diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-07-22 04:04:02 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-07-26 00:35:45 +0300 |
commit | 247d513beb24a55bf3519bd52fa72a9f30f693a5 (patch) | |
tree | 269af075ef66faf39149ec4ab782d7422167f199 /libavcodec/hevc_cabac.c | |
parent | 5bf4ac9113cddc3eeddfd8c9867bc870820370a0 (diff) |
avcodec/hevcdec: Avoid allocation of common CABAC state
It used to be allocated separately, so that the pointer to it
is copied to all HEVCContexts, so that all slice-threads
use the same. This is completely unnecessary now that there
is only one HEVCContext any more. There is just one minor
complication left: The slice-threads only get a pointer to
const HEVCContext, but they need to modify the common CABAC
state. Fix this by adding a pointer to the common CABAC state
to HEVCLocalContext and document why it exists.
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/hevc_cabac.c')
-rw-r--r-- | libavcodec/hevc_cabac.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c index f8f349dc4c..6b38da84bd 100644 --- a/libavcodec/hevc_cabac.c +++ b/libavcodec/hevc_cabac.c @@ -455,18 +455,18 @@ void ff_hevc_save_states(HEVCLocalContext *lc, int ctb_addr_ts) (ctb_addr_ts % s->ps.sps->ctb_width == 2 || (s->ps.sps->ctb_width == 2 && ctb_addr_ts % s->ps.sps->ctb_width == 0))) { - memcpy(s->cabac->state, lc->cabac_state, HEVC_CONTEXTS); + memcpy(lc->common_cabac_state->state, lc->cabac_state, HEVC_CONTEXTS); if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { - memcpy(s->cabac->stat_coeff, lc->stat_coeff, HEVC_STAT_COEFFS); + memcpy(lc->common_cabac_state->stat_coeff, lc->stat_coeff, HEVC_STAT_COEFFS); } } } static void load_states(HEVCLocalContext *lc, const HEVCContext *s) { - memcpy(lc->cabac_state, s->cabac->state, HEVC_CONTEXTS); + memcpy(lc->cabac_state, lc->common_cabac_state->state, HEVC_CONTEXTS); if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { - memcpy(lc->stat_coeff, s->cabac->stat_coeff, HEVC_STAT_COEFFS); + memcpy(lc->stat_coeff, lc->common_cabac_state->stat_coeff, HEVC_STAT_COEFFS); } } |