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 52A1F41D30 for ; Thu, 17 Feb 2022 21:00:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6DFBB68B35B; Thu, 17 Feb 2022 23:00:03 +0200 (EET) Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A06DB68AFF0 for ; Thu, 17 Feb 2022 22:59:56 +0200 (EET) Received: by mail-oi1-f171.google.com with SMTP id a6so931273oid.9 for ; Thu, 17 Feb 2022 12:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to :references:from:subject:in-reply-to:content-transfer-encoding; bh=oPMRJJgaph/ixn8Fr3ijz6ZdnQll7SBzM2yg0flkahY=; b=dhc3zTd1ElnSd3VWkuP4pvbrDdxXOyeyq1BhSihdLD6DK4jttvmcL0CrF8Dqk9h1Xo 94sDmJ75GCpxOcCJMCoFlFMMtnr2gGDlbVXLn/h1vSo7lozVclOa0s/MEg74o0+KyhvV siLBqDrDvwE+NAJseWorNRe4jYk03N5CyrpY74R81QdviuJ/adqTJOAS4PvP0OVEuBl9 /nKfEguMxgOc6IdcXzDzC9IWFTR/pOehc1EYV157IS78kgI4KbNxKLe+LEYumO67E2Bz ynpFTcLMLlTd3yJtc9LqKT2bSwung1cLulysPz9pPw0cSJLL5UIOgGwugSlYdI1jZNsC ZIaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:references:from:subject:in-reply-to :content-transfer-encoding; bh=oPMRJJgaph/ixn8Fr3ijz6ZdnQll7SBzM2yg0flkahY=; b=cFONt/y0eXlDMWkVGqQC8+EAmriF5F8kvXN851yZozbMB/7zipNkhYytF8YR/whpLC EK/5tqeLhc8uggOVSyriAtHYur6X2XwwRIiSscXe/dvo93p8K4lFlXcLkuzhW8BYl07o bzcpQru3xv2sEMTumOgbmIpX3D/xJfEBXME4PyQFUdeM6eqLRRfUO5x08vP0/58WyvuB cHhtUsCFcgbUwo6HXixi2uYzcijj49+6sgIPox3iD5iUzfREOTxqXFuGrMc4F/UMyzhu E8IA5QIiidE+sU1nAmac3E9ruD5mhQNa+iqFGKykuN91tfRmAXsFWqImC81jfFgaynsN rScg== X-Gm-Message-State: AOAM53087+rQ3nrVq8y6MZs+Y2evLYRqA7jlggNWT003HcgTUFmziCfk 06sXuNqJObxa3wH32AOdpZTt61Ts04LJ3A== X-Google-Smtp-Source: ABdhPJyOUx28LgVrIBsJ4+3xFohxgmlBo5JY9JaYGxT/M6UBXj5Zy3Hc6EEf8nWb2uNoeDB71OK/WQ== X-Received: by 2002:a05:6808:1886:b0:2ce:6ee7:2ce5 with SMTP id bi6-20020a056808188600b002ce6ee72ce5mr3633424oib.275.1645131594324; Thu, 17 Feb 2022 12:59:54 -0800 (PST) Received: from [192.168.0.10] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id n18sm464039otr.48.2022.02.17.12.59.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Feb 2022 12:59:53 -0800 (PST) Message-ID: <57c1a0f8-9704-5849-7465-1d33068c447b@gmail.com> Date: Thu, 17 Feb 2022 17:59:51 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220217055117.3233501-1-vigneshv@google.com> From: James Almer In-Reply-To: <20220217055117.3233501-1-vigneshv@google.com> Subject: Re: [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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2/17/2022 2:51 AM, Vignesh Venkatasubramanian wrote: > 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; How will libaom react if you feed it more than 1 frame? Will it reject the input and return an error? > + // 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 }, Judging by the above settings, this option should be called "still_picture". The description can mention it's required for AVIF output. An alternative is to add new AVProfiles, giving them values outside the range that would be written into the sequence header. Like FF_PROFILE_AV1_MAIN_STILL_PICTURE with a value of 0x80, FF_PROFILE_AV1_HIGH_STILL_PICTURE with a value of 0x81, etc. Then you just look for avctx->profile & 0x80 to know it's a still picture. Of course considerations would need to be done to avoid problems, like the line "enccfg.g_profile = avctx->profile;" being changed to "enccfg.g_profile = avctx->profile & 0x3;" (We can define a constant for that 0x3 mask called profile_bits or whatever). > { "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}, _______________________________________________ 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".