43 #define SCREEN_WIDE 640
44 #define SCREEN_HIGH 429
54 #define NEXT_BYTE(v) (v) = forward ? (v) + 1 : (v) - 1;
58 unsigned val, saved_val = 0;
60 const uint8_t *
src, *source_end = source + src_len;
64 int forward = (frame_off <= -
SCREEN_WIDE) || (frame_off >= 0);
65 int read_two_nibbles,
flag;
78 src = source + src_len - 1;
93 if (!mode || (tmplen == 4)) {
94 if (src < source || src >= source_end)
100 read_two_nibbles = 0;
106 if (!read_two_nibbles) {
107 if (src < source || src >= source_end)
110 val |= (unsigned)*src << shift;
116 read_two_nibbles = 0;
118 mask = (1 <<
shift) - 1;
119 val = ((val >> 2) & ~mask) | (val &
mask);
121 if ((val & (0xC << shift))) {
132 saved_val = val >> (4 +
shift);
134 val &= (1 << (shift + 4)) - 1;
137 advance_mode = val & 1;
138 len = (val >> 1) - 1;
140 mode += 1 + advance_mode;
143 if (len <= 0 ||
FFABS(dst_end - dst) < len)
150 frame_end - dst < frame_off + len ||
151 frame_end - dst < len)
153 for (i = 0; i <
len; i++)
154 dst[i] = dst[frame_off + i];
160 frame_end - dst < frame_off + len ||
161 frame_end - dst < len)
163 for (i = len - 1; i >= 0; i--)
164 dst[i] = dst[frame_off + i];
169 if (source + src_len - src < len)
171 memcpy(dst, src, len);
175 if (src - source < len)
179 memcpy(dst, src, len);
183 val = forward ? dst[-1] : dst[1];
185 memset(dst, val, len);
189 memset(dst, val, len);
208 type = bytestream_get_byte(&c->
stream);
210 int blobs = bytestream_get_byte(&c->
stream);
211 if (pkt->
size < blobs * 65 + 2) {
218 int command_size = (type &
BMV_PRINT) ? 8 : 10;
223 c->
stream += command_size;
230 for (i = 0; i < 256; i++)
231 c->
pal[i] = 0xFFU << 24 | bytestream_get_be24(&c->
stream);
238 scr_off = (int16_t)bytestream_get_le16(&c->
stream);
256 outptr = frame->
data[0];
259 for (i = 0; i < avctx->
height; i++) {
260 memcpy(outptr, srcptr, avctx->
width);
261 srcptr += avctx->
width;
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int shift(int a, int b)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static av_cold int init(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, int frame_off)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
8 bits with AV_PIX_FMT_RGB32 palette
static av_cold int decode_init(AVCodecContext *avctx)
#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. ...
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
static void frame_end(MpegEncContext *s)
int width
picture width / height.
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
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
uint8_t frame_base[SCREEN_WIDE *(SCREEN_HIGH+1)]
This structure stores compressed data.
mode
Use these values in ebur128_init (or'ed).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
AVCodec ff_bmv_video_decoder
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)