48 uint32_t *pal,
int colors)
52 for (i = 0; i <= colors; i++) {
54 unsigned int idx = bytestream2_get_be16(gbc);
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[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;
338 int opcode = bytestream2_get_be16(&gbc);
349 bppcnt = bytestream2_get_be16(&gbc);
350 bpp = bytestream2_get_be16(&gbc);
353 if (bppcnt == 1 && bpp == 8) {
355 }
else if (bppcnt == 1 && (bpp == 4 || bpp == 2)) {
357 }
else if (bppcnt == 3 && bpp == 5) {
361 "Invalid pixel format (bppcnt %d bpp %d) in Packbit\n",
368 colors = bytestream2_get_be16(&gbc);
370 if (colors < 0 || colors > 256) {
372 "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) {
476 bytestream2_get_be16(&gbc);
490 eop = bytestream2_get_be16(&gbc);
494 "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.
#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)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int parse_palette(AVCodecContext *avctx, GetByteContext *gbc, uint32_t *pal, int colors)
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.
#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.
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.