Skip to content

Commit 9032362

Browse files
committed
hevc: fix RAP_B_Bossen
1 parent f1e1ab7 commit 9032362

File tree

3 files changed

+20
-35
lines changed

3 files changed

+20
-35
lines changed

libavcodec/hevc.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -362,17 +362,6 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
362362
return ret;
363363
}
364364

365-
static int is_sps_exist(HEVCContext *s, const HEVCSPS* last_sps)
366-
{
367-
int i;
368-
369-
for( i = 0; i < MAX_SPS_COUNT; i++)
370-
if(s->sps_list[i])
371-
if (last_sps == (HEVCSPS*)s->sps_list[i]->data)
372-
return 1;
373-
return 0;
374-
}
375-
376365
static int hls_slice_header(HEVCContext *s)
377366
{
378367
GetBitContext *gb = &s->HEVClc->gb;
@@ -390,8 +379,6 @@ static int hls_slice_header(HEVCContext *s)
390379
sh->no_output_of_prior_pics_flag = 0;
391380
if (IS_IRAP(s))
392381
sh->no_output_of_prior_pics_flag = get_bits1(gb);
393-
if (s->nal_unit_type == NAL_CRA_NUT && s->last_eos == 1)
394-
sh->no_output_of_prior_pics_flag = 1;
395382

396383
sh->pps_id = get_ue_golomb_long(gb);
397384
if (sh->pps_id >= MAX_PPS_COUNT || !s->pps_list[sh->pps_id]) {
@@ -404,16 +391,16 @@ static int hls_slice_header(HEVCContext *s)
404391
return AVERROR_INVALIDDATA;
405392
}
406393
s->pps = (HEVCPPS*)s->pps_list[sh->pps_id]->data;
394+
if (s->nal_unit_type == NAL_CRA_NUT && s->last_eos == 1)
395+
sh->no_output_of_prior_pics_flag = 1;
407396

408397
if (s->sps != (HEVCSPS*)s->sps_list[s->pps->sps_id]->data) {
409398
const HEVCSPS* last_sps = s->sps;
410399
s->sps = (HEVCSPS*)s->sps_list[s->pps->sps_id]->data;
411-
if (last_sps) {
412-
if (is_sps_exist(s, last_sps)) {
413-
if (s->sps->width != last_sps->width || s->sps->height != last_sps->height ||
414-
s->sps->temporal_layer[s->sps->max_sub_layers - 1].max_dec_pic_buffering != last_sps->temporal_layer[last_sps->max_sub_layers - 1].max_dec_pic_buffering)
415-
sh->no_output_of_prior_pics_flag = 0;
416-
} else
400+
if (last_sps && IS_IRAP(s) && s->nal_unit_type != NAL_CRA_NUT) {
401+
if (s->sps->width != last_sps->width || s->sps->height != last_sps->height ||
402+
s->sps->temporal_layer[s->sps->max_sub_layers - 1].max_dec_pic_buffering !=
403+
last_sps->temporal_layer[last_sps->max_sub_layers - 1].max_dec_pic_buffering)
417404
sh->no_output_of_prior_pics_flag = 0;
418405
}
419406
ff_hevc_clear_refs(s);

tests/fate/hevc.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ HEVC_SAMPLES_444_12BIT = \
165165
# AMP_E_Hisilicon_3 -- AMP_E_Hisilicon
166166
# MVDL1ZERO_A_docomo_4 -- MVDL1ZERO_A_docomo_3
167167
# RAP_A_docomo_5 -- RAP_A_docomo_4
168+
# RAP_B_bossen_2 -- RAP_B_bossen_1
168169
# RPS_A_docomo_5 -- RPS_A_docomo_4
169170
# RPS_F_docomo_2 -- RPS_F_docomo_1
170171

tests/ref/fate/hevc-conformance-RAP_B_Bossen_1

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,16 @@
6666
0, 64, 64, 1, 149760, 0x3362678b
6767
0, 65, 65, 1, 149760, 0x6e7fc851
6868
0, 66, 66, 1, 149760, 0x33f96449
69-
0, 67, 67, 1, 149760, 0xd9d05007
70-
0, 68, 68, 1, 149760, 0x477f2cf2
71-
0, 69, 69, 1, 149760, 0xe1f9ccd0
72-
0, 70, 70, 1, 149760, 0xb3ba8cfb
73-
0, 71, 71, 1, 149760, 0x64787995
74-
0, 72, 72, 1, 149760, 0xc10de4c4
75-
0, 73, 73, 1, 149760, 0x18dd343f
76-
0, 74, 74, 1, 149760, 0xa1c51358
77-
0, 75, 75, 1, 149760, 0x91fe6361
78-
0, 76, 76, 1, 149760, 0xeec85f94
79-
0, 77, 77, 1, 149760, 0x00a57402
80-
0, 78, 78, 1, 149760, 0x4e88cc16
81-
0, 79, 79, 1, 149760, 0xdbd51976
82-
0, 80, 80, 1, 149760, 0xfebf6b1a
83-
0, 81, 81, 1, 149760, 0x052546d2
84-
0, 82, 82, 1, 149760, 0x046cd73b
69+
0, 67, 67, 1, 149760, 0xb3ba8cfb
70+
0, 68, 68, 1, 149760, 0x64787995
71+
0, 69, 69, 1, 149760, 0xc10de4c4
72+
0, 70, 70, 1, 149760, 0x18dd343f
73+
0, 71, 71, 1, 149760, 0xa1c51358
74+
0, 72, 72, 1, 149760, 0x91fe6361
75+
0, 73, 73, 1, 149760, 0xeec85f94
76+
0, 74, 74, 1, 149760, 0x00a57402
77+
0, 75, 75, 1, 149760, 0x4e88cc16
78+
0, 76, 76, 1, 149760, 0xdbd51976
79+
0, 77, 77, 1, 149760, 0xfebf6b1a
80+
0, 78, 78, 1, 149760, 0x052546d2
81+
0, 79, 79, 1, 149760, 0x046cd73b

0 commit comments

Comments
 (0)