38 for (y = 0; y <
height; y++) {
39 for (x = 0; x <
width; x++)
53 for (y = 0; y < 4; y++) {
54 for (x = 0; x < 4; x++) {
70 for (y = 0; y < 8; y++) {
71 for (x = 0; x < 8; x++) {
87 for (y = 0; y < 16; y++) {
88 for (x = 0; x < 16; x++) {
104 for (y = 0; y < 32; y++) {
105 for (x = 0; x < 32; x++) {
116 int16_t *coeffs = (int16_t *) _coeffs;
118 int size = 1 << log2_size;
122 for (y = 0; y < size - 1; y++) {
123 for (x = 0; x <
size; x++)
124 coeffs[x] += coeffs[x - size];
128 for (y = 0; y <
size; y++) {
129 for (x = 1; x <
size; x++)
130 coeffs[x] += coeffs[x - 1];
140 int size = 1 << log2_size;
141 int16_t *coeffs = _coeffs;
145 int offset = 1 << (shift - 1);
146 for (y = 0; y <
size; y++) {
147 for (x = 0; x <
size; x++) {
148 *coeffs = (*coeffs +
offset) >> shift;
153 for (y = 0; y <
size; y++) {
154 for (x = 0; x <
size; x++) {
155 *coeffs = *coeffs << -
shift;
162 #define SET(dst, x) (dst) = (x)
163 #define SCALE(dst, x) (dst) = av_clip_int16(((x) + add) >> shift)
164 #define ADD_AND_SCALE(dst, x) \
165 (dst) = av_clip_pixel((dst) + av_clip_int16(((x) + add) >> shift))
167 #define TR_4x4_LUMA(dst, src, step, assign) \
169 int c0 = src[0 * step] + src[2 * step]; \
170 int c1 = src[2 * step] + src[3 * step]; \
171 int c2 = src[0 * step] - src[3 * step]; \
172 int c3 = 74 * src[1 * step]; \
174 assign(dst[2 * step], 74 * (src[0 * step] - \
177 assign(dst[0 * step], 29 * c0 + 55 * c1 + c3); \
178 assign(dst[1 * step], 55 * c2 - 29 * c1 + c3); \
179 assign(dst[3 * step], 55 * c0 + 29 * c2 - c3); \
186 int add = 1 << (shift - 1);
187 int16_t *
src = coeffs;
189 for (i = 0; i < 4; i++) {
195 add = 1 << (shift - 1);
196 for (i = 0; i < 4; i++) {
204 #define TR_4(dst, src, dstep, sstep, assign, end) \
206 const int e0 = 64 * src[0 * sstep] + 64 * src[2 * sstep]; \
207 const int e1 = 64 * src[0 * sstep] - 64 * src[2 * sstep]; \
208 const int o0 = 83 * src[1 * sstep] + 36 * src[3 * sstep]; \
209 const int o1 = 36 * src[1 * sstep] - 83 * src[3 * sstep]; \
211 assign(dst[0 * dstep], e0 + o0); \
212 assign(dst[1 * dstep], e1 + o1); \
213 assign(dst[2 * dstep], e1 - o1); \
214 assign(dst[3 * dstep], e0 - o0); \
217 #define TR_8(dst, src, dstep, sstep, assign, end) \
221 int o_8[4] = { 0 }; \
222 for (i = 0; i < 4; i++) \
223 for (j = 1; j < end; j += 2) \
224 o_8[i] += transform[4 * j][i] * src[j * sstep]; \
225 TR_4(e_8, src, 1, 2 * sstep, SET, 4); \
227 for (i = 0; i < 4; i++) { \
228 assign(dst[i * dstep], e_8[i] + o_8[i]); \
229 assign(dst[(7 - i) * dstep], e_8[i] - o_8[i]); \
233 #define TR_16(dst, src, dstep, sstep, assign, end) \
237 int o_16[8] = { 0 }; \
238 for (i = 0; i < 8; i++) \
239 for (j = 1; j < end; j += 2) \
240 o_16[i] += transform[2 * j][i] * src[j * sstep]; \
241 TR_8(e_16, src, 1, 2 * sstep, SET, 8); \
243 for (i = 0; i < 8; i++) { \
244 assign(dst[i * dstep], e_16[i] + o_16[i]); \
245 assign(dst[(15 - i) * dstep], e_16[i] - o_16[i]); \
249 #define TR_32(dst, src, dstep, sstep, assign, end) \
253 int o_32[16] = { 0 }; \
254 for (i = 0; i < 16; i++) \
255 for (j = 1; j < end; j += 2) \
256 o_32[i] += transform[j][i] * src[j * sstep]; \
257 TR_16(e_32, src, 1, 2 * sstep, SET, end/2); \
259 for (i = 0; i < 16; i++) { \
260 assign(dst[i * dstep], e_32[i] + o_32[i]); \
261 assign(dst[(31 - i) * dstep], e_32[i] - o_32[i]); \
265 #define IDCT_VAR4(H) \
266 int limit2 = FFMIN(col_limit + 4, H)
267 #define IDCT_VAR8(H) \
268 int limit = FFMIN(col_limit, H); \
269 int limit2 = FFMIN(col_limit + 4, H)
270 #define IDCT_VAR16(H) IDCT_VAR8(H)
271 #define IDCT_VAR32(H) IDCT_VAR8(H)
274 static void FUNC(idct_##H ##x ##H )( \
275 int16_t *coeffs, int col_limit) { \
278 int add = 1 << (shift - 1); \
279 int16_t *src = coeffs; \
282 for (i = 0; i < H; i++) { \
283 TR_ ## H(src, src, H, H, SCALE, limit2); \
284 if (limit2 < H && i%4 == 0 && !!i) \
289 shift = 20 - BIT_DEPTH; \
290 add = 1 << (shift - 1); \
291 for (i = 0; i < H; i++) { \
292 TR_ ## H(coeffs, coeffs, 1, 1, SCALE, limit); \
298 static void FUNC(idct_##H ##x ##H ##_dc)( \
301 int shift = 14 - BIT_DEPTH; \
302 int add = 1 << (shift - 1); \
303 int coeff = (((coeffs[0] + 1) >> 1) + add) >> shift; \
305 for (j = 0; j < H; j++) { \
306 for (i = 0; i < H; i++) { \
307 coeffs[i+j*H] = coeff; \
341 int *sao_offset_val = sao->offset_val[c_idx];
342 int sao_left_class = sao->band_position[c_idx];
344 stride /=
sizeof(
pixel);
346 for (k = 0; k < 4; k++)
347 offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
348 for (y = 0; y <
height; y++) {
349 for (x = 0; x <
width; x++)
356 #define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1))
361 int c_idx,
int init_x,
int init_y) {
363 static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
364 static const int8_t pos[4][2][2] = {
365 { { -1, 0 }, { 1, 0 } },
366 { { 0, -1 }, { 0, 1 } },
367 { { -1, -1 }, { 1, 1 } },
368 { { 1, -1 }, { -1, 1 } },
370 int *sao_offset_val = sao->offset_val[c_idx];
371 int sao_eo_class = sao->eo_class[c_idx];
375 int y_stride = init_y * stride;
376 int pos_0_0 = pos[sao_eo_class][0][0];
377 int pos_0_1 = pos[sao_eo_class][0][1];
378 int pos_1_0 = pos[sao_eo_class][1][0];
379 int pos_1_1 = pos[sao_eo_class][1][1];
382 int y_stride_0_1 = (init_y + pos_0_1) * stride;
383 int y_stride_1_1 = (init_y + pos_1_1) * stride;
384 for (y = init_y; y <
height; y++) {
385 for (x = init_x; x <
width; x++) {
386 int diff0 =
CMP(src[x + y_stride], src[x + pos_0_0 + y_stride_0_1]);
387 int diff1 =
CMP(src[x + y_stride], src[x + pos_1_0 + y_stride_1_1]);
389 dst[x + y_stride] =
av_clip_pixel(src[x + y_stride] + sao_offset_val[offset_val]);
392 y_stride_0_1 += stride;
393 y_stride_1_1 += stride;
399 int *borders,
int _width,
int _height,
406 int *sao_offset_val = sao->offset_val[c_idx];
407 int sao_eo_class = sao->eo_class[c_idx];
408 int init_x = 0, init_y = 0, width = _width, height = _height;
410 stride /=
sizeof(
pixel);
416 for (y = 0; y <
height; y++) {
424 int x_stride = width - 1;
425 for (x = 0; x <
height; x++) {
435 for (x = init_x; x <
width; x++)
441 int y_stride = stride * (height - 1);
442 for (x = init_x; x <
width; x++)
443 dst[x + y_stride] =
av_clip_pixel(src[x + y_stride] + offset_val);
453 int *borders,
int _width,
int _height,
460 int *sao_offset_val = sao->offset_val[c_idx];
461 int sao_eo_class = sao->eo_class[c_idx];
462 int init_x = 0, init_y = 0, width = _width, height = _height;
464 stride /=
sizeof(
pixel);
470 for (y = 0; y <
height; y++) {
478 int x_stride = width - 1;
479 for (x = 0; x <
height; x++) {
489 for (x = init_x; x <
width; x++)
495 int y_stride = stride * (height - 1);
496 for (x = init_x; x <
width; x++)
497 dst[x + y_stride] =
av_clip_pixel(src[x + y_stride] + offset_val);
505 int save_upper_left = !diag_edge[0] && sao_eo_class ==
SAO_EO_135D && !borders[0] && !borders[1];
506 int save_upper_right = !diag_edge[1] && sao_eo_class ==
SAO_EO_45D && !borders[1] && !borders[2];
507 int save_lower_right = !diag_edge[2] && sao_eo_class ==
SAO_EO_135D && !borders[2] && !borders[3];
508 int save_lower_left = !diag_edge[3] && sao_eo_class ==
SAO_EO_45D && !borders[0] && !borders[3];
512 for(y = init_y+save_upper_left; y< height-save_lower_left; y++)
513 dst[y*stride] = src[y*stride];
516 for(y = init_y+save_upper_right; y< height-save_lower_right; y++)
517 dst[y*stride+width-1] = src[y*stride+width-1];
521 for(x = init_x+save_upper_left; x < width-save_upper_right; x++)
525 for(x = init_x+save_lower_left; x < width-save_lower_right; x++)
526 dst[(height-1)*stride+x] = src[(height-1)*stride+x];
530 if(diag_edge[1] && sao_eo_class ==
SAO_EO_45D)
531 dst[width-1] = src[width-1];
533 dst[stride*(height-1)+width-1] = src[stride*(height-1)+width-1];
534 if(diag_edge[3] && sao_eo_class ==
SAO_EO_45D)
535 dst[stride*(height-1)] = src[stride*(height-1)];
546 uint8_t *_src, ptrdiff_t _srcstride,
551 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
553 for (y = 0; y <
height; y++) {
554 for (x = 0; x <
width; x++)
566 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
568 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
570 for (y = 0; y <
height; y++) {
571 memcpy(dst, src, width *
sizeof(
pixel));
578 int16_t *src2, ptrdiff_t src2stride,
583 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
585 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
589 int offset = 1 << (shift - 1);
594 for (y = 0; y <
height; y++) {
595 for (x = 0; x <
width; x++)
604 int height,
int denom,
int wx,
int ox, intptr_t mx, intptr_t my,
int width)
608 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
610 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
613 int offset = 1 << (shift - 1);
618 ox = ox * (1 << (BIT_DEPTH - 8));
619 for (y = 0; y <
height; y++) {
620 for (x = 0; x <
width; x++)
621 dst[x] =
av_clip_pixel((((src[x] << (14 - BIT_DEPTH)) * wx + offset) >> shift) + ox);
628 int16_t *src2, ptrdiff_t src2stride,
629 int height,
int denom,
int wx0,
int wx1,
630 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
634 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
636 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
639 int log2Wd = denom + shift - 1;
643 for (y = 0; y <
height; y++) {
644 for (x = 0; x <
width; x++) {
645 dst[x] =
av_clip_pixel(( (src[x] << (14 -
BIT_DEPTH)) * wx1 + src2[x] * wx0 + ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
656 #define QPEL_FILTER(src, stride) \
657 (filter[0] * src[x - 3 * stride] + \
658 filter[1] * src[x - 2 * stride] + \
659 filter[2] * src[x - stride] + \
660 filter[3] * src[x ] + \
661 filter[4] * src[x + stride] + \
662 filter[5] * src[x + 2 * stride] + \
663 filter[6] * src[x + 3 * stride] + \
664 filter[7] * src[x + 4 * stride])
667 uint8_t *_src, ptrdiff_t _srcstride,
672 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
674 for (y = 0; y <
height; y++) {
675 for (x = 0; x <
width; x++)
683 uint8_t *_src, ptrdiff_t _srcstride,
688 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
690 for (y = 0; y <
height; y++) {
691 for (x = 0; x <
width; x++)
701 ptrdiff_t _srcstride,
703 intptr_t my,
int width)
708 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
710 int16_t *tmp = tmp_array;
715 for (x = 0; x <
width; x++)
723 for (y = 0; y <
height; y++) {
724 for (x = 0; x <
width; x++)
732 uint8_t *_src, ptrdiff_t _srcstride,
737 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
739 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
744 int offset = 1 << (shift - 1);
749 for (y = 0; y <
height; y++) {
750 for (x = 0; x <
width; x++)
758 int16_t *src2, ptrdiff_t src2stride,
763 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
765 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
771 int offset = 1 << (shift - 1);
776 for (y = 0; y <
height; y++) {
777 for (x = 0; x <
width; x++)
786 uint8_t *_src, ptrdiff_t _srcstride,
791 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
793 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
798 int offset = 1 << (shift - 1);
803 for (y = 0; y <
height; y++) {
804 for (x = 0; x <
width; x++)
813 int16_t *src2, ptrdiff_t src2stride,
818 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
820 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
826 int offset = 1 << (shift - 1);
831 for (y = 0; y <
height; y++) {
832 for (x = 0; x <
width; x++)
841 uint8_t *_src, ptrdiff_t _srcstride,
847 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
849 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
851 int16_t *tmp = tmp_array;
855 int offset = 1 << (shift - 1);
863 for (x = 0; x <
width; x++)
872 for (y = 0; y <
height; y++) {
873 for (x = 0; x <
width; x++)
881 int16_t *src2, ptrdiff_t src2stride,
887 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
889 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
891 int16_t *tmp = tmp_array;
894 int offset = 1 << (shift - 1);
902 for (x = 0; x <
width; x++)
911 for (y = 0; y <
height; y++) {
912 for (x = 0; x <
width; x++)
921 uint8_t *_src, ptrdiff_t _srcstride,
922 int height,
int denom,
int wx,
int ox,
923 intptr_t mx, intptr_t my,
int width)
927 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
929 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
933 int offset = 1 << (shift - 1);
938 ox = ox * (1 << (BIT_DEPTH - 8));
939 for (y = 0; y <
height; y++) {
940 for (x = 0; x <
width; x++)
948 int16_t *src2, ptrdiff_t src2stride,
949 int height,
int denom,
int wx0,
int wx1,
950 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
954 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
956 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
961 int log2Wd = denom + shift - 1;
965 for (y = 0; y <
height; y++) {
966 for (x = 0; x <
width; x++)
968 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
976 uint8_t *_src, ptrdiff_t _srcstride,
977 int height,
int denom,
int wx,
int ox,
978 intptr_t mx, intptr_t my,
int width)
982 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
984 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
988 int offset = 1 << (shift - 1);
993 ox = ox * (1 << (BIT_DEPTH - 8));
994 for (y = 0; y <
height; y++) {
995 for (x = 0; x <
width; x++)
1003 int16_t *src2, ptrdiff_t src2stride,
1004 int height,
int denom,
int wx0,
int wx1,
1005 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
1009 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1011 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1016 int log2Wd = denom + shift - 1;
1020 for (y = 0; y <
height; y++) {
1021 for (x = 0; x <
width; x++)
1023 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
1031 uint8_t *_src, ptrdiff_t _srcstride,
1032 int height,
int denom,
int wx,
int ox,
1033 intptr_t mx, intptr_t my,
int width)
1038 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1040 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1042 int16_t *tmp = tmp_array;
1045 int offset = 1 << (shift - 1);
1053 for (x = 0; x <
width; x++)
1062 ox = ox * (1 << (BIT_DEPTH - 8));
1063 for (y = 0; y <
height; y++) {
1064 for (x = 0; x <
width; x++)
1072 int16_t *src2, ptrdiff_t src2stride,
1073 int height,
int denom,
int wx0,
int wx1,
1074 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
1079 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1081 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1083 int16_t *tmp = tmp_array;
1085 int log2Wd = denom + shift - 1;
1090 for (x = 0; x <
width; x++)
1101 for (y = 0; y <
height; y++) {
1102 for (x = 0; x <
width; x++)
1104 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
1114 #define EPEL_FILTER(src, stride) \
1115 (filter[0] * src[x - stride] + \
1116 filter[1] * src[x] + \
1117 filter[2] * src[x + stride] + \
1118 filter[3] * src[x + 2 * stride])
1121 uint8_t *_src, ptrdiff_t _srcstride,
1126 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1128 for (y = 0; y <
height; y++) {
1129 for (x = 0; x <
width; x++)
1137 uint8_t *_src, ptrdiff_t _srcstride,
1142 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1145 for (y = 0; y <
height; y++) {
1146 for (x = 0; x <
width; x++)
1154 uint8_t *_src, ptrdiff_t _srcstride,
1159 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1162 int16_t *tmp = tmp_array;
1167 for (x = 0; x <
width; x++)
1176 for (y = 0; y <
height; y++) {
1177 for (x = 0; x <
width; x++)
1189 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1191 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1195 int offset = 1 << (shift - 1);
1200 for (y = 0; y <
height; y++) {
1201 for (x = 0; x <
width; x++)
1209 int16_t *src2, ptrdiff_t src2stride,
1214 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1216 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1220 int offset = 1 << (shift - 1);
1225 for (y = 0; y <
height; y++) {
1226 for (x = 0; x <
width; x++) {
1240 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1242 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1246 int offset = 1 << (shift - 1);
1251 for (y = 0; y <
height; y++) {
1252 for (x = 0; x <
width; x++)
1260 int16_t *src2, ptrdiff_t src2stride,
1265 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1268 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1271 int offset = 1 << (shift - 1);
1276 for (y = 0; y <
height; y++) {
1277 for (x = 0; x <
width; x++)
1290 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1292 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1295 int16_t *tmp = tmp_array;
1298 int offset = 1 << (shift - 1);
1306 for (x = 0; x <
width; x++)
1315 for (y = 0; y <
height; y++) {
1316 for (x = 0; x <
width; x++)
1324 int16_t *src2, ptrdiff_t src2stride,
1329 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1331 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1334 int16_t *tmp = tmp_array;
1337 int offset = 1 << (shift - 1);
1345 for (x = 0; x <
width; x++)
1354 for (y = 0; y <
height; y++) {
1355 for (x = 0; x <
width; x++)
1364 int height,
int denom,
int wx,
int ox, intptr_t mx, intptr_t my,
int width)
1368 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1370 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1374 int offset = 1 << (shift - 1);
1379 ox = ox * (1 << (BIT_DEPTH - 8));
1380 for (y = 0; y <
height; y++) {
1381 for (x = 0; x <
width; x++) {
1390 int16_t *src2, ptrdiff_t src2stride,
1391 int height,
int denom,
int wx0,
int wx1,
1392 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
1396 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1398 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1401 int log2Wd = denom + shift - 1;
1405 for (y = 0; y <
height; y++) {
1406 for (x = 0; x <
width; x++)
1408 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
1416 int height,
int denom,
int wx,
int ox, intptr_t mx, intptr_t my,
int width)
1420 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1422 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1426 int offset = 1 << (shift - 1);
1431 ox = ox * (1 << (BIT_DEPTH - 8));
1432 for (y = 0; y <
height; y++) {
1433 for (x = 0; x <
width; x++) {
1442 int16_t *src2, ptrdiff_t src2stride,
1443 int height,
int denom,
int wx0,
int wx1,
1444 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
1448 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1451 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1453 int log2Wd = denom + shift - 1;
1457 for (y = 0; y <
height; y++) {
1458 for (x = 0; x <
width; x++)
1460 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
1468 int height,
int denom,
int wx,
int ox, intptr_t mx, intptr_t my,
int width)
1472 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1474 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1477 int16_t *tmp = tmp_array;
1480 int offset = 1 << (shift - 1);
1488 for (x = 0; x <
width; x++)
1497 ox = ox * (1 << (BIT_DEPTH - 8));
1498 for (y = 0; y <
height; y++) {
1499 for (x = 0; x <
width; x++)
1507 int16_t *src2, ptrdiff_t src2stride,
1508 int height,
int denom,
int wx0,
int wx1,
1509 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
1513 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1515 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1518 int16_t *tmp = tmp_array;
1520 int log2Wd = denom + shift - 1;
1525 for (x = 0; x <
width; x++)
1536 for (y = 0; y <
height; y++) {
1537 for (x = 0; x <
width; x++)
1539 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
1545 #define P3 pix[-4 * xstride]
1546 #define P2 pix[-3 * xstride]
1547 #define P1 pix[-2 * xstride]
1548 #define P0 pix[-1 * xstride]
1549 #define Q0 pix[0 * xstride]
1550 #define Q1 pix[1 * xstride]
1551 #define Q2 pix[2 * xstride]
1552 #define Q3 pix[3 * xstride]
1555 #define TP3 pix[-4 * xstride + 3 * ystride]
1556 #define TP2 pix[-3 * xstride + 3 * ystride]
1557 #define TP1 pix[-2 * xstride + 3 * ystride]
1558 #define TP0 pix[-1 * xstride + 3 * ystride]
1559 #define TQ0 pix[0 * xstride + 3 * ystride]
1560 #define TQ1 pix[1 * xstride + 3 * ystride]
1561 #define TQ2 pix[2 * xstride + 3 * ystride]
1562 #define TQ3 pix[3 * xstride + 3 * ystride]
1565 ptrdiff_t _xstride, ptrdiff_t _ystride,
1566 int *_beta,
int *_tc,
1571 ptrdiff_t xstride = _xstride /
sizeof(
pixel);
1572 ptrdiff_t ystride = _ystride /
sizeof(
pixel);
1574 for (j = 0; j < 2; j++) {
1575 const int dp0 = abs(
P2 - 2 *
P1 +
P0);
1576 const int dq0 = abs(
Q2 - 2 *
Q1 +
Q0);
1577 const int dp3 = abs(
TP2 - 2 *
TP1 +
TP0);
1578 const int dq3 = abs(
TQ2 - 2 *
TQ1 +
TQ0);
1579 const int d0 = dp0 + dq0;
1580 const int d3 = dp3 + dq3;
1581 const int beta = _beta[j] << (
BIT_DEPTH - 8);
1583 const int no_p = _no_p[j];
1584 const int no_q = _no_q[j];
1586 if (d0 + d3 >= beta) {
1590 const int beta_3 = beta >> 3;
1591 const int beta_2 = beta >> 2;
1592 const int tc25 = ((tc * 5 + 1) >> 1);
1594 if (abs(
P3 -
P0) + abs(
Q3 -
Q0) < beta_3 && abs(
P0 -
Q0) < tc25 &&
1596 (d0 << 1) < beta_2 && (d3 << 1) < beta_2) {
1598 const int tc2 = tc << 1;
1599 for (d = 0; d < 4; d++) {
1609 P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc2, tc2);
1610 P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2);
1611 P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc2, tc2);
1614 Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc2, tc2);
1615 Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2);
1616 Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc2, tc2);
1623 const int tc_2 = tc >> 1;
1624 if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3))
1626 if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3))
1629 for (d = 0; d < 4; d++) {
1636 int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4;
1637 if (abs(delta0) < 10 *
tc) {
1638 delta0 = av_clip(delta0, -tc, tc);
1643 if (!no_p && nd_p > 1) {
1644 const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2);
1647 if (!no_q && nd_q > 1) {
1648 const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2);
1660 ptrdiff_t _ystride,
int *_tc,
1663 int d, j, no_p, no_q;
1665 ptrdiff_t xstride = _xstride /
sizeof(
pixel);
1666 ptrdiff_t ystride = _ystride /
sizeof(
pixel);
1668 for (j = 0; j < 2; j++) {
1677 for (d = 0; d < 4; d++) {
1683 delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc);
1712 beta, tc, no_p, no_q);
1720 beta, tc, no_p, no_q);