Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/3] avcodec/libaomenc: Add parameter for avif single image encoding
@ 2022-02-17  5:51 Vignesh Venkatasubramanian
  2022-02-17  5:51 ` [FFmpeg-devel] [PATCH 2/3] avformat/av1: Add a parameter to av1c to omit seq header Vignesh Venkatasubramanian
                   ` (3 more replies)
  0 siblings, 4 replies; 71+ messages in thread
From: Vignesh Venkatasubramanian @ 2022-02-17  5:51 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Vignesh Venkatasubramanian

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 <vigneshv@google.com>
---
 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".

^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2022-05-13  7:22 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17  5:51 [FFmpeg-devel] [PATCH 1/3] avcodec/libaomenc: Add parameter for avif single image encoding Vignesh Venkatasubramanian
2022-02-17  5:51 ` [FFmpeg-devel] [PATCH 2/3] avformat/av1: Add a parameter to av1c to omit seq header Vignesh Venkatasubramanian
2022-03-02 22:57   ` James Almer
2022-03-02 23:22     ` Vignesh Venkatasubramanian
2022-03-02 23:23     ` Vignesh Venkatasubramanian
2022-03-02 23:27       ` James Almer
2022-03-28 20:48         ` Vignesh Venkatasubramanian
2022-04-13 20:40           ` Vignesh Venkatasubramanian
2022-05-02 21:36             ` Vignesh Venkatasubramanian
2022-02-17  5:51 ` [FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing Vignesh Venkatasubramanian
2022-02-22 18:40   ` Vignesh Venkatasubramanian
2022-02-22 20:03     ` James Almer
2022-02-22 21:37       ` Vignesh Venkatasubramanian
2022-02-22 21:38       ` Vignesh Venkatasubramanian
2022-02-22 21:43         ` Vignesh Venkatasubramanian
2022-02-24 17:34           ` Vignesh Venkatasubramanian
2022-03-01 16:49             ` Vignesh Venkatasubramanian
2022-03-03 15:36           ` James Almer
2022-03-03 19:16             ` Vignesh Venkatasubramanian
2022-03-04 11:24               ` James Almer
2022-03-04 17:52                 ` Vignesh Venkatasubramanian
2022-03-04 17:54                 ` Vignesh Venkatasubramanian
2022-03-09 19:34                   ` Vignesh Venkatasubramanian
2022-03-10 16:01               ` Andreas Rheinhardt
2022-03-10 18:12                 ` Vignesh Venkatasubramanian
2022-03-21 20:46                   ` Andreas Rheinhardt
2022-03-22 16:45                     ` Vignesh Venkatasubramanian
2022-03-22 16:46                       ` Vignesh Venkatasubramanian
2022-03-28 17:06                         ` Vignesh Venkatasubramanian
2022-03-28 20:49                           ` Vignesh Venkatasubramanian
2022-04-07 18:25                             ` Vignesh Venkatasubramanian
2022-04-13 17:21                             ` James Zern
2022-04-13 20:40                               ` Vignesh Venkatasubramanian
2022-04-13 21:01                                 ` Andreas Rheinhardt
2022-04-13 21:33                                   ` Vignesh Venkatasubramanian
2022-05-02 17:28                                 ` James Zern
2022-05-02 21:34                                   ` Vignesh Venkatasubramanian
2022-05-02 21:35                                     ` Vignesh Venkatasubramanian
2022-05-03 23:39                                       ` James Zern
2022-05-04  2:46                                       ` "zhilizhao(赵志立)"
2022-05-04 16:45                                         ` Vignesh Venkatasubramanian
2022-05-04 16:48                                           ` Vignesh Venkatasubramanian
2022-05-04 17:10                                           ` "zhilizhao(赵志立)"
2022-05-04 17:14                                             ` Vignesh Venkatasubramanian
2022-05-04 17:15                                               ` Vignesh Venkatasubramanian
2022-05-11 16:54                                                 ` Vignesh Venkatasubramanian
2022-05-11 17:25                                                   ` Gyan Doshi
2022-05-12 10:26                                                     ` Gyan Doshi
2022-05-12 16:23                                                       ` Vignesh Venkatasubramanian
2022-05-12 16:23                                                         ` Vignesh Venkatasubramanian
2022-05-13  7:22                                                           ` Gyan Doshi
2022-04-13 20:41                               ` Vignesh Venkatasubramanian
2022-04-13 21:04                       ` Andreas Rheinhardt
2022-04-13 21:35                         ` Vignesh Venkatasubramanian
2022-04-21 16:38                           ` Vignesh Venkatasubramanian
2022-04-29 16:03                             ` Vignesh Venkatasubramanian
2022-03-10 18:14                 ` Vignesh Venkatasubramanian
2022-03-15 15:59                   ` Vignesh Venkatasubramanian
2022-03-21 17:07                     ` Vignesh Venkatasubramanian
2022-03-03 19:20             ` Vignesh Venkatasubramanian
2022-03-03 19:46               ` James Almer
2022-03-03 19:57                 ` Vignesh Venkatasubramanian
2022-02-17 18:09 ` [FFmpeg-devel] [PATCH 1/3] avcodec/libaomenc: Add parameter for avif single image encoding James Zern
2022-02-17 19:33   ` Vignesh Venkatasubramanian
2022-02-17 20:59 ` James Almer
2022-02-17 21:18   ` [FFmpeg-devel] [PATCH] " Vignesh Venkatasubramanian
2022-02-17 21:20   ` [FFmpeg-devel] [PATCH 1/3] " Vignesh Venkatasubramanian
2022-02-22 21:36     ` Vignesh Venkatasubramanian
2022-03-28 20:47       ` Vignesh Venkatasubramanian
2022-04-13 20:39         ` Vignesh Venkatasubramanian
2022-05-02 21:37           ` Vignesh Venkatasubramanian

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git