static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src,

                                  ptrdiff_t stride, SAOParams *sao,

                                  int *borders, int width, int height,

                                  int c_idx, int class)

{

    pixel *dst = (pixel *)_dst;

    pixel *src = (pixel *)_src;

    int offset_table[32] = { 0 };

    int k, y, x;

    int chroma = !!c_idx;

    int shift  = BIT_DEPTH - 5;

    int *sao_offset_val = sao->offset_val[c_idx];

    int sao_left_class  = sao->band_position[c_idx];

    int init_y = 0, init_x = 0;



    stride /= sizeof(pixel);



    switch (class) {

    case 0:

        if (!borders[2])

            width -= (8 >> chroma) + 2;

        if (!borders[3])

            height -= (4 >> chroma) + 2;

        break;

    case 1:

        init_y = -(4 >> chroma) - 2;

        if (!borders[2])

            width -= (8 >> chroma) + 2;

        height = (4 >> chroma) + 2;

        break;

    case 2:

        init_x = -(8 >> chroma) - 2;

        width  =  (8 >> chroma) + 2;

        if (!borders[3])

            height -= (4 >> chroma) + 2;

        break;

    case 3:

        init_y = -(4 >> chroma) - 2;

        init_x = -(8 >> chroma) - 2;

        width  =  (8 >> chroma) + 2;

        height =  (4 >> chroma) + 2;

        break;

    }



    dst = dst + (init_y * stride + init_x);

    src = src + (init_y * stride + init_x);

    for (k = 0; k < 4; k++)

        offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];

    for (y = 0; y < height; y++) {

        for (x = 0; x < width; x++)

            dst[x] = av_clip_pixel(src[x] + offset_table[av_clip_pixel(src[x] >> shift)]);

        dst += stride;

        src += stride;

    }

}

static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src,

                                  ptrdiff_t stride, SAOParams *sao,

                                  int *borders, int width, int height,

                                  int c_idx, int class)

{

    pixel *dst = (pixel *)_dst;

    pixel *src = (pixel *)_src;

    int offset_table[32] = { 0 };

    int k, y, x;

    int chroma = !!c_idx;

    int shift  = BIT_DEPTH - 5;

    int *sao_offset_val = sao->offset_val[c_idx];

    int sao_left_class  = sao->band_position[c_idx];

    int init_y = 0, init_x = 0;



    stride /= sizeof(pixel);



    switch (class) {

    case 0:

        if (!borders[2])

            width -= (8 >> chroma) + 2;

        if (!borders[3])

            height -= (4 >> chroma) + 2;

        break;

    case 1:

        init_y = -(4 >> chroma) - 2;

        if (!borders[2])

            width -= (8 >> chroma) + 2;

        height = (4 >> chroma) + 2;

        break;

    case 2:

        init_x = -(8 >> chroma) - 2;

        width  =  (8 >> chroma) + 2;

        if (!borders[3])

            height -= (4 >> chroma) + 2;

        break;

    case 3:

        init_y = -(4 >> chroma) - 2;

        init_x = -(8 >> chroma) - 2;

        width  =  (8 >> chroma) + 2;

        height =  (4 >> chroma) + 2;

        break;

    }



    dst = dst + (init_y * stride + init_x);

    src = src + (init_y * stride + init_x);

    for (k = 0; k < 4; k++)

        offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];

    for (y = 0; y < height; y++) {

        for (x = 0; x < width; x++)

            dst[x] = av_clip_pixel(src[x] + offset_table[av_clip_pixel(src[x] >> shift)]);

        dst += stride;

        src += stride;

    }

}

static void FUNC_0(sao_band_filter)(uint8_t *_dst, uint8_t *_src,

                                  ptrdiff_t stride, SAOParams *sao,

                                  int *borders, int width, int height,

                                  int c_idx, int class)

