42 #define SCREEN_WIDE 640 43 #define SCREEN_HIGH 429 53 #define NEXT_BYTE(v) v = forward ? v + 1 : v - 1; 57 unsigned val, saved_val = 0;
59 const uint8_t *src, *source_end = source + src_len;
63 int forward = (frame_off <= -
SCREEN_WIDE) || (frame_off >= 0);
64 int read_two_nibbles, flag;
77 src = source + src_len - 1;
92 if (!mode || (tmplen == 4)) {
93 if (src < source || src >= source_end)
103 if (!read_two_nibbles) {
104 if (src < source || src >= source_end)
107 val |= *src << shift;
113 read_two_nibbles = 0;
115 mask = (1 << shift) - 1;
116 val = ((val >> 2) & ~mask) | (val &
mask);
118 if ((val & (0xC << shift))) {
129 saved_val = val >> (4 + shift);
131 val &= (1 << (shift + 4)) - 1;
134 advance_mode = val & 1;
135 len = (val >> 1) - 1;
136 mode += 1 + advance_mode;
139 if (len <= 0 ||
FFABS(dst_end - dst) <
len)
146 frame_end - dst < frame_off + len ||
147 frame_end - dst < len)
149 for (i = 0; i <
len; i++)
150 dst[i] = dst[frame_off + i];
156 frame_end - dst < frame_off + len ||
157 frame_end - dst < len)
159 for (i = len - 1; i >= 0; i--)
160 dst[i] = dst[frame_off + i];
165 if (source + src_len - src < len)
167 memcpy(dst, src, len);
171 if (src - source < len)
175 memcpy(dst, src, len);
179 val = forward ? dst[-1] : dst[1];
181 memset(dst, val, len);
185 memset(dst, val, len);
207 type = bytestream_get_byte(&c->
stream);
209 int blobs = bytestream_get_byte(&c->
stream);
210 if (pkt->
size < blobs * 65 + 2) {
217 int command_size = (type &
BMV_PRINT) ? 8 : 10;
222 c->
stream += command_size;
229 for (i = 0; i < 256; i++)
230 c->
pal[i] = bytestream_get_be24(&c->
stream);
237 scr_off = (int16_t)bytestream_get_le16(&c->
stream);
257 outptr = frame->
data[0];
260 for (i = 0; i < avctx->
height; i++) {
261 memcpy(outptr, srcptr, avctx->
width);
262 srcptr += avctx->
width;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, int frame_off)
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
8 bit with PIX_FMT_RGB32 palette
static av_cold int decode_init(AVCodecContext *avctx)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint16_t mask[17]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static void frame_end(MpegEncContext *s)
int width
picture width / height.
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int palette_has_changed
Tell user application that palette has changed from previous frame.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
common internal and external API header
static av_cold int init(AVCodecParserContext *s)
uint8_t frame_base[SCREEN_WIDE *(SCREEN_HIGH+1)]
This structure stores compressed data.
AVCodec ff_bmv_video_decoder
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)