avcodec/cbs_h266: move decoded_picture_hash to CBS SEI

It's defined in H.274 as a common SEI message type and not in H.266

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2024-06-26 20:12:58 -03:00
parent 826f55d5b3
commit e0b574c483
5 changed files with 44 additions and 44 deletions

View File

@ -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
};

View File

@ -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;

View File

@ -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)
{

View File

@ -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];

View File

@ -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,