75 switch(bpp * 2 + be) {
89 const int bpp = c->
bpp2;
91 uint16_t *dst16 = (uint16_t*)c->
curbits;
92 uint32_t *dst32 = (uint32_t*)c->
curbits;
94 for(j = 0; j < c->
cur_h; j++) {
95 for(i = 0; i < c->
cur_w; i++) {
98 if(bpp == 1) *dst8++ = p;
99 if(bpp == 2) *dst16++ = p;
100 if(bpp == 4) *dst32++ = p;
106 for(j = 0; j < c->
cur_h; j++) {
107 for(i = 0; i < c->
cur_w; i++) {
110 if(bpp == 1) *dst8++ = p;
111 if(bpp == 2) *dst16++ = p;
112 if(bpp == 4) *dst32++ = p;
136 if((w < 1) || (h < 1))
return;
141 for(j = 0; j < h; j++) {
142 for(i = 0; i < w; i++)
143 dst[i] = (dst[i] & cd[i]) ^ msk[i];
148 }
else if(c->
bpp2 == 2) {
149 uint16_t* cd = (uint16_t*)c->
curbits, *msk = (uint16_t*)c->
curmask;
151 for(j = 0; j < h; j++) {
152 dst2 = (uint16_t*)dst;
153 for(i = 0; i < w; i++)
154 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
159 }
else if(c->
bpp2 == 4) {
160 uint32_t* cd = (uint32_t*)c->
curbits, *msk = (uint32_t*)c->
curmask;
162 for(j = 0; j < h; j++) {
163 dst2 = (uint32_t*)dst;
164 for(i = 0; i < w; i++)
165 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
177 dst += dx * bpp + dy *
stride;
179 for(j = 0; j < h; j++) {
180 memset(dst, color, w);
185 for(j = 0; j < h; j++) {
186 dst2 = (uint16_t*)dst;
187 for(i = 0; i < w; i++) {
194 for(j = 0; j < h; j++) {
195 dst2 = (uint32_t*)dst;
196 for(i = 0; i < w; i++) {
207 for(j = 0; j < h; j++) {
208 for(i = 0; i < w; i++) {
216 ((uint16_t*)dst)[i] = p;
219 ((uint32_t*)dst)[i] = p;
230 int bg = 0, fg = 0, rects,
color,
flags, xy, wh;
231 const int bpp = c->
bpp2;
233 int bw = 16, bh = 16;
234 const uint8_t *ssrc=src;
236 for(j = 0; j < h; j += 16) {
239 if(j + 16 > h) bh = h - j;
240 for(i = 0; i < w; i += 16, dst2 += 16 * bpp) {
241 if(src - ssrc >= ssize) {
245 if(i + 16 > w) bw = w - i;
248 if(src - ssrc > ssize - bw * bh * bpp) {
253 src += bw * bh * bpp;
264 color = !!(flags &
HT_CLR);
266 paint_rect(dst2, 0, 0, bw, bh, bg, bpp, stride);
268 if(src - ssrc > ssize - rects * (color * bpp + 2)) {
272 for(k = 0; k < rects; k++) {
278 paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
289 const uint8_t *buf = avpkt->
data;
290 int buf_size = avpkt->
size;
293 const uint8_t *src = buf;
294 int dx, dy, w, h,
depth, enc, chunks, res, size_left;
323 if((w > 0) && (h > 0)) {
325 for(i = 0; i < h; i++) {
332 chunks =
AV_RB16(src); src += 2;
340 size_left = buf_size - (src - buf);
343 if(size_left < 2 + w * h * c->bpp2 * 2) {
344 av_log(avctx,
AV_LOG_ERROR,
"Premature end of data! (need %i got %i)\n", 2 + w * h * c->
bpp2 * 2, size_left);
360 src += w * h * c->
bpp2 * 2;
379 if(depth != c->
bpp) {
380 av_log(avctx,
AV_LOG_INFO,
"Depth mismatch. Container %i bpp, Frame data: %i bpp\n", c->
bpp, depth);
399 if(size_left < w * h * c->bpp2) {
404 src += w * h * c->
bpp2;
438 if((w > 0) && (h > 0)) {
440 for(i = 0; i < h; i++) {
struct VmncContext VmncContext
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AV_WL32 AV_WL24 AV_WL16 AV_WB32 AV_WB24 AV_RB16
#define FF_BUFFER_HINTS_VALID
AV_WL32 AV_WL24 AV_WL16 AV_RB32
int buffer_hints
codec suggestion on buffer type if != 0
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static void put_cursor(uint8_t *dst, int stride, VmncContext *c, int dx, int dy)
int(* reget_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of a frame to get cr buffer for it.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static int decode_hextile(VmncContext *c, uint8_t *dst, const uint8_t *src, int ssize, int w, int h, int stride)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
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.
static av_cold int decode_end(AVCodecContext *avctx)
#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.
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
static av_always_inline void paint_raw(uint8_t *dst, int w, int h, const uint8_t *src, int bpp, int be, int stride)
int width
picture width / height.
struct AVFrame AVFrame
Audio Video Frame.
#define FF_BUFFER_HINTS_REUSABLE
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)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_BUFFER_HINTS_PRESERVE
static av_always_inline void paint_rect(uint8_t *dst, int dx, int dy, int w, int h, int color, int bpp, int stride)
static av_always_inline int vmnc_get_pixel(const uint8_t *buf, int bpp, int be)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_cold int decode_init(AVCodecContext *avctx)
8 bit with PIX_FMT_RGB32 palette
static const uint8_t color[]
int key_frame
1 -> keyframe, 0-> not
static void load_cursor(VmncContext *c, const uint8_t *src)