44#define SCREEN_WIDE 640
45#define SCREEN_HIGH 429
55#define NEXT_BYTE(v) (v) = forward ? (v) + 1 : (v) - 1;
59 unsigned val, saved_val = 0;
61 const uint8_t *
src, *source_end = source + src_len;
63 uint8_t *
dst, *dst_end;
66 int read_two_nibbles,
flag;
79 src = source + src_len - 1;
94 if (!
mode || (tmplen == 4)) {
101 read_two_nibbles = 0;
107 if (!read_two_nibbles) {
117 read_two_nibbles = 0;
138 advance_mode =
val & 1;
141 mode += 1 + advance_mode;
164 for (
i =
len - 1;
i >= 0;
i--)
170 if (source + src_len -
src <
len)
205 uint8_t *srcptr, *outptr;
207 c->stream =
pkt->data;
208 type = bytestream_get_byte(&
c->stream);
210 int blobs = bytestream_get_byte(&
c->stream);
211 if (
pkt->size < blobs * 65 + 2) {
215 c->stream += blobs * 65;
219 if (
c->stream -
pkt->data + command_size >
pkt->size) {
223 c->stream += command_size;
226 if (
c->stream -
pkt->data >
pkt->size - 768) {
230 for (
i = 0;
i < 256;
i++)
231 c->pal[
i] = 0xFFU << 24 | bytestream_get_be24(&
c->stream);
234 if (
c->stream -
pkt->data >
pkt->size - 2) {
238 scr_off = (int16_t)bytestream_get_le16(&
c->stream);
255 outptr =
frame->data[0];
259 memcpy(outptr, srcptr, avctx->
width);
260 srcptr += avctx->
width;
261 outptr +=
frame->linesize[0];
282 c->frame =
c->frame_base + 640;
288 .p.name =
"bmv_video",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
static int forward(AudioFWTDNContext *s, const double *in, int in_length, double **out, int *out_length, int ch, uint64_t sn)
const FFCodec ff_bmv_video_decoder
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, int frame_off)
static av_cold int decode_init(AVCodecContext *avctx)
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
common internal and external API header
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int decode_init(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
static int shift(int a, int b)
static const uint16_t mask[17]
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
uint8_t frame_base[SCREEN_WIDE *(SCREEN_HIGH+1)]
static int64_t frame_end(const SyncQueue *sq, SyncQueueFrame frame, int nb_samples)
Compute the end timestamp of a frame.