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

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/hevc/hevcdec.c+6−9
@@ -589,9 +589,8 @@ fail: · 588 unmodified lines
589 return ret;589 return ret;
590}590}
591 591
592static int hls_slice_header(HEVCContext *s, GetBitContext *gb)592static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext *gb)
593{593{
594 SliceHeader *sh = &s->sh;
595 const HEVCPPS *pps;594 const HEVCPPS *pps;
596 const HEVCSPS *sps;595 const HEVCSPS *sps;
597 unsigned pps_id;596 unsigned pps_id;
@@ -647,12 +646,9 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) · 49 unmodified lines
647 }646 }
648 } else {647 } else {
649 sh->slice_segment_addr = sh->slice_addr = 0;648 sh->slice_segment_addr = sh->slice_addr = 0;
650 s->slice_initialized = 0;
651 }649 }
652 650
653 if (!sh->dependent_slice_segment_flag) {651 if (!sh->dependent_slice_segment_flag) {
654 s->slice_initialized = 0;
655
656 for (i = 0; i < pps->num_extra_slice_header_bits; i++)652 for (i = 0; i < pps->num_extra_slice_header_bits; i++)
657 skip_bits(gb, 1); // slice_reserved_undetermined_flag[]653 skip_bits(gb, 1); // slice_reserved_undetermined_flag[]
658 654
@@ -991,8 +987,6 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) · 332 unmodified lines
991 return AVERROR_INVALIDDATA;987 return AVERROR_INVALIDDATA;
992 }988 }
993 989
994 s->slice_initialized = 1;
995
996 return 0;990 return 0;
997}991}
998 992
@@ -2798,6 +2792,8 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext · 1799 unmodified lines
2798 }2792 }
2799 }2793 }
2800 2794
2795 s->slice_initialized = 1;
2796
2801 if (s->avctx->hwaccel)2797 if (s->avctx->hwaccel)
2802 return FF_HW_CALL(s->avctx, decode_slice, nal->raw_data, nal->raw_size);2798 return FF_HW_CALL(s->avctx, decode_slice, nal->raw_data, nal->raw_size);
2803 2799
@@ -3042,6 +3038,7 @@ fail: · 238 unmodified lines
3042 if (s->cur_frame)3038 if (s->cur_frame)
3043 ff_hevc_unref_frame(s->cur_frame, ~0);3039 ff_hevc_unref_frame(s->cur_frame, ~0);
3044 s->cur_frame = s->collocated_ref = NULL;3040 s->cur_frame = s->collocated_ref = NULL;
3041 s->slice_initialized = 0;
3045 return ret;3042 return ret;
3046}3043}
3047 3044
@@ -3131,7 +3128,7 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) · 83 unmodified lines
3131 case HEVC_NAL_RADL_R:3128 case HEVC_NAL_RADL_R:
3132 case HEVC_NAL_RASL_N:3129 case HEVC_NAL_RASL_N:
3133 case HEVC_NAL_RASL_R:3130 case HEVC_NAL_RASL_R:
3134 ret = hls_slice_header(s, &gb);3131 ret = hls_slice_header(&s->sh, s, &gb);
3135 if (ret < 0)3132 if (ret < 0)
3136 return ret;3133 return ret;
3137 if (ret == 1) {3134 if (ret == 1) {
@@ -3139,7 +3136,6 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) · 1 unmodified line
3139 goto fail;3136 goto fail;
3140 }3137 }
3141 3138
3142
3143 if ((s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) ||3139 if ((s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) ||
3144 (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) ||3140 (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) ||
3145 (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IRAP(s)) ||3141 (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
3211 s->last_eos = s->eos;3207 s->last_eos = s->eos;
3212 s->eos = 0;3208 s->eos = 0;
3213 s->overlap = 0;3209 s->overlap = 0;
3210 s->slice_initialized = 0;
3214 3211
3215 /* split the input packet into NAL units, so we know the upper bound on the3212 /* split the input packet into NAL units, so we know the upper bound on the
3216 * number of slices in the frame */3213 * 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