aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/sonic.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-23 01:22:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-23 01:35:34 +0200
commit4ec7ef56bd03e9c5bc51ba1923ee535a8f1b3fd0 (patch)
tree9622860aa1e9033410f40084c0ab234e0a80d707 /libavcodec/sonic.c
parentbcb42fb6dbef6da862f3445b2c5ebeb677581807 (diff)
downloadffmpeg-4ec7ef56bd03e9c5bc51ba1923ee535a8f1b3fd0.tar.gz
sonic: simplify quant cliping
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/sonic.c')
-rw-r--r--libavcodec/sonic.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index fc56f94a4f..85248b1579 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);