static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,

                                AVFrame *picture)

{

    int compno, reslevelno, bandno;

    int x, y;



    uint8_t *line;

    Jpeg2000T1Context t1;



    /* Loop on tile components */

    for (compno = 0; compno < s->ncomponents; compno++) {

        Jpeg2000Component *comp     = tile->comp + compno;

        Jpeg2000CodingStyle *codsty = tile->codsty + compno;



        /* Loop on resolution levels */

        for (reslevelno = 0; reslevelno < codsty->nreslevels2decode; reslevelno++) {

            Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno;

            /* Loop on bands */

            for (bandno = 0; bandno < rlevel->nbands; bandno++) {

                int nb_precincts, precno;

                Jpeg2000Band *band = rlevel->band + bandno;

                int cblkno = 0, bandpos;



                bandpos = bandno + (reslevelno > 0);



                if (band->coord[0][0] == band->coord[0][1] ||

                    band->coord[1][0] == band->coord[1][1])

                    continue;



                nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y;

                /* Loop on precincts */

                for (precno = 0; precno < nb_precincts; precno++) {

                    Jpeg2000Prec *prec = band->prec + precno;



                    /* Loop on codeblocks */

                    for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {

                        int x, y;

                        Jpeg2000Cblk *cblk = prec->cblk + cblkno;

                        decode_cblk(s, codsty, &t1, cblk,

                                    cblk->coord[0][1] - cblk->coord[0][0],

                                    cblk->coord[1][1] - cblk->coord[1][0],

                                    bandpos);



                        x = cblk->coord[0][0];

                        y = cblk->coord[1][0];



                        if (codsty->transform == FF_DWT97)

                            dequantization_float(x, y, cblk, comp, &t1, band);

                        else

                            dequantization_int(x, y, cblk, comp, &t1, band);

                   } /* end cblk */

                } /*end prec */

            } /* end band */

        } /* end reslevel */



        /* inverse DWT */

        ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data);

    } /*end comp */



    /* inverse MCT transformation */

    if (tile->codsty[0].mct)

        mct_decode(s, tile);



    if (s->cdef[0] < 0) {

        for (x = 0; x < s->ncomponents; x++)

            s->cdef[x] = x + 1;

        if ((s->ncomponents & 1) == 0)

            s->cdef[s->ncomponents-1] = 0;

    }



    if (s->precision <= 8) {

        for (compno = 0; compno < s->ncomponents; compno++) {

            Jpeg2000Component *comp = tile->comp + compno;

            Jpeg2000CodingStyle *codsty = tile->codsty + compno;

            float *datap = comp->f_data;

            int32_t *i_datap = comp->i_data;

            int cbps = s->cbps[compno];

            int w = tile->comp[compno].coord[0][1] - s->image_offset_x;

            int planar = !!picture->data[2];

            int pixelsize = planar ? 1 : s->ncomponents;

            int plane = 0;



            if (planar)

                plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);





            y    = tile->comp[compno].coord[1][0] - s->image_offset_y;

            line = picture->data[plane] + y * picture->linesize[plane];

            for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {

                uint8_t *dst;



                x   = tile->comp[compno].coord[0][0] - s->image_offset_x;

                dst = line + x * pixelsize + compno*!planar;



                if (codsty->transform == FF_DWT97) {

                    for (; x < w; x += s->cdx[compno]) {

                        int val = lrintf(*datap) + (1 << (cbps - 1));

                        /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        *dst = val << (8 - cbps);

                        datap++;

                        dst += pixelsize;

                    }

                } else {

                    for (; x < w; x += s->cdx[compno]) {

                        int val = *i_datap + (1 << (cbps - 1));

                        /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        *dst = val << (8 - cbps);

                        i_datap++;

                        dst += pixelsize;

                    }

                }

                line += picture->linesize[plane];

            }

        }

    } else {

        for (compno = 0; compno < s->ncomponents; compno++) {

            Jpeg2000Component *comp = tile->comp + compno;

            Jpeg2000CodingStyle *codsty = tile->codsty + compno;

            float *datap = comp->f_data;

            int32_t *i_datap = comp->i_data;

            uint16_t *linel;

            int cbps = s->cbps[compno];

            int w = tile->comp[compno].coord[0][1] - s->image_offset_x;

            int planar = !!picture->data[2];

            int pixelsize = planar ? 1 : s->ncomponents;

            int plane = 0;



            if (planar)

                plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);



            y     = tile->comp[compno].coord[1][0] - s->image_offset_y;

            linel = (uint16_t *)picture->data[plane] + y * (picture->linesize[plane] >> 1);

            for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {

                uint16_t *dst;



                x   = tile->comp[compno].coord[0][0] - s->image_offset_x;

                dst = linel + (x * pixelsize + compno*!planar);

                if (codsty->transform == FF_DWT97) {

                    for (; x < w; x += s-> cdx[compno]) {

                        int  val = lrintf(*datap) + (1 << (cbps - 1));

                        /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        /* align 12 bit values in little-endian mode */

                        *dst = val << (16 - cbps);

                        datap++;

                        dst += pixelsize;

                    }

                } else {

                    for (; x < w; x += s-> cdx[compno]) {

                        int val = *i_datap + (1 << (cbps - 1));

                        /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        /* align 12 bit values in little-endian mode */

                        *dst = val << (16 - cbps);

                        i_datap++;

                        dst += pixelsize;

                    }

                }

                linel += picture->linesize[plane] >> 1;

            }

        }

    }



    return 0;

}

