|
|
|
@@ -454,12 +454,19 @@ void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts) |
|
|
|
(s->ps.sps->ctb_width == 2 && |
|
|
|
ctb_addr_ts % s->ps.sps->ctb_width == 0))) { |
|
|
|
memcpy(s->cabac_state, s->HEVClc->cabac_state, HEVC_CONTEXTS); |
|
|
|
if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { |
|
|
|
memcpy(s->stat_coeff, s->HEVClc->stat_coeff, HEVC_STAT_COEFFS); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void load_states(HEVCContext *s) |
|
|
|
static void load_states(HEVCContext *s, int thread) |
|
|
|
{ |
|
|
|
memcpy(s->HEVClc->cabac_state, s->cabac_state, HEVC_CONTEXTS); |
|
|
|
if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { |
|
|
|
const HEVCContext *prev = s->sList[(thread + s->threads_number - 1) % s->threads_number]; |
|
|
|
memcpy(s->HEVClc->stat_coeff, prev->stat_coeff, HEVC_STAT_COEFFS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static int cabac_reinit(HEVCLocalContext *lc) |
|
|
|
@@ -501,7 +508,7 @@ static void cabac_init_state(HEVCContext *s) |
|
|
|
s->HEVClc->stat_coeff[i] = 0; |
|
|
|
} |
|
|
|
|
|
|
|
int ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts) |
|
|
|
int ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts, int thread) |
|
|
|
{ |
|
|
|
if (ctb_addr_ts == s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]) { |
|
|
|
int ret = cabac_init_decoder(s); |
|
|
|
@@ -518,7 +525,7 @@ int ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts) |
|
|
|
if (s->ps.sps->ctb_width == 1) |
|
|
|
cabac_init_state(s); |
|
|
|
else if (s->sh.dependent_slice_segment_flag == 1) |
|
|
|
load_states(s); |
|
|
|
load_states(s, thread); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
@@ -549,7 +556,7 @@ int ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts) |
|
|
|
if (s->ps.sps->ctb_width == 1) |
|
|
|
cabac_init_state(s); |
|
|
|
else |
|
|
|
load_states(s); |
|
|
|
load_states(s, thread); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|