aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2023-12-11 01:07:16 +0100
committerClément Bœsch <u@pkh.me>2024-01-10 14:08:00 +0100
commit3ba52f18e4ec7755cf5866a90bb944bcba4d824b (patch)
tree3e026bda4de88e2a57bc3b4dea4bf4b36064ba33
parente940baa65bcbdf86466fd5a8c7504caa7c1a9ec1 (diff)
downloadffmpeg-3ba52f18e4ec7755cf5866a90bb944bcba4d824b.tar.gz
avcodec/proresenc_anatoliy: move run/lev to codebook LUT to shared proresdata
This is going to be shared with proresenc_kostya in the upcoming commit.
-rw-r--r--libavcodec/proresdata.c6
-rw-r--r--libavcodec/proresdata.h2
-rw-r--r--libavcodec/proresenc_anatoliy.c9
3 files changed, 10 insertions, 7 deletions
diff --git a/libavcodec/proresdata.c b/libavcodec/proresdata.c
index 4787907c71..167bedf794 100644
--- a/libavcodec/proresdata.c
+++ b/libavcodec/proresdata.c
@@ -43,3 +43,9 @@ const uint8_t ff_prores_interlaced_scan[64] = {
30, 23, 31, 38, 45, 52, 60, 53,
46, 39, 47, 54, 61, 62, 55, 63
};
+
+const uint8_t ff_prores_run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29,
+ 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C };
+
+const uint8_t ff_prores_level_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28,
+ 0x28, 0x28, 0x28, 0x4C };
diff --git a/libavcodec/proresdata.h b/libavcodec/proresdata.h
index d8c8786689..28eb3256b6 100644
--- a/libavcodec/proresdata.h
+++ b/libavcodec/proresdata.h
@@ -29,6 +29,8 @@
extern const uint8_t ff_prores_progressive_scan[64];
extern const uint8_t ff_prores_interlaced_scan[64];
+extern const uint8_t ff_prores_run_to_cb[16];
+extern const uint8_t ff_prores_level_to_cb[10];
#define FIRST_DC_CB 0xB8 // rice_order = 5, exp_golomb_order = 6, switch_bits = 0
diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 9b9ffa03be..9064d4266c 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -296,11 +296,6 @@ static void encode_dc_coeffs(PutBitContext *pb, int16_t *in,
}
}
-static const uint8_t run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29,
- 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C };
-static const uint8_t lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28,
- 0x28, 0x28, 0x28, 0x4C };
-
static void encode_ac_coeffs(PutBitContext *pb,
int16_t *in, int blocks_per_slice, int *qmat, const uint8_t ff_prores_scan[64])
{
@@ -313,14 +308,14 @@ static void encode_ac_coeffs(PutBitContext *pb,
for (j = 0; j < blocks_per_slice; j++) {
int val = QSCALE(qmat, indp, in[(j << 6) + indp]);
if (val) {
- encode_codeword(pb, run, run_to_cb[FFMIN(prev_run, 15)]);
+ encode_codeword(pb, run, ff_prores_run_to_cb[FFMIN(prev_run, 15)]);
prev_run = run;
run = 0;
level = get_level(val);
code = level - 1;
- encode_codeword(pb, code, lev_to_cb[FFMIN(prev_level, 9)]);
+ encode_codeword(pb, code, ff_prores_level_to_cb[FFMIN(prev_level, 9)]);
prev_level = level;