41 #define SCREEN_WIDE 640
42 #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);
206 type = bytestream_get_byte(&c->
stream);
208 int blobs = bytestream_get_byte(&c->
stream);
209 if (pkt->
size < blobs * 65 + 2) {
216 int command_size = (type &
BMV_PRINT) ? 8 : 10;
221 c->
stream += command_size;
228 for (i = 0; i < 256; i++)
229 c->
pal[i] = bytestream_get_be24(&c->
stream);
236 scr_off = (int16_t)bytestream_get_le16(&c->
stream);
263 for (i = 0; i < avctx->
height; i++) {
264 memcpy(outptr, srcptr, avctx->
width);
265 srcptr += avctx->
width;
303 16512, 8256, 4128, 2064, 1032, 516, 258, 192, 129, 88, 64, 56, 48, 40, 36, 32
321 int *got_frame_ptr,
AVPacket *avpkt)
325 int buf_size = avpkt->
size;
326 int blocks = 0, total_blocks, i;
328 int16_t *output_samples;
331 total_blocks = *buf++;
332 if (buf_size < total_blocks * 65 + 1) {
334 total_blocks * 65 + 1, buf_size);
344 output_samples = (int16_t *)c->
frame.
data[0];
346 for (blocks = 0; blocks < total_blocks; blocks++) {
348 code = (code >> 1) | (code << 7);
351 for (i = 0; i < 32; i++) {
352 *output_samples++ = av_clip_int16((scale[0] * (int8_t)*buf++) >> 5);
353 *output_samples++ = av_clip_int16((scale[1] * (int8_t)*buf++) >> 5);
static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
AVCodec ff_bmv_video_decoder
This structure describes decoded (raw) audio or video data.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
AVFrame * coded_frame
the picture in the bitstream
AVCodec ff_bmv_audio_decoder
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_CH_LAYOUT_STEREO
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
struct BMVDecContext BMVDecContext
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
enum AVSampleFormat sample_fmt
audio sample format
8 bit with PIX_FMT_RGB32 palette
static int init(AVCodecParserContext *s)
static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, int frame_off)
static const uint16_t mask[17]
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
#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.
uint64_t channel_layout
Audio channel layout.
audio channel layout utility functions
int width
picture width / height.
static av_cold int decode_init(AVCodecContext *avctx)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
static const int bmv_aud_mults[16]
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
int palette_has_changed
Tell user application that palette has changed from previous frame.
static const uint16_t scale[4]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
#define AVERROR_INVALIDDATA
struct BMVAudioDecContext BMVAudioDecContext
int channels
number of audio channels
static av_cold int bmv_aud_decode_init(AVCodecContext *avctx)
uint8_t frame_base[SCREEN_WIDE *(SCREEN_HIGH+1)]
static av_cold int decode_end(AVCodecContext *avctx)
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame