+ memset(s->pixel_ptr, P[0], 4);
+ memset(s->pixel_ptr + 4, P[1], 4);
+ s->pixel_ptr += s->stride;
+ }
+
+ /* report success */
+ return 0;
+}
+
+static int ipvideo_decode_block_opcode_0xE(IpvideoContext *s)
+{
+ int y;
+ unsigned char pix;
+
+ /* 1-color encoding: the whole block is 1 solid color */
+ CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
+ pix = *s->stream_ptr++;
+
+ for (y = 0; y < 8; y++) {
+ memset(s->pixel_ptr, pix, 8);
+ s->pixel_ptr += s->stride;
+ }
+
+ /* report success */
+ return 0;
+}
+
+static int ipvideo_decode_block_opcode_0xF(IpvideoContext *s)
+{
+ int x, y;
+ unsigned char sample[2];
+
+ /* dithered encoding */
+ CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
+ sample[0] = *s->stream_ptr++;
+ sample[1] = *s->stream_ptr++;
+
+ for (y = 0; y < 8; y++) {
+ for (x = 0; x < 8; x += 2) {
+ *s->pixel_ptr++ = sample[ y & 1 ];
+ *s->pixel_ptr++ = sample[!(y & 1)];
+ }
+ s->pixel_ptr += s->line_inc;
+ }
+
+ /* report success */
+ return 0;
+}
+
+static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s)
+{
+ signed char x, y;
+
+ /* copy a block from the second last frame using an expanded range */
+ CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
+
+ x = *s->stream_ptr++;
+ y = *s->stream_ptr++;
+
+ av_dlog(NULL, " motion bytes = %d, %d\n", x, y);
+ return copy_from(s, &s->second_last_frame, x, y);
+}
+
+static int ipvideo_decode_block_opcode_0x7_16(IpvideoContext *s)
+{
+ int x, y;
+ uint16_t P[2];
+ unsigned int flags;
+ uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
+
+ /* 2-color encoding */
+ CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
+
+ P[0] = bytestream_get_le16(&s->stream_ptr);
+ P[1] = bytestream_get_le16(&s->stream_ptr);
+
+ if (!(P[0] & 0x8000)) {
+
+ CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);