4 * Copyright (C) 2012 - 2013 Guillaume Martres
6 * This file is part of Libav.
8 * Libav is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * Libav is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with Libav; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 #include "bit_depth_template.c"
28 static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t stride, int size,
29 GetBitContext *gb, int pcm_bit_depth)
32 pixel *dst = (pixel *)_dst;
34 stride /= sizeof(pixel);
36 for (y = 0; y < size; y++) {
37 for (x = 0; x < size; x++)
38 dst[x] = get_bits(gb, pcm_bit_depth) << (BIT_DEPTH - pcm_bit_depth);
43 static av_always_inline void FUNC(transquant_bypass)(uint8_t *_dst, int16_t *coeffs,
44 ptrdiff_t stride, int size)
47 pixel *dst = (pixel *)_dst;
49 stride /= sizeof(pixel);
51 for (y = 0; y < size; y++) {
52 for (x = 0; x < size; x++) {
53 dst[x] = av_clip_pixel(dst[x] + *coeffs);
60 static void FUNC(transquant_bypass4x4)(uint8_t *_dst, int16_t *coeffs,
63 FUNC(transquant_bypass)(_dst, coeffs, stride, 4);
66 static void FUNC(transquant_bypass8x8)(uint8_t *_dst, int16_t *coeffs,
69 FUNC(transquant_bypass)(_dst, coeffs, stride, 8);
72 static void FUNC(transquant_bypass16x16)(uint8_t *_dst, int16_t *coeffs,
75 FUNC(transquant_bypass)(_dst, coeffs, stride, 16);
78 static void FUNC(transquant_bypass32x32)(uint8_t *_dst, int16_t *coeffs,
81 FUNC(transquant_bypass)(_dst, coeffs, stride, 32);
84 static void FUNC(transform_skip)(uint8_t *_dst, int16_t *coeffs,
87 pixel *dst = (pixel *)_dst;
88 int shift = 13 - BIT_DEPTH;
90 int offset = 1 << (shift - 1);
96 stride /= sizeof(pixel);
98 for (y = 0; y < 4 * 4; y += 4) {
99 for (x = 0; x < 4; x++)
100 dst[x] = av_clip_pixel(dst[x] + ((coeffs[y + x] + offset) >> shift));
105 #define SET(dst, x) (dst) = (x)
106 #define SCALE(dst, x) (dst) = av_clip_int16(((x) + add) >> shift)
107 #define ADD_AND_SCALE(dst, x) \
108 (dst) = av_clip_pixel((dst) + av_clip_int16(((x) + add) >> shift))
110 #define TR_4x4_LUMA(dst, src, step, assign) \
112 int c0 = src[0 * step] + src[2 * step]; \
113 int c1 = src[2 * step] + src[3 * step]; \
114 int c2 = src[0 * step] - src[3 * step]; \
115 int c3 = 74 * src[1 * step]; \
117 assign(dst[2 * step], 74 * (src[0 * step] - \
120 assign(dst[0 * step], 29 * c0 + 55 * c1 + c3); \
121 assign(dst[1 * step], 55 * c2 - 29 * c1 + c3); \
122 assign(dst[3 * step], 55 * c0 + 29 * c2 - c3); \
125 static void FUNC(transform_4x4_luma_add)(uint8_t *_dst, int16_t *coeffs,
129 pixel *dst = (pixel *)_dst;
131 int add = 1 << (shift - 1);
132 int16_t *src = coeffs;
134 stride /= sizeof(pixel);
136 for (i = 0; i < 4; i++) {
137 TR_4x4_LUMA(src, src, 4, SCALE);
141 shift = 20 - BIT_DEPTH;
142 add = 1 << (shift - 1);
143 for (i = 0; i < 4; i++) {
144 TR_4x4_LUMA(dst, coeffs, 1, ADD_AND_SCALE);
152 #define TR_4(dst, src, dstep, sstep, assign) \
154 const int e0 = transform[8 * 0][0] * src[0 * sstep] + \
155 transform[8 * 2][0] * src[2 * sstep]; \
156 const int e1 = transform[8 * 0][1] * src[0 * sstep] + \
157 transform[8 * 2][1] * src[2 * sstep]; \
158 const int o0 = transform[8 * 1][0] * src[1 * sstep] + \
159 transform[8 * 3][0] * src[3 * sstep]; \
160 const int o1 = transform[8 * 1][1] * src[1 * sstep] + \
161 transform[8 * 3][1] * src[3 * sstep]; \
163 assign(dst[0 * dstep], e0 + o0); \
164 assign(dst[1 * dstep], e1 + o1); \
165 assign(dst[2 * dstep], e1 - o1); \
166 assign(dst[3 * dstep], e0 - o0); \
169 static void FUNC(transform_4x4_add)(uint8_t *_dst, int16_t *coeffs,
173 pixel *dst = (pixel *)_dst;
175 int add = 1 << (shift - 1);
176 int16_t *src = coeffs;
178 stride /= sizeof(pixel);
180 for (i = 0; i < 4; i++) {
181 TR_4(src, src, 4, 4, SCALE);
185 shift = 20 - BIT_DEPTH;
186 add = 1 << (shift - 1);
187 for (i = 0; i < 4; i++) {
188 TR_4(dst, coeffs, 1, 1, ADD_AND_SCALE);
194 #define TR_8(dst, src, dstep, sstep, assign) \
198 int o_8[4] = { 0 }; \
199 for (i = 0; i < 4; i++) \
200 for (j = 1; j < 8; j += 2) \
201 o_8[i] += transform[4 * j][i] * src[j * sstep]; \
202 TR_4(e_8, src, 1, 2 * sstep, SET); \
204 for (i = 0; i < 4; i++) { \
205 assign(dst[i * dstep], e_8[i] + o_8[i]); \
206 assign(dst[(7 - i) * dstep], e_8[i] - o_8[i]); \
210 #define TR_16(dst, src, dstep, sstep, assign) \
214 int o_16[8] = { 0 }; \
215 for (i = 0; i < 8; i++) \
216 for (j = 1; j < 16; j += 2) \
217 o_16[i] += transform[2 * j][i] * src[j * sstep]; \
218 TR_8(e_16, src, 1, 2 * sstep, SET); \
220 for (i = 0; i < 8; i++) { \
221 assign(dst[i * dstep], e_16[i] + o_16[i]); \
222 assign(dst[(15 - i) * dstep], e_16[i] - o_16[i]); \
226 #define TR_32(dst, src, dstep, sstep, assign) \
230 int o_32[16] = { 0 }; \
231 for (i = 0; i < 16; i++) \
232 for (j = 1; j < 32; j += 2) \
233 o_32[i] += transform[j][i] * src[j * sstep]; \
234 TR_16(e_32, src, 1, 2 * sstep, SET); \
236 for (i = 0; i < 16; i++) { \
237 assign(dst[i * dstep], e_32[i] + o_32[i]); \
238 assign(dst[(31 - i) * dstep], e_32[i] - o_32[i]); \
244 static void FUNC(transform_8x8_add)(uint8_t *_dst, int16_t *coeffs,
248 pixel *dst = (pixel *)_dst;
250 int add = 1 << (shift - 1);
251 int16_t *src = coeffs;
253 stride /= sizeof(pixel);
255 for (i = 0; i < 8; i++) {
256 TR_8(src, src, 8, 8, SCALE);
260 shift = 20 - BIT_DEPTH;
261 add = 1 << (shift - 1);
262 for (i = 0; i < 8; i++) {
263 TR_8(dst, coeffs, 1, 1, ADD_AND_SCALE);
269 static void FUNC(transform_16x16_add)(uint8_t *_dst, int16_t *coeffs,
273 pixel *dst = (pixel *)_dst;
275 int add = 1 << (shift - 1);
276 int16_t *src = coeffs;
278 stride /= sizeof(pixel);
280 for (i = 0; i < 16; i++) {
281 TR_16(src, src, 16, 16, SCALE);
285 shift = 20 - BIT_DEPTH;
286 add = 1 << (shift - 1);
287 for (i = 0; i < 16; i++) {
288 TR_16(dst, coeffs, 1, 1, ADD_AND_SCALE);
294 static void FUNC(transform_32x32_add)(uint8_t *_dst, int16_t *coeffs,
298 pixel *dst = (pixel *)_dst;
300 int add = 1 << (shift - 1);
301 int16_t *src = coeffs;
303 stride /= sizeof(pixel);
305 for (i = 0; i < 32; i++) {
306 TR_32(src, src, 32, 32, SCALE);
310 shift = 20 - BIT_DEPTH;
311 add = 1 << (shift - 1);
312 for (i = 0; i < 32; i++) {
313 TR_32(dst, coeffs, 1, 1, ADD_AND_SCALE);
319 static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src,
320 ptrdiff_t stride, SAOParams *sao,
321 int *borders, int width, int height,
322 int c_idx, int class)
324 pixel *dst = (pixel *)_dst;
325 pixel *src = (pixel *)_src;
326 int offset_table[32] = { 0 };
328 int chroma = !!c_idx;
329 int shift = BIT_DEPTH - 5;
330 int *sao_offset_val = sao->offset_val[c_idx];
331 int sao_left_class = sao->band_position[c_idx];
332 int init_y = 0, init_x = 0;
334 stride /= sizeof(pixel);
339 width -= (8 >> chroma) + 2;
341 height -= (4 >> chroma) + 2;
344 init_y = -(4 >> chroma) - 2;
346 width -= (8 >> chroma) + 2;
347 height = (4 >> chroma) + 2;
350 init_x = -(8 >> chroma) - 2;
351 width = (8 >> chroma) + 2;
353 height -= (4 >> chroma) + 2;
356 init_y = -(4 >> chroma) - 2;
357 init_x = -(8 >> chroma) - 2;
358 width = (8 >> chroma) + 2;
359 height = (4 >> chroma) + 2;
363 dst = dst + (init_y * stride + init_x);
364 src = src + (init_y * stride + init_x);
365 for (k = 0; k < 4; k++)
366 offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
367 for (y = 0; y < height; y++) {
368 for (x = 0; x < width; x++)
369 dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
375 static void FUNC(sao_band_filter_0)(uint8_t *dst, uint8_t *src,
376 ptrdiff_t stride, SAOParams *sao,
377 int *borders, int width, int height,
380 FUNC(sao_band_filter)(dst, src, stride, sao, borders,
381 width, height, c_idx, 0);
384 static void FUNC(sao_band_filter_1)(uint8_t *dst, uint8_t *src,
385 ptrdiff_t stride, SAOParams *sao,
386 int *borders, int width, int height,
389 FUNC(sao_band_filter)(dst, src, stride, sao, borders,
390 width, height, c_idx, 1);
393 static void FUNC(sao_band_filter_2)(uint8_t *dst, uint8_t *src,
394 ptrdiff_t stride, SAOParams *sao,
395 int *borders, int width, int height,
398 FUNC(sao_band_filter)(dst, src, stride, sao, borders,
399 width, height, c_idx, 2);
402 static void FUNC(sao_band_filter_3)(uint8_t *_dst, uint8_t *_src,
403 ptrdiff_t stride, SAOParams *sao,
404 int *borders, int width, int height,
407 FUNC(sao_band_filter)(_dst, _src, stride, sao, borders,
408 width, height, c_idx, 3);
411 static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
412 ptrdiff_t stride, SAOParams *sao,
413 int *borders, int _width, int _height,
414 int c_idx, uint8_t vert_edge,
415 uint8_t horiz_edge, uint8_t diag_edge)
418 pixel *dst = (pixel *)_dst;
419 pixel *src = (pixel *)_src;
420 int chroma = !!c_idx;
421 int *sao_offset_val = sao->offset_val[c_idx];
422 int sao_eo_class = sao->eo_class[c_idx];
423 int init_x = 0, init_y = 0, width = _width, height = _height;
425 static const int8_t pos[4][2][2] = {
426 { { -1, 0 }, { 1, 0 } }, // horizontal
427 { { 0, -1 }, { 0, 1 } }, // vertical
428 { { -1, -1 }, { 1, 1 } }, // 45 degree
429 { { 1, -1 }, { -1, 1 } }, // 135 degree
431 static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
433 #define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1))
435 stride /= sizeof(pixel);
438 width -= (8 >> chroma) + 2;
440 height -= (4 >> chroma) + 2;
442 dst = dst + (init_y * stride + init_x);
443 src = src + (init_y * stride + init_x);
445 if (sao_eo_class != SAO_EO_VERT) {
447 int offset_val = sao_offset_val[0];
449 for (y = 0; y < height; y++) {
450 dst[y_stride] = av_clip_pixel(src[y_stride] + offset_val);
456 int offset_val = sao_offset_val[0];
457 int x_stride = width - 1;
458 for (x = 0; x < height; x++) {
459 dst[x_stride] = av_clip_pixel(src[x_stride] + offset_val);
465 if (sao_eo_class != SAO_EO_HORIZ) {
467 int offset_val = sao_offset_val[0];
468 for (x = init_x; x < width; x++)
469 dst[x] = av_clip_pixel(src[x] + offset_val);
473 int offset_val = sao_offset_val[0];
474 int y_stride = stride * (height - 1);
475 for (x = init_x; x < width; x++)
476 dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + offset_val);
481 int y_stride = init_y * stride;
482 int pos_0_0 = pos[sao_eo_class][0][0];
483 int pos_0_1 = pos[sao_eo_class][0][1];
484 int pos_1_0 = pos[sao_eo_class][1][0];
485 int pos_1_1 = pos[sao_eo_class][1][1];
487 int y_stride_0_1 = (init_y + pos_0_1) * stride;
488 int y_stride_1_1 = (init_y + pos_1_1) * stride;
489 for (y = init_y; y < height; y++) {
490 for (x = init_x; x < width; x++) {
491 int diff0 = CMP(src[x + y_stride], src[x + pos_0_0 + y_stride_0_1]);
492 int diff1 = CMP(src[x + y_stride], src[x + pos_1_0 + y_stride_1_1]);
493 int offset_val = edge_idx[2 + diff0 + diff1];
494 dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + sao_offset_val[offset_val]);
497 y_stride_0_1 += stride;
498 y_stride_1_1 += stride;
503 // Restore pixels that can't be modified
504 int save_upper_left = !diag_edge && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1];
505 if (vert_edge && sao_eo_class != SAO_EO_VERT)
506 for (y = init_y+save_upper_left; y< height; y++)
507 dst[y*stride] = src[y*stride];
508 if(horiz_edge && sao_eo_class != SAO_EO_HORIZ)
509 for(x = init_x+save_upper_left; x<width; x++)
511 if(diag_edge && sao_eo_class == SAO_EO_135D)
518 static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
519 ptrdiff_t stride, SAOParams *sao,
520 int *borders, int _width, int _height,
521 int c_idx, uint8_t vert_edge,
522 uint8_t horiz_edge, uint8_t diag_edge)
525 pixel *dst = (pixel *)_dst;
526 pixel *src = (pixel *)_src;
527 int chroma = !!c_idx;
528 int *sao_offset_val = sao->offset_val[c_idx];
529 int sao_eo_class = sao->eo_class[c_idx];
530 int init_x = 0, init_y = 0, width = _width, height = _height;
532 static const int8_t pos[4][2][2] = {
533 { { -1, 0 }, { 1, 0 } }, // horizontal
534 { { 0, -1 }, { 0, 1 } }, // vertical
535 { { -1, -1 }, { 1, 1 } }, // 45 degree
536 { { 1, -1 }, { -1, 1 } }, // 135 degree
538 static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
540 #define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1))
542 stride /= sizeof(pixel);
544 init_y = -(4 >> chroma) - 2;
546 width -= (8 >> chroma) + 2;
547 height = (4 >> chroma) + 2;
549 dst = dst + (init_y * stride + init_x);
550 src = src + (init_y * stride + init_x);
552 if (sao_eo_class != SAO_EO_VERT) {
554 int offset_val = sao_offset_val[0];
556 for (y = 0; y < height; y++) {
557 dst[y_stride] = av_clip_pixel(src[y_stride] + offset_val);
563 int offset_val = sao_offset_val[0];
564 int x_stride = width - 1;
565 for (x = 0; x < height; x++) {
566 dst[x_stride] = av_clip_pixel(src[x_stride] + offset_val);
573 int y_stride = init_y * stride;
574 int pos_0_0 = pos[sao_eo_class][0][0];
575 int pos_0_1 = pos[sao_eo_class][0][1];
576 int pos_1_0 = pos[sao_eo_class][1][0];
577 int pos_1_1 = pos[sao_eo_class][1][1];
579 int y_stride_0_1 = (init_y + pos_0_1) * stride;
580 int y_stride_1_1 = (init_y + pos_1_1) * stride;
581 for (y = init_y; y < height; y++) {
582 for (x = init_x; x < width; x++) {
583 int diff0 = CMP(src[x + y_stride], src[x + pos_0_0 + y_stride_0_1]);
584 int diff1 = CMP(src[x + y_stride], src[x + pos_1_0 + y_stride_1_1]);
585 int offset_val = edge_idx[2 + diff0 + diff1];
586 dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + sao_offset_val[offset_val]);
589 y_stride_0_1 += stride;
590 y_stride_1_1 += stride;
595 // Restore pixels that can't be modified
596 int save_lower_left = !diag_edge && sao_eo_class == SAO_EO_45D && !borders[0];
597 if(vert_edge && sao_eo_class != SAO_EO_VERT)
598 for(y = init_y; y< height-save_lower_left; y++)
599 dst[y*stride] = src[y*stride];
600 if(horiz_edge && sao_eo_class != SAO_EO_HORIZ)
601 for(x = init_x+save_lower_left; x<width; x++)
602 dst[(height-1)*stride+x] = src[(height-1)*stride+x];
603 if(diag_edge && sao_eo_class == SAO_EO_45D)
604 dst[stride*(height-1)] = src[stride*(height-1)];
610 static void FUNC(sao_edge_filter_2)(uint8_t *_dst, uint8_t *_src,
611 ptrdiff_t stride, SAOParams *sao,
612 int *borders, int _width, int _height,
613 int c_idx, uint8_t vert_edge,
614 uint8_t horiz_edge, uint8_t diag_edge)
617 pixel *dst = (pixel *)_dst;
618 pixel *src = (pixel *)_src;
619 int chroma = !!c_idx;
620 int *sao_offset_val = sao->offset_val[c_idx];
621 int sao_eo_class = sao->eo_class[c_idx];
622 int init_x = 0, init_y = 0, width = _width, height = _height;
624 static const int8_t pos[4][2][2] = {
625 { { -1, 0 }, { 1, 0 } }, // horizontal
626 { { 0, -1 }, { 0, 1 } }, // vertical
627 { { -1, -1 }, { 1, 1 } }, // 45 degree
628 { { 1, -1 }, { -1, 1 } }, // 135 degree
630 static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
632 #define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1))
634 stride /= sizeof(pixel);
636 init_x = -(8 >> chroma) - 2;
637 width = (8 >> chroma) + 2;
639 height -= (4 >> chroma) + 2;
641 dst = dst + (init_y * stride + init_x);
642 src = src + (init_y * stride + init_x);
644 if (sao_eo_class != SAO_EO_HORIZ) {
646 int offset_val = sao_offset_val[0];
647 for (x = init_x; x < width; x++)
648 dst[x] = av_clip_pixel(src[x] + offset_val);
652 int offset_val = sao_offset_val[0];
653 int y_stride = stride * (height - 1);
654 for (x = init_x; x < width; x++)
655 dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + offset_val);
660 int y_stride = init_y * stride;
661 int pos_0_0 = pos[sao_eo_class][0][0];
662 int pos_0_1 = pos[sao_eo_class][0][1];
663 int pos_1_0 = pos[sao_eo_class][1][0];
664 int pos_1_1 = pos[sao_eo_class][1][1];
666 int y_stride_0_1 = (init_y + pos_0_1) * stride;
667 int y_stride_1_1 = (init_y + pos_1_1) * stride;
668 for (y = init_y; y < height; y++) {
669 for (x = init_x; x < width; x++) {
670 int diff0 = CMP(src[x + y_stride], src[x + pos_0_0 + y_stride_0_1]);
671 int diff1 = CMP(src[x + y_stride], src[x + pos_1_0 + y_stride_1_1]);
672 int offset_val = edge_idx[2 + diff0 + diff1];
673 dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + sao_offset_val[offset_val]);
676 y_stride_0_1 += stride;
677 y_stride_1_1 += stride;
682 // Restore pixels that can't be modified
683 int save_upper_right = !diag_edge && sao_eo_class == SAO_EO_45D && !borders[1];
684 if(vert_edge && sao_eo_class != SAO_EO_VERT)
685 for(y = init_y+save_upper_right; y< height; y++)
686 dst[y*stride+width-1] = src[y*stride+width-1];
687 if(horiz_edge && sao_eo_class != SAO_EO_HORIZ)
688 for(x = init_x; x<width-save_upper_right; x++)
690 if(diag_edge && sao_eo_class == SAO_EO_45D)
691 dst[width-1] = src[width-1];
696 static void FUNC(sao_edge_filter_3)(uint8_t *_dst, uint8_t *_src,
697 ptrdiff_t stride, SAOParams *sao,
698 int *borders, int _width, int _height,
699 int c_idx, uint8_t vert_edge,
700 uint8_t horiz_edge, uint8_t diag_edge)
703 pixel *dst = (pixel *)_dst;
704 pixel *src = (pixel *)_src;
705 int chroma = !!c_idx;
706 int *sao_offset_val = sao->offset_val[c_idx];
707 int sao_eo_class = sao->eo_class[c_idx];
708 int init_x = 0, init_y = 0, width = _width, height = _height;
710 static const int8_t pos[4][2][2] = {
711 { { -1, 0 }, { 1, 0 } }, // horizontal
712 { { 0, -1 }, { 0, 1 } }, // vertical
713 { { -1, -1 }, { 1, 1 } }, // 45 degree
714 { { 1, -1 }, { -1, 1 } }, // 135 degree
716 static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
718 #define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1))
720 stride /= sizeof(pixel);
722 init_y = -(4 >> chroma) - 2;
723 init_x = -(8 >> chroma) - 2;
724 width = (8 >> chroma) + 2;
725 height = (4 >> chroma) + 2;
728 dst = dst + (init_y * stride + init_x);
729 src = src + (init_y * stride + init_x);
733 int y_stride = init_y * stride;
734 int pos_0_0 = pos[sao_eo_class][0][0];
735 int pos_0_1 = pos[sao_eo_class][0][1];
736 int pos_1_0 = pos[sao_eo_class][1][0];
737 int pos_1_1 = pos[sao_eo_class][1][1];
739 int y_stride_0_1 = (init_y + pos_0_1) * stride;
740 int y_stride_1_1 = (init_y + pos_1_1) * stride;
742 for (y = init_y; y < height; y++) {
743 for (x = init_x; x < width; x++) {
744 int diff0 = CMP(src[x + y_stride], src[x + pos_0_0 + y_stride_0_1]);
745 int diff1 = CMP(src[x + y_stride], src[x + pos_1_0 + y_stride_1_1]);
746 int offset_val = edge_idx[2 + diff0 + diff1];
747 dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + sao_offset_val[offset_val]);
750 y_stride_0_1 += stride;
751 y_stride_1_1 += stride;
756 // Restore pixels that can't be modified
757 int save_lower_right = !diag_edge && sao_eo_class == SAO_EO_135D;
758 if(vert_edge && sao_eo_class != SAO_EO_VERT)
759 for(y = init_y; y< height-save_lower_right; y++)
760 dst[y*stride+width-1] = src[y*stride+width-1];
761 if(horiz_edge && sao_eo_class != SAO_EO_HORIZ)
762 for(x = init_x; x<width-save_lower_right; x++)
763 dst[(height-1)*stride+x] = src[(height-1)*stride+x];
764 if(diag_edge && sao_eo_class == SAO_EO_135D)
765 dst[stride*(height-1)+width-1] = src[stride*(height-1)+width-1];
778 static av_always_inline void
779 FUNC(put_hevc_qpel_pixels)(int16_t *dst, ptrdiff_t dststride,
780 uint8_t *_src, ptrdiff_t _srcstride,
781 int width, int height, int mx, int my,
785 pixel *src = (pixel *)_src;
786 ptrdiff_t srcstride = _srcstride / sizeof(pixel);
788 for (y = 0; y < height; y++) {
789 for (x = 0; x < width; x++)
790 dst[x] = src[x] << (14 - BIT_DEPTH);
796 #define QPEL_FILTER_1(src, stride) \
797 (1 * -src[x - 3 * stride] + \
798 4 * src[x - 2 * stride] - \
799 10 * src[x - stride] + \
801 17 * src[x + stride] - \
802 5 * src[x + 2 * stride] + \
803 1 * src[x + 3 * stride])
805 #define QPEL_FILTER_2(src, stride) \
806 (1 * -src[x - 3 * stride] + \
807 4 * src[x - 2 * stride] - \
808 11 * src[x - stride] + \
810 40 * src[x + stride] - \
811 11 * src[x + 2 * stride] + \
812 4 * src[x + 3 * stride] - \
813 1 * src[x + 4 * stride])
815 #define QPEL_FILTER_3(src, stride) \
816 (1 * src[x - 2 * stride] - \
817 5 * src[x - stride] + \
819 58 * src[x + stride] - \
820 10 * src[x + 2 * stride] + \
821 4 * src[x + 3 * stride] - \
822 1 * src[x + 4 * stride])
825 #define PUT_HEVC_QPEL_H(H) \
826 static void FUNC(put_hevc_qpel_h ## H)(int16_t *dst, ptrdiff_t dststride, \
827 uint8_t *_src, ptrdiff_t _srcstride, \
828 int width, int height, \
832 pixel *src = (pixel*)_src; \
833 ptrdiff_t srcstride = _srcstride / sizeof(pixel); \
835 for (y = 0; y < height; y++) { \
836 for (x = 0; x < width; x++) \
837 dst[x] = QPEL_FILTER_ ## H(src, 1) >> (BIT_DEPTH - 8); \
843 #define PUT_HEVC_QPEL_V(V) \
844 static void FUNC(put_hevc_qpel_v ## V)(int16_t *dst, ptrdiff_t dststride, \
845 uint8_t *_src, ptrdiff_t _srcstride, \
846 int width, int height, \
850 pixel *src = (pixel*)_src; \
851 ptrdiff_t srcstride = _srcstride / sizeof(pixel); \
853 for (y = 0; y < height; y++) { \
854 for (x = 0; x < width; x++) \
855 dst[x] = QPEL_FILTER_ ## V(src, srcstride) >> (BIT_DEPTH - 8); \
861 #define PUT_HEVC_QPEL_HV(H, V) \
862 static void FUNC(put_hevc_qpel_h ## H ## v ## V)(int16_t *dst, \
863 ptrdiff_t dststride, \
865 ptrdiff_t _srcstride, \
866 int width, int height, \
870 pixel *src = (pixel*)_src; \
871 ptrdiff_t srcstride = _srcstride / sizeof(pixel); \
873 int16_t tmp_array[(MAX_PB_SIZE + 7) * MAX_PB_SIZE]; \
874 int16_t *tmp = tmp_array; \
876 src -= ff_hevc_qpel_extra_before[V] * srcstride; \
878 for (y = 0; y < height + ff_hevc_qpel_extra[V]; y++) { \
879 for (x = 0; x < width; x++) \
880 tmp[x] = QPEL_FILTER_ ## H(src, 1) >> (BIT_DEPTH - 8); \
882 tmp += MAX_PB_SIZE; \
885 tmp = tmp_array + ff_hevc_qpel_extra_before[V] * MAX_PB_SIZE; \
887 for (y = 0; y < height; y++) { \
888 for (x = 0; x < width; x++) \
889 dst[x] = QPEL_FILTER_ ## V(tmp, MAX_PB_SIZE) >> 6; \
890 tmp += MAX_PB_SIZE; \
901 PUT_HEVC_QPEL_HV(1, 1)
902 PUT_HEVC_QPEL_HV(1, 2)
903 PUT_HEVC_QPEL_HV(1, 3)
904 PUT_HEVC_QPEL_HV(2, 1)
905 PUT_HEVC_QPEL_HV(2, 2)
906 PUT_HEVC_QPEL_HV(2, 3)
907 PUT_HEVC_QPEL_HV(3, 1)
908 PUT_HEVC_QPEL_HV(3, 2)
909 PUT_HEVC_QPEL_HV(3, 3)
912 static void FUNC(put_hevc_qpel_pixels_ ## W)(int16_t *dst, ptrdiff_t dststride, \
913 uint8_t *src, ptrdiff_t srcstride, \
914 int height, int mx, int my, \
917 FUNC(put_hevc_qpel_pixels)(dst, dststride, src, srcstride, W, height, \
921 static void FUNC(put_hevc_qpel_h_ ## W)(int16_t *dst, ptrdiff_t dststride, \
922 uint8_t *src, ptrdiff_t srcstride, \
923 int height, int mx, int my, \
927 FUNC(put_hevc_qpel_h1)(dst, dststride, src, srcstride, W, height, mcbuffer); \
929 FUNC(put_hevc_qpel_h2)(dst, dststride, src, srcstride, W, height, mcbuffer); \
931 FUNC(put_hevc_qpel_h3)(dst, dststride, src, srcstride, W, height, mcbuffer); \
934 static void FUNC(put_hevc_qpel_v_ ## W)(int16_t *dst, ptrdiff_t dststride, \
935 uint8_t *src, ptrdiff_t srcstride, \
936 int height, int mx, int my, \
940 FUNC(put_hevc_qpel_v1)(dst, dststride, src, srcstride, W, height, mcbuffer); \
942 FUNC(put_hevc_qpel_v2)(dst, dststride, src, srcstride, W, height, mcbuffer); \
944 FUNC(put_hevc_qpel_v3)(dst, dststride, src, srcstride, W, height, mcbuffer); \
947 static void FUNC(put_hevc_qpel_hv_ ## W)(int16_t *dst, ptrdiff_t dststride, \
948 uint8_t *src, ptrdiff_t srcstride, \
949 int height, int mx, int my, \
954 FUNC(put_hevc_qpel_h1v1)(dst, dststride, src, srcstride, W, height, mcbuffer); \
956 FUNC(put_hevc_qpel_h2v1)(dst, dststride, src, srcstride, W, height, mcbuffer); \
958 FUNC(put_hevc_qpel_h3v1)(dst, dststride, src, srcstride, W, height, mcbuffer); \
959 } else if (my == 2) { \
961 FUNC(put_hevc_qpel_h1v2)(dst, dststride, src, srcstride, W, height, mcbuffer); \
963 FUNC(put_hevc_qpel_h2v2)(dst, dststride, src, srcstride, W, height, mcbuffer); \
965 FUNC(put_hevc_qpel_h3v2)(dst, dststride, src, srcstride, W, height, mcbuffer); \
968 FUNC(put_hevc_qpel_h1v3)(dst, dststride, src, srcstride, W, height, mcbuffer); \
970 FUNC(put_hevc_qpel_h2v3)(dst, dststride, src, srcstride, W, height, mcbuffer); \
972 FUNC(put_hevc_qpel_h3v3)(dst, dststride, src, srcstride, W, height, mcbuffer); \
985 static inline void FUNC(put_hevc_epel_pixels)(int16_t *dst, ptrdiff_t dststride,
986 uint8_t *_src, ptrdiff_t _srcstride,
987 int width, int height, int mx, int my,
991 pixel *src = (pixel *)_src;
992 ptrdiff_t srcstride = _srcstride / sizeof(pixel);
994 for (y = 0; y < height; y++) {
995 for (x = 0; x < width; x++)
996 dst[x] = src[x] << (14 - BIT_DEPTH);
1002 #define EPEL_FILTER(src, stride) \
1003 (filter_0 * src[x - stride] + \
1004 filter_1 * src[x] + \
1005 filter_2 * src[x + stride] + \
1006 filter_3 * src[x + 2 * stride])
1008 static inline void FUNC(put_hevc_epel_h)(int16_t *dst, ptrdiff_t dststride,
1009 uint8_t *_src, ptrdiff_t _srcstride,
1010 int width, int height, int mx, int my,
1014 pixel *src = (pixel *)_src;
1015 ptrdiff_t srcstride = _srcstride / sizeof(pixel);
1016 const int8_t *filter = ff_hevc_epel_filters[mx - 1];
1017 int8_t filter_0 = filter[0];
1018 int8_t filter_1 = filter[1];
1019 int8_t filter_2 = filter[2];
1020 int8_t filter_3 = filter[3];
1021 for (y = 0; y < height; y++) {
1022 for (x = 0; x < width; x++)
1023 dst[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
1029 static inline void FUNC(put_hevc_epel_v)(int16_t *dst, ptrdiff_t dststride,
1030 uint8_t *_src, ptrdiff_t _srcstride,
1031 int width, int height, int mx, int my,
1035 pixel *src = (pixel *)_src;
1036 ptrdiff_t srcstride = _srcstride / sizeof(pixel);
1037 const int8_t *filter = ff_hevc_epel_filters[my - 1];
1038 int8_t filter_0 = filter[0];
1039 int8_t filter_1 = filter[1];
1040 int8_t filter_2 = filter[2];
1041 int8_t filter_3 = filter[3];
1043 for (y = 0; y < height; y++) {
1044 for (x = 0; x < width; x++)
1045 dst[x] = EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8);
1051 static inline void FUNC(put_hevc_epel_hv)(int16_t *dst, ptrdiff_t dststride,
1052 uint8_t *_src, ptrdiff_t _srcstride,
1053 int width, int height, int mx, int my,
1057 pixel *src = (pixel *)_src;
1058 ptrdiff_t srcstride = _srcstride / sizeof(pixel);
1059 const int8_t *filter_h = ff_hevc_epel_filters[mx - 1];
1060 const int8_t *filter_v = ff_hevc_epel_filters[my - 1];
1061 int8_t filter_0 = filter_h[0];
1062 int8_t filter_1 = filter_h[1];
1063 int8_t filter_2 = filter_h[2];
1064 int8_t filter_3 = filter_h[3];
1065 int16_t tmp_array[(MAX_PB_SIZE + 3) * MAX_PB_SIZE];
1066 int16_t *tmp = tmp_array;
1068 src -= EPEL_EXTRA_BEFORE * srcstride;
1070 for (y = 0; y < height + EPEL_EXTRA; y++) {
1071 for (x = 0; x < width; x++)
1072 tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
1077 tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE;
1078 filter_0 = filter_v[0];
1079 filter_1 = filter_v[1];
1080 filter_2 = filter_v[2];
1081 filter_3 = filter_v[3];
1082 for (y = 0; y < height; y++) {
1083 for (x = 0; x < width; x++)
1084 dst[x] = EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6;
1091 static void FUNC(put_hevc_epel_pixels_ ## W)(int16_t *dst, ptrdiff_t dststride, \
1092 uint8_t *src, ptrdiff_t srcstride, \
1093 int height, int mx, int my, \
1094 int16_t *mcbuffer) \
1096 FUNC(put_hevc_epel_pixels)(dst, dststride, src, srcstride, \
1097 W, height, mx, my, mcbuffer); \
1099 static void FUNC(put_hevc_epel_h_ ## W)(int16_t *dst, ptrdiff_t dststride, \
1100 uint8_t *src, ptrdiff_t srcstride, \
1101 int height, int mx, int my, \
1102 int16_t *mcbuffer) \
1104 FUNC(put_hevc_epel_h)(dst, dststride, src, srcstride, \
1105 W, height, mx, my, mcbuffer); \
1107 static void FUNC(put_hevc_epel_v_ ## W)(int16_t *dst, ptrdiff_t dststride, \
1108 uint8_t *src, ptrdiff_t srcstride, \
1109 int height, int mx, int my, \
1110 int16_t *mcbuffer) \
1112 FUNC(put_hevc_epel_v)(dst, dststride, src, srcstride, \
1113 W, height, mx, my, mcbuffer); \
1115 static void FUNC(put_hevc_epel_hv_ ## W)(int16_t *dst, ptrdiff_t dststride, \
1116 uint8_t *src, ptrdiff_t srcstride, \
1117 int height, int mx, int my, \
1118 int16_t *mcbuffer) \
1120 FUNC(put_hevc_epel_hv)(dst, dststride, src, srcstride, \
1121 W, height, mx, my, mcbuffer); \
1133 static av_always_inline void
1134 FUNC(put_unweighted_pred)(uint8_t *_dst, ptrdiff_t _dststride,
1135 int16_t *src, ptrdiff_t srcstride,
1136 int width, int height)
1139 pixel *dst = (pixel *)_dst;
1140 ptrdiff_t dststride = _dststride / sizeof(pixel);
1142 int shift = 14 - BIT_DEPTH;
1144 int offset = 1 << (shift - 1);
1148 for (y = 0; y < height; y++) {
1149 for (x = 0; x < width; x++)
1150 dst[x] = av_clip_pixel((src[x] + offset) >> shift);
1156 static av_always_inline void
1157 FUNC(put_unweighted_pred_avg)(uint8_t *_dst, ptrdiff_t _dststride,
1158 int16_t *src1, int16_t *src2,
1159 ptrdiff_t srcstride,
1160 int width, int height)
1163 pixel *dst = (pixel *)_dst;
1164 ptrdiff_t dststride = _dststride / sizeof(pixel);
1166 int shift = 14 + 1 - BIT_DEPTH;
1168 int offset = 1 << (shift - 1);
1173 for (y = 0; y < height; y++) {
1174 for (x = 0; x < width; x++)
1175 dst[x] = av_clip_pixel((src1[x] + src2[x] + offset) >> shift);
1182 static av_always_inline void
1183 FUNC(weighted_pred)(uint8_t denom, int16_t wlxFlag, int16_t olxFlag,
1184 uint8_t *_dst, ptrdiff_t _dststride,
1185 int16_t *src, ptrdiff_t srcstride,
1186 int width, int height)
1188 int shift, log2Wd, wx, ox, x, y, offset;
1189 pixel *dst = (pixel *)_dst;
1190 ptrdiff_t dststride = _dststride / sizeof(pixel);
1192 shift = 14 - BIT_DEPTH;
1193 log2Wd = denom + shift;
1194 offset = 1 << (log2Wd - 1);
1196 ox = olxFlag * (1 << (BIT_DEPTH - 8));
1198 for (y = 0; y < height; y++) {
1199 for (x = 0; x < width; x++) {
1201 dst[x] = av_clip_pixel(((src[x] * wx + offset) >> log2Wd) + ox);
1203 dst[x] = av_clip_pixel(src[x] * wx + ox);
1211 static av_always_inline void
1212 FUNC(weighted_pred_avg)(uint8_t denom,
1213 int16_t wl0Flag, int16_t wl1Flag,
1214 int16_t ol0Flag, int16_t ol1Flag,
1215 uint8_t *_dst, ptrdiff_t _dststride,
1216 int16_t *src1, int16_t *src2,
1217 ptrdiff_t srcstride,
1218 int width, int height)
1220 int shift, log2Wd, w0, w1, o0, o1, x, y;
1221 pixel *dst = (pixel *)_dst;
1222 ptrdiff_t dststride = _dststride / sizeof(pixel);
1224 shift = 14 - BIT_DEPTH;
1225 log2Wd = denom + shift;
1228 o0 = ol0Flag * (1 << (BIT_DEPTH - 8));
1229 o1 = ol1Flag * (1 << (BIT_DEPTH - 8));
1231 for (y = 0; y < height; y++) {
1232 for (x = 0; x < width; x++)
1233 dst[x] = av_clip_pixel((src1[x] * w0 + src2[x] * w1 +
1234 ((o0 + o1 + 1) << log2Wd)) >> (log2Wd + 1));
1241 #define PUT_PRED(w) \
1242 static void FUNC(put_unweighted_pred_ ## w)(uint8_t *dst, ptrdiff_t dststride, \
1243 int16_t *src, ptrdiff_t srcstride, \
1246 FUNC(put_unweighted_pred)(dst, dststride, src, srcstride, w, height); \
1248 static void FUNC(put_unweighted_pred_avg_ ## w)(uint8_t *dst, ptrdiff_t dststride, \
1249 int16_t *src1, int16_t *src2, \
1250 ptrdiff_t srcstride, int height) \
1252 FUNC(put_unweighted_pred_avg)(dst, dststride, src1, src2, srcstride, w, height); \
1254 static void FUNC(put_weighted_pred_ ## w)(uint8_t denom, int16_t weight, int16_t offset, \
1255 uint8_t *dst, ptrdiff_t dststride, \
1256 int16_t *src, ptrdiff_t srcstride, int height) \
1258 FUNC(weighted_pred)(denom, weight, offset, \
1259 dst, dststride, src, srcstride, w, height); \
1261 static void FUNC(put_weighted_pred_avg_ ## w)(uint8_t denom, int16_t weight0, int16_t weight1, \
1262 int16_t offset0, int16_t offset1, \
1263 uint8_t *dst, ptrdiff_t dststride, \
1264 int16_t *src1, int16_t *src2, \
1265 ptrdiff_t srcstride, int height) \
1267 FUNC(weighted_pred_avg)(denom, weight0, weight1, offset0, offset1, \
1268 dst, dststride, src1, src2, srcstride, w, height); \
1283 #define P3 pix[-4 * xstride]
1284 #define P2 pix[-3 * xstride]
1285 #define P1 pix[-2 * xstride]
1286 #define P0 pix[-1 * xstride]
1287 #define Q0 pix[0 * xstride]
1288 #define Q1 pix[1 * xstride]
1289 #define Q2 pix[2 * xstride]
1290 #define Q3 pix[3 * xstride]
1292 // line three. used only for deblocking decision
1293 #define TP3 pix[-4 * xstride + 3 * ystride]
1294 #define TP2 pix[-3 * xstride + 3 * ystride]
1295 #define TP1 pix[-2 * xstride + 3 * ystride]
1296 #define TP0 pix[-1 * xstride + 3 * ystride]
1297 #define TQ0 pix[0 * xstride + 3 * ystride]
1298 #define TQ1 pix[1 * xstride + 3 * ystride]
1299 #define TQ2 pix[2 * xstride + 3 * ystride]
1300 #define TQ3 pix[3 * xstride + 3 * ystride]
1302 static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix,
1303 ptrdiff_t _xstride, ptrdiff_t _ystride,
1305 uint8_t *_no_p, uint8_t *_no_q)
1308 pixel *pix = (pixel *)_pix;
1309 ptrdiff_t xstride = _xstride / sizeof(pixel);
1310 ptrdiff_t ystride = _ystride / sizeof(pixel);
1312 beta <<= BIT_DEPTH - 8;
1314 for (j = 0; j < 2; j++) {
1315 const int dp0 = abs(P2 - 2 * P1 + P0);
1316 const int dq0 = abs(Q2 - 2 * Q1 + Q0);
1317 const int dp3 = abs(TP2 - 2 * TP1 + TP0);
1318 const int dq3 = abs(TQ2 - 2 * TQ1 + TQ0);
1319 const int d0 = dp0 + dq0;
1320 const int d3 = dp3 + dq3;
1321 const int tc = _tc[j] << (BIT_DEPTH - 8);
1322 const int no_p = _no_p[j];
1323 const int no_q = _no_q[j];
1325 if (d0 + d3 >= beta) {
1329 const int beta_3 = beta >> 3;
1330 const int beta_2 = beta >> 2;
1331 const int tc25 = ((tc * 5 + 1) >> 1);
1333 if (abs(P3 - P0) + abs(Q3 - Q0) < beta_3 && abs(P0 - Q0) < tc25 &&
1334 abs(TP3 - TP0) + abs(TQ3 - TQ0) < beta_3 && abs(TP0 - TQ0) < tc25 &&
1335 (d0 << 1) < beta_2 && (d3 << 1) < beta_2) {
1337 const int tc2 = tc << 1;
1338 for (d = 0; d < 4; d++) {
1348 P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc2, tc2);
1349 P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2);
1350 P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc2, tc2);
1353 Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc2, tc2);
1354 Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2);
1355 Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc2, tc2);
1359 } else { // normal filtering
1362 const int tc_2 = tc >> 1;
1363 if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3))
1365 if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3))
1368 for (d = 0; d < 4; d++) {
1375 int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4;
1376 if (abs(delta0) < 10 * tc) {
1377 delta0 = av_clip(delta0, -tc, tc);
1379 P0 = av_clip_pixel(p0 + delta0);
1381 Q0 = av_clip_pixel(q0 - delta0);
1382 if (!no_p && nd_p > 1) {
1383 const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2);
1384 P1 = av_clip_pixel(p1 + deltap1);
1386 if (!no_q && nd_q > 1) {
1387 const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2);
1388 Q1 = av_clip_pixel(q1 + deltaq1);
1398 static void FUNC(hevc_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _xstride,
1399 ptrdiff_t _ystride, int *_tc,
1400 uint8_t *_no_p, uint8_t *_no_q)
1402 int d, j, no_p, no_q;
1403 pixel *pix = (pixel *)_pix;
1404 ptrdiff_t xstride = _xstride / sizeof(pixel);
1405 ptrdiff_t ystride = _ystride / sizeof(pixel);
1407 for (j = 0; j < 2; j++) {
1408 const int tc = _tc[j] << (BIT_DEPTH - 8);
1416 for (d = 0; d < 4; d++) {
1422 delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc);
1424 P0 = av_clip_pixel(p0 + delta0);
1426 Q0 = av_clip_pixel(q0 - delta0);
1432 static void FUNC(hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
1433 int *tc, uint8_t *no_p,
1436 FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel), tc, no_p, no_q);
1439 static void FUNC(hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
1440 int *tc, uint8_t *no_p,
1443 FUNC(hevc_loop_filter_chroma)(pix, sizeof(pixel), stride, tc, no_p, no_q);
1446 static void FUNC(hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
1447 int beta, int *tc, uint8_t *no_p,
1450 FUNC(hevc_loop_filter_luma)(pix, stride, sizeof(pixel),
1451 beta, tc, no_p, no_q);
1454 static void FUNC(hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
1455 int beta, int *tc, uint8_t *no_p,
1458 FUNC(hevc_loop_filter_luma)(pix, sizeof(pixel), stride,
1459 beta, tc, no_p, no_q);