FFmpeg
qtrleenc.c
Go to the documentation of this file.
1 /*
2  * Quicktime Animation (RLE) Video Encoder
3  * Copyright (C) 2007 Clemens Fruhwirth
4  * Copyright (C) 2007 Alexis Ballier
5  *
6  * This file is based on flashsvenc.c.
7  *
8  * This file is part of FFmpeg.
9  *
10  * FFmpeg is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * FFmpeg is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with FFmpeg; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 #include "libavutil/imgutils.h"
26 #include "libavutil/mem.h"
27 #include "avcodec.h"
28 #include "bytestream.h"
29 #include "codec_internal.h"
30 #include "encode.h"
31 
32 /** Maximum RLE code for bulk copy */
33 #define MAX_RLE_BULK 127
34 /** Maximum RLE code for repeat */
35 #define MAX_RLE_REPEAT 128
36 /** Maximum RLE code for skip */
37 #define MAX_RLE_SKIP 254
38 
39 typedef struct QtrleEncContext {
43  unsigned int max_buf_size;
45  /**
46  * This array will contain at ith position the value of the best RLE code
47  * if the line started at pixel i
48  * There can be 3 values :
49  * skip (0) : skip as much as possible pixels because they are equal to the
50  * previous frame ones
51  * repeat (<-1) : repeat that pixel -rle_code times, still as much as
52  * possible
53  * copy (>0) : copy the raw next rle_code pixels */
54  signed char *rlecode_table;
55  /**
56  * This array will contain the length of the best rle encoding of the line
57  * starting at ith pixel */
59  /**
60  * Will contain at ith position the number of consecutive pixels equal to the previous
61  * frame starting from pixel i */
62  uint8_t* skip_table;
63 
64  /** Encoded frame is a key frame */
65  int key_frame;
67 
69 {
70  QtrleEncContext *s = avctx->priv_data;
71 
72  av_frame_free(&s->previous_frame);
73  av_free(s->rlecode_table);
74  av_free(s->length_table);
75  av_free(s->skip_table);
76  return 0;
77 }
78 
80 {
81  QtrleEncContext *s = avctx->priv_data;
82 
83  if (av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) {
84  return AVERROR(EINVAL);
85  }
86  s->avctx=avctx;
87  s->logical_width=avctx->width;
88 
89  switch (avctx->pix_fmt) {
90  case AV_PIX_FMT_GRAY8:
91  if (avctx->width % 4) {
92  av_log(avctx, AV_LOG_ERROR, "Width not being a multiple of 4 is not supported\n");
93  return AVERROR(EINVAL);
94  }
95  s->logical_width = avctx->width / 4;
96  s->pixel_size = 4;
97  break;
99  s->pixel_size = 2;
100  break;
101  case AV_PIX_FMT_RGB24:
102  s->pixel_size = 3;
103  break;
104  case AV_PIX_FMT_ARGB:
105  s->pixel_size = 4;
106  break;
107  default:
108  av_log(avctx, AV_LOG_ERROR, "Unsupported colorspace.\n");
109  break;
110  }
111  avctx->bits_per_coded_sample = avctx->pix_fmt == AV_PIX_FMT_GRAY8 ? 40 : s->pixel_size*8;
112 
113  s->rlecode_table = av_mallocz(s->logical_width);
114  s->skip_table = av_mallocz(s->logical_width);
115  s->length_table = av_calloc(s->logical_width + 1, sizeof(*s->length_table));
116  if (!s->skip_table || !s->length_table || !s->rlecode_table) {
117  av_log(avctx, AV_LOG_ERROR, "Error allocating memory.\n");
118  return AVERROR(ENOMEM);
119  }
120  s->previous_frame = av_frame_alloc();
121  if (!s->previous_frame) {
122  av_log(avctx, AV_LOG_ERROR, "Error allocating picture\n");
123  return AVERROR(ENOMEM);
124  }
125 
126  s->max_buf_size = s->logical_width*s->avctx->height*s->pixel_size*2 /* image base material */
127  + 15 /* header + footer */
128  + s->avctx->height*2 /* skip code+rle end */
129  + s->logical_width/MAX_RLE_BULK + 1 /* rle codes */;
130 
131  return 0;
132 }
133 
134 /**
135  * Compute the best RLE sequence for a line
136  */
137 static void qtrle_encode_line(QtrleEncContext *s, const AVFrame *p, int line, uint8_t **buf)
138 {
139  int width=s->logical_width;
140  int i;
141  signed char rlecode;
142 
143  /* This will be the number of pixels equal to the previous frame one's
144  * starting from the ith pixel */
145  unsigned int skipcount;
146  /* This will be the number of consecutive equal pixels in the current
147  * frame, starting from the ith one also */
148  unsigned int av_uninit(repeatcount);
149 
150  /* The cost of the three different possibilities */
151  int total_skip_cost;
152  int total_repeat_cost;
153 
154  int base_bulk_cost;
155  int lowest_bulk_cost;
156  int lowest_bulk_cost_index;
157  int sec_lowest_bulk_cost;
158  int sec_lowest_bulk_cost_index;
159 
160  const uint8_t *this_line = p->data[0] + line * p->linesize[0] + width * s->pixel_size;
161  /* There might be no earlier frame if the current frame is a keyframe.
162  * So just use a pointer to the current frame to avoid a check
163  * to avoid NULL - s->pixel_size (which is undefined behaviour). */
164  const uint8_t *prev_line = s->key_frame ? this_line
165  : s->previous_frame->data[0]
166  + line * s->previous_frame->linesize[0]
167  + width * s->pixel_size;
168 
169  s->length_table[width] = 0;
170  skipcount = 0;
171 
172  /* Initial values */
173  lowest_bulk_cost = INT_MAX / 2;
174  lowest_bulk_cost_index = width;
175  sec_lowest_bulk_cost = INT_MAX / 2;
176  sec_lowest_bulk_cost_index = width;
177 
178  base_bulk_cost = 1 + s->pixel_size;
179 
180  for (i = width - 1; i >= 0; i--) {
181 
182  int prev_bulk_cost;
183 
184  this_line -= s->pixel_size;
185  prev_line -= s->pixel_size;
186 
187  /* If our lowest bulk cost index is too far away, replace it
188  * with the next lowest bulk cost */
189  if (FFMIN(width, i + MAX_RLE_BULK) < lowest_bulk_cost_index) {
190  lowest_bulk_cost = sec_lowest_bulk_cost;
191  lowest_bulk_cost_index = sec_lowest_bulk_cost_index;
192 
193  sec_lowest_bulk_cost = INT_MAX / 2;
194  sec_lowest_bulk_cost_index = width;
195  }
196 
197  /* Deal with the first pixel's bulk cost */
198  if (!i) {
199  base_bulk_cost++;
200  lowest_bulk_cost++;
201  sec_lowest_bulk_cost++;
202  }
203 
204  /* Look at the bulk cost of the previous loop and see if it is
205  * a new lower bulk cost */
206  prev_bulk_cost = s->length_table[i + 1] + base_bulk_cost;
207  if (prev_bulk_cost <= sec_lowest_bulk_cost) {
208  /* If it's lower than the 2nd lowest, then it may be lower
209  * than the lowest */
210  if (prev_bulk_cost <= lowest_bulk_cost) {
211 
212  /* If we have found a new lowest bulk cost,
213  * then the 2nd lowest bulk cost is now farther than the
214  * lowest bulk cost, and will never be used */
215  sec_lowest_bulk_cost = INT_MAX / 2;
216 
217  lowest_bulk_cost = prev_bulk_cost;
218  lowest_bulk_cost_index = i + 1;
219  } else {
220  /* Then it must be the 2nd lowest bulk cost */
221  sec_lowest_bulk_cost = prev_bulk_cost;
222  sec_lowest_bulk_cost_index = i + 1;
223  }
224  }
225 
226  if (!s->key_frame && !memcmp(this_line, prev_line, s->pixel_size))
227  skipcount = FFMIN(skipcount + 1, MAX_RLE_SKIP);
228  else
229  skipcount = 0;
230 
231  total_skip_cost = s->length_table[i + skipcount] + 2;
232  s->skip_table[i] = skipcount;
233 
234 
235  if (i < width - 1 && !memcmp(this_line, this_line + s->pixel_size, s->pixel_size))
236  repeatcount = FFMIN(repeatcount + 1, MAX_RLE_REPEAT);
237  else
238  repeatcount = 1;
239 
240  total_repeat_cost = s->length_table[i + repeatcount] + 1 + s->pixel_size;
241 
242  /* skip code is free for the first pixel, it costs one byte for repeat and bulk copy
243  * so let's make it aware */
244  if (i == 0) {
245  total_skip_cost--;
246  total_repeat_cost++;
247  }
248 
249  if (repeatcount > 1 && (skipcount == 0 || total_repeat_cost < total_skip_cost)) {
250  /* repeat is the best */
251  s->length_table[i] = total_repeat_cost;
252  s->rlecode_table[i] = -repeatcount;
253  }
254  else if (skipcount > 0) {
255  /* skip is the best choice here */
256  s->length_table[i] = total_skip_cost;
257  s->rlecode_table[i] = 0;
258  }
259  else {
260  /* We cannot do neither skip nor repeat
261  * thus we use the best bulk copy */
262 
263  s->length_table[i] = lowest_bulk_cost;
264  s->rlecode_table[i] = lowest_bulk_cost_index - i;
265 
266  }
267 
268  /* These bulk costs increase every iteration */
269  lowest_bulk_cost += s->pixel_size;
270  sec_lowest_bulk_cost += s->pixel_size;
271  }
272 
273  /* Good! Now we have the best sequence for this line, let's output it. */
274 
275  /* We do a special case for the first pixel so that we avoid testing it in
276  * the whole loop */
277 
278  i=0;
279  this_line = p-> data[0] + line*p->linesize[0];
280 
281  if (s->rlecode_table[0] == 0) {
282  bytestream_put_byte(buf, s->skip_table[0] + 1);
283  i += s->skip_table[0];
284  }
285  else bytestream_put_byte(buf, 1);
286 
287 
288  while (i < width) {
289  rlecode = s->rlecode_table[i];
290  bytestream_put_byte(buf, rlecode);
291  if (rlecode == 0) {
292  /* Write a skip sequence */
293  bytestream_put_byte(buf, s->skip_table[i] + 1);
294  i += s->skip_table[i];
295  }
296  else if (rlecode > 0) {
297  /* bulk copy */
298  if (s->avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
299  int j;
300  // QT grayscale colorspace has 0=white and 255=black, we will
301  // ignore the palette that is included in the AVFrame because
302  // AV_PIX_FMT_GRAY8 has defined color mapping
303  for (j = 0; j < rlecode*s->pixel_size; ++j)
304  bytestream_put_byte(buf, *(this_line + i*s->pixel_size + j) ^ 0xff);
305  } else {
306  bytestream_put_buffer(buf, this_line + i*s->pixel_size, rlecode*s->pixel_size);
307  }
308  i += rlecode;
309  }
310  else {
311  /* repeat the bits */
312  if (s->avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
313  int j;
314  // QT grayscale colorspace has 0=white and 255=black, ...
315  for (j = 0; j < s->pixel_size; ++j)
316  bytestream_put_byte(buf, *(this_line + i*s->pixel_size + j) ^ 0xff);
317  } else {
318  bytestream_put_buffer(buf, this_line + i*s->pixel_size, s->pixel_size);
319  }
320  i -= rlecode;
321  }
322  }
323  bytestream_put_byte(buf, -1); // end RLE line
324 }
325 
326 /** Encode frame including header */
327 static int encode_frame(QtrleEncContext *s, const AVFrame *p, uint8_t *buf)
328 {
329  int i;
330  int start_line = 0;
331  int end_line = s->avctx->height;
332  uint8_t *orig_buf = buf;
333 
334  if (!s->key_frame) {
335  unsigned line_size = s->logical_width * s->pixel_size;
336  for (start_line = 0; start_line < s->avctx->height; start_line++)
337  if (memcmp(p->data[0] + start_line*p->linesize[0],
338  s->previous_frame->data[0] + start_line * s->previous_frame->linesize[0],
339  line_size))
340  break;
341 
342  for (end_line=s->avctx->height; end_line > start_line; end_line--)
343  if (memcmp(p->data[0] + (end_line - 1)*p->linesize[0],
344  s->previous_frame->data[0] + (end_line - 1) * s->previous_frame->linesize[0],
345  line_size))
346  break;
347  }
348 
349  bytestream_put_be32(&buf, 0); // CHUNK SIZE, patched later
350 
351  if ((start_line == 0 && end_line == s->avctx->height) || start_line == s->avctx->height)
352  bytestream_put_be16(&buf, 0); // header
353  else {
354  bytestream_put_be16(&buf, 8); // header
355  bytestream_put_be16(&buf, start_line); // starting line
356  bytestream_put_be16(&buf, 0); // unknown
357  bytestream_put_be16(&buf, end_line - start_line); // lines to update
358  bytestream_put_be16(&buf, 0); // unknown
359  }
360  for (i = start_line; i < end_line; i++)
361  qtrle_encode_line(s, p, i, &buf);
362 
363  bytestream_put_byte(&buf, 0); // zero skip code = frame finished
364  AV_WB32(orig_buf, buf - orig_buf); // patch the chunk size
365  return buf - orig_buf;
366 }
367 
369  const AVFrame *pict, int *got_packet)
370 {
371  QtrleEncContext * const s = avctx->priv_data;
372  int ret;
373 
374  if ((ret = ff_alloc_packet(avctx, pkt, s->max_buf_size)) < 0)
375  return ret;
376 
377  if (avctx->gop_size == 0 || !s->previous_frame->data[0] ||
378  (s->avctx->frame_num % avctx->gop_size) == 0) {
379  /* I-Frame */
380  s->key_frame = 1;
381  } else {
382  /* P-Frame */
383  s->key_frame = 0;
384  }
385 
386  pkt->size = encode_frame(s, pict, pkt->data);
387 
388  /* save the current frame */
389  ret = av_frame_replace(s->previous_frame, pict);
390  if (ret < 0) {
391  av_log(avctx, AV_LOG_ERROR, "cannot add reference\n");
392  return ret;
393  }
394 
395  if (s->key_frame)
397  *got_packet = 1;
398 
399  return 0;
400 }
401 
403  .p.name = "qtrle",
404  CODEC_LONG_NAME("QuickTime Animation (RLE) video"),
405  .p.type = AVMEDIA_TYPE_VIDEO,
406  .p.id = AV_CODEC_ID_QTRLE,
408  .priv_data_size = sizeof(QtrleEncContext),
411  .close = qtrle_encode_end,
412  .p.pix_fmts = (const enum AVPixelFormat[]){
414  },
415  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
416 };
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
AVERROR
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
MAX_RLE_BULK
#define MAX_RLE_BULK
Maximum RLE code for bulk copy.
Definition: qtrleenc.c:33
QtrleEncContext::avctx
AVCodecContext * avctx
Definition: qtrleenc.c:40
QtrleEncContext::length_table
int * length_table
This array will contain the length of the best rle encoding of the line starting at ith pixel.
Definition: qtrleenc.c:58
QtrleEncContext::pixel_size
int pixel_size
Definition: qtrleenc.c:41
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
AVPacket::data
uint8_t * data
Definition: packet.h:524
encode.h
data
const char data[16]
Definition: mxf.c:148
FFCodec
Definition: codec_internal.h:126
qtrle_encode_end
static av_cold int qtrle_encode_end(AVCodecContext *avctx)
Definition: qtrleenc.c:68
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:579
AV_PIX_FMT_RGB555BE
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:114
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:395
ff_qtrle_encoder
const FFCodec ff_qtrle_encoder
Definition: qtrleenc.c:402
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:130
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:295
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:148
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:198
qtrle_encode_line
static void qtrle_encode_line(QtrleEncContext *s, const AVFrame *p, int line, uint8_t **buf)
Compute the best RLE sequence for a line.
Definition: qtrleenc.c:137
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
QtrleEncContext::logical_width
int logical_width
Definition: qtrleenc.c:44
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:271
MAX_RLE_SKIP
#define MAX_RLE_SKIP
Maximum RLE code for skip.
Definition: qtrleenc.c:37
QtrleEncContext::key_frame
int key_frame
Encoded frame is a key frame.
Definition: qtrleenc.c:65
QtrleEncContext::skip_table
uint8_t * skip_table
Will contain at ith position the number of consecutive pixels equal to the previous frame starting fr...
Definition: qtrleenc.c:62
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_WB32
#define AV_WB32(p, v)
Definition: intreadwrite.h:417
MAX_RLE_REPEAT
#define MAX_RLE_REPEAT
Maximum RLE code for repeat.
Definition: qtrleenc.c:35
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:75
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AVPacket::size
int size
Definition: packet.h:525
AVCodecContext::gop_size
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
Definition: avcodec.h:1031
codec_internal.h
encode_frame
static int encode_frame(QtrleEncContext *s, const AVFrame *p, uint8_t *buf)
Encode frame including header.
Definition: qtrleenc.c:327
QtrleEncContext::rlecode_table
signed char * rlecode_table
This array will contain at ith position the value of the best RLE code if the line started at pixel i...
Definition: qtrleenc.c:54
line
Definition: graph2dot.c:48
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:530
QtrleEncContext::max_buf_size
unsigned int max_buf_size
Definition: qtrleenc.c:43
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:99
AVCodecContext::bits_per_coded_sample
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:1567
bytestream_put_buffer
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
Definition: bytestream.h:372
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
QtrleEncContext::previous_frame
AVFrame * previous_frame
Definition: qtrleenc.c:42
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:256
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AVCodecContext::height
int height
Definition: avcodec.h:618
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:657
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:264
avcodec.h
av_uninit
#define av_uninit(x)
Definition: attributes.h:154
ret
ret
Definition: filter_design.txt:187
av_frame_replace
int av_frame_replace(AVFrame *dst, const AVFrame *src)
Ensure the destination frame refers to the same data described by the source frame,...
Definition: frame.c:483
AVCodecContext
main external API structure.
Definition: avcodec.h:445
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
qtrle_encode_frame
static int qtrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
Definition: qtrleenc.c:368
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
mem.h
AV_CODEC_ID_QTRLE
@ AV_CODEC_ID_QTRLE
Definition: codec_id.h:107
qtrle_encode_init
static av_cold int qtrle_encode_init(AVCodecContext *avctx)
Definition: qtrleenc.c:79
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVPacket
This structure stores compressed data.
Definition: packet.h:501
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:618
bytestream.h
imgutils.h
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:419
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
av_image_check_size
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
Definition: imgutils.c:318
QtrleEncContext
Definition: qtrleenc.c:39
ff_alloc_packet
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
Definition: encode.c:62