From patchwork Fri Jun 26 00:55:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Cao X-Patchwork-Id: 20623 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 4F2FD44B897 for ; Fri, 26 Jun 2020 04:02:35 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 229C16882AD; Fri, 26 Jun 2020 04:02:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B472E6880AA for ; Fri, 26 Jun 2020 04:02:28 +0300 (EEST) Received: by mail-pf1-f193.google.com with SMTP id d66so3896787pfd.6 for ; Thu, 25 Jun 2020 18:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=eN+QO5KHH+/l34cxTiJL+3qVDTH+puTN5MGzb8sX+so=; b=aSxSq3hxoXfZxtRLmynvEWn/eCmMBbREmKrFzuwV2rs/VsvR+ofhnc4N7m7YfBV0/P 1RrrnFue5nb9i/OhAhMqlaX/0AEL2liPT3TQupO6C+ECPz2rBAGeElzoICQeNI3xD8zA Q1TpVd+DgYUQdLUGAT1qByrAOobcBLp8ZIRzPiCGzAgDuSNUagn5cuRnHsFtLZQxNKvl iGvwZSs2y5vPTTxVnNgUIp+xIkE12A5KHlSNU8Fe29JQXnJS8J1DCOvRqrgSoWG/Q8sV CYhSSF5ie/GEPVXhvTYfW8ZKeoPhmMXw+bM4/xG3rJnWFU7t6GiokN8wrbC2Ofk4xDpu tOYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eN+QO5KHH+/l34cxTiJL+3qVDTH+puTN5MGzb8sX+so=; b=OSYSzXtOx+vrKY8WsLATpj+E3ZAu4pFsGJdyZcv2THQCPTyHFR0qmfh4SB0OBwMCuC KtsfT5jJSIBQNmL3npt0kUX6jrNjBy1iyK/S1ptlGl/L1L967rLYwLn1+MJGee6LNc3t 8QnPUN5VNmIjQ8OA980hBcEtWus4Dxp92mxZ5I0XpO2PR9zIei0+tXoOhTOxnhYkSiWu 0wzNeMqetXdE+jLq3NyOeBXkjbk7fGnIH4PVfteSv8hxAHywi0HtYJYL+cgvkYgC3Y0k YOQgENu+rSMgjlDKY5gqo8bK/VBpdGXa6cad7HvNs4aJUC/eMxxiLYX0meCvA0ecd1V7 /kTw== X-Gm-Message-State: AOAM533iWAoxE3crRSjIO+ylypmFt94dOTHS3o+FKK4ID/DVZqJfwoBx WGKnMAzT48Nhfm4uLquG1sVr77YiJCw= X-Google-Smtp-Source: ABdhPJyax3rPQ+iCx9tAfLR258T/tbCpjpbFUvkPLx+sdnw6OgtWybQ89Az+WjW/uG8oekJK/953Ug== X-Received: by 2002:a63:2144:: with SMTP id s4mr491558pgm.94.1593132926511; Thu, 25 Jun 2020 17:55:26 -0700 (PDT) Received: from wangcao.mtv.corp.google.com ([2620:0:1000:4011:7b84:dc77:c8b2:63c]) by smtp.gmail.com with ESMTPSA id bg6sm4298777pjb.51.2020.06.25.17.55.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 17:55:25 -0700 (PDT) From: Wang Cao X-Google-Original-From: Wang Cao To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Jun 2020 17:55:13 -0700 Message-Id: <20200626005516.678811-2-wangcao@google.com> X-Mailer: git-send-email 2.27.0.111.gc72c7da667-goog In-Reply-To: <20200626005516.678811-1-wangcao@google.com> References: <20200626005516.678811-1-wangcao@google.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] libavcodec/libaomenc: Add command-line options to control the use of partition tools. 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" This patch adds the control for enabling rectangular partitions, 1:4/4:1 partitions and AB shape partitions. Signed-off-by: Wang Cao --- doc/encoders.texi | 10 ++++++++++ libavcodec/libaomenc.c | 15 +++++++++++++++ libavcodec/version.h | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 045535accb..6513f6c3ef 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1638,8 +1638,18 @@ is @option{qthresh}. Valid value ranges from 1 to 63. The q level threshold after which superres is used for key frames when @option{superres-mode} is @option{qthresh}. Valid value ranges from 1 to 63. +@item enable-rect-partitions (@emph{boolean}) +Enable rectangular partitions. Default is true. + +@item enable-1to4-partitions (@emph{boolean}) +Enable 1:4/4:1 partitions. Default is true. + +@item enable-ab-partitions (@emph{boolean}) +Enable AB shape partitions. Default is true. + @end table + @section libkvazaar Kvazaar H.265/HEVC encoder. diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 17e130d8ec..ab2f456518 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -102,6 +102,9 @@ typedef struct AOMEncoderContext { int superres_qthresh; int superres_kf_denominator; int superres_kf_qthresh; + int enable_rect_partitions; + int enable_1to4_partitions; + int enable_ab_partitions; } AOMContext; static const char *const ctlidstr[] = { @@ -142,6 +145,9 @@ static const char *const ctlidstr[] = { [AV1E_SET_ENABLE_CDEF] = "AV1E_SET_ENABLE_CDEF", [AOME_SET_TUNING] = "AOME_SET_TUNING", [AV1E_SET_ENABLE_SUPERRES] = "AV1E_SET_ENABLE_SUPERRES", + [AV1E_SET_ENABLE_1TO4_PARTITIONS] = "AV1E_SET_ENABLE_1TO4_PARTITIONS", + [AV1E_SET_ENABLE_AB_PARTITIONS] = "AV1E_SET_ENABLE_AB_PARTITIONS", + [AV1E_SET_ENABLE_RECT_PARTITIONS] = "AV1E_SET_ENABLE_RECT_PARTITIONS", }; static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) @@ -725,6 +731,12 @@ static av_cold int aom_init(AVCodecContext *avctx, codecctl_int(avctx, AV1E_SET_ENABLE_CDEF, ctx->enable_cdef); if (ctx->enable_restoration >= 0) codecctl_int(avctx, AV1E_SET_ENABLE_RESTORATION, ctx->enable_restoration); + if (ctx->enable_rect_partitions >= 0) + codecctl_int(avctx, AV1E_SET_ENABLE_RECT_PARTITIONS, ctx->enable_rect_partitions); + if (ctx->enable_1to4_partitions >= 0) + codecctl_int(avctx, AV1E_SET_ENABLE_1TO4_PARTITIONS, ctx->enable_1to4_partitions); + if (ctx->enable_ab_partitions >= 0) + codecctl_int(avctx, AV1E_SET_ENABLE_AB_PARTITIONS, ctx->enable_ab_partitions); codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh); if (ctx->crf >= 0) @@ -1145,6 +1157,9 @@ static const AVOption options[] = { { "superres-qthresh", "The q level threshold after which superres is used, range [1, 63]", OFFSET(superres_qthresh), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, VE}, { "superres-kf-denominator", "The denominator for superres to use on key frames, range [8, 16]", OFFSET(superres_kf_denominator), AV_OPT_TYPE_INT, {.i64 = 8}, 8, 16, VE}, { "superres-kf-qthresh", "The q level threshold after which superres is used for key frames, range [1, 63]", OFFSET(superres_kf_qthresh), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, VE}, + { "enable-rect-partitions", "Enable rectangular partitions", OFFSET(enable_rect_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, + { "enable-1to4-partitions", "Enable 1:4/4:1 partitions", OFFSET(enable_1to4_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, + { "enable-ab-partitions", "Enable ab shape partitions", OFFSET(enable_ab_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, { NULL }, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index 05f59901ff..c9ce7981b5 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 93 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MICRO 102 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \