22 #include "libavutil/common.h"
23 #include "libavutil/intreadwrite.h"
24 #include "libavutil/imgutils.h"
35 unsigned int w, h,
depth,
type, maptype, maplength,
stride, x,
y,
len, alen;
110 if (buf_end - buf < maplength)
113 if (depth > 8 && maplength) {
114 av_log(avctx,
AV_LOG_WARNING,
"useless colormap found or file is corrupted, trying to recover\n");
116 }
else if (maplength) {
117 unsigned int len = maplength / 3;
119 if (maplength % 3 || maplength > 768) {
125 for (x = 0; x <
len; x++, ptr += 4)
126 *(uint32_t *)ptr = (0xFF
U<<24) + (buf[x]<<16) + (buf[len+x]<<8) + buf[len+len+x];
131 if (maplength && depth < 8) {
135 stride = (w + 15 >> 3) * depth;
142 len = (depth * w + 7) >> 3;
143 alen = len + (len & 1);
150 while (ptr != end && buf < buf_end) {
152 if (buf_end - buf < 1)
172 for (y = 0; y < h; y++) {
173 if (buf_end - buf < len)
175 memcpy(ptr, buf, len);
183 for (y=0; y<h; y++) {
184 for (x = 0; x < (w + 7 >> 3) * depth; x++) {
186 ptr[8*x] = ptr2[x] >> 7;
187 ptr[8*x+1] = ptr2[x] >> 6 & 1;
188 ptr[8*x+2] = ptr2[x] >> 5 & 1;
189 ptr[8*x+3] = ptr2[x] >> 4 & 1;
190 ptr[8*x+4] = ptr2[x] >> 3 & 1;
191 ptr[8*x+5] = ptr2[x] >> 2 & 1;
192 ptr[8*x+6] = ptr2[x] >> 1 & 1;
193 ptr[8*x+7] = ptr2[x] & 1;
195 ptr[2*x] = ptr2[x] >> 4;
196 ptr[2*x+1] = ptr2[x] & 0xF;
200 ptr2 += (w + 15 >> 3) * depth;
207 return buf - bufstart;
#define AVERROR_PATCHWELCOME
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define RMT_RAW
the data layout of this map type is unknown
packed RGB 8:8:8, 24bpp, RGBRGB...
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
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.
packed BGR 8:8:8, 32bpp, 0BGR0BGR...
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
packed RGB 8:8:8, 24bpp, BGRBGR...
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static av_cold int end(AVCodecContext *avctx)
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.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Libavcodec external API header.
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.
int width
picture width / height.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
AVCodec ff_sunrast_decoder
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static int sunrast_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
common internal api header.
#define AVERROR_INVALIDDATA
8 bit with PIX_FMT_RGB32 palette
packed RGB 8:8:8, 32bpp, 0RGB0RGB...
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.