43 #define BITSTREAM_READER_LE
50 #define PALETTE_COUNT 256
74 int motion_offset = current_offset + delta_y * dst->
linesize[0]
76 if (motion_offset < 0) {
112 B = bytestream2_get_byte(&s->
mv_ptr);
119 x = -14 + ((B - 56) % 29);
120 y = 8 + ((B - 56) / 29);
123 ff_tlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
138 B = bytestream2_get_byte(&s->
mv_ptr);
145 x = -(-14 + ((B - 56) % 29));
146 y = -( 8 + ((B - 56) / 29));
149 ff_tlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
156 unsigned char B, BL, BH;
162 B = bytestream2_get_byte(&s->
mv_ptr);
166 BH = (B >> 4) & 0x0F;
170 ff_tlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
214 for (y = 0; y < 8; y++) {
215 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
216 for (; flags != 1; flags >>= 1)
225 for (y = 0; y < 8; y += 2) {
226 for (x = 0; x < 8; x += 2, flags >>= 1) {
244 unsigned int flags = 0;
257 for (y = 0; y < 16; y++) {
267 for (x = 0; x < 4; x++, flags >>= 1)
283 for (y = 0; y < 16; y++) {
284 for (x = 0; x < 4; x++, flags >>= 1)
300 for (y = 0; y < 8; y++) {
307 for (x = 0; x < 8; x++, flags >>= 1)
335 for (y = 0; y < 8; y++) {
338 for (x = 0; x < 8; x++, flags >>= 2)
349 for (y = 0; y < 8; y += 2) {
350 for (x = 0; x < 8; x += 2, flags >>= 2) {
366 for (y = 0; y < 8; y++) {
367 for (x = 0; x < 8; x += 2, flags >>= 2) {
374 for (y = 0; y < 8; y += 2) {
375 for (x = 0; x < 8; x++, flags >>= 2) {
406 for (y = 0; y < 16; y++) {
413 for (x = 0; x < 4; x++, flags >>= 2)
424 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
432 for (y = 0; y < 16; y++) {
433 for (x = 0; x < 4; x++, flags >>= 2)
459 for (y = 0; y < 8; y++) {
473 for (y = 0; y < 8; y += 2) {
474 for (x = 0; x < 8; x += 2) {
498 for (y = 0; y < 8; y++) {
520 for (y = 0; y < 8; y++) {
535 sample[0] = bytestream2_get_byte(&s->
stream_ptr);
536 sample[1] = bytestream2_get_byte(&s->
stream_ptr);
538 for (y = 0; y < 8; y++) {
539 for (x = 0; x < 8; x += 2) {
567 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
573 if (!(P[0] & 0x8000)) {
575 for (y = 0; y < 8; y++) {
576 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
577 for (; flags != 1; flags >>= 1)
578 *pixel_ptr++ = P[flags & 1];
585 for (y = 0; y < 8; y += 2) {
586 for (x = 0; x < 8; x += 2, flags >>= 1) {
589 pixel_ptr[x + s->
stride] =
590 pixel_ptr[x + 1 + s->
stride] = P[flags & 1];
592 pixel_ptr += s->
stride * 2;
603 unsigned int flags = 0;
604 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
611 if (!(P[0] & 0x8000)) {
613 for (y = 0; y < 16; y++) {
623 for (x = 0; x < 4; x++, flags >>= 1)
624 *pixel_ptr++ = P[flags & 1];
625 pixel_ptr += s->
stride - 4;
627 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
636 if (!(P[2] & 0x8000)) {
640 for (y = 0; y < 16; y++) {
641 for (x = 0; x < 4; x++, flags >>= 1)
642 *pixel_ptr++ = P[flags & 1];
643 pixel_ptr += s->
stride - 4;
646 pixel_ptr -= 8 * s->
stride - 4;
657 for (y = 0; y < 8; y++) {
664 for (x = 0; x < 8; x++, flags >>= 1)
665 *pixel_ptr++ = P[flags & 1];
679 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
682 for (x = 0; x < 4; x++)
685 if (!(P[0] & 0x8000)) {
686 if (!(P[2] & 0x8000)) {
689 for (y = 0; y < 8; y++) {
692 for (x = 0; x < 8; x++, flags >>= 2)
693 *pixel_ptr++ = P[flags & 0x03];
703 for (y = 0; y < 8; y += 2) {
704 for (x = 0; x < 8; x += 2, flags >>= 2) {
707 pixel_ptr[x + s->
stride] =
708 pixel_ptr[x + 1 + s->
stride] = P[flags & 0x03];
710 pixel_ptr += s->
stride * 2;
719 if (!(P[2] & 0x8000)) {
720 for (y = 0; y < 8; y++) {
721 for (x = 0; x < 8; x += 2, flags >>= 2) {
723 pixel_ptr[x + 1] = P[flags & 0x03];
728 for (y = 0; y < 8; y += 2) {
729 for (x = 0; x < 8; x++, flags >>= 2) {
731 pixel_ptr[x + s->
stride] = P[flags & 0x03];
733 pixel_ptr += s->
stride * 2;
747 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
749 for (x = 0; x < 4; x++)
754 if (!(P[0] & 0x8000)) {
757 for (y = 0; y < 16; y++) {
761 for (x = 0; x < 4; x++)
766 for (x = 0; x < 4; x++, flags >>= 2)
767 *pixel_ptr++ = P[flags & 0x03];
769 pixel_ptr += s->
stride - 4;
771 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
777 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
779 for (x = 4; x < 8; x++)
781 vert = !(P[4] & 0x8000);
786 for (y = 0; y < 16; y++) {
787 for (x = 0; x < 4; x++, flags >>= 2)
788 *pixel_ptr++ = P[flags & 0x03];
791 pixel_ptr += s->
stride - 4;
793 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
794 }
else if (y & 1) pixel_ptr += s->
line_inc;
811 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
814 for (y = 0; y < 8; y++) {
815 for (x = 0; x < 8; x++)
816 pixel_ptr[x] = bytestream2_get_le16(&s->
stream_ptr);
827 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
830 for (y = 0; y < 8; y += 2) {
831 for (x = 0; x < 8; x += 2) {
834 pixel_ptr[x + s->
stride] =
837 pixel_ptr += s->
stride * 2;
848 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
851 for (y = 0; y < 8; y++) {
856 for (x = 0; x < 8; x++)
857 pixel_ptr[x] = P[x >> 2];
869 uint16_t *pixel_ptr = (uint16_t*)s->
pixel_ptr;
874 for (y = 0; y < 8; y++) {
875 for (x = 0; x < 8; x++)
909 unsigned char opcode;
936 " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n",
957 "decode finished with %d bytes left over\n",
985 void *
data,
int *got_frame,
989 int buf_size = avpkt->
size;
1007 if (buf_size < s->decoding_map_size + 2)
1054 .
name =
"interplayvideo",
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
const unsigned char * decoding_map
ptrdiff_t const GLvoid * data
unsigned char * pixel_ptr
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int init(AVCodecContext *avctx)
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)
static int ipvideo_decode_block_opcode_0x4(IpvideoContext *s, AVFrame *frame)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static int(*const ipvideo_decode_block16[])(IpvideoContext *s, AVFrame *frame)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s, AVFrame *frame)
static int ipvideo_decode_block_opcode_0x2(IpvideoContext *s, AVFrame *frame)
8 bits with AV_PIX_FMT_RGB32 palette
static int ipvideo_decode_block_opcode_0x9(IpvideoContext *s, AVFrame *frame)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static int ipvideo_decode_block_opcode_0x7_16(IpvideoContext *s, AVFrame *frame)
bitstream reader API header.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int get_bits_left(GetBitContext *gb)
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)
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette...
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)
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
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)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
int flags
AV_CODEC_FLAG_*.
static av_cold int ipvideo_decode_end(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
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)
static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s, AVFrame *frame)
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)
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
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.
static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s, AVFrame *frame)
AVCodec ff_interplay_video_decoder
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
static int ipvideo_decode_block_opcode_0xB_16(IpvideoContext *s, AVFrame *frame)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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)
#define AV_CODEC_CAP_PARAM_CHANGE
Codec supports changed parameters at any point.
int upper_motion_limit_offset
#define AV_PIX_FMT_RGB555
static int ipvideo_decode_block_opcode_0xF(IpvideoContext *s, AVFrame *frame)
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, AVFrame *frame, int *got_frame, AVPacket *pkt)
#define FFSWAP(type, a, b)
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.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.