From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 10/12] lavc/encode: map AVCodecContext.decoded_side_data to coded_side_data
Date: Fri, 22 Mar 2024 21:28:39 +0100
Message-ID: <20240322202841.31730-10-anton@khirnov.net> (raw)
In-Reply-To: <20240322202841.31730-1-anton@khirnov.net>
This way it can be automagically propagated through the encoder to
muxing.
---
libavcodec/encode.c | 23 +++++++++++++++++++++++
tests/ref/fate/libx265-hdr10 | 24 ++++++++++++------------
2 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 7fc9737e93..46e46a055e 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -782,6 +782,29 @@ int ff_encode_preinit(AVCodecContext *avctx)
return AVERROR(ENOMEM);
}
+ for (int i = 0; ff_sd_global_map[i].packet < AV_PKT_DATA_NB; i++) {
+ const enum AVPacketSideDataType type_packet = ff_sd_global_map[i].packet;
+ const enum AVFrameSideDataType type_frame = ff_sd_global_map[i].frame;
+ const AVFrameSideData *sd_frame;
+ AVPacketSideData *sd_packet;
+
+ sd_frame = av_frame_side_data_get(avctx->decoded_side_data,
+ avctx->nb_decoded_side_data,
+ type_frame);
+ if (!sd_frame ||
+ av_packet_side_data_get(avctx->coded_side_data, avctx->nb_coded_side_data,
+ type_packet))
+
+ continue;
+
+ sd_packet = av_packet_side_data_new(&avctx->coded_side_data, &avctx->nb_coded_side_data,
+ type_packet, sd_frame->size, 0);
+ if (!sd_packet)
+ return AVERROR(ENOMEM);
+
+ memcpy(sd_packet->data, sd_frame->data, sd_frame->size);
+ }
+
if (CONFIG_FRAME_THREAD_ENCODER) {
ret = ff_frame_thread_encoder_init(avctx);
if (ret < 0)
diff --git a/tests/ref/fate/libx265-hdr10 b/tests/ref/fate/libx265-hdr10
index 571c837cac..68511202a5 100644
--- a/tests/ref/fate/libx265-hdr10
+++ b/tests/ref/fate/libx265-hdr10
@@ -1,16 +1,16 @@
frames.frame.0.side_data_list.side_data.0.side_data_type="H.26[45] User Data Unregistered SEI message"
-frames.frame.0.side_data_list.side_data.1.side_data_type="H.26[45] User Data Unregistered SEI message"
-frames.frame.0.side_data_list.side_data.2.side_data_type="Mastering display metadata"
-frames.frame.0.side_data_list.side_data.2.red_x="13250/50000"
-frames.frame.0.side_data_list.side_data.2.red_y="34500/50000"
-frames.frame.0.side_data_list.side_data.2.green_x="7500/50000"
-frames.frame.0.side_data_list.side_data.2.green_y="3000/50000"
-frames.frame.0.side_data_list.side_data.2.blue_x="34000/50000"
-frames.frame.0.side_data_list.side_data.2.blue_y="16000/50000"
-frames.frame.0.side_data_list.side_data.2.white_point_x="15635/50000"
-frames.frame.0.side_data_list.side_data.2.white_point_y="16450/50000"
-frames.frame.0.side_data_list.side_data.2.min_luminance="50/10000"
-frames.frame.0.side_data_list.side_data.2.max_luminance="10000000/10000"
+frames.frame.0.side_data_list.side_data.1.side_data_type="Mastering display metadata"
+frames.frame.0.side_data_list.side_data.1.red_x="13250/50000"
+frames.frame.0.side_data_list.side_data.1.red_y="34500/50000"
+frames.frame.0.side_data_list.side_data.1.green_x="7500/50000"
+frames.frame.0.side_data_list.side_data.1.green_y="3000/50000"
+frames.frame.0.side_data_list.side_data.1.blue_x="34000/50000"
+frames.frame.0.side_data_list.side_data.1.blue_y="16000/50000"
+frames.frame.0.side_data_list.side_data.1.white_point_x="15635/50000"
+frames.frame.0.side_data_list.side_data.1.white_point_y="16450/50000"
+frames.frame.0.side_data_list.side_data.1.min_luminance="50/10000"
+frames.frame.0.side_data_list.side_data.1.max_luminance="10000000/10000"
+frames.frame.0.side_data_list.side_data.2.side_data_type="H.26[45] User Data Unregistered SEI message"
frames.frame.0.side_data_list.side_data.3.side_data_type="Content light level metadata"
frames.frame.0.side_data_list.side_data.3.max_content=1000
frames.frame.0.side_data_list.side_data.3.max_average=200
--
2.43.0
_______________________________________________
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".
next prev parent reply other threads:[~2024-03-22 20:30 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-22 20:28 [FFmpeg-devel] [PATCH 01/12] tests/fate/ffmpeg: evaluate thread count in fate-run.sh rather than make Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 02/12] fftools/ffmpeg_demux: only call filter_codec_opts() when we have a decoder Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 03/12] fftools/cmdutils: do not use a random codec's private options Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 04/12] fftools/ffmpeg_dec: apply decoder options manually Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 05/12] fftools/ffmpeg_{demux, dec}: pass -bitexact through DecoderFlags Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 06/12] fftools/ffmpeg_dec: apply cropping manually Anton Khirnov
2024-03-23 2:53 ` James Almer
2024-03-23 7:20 ` Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 07/12] fftools/ffmpeg_filter: remove display matrix if we have applied it Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 08/12] lavc/frame_thread_encoder: avoid assigning a whole AVCodecContext Anton Khirnov
2024-03-22 20:42 ` Andreas Rheinhardt
2024-03-23 14:00 ` [FFmpeg-devel] [PATCH v2 " Anton Khirnov
2024-03-23 14:11 ` Andreas Rheinhardt
2024-03-24 9:27 ` Anton Khirnov
2024-03-24 10:19 ` Andreas Rheinhardt
2024-03-24 10:33 ` Anton Khirnov
2024-03-24 11:10 ` Andreas Rheinhardt
2024-03-24 11:23 ` Anton Khirnov
2024-03-24 0:11 ` [FFmpeg-devel] [PATCH " Michael Niedermayer
2024-03-24 9:29 ` [FFmpeg-devel] [PATCH v3 " Anton Khirnov
2024-03-24 11:25 ` Andreas Rheinhardt
2024-03-24 11:36 ` Anton Khirnov
2024-03-27 10:27 ` [FFmpeg-devel] [PATCH v4 " Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 09/12] lavc/decode: move sd_global_map to avcodec Anton Khirnov
2024-03-22 20:28 ` Anton Khirnov [this message]
2024-03-23 2:33 ` [FFmpeg-devel] [PATCH 10/12] lavc/encode: map AVCodecContext.decoded_side_data to coded_side_data James Almer
2024-03-23 7:20 ` Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 11/12] fftools/ffmpeg_enc: stop copying demuxer side data to the muxer Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 12/12] fftools/ffmpeg_demux: make InputStream.autorotate private Anton Khirnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240322202841.31730-10-anton@khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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