static void filter(SPPContext *p, uint8_t *dst, uint8_t *src,

                   int dst_linesize, int src_linesize, int width, int height,

                   const uint8_t *qp_table, int qp_stride, int is_luma, int sample_bytes)

{

    int x, y, i;

    const int count = 1 << p->log2_count;

    const int linesize = is_luma ? p->temp_linesize : FFALIGN(width+16, 16);

    DECLARE_ALIGNED(16, uint64_t, block_align)[32];

    int16_t *block  = (int16_t *)block_align;

    int16_t *block2 = (int16_t *)(block_align + 16);

    uint16_t *psrc16 = (uint16_t*)p->src;



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

        int index = 8 + 8*linesize + y*linesize;

        memcpy(p->src + index*sample_bytes, src + y*src_linesize, width*sample_bytes);

        if (sample_bytes == 1) {

            for (x = 0; x < 8; x++) {

                p->src[index         - x - 1] = p->src[index +         x    ];

                p->src[index + width + x    ] = p->src[index + width - x - 1];

            }

        } else {

            for (x = 0; x < 8; x++) {

                psrc16[index         - x - 1] = psrc16[index +         x    ];

                psrc16[index + width + x    ] = psrc16[index + width - x - 1];

            }

        }

    }

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

        memcpy(p->src + (       7-y)*linesize * sample_bytes, p->src + (       y+8)*linesize * sample_bytes, linesize * sample_bytes);

        memcpy(p->src + (height+8+y)*linesize * sample_bytes, p->src + (height-y+7)*linesize * sample_bytes, linesize * sample_bytes);

    }



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

        memset(p->temp + (8 + y) * linesize, 0, 8 * linesize * sizeof(*p->temp));

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

            int qp;



            if (p->qp) {

                qp = p->qp;

            } else{

                const int qps = 3 + is_luma;

                qp = qp_table[(FFMIN(x, width - 1) >> qps) + (FFMIN(y, height - 1) >> qps) * qp_stride];

                qp = FFMAX(1, norm_qscale(qp, p->qscale_type));

            }

            for (i = 0; i < count; i++) {

                const int x1 = x + offset[i + count - 1][0];

                const int y1 = y + offset[i + count - 1][1];

                const int index = x1 + y1*linesize;

                p->dct->get_pixels(block, p->src + sample_bytes*index, sample_bytes*linesize);

                p->dct->fdct(block);

                p->requantize(block2, block, qp, p->dct->idct_permutation);

                p->dct->idct(block2);

                add_block(p->temp + index, linesize, block2);

            }

        }

        if (y) {

            if (sample_bytes == 1) {

                p->store_slice(dst + (y - 8) * dst_linesize, p->temp + 8 + y*linesize,

                               dst_linesize, linesize, width,

                               FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count,

                               ldither);

            } else {

                store_slice16_c((uint16_t*)(dst + (y - 8) * dst_linesize), p->temp + 8 + y*linesize,

                                dst_linesize/2, linesize, width,

                                FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count,

                                ldither);

            }

        }

    }

}

static void filter(SPPContext *p, uint8_t *dst, uint8_t *src,

                   int dst_linesize, int src_linesize, int width, int height,

                   const uint8_t *qp_table, int qp_stride, int is_luma, int sample_bytes)

