Browse code

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

Clément Bœsch authored on 2011/11/16 16:12:48
Showing 4 changed files
... ...
@@ -84,7 +84,7 @@ static int sane_layout(int64_t layout){
84 84
     return 1;
85 85
 }
86 86
 
87
-int swr_rematrix_init(SwrContext *s){
87
+int swri_rematrix_init(SwrContext *s){
88 88
     int i, j, out_i;
89 89
     double matrix[64][64]={{0}};
90 90
     int64_t unaccounted= s->in_ch_layout & ~s->out_ch_layout;
... ...
@@ -239,7 +239,7 @@ int swr_rematrix_init(SwrContext *s){
239 239
     return 0;
240 240
 }
241 241
 
242
-int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy){
242
+int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy){
243 243
     int out_i, in_i, i, j;
244 244
 
245 245
     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
199 199
     return 0;
200 200
 }
201 201
 
202
-ResampleContext *swr_resample_init(ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
202
+ResampleContext *swri_resample_init(ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
203 203
     double factor= FFMIN(out_rate * cutoff / in_rate, 1.0);
204 204
     int phase_count= 1<<phase_shift;
205 205
 
... ...
@@ -238,7 +238,7 @@ error:
238 238
     return NULL;
239 239
 }
240 240
 
241
-void swr_resample_free(ResampleContext **c){
241
+void swri_resample_free(ResampleContext **c){
242 242
     if(!*c)
243 243
         return;
244 244
     av_freep(&(*c)->filter_bank);
... ...
@@ -252,7 +252,7 @@ void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_dis
252 252
     c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;
253 253
 }
254 254
 
255
-int swr_resample(ResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx){
255
+int swri_resample(ResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx){
256 256
     int dst_index, i;
257 257
     int index= c->index;
258 258
     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
341 341
     return dst_index;
342 342
 }
343 343
 
344
-int swr_multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){
344
+int swri_multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){
345 345
     int i, ret= -1;
346 346
 
347 347
     for(i=0; i<dst->ch_count; i++){
348
-        ret= swr_resample(c, (short*)dst->ch[i], (const short*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count);
348
+        ret= swri_resample(c, (short*)dst->ch[i], (const short*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count);
349 349
     }
350 350
 
351 351
     return ret;
... ...
@@ -122,7 +122,7 @@ void swr_free(SwrContext **ss){
122 122
         swri_audio_convert_free(&s-> in_convert);
123 123
         swri_audio_convert_free(&s->out_convert);
124 124
         swri_audio_convert_free(&s->full_convert);
125
-        swr_resample_free(&s->resample);
125
+        swri_resample_free(&s->resample);
126 126
     }
127 127
 
128 128
     av_freep(ss);
... ...
@@ -168,9 +168,9 @@ int swr_init(SwrContext *s){
168 168
 
169 169
 
170 170
     if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){
171
-        s->resample = swr_resample_init(s->resample, s->out_sample_rate, s->in_sample_rate, 16, 10, 0, 0.8);
171
+        s->resample = swri_resample_init(s->resample, s->out_sample_rate, s->in_sample_rate, 16, 10, 0, 0.8);
172 172
     }else
173
-        swr_resample_free(&s->resample);
173
+        swri_resample_free(&s->resample);
174 174
     if(s->int_sample_fmt != AV_SAMPLE_FMT_S16 && s->resample){
175 175
         av_log(s, AV_LOG_ERROR, "Resampling only supported with internal s16 currently\n"); //FIXME
176 176
         return -1;
... ...
@@ -238,7 +238,7 @@ av_assert0(s->out.ch_count);
238 238
     s->in_buffer.planar = s->postin.planar = s->midbuf.planar = s->preout.planar =  1;
239 239
 
240 240
 
241
-    if(s->rematrix && swr_rematrix_init(s)<0)
241
+    if(s->rematrix && swri_rematrix_init(s)<0)
242 242
         return -1;
243 243
 
244 244
     return 0;
... ...
@@ -392,10 +392,10 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
392 392
         if(postin != midbuf)
393 393
             out_count= resample(s, midbuf, out_count, postin, in_count);
394 394
         if(midbuf != preout)
395
-            swr_rematrix(s, preout, midbuf, out_count, preout==out);
395
+            swri_rematrix(s, preout, midbuf, out_count, preout==out);
396 396
     }else{
397 397
         if(postin != midbuf)
398
-            swr_rematrix(s, midbuf, postin, in_count, midbuf==out);
398
+            swri_rematrix(s, midbuf, postin, in_count, midbuf==out);
399 399
         if(midbuf != preout)
400 400
             out_count= resample(s, preout, out_count, midbuf, in_count);
401 401
     }
... ...
@@ -439,7 +439,7 @@ static int resample(SwrContext *s, AudioData *out_param, int out_count,
439 439
         int ret, size, consumed;
440 440
         if(!s->resample_in_constraint && s->in_buffer_count){
441 441
             buf_set(&tmp, &s->in_buffer, s->in_buffer_index);
442
-            ret= swr_multiple_resample(s->resample, &out, out_count, &tmp, s->in_buffer_count, &consumed);
442
+            ret= swri_multiple_resample(s->resample, &out, out_count, &tmp, s->in_buffer_count, &consumed);
443 443
             out_count -= ret;
444 444
             ret_sum += ret;
445 445
             buf_set(&out, &out, ret);
... ...
@@ -459,7 +459,7 @@ static int resample(SwrContext *s, AudioData *out_param, int out_count,
459 459
 
460 460
         if(in_count && !s->in_buffer_count){
461 461
             s->in_buffer_index=0;
462
-            ret= swr_multiple_resample(s->resample, &out, out_count, &in, in_count, &consumed);
462
+            ret= swri_multiple_resample(s->resample, &out, out_count, &in, in_count, &consumed);
463 463
             out_count -= ret;
464 464
             ret_sum += ret;
465 465
             buf_set(&out, &out, ret);
... ...
@@ -70,12 +70,12 @@ typedef struct SwrContext {          //FIXME find unused fields
70 70
     //TODO callbacks for asm optims
71 71
 }SwrContext;
72 72
 
73
-struct ResampleContext *swr_resample_init(struct ResampleContext *, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
74
-void swr_resample_free(struct ResampleContext **c);
75
-int swr_multiple_resample(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
76
-void swr_resample_compensate(struct ResampleContext *c, int sample_delta, int compensation_distance);
77
-int swr_resample(struct ResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx);
73
+struct ResampleContext *swri_resample_init(struct ResampleContext *, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
74
+void swri_resample_free(struct ResampleContext **c);
75
+int swri_multiple_resample(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
76
+void swri_resample_compensate(struct ResampleContext *c, int sample_delta, int compensation_distance);
77
+int swri_resample(struct ResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx);
78 78
 
79
-int swr_rematrix_init(SwrContext *s);
80
-int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy);
79
+int swri_rematrix_init(SwrContext *s);
80
+int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy);
81 81
 #endif