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 A9F2D41A46 for ; Thu, 17 Feb 2022 05:51:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 308D768B1D1; Thu, 17 Feb 2022 07:51:31 +0200 (EET) Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 36B8E68AEB1 for ; Thu, 17 Feb 2022 07:51:24 +0200 (EET) Received: by mail-yb1-f201.google.com with SMTP id i4-20020a25a0c4000000b00623ab738437so6326696ybm.0 for ; Wed, 16 Feb 2022 21:51:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=jY8aC5fIgBpYhbh86WoX7XQz/lswekl54M4wR7waLfk=; b=osvzdGt5OyX+hXxpKuF9M3ej3yxIvDZGHX22pbW7mGVtYFZleCBjUktTgPTvrXOzIe Ywe+IUfoOc46+Vg7zGI3TYFSdjp1ffA21AZ2KPn7gZuEe6MAd3zIUJaEX9TutqM9zHnF 1CH2MiGjrpYBXbw4969vWKb2gEldhf9eEVRUj9l/N8g7t7653QlZP3kdjLQpi8j1Y+wA NyyXU/wb/U5bAMSXUhBOVzm0QKdZ04N+PiNV+uLFEryieSOQTIMXgVfxW0tphF8qwPWj UutiwPjGRvNv90tBFSwQLP5QOml/XyLjDsAjHH1SPhx/xUTAXQ8agJAUzOihPSW5Fc7z w/1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=jY8aC5fIgBpYhbh86WoX7XQz/lswekl54M4wR7waLfk=; b=KQk4axMJuDVICgY/5AGtgK/Esd/Jg83gT/xS5PxVcPof2+zaQLIimJBe8EmK62/bET AMX46D0VJgV9TsVrZGaEDJSU/If+mm+Y6a7y/hLzbBi7sTbZdlwkVPAVpeYDdToF9e/G /e8TJQ33RUq29czpnRI/6sXjBtnnnNUEgqTRhLRwwUVrYFy6YZ1/XlYrvUt7YvIx5gTI I9axBRdd4aVLeJG6oduRgdA2vUEiUfSBDQpcPbHfh0KGpa+xxtD+O2xUhE7GVzXOhs3n yPtpnXYAoeUyB6o9ZdJ/TJVu1jzqEqcBNqtPc3RvUUwJT2Gid72LuGlAbG3dF+91/2qc lmFw== X-Gm-Message-State: AOAM532yYWK8fZA6iZvv/qODksUKuVOnKcb/HAQMeuuY+ZeLUYo+gjyt WBJ2pu08mkmvYV7S7+sqN4yoK1wdfAqM7WKVtoKx8luHC422YgM2qVrXGgLzZEW7voI1/AVF1Ve BC+M6f8Rett9ApyvUXgMgBUEBkYcZoFk7vVYU3qzhwN9PWyWiUCPivT35r4qwIzP7elhc X-Google-Smtp-Source: ABdhPJyQYUjrpcv12uo0IlvBkvYrUs+MhOLyEuVRRUv2BRTrM9gSNWRpf4lGPB1tefQmYpajDUEiFP7S41oWcg== X-Received: from vigneshv3.mtv.corp.google.com ([2620:0:1000:2511:4804:9763:5ad6:9d1f]) (user=vigneshv job=sendgmr) by 2002:a81:644:0:b0:2d0:d34c:9170 with SMTP id 65-20020a810644000000b002d0d34c9170mr1178351ywg.204.1645077082250; Wed, 16 Feb 2022 21:51:22 -0800 (PST) Date: Wed, 16 Feb 2022 21:51:15 -0800 Message-Id: <20220217055117.3233501-1-vigneshv@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-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 963cc1bcbc..0398060a2f 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -99,6 +99,7 @@ typedef struct AOMEncoderContext { int enable_restoration; int usage; int tune; + int is_avif; int enable_rect_partitions; int enable_1to4_partitions; int enable_ab_partitions; @@ -746,6 +747,18 @@ static av_cold int aom_init(AVCodecContext *avctx, if (res < 0) return res; + if (ctx->is_avif) { + // 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) { @@ -1290,6 +1303,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 + { "avif-image", "Encode in single frame mode for still AVIF images.", OFFSET(is_avif), AV_OPT_TYPE_BOOL, {.i64 = -1}, -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.265.g69c8d7142f-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".