{

    int x, y, i;

    const int count = 1 << p->log2_count;

    const int linesize = is_luma ? p->temp_linesize : FFALIGN(width+16, 16);

    DECLARE_ALIGNED(16, uint64_t, block_align)[32];

    int16_t *block  = (int16_t *)block_align;

    int16_t *block2 = (int16_t *)(block_align + 16);

    uint16_t *psrc16 = (uint16_t*)p->src;



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

        int index = 8 + 8*linesize + y*linesize;

        memcpy(p->src + index*sample_bytes, src + y*src_linesize, width*sample_bytes);

        if (sample_bytes == 1) {

            for (x = 0; x < 8; x++) {

                p->src[index         - x - 1] = p->src[index +         x    ];

                p->src[index + width + x    ] = p->src[index + width - x - 1];

            }

        } else {

            for (x = 0; x < 8; x++) {

                psrc16[index         - x - 1] = psrc16[index +         x    ];

                psrc16[index + width + x    ] = psrc16[index + width - x - 1];

            }

        }

    }

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

        memcpy(p->src + (       7-y)*linesize * sample_bytes, p->src + (       y+8)*linesize * sample_bytes, linesize * sample_bytes);

        memcpy(p->src + (height+8+y)*linesize * sample_bytes, p->src + (height-y+7)*linesize * sample_bytes, linesize * sample_bytes);

    }



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

        memset(p->temp + (8 + y) * linesize, 0, 8 * linesize * sizeof(*p->temp));

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

            int qp;



            if (p->qp) {

                qp = p->qp;

            } else{

                const int qps = 3 + is_luma;

                qp = qp_table[(FFMIN(x, width - 1) >> qps) + (FFMIN(y, height - 1) >> qps) * qp_stride];

                qp = FFMAX(1, norm_qscale(qp, p->qscale_type));

            }

            for (i = 0; i < count; i++) {

                const int x1 = x + offset[i + count - 1][0];

                const int y1 = y + offset[i + count - 1][1];

                const int index = x1 + y1*linesize;

                p->dct->get_pixels(block, p->src + sample_bytes*index, sample_bytes*linesize);

                p->dct->fdct(block);

                p->requantize(block2, block, qp, p->dct->idct_permutation);

                p->dct->idct(block2);

                add_block(p->temp + index, linesize, block2);

            }

        }

        if (y) {

            if (sample_bytes == 1) {

                p->store_slice(dst + (y - 8) * dst_linesize, p->temp + 8 + y*linesize,

                               dst_linesize, linesize, width,

                               FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count,

                               ldither);

            } else {

                store_slice16_c((uint16_t*)(dst + (y - 8) * dst_linesize), p->temp + 8 + y*linesize,

                                dst_linesize/2, linesize, width,

                                FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count,

                                ldither);

            }

        }

    }

}

                   const uint8_t *qp_table, int qp_stride, int is_luma, int sample_bytes)                                 ldither);
static void FUNC_0(SPPContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2,

                   int VAR_3, int VAR_4, int VAR_5, int VAR_6,

                   const uint8_t *VAR_7, int VAR_8, int VAR_9, int VAR_10)

