44 if (*x + run >= s->
width) {
45 int n = s->
width - *x;
46 memset(d + *x, value, n);
53 memset(d + *x, value, run);
61 int *x,
int *y,
int *plane,
int bits_per_plane)
64 int shift = *plane * bits_per_plane;
65 int mask = ((1 << bits_per_plane) - 1) << shift;
70 for (j = 8-bits_per_plane; j >= 0; j -= bits_per_plane) {
72 d[*x] |= (value >> j) & mask;
80 value <<= bits_per_plane;
81 mask <<= bits_per_plane;
95 [3] = { 0, 11, 13, 15 },
96 [4] = { 0, 10, 12, 14 },
97 [5] = { 0, 11, 12, 15 },
101 void *
data,
int *got_frame,
106 int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;
107 int i, x, y, plane, tmp;
114 if (bytestream2_get_le16u(&s->
g) != 0x1234)
117 s->
width = bytestream2_get_le16u(&s->
g);
118 s->
height = bytestream2_get_le16u(&s->
g);
120 tmp = bytestream2_get_byteu(&s->
g);
121 bits_per_plane = tmp & 0xF;
124 if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {
129 if (bytestream2_peek_byte(&s->
g) == 0xFF) {
131 etype = bytestream2_get_le16(&s->
g);
132 esize = bytestream2_get_le16(&s->
g);
160 if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->
g) < 6) {
161 int idx = bytestream2_get_byte(&s->
g);
163 for (i = 0; i < npal; i++)
165 }
else if (etype == 2) {
166 npal =
FFMIN(esize, 16);
167 for (i = 0; i < npal; i++) {
168 int pal_idx = bytestream2_get_byte(&s->
g);
171 }
else if (etype == 3) {
172 npal =
FFMIN(esize, 16);
173 for (i = 0; i < npal; i++) {
174 int pal_idx = bytestream2_get_byte(&s->
g);
177 }
else if (etype == 4 || etype == 5) {
178 npal =
FFMIN(esize / 3, 256);
179 for (i = 0; i < npal; i++)
180 palette[i] = bytestream2_get_be24(&s->
g) << 2;
184 palette[0] = 0x000000;
185 palette[1] = 0xFFFFFF;
186 }
else if (bpp == 2) {
188 for (i = 0; i < npal; i++)
203 if (bytestream2_get_le16(&s->
g)) {
205 int stop_size, marker,
t1,
t2;
208 t2 = bytestream2_get_le16(&s->
g);
209 stop_size = t1 -
FFMIN(t1, t2);
212 marker = bytestream2_get_byte(&s->
g);
214 while (plane < s->nb_planes &&
217 int val = bytestream2_get_byte(&s->
g);
219 run = bytestream2_get_byte(&s->
g);
221 run = bytestream2_get_le16(&s->
g);
222 val = bytestream2_get_byte(&s->
g);
227 if (bits_per_plane == 8) {
232 picmemset(s, val, run, &x, &y, &plane, bits_per_plane);
This structure describes decoded (raw) audio or video data.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static const uint8_t cga_mode45_index[6][4]
8 bit with PIX_FMT_RGB32 palette
static av_cold int decode_end(AVCodecContext *avctx)
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
static const uint16_t mask[17]
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static void picmemset(PicContext *s, int value, int run, int *x, int *y, int *plane, int bits_per_plane)
static void picmemset_8bpp(PicContext *s, int value, int run, int *x, int *y)
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
static av_always_inline int bytestream2_tell(GetByteContext *g)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
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)
AVCodec ff_pictor_decoder
int palette_has_changed
Tell user application that palette has changed from previous frame.
const uint32_t ff_cga_palette[16]
const uint32_t ff_ega_palette[64]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
#define AVERROR_INVALIDDATA
#define AVERROR_PATCHWELCOME
struct PicContext PicContext
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
This structure stores compressed data.
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)