Go to the documentation of this file.
49 #define CHECK_PIXEL_PTR(n) \
50 if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \
51 av_log (s->avctx, AV_LOG_ERROR, "Problem: pixel_ptr = %d, pixel_limit = %d\n",\
52 pixel_ptr + n, pixel_limit); \
60 int row_inc =
s->frame->linesize[0];
62 uint8_t *
rgb =
s->frame->data[0];
63 int pixel_limit =
s->frame->linesize[0] *
s->avctx->height;
77 while (lines_to_change) {
78 skip = bytestream2_get_byte(&
s->g);
79 rle_code = (int8_t)bytestream2_get_byte(&
s->g);
85 pixel_ptr = row_ptr + 2 * 8 * (
skip & 0x7f);
87 pixel_ptr += 2 * 8 *
skip;
99 pi0 = bytestream2_get_byte(&
s->g);
100 pi1 = bytestream2_get_byte(&
s->g);
104 rgb[pixel_ptr++] = (pi0 >> 7) & 0x01;
105 rgb[pixel_ptr++] = (pi0 >> 6) & 0x01;
106 rgb[pixel_ptr++] = (pi0 >> 5) & 0x01;
107 rgb[pixel_ptr++] = (pi0 >> 4) & 0x01;
108 rgb[pixel_ptr++] = (pi0 >> 3) & 0x01;
109 rgb[pixel_ptr++] = (pi0 >> 2) & 0x01;
110 rgb[pixel_ptr++] = (pi0 >> 1) & 0x01;
111 rgb[pixel_ptr++] = pi0 & 0x01;
112 rgb[pixel_ptr++] = (pi1 >> 7) & 0x01;
113 rgb[pixel_ptr++] = (pi1 >> 6) & 0x01;
114 rgb[pixel_ptr++] = (pi1 >> 5) & 0x01;
115 rgb[pixel_ptr++] = (pi1 >> 4) & 0x01;
116 rgb[pixel_ptr++] = (pi1 >> 3) & 0x01;
117 rgb[pixel_ptr++] = (pi1 >> 2) & 0x01;
118 rgb[pixel_ptr++] = (pi1 >> 1) & 0x01;
119 rgb[pixel_ptr++] = pi1 & 0x01;
127 int x = bytestream2_get_byte(&
s->g);
128 rgb[pixel_ptr++] = (x >> 7) & 0x01;
129 rgb[pixel_ptr++] = (x >> 6) & 0x01;
130 rgb[pixel_ptr++] = (x >> 5) & 0x01;
131 rgb[pixel_ptr++] = (x >> 4) & 0x01;
132 rgb[pixel_ptr++] = (x >> 3) & 0x01;
133 rgb[pixel_ptr++] = (x >> 2) & 0x01;
134 rgb[pixel_ptr++] = (x >> 1) & 0x01;
135 rgb[pixel_ptr++] = x & 0x01;
142 int lines_to_change,
int bpp)
146 int row_inc =
s->frame->linesize[0];
148 uint8_t *
rgb =
s->frame->data[0];
149 int pixel_limit =
s->frame->linesize[0] *
s->avctx->height;
150 int num_pixels = (bpp == 4) ? 8 : 16;
152 while (lines_to_change--) {
153 pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&
s->g) - 1));
156 while ((rle_code = (int8_t)bytestream2_get_byte(&
s->g)) != -1) {
161 pixel_ptr += (num_pixels * (bytestream2_get_byte(&
s->g) - 1));
163 }
else if (rle_code < 0) {
165 rle_code = -rle_code;
168 for (
i = num_pixels-1;
i >= 0;
i--) {
169 pi[num_pixels-1-
i] = (bytestream2_peek_byte(&
s->g) >> ((
i*bpp) & 0x07)) & ((1<<bpp)-1);
174 memcpy(&
rgb[pixel_ptr], &pi, num_pixels);
175 pixel_ptr += num_pixels;
183 int x = bytestream2_get_byte(&
s->g);
184 rgb[pixel_ptr++] = (x >> 4) & 0x0f;
185 rgb[pixel_ptr++] = x & 0x0f;
187 int x = bytestream2_get_byte(&
s->g);
188 rgb[pixel_ptr++] = (x >> 6) & 0x03;
189 rgb[pixel_ptr++] = (x >> 4) & 0x03;
190 rgb[pixel_ptr++] = (x >> 2) & 0x03;
191 rgb[pixel_ptr++] = x & 0x03;
204 int row_inc =
s->frame->linesize[0];
205 uint8_t pi1, pi2, pi3, pi4;
206 uint8_t *
rgb =
s->frame->data[0];
207 int pixel_limit =
s->frame->linesize[0] *
s->avctx->height;
209 while (lines_to_change--) {
210 pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&
s->g) - 1));
213 while ((rle_code = (int8_t)bytestream2_get_byte(&
s->g)) != -1) {
218 pixel_ptr += (4 * (bytestream2_get_byte(&
s->g) - 1));
220 }
else if (rle_code < 0) {
222 rle_code = -rle_code;
225 pi1 = bytestream2_get_byte(&
s->g);
226 pi2 = bytestream2_get_byte(&
s->g);
227 pi3 = bytestream2_get_byte(&
s->g);
228 pi4 = bytestream2_get_byte(&
s->g);
233 rgb[pixel_ptr++] = pi1;
234 rgb[pixel_ptr++] = pi2;
235 rgb[pixel_ptr++] = pi3;
236 rgb[pixel_ptr++] = pi4;
244 pixel_ptr += rle_code;
255 int row_inc =
s->frame->linesize[0];
257 uint8_t *
rgb =
s->frame->data[0];
258 int pixel_limit =
s->frame->linesize[0] *
s->avctx->height;
260 while (lines_to_change--) {
261 pixel_ptr = row_ptr + (bytestream2_get_byte(&
s->g) - 1) * 2;
264 while ((rle_code = (int8_t)bytestream2_get_byte(&
s->g)) != -1) {
269 pixel_ptr += (bytestream2_get_byte(&
s->g) - 1) * 2;
271 }
else if (rle_code < 0) {
273 rle_code = -rle_code;
274 rgb16 = bytestream2_get_be16(&
s->g);
279 *(uint16_t *)(&
rgb[pixel_ptr]) = rgb16;
287 rgb16 = bytestream2_get_be16(&
s->g);
288 *(uint16_t *)(&
rgb[pixel_ptr]) = rgb16;
299 int rle_code, rle_code_half;
301 int row_inc =
s->frame->linesize[0];
304 uint8_t *
rgb =
s->frame->data[0];
305 int pixel_limit =
s->frame->linesize[0] *
s->avctx->height;
307 while (lines_to_change--) {
308 pixel_ptr = row_ptr + (bytestream2_get_byte(&
s->g) - 1) * 3;
311 while ((rle_code = (int8_t)bytestream2_get_byte(&
s->g)) != -1) {
316 pixel_ptr += (bytestream2_get_byte(&
s->g) - 1) * 3;
318 }
else if (rle_code < 0) {
320 rle_code = -rle_code;
322 b = bytestream2_get_byte(&
s->g);
328 rgb[pixel_ptr + 2] =
b;
334 rle_code_half = rle_code / 2;
336 while (rle_code_half--) {
342 if (rle_code % 2 != 0){
344 rgb[pixel_ptr + 2] = bytestream2_get_byte(&
s->g);
355 int rle_code, rle_code_half;
357 int row_inc =
s->frame->linesize[0];
359 uint8_t *
rgb =
s->frame->data[0];
360 int pixel_limit =
s->frame->linesize[0] *
s->avctx->height;
362 while (lines_to_change--) {
363 pixel_ptr = row_ptr + (bytestream2_get_byte(&
s->g) - 1) * 4;
366 while ((rle_code = (int8_t)bytestream2_get_byte(&
s->g)) != -1) {
371 pixel_ptr += (bytestream2_get_byte(&
s->g) - 1) * 4;
373 }
else if (rle_code < 0) {
375 rle_code = -rle_code;
388 rle_code_half = rle_code / 2;
389 while (rle_code_half--) {
394 if (rle_code % 2 != 0){
459 if (avpkt->
size < 8) {
465 size = bytestream2_get_be32(&
s->g) & 0x3FFFFFFF;
471 header = bytestream2_get_be16(&
s->g);
475 if (avpkt->
size < 14) {
479 start_line = bytestream2_get_be16(&
s->g);
481 height = bytestream2_get_be16(&
s->g);
483 if (
height >
s->avctx->height - start_line) {
494 row_ptr =
s->frame->linesize[0] * start_line;
540 #if FF_API_PALETTE_HAS_CHANGED
542 s->frame->palette_has_changed =
545 #if FF_API_PALETTE_HAS_CHANGED
554 if (!
s->frame->data[0])
static void qtrle_decode_8bpp(QtrleContext *s, int row_ptr, int lines_to_change)
#define FF_ENABLE_DEPRECATION_WARNINGS
#define CHECK_PIXEL_PTR(n)
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
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change)
static int qtrle_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
#define bytestream2_get_ne64
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
AVCodec p
The public AVCodec.
static void qtrle_decode_16bpp(QtrleContext *s, int row_ptr, int lines_to_change)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_CODEC_DECODE_CB(func)
int(* init)(AVBSFContext *ctx)
static av_cold int qtrle_decode_init(AVCodecContext *avctx)
#define CODEC_LONG_NAME(str)
#define bytestream2_get_ne32
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
#define bytestream2_get_ne16
static const uint8_t header[24]
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define i(width, name, range_min, range_max)
#define AV_PIX_FMT_RGB555
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
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.
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
Set various frame properties from the codec context / packet data.
main external API structure.
const FFCodec ff_qtrle_decoder
static void qtrle_decode_flush(AVCodecContext *avctx)
int discard_damaged_percentage
The percentage of damaged samples to discard a frame.
static void qtrle_decode_2n4bpp(QtrleContext *s, int row_ptr, int lines_to_change, int bpp)
#define FF_DISABLE_DEPRECATION_WARNINGS
static av_cold int qtrle_decode_end(AVCodecContext *avctx)
This structure stores compressed data.
static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change)
static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
Check whether the side-data of src contains a palette of size AVPALETTE_SIZE; if so,...
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.