38 for (y = 0; y <
height; y++) {
39 for (x = 0; x <
width; x++)
53 for (y = 0; y <
size; y++) {
54 for (x = 0; x <
size; x++) {
89 int16_t *
coeffs = (int16_t *) _coeffs;
91 int size = 1 << log2_size;
95 for (y = 0; y < size - 1; y++) {
96 for (x = 0; x <
size; x++)
97 coeffs[x] += coeffs[x - size];
101 for (y = 0; y <
size; y++) {
102 for (x = 1; x <
size; x++)
103 coeffs[x] += coeffs[x - 1];
113 int size = 1 << log2_size;
114 int16_t *
coeffs = _coeffs;
118 int offset = 1 << (shift - 1);
119 for (y = 0; y <
size; y++) {
120 for (x = 0; x <
size; x++) {
121 *coeffs = (*coeffs +
offset) >> shift;
126 for (y = 0; y <
size; y++) {
127 for (x = 0; x <
size; x++) {
128 *coeffs = *coeffs << -
shift;
135 #define SET(dst, x) (dst) = (x)
136 #define SCALE(dst, x) (dst) = av_clip_int16(((x) + add) >> shift)
137 #define ADD_AND_SCALE(dst, x) \
138 (dst) = av_clip_pixel((dst) + av_clip_int16(((x) + add) >> shift))
140 #define TR_4x4_LUMA(dst, src, step, assign) \
142 int c0 = src[0 * step] + src[2 * step]; \
143 int c1 = src[2 * step] + src[3 * step]; \
144 int c2 = src[0 * step] - src[3 * step]; \
145 int c3 = 74 * src[1 * step]; \
147 assign(dst[2 * step], 74 * (src[0 * step] - \
150 assign(dst[0 * step], 29 * c0 + 55 * c1 + c3); \
151 assign(dst[1 * step], 55 * c2 - 29 * c1 + c3); \
152 assign(dst[3 * step], 55 * c0 + 29 * c2 - c3); \
159 int add = 1 << (shift - 1);
162 for (i = 0; i < 4; i++) {
168 add = 1 << (shift - 1);
169 for (i = 0; i < 4; i++) {
177 #define TR_4(dst, src, dstep, sstep, assign, end) \
179 const int e0 = 64 * src[0 * sstep] + 64 * src[2 * sstep]; \
180 const int e1 = 64 * src[0 * sstep] - 64 * src[2 * sstep]; \
181 const int o0 = 83 * src[1 * sstep] + 36 * src[3 * sstep]; \
182 const int o1 = 36 * src[1 * sstep] - 83 * src[3 * sstep]; \
184 assign(dst[0 * dstep], e0 + o0); \
185 assign(dst[1 * dstep], e1 + o1); \
186 assign(dst[2 * dstep], e1 - o1); \
187 assign(dst[3 * dstep], e0 - o0); \
190 #define TR_8(dst, src, dstep, sstep, assign, end) \
194 int o_8[4] = { 0 }; \
195 for (i = 0; i < 4; i++) \
196 for (j = 1; j < end; j += 2) \
197 o_8[i] += transform[4 * j][i] * src[j * sstep]; \
198 TR_4(e_8, src, 1, 2 * sstep, SET, 4); \
200 for (i = 0; i < 4; i++) { \
201 assign(dst[i * dstep], e_8[i] + o_8[i]); \
202 assign(dst[(7 - i) * dstep], e_8[i] - o_8[i]); \
206 #define TR_16(dst, src, dstep, sstep, assign, end) \
210 int o_16[8] = { 0 }; \
211 for (i = 0; i < 8; i++) \
212 for (j = 1; j < end; j += 2) \
213 o_16[i] += transform[2 * j][i] * src[j * sstep]; \
214 TR_8(e_16, src, 1, 2 * sstep, SET, 8); \
216 for (i = 0; i < 8; i++) { \
217 assign(dst[i * dstep], e_16[i] + o_16[i]); \
218 assign(dst[(15 - i) * dstep], e_16[i] - o_16[i]); \
222 #define TR_32(dst, src, dstep, sstep, assign, end) \
226 int o_32[16] = { 0 }; \
227 for (i = 0; i < 16; i++) \
228 for (j = 1; j < end; j += 2) \
229 o_32[i] += transform[j][i] * src[j * sstep]; \
230 TR_16(e_32, src, 1, 2 * sstep, SET, end/2); \
232 for (i = 0; i < 16; i++) { \
233 assign(dst[i * dstep], e_32[i] + o_32[i]); \
234 assign(dst[(31 - i) * dstep], e_32[i] - o_32[i]); \
238 #define IDCT_VAR4(H) \
239 int limit2 = FFMIN(col_limit + 4, H)
240 #define IDCT_VAR8(H) \
241 int limit = FFMIN(col_limit, H); \
242 int limit2 = FFMIN(col_limit + 4, H)
243 #define IDCT_VAR16(H) IDCT_VAR8(H)
244 #define IDCT_VAR32(H) IDCT_VAR8(H)
247 static void FUNC(idct_##H ##x ##H )( \
248 int16_t *coeffs, int col_limit) { \
251 int add = 1 << (shift - 1); \
252 int16_t *src = coeffs; \
255 for (i = 0; i < H; i++) { \
256 TR_ ## H(src, src, H, H, SCALE, limit2); \
257 if (limit2 < H && i%4 == 0 && !!i) \
262 shift = 20 - BIT_DEPTH; \
263 add = 1 << (shift - 1); \
264 for (i = 0; i < H; i++) { \
265 TR_ ## H(coeffs, coeffs, 1, 1, SCALE, limit); \
271 static void FUNC(idct_##H ##x ##H ##_dc)( \
274 int shift = 14 - BIT_DEPTH; \
275 int add = 1 << (shift - 1); \
276 int coeff = (((coeffs[0] + 1) >> 1) + add) >> shift; \
278 for (j = 0; j < H; j++) { \
279 for (i = 0; i < H; i++) { \
280 coeffs[i+j*H] = coeff; \
305 ptrdiff_t stride_dst, ptrdiff_t stride_src,
306 int16_t *sao_offset_val,
int sao_left_class,
315 stride_dst /=
sizeof(
pixel);
316 stride_src /=
sizeof(
pixel);
318 for (k = 0; k < 4; k++)
319 offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
320 for (y = 0; y <
height; y++) {
321 for (x = 0; x <
width; x++)
322 dst[x] =
av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
328 #define CMP(a, b) (((a) > (b)) - ((a) < (b)))
333 static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
334 static const int8_t pos[4][2][2] = {
335 { { -1, 0 }, { 1, 0 } },
336 { { 0, -1 }, { 0, 1 } },
337 { { -1, -1 }, { 1, 1 } },
338 { { 1, -1 }, { -1, 1 } },
342 int a_stride, b_stride;
345 stride_dst /=
sizeof(
pixel);
347 a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src;
348 b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src;
349 for (y = 0; y <
height; y++) {
350 for (x = 0; x <
width; x++) {
351 int diff0 =
CMP(src[x], src[x + a_stride]);
352 int diff1 =
CMP(src[x], src[x + b_stride]);
362 ptrdiff_t stride_dst, ptrdiff_t stride_src,
SAOParams *sao,
363 int *borders,
int _width,
int _height,
370 int16_t *sao_offset_val = sao->offset_val[c_idx];
371 int sao_eo_class = sao->eo_class[c_idx];
372 int init_x = 0, width = _width,
height = _height;
374 stride_dst /=
sizeof(
pixel);
375 stride_src /=
sizeof(
pixel);
380 for (y = 0; y <
height; y++) {
381 dst[y * stride_dst] =
av_clip_pixel(src[y * stride_src] + offset_val);
388 for (x = 0; x <
height; x++) {
397 for (x = init_x; x <
width; x++)
402 int y_stride_dst = stride_dst * (height - 1);
403 int y_stride_src = stride_src * (height - 1);
404 for (x = init_x; x <
width; x++)
405 dst[x + y_stride_dst] =
av_clip_pixel(src[x + y_stride_src] + offset_val);
412 ptrdiff_t stride_dst, ptrdiff_t stride_src,
SAOParams *sao,
413 int *borders,
int _width,
int _height,
420 int16_t *sao_offset_val = sao->offset_val[c_idx];
421 int sao_eo_class = sao->eo_class[c_idx];
422 int init_x = 0, init_y = 0, width = _width,
height = _height;
424 stride_dst /=
sizeof(
pixel);
425 stride_src /=
sizeof(
pixel);
430 for (y = 0; y <
height; y++) {
431 dst[y * stride_dst] =
av_clip_pixel(src[y * stride_src] + offset_val);
438 for (x = 0; x <
height; x++) {
447 for (x = init_x; x <
width; x++)
453 int y_stride_dst = stride_dst * (height - 1);
454 int y_stride_src = stride_src * (height - 1);
455 for (x = init_x; x <
width; x++)
456 dst[x + y_stride_dst] =
av_clip_pixel(src[x + y_stride_src] + offset_val);
462 int save_upper_left = !diag_edge[0] && sao_eo_class ==
SAO_EO_135D && !borders[0] && !borders[1];
463 int save_upper_right = !diag_edge[1] && sao_eo_class ==
SAO_EO_45D && !borders[1] && !borders[2];
464 int save_lower_right = !diag_edge[2] && sao_eo_class ==
SAO_EO_135D && !borders[2] && !borders[3];
465 int save_lower_left = !diag_edge[3] && sao_eo_class ==
SAO_EO_45D && !borders[0] && !borders[3];
469 for(y = init_y+save_upper_left; y< height-save_lower_left; y++)
470 dst[y*stride_dst] = src[y*stride_src];
473 for(y = init_y+save_upper_right; y< height-save_lower_right; y++)
474 dst[y*stride_dst+width-1] = src[y*stride_src+width-1];
478 for(x = init_x+save_upper_left; x < width-save_upper_right; x++)
482 for(x = init_x+save_lower_left; x < width-save_lower_right; x++)
483 dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x];
487 if(diag_edge[1] && sao_eo_class ==
SAO_EO_45D)
488 dst[width-1] = src[width-1];
490 dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1];
491 if(diag_edge[3] && sao_eo_class ==
SAO_EO_45D)
492 dst[stride_dst*(height-1)] = src[stride_src*(height-1)];
503 uint8_t *_src, ptrdiff_t _srcstride,
508 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
510 for (y = 0; y <
height; y++) {
511 for (x = 0; x <
width; x++)
523 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
525 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
527 for (y = 0; y <
height; y++) {
528 memcpy(dst, src, width *
sizeof(
pixel));
540 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
542 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
546 int offset = 1 << (shift - 1);
551 for (y = 0; y <
height; y++) {
552 for (x = 0; x <
width; x++)
561 int height,
int denom,
int wx,
int ox, intptr_t mx, intptr_t my,
int width)
565 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
567 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
570 int offset = 1 << (shift - 1);
575 ox = ox * (1 << (BIT_DEPTH - 8));
576 for (y = 0; y <
height; y++) {
577 for (x = 0; x <
width; x++)
578 dst[x] =
av_clip_pixel((((src[x] << (14 - BIT_DEPTH)) * wx + offset) >> shift) + ox);
586 int height,
int denom,
int wx0,
int wx1,
587 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
591 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
593 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
596 int log2Wd = denom + shift - 1;
600 for (y = 0; y <
height; y++) {
601 for (x = 0; x <
width; x++) {
602 dst[x] =
av_clip_pixel(( (src[x] << (14 -
BIT_DEPTH)) * wx1 + src2[x] * wx0 + ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
613 #define QPEL_FILTER(src, stride) \
614 (filter[0] * src[x - 3 * stride] + \
615 filter[1] * src[x - 2 * stride] + \
616 filter[2] * src[x - stride] + \
617 filter[3] * src[x ] + \
618 filter[4] * src[x + stride] + \
619 filter[5] * src[x + 2 * stride] + \
620 filter[6] * src[x + 3 * stride] + \
621 filter[7] * src[x + 4 * stride])
624 uint8_t *_src, ptrdiff_t _srcstride,
629 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
631 for (y = 0; y <
height; y++) {
632 for (x = 0; x <
width; x++)
640 uint8_t *_src, ptrdiff_t _srcstride,
645 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
647 for (y = 0; y <
height; y++) {
648 for (x = 0; x <
width; x++)
657 ptrdiff_t _srcstride,
659 intptr_t my,
int width)
664 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
666 int16_t *tmp = tmp_array;
671 for (x = 0; x <
width; x++)
679 for (y = 0; y <
height; y++) {
680 for (x = 0; x <
width; x++)
688 uint8_t *_src, ptrdiff_t _srcstride,
693 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
695 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
700 int offset = 1 << (shift - 1);
705 for (y = 0; y <
height; y++) {
706 for (x = 0; x <
width; x++)
719 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
721 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
727 int offset = 1 << (shift - 1);
732 for (y = 0; y <
height; y++) {
733 for (x = 0; x <
width; x++)
742 uint8_t *_src, ptrdiff_t _srcstride,
747 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
749 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
754 int offset = 1 << (shift - 1);
759 for (y = 0; y <
height; y++) {
760 for (x = 0; x <
width; x++)
774 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
776 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
782 int offset = 1 << (shift - 1);
787 for (y = 0; y <
height; y++) {
788 for (x = 0; x <
width; x++)
797 uint8_t *_src, ptrdiff_t _srcstride,
803 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
805 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
807 int16_t *tmp = tmp_array;
811 int offset = 1 << (shift - 1);
819 for (x = 0; x <
width; x++)
828 for (y = 0; y <
height; y++) {
829 for (x = 0; x <
width; x++)
843 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
845 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
847 int16_t *tmp = tmp_array;
850 int offset = 1 << (shift - 1);
858 for (x = 0; x <
width; x++)
867 for (y = 0; y <
height; y++) {
868 for (x = 0; x <
width; x++)
877 uint8_t *_src, ptrdiff_t _srcstride,
878 int height,
int denom,
int wx,
int ox,
879 intptr_t mx, intptr_t my,
int width)
883 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
885 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
889 int offset = 1 << (shift - 1);
894 ox = ox * (1 << (BIT_DEPTH - 8));
895 for (y = 0; y <
height; y++) {
896 for (x = 0; x <
width; x++)
905 int height,
int denom,
int wx0,
int wx1,
906 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
910 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
912 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
917 int log2Wd = denom + shift - 1;
921 for (y = 0; y <
height; y++) {
922 for (x = 0; x <
width; x++)
924 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
932 uint8_t *_src, ptrdiff_t _srcstride,
933 int height,
int denom,
int wx,
int ox,
934 intptr_t mx, intptr_t my,
int width)
938 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
940 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
944 int offset = 1 << (shift - 1);
949 ox = ox * (1 << (BIT_DEPTH - 8));
950 for (y = 0; y <
height; y++) {
951 for (x = 0; x <
width; x++)
960 int height,
int denom,
int wx0,
int wx1,
961 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
965 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
967 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
972 int log2Wd = denom + shift - 1;
976 for (y = 0; y <
height; y++) {
977 for (x = 0; x <
width; x++)
979 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
987 uint8_t *_src, ptrdiff_t _srcstride,
988 int height,
int denom,
int wx,
int ox,
989 intptr_t mx, intptr_t my,
int width)
994 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
996 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
998 int16_t *tmp = tmp_array;
1001 int offset = 1 << (shift - 1);
1009 for (x = 0; x <
width; x++)
1018 ox = ox * (1 << (BIT_DEPTH - 8));
1019 for (y = 0; y <
height; y++) {
1020 for (x = 0; x <
width; x++)
1029 int height,
int denom,
int wx0,
int wx1,
1030 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
1035 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1037 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1039 int16_t *tmp = tmp_array;
1041 int log2Wd = denom + shift - 1;
1046 for (x = 0; x <
width; x++)
1057 for (y = 0; y <
height; y++) {
1058 for (x = 0; x <
width; x++)
1060 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
1070 #define EPEL_FILTER(src, stride) \
1071 (filter[0] * src[x - stride] + \
1072 filter[1] * src[x] + \
1073 filter[2] * src[x + stride] + \
1074 filter[3] * src[x + 2 * stride])
1077 uint8_t *_src, ptrdiff_t _srcstride,
1082 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1084 for (y = 0; y <
height; y++) {
1085 for (x = 0; x <
width; x++)
1093 uint8_t *_src, ptrdiff_t _srcstride,
1098 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1101 for (y = 0; y <
height; y++) {
1102 for (x = 0; x <
width; x++)
1110 uint8_t *_src, ptrdiff_t _srcstride,
1115 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1118 int16_t *tmp = tmp_array;
1123 for (x = 0; x <
width; x++)
1132 for (y = 0; y <
height; y++) {
1133 for (x = 0; x <
width; x++)
1145 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1147 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1151 int offset = 1 << (shift - 1);
1156 for (y = 0; y <
height; y++) {
1157 for (x = 0; x <
width; x++)
1170 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1172 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1176 int offset = 1 << (shift - 1);
1181 for (y = 0; y <
height; y++) {
1182 for (x = 0; x <
width; x++) {
1196 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1198 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1202 int offset = 1 << (shift - 1);
1207 for (y = 0; y <
height; y++) {
1208 for (x = 0; x <
width; x++)
1221 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1224 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1227 int offset = 1 << (shift - 1);
1232 for (y = 0; y <
height; y++) {
1233 for (x = 0; x <
width; x++)
1246 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1248 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1251 int16_t *tmp = tmp_array;
1254 int offset = 1 << (shift - 1);
1262 for (x = 0; x <
width; x++)
1271 for (y = 0; y <
height; y++) {
1272 for (x = 0; x <
width; x++)
1285 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1287 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1290 int16_t *tmp = tmp_array;
1293 int offset = 1 << (shift - 1);
1301 for (x = 0; x <
width; x++)
1310 for (y = 0; y <
height; y++) {
1311 for (x = 0; x <
width; x++)
1320 int height,
int denom,
int wx,
int ox, intptr_t mx, intptr_t my,
int width)
1324 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1326 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1330 int offset = 1 << (shift - 1);
1335 ox = ox * (1 << (BIT_DEPTH - 8));
1336 for (y = 0; y <
height; y++) {
1337 for (x = 0; x <
width; x++) {
1347 int height,
int denom,
int wx0,
int wx1,
1348 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
1352 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1354 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1357 int log2Wd = denom + shift - 1;
1361 for (y = 0; y <
height; y++) {
1362 for (x = 0; x <
width; x++)
1364 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
1372 int height,
int denom,
int wx,
int ox, intptr_t mx, intptr_t my,
int width)
1376 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1378 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1382 int offset = 1 << (shift - 1);
1387 ox = ox * (1 << (BIT_DEPTH - 8));
1388 for (y = 0; y <
height; y++) {
1389 for (x = 0; x <
width; x++) {
1399 int height,
int denom,
int wx0,
int wx1,
1400 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
1404 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1407 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1409 int log2Wd = denom + shift - 1;
1413 for (y = 0; y <
height; y++) {
1414 for (x = 0; x <
width; x++)
1416 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
1424 int height,
int denom,
int wx,
int ox, intptr_t mx, intptr_t my,
int width)
1428 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1430 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1433 int16_t *tmp = tmp_array;
1436 int offset = 1 << (shift - 1);
1444 for (x = 0; x <
width; x++)
1453 ox = ox * (1 << (BIT_DEPTH - 8));
1454 for (y = 0; y <
height; y++) {
1455 for (x = 0; x <
width; x++)
1464 int height,
int denom,
int wx0,
int wx1,
1465 int ox0,
int ox1, intptr_t mx, intptr_t my,
int width)
1469 ptrdiff_t srcstride = _srcstride /
sizeof(
pixel);
1471 ptrdiff_t dststride = _dststride /
sizeof(
pixel);
1474 int16_t *tmp = tmp_array;
1476 int log2Wd = denom + shift - 1;
1481 for (x = 0; x <
width; x++)
1492 for (y = 0; y <
height; y++) {
1493 for (x = 0; x <
width; x++)
1495 ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
1501 #define P3 pix[-4 * xstride]
1502 #define P2 pix[-3 * xstride]
1503 #define P1 pix[-2 * xstride]
1504 #define P0 pix[-1 * xstride]
1505 #define Q0 pix[0 * xstride]
1506 #define Q1 pix[1 * xstride]
1507 #define Q2 pix[2 * xstride]
1508 #define Q3 pix[3 * xstride]
1511 #define TP3 pix[-4 * xstride + 3 * ystride]
1512 #define TP2 pix[-3 * xstride + 3 * ystride]
1513 #define TP1 pix[-2 * xstride + 3 * ystride]
1514 #define TP0 pix[-1 * xstride + 3 * ystride]
1515 #define TQ0 pix[0 * xstride + 3 * ystride]
1516 #define TQ1 pix[1 * xstride + 3 * ystride]
1517 #define TQ2 pix[2 * xstride + 3 * ystride]
1518 #define TQ3 pix[3 * xstride + 3 * ystride]
1521 ptrdiff_t _xstride, ptrdiff_t _ystride,
1527 ptrdiff_t xstride = _xstride /
sizeof(
pixel);
1528 ptrdiff_t ystride = _ystride /
sizeof(
pixel);
1532 for (j = 0; j < 2; j++) {
1533 const int dp0 = abs(
P2 - 2 *
P1 +
P0);
1534 const int dq0 = abs(
Q2 - 2 *
Q1 +
Q0);
1535 const int dp3 = abs(
TP2 - 2 *
TP1 +
TP0);
1536 const int dq3 = abs(
TQ2 - 2 *
TQ1 +
TQ0);
1537 const int d0 = dp0 + dq0;
1538 const int d3 = dp3 + dq3;
1540 const int no_p = _no_p[j];
1541 const int no_q = _no_q[j];
1543 if (d0 + d3 >= beta) {
1547 const int beta_3 = beta >> 3;
1548 const int beta_2 = beta >> 2;
1549 const int tc25 = ((tc * 5 + 1) >> 1);
1551 if (abs(
P3 -
P0) + abs(
Q3 -
Q0) < beta_3 && abs(
P0 -
Q0) < tc25 &&
1553 (d0 << 1) < beta_2 && (d3 << 1) < beta_2) {
1555 const int tc2 = tc << 1;
1556 for (d = 0; d < 4; d++) {
1566 P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc2, tc2);
1567 P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2);
1568 P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc2, tc2);
1571 Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc2, tc2);
1572 Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2);
1573 Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc2, tc2);
1580 const int tc_2 = tc >> 1;
1581 if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3))
1583 if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3))
1586 for (d = 0; d < 4; d++) {
1593 int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4;
1594 if (abs(delta0) < 10 *
tc) {
1595 delta0 = av_clip(delta0, -tc, tc);
1600 if (!no_p && nd_p > 1) {
1601 const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2);
1604 if (!no_q && nd_q > 1) {
1605 const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2);
1617 ptrdiff_t _ystride,
int *_tc,
1620 int d, j, no_p, no_q;
1622 ptrdiff_t xstride = _xstride /
sizeof(
pixel);
1623 ptrdiff_t ystride = _ystride /
sizeof(
pixel);
1625 for (j = 0; j < 2; j++) {
1634 for (d = 0; d < 4; d++) {
1640 delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc);
1669 beta, tc, no_p, no_q);
1677 beta, tc, no_p, no_q);
static void FUNC() put_hevc_qpel_bi_w_hv(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_pel_uni_pixels(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_qpel_bi_hv(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
static int shift(int a, int b)
static void FUNC() put_hevc_epel_bi_hv(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_qpel_uni_w_h(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
static void FUNC() transform_add32x32(uint8_t *_dst, int16_t *coeffs, ptrdiff_t stride)
static void FUNC() put_hevc_epel_uni_w_h(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void FUNC() put_hevc_pel_bi_w_pixels(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
static const uint8_t q1[256]
static void FUNC() put_hevc_qpel_uni_w_hv(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_qpel_uni_h(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_qpel_h(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static av_always_inline void FUNC() transquant_bypass(uint8_t *_dst, int16_t *coeffs, ptrdiff_t stride, int size)
#define QPEL_FILTER(src, stride)
static void FUNC() sao_edge_restore_1(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, SAOParams *sao, int *borders, int _width, int _height, int c_idx, uint8_t *vert_edge, uint8_t *horiz_edge, uint8_t *diag_edge)
static void FUNC() put_hevc_qpel_bi_h(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_qpel_uni_w_v(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
static void FUNC() hevc_h_loop_filter_luma(uint8_t *pix, ptrdiff_t stride, int beta, int32_t *tc, uint8_t *no_p, uint8_t *no_q)
const int8_t ff_hevc_epel_filters[7][4]
bitstream reader API header.
#define EPEL_EXTRA_BEFORE
const int8_t ff_hevc_qpel_filters[3][16]
static void FUNC() put_hevc_qpel_v(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_epel_hv(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static const uint8_t offset[127][2]
static void FUNC() transform_skip(int16_t *_coeffs, int16_t log2_size)
static const uint8_t q0[256]
static void FUNC() put_hevc_qpel_uni_hv(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() transform_add8x8(uint8_t *_dst, int16_t *coeffs, ptrdiff_t stride)
#define EPEL_FILTER(src, stride)
static void FUNC() put_hevc_pel_bi_pixels(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_epel_bi_v(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() sao_band_filter(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int16_t *sao_offset_val, int sao_left_class, int width, int height)
static void FUNC() put_hevc_epel_uni_w_hv(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_qpel_bi_v(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() hevc_v_loop_filter_luma(uint8_t *pix, ptrdiff_t stride, int beta, int32_t *tc, uint8_t *no_p, uint8_t *no_q)
static void FUNC() put_hevc_epel_bi_w_h(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_epel_uni_w_v(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_pel_pixels(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() hevc_loop_filter_chroma(uint8_t *_pix, ptrdiff_t _xstride, ptrdiff_t _ystride, int *_tc, uint8_t *_no_p, uint8_t *_no_q)
static void FUNC() transform_add16x16(uint8_t *_dst, int16_t *coeffs, ptrdiff_t stride)
static void FUNC() hevc_h_loop_filter_chroma(uint8_t *pix, ptrdiff_t stride, int32_t *tc, uint8_t *no_p, uint8_t *no_q)
static void FUNC() transform_add4x4(uint8_t *_dst, int16_t *coeffs, ptrdiff_t stride)
BYTE int const BYTE int int int height
static void FUNC() put_hevc_qpel_hv(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_qpel_bi_w_v(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_epel_uni_h(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_epel_uni_v(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_pcm(uint8_t *_dst, ptrdiff_t stride, int width, int height, GetBitContext *gb, int pcm_bit_depth)
static void FUNC() put_hevc_epel_uni_hv(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() transform_rdpcm(int16_t *_coeffs, int16_t log2_size, int mode)
static void FUNC() put_hevc_epel_v(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
GLint GLenum GLboolean GLsizei stride
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
static void FUNC() put_hevc_qpel_bi_w_h(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
static void FUNC() hevc_v_loop_filter_chroma(uint8_t *pix, ptrdiff_t stride, int32_t *tc, uint8_t *no_p, uint8_t *no_q)
int16_t offset_val[3][5]
SaoOffsetVal.
static void FUNC() sao_edge_restore_0(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, SAOParams *sao, int *borders, int _width, int _height, int c_idx, uint8_t *vert_edge, uint8_t *horiz_edge, uint8_t *diag_edge)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
#define TR_4x4_LUMA(dst, src, step, assign)
static const uint8_t offset_table[]
static void FUNC() put_hevc_pel_uni_w_pixels(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_epel_bi_h(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
static const int16_t coeffs[]
#define QPEL_EXTRA_BEFORE
static void FUNC() sao_edge_filter(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, int eo, int width, int height)
static void FUNC() transform_4x4_luma(int16_t *coeffs)
static void FUNC() hevc_loop_filter_luma(uint8_t *_pix, ptrdiff_t _xstride, ptrdiff_t _ystride, int beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q)
static void FUNC() put_hevc_epel_bi_w_hv(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_epel_bi_w_v(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_epel_h(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
static void FUNC() put_hevc_qpel_uni_v(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)