{

    pixel *dst = (pixel *)_dst;

    pixel *src = (pixel *)_src;

    int VAR_0[32] = { 0 };

    int VAR_1, VAR_2, VAR_3;

    int VAR_4 = !!c_idx;

    int VAR_5  = BIT_DEPTH - 5;

    int *VAR_6 = sao->offset_val[c_idx];

    int VAR_7  = sao->band_position[c_idx];

    int VAR_8 = 0, VAR_9 = 0;



    stride /= sizeof(pixel);



    switch (class) {

    case 0:

        if (!borders[2])

            width -= (8 >> VAR_4) + 2;

        if (!borders[3])

            height -= (4 >> VAR_4) + 2;

        break;

    case 1:

        VAR_8 = -(4 >> VAR_4) - 2;

        if (!borders[2])

            width -= (8 >> VAR_4) + 2;

        height = (4 >> VAR_4) + 2;

        break;

    case 2:

        VAR_9 = -(8 >> VAR_4) - 2;

        width  =  (8 >> VAR_4) + 2;

        if (!borders[3])

            height -= (4 >> VAR_4) + 2;

        break;

    case 3:

        VAR_8 = -(4 >> VAR_4) - 2;

        VAR_9 = -(8 >> VAR_4) - 2;

        width  =  (8 >> VAR_4) + 2;

        height =  (4 >> VAR_4) + 2;

        break;

    }



    dst = dst + (VAR_8 * stride + VAR_9);

    src = src + (VAR_8 * stride + VAR_9);

    for (VAR_1 = 0; VAR_1 < 4; VAR_1++)

        VAR_0[(VAR_1 + VAR_7) & 31] = VAR_6[VAR_1 + 1];

    for (VAR_2 = 0; VAR_2 < height; VAR_2++) {

        for (VAR_3 = 0; VAR_3 < width; VAR_3++)

            dst[VAR_3] = av_clip_pixel(src[VAR_3] + VAR_0[av_clip_pixel(src[VAR_3] >> VAR_5)]);

        dst += stride;

        src += stride;

    }

}

static void FUNC_0(sao_band_filter)(uint8_t *_dst, uint8_t *_src,
ptrdiff_t stride, SAOParams *sao,
int *borders, int width, int height,
int c_idx, int class)
{ pixel *dst = (pixel *)_dst; pixel *src = (pixel *)_src; int VAR_0[32] = { 0 }; int VAR_1, VAR_2, VAR_3; int VAR_4 = !!c_idx; int VAR_5  = BIT_DEPTH - 5; int *VAR_6 = sao->offset_val[c_idx]; int VAR_7  = sao->band_position[c_idx]; int VAR_8 = 0, VAR_9 = 0; stride /= sizeof(pixel); switch (class) { case 0:
if (!borders[2])
width -= (8 >> VAR_4) + 2; if (!borders[3])
height -= (4 >> VAR_4) + 2; break; case 1:
VAR_8 = -(4 >> VAR_4) - 2; if (!borders[2])
width -= (8 >> VAR_4) + 2; height = (4 >> VAR_4) + 2; break; case 2:
VAR_9 = -(8 >> VAR_4) - 2; width  =  (8 >> VAR_4) + 2; if (!borders[3])
height -= (4 >> VAR_4) + 2; break; case 3:
VAR_8 = -(4 >> VAR_4) - 2; VAR_9 = -(8 >> VAR_4) - 2; width  =  (8 >> VAR_4) + 2; height =  (4 >> VAR_4) + 2; break; } dst = dst + (VAR_8 * stride + VAR_9); src = src + (VAR_8 * stride + VAR_9); for (VAR_1 = 0; VAR_1 < 4; VAR_1++) VAR_0[(VAR_1 + VAR_7) & 31] = VAR_6[VAR_1 + 1]; for (VAR_2 = 0; VAR_2 < height; VAR_2++) { for (VAR_3 = 0; VAR_3 < width; VAR_3++) dst[VAR_3] = av_clip_pixel(src[VAR_3] + VAR_0[av_clip_pixel(src[VAR_3] >> VAR_5)]); dst += stride; src += stride; } }