From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id D372241022 for ; Wed, 13 Apr 2022 20:39:38 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EE29468B41E; Wed, 13 Apr 2022 23:39:35 +0300 (EEST) Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CA43368B360 for ; Wed, 13 Apr 2022 23:39:29 +0300 (EEST) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-2e61c5a0eb7so25748657b3.22 for ; Wed, 13 Apr 2022 13:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=rDn2haR5vqJ4UydnzvgLnIpleYuPmJrdn8GZOUHJG74=; b=TNxSVTrVWEqEv15nN3kTzd3yDylazayxDzwGD2SCvp8N4N58l5c9EhKE8x7W3BmgFt H6cSgBRZ0QbSi94juR4r1qEeFTrbJ4+TQt1mosHQJKvkPTaIU9lJ3wk4HqfZPNIwyIQC SQ2oWYAhVQh97lE7HoWPCwOyjD766UtpgyBmlj4ptpt15oz45Bk+jowYpC+JT6WeUr0A GcrUttEpvJn9ypNvfm1vsIQhjdK4mLL9mrwHRIgvN0csu16eabJcfmI7y93r65M+kIXA VbV+tYPy1Bq/TovikeT8UIc+g0Om90V+azKMzohm6LbOc+N1Ijw+6Cz+Sr3AIw/E4gpk uWsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=rDn2haR5vqJ4UydnzvgLnIpleYuPmJrdn8GZOUHJG74=; b=2JCeYyewr+kTxuIRofqZsEkvb0Qh4AIUmwE/d/e3RQMy/DanYpelKndvvMzKyFWIwM Gjrp8zdSqbLCUu9LtO8NqI7DT/eyTHip7umc8QlXhwcdqg3ZbTMlpTBgxOAWslkHEg2I kbnJngeIr0yvUG3GTVcZReVdYZI+kx5RDZJ1p0fIuW5p4bS8gb9ICF6PDXOZvCws56Qu rM/U6/ILJuvEeq+JQge3CWnRek3P21OSVErCaCIkpTXacRYmxIqXAEcs8SPcAnn0Y6a7 AMhgYWBO+w65bTIdpMy2ZaKCGpikfg1PmEbukK34jGcJ3+KG278r77BjfPnq5T5I3idX mesg== X-Gm-Message-State: AOAM533HNlR6YMtnZl9akA+yA5ii7RIm91LU4EDH/xJCo19FZ4kqZWvx p++pFrcSsjxbvpq7Fx9ajLA0koO9IfXjzcquLMmPyyt6kxiw4bQ8iS/Bv+ymUmlDJVBkbXbGfaK ftsxkb05+VTFzyc+G+lmD7JNiUdZaDdmCrHnPIKuVBxMD6K+Lyk6wpYvbLm3cK59zrM9/ X-Google-Smtp-Source: ABdhPJyPpdjutLfWOZfx+vNAA0vurC/+0SG6FNueSq1nKkyhTPnFwnkRB9Z2dstGFQ6/lxgivPZ9pootLmjHfg== X-Received: from vigneshv3.mtv.corp.google.com ([2620:0:1000:2511:a185:f162:f2de:5a9]) (user=vigneshv job=sendgmr) by 2002:a05:6902:150d:b0:63d:f457:9384 with SMTP id q13-20020a056902150d00b0063df4579384mr589635ybu.601.1649882367601; Wed, 13 Apr 2022 13:39:27 -0700 (PDT) Date: Wed, 13 Apr 2022 13:39:18 -0700 In-Reply-To: <20220328204752.3339971-1-vigneshv@google.com> Message-Id: <20220413203918.3695742-1-vigneshv@google.com> Mime-Version: 1.0 References: <20220328204752.3339971-1-vigneshv@google.com> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog From: Vignesh Venkatasubramanian To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/libaomenc: Add parameter for avif single image encoding 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 Cc: Vignesh Venkatasubramanian Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Add a parameter to libaom-av1 encoder to enforce some of the single image constraints in the AV1 encoder. Setting this flag will limit the encoder to producing exactly one frame and the sequence header that is produced by the encoder will be conformant to the AVIF specification [1]. Part of Fixing Trac ticket #7621 [1] https://aomediacodec.github.io/av1-avif Signed-off-by:: Vignesh Venkatasubramanian --- libavcodec/libaomenc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 054903e6e2..0411773bbf 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -100,6 +100,7 @@ typedef struct AOMEncoderContext { int enable_restoration; int usage; int tune; + int still_picture; int enable_rect_partitions; int enable_1to4_partitions; int enable_ab_partitions; @@ -747,6 +748,18 @@ static av_cold int aom_init(AVCodecContext *avctx, if (res < 0) return res; + if (ctx->still_picture) { + // Set the maximum number of frames to 1. This will let libaom set + // still_picture and reduced_still_picture_header to 1 in the Sequence + // Header as required by AVIF still images. + enccfg.g_limit = 1; + // Reduce memory usage for still images. + enccfg.g_lag_in_frames = 0; + // All frames will be key frames. + enccfg.kf_max_dist = 0; + enccfg.kf_mode = AOM_KF_DISABLED; + } + /* Construct Encoder Context */ res = aom_codec_enc_init(&ctx->encoder, iface, &enccfg, flags); if (res != AOM_CODEC_OK) { @@ -1291,6 +1304,7 @@ static const AVOption options[] = { { "psnr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_PSNR}, 0, 0, VE, "tune"}, { "ssim", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_SSIM}, 0, 0, VE, "tune"}, FF_AV1_PROFILE_OPTS + { "still-picture", "Encode in single frame mode (typically used for still AVIF images).", OFFSET(still_picture), AV_OPT_TYPE_BOOL, {.i64 = 0}, -1, 1, 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}, -- 2.35.1.1178.g4f1659d476-goog _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".