summaryrefslogtreecommitdiff
path: root/libavcodec/hevcdec.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-22 03:04:02 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-25 23:35:45 +0200
commit247d513beb24a55bf3519bd52fa72a9f30f693a5 (patch)
tree269af075ef66faf39149ec4ab782d7422167f199 /libavcodec/hevcdec.h
parent5bf4ac9113cddc3eeddfd8c9867bc870820370a0 (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/hevcdec.h')
-rw-r--r--libavcodec/hevcdec.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 3367ee312a..6cef9e6f0a 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -439,6 +439,18 @@ typedef struct HEVCLocalContext {
GetBitContext gb;
CABACContext cc;
+ /**
+ * This is a pointer to the common CABAC state.
+ * In case entropy_coding_sync_enabled_flag is set,
+ * the CABAC state after decoding the second CTU in a row is
+ * stored here and used to initialize the CABAC state before
+ * decoding the first CTU in the next row.
+ * This is the basis for WPP and in case slice-threading is used,
+ * the next row is decoded by another thread making this state
+ * shared between threads.
+ */
+ HEVCCABACState *common_cabac_state;
+
int8_t qp_y;
int8_t curr_qp_y;
@@ -485,8 +497,6 @@ typedef struct HEVCContext {
int width;
int height;
- HEVCCABACState *cabac;
-
/** 1 if the independent slice segment header was successfully parsed */
uint8_t slice_initialized;
@@ -559,6 +569,9 @@ typedef struct HEVCContext {
uint16_t seq_decode;
uint16_t seq_output;
+ /** The target for the common_cabac_state of the local contexts. */
+ HEVCCABACState cabac;
+
int enable_parallel_tiles;
atomic_int wpp_err;