static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,

                                AVFrame *picture)

{

    int compno, reslevelno, bandno;

    int x, y;



    uint8_t *line;

    Jpeg2000T1Context t1;



    

    for (compno = 0; compno < s->ncomponents; compno++) {

        Jpeg2000Component *comp     = tile->comp + compno;

        Jpeg2000CodingStyle *codsty = tile->codsty + compno;



        

        for (reslevelno = 0; reslevelno < codsty->nreslevels2decode; reslevelno++) {

            Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno;

            

            for (bandno = 0; bandno < rlevel->nbands; bandno++) {

                int nb_precincts, precno;

                Jpeg2000Band *band = rlevel->band + bandno;

                int cblkno = 0, bandpos;



                bandpos = bandno + (reslevelno > 0);



                if (band->coord[0][0] == band->coord[0][1] ||

                    band->coord[1][0] == band->coord[1][1])

                    continue;



                nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y;

                

                for (precno = 0; precno < nb_precincts; precno++) {

                    Jpeg2000Prec *prec = band->prec + precno;



                    

                    for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {

                        int x, y;

                        Jpeg2000Cblk *cblk = prec->cblk + cblkno;

                        decode_cblk(s, codsty, &t1, cblk,

                                    cblk->coord[0][1] - cblk->coord[0][0],

                                    cblk->coord[1][1] - cblk->coord[1][0],

                                    bandpos);



                        x = cblk->coord[0][0];

                        y = cblk->coord[1][0];



                        if (codsty->transform == FF_DWT97)

                            dequantization_float(x, y, cblk, comp, &t1, band);

                        else

                            dequantization_int(x, y, cblk, comp, &t1, band);

                   } 

                } 

            } 

        } 



        

        ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data);

    } 



    

    if (tile->codsty[0].mct)

        mct_decode(s, tile);



    if (s->cdef[0] < 0) {

        for (x = 0; x < s->ncomponents; x++)

            s->cdef[x] = x + 1;

        if ((s->ncomponents & 1) == 0)

            s->cdef[s->ncomponents-1] = 0;

    }



    if (s->precision <= 8) {

        for (compno = 0; compno < s->ncomponents; compno++) {

            Jpeg2000Component *comp = tile->comp + compno;

            Jpeg2000CodingStyle *codsty = tile->codsty + compno;

            float *datap = comp->f_data;

            int32_t *i_datap = comp->i_data;

            int cbps = s->cbps[compno];

            int w = tile->comp[compno].coord[0][1] - s->image_offset_x;

            int planar = !!picture->data[2];

            int pixelsize = planar ? 1 : s->ncomponents;

            int plane = 0;



            if (planar)

                plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);





            y    = tile->comp[compno].coord[1][0] - s->image_offset_y;

            line = picture->data[plane] + y * picture->linesize[plane];

            for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {

                uint8_t *dst;



                x   = tile->comp[compno].coord[0][0] - s->image_offset_x;

                dst = line + x * pixelsize + compno*!planar;



                if (codsty->transform == FF_DWT97) {

                    for (; x < w; x += s->cdx[compno]) {

                        int val = lrintf(*datap) + (1 << (cbps - 1));

                        

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        *dst = val << (8 - cbps);

                        datap++;

                        dst += pixelsize;

                    }

                } else {

                    for (; x < w; x += s->cdx[compno]) {

                        int val = *i_datap + (1 << (cbps - 1));

                        

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        *dst = val << (8 - cbps);

                        i_datap++;

                        dst += pixelsize;

                    }

                }

                line += picture->linesize[plane];

            }

        }

    } else {

        for (compno = 0; compno < s->ncomponents; compno++) {

            Jpeg2000Component *comp = tile->comp + compno;

            Jpeg2000CodingStyle *codsty = tile->codsty + compno;

            float *datap = comp->f_data;

            int32_t *i_datap = comp->i_data;

            uint16_t *linel;

            int cbps = s->cbps[compno];

            int w = tile->comp[compno].coord[0][1] - s->image_offset_x;

            int planar = !!picture->data[2];

            int pixelsize = planar ? 1 : s->ncomponents;

            int plane = 0;



            if (planar)

                plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);



            y     = tile->comp[compno].coord[1][0] - s->image_offset_y;

            linel = (uint16_t *)picture->data[plane] + y * (picture->linesize[plane] >> 1);

            for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {

                uint16_t *dst;



                x   = tile->comp[compno].coord[0][0] - s->image_offset_x;

                dst = linel + (x * pixelsize + compno*!planar);

                if (codsty->transform == FF_DWT97) {

                    for (; x < w; x += s-> cdx[compno]) {

                        int  val = lrintf(*datap) + (1 << (cbps - 1));

                        

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        

                        *dst = val << (16 - cbps);

                        datap++;

                        dst += pixelsize;

                    }

                } else {

                    for (; x < w; x += s-> cdx[compno]) {

                        int val = *i_datap + (1 << (cbps - 1));

                        

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        

                        *dst = val << (16 - cbps);

                        i_datap++;

                        dst += pixelsize;

                    }

                }

                linel += picture->linesize[plane] >> 1;

            }

        }

    }



    return 0;

}

