FFmpeg
cllc.c
Go to the documentation of this file.
1 /*
2  * Canopus Lossless Codec decoder
3  *
4  * Copyright (c) 2012-2013 Derek Buitenhuis
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include <inttypes.h>
24 
25 #include "libavutil/intreadwrite.h"
26 #include "bswapdsp.h"
27 #include "canopus.h"
28 #include "get_bits.h"
29 #include "avcodec.h"
30 #include "internal.h"
31 #include "thread.h"
32 
33 #define VLC_BITS 7
34 #define VLC_DEPTH 2
35 
36 
37 typedef struct CLLCContext {
40 
43 } CLLCContext;
44 
46 {
47  uint8_t symbols[256];
48  uint8_t bits[256];
49  uint16_t codes[256];
50  int num_lens, num_codes, num_codes_sum, prefix;
51  int i, j, count;
52 
53  prefix = 0;
54  count = 0;
55  num_codes_sum = 0;
56 
57  num_lens = get_bits(gb, 5);
58 
59  if (num_lens > VLC_BITS * VLC_DEPTH) {
60  vlc->table = NULL;
61 
62  av_log(ctx->avctx, AV_LOG_ERROR, "To long VLCs %d\n", num_lens);
63  return AVERROR_INVALIDDATA;
64  }
65 
66  for (i = 0; i < num_lens; i++) {
67  num_codes = get_bits(gb, 9);
68  num_codes_sum += num_codes;
69 
70  if (num_codes_sum > 256) {
71  vlc->table = NULL;
72 
73  av_log(ctx->avctx, AV_LOG_ERROR,
74  "Too many VLCs (%d) to be read.\n", num_codes_sum);
75  return AVERROR_INVALIDDATA;
76  }
77 
78  for (j = 0; j < num_codes; j++) {
79  symbols[count] = get_bits(gb, 8);
80  bits[count] = i + 1;
81  codes[count] = prefix++;
82 
83  count++;
84  }
85  if (prefix > (65535 - 256)/2) {
86  vlc->table = NULL;
87  return AVERROR_INVALIDDATA;
88  }
89 
90  prefix <<= 1;
91  }
92 
93  return ff_init_vlc_sparse(vlc, VLC_BITS, count, bits, 1, 1,
94  codes, 2, 2, symbols, 1, 1, 0);
95 }
96 
97 /*
98  * Unlike the RGB24 read/restore, which reads in a component at a time,
99  * ARGB read/restore reads in ARGB quads.
100  */
101 static int read_argb_line(CLLCContext *ctx, GetBitContext *gb, int *top_left,
102  VLC *vlc, uint8_t *outbuf)
103 {
104  uint8_t *dst;
105  int pred[4];
106  int code;
107  int i;
108 
109  OPEN_READER(bits, gb);
110 
111  dst = outbuf;
112  pred[0] = top_left[0];
113  pred[1] = top_left[1];
114  pred[2] = top_left[2];
115  pred[3] = top_left[3];
116 
117  for (i = 0; i < ctx->avctx->width; i++) {
118  /* Always get the alpha component */
119  UPDATE_CACHE(bits, gb);
120  GET_VLC(code, bits, gb, vlc[0].table, VLC_BITS, VLC_DEPTH);
121 
122  pred[0] += code;
123  dst[0] = pred[0];
124 
125  /* Skip the components if they are entirely transparent */
126  if (dst[0]) {
127  /* Red */
128  UPDATE_CACHE(bits, gb);
129  GET_VLC(code, bits, gb, vlc[1].table, VLC_BITS, VLC_DEPTH);
130 
131  pred[1] += code;
132  dst[1] = pred[1];
133 
134  /* Green */
135  UPDATE_CACHE(bits, gb);
136  GET_VLC(code, bits, gb, vlc[2].table, VLC_BITS, VLC_DEPTH);
137 
138  pred[2] += code;
139  dst[2] = pred[2];
140 
141  /* Blue */
142  UPDATE_CACHE(bits, gb);
143  GET_VLC(code, bits, gb, vlc[3].table, VLC_BITS, VLC_DEPTH);
144 
145  pred[3] += code;
146  dst[3] = pred[3];
147  } else {
148  dst[1] = 0;
149  dst[2] = 0;
150  dst[3] = 0;
151  }
152 
153  dst += 4;
154  }
155 
156  CLOSE_READER(bits, gb);
157 
158  top_left[0] = outbuf[0];
159 
160  /* Only stash components if they are not transparent */
161  if (top_left[0]) {
162  top_left[1] = outbuf[1];
163  top_left[2] = outbuf[2];
164  top_left[3] = outbuf[3];
165  }
166 
167  return 0;
168 }
169 
171  int *top_left, VLC *vlc, uint8_t *outbuf)
172 {
173  uint8_t *dst;
174  int pred, code;
175  int i;
176 
177  OPEN_READER(bits, gb);
178 
179  dst = outbuf;
180  pred = *top_left;
181 
182  /* Simultaneously read and restore the line */
183  for (i = 0; i < ctx->avctx->width; i++) {
184  UPDATE_CACHE(bits, gb);
185  GET_VLC(code, bits, gb, vlc->table, VLC_BITS, VLC_DEPTH);
186 
187  pred += code;
188  dst[0] = pred;
189  dst += 3;
190  }
191 
192  CLOSE_READER(bits, gb);
193 
194  /* Stash the first pixel */
195  *top_left = outbuf[0];
196 
197  return 0;
198 }
199 
201  int *top_left, VLC *vlc, uint8_t *outbuf,
202  int is_chroma)
203 {
204  int pred, code;
205  int i;
206 
207  OPEN_READER(bits, gb);
208 
209  pred = *top_left;
210 
211  /* Simultaneously read and restore the line */
212  for (i = 0; i < ctx->avctx->width >> is_chroma; i++) {
213  UPDATE_CACHE(bits, gb);
214  GET_VLC(code, bits, gb, vlc->table, VLC_BITS, VLC_DEPTH);
215 
216  pred += code;
217  outbuf[i] = pred;
218  }
219 
220  CLOSE_READER(bits, gb);
221 
222  /* Stash the first pixel */
223  *top_left = outbuf[0];
224 
225  return 0;
226 }
227 
229 {
230  AVCodecContext *avctx = ctx->avctx;
231  uint8_t *dst;
232  int pred[4];
233  int ret;
234  int i, j;
235  VLC vlc[4];
236 
237  pred[0] = 0;
238  pred[1] = 0x80;
239  pred[2] = 0x80;
240  pred[3] = 0x80;
241 
242  dst = pic->data[0];
243 
244  skip_bits(gb, 16);
245 
246  /* Read in code table for each plane */
247  for (i = 0; i < 4; i++) {
248  ret = read_code_table(ctx, gb, &vlc[i]);
249  if (ret < 0) {
250  for (j = 0; j <= i; j++)
251  ff_free_vlc(&vlc[j]);
252 
253  av_log(ctx->avctx, AV_LOG_ERROR,
254  "Could not read code table %d.\n", i);
255  return ret;
256  }
257  }
258 
259  /* Read in and restore every line */
260  for (i = 0; i < avctx->height; i++) {
261  read_argb_line(ctx, gb, pred, vlc, dst);
262 
263  dst += pic->linesize[0];
264  }
265 
266  for (i = 0; i < 4; i++)
267  ff_free_vlc(&vlc[i]);
268 
269  return 0;
270 }
271 
273 {
274  AVCodecContext *avctx = ctx->avctx;
275  uint8_t *dst;
276  int pred[3];
277  int ret;
278  int i, j;
279  VLC vlc[3];
280 
281  pred[0] = 0x80;
282  pred[1] = 0x80;
283  pred[2] = 0x80;
284 
285  dst = pic->data[0];
286 
287  skip_bits(gb, 16);
288 
289  /* Read in code table for each plane */
290  for (i = 0; i < 3; i++) {
291  ret = read_code_table(ctx, gb, &vlc[i]);
292  if (ret < 0) {
293  for (j = 0; j <= i; j++)
294  ff_free_vlc(&vlc[j]);
295 
296  av_log(ctx->avctx, AV_LOG_ERROR,
297  "Could not read code table %d.\n", i);
298  return ret;
299  }
300  }
301 
302  /* Read in and restore every line */
303  for (i = 0; i < avctx->height; i++) {
304  for (j = 0; j < 3; j++)
305  read_rgb24_component_line(ctx, gb, &pred[j], &vlc[j], &dst[j]);
306 
307  dst += pic->linesize[0];
308  }
309 
310  for (i = 0; i < 3; i++)
311  ff_free_vlc(&vlc[i]);
312 
313  return 0;
314 }
315 
317 {
318  AVCodecContext *avctx = ctx->avctx;
319  uint8_t block;
320  uint8_t *dst[3];
321  int pred[3];
322  int ret;
323  int i, j;
324  VLC vlc[2];
325 
326  pred[0] = 0x80;
327  pred[1] = 0x80;
328  pred[2] = 0x80;
329 
330  dst[0] = pic->data[0];
331  dst[1] = pic->data[1];
332  dst[2] = pic->data[2];
333 
334  skip_bits(gb, 8);
335 
336  block = get_bits(gb, 8);
337  if (block) {
338  avpriv_request_sample(ctx->avctx, "Blocked YUV");
339  return AVERROR_PATCHWELCOME;
340  }
341 
342  /* Read in code table for luma and chroma */
343  for (i = 0; i < 2; i++) {
344  ret = read_code_table(ctx, gb, &vlc[i]);
345  if (ret < 0) {
346  for (j = 0; j <= i; j++)
347  ff_free_vlc(&vlc[j]);
348 
349  av_log(ctx->avctx, AV_LOG_ERROR,
350  "Could not read code table %d.\n", i);
351  return ret;
352  }
353  }
354 
355  /* Read in and restore every line */
356  for (i = 0; i < avctx->height; i++) {
357  read_yuv_component_line(ctx, gb, &pred[0], &vlc[0], dst[0], 0); /* Y */
358  read_yuv_component_line(ctx, gb, &pred[1], &vlc[1], dst[1], 1); /* U */
359  read_yuv_component_line(ctx, gb, &pred[2], &vlc[1], dst[2], 1); /* V */
360 
361  for (j = 0; j < 3; j++)
362  dst[j] += pic->linesize[j];
363  }
364 
365  for (i = 0; i < 2; i++)
366  ff_free_vlc(&vlc[i]);
367 
368  return 0;
369 }
370 
371 static int cllc_decode_frame(AVCodecContext *avctx, void *data,
372  int *got_picture_ptr, AVPacket *avpkt)
373 {
374  CLLCContext *ctx = avctx->priv_data;
375  AVFrame *pic = data;
376  ThreadFrame frame = { .f = data };
377  uint8_t *src = avpkt->data;
378  uint32_t info_tag, info_offset;
379  int data_size;
380  GetBitContext gb;
381  int coding_type, ret;
382 
383  if (avpkt->size < 4 + 4) {
384  av_log(avctx, AV_LOG_ERROR, "Frame is too small %d.\n", avpkt->size);
385  return AVERROR_INVALIDDATA;
386  }
387 
388  info_offset = 0;
389  info_tag = AV_RL32(src);
390  if (info_tag == MKTAG('I', 'N', 'F', 'O')) {
391  info_offset = AV_RL32(src + 4);
392  if (info_offset > UINT32_MAX - 8 || info_offset + 8 > avpkt->size) {
393  av_log(avctx, AV_LOG_ERROR,
394  "Invalid INFO header offset: 0x%08"PRIX32" is too large.\n",
395  info_offset);
396  return AVERROR_INVALIDDATA;
397  }
398  ff_canopus_parse_info_tag(avctx, src + 8, info_offset);
399 
400  info_offset += 8;
401  src += info_offset;
402  }
403 
404  data_size = (avpkt->size - info_offset) & ~1;
405 
406  /* Make sure our bswap16'd buffer is big enough */
407  av_fast_padded_malloc(&ctx->swapped_buf,
408  &ctx->swapped_buf_size, data_size);
409  if (!ctx->swapped_buf) {
410  av_log(avctx, AV_LOG_ERROR, "Could not allocate swapped buffer.\n");
411  return AVERROR(ENOMEM);
412  }
413 
414  /* bswap16 the buffer since CLLC's bitreader works in 16-bit words */
415  ctx->bdsp.bswap16_buf((uint16_t *) ctx->swapped_buf, (uint16_t *) src,
416  data_size / 2);
417 
418  if ((ret = init_get_bits8(&gb, ctx->swapped_buf, data_size)) < 0)
419  return ret;
420 
421  /*
422  * Read in coding type. The types are as follows:
423  *
424  * 0 - YUY2
425  * 1 - BGR24 (Triples)
426  * 2 - BGR24 (Quads)
427  * 3 - BGRA
428  */
429  coding_type = (AV_RL32(src) >> 8) & 0xFF;
430  av_log(avctx, AV_LOG_DEBUG, "Frame coding type: %d\n", coding_type);
431 
432  if(get_bits_left(&gb) < avctx->height * avctx->width)
433  return AVERROR_INVALIDDATA;
434 
435  switch (coding_type) {
436  case 0:
437  avctx->pix_fmt = AV_PIX_FMT_YUV422P;
438  avctx->bits_per_raw_sample = 8;
439 
440  if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
441  return ret;
442 
443  ret = decode_yuv_frame(ctx, &gb, pic);
444  if (ret < 0)
445  return ret;
446 
447  break;
448  case 1:
449  case 2:
450  avctx->pix_fmt = AV_PIX_FMT_RGB24;
451  avctx->bits_per_raw_sample = 8;
452 
453  if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
454  return ret;
455 
456  ret = decode_rgb24_frame(ctx, &gb, pic);
457  if (ret < 0)
458  return ret;
459 
460  break;
461  case 3:
462  avctx->pix_fmt = AV_PIX_FMT_ARGB;
463  avctx->bits_per_raw_sample = 8;
464 
465  if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
466  return ret;
467 
468  ret = decode_argb_frame(ctx, &gb, pic);
469  if (ret < 0)
470  return ret;
471 
472  break;
473  default:
474  av_log(avctx, AV_LOG_ERROR, "Unknown coding type: %d.\n", coding_type);
475  return AVERROR_INVALIDDATA;
476  }
477 
478  pic->key_frame = 1;
480 
481  *got_picture_ptr = 1;
482 
483  return avpkt->size;
484 }
485 
486 #if HAVE_THREADS
487 static int cllc_init_thread_copy(AVCodecContext *avctx)
488 {
489  CLLCContext *ctx = avctx->priv_data;
490 
491  ctx->avctx = avctx;
492  ctx->swapped_buf = NULL;
493  ctx->swapped_buf_size = 0;
494 
495  return 0;
496 }
497 #endif
498 
500 {
501  CLLCContext *ctx = avctx->priv_data;
502 
503  av_freep(&ctx->swapped_buf);
504 
505  return 0;
506 }
507 
509 {
510  CLLCContext *ctx = avctx->priv_data;
511 
512  /* Initialize various context values */
513  ctx->avctx = avctx;
514  ctx->swapped_buf = NULL;
515  ctx->swapped_buf_size = 0;
516 
517  ff_bswapdsp_init(&ctx->bdsp);
518 
519  return 0;
520 }
521 
523  .name = "cllc",
524  .long_name = NULL_IF_CONFIG_SMALL("Canopus Lossless Codec"),
525  .type = AVMEDIA_TYPE_VIDEO,
526  .id = AV_CODEC_ID_CLLC,
527  .priv_data_size = sizeof(CLLCContext),
529  .init_thread_copy = ONLY_IF_THREADS_ENABLED(cllc_init_thread_copy),
530  .decode = cllc_decode_frame,
531  .close = cllc_decode_close,
533  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
534 };
AVCodec
AVCodec.
Definition: avcodec.h:3481
bswapdsp.h
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:849
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
read_yuv_component_line
static int read_yuv_component_line(CLLCContext *ctx, GetBitContext *gb, int *top_left, VLC *vlc, uint8_t *outbuf, int is_chroma)
Definition: cllc.c:200
VLC_DEPTH
#define VLC_DEPTH
Definition: cllc.c:34
MKTAG
#define MKTAG(a, b, c, d)
Definition: common.h:366
CLLCContext::avctx
AVCodecContext * avctx
Definition: cllc.c:38
GET_VLC
#define GET_VLC(code, name, gb, table, bits, max_depth)
If the vlc code is invalid and max_depth=1, then no bits will be removed.
Definition: get_bits.h:706
count
void INT64 INT64 count
Definition: avisynth_c.h:767
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
internal.h
AVPacket::data
uint8_t * data
Definition: avcodec.h:1477
decode_rgb24_frame
static int decode_rgb24_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
Definition: cllc.c:272
table
static const uint16_t table[]
Definition: prosumer.c:206
data
const char data[16]
Definition: mxf.c:91
UPDATE_CACHE
#define UPDATE_CACHE(name, gb)
Definition: get_bits.h:178
thread.h
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:309
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
read_rgb24_component_line
static int read_rgb24_component_line(CLLCContext *ctx, GetBitContext *gb, int *top_left, VLC *vlc, uint8_t *outbuf)
Definition: cllc.c:170
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
ff_canopus_parse_info_tag
int ff_canopus_parse_info_tag(AVCodecContext *avctx, const uint8_t *src, size_t size)
Definition: canopus.c:30
GetBitContext
Definition: get_bits.h:61
AVFrame::key_frame
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:373
src
#define src
Definition: vp8dsp.c:254
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
av_cold
#define av_cold
Definition: attributes.h:84
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:677
CLOSE_READER
#define CLOSE_READER(name, gb)
Definition: get_bits.h:149
VLC_BITS
#define VLC_BITS
Definition: cllc.c:33
intreadwrite.h
bits
uint8_t bits
Definition: vp3data.h:202
cllc_decode_close
static av_cold int cllc_decode_close(AVCodecContext *avctx)
Definition: cllc.c:499
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:2796
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
ctx
AVFormatContext * ctx
Definition: movenc.c:48
get_bits.h
ff_free_vlc
void ff_free_vlc(VLC *vlc)
Definition: bitstream.c:359
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1037
ff_bswapdsp_init
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
Definition: bswapdsp.c:49
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:274
ONLY_IF_THREADS_ENABLED
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
Definition: internal.h:227
ff_thread_get_buffer
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
Definition: pthread_frame.c:964
ff_init_vlc_sparse
int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags)
Definition: bitstream.c:273
canopus.h
cllc_decode_frame
static int cllc_decode_frame(AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt)
Definition: cllc.c:371
AVFrame::pict_type
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:378
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
read_argb_line
static int read_argb_line(CLLCContext *ctx, GetBitContext *gb, int *top_left, VLC *vlc, uint8_t *outbuf)
Definition: cllc.c:101
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:981
read_code_table
static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
Definition: cllc.c:45
AVPacket::size
int size
Definition: avcodec.h:1478
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
decode_yuv_frame
static int decode_yuv_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
Definition: cllc.c:316
init_thread_copy
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have add an init_thread_copy() which re-allocates them for other threads. Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little speed gain at this point but it should work. If there are inter-frame dependencies
CLLCContext::swapped_buf
uint8_t * swapped_buf
Definition: cllc.c:41
OPEN_READER
#define OPEN_READER(name, gb)
Definition: get_bits.h:138
CLLCContext::bdsp
BswapDSPContext bdsp
Definition: cllc.c:39
cllc_decode_init
static av_cold int cllc_decode_init(AVCodecContext *avctx)
Definition: cllc.c:508
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:92
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
code
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
Definition: filter_design.txt:178
av_fast_padded_malloc
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
Definition: utils.c:70
uint8_t
uint8_t
Definition: audio_convert.c:194
AV_CODEC_ID_CLLC
@ AV_CODEC_ID_CLLC
Definition: avcodec.h:384
AVCodec::name
const char * name
Name of the codec implementation.
Definition: avcodec.h:3488
AVCodecContext::height
int height
Definition: avcodec.h:1738
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1775
avcodec.h
ret
ret
Definition: filter_design.txt:187
pred
static const float pred[4]
Definition: siprdata.h:259
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:88
AVCodecContext
main external API structure.
Definition: avcodec.h:1565
ThreadFrame
Definition: thread.h:34
CLLCContext
Definition: cllc.c:37
VLC
Definition: vlc.h:26
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
decode_argb_frame
static int decode_argb_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
Definition: cllc.c:228
ff_cllc_decoder
AVCodec ff_cllc_decoder
Definition: cllc.c:522
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:39
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:1592
AVPacket
This structure stores compressed data.
Definition: avcodec.h:1454
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
CLLCContext::swapped_buf_size
int swapped_buf_size
Definition: cllc.c:42
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:1738
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:326
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
BswapDSPContext
Definition: bswapdsp.h:24
VLC::table
VLC_TYPE(* table)[2]
code, bits
Definition: vlc.h:28