comparison psymodel.c @ 9953:a79d7debe431 libavcodec

Use cutoff frequency to adjust bandwidth in the generic psymodel preprocess.
author alexc
date Tue, 14 Jul 2009 05:22:23 +0000
parents 6c1ac45b3097
children 9db3fbaba639
comparison
equal deleted inserted replaced
9952:4b3abcad0628 9953:a79d7debe431
82 int i; 82 int i;
83 float cutoff_coeff; 83 float cutoff_coeff;
84 ctx = av_mallocz(sizeof(FFPsyPreprocessContext)); 84 ctx = av_mallocz(sizeof(FFPsyPreprocessContext));
85 ctx->avctx = avctx; 85 ctx->avctx = avctx;
86 86
87 if (avctx->flags & CODEC_FLAG_QSCALE) 87 if (avctx->cutoff > 0)
88 cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate;
89 else if (avctx->flags & CODEC_FLAG_QSCALE)
88 cutoff_coeff = 1.0f / av_clip(1 + avctx->global_quality / FF_QUALITY_SCALE, 1, 8); 90 cutoff_coeff = 1.0f / av_clip(1 + avctx->global_quality / FF_QUALITY_SCALE, 1, 8);
89 else 91 else
90 cutoff_coeff = avctx->bit_rate / (4.0f * avctx->sample_rate * avctx->channels); 92 cutoff_coeff = avctx->bit_rate / (4.0f * avctx->sample_rate * avctx->channels);
91 93
92 ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, 94 ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS,