27 16, 11, 10, 16, 24, 40, 51, 61,
28 12, 12, 14, 19, 26, 58, 60, 55,
29 14, 13, 16, 24, 40, 57, 69, 56,
30 14, 17, 22, 29, 51, 87, 80, 62,
31 18, 22, 37, 56, 68, 109, 103, 77,
32 24, 35, 55, 64, 81, 104, 113, 92,
33 49, 64, 78, 87, 103, 121, 120, 101,
34 72, 92, 95, 98, 112, 100, 103, 99
38 17, 18, 24, 47, 99, 99, 99, 99,
39 18, 21, 26, 66, 99, 99, 99, 99,
40 24, 26, 56, 99, 99, 99, 99, 99,
41 47, 66, 99, 99, 99, 99, 99, 99,
42 99, 99, 99, 99, 99, 99, 99, 99,
43 99, 99, 99, 99, 99, 99, 99, 99,
44 99, 99, 99, 99, 99, 99, 99, 99,
45 99, 99, 99, 99, 99, 99, 99, 99
54 int scale = 200 - 2 * quality;
56 for (i = 0; i < 64; i++)
57 qmat[i] = (qsrc[i] * scale + 50) / 100;
59 for (i = 0; i < 64; i++)
60 qmat[i] = (5000 * qsrc[i] / quality + 50) / 100;
64 #define DCT_TEMPLATE(blk, step, SOP, shift) \
65 const int t0 = -39409 * blk[7 * step] - 58980 * blk[1 * step]; \
66 const int t1 = 39410 * blk[1 * step] - 58980 * blk[7 * step]; \
67 const int t2 = -33410 * blk[5 * step] - 167963 * blk[3 * step]; \
68 const int t3 = 33410 * blk[3 * step] - 167963 * blk[5 * step]; \
69 const int t4 = blk[3 * step] + blk[7 * step]; \
70 const int t5 = blk[1 * step] + blk[5 * step]; \
71 const int t6 = 77062 * t4 + 51491 * t5; \
72 const int t7 = 77062 * t5 - 51491 * t4; \
73 const int t8 = 35470 * blk[2 * step] - 85623 * blk[6 * step]; \
74 const int t9 = 35470 * blk[6 * step] + 85623 * blk[2 * step]; \
75 const int tA = SOP(blk[0 * step] - blk[4 * step]); \
76 const int tB = SOP(blk[0 * step] + blk[4 * step]); \
78 blk[0 * step] = ( t1 + t6 + t9 + tB) >> shift; \
79 blk[1 * step] = ( t3 + t7 + t8 + tA) >> shift; \
80 blk[2 * step] = ( t2 + t6 - t8 + tA) >> shift; \
81 blk[3 * step] = ( t0 + t7 - t9 + tB) >> shift; \
82 blk[4 * step] = (-(t0 + t7) - t9 + tB) >> shift; \
83 blk[5 * step] = (-(t2 + t6) - t8 + tA) >> shift; \
84 blk[6 * step] = (-(t3 + t7) + t8 + tA) >> shift; \
85 blk[7 * step] = (-(t1 + t6) + t9 + tB) >> shift; \
87 #define SOP_ROW(a) ((a) << 16) + 0x2000
88 #define SOP_COL(a) ((a + 32) << 16)
96 for (i = 0; i < 8; i++) {
102 for (i = 0; i < 8; i++) {
108 for (j = 0; j < 8; j++) {
109 for (i = 0; i < 8; i++)
110 dst[i] = av_clip_uint8(ptr[i] + 128);