static int encode_packets(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno)

{

    int compno, reslevelno, ret;

    Jpeg2000CodingStyle *codsty = &s->codsty;

    Jpeg2000QuantStyle  *qntsty = &s->qntsty;



    av_log(s->avctx, AV_LOG_DEBUG, "tier2\n");

    // lay-rlevel-comp-pos progression

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

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

            int precno;

            Jpeg2000ResLevel *reslevel = s->tile[tileno].comp[compno].reslevel + reslevelno;

            for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){

                if (ret = encode_packet(s, reslevel, precno, qntsty->expn + (reslevelno ? 3*reslevelno-2 : 0),

                              qntsty->nguardbits))

                    return ret;

            }

        }

    }

    av_log(s->avctx, AV_LOG_DEBUG, "after tier2\n");

    return 0;

}

static int encode_packets(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno)

{

    int compno, reslevelno, ret;

    Jpeg2000CodingStyle *codsty = &s->codsty;

    Jpeg2000QuantStyle  *qntsty = &s->qntsty;



    av_log(s->avctx, AV_LOG_DEBUG, "tier2\n");

    

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

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

            int precno;

            Jpeg2000ResLevel *reslevel = s->tile[tileno].comp[compno].reslevel + reslevelno;

            for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){

                if (ret = encode_packet(s, reslevel, precno, qntsty->expn + (reslevelno ? 3*reslevelno-2 : 0),

                              qntsty->nguardbits))

                    return ret;

            }

        }

    }

    av_log(s->avctx, AV_LOG_DEBUG, "after tier2\n");

    return 0;

}

                if (ret = encode_packet(s, reslevel, precno, qntsty->expn + (reslevelno ? 3*reslevelno-2 : 0),                               qntsty->nguardbits))
static int FUNC_0(Jpeg2000EncoderContext *VAR_0, Jpeg2000Tile *VAR_1, int VAR_2)

{

    int VAR_3, VAR_4, VAR_5;

    Jpeg2000CodingStyle *codsty = &VAR_0->codsty;

    Jpeg2000QuantStyle  *qntsty = &VAR_0->qntsty;



    av_log(VAR_0->avctx, AV_LOG_DEBUG, "tier2\n");

    

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

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

            int precno;

            Jpeg2000ResLevel *reslevel = VAR_0->VAR_1[VAR_2].comp[VAR_3].reslevel + VAR_4;

            for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){

                if (VAR_5 = encode_packet(VAR_0, reslevel, precno, qntsty->expn + (VAR_4 ? 3*VAR_4-2 : 0),

                              qntsty->nguardbits))

                    return VAR_5;

            }

        }

    }

    av_log(VAR_0->avctx, AV_LOG_DEBUG, "after tier2\n");

    return 0;

}

static int FUNC_0(Jpeg2000EncoderContext *VAR_0, Jpeg2000Tile *VAR_1, int VAR_2)
{ int VAR_3, VAR_4, VAR_5; Jpeg2000CodingStyle *codsty = &VAR_0->codsty; Jpeg2000QuantStyle  *qntsty = &VAR_0->qntsty; av_log(VAR_0->avctx, AV_LOG_DEBUG, "tier2\n"); for (VAR_4 = 0; VAR_4 < codsty->nreslevels; VAR_4++){ for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++){ int precno; Jpeg2000ResLevel *reslevel = VAR_0->VAR_1[VAR_2].comp[VAR_3].reslevel + VAR_4; for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){ if (VAR_5 = encode_packet(VAR_0, reslevel, precno, qntsty->expn + (VAR_4 ? 3*VAR_4-2 : 0),
qntsty->nguardbits))
return VAR_5; } } } av_log(VAR_0->avctx, AV_LOG_DEBUG, "after tier2\n"); return 0; }