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 A0B8442C60 for ; Mon, 2 May 2022 21:37:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 609E168B2EE; Tue, 3 May 2022 00:37:12 +0300 (EEST) 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 8DA9568B0A6 for ; Tue, 3 May 2022 00:37:05 +0300 (EEST) Received: by mail-yb1-f201.google.com with SMTP id b33-20020a25aea1000000b0064588c45fbaso8868890ybj.16 for ; Mon, 02 May 2022 14:37:05 -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=oXCmEuZhS0Dr2TgjhoFpNW8T2V4dSh5M5R9X7SQeokA=; b=A8EUvsR6KQUswVp106Dwp4wHWJMI+txQbF331TV/LlExWuBodj0r9MWOEsHGIO0Ky+ mQMoEPgdm88/CrrSeQSrdjcgU3itF4B86Zj9TeaaM06PLQyKxlES/zDPmLFu0rhxUTli n+llFv8aQbjNzylFJhL8g5UgIn13VBRHVSjjcCiS2Z3TYZqnJqGAD8yEZ7qRum/Bj4Vd ANjCsMvHllGXT6jy55Rj0iIBbmiruX+vwW994nuQOXaTyKnasrDyygFm7NGvN+z9CKt7 C9exkPT8wYKH3aAlAoaUtWopNVTWnNVrse43dvMDvbhrIG4UXrEdQ5CjgBmNBDpOZPbZ Ii4w== 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=oXCmEuZhS0Dr2TgjhoFpNW8T2V4dSh5M5R9X7SQeokA=; b=KTRZFmKRMO7DAPDxqdBZLk3jwbUxvawBn75kq8FovsA24J6J9BulOMYVL/FDmHJbqx PvcLAxBM0xtwi3kcywV6JDshJJKtit/QqJABNlIBC5nO8ZVIil/chJ9BHgZioFNK9FY3 wmgv4Ru9DJwhQLmo4MIolVftDCnOCcpMnuz3l97C1n1s09DGRQwMD94oYiyxENh29fJu sNEQ1Fypp9cuKFjPcV1RSxowOVIsai+cphp3PKU0ZkPdWuhAuSpe5vY3K+o4MA1lmeSR bOoW/le+kbJMkknqk0MpjzQsYx5TrFgcO6LdbAOiZqrV1OxXSw95GQmQRxx5wHL1ech3 8SCA== X-Gm-Message-State: AOAM5301yRuvAYMUmgDhAlqbZDcwF3NjH+SHC52fevcTuvwWBFR+uj0J s2Ixd/4gcPAZSRTg64aonsrSnbeIkRd5B8QN1YZG3hoA061T2M3Ee1PtVvW2OgWleQ/GnfGwvgJ mx3sYbpppK0vdBdXoWMC/oduhV2DiaWlHGhMZVfK1YXUEB60r9xSZOH36N4I9E3T9Ki/T X-Google-Smtp-Source: ABdhPJzBjm0ZXNlR38FBsj34V69iWlhjdLqTVffBZTx/3ldZHhth8gDMKCGjqtKITwMpCs3SgwVSFQPfZdxwfg== X-Received: from vigneshv3.mtv.corp.google.com ([2620:0:1000:2511:f699:797:bdbd:2026]) (user=vigneshv job=sendgmr) by 2002:a25:950:0:b0:648:ba7a:b98d with SMTP id u16-20020a250950000000b00648ba7ab98dmr12214136ybm.42.1651527424331; Mon, 02 May 2022 14:37:04 -0700 (PDT) Date: Mon, 2 May 2022 14:37:01 -0700 In-Reply-To: <20220413203918.3695742-1-vigneshv@google.com> Message-Id: <20220502213701.2462428-1-vigneshv@google.com> Mime-Version: 1.0 References: <20220413203918.3695742-1-vigneshv@google.com> X-Mailer: git-send-email 2.36.0.464.gb9c8b46e94-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.36.0.464.gb9c8b46e94-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".