49 uint32_t *pal,
int colors,
int pixmap)
53 for (
i = 0;
i <= colors;
i++) {
55 unsigned int idx = bytestream2_get_be16(gbc);
56 if (idx > 255 && !pixmap) {
58 "Palette index out of range: %u\n", idx);
64 r = bytestream2_get_byte(gbc);
66 g = bytestream2_get_byte(gbc);
68 b = bytestream2_get_byte(gbc);
70 pal[pixmap ?
i : idx] = (0xFFU << 24) | (
r << 16) | (
g << 8) |
b;
78 uint8_t *outdata = p->data[0];
83 uint8_t *
out = outdata;
88 size =
left = bytestream2_get_be16(gbc);
90 size =
left = bytestream2_get_byte(gbc);
96 code = bytestream2_get_byte(gbc);
98 pix = bytestream2_get_byte(gbc);
99 for (j = 0; j < 257 -
code; j++) {
111 for (j = 0; j <
code + 1; j++) {
112 pix = bytestream2_get_byte(gbc);
125 outdata += p->linesize[0];
133 uint8_t *outdata = p->data[0];
138 uint8_t *
out = outdata;
142 size =
left = bytestream2_get_be16(gbc);
148 code = bytestream2_get_byte(gbc);
150 pix = bytestream2_get_byte(gbc);
151 for (j = 0; j < 257 -
code; j++) {
159 for (j = 0; j <
code + 1; j++) {
160 pix = bytestream2_get_byte(gbc);
169 outdata += p->linesize[0];
177 uint8_t *outdata = p->data[0];
182 uint16_t *
out = (uint16_t *)outdata;
186 size =
left = bytestream2_get_be16(gbc);
192 code = bytestream2_get_byte(gbc);
194 pix = bytestream2_get_be16(gbc);
195 for (j = 0; j < 257 -
code; j++) {
202 for (j = 0; j <
code + 1; j++) {
204 out[
pos++] = bytestream2_get_be16(gbc);
212 outdata += p->linesize[0];
222 uint8_t *outdata = p->data[0];
226 uint8_t *
out = outdata;
230 size =
left = bytestream2_get_be16(gbc);
236 code = bytestream2_get_byte(gbc);
238 pix = bytestream2_get_byte(gbc);
239 for (j = 0; j < 257 -
code; j++) {
250 for (j = 0; j <
code + 1; j++) {
251 pix = bytestream2_get_byte(gbc);
263 outdata += p->linesize[0];
270 unsigned w,
h, v0, v1;
285 if (v0 == 0x0011 && v1 == 0x02FF)
315 h = bytestream2_get_be16(&gbc);
316 w = bytestream2_get_be16(&gbc);
327 }
else if (ver != 2) {
336 int rowbytes, pack_type;
338 int opcode = bytestream2_get_be16(&gbc);
348 flags = bytestream2_get_be16(&gbc) & 0xC000;
350 bppcnt = bytestream2_get_be16(&gbc);
351 bpp = bytestream2_get_be16(&gbc);
354 if (bppcnt == 1 && bpp == 8) {
356 }
else if (bppcnt == 1 && (bpp == 4 || bpp == 2)) {
358 }
else if (bppcnt == 3 && bpp == 5) {
362 "Invalid pixel format (bppcnt %d bpp %d) in Packbit\n",
369 colors = bytestream2_get_be16(&gbc);
371 if (colors < 0 || colors > 255) {
373 "Error color count - %i(0x%X)\n", colors, colors);
413 rowbytes = bytestream2_get_be16(&gbc) & 0x3FFF;
414 if (rowbytes <= 250) {
420 h = bytestream2_get_be16(&gbc);
421 w = bytestream2_get_be16(&gbc);
428 pack_type = bytestream2_get_be16(&gbc);
431 bppcnt = bytestream2_get_be16(&gbc);
432 bpp = bytestream2_get_be16(&gbc);
435 if (bppcnt == 3 && bpp == 8) {
437 }
else if (bppcnt == 3 && bpp == 5 || bppcnt == 2 && bpp == 8) {
439 }
else if (bppcnt == 4 && bpp == 8) {
443 "Invalid pixel format (bppcnt %d bpp %d) in Directbit\n",
452 if (pack_type != 3 && pack_type != 4) {
478 bytestream2_get_be16(&gbc);
492 eop = bytestream2_get_be16(&gbc);
496 "Missing end of picture opcode (found 0x%04X)\n", eop);
const FFCodec ff_qdraw_decoder
Libavcodec external API header.
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
common internal and external API header
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
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_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
#define AV_PIX_FMT_RGB555
static int decode_rle_bpp4(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
static int decode_rle16(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
static int decode_rle_bpp2(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
static int parse_palette(AVCodecContext *avctx, GetByteContext *gbc, uint32_t *pal, int colors, int pixmap)
static int decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
static int check_header(const char *buf, int buf_size)
static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc, int step)
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
#define avpriv_request_sample(...)