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);
207 for (y = 0; y < 8; y++) {
208 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
209 for (; flags != 1; flags >>= 1)
218 for (y = 0; y < 8; y += 2) {
219 for (x = 0; x < 8; x += 2, flags >>= 1) {
237 unsigned int flags = 0;
245 for (y = 0; y < 16; y++) {
255 for (x = 0; x < 4; x++, flags >>= 1)
271 for (y = 0; y < 16; y++) {
272 for (x = 0; x < 4; x++, flags >>= 1)
288 for (y = 0; y < 8; y++) {
295 for (x = 0; x < 8; x++, flags >>= 1)
318 for (y = 0; y < 8; y++) {
321 for (x = 0; x < 8; x++, flags >>= 2)
332 for (y = 0; y < 8; y += 2) {
333 for (x = 0; x < 8; x += 2, flags >>= 2) {
349 for (y = 0; y < 8; y++) {
350 for (x = 0; x < 8; x += 2, flags >>= 2) {
357 for (y = 0; y < 8; y += 2) {
358 for (x = 0; x < 8; x++, flags >>= 2) {
384 for (y = 0; y < 16; y++) {
391 for (x = 0; x < 4; x++, flags >>= 2)
402 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
410 for (y = 0; y < 16; y++) {
411 for (x = 0; x < 4; x++, flags >>= 2)
437 for (y = 0; y < 8; y++) {
451 for (y = 0; y < 8; y += 2) {
452 for (x = 0; x < 8; x += 2) {
471 for (y = 0; y < 8; y++) {
493 for (y = 0; y < 8; y++) {
508 sample[0] = bytestream2_get_byte(&s->
stream_ptr);
509 sample[1] = bytestream2_get_byte(&s->
stream_ptr);
511 for (y = 0; y < 8; y++) {
512 for (x = 0; x < 8; x += 2) {
540 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
546 if (!(P[0] & 0x8000)) {
548 for (y = 0; y < 8; y++) {
549 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
550 for (; flags != 1; flags >>= 1)
551 *pixel_ptr++ = P[flags & 1];
558 for (y = 0; y < 8; y += 2) {
559 for (x = 0; x < 8; x += 2, flags >>= 1) {
562 pixel_ptr[x + s->
stride] =
563 pixel_ptr[x + 1 + s->
stride] = P[flags & 1];
565 pixel_ptr += s->
stride * 2;
576 unsigned int flags = 0;
577 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
584 if (!(P[0] & 0x8000)) {
586 for (y = 0; y < 16; y++) {
596 for (x = 0; x < 4; x++, flags >>= 1)
597 *pixel_ptr++ = P[flags & 1];
598 pixel_ptr += s->
stride - 4;
600 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
609 if (!(P[2] & 0x8000)) {
613 for (y = 0; y < 16; y++) {
614 for (x = 0; x < 4; x++, flags >>= 1)
615 *pixel_ptr++ = P[flags & 1];
616 pixel_ptr += s->
stride - 4;
619 pixel_ptr -= 8 * s->
stride - 4;
630 for (y = 0; y < 8; y++) {
637 for (x = 0; x < 8; x++, flags >>= 1)
638 *pixel_ptr++ = P[flags & 1];
652 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
655 for (x = 0; x < 4; x++)
658 if (!(P[0] & 0x8000)) {
659 if (!(P[2] & 0x8000)) {
662 for (y = 0; y < 8; y++) {
665 for (x = 0; x < 8; x++, flags >>= 2)
666 *pixel_ptr++ = P[flags & 0x03];
676 for (y = 0; y < 8; y += 2) {
677 for (x = 0; x < 8; x += 2, flags >>= 2) {
680 pixel_ptr[x + s->
stride] =
681 pixel_ptr[x + 1 + s->
stride] = P[flags & 0x03];
683 pixel_ptr += s->
stride * 2;
692 if (!(P[2] & 0x8000)) {
693 for (y = 0; y < 8; y++) {
694 for (x = 0; x < 8; x += 2, flags >>= 2) {
696 pixel_ptr[x + 1] = P[flags & 0x03];
701 for (y = 0; y < 8; y += 2) {
702 for (x = 0; x < 8; x++, flags >>= 2) {
704 pixel_ptr[x + s->
stride] = P[flags & 0x03];
706 pixel_ptr += s->
stride * 2;
720 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
722 for (x = 0; x < 4; x++)
727 if (!(P[0] & 0x8000)) {
730 for (y = 0; y < 16; y++) {
734 for (x = 0; x < 4; x++)
739 for (x = 0; x < 4; x++, flags >>= 2)
740 *pixel_ptr++ = P[flags & 0x03];
742 pixel_ptr += s->
stride - 4;
744 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
750 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
752 for (x = 4; x < 8; x++)
754 vert = !(P[4] & 0x8000);
759 for (y = 0; y < 16; y++) {
760 for (x = 0; x < 4; x++, flags >>= 2)
761 *pixel_ptr++ = P[flags & 0x03];
764 pixel_ptr += s->
stride - 4;
766 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
767 }
else if (y & 1) pixel_ptr += s->
line_inc;
784 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
787 for (y = 0; y < 8; y++) {
788 for (x = 0; x < 8; x++)
789 pixel_ptr[x] = bytestream2_get_le16(&s->
stream_ptr);
800 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
803 for (y = 0; y < 8; y += 2) {
804 for (x = 0; x < 8; x += 2) {
807 pixel_ptr[x + s->
stride] =
810 pixel_ptr += s->
stride * 2;
821 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
824 for (y = 0; y < 8; y++) {
829 for (x = 0; x < 8; x++)
830 pixel_ptr[x] = P[x >> 2];
842 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
847 for (y = 0; y < 8; y++) {
848 for (x = 0; x < 8; x++)
882 unsigned char opcode;
907 " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n",
928 "decode finished with %d bytes left over\n",
956 void *
data,
int *got_frame,
960 int buf_size = avpkt->
size;
970 if (buf_size < s->decoding_map_size)
1018 .
name =
"interplayvideo",
This structure describes decoded (raw) audio or video data.
const unsigned char * decoding_map
unsigned char * pixel_ptr
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int init(AVCodecContext *avctx)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
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_0x4(IpvideoContext *s, AVFrame *frame)
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
static int(*const ipvideo_decode_block16[])(IpvideoContext *s, AVFrame *frame)
#define AV_PIX_FMT_RGB555
static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s, AVFrame *frame)
static int ipvideo_decode_block_opcode_0x2(IpvideoContext *s, AVFrame *frame)
static int ipvideo_decode_block_opcode_0x9(IpvideoContext *s, AVFrame *frame)
static int ipvideo_decode_block_opcode_0x7_16(IpvideoContext *s, AVFrame *frame)
const char * name
Name of the codec implementation.
int av_frame_ref(AVFrame *dst, AVFrame *src)
Setup a new reference to the data described by a given frame.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
bitstream reader API header.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define FFSWAP(type, a, b)
static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s, AVFrame *frame)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int ipvideo_decode_block_opcode_0x8_16(IpvideoContext *s, AVFrame *frame)
#define CODEC_CAP_PARAM_CHANGE
Codec supports changed parameters at any point.
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
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. ...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static int ipvideo_decode_block_opcode_0xD(IpvideoContext *s, AVFrame *frame)
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
static int ipvideo_decode_block_opcode_0xE_16(IpvideoContext *s, AVFrame *frame)
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
static av_cold int ipvideo_decode_end(AVCodecContext *avctx)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Libavcodec external API header.
static int ipvideo_decode_block_opcode_0xC_16(IpvideoContext *s, AVFrame *frame)
GetByteContext stream_ptr
static int ipvideo_decode_block_opcode_0x0(IpvideoContext *s, AVFrame *frame)
av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s, AVFrame *frame)
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
int width
picture width / height.
static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s, AVFrame *frame)
static int copy_from(IpvideoContext *s, AVFrame *src, AVFrame *dst, int delta_x, int delta_y)
static int ipvideo_decode_block_opcode_0x1(IpvideoContext *s, AVFrame *frame)
AVFrame * second_last_frame
static av_always_inline int bytestream2_tell(GetByteContext *g)
main external API structure.
static void close(AVCodecParserContext *s)
static int ipvideo_decode_block_opcode_0x6(IpvideoContext *s, AVFrame *frame)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
static int ipvideo_decode_block_opcode_0xD_16(IpvideoContext *s, AVFrame *frame)
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.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s, AVFrame *frame)
AVCodec ff_interplay_video_decoder
static int ipvideo_decode_block_opcode_0xB_16(IpvideoContext *s, AVFrame *frame)
static int ipvideo_decode_block_opcode_0xE(IpvideoContext *s, AVFrame *frame)
static void ipvideo_decode_opcodes(IpvideoContext *s, AVFrame *frame)
common internal api header.
static int ipvideo_decode_block_opcode_0x9_16(IpvideoContext *s, AVFrame *frame)
int upper_motion_limit_offset
static int ipvideo_decode_block_opcode_0xF(IpvideoContext *s, AVFrame *frame)
#define AVERROR_INVALIDDATA
static int ipvideo_decode_block_opcode_0xB(IpvideoContext *s, AVFrame *frame)
static int ipvideo_decode_block_opcode_0xA_16(IpvideoContext *s, AVFrame *frame)
int frame_number
Frame counter, set by libavcodec.
static int ipvideo_decode_block_opcode_0x7(IpvideoContext *s, AVFrame *frame)
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
8 bit with PIX_FMT_RGB32 palette
static int(*const ipvideo_decode_block[])(IpvideoContext *s, AVFrame *frame)
static int ipvideo_decode_block_opcode_0xC(IpvideoContext *s, AVFrame *frame)
This structure stores compressed data.
static int ipvideo_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.