44 #define BITSTREAM_READER_LE
48 #define PALETTE_COUNT 256
75 if (motion_offset < 0) {
111 B = bytestream2_get_byte(&s->
mv_ptr);
118 x = -14 + ((B - 56) % 29);
119 y = 8 + ((B - 56) / 29);
122 av_dlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
137 B = bytestream2_get_byte(&s->
mv_ptr);
144 x = -(-14 + ((B - 56) % 29));
145 y = -( 8 + ((B - 56) / 29));
148 av_dlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
155 unsigned char B, BL, BH;
161 B = bytestream2_get_byte(&s->
mv_ptr);
165 BH = (B >> 4) & 0x0F;
169 av_dlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
208 for (y = 0; y < 8; y++) {
209 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
210 for (; flags != 1; flags >>= 1)
219 for (y = 0; y < 8; y += 2) {
220 for (x = 0; x < 8; x += 2, flags >>= 1) {
238 unsigned int flags = 0;
246 for (y = 0; y < 16; y++) {
256 for (x = 0; x < 4; x++, flags >>= 1)
272 for (y = 0; y < 16; y++) {
273 for (x = 0; x < 4; x++, flags >>= 1)
289 for (y = 0; y < 8; y++) {
296 for (x = 0; x < 8; x++, flags >>= 1)
319 for (y = 0; y < 8; y++) {
322 for (x = 0; x < 8; x++, flags >>= 2)
333 for (y = 0; y < 8; y += 2) {
334 for (x = 0; x < 8; x += 2, flags >>= 2) {
350 for (y = 0; y < 8; y++) {
351 for (x = 0; x < 8; x += 2, flags >>= 2) {
358 for (y = 0; y < 8; y += 2) {
359 for (x = 0; x < 8; x++, flags >>= 2) {
385 for (y = 0; y < 16; y++) {
392 for (x = 0; x < 4; x++, flags >>= 2)
403 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
411 for (y = 0; y < 16; y++) {
412 for (x = 0; x < 4; x++, flags >>= 2)
438 for (y = 0; y < 8; y++) {
452 for (y = 0; y < 8; y += 2) {
453 for (x = 0; x < 8; x += 2) {
472 for (y = 0; y < 8; y++) {
494 for (y = 0; y < 8; y++) {
509 sample[0] = bytestream2_get_byte(&s->
stream_ptr);
510 sample[1] = bytestream2_get_byte(&s->
stream_ptr);
512 for (y = 0; y < 8; y++) {
513 for (x = 0; x < 8; x += 2) {
541 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
547 if (!(P[0] & 0x8000)) {
549 for (y = 0; y < 8; y++) {
550 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
551 for (; flags != 1; flags >>= 1)
552 *pixel_ptr++ = P[flags & 1];
559 for (y = 0; y < 8; y += 2) {
560 for (x = 0; x < 8; x += 2, flags >>= 1) {
563 pixel_ptr[x + s->
stride] =
564 pixel_ptr[x + 1 + s->
stride] = P[flags & 1];
566 pixel_ptr += s->
stride * 2;
577 unsigned int flags = 0;
578 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
585 if (!(P[0] & 0x8000)) {
587 for (y = 0; y < 16; y++) {
597 for (x = 0; x < 4; x++, flags >>= 1)
598 *pixel_ptr++ = P[flags & 1];
599 pixel_ptr += s->
stride - 4;
601 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
610 if (!(P[2] & 0x8000)) {
614 for (y = 0; y < 16; y++) {
615 for (x = 0; x < 4; x++, flags >>= 1)
616 *pixel_ptr++ = P[flags & 1];
617 pixel_ptr += s->
stride - 4;
620 pixel_ptr -= 8 * s->
stride - 4;
631 for (y = 0; y < 8; y++) {
638 for (x = 0; x < 8; x++, flags >>= 1)
639 *pixel_ptr++ = P[flags & 1];
653 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
656 for (x = 0; x < 4; x++)
659 if (!(P[0] & 0x8000)) {
660 if (!(P[2] & 0x8000)) {
663 for (y = 0; y < 8; y++) {
666 for (x = 0; x < 8; x++, flags >>= 2)
667 *pixel_ptr++ = P[flags & 0x03];
677 for (y = 0; y < 8; y += 2) {
678 for (x = 0; x < 8; x += 2, flags >>= 2) {
681 pixel_ptr[x + s->
stride] =
682 pixel_ptr[x + 1 + s->
stride] = P[flags & 0x03];
684 pixel_ptr += s->
stride * 2;
693 if (!(P[2] & 0x8000)) {
694 for (y = 0; y < 8; y++) {
695 for (x = 0; x < 8; x += 2, flags >>= 2) {
697 pixel_ptr[x + 1] = P[flags & 0x03];
702 for (y = 0; y < 8; y += 2) {
703 for (x = 0; x < 8; x++, flags >>= 2) {
705 pixel_ptr[x + s->
stride] = P[flags & 0x03];
707 pixel_ptr += s->
stride * 2;
721 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
723 for (x = 0; x < 4; x++)
728 if (!(P[0] & 0x8000)) {
731 for (y = 0; y < 16; y++) {
735 for (x = 0; x < 4; x++)
740 for (x = 0; x < 4; x++, flags >>= 2)
741 *pixel_ptr++ = P[flags & 0x03];
743 pixel_ptr += s->
stride - 4;
745 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
751 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
753 for (x = 4; x < 8; x++)
755 vert = !(P[4] & 0x8000);
760 for (y = 0; y < 16; y++) {
761 for (x = 0; x < 4; x++, flags >>= 2)
762 *pixel_ptr++ = P[flags & 0x03];
765 pixel_ptr += s->
stride - 4;
767 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
768 }
else if (y & 1) pixel_ptr += s->
line_inc;
785 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
788 for (y = 0; y < 8; y++) {
789 for (x = 0; x < 8; x++)
790 pixel_ptr[x] = bytestream2_get_le16(&s->
stream_ptr);
801 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
804 for (y = 0; y < 8; y += 2) {
805 for (x = 0; x < 8; x += 2) {
808 pixel_ptr[x + s->
stride] =
811 pixel_ptr += s->
stride * 2;
822 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
825 for (y = 0; y < 8; y++) {
830 for (x = 0; x < 8; x++)
831 pixel_ptr[x] = P[x >> 2];
843 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
848 for (y = 0; y < 8; y++) {
849 for (x = 0; x < 8; x++)
883 unsigned char opcode;
885 static int frame = 0;
912 " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n",
933 "decode finished with %d bytes left over\n",
960 void *
data,
int *got_frame,
964 int buf_size = avpkt->
size;
972 if (buf_size < s->decoding_map_size)
1023 .
name =
"interplayvideo",