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
43 30, 23, 31, 38, 45, 52, 60, 53,43 30, 23, 31, 38, 45, 52, 60, 53,
44 46, 39, 47, 54, 61, 62, 55, 6344 46, 39, 47, 54, 61, 62, 55, 63
45};45};
46
47const 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
50const 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
29 29
30extern const uint8_t ff_prores_progressive_scan[64];30extern const uint8_t ff_prores_progressive_scan[64];
31extern const uint8_t ff_prores_interlaced_scan[64];31extern const uint8_t ff_prores_interlaced_scan[64];
32extern const uint8_t ff_prores_run_to_cb[16];
33extern const uint8_t ff_prores_level_to_cb[10];
32 34
33#define FIRST_DC_CB 0xB8 // rice_order = 5, exp_golomb_order = 6, switch_bits = 035#define FIRST_DC_CB 0xB8 // rice_order = 5, exp_golomb_order = 6, switch_bits = 0
34 36
libavcodec/proresenc_anatoliy.c+2−7
@@ -296,11 +296,6 @@ static void encode_dc_coeffs(PutBitContext *pb, int16_t *in, · 295 unmodified lines
296 }296 }
297}297}
298 298
299static const uint8_t run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29,
300 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C };
301static const uint8_t lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28,
302 0x28, 0x28, 0x28, 0x4C };
303
304static void encode_ac_coeffs(PutBitContext *pb,299static void encode_ac_coeffs(PutBitContext *pb,
305 int16_t *in, int blocks_per_slice, int *qmat, const uint8_t ff_prores_scan[64])300 int16_t *in, int blocks_per_slice, int *qmat, const uint8_t ff_prores_scan[64])
306{301{
@@ -313,14 +308,14 @@ static void encode_ac_coeffs(PutBitContext *pb, · 6 unmodified lines
313 for (j = 0; j < blocks_per_slice; j++) {308 for (j = 0; j < blocks_per_slice; j++) {
314 int val = QSCALE(qmat, indp, in[(j << 6) + indp]);309 int val = QSCALE(qmat, indp, in[(j << 6) + indp]);
315 if (val) {310 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)]);
317 312
318 prev_run = run;313 prev_run = run;
319 run = 0;314 run = 0;
320 level = get_level(val);315 level = get_level(val);
321 code = level - 1;316 code = level - 1;
322 317
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)]);
324 319
325 prev_level = level;320 prev_level = level;
326 321

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