static void dwt_decode97_int(DWTContext *s, int32_t *t)

{

    int lev;

    int w       = s->linelen[s->ndeclevels - 1][0];

    int h       = s->linelen[s->ndeclevels - 1][1];

    int i;

    int32_t *line = s->i_linebuf;

    int32_t *data = t;

    /* position at index O of line range [0-5,w+5] cf. extend function */

    line += 5;



    for (i = 0; i < w * h; i++)

        data[i] *= 1 << I_PRESHIFT;



    for (lev = 0; lev < s->ndeclevels; lev++) {

        int lh = s->linelen[lev][0],

            lv = s->linelen[lev][1],

            mh = s->mod[lev][0],

            mv = s->mod[lev][1],

            lp;

        int32_t *l;

        // HOR_SD

        l = line + mh;

        for (lp = 0; lp < lv; lp++) {

            int i, j = 0;

            // rescale with interleaving

            for (i = mh; i < lh; i += 2, j++)

                l[i] = ((data[w * lp + j] * I_LFTG_K) + (1 << 15)) >> 16;

            for (i = 1 - mh; i < lh; i += 2, j++)

                l[i] = data[w * lp + j];



            sr_1d97_int(line, mh, mh + lh);



            for (i = 0; i < lh; i++)

                data[w * lp + i] = l[i];

        }



        // VER_SD

        l = line + mv;

        for (lp = 0; lp < lh; lp++) {

            int i, j = 0;

            // rescale with interleaving

            for (i = mv; i < lv; i += 2, j++)

                l[i] = ((data[w * j + lp] * I_LFTG_K) + (1 << 15)) >> 16;

            for (i = 1 - mv; i < lv; i += 2, j++)

                l[i] = data[w * j + lp];



            sr_1d97_int(line, mv, mv + lv);



            for (i = 0; i < lv; i++)

                data[w * i + lp] = l[i];

        }

    }



    for (i = 0; i < w * h; i++)

        data[i] = (data[i] + ((1<<I_PRESHIFT)>>1)) >> I_PRESHIFT;

}

static void dwt_decode97_int(DWTContext *s, int32_t *t)

{

    int lev;

    int w       = s->linelen[s->ndeclevels - 1][0];

    int h       = s->linelen[s->ndeclevels - 1][1];

    int i;

    int32_t *line = s->i_linebuf;

    int32_t *data = t;

    

    line += 5;



    for (i = 0; i < w * h; i++)

        data[i] *= 1 << I_PRESHIFT;



    for (lev = 0; lev < s->ndeclevels; lev++) {

        int lh = s->linelen[lev][0],

            lv = s->linelen[lev][1],

            mh = s->mod[lev][0],

            mv = s->mod[lev][1],

            lp;

        int32_t *l;

        

        l = line + mh;

        for (lp = 0; lp < lv; lp++) {

            int i, j = 0;

            

            for (i = mh; i < lh; i += 2, j++)

                l[i] = ((data[w * lp + j] * I_LFTG_K) + (1 << 15)) >> 16;

            for (i = 1 - mh; i < lh; i += 2, j++)

                l[i] = data[w * lp + j];



            sr_1d97_int(line, mh, mh + lh);



            for (i = 0; i < lh; i++)

                data[w * lp + i] = l[i];

        }



        

        l = line + mv;

        for (lp = 0; lp < lh; lp++) {

            int i, j = 0;

            

            for (i = mv; i < lv; i += 2, j++)

                l[i] = ((data[w * j + lp] * I_LFTG_K) + (1 << 15)) >> 16;

            for (i = 1 - mv; i < lv; i += 2, j++)

                l[i] = data[w * j + lp];



            sr_1d97_int(line, mv, mv + lv);



            for (i = 0; i < lv; i++)

                data[w * i + lp] = l[i];

        }

    }



    for (i = 0; i < w * h; i++)

        data[i] = (data[i] + ((1<<I_PRESHIFT)>>1)) >> I_PRESHIFT;

}

        data[i] *= 1 << I_PRESHIFT;
static void FUNC_0(DWTContext *VAR_0, int32_t *VAR_1)

