diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-09-24 10:53:59 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-09-24 10:53:59 +0000 |
commit | 5e746b99959e8cf13af70af4f9f8c772dcc15fc5 (patch) | |
tree | c6188eb02a359ae00c39f7f59298eb758057a47c /libavcodec/ratecontrol.c | |
parent | 99609036675ceb968a53397ab3e051e97a7181fd (diff) | |
download | ffmpeg-5e746b99959e8cf13af70af4f9f8c772dcc15fc5.tar.gz |
darkness masking (lumi masking does only bright stuff now)
Originally committed as revision 967 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ratecontrol.c')
-rw-r--r-- | libavcodec/ratecontrol.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index c84fd223aa..cd0ff81da2 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -465,6 +465,7 @@ static void update_predictor(Predictor *p, double q, double var, double size) static void adaptive_quantization(MpegEncContext *s, double q){ int i; const float lumi_masking= s->avctx->lumi_masking / (128.0*128.0); + const float dark_masking= s->avctx->dark_masking / (128.0*128.0); const float temp_cplx_masking= s->avctx->temporal_cplx_masking; const float spatial_cplx_masking = s->avctx->spatial_cplx_masking; const float p_masking = s->avctx->p_masking; @@ -492,7 +493,11 @@ static void adaptive_quantization(MpegEncContext *s, double q){ factor= pow(temp_cplx, - temp_cplx_masking); } factor*=pow(spat_cplx, - spatial_cplx_masking); - factor*= (1.0 - (lumi-128)*(lumi-128)*lumi_masking); + + if(lumi>127) + factor*= (1.0 - (lumi-128)*(lumi-128)*lumi_masking); + else + factor*= (1.0 - (lumi-128)*(lumi-128)*dark_masking); if(factor<0.00001) factor= 0.00001; |