comparison psymodel.c @ 11579:9db3fbaba639 libavcodec

aacenc: Don't lowpass the input unless specifically requested. The heuristic for estimating a good cutoff is busted.
author alexc
date Fri, 02 Apr 2010 14:19:39 +0000
parents a79d7debe431
children 0d0446295060
comparison
equal deleted inserted replaced
11578:6bc036ad8ff9 11579:9db3fbaba639
78 78
79 av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *avctx) 79 av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *avctx)
80 { 80 {
81 FFPsyPreprocessContext *ctx; 81 FFPsyPreprocessContext *ctx;
82 int i; 82 int i;
83 float cutoff_coeff; 83 float cutoff_coeff = 0;
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->cutoff > 0) 87 if (avctx->cutoff > 0)
88 cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate; 88 cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate;
89 else if (avctx->flags & CODEC_FLAG_QSCALE)
90 cutoff_coeff = 1.0f / av_clip(1 + avctx->global_quality / FF_QUALITY_SCALE, 1, 8);
91 else
92 cutoff_coeff = avctx->bit_rate / (4.0f * avctx->sample_rate * avctx->channels);
93 89
90 if (cutoff_coeff)
94 ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, 91 ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS,
95 FILT_ORDER, cutoff_coeff, 0.0, 0.0); 92 FILT_ORDER, cutoff_coeff, 0.0, 0.0);
96 if (ctx->fcoeffs) { 93 if (ctx->fcoeffs) {
97 ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels); 94 ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels);
98 for (i = 0; i < avctx->channels; i++) 95 for (i = 0; i < avctx->channels; i++)