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 75889403AE for ; Tue, 22 Feb 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 3C40268B12A; Tue, 22 Feb 2022 23:37:10 +0200 (EET) 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 3EC7E689B6B for ; Tue, 22 Feb 2022 23:37:03 +0200 (EET) Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-2d0a5824ec6so153548407b3.0 for ; Tue, 22 Feb 2022 13:37:03 -0800 (PST) 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=2G5QaqL7aCJlsv9cZGyjkw+uWvtCw3dtl36oFf1IhS4=; b=kdBHJG7HE48vTbVC3ftWNyB1GHIsRe6TfHl30WaHWX2YgAau1DNpK0nwVIDVOT1HIE Xh2N5Qwc4rOVHdGn9XnTHMfpxBTkp3evLrWO1EL7CCJnYG5oeZmKpqp966DE5qS7G7uG 7BalcjItXSbN3EnWhtuB/oq02qkFlHs4oqnmqP06DTPFwlr/PJIHREVYJ5/N1ZI8zDNx J6h2qM6goQcln3npoVJE5jQITRVaF1RoIeG4M82L/YRbIudOyzCC0bl2IpkA470pPlCU HtQPMCuf9nDJxRJ2nGMV/sS5ZDjYe9S33oT9acFg1HHd9efyx4bvKPJ8jQr/XQ+5ZqXY jbjA== 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=2G5QaqL7aCJlsv9cZGyjkw+uWvtCw3dtl36oFf1IhS4=; b=xfPDDEtotFyNK0QZUHTRLUwuxTCXNul73PP144FR19IvtSsNUXV0juKghjsg2V63Sy D28U3CtieB0/gm9VSnH5v/8YB4ycfXi89awTjB4+atDwQpQn6KwDhUaHmqQDWOo5I+JI Bh/WwCWIoCSEtmH9JTxcnDq+G1kqOt+cpPFhwukDrnipXdkekkEVykzw9nW5OBXvVS1L 8l/WTJigmlDNKnK52kZxBtPsabn1Ob1CvWumfZKMkr+tTL+CLg46ByD9DHSYRvqwtNvq Fyxa+YiqtQIQjbOA9orynC/MoMvs/yvTMcWpGpiuBnBfuCwJBf42ha/w3VIMuXE/wJlA 8i3A== X-Gm-Message-State: AOAM530fxGz+02TqROdBU0+o8w/WVEfAJHb1Bqku4yG4/lGtVI4wVW1B xSg3iVdmgKs8+7N8G/cQOSMGJMYREaPt7+mc/OcUIFQJBXfTuC9C72zbKantj6G3CAMa9ODav6i qGn/qV2ZNXZnn9XBOq66m1CFRff3ORZ1Xa2FA22RD4fupdn26Mywu6VxrBdA85jMhn3fm X-Google-Smtp-Source: ABdhPJwi+oQQj/snql9X+VRDW4Gk8YX/fz/hzQfJCdvgtMUqNFNL7UqHQm+V6ZJsaiFN1USrkF3pOnebSmZM0Q== X-Received: from vigneshv3.mtv.corp.google.com ([2620:0:1000:2511:2a22:eadd:d2be:b1c4]) (user=vigneshv job=sendgmr) by 2002:a05:6902:207:b0:61d:eee9:b138 with SMTP id j7-20020a056902020700b0061deee9b138mr25486079ybs.225.1645565821513; Tue, 22 Feb 2022 13:37:01 -0800 (PST) Date: Tue, 22 Feb 2022 13:36:55 -0800 In-Reply-To: Message-Id: <20220222213655.3049471-1-vigneshv@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.35.1.473.g83b2b277ed-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..a6d752ab4a 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -99,6 +99,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; @@ -746,6 +747,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) { @@ -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 + { "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.473.g83b2b277ed-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".