diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 283925f937..5ec781ddab 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -2134,6 +2134,12 @@ static const SEIMessageTypeDescriptor cbs_sei_common_types[] = { sizeof(SEIRawFramePackingArrangement), SEI_MESSAGE_RW(sei, frame_packing_arrangement), }, + { + SEI_TYPE_DECODED_PICTURE_HASH, + 0, 1, + sizeof(SEIRawDecodedPictureHash), + SEI_MESSAGE_RW(sei, decoded_picture_hash), + }, { SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME, 1, 0, @@ -2272,12 +2278,6 @@ static const SEIMessageTypeDescriptor cbs_sei_h265_types[] = { }; static const SEIMessageTypeDescriptor cbs_sei_h266_types[] = { - { - SEI_TYPE_DECODED_PICTURE_HASH, - 0, 1, - sizeof(H266RawSEIDecodedPictureHash), - SEI_MESSAGE_RW(h266, sei_decoded_picture_hash), - }, SEI_MESSAGE_TYPE_END }; diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 5f12915b65..d24a8e9313 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -848,16 +848,6 @@ typedef struct H266RawSlice { int data_bit_start; } H266RawSlice; -typedef struct H266RawSEIDecodedPictureHash { - uint8_t dph_sei_hash_type; - uint8_t dph_sei_single_component_flag; - uint8_t dph_sei_picture_md5[3][16]; - uint16_t dph_sei_picture_crc[3]; - uint32_t dph_sei_picture_checksum[3]; - - uint8_t dph_sei_reserved_zero_7bits; -} H266RawSEIDecodedPictureHash; - typedef struct H266RawSEI { H266RawNALUnitHeader nal_unit_header; SEIRawMessageList message_list; diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 34b766c7af..9c37996947 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3442,34 +3442,6 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, return 0; } -SEI_FUNC(sei_decoded_picture_hash, (CodedBitstreamContext *ctx, - RWContext *rw, - H266RawSEIDecodedPictureHash *current, - SEIMessageState *unused)) -{ - int err, c_idx, i; - - HEADER("Decoded Picture Hash"); - - u(8, dph_sei_hash_type, 0, 2); - flag(dph_sei_single_component_flag); - ub(7, dph_sei_reserved_zero_7bits); - - for (c_idx = 0; c_idx < (current->dph_sei_single_component_flag ? 1 : 3); - c_idx++) { - if (current->dph_sei_hash_type == 0) { - for (i = 0; i < 16; i++) - us(8, dph_sei_picture_md5[c_idx][i], 0x00, 0xff, 2, c_idx, i); - } else if (current->dph_sei_hash_type == 1) { - us(16, dph_sei_picture_crc[c_idx], 0x0000, 0xffff, 1, c_idx); - } else if (current->dph_sei_hash_type == 2) { - us(32, dph_sei_picture_checksum[c_idx], 0x00000000, 0xffffffff, 1, - c_idx); - } - } - return 0; -} - static int FUNC(sei) (CodedBitstreamContext *ctx, RWContext *rw, H266RawSEI *current, int prefix) { diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h index cc7d6f797d..15ef3415ab 100644 --- a/libavcodec/cbs_sei.h +++ b/libavcodec/cbs_sei.h @@ -63,6 +63,16 @@ typedef struct SEIRawFramePackingArrangement { uint8_t fp_upsampled_aspect_ratio_flag; } SEIRawFramePackingArrangement; +typedef struct SEIRawDecodedPictureHash { + uint8_t dph_sei_hash_type; + uint8_t dph_sei_single_component_flag; + uint8_t dph_sei_picture_md5[3][16]; + uint16_t dph_sei_picture_crc[3]; + uint32_t dph_sei_picture_checksum[3]; + + uint8_t dph_sei_reserved_zero_7bits; +} SEIRawDecodedPictureHash; + typedef struct SEIRawMasteringDisplayColourVolume { uint16_t display_primaries_x[3]; uint16_t display_primaries_y[3]; diff --git a/libavcodec/cbs_sei_syntax_template.c b/libavcodec/cbs_sei_syntax_template.c index 03ef9ab473..0205bb47aa 100644 --- a/libavcodec/cbs_sei_syntax_template.c +++ b/libavcodec/cbs_sei_syntax_template.c @@ -128,6 +128,34 @@ SEI_FUNC(frame_packing_arrangement, (CodedBitstreamContext *ctx, RWContext *rw, return 0; } +SEI_FUNC(decoded_picture_hash, (CodedBitstreamContext *ctx, + RWContext *rw, + SEIRawDecodedPictureHash *current, + SEIMessageState *unused)) +{ + int err, c_idx, i; + + HEADER("Decoded Picture Hash"); + + u(8, dph_sei_hash_type, 0, 2); + flag(dph_sei_single_component_flag); + ub(7, dph_sei_reserved_zero_7bits); + + for (c_idx = 0; c_idx < (current->dph_sei_single_component_flag ? 1 : 3); + c_idx++) { + if (current->dph_sei_hash_type == 0) { + for (i = 0; i < 16; i++) + us(8, dph_sei_picture_md5[c_idx][i], 0x00, 0xff, 2, c_idx, i); + } else if (current->dph_sei_hash_type == 1) { + us(16, dph_sei_picture_crc[c_idx], 0x0000, 0xffff, 1, c_idx); + } else if (current->dph_sei_hash_type == 2) { + us(32, dph_sei_picture_checksum[c_idx], 0x00000000, 0xffffffff, 1, + c_idx); + } + } + return 0; +} + SEI_FUNC(mastering_display_colour_volume, (CodedBitstreamContext *ctx, RWContext *rw, SEIRawMasteringDisplayColourVolume *current,