aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dcahuff.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-05 23:28:01 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-16 18:07:29 +0200
commit2339f63eac90a7a3b25f2d5ee5749dbc46563684 (patch)
tree4321bad17581e982c2451bcfde992b184c24a4ea /libavcodec/dcahuff.h
parent077880ad88eb1218c5c6b3b134e75317701dbe81 (diff)
downloadffmpeg-2339f63eac90a7a3b25f2d5ee5749dbc46563684.tar.gz
avcodec/dcaenc: Create encoder-adapted tables
Up until now, the encoder used the same tables that the decoder uses to create its VLCs. These have the downside of requiring the encoder to offset the tables at runtime as well as having to read from separate tables for the length as well as the code of the symbol to encode. The former are uint8_t, the latter uint16_t, so using a joint table would require padding, but this doesn't matter when these tables are generated at runtime, because they live in the .bss segment. Also move these init functions as well as the functions that actually use them to dcaenc.c, because they are encoder-specific. This also allows to remove an inclusion of PutBitContext from dcahuff.h (and indirectly from all dca-decoder files). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/dcahuff.h')
-rw-r--r--libavcodec/dcahuff.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/libavcodec/dcahuff.h b/libavcodec/dcahuff.h
index 1f13b6f443..68974d9965 100644
--- a/libavcodec/dcahuff.h
+++ b/libavcodec/dcahuff.h
@@ -27,11 +27,13 @@
#include "libavutil/attributes.h"
-#include "put_bits.h"
#include "vlc.h"
#define DCA_CODE_BOOKS 10
#define DCA_BITALLOC_12_COUNT 5
+#define DCA_NUM_BITALLOC_CODES (1 * 3 + \
+ 3 * (5 + 7 + 9 + 13) \
+ + 7 * (17 + 25 + 33 + 65 + 129))
typedef struct DCAVLC {
int offset; ///< Code values offset
@@ -58,10 +60,14 @@ extern VLC ff_dca_vlc_grid_2;
extern VLC ff_dca_vlc_grid_3;
extern VLC ff_dca_vlc_rsd;
+extern const int8_t ff_dca_bitalloc_offsets[DCA_CODE_BOOKS];
+extern const uint8_t ff_dca_bitalloc_sizes[DCA_CODE_BOOKS];
+extern const uint16_t *const ff_dca_bitalloc_codes[DCA_CODE_BOOKS][8];
+extern const uint8_t *const ff_dca_bitalloc_bits[DCA_CODE_BOOKS][8];
+
+extern const uint8_t ff_dca_bitalloc_12_bits[DCA_BITALLOC_12_COUNT][12];
+extern const uint16_t ff_dca_bitalloc_12_codes[DCA_BITALLOC_12_COUNT][12];
+
av_cold void ff_dca_init_vlcs(void);
-uint32_t ff_dca_vlc_calc_quant_bits(int *values, uint8_t n, uint8_t sel, uint8_t abits);
-void ff_dca_vlc_enc_quant(PutBitContext *pb, int *values, uint8_t n, uint8_t sel, uint8_t abits);
-uint32_t ff_dca_vlc_calc_alloc_bits(int *values, uint8_t n, uint8_t sel);
-void ff_dca_vlc_enc_alloc(PutBitContext *pb, int *values, uint8_t n, uint8_t sel);
#endif /* AVCODEC_DCAHUFF_H */