[FFmpeg-devel] [PATCH v1 14/19] avcodec/cbs_sei_syntax_template: add sei message frame_field_information
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Sat Apr 26 01:55:15 EEST 2025
James Almer:
> On 4/25/2025 7:08 PM, Andreas Rheinhardt wrote:
>> toqsxw at gmail.com:
>>> From: Wu Jianhua <toqsxw at outlook.com>
>>>
>>> Signed-off-by: Wu Jianhua <toqsxw at outlook.com>
>>> ---
>>> libavcodec/cbs_h2645.c | 6 ++++++
>>> libavcodec/cbs_sei.h | 12 ++++++++++++
>>> libavcodec/cbs_sei_syntax_template.c | 26 ++++++++++++++++++++++++++
>>> 3 files changed, 44 insertions(+)
>>>
>>> diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
>>> index c868770209..6677134d77 100644
>>> --- a/libavcodec/cbs_h2645.c
>>> +++ b/libavcodec/cbs_h2645.c
>>> @@ -2199,6 +2199,12 @@ static const SEIMessageTypeDescriptor
>>> cbs_sei_common_types[] = {
>>> sizeof(SEIRawDisplayOrientation),
>>> SEI_MESSAGE_RW(sei, display_orientation)
>>> },
>>> + {
>>> + SEI_TYPE_FRAME_FIELD_INFO,
>>> + 1, 0,
>>> + sizeof(SEIRawFrameFieldInformation),
>>> + SEI_MESSAGE_RW(sei, frame_field_information)
>>> + },
>>> SEI_MESSAGE_TYPE_END,
>>> };
>>> diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h
>>> index 7be12e33e0..81867b79a7 100644
>>> --- a/libavcodec/cbs_sei.h
>>> +++ b/libavcodec/cbs_sei.h
>>> @@ -125,6 +125,18 @@ typedef struct SEIRawDisplayOrientation {
>>> uint8_t display_orientation_reserved_zero_3bits;
>>> } SEIRawDisplayOrientation;
>>> +typedef struct SEIRawFrameFieldInformation {
>>> + uint8_t ffi_field_pic_flag;
>>> + uint8_t ffi_bottom_field_flag;
>>> + uint8_t ffi_pairing_indicated_flag;
>>> + uint8_t ffi_paired_with_next_field_flag;
>>> + uint8_t ffi_display_fields_from_frame_flag;
>>> + uint8_t ffi_top_field_first_flag;
>>> + uint8_t ffi_display_elemental_periods_minus1;
>>> + uint8_t ffi_source_scan_type;
>>> + uint8_t ffi_duplicate_flag;
>>> +} SEIRawFrameFieldInformation;
>>> +
>>> typedef struct SEIRawMessage {
>>> uint32_t payload_type;
>>> uint32_t payload_size;
>>> diff --git a/libavcodec/cbs_sei_syntax_template.c b/libavcodec/
>>> cbs_sei_syntax_template.c
>>> index fb19f6ee42..e6863a0fd7 100644
>>> --- a/libavcodec/cbs_sei_syntax_template.c
>>> +++ b/libavcodec/cbs_sei_syntax_template.c
>>> @@ -295,6 +295,32 @@ SEI_FUNC(display_orientation,
>>> (CodedBitstreamContext *ctx, RWContext *rw,
>>> return 0;
>>> }
>>> +SEI_FUNC(frame_field_information, (CodedBitstreamContext *ctx,
>>> RWContext *rw,
>>> + SEIRawFrameFieldInformation
>>> *current,
>>> + SEIMessageState *state))
>>> +{
>>> + int err;
>>> +
>>> + HEADER("Frame-field information");
>>> +
>>> + flag(ffi_field_pic_flag);
>>> + if (current->ffi_field_pic_flag) {
>>> + flag(ffi_bottom_field_flag);
>>> + flag(ffi_pairing_indicated_flag);
>>> + if (current->ffi_pairing_indicated_flag)
>>> + flag(ffi_paired_with_next_field_flag);
>>> + } else {
>>> + flag(ffi_display_fields_from_frame_flag);
>>> + if (current->ffi_display_fields_from_frame_flag)
>>> + flag(ffi_top_field_first_flag);
>>> + u(8, ffi_display_elemental_periods_minus1, 0, 0xff);
>>> + }
>>> + u(2, ffi_source_scan_type, 0, 3);
>>> + flag(ffi_duplicate_flag);
>>> +
>>> + return 0;
>>> +}
>>> +
>>> static int FUNC(message)(CodedBitstreamContext *ctx, RWContext *rw,
>>> SEIRawMessage *current)
>>> {
>>
>> This does really not seem like a common SEI, yet you add it to the
>> common ones.
>
> It's in ITU-T H.274, which is what the common list contains. It's used
> as fallback if a SEI type is not a H.26x specific one.
>
I know and this makes it wrong. It will e.g. be used for H.264 SEI type
168, although this SEI does not exist in H.264 (unless I am mistaken
about the last point, but I don't think I am).
- Andreas
More information about the ffmpeg-devel
mailing list