52 #define W1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
53 #define W2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
54 #define W3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
55 #define W4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
56 #define W5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
57 #define W6 8867 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
58 #define W7 4520 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
64 #define MUL(a, b) MUL16(a, b)
65 #define MAC(a, b, c) MAC16(a, b, c)
67 #elif BIT_DEPTH == 10 || BIT_DEPTH == 12
70 #define W1 (22725*4) // 90901
71 #define W2 (21407*4) // 85627
72 #define W3 (19265*4) // 77062
73 #define W4 (16384*4) // 65535
74 #define W5 (12873*4) // 51491
75 #define W6 ( 8867*4) // 35468
76 #define W7 ( 4520*4) // 18081
95 #define MUL(a, b) ((a) * (b))
96 #define MAC(a, b, c) ((a) += (b) * (c))
100 #error "Unsupported bitdepth"
109 #define ROW0_MASK (0xffffLL << 48 * HAVE_BIGENDIAN)
110 if (((((uint64_t *)row)[0] & ~ROW0_MASK) | ((uint64_t *)row)[1]) == 0) {
112 if (DC_SHIFT - extra_shift >= 0) {
113 temp = (row[0] * (1 << (DC_SHIFT - extra_shift))) & 0xffff;
115 temp = ((row[0] + (1<<(extra_shift - DC_SHIFT-1))) >> (extra_shift - DC_SHIFT)) & 0xffff;
117 temp += temp * (1 << 16);
118 temp += temp * ((uint64_t) 1 << 32);
119 ((uint64_t *)row)[0] =
temp;
120 ((uint64_t *)row)[1] =
temp;
124 if (!(((uint32_t*)row)[1] |
125 ((uint32_t*)row)[2] |
126 ((uint32_t*)row)[3] |
129 if (DC_SHIFT - extra_shift >= 0) {
130 temp = (row[0] * (1 << (DC_SHIFT - extra_shift))) & 0xffff;
132 temp = ((row[0] + (1<<(extra_shift - DC_SHIFT-1))) >> (extra_shift - DC_SHIFT)) & 0xffff;
134 temp += temp * (1 << 16);
135 ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
136 ((uint32_t*)row)[2]=((uint32_t*)row)[3] =
temp;
141 a0 = (
W4 * row[0]) + (1 << (
ROW_SHIFT + extra_shift - 1));
151 b0 =
MUL(
W1, row[1]);
153 b1 =
MUL(
W3, row[1]);
154 MAC(b1, -
W7, row[3]);
155 b2 =
MUL(
W5, row[1]);
156 MAC(b2, -
W1, row[3]);
157 b3 =
MUL(
W7, row[1]);
158 MAC(b3, -
W5, row[3]);
161 a0 +=
W4*row[4] +
W6*row[6];
162 a1 += -
W4*row[4] -
W2*row[6];
163 a2 += -
W4*row[4] +
W2*row[6];
164 a3 +=
W4*row[4] -
W6*row[6];
169 MAC(b1, -
W1, row[5]);
170 MAC(b1, -
W5, row[7]);
176 MAC(b3, -
W1, row[7]);
179 row[0] = (a0 + b0) >> (
ROW_SHIFT + extra_shift);
180 row[7] = (a0 - b0) >> (
ROW_SHIFT + extra_shift);
181 row[1] = (a1 + b1) >> (
ROW_SHIFT + extra_shift);
182 row[6] = (a1 - b1) >> (
ROW_SHIFT + extra_shift);
183 row[2] = (a2 + b2) >> (
ROW_SHIFT + extra_shift);
184 row[5] = (a2 - b2) >> (
ROW_SHIFT + extra_shift);
185 row[3] = (a3 + b3) >> (
ROW_SHIFT + extra_shift);
186 row[4] = (a3 - b3) >> (
ROW_SHIFT + extra_shift);
189 #define IDCT_COLS do { \
190 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); \
197 a2 += -W6*col[8*2]; \
198 a3 += -W2*col[8*2]; \
200 b0 = MUL(W1, col[8*1]); \
201 b1 = MUL(W3, col[8*1]); \
202 b2 = MUL(W5, col[8*1]); \
203 b3 = MUL(W7, col[8*1]); \
205 MAC(b0, W3, col[8*3]); \
206 MAC(b1, -W7, col[8*3]); \
207 MAC(b2, -W1, col[8*3]); \
208 MAC(b3, -W5, col[8*3]); \
212 a1 += -W4*col[8*4]; \
213 a2 += -W4*col[8*4]; \
218 MAC(b0, W5, col[8*5]); \
219 MAC(b1, -W1, col[8*5]); \
220 MAC(b2, W7, col[8*5]); \
221 MAC(b3, W3, col[8*5]); \
226 a1 += -W2*col[8*6]; \
228 a3 += -W6*col[8*6]; \
232 MAC(b0, W7, col[8*7]); \
233 MAC(b1, -W5, col[8*7]); \
234 MAC(b2, W3, col[8*7]); \
235 MAC(b3, -W1, col[8*7]); \
308 line_size /=
sizeof(
pixel);
310 for (i = 0; i < 8; i++)
313 for (i = 0; i < 8; i++)
322 line_size /=
sizeof(
pixel);
324 for (i = 0; i < 8; i++)
327 for (i = 0; i < 8; i++)
335 for (i = 0; i < 8; i++)
338 for (i = 0; i < 8; i++)
void FUNC() ff_simple_idct(int16_t *block)
static void FUNC() idctSparseColPut(pixel *dest, int line_size, int16_t *col)
static void FUNC() idctRowCondDC(int16_t *row, int extra_shift)
static void FUNC() idctSparseColAdd(pixel *dest, int line_size, int16_t *col)
static void FUNC() idctSparseCol(int16_t *col)
void FUNC() ff_simple_idct_put(uint8_t *dest_, int line_size, int16_t *block)
void FUNC() ff_simple_idct_add(uint8_t *dest_, int line_size, int16_t *block)