58 for (i = 0; i < 3; ++i) {
75 unsigned char *dst,
int dst_size)
78 unsigned char huff_code_table[15];
79 unsigned char *dst_cur = dst;
80 unsigned char *dst_end = dst + dst_size;
81 const unsigned char *src_end = src + src_size;
83 memcpy(huff_code_table, src, 15);
86 while (src < src_end) {
88 if ((huff_code >> 4) == 15) {
91 *dst_cur++ = b | (huff_code >> 4);
93 *dst_cur++ = huff_code_table[huff_code >> 4];
94 if (dst_cur >= dst_end)
98 if (huff_code == 15) {
101 *dst_cur++ = huff_code_table[huff_code];
102 if (dst_cur >= dst_end)
106 return dst_cur - dst;
110 unsigned char *dst,
int dst_size)
113 int i, sz, offset, code;
114 unsigned char *dst_end = dst + dst_size, *dst_start = dst;
115 const unsigned char *src_end = src + src_size;
117 while (src < src_end && dst < dst_end) {
119 for (i = 0; i < 8 && src < src_end && dst < dst_end; ++i) {
120 if (code & (1 << i)) {
126 if ((
int)(dst - dst_start) < offset + 1)
128 sz = (cmd & 0xF) + 2;
132 sz =
FFMIN(sz, dst_end - dst);
134 *dst = *(dst - offset - 1);
145 unsigned char *dst,
int dst_size)
148 unsigned char *dst_end = dst + dst_size;
149 const unsigned char *src_end = src + src_size;
151 while (src < src_end && dst < dst_end) {
157 memset(dst, *src++,
FFMIN(len, dst_end - dst));
160 memcpy(dst, src,
FFMIN3(len, dst_end - dst, src_end - src));
168 void *
data,
int *got_frame,
172 int buf_size = avpkt->
size;
174 int i, y, palette_type, palette_colors_count,
175 bitmap_frame_type, bitmap_frame_size, res = 0;
177 palette_type = buf[0];
178 palette_colors_count =
AV_RL16(buf + 1);
179 bitmap_frame_type = buf[3];
182 bitmap_frame_size = buf_size - 4;
185 if (bitmap_frame_size < palette_colors_count * (3 + (palette_type != 0)))
187 if (palette_type == 0) {
188 if (palette_colors_count > 256)
190 for (i = 0; i < palette_colors_count; ++i) {
191 cin->
palette[i] = bytestream_get_le24(&buf);
192 bitmap_frame_size -= 3;
195 for (i = 0; i < palette_colors_count; ++i) {
198 bitmap_frame_size -= 4;
206 switch (bitmap_frame_type) {
256 "delphinecinvideo: reget_buffer() failed to allocate a frame\n");
285 for (i = 0; i < 3; ++i)
292 .
name =
"dsicinvideo",
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
static void cin_apply_delta_data(const unsigned char *src, unsigned char *dst, int size)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
AVCodec ff_dsicinvideo_decoder
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
const char * name
Name of the codec implementation.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
static int cin_decode_huffman(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
uint8_t * bitmap_table[3]
Libavcodec external API header.
static av_cold int cinvideo_decode_init(AVCodecContext *avctx)
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
Identical in function to av_frame_make_writable(), except it uses ff_get_buffer() to allocate the buf...
static av_cold int cinvideo_decode_end(AVCodecContext *avctx)
int width
picture width / height.
static int cin_decode_lzss(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
8 bit with PIX_FMT_RGB32 palette
main external API structure.
static void close(AVCodecParserContext *s)
int palette_has_changed
Tell user application that palette has changed from previous frame.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define FFSWAP(type, a, b)
common internal api header.
static av_cold int init(AVCodecParserContext *s)
static void cin_decode_rle(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int cinvideo_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)