From patchwork Tue Aug 8 07:40:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 4651 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp3901621vsu; Tue, 8 Aug 2017 00:40:43 -0700 (PDT) X-Received: by 10.223.160.26 with SMTP id k26mr1967445wrk.121.1502178043664; Tue, 08 Aug 2017 00:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502178043; cv=none; d=google.com; s=arc-20160816; b=0rQJdDvBF/7pu5uHjHbiolLuHunco7gh/dUzB6UP1g1euDeQ0yUgIJeKF0wK4eiPKs cNGg/uj72wrQO7CwoDrOVvkmKaU++2AUxvxtQivx8202uE7bxY2BzbUmyQdMnnaNClTb D9gAGAxzbW1kDrnIWu20OCOU+yOJMxRacqX/BJO+sEJaX3wgaKnQKtmrywq3HGvbEom4 N1ylWYeFAf7IvBEF/cv7nbHjyxw9gabg8yNF42S8RZGOamXeBqoquk73EO9BA+sgOoRy qU3mZyvAHSLwSg9YIDMDk5ss0Ig9Vs8lE/D5RPphvYug4FpIVofli1cLmhlH2kSEc9qA ua8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:content-disposition:content-language :mime-version:user-agent:date:message-id:from:to:dkim-signature :delivered-to:arc-authentication-results; bh=Ih1SDi6ZuyqPcHEkT3wnaFybHqKk0NjEFaUXrOfcKdw=; b=V7NYmtEDKkmtIEOGrF9fyeJPGrYMYbl1nXco4GTSjFb9HuGIcZC/W4lKQTnRAKiUll qea0fb5V1B+2dPTlGLQgPb8YuUVbfE2clAVha7oMyVSsYUWLpOP0qzs6Y9G1MK8Z8ziA 7DuK43qNUXCxUuE+F7bQfPowVqocA0Gep6jWQx2blCrZNuLWHH6cO9+65KtZNdeKS9k5 TQgTPwQfmNfwgnxXugpumBQf1QT7TwSns6CAvzlfPWVLAO2Tee8+an3g4k/7EpeoCLe7 IdJo82rVX+dj49fRuSNdE9hR+r26X4N6kusjS3nWd2PcULN5vk9kg1BrKFYBJz1NJYiQ jBcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=I6YZ5iJy; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y124si716909wmb.268.2017.08.08.00.40.43; Tue, 08 Aug 2017 00:40:43 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=I6YZ5iJy; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 04C6B68991C; Tue, 8 Aug 2017 10:40:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f54.google.com (mail-pg0-f54.google.com [74.125.83.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 32D89680957 for ; Tue, 8 Aug 2017 10:40:32 +0300 (EEST) Received: by mail-pg0-f54.google.com with SMTP id l64so11568754pge.5 for ; Tue, 08 Aug 2017 00:40:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=km7u9nF3HAAOu9aBhnuyPIA9rhqNBRFgSUzXMRWXWeY=; b=I6YZ5iJyhA/Oarx92ZD9k6fc4wRGumSBWHwEeun6lVctNnO8kEdIjkdf/QEVzQu3RU rPTCyDgcsmOXmpv0wupDiGBn5YgN3wGT5o7UN8ymQV7fku+mgnqVFHwCPCZ8DYACcY3U gybZR94jOX3n5ICqv2o89yFdIr+5AK9V9gqhj1eHfZIgqn3CyzUgzunt93gaz1xFQ7fL uwybA15qpw2J9X4b0+XbSX6+zmN0cxaKPPqrJGzSjZ0AwtBdwzVk4E/Gyys9/x8lO5Ag AEsuIBViyXHrVIsLAuH+LIq1CVp6ffFPUHNfO6eCqVd2cJzvak1xaE7kfCDvoZxS/vLq 1fVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=km7u9nF3HAAOu9aBhnuyPIA9rhqNBRFgSUzXMRWXWeY=; b=iiSAhXQUwqZkT4mUDPIAz/wTnKpljFyLa+QScQwClicrhgRF4O8m2Bx0tXiChedArH jf9jxhm1x39PDRJR8BF7uhKjXJdYSO0iZ3xydVBVuUTBvmU+Vlj7VyDhje83V5iFIwMF tB05v+NlDrey0kbqi7HbI8vnFhkc9MyX915eg6sUce/pZ2uBim8/fyq+7xTlJ+p9tRGg 7a2lI50lNJ/rTr61S6x3bGPKILxEsZFSThz1I5lF4Mgo623kyeY1dvnfhnRJXrqTzffq WZbebqoCfgyqjriX8vrtg+vh1xnN7cPf/LbRwRFGzvjDPWSGnMvN5yP5iHE831uUVjOm LFNg== X-Gm-Message-State: AHYfb5jIXL9wk2kNd/IQzolZMnOQXeocGuhsQ8BVAgDc8Y4z0OLnKb8B dr+pTeakg8dlapZn X-Received: by 10.98.215.74 with SMTP id v10mr3409111pfl.314.1502178032432; Tue, 08 Aug 2017 00:40:32 -0700 (PDT) Received: from [10.67.68.30] (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by smtp.gmail.com with ESMTPSA id p68sm1511363pfj.48.2017.08.08.00.40.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Aug 2017 00:40:31 -0700 (PDT) To: FFmpeg development discussions and patches , Mark Thompson From: Jun Zhao Message-ID: Date: Tue, 8 Aug 2017 15:40:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-US Content-Disposition: attachment; filename*0="0001-lavc-vaapi_encode_h264-add-cabac-option-support.patch" X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] [PATCH] lavc/vaapi_encode_h264: add "cabac" option support 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From c95be027e1f109fbcec3102371a6cb0cbfc7e551 Mon Sep 17 00:00:00 2001 From: Jun Zhao Date: Tue, 8 Aug 2017 03:33:53 -0400 Subject: [PATCH] lavc/vaapi_encode_h264: add "cabac" option support 0 means no-cabac, 1 means enable cabac when profile > baseline. Default is enable cabac. Signed-off-by: Yi A Wang Signed-off-by: Jun Zhao --- libavcodec/vaapi_encode_h264.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index f9fcd805a4..8107dc62a8 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -168,6 +168,7 @@ typedef struct VAAPIEncodeH264Options { int qp; int quality; int low_power; + int cabac; } VAAPIEncodeH264Options; @@ -783,6 +784,8 @@ static int vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx) VAEncPictureParameterBufferH264 *vpic = ctx->codec_picture_params; VAAPIEncodeH264Context *priv = ctx->priv_data; VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params; + VAAPIEncodeH264Options *opt = + (VAAPIEncodeH264Options*)ctx->codec_options_data; int i; { @@ -927,8 +930,12 @@ static int vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx) vpic->num_ref_idx_l0_active_minus1 = 0; vpic->num_ref_idx_l1_active_minus1 = 0; - vpic->pic_fields.bits.entropy_coding_mode_flag = - ((avctx->profile & 0xff) != 66); + if (opt->cabac) { + vpic->pic_fields.bits.entropy_coding_mode_flag = + ((avctx->profile & 0xff) != 66); + } else { + vpic->pic_fields.bits.entropy_coding_mode_flag = 0; + } vpic->pic_fields.bits.weighted_pred_flag = 0; vpic->pic_fields.bits.weighted_bipred_idc = 0; vpic->pic_fields.bits.transform_8x8_mode_flag = @@ -1283,6 +1290,8 @@ static const AVOption vaapi_encode_h264_options[] = { { "low_power", "Use low-power encoding mode (experimental: only supported " "on some platforms, does not support all features)", OFFSET(low_power), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS }, + { "cabac", "Use CABAC (Context-adaptive binary arithmetic coding) entropy coding.", + OFFSET(cabac), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS }, { NULL }, };