sonic: simplify quant cliping
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Jun 2013 23:22:26 +0000 (01:22 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Jun 2013 23:35:34 +0000 (01:35 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/sonic.c

index fc56f94..85248b1 100644 (file)
@@ -722,10 +722,7 @@ static int sonic_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
         quant = (int)(BASE_QUANT*s->quantization*energy2/SAMPLE_FACTOR);
 //        av_log(avctx, AV_LOG_DEBUG, "quant: %d energy: %f / %f\n", quant, energy1, energy2);
 
-        if (quant < 1)
-            quant = 1;
-        if (quant > 65534)
-            quant = 65534;
+        quant = av_clip(quant, 1, 65534);
 
         set_ue_golomb(&pb, quant);