| 1 |
/* |
| 2 |
* copyright (c) 2001 Fabrice Bellard |
| 3 |
* |
| 4 |
* This file is part of FFmpeg. |
| 5 |
* |
| 6 |
* FFmpeg is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 2.1 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* FFmpeg is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with FFmpeg; if not, see <http://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef AVCODEC_H |
| 21 |
#define AVCODEC_H |
| 22 |
|
| 23 |
/* Just a heavily bastardized version of the original file from |
| 24 |
* ffmpeg, just enough to get resample2.c to compile without |
| 25 |
* modification -- Lennart */ |
| 26 |
|
| 27 |
#if !defined(PACKAGE) && defined(HAVE_CONFIG_H) |
| 28 |
#include <config.h> |
| 29 |
#endif |
| 30 |
|
| 31 |
#include <sys/types.h> |
| 32 |
#include <inttypes.h> |
| 33 |
#include <math.h> |
| 34 |
#include <string.h> |
| 35 |
#include <stdlib.h> |
| 36 |
#include <assert.h> |
| 37 |
|
| 38 |
#define av_mallocz(l) calloc(1, (l)) |
| 39 |
#define av_malloc(l) malloc(l) |
| 40 |
#define av_realloc(p,l) realloc((p),(l)) |
| 41 |
#define av_free(p) free(p) |
| 42 |
|
| 43 |
static inline void av_freep(void *k) { |
| 44 |
void **p = k; |
| 45 |
|
| 46 |
if (p) { |
| 47 |
free(*p); |
| 48 |
*p = NULL; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
static inline int av_clip(int a, int amin, int amax) |
| 53 |
{ |
| 54 |
if (a < amin) return amin; |
| 55 |
else if (a > amax) return amax; |
| 56 |
else return a; |
| 57 |
} |
| 58 |
|
| 59 |
#define av_log(a,b,c) |
| 60 |
|
| 61 |
#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) |
| 62 |
#define FFSIGN(a) ((a) > 0 ? 1 : -1) |
| 63 |
|
| 64 |
#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) |
| 65 |
#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) |
| 66 |
|
| 67 |
struct AVResampleContext; |
| 68 |
struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); |
| 69 |
int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); |
| 70 |
void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); |
| 71 |
void av_resample_close(struct AVResampleContext *c); |
| 72 |
void av_build_filter(int16_t *filter, double factor, int tap_count, int phase_count, int scale, int type); |
| 73 |
|
| 74 |
/* |
| 75 |
* crude lrintf for non-C99 systems. |
| 76 |
*/ |
| 77 |
#ifndef HAVE_LRINTF |
| 78 |
#define lrintf(x) ((long int)(x)) |
| 79 |
#endif |
| 80 |
|
| 81 |
#endif /* AVCODEC_H */ |