static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000Tile *VAR_1,

                                AVFrame *VAR_2)

{

    int VAR_3, VAR_4, VAR_5;

    int VAR_6, VAR_7;



    uint8_t *line;

    Jpeg2000T1Context t1;



    

    for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) {

        Jpeg2000Component *comp     = VAR_1->comp + VAR_3;

        Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_3;



        

        for (VAR_4 = 0; VAR_4 < codsty->nreslevels2decode; VAR_4++) {

            Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_4;

            

            for (VAR_5 = 0; VAR_5 < rlevel->nbands; VAR_5++) {

                int nb_precincts, precno;

                Jpeg2000Band *band = rlevel->band + VAR_5;

                int cblkno = 0, bandpos;



                bandpos = VAR_5 + (VAR_4 > 0);



                if (band->coord[0][0] == band->coord[0][1] ||

                    band->coord[1][0] == band->coord[1][1])

                    continue;



                nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y;

                

                for (precno = 0; precno < nb_precincts; precno++) {

                    Jpeg2000Prec *prec = band->prec + precno;



                    

                    for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {

                        int VAR_6, VAR_7;

                        Jpeg2000Cblk *cblk = prec->cblk + cblkno;

                        decode_cblk(VAR_0, codsty, &t1, cblk,

                                    cblk->coord[0][1] - cblk->coord[0][0],

                                    cblk->coord[1][1] - cblk->coord[1][0],

                                    bandpos);



                        VAR_6 = cblk->coord[0][0];

                        VAR_7 = cblk->coord[1][0];



                        if (codsty->transform == FF_DWT97)

                            dequantization_float(VAR_6, VAR_7, cblk, comp, &t1, band);

                        else

                            dequantization_int(VAR_6, VAR_7, cblk, comp, &t1, band);

                   } 

                } 

            } 

        } 



        

        ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data);

    } 



    

    if (VAR_1->codsty[0].mct)

        mct_decode(VAR_0, VAR_1);



    if (VAR_0->cdef[0] < 0) {

        for (VAR_6 = 0; VAR_6 < VAR_0->ncomponents; VAR_6++)

            VAR_0->cdef[VAR_6] = VAR_6 + 1;

        if ((VAR_0->ncomponents & 1) == 0)

            VAR_0->cdef[VAR_0->ncomponents-1] = 0;

    }



    if (VAR_0->precision <= 8) {

        for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) {

            Jpeg2000Component *comp = VAR_1->comp + VAR_3;

            Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_3;

            float *datap = comp->f_data;

            int32_t *i_datap = comp->i_data;

            int cbps = VAR_0->cbps[VAR_3];

            int w = VAR_1->comp[VAR_3].coord[0][1] - VAR_0->image_offset_x;

            int planar = !!VAR_2->data[2];

            int pixelsize = planar ? 1 : VAR_0->ncomponents;

            int plane = 0;



            if (planar)

                plane = VAR_0->cdef[VAR_3] ? VAR_0->cdef[VAR_3]-1 : (VAR_0->ncomponents-1);





            VAR_7    = VAR_1->comp[VAR_3].coord[1][0] - VAR_0->image_offset_y;

            line = VAR_2->data[plane] + VAR_7 * VAR_2->linesize[plane];

            for (; VAR_7 < VAR_1->comp[VAR_3].coord[1][1] - VAR_0->image_offset_y; VAR_7 += VAR_0->cdy[VAR_3]) {

                uint8_t *dst;



                VAR_6   = VAR_1->comp[VAR_3].coord[0][0] - VAR_0->image_offset_x;

                dst = line + VAR_6 * pixelsize + VAR_3*!planar;



                if (codsty->transform == FF_DWT97) {

                    for (; VAR_6 < w; VAR_6 += VAR_0->cdx[VAR_3]) {

                        int val = lrintf(*datap) + (1 << (cbps - 1));

                        

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        *dst = val << (8 - cbps);

                        datap++;

                        dst += pixelsize;

                    }

                } else {

                    for (; VAR_6 < w; VAR_6 += VAR_0->cdx[VAR_3]) {

                        int val = *i_datap + (1 << (cbps - 1));

                        

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        *dst = val << (8 - cbps);

                        i_datap++;

                        dst += pixelsize;

                    }

                }

                line += VAR_2->linesize[plane];

            }

        }

    } else {

        for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) {

            Jpeg2000Component *comp = VAR_1->comp + VAR_3;

            Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_3;

            float *datap = comp->f_data;

            int32_t *i_datap = comp->i_data;

            uint16_t *linel;

            int cbps = VAR_0->cbps[VAR_3];

            int w = VAR_1->comp[VAR_3].coord[0][1] - VAR_0->image_offset_x;

            int planar = !!VAR_2->data[2];

            int pixelsize = planar ? 1 : VAR_0->ncomponents;

            int plane = 0;



            if (planar)

                plane = VAR_0->cdef[VAR_3] ? VAR_0->cdef[VAR_3]-1 : (VAR_0->ncomponents-1);



            VAR_7     = VAR_1->comp[VAR_3].coord[1][0] - VAR_0->image_offset_y;

            linel = (uint16_t *)VAR_2->data[plane] + VAR_7 * (VAR_2->linesize[plane] >> 1);

            for (; VAR_7 < VAR_1->comp[VAR_3].coord[1][1] - VAR_0->image_offset_y; VAR_7 += VAR_0->cdy[VAR_3]) {

                uint16_t *dst;



                VAR_6   = VAR_1->comp[VAR_3].coord[0][0] - VAR_0->image_offset_x;

                dst = linel + (VAR_6 * pixelsize + VAR_3*!planar);

                if (codsty->transform == FF_DWT97) {

                    for (; VAR_6 < w; VAR_6 += VAR_0-> cdx[VAR_3]) {

                        int  val = lrintf(*datap) + (1 << (cbps - 1));

                        

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        

                        *dst = val << (16 - cbps);

                        datap++;

                        dst += pixelsize;

                    }

                } else {

                    for (; VAR_6 < w; VAR_6 += VAR_0-> cdx[VAR_3]) {

                        int val = *i_datap + (1 << (cbps - 1));

                        

                        val = av_clip(val, 0, (1 << cbps) - 1);

                        

                        *dst = val << (16 - cbps);

                        i_datap++;

                        dst += pixelsize;

                    }

                }

                linel += VAR_2->linesize[plane] >> 1;

            }

        }

    }



    return 0;

}

