45 #define BITSTREAM_READER_LE
49 #define PALETTE_COUNT 256
73 int motion_offset = current_offset + delta_y * dst->
linesize[0]
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);
213 for (y = 0; y < 8; y++) {
214 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
215 for (; flags != 1; flags >>= 1)
224 for (y = 0; y < 8; y += 2) {
225 for (x = 0; x < 8; x += 2, flags >>= 1) {
243 unsigned int flags = 0;
256 for (y = 0; y < 16; y++) {
266 for (x = 0; x < 4; x++, flags >>= 1)
282 for (y = 0; y < 16; y++) {
283 for (x = 0; x < 4; x++, flags >>= 1)
299 for (y = 0; y < 8; y++) {
306 for (x = 0; x < 8; x++, flags >>= 1)
334 for (y = 0; y < 8; y++) {
337 for (x = 0; x < 8; x++, flags >>= 2)
348 for (y = 0; y < 8; y += 2) {
349 for (x = 0; x < 8; x += 2, flags >>= 2) {
365 for (y = 0; y < 8; y++) {
366 for (x = 0; x < 8; x += 2, flags >>= 2) {
373 for (y = 0; y < 8; y += 2) {
374 for (x = 0; x < 8; x++, flags >>= 2) {
405 for (y = 0; y < 16; y++) {
412 for (x = 0; x < 4; x++, flags >>= 2)
423 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
431 for (y = 0; y < 16; y++) {
432 for (x = 0; x < 4; x++, flags >>= 2)
458 for (y = 0; y < 8; y++) {
472 for (y = 0; y < 8; y += 2) {
473 for (x = 0; x < 8; x += 2) {
497 for (y = 0; y < 8; y++) {
519 for (y = 0; y < 8; y++) {
534 sample[0] = bytestream2_get_byte(&s->
stream_ptr);
535 sample[1] = bytestream2_get_byte(&s->
stream_ptr);
537 for (y = 0; y < 8; y++) {
538 for (x = 0; x < 8; x += 2) {
566 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
572 if (!(P[0] & 0x8000)) {
574 for (y = 0; y < 8; y++) {
575 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
576 for (; flags != 1; flags >>= 1)
577 *pixel_ptr++ = P[flags & 1];
584 for (y = 0; y < 8; y += 2) {
585 for (x = 0; x < 8; x += 2, flags >>= 1) {
588 pixel_ptr[x + s->
stride] =
589 pixel_ptr[x + 1 + s->
stride] = P[flags & 1];
591 pixel_ptr += s->
stride * 2;
602 unsigned int flags = 0;
603 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
610 if (!(P[0] & 0x8000)) {
612 for (y = 0; y < 16; y++) {
622 for (x = 0; x < 4; x++, flags >>= 1)
623 *pixel_ptr++ = P[flags & 1];
624 pixel_ptr += s->
stride - 4;
626 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
635 if (!(P[2] & 0x8000)) {
639 for (y = 0; y < 16; y++) {
640 for (x = 0; x < 4; x++, flags >>= 1)
641 *pixel_ptr++ = P[flags & 1];
642 pixel_ptr += s->
stride - 4;
645 pixel_ptr -= 8 * s->
stride - 4;
656 for (y = 0; y < 8; y++) {
663 for (x = 0; x < 8; x++, flags >>= 1)
664 *pixel_ptr++ = P[flags & 1];
678 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
681 for (x = 0; x < 4; x++)
684 if (!(P[0] & 0x8000)) {
685 if (!(P[2] & 0x8000)) {
688 for (y = 0; y < 8; y++) {
691 for (x = 0; x < 8; x++, flags >>= 2)
692 *pixel_ptr++ = P[flags & 0x03];
702 for (y = 0; y < 8; y += 2) {
703 for (x = 0; x < 8; x += 2, flags >>= 2) {
706 pixel_ptr[x + s->
stride] =
707 pixel_ptr[x + 1 + s->
stride] = P[flags & 0x03];
709 pixel_ptr += s->
stride * 2;
718 if (!(P[2] & 0x8000)) {
719 for (y = 0; y < 8; y++) {
720 for (x = 0; x < 8; x += 2, flags >>= 2) {
722 pixel_ptr[x + 1] = P[flags & 0x03];
727 for (y = 0; y < 8; y += 2) {
728 for (x = 0; x < 8; x++, flags >>= 2) {
730 pixel_ptr[x + s->
stride] = P[flags & 0x03];
732 pixel_ptr += s->
stride * 2;
746 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
748 for (x = 0; x < 4; x++)
753 if (!(P[0] & 0x8000)) {
756 for (y = 0; y < 16; y++) {
760 for (x = 0; x < 4; x++)
765 for (x = 0; x < 4; x++, flags >>= 2)
766 *pixel_ptr++ = P[flags & 0x03];
768 pixel_ptr += s->
stride - 4;
770 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
776 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
778 for (x = 4; x < 8; x++)
780 vert = !(P[4] & 0x8000);
785 for (y = 0; y < 16; y++) {
786 for (x = 0; x < 4; x++, flags >>= 2)
787 *pixel_ptr++ = P[flags & 0x03];
790 pixel_ptr += s->
stride - 4;
792 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
793 }
else if (y & 1) pixel_ptr += s->
line_inc;
810 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
813 for (y = 0; y < 8; y++) {
814 for (x = 0; x < 8; x++)
815 pixel_ptr[x] = bytestream2_get_le16(&s->
stream_ptr);
826 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
829 for (y = 0; y < 8; y += 2) {
830 for (x = 0; x < 8; x += 2) {
833 pixel_ptr[x + s->
stride] =
836 pixel_ptr += s->
stride * 2;
847 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
850 for (y = 0; y < 8; y++) {
855 for (x = 0; x < 8; x++)
856 pixel_ptr[x] = P[x >> 2];
868 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
873 for (y = 0; y < 8; y++) {
874 for (x = 0; x < 8; x++)
908 unsigned char opcode;
933 " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n",
954 "decode finished with %d bytes left over\n",
982 void *
data,
int *got_frame,
986 int buf_size = avpkt->
size;
999 if (buf_size < s->decoding_map_size + 2)
1047 .
name =
"interplayvideo",