28 #define RT_BYTE_ENCODED 2
29 #define RT_FORMAT_RGB 3
30 #define RT_FORMAT_TIFF 4
31 #define RT_FORMAT_IFF 5
48 const uint8_t *buf = avpkt->
data;
49 const uint8_t *buf_end = avpkt->
data + avpkt->
size;
53 unsigned int w, h,
depth, type, maptype, maplength,
stride, x, y,
len, alen;
55 const uint8_t *bufstart = buf;
60 if (
AV_RB32(buf) != 0x59a66a95) {
118 if (buf_end - buf < maplength)
121 if (depth != 8 && maplength) {
122 av_log(avctx,
AV_LOG_WARNING,
"useless colormap found or file is corrupted, trying to recover\n");
124 }
else if (depth == 8) {
125 unsigned int len = maplength / 3;
131 if (maplength % 3 || maplength > 768) {
137 for (x=0; x<
len; x++, ptr+=4)
138 *(uint32_t *)ptr = (buf[x]<<16) + (buf[len+x]<<8) + buf[len+len+x];
147 len = (depth * w + 7) >> 3;
148 alen = len + (len&1);
152 uint8_t *end = ptr + h*
stride;
155 while (ptr != end && buf < buf_end) {
157 if (buf_end - buf < 1)
160 if ((value = *buf++) == 0x80) {
177 for (y=0; y<h; y++) {
178 if (buf_end - buf < len)
180 memcpy(ptr, buf, len);
189 return buf - bufstart;
int(* get_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of each frame to get a buffer for it.
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
AV_WL32 AV_WL24 AV_WL16 AV_RB32
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
AVFrame * coded_frame
the picture in the bitstream
#define AV_LOG_WARNING
Something somehow does not look correct.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
struct SUNRASTContext SUNRASTContext
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#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.
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.
struct AVFrame AVFrame
Audio Video Frame.
static int sunrast_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
AVCodec ff_sunrast_decoder
static av_cold int sunrast_end(AVCodecContext *avctx)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
static av_cold int sunrast_init(AVCodecContext *avctx)
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
packed RGB 8:8:8, 24bpp, BGRBGR...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
8 bit with PIX_FMT_RGB32 palette
packed RGB 8:8:8, 24bpp, RGBRGB...
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.