static int jp2_find_codestream(J2kDecoderContext *s)

{

    uint32_t atom_size;

    int found_codestream = 0, search_range = 10;



    // skip jpeg2k signature atom

    s->buf += 12;



    while(!found_codestream && search_range && s->buf_end - s->buf >= 8) {

        atom_size = AV_RB32(s->buf);

        if(AV_RB32(s->buf + 4) == JP2_CODESTREAM) {

            found_codestream = 1;

            s->buf += 8;

        } else {

            if (s->buf_end - s->buf < atom_size)

                return 0;

            s->buf += atom_size;

            search_range--;

        }

    }



    if(found_codestream)

        return 1;

    return 0;

}

static int jp2_find_codestream(J2kDecoderContext *s)

{

    uint32_t atom_size;

    int found_codestream = 0, search_range = 10;



    

    s->buf += 12;



    while(!found_codestream && search_range && s->buf_end - s->buf >= 8) {

        atom_size = AV_RB32(s->buf);

        if(AV_RB32(s->buf + 4) == JP2_CODESTREAM) {

            found_codestream = 1;

            s->buf += 8;

        } else {

            if (s->buf_end - s->buf < atom_size)

                return 0;

            s->buf += atom_size;

            search_range--;

        }

    }



    if(found_codestream)

        return 1;

    return 0;

}

    uint32_t atom_size;     s->buf += 12;     while(!found_codestream && search_range && s->buf_end - s->buf >= 8) {         atom_size = AV_RB32(s->buf);         if(AV_RB32(s->buf + 4) == JP2_CODESTREAM) {             s->buf += 8;             if (s->buf_end - s->buf < atom_size)             s->buf += atom_size;     if(found_codestream)
static int FUNC_0(J2kDecoderContext *VAR_0)

{

    uint32_t atom_size;

    int VAR_1 = 0, VAR_2 = 10;



    

    VAR_0->buf += 12;



    while(!VAR_1 && VAR_2 && VAR_0->buf_end - VAR_0->buf >= 8) {

        atom_size = AV_RB32(VAR_0->buf);

        if(AV_RB32(VAR_0->buf + 4) == JP2_CODESTREAM) {

            VAR_1 = 1;

            VAR_0->buf += 8;

        } else {

            if (VAR_0->buf_end - VAR_0->buf < atom_size)

                return 0;

            VAR_0->buf += atom_size;

            VAR_2--;

        }

    }



    if(VAR_1)

        return 1;

    return 0;

}

static int FUNC_0(J2kDecoderContext *VAR_0)
{ uint32_t atom_size; int VAR_1 = 0, VAR_2 = 10; VAR_0->buf += 12; while(!VAR_1 && VAR_2 && VAR_0->buf_end - VAR_0->buf >= 8) { atom_size = AV_RB32(VAR_0->buf); if(AV_RB32(VAR_0->buf + 4) == JP2_CODESTREAM) { VAR_1 = 1; VAR_0->buf += 8; } else { if (VAR_0->buf_end - VAR_0->buf < atom_size)
return 0; VAR_0->buf += atom_size; VAR_2--; } } if(VAR_1)
return 1; return 0; }