43 #define BITSTREAM_READER_LE 50 #define PALETTE_COUNT 256 83 int y = current_offset / dst->
linesize[0];
84 int dx = delta_x + x - ((delta_x + x >=
width) - (delta_x + x < 0)) * width;
85 int dy = delta_y + y + (delta_x + x >=
width) - (delta_x + x < 0);
88 if (motion_offset < 0) {
124 B = bytestream2_get_byte(&s->
mv_ptr);
131 x = -14 + ((B - 56) % 29);
132 y = 8 + ((B - 56) / 29);
135 ff_tlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
150 B = bytestream2_get_byte(&s->
mv_ptr);
157 x = -(-14 + ((B - 56) % 29));
158 y = -( 8 + ((B - 56) / 29));
161 ff_tlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
168 unsigned char B, BL, BH;
174 B = bytestream2_get_byte(&s->
mv_ptr);
178 BH = (B >> 4) & 0x0F;
182 ff_tlog(s->
avctx,
"motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
226 for (y = 0; y < 8; y++) {
227 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
228 for (; flags != 1; flags >>= 1)
237 for (y = 0; y < 8; y += 2) {
238 for (x = 0; x < 8; x += 2, flags >>= 1) {
256 unsigned int flags = 0;
269 for (y = 0; y < 16; y++) {
279 for (x = 0; x < 4; x++, flags >>= 1)
295 for (y = 0; y < 16; y++) {
296 for (x = 0; x < 4; x++, flags >>= 1)
312 for (y = 0; y < 8; y++) {
319 for (x = 0; x < 8; x++, flags >>= 1)
347 for (y = 0; y < 8; y++) {
350 for (x = 0; x < 8; x++, flags >>= 2)
361 for (y = 0; y < 8; y += 2) {
362 for (x = 0; x < 8; x += 2, flags >>= 2) {
378 for (y = 0; y < 8; y++) {
379 for (x = 0; x < 8; x += 2, flags >>= 2) {
386 for (y = 0; y < 8; y += 2) {
387 for (x = 0; x < 8; x++, flags >>= 2) {
418 for (y = 0; y < 16; y++) {
425 for (x = 0; x < 4; x++, flags >>= 2)
436 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
444 for (y = 0; y < 16; y++) {
445 for (x = 0; x < 4; x++, flags >>= 2)
471 for (y = 0; y < 8; y++) {
485 for (y = 0; y < 8; y += 2) {
486 for (x = 0; x < 8; x += 2) {
510 for (y = 0; y < 8; y++) {
532 for (y = 0; y < 8; y++) {
547 sample[0] = bytestream2_get_byte(&s->
stream_ptr);
548 sample[1] = bytestream2_get_byte(&s->
stream_ptr);
550 for (y = 0; y < 8; y++) {
551 for (x = 0; x < 8; x += 2) {
585 if (!(P[0] & 0x8000)) {
587 for (y = 0; y < 8; y++) {
588 flags = bytestream2_get_byte(&s->
stream_ptr) | 0x100;
589 for (; flags != 1; flags >>= 1)
590 *pixel_ptr++ = P[flags & 1];
597 for (y = 0; y < 8; y += 2) {
598 for (x = 0; x < 8; x += 2, flags >>= 1) {
601 pixel_ptr[x + s->
stride] =
602 pixel_ptr[x + 1 + s->
stride] = P[flags & 1];
604 pixel_ptr += s->
stride * 2;
615 unsigned int flags = 0;
623 if (!(P[0] & 0x8000)) {
625 for (y = 0; y < 16; y++) {
635 for (x = 0; x < 4; x++, flags >>= 1)
636 *pixel_ptr++ = P[flags & 1];
637 pixel_ptr += s->
stride - 4;
639 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
648 if (!(P[2] & 0x8000)) {
652 for (y = 0; y < 16; y++) {
653 for (x = 0; x < 4; x++, flags >>= 1)
654 *pixel_ptr++ = P[flags & 1];
655 pixel_ptr += s->
stride - 4;
658 pixel_ptr -= 8 * s->
stride - 4;
669 for (y = 0; y < 8; y++) {
676 for (x = 0; x < 8; x++, flags >>= 1)
677 *pixel_ptr++ = P[flags & 1];
694 for (x = 0; x < 4; x++)
697 if (!(P[0] & 0x8000)) {
698 if (!(P[2] & 0x8000)) {
701 for (y = 0; y < 8; y++) {
704 for (x = 0; x < 8; x++, flags >>= 2)
705 *pixel_ptr++ = P[flags & 0x03];
715 for (y = 0; y < 8; y += 2) {
716 for (x = 0; x < 8; x += 2, flags >>= 2) {
719 pixel_ptr[x + s->
stride] =
720 pixel_ptr[x + 1 + s->
stride] = P[flags & 0x03];
722 pixel_ptr += s->
stride * 2;
731 if (!(P[2] & 0x8000)) {
732 for (y = 0; y < 8; y++) {
733 for (x = 0; x < 8; x += 2, flags >>= 2) {
735 pixel_ptr[x + 1] = P[flags & 0x03];
740 for (y = 0; y < 8; y += 2) {
741 for (x = 0; x < 8; x++, flags >>= 2) {
743 pixel_ptr[x + s->
stride] = P[flags & 0x03];
745 pixel_ptr += s->
stride * 2;
761 for (x = 0; x < 4; x++)
766 if (!(P[0] & 0x8000)) {
769 for (y = 0; y < 16; y++) {
773 for (x = 0; x < 4; x++)
778 for (x = 0; x < 4; x++, flags >>= 2)
779 *pixel_ptr++ = P[flags & 0x03];
781 pixel_ptr += s->
stride - 4;
783 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
789 uint64_t flags = bytestream2_get_le64(&s->
stream_ptr);
791 for (x = 4; x < 8; x++)
793 vert = !(P[4] & 0x8000);
798 for (y = 0; y < 16; y++) {
799 for (x = 0; x < 4; x++, flags >>= 2)
800 *pixel_ptr++ = P[flags & 0x03];
803 pixel_ptr += s->
stride - 4;
805 if (y == 7) pixel_ptr -= 8 * s->
stride - 4;
806 }
else if (y & 1) pixel_ptr += s->
line_inc;
826 for (y = 0; y < 8; y++) {
827 for (x = 0; x < 8; x++)
828 pixel_ptr[x] = bytestream2_get_le16(&s->
stream_ptr);
842 for (y = 0; y < 8; y += 2) {
843 for (x = 0; x < 8; x += 2) {
846 pixel_ptr[x + s->
stride] =
849 pixel_ptr += s->
stride * 2;
863 for (y = 0; y < 8; y++) {
868 for (x = 0; x < 8; x++)
869 pixel_ptr[x] = P[x >> 2];
886 for (y = 0; y < 8; y++) {
887 for (x = 0; x < 8; x++)
923 for (line = 0; line < 8; ++
line) {
939 off_x = ((uint16_t)opcode - 0xC000) % frame->
width;
940 off_y = ((uint16_t)opcode - 0xC000) / frame->
width;
942 }
else if (opcode > 0) {
943 off_x = ((uint16_t)opcode - 0x4000) % frame->
width;
944 off_y = ((uint16_t)opcode - 0x4000) / frame->
width;
945 copy_from(s, frame, frame, off_x, off_y);
969 for (pass = 0; pass < 2; ++
pass) {
973 opcode = bytestream2_get_le16(&decoding_map_ptr);
976 " block @ (%3d, %3d): opcode 0x%X, data ptr offset %d\n",
987 "decode finished with %d bytes left over\n",
997 for (line = 0; line < 8; ++
line) {
1012 }
else if (opcode > 0) {
1025 int pass, x, y, changed_block;
1026 int16_t opcode, skip;
1043 for (pass = 0; pass < 2; ++
pass) {
1046 skip = bytestream2_get_le16(&skip_map_ptr);
1053 if (skip != -0x8000 && skip) {
1054 opcode = bytestream2_get_le16(&decoding_map_ptr);
1060 skip = bytestream2_get_le16(&skip_map_ptr);
1068 skip = bytestream2_get_le16(&skip_map_ptr);
1075 if (skip != -0x8000 && skip) {
1081 skip = bytestream2_get_le16(&skip_map_ptr);
1084 if (changed_block) {
1099 "decode finished with %d bytes left over\n",
1107 unsigned char opcode;
1134 " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n",
1155 "decode finished with %d bytes left over\n",
1191 void *
data,
int *got_frame,
1195 int buf_size = avpkt->
size;
1201 int video_data_size;
1225 frame_format =
AV_RL8(buf);
1226 send_buffer =
AV_RL8(buf + 1);
1227 video_data_size =
AV_RL16(buf + 2);
1231 switch (frame_format) {
1330 switch (frame_format) {
1342 *got_frame = send_buffer;
1367 .
name =
"interplayvideo",
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#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
static void ipvideo_format_06_secondpass(IpvideoContext *s, AVFrame *frame, int16_t opcode)
unsigned char * pixel_ptr
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int init(AVCodecContext *avctx)
static void(*const ipvideo_format_06_passes[])(IpvideoContext *s, AVFrame *frame, int16_t op)
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 void(*const ipvideo_format_10_passes[])(IpvideoContext *s, AVFrame *frame, int16_t op)
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 void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static void ipvideo_decode_format_11_opcodes(IpvideoContext *s, AVFrame *frame)
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)
static void ipvideo_format_10_secondpass(IpvideoContext *s, AVFrame *frame, int16_t opcode)
bitstream reader API header.
static void ipvideo_format_06_firstpass(IpvideoContext *s, AVFrame *frame, int16_t opcode)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
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.
static void ipvideo_decode_format_10_opcodes(IpvideoContext *s, AVFrame *frame)
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.
int flags
AV_CODEC_FLAG_*.
static av_cold int ipvideo_decode_end(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
static void ipvideo_decode_format_06_opcodes(IpvideoContext *s, AVFrame *frame)
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.
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
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)
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
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.
AVFrame * cur_decode_frame
static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s, AVFrame *frame)
static void ipvideo_format_10_firstpass(IpvideoContext *s, AVFrame *frame, int16_t opcode)
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)
#define flags(name, subs,...)
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 int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line
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
AVFrame * prev_decode_frame
#define AV_PIX_FMT_RGB555
static int ipvideo_decode_block_opcode_0xF(IpvideoContext *s, AVFrame *frame)
const unsigned char * skip_map
static int ipvideo_decode_block_opcode_0xB(IpvideoContext *s, AVFrame *frame)
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
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)
#define FFSWAP(type, a, b)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
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.