43 int i, ret, buf_size = avpkt->
size;
44 uint32_t
version, header_size, vclass, ncolors;
45 uint32_t xoffset, be, bpp, lsize, rsize;
46 uint32_t pixformat, pixdepth, bunit, bitorder, bpad;
55 header_size = bytestream2_get_be32u(&gb);
57 version = bytestream2_get_be32u(&gb);
68 pixformat = bytestream2_get_be32u(&gb);
69 pixdepth = bytestream2_get_be32u(&gb);
70 avctx->
width = bytestream2_get_be32u(&gb);
71 avctx->
height = bytestream2_get_be32u(&gb);
72 xoffset = bytestream2_get_be32u(&gb);
73 be = bytestream2_get_be32u(&gb);
74 bunit = bytestream2_get_be32u(&gb);
75 bitorder = bytestream2_get_be32u(&gb);
76 bpad = bytestream2_get_be32u(&gb);
77 bpp = bytestream2_get_be32u(&gb);
78 lsize = bytestream2_get_be32u(&gb);
79 vclass = bytestream2_get_be32u(&gb);
80 rgb[0] = bytestream2_get_be32u(&gb);
81 rgb[1] = bytestream2_get_be32u(&gb);
82 rgb[2] = bytestream2_get_be32u(&gb);
84 ncolors = bytestream2_get_be32u(&gb);
87 av_log(avctx,
AV_LOG_DEBUG,
"pixformat %d, pixdepth %d, bunit %d, bitorder %d, bpad %d\n",
88 pixformat, pixdepth, bunit, bitorder, bpad);
89 av_log(avctx,
AV_LOG_DEBUG,
"vclass %d, ncolors %d, bpp %d, be %d, lsize %d, xoffset %d\n",
90 vclass, ncolors, bpp, be, lsize, xoffset);
98 if (pixdepth == 0 || pixdepth > 32) {
118 if (bunit != 8 && bunit != 16 && bunit != 32) {
123 if (bpad != 8 && bpad != 16 && bpad != 32) {
128 if (bpp == 0 || bpp > 32) {
173 if (bpp != 16 && bpp != 24 && bpp != 32)
175 if (bpp == 16 && pixdepth == 15) {
176 if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F)
178 else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00)
180 }
else if (bpp == 16 && pixdepth == 16) {
181 if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F)
183 else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800)
185 }
else if (bpp == 24) {
186 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
188 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
190 }
else if (bpp == 32) {
191 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
193 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
204 av_log_ask_for_sample(avctx,
"unknown file: bpp %d, pixdepth %d, vclass %d\n", 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] = red << 16 | green << 8 | blue;
239 for (i = 0; i < avctx->
height; i++) {
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.
packed RGB 8:8:8, 24bpp, RGBRGB...
AVFrame * coded_frame
the picture in the bitstream
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 ...
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)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
8 bit with 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)
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
#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...
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
static av_cold int xwd_decode_init(AVCodecContext *avctx)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
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.
static int xwd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
packed RGB 8:8:8, 24bpp, BGRBGR...
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
static av_cold int xwd_decode_close(AVCodecContext *avctx)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 ...
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 ...
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...
#define AVERROR_INVALIDDATA
#define AVERROR_PATCHWELCOME
int key_frame
1 -> keyframe, 0-> not
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 ...
This structure stores compressed data.