Mercurial > libavcodec.hg
comparison resample2.c @ 4700:e210bbc7dd19 libavcodec
select more sensible default windows (= attenuation beyond the dynamic range of your input is silly if it negatively affects other parameters)
| author | michael |
|---|---|
| date | Thu, 22 Mar 2007 00:16:41 +0000 |
| parents | 4040ca52670a |
| children | 5fa551fb7640 |
comparison
equal
deleted
inserted
replaced
| 4699:4040ca52670a | 4700:e210bbc7dd19 |
|---|---|
| 35 | 35 |
| 36 #define FELEM int16_t | 36 #define FELEM int16_t |
| 37 #define FELEM2 int32_t | 37 #define FELEM2 int32_t |
| 38 #define FELEM_MAX INT16_MAX | 38 #define FELEM_MAX INT16_MAX |
| 39 #define FELEM_MIN INT16_MIN | 39 #define FELEM_MIN INT16_MIN |
| 40 #define WINDOW_TYPE 9 | |
| 40 #else | 41 #else |
| 41 #define FILTER_SHIFT 30 | 42 #define FILTER_SHIFT 30 |
| 42 | 43 |
| 43 #define FELEM int32_t | 44 #define FELEM int32_t |
| 44 #define FELEM2 int64_t | 45 #define FELEM2 int64_t |
| 45 #define FELEM_MAX INT32_MAX | 46 #define FELEM_MAX INT32_MAX |
| 46 #define FELEM_MIN INT32_MIN | 47 #define FELEM_MIN INT32_MIN |
| 48 #define WINDOW_TYPE 12 | |
| 47 #endif | 49 #endif |
| 48 | 50 |
| 49 | 51 |
| 50 typedef struct AVResampleContext{ | 52 typedef struct AVResampleContext{ |
| 51 FELEM *filter_bank; | 53 FELEM *filter_bank; |
| 175 c->phase_mask= phase_count-1; | 177 c->phase_mask= phase_count-1; |
| 176 c->linear= linear; | 178 c->linear= linear; |
| 177 | 179 |
| 178 c->filter_length= FFMAX((int)ceil(filter_size/factor), 1); | 180 c->filter_length= FFMAX((int)ceil(filter_size/factor), 1); |
| 179 c->filter_bank= av_mallocz(c->filter_length*(phase_count+1)*sizeof(FELEM)); | 181 c->filter_bank= av_mallocz(c->filter_length*(phase_count+1)*sizeof(FELEM)); |
| 180 av_build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<<FILTER_SHIFT, 1); | 182 av_build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<<FILTER_SHIFT, WINDOW_TYPE); |
| 181 memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c->filter_length-1)*sizeof(FELEM)); | 183 memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c->filter_length-1)*sizeof(FELEM)); |
| 182 c->filter_bank[c->filter_length*phase_count]= c->filter_bank[c->filter_length - 1]; | 184 c->filter_bank[c->filter_length*phase_count]= c->filter_bank[c->filter_length - 1]; |
| 183 | 185 |
| 184 c->src_incr= out_rate; | 186 c->src_incr= out_rate; |
| 185 c->ideal_dst_incr= c->dst_incr= in_rate * phase_count; | 187 c->ideal_dst_incr= c->dst_incr= in_rate * phase_count; |
