pcompress/filters/packjpg/pjpgtbl.h
Moinak Ghosh 75dfa6a6fb Add basic framework for file type based filters during libarchive stage.
Add packJPG filter for Jpeg files (not active yet).
Directory format changes for clarity.
2013-11-10 23:09:42 +05:30

1659 lines
60 KiB
C

/* -----------------------------------------------
defines for use in packJPG processing
----------------------------------------------- */
// action defines
#define A_COMPRESS 1
#define A_SPLIT_DUMP 2
#define A_COLL_DUMP 3
#define A_FCOLL_DUMP 4
#define A_ZDST_DUMP 5
#define A_TXT_INFO 6
#define A_DIST_INFO 7
#define A_PGM_DUMP 8
// file type defines
#define F_JPG 1
#define F_PJG 2
#define F_UNK 3
/* -----------------------------------------------
compression helper tables
----------------------------------------------- */
// maxima for each frequency in zigzag order
// dc maximum is fixed by offset (+4/QUANT)
static const unsigned short int freqmax[] =
{
1024, 931, 932, 985, 858, 985, 968, 884,
884, 967, 1020, 841, 871, 840, 1020, 968,
932, 875, 876, 932, 969, 1020, 838, 985,
844, 985, 838, 1020, 1020, 854, 878, 967,
967, 878, 854, 1020, 854, 871, 886, 1020,
886, 871, 854, 854, 870, 969, 969, 870,
854, 838, 1010, 838, 1020, 837, 1020, 969,
969, 1020, 838, 1020, 838, 1020, 1020, 838
};
/*
// maxima for each frequency - IJG DCT float (not used)
static const unsigned short int freqmax_float[] =
{
1024, 924, 942, 924, 1020, 924, 942, 924,
924, 837, 854, 837, 924, 837, 854, 837,
942, 854, 871, 854, 942, 854, 871, 854,
924, 837, 854, 837, 924, 837, 854, 837,
1020, 924, 942, 924, 1020, 924, 942, 924,
924, 837, 854, 837, 924, 837, 854, 837,
942, 854, 871, 854, 942, 854, 871, 854,
924, 837, 854, 837, 924, 837, 854, 837
};
*/
/*
// maxima for each frequency - IJG DCT int (not used)
static const unsigned short int freqmax_int[] =
{
1024, 924, 942, 924, 1020, 924, 942, 924,
924, 838, 854, 838, 924, 838, 854, 838,
942, 854, 871, 854, 942, 854, 871, 854,
924, 837, 854, 837, 924, 837, 854, 837,
1020, 924, 942, 924, 1020, 924, 942, 924,
924, 838, 854, 838, 924, 838, 854, 838,
942, 854, 871, 854, 942, 854, 871, 854,
924, 838, 854, 838, 924, 838, 854, 838
};
*/
/*
// maxima for each frequency - IJG DCT fast (not used)
static const unsigned short int freqmax_fast[] =
{
1024, 931, 985, 968, 1020, 968, 1020, 1020,
932, 858, 884, 840, 932, 812, 854, 854,
985, 884, 849, 875, 985, 878, 821, 821,
967, 841, 876, 844, 967, 886, 870, 726,
1020, 932, 985, 967, 1020, 969, 1020, 1020,
969, 812, 878, 886, 969, 829, 969, 727,
1020, 854, 821, 870, 1010, 969, 1020, 1020,
1020, 854, 821, 725, 1020, 727, 1020, 510
};
*/
/*
// maxima for each frequency - IJG DCT max (not used)
static const unsigned short int freqmax_ijg[] =
{
1024, 931, 985, 968, 1020, 968, 1020, 1020,
932, 858, 884, 840, 932, 838, 854, 854,
985, 884, 871, 875, 985, 878, 871, 854,
967, 841, 876, 844, 967, 886, 870, 837,
1020, 932, 985, 967, 1020, 969, 1020, 1020,
969, 838, 878, 886, 969, 838, 969, 838,
1020, 854, 871, 870, 1010, 969, 1020, 1020,
1020, 854, 854, 838, 1020, 838, 1020, 838
};
*/
/*
// valdist 99.0% quantiles
int vdqu[ 3 ][ 64 ] =
{
// table for statistical id 0
{
206, 346, 187, 126, 91, 68, 51, 42,
353, 173, 124, 87, 63, 49, 39, 33,
186, 119, 93, 70, 53, 42, 34, 29,
127, 84, 68, 55, 44, 35, 29, 25,
88, 63, 53, 44, 36, 30, 25, 22,
67, 48, 42, 36, 30, 26, 22, 20,
48, 38, 33, 29, 25, 22, 20, 18,
43, 32, 29, 26, 23, 20, 18, 17,
},
// table for statistical id 1
{
23, 86, 46, 28, 19, 14, 11, 9,
93, 48, 32, 21, 15, 11, 9, 7,
51, 32, 24, 18, 13, 10, 8, 7,
31, 22, 18, 14, 11, 9, 7, 6,
21, 16, 14, 11, 9, 7, 6, 5,
15, 12, 11, 9, 7, 6, 5, 5,
12, 10, 9, 7, 6, 5, 5, 4,
10, 8, 7, 6, 5, 5, 4, 4,
},
// table for statistical id 2
{
25, 89, 45, 27, 18, 13, 10, 8,
94, 48, 31, 21, 15, 11, 8, 6,
49, 32, 24, 17, 13, 10, 8, 6,
29, 22, 18, 14, 11, 8, 7, 5,
20, 16, 13, 11, 9, 7, 6, 5,
15, 12, 11, 9, 7, 6, 5, 4,
11, 9, 9, 7, 6, 5, 4, 4,
8, 7, 7, 6, 5, 4, 4, 3,
},
};
*/
// standard scan = zigzag scan
static const unsigned char stdscan[] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63
};
// zigzag scan conversion table
static const unsigned char zigzag[] =
{
0, 1, 5, 6, 14, 15, 27, 28,
2, 4, 7, 13, 16, 26, 29, 42,
3, 8, 12, 17, 25, 30, 41, 43,
9, 11, 18, 24, 31, 40, 44, 53,
10, 19, 23, 32, 39, 45, 52, 54,
20, 22, 33, 38, 46, 51, 55, 60,
21, 34, 37, 47, 50, 56, 59, 61,
35, 36, 48, 49, 57, 58, 62, 63
};
// zigzag scan reverse conversion table
static const unsigned char unzigzag[] =
{
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36,
29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63
};
// even/uneven zigzag scan conversion table
static const unsigned char even_zigzag[] =
{
0, 5, 14, 27, 1, 6, 15, 28,
3, 12, 25, 41, 8, 17, 30, 43,
10, 23, 39, 52, 19, 32, 45, 54,
21, 37, 50, 59, 34, 47, 56, 61,
2, 7, 16, 29, 4, 13, 26, 42,
9, 18, 31, 44, 11, 24, 40, 53,
20, 33, 46, 55, 22, 38, 51, 60,
35, 48, 57, 62, 36, 49, 58, 63,
};
// context weighting for each band (luminance) (from POTY 2006/2007)
static const signed int abs_ctx_weights_lum[ 64 ][ 3 ][ 5 ] =
{
{ // DCT(0/0)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 11, 8, 0, },
{ 9, 13, 0, 0, 0, },
},
{ // DCT(1/0)
{ 0, 0, 8, 0, 0, },
{ 0, 3, 28, 7, 0, },
{ 5, 7, 0, 0, 0, },
},
{ // DCT(0/1)
{ 0, 0, 5, 0, 0, },
{ 0, 4, 4, 6, 0, },
{ 8, 30, 0, 0, 0, },
},
{ // DCT(0/2)
{ 0, 0, 5, 0, 0, },
{ 0, 3, 5, 5, 0, },
{ 11, 27, 0, 0, 0, },
},
{ // DCT(1/1)
{ 0, 0, 4, 0, 0, },
{ 0, 7, 13, 10, 0, },
{ 6, 16, 0, 0, 0, },
},
{ // DCT(2/0)
{ 0, 0, 10, 0, 0, },
{ 0, 2, 25, 6, 0, },
{ 6, 9, 0, 0, 0, },
},
{ // DCT(3/0)
{ 0, 0, 10, 0, 0, },
{ 0, 1, 24, 6, 0, },
{ 7, 9, 0, 0, 0, },
},
{ // DCT(2/1)
{ 0, 0, 5, 0, 0, },
{ 0, 7, 15, 10, 0, },
{ 8, 12, 0, 0, 0, },
},
{ // DCT(1/2)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 8, 10, 0, },
{ 7, 18, 0, 0, 0, },
},
{ // DCT(0/3)
{ 0, 0, 6, 0, 0, },
{ 0, 3, 5, 5, 0, },
{ 12, 26, 0, 0, 0, },
},
{ // DCT(0/4)
{ 0, 0, 6, 0, 0, },
{ 0, 3, 6, 5, 0, },
{ 13, 25, 0, 0, 0, },
},
{ // DCT(1/3)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 8, 8, 0, },
{ 8, 19, 0, 0, 0, },
},
{ // DCT(2/2)
{ 0, 0, 5, 0, 0, },
{ 0, 8, 11, 11, 0, },
{ 8, 14, 0, 0, 0, },
},
{ // DCT(3/1)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 16, 9, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(4/0)
{ 0, 0, 11, 0, 0, },
{ 0, 1, 24, 5, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(5/0)
{ 0, 0, 11, 0, 0, },
{ 0, 1, 24, 5, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(4/1)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 16, 9, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(3/2)
{ 0, 0, 5, 0, 0, },
{ 0, 8, 12, 11, 0, },
{ 8, 12, 0, 0, 0, },
},
{ // DCT(2/3)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 9, 10, 0, },
{ 8, 15, 0, 0, 0, },
},
{ // DCT(1/4)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 8, 8, 0, },
{ 9, 19, 0, 0, 0, },
},
{ // DCT(0/5)
{ 0, 0, 6, 0, 0, },
{ 0, 2, 6, 5, 0, },
{ 13, 25, 0, 0, 0, },
},
{ // DCT(0/6)
{ 0, 0, 5, 0, 0, },
{ 0, 2, 6, 5, 0, },
{ 13, 24, 0, 0, 0, },
},
{ // DCT(1/5)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 8, 7, 0, },
{ 10, 19, 0, 0, 0, },
},
{ // DCT(2/4)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 9, 9, 0, },
{ 8, 16, 0, 0, 0, },
},
{ // DCT(3/3)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 10, 11, 0, },
{ 8, 13, 0, 0, 0, },
},
{ // DCT(4/2)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 13, 10, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(5/1)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 15, 8, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(6/0)
{ 0, 0, 11, 0, 0, },
{ 0, 1, 23, 5, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(7/0)
{ 0, 0, 11, 0, 0, },
{ 0, 1, 23, 5, 0, },
{ 7, 9, 0, 0, 0, },
},
{ // DCT(6/1)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 15, 8, 0, },
{ 8, 10, 0, 0, 0, },
},
{ // DCT(5/2)
{ 0, 0, 7, 0, 0, },
{ 0, 7, 13, 9, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(4/3)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 11, 10, 0, },
{ 8, 12, 0, 0, 0, },
},
{ // DCT(3/4)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 9, 10, 0, },
{ 8, 14, 0, 0, 0, },
},
{ // DCT(2/5)
{ 0, 0, 7, 0, 0, },
{ 0, 7, 8, 8, 0, },
{ 9, 16, 0, 0, 0, },
},
{ // DCT(1/6)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 7, 7, 0, },
{ 10, 18, 0, 0, 0, },
},
{ // DCT(0/7)
{ 0, 0, 6, 0, 0, },
{ 0, 3, 6, 5, 0, },
{ 13, 24, 0, 0, 0, },
},
{ // DCT(1/7)
{ 0, 0, 6, 0, 0, },
{ 0, 5, 7, 6, 0, },
{ 10, 18, 0, 0, 0, },
},
{ // DCT(2/6)
{ 0, 0, 7, 0, 0, },
{ 0, 7, 8, 8, 0, },
{ 9, 15, 0, 0, 0, },
},
{ // DCT(3/5)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 9, 9, 0, },
{ 8, 14, 0, 0, 0, },
},
{ // DCT(4/4)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 10, 10, 0, },
{ 8, 12, 0, 0, 0, },
},
{ // DCT(5/3)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 11, 10, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(6/2)
{ 0, 0, 7, 0, 0, },
{ 0, 7, 13, 8, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(7/1)
{ 0, 0, 8, 0, 0, },
{ 0, 5, 15, 8, 0, },
{ 8, 10, 0, 0, 0, },
},
{ // DCT(7/2)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 13, 8, 0, },
{ 8, 10, 0, 0, 0, },
},
{ // DCT(6/3)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 11, 9, 0, },
{ 8, 10, 0, 0, 0, },
},
{ // DCT(5/4)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 10, 10, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(4/5)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 9, 9, 0, },
{ 8, 12, 0, 0, 0, },
},
{ // DCT(3/6)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 8, 8, 0, },
{ 8, 13, 0, 0, 0, },
},
{ // DCT(2/7)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 7, 7, 0, },
{ 9, 16, 0, 0, 0, },
},
{ // DCT(3/7)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 7, 7, 0, },
{ 8, 14, 0, 0, 0, },
},
{ // DCT(4/6)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 9, 9, 0, },
{ 7, 12, 0, 0, 0, },
},
{ // DCT(5/5)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 9, 10, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(6/4)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 10, 9, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(7/3)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 12, 8, 0, },
{ 8, 10, 0, 0, 0, },
},
{ // DCT(7/4)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 11, 8, 0, },
{ 7, 9, 0, 0, 0, },
},
{ // DCT(6/5)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 9, 9, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(5/6)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 9, 9, 0, },
{ 7, 11, 0, 0, 0, },
},
{ // DCT(4/7)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 7, 8, 0, },
{ 7, 12, 0, 0, 0, },
},
{ // DCT(5/7)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 8, 8, 0, },
{ 7, 11, 0, 0, 0, },
},
{ // DCT(6/6)
{ 0, 0, 8, 0, 0, },
{ 0, 6, 7, 8, 0, },
{ 8, 12, 0, 0, 0, },
},
{ // DCT(7/5)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 10, 9, 0, },
{ 7, 9, 0, 0, 0, },
},
{ // DCT(7/6)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 9, 8, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(6/7)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 7, 8, 0, },
{ 7, 11, 0, 0, 0, },
},
{ // DCT(7/7)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 8, 9, 0, },
{ 7, 9, 0, 0, 0, },
},
};
/*
// context weighting for each band (chrominance) (from POTY 2006/2007)
static const signed int abs_ctx_weights_chr[ 64 ][ 3 ][ 5 ] =
{
{ // DCT(0/0)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 11, 8, 0, },
{ 9, 13, 0, 0, 0, },
},
{ // DCT(1/0)
{ 0, 0, 6, 0, 0, },
{ 0, 4, 28, 8, 0, },
{ 5, 7, 0, 0, 0, },
},
{ // DCT(0/1)
{ 0, 0, 5, 0, 0, },
{ 0, 4, 5, 7, 0, },
{ 7, 29, 0, 0, 0, },
},
{ // DCT(0/2)
{ 0, 0, 5, 0, 0, },
{ 0, 4, 7, 6, 0, },
{ 10, 23, 0, 0, 0, },
},
{ // DCT(1/1)
{ 0, 0, 4, 0, 0, },
{ 0, 7, 13, 10, 0, },
{ 6, 16, 0, 0, 0, },
},
{ // DCT(2/0)
{ 0, 0, 9, 0, 0, },
{ 0, 3, 22, 7, 0, },
{ 6, 9, 0, 0, 0, },
},
{ // DCT(3/0)
{ 0, 0, 10, 0, 0, },
{ 0, 4, 19, 7, 0, },
{ 6, 9, 0, 0, 0, },
},
{ // DCT(2/1)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 14, 10, 0, },
{ 7, 11, 0, 0, 0, },
},
{ // DCT(1/2)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 9, 9, 0, },
{ 7, 16, 0, 0, 0, },
},
{ // DCT(0/3)
{ 0, 0, 6, 0, 0, },
{ 0, 4, 7, 6, 0, },
{ 10, 20, 0, 0, 0, },
},
{ // DCT(0/4)
{ 0, 0, 6, 0, 0, },
{ 0, 4, 7, 6, 0, },
{ 10, 19, 0, 0, 0, },
},
{ // DCT(1/3)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 8, 8, 0, },
{ 7, 16, 0, 0, 0, },
},
{ // DCT(2/2)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 10, 10, 0, },
{ 7, 12, 0, 0, 0, },
},
{ // DCT(3/1)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 14, 9, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(4/0)
{ 0, 0, 10, 0, 0, },
{ 0, 3, 19, 6, 0, },
{ 6, 8, 0, 0, 0, },
},
{ // DCT(5/0)
{ 0, 0, 9, 0, 0, },
{ 0, 3, 18, 6, 0, },
{ 6, 8, 0, 0, 0, },
},
{ // DCT(4/1)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 13, 8, 0, },
{ 7, 9, 0, 0, 0, },
},
{ // DCT(3/2)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 11, 9, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(2/3)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 9, 9, 0, },
{ 7, 12, 0, 0, 0, },
},
{ // DCT(1/4)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 8, 7, 0, },
{ 7, 14, 0, 0, 0, },
},
{ // DCT(0/5)
{ 0, 0, 5, 0, 0, },
{ 0, 4, 7, 5, 0, },
{ 10, 19, 0, 0, 0, },
},
{ // DCT(0/6)
{ 0, 0, 5, 0, 0, },
{ 0, 4, 7, 5, 0, },
{ 10, 18, 0, 0, 0, },
},
{ // DCT(1/5)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 8, 7, 0, },
{ 7, 14, 0, 0, 0, },
},
{ // DCT(2/4)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 8, 8, 0, },
{ 7, 12, 0, 0, 0, },
},
{ // DCT(3/3)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 9, 9, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(4/2)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 11, 9, 0, },
{ 6, 9, 0, 0, 0, },
},
{ // DCT(5/1)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 12, 7, 0, },
{ 6, 9, 0, 0, 0, },
},
{ // DCT(6/0)
{ 0, 0, 9, 0, 0, },
{ 0, 3, 18, 5, 0, },
{ 5, 7, 0, 0, 0, },
},
{ // DCT(7/0)
{ 0, 0, 9, 0, 0, },
{ 0, 3, 18, 5, 0, },
{ 5, 6, 0, 0, 0, },
},
{ // DCT(6/1)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 12, 7, 0, },
{ 6, 8, 0, 0, 0, },
},
{ // DCT(5/2)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 10, 8, 0, },
{ 6, 9, 0, 0, 0, },
},
{ // DCT(4/3)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 10, 9, 0, },
{ 6, 9, 0, 0, 0, },
},
{ // DCT(3/4)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 9, 9, 0, },
{ 7, 11, 0, 0, 0, },
},
{ // DCT(2/5)
{ 0, 0, 6, 0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 0, 0, 6, 0, 0, },
{ 0, 7, 10, 8, 0, },
{ 6, 10, 0, 0, 0, },
},
{ // DCT(7/7)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 10, 8, 0, },
{ 6, 9, 0, 0, 0, },
},
};
*/
// tresholds (size of component) for configuration sets
static const unsigned int conf_sets[][3] =
{
{ 76800, 19200, 19200 }, // 2480x1920
{ 19200, 4800, 4800 }, // 1280x960
{ 10800, 2700, 2700 }, // 960x720
{ 4800, 1200, 1200 }, // 640x480
{ 1200, 300, 300 }, // 320x240
{ 0, 0, 0 } // 0x0
};
// configuration sets for number of segments
static const unsigned char conf_segm[][3] =
{
{ 10, 10, 10 },
{ 10, 10, 10 },
{ 10, 10, 10 },
{ 10, 10, 10 },
{ 10, 10, 10 },
{ 10, 10, 10 }
};
// configuration sets for noise thresholds
static const unsigned char conf_ntrs[][3] =
{
{ 7, 7, 7 },
{ 6, 6, 6 },
{ 5, 5, 5 },
{ 5, 5, 5 },
{ 4, 4, 4 },
{ 4, 4, 4 }
};
// standard huffman tables, found in JPEG specification, Chapter K.3
static const unsigned char std_huff_tables[4][272] =
{
{ // standard luma dc table (0/0)
0x00,0x01,0x05,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B
},
{ // standard chroma dc table (0/1)
0x00,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B
},
{ // standard luma ac table (1/0)
0x00,0x02,0x01,0x03,0x03,0x02,0x04,0x03,0x05,0x05,0x04,0x04,0x00,0x00,0x01,0x7D,
0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,
0x22,0x71,0x14,0x32,0x81,0x91,0xA1,0x08,0x23,0x42,0xB1,0xC1,0x15,0x52,0xD1,0xF0,
0x24,0x33,0x62,0x72,0x82,0x09,0x0A,0x16,0x17,0x18,0x19,0x1A,0x25,0x26,0x27,0x28,
0x29,0x2A,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x43,0x44,0x45,0x46,0x47,0x48,0x49,
0x4A,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x63,0x64,0x65,0x66,0x67,0x68,0x69,
0x6A,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x83,0x84,0x85,0x86,0x87,0x88,0x89,
0x8A,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,
0xA8,0xA9,0xAA,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xC2,0xC3,0xC4,0xC5,
0xC6,0xC7,0xC8,0xC9,0xCA,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xE1,0xE2,
0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,
0xF9,0xFA
},
{ // standard chroma ac table (1/1)
0x00,0x02,0x01,0x02,0x04,0x04,0x03,0x04,0x07,0x05,0x04,0x04,0x00,0x01,0x02,0x77,
0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,
0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91,0xA1,0xB1,0xC1,0x09,0x23,0x33,0x52,0xF0,
0x15,0x62,0x72,0xD1,0x0A,0x16,0x24,0x34,0xE1,0x25,0xF1,0x17,0x18,0x19,0x1A,0x26,
0x27,0x28,0x29,0x2A,0x35,0x36,0x37,0x38,0x39,0x3A,0x43,0x44,0x45,0x46,0x47,0x48,
0x49,0x4A,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x63,0x64,0x65,0x66,0x67,0x68,
0x69,0x6A,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x82,0x83,0x84,0x85,0x86,0x87,
0x88,0x89,0x8A,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0xA2,0xA3,0xA4,0xA5,
0xA6,0xA7,0xA8,0xA9,0xAA,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xC2,0xC3,
0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,
0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,
0xF9,0xFA
}
};
// lengths of standard huffmann tables
static const unsigned char std_huff_lengths[ 4 ] = { 28, 28, 178, 178 };
// precalculated bit lengths for values 0...1024
int pbitlen_0_1024[] =
{
0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, // 32
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, // 64
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 96
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 128
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 160
8, 8, 8, 8, 8, 8,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9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 512
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 544
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 576
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 608
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 640
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 672
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 704
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 736
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 768
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 800
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 832
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 864
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 896
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 928
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 960
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 992
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 1024
11
};
// precalculated bit lengths for values -2048...2047
int pbitlen_n2048_2047[] =
{
12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -2016
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1984
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1952
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1920
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1888
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1856
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1824
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1792
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1760
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1728
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1696
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1664
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1632
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1600
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1568
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1536
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1504
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1472
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1440
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1408
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1376
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1344
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1312
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1280
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1248
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1216
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1184
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1152
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1120
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1088
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1056
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // -1024
11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -992
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -960
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -928
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -896
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -864
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -832
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -800
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -768
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -736
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -704
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -672
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -640
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -608
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -576
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -544
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // -512
10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // -480
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // -448
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // -416
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // -384
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // -352
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // -320
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 384
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 416
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 448
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 480
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 512
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 544
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 576
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 608
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 640
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 672
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 704
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 736
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 768
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 800
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 832
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 864
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 896
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 928
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 960
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 992
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 1024
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1056
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1088
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1120
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1152
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1184
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1216
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1248
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1280
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1312
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1344
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1376
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1408
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1440
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1472
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1504
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1536
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1568
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1600
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1632
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1664
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1696
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1728
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1760
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1792
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1824
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1856
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1888
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1920
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1952
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 1984
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, // 2016
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 // 2048
};
// precalculated segmentation settings (the 0th setting corresponds to 1 segments)
unsigned char segm_tables[ 49 ][ 50 ] =
{
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, // s0
{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }, // s8
{ 0, 1, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }, // s9
{ 0, 1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, }, // s10
{ 0, 1, 2, 3, 4, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, }, // s11
{ 0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10,
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, }, // s12
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11,
11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, }, // s13
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12,
12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, }, // s14
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13,
13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, }, // s15
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14,
14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, }, // s16
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14,
15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, }, // s17
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15,
15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, }, // s18
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16,
16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, }, // s19
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17,
17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, }, // s20
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18,
18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, }, // s21
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, 18, 18, 18, 18, 19,
19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, }, // s22
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 19, 19, 19, 19,
20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, }, // s23
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 19, 20, 20, 20,
20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, }, // s24
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 21, 21,
21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, }, // s25
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 22,
22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, }, // s26
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 23,
23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, }, // s27
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, }, // s28
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, }, // s29
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, }, // s30
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, }, // s31
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, }, // s32
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 29, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, }, // s33
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, }, // s34
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, }, // s35
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, }, // s36
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, }, // s37
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, }, // s38
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, }, // s39
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, }, // s40
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 41, }, // s41
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 41, 41, 41, 42, 42, 42, 42, 42, }, // s42
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 42, 42, 43, 43, 43, 43, 43, }, // s43
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 43, 44, 44, 44, 44, 44, }, // s44
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 45, 45, 45, 45, }, // s45
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 46, 46, 46, }, // s46
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 47, 47, }, // s47
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 48, }, // s48
};
/*
// old stuff starting here - no more used, therefore commented out
// zagzig scan, can be used instead of zigzag scan
static const unsigned char zagscan[] =
{
0, 2, 1, 5, 4, 3, 9, 8,
7, 6, 14, 13, 12, 11, 10, 20,
19, 18, 17, 16, 15, 27, 26, 25,
24, 23, 22, 21, 35, 34, 33, 32,
31, 30, 29, 28, 42, 41, 40, 39,
38, 37, 36, 48, 47, 46, 45, 44,
43, 53, 52, 51, 50, 49, 57, 56,
55, 54, 60, 59, 58, 62, 61, 63
};
// distance scan, can be used instead of zigzag scan
static const unsigned char distscan[] =
{
0, 2, 1, 4, 3, 5, 7, 8,
12, 6, 9, 11, 13, 17, 18, 10,
14, 16, 19, 24, 25, 23, 20, 32,
31, 15, 26, 22, 33, 30, 39, 38,
40, 27, 21, 34, 29, 41, 37, 46,
45, 44, 47, 35, 28, 51, 36, 42,
52, 50, 48, 43, 53, 49, 56, 55,
54, 57, 59, 60, 58, 62, 61, 63
};
// diagonal / horizontal / vertical scan, don't use this unless you want bad results
static const unsigned char dhvscan[] =
{
0, 4, 12, 24, 39, 51, 59, 63,
1, 5, 6, 7, 13, 14, 15, 16,
17, 25, 26, 27, 28, 29, 30, 31,
40, 41, 42, 43, 44, 45, 52, 53,
54, 55, 60, 61,
2, 3, 8, 9, 10, 11, 18, 19,
20, 21, 22, 23, 32, 33, 34, 35,
36, 37, 38, 46, 47, 48, 49, 50,
56, 57, 58, 62
};
// sign relevancy scan
static const unsigned char sgnscan[] =
{
0, 1, 2, 3, 5, 6, 9, 10,
14, 15, 20, 21, 27, 28, 35, 4,
7, 13, 16, 26, 29, 42, 8, 12,
17, 25, 30, 41, 43, 11, 18, 24,
31, 40, 44, 53, 19, 23, 32, 39,
45, 52, 54, 22, 33, 38, 46, 51,
55, 60, 34, 37, 47, 50, 56, 59,
61, 36, 48, 49, 57, 58, 62, 63
};
// even/uneven zigzag scan reverse conversion table
static const int even_natural_order[] =
{
0, 8, 9, 3, 1, 16, 2, 10,
12, 26, 40, 41, 19, 33, 48, 34,
35, 49, 57, 43, 42, 56, 50, 36,
58, 52, 38, 39, 59, 45, 31, 46,
17, 32, 18, 4, 24, 25, 11, 5,
27, 13, 7, 21, 20, 6, 14, 28,
29, 15, 30, 44, 22, 23, 37, 51,
53, 61, 47, 62, 60, 54, 55, 63,
};
// scans for each frequency
static const char freqalign[] =
{
'm', 'v', 'v', 'v', 'v', 'v', 'v', 'v',
'h', 'm', 'v', 'v', 'v', 'v', 'v', 'v',
'h', 'h', 'm', 'v', 'v', 'v', 'v', 'v',
'h', 'h', 'h', 'm', 'v', 'v', 'v', 'v',
'h', 'h', 'h', 'h', 'm', 'v', 'v', 'v',
'h', 'h', 'h', 'h', 'h', 'm', 'v', 'v',
'h', 'h', 'h', 'h', 'h', 'h', 'm', 'v',
'h', 'h', 'h', 'h', 'h', 'h', 'h', 'm'
};
// chengjie tu subband classification
static const unsigned char ctxclass[] =
{
0, 1, 3, 3, 3, 6, 6, 6, // 0 -> DC (DC subband)
2, 5, 5, 5, 6, 6, 6, 6, // 1 -> PV (principal vertical)
4, 5, 5, 5, 6, 6, 6, 6, // 2 -> PH (principal horizontal)
4, 5, 5, 6, 6, 6, 6, 6, // 3 -> LV (low-frequency vertical)
4, 6, 6, 6, 6, 6, 6, 6, // 4 -> LH (low-frequency horizontal)
6, 6, 6, 6, 6, 6, 6, 6, // 5 -> LD (low-frequency diagonal)
6, 6, 6, 6, 6, 6, 6, 6, // 6 -> HP (high-pass)
6, 6, 6, 6, 6, 6, 6, 6
};
// context weighting for subband classification
static const signed int ctx_weights[ 7 ][ 3 ][ 5 ] =
{
{ // 0 -> DC (DC subband)
{ 0, 0, 2, 0, 0 },
{ 0, 3, 4, 3, 0 },
{ 2, 4, 0, 0, 0 }
},
{ // 1 -> PV (principal vertical)
{ 0, 0, 3, 0, 0 },
{ 0, 0, 6, 0, 0 },
{ 0, 0, 0, 0, 0 }
},
{ // 2 -> PH (principal horizontal)
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 3, 6, 0, 0, 0 }
},
{ // 3 -> LV (low-frequency vertical)
{ 0, 0, 3, 0, 0 },
{ 0, 1, 6, 1, 0 },
{ 0, 1, 0, 0, 0 }
},
{ // 4 -> LH (low-frequency horizontal)
{ 0, 0, 0, 0, 0 },
{ 0, 1, 1, 1, 0 },
{ 3, 6, 0, 0, 0 }
},
{ // 5 -> LD (low-frequency diagonal)
{ 0, 0, 2, 0, 0 },
{ 0, 3, 4, 3, 0 },
{ 2, 4, 0, 0, 0 }
},
{ // 6 -> HP (high-pass)
{ 0, 0, 2, 0, 0 },
{ 0, 3, 4, 3, 0 },
{ 2, 4, 0, 0, 0 }
}
};
// context weighting for each band (from mixedlum27 set)
static const signed int abs_ctx_weights[ 64 ][ 3 ][ 5 ] =
{
{ // DCT(0/0)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 11, 8, 0, },
{ 9, 13, 0, 0, 0, },
},
{ // DCT(1/0)
{ 0, 0, 7, 0, 0, },
{ 0, 4, 30, 6, 0, },
{ 5, 6, 0, 0, 0, },
},
{ // DCT(0/1)
{ 0, 0, 4, 0, 0, },
{ 0, 3, 3, 6, 0, },
{ 7, 35, 0, 0, 0, },
},
{ // DCT(0/2)
{ 0, 0, 5, 0, 0, },
{ 0, 2, 5, 6, 0, },
{ 10, 29, 0, 0, 0, },
},
{ // DCT(1/1)
{ 0, 0, 4, 0, 0, },
{ 0, 7, 13, 11, 0, },
{ 5, 16, 0, 0, 0, },
},
{ // DCT(2/0)
{ 0, 0, 10, 0, 0, },
{ 0, 2, 27, 6, 0, },
{ 5, 8, 0, 0, 0, },
},
{ // DCT(3/0)
{ 0, 0, 11, 0, 0, },
{ 0, 2, 24, 6, 0, },
{ 6, 9, 0, 0, 0, },
},
{ // DCT(2/1)
{ 0, 0, 5, 0, 0, },
{ 0, 8, 15, 10, 0, },
{ 6, 12, 0, 0, 0, },
},
{ // DCT(1/2)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 9, 11, 0, },
{ 7, 17, 0, 0, 0, },
},
{ // DCT(0/3)
{ 0, 0, 6, 0, 0, },
{ 0, 3, 6, 6, 0, },
{ 11, 26, 0, 0, 0, },
},
{ // DCT(0/4)
{ 0, 0, 6, 0, 0, },
{ 0, 3, 6, 7, 0, },
{ 11, 24, 0, 0, 0, },
},
{ // DCT(1/3)
{ 0, 0, 6, 0, 0, },
{ 0, 6, 9, 10, 0, },
{ 8, 17, 0, 0, 0, },
},
{ // DCT(2/2)
{ 0, 0, 5, 0, 0, },
{ 0, 9, 11, 11, 0, },
{ 7, 13, 0, 0, 0, },
},
{ // DCT(3/1)
{ 0, 0, 6, 0, 0, },
{ 0, 7, 16, 10, 0, },
{ 7, 11, 0, 0, 0, },
},
{ // DCT(4/0)
{ 0, 0, 11, 0, 0, },
{ 0, 3, 22, 6, 0, },
{ 7, 9, 0, 0, 0, },
},
{ // DCT(5/0)
{ 0, 0, 11, 0, 0, },
{ 0, 3, 19, 6, 0, },
{ 7, 9, 0, 0, 0, },
},
{ // DCT(4/1)
{ 0, 0, 7, 0, 0, },
{ 0, 7, 15, 9, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(3/2)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 13, 10, 0, },
{ 7, 12, 0, 0, 0, },
},
{ // DCT(2/3)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 10, 11, 0, },
{ 7, 14, 0, 0, 0, },
},
{ // DCT(1/4)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 9, 10, 0, },
{ 8, 16, 0, 0, 0, },
},
{ // DCT(0/5)
{ 0, 0, 5, 0, 0, },
{ 0, 3, 6, 6, 0, },
{ 13, 24, 0, 0, 0, },
},
{ // DCT(0/6)
{ 0, 0, 5, 0, 0, },
{ 0, 3, 6, 6, 0, },
{ 13, 20, 0, 0, 0, },
},
{ // DCT(1/5)
{ 0, 0, 7, 0, 0, },
{ 0, 7, 9, 9, 0, },
{ 8, 15, 0, 0, 0, },
},
{ // DCT(2/4)
{ 0, 0, 7, 0, 0, },
{ 0, 8, 10, 10, 0, },
{ 7, 13, 0, 0, 0, },
},
{ // DCT(3/3)
{ 0, 0, 7, 0, 0, },
{ 0, 9, 10, 11, 0, },
{ 7, 12, 0, 0, 0, },
},
{ // DCT(4/2)
{ 0, 0, 7, 0, 0, },
{ 0, 8, 12, 9, 0, },
{ 8, 11, 0, 0, 0, },
},
{ // DCT(5/1)
{ 0, 0, 7, 0, 0, },
{ 0, 7, 13, 9, 0, },
{ 8, 10, 0, 0, 0, },
},
{ // DCT(6/0)
{ 0, 0, 12, 0, 0, },
{ 0, 3, 18, 5, 0, },
{ 5, 7, 0, 0, 0, },
},
{ // DCT(7/0)
{ 0, 0, 13, 0, 0, },
{ 0, 3, 19, 3, 0, },
{ 5, 6, 0, 0, 0, },
},
{ // DCT(6/1)
{ 0, 0, 7, 0, 0, },
{ 0, 6, 11, 8, 0, },
{ 7, 9, 0, 0, 0, },
},
{ // DCT(5/2)
{ 0, 0, 7, 0, 0, },
{ 0, 7, 11, 8, 0, },
{ 7, 10, 0, 0, 0, },
},
{ // DCT(4/3)
{ 0, 0, 6, 0, 0, },
{ 0, 8, 10, 10, 0, },
{ 7, 11, 0, 0, 0, },
},
{ // DCT(3/4)
{ 0, 0, 7, 0, 0, },
{ 0, 8, 10, 10, 0, },
{ 7, 11, 0, 0, 0, },
},
{ // DCT(2/5)
{ 0, 0, 6,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