[FFmpeg-devel] [PATCH] avcodec/vaapi_encode_vp8: Use av_clip_uintp2()

Michael Niedermayer michael at niedermayer.cc
Thu Feb 16 18:20:42 EET 2017


Its used elsewhere for 2^p-1 cliping

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/vaapi_encode_vp8.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c
index 4a1c85e66c..3d3831c46d 100644
--- a/libavcodec/vaapi_encode_vp8.c
+++ b/libavcodec/vaapi_encode_vp8.c
@@ -161,12 +161,12 @@ static av_cold int vaapi_encode_vp8_configure(AVCodecContext *avctx)
     VAAPIEncodeContext     *ctx = avctx->priv_data;
     VAAPIEncodeVP8Context *priv = ctx->priv_data;
 
-    priv->q_index_p = av_clip(avctx->global_quality, 0, 127);
+    priv->q_index_p = av_clip_uintp2(avctx->global_quality, 7);
     if (avctx->i_quant_factor > 0.0)
-        priv->q_index_i = av_clip((avctx->global_quality *
+        priv->q_index_i = av_clip_uintp2((avctx->global_quality *
                                    avctx->i_quant_factor +
                                    avctx->i_quant_offset) + 0.5,
-                                  0, 127);
+                                  7);
     else
         priv->q_index_i = priv->q_index_p;
 
-- 
2.11.0



More information about the ffmpeg-devel mailing list