[FFmpeg-devel] [PATCH v2 02/18] cbs_h264: Add support for frame packing arrangement SEI messages

Mark Thompson sw at jkqxz.net
Sat Mar 13 00:56:13 EET 2021


On 23/02/2021 16:39, James Almer wrote:
> On 2/21/2021 4:51 PM, Mark Thompson wrote:
>> ---
>>   libavcodec/cbs_h264.h                 | 23 ++++++++++++++++
>>   libavcodec/cbs_h2645.c                |  6 +++++
>>   libavcodec/cbs_h264_syntax_template.c | 39 +++++++++++++++++++++++++++
>>   3 files changed, 68 insertions(+)
>>
>> ...
>> diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
>> index 9587f33985..e03d41e47a 100644
>> --- a/libavcodec/cbs_h264_syntax_template.c
>> +++ b/libavcodec/cbs_h264_syntax_template.c
>> @@ -719,6 +719,45 @@ static int FUNC(sei_recovery_point)(CodedBitstreamContext *ctx, RWContext *rw,
>>       return 0;
>>   }
>> +
>> +
>> +static int FUNC(sei_frame_packing_arrangement)
>> +    (CodedBitstreamContext *ctx, RWContext *rw,
>> +     H264RawSEIFramePackingArrangement *current, SEIMessageState *sei)
>> +{
>> +    int err;
>> +
>> +    HEADER("Frame Packing Arrangement");
>> +
>> +    ue(frame_packing_arrangement_id, 0, UINT32_MAX - 1);
>> +    flag(frame_packing_arrangement_cancel_flag);
>> +
>> +    if (!current->frame_packing_arrangement_cancel_flag) {
>> +        u(7, frame_packing_arrangement_type, 0, 7);
>> +        flag(quincunx_sampling_flag);
>> +        u(6, content_interpretation_type, 0, 2);
>> +        flag(spatial_flipping_flag);
>> +        flag(frame0_flipped_flag);
>> +        flag(field_views_flag);
>> +        flag(current_frame_is_frame0_flag);
>> +        flag(frame0_self_contained_flag);
>> +        flag(frame1_self_contained_flag);
>> +        if (!current->quincunx_sampling_flag &&
>> +            current->frame_packing_arrangement_type != 5) {
> 
> nit: maybe H264_SEI_FPA_TYPE_INTERLEAVE_TEMPORAL instead of 5.

The standard does say exactly "!= 5", so I prefer to keep to that.  (It would be nice if the H.2(6[456]|74) specs made better use of enum constants, but we are stuck with what they actually do.)

- Mark


More information about the ffmpeg-devel mailing list