History

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.

Clément Bœsch committed 2 years ago

Commit 3ba52f11 parent e940baa3 files · +10 −7Browse files

Unified · Split

3 files
  1. libavcodec/proresdata.c +6 −0
  2. libavcodec/proresdata.h +2 −0
  3. libavcodec/proresenc_anatoliy.c +2 −7
libavcodec/proresdata.c+6−0
@@ -43,3 +43,9 @@ const uint8_t ff_prores_interlaced_scan[64] = { · 42 unmodified lines
4343 30, 23, 31, 38, 45, 52, 60, 53,
4444 46, 39, 47, 54, 61, 62, 55, 63
4545 };
46+
47+const uint8_t ff_prores_run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29,
48+ 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C };
49+
50+const uint8_t ff_prores_level_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28,
51+ 0x28, 0x28, 0x28, 0x4C };
libavcodec/proresdata.h+2−0
@@ -29,6 +29,8 @@ · 28 unmodified lines
2929
3030 extern const uint8_t ff_prores_progressive_scan[64];
3131 extern const uint8_t ff_prores_interlaced_scan[64];
32+extern const uint8_t ff_prores_run_to_cb[16];
33+extern const uint8_t ff_prores_level_to_cb[10];
3234
3335 #define FIRST_DC_CB 0xB8 // rice_order = 5, exp_golomb_order = 6, switch_bits = 0
3436
libavcodec/proresenc_anatoliy.c+2−7
@@ -296,11 +296,6 @@ static void encode_dc_coeffs(PutBitContext *pb, int16_t *in, · 295 unmodified lines
296296 }
297297 }
298298
299−static const uint8_t run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29,
300− 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C };
301−static const uint8_t lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28,
302− 0x28, 0x28, 0x28, 0x4C };
303−
304299 static void encode_ac_coeffs(PutBitContext *pb,
305300 int16_t *in, int blocks_per_slice, int *qmat, const uint8_t ff_prores_scan[64])
306301 {
@@ -313,14 +308,14 @@ static void encode_ac_coeffs(PutBitContext *pb, · 6 unmodified lines
313308 for (j = 0; j < blocks_per_slice; j++) {
314309 int val = QSCALE(qmat, indp, in[(j << 6) + indp]);
315310 if (val) {
316− encode_codeword(pb, run, run_to_cb[FFMIN(prev_run, 15)]);
311+ encode_codeword(pb, run, ff_prores_run_to_cb[FFMIN(prev_run, 15)]);
317312
318313 prev_run = run;
319314 run = 0;
320315 level = get_level(val);
321316 code = level - 1;
322317
323− encode_codeword(pb, code, lev_to_cb[FFMIN(prev_level, 9)]);
318+ encode_codeword(pb, code, ff_prores_level_to_cb[FFMIN(prev_level, 9)]);
324319
325320 prev_level = level;
326321

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t