[FFmpeg-soc] [soc]: r4178 - aacenc/psymodel.c

kostya subversion at mplayerhq.hu
Thu Mar 19 07:49:17 CET 2009


Author: kostya
Date: Thu Mar 19 07:49:16 2009
New Revision: 4178

Log:
Make frequency cutoff coefficient dependent on encoding parameters

Modified:
   aacenc/psymodel.c

Modified: aacenc/psymodel.c
==============================================================================
--- aacenc/psymodel.c	Wed Mar 18 22:19:58 2009	(r4177)
+++ aacenc/psymodel.c	Thu Mar 19 07:49:16 2009	(r4178)
@@ -80,10 +80,17 @@ av_cold struct FFPsyPreprocessContext* f
 {
     FFPsyPreprocessContext *ctx;
     int i;
+    float cutoff_coeff;
     ctx = av_mallocz(sizeof(FFPsyPreprocessContext));
     ctx->avctx = avctx;
+
+    if(avctx->flags & CODEC_FLAG_QSCALE)
+        cutoff_coeff = 1.0f / av_clip(1 + avctx->global_quality / FF_QUALITY_SCALE, 1, 8);
+    else
+        cutoff_coeff = avctx->bit_rate / (4.0f * avctx->sample_rate * avctx->channels);
+
     ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS,
-                                           FILT_ORDER, 0.25, 0.0, 0.0);
+                                           FILT_ORDER, cutoff_coeff, 0.0, 0.0);
     if(ctx->fcoeffs){
         ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels);
         for(i = 0; i < avctx->channels; i++)



More information about the FFmpeg-soc mailing list