static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)

{

    int ret, i;

    int tp_index = 0;



    s->bit_index = 8;

    if (tile->poc.nb_poc) {

        for (i=0; i<tile->poc.nb_poc; i++) {

            Jpeg2000POCEntry *e = &tile->poc.poc[i];

            ret = jpeg2000_decode_packets_po_iteration(s, tile,

                e->RSpoc, e->CSpoc,

                e->LYEpoc, e->REpoc, e->CEpoc,

                e->Ppoc, &tp_index

                );

            if (ret < 0)

                return ret;

        }

    } else {

        ret = jpeg2000_decode_packets_po_iteration(s, tile,

            0, 0,

            tile->codsty[0].nlayers,

            33,

            s->ncomponents,

            tile->codsty[0].prog_order,

            &tp_index

        );

    }

    /* EOC marker reached */

    bytestream2_skip(&s->g, 2);



    return ret;

}

static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)

{

    int ret, i;

    int tp_index = 0;



    s->bit_index = 8;

    if (tile->poc.nb_poc) {

        for (i=0; i<tile->poc.nb_poc; i++) {

            Jpeg2000POCEntry *e = &tile->poc.poc[i];

            ret = jpeg2000_decode_packets_po_iteration(s, tile,

                e->RSpoc, e->CSpoc,

                e->LYEpoc, e->REpoc, e->CEpoc,

                e->Ppoc, &tp_index

                );

            if (ret < 0)

                return ret;

        }

    } else {

        ret = jpeg2000_decode_packets_po_iteration(s, tile,

            0, 0,

            tile->codsty[0].nlayers,

            33,

            s->ncomponents,

            tile->codsty[0].prog_order,

            &tp_index

        );

    }

    

    bytestream2_skip(&s->g, 2);



    return ret;

}

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

{

    int VAR_2, VAR_3;

    int VAR_4 = 0;



    VAR_0->bit_index = 8;

    if (VAR_1->poc.nb_poc) {

        for (VAR_3=0; VAR_3<VAR_1->poc.nb_poc; VAR_3++) {

            Jpeg2000POCEntry *e = &VAR_1->poc.poc[VAR_3];

            VAR_2 = jpeg2000_decode_packets_po_iteration(VAR_0, VAR_1,

                e->RSpoc, e->CSpoc,

                e->LYEpoc, e->REpoc, e->CEpoc,

                e->Ppoc, &VAR_4

                );

            if (VAR_2 < 0)

                return VAR_2;

        }

    } else {

        VAR_2 = jpeg2000_decode_packets_po_iteration(VAR_0, VAR_1,

            0, 0,

            VAR_1->codsty[0].nlayers,

            33,

            VAR_0->ncomponents,

            VAR_1->codsty[0].prog_order,

            &VAR_4

        );

    }

    

    bytestream2_skip(&VAR_0->g, 2);



    return VAR_2;

}

static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000Tile *VAR_1)
{ int VAR_2, VAR_3; int VAR_4 = 0; VAR_0->bit_index = 8; if (VAR_1->poc.nb_poc) { for (VAR_3=0; VAR_3<VAR_1->poc.nb_poc; VAR_3++) { Jpeg2000POCEntry *e = &VAR_1->poc.poc[VAR_3]; VAR_2 = jpeg2000_decode_packets_po_iteration(VAR_0, VAR_1,
e->RSpoc, e->CSpoc,
e->LYEpoc, e->REpoc, e->CEpoc,
e->Ppoc, &VAR_4
); if (VAR_2 < 0)
return VAR_2; } } else { VAR_2 = jpeg2000_decode_packets_po_iteration(VAR_0, VAR_1,
0, 0,
VAR_1->codsty[0].nlayers,
33,
VAR_0->ncomponents,
VAR_1->codsty[0].prog_order,
&VAR_4
); } bytestream2_skip(&VAR_0->g, 2); return VAR_2; }