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;
#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
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_cold int decode_init(AVCodecContext *avctx)
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 source
#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)]
static double val(void *priv, double ch)
This structure stores compressed data.
mode
Use these values in ebur128_init (or'ed).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_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)