Skip to content

Commit 1f8305d

Browse files
author
larley
committed
+ more H.264 PolyV changes
1 parent f6c643f commit 1f8305d

7 files changed

Lines changed: 138 additions & 62 deletions

File tree

libavcodec/h2645_vui.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void ff_h2645_decode_common_vui_params(GetBitContext *gb, H2645VUI *vui, void *l
3939
av_log(logctx, AV_LOG_DEBUG, "Decoding VUI\n");
4040

4141
vui->aspect_ratio_info_present_flag = get_bits1(gb);
42-
if (vui->aspect_ratio_info_present_flag) {
42+
if (!vui->aspect_ratio_info_present_flag) { // [PolyV] inverted
4343
vui->aspect_ratio_idc = get_bits(gb, 8);
4444
if (vui->aspect_ratio_idc < FF_ARRAY_ELEMS(ff_h2645_pixel_aspect))
4545
vui->sar = ff_h2645_pixel_aspect[vui->aspect_ratio_idc];
@@ -58,13 +58,13 @@ void ff_h2645_decode_common_vui_params(GetBitContext *gb, H2645VUI *vui, void *l
5858

5959
vui->video_signal_type_present_flag = get_bits1(gb);
6060
if (vui->video_signal_type_present_flag) {
61-
vui->video_format = get_bits(gb, 3);
6261
vui->video_full_range_flag = get_bits1(gb);
6362
vui->colour_description_present_flag = get_bits1(gb);
63+
vui->video_format = get_bits(gb, 3); // [PolyV] moved
6464
if (vui->colour_description_present_flag) {
65-
vui->colour_primaries = get_bits(gb, 8);
66-
vui->transfer_characteristics = get_bits(gb, 8);
67-
vui->matrix_coeffs = get_bits(gb, 8);
65+
vui->matrix_coeffs = get_bits(gb, 8); // [PolyV] moved
66+
vui->colour_primaries = get_bits(gb, 8); // [PolyV] moved
67+
vui->transfer_characteristics = get_bits(gb, 8); // [PolyV] moved
6868

6969
// Set invalid values to "unspecified"
7070
if (!av_color_primaries_name(vui->colour_primaries))
@@ -78,8 +78,8 @@ void ff_h2645_decode_common_vui_params(GetBitContext *gb, H2645VUI *vui, void *l
7878

7979
vui->chroma_loc_info_present_flag = get_bits1(gb);
8080
if (vui->chroma_loc_info_present_flag) {
81-
vui->chroma_sample_loc_type_top_field = get_ue_golomb_31(gb);
8281
vui->chroma_sample_loc_type_bottom_field = get_ue_golomb_31(gb);
82+
vui->chroma_sample_loc_type_top_field = get_ue_golomb_31(gb); // [PolyV] moved
8383
if (vui->chroma_sample_loc_type_top_field <= 5U)
8484
vui->chroma_location = vui->chroma_sample_loc_type_top_field + 1;
8585
else

libavcodec/h264_parse.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,25 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
3838
pwt->use_weight = 0;
3939
pwt->use_weight_chroma = 0;
4040

41-
pwt->luma_log2_weight_denom = get_ue_golomb_31(gb);
42-
if (pwt->luma_log2_weight_denom > 7U) {
43-
av_log(logctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is out of range\n", pwt->luma_log2_weight_denom);
44-
pwt->luma_log2_weight_denom = 0;
45-
}
46-
luma_def = 1 << pwt->luma_log2_weight_denom;
47-
4841
if (sps->chroma_format_idc) {
49-
pwt->chroma_log2_weight_denom = get_ue_golomb_31(gb);
42+
pwt->chroma_log2_weight_denom = get_ue_golomb_31(gb); // [PolyV] might be get_ue_golomb
5043
if (pwt->chroma_log2_weight_denom > 7U) {
5144
av_log(logctx, AV_LOG_ERROR, "chroma_log2_weight_denom %d is out of range\n", pwt->chroma_log2_weight_denom);
5245
pwt->chroma_log2_weight_denom = 0;
5346
}
5447
chroma_def = 1 << pwt->chroma_log2_weight_denom;
5548
}
5649

50+
// [PolyV] moved
51+
pwt->luma_log2_weight_denom = get_ue_golomb_31(gb);
52+
if (pwt->luma_log2_weight_denom > 7U) {
53+
av_log(logctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is out of range\n", pwt->luma_log2_weight_denom);
54+
pwt->luma_log2_weight_denom = 0;
55+
}
56+
luma_def = 1 << pwt->luma_log2_weight_denom;
57+
58+
get_ue_golomb_31(gb); // [PolyV] added
59+
5760
for (list = 0; list < 2; list++) {
5861
pwt->luma_weight_flag[list] = 0;
5962
pwt->chroma_weight_flag[list] = 0;
@@ -62,8 +65,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
6265

6366
luma_weight_flag = get_bits1(gb);
6467
if (luma_weight_flag) {
68+
pwt->luma_weight[i][list][1] = get_se_golomb(gb); // [PolyV] moved
69+
get_bits1(gb); // [PolyV] added
6570
pwt->luma_weight[i][list][0] = get_se_golomb(gb);
66-
pwt->luma_weight[i][list][1] = get_se_golomb(gb);
6771
if ((int8_t)pwt->luma_weight[i][list][0] != pwt->luma_weight[i][list][0] ||
6872
(int8_t)pwt->luma_weight[i][list][1] != pwt->luma_weight[i][list][1])
6973
goto out_range_weight;
@@ -82,8 +86,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
8286
if (chroma_weight_flag) {
8387
int j;
8488
for (j = 0; j < 2; j++) {
89+
pwt->chroma_weight[i][list][j][1] = get_se_golomb(gb); // [PolyV] moved
90+
get_bits1(gb); // [PolyV] added
8591
pwt->chroma_weight[i][list][j][0] = get_se_golomb(gb);
86-
pwt->chroma_weight[i][list][j][1] = get_se_golomb(gb);
8792
if ((int8_t)pwt->chroma_weight[i][list][j][0] != pwt->chroma_weight[i][list][j][0] ||
8893
(int8_t)pwt->chroma_weight[i][list][j][1] != pwt->chroma_weight[i][list][j][1]) {
8994
pwt->chroma_weight[i][list][j][0] = chroma_def;
@@ -237,12 +242,12 @@ int ff_h264_parse_ref_count(int *plist_count, int ref_count[2],
237242
num_ref_idx_active_override_flag = get_bits1(gb);
238243

239244
if (num_ref_idx_active_override_flag) {
240-
ref_count[0] = get_ue_golomb(gb) + 1;
241245
if (slice_type_nos == AV_PICTURE_TYPE_B) {
242246
ref_count[1] = get_ue_golomb(gb) + 1;
243247
} else
244248
// full range is spec-ok in this case, even for frames
245249
ref_count[1] = 1;
250+
ref_count[0] = get_ue_golomb(gb) + 1; // [PolyV] moved
246251
}
247252

248253
if (slice_type_nos == AV_PICTURE_TYPE_B)

libavcodec/h264_ps.c

Lines changed: 95 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ static const uint8_t default_scaling4[2][16] = {
4545
20, 24, 27, 30, 24, 27, 30, 34 }
4646
};
4747

48+
static const uint8_t default_scaling4_mars[2][16] = {
49+
{ 6, 12, 21, 28, 12, 21, 28, 32,
50+
21, 28, 32, 36, 28, 32, 36, 42 },
51+
{ 10, 14, 22, 24, 14, 22, 24, 27,
52+
22, 24, 27, 31, 24, 27, 31, 34 }
53+
};
54+
4855
static const uint8_t default_scaling8[2][64] = {
4956
{ 6, 10, 13, 16, 18, 23, 25, 27,
5057
10, 11, 16, 18, 23, 25, 27, 29,
@@ -64,6 +71,25 @@ static const uint8_t default_scaling8[2][64] = {
6471
24, 25, 27, 28, 30, 32, 33, 35 }
6572
};
6673

74+
static const uint8_t default_scaling8_mars[2][64] = {
75+
{ 6, 10, 13, 16, 18, 23, 25, 27,
76+
10, 11, 16, 18, 23, 25, 27, 29,
77+
13, 16, 18, 23, 25, 27, 29, 31,
78+
16, 18, 23, 25, 27, 29, 31, 34,
79+
18, 23, 25, 27, 29, 31, 34, 36,
80+
23, 25, 27, 29, 31, 34, 36, 37,
81+
25, 27, 29, 31, 34, 36, 37, 39,
82+
27, 29, 31, 34, 36, 37, 39, 42 }, // [PolyV] changed
83+
{ 9, 13, 15, 17, 20, 21, 22, 24,
84+
13, 13, 17, 20, 21, 22, 24, 25,
85+
15, 17, 20, 21, 22, 24, 25, 27,
86+
17, 20, 21, 22, 24, 25, 27, 28,
87+
20, 21, 22, 24, 25, 27, 28, 30,
88+
21, 22, 24, 25, 27, 28, 30, 33,
89+
22, 24, 25, 27, 28, 30, 33, 34,
90+
24, 25, 27, 28, 30, 33, 34, 35 } // [PolyV] changed
91+
};
92+
6793
/* maximum number of MBs in the DPB for a given level */
6894
static const int level_max_dpb_mbs[][2] = {
6995
{ 10, 396 },
@@ -142,8 +168,9 @@ static inline int decode_vui_parameters(GetBitContext *gb, void *logctx,
142168

143169
sps->timing_info_present_flag = get_bits1(gb);
144170
if (sps->timing_info_present_flag) {
171+
sps->fixed_frame_rate_flag = get_bits1(gb); // [PolyV] moved
172+
unsigned time_scale = get_bits_long(gb, 32); // [PolyV] moved
145173
unsigned num_units_in_tick = get_bits_long(gb, 32);
146-
unsigned time_scale = get_bits_long(gb, 32);
147174
if (!num_units_in_tick || !time_scale) {
148175
av_log(logctx, AV_LOG_ERROR,
149176
"time_scale/num_units_in_tick invalid or unsupported (%u/%u)\n",
@@ -153,14 +180,13 @@ static inline int decode_vui_parameters(GetBitContext *gb, void *logctx,
153180
sps->num_units_in_tick = num_units_in_tick;
154181
sps->time_scale = time_scale;
155182
}
156-
sps->fixed_frame_rate_flag = get_bits1(gb);
157183
}
158184

159-
sps->nal_hrd_parameters_present_flag = get_bits1(gb);
185+
sps->nal_hrd_parameters_present_flag = get_bits1(gb); // [PolyV] may be flipped, can't prove it
160186
if (sps->nal_hrd_parameters_present_flag)
161187
if (decode_hrd_parameters(gb, logctx, sps) < 0)
162188
return AVERROR_INVALIDDATA;
163-
sps->vcl_hrd_parameters_present_flag = get_bits1(gb);
189+
sps->vcl_hrd_parameters_present_flag = get_bits1(gb); // [PolyV] may be flipped, can't prove it
164190
if (sps->vcl_hrd_parameters_present_flag)
165191
if (decode_hrd_parameters(gb, logctx, sps) < 0)
166192
return AVERROR_INVALIDDATA;
@@ -172,9 +198,9 @@ static inline int decode_vui_parameters(GetBitContext *gb, void *logctx,
172198
return 0;
173199
sps->bitstream_restriction_flag = get_bits1(gb);
174200
if (sps->bitstream_restriction_flag) {
175-
get_bits1(gb); /* motion_vectors_over_pic_boundaries_flag */
176201
get_ue_golomb_31(gb); /* max_bytes_per_pic_denom */
177202
get_ue_golomb_31(gb); /* max_bits_per_mb_denom */
203+
get_bits1(gb); /* motion_vectors_over_pic_boundaries_flag */ // [PolyV] moved
178204
get_ue_golomb_31(gb); /* log2_max_mv_length_horizontal */
179205
get_ue_golomb_31(gb); /* log2_max_mv_length_vertical */
180206
sps->num_reorder_frames = get_ue_golomb_31(gb);
@@ -235,31 +261,72 @@ static int decode_scaling_matrices(GetBitContext *gb, const SPS *sps,
235261
uint8_t(*scaling_matrix8)[64])
236262
{
237263
int fallback_sps = !is_sps && sps->scaling_matrix_present;
238-
const uint8_t *fallback[4] = {
239-
fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0],
240-
fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1],
241-
fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0],
242-
fallback_sps ? sps->scaling_matrix8[3] : default_scaling8[1]
243-
};
264+
const uint8_t *fallback_0;
265+
const uint8_t *fallback_1;
266+
const uint8_t *fallback_2;
267+
const uint8_t *fallback_3;
268+
269+
int b_mars_flag;
270+
271+
if (sps->profile_idc == 77 || sps->profile_idc == 66) {
272+
b_mars_flag = 0;
273+
if (fallback_sps) {
274+
fallback_0 = sps->scaling_matrix4[0];
275+
fallback_1 = sps->scaling_matrix4[3];
276+
fallback_2 = sps->scaling_matrix8[0];
277+
fallback_3 = sps->scaling_matrix8[3];
278+
} else {
279+
fallback_0 = default_scaling4[0];
280+
fallback_1 = default_scaling4[1];
281+
fallback_2 = default_scaling8[0];
282+
fallback_3 = default_scaling8[1];
283+
}
284+
} else {
285+
b_mars_flag = 1;
286+
if (fallback_sps) {
287+
fallback_0 = sps->scaling_matrix4[0];
288+
fallback_1 = sps->scaling_matrix4[3];
289+
fallback_2 = sps->scaling_matrix8[0];
290+
fallback_3 = sps->scaling_matrix8[3];
291+
} else {
292+
fallback_0 = default_scaling4_mars[0]; // [PolyV] edited scaling
293+
fallback_1 = default_scaling4_mars[1]; // [PolyV] edited scaling
294+
fallback_2 = default_scaling8_mars[1]; // [PolyV] edited scaling
295+
fallback_3 = default_scaling8_mars[0]; // [PolyV] edited scaling
296+
}
297+
}
298+
244299
int ret = 0;
245300
*mask = 0x0;
301+
246302
if (present_flag) {
247-
ret |= decode_scaling_list(gb, scaling_matrix4[0], 16, default_scaling4[0], fallback[0], mask, 0); // Intra, Y
248-
ret |= decode_scaling_list(gb, scaling_matrix4[1], 16, default_scaling4[0], scaling_matrix4[0], mask, 1); // Intra, Cr
249-
ret |= decode_scaling_list(gb, scaling_matrix4[2], 16, default_scaling4[0], scaling_matrix4[1], mask, 2); // Intra, Cb
250-
ret |= decode_scaling_list(gb, scaling_matrix4[3], 16, default_scaling4[1], fallback[1], mask, 3); // Inter, Y
251-
ret |= decode_scaling_list(gb, scaling_matrix4[4], 16, default_scaling4[1], scaling_matrix4[3], mask, 4); // Inter, Cr
252-
ret |= decode_scaling_list(gb, scaling_matrix4[5], 16, default_scaling4[1], scaling_matrix4[4], mask, 5); // Inter, Cb
303+
const uint8_t *default4_0 = b_mars_flag ? default_scaling4_mars[0] : default_scaling4[0];
304+
const uint8_t *default4_1 = b_mars_flag ? default_scaling4_mars[1] : default_scaling4[1];
305+
const uint8_t *default8_0 = b_mars_flag ? default_scaling8_mars[0] : default_scaling8[0];
306+
const uint8_t *default8_1 = b_mars_flag ? default_scaling8_mars[1] : default_scaling8[1];
307+
308+
ret |= decode_scaling_list(gb, scaling_matrix4[0], 16, default4_0, fallback_0, mask, 0);
309+
ret |= decode_scaling_list(gb, scaling_matrix4[1], 16, default4_0, scaling_matrix4[0], mask, 1);
310+
ret |= decode_scaling_list(gb, scaling_matrix4[2], 16, default4_0, scaling_matrix4[1], mask, 2);
311+
ret |= decode_scaling_list(gb, scaling_matrix4[3], 16, default4_1, fallback_1, mask, 3);
312+
ret |= decode_scaling_list(gb, scaling_matrix4[4], 16, default4_1, scaling_matrix4[3], mask, 4);
313+
ret |= decode_scaling_list(gb, scaling_matrix4[5], 16, default4_1, scaling_matrix4[4], mask, 5);
314+
253315
if (is_sps || pps->transform_8x8_mode) {
254-
ret |= decode_scaling_list(gb, scaling_matrix8[0], 64, default_scaling8[0], fallback[2], mask, 6); // Intra, Y
255-
ret |= decode_scaling_list(gb, scaling_matrix8[3], 64, default_scaling8[1], fallback[3], mask, 7); // Inter, Y
316+
ret |= decode_scaling_list(gb, scaling_matrix8[0], 64, default8_0, fallback_2, mask, 6);
317+
ret |= decode_scaling_list(gb, scaling_matrix8[3], 64, default8_1, fallback_3, mask, 7);
318+
256319
if (sps->chroma_format_idc == 3) {
257-
ret |= decode_scaling_list(gb, scaling_matrix8[1], 64, default_scaling8[0], scaling_matrix8[0], mask, 8); // Intra, Cr
258-
ret |= decode_scaling_list(gb, scaling_matrix8[4], 64, default_scaling8[1], scaling_matrix8[3], mask, 9); // Inter, Cr
259-
ret |= decode_scaling_list(gb, scaling_matrix8[2], 64, default_scaling8[0], scaling_matrix8[1], mask, 10); // Intra, Cb
260-
ret |= decode_scaling_list(gb, scaling_matrix8[5], 64, default_scaling8[1], scaling_matrix8[4], mask, 11); // Inter, Cb
320+
const uint8_t *default8_0_chroma = b_mars_flag ? default_scaling8_mars[1] : default_scaling8[0]; // [PolyV] swapped
321+
const uint8_t *default8_1_chroma = b_mars_flag ? default_scaling8_mars[0] : default_scaling8[1]; // [PolyV] swapped
322+
323+
ret |= decode_scaling_list(gb, scaling_matrix8[1], 64, default8_0_chroma, scaling_matrix8[0], mask, 8);
324+
ret |= decode_scaling_list(gb, scaling_matrix8[4], 64, default8_1_chroma, scaling_matrix8[3], mask, 9);
325+
ret |= decode_scaling_list(gb, scaling_matrix8[2], 64, default8_0_chroma, scaling_matrix8[1], mask, 10);
326+
ret |= decode_scaling_list(gb, scaling_matrix8[5], 64, default8_1_chroma, scaling_matrix8[4], mask, 11);
261327
}
262328
}
329+
263330
if (!ret)
264331
ret = is_sps;
265332
}
@@ -301,8 +368,6 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
301368
}
302369
memcpy(sps->data, gb->buffer, sps->data_size);
303370

304-
sps->b_mars_flag = 1; // [PolyV] always active
305-
306371
// Re-add the removed stop bit (may be used by hwaccels).
307372
if (!(gb->size_in_bits & 7) && sps->data_size < sizeof(sps->data))
308373
sps->data[sps->data_size++] = 0x80;
@@ -441,7 +506,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
441506
goto fail;
442507
}
443508

444-
sps->ref_frame_count = get_ue_golomb_31(gb) + 4; // [PolyV] Added +4
509+
sps->ref_frame_count = get_ue_golomb_31(gb) - 4; // [PolyV] Added -4
445510
if (avctx->codec_tag == MKTAG('S', 'M', 'V', '2'))
446511
sps->ref_frame_count = FFMAX(2, sps->ref_frame_count);
447512
if (sps->ref_frame_count > H264_MAX_DPB_FRAMES) {
@@ -802,10 +867,10 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
802867
bits_left = bit_length - get_bits_count(gb);
803868
if (bits_left > 0 && more_rbsp_data_in_pps(sps, avctx)) {
804869
pps->transform_8x8_mode = get_bits1(gb);
805-
//pps->pic_scaling_matrix_present_flag = get_bits1(gb); // [PolyV] ignored
806870

807-
if (sps->b_mars_flag == 1) // [PolyV] added
808-
get_bits(gb, 2);
871+
get_bits(gb, 2); // [PolyV] added
872+
873+
pps->pic_scaling_matrix_present_flag = get_bits1(gb); // [PolyV] moved (read inside decode_scaling_matrices in the binary)
809874

810875
ret = decode_scaling_matrices(gb, sps, pps, 0,
811876
pps->pic_scaling_matrix_present_flag,
@@ -814,8 +879,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
814879
if (ret < 0)
815880
goto fail;
816881

817-
if (sps->b_mars_flag == 1) // [PolyV] added
818-
get_se_golomb(gb);
882+
get_se_golomb(gb); // [PolyV] added
819883

820884
// second_chroma_qp_index_offset
821885
pps->chroma_qp_index_offset[1] = get_se_golomb(gb);

libavcodec/h264_ps.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ typedef struct SPS {
4545
unsigned int sps_id;
4646
int profile_idc;
4747
int level_idc;
48-
int b_mars_flag; //< PolyV
4948
int chroma_format_idc;
5049
int transform_bypass; ///< qpprime_y_zero_transform_bypass_flag
5150
int log2_max_frame_num; ///< log2_max_frame_num_minus4 + 4

libavcodec/h264_refs.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,21 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl)
423423
return 0;
424424
}
425425

426-
int ff_h264_decode_ref_pic_list_reordering(H264SliceContext *sl, void *logctx)
426+
int ff_h264_decode_ref_pic_list_reordering(H264SliceContext *sl, void *logctx, int b_mars_flag) // [PolyV] added "b_mars_flag"
427427
{
428428
sl->nb_ref_modifications[0] = 0;
429429
sl->nb_ref_modifications[1] = 0;
430430

431431
for (int list = 0; list < sl->list_count; list++) {
432+
if (b_mars_flag == 1) // [PolyV] added
433+
get_bits(&sl->gb, 2); // [PolyV] added
434+
432435
if (!get_bits1(&sl->gb)) // ref_pic_list_modification_flag_l[01]
433436
continue;
434437

438+
if (b_mars_flag == 1) // [PolyV] added
439+
get_bits1(&sl->gb); // [PolyV] added
440+
435441
for (int index = 0; ; index++) {
436442
unsigned int op = get_ue_golomb_31(&sl->gb);
437443

@@ -441,12 +447,18 @@ int ff_h264_decode_ref_pic_list_reordering(H264SliceContext *sl, void *logctx)
441447
if (index >= sl->ref_count[list]) {
442448
av_log(logctx, AV_LOG_ERROR, "reference count overflow\n");
443449
return AVERROR_INVALIDDATA;
444-
} else if (op > 2) {
450+
}
451+
452+
if (op > 2) {
445453
av_log(logctx, AV_LOG_ERROR,
446454
"illegal modification_of_pic_nums_idc %u\n",
447455
op);
448456
return AVERROR_INVALIDDATA;
449457
}
458+
459+
if (b_mars_flag == 1) // [PolyV] added
460+
get_bits(&sl->gb, 2); // [PolyV] added
461+
450462
sl->ref_modifications[list][index].val = get_ue_golomb_long(&sl->gb);
451463
sl->ref_modifications[list][index].op = op;
452464
sl->nb_ref_modifications[list]++;
@@ -825,7 +837,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h)
825837
}
826838

827839
int ff_h264_decode_ref_pic_marking(H264SliceContext *sl, GetBitContext *gb,
828-
const H2645NAL *nal, void *logctx, int read_extra)
840+
const H2645NAL *nal, void *logctx, int b_mars_flag) // [PolyV] added "b_mars_flag"
829841
{
830842
MMCO *mmco = sl->mmco;
831843
int nb_mmco = 0;
@@ -841,8 +853,8 @@ int ff_h264_decode_ref_pic_marking(H264SliceContext *sl, GetBitContext *gb,
841853
} else {
842854
sl->explicit_ref_marking = get_bits1(gb);
843855
if (sl->explicit_ref_marking) {
844-
if (read_extra)
845-
get_ue_golomb_31(gb);
856+
if (b_mars_flag) // [PolyV] added
857+
get_ue_golomb_31(gb); // [PolyV] added
846858
int i;
847859
for (i = 0; i < FF_ARRAY_ELEMS(sl->mmco); i++) {
848860
MMCOOpcode opcode = get_ue_golomb_31(gb);

0 commit comments

Comments
 (0)