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)
105 if (!read_two_nibbles) {
106 if (src < source || src >= source_end)
109 val |= *src <<
shift;
115 read_two_nibbles = 0;
117 mask = (1 <<
shift) - 1;
118 val = ((val >> 2) & ~mask) | (val &
mask);
120 if ((val & (0xC << shift))) {
131 saved_val = val >> (4 +
shift);
133 val &= (1 << (shift + 4)) - 1;
136 advance_mode = val & 1;
137 len = (val >> 1) - 1;
139 mode += 1 + advance_mode;
142 if (len <= 0 ||
FFABS(dst_end - dst) < len)
149 frame_end - dst < frame_off + len ||
150 frame_end - dst < len)
152 for (i = 0; i <
len; i++)
153 dst[i] = dst[frame_off + i];
159 frame_end - dst < frame_off + len ||
160 frame_end - dst < len)
162 for (i = len - 1; i >= 0; i--)
163 dst[i] = dst[frame_off + i];
168 if (source + src_len - src < len)
170 memcpy(dst, src, len);
174 if (src - source < len)
178 memcpy(dst, src, len);
182 val = forward ? dst[-1] : dst[1];
184 memset(dst, val, len);
188 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;
289 16512, 8256, 4128, 2064, 1032, 516, 258, 192, 129, 88, 64, 56, 48, 40, 36, 32
302 int *got_frame_ptr,
AVPacket *avpkt)
306 int buf_size = avpkt->
size;
307 int blocks = 0, total_blocks, i;
309 int16_t *output_samples;
312 total_blocks = *buf++;
313 if (buf_size < total_blocks * 65 + 1) {
315 total_blocks * 65 + 1, buf_size);
323 output_samples = (int16_t *)frame->
data[0];
325 for (blocks = 0; blocks < total_blocks; blocks++) {
327 code = (code >> 1) | (code << 7);
330 for (i = 0; i < 32; i++) {
331 *output_samples++ = av_clip_int16((scale[0] * (int8_t)*buf++) >> 5);
332 *output_samples++ = av_clip_int16((scale[1] * (int8_t)*buf++) >> 5);