void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,

                           const int dst_pitch, const int num_bands)

{

    int             x, y, indx, b0, b1, b2, b3, p0, p1, p2, p3;

    const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;

    int32_t         pitch;



    /* all bands should have the same pitch */

    pitch = plane->bands[0].pitch;



    /* get pointers to the wavelet bands */

    b0_ptr = plane->bands[0].buf;

    b1_ptr = plane->bands[1].buf;

    b2_ptr = plane->bands[2].buf;

    b3_ptr = plane->bands[3].buf;



    for (y = 0; y < plane->height; y += 2) {

        for (x = 0, indx = 0; x < plane->width; x += 2, indx++) {

            /* load coefficients */

            b0 = b0_ptr[indx]; //should be: b0 = (num_bands > 0) ? b0_ptr[indx] : 0;

            b1 = b1_ptr[indx]; //should be: b1 = (num_bands > 1) ? b1_ptr[indx] : 0;

            b2 = b2_ptr[indx]; //should be: b2 = (num_bands > 2) ? b2_ptr[indx] : 0;

            b3 = b3_ptr[indx]; //should be: b3 = (num_bands > 3) ? b3_ptr[indx] : 0;



            /* haar wavelet recomposition */

            p0 = (b0 + b1 + b2 + b3 + 2) >> 2;

            p1 = (b0 + b1 - b2 - b3 + 2) >> 2;

            p2 = (b0 - b1 + b2 - b3 + 2) >> 2;

            p3 = (b0 - b1 - b2 + b3 + 2) >> 2;



            /* bias, convert and output four pixels */

            dst[x]                 = av_clip_uint8(p0 + 128);

            dst[x + 1]             = av_clip_uint8(p1 + 128);

            dst[dst_pitch + x]     = av_clip_uint8(p2 + 128);

            dst[dst_pitch + x + 1] = av_clip_uint8(p3 + 128);

        }// for x



        dst += dst_pitch << 1;



        b0_ptr += pitch;

        b1_ptr += pitch;

        b2_ptr += pitch;

        b3_ptr += pitch;

    }// for y

}

void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,

                           const int dst_pitch, const int num_bands)

{

    int             x, y, indx, b0, b1, b2, b3, p0, p1, p2, p3;

    const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;

    int32_t         pitch;



    

    pitch = plane->bands[0].pitch;



    

    b0_ptr = plane->bands[0].buf;

    b1_ptr = plane->bands[1].buf;

    b2_ptr = plane->bands[2].buf;

    b3_ptr = plane->bands[3].buf;



    for (y = 0; y < plane->height; y += 2) {

        for (x = 0, indx = 0; x < plane->width; x += 2, indx++) {

            

            b0 = b0_ptr[indx]; 

            b1 = b1_ptr[indx]; 

            b2 = b2_ptr[indx]; 

            b3 = b3_ptr[indx]; 



            

            p0 = (b0 + b1 + b2 + b3 + 2) >> 2;

            p1 = (b0 + b1 - b2 - b3 + 2) >> 2;

            p2 = (b0 - b1 + b2 - b3 + 2) >> 2;

            p3 = (b0 - b1 - b2 + b3 + 2) >> 2;



            

            dst[x]                 = av_clip_uint8(p0 + 128);

            dst[x + 1]             = av_clip_uint8(p1 + 128);

            dst[dst_pitch + x]     = av_clip_uint8(p2 + 128);

            dst[dst_pitch + x + 1] = av_clip_uint8(p3 + 128);

        }



        dst += dst_pitch << 1;



        b0_ptr += pitch;

        b1_ptr += pitch;

        b2_ptr += pitch;

        b3_ptr += pitch;

    }

}

                           const int dst_pitch, const int num_bands)
void FUNC_0(const IVIPlaneDesc *VAR_0, uint8_t *VAR_1,

                           const int VAR_2, const int VAR_3)

{

    int             VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14;

    const IDWTELEM *VAR_15, *b1_ptr, *b2_ptr, *b3_ptr;

    int32_t         pitch;



    

    pitch = VAR_0->bands[0].pitch;



    

    VAR_15 = VAR_0->bands[0].buf;

    b1_ptr = VAR_0->bands[1].buf;

    b2_ptr = VAR_0->bands[2].buf;

    b3_ptr = VAR_0->bands[3].buf;



    for (VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5 += 2) {

        for (VAR_4 = 0, VAR_6 = 0; VAR_4 < VAR_0->width; VAR_4 += 2, VAR_6++) {

            

            VAR_7 = VAR_15[VAR_6]; 

            VAR_8 = b1_ptr[VAR_6]; 

            VAR_9 = b2_ptr[VAR_6]; 

            VAR_10 = b3_ptr[VAR_6]; 



            

            VAR_11 = (VAR_7 + VAR_8 + VAR_9 + VAR_10 + 2) >> 2;

            VAR_12 = (VAR_7 + VAR_8 - VAR_9 - VAR_10 + 2) >> 2;

            VAR_13 = (VAR_7 - VAR_8 + VAR_9 - VAR_10 + 2) >> 2;

            VAR_14 = (VAR_7 - VAR_8 - VAR_9 + VAR_10 + 2) >> 2;



            

            VAR_1[VAR_4]                 = av_clip_uint8(VAR_11 + 128);

            VAR_1[VAR_4 + 1]             = av_clip_uint8(VAR_12 + 128);

            VAR_1[VAR_2 + VAR_4]     = av_clip_uint8(VAR_13 + 128);

            VAR_1[VAR_2 + VAR_4 + 1] = av_clip_uint8(VAR_14 + 128);

        }



        VAR_1 += VAR_2 << 1;



        VAR_15 += pitch;

        b1_ptr += pitch;

        b2_ptr += pitch;

        b3_ptr += pitch;

    }

}

void FUNC_0(const IVIPlaneDesc *VAR_0, uint8_t *VAR_1,
const int VAR_2, const int VAR_3)
{ int             VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14; const IDWTELEM *VAR_15, *b1_ptr, *b2_ptr, *b3_ptr; int32_t         pitch; pitch = VAR_0->bands[0].pitch; VAR_15 = VAR_0->bands[0].buf; b1_ptr = VAR_0->bands[1].buf; b2_ptr = VAR_0->bands[2].buf; b3_ptr = VAR_0->bands[3].buf; for (VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5 += 2) { for (VAR_4 = 0, VAR_6 = 0; VAR_4 < VAR_0->width; VAR_4 += 2, VAR_6++) { VAR_7 = VAR_15[VAR_6]; VAR_8 = b1_ptr[VAR_6]; VAR_9 = b2_ptr[VAR_6]; VAR_10 = b3_ptr[VAR_6]; VAR_11 = (VAR_7 + VAR_8 + VAR_9 + VAR_10 + 2) >> 2; VAR_12 = (VAR_7 + VAR_8 - VAR_9 - VAR_10 + 2) >> 2; VAR_13 = (VAR_7 - VAR_8 + VAR_9 - VAR_10 + 2) >> 2; VAR_14 = (VAR_7 - VAR_8 - VAR_9 + VAR_10 + 2) >> 2; VAR_1[VAR_4]                 = av_clip_uint8(VAR_11 + 128); VAR_1[VAR_4 + 1]             = av_clip_uint8(VAR_12 + 128); VAR_1[VAR_2 + VAR_4]     = av_clip_uint8(VAR_13 + 128); VAR_1[VAR_2 + VAR_4 + 1] = av_clip_uint8(VAR_14 + 128); } VAR_1 += VAR_2 << 1; VAR_15 += pitch; b1_ptr += pitch; b2_ptr += pitch; b3_ptr += pitch; } }