static void decode_delta_d(uint8_t *dst,

                           const uint8_t *buf, const uint8_t *buf_end,

                           int w, int flag, int bpp, int dst_size)

{

    int planepitch = FFALIGN(w, 16) >> 3;

    int pitch = planepitch * bpp;

    int planepitch_byte = (w + 7) / 8;

    unsigned entries, ofssrc;

    GetByteContext gb, ptrs;

    PutByteContext pb;

    int k;



    if (buf_end - buf <= 4 * bpp)

        return;



    bytestream2_init_writer(&pb, dst, dst_size);

    bytestream2_init(&ptrs, buf, bpp * 4);



    for (k = 0; k < bpp; k++) {

        ofssrc = bytestream2_get_be32(&ptrs);



        if (!ofssrc)

            continue;



        if (ofssrc >= buf_end - buf)

            continue;



        bytestream2_init(&gb, buf + ofssrc, buf_end - (buf + ofssrc));



        entries = bytestream2_get_be32(&gb);

        while (entries) {

            int32_t opcode  = bytestream2_get_be32(&gb);

            unsigned offset = bytestream2_get_be32(&gb);



            bytestream2_seek_p(&pb, (offset / planepitch_byte) * pitch + (offset % planepitch_byte) + k * planepitch, SEEK_SET);

            if (opcode >= 0) {

                uint32_t x = bytestream2_get_be32(&gb);

                while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {

                    bytestream2_put_be32(&pb, x);

                    bytestream2_skip_p(&pb, pitch - 4);

                    opcode--;

                }

            } else {

                opcode = -opcode;

                while (opcode && bytestream2_get_bytes_left(&gb) > 0) {

                    bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));

                    bytestream2_skip_p(&pb, pitch - 4);

                    opcode--;

                }

            }

            entries--;

        }

    }

}

static void decode_delta_d(uint8_t *dst,

                           const uint8_t *buf, const uint8_t *buf_end,

                           int w, int flag, int bpp, int dst_size)

{

    int planepitch = FFALIGN(w, 16) >> 3;

    int pitch = planepitch * bpp;

    int planepitch_byte = (w + 7) / 8;

    unsigned entries, ofssrc;

    GetByteContext gb, ptrs;

    PutByteContext pb;

    int k;



    if (buf_end - buf <= 4 * bpp)

        return;



    bytestream2_init_writer(&pb, dst, dst_size);

    bytestream2_init(&ptrs, buf, bpp * 4);



    for (k = 0; k < bpp; k++) {

        ofssrc = bytestream2_get_be32(&ptrs);



        if (!ofssrc)

            continue;



        if (ofssrc >= buf_end - buf)

            continue;



        bytestream2_init(&gb, buf + ofssrc, buf_end - (buf + ofssrc));



        entries = bytestream2_get_be32(&gb);

        while (entries) {

            int32_t opcode  = bytestream2_get_be32(&gb);

            unsigned offset = bytestream2_get_be32(&gb);



            bytestream2_seek_p(&pb, (offset / planepitch_byte) * pitch + (offset % planepitch_byte) + k * planepitch, SEEK_SET);

            if (opcode >= 0) {

                uint32_t x = bytestream2_get_be32(&gb);

                while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {

                    bytestream2_put_be32(&pb, x);

                    bytestream2_skip_p(&pb, pitch - 4);

                    opcode--;

                }

            } else {

                opcode = -opcode;

                while (opcode && bytestream2_get_bytes_left(&gb) > 0) {

                    bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));

                    bytestream2_skip_p(&pb, pitch - 4);

                    opcode--;

                }

            }

            entries--;

        }

    }

}

static void FUNC_0(uint8_t *VAR_0,

                           const uint8_t *VAR_1, const uint8_t *VAR_2,

                           int VAR_3, int VAR_4, int VAR_5, int VAR_6)

{

    int VAR_7 = FFALIGN(VAR_3, 16) >> 3;

    int VAR_8 = VAR_7 * VAR_5;

    int VAR_9 = (VAR_3 + 7) / 8;

    unsigned VAR_10, VAR_11;

    GetByteContext gb, ptrs;

    PutByteContext pb;

    int VAR_12;



    if (VAR_2 - VAR_1 <= 4 * VAR_5)

        return;



    bytestream2_init_writer(&pb, VAR_0, VAR_6);

    bytestream2_init(&ptrs, VAR_1, VAR_5 * 4);



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

        VAR_11 = bytestream2_get_be32(&ptrs);



        if (!VAR_11)

            continue;



        if (VAR_11 >= VAR_2 - VAR_1)

            continue;



        bytestream2_init(&gb, VAR_1 + VAR_11, VAR_2 - (VAR_1 + VAR_11));



        VAR_10 = bytestream2_get_be32(&gb);

        while (VAR_10) {

            int32_t opcode  = bytestream2_get_be32(&gb);

            unsigned VAR_13 = bytestream2_get_be32(&gb);



            bytestream2_seek_p(&pb, (VAR_13 / VAR_9) * VAR_8 + (VAR_13 % VAR_9) + VAR_12 * VAR_7, SEEK_SET);

            if (opcode >= 0) {

                uint32_t x = bytestream2_get_be32(&gb);

                while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {

                    bytestream2_put_be32(&pb, x);

                    bytestream2_skip_p(&pb, VAR_8 - 4);

                    opcode--;

                }

            } else {

                opcode = -opcode;

                while (opcode && bytestream2_get_bytes_left(&gb) > 0) {

                    bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));

                    bytestream2_skip_p(&pb, VAR_8 - 4);

                    opcode--;

                }

            }

            VAR_10--;

        }

    }

}

static void FUNC_0(uint8_t *VAR_0,
const uint8_t *VAR_1, const uint8_t *VAR_2,
int VAR_3, int VAR_4, int VAR_5, int VAR_6)
{ int VAR_7 = FFALIGN(VAR_3, 16) >> 3; int VAR_8 = VAR_7 * VAR_5; int VAR_9 = (VAR_3 + 7) / 8; unsigned VAR_10, VAR_11; GetByteContext gb, ptrs; PutByteContext pb; int VAR_12; if (VAR_2 - VAR_1 <= 4 * VAR_5)
return; bytestream2_init_writer(&pb, VAR_0, VAR_6); bytestream2_init(&ptrs, VAR_1, VAR_5 * 4); for (VAR_12 = 0; VAR_12 < VAR_5; VAR_12++) { VAR_11 = bytestream2_get_be32(&ptrs); if (!VAR_11)
continue; if (VAR_11 >= VAR_2 - VAR_1)
continue; bytestream2_init(&gb, VAR_1 + VAR_11, VAR_2 - (VAR_1 + VAR_11)); VAR_10 = bytestream2_get_be32(&gb); while (VAR_10) { int32_t opcode  = bytestream2_get_be32(&gb); unsigned VAR_13 = bytestream2_get_be32(&gb); bytestream2_seek_p(&pb, (VAR_13 / VAR_9) * VAR_8 + (VAR_13 % VAR_9) + VAR_12 * VAR_7, SEEK_SET); if (opcode >= 0) { uint32_t x = bytestream2_get_be32(&gb); while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) { bytestream2_put_be32(&pb, x); bytestream2_skip_p(&pb, VAR_8 - 4); opcode--; } } else { opcode = -opcode; while (opcode && bytestream2_get_bytes_left(&gb) > 0) { bytestream2_put_be32(&pb, bytestream2_get_be32(&gb)); bytestream2_skip_p(&pb, VAR_8 - 4); opcode--; } } VAR_10--; } } }