static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s, AVFrame *frame)
{
    int x, y;
    unsigned char P[8];
    int flags = 0;
    bytestream2_get_buffer(&s->stream_ptr, P, 4);
    /* 4-color encoding for each 4x4 quadrant, or 4-color encoding on
     * either top and bottom or left and right halves */
    if (P[0] <= P[1]) {
        /* 4-color encoding for each quadrant; need 32 bytes */
        for (y = 0; y < 16; y++) {
            // new values for each 4x4 block
            if (!(y & 3)) {
                if (y) bytestream2_get_buffer(&s->stream_ptr, P, 4);
                flags = bytestream2_get_le32(&s->stream_ptr);
            for (x = 0; x < 4; x++, flags >>= 2)
                *s->pixel_ptr++ = P[flags & 0x03];
            s->pixel_ptr += s->stride - 4;
            // switch to right half
            if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
    } else {
        // vertical split?
        int vert;
        uint64_t flags = bytestream2_get_le64(&s->stream_ptr);
        bytestream2_get_buffer(&s->stream_ptr, P + 4, 4);
        vert = P[4] <= P[5];
        /* 4-color encoding for either left and right or top and bottom
         * halves */
        for (y = 0; y < 16; y++) {
            for (x = 0; x < 4; x++, flags >>= 2)
                *s->pixel_ptr++ = P[flags & 0x03];
            if (vert) {
                s->pixel_ptr += s->stride - 4;
                // switch to right half
                if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
            } else if (y & 1) s->pixel_ptr += s->line_inc;
            // load values for second half
            if (y == 7) {
                memcpy(P, P + 4, 4);
                flags = bytestream2_get_le64(&s->stream_ptr);
    /* report success */
    return 0;
static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s, AVFrame *frame)
{
    int x, y;
    unsigned char P[8];
    int flags = 0;
    bytestream2_get_buffer(&s->stream_ptr, P, 4);
    

    if (P[0] <= P[1]) {
        
        for (y = 0; y < 16; y++) {
            
            if (!(y & 3)) {
                if (y) bytestream2_get_buffer(&s->stream_ptr, P, 4);
                flags = bytestream2_get_le32(&s->stream_ptr);
            for (x = 0; x < 4; x++, flags >>= 2)
                *s->pixel_ptr++ = P[flags & 0x03];
            s->pixel_ptr += s->stride - 4;
            
            if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
    } else {
        
        int vert;
        uint64_t flags = bytestream2_get_le64(&s->stream_ptr);
        bytestream2_get_buffer(&s->stream_ptr, P + 4, 4);
        vert = P[4] <= P[5];
        

        for (y = 0; y < 16; y++) {
            for (x = 0; x < 4; x++, flags >>= 2)
                *s->pixel_ptr++ = P[flags & 0x03];
            if (vert) {
                s->pixel_ptr += s->stride - 4;
                
                if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
            } else if (y & 1) s->pixel_ptr += s->line_inc;
            
            if (y == 7) {
                memcpy(P, P + 4, 4);
                flags = bytestream2_get_le64(&s->stream_ptr);
    
    return 0;
static int FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1)
{
    int VAR_2, VAR_3;
    unsigned char VAR_4[8];
    int VAR_5 = 0;
    bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4, 4);
    

    if (VAR_4[0] <= VAR_4[1]) {
        
        for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {
            
            if (!(VAR_3 & 3)) {
                if (VAR_3) bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4, 4);
                VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr);
            for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 2)
                *VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 0x03];
            VAR_0->pixel_ptr += VAR_0->stride - 4;
            
            if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4;
    } else {
        
        int VAR_6;
        uint64_t VAR_5 = bytestream2_get_le64(&VAR_0->stream_ptr);
        bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4 + 4, 4);
        VAR_6 = VAR_4[4] <= VAR_4[5];
        

        for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {
            for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 2)
                *VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 0x03];
            if (VAR_6) {
                VAR_0->pixel_ptr += VAR_0->stride - 4;
                
                if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4;
            } else if (VAR_3 & 1) VAR_0->pixel_ptr += VAR_0->line_inc;
            
            if (VAR_3 == 7) {
                memcpy(VAR_4, VAR_4 + 4, 4);
                VAR_5 = bytestream2_get_le64(&VAR_0->stream_ptr);
    
    return 0;
static int FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1)
{ int VAR_2, VAR_3; unsigned char VAR_4[8]; int VAR_5 = 0; bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4, 4); if (VAR_4[0] <= VAR_4[1]) { for (VAR_3 = 0; VAR_3 < 16; VAR_3++) { if (!(VAR_3 & 3)) { if (VAR_3) bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4, 4); VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr); for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 2) *VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 0x03]; VAR_0->pixel_ptr += VAR_0->stride - 4; if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4; } else { int VAR_6; uint64_t VAR_5 = bytestream2_get_le64(&VAR_0->stream_ptr); bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4 + 4, 4); VAR_6 = VAR_4[4] <= VAR_4[5]; for (VAR_3 = 0; VAR_3 < 16; VAR_3++) { for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 2) *VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 0x03]; if (VAR_6) { VAR_0->pixel_ptr += VAR_0->stride - 4; if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4; } else if (VAR_3 & 1) VAR_0->pixel_ptr += VAR_0->line_inc; if (VAR_3 == 7) { memcpy(VAR_4, VAR_4 + 4, 4); VAR_5 = bytestream2_get_le64(&VAR_0->stream_ptr); return 0;