From patchwork Thu Feb 16 16:20:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 2578 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp2553020vsb; Thu, 16 Feb 2017 08:21:09 -0800 (PST) X-Received: by 10.223.179.15 with SMTP id j15mr2857588wrd.159.1487262069365; Thu, 16 Feb 2017 08:21:09 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 33si9880882wrb.160.2017.02.16.08.21.08; Thu, 16 Feb 2017 08:21:09 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DC281689893; Thu, 16 Feb 2017 18:20:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-1.mx.upcmail.net (vie01a-qmta-pe01-1.mx.upcmail.net [62.179.121.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B9DB068972E for ; Thu, 16 Feb 2017 18:20:52 +0200 (EET) Received: from [172.31.218.39] (helo=vie01a-dmta-pe03-3.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1ceOni-0002Gw-FG for ffmpeg-devel@ffmpeg.org; Thu, 16 Feb 2017 17:20:58 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1ceOnc-0003Vd-Ev for ffmpeg-devel@ffmpeg.org; Thu, 16 Feb 2017 17:20:52 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id lULj1u00R0S5wYM01ULk1n; Thu, 16 Feb 2017 17:20:44 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 16 Feb 2017 17:20:42 +0100 Message-Id: <20170216162042.3518-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH] avcodec/vaapi_encode_vp8: Use av_clip_uintp2() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Its used elsewhere for 2^p-1 cliping Signed-off-by: Michael Niedermayer --- 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;