static int decode_hybrid(const uint8_t *sptr, uint8_t *dptr, int dx, int dy,

                         int h, int w, int stride, const uint32_t *pal)

{

    int x, y;

    const uint8_t *orig_src = sptr;



    for (y = dx + h; y > dx; y--) {

        uint8_t *dst = dptr + (y * stride) + dy * 3;

        for (x = 0; x < w; x++) {

            if (*sptr & 0x80) {

                /* 15-bit color */

                unsigned c = AV_RB16(sptr) & ~0x8000;

                unsigned b =  c        & 0x1F;

                unsigned g = (c >>  5) & 0x1F;

                unsigned r =  c >> 10;

                /* 000aaabb -> aaabbaaa  */

                *dst++ = (b << 3) | (b >> 2);

                *dst++ = (g << 3) | (g >> 2);

                *dst++ = (r << 3) | (r >> 2);

                sptr += 2;

            } else {

                /* palette index */

                uint32_t c = pal[*sptr++];

                bytestream_put_le24(&dst, c);

            }

        }

    }

    return sptr - orig_src;

}

static int decode_hybrid(const uint8_t *sptr, uint8_t *dptr, int dx, int dy,

                         int h, int w, int stride, const uint32_t *pal)

{

    int x, y;

    const uint8_t *orig_src = sptr;



    for (y = dx + h; y > dx; y--) {

        uint8_t *dst = dptr + (y * stride) + dy * 3;

        for (x = 0; x < w; x++) {

            if (*sptr & 0x80) {

                

                unsigned c = AV_RB16(sptr) & ~0x8000;

                unsigned b =  c        & 0x1F;

                unsigned g = (c >>  5) & 0x1F;

                unsigned r =  c >> 10;

                

                *dst++ = (b << 3) | (b >> 2);

                *dst++ = (g << 3) | (g >> 2);

                *dst++ = (r << 3) | (r >> 2);

                sptr += 2;

            } else {

                

                uint32_t c = pal[*sptr++];

                bytestream_put_le24(&dst, c);

            }

        }

    }

    return sptr - orig_src;

}

static int decode_hybrid(const uint8_t *sptr, uint8_t *dptr, int dx, int dy,
static int FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3,

                         int VAR_4, int VAR_5, int VAR_6, const uint32_t *VAR_7)

{

    int VAR_8, VAR_9;

    const uint8_t *VAR_10 = VAR_0;



    for (VAR_9 = VAR_2 + VAR_4; VAR_9 > VAR_2; VAR_9--) {

        uint8_t *dst = VAR_1 + (VAR_9 * VAR_6) + VAR_3 * 3;

        for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) {

            if (*VAR_0 & 0x80) {

                

                unsigned VAR_11 = AV_RB16(VAR_0) & ~0x8000;

                unsigned VAR_12 =  VAR_11        & 0x1F;

                unsigned VAR_13 = (VAR_11 >>  5) & 0x1F;

                unsigned VAR_14 =  VAR_11 >> 10;

                

                *dst++ = (VAR_12 << 3) | (VAR_12 >> 2);

                *dst++ = (VAR_13 << 3) | (VAR_13 >> 2);

                *dst++ = (VAR_14 << 3) | (VAR_14 >> 2);

                VAR_0 += 2;

            } else {

                

                uint32_t VAR_11 = VAR_7[*VAR_0++];

                bytestream_put_le24(&dst, VAR_11);

            }

        }

    }

    return VAR_0 - VAR_10;

}

static int FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3,
int VAR_4, int VAR_5, int VAR_6, const uint32_t *VAR_7)
{ int VAR_8, VAR_9; const uint8_t *VAR_10 = VAR_0; for (VAR_9 = VAR_2 + VAR_4; VAR_9 > VAR_2; VAR_9--) { uint8_t *dst = VAR_1 + (VAR_9 * VAR_6) + VAR_3 * 3; for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) { if (*VAR_0 & 0x80) { unsigned VAR_11 = AV_RB16(VAR_0) & ~0x8000; unsigned VAR_12 =  VAR_11        & 0x1F; unsigned VAR_13 = (VAR_11 >>  5) & 0x1F; unsigned VAR_14 =  VAR_11 >> 10; *dst++ = (VAR_12 << 3) | (VAR_12 >> 2); *dst++ = (VAR_13 << 3) | (VAR_13 >> 2); *dst++ = (VAR_14 << 3) | (VAR_14 >> 2); VAR_0 += 2; } else { uint32_t VAR_11 = VAR_7[*VAR_0++]; bytestream_put_le24(&dst, VAR_11); } } } return VAR_0 - VAR_10; }