[FFmpeg-cvslog] sonic: simplify quant cliping
Michael Niedermayer
git at videolan.org
Sun Jun 23 01:44:06 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jun 23 01:22:26 2013 +0200| [4ec7ef56bd03e9c5bc51ba1923ee535a8f1b3fd0] | committer: Michael Niedermayer
sonic: simplify quant cliping
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ec7ef56bd03e9c5bc51ba1923ee535a8f1b3fd0
---
libavcodec/sonic.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index fc56f94..85248b1 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -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);
More information about the ffmpeg-cvslog
mailing list