{

    int VAR_11, VAR_12, VAR_13;

    const int VAR_14 = 1 << VAR_0->log2_count;

    const int VAR_15 = VAR_9 ? VAR_0->temp_linesize : FFALIGN(VAR_5+16, 16);

    DECLARE_ALIGNED(16, uint64_t, block_align)[32];

    int16_t *block  = (int16_t *)block_align;

    int16_t *block2 = (int16_t *)(block_align + 16);

    uint16_t *psrc16 = (uint16_t*)VAR_0->VAR_2;



    for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) {

        int VAR_21 = 8 + 8*VAR_15 + VAR_12*VAR_15;

        memcpy(VAR_0->VAR_2 + VAR_21*VAR_10, VAR_2 + VAR_12*VAR_4, VAR_5*VAR_10);

        if (VAR_10 == 1) {

            for (VAR_11 = 0; VAR_11 < 8; VAR_11++) {

                VAR_0->VAR_2[VAR_21         - VAR_11 - 1] = VAR_0->VAR_2[VAR_21 +         VAR_11    ];

                VAR_0->VAR_2[VAR_21 + VAR_5 + VAR_11    ] = VAR_0->VAR_2[VAR_21 + VAR_5 - VAR_11 - 1];

            }

        } else {

            for (VAR_11 = 0; VAR_11 < 8; VAR_11++) {

                psrc16[VAR_21         - VAR_11 - 1] = psrc16[VAR_21 +         VAR_11    ];

                psrc16[VAR_21 + VAR_5 + VAR_11    ] = psrc16[VAR_21 + VAR_5 - VAR_11 - 1];

            }

        }

    }

    for (VAR_12 = 0; VAR_12 < 8; VAR_12++) {

        memcpy(VAR_0->VAR_2 + (       7-VAR_12)*VAR_15 * VAR_10, VAR_0->VAR_2 + (       VAR_12+8)*VAR_15 * VAR_10, VAR_15 * VAR_10);

        memcpy(VAR_0->VAR_2 + (VAR_6+8+VAR_12)*VAR_15 * VAR_10, VAR_0->VAR_2 + (VAR_6-VAR_12+7)*VAR_15 * VAR_10, VAR_15 * VAR_10);

    }



    for (VAR_12 = 0; VAR_12 < VAR_6 + 8; VAR_12 += 8) {

        memset(VAR_0->temp + (8 + VAR_12) * VAR_15, 0, 8 * VAR_15 * sizeof(*VAR_0->temp));

        for (VAR_11 = 0; VAR_11 < VAR_5 + 8; VAR_11 += 8) {

            int VAR_17;



            if (VAR_0->VAR_17) {

                VAR_17 = VAR_0->VAR_17;

            } else{

                const int VAR_18 = 3 + VAR_9;

                VAR_17 = VAR_7[(FFMIN(VAR_11, VAR_5 - 1) >> VAR_18) + (FFMIN(VAR_12, VAR_6 - 1) >> VAR_18) * VAR_8];

                VAR_17 = FFMAX(1, norm_qscale(VAR_17, VAR_0->qscale_type));

            }

            for (VAR_13 = 0; VAR_13 < VAR_14; VAR_13++) {

                const int VAR_19 = VAR_11 + offset[VAR_13 + VAR_14 - 1][0];

                const int VAR_20 = VAR_12 + offset[VAR_13 + VAR_14 - 1][1];

                const int VAR_21 = VAR_19 + VAR_20*VAR_15;

                VAR_0->dct->get_pixels(block, VAR_0->VAR_2 + VAR_10*VAR_21, VAR_10*VAR_15);

                VAR_0->dct->fdct(block);

                VAR_0->requantize(block2, block, VAR_17, VAR_0->dct->idct_permutation);

                VAR_0->dct->idct(block2);

                add_block(VAR_0->temp + VAR_21, VAR_15, block2);

            }

        }

        if (VAR_12) {

            if (VAR_10 == 1) {

                VAR_0->store_slice(VAR_1 + (VAR_12 - 8) * VAR_3, VAR_0->temp + 8 + VAR_12*VAR_15,

                               VAR_3, VAR_15, VAR_5,

                               FFMIN(8, VAR_6 + 8 - VAR_12), MAX_LEVEL - VAR_0->log2_count,

                               ldither);

            } else {

                store_slice16_c((uint16_t*)(VAR_1 + (VAR_12 - 8) * VAR_3), VAR_0->temp + 8 + VAR_12*VAR_15,

                                VAR_3/2, VAR_15, VAR_5,

                                FFMIN(8, VAR_6 + 8 - VAR_12), MAX_LEVEL - VAR_0->log2_count,

                                ldither);

            }

        }

    }

}

