1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

swr: simplify code by using av_get_bytes_per_sample()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-04-11 09:57:38 +02:00
parent 6e9c634c36
commit f9a2c5bc07
2 changed files with 3 additions and 7 deletions

View File

@ -290,7 +290,7 @@ int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mus
for(out_i=0; out_i<out->ch_count; out_i++){
switch(s->matrix_ch[out_i][0]){
case 0:
memset(out->ch[out_i], 0, len * (s->int_sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(float) : sizeof(int16_t)));
memset(out->ch[out_i], 0, len * av_get_bytes_per_sample(s->int_sample_fmt));
break;
case 1:
in_i= s->matrix_ch[out_i][1];

View File

@ -202,21 +202,17 @@ ResampleContext *swri_resample_init(ResampleContext *c, int out_rate, int in_rat
c->format= format;
c->felem_size= av_get_bytes_per_sample(c->format);
switch(c->format){
case AV_SAMPLE_FMT_S16:
c->felem_size = 2;
c->filter_shift = 15;
break;
case AV_SAMPLE_FMT_S32:
c->felem_size = 4;
c->filter_shift = 30;
break;
case AV_SAMPLE_FMT_FLT:
c->felem_size = 4;
c->filter_shift = 0;
break;
case AV_SAMPLE_FMT_DBL:
c->felem_size = 8;
c->filter_shift = 0;
break;
default: