Commit 64db5a1a authored by Clément Bœsch's avatar Clément Bœsch

swr: drop 'AV' prefix from ResampleContext.

This type/struct is not part of the public API.
parent fc6351d0
......@@ -56,7 +56,7 @@
#endif
typedef struct AVResampleContext{
typedef struct ResampleContext {
const AVClass *av_class;
FELEM *filter_bank;
int filter_length;
......@@ -70,7 +70,7 @@ typedef struct AVResampleContext{
int phase_mask;
int linear;
double factor;
}AVResampleContext;
} ResampleContext;
/**
* 0th order modified bessel function of the first kind.
......@@ -199,13 +199,13 @@ static int build_filter(FELEM *filter, double factor, int tap_count, int phase_c
return 0;
}
AVResampleContext *swr_resample_init(AVResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
ResampleContext *swr_resample_init(ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
double factor= FFMIN(out_rate * cutoff / in_rate, 1.0);
int phase_count= 1<<phase_shift;
if (!c || c->phase_shift != phase_shift || c->linear!=linear || c->factor != factor
|| c->filter_length != FFMAX((int)ceil(filter_size/factor), 1)) {
c = av_mallocz(sizeof(AVResampleContext));
c = av_mallocz(sizeof(*c));
if (!c)
return NULL;
......@@ -238,7 +238,7 @@ error:
return NULL;
}
void swr_resample_free(AVResampleContext **c){
void swr_resample_free(ResampleContext **c){
if(!*c)
return;
av_freep(&(*c)->filter_bank);
......@@ -246,13 +246,13 @@ void swr_resample_free(AVResampleContext **c){
}
void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_distance){
AVResampleContext *c= s->resample;
ResampleContext *c= s->resample;
// sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;
c->compensation_distance= compensation_distance;
c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;
}
int swr_resample(AVResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx){
int swr_resample(ResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx){
int dst_index, i;
int index= c->index;
int frac= c->frac;
......@@ -341,7 +341,7 @@ av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->comp
return dst_index;
}
int swr_multiple_resample(AVResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){
int swr_multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){
int i, ret= -1;
for(i=0; i<dst->ch_count; i++){
......
......@@ -61,7 +61,7 @@ typedef struct SwrContext { //FIXME find unused fields
struct AudioConvert *in_convert;
struct AudioConvert *out_convert;
struct AudioConvert *full_convert;
struct AVResampleContext *resample;
struct ResampleContext *resample;
float matrix[SWR_CH_MAX][SWR_CH_MAX];
int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX];
......@@ -70,11 +70,11 @@ typedef struct SwrContext { //FIXME find unused fields
//TODO callbacks for asm optims
}SwrContext;
struct AVResampleContext *swr_resample_init(struct AVResampleContext *, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
void swr_resample_free(struct AVResampleContext **c);
int swr_multiple_resample(struct AVResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
void swr_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
int swr_resample(struct AVResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx);
struct ResampleContext *swr_resample_init(struct ResampleContext *, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
void swr_resample_free(struct ResampleContext **c);
int swr_multiple_resample(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
void swr_resample_compensate(struct ResampleContext *c, int sample_delta, int compensation_distance);
int swr_resample(struct ResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx);
int swr_rematrix_init(SwrContext *s);
int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment