76 switch(bpp * 2 + be) {
90 const int bpp = c->
bpp2;
92 uint16_t *dst16 = (uint16_t*)c->
curbits;
93 uint32_t *dst32 = (uint32_t*)c->
curbits;
95 for(j = 0; j < c->
cur_h; j++) {
96 for(i = 0; i < c->
cur_w; i++) {
99 if(bpp == 1) *dst8++ = p;
100 if(bpp == 2) *dst16++ = p;
101 if(bpp == 4) *dst32++ = p;
107 for(j = 0; j < c->
cur_h; j++) {
108 for(i = 0; i < c->
cur_w; i++) {
111 if(bpp == 1) *dst8++ = p;
112 if(bpp == 2) *dst16++ = p;
113 if(bpp == 4) *dst32++ = p;
137 if((w < 1) || (h < 1))
return;
142 for(j = 0; j < h; j++) {
143 for(i = 0; i < w; i++)
144 dst[i] = (dst[i] & cd[i]) ^ msk[i];
149 }
else if(c->
bpp2 == 2) {
150 uint16_t* cd = (uint16_t*)c->
curbits, *msk = (uint16_t*)c->
curmask;
152 for(j = 0; j < h; j++) {
153 dst2 = (uint16_t*)dst;
154 for(i = 0; i < w; i++)
155 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
160 }
else if(c->
bpp2 == 4) {
161 uint32_t* cd = (uint32_t*)c->
curbits, *msk = (uint32_t*)c->
curmask;
163 for(j = 0; j < h; j++) {
164 dst2 = (uint32_t*)dst;
165 for(i = 0; i < w; i++)
166 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
178 dst += dx * bpp + dy *
stride;
180 for(j = 0; j < h; j++) {
181 memset(dst, color, w);
186 for(j = 0; j < h; j++) {
187 dst2 = (uint16_t*)dst;
188 for(i = 0; i < w; i++) {
195 for(j = 0; j < h; j++) {
196 dst2 = (uint32_t*)dst;
197 for(i = 0; i < w; i++) {
208 for(j = 0; j < h; j++) {
209 for(i = 0; i < w; i++) {
217 ((uint16_t*)dst)[i] = p;
220 ((uint32_t*)dst)[i] = p;
231 int bg = 0, fg = 0, rects,
color,
flags, xy, wh;
232 const int bpp = c->
bpp2;
234 int bw = 16, bh = 16;
237 for(j = 0; j < h; j += 16) {
240 if(j + 16 > h) bh = h - j;
241 for(i = 0; i < w; i += 16, dst2 += 16 * bpp) {
242 if(src - ssrc >= ssize) {
246 if(i + 16 > w) bw = w - i;
249 if(src - ssrc > ssize - bw * bh * bpp) {
254 src += bw * bh * bpp;
265 color = !!(flags &
HT_CLR);
267 paint_rect(dst2, 0, 0, bw, bh, bg, bpp, stride);
269 if(src - ssrc > ssize - rects * (color * bpp + 2)) {
273 for(k = 0; k < rects; k++) {
279 paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
292 int buf_size = avpkt->
size;
296 int dx, dy, w, h, depth, enc, chunks, res, size_left;
325 if((w > 0) && (h > 0)) {
327 for(i = 0; i < h; i++) {
334 chunks =
AV_RB16(src); src += 2;
342 size_left = buf_size - (src - buf);
345 if(size_left < 2 + w * h * c->bpp2 * 2) {
346 av_log(avctx,
AV_LOG_ERROR,
"Premature end of data! (need %i got %i)\n", 2 + w * h * c->
bpp2 * 2, size_left);
362 src += w * h * c->
bpp2 * 2;
381 if(depth != c->
bpp) {
382 av_log(avctx,
AV_LOG_INFO,
"Depth mismatch. Container %i bpp, Frame data: %i bpp\n", c->
bpp, depth);
401 if(size_left < w * h * c->bpp2) {
406 src += w * h * c->
bpp2;
440 if((w > 0) && (h > 0)) {
442 for(i = 0; i < h; i++) {
struct VmncContext VmncContext
This structure describes decoded (raw) audio or video data.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
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.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
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)
8 bit with PIX_FMT_RGB32 palette
static int decode_hextile(VmncContext *c, uint8_t *dst, const uint8_t *src, int ssize, int w, int h, int stride)
#define AV_PIX_FMT_RGB555
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int init(AVCodecParserContext *s)
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.
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 FF_BUFFER_HINTS_REUSABLE
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)
#define FF_BUFFER_HINTS_PRESERVE
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_cold int decode_init(AVCodecContext *avctx)
common internal and external API header
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
#define AVERROR_INVALIDDATA
static const uint8_t color[]
int key_frame
1 -> keyframe, 0-> not
static void load_cursor(VmncContext *c, const uint8_t *src)
#define FF_BUFFER_HINTS_VALID
This structure stores compressed data.