48 #define OFFSET(x) offsetof(FSPPContext, x)
49 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
61 { 0, 48, 12, 60, 3, 51, 15, 63, },
62 { 32, 16, 44, 28, 35, 19, 47, 31, },
63 { 8, 56, 4, 52, 11, 59, 7, 55, },
64 { 40, 24, 36, 20, 43, 27, 39, 23, },
65 { 2, 50, 14, 62, 1, 49, 13, 61, },
66 { 34, 18, 46, 30, 33, 17, 45, 29, },
67 { 10, 58, 6, 54, 9, 57, 5, 53, },
68 { 42, 26, 38, 22, 41, 25, 37, 21, },
75 71, 296, 295, 237, 71, 40, 38, 19,
76 245, 193, 185, 121, 102, 73, 53, 27,
77 158, 129, 141, 107, 97, 73, 50, 26,
78 102, 116, 109, 98, 82, 66, 45, 23,
79 71, 94, 95, 81, 70, 56, 38, 20,
80 56, 77, 74, 66, 56, 44, 30, 15,
81 38, 53, 50, 45, 38, 30, 21, 11,
82 20, 27, 26, 23, 20, 15, 11, 5
87 ptrdiff_t dst_stride, ptrdiff_t src_stride,
88 ptrdiff_t
width, ptrdiff_t
height, ptrdiff_t log2_scale)
92 temp = (src[x + pos] + (d[pos] >> log2_scale)) >> (6 - log2_scale); \
93 src[x + pos] = src[x + pos - 8 * src_stride] = 0; \
94 if (temp & 0x100) temp = ~(temp >> 31); \
97 for (y = 0; y <
height; y++) {
99 for (x = 0; x <
width; x += 8) {
117 ptrdiff_t dst_stride, ptrdiff_t src_stride,
118 ptrdiff_t
width, ptrdiff_t
height, ptrdiff_t log2_scale)
121 #define STORE2(pos) \
122 temp = (src[x + pos] + src[x + pos + 16 * src_stride] + (d[pos] >> log2_scale)) >> (6 - log2_scale); \
123 src[x + pos + 16 * src_stride] = 0; \
124 if (temp & 0x100) temp = ~(temp >> 31); \
127 for (y = 0; y <
height; y++) {
129 for (x = 0; x <
width; x += 8) {
145 static void mul_thrmat_c(int16_t *thr_adr_noq, int16_t *thr_adr,
int q)
148 for (
a = 0;
a < 64;
a++)
149 thr_adr[
a] = q * thr_adr_noq[
a];
153 int dst_stride,
int src_stride,
155 uint8_t *qp_store,
int qp_stride,
int is_luma)
157 int x, x0, y, es, qy, t;
161 const int qpsh = 4 - p->
hsub * !is_luma;
162 const int qpsv = 4 - p->
vsub * !is_luma;
165 int16_t *
block = (int16_t *)block_align;
166 int16_t *block3 = (int16_t *)(block_align + 4 * 8 *
BLOCKSZ);
168 memset(block3, 0, 4 * 8 *
BLOCKSZ);
170 if (!
src || !dst)
return;
172 for (y = 0; y <
height; y++) {
175 for (x = 0; x < 8; x++) {
181 for (y = 0; y < 8; y++) {
187 for (y = 8; y < 24; y++)
191 const int y1 = y - 8 +
step;
197 qy = (qy >> qpsv) * qp_stride;
206 for (x = 0; x < 8 * (
BLOCKSZ - 1); x += 8) {
211 t = qp_store[qy + (t >> qpsh)];
219 memmove(block3, block3 + (
BLOCKSZ - 1) * 64, 6 * 8 *
sizeof(int16_t));
230 if (!(y1 & 7) && y1) {
252 int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
265 for (; cnt > 0; cnt -= 2) {
266 threshold = (int16_t *)thr_adr;
267 for (ctr =
DCTSIZE; ctr > 0; ctr--) {
302 tmp10 = (tmp0 + tmp2) >> 2;
303 tmp11 = (tmp0 - tmp2) >> 2;
305 tmp13 = (tmp1 + tmp3) >>2;
308 tmp0 = tmp10 + tmp13;
309 tmp3 = tmp10 - tmp13;
310 tmp1 = tmp11 + tmp12;
311 tmp2 = tmp11 - tmp12;
341 z10 = (tmp6 - tmp5) << 1;
343 z12 = (tmp4 - tmp7) << 1;
345 tmp7 = (z11 + z13) >> 2;
355 wsptr[
DCTSIZE * 0] += (tmp0 + tmp7);
356 wsptr[
DCTSIZE * 1] += (tmp1 + tmp6);
357 wsptr[
DCTSIZE * 2] += (tmp2 + tmp5);
358 wsptr[
DCTSIZE * 3] += (tmp3 - tmp4);
359 wsptr[
DCTSIZE * 4] += (tmp3 + tmp4);
360 wsptr[
DCTSIZE * 5] += (tmp2 - tmp5);
361 wsptr[
DCTSIZE * 6] = (tmp1 - tmp6);
362 wsptr[
DCTSIZE * 7] = (tmp0 - tmp7);
373 static void row_idct_c(int16_t *workspace, int16_t *output_adr, ptrdiff_t output_stride,
int cnt)
375 int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
384 for (; cnt > 0; cnt--) {
387 tmp10 = wsptr[2] + wsptr[3];
388 tmp11 = wsptr[2] - wsptr[3];
390 tmp13 = wsptr[0] + wsptr[1];
393 tmp0 = tmp10 + tmp13;
394 tmp3 = tmp10 - tmp13;
395 tmp1 = tmp11 + tmp12;
396 tmp2 = tmp11 - tmp12;
404 z13 = wsptr[4] + wsptr[5];
405 z10 = wsptr[4] - wsptr[5];
406 z11 = wsptr[6] + wsptr[7];
407 z12 = wsptr[6] - wsptr[7];
416 tmp6 = (tmp12 << 3) - tmp7;
417 tmp5 = (tmp11 << 3) - tmp6;
418 tmp4 = (tmp10 << 3) + tmp5;
421 outptr[0 * output_stride] +=
DESCALE(tmp0 + tmp7, 3);
422 outptr[1 * output_stride] +=
DESCALE(tmp1 + tmp6, 3);
423 outptr[2 * output_stride] +=
DESCALE(tmp2 + tmp5, 3);
424 outptr[3 * output_stride] +=
DESCALE(tmp3 - tmp4, 3);
425 outptr[4 * output_stride] +=
DESCALE(tmp3 + tmp4, 3);
426 outptr[5 * output_stride] +=
DESCALE(tmp2 - tmp5, 3);
427 outptr[6 * output_stride] +=
DESCALE(tmp1 - tmp6, 3);
428 outptr[7 * output_stride] +=
DESCALE(tmp0 - tmp7, 3);
435 static void row_fdct_c(int16_t *
data,
const uint8_t *pixels, ptrdiff_t line_size,
int cnt)
437 int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
446 for (; cnt > 0; cnt--) {
447 tmp0 = pixels[line_size * 0] + pixels[line_size * 7];
448 tmp7 = pixels[line_size * 0] - pixels[line_size * 7];
449 tmp1 = pixels[line_size * 1] + pixels[line_size * 6];
450 tmp6 = pixels[line_size * 1] - pixels[line_size * 6];
451 tmp2 = pixels[line_size * 2] + pixels[line_size * 5];
452 tmp5 = pixels[line_size * 2] - pixels[line_size * 5];
453 tmp3 = pixels[line_size * 3] + pixels[line_size * 4];
454 tmp4 = pixels[line_size * 3] - pixels[line_size * 4];
465 dataptr[2] = tmp10 + tmp11;
466 dataptr[3] = tmp10 - tmp11;
469 dataptr[0] = tmp13 + z1;
470 dataptr[1] = tmp13 - z1;
474 tmp10 = (tmp4 + tmp5) << 2;
475 tmp11 = (tmp5 + tmp6) << 2;
476 tmp12 = (tmp6 + tmp7) << 2;
486 dataptr[4] = z13 + z2;
487 dataptr[5] = z13 - z2;
488 dataptr[6] = z11 + z4;
489 dataptr[7] = z11 - z4;
545 int8_t *qp_table =
NULL;
548 int custom_threshold_m[64];
555 for (
i = 0;
i < 8;
i++) {
557 |(((uint64_t)custom_threshold_m[
i * 8 + 6]) << 16)
558 |(((uint64_t)custom_threshold_m[
i * 8 + 0]) << 32)
559 |(((uint64_t)custom_threshold_m[
i * 8 + 4]) << 48);
562 |(((uint64_t)custom_threshold_m[
i * 8 + 3]) << 16)
563 |(((uint64_t)custom_threshold_m[
i * 8 + 1]) << 32)
564 |(((uint64_t)custom_threshold_m[
i * 8 + 7]) << 48);
594 if (qp_table || fspp->
qp) {
618 cw, ch, qp_table, qp_stride, 0);
620 cw, ch, qp_table, qp_stride, 0);
664 .priv_class = &fspp_class,