From patchwork Wed Aug 16 02:47:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 4715 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp272257vsu; Tue, 15 Aug 2017 19:47:57 -0700 (PDT) X-Received: by 10.28.226.137 with SMTP id z131mr238813wmg.151.1502851677814; Tue, 15 Aug 2017 19:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502851677; cv=none; d=google.com; s=arc-20160816; b=m7en6ZGARxwaSJU2A9O42Z+Plnfbftp0kAwGSP79k4Ya0yqGPEzFWCpH/+3fLnVUu0 iEJz1Pfn5H26KOobjtNxjv9/G29BtjUyRYXAig96Te8QjnUbcBHG9pkGgGOhZhrFvI2Z ylebQZ53JHrETEGfecFW764Mc/luo5uFNopyZVVxAqLKRHHj37lNABMJVyHY7mel1o3d 4a8yI0N0gVhte3dN74IZbhV3EpV1z1t+2kIYmsVM66xT6ZnEWveC+nephw7bMAWKXleU T+vPibtO4veY4FpZuTkdCgN11slCu9zRgNhYutM5yYH1ygWfoYSZLjtnu8RR8XvIBAP5 vSRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :content-language:mime-version:user-agent:date:message-id:from:to :dkim-signature:delivered-to:arc-authentication-results; bh=jFWHz8/Y3Cd0cxNB3aRjVlq3Q1dyOwRqQX74tI/Gkg0=; b=NMMD2VSNKkw6VQqFN7Dgl0fGUtKw1181vDF+24DcMWudAauEw8vz77Ezj7FqMaxrKn BqniDLNSY3uyXL9vEUtVlzQT4e7cMZjT4qWiUj1tQFS6lwGZTv1gHJXfATI5v3MYnlxh 4xb81zymLfScjpAzPsxk42OshWb07k2HT6/faTTyP6ytO1BoXZS59M/xdFiCrPIYNaVA 2ZKEmSLirStpRvRWFLZZw7g2cMWsph+ArHsPhog5knXHj3NvsujngSMi3EFkZo9Ixo1H L9OEb+vTk/QgtS/7DgKC5FAfcOVLqQG0wNdF0hbYlZjrdXMFO/76Hi9Tp9wHqiicFlzu 0TOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=qbSlBcs5; 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 k5si8109534wrd.242.2017.08.15.19.47.56; Tue, 15 Aug 2017 19:47:57 -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=qbSlBcs5; 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 09C306882C5; Wed, 16 Aug 2017 05:47:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF9CF68065E for ; Wed, 16 Aug 2017 05:47:41 +0300 (EEST) Received: by mail-pg0-f68.google.com with SMTP id 83so4092719pgb.4 for ; Tue, 15 Aug 2017 19:47:46 -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=LuyTrEP33icsv9JGn9noF/djK2AYGMbMwQHl4eqRX0E=; b=qbSlBcs5opfWgTKR8SfFcMqKMUgsE/QltkY8BzAeQJ01UgR9GZ7YX2d7sWb/zbcDE0 hj2BG9VuGIoGIzsrW5TxAlRs39krWvsFcoTYiJ8VLbk/HPD0R/ChDXTSeczd+m+OS7Uk hJDgHVCIi17CJ5chKiNIiDTJxYbzVygf0FomUEWr6WuZN+Gw26km5fReBEblMZcFubjd kQyd63NBg5xL70i5oGvG0MRo+yKpRjnAH+gYnnuyeZ0Rt2qHotrqWaHWBy7an6fcpasD tTylfi8YKGUU2ONzMBkjg555rBUtzXRpxJpmq0Nsc6orLvuPlENgPinqEogXRsCahIZ4 Wi3g== 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=LuyTrEP33icsv9JGn9noF/djK2AYGMbMwQHl4eqRX0E=; b=IHtyh7NqFHr+8J5rxQdzAq1tGb+PmC3arF1LLifXnmRtGaNs2YYc7mP24gVfw5Rduu lddO63IBF4p3RP9ltvLfTDcttzUvW40P/grl5qbRcYYzSz4tDCMBN3gwo5rVpt7eukNB brdUAKOs8Amy1XFS2bNDb7NQPXS/kj5a5zhLKTBnaUIDmMJ6CPS+UHnfobcAbrtKqE7W AnQCR8s2xEeRhKeXwL+D5wOkn9nL+fQPnvsDzl5PZVMQ/rNXEA8vlZnm3RXHE59DcnfI F7Jw7kCBLOoUUgVkAl5MyfDMZa43FY0FCZajKJl9YmGFXD+UP5/6iNCXAoWZ1PgCR6WV lpAw== X-Gm-Message-State: AHYfb5gbsBJbNOtazfkFZ9jySIF0YZgFdsPgLxgXGkueRrs6SwruDbHX fvJl9bFWMeUHww== X-Received: by 10.98.33.14 with SMTP id h14mr191013pfh.249.1502851664874; Tue, 15 Aug 2017 19:47:44 -0700 (PDT) Received: from [10.67.68.37] (fmdmzpr04-ext.fm.intel.com. [192.55.54.39]) by smtp.gmail.com with ESMTPSA id y4sm21408191pfd.116.2017.08.15.19.47.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Aug 2017 19:47:43 -0700 (PDT) To: FFmpeg development discussions and patches , Mark Thompson , Hendrik Leppkes , Steven Liu From: Jun Zhao Message-ID: <86bd3b38-e8ff-1d06-cb4d-8b14b443ff74@gmail.com> Date: Wed, 16 Aug 2017 10:47:37 +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 Subject: [FFmpeg-devel] [PATCH V3 1/2] lavc/vaapi_encode_h264: add "coder" 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" V3: Clean the code and add docs for "coder" option base on Steven code review. V2: Follow libx264 "coder" option style, base on Hendrik Leppkes code review. From 5a8927c04ed7b7f4820d26a124df99b5419deab1 Mon Sep 17 00:00:00 2001 From: Jun Zhao Date: Tue, 8 Aug 2017 03:33:53 -0400 Subject: [PATCH V3 1/2] lavc/vaapi_encode_h264: add "coder" option support Follow libx264 style to support "coder" option, and set it to cabac by default. Signed-off-by: Yi A Wang Signed-off-by: Jun Zhao --- libavcodec/vaapi_encode_h264.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index f9fcd805a4..c658e4e4d6 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -168,6 +168,8 @@ typedef struct VAAPIEncodeH264Options { int qp; int quality; int low_power; + // Entropy encoder type + int coder; } VAAPIEncodeH264Options; @@ -783,6 +785,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 +931,8 @@ 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); + vpic->pic_fields.bits.entropy_coding_mode_flag + = opt->coder ? ((avctx->profile & 0xff) != 66) : 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 +1287,12 @@ 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 }, + { "coder", "Entropy coder type", + OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "coder" }, + { "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS, "coder" }, + { "cabac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, FLAGS, "coder" }, + { "vlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS, "coder" }, + { "ac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, FLAGS, "coder" }, { NULL }, };