48 uint32_t *pal,
int colors,
int pixmap)
52 for (i = 0; i <= colors; i++) {
54 unsigned int idx = bytestream2_get_be16(gbc);
55 if (idx > 255 && !pixmap) {
57 "Palette index out of range: %u\n", idx);
63 r = bytestream2_get_byte(gbc);
65 g = bytestream2_get_byte(gbc);
67 b = bytestream2_get_byte(gbc);
69 pal[pixmap ? i : idx] = (0xFF
U << 24) | (r << 16) | (g << 8) | b;
80 for (i = 0; i < avctx->
height; i++) {
81 int size, left, code, pix;
87 size = left = bytestream2_get_be16(gbc);
89 size = left = bytestream2_get_byte(gbc);
95 code = bytestream2_get_byte(gbc);
97 pix = bytestream2_get_byte(gbc);
98 for (j = 0; j < 257 - code; j++) {
100 out[pos++] = (pix & 0xC0) >> 6;
102 out[pos++] = (pix & 0x30) >> 4;
104 out[pos++] = (pix & 0x0C) >> 2;
106 out[pos++] = (pix & 0x03);
110 for (j = 0; j < code + 1; j++) {
111 pix = bytestream2_get_byte(gbc);
113 out[pos++] = (pix & 0xC0) >> 6;
115 out[pos++] = (pix & 0x30) >> 4;
117 out[pos++] = (pix & 0x0C) >> 2;
119 out[pos++] = (pix & 0x03);
121 left -= 1 + (code + 1);
135 for (i = 0; i < avctx->
height; i++) {
136 int size, left, code, pix;
141 size = left = bytestream2_get_be16(gbc);
147 code = bytestream2_get_byte(gbc);
149 pix = bytestream2_get_byte(gbc);
150 for (j = 0; j < 257 - code; j++) {
152 out[pos++] = (pix & 0xF0) >> 4;
154 out[pos++] = pix & 0xF;
158 for (j = 0; j < code + 1; j++) {
159 pix = bytestream2_get_byte(gbc);
161 out[pos++] = (pix & 0xF0) >> 4;
163 out[pos++] = pix & 0xF;
165 left -= 1 + (code + 1);
179 for (i = 0; i < avctx->
height; i++) {
180 int size, left, code, pix;
181 uint16_t *
out = (uint16_t *)outdata;
185 size = left = bytestream2_get_be16(gbc);
191 code = bytestream2_get_byte(gbc);
193 pix = bytestream2_get_be16(gbc);
194 for (j = 0; j < 257 - code; j++) {
201 for (j = 0; j < code + 1; j++) {
203 out[pos++] = bytestream2_get_be16(gbc);
208 left -= 1 + (code + 1) * 2;
223 for (i = 0; i < avctx->
height; i++) {
224 int size, left, code, pix;
229 size = left = bytestream2_get_be16(gbc);
235 code = bytestream2_get_byte(gbc);
237 pix = bytestream2_get_byte(gbc);
238 for (j = 0; j < 257 - code; j++) {
242 if (pos >= offset && step > 1) {
249 for (j = 0; j < code + 1; j++) {
250 pix = bytestream2_get_byte(gbc);
254 if (pos >= offset && step > 1) {
269 unsigned w,
h,
v0, v1;
284 if (v0 == 0x0011 && v1 == 0x02FF)
291 void *
data,
int *got_frame,
316 h = bytestream2_get_be16(&gbc);
317 w = bytestream2_get_be16(&gbc);
328 }
else if (ver != 2) {
337 int rowbytes, pack_type;
339 int opcode = bytestream2_get_be16(&gbc);
349 flags = bytestream2_get_be16(&gbc) & 0xC000;
351 bppcnt = bytestream2_get_be16(&gbc);
352 bpp = bytestream2_get_be16(&gbc);
355 if (bppcnt == 1 && bpp == 8) {
357 }
else if (bppcnt == 1 && (bpp == 4 || bpp == 2)) {
359 }
else if (bppcnt == 3 && bpp == 5) {
363 "Invalid pixel format (bppcnt %d bpp %d) in Packbit\n",
370 colors = bytestream2_get_be16(&gbc);
372 if (colors < 0 || colors > 256) {
374 "Error color count - %i(0x%X)\n", colors, colors);
385 ret =
parse_palette(avctx, &gbc, (uint32_t *)p->
data[1], colors, flags & 0x8000);
415 rowbytes = bytestream2_get_be16(&gbc) & 0x3FFF;
416 if (rowbytes <= 250) {
422 h = bytestream2_get_be16(&gbc);
423 w = bytestream2_get_be16(&gbc);
430 pack_type = bytestream2_get_be16(&gbc);
433 bppcnt = bytestream2_get_be16(&gbc);
434 bpp = bytestream2_get_be16(&gbc);
437 if (bppcnt == 3 && bpp == 8) {
439 }
else if (bppcnt == 3 && bpp == 5 || bppcnt == 2 && bpp == 8) {
441 }
else if (bppcnt == 4 && bpp == 8) {
445 "Invalid pixel format (bppcnt %d bpp %d) in Directbit\n",
454 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);
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
#define AV_LOG_WARNING
Something somehow does not look correct.
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.
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)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
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
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
static int decode_rle_bpp4(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc, int step)
const char * name
Name of the codec implementation.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const uint8_t offset[127][2]
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
static int decode_rle16(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
static int parse_palette(AVCodecContext *avctx, GetByteContext *gbc, uint32_t *pal, int colors, int pixmap)
#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.
int palette_has_changed
Tell user application that palette has changed from previous frame.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define flags(name, subs,...)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
common internal and external API header
static int decode_rle_bpp2(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
#define AV_PIX_FMT_RGB555
int key_frame
1 -> keyframe, 0-> not
static int check_header(const char *buf, int buf_size)
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.