{

    int VAR_2;

    int VAR_3       = VAR_0->linelen[VAR_0->ndeclevels - 1][0];

    int VAR_4       = VAR_0->linelen[VAR_0->ndeclevels - 1][1];

    int VAR_5;

    int32_t *line = VAR_0->i_linebuf;

    int32_t *data = VAR_1;

    

    line += 5;



    for (VAR_5 = 0; VAR_5 < VAR_3 * VAR_4; VAR_5++)

        data[VAR_5] *= 1 << I_PRESHIFT;



    for (VAR_2 = 0; VAR_2 < VAR_0->ndeclevels; VAR_2++) {

        int lh = VAR_0->linelen[VAR_2][0],

            lv = VAR_0->linelen[VAR_2][1],

            mh = VAR_0->mod[VAR_2][0],

            mv = VAR_0->mod[VAR_2][1],

            lp;

        int32_t *l;

        

        l = line + mh;

        for (lp = 0; lp < lv; lp++) {

            int VAR_5, j = 0;

            

            for (VAR_5 = mh; VAR_5 < lh; VAR_5 += 2, j++)

                l[VAR_5] = ((data[VAR_3 * lp + j] * I_LFTG_K) + (1 << 15)) >> 16;

            for (VAR_5 = 1 - mh; VAR_5 < lh; VAR_5 += 2, j++)

                l[VAR_5] = data[VAR_3 * lp + j];



            sr_1d97_int(line, mh, mh + lh);



            for (VAR_5 = 0; VAR_5 < lh; VAR_5++)

                data[VAR_3 * lp + VAR_5] = l[VAR_5];

        }



        

        l = line + mv;

        for (lp = 0; lp < lh; lp++) {

            int VAR_5, j = 0;

            

            for (VAR_5 = mv; VAR_5 < lv; VAR_5 += 2, j++)

                l[VAR_5] = ((data[VAR_3 * j + lp] * I_LFTG_K) + (1 << 15)) >> 16;

            for (VAR_5 = 1 - mv; VAR_5 < lv; VAR_5 += 2, j++)

                l[VAR_5] = data[VAR_3 * j + lp];



            sr_1d97_int(line, mv, mv + lv);



            for (VAR_5 = 0; VAR_5 < lv; VAR_5++)

                data[VAR_3 * VAR_5 + lp] = l[VAR_5];

        }

    }



    for (VAR_5 = 0; VAR_5 < VAR_3 * VAR_4; VAR_5++)

        data[VAR_5] = (data[VAR_5] + ((1<<I_PRESHIFT)>>1)) >> I_PRESHIFT;

}

static void FUNC_0(DWTContext *VAR_0, int32_t *VAR_1)
{ int VAR_2; int VAR_3       = VAR_0->linelen[VAR_0->ndeclevels - 1][0]; int VAR_4       = VAR_0->linelen[VAR_0->ndeclevels - 1][1]; int VAR_5; int32_t *line = VAR_0->i_linebuf; int32_t *data = VAR_1; line += 5; for (VAR_5 = 0; VAR_5 < VAR_3 * VAR_4; VAR_5++) data[VAR_5] *= 1 << I_PRESHIFT; for (VAR_2 = 0; VAR_2 < VAR_0->ndeclevels; VAR_2++) { int lh = VAR_0->linelen[VAR_2][0],
lv = VAR_0->linelen[VAR_2][1],
mh = VAR_0->mod[VAR_2][0],
mv = VAR_0->mod[VAR_2][1],
lp; int32_t *l; l = line + mh; for (lp = 0; lp < lv; lp++) { int VAR_5, j = 0; for (VAR_5 = mh; VAR_5 < lh; VAR_5 += 2, j++) l[VAR_5] = ((data[VAR_3 * lp + j] * I_LFTG_K) + (1 << 15)) >> 16; for (VAR_5 = 1 - mh; VAR_5 < lh; VAR_5 += 2, j++) l[VAR_5] = data[VAR_3 * lp + j]; sr_1d97_int(line, mh, mh + lh); for (VAR_5 = 0; VAR_5 < lh; VAR_5++) data[VAR_3 * lp + VAR_5] = l[VAR_5]; } l = line + mv; for (lp = 0; lp < lh; lp++) { int VAR_5, j = 0; for (VAR_5 = mv; VAR_5 < lv; VAR_5 += 2, j++) l[VAR_5] = ((data[VAR_3 * j + lp] * I_LFTG_K) + (1 << 15)) >> 16; for (VAR_5 = 1 - mv; VAR_5 < lv; VAR_5 += 2, j++) l[VAR_5] = data[VAR_3 * j + lp]; sr_1d97_int(line, mv, mv + lv); for (VAR_5 = 0; VAR_5 < lv; VAR_5++) data[VAR_3 * VAR_5 + lp] = l[VAR_5]; } } for (VAR_5 = 0; VAR_5 < VAR_3 * VAR_4; VAR_5++) data[VAR_5] = (data[VAR_5] + ((1<<I_PRESHIFT)>>1)) >> I_PRESHIFT; }