50 #define CHECK_PIXEL_PTR(n) \
51 if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \
52 av_log (s->avctx, AV_LOG_ERROR, "Problem: pixel_ptr = %d, pixel_limit = %d\n",\
53 pixel_ptr + n, pixel_limit); \
62 unsigned char pi0, pi1;
70 while (lines_to_change) {
71 skip = bytestream2_get_byte(&s->
g);
72 rle_code = (
signed char)bytestream2_get_byte(&s->
g);
78 pixel_ptr = row_ptr + 2 * (skip & 0x7f);
80 pixel_ptr += 2 * skip;
89 pi0 = bytestream2_get_byte(&s->
g);
90 pi1 = bytestream2_get_byte(&s->
g);
94 rgb[pixel_ptr++] = pi0;
95 rgb[pixel_ptr++] = pi1;
103 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
109 int lines_to_change,
int bpp)
114 unsigned char pi[16];
117 int num_pixels = (bpp == 4) ? 8 : 16;
119 while (lines_to_change--) {
120 pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
123 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
126 pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
128 }
else if (rle_code < 0) {
130 rle_code = -rle_code;
133 for (i = num_pixels-1; i >= 0; i--) {
134 pi[num_pixels-1-i] = (bytestream2_peek_byte(&s->
g) >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
139 for (i = 0; i < num_pixels; i++)
140 rgb[pixel_ptr++] = pi[i];
148 int x = bytestream2_get_byte(&s->
g);
149 rgb[pixel_ptr++] = (x >> 4) & 0x0f;
150 rgb[pixel_ptr++] = x & 0x0f;
152 int x = bytestream2_get_byte(&s->
g);
153 rgb[pixel_ptr++] = (x >> 6) & 0x03;
154 rgb[pixel_ptr++] = (x >> 4) & 0x03;
155 rgb[pixel_ptr++] = (x >> 2) & 0x03;
156 rgb[pixel_ptr++] = x & 0x03;
170 unsigned char pi1, pi2, pi3, pi4;
174 while (lines_to_change--) {
175 pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&s->
g) - 1));
178 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
181 pixel_ptr += (4 * (bytestream2_get_byte(&s->
g) - 1));
183 }
else if (rle_code < 0) {
185 rle_code = -rle_code;
188 pi1 = bytestream2_get_byte(&s->
g);
189 pi2 = bytestream2_get_byte(&s->
g);
190 pi3 = bytestream2_get_byte(&s->
g);
191 pi4 = bytestream2_get_byte(&s->
g);
196 rgb[pixel_ptr++] = pi1;
197 rgb[pixel_ptr++] = pi2;
198 rgb[pixel_ptr++] = pi3;
199 rgb[pixel_ptr++] = pi4;
207 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
220 unsigned short rgb16;
224 while (lines_to_change--) {
225 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 2;
228 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
231 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 2;
233 }
else if (rle_code < 0) {
235 rle_code = -rle_code;
236 rgb16 = bytestream2_get_be16(&s->
g);
241 *(
unsigned short *)(&rgb[pixel_ptr]) = rgb16;
249 rgb16 = bytestream2_get_be16(&s->
g);
250 *(
unsigned short *)(&rgb[pixel_ptr]) = rgb16;
264 unsigned char r,
g,
b;
268 while (lines_to_change--) {
269 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 3;
272 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
275 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 3;
277 }
else if (rle_code < 0) {
279 rle_code = -rle_code;
280 r = bytestream2_get_byte(&s->
g);
281 g = bytestream2_get_byte(&s->
g);
282 b = bytestream2_get_byte(&s->
g);
287 rgb[pixel_ptr++] =
r;
288 rgb[pixel_ptr++] =
g;
289 rgb[pixel_ptr++] =
b;
296 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
297 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
298 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
315 while (lines_to_change--) {
316 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 4;
319 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
322 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 4;
324 }
else if (rle_code < 0) {
326 rle_code = -rle_code;
327 argb = bytestream2_get_be32(&s->
g);
340 argb = bytestream2_get_be32(&s->
g);
396 void *
data,
int *got_frame,
400 int header, start_line;
419 header = bytestream2_get_be16(&s->
g);
422 if (header & 0x0008) {
423 if (avpkt->
size < 14)
425 start_line = bytestream2_get_be16(&s->
g);
427 height = bytestream2_get_be16(&s->
g);
static void qtrle_decode_2n4bpp(QtrleContext *s, int row_ptr, int lines_to_change, int bpp)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
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)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
const char * name
Name of the codec implementation.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static av_cold int qtrle_decode_init(AVCodecContext *avctx)
static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Libavcodec external API header.
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
Identical in function to av_frame_make_writable(), except it uses ff_get_buffer() to allocate the buf...
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
static void qtrle_decode_8bpp(QtrleContext *s, int row_ptr, int lines_to_change)
#define CHECK_PIXEL_PTR(n)
8 bit with PIX_FMT_RGB32 palette
#define AV_PIX_FMT_RGB555
main external API structure.
static void close(AVCodecParserContext *s)
int palette_has_changed
Tell user application that palette has changed from previous frame.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change)
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
common internal api header.
static int qtrle_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static av_cold int init(AVCodecParserContext *s)
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
static void qtrle_decode_16bpp(QtrleContext *s, int row_ptr, int lines_to_change)
static av_cold int qtrle_decode_end(AVCodecContext *avctx)
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.