44 #define BITSTREAM_READER_LE
48 #define PALETTE_COUNT 256
72 int motion_offset = current_offset + delta_y * dst->
linesize[0]
74 if (motion_offset < 0) {
82 if (src->
data[0] == NULL) {
110 B = bytestream2_get_byte(&s->
mv_ptr);
117 x = -14 + ((B - 56) % 29);
118 y = 8 + ((B - 56) / 29);
121 av_dlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
136 B = bytestream2_get_byte(&s->
mv_ptr);
143 x = -(-14 + ((B - 56) % 29));
144 y = -( 8 + ((B - 56) / 29));
147 av_dlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
154 unsigned char B, BL, BH;
160 B = bytestream2_get_byte(&s->
mv_ptr);
164 BH = (B >> 4) & 0x0F;
168 av_dlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
212 for (y = 0; y < 8; y++) {
213 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
214 for (; flags != 1; flags >>= 1)
223 for (y = 0; y < 8; y += 2) {
224 for (x = 0; x < 8; x += 2, flags >>= 1) {
242 unsigned int flags = 0;
255 for (y = 0; y < 16; y++) {
265 for (x = 0; x < 4; x++, flags >>= 1)
281 for (y = 0; y < 16; y++) {
282 for (x = 0; x < 4; x++, flags >>= 1)
298 for (y = 0; y < 8; y++) {
305 for (x = 0; x < 8; x++, flags >>= 1)
333 for (y = 0; y < 8; y++) {
336 for (x = 0; x < 8; x++, flags >>= 2)
347 for (y = 0; y < 8; y += 2) {
348 for (x = 0; x < 8; x += 2, flags >>= 2) {
364 for (y = 0; y < 8; y++) {
365 for (x = 0; x < 8; x += 2, flags >>= 2) {
372 for (y = 0; y < 8; y += 2) {
373 for (x = 0; x < 8; x++, flags >>= 2) {
404 for (y = 0; y < 16; y++) {
411 for (x = 0; x < 4; x++, flags >>= 2)
422 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
430 for (y = 0; y < 16; y++) {
431 for (x = 0; x < 4; x++, flags >>= 2)
457 for (y = 0; y < 8; y++) {
471 for (y = 0; y < 8; y += 2) {
472 for (x = 0; x < 8; x += 2) {
496 for (y = 0; y < 8; y++) {
518 for (y = 0; y < 8; y++) {
533 sample[0] = bytestream2_get_byte(&s->
stream_ptr);
534 sample[1] = bytestream2_get_byte(&s->
stream_ptr);
536 for (y = 0; y < 8; y++) {
537 for (x = 0; x < 8; x += 2) {
565 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
571 if (!(P[0] & 0x8000)) {
573 for (y = 0; y < 8; y++) {
574 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
575 for (; flags != 1; flags >>= 1)
576 *pixel_ptr++ = P[flags & 1];
583 for (y = 0; y < 8; y += 2) {
584 for (x = 0; x < 8; x += 2, flags >>= 1) {
587 pixel_ptr[x + s->
stride] =
588 pixel_ptr[x + 1 + s->
stride] = P[flags & 1];
590 pixel_ptr += s->
stride * 2;
601 unsigned int flags = 0;
602 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
609 if (!(P[0] & 0x8000)) {
611 for (y = 0; y < 16; y++) {
621 for (x = 0; x < 4; x++, flags >>= 1)
622 *pixel_ptr++ = P[flags & 1];
623 pixel_ptr += s->
stride - 4;
625 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
634 if (!(P[2] & 0x8000)) {
638 for (y = 0; y < 16; y++) {
639 for (x = 0; x < 4; x++, flags >>= 1)
640 *pixel_ptr++ = P[flags & 1];
641 pixel_ptr += s->
stride - 4;
644 pixel_ptr -= 8 * s->
stride - 4;
655 for (y = 0; y < 8; y++) {
662 for (x = 0; x < 8; x++, flags >>= 1)
663 *pixel_ptr++ = P[flags & 1];
677 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
680 for (x = 0; x < 4; x++)
683 if (!(P[0] & 0x8000)) {
684 if (!(P[2] & 0x8000)) {
687 for (y = 0; y < 8; y++) {
690 for (x = 0; x < 8; x++, flags >>= 2)
691 *pixel_ptr++ = P[flags & 0x03];
701 for (y = 0; y < 8; y += 2) {
702 for (x = 0; x < 8; x += 2, flags >>= 2) {
705 pixel_ptr[x + s->
stride] =
706 pixel_ptr[x + 1 + s->
stride] = P[flags & 0x03];
708 pixel_ptr += s->
stride * 2;
717 if (!(P[2] & 0x8000)) {
718 for (y = 0; y < 8; y++) {
719 for (x = 0; x < 8; x += 2, flags >>= 2) {
721 pixel_ptr[x + 1] = P[flags & 0x03];
726 for (y = 0; y < 8; y += 2) {
727 for (x = 0; x < 8; x++, flags >>= 2) {
729 pixel_ptr[x + s->
stride] = P[flags & 0x03];
731 pixel_ptr += s->
stride * 2;
745 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
747 for (x = 0; x < 4; x++)
752 if (!(P[0] & 0x8000)) {
755 for (y = 0; y < 16; y++) {
759 for (x = 0; x < 4; x++)
764 for (x = 0; x < 4; x++, flags >>= 2)
765 *pixel_ptr++ = P[flags & 0x03];
767 pixel_ptr += s->
stride - 4;
769 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
775 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
777 for (x = 4; x < 8; x++)
779 vert = !(P[4] & 0x8000);
784 for (y = 0; y < 16; y++) {
785 for (x = 0; x < 4; x++, flags >>= 2)
786 *pixel_ptr++ = P[flags & 0x03];
789 pixel_ptr += s->
stride - 4;
791 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
792 }
else if (y & 1) pixel_ptr += s->
line_inc;
809 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
812 for (y = 0; y < 8; y++) {
813 for (x = 0; x < 8; x++)
814 pixel_ptr[x] = bytestream2_get_le16(&s->
stream_ptr);
825 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
828 for (y = 0; y < 8; y += 2) {
829 for (x = 0; x < 8; x += 2) {
832 pixel_ptr[x + s->
stride] =
835 pixel_ptr += s->
stride * 2;
846 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
849 for (y = 0; y < 8; y++) {
854 for (x = 0; x < 8; x++)
855 pixel_ptr[x] = P[x >> 2];
867 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
872 for (y = 0; y < 8; y++) {
873 for (x = 0; x < 8; x++)
907 unsigned char opcode;
932 " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n",
953 "decode finished with %d bytes left over\n",
981 void *
data,
int *got_frame,
985 int buf_size = avpkt->
size;
995 if (buf_size < s->decoding_map_size)
1043 .
name =
"interplayvideo",