Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: patched-ffmpeg-mt/libavcodec/resample2.c

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * audio resampling 2 * audio resampling
3 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> 3 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
4 * 4 *
5 * This file is part of FFmpeg. 5 * This file is part of FFmpeg.
6 * 6 *
7 * FFmpeg is free software; you can redistribute it and/or 7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 return v; 89 return v;
90 } 90 }
91 91
92 /** 92 /**
93 * builds a polyphase filterbank. 93 * builds a polyphase filterbank.
94 * @param factor resampling factor 94 * @param factor resampling factor
95 * @param scale wanted sum of coefficients for each filter 95 * @param scale wanted sum of coefficients for each filter
96 * @param type 0->cubic, 1->blackman nuttall windowed sinc, 2..16->kaiser window ed sinc beta=2..16 96 * @param type 0->cubic, 1->blackman nuttall windowed sinc, 2..16->kaiser window ed sinc beta=2..16
97 */ 97 */
98 void av_build_filter(FELEM *filter, double factor, int tap_count, int phase_coun t, int scale, int type){ 98 static void build_filter(FELEM *filter, double factor, int tap_count, int phase_ count, int scale, int type){
99 int ph, i; 99 int ph, i;
100 double x, y, w, tab[tap_count]; 100 double x, y, w, tab[tap_count];
101 const int center= (tap_count-1)/2; 101 const int center= (tap_count-1)/2;
102 102
103 /* if upsampling, only need to interpolate, no filter */ 103 /* if upsampling, only need to interpolate, no filter */
104 if (factor > 1.0) 104 if (factor > 1.0)
105 factor = 1.0; 105 factor = 1.0;
106 106
107 for(ph=0;ph<phase_count;ph++) { 107 for(ph=0;ph<phase_count;ph++) {
108 double norm = 0; 108 double norm = 0;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 AVResampleContext *c= av_mallocz(sizeof(AVResampleContext)); 182 AVResampleContext *c= av_mallocz(sizeof(AVResampleContext));
183 double factor= FFMIN(out_rate * cutoff / in_rate, 1.0); 183 double factor= FFMIN(out_rate * cutoff / in_rate, 1.0);
184 int phase_count= 1<<phase_shift; 184 int phase_count= 1<<phase_shift;
185 185
186 c->phase_shift= phase_shift; 186 c->phase_shift= phase_shift;
187 c->phase_mask= phase_count-1; 187 c->phase_mask= phase_count-1;
188 c->linear= linear; 188 c->linear= linear;
189 189
190 c->filter_length= FFMAX((int)ceil(filter_size/factor), 1); 190 c->filter_length= FFMAX((int)ceil(filter_size/factor), 1);
191 c->filter_bank= av_mallocz(c->filter_length*(phase_count+1)*sizeof(FELEM)); 191 c->filter_bank= av_mallocz(c->filter_length*(phase_count+1)*sizeof(FELEM));
192 av_build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<<FI LTER_SHIFT, WINDOW_TYPE); 192 build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<<FILTE R_SHIFT, WINDOW_TYPE);
193 memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c-> filter_length-1)*sizeof(FELEM)); 193 memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c-> filter_length-1)*sizeof(FELEM));
194 c->filter_bank[c->filter_length*phase_count]= c->filter_bank[c->filter_lengt h - 1]; 194 c->filter_bank[c->filter_length*phase_count]= c->filter_bank[c->filter_lengt h - 1];
195 195
196 c->src_incr= out_rate; 196 c->src_incr= out_rate;
197 c->ideal_dst_incr= c->dst_incr= in_rate * phase_count; 197 c->ideal_dst_incr= c->dst_incr= in_rate * phase_count;
198 c->index= -phase_count*((c->filter_length-1)/2); 198 c->index= -phase_count*((c->filter_length-1)/2);
199 199
200 return c; 200 return c;
201 } 201 }
202 202
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 #if 0 293 #if 0
294 if(update_ctx && !c->compensation_distance){ 294 if(update_ctx && !c->compensation_distance){
295 #undef rand 295 #undef rand
296 av_resample_compensate(c, rand() % (8000*2) - 8000, 8000*2); 296 av_resample_compensate(c, rand() % (8000*2) - 8000, 8000*2);
297 av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->comp ensation_distance); 297 av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->comp ensation_distance);
298 } 298 }
299 #endif 299 #endif
300 300
301 return dst_index; 301 return dst_index;
302 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698