From patchwork Mon Jan 24 02:59:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Wenbin" X-Patchwork-Id: 33756 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2375195iog; Sun, 23 Jan 2022 19:01:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6kGSLHFq3ezJpzL0OqTkqLQtLO0q0d/WP0EIj7vPZxDGxNuGILMVH3XUAx/3LeyrtnZe3 X-Received: by 2002:a05:6402:26d2:: with SMTP id x18mr1838557edd.147.1642993307936; Sun, 23 Jan 2022 19:01:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642993307; cv=none; d=google.com; s=arc-20160816; b=lbL6uX6JygG9Xh2R1PiVQL4tNRJdo3RTzeVne5zEy/9v7Al3foTlrehwe9YmZgClpv jEDkWziqDPiR0oBmnI8qUtQTaY4Lk/zzja4+wKp0q4lfcfTDp/EkWKGUg15M0ogIIUyn a3r8aY+b4itRiJ5RZvo6J/8Hwq8Hm44EKU5/YwoAA5fdfneevJUtuwMfydv1RxHVjOpN ZOmxOW0IOWzb6A9bc9vNWEwnquq0ammYxnHDC+dy3IvYHkIhpyiuZrFWoRxfVTuot5ck e4bZ9675b868sJTOeQNtXIw99lcopSKXSYXRsi2Z4NNuYS/zXh4lW6xb1JCwEWne+Dww n9JA== 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:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=7mscVBp7X8U5ZRj8Zj0BjU5FJV3+hm22unxCD5OZ69w=; b=xhbgXdPlFggBz5YKqbT8902NUZFE3LMOyhhundP2lrdvJoD+qDhB50wH0Vd7579DuU qvDrp7VEH97jJQj9qAh5TMokXnHvyP/gu8OrhhMz5ePpMFB/skrWGz0OnpXWvL1dNcJj g/uymUOlqZsJ4C2SgawvIX7vNjTzotOkSWBp0+atQpBqP0adMnCT5+vbtaIfey6WKegi 87sZIMMB8OtE9yegP+k0wRDGbFUjklfvo4mWqwox2qlRjTq2vdgfh+YsjPrYhEJzO5P+ sXc6ekoScxkAJEF5te8LD+UimRJVRSHXER4fnOm3f5o3XGWAJf4++n6LJLC8ORGbkO5a zFWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=OTMLWGXd; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b10si9224279edd.580.2022.01.23.19.01.47; Sun, 23 Jan 2022 19:01:47 -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; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=OTMLWGXd; 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 7E9D868B027; Mon, 24 Jan 2022 05:01:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 940D768AF87 for ; Mon, 24 Jan 2022 05:01:36 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642993301; x=1674529301; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=dT9jy4Ab4Su2P0wgZkbN8CA4SVhhxFAZHitD6QEK2Y4=; b=OTMLWGXd+4AYnfQSuUczU4d5rhQhND9fBW0pKWFRzZe9L4MwfFSx8ZXR qSiqT7kGMHfmU5lTzw4xpPPTpJohXFitJvJIeKYUN6RqFmUKEPVqwZp40 7vkqW8fMS12FUWFIcOB7rlY7zFUqGvGYzGGzcFsDRDhuBxdMvjyazBE16 fSE15kFWhBV49x2L+ErAqlPwHCcnizlSUkHUQCW//MQlO9rKg/fgPJgQ0 VFA/q2ehPfhpYaN2DWgJEEFSsLKbBhXeQmV1pGYhbLDMJbOjkL8hnSPD7 XRqOjnBskinPcLJZFFKJF8xbWjTwmRAZ+Ugyd7/kF9KYwidONPZ8GhxUo w==; X-IronPort-AV: E=McAfee;i="6200,9189,10236"; a="246168123" X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="246168123" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2022 19:01:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="673480633" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga001.fm.intel.com with ESMTP; 23 Jan 2022 19:01:33 -0800 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Jan 2022 10:59:53 +0800 Message-Id: <20220124025955.204168-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] libavcodec/qsvenc: Add max slice size support to hevc_qsv X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: Zn/4pVSCeiES Add max_slice_size option to hevc_qsv as well. Signed-off-by: Wenbin Chen --- doc/encoders.texi | 3 +++ libavcodec/qsvenc.c | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index e3adbf4325..8966610263 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3397,6 +3397,9 @@ Enable rate distortion optimization. @item @var{max_frame_size} Maximum encoded frame size in bytes. +@item @var{max_slice_size} +Maximum encoded slice size in bytes. + @item @var{p_strategy} Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0). diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 413e5ae8f6..f311cd9ce4 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -877,11 +877,6 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) if (q->mbbrc >= 0) q->extco2.MBBRC = q->mbbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; -#if QSV_HAVE_MAX_SLICE_SIZE - if (q->max_slice_size >= 0) - q->extco2.MaxSliceSize = q->max_slice_size; -#endif - #if QSV_HAVE_TRELLIS if (avctx->trellis >= 0) q->extco2.Trellis = (avctx->trellis == 0) ? MFX_TRELLIS_OFF : (MFX_TRELLIS_I | MFX_TRELLIS_P | MFX_TRELLIS_B); @@ -907,6 +902,10 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; if (q->max_frame_size >= 0) q->extco2.MaxFrameSize = q->max_frame_size; +#if QSV_HAVE_MAX_SLICE_SIZE + if (q->max_slice_size >= 0) + q->extco2.MaxSliceSize = q->max_slice_size; +#endif #if QSV_HAVE_DISABLEDEBLOCKIDC q->extco2.DisableDeblockingIdc = q->dblk_idc; #endif