hls_slice_header() no longer modifies anything in HEVCContext besides SliceHeader.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -589,9 +589,8 @@ fail: · 588 unmodified lines | ||
| 589 | 589 | return ret; |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | −static int hls_slice_header(HEVCContext *s, GetBitContext *gb) | |
| 592 | +static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext *gb) | |
| 593 | 593 | { |
| 594 | − SliceHeader *sh = &s->sh; | |
| 595 | 594 | const HEVCPPS *pps; |
| 596 | 595 | const HEVCSPS *sps; |
| 597 | 596 | unsigned pps_id; |
| @@ -647,12 +646,9 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) · 49 unmodified lines | ||
| 647 | 646 | } |
| 648 | 647 | } else { |
| 649 | 648 | sh->slice_segment_addr = sh->slice_addr = 0; |
| 650 | − s->slice_initialized = 0; | |
| 651 | 649 | } |
| 652 | 650 | |
| 653 | 651 | if (!sh->dependent_slice_segment_flag) { |
| 654 | − s->slice_initialized = 0; | |
| 655 | − | |
| 656 | 652 | for (i = 0; i < pps->num_extra_slice_header_bits; i++) |
| 657 | 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 | 987 | return AVERROR_INVALIDDATA; |
| 992 | 988 | } |
| 993 | 989 | |
| 994 | − s->slice_initialized = 1; | |
| 995 | − | |
| 996 | 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 | 2797 | if (s->avctx->hwaccel) |
| 2802 | 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 | 3038 | if (s->cur_frame) |
| 3043 | 3039 | ff_hevc_unref_frame(s->cur_frame, ~0); |
| 3044 | 3040 | s->cur_frame = s->collocated_ref = NULL; |
| 3041 | + s->slice_initialized = 0; | |
| 3045 | 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 | 3128 | case HEVC_NAL_RADL_R: |
| 3132 | 3129 | case HEVC_NAL_RASL_N: |
| 3133 | 3130 | case HEVC_NAL_RASL_R: |
| 3134 | − ret = hls_slice_header(s, &gb); | |
| 3131 | + ret = hls_slice_header(&s->sh, s, &gb); | |
| 3135 | 3132 | if (ret < 0) |
| 3136 | 3133 | return ret; |
| 3137 | 3134 | if (ret == 1) { |
| @@ -3139,7 +3136,6 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) · 1 unmodified line | ||
| 3139 | 3136 | goto fail; |
| 3140 | 3137 | } |
| 3141 | 3138 | |
| 3142 | − | |
| 3143 | 3139 | if ((s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) || |
| 3144 | 3140 | (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) || |
| 3145 | 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 | 3207 | s->last_eos = s->eos; |
| 3212 | 3208 | s->eos = 0; |
| 3213 | 3209 | s->overlap = 0; |
| 3210 | + s->slice_initialized = 0; | |
| 3214 | 3211 | |
| 3215 | 3212 | /* split the input packet into NAL units, so we know the upper bound on the |
| 3216 | 3213 | * number of slices in the frame */ |