summaryrefslogtreecommitdiff
path: root/libavcodec/mqc.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-05-07 04:12:13 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-05-12 06:00:14 +0200
commitb43e946b71e144a4ce5e83cd18e5a07155edb26f (patch)
treedf26ccfbe9cbe32a334db8cd50bc8acdddfcde00 /libavcodec/mqc.h
parent65462185721e3686e27f22e952485ffc4ebd6f97 (diff)
avcodec/mqc: Hardcode tables to save space
mqc currently initializes three arrays at runtime; each of them has 2 * 47 elements, one is uint16_t, two are uint8_t, so that their combined size is 8 * 47. The source data for these initializations is contained in an array of 47 elements of size six. Said array is only used in order to initialize the other arrays, so the savings are just 2 * 47B. Yet this is dwarfed by the size of the code for performing the initializations: It is 109B (GCC 10.2, x64, -O3 albeit in an av_cold function); this does not even include the size of the code in the callers. So just hardcode these tables. This also fixes a data race, because the encoder always initialized these tables during init, although they might already be used at the same time by already running encoder/decoder instances. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mqc.h')
-rw-r--r--libavcodec/mqc.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/libavcodec/mqc.h b/libavcodec/mqc.h
index 73604d5efe..ad80fe9228 100644
--- a/libavcodec/mqc.h
+++ b/libavcodec/mqc.h
@@ -33,9 +33,9 @@
#define MQC_CX_UNI 17
#define MQC_CX_RL 18
-extern uint16_t ff_mqc_qe[2 * 47];
-extern uint8_t ff_mqc_nlps[2 * 47];
-extern uint8_t ff_mqc_nmps[2 * 47];
+extern const uint16_t ff_mqc_qe[2 * 47];
+extern const uint8_t ff_mqc_nlps[2 * 47];
+extern const uint8_t ff_mqc_nmps[2 * 47];
typedef struct MqcState {
uint8_t *bp, *bpstart;
@@ -80,11 +80,6 @@ int ff_mqc_decode(MqcState *mqc, uint8_t *cxstate);
/* common */
/**
- * MQ-coder Initialize context tables (QE, NLPS, NMPS)
- */
-void ff_mqc_init_context_tables(void);
-
-/**
* MQ-coder context initialisations.
* @param mqc MQ-coder context
*/