* [FFmpeg-devel] [PATCH] avcodec/vvc: parse all SEI messages
@ 2025-06-11 18:52 Marvin Scholz
2025-06-12 13:23 ` Nuo Mi
0 siblings, 1 reply; 2+ messages in thread
From: Marvin Scholz @ 2025-06-11 18:52 UTC (permalink / raw)
To: ffmpeg-devel
While the current code iterated over the messages, it always returned
in the first iteration. Instead keep iterating and warn for failure to
parse. At time of writing, none of the parsing functions seems to
actually return an error, ever.
Fix CID 1648348
---
libavcodec/vvc/sei.c | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/libavcodec/vvc/sei.c b/libavcodec/vvc/sei.c
index d8ab2bf245..cd202edb2a 100644
--- a/libavcodec/vvc/sei.c
+++ b/libavcodec/vvc/sei.c
@@ -184,6 +184,7 @@ int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI *sei, const struct VVCFrameCon
return AVERROR_INVALIDDATA;
for (int i = 0; i < sei->message_list.nb_messages; i++) {
+ int ret = 0;
SEIRawMessage *message = &sei->message_list.messages[i];
void *payload = message->payload;
@@ -193,25 +194,32 @@ int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI *sei, const struct VVCFrameCon
c->film_grain_characteristics = av_refstruct_allocz(sizeof(*c->film_grain_characteristics));
if (!c->film_grain_characteristics)
return AVERROR(ENOMEM);
- return decode_film_grain_characteristics(c->film_grain_characteristics, payload, fc);
+ ret = decode_film_grain_characteristics(c->film_grain_characteristics, payload, fc);
+ break;
case SEI_TYPE_DECODED_PICTURE_HASH:
- return decode_decoded_picture_hash(&s->picture_hash, payload);
+ ret = decode_decoded_picture_hash(&s->picture_hash, payload);
+ break;
case SEI_TYPE_DISPLAY_ORIENTATION:
- return decode_display_orientation(&s->common.display_orientation, payload);
+ ret = decode_display_orientation(&s->common.display_orientation, payload);
+ break;
case SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
- return decode_content_light_level_info(&s->common.content_light, payload);
+ ret = decode_content_light_level_info(&s->common.content_light, payload);
+ break;
case SEI_TYPE_FRAME_FIELD_INFO:
- return decode_frame_field_info(&s->frame_field_info, payload);
+ ret = decode_frame_field_info(&s->frame_field_info, payload);
+ break;
case SEI_TYPE_AMBIENT_VIEWING_ENVIRONMENT:
- return decode_ambient_viewing_environment(&s->common.ambient_viewing_environment, payload);
+ ret = decode_ambient_viewing_environment(&s->common.ambient_viewing_environment, payload);
+ break;
case SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
- return decode_mastering_display_colour_volume(&s->common.mastering_display, payload);
+ ret = decode_mastering_display_colour_volume(&s->common.mastering_display, payload);
+ break;
default:
av_log(fc->log_ctx, AV_LOG_DEBUG, "Skipped %s SEI %d\n",
@@ -219,6 +227,13 @@ int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI *sei, const struct VVCFrameCon
"PREFIX" : "SUFFIX", message->payload_type);
return FF_H2645_SEI_MESSAGE_UNHANDLED;
}
+
+ if (ret == AVERROR(ENOMEM))
+ return ret;
+ if (ret < 0)
+ av_log(fc->log_ctx, AV_LOG_WARNING, "Failure to parse %s SEI %d: %s\n",
+ sei->nal_unit_header.nal_unit_type == VVC_PREFIX_SEI_NUT ?
+ "PREFIX" : "SUFFIX", message->payload_type, av_err2str(ret));
}
return 0;
--
2.39.5 (Apple Git-154)
_______________________________________________
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] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/vvc: parse all SEI messages
2025-06-11 18:52 [FFmpeg-devel] [PATCH] avcodec/vvc: parse all SEI messages Marvin Scholz
@ 2025-06-12 13:23 ` Nuo Mi
0 siblings, 0 replies; 2+ messages in thread
From: Nuo Mi @ 2025-06-12 13:23 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Thu, Jun 12, 2025 at 2:52 AM Marvin Scholz <
epirat07-at-gmail.com@ffmpeg.org> wrote:
> While the current code iterated over the messages, it always returned
> in the first iteration. Instead keep iterating and warn for failure to
> parse. At time of writing, none of the parsing functions seems to
> actually return an error, ever.
>
> Fix CID 1648348
>
Thank you, Marvin.
Pushed.
> ---
> libavcodec/vvc/sei.c | 29 ++++++++++++++++++++++-------
> 1 file changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/vvc/sei.c b/libavcodec/vvc/sei.c
> index d8ab2bf245..cd202edb2a 100644
> --- a/libavcodec/vvc/sei.c
> +++ b/libavcodec/vvc/sei.c
> @@ -184,6 +184,7 @@ int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI
> *sei, const struct VVCFrameCon
> return AVERROR_INVALIDDATA;
>
> for (int i = 0; i < sei->message_list.nb_messages; i++) {
> + int ret = 0;
> SEIRawMessage *message = &sei->message_list.messages[i];
> void *payload = message->payload;
>
> @@ -193,25 +194,32 @@ int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI
> *sei, const struct VVCFrameCon
> c->film_grain_characteristics =
> av_refstruct_allocz(sizeof(*c->film_grain_characteristics));
> if (!c->film_grain_characteristics)
> return AVERROR(ENOMEM);
> - return
> decode_film_grain_characteristics(c->film_grain_characteristics, payload,
> fc);
> + ret =
> decode_film_grain_characteristics(c->film_grain_characteristics, payload,
> fc);
> + break;
>
> case SEI_TYPE_DECODED_PICTURE_HASH:
> - return decode_decoded_picture_hash(&s->picture_hash, payload);
> + ret = decode_decoded_picture_hash(&s->picture_hash, payload);
> + break;
>
> case SEI_TYPE_DISPLAY_ORIENTATION:
> - return
> decode_display_orientation(&s->common.display_orientation, payload);
> + ret =
> decode_display_orientation(&s->common.display_orientation, payload);
> + break;
>
> case SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
> - return
> decode_content_light_level_info(&s->common.content_light, payload);
> + ret =
> decode_content_light_level_info(&s->common.content_light, payload);
> + break;
>
> case SEI_TYPE_FRAME_FIELD_INFO:
> - return decode_frame_field_info(&s->frame_field_info, payload);
> + ret = decode_frame_field_info(&s->frame_field_info, payload);
> + break;
>
> case SEI_TYPE_AMBIENT_VIEWING_ENVIRONMENT:
> - return
> decode_ambient_viewing_environment(&s->common.ambient_viewing_environment,
> payload);
> + ret =
> decode_ambient_viewing_environment(&s->common.ambient_viewing_environment,
> payload);
> + break;
>
> case SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
> - return
> decode_mastering_display_colour_volume(&s->common.mastering_display,
> payload);
> + ret =
> decode_mastering_display_colour_volume(&s->common.mastering_display,
> payload);
> + break;
>
> default:
> av_log(fc->log_ctx, AV_LOG_DEBUG, "Skipped %s SEI %d\n",
> @@ -219,6 +227,13 @@ int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI
> *sei, const struct VVCFrameCon
> "PREFIX" : "SUFFIX", message->payload_type);
> return FF_H2645_SEI_MESSAGE_UNHANDLED;
> }
> +
> + if (ret == AVERROR(ENOMEM))
> + return ret;
> + if (ret < 0)
> + av_log(fc->log_ctx, AV_LOG_WARNING, "Failure to parse %s SEI
> %d: %s\n",
> + sei->nal_unit_header.nal_unit_type == VVC_PREFIX_SEI_NUT ?
> + "PREFIX" : "SUFFIX", message->payload_type,
> av_err2str(ret));
> }
>
> return 0;
> --
> 2.39.5 (Apple Git-154)
>
> _______________________________________________
> 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".
>
_______________________________________________
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] 2+ messages in thread
end of thread, other threads:[~2025-06-12 13:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-11 18:52 [FFmpeg-devel] [PATCH] avcodec/vvc: parse all SEI messages Marvin Scholz
2025-06-12 13:23 ` Nuo Mi
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