37     for (y = 0; y < 
height; y++) {
 
   38         for (x = 0; x < 
width; x++)
 
   52     for (y = 0; y < 
size; y++) {
 
   53         for (x = 0; x < 
size; x++) {
 
   87     int16_t *coeffs = (int16_t *) _coeffs;
 
   89     int size = 1 << log2_size;
 
   93         for (y = 0; y < 
size - 1; y++) {
 
   94             for (x = 0; x < 
size; x++)
 
   95                 coeffs[x] += coeffs[x - 
size];
 
   99         for (y = 0; y < 
size; y++) {
 
  100             for (x = 1; x < 
size; x++)
 
  101                 coeffs[x] += coeffs[x - 1];
 
  111     int size = 1 << log2_size;
 
  115         for (y = 0; y < 
size; y++) {
 
  116             for (x = 0; x < 
size; x++) {
 
  122         for (y = 0; y < 
size; y++) {
 
  123             for (x = 0; x < 
size; x++) {
 
  124                 *coeffs = *(uint16_t*)coeffs << -
shift;
 
  131 #define SET(dst, x)   (dst) = (x) 
  132 #define SCALE(dst, x) (dst) = av_clip_int16(((x) + add) >> shift) 
  134 #define TR_4x4_LUMA(dst, src, step, assign)                             \ 
  136         int c0 = src[0 * step] + src[2 * step];                         \ 
  137         int c1 = src[2 * step] + src[3 * step];                         \ 
  138         int c2 = src[0 * step] - src[3 * step];                         \ 
  139         int c3 = 74 * src[1 * step];                                    \ 
  141         assign(dst[2 * step], 74 * (src[0 * step] -                     \ 
  144         assign(dst[0 * step], 29 * c0 + 55 * c1 + c3);                  \ 
  145         assign(dst[1 * step], 55 * c2 - 29 * c1 + c3);                  \ 
  146         assign(dst[3 * step], 55 * c0 + 29 * c2 - c3);                  \ 
  154     int16_t *
src = coeffs;
 
  156     for (
i = 0; 
i < 4; 
i++) {
 
  163     for (
i = 0; 
i < 4; 
i++) {
 
  171 #define TR_4(dst, src, dstep, sstep, assign, end)                 \ 
  173         const int e0 = 64 * src[0 * sstep] + 64 * src[2 * sstep]; \ 
  174         const int e1 = 64 * src[0 * sstep] - 64 * src[2 * sstep]; \ 
  175         const int o0 = 83 * src[1 * sstep] + 36 * src[3 * sstep]; \ 
  176         const int o1 = 36 * src[1 * sstep] - 83 * src[3 * sstep]; \ 
  178         assign(dst[0 * dstep], e0 + o0);                          \ 
  179         assign(dst[1 * dstep], e1 + o1);                          \ 
  180         assign(dst[2 * dstep], e1 - o1);                          \ 
  181         assign(dst[3 * dstep], e0 - o0);                          \ 
  184 #define TR_8(dst, src, dstep, sstep, assign, end)                 \ 
  188         int o_8[4] = { 0 };                                       \ 
  189         for (i = 0; i < 4; i++)                                   \ 
  190             for (j = 1; j < end; j += 2)                          \ 
  191                 o_8[i] += transform[4 * j][i] * src[j * sstep];   \ 
  192         TR_4(e_8, src, 1, 2 * sstep, SET, 4);                     \ 
  194         for (i = 0; i < 4; i++) {                                 \ 
  195             assign(dst[i * dstep], e_8[i] + o_8[i]);              \ 
  196             assign(dst[(7 - i) * dstep], e_8[i] - o_8[i]);        \ 
  200 #define TR_16(dst, src, dstep, sstep, assign, end)                \ 
  204         int o_16[8] = { 0 };                                      \ 
  205         for (i = 0; i < 8; i++)                                   \ 
  206             for (j = 1; j < end; j += 2)                          \ 
  207                 o_16[i] += transform[2 * j][i] * src[j * sstep];  \ 
  208         TR_8(e_16, src, 1, 2 * sstep, SET, 8);                    \ 
  210         for (i = 0; i < 8; i++) {                                 \ 
  211             assign(dst[i * dstep], e_16[i] + o_16[i]);            \ 
  212             assign(dst[(15 - i) * dstep], e_16[i] - o_16[i]);     \ 
  216 #define TR_32(dst, src, dstep, sstep, assign, end)                \ 
  220         int o_32[16] = { 0 };                                     \ 
  221         for (i = 0; i < 16; i++)                                  \ 
  222             for (j = 1; j < end; j += 2)                          \ 
  223                 o_32[i] += transform[j][i] * src[j * sstep];      \ 
  224         TR_16(e_32, src, 1, 2 * sstep, SET, end / 2);             \ 
  226         for (i = 0; i < 16; i++) {                                \ 
  227             assign(dst[i * dstep], e_32[i] + o_32[i]);            \ 
  228             assign(dst[(31 - i) * dstep], e_32[i] - o_32[i]);     \ 
  232 #define IDCT_VAR4(H)                                              \ 
  233     int limit2 = FFMIN(col_limit + 4, H) 
  234 #define IDCT_VAR8(H)                                              \ 
  235     int limit  = FFMIN(col_limit, H);                             \ 
  236     int limit2 = FFMIN(col_limit + 4, H) 
  237 #define IDCT_VAR16(H)   IDCT_VAR8(H) 
  238 #define IDCT_VAR32(H)   IDCT_VAR8(H) 
  241 static void FUNC(idct_ ## H ## x ## H )(int16_t *coeffs,          \ 
  246     int      add   = 1 << (shift - 1);                            \ 
  247     int16_t *src   = coeffs;                                      \ 
  250     for (i = 0; i < H; i++) {                                     \ 
  251         TR_ ## H(src, src, H, H, SCALE, limit2);                  \ 
  252         if (limit2 < H && i%4 == 0 && !!i)                        \ 
  257     shift = 20 - BIT_DEPTH;                                       \ 
  258     add   = 1 << (shift - 1);                                     \ 
  259     for (i = 0; i < H; i++) {                                     \ 
  260         TR_ ## H(coeffs, coeffs, 1, 1, SCALE, limit);             \ 
  266 static void FUNC(idct_ ## H ## x ## H ## _dc)(int16_t *coeffs)    \ 
  269     int shift = 14 - BIT_DEPTH;                                   \ 
  270     int add   = 1 << (shift - 1);                                 \ 
  271     int coeff = (((coeffs[0] + 1) >> 1) + add) >> shift;          \ 
  273     for (j = 0; j < H; j++) {                                     \ 
  274         for (i = 0; i < H; i++) {                                 \ 
  275             coeffs[i + j * H] = coeff;                            \ 
  299                                   ptrdiff_t stride_dst, ptrdiff_t stride_src,
 
  300                                   int16_t *sao_offset_val, 
int sao_left_class,
 
  309     stride_dst /= 
sizeof(
pixel);
 
  310     stride_src /= 
sizeof(
pixel);
 
  312     for (k = 0; k < 4; k++)
 
  313         offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
 
  314     for (y = 0; y < 
height; y++) {
 
  315         for (x = 0; x < 
width; x++)
 
  322 #define CMP(a, b) (((a) > (b)) - ((a) < (b))) 
  324 static void FUNC(
sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val,
 
  327     static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
 
  328     static const int8_t 
pos[4][2][2] = {
 
  329         { { -1,  0 }, {  1, 0 } }, 
 
  330         { {  0, -1 }, {  0, 1 } }, 
 
  331         { { -1, -1 }, {  1, 1 } }, 
 
  332         { {  1, -1 }, { -1, 1 } }, 
 
  336     int a_stride, b_stride;
 
  339     stride_dst /= 
sizeof(
pixel);
 
  341     a_stride = 
pos[eo][0][0] + 
pos[eo][0][1] * stride_src;
 
  342     b_stride = 
pos[eo][1][0] + 
pos[eo][1][1] * stride_src;
 
  343     for (y = 0; y < 
height; y++) {
 
  344         for (x = 0; x < 
width; x++) {
 
  345             int diff0 = 
CMP(
src[x], 
src[x + a_stride]);
 
  346             int diff1 = 
CMP(
src[x], 
src[x + b_stride]);
 
  356                                     ptrdiff_t stride_dst, ptrdiff_t stride_src, 
SAOParams *sao,
 
  357                                     int *borders, 
int _width, 
int _height,
 
  358                                     int c_idx, uint8_t *vert_edge,
 
  359                                     uint8_t *horiz_edge, uint8_t *diag_edge)
 
  364     int16_t *sao_offset_val = sao->offset_val[c_idx];
 
  365     int sao_eo_class    = sao->eo_class[c_idx];
 
  368     stride_dst /= 
sizeof(
pixel);
 
  369     stride_src /= 
sizeof(
pixel);
 
  374             for (y = 0; y < 
height; y++) {
 
  382             for (x = 0; x < 
height; x++) {
 
  391             for (x = init_x; x < 
width; x++)
 
  396             ptrdiff_t y_stride_dst = stride_dst * (
height - 1);
 
  397             ptrdiff_t y_stride_src = stride_src * (
height - 1);
 
  398             for (x = init_x; x < 
width; x++)
 
  406                                     ptrdiff_t stride_dst, ptrdiff_t stride_src, 
SAOParams *sao,
 
  407                                     int *borders, 
int _width, 
int _height,
 
  408                                     int c_idx, uint8_t *vert_edge,
 
  409                                     uint8_t *horiz_edge, uint8_t *diag_edge)
 
  414     int16_t *sao_offset_val = sao->offset_val[c_idx];
 
  415     int sao_eo_class    = sao->eo_class[c_idx];
 
  416     int init_x = 0, init_y = 0, 
width = _width, 
height = _height;
 
  418     stride_dst /= 
sizeof(
pixel);
 
  419     stride_src /= 
sizeof(
pixel);
 
  424             for (y = 0; y < 
height; y++) {
 
  432             for (x = 0; x < 
height; x++) {
 
  441             for (x = init_x; x < 
width; x++)
 
  447             ptrdiff_t y_stride_dst = stride_dst * (
height - 1);
 
  448             ptrdiff_t y_stride_src = stride_src * (
height - 1);
 
  449             for (x = init_x; x < 
width; x++)
 
  456         int save_upper_left  = !diag_edge[0] && sao_eo_class == 
SAO_EO_135D && !borders[0] && !borders[1];
 
  457         int save_upper_right = !diag_edge[1] && sao_eo_class == 
SAO_EO_45D  && !borders[1] && !borders[2];
 
  458         int save_lower_right = !diag_edge[2] && sao_eo_class == 
SAO_EO_135D && !borders[2] && !borders[3];
 
  459         int save_lower_left  = !diag_edge[3] && sao_eo_class == 
SAO_EO_45D  && !borders[0] && !borders[3];
 
  463             for(y = init_y+save_upper_left; y< 
height-save_lower_left; y++)
 
  464                 dst[y*stride_dst] = 
src[y*stride_src];
 
  467             for(y = init_y+save_upper_right; y< 
height-save_lower_right; y++)
 
  472             for(x = init_x+save_upper_left; x < 
width-save_upper_right; x++)
 
  476             for(x = init_x+save_lower_left; x < 
width-save_lower_right; x++)
 
  481         if(diag_edge[1] && sao_eo_class == 
SAO_EO_45D)
 
  485         if(diag_edge[3] && sao_eo_class == 
SAO_EO_45D)
 
  497                                       uint8_t *_src, ptrdiff_t _srcstride,
 
  502     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
  504     for (y = 0; y < 
height; y++) {
 
  505         for (x = 0; x < 
width; x++)
 
  517     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
  519     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  521     for (y = 0; y < 
height; y++) {
 
  534     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
  536     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  545     for (y = 0; y < 
height; y++) {
 
  546         for (x = 0; x < 
width; x++)
 
  555                                             int height, 
int denom, 
int wx, 
int ox, intptr_t mx, intptr_t my, 
int width)
 
  559     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
  561     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  570     for (y = 0; y < 
height; y++) {
 
  571         for (x = 0; x < 
width; x++)
 
  580                                            int height, 
int denom, 
int wx0, 
int wx1,
 
  581                                            int ox0, 
int ox1, intptr_t mx, intptr_t my, 
int width)
 
  585     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
  587     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  590     int log2Wd = denom + 
shift - 1;
 
  594     for (y = 0; y < 
height; y++) {
 
  595         for (x = 0; x < 
width; x++) {
 
  596             dst[x] = 
av_clip_pixel(( (
src[x] << (14 - 
BIT_DEPTH)) * wx1 + src2[x] * wx0 + (ox0 + ox1 + 1) * (1 << log2Wd)) >> (log2Wd + 1));
 
  607 #define QPEL_FILTER(src, stride)                                               \ 
  608     (filter[0] * src[x - 3 * stride] +                                         \ 
  609      filter[1] * src[x - 2 * stride] +                                         \ 
  610      filter[2] * src[x -     stride] +                                         \ 
  611      filter[3] * src[x             ] +                                         \ 
  612      filter[4] * src[x +     stride] +                                         \ 
  613      filter[5] * src[x + 2 * stride] +                                         \ 
  614      filter[6] * src[x + 3 * stride] +                                         \ 
  615      filter[7] * src[x + 4 * stride]) 
  618                                   uint8_t *_src, ptrdiff_t _srcstride,
 
  623     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  625     for (y = 0; y < 
height; y++) {
 
  626         for (x = 0; x < 
width; x++)
 
  634                                   uint8_t *_src, ptrdiff_t _srcstride,
 
  639     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  641     for (y = 0; y < 
height; y++)  {
 
  642         for (x = 0; x < 
width; x++)
 
  651                                    ptrdiff_t _srcstride,
 
  653                                    intptr_t my, 
int width)
 
  658     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
  660     int16_t *
tmp = tmp_array;
 
  665         for (x = 0; x < 
width; x++)
 
  673     for (y = 0; y < 
height; y++) {
 
  674         for (x = 0; x < 
width; x++)
 
  682                                       uint8_t *_src, ptrdiff_t _srcstride,
 
  687     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  689     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  699     for (y = 0; y < 
height; y++) {
 
  700         for (x = 0; x < 
width; x++)
 
  713     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  715     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  726     for (y = 0; y < 
height; y++) {
 
  727         for (x = 0; x < 
width; x++)
 
  736                                      uint8_t *_src, ptrdiff_t _srcstride,
 
  741     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  743     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  753     for (y = 0; y < 
height; y++) {
 
  754         for (x = 0; x < 
width; x++)
 
  768     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  770     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  781     for (y = 0; y < 
height; y++) {
 
  782         for (x = 0; x < 
width; x++)
 
  791                                        uint8_t *_src, ptrdiff_t _srcstride,
 
  797     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
  799     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  801     int16_t *
tmp = tmp_array;
 
  813         for (x = 0; x < 
width; x++)
 
  822     for (y = 0; y < 
height; y++) {
 
  823         for (x = 0; x < 
width; x++)
 
  837     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
  839     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  841     int16_t *
tmp = tmp_array;
 
  852         for (x = 0; x < 
width; x++)
 
  861     for (y = 0; y < 
height; y++) {
 
  862         for (x = 0; x < 
width; x++)
 
  871                                         uint8_t *_src, ptrdiff_t _srcstride,
 
  872                                         int height, 
int denom, 
int wx, 
int ox,
 
  873                                         intptr_t mx, intptr_t my, 
int width)
 
  877     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  879     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  889     for (y = 0; y < 
height; y++) {
 
  890         for (x = 0; x < 
width; x++)
 
  899                                        int height, 
int denom, 
int wx0, 
int wx1,
 
  900                                        int ox0, 
int ox1, intptr_t mx, intptr_t my, 
int width)
 
  904     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  906     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  911     int log2Wd = denom + 
shift - 1;
 
  915     for (y = 0; y < 
height; y++) {
 
  916         for (x = 0; x < 
width; x++)
 
  918                                     ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
 
  926                                         uint8_t *_src, ptrdiff_t _srcstride,
 
  927                                         int height, 
int denom, 
int wx, 
int ox,
 
  928                                         intptr_t mx, intptr_t my, 
int width)
 
  932     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  934     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  944     for (y = 0; y < 
height; y++) {
 
  945         for (x = 0; x < 
width; x++)
 
  954                                        int height, 
int denom, 
int wx0, 
int wx1,
 
  955                                        int ox0, 
int ox1, intptr_t mx, intptr_t my, 
int width)
 
  959     ptrdiff_t     srcstride = _srcstride / 
sizeof(
pixel);
 
  961     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  966     int log2Wd = denom + 
shift - 1;
 
  970     for (y = 0; y < 
height; y++) {
 
  971         for (x = 0; x < 
width; x++)
 
  973                                     ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
 
  981                                          uint8_t *_src, ptrdiff_t _srcstride,
 
  982                                          int height, 
int denom, 
int wx, 
int ox,
 
  983                                          intptr_t mx, intptr_t my, 
int width)
 
  988     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
  990     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
  992     int16_t *
tmp = tmp_array;
 
 1003         for (x = 0; x < 
width; x++)
 
 1013     for (y = 0; y < 
height; y++) {
 
 1014         for (x = 0; x < 
width; x++)
 
 1023                                         int height, 
int denom, 
int wx0, 
int wx1,
 
 1024                                         int ox0, 
int ox1, intptr_t mx, intptr_t my, 
int width)
 
 1029     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
 1031     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1033     int16_t *
tmp = tmp_array;
 
 1035     int log2Wd = denom + 
shift - 1;
 
 1040         for (x = 0; x < 
width; x++)
 
 1051     for (y = 0; y < 
height; y++) {
 
 1052         for (x = 0; x < 
width; x++)
 
 1054                                     ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
 
 1064 #define EPEL_FILTER(src, stride)                                               \ 
 1065     (filter[0] * src[x - stride] +                                             \ 
 1066      filter[1] * src[x]          +                                             \ 
 1067      filter[2] * src[x + stride] +                                             \ 
 1068      filter[3] * src[x + 2 * stride]) 
 1071                                   uint8_t *_src, ptrdiff_t _srcstride,
 
 1076     ptrdiff_t srcstride  = _srcstride / 
sizeof(
pixel);
 
 1078     for (y = 0; y < 
height; y++) {
 
 1079         for (x = 0; x < 
width; x++)
 
 1087                                   uint8_t *_src, ptrdiff_t _srcstride,
 
 1092     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
 1095     for (y = 0; y < 
height; y++) {
 
 1096         for (x = 0; x < 
width; x++)
 
 1104                                    uint8_t *_src, ptrdiff_t _srcstride,
 
 1109     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
 1112     int16_t *
tmp = tmp_array;
 
 1117         for (x = 0; x < 
width; x++)
 
 1126     for (y = 0; y < 
height; y++) {
 
 1127         for (x = 0; x < 
width; x++)
 
 1139     ptrdiff_t srcstride  = _srcstride / 
sizeof(
pixel);
 
 1141     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1150     for (y = 0; y < 
height; y++) {
 
 1151         for (x = 0; x < 
width; x++)
 
 1164     ptrdiff_t srcstride  = _srcstride / 
sizeof(
pixel);
 
 1166     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1175     for (y = 0; y < 
height; y++) {
 
 1176         for (x = 0; x < 
width; x++) {
 
 1190     ptrdiff_t srcstride  = _srcstride / 
sizeof(
pixel);
 
 1192     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1201     for (y = 0; y < 
height; y++) {
 
 1202         for (x = 0; x < 
width; x++)
 
 1215     ptrdiff_t srcstride  = _srcstride / 
sizeof(
pixel);
 
 1218     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1226     for (y = 0; y < 
height; y++) {
 
 1227         for (x = 0; x < 
width; x++)
 
 1240     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
 1242     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1245     int16_t *
tmp = tmp_array;
 
 1256         for (x = 0; x < 
width; x++)
 
 1265     for (y = 0; y < 
height; y++) {
 
 1266         for (x = 0; x < 
width; x++)
 
 1279     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
 1281     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1284     int16_t *
tmp = tmp_array;
 
 1295         for (x = 0; x < 
width; x++)
 
 1304     for (y = 0; y < 
height; y++) {
 
 1305         for (x = 0; x < 
width; x++)
 
 1314                                         int height, 
int denom, 
int wx, 
int ox, intptr_t mx, intptr_t my, 
int width)
 
 1318     ptrdiff_t srcstride  = _srcstride / 
sizeof(
pixel);
 
 1320     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1330     for (y = 0; y < 
height; y++) {
 
 1331         for (x = 0; x < 
width; x++) {
 
 1341                                        int height, 
int denom, 
int wx0, 
int wx1,
 
 1342                                        int ox0, 
int ox1, intptr_t mx, intptr_t my, 
int width)
 
 1346     ptrdiff_t srcstride  = _srcstride / 
sizeof(
pixel);
 
 1348     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1351     int log2Wd = denom + 
shift - 1;
 
 1355     for (y = 0; y < 
height; y++) {
 
 1356         for (x = 0; x < 
width; x++)
 
 1358                                     ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
 
 1366                                         int height, 
int denom, 
int wx, 
int ox, intptr_t mx, intptr_t my, 
int width)
 
 1370     ptrdiff_t srcstride  = _srcstride / 
sizeof(
pixel);
 
 1372     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1382     for (y = 0; y < 
height; y++) {
 
 1383         for (x = 0; x < 
width; x++) {
 
 1393                                        int height, 
int denom, 
int wx0, 
int wx1,
 
 1394                                        int ox0, 
int ox1, intptr_t mx, intptr_t my, 
int width)
 
 1398     ptrdiff_t srcstride  = _srcstride / 
sizeof(
pixel);
 
 1401     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1403     int log2Wd = denom + 
shift - 1;
 
 1407     for (y = 0; y < 
height; y++) {
 
 1408         for (x = 0; x < 
width; x++)
 
 1410                                     ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
 
 1418                                          int height, 
int denom, 
int wx, 
int ox, intptr_t mx, intptr_t my, 
int width)
 
 1422     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
 1424     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1427     int16_t *
tmp = tmp_array;
 
 1438         for (x = 0; x < 
width; x++)
 
 1448     for (y = 0; y < 
height; y++) {
 
 1449         for (x = 0; x < 
width; x++)
 
 1458                                         int height, 
int denom, 
int wx0, 
int wx1,
 
 1459                                         int ox0, 
int ox1, intptr_t mx, intptr_t my, 
int width)
 
 1463     ptrdiff_t srcstride = _srcstride / 
sizeof(
pixel);
 
 1465     ptrdiff_t dststride = _dststride / 
sizeof(
pixel);
 
 1468     int16_t *
tmp = tmp_array;
 
 1470     int log2Wd = denom + 
shift - 1;
 
 1475         for (x = 0; x < 
width; x++)
 
 1486     for (y = 0; y < 
height; y++) {
 
 1487         for (x = 0; x < 
width; x++)
 
 1489                                     ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
 
 1497 #define P3 pix[-4 * xstride] 
 1498 #define P2 pix[-3 * xstride] 
 1499 #define P1 pix[-2 * xstride] 
 1500 #define P0 pix[-1 * xstride] 
 1501 #define Q0 pix[0 * xstride] 
 1502 #define Q1 pix[1 * xstride] 
 1503 #define Q2 pix[2 * xstride] 
 1504 #define Q3 pix[3 * xstride] 
 1507 #define TP3 pix[-4 * xstride + 3 * ystride] 
 1508 #define TP2 pix[-3 * xstride + 3 * ystride] 
 1509 #define TP1 pix[-2 * xstride + 3 * ystride] 
 1510 #define TP0 pix[-1 * xstride + 3 * ystride] 
 1511 #define TQ0 pix[0  * xstride + 3 * ystride] 
 1512 #define TQ1 pix[1  * xstride + 3 * ystride] 
 1513 #define TQ2 pix[2  * xstride + 3 * ystride] 
 1514 #define TQ3 pix[3  * xstride + 3 * ystride] 
 1517                                         ptrdiff_t _xstride, ptrdiff_t _ystride,
 
 1519                                         uint8_t *_no_p, uint8_t *_no_q)
 
 1523     ptrdiff_t xstride = _xstride / 
sizeof(
pixel);
 
 1524     ptrdiff_t ystride = _ystride / 
sizeof(
pixel);
 
 1528     for (j = 0; j < 2; j++) {
 
 1533         const int d0   = dp0 + dq0;
 
 1534         const int d3   = dp3 + dq3;
 
 1536         const int no_p = _no_p[j];
 
 1537         const int no_q = _no_q[j];
 
 1539         if (d0 + d3 >= beta) {
 
 1543             const int beta_3 = beta >> 3;
 
 1544             const int beta_2 = beta >> 2;
 
 1545             const int tc25   = ((
tc * 5 + 1) >> 1);
 
 1549                                       (d0 << 1) < beta_2 &&      (d3 << 1) < beta_2) {
 
 1551                 const int tc2 = 
tc << 1;
 
 1552                 for (
d = 0; 
d < 4; 
d++) {
 
 1562                         P0 = p0 + 
av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * 
q0 + 
q1 + 4) >> 3) - p0, -tc2, tc2);
 
 1563                         P1 = p1 + 
av_clip(((p2 + p1 + p0 + 
q0 + 2) >> 2) - p1, -tc2, tc2);
 
 1564                         P2 = p2 + 
av_clip(((2 * p3 + 3 * p2 + p1 + p0 + 
q0 + 4) >> 3) - p2, -tc2, tc2);
 
 1567                         Q0 = 
q0 + 
av_clip(((p1 + 2 * p0 + 2 * 
q0 + 2 * 
q1 + q2 + 4) >> 3) - 
q0, -tc2, tc2);
 
 1569                         Q2 = q2 + 
av_clip(((2 * q3 + 3 * q2 + 
q1 + 
q0 + p0 + 4) >> 3) - q2, -tc2, tc2);
 
 1576                 const int tc_2 = 
tc >> 1;
 
 1577                 if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3))
 
 1579                 if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3))
 
 1582                 for (
d = 0; 
d < 4; 
d++) {
 
 1589                     int delta0   = (9 * (
q0 - p0) - 3 * (
q1 - p1) + 8) >> 4;
 
 1590                     if (
abs(delta0) < 10 * 
tc) {
 
 1596                         if (!no_p && nd_p > 1) {
 
 1597                             const int deltap1 = 
av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2);
 
 1600                         if (!no_q && nd_q > 1) {
 
 1601                             const int deltaq1 = 
av_clip((((q2 + 
q0 + 1) >> 1) - 
q1 - delta0) >> 1, -tc_2, tc_2);
 
 1613                                           ptrdiff_t _ystride, 
int *_tc,
 
 1614                                           uint8_t *_no_p, uint8_t *_no_q)
 
 1616     int d, j, no_p, no_q;
 
 1618     ptrdiff_t xstride = _xstride / 
sizeof(
pixel);
 
 1619     ptrdiff_t ystride = _ystride / 
sizeof(
pixel);
 
 1621     for (j = 0; j < 2; j++) {
 
 1630         for (
d = 0; 
d < 4; 
d++) {
 
 1665                                 beta, 
tc, no_p, no_q);
 
 1673                                 beta, 
tc, no_p, no_q);