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(
NULL,
" 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(
NULL,
" 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(
NULL,
" 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;
888 av_dlog(
NULL,
"------------------ frame %d\n", frame);
912 " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n",
933 "Interplay video: decode finished with %d bytes left over\n",
956 void *
data,
int *got_frame,
960 int buf_size = avpkt->
size;
968 if (buf_size < s->decoding_map_size)
1019 .
name =
"interplayvideo",
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
This structure describes decoded (raw) audio or video data.
static int ipvideo_decode_block_opcode_0x6(IpvideoContext *s)
const unsigned char * decoding_map
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
unsigned char * pixel_ptr
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int ipvideo_decode_block_opcode_0x1(IpvideoContext *s)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
static int ipvideo_decode_block_opcode_0x7_16(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0xF(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x4(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0xD_16(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s)
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
8 bit with PIX_FMT_RGB32 palette
static void ipvideo_decode_opcodes(IpvideoContext *s)
#define AV_PIX_FMT_RGB555
AVFrame second_last_frame
bitstream reader API header.
static int ipvideo_decode_block_opcode_0x8_16(IpvideoContext *s)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int init(AVCodecParserContext *s)
static int ipvideo_decode_block_opcode_0xE(IpvideoContext *s)
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
static int ipvideo_decode_block_opcode_0xE_16(IpvideoContext *s)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
static int(*const ipvideo_decode_block[])(IpvideoContext *s)
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s)
static av_cold int ipvideo_decode_end(AVCodecContext *avctx)
void av_log(void *avcl, int level, const char *fmt,...)
static int ipvideo_decode_block_opcode_0xB_16(IpvideoContext *s)
const char * name
Name of the codec implementation.
GetByteContext stream_ptr
static int(*const ipvideo_decode_block16[])(IpvideoContext *s)
#define CODEC_CAP_PARAM_CHANGE
int width
picture width / height.
static int ipvideo_decode_block_opcode_0xD(IpvideoContext *s)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
struct IpvideoContext IpvideoContext
static int ipvideo_decode_block_opcode_0x7(IpvideoContext *s)
static av_always_inline int bytestream2_tell(GetByteContext *g)
static int ipvideo_decode_block_opcode_0xB(IpvideoContext *s)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
int palette_has_changed
Tell user application that palette has changed from previous frame.
static int copy_from(IpvideoContext *s, AVFrame *src, int delta_x, int delta_y)
AVCodec ff_interplay_video_decoder
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int ipvideo_decode_block_opcode_0xC_16(IpvideoContext *s)
common internal api header.
int upper_motion_limit_offset
static int ipvideo_decode_block_opcode_0x2(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x0(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x9_16(IpvideoContext *s)
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
static int ipvideo_decode_block_opcode_0x9(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0xA_16(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0xC(IpvideoContext *s)
This structure stores compressed data.
static int ipvideo_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)