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

swr: use "swri_" prefix instead of "swr_" for the private API.

parent 64db5a1a
......@@ -84,7 +84,7 @@ static int sane_layout(int64_t layout){
return 1;
}
int swr_rematrix_init(SwrContext *s){
int swri_rematrix_init(SwrContext *s){
int i, j, out_i;
double matrix[64][64]={{0}};
int64_t unaccounted= s->in_ch_layout & ~s->out_ch_layout;
......@@ -239,7 +239,7 @@ int swr_rematrix_init(SwrContext *s){
return 0;
}
int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy){
int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy){
int out_i, in_i, i, j;
av_assert0(out->ch_count == av_get_channel_layout_nb_channels(s->out_ch_layout));
......
......@@ -199,7 +199,7 @@ static int build_filter(FELEM *filter, double factor, int tap_count, int phase_c
return 0;
}
ResampleContext *swr_resample_init(ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
ResampleContext *swri_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;
......@@ -238,7 +238,7 @@ error:
return NULL;
}
void swr_resample_free(ResampleContext **c){
void swri_resample_free(ResampleContext **c){
if(!*c)
return;
av_freep(&(*c)->filter_bank);
......@@ -252,7 +252,7 @@ void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_dis
c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;
}
int swr_resample(ResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx){
int swri_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,11 +341,11 @@ 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(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){
int swri_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++){
ret= swr_resample(c, (short*)dst->ch[i], (const short*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count);
ret= swri_resample(c, (short*)dst->ch[i], (const short*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count);
}
return ret;
......
......@@ -122,7 +122,7 @@ void swr_free(SwrContext **ss){
swri_audio_convert_free(&s-> in_convert);
swri_audio_convert_free(&s->out_convert);
swri_audio_convert_free(&s->full_convert);
swr_resample_free(&s->resample);
swri_resample_free(&s->resample);
}
av_freep(ss);
......@@ -168,9 +168,9 @@ int swr_init(SwrContext *s){
if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){
s->resample = swr_resample_init(s->resample, s->out_sample_rate, s->in_sample_rate, 16, 10, 0, 0.8);
s->resample = swri_resample_init(s->resample, s->out_sample_rate, s->in_sample_rate, 16, 10, 0, 0.8);
}else
swr_resample_free(&s->resample);
swri_resample_free(&s->resample);
if(s->int_sample_fmt != AV_SAMPLE_FMT_S16 && s->resample){
av_log(s, AV_LOG_ERROR, "Resampling only supported with internal s16 currently\n"); //FIXME
return -1;
......@@ -238,7 +238,7 @@ av_assert0(s->out.ch_count);
s->in_buffer.planar = s->postin.planar = s->midbuf.planar = s->preout.planar = 1;
if(s->rematrix && swr_rematrix_init(s)<0)
if(s->rematrix && swri_rematrix_init(s)<0)
return -1;
return 0;
......@@ -392,10 +392,10 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
if(postin != midbuf)
out_count= resample(s, midbuf, out_count, postin, in_count);
if(midbuf != preout)
swr_rematrix(s, preout, midbuf, out_count, preout==out);
swri_rematrix(s, preout, midbuf, out_count, preout==out);
}else{
if(postin != midbuf)
swr_rematrix(s, midbuf, postin, in_count, midbuf==out);
swri_rematrix(s, midbuf, postin, in_count, midbuf==out);
if(midbuf != preout)
out_count= resample(s, preout, out_count, midbuf, in_count);
}
......@@ -439,7 +439,7 @@ static int resample(SwrContext *s, AudioData *out_param, int out_count,
int ret, size, consumed;
if(!s->resample_in_constraint && s->in_buffer_count){
buf_set(&tmp, &s->in_buffer, s->in_buffer_index);
ret= swr_multiple_resample(s->resample, &out, out_count, &tmp, s->in_buffer_count, &consumed);
ret= swri_multiple_resample(s->resample, &out, out_count, &tmp, s->in_buffer_count, &consumed);
out_count -= ret;
ret_sum += ret;
buf_set(&out, &out, ret);
......@@ -459,7 +459,7 @@ static int resample(SwrContext *s, AudioData *out_param, int out_count,
if(in_count && !s->in_buffer_count){
s->in_buffer_index=0;
ret= swr_multiple_resample(s->resample, &out, out_count, &in, in_count, &consumed);
ret= swri_multiple_resample(s->resample, &out, out_count, &in, in_count, &consumed);
out_count -= ret;
ret_sum += ret;
buf_set(&out, &out, ret);
......
......@@ -70,12 +70,12 @@ typedef struct SwrContext { //FIXME find unused fields
//TODO callbacks for asm optims
}SwrContext;
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);
struct ResampleContext *swri_resample_init(struct ResampleContext *, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
void swri_resample_free(struct ResampleContext **c);
int swri_multiple_resample(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
void swri_resample_compensate(struct ResampleContext *c, int sample_delta, int compensation_distance);
int swri_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);
int swri_rematrix_init(SwrContext *s);
int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy);
#endif
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