1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

h264_ps: set pic_scaling_matrix_present_flag

This commit is contained in:
Lynne 2022-03-18 16:17:33 +01:00
parent 02f38af2dd
commit 6718b37e5d
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
2 changed files with 6 additions and 2 deletions

View File

@ -226,6 +226,7 @@ static int decode_scaling_list(GetBitContext *gb, uint8_t *factors, int size,
/* returns non zero if the provided SPS scaling matrix has been filled */
static int decode_scaling_matrices(GetBitContext *gb, const SPS *sps,
const PPS *pps, int is_sps,
int present_flag,
uint8_t(*scaling_matrix4)[16],
uint8_t(*scaling_matrix8)[64])
{
@ -237,7 +238,7 @@ static int decode_scaling_matrices(GetBitContext *gb, const SPS *sps,
fallback_sps ? sps->scaling_matrix8[3] : default_scaling8[1]
};
int ret = 0;
if (get_bits1(gb)) {
if (present_flag) {
ret |= decode_scaling_list(gb, scaling_matrix4[0], 16, default_scaling4[0], fallback[0]); // Intra, Y
ret |= decode_scaling_list(gb, scaling_matrix4[1], 16, default_scaling4[0], scaling_matrix4[0]); // Intra, Cr
ret |= decode_scaling_list(gb, scaling_matrix4[2], 16, default_scaling4[0], scaling_matrix4[1]); // Intra, Cb
@ -368,7 +369,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
goto fail;
}
sps->transform_bypass = get_bits1(gb);
ret = decode_scaling_matrices(gb, sps, NULL, 1,
ret = decode_scaling_matrices(gb, sps, NULL, 1, get_bits1(gb),
sps->scaling_matrix4, sps->scaling_matrix8);
if (ret < 0)
goto fail;
@ -803,7 +804,9 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
bits_left = bit_length - get_bits_count(gb);
if (bits_left > 0 && more_rbsp_data_in_pps(sps, avctx)) {
pps->transform_8x8_mode = get_bits1(gb);
pps->pic_scaling_matrix_present_flag = get_bits1(gb);
ret = decode_scaling_matrices(gb, sps, pps, 0,
pps->pic_scaling_matrix_present_flag,
pps->scaling_matrix4, pps->scaling_matrix8);
if (ret < 0)
goto fail;

View File

@ -119,6 +119,7 @@ typedef struct PPS {
int constrained_intra_pred; ///< constrained_intra_pred_flag
int redundant_pic_cnt_present; ///< redundant_pic_cnt_present_flag
int transform_8x8_mode; ///< transform_8x8_mode_flag
int pic_scaling_matrix_present_flag;
uint8_t scaling_matrix4[6][16];
uint8_t scaling_matrix8[6][64];
uint8_t chroma_qp_table[2][QP_MAX_NUM+1]; ///< pre-scaled (with chroma_qp_index_offset) version of qp_table