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 6C1EF41D33 for ; Thu, 17 Feb 2022 21:18:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0595B68B367; Thu, 17 Feb 2022 23:18:54 +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 7D4A168AFDF for ; Thu, 17 Feb 2022 23:18:47 +0200 (EET) Received: by mail-yb1-f201.google.com with SMTP id i6-20020a255406000000b006241e97e420so3539748ybb.5 for ; Thu, 17 Feb 2022 13:18:47 -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=sciSRj6nGGz549fYDWh2uICzOlp80/aabSkZsB6uzQk=; b=UaTb1jifMHVqyMFHFXKlBIIt/Uz/UNusRyf93/+nnUOpjCl99oReNIe6zK9fGrqP2r S7WV56vgm3tALilS4U+XWxF3FvOfywDYZRkkE6EkCfrSrkRNNqAnLybEcLfjE7M6E124 pZ/vR/VB/Mgo3IM2zQEolr9g95iA8Dy4xeqrGCNRTNXz+O8BpNJC9YB+aXxUJ/v/kR6K hM6scgw+XHVstxZ6rl+q/4nSIPhQS7e1dadJZatxi2UChaXKJ/Sdo6p4Sd300vDpGX8y 7lxGhCXJFlpmlRhkpMCDSNMYEzYI9WlzU7hhE3R1ZGIZPN9nrNk8YTaILU2a9I/uAxS8 zqAA== 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=sciSRj6nGGz549fYDWh2uICzOlp80/aabSkZsB6uzQk=; b=q0SmHHQMd4fT2YWJJuB5ReeM44LIBl1Wlb9xVSW9AnjATlETPcpychbBPe4REGHpe4 pLAcDuKsGeTp9/mLRlkprbupg2sezKrfZx7oSB2HE2T56MHgGNLCH3DPc+gU5KboBvcA TJEYrJGioUXVUlinYZsbQJuSqSYyqsRqmZFOy2KQv/utC5cBYwc2vTF1Mi4m8HwXlWUC /UQe7gfSiTCnOP3bpUUFJCRNNoPOyX8gEOnqxaLXXSvY8VQLmMOLYqNzDFwHNgILboRD 7wgjEiFY4XVo3QH8CPvG+/9kVayLXaIdVtExAvwUt9jdYhKnZGOvLnkRFayBuTpiBhGS gZjw== X-Gm-Message-State: AOAM533m+6OOrbPl5Q5OSE5G5JQzRVwn9Njr6MWniqB+9r/tOJybP6U0 YqWt/3MJLoriUrBT0TrvQyO+fUw+dqpHJJmQR0gX61NSMyzWybzht5CKgpC3MpkMfvCzotwzsxN 9+JUogkGmC+zt4iDkOB2hi6VlEvYNehwbVcS1RntM0Yyrz5z5ROwyXrbpzFImHzeiXNeL X-Google-Smtp-Source: ABdhPJw/UfqCZ72aVYXdiPc8E8KUORNNyA6xbfrf/kiuMeyhSE0bSGbDaeHK+rdQu9c8HodfpmkA4SpLEHPQjQ== X-Received: from vigneshv3.mtv.corp.google.com ([2620:0:1000:2511:7cc5:c12a:2cc2:684c]) (user=vigneshv job=sendgmr) by 2002:a81:b204:0:b0:2cf:aa3c:ab17 with SMTP id q4-20020a81b204000000b002cfaa3cab17mr4683147ywh.410.1645132725849; Thu, 17 Feb 2022 13:18:45 -0800 (PST) Date: Thu, 17 Feb 2022 13:18:38 -0800 In-Reply-To: <57c1a0f8-9704-5849-7465-1d33068c447b@gmail.com> Message-Id: <20220217211838.3404301-1-vigneshv@google.com> Mime-Version: 1.0 References: <57c1a0f8-9704-5849-7465-1d33068c447b@gmail.com> X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-goog From: Vignesh Venkatasubramanian To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] 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..638c1deca6 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 = -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".