36 int i, ret, buf_size = avpkt->
size;
37 uint32_t
version, header_size, vclass, ncolors;
38 uint32_t xoffset, be, bpp, lsize, rsize;
39 uint32_t pixformat, pixdepth, bunit, bitorder, bpad;
49 header_size = bytestream2_get_be32u(&gb);
51 version = bytestream2_get_be32u(&gb);
62 pixformat = bytestream2_get_be32u(&gb);
63 pixdepth = bytestream2_get_be32u(&gb);
64 width = bytestream2_get_be32u(&gb);
65 height = bytestream2_get_be32u(&gb);
66 xoffset = bytestream2_get_be32u(&gb);
67 be = bytestream2_get_be32u(&gb);
68 bunit = bytestream2_get_be32u(&gb);
69 bitorder = bytestream2_get_be32u(&gb);
70 bpad = bytestream2_get_be32u(&gb);
71 bpp = bytestream2_get_be32u(&gb);
72 lsize = bytestream2_get_be32u(&gb);
73 vclass = bytestream2_get_be32u(&gb);
74 rgb[0] = bytestream2_get_be32u(&gb);
75 rgb[1] = bytestream2_get_be32u(&gb);
76 rgb[2] = bytestream2_get_be32u(&gb);
78 ncolors = bytestream2_get_be32u(&gb);
85 "pixformat %"PRIu32
", pixdepth %"PRIu32
", bunit %"PRIu32
", bitorder %"PRIu32
", bpad %"PRIu32
"\n",
86 pixformat, pixdepth, bunit, bitorder, bpad);
88 "vclass %"PRIu32
", ncolors %"PRIu32
", bpp %"PRIu32
", be %"PRIu32
", lsize %"PRIu32
", xoffset %"PRIu32
"\n",
89 vclass, ncolors, bpp, be, lsize, xoffset);
91 "red %0"PRIx32
", green %0"PRIx32
", blue %0"PRIx32
"\n",
92 rgb[0], rgb[1], rgb[2]);
99 if (pixdepth == 0 || pixdepth > 32) {
119 if (bunit != 8 && bunit != 16 && bunit != 32) {
124 if (bpad != 8 && bpad != 16 && bpad != 32) {
129 if (bpp == 0 || bpp > 32) {
162 if (bpp != 1 && bpp != 8)
164 if (bpp == 1 && pixdepth == 1) {
166 }
else if (bpp == 8 && pixdepth == 8) {
177 if (bpp != 16 && bpp != 24 && bpp != 32)
179 if (bpp == 16 && pixdepth == 15) {
180 if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F)
182 else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00)
184 }
else if (bpp == 16 && pixdepth == 16) {
185 if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F)
187 else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800)
189 }
else if (bpp == 24) {
190 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
192 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
194 }
else if (bpp == 32) {
195 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
197 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
209 "Unknown file: bpp %"PRIu32
", pixdepth %"PRIu32
", vclass %"PRIu32
"",
210 bpp, pixdepth, vclass);
221 uint32_t *dst = (uint32_t *)p->
data[1];
224 for (i = 0; i < ncolors; i++) {
227 red = bytestream2_get_byteu(&gb);
229 green = bytestream2_get_byteu(&gb);
231 blue = bytestream2_get_byteu(&gb);
234 dst[i] = 0xFF
U << 24 | red << 16 | green << 8 | blue;
239 for (i = 0; i < avctx->
height; i++) {
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
packed RGB 8:8:8, 24bpp, RGBRGB...
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
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)
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
8 bits with AV_PIX_FMT_RGB32 palette
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
#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. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
const char * name
Name of the codec implementation.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
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.
static int xwd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
packed RGB 8:8:8, 24bpp, BGRBGR...
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined ...
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
int key_frame
1 -> keyframe, 0-> not
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.