51 #define CHECK_PIXEL_PTR(n) \ 52 if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \ 53 av_log (s->avctx, AV_LOG_ERROR, "Problem: pixel_ptr = %d, pixel_limit = %d\n",\ 54 pixel_ptr + n, pixel_limit); \ 79 while (lines_to_change) {
80 skip = bytestream2_get_byte(&s->
g);
81 rle_code = (int8_t)bytestream2_get_byte(&s->
g);
87 pixel_ptr = row_ptr + 2 * 8 * (skip & 0x7f);
89 pixel_ptr += 2 * 8 * skip;
101 pi0 = bytestream2_get_byte(&s->
g);
102 pi1 = bytestream2_get_byte(&s->
g);
106 rgb[pixel_ptr++] = (pi0 >> 7) & 0x01;
107 rgb[pixel_ptr++] = (pi0 >> 6) & 0x01;
108 rgb[pixel_ptr++] = (pi0 >> 5) & 0x01;
109 rgb[pixel_ptr++] = (pi0 >> 4) & 0x01;
110 rgb[pixel_ptr++] = (pi0 >> 3) & 0x01;
111 rgb[pixel_ptr++] = (pi0 >> 2) & 0x01;
112 rgb[pixel_ptr++] = (pi0 >> 1) & 0x01;
113 rgb[pixel_ptr++] = pi0 & 0x01;
114 rgb[pixel_ptr++] = (pi1 >> 7) & 0x01;
115 rgb[pixel_ptr++] = (pi1 >> 6) & 0x01;
116 rgb[pixel_ptr++] = (pi1 >> 5) & 0x01;
117 rgb[pixel_ptr++] = (pi1 >> 4) & 0x01;
118 rgb[pixel_ptr++] = (pi1 >> 3) & 0x01;
119 rgb[pixel_ptr++] = (pi1 >> 2) & 0x01;
120 rgb[pixel_ptr++] = (pi1 >> 1) & 0x01;
121 rgb[pixel_ptr++] = pi1 & 0x01;
129 int x = bytestream2_get_byte(&s->
g);
130 rgb[pixel_ptr++] = (x >> 7) & 0x01;
131 rgb[pixel_ptr++] = (x >> 6) & 0x01;
132 rgb[pixel_ptr++] = (x >> 5) & 0x01;
133 rgb[pixel_ptr++] = (x >> 4) & 0x01;
134 rgb[pixel_ptr++] = (x >> 3) & 0x01;
135 rgb[pixel_ptr++] = (x >> 2) & 0x01;
136 rgb[pixel_ptr++] = (x >> 1) & 0x01;
137 rgb[pixel_ptr++] = x & 0x01;
144 int lines_to_change,
int bpp)
152 int num_pixels = (bpp == 4) ? 8 : 16;
154 while (lines_to_change--) {
155 pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
158 while ((rle_code = (int8_t)bytestream2_get_byte(&s->
g)) != -1) {
163 pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
165 }
else if (rle_code < 0) {
167 rle_code = -rle_code;
170 for (i = num_pixels-1; i >= 0; i--) {
171 pi[num_pixels-1-
i] = (bytestream2_peek_byte(&s->
g) >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
176 memcpy(&rgb[pixel_ptr], &pi, num_pixels);
177 pixel_ptr += num_pixels;
185 int x = bytestream2_get_byte(&s->
g);
186 rgb[pixel_ptr++] = (x >> 4) & 0x0f;
187 rgb[pixel_ptr++] = x & 0x0f;
189 int x = bytestream2_get_byte(&s->
g);
190 rgb[pixel_ptr++] = (x >> 6) & 0x03;
191 rgb[pixel_ptr++] = (x >> 4) & 0x03;
192 rgb[pixel_ptr++] = (x >> 2) & 0x03;
193 rgb[pixel_ptr++] = x & 0x03;
211 while (lines_to_change--) {
212 pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&s->
g) - 1));
215 while ((rle_code = (int8_t)bytestream2_get_byte(&s->
g)) != -1) {
220 pixel_ptr += (4 * (bytestream2_get_byte(&s->
g) - 1));
222 }
else if (rle_code < 0) {
224 rle_code = -rle_code;
227 pi1 = bytestream2_get_byte(&s->
g);
228 pi2 = bytestream2_get_byte(&s->
g);
229 pi3 = bytestream2_get_byte(&s->
g);
230 pi4 = bytestream2_get_byte(&s->
g);
235 rgb[pixel_ptr++] = pi1;
236 rgb[pixel_ptr++] = pi2;
237 rgb[pixel_ptr++] = pi3;
238 rgb[pixel_ptr++] = pi4;
246 pixel_ptr += rle_code;
262 while (lines_to_change--) {
263 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 2;
266 while ((rle_code = (int8_t)bytestream2_get_byte(&s->
g)) != -1) {
271 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 2;
273 }
else if (rle_code < 0) {
275 rle_code = -rle_code;
276 rgb16 = bytestream2_get_be16(&s->
g);
281 *(uint16_t *)(&rgb[pixel_ptr]) = rgb16;
289 rgb16 = bytestream2_get_be16(&s->
g);
290 *(uint16_t *)(&rgb[pixel_ptr]) = rgb16;
301 int rle_code, rle_code_half;
309 while (lines_to_change--) {
310 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 3;
313 while ((rle_code = (int8_t)bytestream2_get_byte(&s->
g)) != -1) {
318 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 3;
320 }
else if (rle_code < 0) {
322 rle_code = -rle_code;
324 b = bytestream2_get_byte(&s->
g);
330 rgb[pixel_ptr + 2] =
b;
336 rle_code_half = rle_code / 2;
338 while (rle_code_half--) {
344 if (rle_code % 2 != 0){
346 rgb[pixel_ptr + 2] = bytestream2_get_byte(&s->
g);
357 int rle_code, rle_code_half;
364 while (lines_to_change--) {
365 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 4;
368 while ((rle_code = (int8_t)bytestream2_get_byte(&s->
g)) != -1) {
373 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 4;
375 }
else if (rle_code < 0) {
377 rle_code = -rle_code;
390 rle_code_half = rle_code / 2;
391 while (rle_code_half--) {
396 if (rle_code % 2 != 0){
449 void *
data,
int *got_frame,
462 if (avpkt->
size < 8) {
468 size = bytestream2_get_be32(&s->
g) & 0x3FFFFFFF;
474 header = bytestream2_get_be16(&s->
g);
477 if (header & 0x0008) {
478 if (avpkt->
size < 14) {
482 start_line = bytestream2_get_be16(&s->
g);
484 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.
ptrdiff_t const GLvoid * data
static void flush(AVCodecContext *avctx)
packed RGB 8:8:8, 24bpp, RGBRGB...
static av_cold int init(AVCodecContext *avctx)
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)
static void qtrle_decode_flush(AVCodecContext *avctx)
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
Set various frame properties from the codec context / packet data.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define bytestream2_get_ne32
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change)
8 bits with AV_PIX_FMT_RGB32 palette
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static av_cold int qtrle_decode_init(AVCodecContext *avctx)
static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
static const uint8_t header[24]
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette...
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define bytestream2_get_ne16
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available...
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
const char * name
Name of the codec implementation.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
#define bytestream2_get_ne64
static void qtrle_decode_8bpp(QtrleContext *s, int row_ptr, int lines_to_change)
#define CHECK_PIXEL_PTR(n)
int discard_damaged_percentage
The percentage of damaged samples to discard a frame.
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int palette_has_changed
Tell user application that palette has changed from previous frame.
static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change)
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
static int qtrle_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_PIX_FMT_RGB555
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
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.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.