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 E54FF420E3 for ; Mon, 28 Mar 2022 20:48:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8C3DB68B2A4; Mon, 28 Mar 2022 23:48:04 +0300 (EEST) Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DC43668B12C for ; Mon, 28 Mar 2022 23:47:57 +0300 (EEST) Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-2e6aaf57a0eso121438327b3.11 for ; Mon, 28 Mar 2022 13:47:57 -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=1vAAlgZlX8s8PPkF4mAcINGxifXRwtxAmQA7oyOh9bU=; b=Qoak2vGdF2D0pG77J7FS6WtrHrXJHxUjsFSiJXR6ERRB6lWGsXuwaImSRiGykdgyiN fT/zuLO5h9hOv4KarYwmibIpqELWSgrt4MyZXFykjWA/vIPyJ6YRA3nNW6XSwSZaj/yf mBqUmEFgeaIIjGYpe/7tyGGuI7S1yaDpTBNLCnSPXHemf8DD0/02UwDW/jFFvgcLXsLs LfPED6izkYSoobfS0Vbc4eBnqjI4buoKNUi8y1f+EXB7fJFgymJ9s7Wn5lCdn4MVulj9 joZaeqT2zRVcbaK945FpbnkleslTuNF1VjOs0q5o2ht5aHKCpUW9zW0jaxsM+3DkxbZ8 M6/Q== 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=1vAAlgZlX8s8PPkF4mAcINGxifXRwtxAmQA7oyOh9bU=; b=SowZMiJORchuz3hKTCcg+xybjVb6xVbly9En36f+Lz/U7UlwJvFpYlWNAvGqWDpi/T IaiSXp34bE1fgojcfw7dIR7o3LBPYBSNXW/UvCXRbvS2LxM8RuAassrwTIg2ChmKGV7S 0d4Rjz6VTqiqj+EMRHiHi69wtVCMJ4SBbGcVkPbw6PLRBcNYONjnXOpv5kgJ7qW4h0KL KSjB3KTp9zL5Z1mlsW+1iJb2wlDfxnBgrpNoxHanierODZJGqQPKiLyCI87Qe1jynvr0 qvoXt7SPttOgC2ouDFvZbunPjMzbtKwhtPNa6QhcscprDkB2KVyw/WjPL9ssIw3rVnQW ET8Q== X-Gm-Message-State: AOAM532auL3hL22JQZw6bAZnecXXT8Y+mytw+RlsL65TQ1ML8DfJ6jXC UT3/UinF1FpbuXUA9oERkvvzDm8VBe5gCixqEwCulTATG6dCVoXNfRtG4EnW73bQAcV8I09Hm+X H0pmW4xODV953aIi3tQPIclccV9g0zCG255ZRYK8BobwLylvlzrCfFJRF/bf0x1kPvuzJ X-Google-Smtp-Source: ABdhPJzdbTFW9nvAw0VSYiYWUz/oNozcddh9izdzvf7bwmQVwukmSU0WPEzgJaZ/HHaGWiKstDIL1YmRV0wEFQ== X-Received: from vigneshv3.mtv.corp.google.com ([2620:0:1000:2511:228a:277d:bb24:94ea]) (user=vigneshv job=sendgmr) by 2002:a25:b9cb:0:b0:61d:a7a5:6005 with SMTP id y11-20020a25b9cb000000b0061da7a56005mr24058197ybj.360.1648500476557; Mon, 28 Mar 2022 13:47:56 -0700 (PDT) Date: Mon, 28 Mar 2022 13:47:52 -0700 In-Reply-To: <20220222213655.3049471-1-vigneshv@google.com> Message-Id: <20220328204752.3339971-1-vigneshv@google.com> Mime-Version: 1.0 References: <20220222213655.3049471-1-vigneshv@google.com> X-Mailer: git-send-email 2.35.1.1021.g381101b075-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 7dbb6f6f39..ccd0823b97 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.1021.g381101b075-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".