static void FUNC_0(SPPContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2,
int VAR_3, int VAR_4, int VAR_5, int VAR_6,
const uint8_t *VAR_7, int VAR_8, int VAR_9, int VAR_10)
{ int VAR_11, VAR_12, VAR_13; const int VAR_14 = 1 << VAR_0->log2_count; const int VAR_15 = VAR_9 ? VAR_0->temp_linesize : FFALIGN(VAR_5+16, 16); DECLARE_ALIGNED(16, uint64_t, block_align)[32]; int16_t *block  = (int16_t *)block_align; int16_t *block2 = (int16_t *)(block_align + 16); uint16_t *psrc16 = (uint16_t*)VAR_0->VAR_2; for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) { int VAR_21 = 8 + 8*VAR_15 + VAR_12*VAR_15; memcpy(VAR_0->VAR_2 + VAR_21*VAR_10, VAR_2 + VAR_12*VAR_4, VAR_5*VAR_10); if (VAR_10 == 1) { for (VAR_11 = 0; VAR_11 < 8; VAR_11++) { VAR_0->VAR_2[VAR_21         - VAR_11 - 1] = VAR_0->VAR_2[VAR_21 +         VAR_11    ]; VAR_0->VAR_2[VAR_21 + VAR_5 + VAR_11    ] = VAR_0->VAR_2[VAR_21 + VAR_5 - VAR_11 - 1]; } } else { for (VAR_11 = 0; VAR_11 < 8; VAR_11++) { psrc16[VAR_21         - VAR_11 - 1] = psrc16[VAR_21 +         VAR_11    ]; psrc16[VAR_21 + VAR_5 + VAR_11    ] = psrc16[VAR_21 + VAR_5 - VAR_11 - 1]; } } } for (VAR_12 = 0; VAR_12 < 8; VAR_12++) { memcpy(VAR_0->VAR_2 + (       7-VAR_12)*VAR_15 * VAR_10, VAR_0->VAR_2 + (       VAR_12+8)*VAR_15 * VAR_10, VAR_15 * VAR_10); memcpy(VAR_0->VAR_2 + (VAR_6+8+VAR_12)*VAR_15 * VAR_10, VAR_0->VAR_2 + (VAR_6-VAR_12+7)*VAR_15 * VAR_10, VAR_15 * VAR_10); } for (VAR_12 = 0; VAR_12 < VAR_6 + 8; VAR_12 += 8) { memset(VAR_0->temp + (8 + VAR_12) * VAR_15, 0, 8 * VAR_15 * sizeof(*VAR_0->temp)); for (VAR_11 = 0; VAR_11 < VAR_5 + 8; VAR_11 += 8) { int VAR_17; if (VAR_0->VAR_17) { VAR_17 = VAR_0->VAR_17; } else{ const int VAR_18 = 3 + VAR_9; VAR_17 = VAR_7[(FFMIN(VAR_11, VAR_5 - 1) >> VAR_18) + (FFMIN(VAR_12, VAR_6 - 1) >> VAR_18) * VAR_8]; VAR_17 = FFMAX(1, norm_qscale(VAR_17, VAR_0->qscale_type)); } for (VAR_13 = 0; VAR_13 < VAR_14; VAR_13++) { const int VAR_19 = VAR_11 + offset[VAR_13 + VAR_14 - 1][0]; const int VAR_20 = VAR_12 + offset[VAR_13 + VAR_14 - 1][1]; const int VAR_21 = VAR_19 + VAR_20*VAR_15; VAR_0->dct->get_pixels(block, VAR_0->VAR_2 + VAR_10*VAR_21, VAR_10*VAR_15); VAR_0->dct->fdct(block); VAR_0->requantize(block2, block, VAR_17, VAR_0->dct->idct_permutation); VAR_0->dct->idct(block2); add_block(VAR_0->temp + VAR_21, VAR_15, block2); } } if (VAR_12) { if (VAR_10 == 1) { VAR_0->store_slice(VAR_1 + (VAR_12 - 8) * VAR_3, VAR_0->temp + 8 + VAR_12*VAR_15,
VAR_3, VAR_15, VAR_5,
FFMIN(8, VAR_6 + 8 - VAR_12), MAX_LEVEL - VAR_0->log2_count,
ldither); } else { store_slice16_c((uint16_t*)(VAR_1 + (VAR_12 - 8) * VAR_3), VAR_0->temp + 8 + VAR_12*VAR_15,
VAR_3/2, VAR_15, VAR_5,
FFMIN(8, VAR_6 + 8 - VAR_12), MAX_LEVEL - VAR_0->log2_count,
ldither); } } } }