static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000Tile *VAR_1,
AVFrame *VAR_2)
{ int VAR_3, VAR_4, VAR_5; int VAR_6, VAR_7; uint8_t *line; Jpeg2000T1Context t1; for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) { Jpeg2000Component *comp     = VAR_1->comp + VAR_3; Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_3; for (VAR_4 = 0; VAR_4 < codsty->nreslevels2decode; VAR_4++) { Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_4; for (VAR_5 = 0; VAR_5 < rlevel->nbands; VAR_5++) { int nb_precincts, precno; Jpeg2000Band *band = rlevel->band + VAR_5; int cblkno = 0, bandpos; bandpos = VAR_5 + (VAR_4 > 0); if (band->coord[0][0] == band->coord[0][1] ||
band->coord[1][0] == band->coord[1][1])
continue; nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y; for (precno = 0; precno < nb_precincts; precno++) { Jpeg2000Prec *prec = band->prec + precno; for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) { int VAR_6, VAR_7; Jpeg2000Cblk *cblk = prec->cblk + cblkno; decode_cblk(VAR_0, codsty, &t1, cblk,
cblk->coord[0][1] - cblk->coord[0][0],
cblk->coord[1][1] - cblk->coord[1][0],
bandpos); VAR_6 = cblk->coord[0][0]; VAR_7 = cblk->coord[1][0]; if (codsty->transform == FF_DWT97)
dequantization_float(VAR_6, VAR_7, cblk, comp, &t1, band); else
dequantization_int(VAR_6, VAR_7, cblk, comp, &t1, band); } } } } ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data); } if (VAR_1->codsty[0].mct)
mct_decode(VAR_0, VAR_1); if (VAR_0->cdef[0] < 0) { for (VAR_6 = 0; VAR_6 < VAR_0->ncomponents; VAR_6++) VAR_0->cdef[VAR_6] = VAR_6 + 1; if ((VAR_0->ncomponents & 1) == 0)
VAR_0->cdef[VAR_0->ncomponents-1] = 0; } if (VAR_0->precision <= 8) { for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) { Jpeg2000Component *comp = VAR_1->comp + VAR_3; Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_3; float *datap = comp->f_data; int32_t *i_datap = comp->i_data; int cbps = VAR_0->cbps[VAR_3]; int w = VAR_1->comp[VAR_3].coord[0][1] - VAR_0->image_offset_x; int planar = !!VAR_2->data[2]; int pixelsize = planar ? 1 : VAR_0->ncomponents; int plane = 0; if (planar)
plane = VAR_0->cdef[VAR_3] ? VAR_0->cdef[VAR_3]-1 : (VAR_0->ncomponents-1); VAR_7    = VAR_1->comp[VAR_3].coord[1][0] - VAR_0->image_offset_y; line = VAR_2->data[plane] + VAR_7 * VAR_2->linesize[plane]; for (; VAR_7 < VAR_1->comp[VAR_3].coord[1][1] - VAR_0->image_offset_y; VAR_7 += VAR_0->cdy[VAR_3]) { uint8_t *dst; VAR_6   = VAR_1->comp[VAR_3].coord[0][0] - VAR_0->image_offset_x; dst = line + VAR_6 * pixelsize + VAR_3*!planar; if (codsty->transform == FF_DWT97) { for (; VAR_6 < w; VAR_6 += VAR_0->cdx[VAR_3]) { int val = lrintf(*datap) + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (8 - cbps); datap++; dst += pixelsize; } } else { for (; VAR_6 < w; VAR_6 += VAR_0->cdx[VAR_3]) { int val = *i_datap + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (8 - cbps); i_datap++; dst += pixelsize; } } line += VAR_2->linesize[plane]; } } } else { for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) { Jpeg2000Component *comp = VAR_1->comp + VAR_3; Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_3; float *datap = comp->f_data; int32_t *i_datap = comp->i_data; uint16_t *linel; int cbps = VAR_0->cbps[VAR_3]; int w = VAR_1->comp[VAR_3].coord[0][1] - VAR_0->image_offset_x; int planar = !!VAR_2->data[2]; int pixelsize = planar ? 1 : VAR_0->ncomponents; int plane = 0; if (planar)
plane = VAR_0->cdef[VAR_3] ? VAR_0->cdef[VAR_3]-1 : (VAR_0->ncomponents-1); VAR_7     = VAR_1->comp[VAR_3].coord[1][0] - VAR_0->image_offset_y; linel = (uint16_t *)VAR_2->data[plane] + VAR_7 * (VAR_2->linesize[plane] >> 1); for (; VAR_7 < VAR_1->comp[VAR_3].coord[1][1] - VAR_0->image_offset_y; VAR_7 += VAR_0->cdy[VAR_3]) { uint16_t *dst; VAR_6   = VAR_1->comp[VAR_3].coord[0][0] - VAR_0->image_offset_x; dst = linel + (VAR_6 * pixelsize + VAR_3*!planar); if (codsty->transform == FF_DWT97) { for (; VAR_6 < w; VAR_6 += VAR_0-> cdx[VAR_3]) { int  val = lrintf(*datap) + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (16 - cbps); datap++; dst += pixelsize; } } else { for (; VAR_6 < w; VAR_6 += VAR_0-> cdx[VAR_3]) { int val = *i_datap + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (16 - cbps); i_datap++; dst += pixelsize; } } linel += VAR_2->linesize[plane] >> 1; } } } return 0; }