History

lavc/hevcdec: move setting slice_initialized out of hls_slice_header()

hls_slice_header() no longer modifies anything in HEVCContext besides SliceHeader.

Anton Khirnov committed 2 years ago

Commit a8f9d521 parent 82ded1a1 file · +6 −9Browse files

Unified · Split

libavcodec/hevc/hevcdec.c+6−9
@@ -589,9 +589,8 @@ fail: · 588 unmodified lines
589589 return ret;
590590 }
591591
592−static int hls_slice_header(HEVCContext *s, GetBitContext *gb)
592+static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext *gb)
593593 {
594− SliceHeader *sh = &s->sh;
595594 const HEVCPPS *pps;
596595 const HEVCSPS *sps;
597596 unsigned pps_id;
@@ -647,12 +646,9 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) · 49 unmodified lines
647646 }
648647 } else {
649648 sh->slice_segment_addr = sh->slice_addr = 0;
650− s->slice_initialized = 0;
651649 }
652650
653651 if (!sh->dependent_slice_segment_flag) {
654− s->slice_initialized = 0;
655−
656652 for (i = 0; i < pps->num_extra_slice_header_bits; i++)
657653 skip_bits(gb, 1); // slice_reserved_undetermined_flag[]
658654
@@ -991,8 +987,6 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) · 332 unmodified lines
991987 return AVERROR_INVALIDDATA;
992988 }
993989
994− s->slice_initialized = 1;
995−
996990 return 0;
997991 }
998992
@@ -2798,6 +2792,8 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext · 1799 unmodified lines
27982792 }
27992793 }
28002794
2795+ s->slice_initialized = 1;
2796+
28012797 if (s->avctx->hwaccel)
28022798 return FF_HW_CALL(s->avctx, decode_slice, nal->raw_data, nal->raw_size);
28032799
@@ -3042,6 +3038,7 @@ fail: · 238 unmodified lines
30423038 if (s->cur_frame)
30433039 ff_hevc_unref_frame(s->cur_frame, ~0);
30443040 s->cur_frame = s->collocated_ref = NULL;
3041+ s->slice_initialized = 0;
30453042 return ret;
30463043 }
30473044
@@ -3131,7 +3128,7 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) · 83 unmodified lines
31313128 case HEVC_NAL_RADL_R:
31323129 case HEVC_NAL_RASL_N:
31333130 case HEVC_NAL_RASL_R:
3134− ret = hls_slice_header(s, &gb);
3131+ ret = hls_slice_header(&s->sh, s, &gb);
31353132 if (ret < 0)
31363133 return ret;
31373134 if (ret == 1) {
@@ -3139,7 +3136,6 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) · 1 unmodified line
31393136 goto fail;
31403137 }
31413138
3142−
31433139 if ((s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) ||
31443140 (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) ||
31453141 (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IRAP(s)) ||
@@ -3211,6 +3207,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) · 65 unmodified lines
32113207 s->last_eos = s->eos;
32123208 s->eos = 0;
32133209 s->overlap = 0;
3210+ s->slice_initialized = 0;
32143211
32153212 /* split the input packet into NAL units, so we know the upper bound on the
32163213 * number of slices in the frame */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t