Go to the documentation of this file.
35 uint32_t
version, header_size, vclass, ncolors;
36 uint32_t xoffset,
be, bpp, lsize, rsize;
37 uint32_t pixformat, pixdepth, bunit, bitorder, bpad;
48 header_size = bytestream2_get_be32u(&gb);
50 version = bytestream2_get_be32u(&gb);
61 pixformat = bytestream2_get_be32u(&gb);
62 pixdepth = bytestream2_get_be32u(&gb);
63 width = bytestream2_get_be32u(&gb);
64 height = bytestream2_get_be32u(&gb);
65 xoffset = bytestream2_get_be32u(&gb);
66 be = bytestream2_get_be32u(&gb);
67 bunit = bytestream2_get_be32u(&gb);
68 bitorder = bytestream2_get_be32u(&gb);
69 bpad = bytestream2_get_be32u(&gb);
70 bpp = bytestream2_get_be32u(&gb);
71 lsize = bytestream2_get_be32u(&gb);
72 vclass = bytestream2_get_be32u(&gb);
73 rgb[0] = bytestream2_get_be32u(&gb);
74 rgb[1] = bytestream2_get_be32u(&gb);
75 rgb[2] = bytestream2_get_be32u(&gb);
77 ncolors = bytestream2_get_be32u(&gb);
84 "pixformat %"PRIu32
", pixdepth %"PRIu32
", bunit %"PRIu32
", bitorder %"PRIu32
", bpad %"PRIu32
"\n",
85 pixformat, pixdepth, bunit, bitorder, bpad);
87 "vclass %"PRIu32
", ncolors %"PRIu32
", bpp %"PRIu32
", be %"PRIu32
", lsize %"PRIu32
", xoffset %"PRIu32
"\n",
88 vclass, ncolors, bpp,
be, lsize, xoffset);
90 "red %0"PRIx32
", green %0"PRIx32
", blue %0"PRIx32
"\n",
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) {
161 if (bpp != 1 && bpp != 8)
163 if (bpp == 1 && pixdepth == 1) {
165 }
else if (bpp == 8 && pixdepth == 8) {
176 if (bpp != 16 && bpp != 24 && bpp != 32)
178 if (bpp == 16 && pixdepth == 15) {
179 if (
rgb[0] == 0x7C00 &&
rgb[1] == 0x3E0 &&
rgb[2] == 0x1F)
181 else if (
rgb[0] == 0x1F &&
rgb[1] == 0x3E0 &&
rgb[2] == 0x7C00)
183 }
else if (bpp == 16 && pixdepth == 16) {
184 if (
rgb[0] == 0xF800 &&
rgb[1] == 0x7E0 &&
rgb[2] == 0x1F)
186 else if (
rgb[0] == 0x1F &&
rgb[1] == 0x7E0 &&
rgb[2] == 0xF800)
188 }
else if (bpp == 24) {
189 if (
rgb[0] == 0xFF0000 &&
rgb[1] == 0xFF00 &&
rgb[2] == 0xFF)
191 else if (
rgb[0] == 0xFF &&
rgb[1] == 0xFF00 &&
rgb[2] == 0xFF0000)
193 }
else if (bpp == 32) {
194 if (
rgb[0] == 0xFF0000 &&
rgb[1] == 0xFF00 &&
rgb[2] == 0xFF)
196 else if (
rgb[0] == 0xFF &&
rgb[1] == 0xFF00 &&
rgb[2] == 0xFF0000)
208 "Unknown file: bpp %"PRIu32
", pixdepth %"PRIu32
", vclass %"PRIu32
"",
209 bpp, pixdepth, vclass);
223 uint32_t *dst = (uint32_t *)p->
data[1];
224 uint8_t red, green, blue;
226 for (
int i = 0;
i < ncolors;
i++) {
228 red = bytestream2_get_byteu(&gb);
230 green = bytestream2_get_byteu(&gb);
232 blue = bytestream2_get_byteu(&gb);
235 dst[
i] = 0xFF
U << 24 | red << 16 | green << 8 | blue;
240 for (
int i = 0;
i < avctx->
height;
i++) {
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it be(in the first position) for now. Options ------- Then comes the options array. This is what will define the user accessible options. For example
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
This structure describes decoded (raw) audio or video data.
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
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.
@ AV_PIX_FMT_RGB555BE
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.
AVCodec p
The public AVCodec.
enum AVDiscard skip_frame
Skip decoding for selected frames.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define FF_CODEC_DECODE_CB(func)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define CODEC_LONG_NAME(str)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AVDISCARD_ALL
discard all
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
enum AVPictureType pict_type
Picture type of the frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
#define i(width, name, range_min, range_max)
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
main external API structure.
static int xwd_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
#define avpriv_request_sample(...)
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
const FFCodec ff_xwd_decoder
This structure stores compressed data.
int width
picture width / height.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
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...