57 1, 2, 2, 2, 3, 3, 3, 4,
58 2, 2, 2, 3, 3, 3, 4, 4,
59 2, 2, 3, 3, 3, 4, 4, 4,
60 2, 2, 3, 3, 3, 4, 4, 5,
61 2, 3, 3, 3, 4, 4, 5, 6,
62 3, 3, 3, 4, 4, 5, 6, 7,
63 3, 3, 3, 4, 4, 5, 7, 7,
64 3, 3, 4, 4, 5, 7, 7, 7,
68 1, 5, 6, 7, 8, 9, 9, 11,
69 5, 5, 7, 8, 9, 9, 11, 12,
70 6, 7, 8, 9, 9, 11, 11, 12,
71 7, 7, 8, 9, 9, 11, 12, 13,
72 7, 8, 9, 9, 10, 11, 13, 16,
73 8, 9, 9, 10, 11, 13, 16, 19,
74 8, 9, 9, 11, 12, 15, 18, 23,
75 9, 9, 11, 12, 15, 18, 23, 27
80 #define FIC_HEADER_SIZE 27
84 const int t0 = 27246 * blk[3 * step] + 18405 * blk[5 * step];
85 const int t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step];
86 const int t2 = 6393 * blk[7 * step] + 32139 * blk[1 * step];
87 const int t3 = 6393 * blk[1 * step] - 32139 * blk[7 * step];
88 const int t4 = 5793 * (t2 + t0 + 0x800 >> 12);
89 const int t5 = 5793 * (t3 + t1 + 0x800 >> 12);
90 const int t6 = t2 -
t0;
91 const int t7 = t3 -
t1;
92 const int t8 = 17734 * blk[2 * step] - 42813 * blk[6 * step];
93 const int t9 = 17734 * blk[6 * step] + 42814 * blk[2 * step];
94 const int tA = (blk[0 * step] - blk[4 * step] << 15) + rnd;
95 const int tB = (blk[0 * step] + blk[4 * step] << 15) + rnd;
96 blk[0 * step] = ( t4 + t9 + tB) >> shift;
97 blk[1 * step] = ( t6 + t7 + t8 + tA) >> shift;
98 blk[2 * step] = ( t6 - t7 - t8 + tA) >> shift;
99 blk[3 * step] = ( t5 - t9 + tB) >> shift;
100 blk[4 * step] = ( -t5 - t9 + tB) >> shift;
101 blk[5 * step] = (-(t6 -
t7) - t8 + tA) >>
shift;
102 blk[6 * step] = (-(t6 +
t7) + t8 + tA) >>
shift;
103 blk[7 * step] = ( -t4 + t9 + tB) >> shift;
112 fic_idct(ptr++, 8, 13, (1 << 12) + (1 << 17));
113 for (i = 1; i < 8; i++) {
119 for (i = 0; i < 8; i++) {
125 for (j = 0; j < 8; j++) {
126 for (i = 0; i < 8; i++)
127 dst[i] = av_clip_uint8(ptr[i]);
146 memset(block, 0,
sizeof(*block) * 64);
152 for (i = 0; i < num_coeff; i++)
169 int y_off = tctx->
y_off;
174 for (p = 0; p < 3; p++) {
178 for (y = 0; y < (slice_h >> !!p); y += 8) {
198 for (i = 0; i <
size; i++)
199 dst[i] += ((src[i] - dst[i]) * alpha[i]) >> 8;
212 for (i = 0; i < 1024; i++) {
213 planes[0][i] = (( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16;
214 planes[1][i] = ((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128;
215 planes[2][i] = ((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128;
216 planes[3][i] = ptr[3];
222 for (i = 0; i < 32; i += 2)
223 for (j = 0; j < 32; j += 2)
224 for (p = 0; p < 3; p++)
225 chroma[p][16 * (i / 2) + j / 2] = (planes[p + 1][32 * i + j ] +
226 planes[p + 1][32 * i + j + 1] +
227 planes[p + 1][32 * (i + 1) + j ] +
228 planes[p + 1][32 * (i + 1) + j + 1]) / 4;
231 for (i = 0; i < 3; i++)
234 (cur_x >> !!i) + !!i;
237 for (i = 0; i <
FFMIN(32, avctx->
height - cur_y) - 1; i += 2) {
239 int csize = lsize / 2;
242 planes[0] + i * 32, lsize, planes[3] + i * 32);
244 planes[0] + (i + 1) * 32, lsize, planes[3] + (i + 1) * 32);
246 chroma[0] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
248 chroma[1] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
306 "Packet is too small to contain cursor (%d vs %d bytes).\n",
314 if (!skip_cursor && tsize < 32) {
316 "Cursor data too small. Skipping cursor.\n");
323 if (!skip_cursor && (cur_x > avctx->
width || cur_y > avctx->
height)) {
325 "Invalid cursor position: (%d,%d). Skipping cusor.\n",
330 if (!skip_cursor && (
AV_RL16(src + 37) != 32 ||
AV_RL16(src + 39) != 32)) {
332 "Invalid cursor size. Skipping cursor.\n");
368 for (slice = 0; slice < nslices; slice++) {
369 unsigned slice_off =
AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4);
371 int y_off = ctx->
slice_h * slice;
378 if (slice == nslices - 1) {
382 slice_size =
AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4);
385 if (slice_size < slice_off || slice_size > msize)
388 slice_size -= slice_off;
397 NULL, nslices,
sizeof(ctx->
slice_data[0]))) < 0)
415 memcpy(ctx->
cursor_buf, src + 59, 32 * 32 * 4);