49 #define CHECK_PIXEL_PTR(n) \
50 if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \
51 av_log (s->avctx, AV_LOG_INFO, "Problem: pixel_ptr = %d, pixel_limit = %d\n", \
52 pixel_ptr + n, pixel_limit); \
61 unsigned char pi0, pi1;
69 while (lines_to_change) {
70 skip = bytestream2_get_byte(&s->
g);
71 rle_code = (
signed char)bytestream2_get_byte(&s->
g);
77 pixel_ptr = row_ptr + 2 * (skip & 0x7f);
79 pixel_ptr += 2 * skip;
88 pi0 = bytestream2_get_byte(&s->
g);
89 pi1 = bytestream2_get_byte(&s->
g);
93 rgb[pixel_ptr++] = pi0;
94 rgb[pixel_ptr++] = pi1;
102 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
108 int lines_to_change,
int bpp)
113 unsigned char pi[16];
116 int num_pixels = (bpp == 4) ? 8 : 16;
118 while (lines_to_change--) {
119 pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
122 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
125 pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
127 }
else if (rle_code < 0) {
129 rle_code = -rle_code;
132 for (i = num_pixels-1; i >= 0; i--) {
133 pi[num_pixels-1-i] = (bytestream2_peek_byte(&s->
g) >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
138 for (i = 0; i < num_pixels; i++)
139 rgb[pixel_ptr++] = pi[i];
147 int x = bytestream2_get_byte(&s->
g);
148 rgb[pixel_ptr++] = (x >> 4) & 0x0f;
149 rgb[pixel_ptr++] = x & 0x0f;
151 int x = bytestream2_get_byte(&s->
g);
152 rgb[pixel_ptr++] = (x >> 6) & 0x03;
153 rgb[pixel_ptr++] = (x >> 4) & 0x03;
154 rgb[pixel_ptr++] = (x >> 2) & 0x03;
155 rgb[pixel_ptr++] = x & 0x03;
169 unsigned char pi1, pi2, pi3, pi4;
173 while (lines_to_change--) {
174 pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&s->
g) - 1));
177 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
180 pixel_ptr += (4 * (bytestream2_get_byte(&s->
g) - 1));
182 }
else if (rle_code < 0) {
184 rle_code = -rle_code;
187 pi1 = bytestream2_get_byte(&s->
g);
188 pi2 = bytestream2_get_byte(&s->
g);
189 pi3 = bytestream2_get_byte(&s->
g);
190 pi4 = bytestream2_get_byte(&s->
g);
195 rgb[pixel_ptr++] = pi1;
196 rgb[pixel_ptr++] = pi2;
197 rgb[pixel_ptr++] = pi3;
198 rgb[pixel_ptr++] = pi4;
206 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
219 unsigned short rgb16;
223 while (lines_to_change--) {
224 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 2;
227 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
230 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 2;
232 }
else if (rle_code < 0) {
234 rle_code = -rle_code;
235 rgb16 = bytestream2_get_be16(&s->
g);
240 *(
unsigned short *)(&rgb[pixel_ptr]) = rgb16;
248 rgb16 = bytestream2_get_be16(&s->
g);
249 *(
unsigned short *)(&rgb[pixel_ptr]) = rgb16;
263 unsigned char r,
g,
b;
267 while (lines_to_change--) {
268 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 3;
271 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
274 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 3;
276 }
else if (rle_code < 0) {
278 rle_code = -rle_code;
279 r = bytestream2_get_byte(&s->
g);
280 g = bytestream2_get_byte(&s->
g);
281 b = bytestream2_get_byte(&s->
g);
286 rgb[pixel_ptr++] =
r;
287 rgb[pixel_ptr++] =
g;
288 rgb[pixel_ptr++] =
b;
295 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
296 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
297 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
314 while (lines_to_change--) {
315 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 4;
318 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
321 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 4;
323 }
else if (rle_code < 0) {
325 rle_code = -rle_code;
326 argb = bytestream2_get_be32(&s->
g);
339 argb = bytestream2_get_be32(&s->
g);
393 void *
data,
int *got_frame,
397 int header, start_line;
418 header = bytestream2_get_be16(&s->
g);
421 if (header & 0x0008) {
422 if (avpkt->
size < 14)
424 start_line = bytestream2_get_be16(&s->
g);
426 height = bytestream2_get_be16(&s->
g);
static void qtrle_decode_2n4bpp(QtrleContext *s, int row_ptr, int lines_to_change, int bpp)
This structure describes decoded (raw) audio or video data.
int buffer_hints
codec suggestion on buffer type if != 0
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
packed RGB 8:8:8, 24bpp, RGBRGB...
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)
int(* reget_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of a frame to get cr buffer for it.
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)
8 bit with PIX_FMT_RGB32 palette
#define AV_PIX_FMT_RGB555
static av_cold int qtrle_decode_init(AVCodecContext *avctx)
static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
struct QtrleContext QtrleContext
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int init(AVCodecParserContext *s)
#define FF_BUFFER_HINTS_READABLE
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
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. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static void qtrle_decode_8bpp(QtrleContext *s, int row_ptr, int lines_to_change)
#define CHECK_PIXEL_PTR(n)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
int palette_has_changed
Tell user application that palette has changed from previous frame.
#define FF_BUFFER_HINTS_REUSABLE
static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change)
#define FF_BUFFER_HINTS_PRESERVE
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
#define AVERROR_INVALIDDATA
static int qtrle_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
#define FF_BUFFER_HINTS_VALID
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
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.