1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

dnxhddec: store 2*level+1 in ac_level tables

This is the value actually used by the decoder in speed-critical code.
The encoder uses these tables only in init code.

Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
Mans Rullgard 2011-07-22 00:42:08 +01:00
parent b297c881d6
commit 185a2c08c5
4 changed files with 121 additions and 118 deletions

View File

@ -284,23 +284,23 @@ static const uint8_t dnxhd_1237_ac_bits[257] = {
}; };
static const uint8_t dnxhd_1237_ac_level[257] = { static const uint8_t dnxhd_1237_ac_level[257] = {
1, 1, 2, 0, 3, 4, 2, 5, 6, 7, 3, 8, 9, 10, 11, 12, 3, 3, 5, 0, 7, 9, 5, 11, 13, 15, 7, 17, 19, 21, 23, 25,
4, 5, 13, 14, 15, 16, 6, 17, 18, 19, 20, 21, 7, 22, 23, 24, 9, 11, 27, 29, 31, 33, 13, 35, 37, 39, 41, 43, 15, 45, 47, 49,
25, 26, 27, 8, 9, 28, 29, 30, 31, 32, 33, 34, 10, 11, 12, 35, 51, 53, 55, 17, 19, 57, 59, 61, 63, 65, 67, 69, 21, 23, 25, 71,
36, 37, 38, 39, 40, 41, 13, 14, 15, 16, 42, 43, 44, 45, 46, 47, 73, 75, 77, 79, 81, 83, 27, 29, 31, 33, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 17, 18, 19, 20, 21, 53, 54, 55, 56, 57, 58, 97, 99,101,103,105, 35, 37, 39, 41, 43,107,109,111,113,115,117,
59, 60, 61, 64, 1, 22, 23, 24, 25, 26, 27, 62, 63, 2, 3, 4, 119,121,123,129, 3, 45, 47, 49, 51, 53, 55,125,127, 5, 7, 9,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,101,103,105,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 28, 29, 30, 31, 107,109,111,113,115,117,119,121,123,125,127,129, 57, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 129, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 129,
}; };
static const uint8_t dnxhd_1237_ac_run_flag[257] = { static const uint8_t dnxhd_1237_ac_run_flag[257] = {
@ -433,23 +433,23 @@ static const uint8_t dnxhd_1238_ac_bits[257] = {
}; };
static const uint8_t dnxhd_1238_ac_level[257] = { static const uint8_t dnxhd_1238_ac_level[257] = {
1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 3, 3, 5, 7, 0, 9, 11, 5, 13, 15, 17, 7, 19, 21, 23, 9,
12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 22, 6, 7, 23, 24, 25, 27, 29, 31, 33, 11, 35, 37, 39, 41, 43, 45, 13, 15, 47, 49,
25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 10, 51, 53, 55, 57, 59, 17, 19, 61, 63, 65, 67, 69, 71, 73, 75, 21,
11, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 12, 13, 14, 49, 23, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 25, 27, 29, 99,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 15, 16, 17, 18, 101,103,105,107,109,111,113,115,117,119,121,123, 31, 33, 35, 37,
62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 125,127,129, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27,
14, 15, 16, 19, 20, 21, 22, 23, 24, 17, 18, 19, 20, 21, 22, 23, 29, 31, 33, 39, 41, 43, 45, 47, 49, 35, 37, 39, 41, 43, 45, 47,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 40, 25, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 81, 51,
26, 27, 28, 29, 30, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 53, 55, 57, 59, 61, 77, 79, 83, 85, 87, 89, 91, 93, 95, 97, 99,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 31, 101,103,105,107,109,111,113,115,117,119,121,123,125,127,129, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 129, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 129,
}; /* 0 is EOB */ }; /* 0 is EOB */
static const uint8_t dnxhd_1238_ac_run_flag[257] = { static const uint8_t dnxhd_1238_ac_run_flag[257] = {
@ -582,23 +582,23 @@ static const uint8_t dnxhd_1235_1241_ac_bits[257] = {
}; };
static const uint8_t dnxhd_1235_1241_ac_level[257] = { static const uint8_t dnxhd_1235_1241_ac_level[257] = {
1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 3, 3, 5, 7, 0, 9, 11, 5, 13, 15, 17, 7, 19, 21, 23, 9,
12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 7, 22, 23, 24, 25, 27, 29, 31, 33, 11, 35, 37, 39, 41, 43, 13, 15, 45, 47, 49,
25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 38, 51, 53, 55, 57, 59, 17, 19, 61, 63, 65, 67, 69, 71, 73, 75, 77,
10, 11, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 12, 13, 21, 23, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,101, 25, 27,
14, 15, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 1, 29, 31,103,105,107,109,111,113,115,117,119,121,123,125,127, 3,
16, 17, 18, 19, 64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 33, 35, 37, 39,129, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25,
13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 18, 19, 20, 21, 22, 23, 27, 29, 31, 33, 35, 41, 43, 45, 47, 49, 37, 39, 41, 43, 45, 47,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79,
40, 41, 42, 25, 26, 27, 28, 29, 30, 31, 32, 43, 44, 45, 46, 47, 81, 83, 85, 51, 53, 55, 57, 59, 61, 63, 65, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 129, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 129, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 129,
}; };
static const uint8_t dnxhd_1235_1241_ac_run_flag[257] = { static const uint8_t dnxhd_1235_1241_ac_run_flag[257] = {
@ -709,23 +709,23 @@ static const uint8_t dnxhd_1250_ac_bits[257] = {
16 16
}; };
static const uint8_t dnxhd_1250_ac_level[257] = { static const uint8_t dnxhd_1250_ac_level[257] = {
1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 3, 3, 5, 7, 0, 9, 11, 5, 13, 15, 17, 7, 19, 21, 23, 9,
12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 22, 6, 23, 24, 25, 25, 27, 29, 31, 33, 11, 35, 37, 39, 41, 43, 45, 13, 47, 49, 51,
26, 27, 28, 29, 7, 8, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 53, 55, 57, 59, 15, 17, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79,
9, 10, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 11, 19, 21, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,101,103,105, 23,
12, 13, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 25, 27,107,109,111,113,115,117,119,121,123,125,127,129, 3, 5,
3, 4, 5, 14, 15, 16, 17, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, 9, 11, 29, 31, 33, 35, 13, 15, 17, 19, 21, 23, 25, 27, 29,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 18, 19, 20, 21, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 37, 39, 41, 43,
27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 22, 23, 24, 87, 89, 91, 93, 95, 97, 99,101,103,105,107,111,113, 45, 47, 49,
25, 26, 27, 54, 57, 58, 59, 60, 61, 62, 63, 64, 28, 29, 30, 31, 51, 53, 55,109,115,117,119,121,123,125,127,129, 57, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 129, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64 129
}; };
static const uint8_t dnxhd_1250_ac_run_flag[257] = { static const uint8_t dnxhd_1250_ac_run_flag[257] = {
0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
@ -853,23 +853,23 @@ static const uint8_t dnxhd_1251_ac_bits[257] = {
}; };
static const uint8_t dnxhd_1251_ac_level[257] = { static const uint8_t dnxhd_1251_ac_level[257] = {
1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 3, 3, 5, 7, 0, 9, 11, 5, 13, 15, 17, 7, 19, 21, 23, 9,
12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 22, 23, 24, 25, 25, 27, 29, 31, 33, 11, 35, 37, 39, 41, 43, 13, 45, 47, 49, 51,
26, 27, 28, 29, 7, 8, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 53, 55, 57, 59, 15, 17, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79,
40, 9, 10, 11, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 81, 19, 21, 23, 83, 85, 87, 89, 91, 93, 95, 97, 99,101,103,105,
12, 13, 14, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 25, 27, 29,107,109,111,113,115,117,119,121,123,125,127,129, 3,
2, 3, 4, 5, 6, 7, 8, 15, 16, 17, 9, 10, 11, 12, 13, 14, 5, 7, 9, 11, 13, 15, 17, 31, 33, 35, 19, 21, 23, 25, 27, 29,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 37,
19, 20, 21, 22, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 39, 41, 43, 45, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 85, 87, 89, 91, 93, 95, 97, 99,101,103,105,107,109,111,113,115,
58, 23, 24, 25, 26, 27, 28, 59, 60, 61, 62, 63, 64, 29, 30, 31, 117, 47, 49, 51, 53, 55, 57,119,121,123,125,127,129, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 129, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 129,
}; };
static const uint8_t dnxhd_1251_ac_run_flag[257] = { static const uint8_t dnxhd_1251_ac_run_flag[257] = {
@ -1002,23 +1002,23 @@ static const uint8_t dnxhd_1252_ac_bits[257] = {
}; };
static const uint8_t dnxhd_1252_ac_level[257] = { static const uint8_t dnxhd_1252_ac_level[257] = {
1, 1, 2, 3, 2, 0, 4, 5, 6, 7, 3, 8, 9, 10, 11, 12, 3, 3, 5, 7, 5, 0, 9, 11, 13, 15, 7, 17, 19, 21, 23, 25,
13, 14, 4, 5, 15, 16, 17, 18, 6, 19, 20, 21, 22, 23, 24, 7, 27, 29, 9, 11, 31, 33, 35, 37, 13, 39, 41, 43, 45, 47, 49, 15,
8, 25, 26, 27, 28, 29, 30, 31, 32, 9, 10, 33, 34, 35, 36, 37, 17, 51, 53, 55, 57, 59, 61, 63, 65, 19, 21, 67, 69, 71, 73, 75,
38, 39, 40, 41, 11, 12, 13, 42, 43, 44, 45, 46, 47, 48, 49, 50, 77, 79, 81, 83, 23, 25, 27, 85, 87, 89, 91, 93, 95, 97, 99,101,
51, 52, 53, 14, 15, 16, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 103,105,107, 29, 31, 33,109,111,113,115,117,119,121,123,125,127,
64, 1, 2, 3, 17, 18, 19, 20, 4, 5, 6, 7, 8, 9, 10, 11, 129, 3, 5, 7, 35, 37, 39, 41, 9, 11, 13, 15, 17, 19, 21, 23,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 22, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 43, 45, 47, 49, 51, 45,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,101,103,105,107,109,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 26, 27, 28, 29, 30, 31, 111,113,115,117,119,121,123,125,127,129, 53, 55, 57, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 129, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,
64, 129,
}; };
static const uint8_t dnxhd_1252_ac_run_flag[257] = { static const uint8_t dnxhd_1252_ac_run_flag[257] = {
@ -1062,70 +1062,70 @@ static const uint8_t dnxhd_1252_ac_index_flag[257] = {
}; };
const CIDEntry ff_dnxhd_cid_table[] = { const CIDEntry ff_dnxhd_cid_table[] = {
{ 1235, 1920, 1080, 0, 917504, 917504, 6, 10, { 1235, 1920, 1080, 0, 917504, 917504, 6, 10, 4,
dnxhd_1235_luma_weight, dnxhd_1235_chroma_weight, dnxhd_1235_luma_weight, dnxhd_1235_chroma_weight,
dnxhd_1235_1241_dc_codes, dnxhd_1235_1241_dc_bits, dnxhd_1235_1241_dc_codes, dnxhd_1235_1241_dc_bits,
dnxhd_1235_1241_ac_codes, dnxhd_1235_1241_ac_bits, dnxhd_1235_1241_ac_level, dnxhd_1235_1241_ac_codes, dnxhd_1235_1241_ac_bits, dnxhd_1235_1241_ac_level,
dnxhd_1235_1241_ac_run_flag, dnxhd_1235_1241_ac_index_flag, dnxhd_1235_1241_ac_run_flag, dnxhd_1235_1241_ac_index_flag,
dnxhd_1235_1238_1241_run_codes, dnxhd_1235_1238_1241_run_bits, dnxhd_1235_1241_run, dnxhd_1235_1238_1241_run_codes, dnxhd_1235_1238_1241_run_bits, dnxhd_1235_1241_run,
{ 175, 185, 365, 440 } }, { 175, 185, 365, 440 } },
{ 1237, 1920, 1080, 0, 606208, 606208, 4, 8, { 1237, 1920, 1080, 0, 606208, 606208, 4, 8, 3,
dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight, dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
dnxhd_1237_dc_codes, dnxhd_1237_dc_bits, dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level, dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag, dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run, dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
{ 115, 120, 145, 240, 290 } }, { 115, 120, 145, 240, 290 } },
{ 1238, 1920, 1080, 0, 917504, 917504, 4, 8, { 1238, 1920, 1080, 0, 917504, 917504, 4, 8, 4,
dnxhd_1238_luma_weight, dnxhd_1238_chroma_weight, dnxhd_1238_luma_weight, dnxhd_1238_chroma_weight,
dnxhd_1238_dc_codes, dnxhd_1238_dc_bits, dnxhd_1238_dc_codes, dnxhd_1238_dc_bits,
dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level, dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag, dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag,
dnxhd_1235_1238_1241_run_codes, dnxhd_1235_1238_1241_run_bits, dnxhd_1238_run, dnxhd_1235_1238_1241_run_codes, dnxhd_1235_1238_1241_run_bits, dnxhd_1238_run,
{ 175, 185, 220, 365, 440 } }, { 175, 185, 220, 365, 440 } },
{ 1241, 1920, 1080, 1, 917504, 458752, 6, 10, { 1241, 1920, 1080, 1, 917504, 458752, 6, 10, 4,
dnxhd_1241_luma_weight, dnxhd_1241_chroma_weight, dnxhd_1241_luma_weight, dnxhd_1241_chroma_weight,
dnxhd_1235_1241_dc_codes, dnxhd_1235_1241_dc_bits, dnxhd_1235_1241_dc_codes, dnxhd_1235_1241_dc_bits,
dnxhd_1235_1241_ac_codes, dnxhd_1235_1241_ac_bits, dnxhd_1235_1241_ac_level, dnxhd_1235_1241_ac_codes, dnxhd_1235_1241_ac_bits, dnxhd_1235_1241_ac_level,
dnxhd_1235_1241_ac_run_flag, dnxhd_1235_1241_ac_index_flag, dnxhd_1235_1241_ac_run_flag, dnxhd_1235_1241_ac_index_flag,
dnxhd_1235_1238_1241_run_codes, dnxhd_1235_1238_1241_run_bits, dnxhd_1235_1241_run, dnxhd_1235_1238_1241_run_codes, dnxhd_1235_1238_1241_run_bits, dnxhd_1235_1241_run,
{ 185, 220 } }, { 185, 220 } },
{ 1242, 1920, 1080, 1, 606208, 303104, 4, 8, { 1242, 1920, 1080, 1, 606208, 303104, 4, 8, 3,
dnxhd_1242_luma_weight, dnxhd_1242_chroma_weight, dnxhd_1242_luma_weight, dnxhd_1242_chroma_weight,
dnxhd_1237_dc_codes, dnxhd_1237_dc_bits, dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level, dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag, dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run, dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
{ 120, 145 } }, { 120, 145 } },
{ 1243, 1920, 1080, 1, 917504, 458752, 4, 8, { 1243, 1920, 1080, 1, 917504, 458752, 4, 8, 4,
dnxhd_1243_luma_weight, dnxhd_1243_chroma_weight, dnxhd_1243_luma_weight, dnxhd_1243_chroma_weight,
dnxhd_1238_dc_codes, dnxhd_1238_dc_bits, dnxhd_1238_dc_codes, dnxhd_1238_dc_bits,
dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level, dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag, dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag,
dnxhd_1235_1238_1241_run_codes, dnxhd_1235_1238_1241_run_bits, dnxhd_1238_run, dnxhd_1235_1238_1241_run_codes, dnxhd_1235_1238_1241_run_bits, dnxhd_1238_run,
{ 185, 220 } }, { 185, 220 } },
{ 1250, 1280, 720, 0, 458752, 458752, 6, 10, { 1250, 1280, 720, 0, 458752, 458752, 6, 10, 4,
dnxhd_1250_luma_weight, dnxhd_1250_chroma_weight, dnxhd_1250_luma_weight, dnxhd_1250_chroma_weight,
dnxhd_1250_dc_codes, dnxhd_1250_dc_bits, dnxhd_1250_dc_codes, dnxhd_1250_dc_bits,
dnxhd_1250_ac_codes, dnxhd_1250_ac_bits, dnxhd_1250_ac_level, dnxhd_1250_ac_codes, dnxhd_1250_ac_bits, dnxhd_1250_ac_level,
dnxhd_1250_ac_run_flag, dnxhd_1250_ac_index_flag, dnxhd_1250_ac_run_flag, dnxhd_1250_ac_index_flag,
dnxhd_1250_run_codes, dnxhd_1250_run_bits, dnxhd_1250_run, dnxhd_1250_run_codes, dnxhd_1250_run_bits, dnxhd_1250_run,
{ 90, 180, 220 } }, { 90, 180, 220 } },
{ 1251, 1280, 720, 0, 458752, 458752, 4, 8, { 1251, 1280, 720, 0, 458752, 458752, 4, 8, 4,
dnxhd_1251_luma_weight, dnxhd_1251_chroma_weight, dnxhd_1251_luma_weight, dnxhd_1251_chroma_weight,
dnxhd_1251_dc_codes, dnxhd_1251_dc_bits, dnxhd_1251_dc_codes, dnxhd_1251_dc_bits,
dnxhd_1251_ac_codes, dnxhd_1251_ac_bits, dnxhd_1251_ac_level, dnxhd_1251_ac_codes, dnxhd_1251_ac_bits, dnxhd_1251_ac_level,
dnxhd_1251_ac_run_flag, dnxhd_1251_ac_index_flag, dnxhd_1251_ac_run_flag, dnxhd_1251_ac_index_flag,
dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run, dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run,
{ 90, 110, 175, 220 } }, { 90, 110, 175, 220 } },
{ 1252, 1280, 720, 0, 303104, 303104, 4, 8, { 1252, 1280, 720, 0, 303104, 303104, 4, 8, 5,
dnxhd_1252_luma_weight, dnxhd_1252_chroma_weight, dnxhd_1252_luma_weight, dnxhd_1252_chroma_weight,
dnxhd_1252_dc_codes, dnxhd_1252_dc_bits, dnxhd_1252_dc_codes, dnxhd_1252_dc_bits,
dnxhd_1252_ac_codes, dnxhd_1252_ac_bits, dnxhd_1252_ac_level, dnxhd_1252_ac_codes, dnxhd_1252_ac_bits, dnxhd_1252_ac_level,
dnxhd_1252_ac_run_flag, dnxhd_1252_ac_index_flag, dnxhd_1252_ac_run_flag, dnxhd_1252_ac_index_flag,
dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run, dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run,
{ 60, 75, 115, 145 } }, { 60, 75, 115, 145 } },
{ 1253, 1920, 1080, 0, 188416, 188416, 4, 8, { 1253, 1920, 1080, 0, 188416, 188416, 4, 8, 3,
dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight, dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
dnxhd_1237_dc_codes, dnxhd_1237_dc_bits, dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level, dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,

View File

@ -33,6 +33,7 @@ typedef struct {
unsigned int coding_unit_size; unsigned int coding_unit_size;
int index_bits; int index_bits;
int bit_depth; int bit_depth;
int eob_index;
const uint8_t *luma_weight, *chroma_weight; const uint8_t *luma_weight, *chroma_weight;
const uint8_t *dc_codes, *dc_bits; const uint8_t *dc_codes, *dc_bits;
const uint16_t *ac_codes; const uint16_t *ac_codes;

View File

@ -182,6 +182,8 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
int i, j, index1, index2, len; int i, j, index1, index2, len;
int level, component, sign; int level, component, sign;
const uint8_t *weight_matrix; const uint8_t *weight_matrix;
const uint8_t *ac_level = ctx->cid_table->ac_level;
const int eob_index = ctx->cid_table->eob_index;
OPEN_READER(bs, &ctx->gb); OPEN_READER(bs, &ctx->gb);
if (n&2) { if (n&2) {
@ -209,14 +211,15 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
UPDATE_CACHE(bs, &ctx->gb); UPDATE_CACHE(bs, &ctx->gb);
GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table, GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table,
DNXHD_VLC_BITS, 2); DNXHD_VLC_BITS, 2);
level = ctx->cid_table->ac_level[index1];
while (level) { while (index1 != eob_index) {
level = ac_level[index1];
sign = SHOW_SBITS(bs, &ctx->gb, 1); sign = SHOW_SBITS(bs, &ctx->gb, 1);
SKIP_BITS(bs, &ctx->gb, 1); SKIP_BITS(bs, &ctx->gb, 1);
if (ctx->cid_table->ac_index_flag[index1]) { if (ctx->cid_table->ac_index_flag[index1]) {
level += SHOW_UBITS(bs, &ctx->gb, index_bits) << 6; level += SHOW_UBITS(bs, &ctx->gb, index_bits) << 7;
SKIP_BITS(bs, &ctx->gb, index_bits); SKIP_BITS(bs, &ctx->gb, index_bits);
} }
@ -235,7 +238,7 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
j = ctx->scantable.permutated[i]; j = ctx->scantable.permutated[i];
//av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j); //av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j);
//av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weight %d\n", level, weight_matrix[i]); //av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weight %d\n", level, weight_matrix[i]);
level = (2*level+1) * qscale * weight_matrix[i]; level *= qscale * weight_matrix[i];
if (level_bias < 32 || weight_matrix[i] != level_bias) if (level_bias < 32 || weight_matrix[i] != level_bias)
level += level_bias; level += level_bias;
level >>= level_shift; level >>= level_shift;
@ -246,7 +249,6 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
UPDATE_CACHE(bs, &ctx->gb); UPDATE_CACHE(bs, &ctx->gb);
GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table, GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table,
DNXHD_VLC_BITS, 2); DNXHD_VLC_BITS, 2);
level = ctx->cid_table->ac_level[index1];
} }
CLOSE_READER(bs, &ctx->gb); CLOSE_READER(bs, &ctx->gb);

View File

@ -121,7 +121,7 @@ static int dnxhd_init_vlc(DNXHDEncContext *ctx)
alevel -= offset<<6; alevel -= offset<<6;
} }
for (j = 0; j < 257; j++) { for (j = 0; j < 257; j++) {
if (ctx->cid_table->ac_level[j] == alevel && if (ctx->cid_table->ac_level[j] >> 1 == alevel &&
(!offset || (ctx->cid_table->ac_index_flag[j] && offset)) && (!offset || (ctx->cid_table->ac_index_flag[j] && offset)) &&
(!run || (ctx->cid_table->ac_run_flag [j] && run))) { (!run || (ctx->cid_table->ac_run_flag [j] && run))) {
assert(!ctx->vlc_codes[index]); assert(!ctx->vlc_codes[index]);