pcompress/filters/packjpg/dct8x8.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

1166 lines
63 KiB
C

#define DCT_RSC_FACTOR 8192
#define DCT_RESCALE( v ) ( ( ( v > 0 ) ? ( v + (DCT_RSC_FACTOR/2) ) : ( v - (DCT_RSC_FACTOR/2) ) ) / DCT_RSC_FACTOR )
// precalculated int values for 8x8 IDCT, multplied by 8192
const int icos_idct_8x8[ 4096 ] =
{
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
1420, 1970, 1856, 1670, 1420, 1116, 769, 392,
1338, 1856, 1748, 1573, 1338, 1051, 724, 369,
1204, 1670, 1573, 1416, 1204, 946, 652, 332,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
805, 1116, 1051, 946, 805, 632, 435, 222,
554, 769, 724, 652, 554, 435, 300, 153,
283, 392, 369, 332, 283, 222, 153, 78,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
1420, 1670, 769, -392, -1420, -1970, -1856, -1116,
1338, 1573, 724, -369, -1338, -1856, -1748, -1051,
1204, 1416, 652, -332, -1204, -1670, -1573, -946,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
805, 946, 435, -222, -805, -1116, -1051, -632,
554, 652, 300, -153, -554, -769, -724, -435,
283, 332, 153, -78, -283, -392, -369, -222,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
1420, 1116, -769, -1970, -1420, 392, 1856, 1670,
1338, 1051, -724, -1856, -1338, 369, 1748, 1573,
1204, 946, -652, -1670, -1204, 332, 1573, 1416,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
805, 632, -435, -1116, -805, 222, 1051, 946,
554, 435, -300, -769, -554, 153, 724, 652,
283, 222, -153, -392, -283, 78, 369, 332,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
1420, 392, -1856, -1116, 1420, 1670, -769, -1970,
1338, 369, -1748, -1051, 1338, 1573, -724, -1856,
1204, 332, -1573, -946, 1204, 1416, -652, -1670,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
805, 222, -1051, -632, 805, 946, -435, -1116,
554, 153, -724, -435, 554, 652, -300, -769,
283, 78, -369, -222, 283, 332, -153, -392,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
1420, -392, -1856, 1116, 1420, -1670, -769, 1970,
1338, -369, -1748, 1051, 1338, -1573, -724, 1856,
1204, -332, -1573, 946, 1204, -1416, -652, 1670,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
805, -222, -1051, 632, 805, -946, -435, 1116,
554, -153, -724, 435, 554, -652, -300, 769,
283, -78, -369, 222, 283, -332, -153, 392,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
1420, -1116, -769, 1970, -1420, -392, 1856, -1670,
1338, -1051, -724, 1856, -1338, -369, 1748, -1573,
1204, -946, -652, 1670, -1204, -332, 1573, -1416,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
805, -632, -435, 1116, -805, -222, 1051, -946,
554, -435, -300, 769, -554, -153, 724, -652,
283, -222, -153, 392, -283, -78, 369, -332,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
1420, -1670, 769, 392, -1420, 1970, -1856, 1116,
1338, -1573, 724, 369, -1338, 1856, -1748, 1051,
1204, -1416, 652, 332, -1204, 1670, -1573, 946,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
805, -946, 435, 222, -805, 1116, -1051, 632,
554, -652, 300, 153, -554, 769, -724, 435,
283, -332, 153, 78, -283, 392, -369, 222,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
1420, -1970, 1856, -1670, 1420, -1116, 769, -392,
1338, -1856, 1748, -1573, 1338, -1051, 724, -369,
1204, -1670, 1573, -1416, 1204, -946, 652, -332,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
805, -1116, 1051, -946, 805, -632, 435, -222,
554, -769, 724, -652, 554, -435, 300, -153,
283, -392, 369, -332, 283, -222, 153, -78,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
1204, 1670, 1573, 1416, 1204, 946, 652, 332,
554, 769, 724, 652, 554, 435, 300, 153,
-283, -392, -369, -332, -283, -222, -153, -78,
-1024, -1420, -1338, -1204, -1024, -805, -554, -283,
-1420, -1970, -1856, -1670, -1420, -1116, -769, -392,
-1338, -1856, -1748, -1573, -1338, -1051, -724, -369,
-805, -1116, -1051, -946, -805, -632, -435, -222,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
1204, 1416, 652, -332, -1204, -1670, -1573, -946,
554, 652, 300, -153, -554, -769, -724, -435,
-283, -332, -153, 78, 283, 392, 369, 222,
-1024, -1204, -554, 283, 1024, 1420, 1338, 805,
-1420, -1670, -769, 392, 1420, 1970, 1856, 1116,
-1338, -1573, -724, 369, 1338, 1856, 1748, 1051,
-805, -946, -435, 222, 805, 1116, 1051, 632,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
1204, 946, -652, -1670, -1204, 332, 1573, 1416,
554, 435, -300, -769, -554, 153, 724, 652,
-283, -222, 153, 392, 283, -78, -369, -332,
-1024, -805, 554, 1420, 1024, -283, -1338, -1204,
-1420, -1116, 769, 1970, 1420, -392, -1856, -1670,
-1338, -1051, 724, 1856, 1338, -369, -1748, -1573,
-805, -632, 435, 1116, 805, -222, -1051, -946,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
1204, 332, -1573, -946, 1204, 1416, -652, -1670,
554, 153, -724, -435, 554, 652, -300, -769,
-283, -78, 369, 222, -283, -332, 153, 392,
-1024, -283, 1338, 805, -1024, -1204, 554, 1420,
-1420, -392, 1856, 1116, -1420, -1670, 769, 1970,
-1338, -369, 1748, 1051, -1338, -1573, 724, 1856,
-805, -222, 1051, 632, -805, -946, 435, 1116,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
1204, -332, -1573, 946, 1204, -1416, -652, 1670,
554, -153, -724, 435, 554, -652, -300, 769,
-283, 78, 369, -222, -283, 332, 153, -392,
-1024, 283, 1338, -805, -1024, 1204, 554, -1420,
-1420, 392, 1856, -1116, -1420, 1670, 769, -1970,
-1338, 369, 1748, -1051, -1338, 1573, 724, -1856,
-805, 222, 1051, -632, -805, 946, 435, -1116,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
1204, -946, -652, 1670, -1204, -332, 1573, -1416,
554, -435, -300, 769, -554, -153, 724, -652,
-283, 222, 153, -392, 283, 78, -369, 332,
-1024, 805, 554, -1420, 1024, 283, -1338, 1204,
-1420, 1116, 769, -1970, 1420, 392, -1856, 1670,
-1338, 1051, 724, -1856, 1338, 369, -1748, 1573,
-805, 632, 435, -1116, 805, 222, -1051, 946,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
1204, -1416, 652, 332, -1204, 1670, -1573, 946,
554, -652, 300, 153, -554, 769, -724, 435,
-283, 332, -153, -78, 283, -392, 369, -222,
-1024, 1204, -554, -283, 1024, -1420, 1338, -805,
-1420, 1670, -769, -392, 1420, -1970, 1856, -1116,
-1338, 1573, -724, -369, 1338, -1856, 1748, -1051,
-805, 946, -435, -222, 805, -1116, 1051, -632,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
1204, -1670, 1573, -1416, 1204, -946, 652, -332,
554, -769, 724, -652, 554, -435, 300, -153,
-283, 392, -369, 332, -283, 222, -153, 78,
-1024, 1420, -1338, 1204, -1024, 805, -554, 283,
-1420, 1970, -1856, 1670, -1420, 1116, -769, 392,
-1338, 1856, -1748, 1573, -1338, 1051, -724, 369,
-805, 1116, -1051, 946, -805, 632, -435, 222,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
805, 1116, 1051, 946, 805, 632, 435, 222,
-554, -769, -724, -652, -554, -435, -300, -153,
-1420, -1970, -1856, -1670, -1420, -1116, -769, -392,
-1024, -1420, -1338, -1204, -1024, -805, -554, -283,
283, 392, 369, 332, 283, 222, 153, 78,
1338, 1856, 1748, 1573, 1338, 1051, 724, 369,
1204, 1670, 1573, 1416, 1204, 946, 652, 332,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
805, 946, 435, -222, -805, -1116, -1051, -632,
-554, -652, -300, 153, 554, 769, 724, 435,
-1420, -1670, -769, 392, 1420, 1970, 1856, 1116,
-1024, -1204, -554, 283, 1024, 1420, 1338, 805,
283, 332, 153, -78, -283, -392, -369, -222,
1338, 1573, 724, -369, -1338, -1856, -1748, -1051,
1204, 1416, 652, -332, -1204, -1670, -1573, -946,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
805, 632, -435, -1116, -805, 222, 1051, 946,
-554, -435, 300, 769, 554, -153, -724, -652,
-1420, -1116, 769, 1970, 1420, -392, -1856, -1670,
-1024, -805, 554, 1420, 1024, -283, -1338, -1204,
283, 222, -153, -392, -283, 78, 369, 332,
1338, 1051, -724, -1856, -1338, 369, 1748, 1573,
1204, 946, -652, -1670, -1204, 332, 1573, 1416,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
805, 222, -1051, -632, 805, 946, -435, -1116,
-554, -153, 724, 435, -554, -652, 300, 769,
-1420, -392, 1856, 1116, -1420, -1670, 769, 1970,
-1024, -283, 1338, 805, -1024, -1204, 554, 1420,
283, 78, -369, -222, 283, 332, -153, -392,
1338, 369, -1748, -1051, 1338, 1573, -724, -1856,
1204, 332, -1573, -946, 1204, 1416, -652, -1670,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
805, -222, -1051, 632, 805, -946, -435, 1116,
-554, 153, 724, -435, -554, 652, 300, -769,
-1420, 392, 1856, -1116, -1420, 1670, 769, -1970,
-1024, 283, 1338, -805, -1024, 1204, 554, -1420,
283, -78, -369, 222, 283, -332, -153, 392,
1338, -369, -1748, 1051, 1338, -1573, -724, 1856,
1204, -332, -1573, 946, 1204, -1416, -652, 1670,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
805, -632, -435, 1116, -805, -222, 1051, -946,
-554, 435, 300, -769, 554, 153, -724, 652,
-1420, 1116, 769, -1970, 1420, 392, -1856, 1670,
-1024, 805, 554, -1420, 1024, 283, -1338, 1204,
283, -222, -153, 392, -283, -78, 369, -332,
1338, -1051, -724, 1856, -1338, -369, 1748, -1573,
1204, -946, -652, 1670, -1204, -332, 1573, -1416,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
805, -946, 435, 222, -805, 1116, -1051, 632,
-554, 652, -300, -153, 554, -769, 724, -435,
-1420, 1670, -769, -392, 1420, -1970, 1856, -1116,
-1024, 1204, -554, -283, 1024, -1420, 1338, -805,
283, -332, 153, 78, -283, 392, -369, 222,
1338, -1573, 724, 369, -1338, 1856, -1748, 1051,
1204, -1416, 652, 332, -1204, 1670, -1573, 946,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
805, -1116, 1051, -946, 805, -632, 435, -222,
-554, 769, -724, 652, -554, 435, -300, 153,
-1420, 1970, -1856, 1670, -1420, 1116, -769, 392,
-1024, 1420, -1338, 1204, -1024, 805, -554, 283,
283, -392, 369, -332, 283, -222, 153, -78,
1338, -1856, 1748, -1573, 1338, -1051, 724, -369,
1204, -1670, 1573, -1416, 1204, -946, 652, -332,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
283, 392, 369, 332, 283, 222, 153, 78,
-1338, -1856, -1748, -1573, -1338, -1051, -724, -369,
-805, -1116, -1051, -946, -805, -632, -435, -222,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
1204, 1670, 1573, 1416, 1204, 946, 652, 332,
-554, -769, -724, -652, -554, -435, -300, -153,
-1420, -1970, -1856, -1670, -1420, -1116, -769, -392,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
283, 332, 153, -78, -283, -392, -369, -222,
-1338, -1573, -724, 369, 1338, 1856, 1748, 1051,
-805, -946, -435, 222, 805, 1116, 1051, 632,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
1204, 1416, 652, -332, -1204, -1670, -1573, -946,
-554, -652, -300, 153, 554, 769, 724, 435,
-1420, -1670, -769, 392, 1420, 1970, 1856, 1116,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
283, 222, -153, -392, -283, 78, 369, 332,
-1338, -1051, 724, 1856, 1338, -369, -1748, -1573,
-805, -632, 435, 1116, 805, -222, -1051, -946,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
1204, 946, -652, -1670, -1204, 332, 1573, 1416,
-554, -435, 300, 769, 554, -153, -724, -652,
-1420, -1116, 769, 1970, 1420, -392, -1856, -1670,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
283, 78, -369, -222, 283, 332, -153, -392,
-1338, -369, 1748, 1051, -1338, -1573, 724, 1856,
-805, -222, 1051, 632, -805, -946, 435, 1116,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
1204, 332, -1573, -946, 1204, 1416, -652, -1670,
-554, -153, 724, 435, -554, -652, 300, 769,
-1420, -392, 1856, 1116, -1420, -1670, 769, 1970,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
283, -78, -369, 222, 283, -332, -153, 392,
-1338, 369, 1748, -1051, -1338, 1573, 724, -1856,
-805, 222, 1051, -632, -805, 946, 435, -1116,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
1204, -332, -1573, 946, 1204, -1416, -652, 1670,
-554, 153, 724, -435, -554, 652, 300, -769,
-1420, 392, 1856, -1116, -1420, 1670, 769, -1970,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
283, -222, -153, 392, -283, -78, 369, -332,
-1338, 1051, 724, -1856, 1338, 369, -1748, 1573,
-805, 632, 435, -1116, 805, 222, -1051, 946,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
1204, -946, -652, 1670, -1204, -332, 1573, -1416,
-554, 435, 300, -769, 554, 153, -724, 652,
-1420, 1116, 769, -1970, 1420, 392, -1856, 1670,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
283, -332, 153, 78, -283, 392, -369, 222,
-1338, 1573, -724, -369, 1338, -1856, 1748, -1051,
-805, 946, -435, -222, 805, -1116, 1051, -632,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
1204, -1416, 652, 332, -1204, 1670, -1573, 946,
-554, 652, -300, -153, 554, -769, 724, -435,
-1420, 1670, -769, -392, 1420, -1970, 1856, -1116,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
283, -392, 369, -332, 283, -222, 153, -78,
-1338, 1856, -1748, 1573, -1338, 1051, -724, 369,
-805, 1116, -1051, 946, -805, 632, -435, 222,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
1204, -1670, 1573, -1416, 1204, -946, 652, -332,
-554, 769, -724, 652, -554, 435, -300, 153,
-1420, 1970, -1856, 1670, -1420, 1116, -769, 392,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
-283, -392, -369, -332, -283, -222, -153, -78,
-1338, -1856, -1748, -1573, -1338, -1051, -724, -369,
805, 1116, 1051, 946, 805, 632, 435, 222,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
-1204, -1670, -1573, -1416, -1204, -946, -652, -332,
-554, -769, -724, -652, -554, -435, -300, -153,
1420, 1970, 1856, 1670, 1420, 1116, 769, 392,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
-283, -332, -153, 78, 283, 392, 369, 222,
-1338, -1573, -724, 369, 1338, 1856, 1748, 1051,
805, 946, 435, -222, -805, -1116, -1051, -632,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
-1204, -1416, -652, 332, 1204, 1670, 1573, 946,
-554, -652, -300, 153, 554, 769, 724, 435,
1420, 1670, 769, -392, -1420, -1970, -1856, -1116,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
-283, -222, 153, 392, 283, -78, -369, -332,
-1338, -1051, 724, 1856, 1338, -369, -1748, -1573,
805, 632, -435, -1116, -805, 222, 1051, 946,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
-1204, -946, 652, 1670, 1204, -332, -1573, -1416,
-554, -435, 300, 769, 554, -153, -724, -652,
1420, 1116, -769, -1970, -1420, 392, 1856, 1670,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
-283, -78, 369, 222, -283, -332, 153, 392,
-1338, -369, 1748, 1051, -1338, -1573, 724, 1856,
805, 222, -1051, -632, 805, 946, -435, -1116,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
-1204, -332, 1573, 946, -1204, -1416, 652, 1670,
-554, -153, 724, 435, -554, -652, 300, 769,
1420, 392, -1856, -1116, 1420, 1670, -769, -1970,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
-283, 78, 369, -222, -283, 332, 153, -392,
-1338, 369, 1748, -1051, -1338, 1573, 724, -1856,
805, -222, -1051, 632, 805, -946, -435, 1116,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
-1204, 332, 1573, -946, -1204, 1416, 652, -1670,
-554, 153, 724, -435, -554, 652, 300, -769,
1420, -392, -1856, 1116, 1420, -1670, -769, 1970,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
-283, 222, 153, -392, 283, 78, -369, 332,
-1338, 1051, 724, -1856, 1338, 369, -1748, 1573,
805, -632, -435, 1116, -805, -222, 1051, -946,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
-1204, 946, 652, -1670, 1204, 332, -1573, 1416,
-554, 435, 300, -769, 554, 153, -724, 652,
1420, -1116, -769, 1970, -1420, -392, 1856, -1670,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
-283, 332, -153, -78, 283, -392, 369, -222,
-1338, 1573, -724, -369, 1338, -1856, 1748, -1051,
805, -946, 435, 222, -805, 1116, -1051, 632,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
-1204, 1416, -652, -332, 1204, -1670, 1573, -946,
-554, 652, -300, -153, 554, -769, 724, -435,
1420, -1670, 769, 392, -1420, 1970, -1856, 1116,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
-283, 392, -369, 332, -283, 222, -153, 78,
-1338, 1856, -1748, 1573, -1338, 1051, -724, 369,
805, -1116, 1051, -946, 805, -632, 435, -222,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
-1204, 1670, -1573, 1416, -1204, 946, -652, 332,
-554, 769, -724, 652, -554, 435, -300, 153,
1420, -1970, 1856, -1670, 1420, -1116, 769, -392,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
-805, -1116, -1051, -946, -805, -632, -435, -222,
-554, -769, -724, -652, -554, -435, -300, -153,
1420, 1970, 1856, 1670, 1420, 1116, 769, 392,
-1024, -1420, -1338, -1204, -1024, -805, -554, -283,
-283, -392, -369, -332, -283, -222, -153, -78,
1338, 1856, 1748, 1573, 1338, 1051, 724, 369,
-1204, -1670, -1573, -1416, -1204, -946, -652, -332,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
-805, -946, -435, 222, 805, 1116, 1051, 632,
-554, -652, -300, 153, 554, 769, 724, 435,
1420, 1670, 769, -392, -1420, -1970, -1856, -1116,
-1024, -1204, -554, 283, 1024, 1420, 1338, 805,
-283, -332, -153, 78, 283, 392, 369, 222,
1338, 1573, 724, -369, -1338, -1856, -1748, -1051,
-1204, -1416, -652, 332, 1204, 1670, 1573, 946,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
-805, -632, 435, 1116, 805, -222, -1051, -946,
-554, -435, 300, 769, 554, -153, -724, -652,
1420, 1116, -769, -1970, -1420, 392, 1856, 1670,
-1024, -805, 554, 1420, 1024, -283, -1338, -1204,
-283, -222, 153, 392, 283, -78, -369, -332,
1338, 1051, -724, -1856, -1338, 369, 1748, 1573,
-1204, -946, 652, 1670, 1204, -332, -1573, -1416,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
-805, -222, 1051, 632, -805, -946, 435, 1116,
-554, -153, 724, 435, -554, -652, 300, 769,
1420, 392, -1856, -1116, 1420, 1670, -769, -1970,
-1024, -283, 1338, 805, -1024, -1204, 554, 1420,
-283, -78, 369, 222, -283, -332, 153, 392,
1338, 369, -1748, -1051, 1338, 1573, -724, -1856,
-1204, -332, 1573, 946, -1204, -1416, 652, 1670,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
-805, 222, 1051, -632, -805, 946, 435, -1116,
-554, 153, 724, -435, -554, 652, 300, -769,
1420, -392, -1856, 1116, 1420, -1670, -769, 1970,
-1024, 283, 1338, -805, -1024, 1204, 554, -1420,
-283, 78, 369, -222, -283, 332, 153, -392,
1338, -369, -1748, 1051, 1338, -1573, -724, 1856,
-1204, 332, 1573, -946, -1204, 1416, 652, -1670,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
-805, 632, 435, -1116, 805, 222, -1051, 946,
-554, 435, 300, -769, 554, 153, -724, 652,
1420, -1116, -769, 1970, -1420, -392, 1856, -1670,
-1024, 805, 554, -1420, 1024, 283, -1338, 1204,
-283, 222, 153, -392, 283, 78, -369, 332,
1338, -1051, -724, 1856, -1338, -369, 1748, -1573,
-1204, 946, 652, -1670, 1204, 332, -1573, 1416,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
-805, 946, -435, -222, 805, -1116, 1051, -632,
-554, 652, -300, -153, 554, -769, 724, -435,
1420, -1670, 769, 392, -1420, 1970, -1856, 1116,
-1024, 1204, -554, -283, 1024, -1420, 1338, -805,
-283, 332, -153, -78, 283, -392, 369, -222,
1338, -1573, 724, 369, -1338, 1856, -1748, 1051,
-1204, 1416, -652, -332, 1204, -1670, 1573, -946,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
-805, 1116, -1051, 946, -805, 632, -435, 222,
-554, 769, -724, 652, -554, 435, -300, 153,
1420, -1970, 1856, -1670, 1420, -1116, 769, -392,
-1024, 1420, -1338, 1204, -1024, 805, -554, 283,
-283, 392, -369, 332, -283, 222, -153, 78,
1338, -1856, 1748, -1573, 1338, -1051, 724, -369,
-1204, 1670, -1573, 1416, -1204, 946, -652, 332,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
-1204, -1670, -1573, -1416, -1204, -946, -652, -332,
554, 769, 724, 652, 554, 435, 300, 153,
283, 392, 369, 332, 283, 222, 153, 78,
-1024, -1420, -1338, -1204, -1024, -805, -554, -283,
1420, 1970, 1856, 1670, 1420, 1116, 769, 392,
-1338, -1856, -1748, -1573, -1338, -1051, -724, -369,
805, 1116, 1051, 946, 805, 632, 435, 222,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
-1204, -1416, -652, 332, 1204, 1670, 1573, 946,
554, 652, 300, -153, -554, -769, -724, -435,
283, 332, 153, -78, -283, -392, -369, -222,
-1024, -1204, -554, 283, 1024, 1420, 1338, 805,
1420, 1670, 769, -392, -1420, -1970, -1856, -1116,
-1338, -1573, -724, 369, 1338, 1856, 1748, 1051,
805, 946, 435, -222, -805, -1116, -1051, -632,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
-1204, -946, 652, 1670, 1204, -332, -1573, -1416,
554, 435, -300, -769, -554, 153, 724, 652,
283, 222, -153, -392, -283, 78, 369, 332,
-1024, -805, 554, 1420, 1024, -283, -1338, -1204,
1420, 1116, -769, -1970, -1420, 392, 1856, 1670,
-1338, -1051, 724, 1856, 1338, -369, -1748, -1573,
805, 632, -435, -1116, -805, 222, 1051, 946,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
-1204, -332, 1573, 946, -1204, -1416, 652, 1670,
554, 153, -724, -435, 554, 652, -300, -769,
283, 78, -369, -222, 283, 332, -153, -392,
-1024, -283, 1338, 805, -1024, -1204, 554, 1420,
1420, 392, -1856, -1116, 1420, 1670, -769, -1970,
-1338, -369, 1748, 1051, -1338, -1573, 724, 1856,
805, 222, -1051, -632, 805, 946, -435, -1116,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
-1204, 332, 1573, -946, -1204, 1416, 652, -1670,
554, -153, -724, 435, 554, -652, -300, 769,
283, -78, -369, 222, 283, -332, -153, 392,
-1024, 283, 1338, -805, -1024, 1204, 554, -1420,
1420, -392, -1856, 1116, 1420, -1670, -769, 1970,
-1338, 369, 1748, -1051, -1338, 1573, 724, -1856,
805, -222, -1051, 632, 805, -946, -435, 1116,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
-1204, 946, 652, -1670, 1204, 332, -1573, 1416,
554, -435, -300, 769, -554, -153, 724, -652,
283, -222, -153, 392, -283, -78, 369, -332,
-1024, 805, 554, -1420, 1024, 283, -1338, 1204,
1420, -1116, -769, 1970, -1420, -392, 1856, -1670,
-1338, 1051, 724, -1856, 1338, 369, -1748, 1573,
805, -632, -435, 1116, -805, -222, 1051, -946,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
-1204, 1416, -652, -332, 1204, -1670, 1573, -946,
554, -652, 300, 153, -554, 769, -724, 435,
283, -332, 153, 78, -283, 392, -369, 222,
-1024, 1204, -554, -283, 1024, -1420, 1338, -805,
1420, -1670, 769, 392, -1420, 1970, -1856, 1116,
-1338, 1573, -724, -369, 1338, -1856, 1748, -1051,
805, -946, 435, 222, -805, 1116, -1051, 632,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
-1204, 1670, -1573, 1416, -1204, 946, -652, 332,
554, -769, 724, -652, 554, -435, 300, -153,
283, -392, 369, -332, 283, -222, 153, -78,
-1024, 1420, -1338, 1204, -1024, 805, -554, 283,
1420, -1970, 1856, -1670, 1420, -1116, 769, -392,
-1338, 1856, -1748, 1573, -1338, 1051, -724, 369,
805, -1116, 1051, -946, 805, -632, 435, -222,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
-1420, -1970, -1856, -1670, -1420, -1116, -769, -392,
1338, 1856, 1748, 1573, 1338, 1051, 724, 369,
-1204, -1670, -1573, -1416, -1204, -946, -652, -332,
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
-805, -1116, -1051, -946, -805, -632, -435, -222,
554, 769, 724, 652, 554, 435, 300, 153,
-283, -392, -369, -332, -283, -222, -153, -78,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
-1420, -1670, -769, 392, 1420, 1970, 1856, 1116,
1338, 1573, 724, -369, -1338, -1856, -1748, -1051,
-1204, -1416, -652, 332, 1204, 1670, 1573, 946,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
-805, -946, -435, 222, 805, 1116, 1051, 632,
554, 652, 300, -153, -554, -769, -724, -435,
-283, -332, -153, 78, 283, 392, 369, 222,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
-1420, -1116, 769, 1970, 1420, -392, -1856, -1670,
1338, 1051, -724, -1856, -1338, 369, 1748, 1573,
-1204, -946, 652, 1670, 1204, -332, -1573, -1416,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
-805, -632, 435, 1116, 805, -222, -1051, -946,
554, 435, -300, -769, -554, 153, 724, 652,
-283, -222, 153, 392, 283, -78, -369, -332,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
-1420, -392, 1856, 1116, -1420, -1670, 769, 1970,
1338, 369, -1748, -1051, 1338, 1573, -724, -1856,
-1204, -332, 1573, 946, -1204, -1416, 652, 1670,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
-805, -222, 1051, 632, -805, -946, 435, 1116,
554, 153, -724, -435, 554, 652, -300, -769,
-283, -78, 369, 222, -283, -332, 153, 392,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
-1420, 392, 1856, -1116, -1420, 1670, 769, -1970,
1338, -369, -1748, 1051, 1338, -1573, -724, 1856,
-1204, 332, 1573, -946, -1204, 1416, 652, -1670,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
-805, 222, 1051, -632, -805, 946, 435, -1116,
554, -153, -724, 435, 554, -652, -300, 769,
-283, 78, 369, -222, -283, 332, 153, -392,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
-1420, 1116, 769, -1970, 1420, 392, -1856, 1670,
1338, -1051, -724, 1856, -1338, -369, 1748, -1573,
-1204, 946, 652, -1670, 1204, 332, -1573, 1416,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
-805, 632, 435, -1116, 805, 222, -1051, 946,
554, -435, -300, 769, -554, -153, 724, -652,
-283, 222, 153, -392, 283, 78, -369, 332,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
-1420, 1670, -769, -392, 1420, -1970, 1856, -1116,
1338, -1573, 724, 369, -1338, 1856, -1748, 1051,
-1204, 1416, -652, -332, 1204, -1670, 1573, -946,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
-805, 946, -435, -222, 805, -1116, 1051, -632,
554, -652, 300, 153, -554, 769, -724, 435,
-283, 332, -153, -78, 283, -392, 369, -222,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
-1420, 1970, -1856, 1670, -1420, 1116, -769, 392,
1338, -1856, 1748, -1573, 1338, -1051, 724, -369,
-1204, 1670, -1573, 1416, -1204, 946, -652, 332,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
-805, 1116, -1051, 946, -805, 632, -435, 222,
554, -769, 724, -652, 554, -435, 300, -153,
-283, 392, -369, 332, -283, 222, -153, 78,
};
// precalculated int values for 8x8 FDCT, multplied by 8192
const int icos_fdct_8x8[ 4096 ] =
{
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
1420, 1420, 1420, 1420, 1420, 1420, 1420, 1420,
1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204,
805, 805, 805, 805, 805, 805, 805, 805,
283, 283, 283, 283, 283, 283, 283, 283,
-283, -283, -283, -283, -283, -283, -283, -283,
-805, -805, -805, -805, -805, -805, -805, -805,
-1204, -1204, -1204, -1204, -1204, -1204, -1204, -1204,
-1420, -1420, -1420, -1420, -1420, -1420, -1420, -1420,
1970, 1670, 1116, 392, -392, -1116, -1670, -1970,
1670, 1416, 946, 332, -332, -946, -1416, -1670,
1116, 946, 632, 222, -222, -632, -946, -1116,
392, 332, 222, 78, -78, -222, -332, -392,
-392, -332, -222, -78, 78, 222, 332, 392,
-1116, -946, -632, -222, 222, 632, 946, 1116,
-1670, -1416, -946, -332, 332, 946, 1416, 1670,
-1970, -1670, -1116, -392, 392, 1116, 1670, 1970,
1856, 769, -769, -1856, -1856, -769, 769, 1856,
1573, 652, -652, -1573, -1573, -652, 652, 1573,
1051, 435, -435, -1051, -1051, -435, 435, 1051,
369, 153, -153, -369, -369, -153, 153, 369,
-369, -153, 153, 369, 369, 153, -153, -369,
-1051, -435, 435, 1051, 1051, 435, -435, -1051,
-1573, -652, 652, 1573, 1573, 652, -652, -1573,
-1856, -769, 769, 1856, 1856, 769, -769, -1856,
1670, -392, -1970, -1116, 1116, 1970, 392, -1670,
1416, -332, -1670, -946, 946, 1670, 332, -1416,
946, -222, -1116, -632, 632, 1116, 222, -946,
332, -78, -392, -222, 222, 392, 78, -332,
-332, 78, 392, 222, -222, -392, -78, 332,
-946, 222, 1116, 632, -632, -1116, -222, 946,
-1416, 332, 1670, 946, -946, -1670, -332, 1416,
-1670, 392, 1970, 1116, -1116, -1970, -392, 1670,
1420, -1420, -1420, 1420, 1420, -1420, -1420, 1420,
1204, -1204, -1204, 1204, 1204, -1204, -1204, 1204,
805, -805, -805, 805, 805, -805, -805, 805,
283, -283, -283, 283, 283, -283, -283, 283,
-283, 283, 283, -283, -283, 283, 283, -283,
-805, 805, 805, -805, -805, 805, 805, -805,
-1204, 1204, 1204, -1204, -1204, 1204, 1204, -1204,
-1420, 1420, 1420, -1420, -1420, 1420, 1420, -1420,
1116, -1970, 392, 1670, -1670, -392, 1970, -1116,
946, -1670, 332, 1416, -1416, -332, 1670, -946,
632, -1116, 222, 946, -946, -222, 1116, -632,
222, -392, 78, 332, -332, -78, 392, -222,
-222, 392, -78, -332, 332, 78, -392, 222,
-632, 1116, -222, -946, 946, 222, -1116, 632,
-946, 1670, -332, -1416, 1416, 332, -1670, 946,
-1116, 1970, -392, -1670, 1670, 392, -1970, 1116,
769, -1856, 1856, -769, -769, 1856, -1856, 769,
652, -1573, 1573, -652, -652, 1573, -1573, 652,
435, -1051, 1051, -435, -435, 1051, -1051, 435,
153, -369, 369, -153, -153, 369, -369, 153,
-153, 369, -369, 153, 153, -369, 369, -153,
-435, 1051, -1051, 435, 435, -1051, 1051, -435,
-652, 1573, -1573, 652, 652, -1573, 1573, -652,
-769, 1856, -1856, 769, 769, -1856, 1856, -769,
392, -1116, 1670, -1970, 1970, -1670, 1116, -392,
332, -946, 1416, -1670, 1670, -1416, 946, -332,
222, -632, 946, -1116, 1116, -946, 632, -222,
78, -222, 332, -392, 392, -332, 222, -78,
-78, 222, -332, 392, -392, 332, -222, 78,
-222, 632, -946, 1116, -1116, 946, -632, 222,
-332, 946, -1416, 1670, -1670, 1416, -946, 332,
-392, 1116, -1670, 1970, -1970, 1670, -1116, 392,
1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
554, 554, 554, 554, 554, 554, 554, 554,
-554, -554, -554, -554, -554, -554, -554, -554,
-1338, -1338, -1338, -1338, -1338, -1338, -1338, -1338,
-1338, -1338, -1338, -1338, -1338, -1338, -1338, -1338,
-554, -554, -554, -554, -554, -554, -554, -554,
554, 554, 554, 554, 554, 554, 554, 554,
1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
1856, 1573, 1051, 369, -369, -1051, -1573, -1856,
769, 652, 435, 153, -153, -435, -652, -769,
-769, -652, -435, -153, 153, 435, 652, 769,
-1856, -1573, -1051, -369, 369, 1051, 1573, 1856,
-1856, -1573, -1051, -369, 369, 1051, 1573, 1856,
-769, -652, -435, -153, 153, 435, 652, 769,
769, 652, 435, 153, -153, -435, -652, -769,
1856, 1573, 1051, 369, -369, -1051, -1573, -1856,
1748, 724, -724, -1748, -1748, -724, 724, 1748,
724, 300, -300, -724, -724, -300, 300, 724,
-724, -300, 300, 724, 724, 300, -300, -724,
-1748, -724, 724, 1748, 1748, 724, -724, -1748,
-1748, -724, 724, 1748, 1748, 724, -724, -1748,
-724, -300, 300, 724, 724, 300, -300, -724,
724, 300, -300, -724, -724, -300, 300, 724,
1748, 724, -724, -1748, -1748, -724, 724, 1748,
1573, -369, -1856, -1051, 1051, 1856, 369, -1573,
652, -153, -769, -435, 435, 769, 153, -652,
-652, 153, 769, 435, -435, -769, -153, 652,
-1573, 369, 1856, 1051, -1051, -1856, -369, 1573,
-1573, 369, 1856, 1051, -1051, -1856, -369, 1573,
-652, 153, 769, 435, -435, -769, -153, 652,
652, -153, -769, -435, 435, 769, 153, -652,
1573, -369, -1856, -1051, 1051, 1856, 369, -1573,
1338, -1338, -1338, 1338, 1338, -1338, -1338, 1338,
554, -554, -554, 554, 554, -554, -554, 554,
-554, 554, 554, -554, -554, 554, 554, -554,
-1338, 1338, 1338, -1338, -1338, 1338, 1338, -1338,
-1338, 1338, 1338, -1338, -1338, 1338, 1338, -1338,
-554, 554, 554, -554, -554, 554, 554, -554,
554, -554, -554, 554, 554, -554, -554, 554,
1338, -1338, -1338, 1338, 1338, -1338, -1338, 1338,
1051, -1856, 369, 1573, -1573, -369, 1856, -1051,
435, -769, 153, 652, -652, -153, 769, -435,
-435, 769, -153, -652, 652, 153, -769, 435,
-1051, 1856, -369, -1573, 1573, 369, -1856, 1051,
-1051, 1856, -369, -1573, 1573, 369, -1856, 1051,
-435, 769, -153, -652, 652, 153, -769, 435,
435, -769, 153, 652, -652, -153, 769, -435,
1051, -1856, 369, 1573, -1573, -369, 1856, -1051,
724, -1748, 1748, -724, -724, 1748, -1748, 724,
300, -724, 724, -300, -300, 724, -724, 300,
-300, 724, -724, 300, 300, -724, 724, -300,
-724, 1748, -1748, 724, 724, -1748, 1748, -724,
-724, 1748, -1748, 724, 724, -1748, 1748, -724,
-300, 724, -724, 300, 300, -724, 724, -300,
300, -724, 724, -300, -300, 724, -724, 300,
724, -1748, 1748, -724, -724, 1748, -1748, 724,
369, -1051, 1573, -1856, 1856, -1573, 1051, -369,
153, -435, 652, -769, 769, -652, 435, -153,
-153, 435, -652, 769, -769, 652, -435, 153,
-369, 1051, -1573, 1856, -1856, 1573, -1051, 369,
-369, 1051, -1573, 1856, -1856, 1573, -1051, 369,
-153, 435, -652, 769, -769, 652, -435, 153,
153, -435, 652, -769, 769, -652, 435, -153,
369, -1051, 1573, -1856, 1856, -1573, 1051, -369,
1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204,
-283, -283, -283, -283, -283, -283, -283, -283,
-1420, -1420, -1420, -1420, -1420, -1420, -1420, -1420,
-805, -805, -805, -805, -805, -805, -805, -805,
805, 805, 805, 805, 805, 805, 805, 805,
1420, 1420, 1420, 1420, 1420, 1420, 1420, 1420,
283, 283, 283, 283, 283, 283, 283, 283,
-1204, -1204, -1204, -1204, -1204, -1204, -1204, -1204,
1670, 1416, 946, 332, -332, -946, -1416, -1670,
-392, -332, -222, -78, 78, 222, 332, 392,
-1970, -1670, -1116, -392, 392, 1116, 1670, 1970,
-1116, -946, -632, -222, 222, 632, 946, 1116,
1116, 946, 632, 222, -222, -632, -946, -1116,
1970, 1670, 1116, 392, -392, -1116, -1670, -1970,
392, 332, 222, 78, -78, -222, -332, -392,
-1670, -1416, -946, -332, 332, 946, 1416, 1670,
1573, 652, -652, -1573, -1573, -652, 652, 1573,
-369, -153, 153, 369, 369, 153, -153, -369,
-1856, -769, 769, 1856, 1856, 769, -769, -1856,
-1051, -435, 435, 1051, 1051, 435, -435, -1051,
1051, 435, -435, -1051, -1051, -435, 435, 1051,
1856, 769, -769, -1856, -1856, -769, 769, 1856,
369, 153, -153, -369, -369, -153, 153, 369,
-1573, -652, 652, 1573, 1573, 652, -652, -1573,
1416, -332, -1670, -946, 946, 1670, 332, -1416,
-332, 78, 392, 222, -222, -392, -78, 332,
-1670, 392, 1970, 1116, -1116, -1970, -392, 1670,
-946, 222, 1116, 632, -632, -1116, -222, 946,
946, -222, -1116, -632, 632, 1116, 222, -946,
1670, -392, -1970, -1116, 1116, 1970, 392, -1670,
332, -78, -392, -222, 222, 392, 78, -332,
-1416, 332, 1670, 946, -946, -1670, -332, 1416,
1204, -1204, -1204, 1204, 1204, -1204, -1204, 1204,
-283, 283, 283, -283, -283, 283, 283, -283,
-1420, 1420, 1420, -1420, -1420, 1420, 1420, -1420,
-805, 805, 805, -805, -805, 805, 805, -805,
805, -805, -805, 805, 805, -805, -805, 805,
1420, -1420, -1420, 1420, 1420, -1420, -1420, 1420,
283, -283, -283, 283, 283, -283, -283, 283,
-1204, 1204, 1204, -1204, -1204, 1204, 1204, -1204,
946, -1670, 332, 1416, -1416, -332, 1670, -946,
-222, 392, -78, -332, 332, 78, -392, 222,
-1116, 1970, -392, -1670, 1670, 392, -1970, 1116,
-632, 1116, -222, -946, 946, 222, -1116, 632,
632, -1116, 222, 946, -946, -222, 1116, -632,
1116, -1970, 392, 1670, -1670, -392, 1970, -1116,
222, -392, 78, 332, -332, -78, 392, -222,
-946, 1670, -332, -1416, 1416, 332, -1670, 946,
652, -1573, 1573, -652, -652, 1573, -1573, 652,
-153, 369, -369, 153, 153, -369, 369, -153,
-769, 1856, -1856, 769, 769, -1856, 1856, -769,
-435, 1051, -1051, 435, 435, -1051, 1051, -435,
435, -1051, 1051, -435, -435, 1051, -1051, 435,
769, -1856, 1856, -769, -769, 1856, -1856, 769,
153, -369, 369, -153, -153, 369, -369, 153,
-652, 1573, -1573, 652, 652, -1573, 1573, -652,
332, -946, 1416, -1670, 1670, -1416, 946, -332,
-78, 222, -332, 392, -392, 332, -222, 78,
-392, 1116, -1670, 1970, -1970, 1670, -1116, 392,
-222, 632, -946, 1116, -1116, 946, -632, 222,
222, -632, 946, -1116, 1116, -946, 632, -222,
392, -1116, 1670, -1970, 1970, -1670, 1116, -392,
78, -222, 332, -392, 392, -332, 222, -78,
-332, 946, -1416, 1670, -1670, 1416, -946, 332,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024,
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024,
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024,
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
-1420, -1204, -805, -283, 283, 805, 1204, 1420,
-1420, -1204, -805, -283, 283, 805, 1204, 1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
-1420, -1204, -805, -283, 283, 805, 1204, 1420,
-1420, -1204, -805, -283, 283, 805, 1204, 1420,
1420, 1204, 805, 283, -283, -805, -1204, -1420,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
-1338, -554, 554, 1338, 1338, 554, -554, -1338,
-1338, -554, 554, 1338, 1338, 554, -554, -1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
-1338, -554, 554, 1338, 1338, 554, -554, -1338,
-1338, -554, 554, 1338, 1338, 554, -554, -1338,
1338, 554, -554, -1338, -1338, -554, 554, 1338,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
-1204, 283, 1420, 805, -805, -1420, -283, 1204,
-1204, 283, 1420, 805, -805, -1420, -283, 1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
-1204, 283, 1420, 805, -805, -1420, -283, 1204,
-1204, 283, 1420, 805, -805, -1420, -283, 1204,
1204, -283, -1420, -805, 805, 1420, 283, -1204,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
-1024, 1024, 1024, -1024, -1024, 1024, 1024, -1024,
-1024, 1024, 1024, -1024, -1024, 1024, 1024, -1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
-1024, 1024, 1024, -1024, -1024, 1024, 1024, -1024,
-1024, 1024, 1024, -1024, -1024, 1024, 1024, -1024,
1024, -1024, -1024, 1024, 1024, -1024, -1024, 1024,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
-805, 1420, -283, -1204, 1204, 283, -1420, 805,
-805, 1420, -283, -1204, 1204, 283, -1420, 805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
-805, 1420, -283, -1204, 1204, 283, -1420, 805,
-805, 1420, -283, -1204, 1204, 283, -1420, 805,
805, -1420, 283, 1204, -1204, -283, 1420, -805,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
-554, 1338, -1338, 554, 554, -1338, 1338, -554,
-554, 1338, -1338, 554, 554, -1338, 1338, -554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
-554, 1338, -1338, 554, 554, -1338, 1338, -554,
-554, 1338, -1338, 554, 554, -1338, 1338, -554,
554, -1338, 1338, -554, -554, 1338, -1338, 554,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
-283, 805, -1204, 1420, -1420, 1204, -805, 283,
-283, 805, -1204, 1420, -1420, 1204, -805, 283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
-283, 805, -1204, 1420, -1420, 1204, -805, 283,
-283, 805, -1204, 1420, -1420, 1204, -805, 283,
283, -805, 1204, -1420, 1420, -1204, 805, -283,
805, 805, 805, 805, 805, 805, 805, 805,
-1420, -1420, -1420, -1420, -1420, -1420, -1420, -1420,
283, 283, 283, 283, 283, 283, 283, 283,
1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204,
-1204, -1204, -1204, -1204, -1204, -1204, -1204, -1204,
-283, -283, -283, -283, -283, -283, -283, -283,
1420, 1420, 1420, 1420, 1420, 1420, 1420, 1420,
-805, -805, -805, -805, -805, -805, -805, -805,
1116, 946, 632, 222, -222, -632, -946, -1116,
-1970, -1670, -1116, -392, 392, 1116, 1670, 1970,
392, 332, 222, 78, -78, -222, -332, -392,
1670, 1416, 946, 332, -332, -946, -1416, -1670,
-1670, -1416, -946, -332, 332, 946, 1416, 1670,
-392, -332, -222, -78, 78, 222, 332, 392,
1970, 1670, 1116, 392, -392, -1116, -1670, -1970,
-1116, -946, -632, -222, 222, 632, 946, 1116,
1051, 435, -435, -1051, -1051, -435, 435, 1051,
-1856, -769, 769, 1856, 1856, 769, -769, -1856,
369, 153, -153, -369, -369, -153, 153, 369,
1573, 652, -652, -1573, -1573, -652, 652, 1573,
-1573, -652, 652, 1573, 1573, 652, -652, -1573,
-369, -153, 153, 369, 369, 153, -153, -369,
1856, 769, -769, -1856, -1856, -769, 769, 1856,
-1051, -435, 435, 1051, 1051, 435, -435, -1051,
946, -222, -1116, -632, 632, 1116, 222, -946,
-1670, 392, 1970, 1116, -1116, -1970, -392, 1670,
332, -78, -392, -222, 222, 392, 78, -332,
1416, -332, -1670, -946, 946, 1670, 332, -1416,
-1416, 332, 1670, 946, -946, -1670, -332, 1416,
-332, 78, 392, 222, -222, -392, -78, 332,
1670, -392, -1970, -1116, 1116, 1970, 392, -1670,
-946, 222, 1116, 632, -632, -1116, -222, 946,
805, -805, -805, 805, 805, -805, -805, 805,
-1420, 1420, 1420, -1420, -1420, 1420, 1420, -1420,
283, -283, -283, 283, 283, -283, -283, 283,
1204, -1204, -1204, 1204, 1204, -1204, -1204, 1204,
-1204, 1204, 1204, -1204, -1204, 1204, 1204, -1204,
-283, 283, 283, -283, -283, 283, 283, -283,
1420, -1420, -1420, 1420, 1420, -1420, -1420, 1420,
-805, 805, 805, -805, -805, 805, 805, -805,
632, -1116, 222, 946, -946, -222, 1116, -632,
-1116, 1970, -392, -1670, 1670, 392, -1970, 1116,
222, -392, 78, 332, -332, -78, 392, -222,
946, -1670, 332, 1416, -1416, -332, 1670, -946,
-946, 1670, -332, -1416, 1416, 332, -1670, 946,
-222, 392, -78, -332, 332, 78, -392, 222,
1116, -1970, 392, 1670, -1670, -392, 1970, -1116,
-632, 1116, -222, -946, 946, 222, -1116, 632,
435, -1051, 1051, -435, -435, 1051, -1051, 435,
-769, 1856, -1856, 769, 769, -1856, 1856, -769,
153, -369, 369, -153, -153, 369, -369, 153,
652, -1573, 1573, -652, -652, 1573, -1573, 652,
-652, 1573, -1573, 652, 652, -1573, 1573, -652,
-153, 369, -369, 153, 153, -369, 369, -153,
769, -1856, 1856, -769, -769, 1856, -1856, 769,
-435, 1051, -1051, 435, 435, -1051, 1051, -435,
222, -632, 946, -1116, 1116, -946, 632, -222,
-392, 1116, -1670, 1970, -1970, 1670, -1116, 392,
78, -222, 332, -392, 392, -332, 222, -78,
332, -946, 1416, -1670, 1670, -1416, 946, -332,
-332, 946, -1416, 1670, -1670, 1416, -946, 332,
-78, 222, -332, 392, -392, 332, -222, 78,
392, -1116, 1670, -1970, 1970, -1670, 1116, -392,
-222, 632, -946, 1116, -1116, 946, -632, 222,
554, 554, 554, 554, 554, 554, 554, 554,
-1338, -1338, -1338, -1338, -1338, -1338, -1338, -1338,
1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
-554, -554, -554, -554, -554, -554, -554, -554,
-554, -554, -554, -554, -554, -554, -554, -554,
1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
-1338, -1338, -1338, -1338, -1338, -1338, -1338, -1338,
554, 554, 554, 554, 554, 554, 554, 554,
769, 652, 435, 153, -153, -435, -652, -769,
-1856, -1573, -1051, -369, 369, 1051, 1573, 1856,
1856, 1573, 1051, 369, -369, -1051, -1573, -1856,
-769, -652, -435, -153, 153, 435, 652, 769,
-769, -652, -435, -153, 153, 435, 652, 769,
1856, 1573, 1051, 369, -369, -1051, -1573, -1856,
-1856, -1573, -1051, -369, 369, 1051, 1573, 1856,
769, 652, 435, 153, -153, -435, -652, -769,
724, 300, -300, -724, -724, -300, 300, 724,
-1748, -724, 724, 1748, 1748, 724, -724, -1748,
1748, 724, -724, -1748, -1748, -724, 724, 1748,
-724, -300, 300, 724, 724, 300, -300, -724,
-724, -300, 300, 724, 724, 300, -300, -724,
1748, 724, -724, -1748, -1748, -724, 724, 1748,
-1748, -724, 724, 1748, 1748, 724, -724, -1748,
724, 300, -300, -724, -724, -300, 300, 724,
652, -153, -769, -435, 435, 769, 153, -652,
-1573, 369, 1856, 1051, -1051, -1856, -369, 1573,
1573, -369, -1856, -1051, 1051, 1856, 369, -1573,
-652, 153, 769, 435, -435, -769, -153, 652,
-652, 153, 769, 435, -435, -769, -153, 652,
1573, -369, -1856, -1051, 1051, 1856, 369, -1573,
-1573, 369, 1856, 1051, -1051, -1856, -369, 1573,
652, -153, -769, -435, 435, 769, 153, -652,
554, -554, -554, 554, 554, -554, -554, 554,
-1338, 1338, 1338, -1338, -1338, 1338, 1338, -1338,
1338, -1338, -1338, 1338, 1338, -1338, -1338, 1338,
-554, 554, 554, -554, -554, 554, 554, -554,
-554, 554, 554, -554, -554, 554, 554, -554,
1338, -1338, -1338, 1338, 1338, -1338, -1338, 1338,
-1338, 1338, 1338, -1338, -1338, 1338, 1338, -1338,
554, -554, -554, 554, 554, -554, -554, 554,
435, -769, 153, 652, -652, -153, 769, -435,
-1051, 1856, -369, -1573, 1573, 369, -1856, 1051,
1051, -1856, 369, 1573, -1573, -369, 1856, -1051,
-435, 769, -153, -652, 652, 153, -769, 435,
-435, 769, -153, -652, 652, 153, -769, 435,
1051, -1856, 369, 1573, -1573, -369, 1856, -1051,
-1051, 1856, -369, -1573, 1573, 369, -1856, 1051,
435, -769, 153, 652, -652, -153, 769, -435,
300, -724, 724, -300, -300, 724, -724, 300,
-724, 1748, -1748, 724, 724, -1748, 1748, -724,
724, -1748, 1748, -724, -724, 1748, -1748, 724,
-300, 724, -724, 300, 300, -724, 724, -300,
-300, 724, -724, 300, 300, -724, 724, -300,
724, -1748, 1748, -724, -724, 1748, -1748, 724,
-724, 1748, -1748, 724, 724, -1748, 1748, -724,
300, -724, 724, -300, -300, 724, -724, 300,
153, -435, 652, -769, 769, -652, 435, -153,
-369, 1051, -1573, 1856, -1856, 1573, -1051, 369,
369, -1051, 1573, -1856, 1856, -1573, 1051, -369,
-153, 435, -652, 769, -769, 652, -435, 153,
-153, 435, -652, 769, -769, 652, -435, 153,
369, -1051, 1573, -1856, 1856, -1573, 1051, -369,
-369, 1051, -1573, 1856, -1856, 1573, -1051, 369,
153, -435, 652, -769, 769, -652, 435, -153,
283, 283, 283, 283, 283, 283, 283, 283,
-805, -805, -805, -805, -805, -805, -805, -805,
1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204,
-1420, -1420, -1420, -1420, -1420, -1420, -1420, -1420,
1420, 1420, 1420, 1420, 1420, 1420, 1420, 1420,
-1204, -1204, -1204, -1204, -1204, -1204, -1204, -1204,
805, 805, 805, 805, 805, 805, 805, 805,
-283, -283, -283, -283, -283, -283, -283, -283,
392, 332, 222, 78, -78, -222, -332, -392,
-1116, -946, -632, -222, 222, 632, 946, 1116,
1670, 1416, 946, 332, -332, -946, -1416, -1670,
-1970, -1670, -1116, -392, 392, 1116, 1670, 1970,
1970, 1670, 1116, 392, -392, -1116, -1670, -1970,
-1670, -1416, -946, -332, 332, 946, 1416, 1670,
1116, 946, 632, 222, -222, -632, -946, -1116,
-392, -332, -222, -78, 78, 222, 332, 392,
369, 153, -153, -369, -369, -153, 153, 369,
-1051, -435, 435, 1051, 1051, 435, -435, -1051,
1573, 652, -652, -1573, -1573, -652, 652, 1573,
-1856, -769, 769, 1856, 1856, 769, -769, -1856,
1856, 769, -769, -1856, -1856, -769, 769, 1856,
-1573, -652, 652, 1573, 1573, 652, -652, -1573,
1051, 435, -435, -1051, -1051, -435, 435, 1051,
-369, -153, 153, 369, 369, 153, -153, -369,
332, -78, -392, -222, 222, 392, 78, -332,
-946, 222, 1116, 632, -632, -1116, -222, 946,
1416, -332, -1670, -946, 946, 1670, 332, -1416,
-1670, 392, 1970, 1116, -1116, -1970, -392, 1670,
1670, -392, -1970, -1116, 1116, 1970, 392, -1670,
-1416, 332, 1670, 946, -946, -1670, -332, 1416,
946, -222, -1116, -632, 632, 1116, 222, -946,
-332, 78, 392, 222, -222, -392, -78, 332,
283, -283, -283, 283, 283, -283, -283, 283,
-805, 805, 805, -805, -805, 805, 805, -805,
1204, -1204, -1204, 1204, 1204, -1204, -1204, 1204,
-1420, 1420, 1420, -1420, -1420, 1420, 1420, -1420,
1420, -1420, -1420, 1420, 1420, -1420, -1420, 1420,
-1204, 1204, 1204, -1204, -1204, 1204, 1204, -1204,
805, -805, -805, 805, 805, -805, -805, 805,
-283, 283, 283, -283, -283, 283, 283, -283,
222, -392, 78, 332, -332, -78, 392, -222,
-632, 1116, -222, -946, 946, 222, -1116, 632,
946, -1670, 332, 1416, -1416, -332, 1670, -946,
-1116, 1970, -392, -1670, 1670, 392, -1970, 1116,
1116, -1970, 392, 1670, -1670, -392, 1970, -1116,
-946, 1670, -332, -1416, 1416, 332, -1670, 946,
632, -1116, 222, 946, -946, -222, 1116, -632,
-222, 392, -78, -332, 332, 78, -392, 222,
153, -369, 369, -153, -153, 369, -369, 153,
-435, 1051, -1051, 435, 435, -1051, 1051, -435,
652, -1573, 1573, -652, -652, 1573, -1573, 652,
-769, 1856, -1856, 769, 769, -1856, 1856, -769,
769, -1856, 1856, -769, -769, 1856, -1856, 769,
-652, 1573, -1573, 652, 652, -1573, 1573, -652,
435, -1051, 1051, -435, -435, 1051, -1051, 435,
-153, 369, -369, 153, 153, -369, 369, -153,
78, -222, 332, -392, 392, -332, 222, -78,
-222, 632, -946, 1116, -1116, 946, -632, 222,
332, -946, 1416, -1670, 1670, -1416, 946, -332,
-392, 1116, -1670, 1970, -1970, 1670, -1116, 392,
392, -1116, 1670, -1970, 1970, -1670, 1116, -392,
-332, 946, -1416, 1670, -1670, 1416, -946, 332,
222, -632, 946, -1116, 1116, -946, 632, -222,
-78, 222, -332, 392, -392, 332, -222, 78,
};
// precalculated int base values for 8x8 DCT, multplied by 8192
const int icos_base_8x8[ 64 ] =
{
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
11363, 9633, 6436, 2260, -2260, -6436, -9633, -11363,
10703, 4433, -4433, -10703, -10703, -4433, 4433, 10703,
9633, -2260, -11363, -6436, 6436, 11363, 2260, -9633,
8192, -8192, -8192, 8192, 8192, -8192, -8192, 8192,
6436, -11363, 2260, 9633, -9633, -2260, 11363, -6436,
4433, -10703, 10703, -4433, -4433, 10703, -10703, 4433,
2260, -6436, 9633, -11363, 11363, -9633, 6436, -2260,
};
// precalculated int values for 1x8 IDCT, multplied by 8192
const int icos_idct_1x8[ 64 ] =
{
1024, 1420, 1338, 1204, 1024, 805, 554, 283,
1024, 1204, 554, -283, -1024, -1420, -1338, -805,
1024, 805, -554, -1420, -1024, 283, 1338, 1204,
1024, 283, -1338, -805, 1024, 1204, -554, -1420,
1024, -283, -1338, 805, 1024, -1204, -554, 1420,
1024, -805, -554, 1420, -1024, -283, 1338, -1204,
1024, -1204, 554, 283, -1024, 1420, -1338, 805,
1024, -1420, 1338, -1204, 1024, -805, 554, -283,
};
// precalculated int values for 1x8 FDCT, multplied by 8192
const int icos_fdct_1x8[ 64 ] =
{
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
11363, 9633, 6436, 2260, -2260, -6436, -9633, -11363,
10703, 4433, -4433, -10703, -10703, -4433, 4433, 10703,
9633, -2260, -11363, -6436, 6436, 11363, 2260, -9633,
8192, -8192, -8192, 8192, 8192, -8192, -8192, 8192,
6436, -11363, 2260, 9633, -9633, -2260, 11363, -6436,
4433, -10703, 10703, -4433, -4433, 10703, -10703, 4433,
2260, -6436, 9633, -11363, 11363, -9633, 6436, -2260,
};
// dct functions follow, you need to rescale the results using DCT_RESCALE
/* -----------------------------------------------
inverse 8x8 DCT transform
----------------------------------------------- */
inline int idct_2d_fst_8x8( signed short* F, int ix, int iy )
{
int idct;
int ixy;
int i;
// calculate start index
ixy = ( ( iy * 8 ) + ix ) * 64;
// begin transform
idct = 0;
for ( i = 0; i < 64; i++ )
idct += F[ i ] * icos_idct_8x8[ ixy++ ];
return idct;
}
/* -----------------------------------------------
forward 8x8 DCT transform
----------------------------------------------- */
inline int fdct_2d_fst_8x8( unsigned char* f, int iu, int iv )
{
int fdct;
int iuv;
int i;
// calculate start index
iuv = ( ( iv * 8 ) + iu ) * 64;
// begin transform
fdct = 0;
for ( i = 0; i < 64; i++ )
fdct += f[ i ] * icos_fdct_8x8[ iuv++ ];
return fdct;
}
/* -----------------------------------------------
inverse 1D-8 DCT transform
----------------------------------------------- */
inline int idct_1d_fst_8( signed short* F, int ix )
{
int idct;
int i;
// calculate start index
ix *= 8;
// begin transform
idct = 0;
for ( i = 0; i < 8; i++ )
idct += F[ i ] * icos_idct_1x8[ ix++ ];
return idct;
}
/* -----------------------------------------------
forward 1D-8 DCT transform
----------------------------------------------- */
inline int fdct_1d_fst_8( unsigned char* f, int iu )
{
int fdct;
int i;
// calculate start index
iu *= 8;
// begin transform
fdct = 0;
for ( i = 0; i < 8; i++ )
fdct += f[ i ] * icos_fdct_1x8[ iu++ ];
return fdct;
}