aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_ps.c
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2022-03-18 16:17:33 +0100
committerLynne <dev@lynne.ee>2023-05-29 00:41:29 +0200
commit6718b37e5dac73868db9f595d36268e6a0752347 (patch)
tree78da2b57c47bde5fa97b222f02a1cac9027d1551 /libavcodec/h264_ps.c
parent02f38af2dd3acbbc6aafa627bd50c811286553f8 (diff)
downloadffmpeg-6718b37e5dac73868db9f595d36268e6a0752347.tar.gz
h264_ps: set pic_scaling_matrix_present_flag
Diffstat (limited to 'libavcodec/h264_ps.c')
-rw-r--r--libavcodec/h264_ps.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 4ec5bd4e80..a94f5350c4 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -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;