FFmpeg  2.8.17
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
qtrle.c
Go to the documentation of this file.
1 /*
2  * Quicktime Animation (RLE) Video Decoder
3  * Copyright (c) 2004 The FFmpeg Project
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * QT RLE Video Decoder by Mike Melanson (melanson@pcisys.net)
25  * For more information about the QT RLE format, visit:
26  * http://www.pcisys.net/~melanson/codecs/
27  *
28  * The QT RLE decoder has seven modes of operation:
29  * 1, 2, 4, 8, 16, 24, and 32 bits per pixel. For modes 1, 2, 4, and 8
30  * the decoder outputs PAL8 colorspace data. 16-bit data yields RGB555
31  * data. 24-bit data is RGB24 and 32-bit data is RGB32.
32  */
33 
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <string.h>
37 
38 #include "avcodec.h"
39 #include "bytestream.h"
40 #include "internal.h"
41 
42 typedef struct QtrleContext {
45 
47  uint32_t pal[256];
48 } QtrleContext;
49 
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); \
54  return; \
55  } \
56 
57 static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
58 {
59  int rle_code;
60  int pixel_ptr;
61  int row_inc = s->frame->linesize[0];
62  uint8_t pi0, pi1; /* 2 8-pixel values */
63  uint8_t *rgb = s->frame->data[0];
64  int pixel_limit = s->frame->linesize[0] * s->avctx->height;
65  int skip;
66  /* skip & 0x80 appears to mean 'start a new line', which can be interpreted
67  * as 'go to next line' during the decoding of a frame but is 'go to first
68  * line' at the beginning. Since we always interpret it as 'go to next line'
69  * in the decoding loop (which makes code simpler/faster), the first line
70  * would not be counted, so we count one more.
71  * See: https://trac.ffmpeg.org/ticket/226
72  * In the following decoding loop, row_ptr will be the position of the
73  * current row. */
74 
75  row_ptr -= row_inc;
76  pixel_ptr = row_ptr;
77  lines_to_change++;
78  while (lines_to_change) {
79  skip = bytestream2_get_byte(&s->g);
80  rle_code = (int8_t)bytestream2_get_byte(&s->g);
81  if (rle_code == 0)
82  break;
83  if(skip & 0x80) {
84  lines_to_change--;
85  row_ptr += row_inc;
86  pixel_ptr = row_ptr + 2 * (skip & 0x7f);
87  } else
88  pixel_ptr += 2 * skip;
89  CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
90 
91  if(rle_code == -1)
92  continue;
93 
94  if (rle_code < 0) {
95  /* decode the run length code */
96  rle_code = -rle_code;
97  /* get the next 2 bytes from the stream, treat them as groups
98  * of 8 pixels, and output them rle_code times */
99 
100  pi0 = bytestream2_get_byte(&s->g);
101  pi1 = bytestream2_get_byte(&s->g);
102  CHECK_PIXEL_PTR(rle_code * 2);
103 
104  while (rle_code--) {
105  rgb[pixel_ptr++] = pi0;
106  rgb[pixel_ptr++] = pi1;
107  }
108  } else {
109  /* copy the same pixel directly to output 2 times */
110  rle_code *= 2;
111  CHECK_PIXEL_PTR(rle_code);
112 
113  bytestream2_get_buffer(&s->g, &rgb[pixel_ptr], rle_code);
114  pixel_ptr += rle_code;
115  }
116  }
117 }
118 
119 static inline void qtrle_decode_2n4bpp(QtrleContext *s, int row_ptr,
120  int lines_to_change, int bpp)
121 {
122  int rle_code, i;
123  int pixel_ptr;
124  int row_inc = s->frame->linesize[0];
125  uint8_t pi[16]; /* 16 palette indices */
126  uint8_t *rgb = s->frame->data[0];
127  int pixel_limit = s->frame->linesize[0] * s->avctx->height;
128  int num_pixels = (bpp == 4) ? 8 : 16;
129 
130  while (lines_to_change--) {
131  pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->g) - 1));
132  CHECK_PIXEL_PTR(0);
133 
134  while ((rle_code = (int8_t)bytestream2_get_byte(&s->g)) != -1) {
135  if (bytestream2_get_bytes_left(&s->g) < 1)
136  return;
137  if (rle_code == 0) {
138  /* there's another skip code in the stream */
139  pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->g) - 1));
140  CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
141  } else if (rle_code < 0) {
142  /* decode the run length code */
143  rle_code = -rle_code;
144  /* get the next 4 bytes from the stream, treat them as palette
145  * indexes, and output them rle_code times */
146  for (i = num_pixels-1; i >= 0; i--) {
147  pi[num_pixels-1-i] = (bytestream2_peek_byte(&s->g) >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
148  bytestream2_skip(&s->g, ((i & ((num_pixels>>2)-1)) == 0));
149  }
150  CHECK_PIXEL_PTR(rle_code * num_pixels);
151  while (rle_code--) {
152  memcpy(&rgb[pixel_ptr], &pi, num_pixels);
153  pixel_ptr += num_pixels;
154  }
155  } else {
156  /* copy the same pixel directly to output 4 times */
157  rle_code *= 4;
158  CHECK_PIXEL_PTR(rle_code*(num_pixels>>2));
159  while (rle_code--) {
160  if(bpp == 4) {
161  int x = bytestream2_get_byte(&s->g);
162  rgb[pixel_ptr++] = (x >> 4) & 0x0f;
163  rgb[pixel_ptr++] = x & 0x0f;
164  } else {
165  int x = bytestream2_get_byte(&s->g);
166  rgb[pixel_ptr++] = (x >> 6) & 0x03;
167  rgb[pixel_ptr++] = (x >> 4) & 0x03;
168  rgb[pixel_ptr++] = (x >> 2) & 0x03;
169  rgb[pixel_ptr++] = x & 0x03;
170  }
171  }
172  }
173  }
174  row_ptr += row_inc;
175  }
176 }
177 
178 static void qtrle_decode_8bpp(QtrleContext *s, int row_ptr, int lines_to_change)
179 {
180  int rle_code;
181  int pixel_ptr;
182  int row_inc = s->frame->linesize[0];
183  uint8_t pi1, pi2, pi3, pi4; /* 4 palette indexes */
184  uint8_t *rgb = s->frame->data[0];
185  int pixel_limit = s->frame->linesize[0] * s->avctx->height;
186 
187  while (lines_to_change--) {
188  pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&s->g) - 1));
189  CHECK_PIXEL_PTR(0);
190 
191  while ((rle_code = (int8_t)bytestream2_get_byte(&s->g)) != -1) {
192  if (bytestream2_get_bytes_left(&s->g) < 1)
193  return;
194  if (rle_code == 0) {
195  /* there's another skip code in the stream */
196  pixel_ptr += (4 * (bytestream2_get_byte(&s->g) - 1));
197  CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
198  } else if (rle_code < 0) {
199  /* decode the run length code */
200  rle_code = -rle_code;
201  /* get the next 4 bytes from the stream, treat them as palette
202  * indexes, and output them rle_code times */
203  pi1 = bytestream2_get_byte(&s->g);
204  pi2 = bytestream2_get_byte(&s->g);
205  pi3 = bytestream2_get_byte(&s->g);
206  pi4 = bytestream2_get_byte(&s->g);
207 
208  CHECK_PIXEL_PTR(rle_code * 4);
209 
210  while (rle_code--) {
211  rgb[pixel_ptr++] = pi1;
212  rgb[pixel_ptr++] = pi2;
213  rgb[pixel_ptr++] = pi3;
214  rgb[pixel_ptr++] = pi4;
215  }
216  } else {
217  /* copy the same pixel directly to output 4 times */
218  rle_code *= 4;
219  CHECK_PIXEL_PTR(rle_code);
220 
221  bytestream2_get_buffer(&s->g, &rgb[pixel_ptr], rle_code);
222  pixel_ptr += rle_code;
223  }
224  }
225  row_ptr += row_inc;
226  }
227 }
228 
229 static void qtrle_decode_16bpp(QtrleContext *s, int row_ptr, int lines_to_change)
230 {
231  int rle_code;
232  int pixel_ptr;
233  int row_inc = s->frame->linesize[0];
234  uint16_t rgb16;
235  uint8_t *rgb = s->frame->data[0];
236  int pixel_limit = s->frame->linesize[0] * s->avctx->height;
237 
238  while (lines_to_change--) {
239  pixel_ptr = row_ptr + (bytestream2_get_byte(&s->g) - 1) * 2;
240  CHECK_PIXEL_PTR(0);
241 
242  while ((rle_code = (int8_t)bytestream2_get_byte(&s->g)) != -1) {
243  if (bytestream2_get_bytes_left(&s->g) < 1)
244  return;
245  if (rle_code == 0) {
246  /* there's another skip code in the stream */
247  pixel_ptr += (bytestream2_get_byte(&s->g) - 1) * 2;
248  CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
249  } else if (rle_code < 0) {
250  /* decode the run length code */
251  rle_code = -rle_code;
252  rgb16 = bytestream2_get_be16(&s->g);
253 
254  CHECK_PIXEL_PTR(rle_code * 2);
255 
256  while (rle_code--) {
257  *(uint16_t *)(&rgb[pixel_ptr]) = rgb16;
258  pixel_ptr += 2;
259  }
260  } else {
261  CHECK_PIXEL_PTR(rle_code * 2);
262 
263  /* copy pixels directly to output */
264  while (rle_code--) {
265  rgb16 = bytestream2_get_be16(&s->g);
266  *(uint16_t *)(&rgb[pixel_ptr]) = rgb16;
267  pixel_ptr += 2;
268  }
269  }
270  }
271  row_ptr += row_inc;
272  }
273 }
274 
275 static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change)
276 {
277  int rle_code;
278  int pixel_ptr;
279  int row_inc = s->frame->linesize[0];
280  uint8_t r, g, b;
281  uint8_t *rgb = s->frame->data[0];
282  int pixel_limit = s->frame->linesize[0] * s->avctx->height;
283 
284  while (lines_to_change--) {
285  pixel_ptr = row_ptr + (bytestream2_get_byte(&s->g) - 1) * 3;
286  CHECK_PIXEL_PTR(0);
287 
288  while ((rle_code = (int8_t)bytestream2_get_byte(&s->g)) != -1) {
289  if (bytestream2_get_bytes_left(&s->g) < 1)
290  return;
291  if (rle_code == 0) {
292  /* there's another skip code in the stream */
293  pixel_ptr += (bytestream2_get_byte(&s->g) - 1) * 3;
294  CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
295  } else if (rle_code < 0) {
296  /* decode the run length code */
297  rle_code = -rle_code;
298  r = bytestream2_get_byte(&s->g);
299  g = bytestream2_get_byte(&s->g);
300  b = bytestream2_get_byte(&s->g);
301 
302  CHECK_PIXEL_PTR(rle_code * 3);
303 
304  while (rle_code--) {
305  rgb[pixel_ptr++] = r;
306  rgb[pixel_ptr++] = g;
307  rgb[pixel_ptr++] = b;
308  }
309  } else {
310  CHECK_PIXEL_PTR(rle_code * 3);
311 
312  /* copy pixels directly to output */
313  while (rle_code--) {
314  rgb[pixel_ptr++] = bytestream2_get_byte(&s->g);
315  rgb[pixel_ptr++] = bytestream2_get_byte(&s->g);
316  rgb[pixel_ptr++] = bytestream2_get_byte(&s->g);
317  }
318  }
319  }
320  row_ptr += row_inc;
321  }
322 }
323 
324 static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change)
325 {
326  int rle_code;
327  int pixel_ptr;
328  int row_inc = s->frame->linesize[0];
329  unsigned int argb;
330  uint8_t *rgb = s->frame->data[0];
331  int pixel_limit = s->frame->linesize[0] * s->avctx->height;
332 
333  while (lines_to_change--) {
334  pixel_ptr = row_ptr + (bytestream2_get_byte(&s->g) - 1) * 4;
335  CHECK_PIXEL_PTR(0);
336 
337  while ((rle_code = (int8_t)bytestream2_get_byte(&s->g)) != -1) {
338  if (bytestream2_get_bytes_left(&s->g) < 1)
339  return;
340  if (rle_code == 0) {
341  /* there's another skip code in the stream */
342  pixel_ptr += (bytestream2_get_byte(&s->g) - 1) * 4;
343  CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
344  } else if (rle_code < 0) {
345  /* decode the run length code */
346  rle_code = -rle_code;
347  argb = bytestream2_get_be32(&s->g);
348 
349  CHECK_PIXEL_PTR(rle_code * 4);
350 
351  while (rle_code--) {
352  AV_WN32A(rgb + pixel_ptr, argb);
353  pixel_ptr += 4;
354  }
355  } else {
356  CHECK_PIXEL_PTR(rle_code * 4);
357 
358  /* copy pixels directly to output */
359  while (rle_code--) {
360  argb = bytestream2_get_be32(&s->g);
361  AV_WN32A(rgb + pixel_ptr, argb);
362  pixel_ptr += 4;
363  }
364  }
365  }
366  row_ptr += row_inc;
367  }
368 }
369 
371 {
372  QtrleContext *s = avctx->priv_data;
373 
374  s->avctx = avctx;
375  switch (avctx->bits_per_coded_sample) {
376  case 1:
377  case 33:
378  avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
379  break;
380 
381  case 2:
382  case 4:
383  case 8:
384  case 34:
385  case 36:
386  case 40:
387  avctx->pix_fmt = AV_PIX_FMT_PAL8;
388  break;
389 
390  case 16:
391  avctx->pix_fmt = AV_PIX_FMT_RGB555;
392  break;
393 
394  case 24:
395  avctx->pix_fmt = AV_PIX_FMT_RGB24;
396  break;
397 
398  case 32:
399  avctx->pix_fmt = AV_PIX_FMT_RGB32;
400  break;
401 
402  default:
403  av_log (avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
404  avctx->bits_per_coded_sample);
405  return AVERROR_INVALIDDATA;
406  }
407 
408  s->frame = av_frame_alloc();
409  if (!s->frame)
410  return AVERROR(ENOMEM);
411 
412  return 0;
413 }
414 
416  void *data, int *got_frame,
417  AVPacket *avpkt)
418 {
419  QtrleContext *s = avctx->priv_data;
420  int header, start_line;
421  int height, row_ptr;
422  int has_palette = 0;
423  int ret;
424 
425  bytestream2_init(&s->g, avpkt->data, avpkt->size);
426  if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
427  return ret;
428 
429  /* check if this frame is even supposed to change */
430  if (avpkt->size < 8)
431  goto done;
432 
433  /* start after the chunk size */
434  bytestream2_seek(&s->g, 4, SEEK_SET);
435 
436  /* fetch the header */
437  header = bytestream2_get_be16(&s->g);
438 
439  /* if a header is present, fetch additional decoding parameters */
440  if (header & 0x0008) {
441  if (avpkt->size < 14)
442  goto done;
443  start_line = bytestream2_get_be16(&s->g);
444  bytestream2_skip(&s->g, 2);
445  height = bytestream2_get_be16(&s->g);
446  bytestream2_skip(&s->g, 2);
447  if (height > s->avctx->height - start_line)
448  goto done;
449  } else {
450  start_line = 0;
451  height = s->avctx->height;
452  }
453  row_ptr = s->frame->linesize[0] * start_line;
454 
455  switch (avctx->bits_per_coded_sample) {
456  case 1:
457  case 33:
458  qtrle_decode_1bpp(s, row_ptr, height);
459  break;
460 
461  case 2:
462  case 34:
463  qtrle_decode_2n4bpp(s, row_ptr, height, 2);
464  has_palette = 1;
465  break;
466 
467  case 4:
468  case 36:
469  qtrle_decode_2n4bpp(s, row_ptr, height, 4);
470  has_palette = 1;
471  break;
472 
473  case 8:
474  case 40:
475  qtrle_decode_8bpp(s, row_ptr, height);
476  has_palette = 1;
477  break;
478 
479  case 16:
480  qtrle_decode_16bpp(s, row_ptr, height);
481  break;
482 
483  case 24:
484  qtrle_decode_24bpp(s, row_ptr, height);
485  break;
486 
487  case 32:
488  qtrle_decode_32bpp(s, row_ptr, height);
489  break;
490 
491  default:
492  av_log (s->avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
493  avctx->bits_per_coded_sample);
494  break;
495  }
496 
497  if(has_palette) {
498  int size;
499  const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
500 
501  if (pal && size == AVPALETTE_SIZE) {
502  s->frame->palette_has_changed = 1;
503  memcpy(s->pal, pal, AVPALETTE_SIZE);
504  } else if (pal) {
505  av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
506  }
507 
508  /* make the palette available on the way out */
509  memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
510  }
511 
512 done:
513  if ((ret = av_frame_ref(data, s->frame)) < 0)
514  return ret;
515  *got_frame = 1;
516 
517  /* always report that the buffer was completely consumed */
518  return avpkt->size;
519 }
520 
522 {
523  QtrleContext *s = avctx->priv_data;
524 
525  av_frame_free(&s->frame);
526 
527  return 0;
528 }
529 
531  .name = "qtrle",
532  .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"),
533  .type = AVMEDIA_TYPE_VIDEO,
534  .id = AV_CODEC_ID_QTRLE,
535  .priv_data_size = sizeof(QtrleContext),
537  .close = qtrle_decode_end,
539  .capabilities = AV_CODEC_CAP_DR1,
540 };
static void qtrle_decode_2n4bpp(QtrleContext *s, int row_ptr, int lines_to_change, int bpp)
Definition: qtrle.c:119
const char * s
Definition: avisynth_c.h:631
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
This structure describes decoded (raw) audio or video data.
Definition: frame.h:171
GetByteContext g
Definition: qtrle.c:46
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:69
const char * g
Definition: vf_curves.c:108
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
AVFrame * frame
Definition: qtrle.c:44
int size
Definition: avcodec.h:1434
const char * b
Definition: vf_curves.c:109
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1732
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:133
AVCodec.
Definition: avcodec.h:3482
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
uint8_t
#define av_cold
Definition: attributes.h:74
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:135
static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change)
Definition: qtrle.c:275
8 bit with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:78
#define AVPALETTE_SIZE
Definition: pixfmt.h:33
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition: frame.c:366
AVCodecContext * avctx
Definition: qtrle.c:43
uint8_t * data
Definition: avcodec.h:1433
static av_cold int qtrle_decode_init(AVCodecContext *avctx)
Definition: qtrle.c:370
static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
Definition: qtrle.c:57
ptrdiff_t size
Definition: opengl_enc.c:101
static const uint8_t header[24]
Definition: sdr2.c:67
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:3006
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define AVERROR(e)
Definition: error.h:43
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
Definition: bytestream.h:164
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:148
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:178
const char * r
Definition: vf_curves.c:107
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
Definition: bytestream.h:263
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:154
const char * name
Name of the codec implementation.
Definition: avcodec.h:3489
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...
Definition: utils.c:1097
static void qtrle_decode_8bpp(QtrleContext *s, int row_ptr, int lines_to_change)
Definition: qtrle.c:178
uint32_t pal[256]
Definition: qtrle.c:47
#define CHECK_PIXEL_PTR(n)
Definition: qtrle.c:50
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:199
main external API structure.
Definition: avcodec.h:1512
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:361
BYTE int const BYTE int int int height
Definition: avisynth_c.h:676
int palette_has_changed
Tell user application that palette has changed from previous frame.
Definition: frame.h:377
static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change)
Definition: qtrle.c:324
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:182
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:521
common internal api header.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
Definition: pixfmt.h:76
static int qtrle_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: qtrle.c:415
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:372
void * priv_data
Definition: avcodec.h:1554
AVCodec ff_qtrle_decoder
Definition: qtrle.c:530
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
Definition: bytestream.h:208
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
Definition: avpacket.c:329
static void qtrle_decode_16bpp(QtrleContext *s, int row_ptr, int lines_to_change)
Definition: qtrle.c:229
static av_cold int qtrle_decode_end(AVCodecContext *avctx)
Definition: qtrle.c:521
This structure stores compressed data.
Definition: avcodec.h:1410
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:857