FFmpeg
Loading...
Searching...
No Matches
vmnc.c
Go to the documentation of this file.
1/*
2 * VMware Screen Codec (VMnc) decoder
3 * Copyright (c) 2006 Konstantin Shishkov
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file
24 * VMware Screen Codec (VMnc) decoder
25 * As Alex Beregszaszi discovered, this is effectively RFB data dump
26 */
27
29#include "libavutil/common.h"
30#include "libavutil/mem.h"
31#include "avcodec.h"
32#include "codec_internal.h"
33#include "decode.h"
34#include "bytestream.h"
35
45
47 HT_RAW = 1, // tile is raw
48 HT_BKG = 2, // background color is present
49 HT_FG = 4, // foreground color is present
50 HT_SUB = 8, // subrects are present
51 HT_CLR = 16 // each subrect has own color
52};
53
54/*
55 * Decoder context
56 */
57typedef struct VmncContext {
60
61 int bpp;
62 int bpp2;
64 uint8_t pal[768];
67
68 /* cursor data */
72 uint8_t *curbits, *curmask;
73 uint8_t *screendta;
76
77/* read pixel value from stream */
78static av_always_inline int vmnc_get_pixel(GetByteContext *gb, int bpp, int be)
79{
80 switch (bpp * 2 + be) {
81 case 2:
82 case 3:
83 return bytestream2_get_byte(gb);
84 case 4:
85 return bytestream2_get_le16(gb);
86 case 5:
87 return bytestream2_get_be16(gb);
88 case 8:
89 return bytestream2_get_le32(gb);
90 case 9:
91 return bytestream2_get_be32(gb);
92 default: return 0;
93 }
94}
95
97{
98 int i, j, p;
99 const int bpp = c->bpp2;
100 uint8_t *dst8 = c->curbits;
101 uint16_t *dst16 = (uint16_t *)c->curbits;
102 uint32_t *dst32 = (uint32_t *)c->curbits;
103
104 for (j = 0; j < c->cur_h; j++) {
105 for (i = 0; i < c->cur_w; i++) {
106 p = vmnc_get_pixel(&c->gb, bpp, c->bigendian);
107 if (bpp == 1)
108 *dst8++ = p;
109 if (bpp == 2)
110 *dst16++ = p;
111 if (bpp == 4)
112 *dst32++ = p;
113 }
114 }
115 dst8 = c->curmask;
116 dst16 = (uint16_t*)c->curmask;
117 dst32 = (uint32_t*)c->curmask;
118 for (j = 0; j < c->cur_h; j++) {
119 for (i = 0; i < c->cur_w; i++) {
120 p = vmnc_get_pixel(&c->gb, bpp, c->bigendian);
121 if (bpp == 1)
122 *dst8++ = p;
123 if (bpp == 2)
124 *dst16++ = p;
125 if (bpp == 4)
126 *dst32++ = p;
127 }
128 }
129}
130
131static void put_cursor(uint8_t *dst, int stride, VmncContext *c, int dx, int dy)
132{
133 int i, j;
134 int w, h, x, y;
135 w = c->cur_w;
136 if (c->width < c->cur_x + c->cur_w)
137 w = c->width - c->cur_x;
138 h = c->cur_h;
139 if (c->height < c->cur_y + c->cur_h)
140 h = c->height - c->cur_y;
141 x = c->cur_x;
142 y = c->cur_y;
143 if (x < 0) {
144 w += x;
145 x = 0;
146 }
147 if (y < 0) {
148 h += y;
149 y = 0;
150 }
151
152 if ((w < 1) || (h < 1))
153 return;
154 dst += x * c->bpp2 + y * stride;
155
156 if (c->bpp2 == 1) {
157 uint8_t *cd = c->curbits, *msk = c->curmask;
158 for (j = 0; j < h; j++) {
159 for (i = 0; i < w; i++)
160 dst[i] = (dst[i] & cd[i]) ^ msk[i];
161 msk += c->cur_w;
162 cd += c->cur_w;
163 dst += stride;
164 }
165 } else if (c->bpp2 == 2) {
166 uint16_t *cd = (uint16_t*)c->curbits, *msk = (uint16_t*)c->curmask;
167 uint16_t *dst2;
168 for (j = 0; j < h; j++) {
169 dst2 = (uint16_t*)dst;
170 for (i = 0; i < w; i++)
171 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
172 msk += c->cur_w;
173 cd += c->cur_w;
174 dst += stride;
175 }
176 } else if (c->bpp2 == 4) {
177 uint32_t *cd = (uint32_t*)c->curbits, *msk = (uint32_t*)c->curmask;
178 uint32_t *dst2;
179 for (j = 0; j < h; j++) {
180 dst2 = (uint32_t*)dst;
181 for (i = 0; i < w; i++)
182 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
183 msk += c->cur_w;
184 cd += c->cur_w;
185 dst += stride;
186 }
187 }
188}
189
190/* fill rectangle with given color */
191static av_always_inline void paint_rect(uint8_t *dst, int dx, int dy,
192 int w, int h, int color,
193 int bpp, int stride)
194{
195 int i, j;
196 dst += dx * bpp + dy * stride;
197 if (bpp == 1) {
198 for (j = 0; j < h; j++) {
199 memset(dst, color, w);
200 dst += stride;
201 }
202 } else if (bpp == 2) {
203 uint16_t *dst2;
204 for (j = 0; j < h; j++) {
205 dst2 = (uint16_t*)dst;
206 for (i = 0; i < w; i++)
207 *dst2++ = color;
208 dst += stride;
209 }
210 } else if (bpp == 4) {
211 uint32_t *dst2;
212 for (j = 0; j < h; j++) {
213 dst2 = (uint32_t*)dst;
214 for (i = 0; i < w; i++)
215 dst2[i] = color;
216 dst += stride;
217 }
218 }
219}
220
221static av_always_inline void paint_raw(uint8_t *dst, int w, int h,
222 GetByteContext *gb, int bpp,
223 int be, int stride)
224{
225 int i, j, p;
226 for (j = 0; j < h; j++) {
227 for (i = 0; i < w; i++) {
228 p = vmnc_get_pixel(gb, bpp, be);
229 switch (bpp) {
230 case 1:
231 dst[i] = p;
232 break;
233 case 2:
234 ((uint16_t*)dst)[i] = p;
235 break;
236 case 4:
237 ((uint32_t*)dst)[i] = p;
238 break;
239 }
240 }
241 dst += stride;
242 }
243}
244
245static int decode_hextile(VmncContext *c, uint8_t* dst, GetByteContext *gb,
246 int w, int h, int stride)
247{
248 int i, j, k;
249 int bg = 0, fg = 0, rects, color, flags, xy, wh;
250 const int bpp = c->bpp2;
251 uint8_t *dst2;
252 int bw = 16, bh = 16;
253
254 for (j = 0; j < h; j += 16) {
255 dst2 = dst;
256 bw = 16;
257 if (j + 16 > h)
258 bh = h - j;
259 for (i = 0; i < w; i += 16, dst2 += 16 * bpp) {
260 if (bytestream2_get_bytes_left(gb) <= 0) {
261 av_log(c->avctx, AV_LOG_ERROR, "Premature end of data!\n");
262 return AVERROR_INVALIDDATA;
263 }
264 if (i + 16 > w)
265 bw = w - i;
266 flags = bytestream2_get_byte(gb);
267 if (flags & HT_RAW) {
268 if (bytestream2_get_bytes_left(gb) < bw * bh * bpp) {
269 av_log(c->avctx, AV_LOG_ERROR, "Premature end of data!\n");
270 return AVERROR_INVALIDDATA;
271 }
272 paint_raw(dst2, bw, bh, gb, bpp, c->bigendian, stride);
273 } else {
274 if (flags & HT_BKG)
275 bg = vmnc_get_pixel(gb, bpp, c->bigendian);
276 if (flags & HT_FG)
277 fg = vmnc_get_pixel(gb, bpp, c->bigendian);
278 rects = 0;
279 if (flags & HT_SUB)
280 rects = bytestream2_get_byte(gb);
281 color = !!(flags & HT_CLR);
282
283 paint_rect(dst2, 0, 0, bw, bh, bg, bpp, stride);
284
285 if (bytestream2_get_bytes_left(gb) < rects * (color * bpp + 2)) {
286 av_log(c->avctx, AV_LOG_ERROR, "Premature end of data!\n");
287 return AVERROR_INVALIDDATA;
288 }
289 for (k = 0; k < rects; k++) {
290 int rect_x, rect_y, rect_w, rect_h;
291 if (color)
292 fg = vmnc_get_pixel(gb, bpp, c->bigendian);
293 xy = bytestream2_get_byte(gb);
294 wh = bytestream2_get_byte(gb);
295
296 rect_x = xy >> 4;
297 rect_y = xy & 0xF;
298 rect_w = (wh >> 4) + 1;
299 rect_h = (wh & 0xF) + 1;
300
301 if (rect_x + rect_w > w - i || rect_y + rect_h > h - j) {
302 av_log(c->avctx, AV_LOG_ERROR, "Rectangle outside picture\n");
303 return AVERROR_INVALIDDATA;
304 }
305
306 paint_rect(dst2, rect_x, rect_y,
307 rect_w, rect_h, fg, bpp, stride);
308 }
309 }
310 }
311 dst += stride * 16;
312 }
313 return 0;
314}
315
317{
318 av_freep(&c->curbits);
319 av_freep(&c->curmask);
320 av_freep(&c->screendta);
321 c->cur_w = c->cur_h = 0;
322 c->cur_hx = c->cur_hy = 0;
323
324}
325
326static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
327 int *got_frame, AVPacket *avpkt)
328{
329 const uint8_t *buf = avpkt->data;
330 int buf_size = avpkt->size;
331 VmncContext * const c = avctx->priv_data;
332 GetByteContext *gb = &c->gb;
333 uint8_t *outptr;
334 int dx, dy, w, h, depth, enc, chunks, res, size_left, ret;
335
336 bytestream2_init(gb, buf, buf_size);
337 bytestream2_skip(gb, 2);
338 chunks = bytestream2_get_be16(gb);
339 if (12LL * chunks > bytestream2_get_bytes_left(gb))
340 return AVERROR_INVALIDDATA;
341
342 if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
343 return ret;
344
345 c->pic->flags &= ~AV_FRAME_FLAG_KEY;
346 c->pic->pict_type = AV_PICTURE_TYPE_P;
347
348 // restore screen after cursor
349 if (c->cursor_painted) {
350 int i;
351 w = c->cur_w;
352 if (c->width < c->cur_x + w)
353 w = c->width - c->cur_x;
354 h = c->cur_h;
355 if (c->height < c->cur_y + h)
356 h = c->height - c->cur_y;
357 dx = c->cur_x;
358 if (dx < 0) {
359 w += dx;
360 dx = 0;
361 }
362 dy = c->cur_y;
363 if (dy < 0) {
364 h += dy;
365 dy = 0;
366 }
367 if ((w > 0) && (h > 0)) {
368 outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0];
369 for (i = 0; i < h; i++) {
370 memcpy(outptr, c->screendta + i * c->cur_w * c->bpp2,
371 w * c->bpp2);
372 outptr += c->pic->linesize[0];
373 }
374 }
375 c->cursor_painted = 0;
376 }
377
378 while (chunks--) {
379 if (bytestream2_get_bytes_left(gb) < 12) {
380 av_log(avctx, AV_LOG_ERROR, "Premature end of data!\n");
381 return -1;
382 }
383 dx = bytestream2_get_be16(gb);
384 dy = bytestream2_get_be16(gb);
385 w = bytestream2_get_be16(gb);
386 h = bytestream2_get_be16(gb);
387 enc = bytestream2_get_be32(gb);
388 if ((dx + w > c->width) || (dy + h > c->height)) {
389 av_log(avctx, AV_LOG_ERROR,
390 "Incorrect frame size: %ix%i+%ix%i of %ix%i\n",
391 w, h, dx, dy, c->width, c->height);
392 return AVERROR_INVALIDDATA;
393 }
394 outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0];
395 size_left = bytestream2_get_bytes_left(gb);
396 switch (enc) {
397 case MAGIC_WMVd: // cursor
398 if (w*(int64_t)h*c->bpp2 > INT_MAX/2 - 2) {
399 av_log(avctx, AV_LOG_ERROR, "dimensions too large\n");
400 return AVERROR_INVALIDDATA;
401 }
402 if (size_left < 2 + w * h * c->bpp2 * 2) {
403 av_log(avctx, AV_LOG_ERROR,
404 "Premature end of data! (need %i got %i)\n",
405 2 + w * h * c->bpp2 * 2, size_left);
406 return AVERROR_INVALIDDATA;
407 }
408 bytestream2_skip(gb, 2);
409 c->cur_w = w;
410 c->cur_h = h;
411 c->cur_hx = dx;
412 c->cur_hy = dy;
413 if ((c->cur_hx > c->cur_w) || (c->cur_hy > c->cur_h)) {
414 av_log(avctx, AV_LOG_ERROR,
415 "Cursor hot spot is not in image: "
416 "%ix%i of %ix%i cursor size\n",
417 c->cur_hx, c->cur_hy, c->cur_w, c->cur_h);
418 c->cur_hx = c->cur_hy = 0;
419 }
420 if (c->cur_w * c->cur_h >= INT_MAX / c->bpp2) {
422 return AVERROR(EINVAL);
423 } else {
424 int screen_size = c->cur_w * c->cur_h * c->bpp2;
425 if ((ret = av_reallocp(&c->curbits, screen_size)) < 0 ||
426 (ret = av_reallocp(&c->curmask, screen_size)) < 0 ||
427 (ret = av_reallocp(&c->screendta, screen_size)) < 0) {
429 return ret;
430 }
431 }
432 load_cursor(c);
433 break;
434 case MAGIC_WMVe: // unknown
435 bytestream2_skip(gb, 2);
436 break;
437 case MAGIC_WMVf: // update cursor position
438 c->cur_x = dx - c->cur_hx;
439 c->cur_y = dy - c->cur_hy;
440 break;
441 case MAGIC_WMVg: // unknown
442 bytestream2_skip(gb, 10);
443 break;
444 case MAGIC_WMVh: // unknown
445 bytestream2_skip(gb, 4);
446 break;
447 case MAGIC_WMVi: // ServerInitialization struct
448 c->pic->flags |= AV_FRAME_FLAG_KEY;
449 c->pic->pict_type = AV_PICTURE_TYPE_I;
450 depth = bytestream2_get_byte(gb);
451 if (depth != c->bpp) {
452 av_log(avctx, AV_LOG_INFO,
453 "Depth mismatch. Container %i bpp, "
454 "Frame data: %i bpp\n",
455 c->bpp, depth);
456 }
457 bytestream2_skip(gb, 1);
458 c->bigendian = bytestream2_get_byte(gb);
459 if (c->bigendian & (~1)) {
460 av_log(avctx, AV_LOG_INFO,
461 "Invalid header: bigendian flag = %i\n", c->bigendian);
462 return AVERROR_INVALIDDATA;
463 }
464 //skip the rest of pixel format data
465 bytestream2_skip(gb, 13);
466 break;
467 case MAGIC_WMVj: // unknown
468 bytestream2_skip(gb, 2);
469 break;
470 case 0x00000000: // raw rectangle data
471 if (size_left < w * h * c->bpp2) {
472 av_log(avctx, AV_LOG_ERROR,
473 "Premature end of data! (need %i got %i)\n",
474 w * h * c->bpp2, size_left);
475 return AVERROR_INVALIDDATA;
476 }
477 paint_raw(outptr, w, h, gb, c->bpp2, c->bigendian,
478 c->pic->linesize[0]);
479 break;
480 case 0x00000005: // HexTile encoded rectangle
481 res = decode_hextile(c, outptr, gb, w, h, c->pic->linesize[0]);
482 if (res < 0)
483 return res;
484 break;
485 default:
486 av_log(avctx, AV_LOG_ERROR, "Unsupported block type 0x%08X\n", enc);
487 chunks = 0; // leave chunks decoding loop
488 }
489 }
490 if (c->screendta) {
491 int i;
492 // save screen data before painting cursor
493 w = c->cur_w;
494 if (c->width < c->cur_x + w)
495 w = c->width - c->cur_x;
496 h = c->cur_h;
497 if (c->height < c->cur_y + h)
498 h = c->height - c->cur_y;
499 dx = c->cur_x;
500 if (dx < 0) {
501 w += dx;
502 dx = 0;
503 }
504 dy = c->cur_y;
505 if (dy < 0) {
506 h += dy;
507 dy = 0;
508 }
509 if ((w > 0) && (h > 0)) {
510 outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0];
511 for (i = 0; i < h; i++) {
512 memcpy(c->screendta + i * c->cur_w * c->bpp2, outptr,
513 w * c->bpp2);
514 outptr += c->pic->linesize[0];
515 }
516 outptr = c->pic->data[0];
517 put_cursor(outptr, c->pic->linesize[0], c, c->cur_x, c->cur_y);
518 c->cursor_painted = 1;
519 }
520 }
521 *got_frame = 1;
522 if ((ret = av_frame_ref(rframe, c->pic)) < 0)
523 return ret;
524
525 /* always report that the buffer was completely consumed */
526 return buf_size;
527}
528
530{
531 VmncContext * const c = avctx->priv_data;
532
533 c->avctx = avctx;
534 c->width = avctx->width;
535 c->height = avctx->height;
536 c->bpp = avctx->bits_per_coded_sample;
537
538 switch (c->bpp) {
539 case 8:
540 avctx->pix_fmt = AV_PIX_FMT_PAL8;
541 break;
542 case 16:
543 avctx->pix_fmt = AV_PIX_FMT_RGB555;
544 break;
545 case 24:
546 /* 24 bits is not technically supported, but some clients might
547 * mistakenly set it, so let's assume they actually meant 32 bits */
548 c->bpp = 32;
550 case 32:
551 avctx->pix_fmt = AV_PIX_FMT_0RGB32;
552 break;
553 default:
554 av_log(avctx, AV_LOG_ERROR, "Unsupported bitdepth %i\n", c->bpp);
555 return AVERROR_INVALIDDATA;
556 }
557 c->bpp2 = c->bpp / 8;
558
559 c->pic = av_frame_alloc();
560 if (!c->pic)
561 return AVERROR(ENOMEM);
562
563 return 0;
564}
565
567{
568 VmncContext * const c = avctx->priv_data;
569
570 av_frame_free(&c->pic);
571
572 av_freep(&c->curbits);
573 av_freep(&c->curmask);
574 av_freep(&c->screendta);
575 return 0;
576}
577
579 .p.name = "vmnc",
580 CODEC_LONG_NAME("VMware Screen Codec / VMware Video"),
581 .p.type = AVMEDIA_TYPE_VIDEO,
582 .p.id = AV_CODEC_ID_VMNC,
583 .priv_data_size = sizeof(VmncContext),
584 .init = decode_init,
585 .close = decode_end,
587 .p.capabilities = AV_CODEC_CAP_DR1,
588};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:97
const FFCodec ff_vmnc_decoder
Definition vmnc.c:578
Libavcodec external API header.
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
Definition bytestream.h:158
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition bytestream.h:137
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
Definition bytestream.h:168
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
common internal and external API header
long long int64_t
Definition coverity.c:34
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available.
Definition decode.c:1943
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:613
int ret
Definition ffplay.c:391
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_VMNC
Definition codec_id.h:139
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AVERROR(e)
Definition error.h:45
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition frame.h:694
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition frame.c:281
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:65
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition frame.c:53
#define AV_LOG_INFO
Standard information.
Definition log.h:221
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
Definition mem.c:289
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
@ AV_PICTURE_TYPE_I
Intra.
Definition avutil.h:278
@ AV_PICTURE_TYPE_P
Predicted.
Definition avutil.h:279
static av_cold int decode_init(AVCodecContext *avctx)
Definition 4xm.c:1000
static av_cold int decode_end(AVCodecContext *avctx)
Definition 4xm.c:982
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
Definition 4xm.c:839
av_cold void CBS_FUNC close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
Definition cbs.c:118
Macro definitions for various function/variable attributes.
#define av_always_inline
Definition attributes.h:72
#define av_fallthrough
Definition attributes.h:67
#define av_cold
Definition attributes.h:117
uint8_t w
Definition llvidencdsp.c:39
Memory handling functions.
#define AV_PIX_FMT_0RGB32
Definition pixfmt.h:524
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition pixfmt.h:84
#define AV_PIX_FMT_RGB555
Definition pixfmt.h:536
main external API structure.
Definition avcodec.h:443
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition avcodec.h:644
int width
picture width / height.
Definition avcodec.h:605
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition avcodec.h:1574
void * priv_data
Definition avcodec.h:470
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
This structure stores compressed data.
Definition packet.h:587
int size
Definition packet.h:611
uint8_t * data
Definition packet.h:610
uint8_t * screendta
Definition vmnc.c:73
int cur_w
Definition vmnc.c:69
int cur_h
Definition vmnc.c:69
GetByteContext gb
Definition vmnc.c:66
uint8_t * curbits
Definition vmnc.c:72
uint8_t * curmask
Definition vmnc.c:72
uint8_t pal[768]
Definition vmnc.c:64
int cursor_painted
Definition vmnc.c:74
int height
Definition vmnc.c:65
int cur_x
Definition vmnc.c:70
int bpp2
Definition vmnc.c:62
int bpp
Definition vmnc.c:61
int cur_hx
Definition vmnc.c:71
AVFrame * pic
Definition vmnc.c:59
AVCodecContext * avctx
Definition vmnc.c:58
int width
Definition vmnc.c:65
int cur_y
Definition vmnc.c:70
int cur_hy
Definition vmnc.c:71
int bigendian
Definition vmnc.c:63
#define stride
#define av_freep(p)
#define av_log(a,...)
static void load_cursor(VmncContext *c)
Definition vmnc.c:96
static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
Definition vmnc.c:326
EncTypes
Definition vmnc.c:36
@ MAGIC_WMVf
Definition vmnc.c:39
@ MAGIC_WMVi
Definition vmnc.c:42
@ MAGIC_WMVj
Definition vmnc.c:43
@ MAGIC_WMVh
Definition vmnc.c:41
@ MAGIC_WMVd
Definition vmnc.c:37
@ MAGIC_WMVe
Definition vmnc.c:38
@ MAGIC_WMVg
Definition vmnc.c:40
static av_always_inline int vmnc_get_pixel(GetByteContext *gb, int bpp, int be)
Definition vmnc.c:78
static void put_cursor(uint8_t *dst, int stride, VmncContext *c, int dx, int dy)
Definition vmnc.c:131
static av_cold int decode_init(AVCodecContext *avctx)
Definition vmnc.c:529
static av_cold int decode_end(AVCodecContext *avctx)
Definition vmnc.c:566
static av_always_inline void paint_raw(uint8_t *dst, int w, int h, GetByteContext *gb, int bpp, int be, int stride)
Definition vmnc.c:221
static int decode_hextile(VmncContext *c, uint8_t *dst, GetByteContext *gb, int w, int h, int stride)
Definition vmnc.c:245
static void reset_buffers(VmncContext *c)
Definition vmnc.c:316
static av_always_inline void paint_rect(uint8_t *dst, int dx, int dy, int w, int h, int color, int bpp, int stride)
Definition vmnc.c:191
HexTile_Flags
Definition vmnc.c:46
@ HT_FG
Definition vmnc.c:49
@ HT_RAW
Definition vmnc.c:47
@ HT_SUB
Definition vmnc.c:50
@ HT_BKG
Definition vmnc.c:48
@ HT_CLR
Definition vmnc.c:51
static double c[64]