Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: toqsxw@gmail.com
To: ffmpeg-devel@ffmpeg.org
Cc: Wu Jianhua <toqsxw@outlook.com>
Subject: [FFmpeg-devel] [PATCH v1 04/19] avcodec/vvc/dec: export sei to the frame when the frame starts
Date: Wed,  2 Apr 2025 01:16:01 +0800
Message-ID: <20250401171616.1378-4-toqsxw@outlook.com> (raw)
In-Reply-To: <20250401171616.1378-1-toqsxw@outlook.com>

From: Wu Jianhua <toqsxw@outlook.com>

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
---
 libavcodec/h2645_sei.c |  9 +++++----
 libavcodec/h2645_sei.h |  2 +-
 libavcodec/vvc/dec.c   | 12 ++++++++++++
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index 2494daaf3c..78d9db20fd 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -44,8 +44,9 @@
 #include "h2645_sei.h"
 #include "itut35.h"
 
-#define IS_H264(codec_id) (CONFIG_H264_SEI && CONFIG_HEVC_SEI ? codec_id == AV_CODEC_ID_H264 : CONFIG_H264_SEI)
-#define IS_HEVC(codec_id) (CONFIG_H264_SEI && CONFIG_HEVC_SEI ? codec_id == AV_CODEC_ID_HEVC : CONFIG_HEVC_SEI)
+#define IS_H264(codec_id) (CONFIG_H264_SEI && (CONFIG_HEVC_SEI || CONFIG_VVC_SEI ) ? codec_id == AV_CODEC_ID_H264 : CONFIG_H264_SEI)
+#define IS_HEVC(codec_id) (CONFIG_HEVC_SEI && (CONFIG_H264_SEI || CONFIG_VVC_SEI ) ? codec_id == AV_CODEC_ID_HEVC : CONFIG_HEVC_SEI)
+#define IS_VVC(codec_id)  (CONFIG_VVC_SEI  && (CONFIG_H264_SEI || CONFIG_HEVC_SEI) ? codec_id == AV_CODEC_ID_VVC  : CONFIG_VVC_SEI )
 
 #if CONFIG_HEVC_SEI
 static int decode_registered_user_data_dynamic_hdr_plus(HEVCSEIDynamicHDRPlus *s,
@@ -427,7 +428,7 @@ static int decode_film_grain_characteristics(H2645SEIFilmGrainCharacteristics *h
                 }
             }
         }
-        if (IS_HEVC(codec_id))
+        if (!IS_H264(codec_id))
             h->persistence_flag = get_bits1(gb);
         else
             h->repetition_period = get_ue_golomb_long(gb);
@@ -854,7 +855,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
         fgp->subsampling_x = fgp->subsampling_y = 0;
 
         h274->model_id = fgc->model_id;
-        if (fgc->separate_colour_description_present_flag) {
+        if (IS_VVC(codec_id) || fgc->separate_colour_description_present_flag) {
             fgp->bit_depth_luma   = fgc->bit_depth_luma;
             fgp->bit_depth_chroma = fgc->bit_depth_chroma;
             fgp->color_range      = fgc->full_range + 1;
diff --git a/libavcodec/h2645_sei.h b/libavcodec/h2645_sei.h
index abc49760d9..f2ad7147c6 100644
--- a/libavcodec/h2645_sei.h
+++ b/libavcodec/h2645_sei.h
@@ -108,7 +108,7 @@ typedef struct H2645SEIFilmGrainCharacteristics {
     uint8_t intensity_interval_upper_bound[3][256];
     int16_t comp_model_value[3][256][6];
     int repetition_period;       //< H.264 only
-    int persistence_flag;        //< HEVC  only
+    int persistence_flag;        //< HEVC/VVC
 } H2645SEIFilmGrainCharacteristics;
 
 typedef struct H2645SEIMasteringDisplay {
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index 206be3cc33..8b1c2c751b 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -718,6 +718,14 @@ static void decode_prefix_sei(VVCFrameContext *fc, VVCContext *s)
     }
 }
 
+static int set_side_data(VVCContext *s, VVCFrameContext *fc)
+{
+    AVFrame *out = fc->ref->frame;
+
+    return ff_h2645_sei_to_frame(out, &fc->sei.common, AV_CODEC_ID_VVC, s->avctx,
+        NULL, fc->ps.sps->bit_depth, fc->ps.sps->bit_depth, fc->ref->poc);
+}
+
 static int frame_start(VVCContext *s, VVCFrameContext *fc, SliceContext *sc)
 {
     const VVCPH *ph                 = &fc->ps.ph;
@@ -733,6 +741,10 @@ static int frame_start(VVCContext *s, VVCFrameContext *fc, SliceContext *sc)
 
     decode_prefix_sei(fc, s);
 
+    ret = set_side_data(s, fc);
+    if (ret < 0)
+        goto fail;
+
     if (!IS_IDR(s))
         ff_vvc_bump_frame(s, fc);
 
-- 
2.44.0.windows.1

_______________________________________________
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".

  parent reply	other threads:[~2025-04-01 17:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01 17:15 [FFmpeg-devel] [PATCH v1 01/19] avcodec/cbs_sei_syntax_template: add sei message film_grain_characteristics toqsxw
2025-04-01 17:15 ` [FFmpeg-devel] [PATCH v1 02/19] avcodec/vvc: support decoding prefix and suffix nal units toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 03/19] avcodec/vvc/sei: add decode_film_grain_characteristics toqsxw
2025-04-01 17:16 ` toqsxw [this message]
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 05/19] avcodec/vvc/dec: support applying film grain by the decoder toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 06/19] avcodec/vvc/dec: support removing film grain params from side data toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 07/19] avcodec/h274: add H274SEIPictureHash struct toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 08/19] avcodec/vvc/sei: add decode_decoded_picture_hash toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 09/19] avcodec/h274: add ff_h274_hash functions toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 10/19] avcodec/vvcdec: verify picture hash toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 11/19] avcodec/cbs_sei_syntax_template: add sei message sei_display_orientation toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 12/19] avcodec/vvc/sei: add decode_display_orientation toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 13/19] avcodec/vvc/sei: add decode_content_light_level_info toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 14/19] avcodec/cbs_sei_syntax_template: add sei message frame_field_information toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 15/19] avcodec/h274: add H274SEIFrameFieldInfo struct toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 16/19] avcodec/vvc/sei: add decode_frame_field_info toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 17/19] avcodec/vvc: support fields toqsxw
2025-04-01 17:35   ` Andreas Rheinhardt
2025-04-01 18:11     ` [FFmpeg-devel] 回复: " Wu Jianhua
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 18/19] avcodec/vvc/sei: add decode_ambient_viewing_environment toqsxw
2025-04-01 17:16 ` [FFmpeg-devel] [PATCH v1 19/19] avcodec/vvc/sei: add decode_mastering_display_colour_volume toqsxw

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=20250401171616.1378-4-toqsxw@outlook.com \
    --to=toqsxw@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=toqsxw@outlook.com \
    /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