FFmpeg  2.8.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fic.c
Go to the documentation of this file.
1 /*
2  * Mirillis FIC decoder
3  *
4  * Copyright (c) 2014 Konstantin Shishkov
5  * Copyright (c) 2014 Derek Buitenhuis
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * FFmpeg is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with FFmpeg; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #include "libavutil/common.h"
25 #include "libavutil/opt.h"
26 #include "avcodec.h"
27 #include "internal.h"
28 #include "get_bits.h"
29 #include "golomb.h"
30 
31 typedef struct FICThreadContext {
32  DECLARE_ALIGNED(16, int16_t, block)[64];
34  int slice_h;
35  int src_size;
36  int y_off;
38 
39 typedef struct FICContext {
40  AVClass *class;
44 
47 
48  const uint8_t *qmat;
49 
51 
54 
57 } FICContext;
58 
59 static const uint8_t fic_qmat_hq[64] = {
60  1, 2, 2, 2, 3, 3, 3, 4,
61  2, 2, 2, 3, 3, 3, 4, 4,
62  2, 2, 3, 3, 3, 4, 4, 4,
63  2, 2, 3, 3, 3, 4, 4, 5,
64  2, 3, 3, 3, 4, 4, 5, 6,
65  3, 3, 3, 4, 4, 5, 6, 7,
66  3, 3, 3, 4, 4, 5, 7, 7,
67  3, 3, 4, 4, 5, 7, 7, 7,
68 };
69 
70 static const uint8_t fic_qmat_lq[64] = {
71  1, 5, 6, 7, 8, 9, 9, 11,
72  5, 5, 7, 8, 9, 9, 11, 12,
73  6, 7, 8, 9, 9, 11, 11, 12,
74  7, 7, 8, 9, 9, 11, 12, 13,
75  7, 8, 9, 9, 10, 11, 13, 16,
76  8, 9, 9, 10, 11, 13, 16, 19,
77  8, 9, 9, 11, 12, 15, 18, 23,
78  9, 9, 11, 12, 15, 18, 23, 27
79 };
80 
81 static const uint8_t fic_header[7] = { 0, 0, 1, 'F', 'I', 'C', 'V' };
82 
83 #define FIC_HEADER_SIZE 27
84 #define CURSOR_OFFSET 59
85 
86 static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd)
87 {
88  const unsigned t0 = 27246 * blk[3 * step] + 18405 * blk[5 * step];
89  const unsigned t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step];
90  const unsigned t2 = 6393 * blk[7 * step] + 32139 * blk[1 * step];
91  const unsigned t3 = 6393 * blk[1 * step] - 32139 * blk[7 * step];
92  const unsigned t4 = 5793U * ((int)(t2 + t0 + 0x800) >> 12);
93  const unsigned t5 = 5793U * ((int)(t3 + t1 + 0x800) >> 12);
94  const unsigned t6 = t2 - t0;
95  const unsigned t7 = t3 - t1;
96  const unsigned t8 = 17734 * blk[2 * step] - 42813 * blk[6 * step];
97  const unsigned t9 = 17734 * blk[6 * step] + 42814 * blk[2 * step];
98  const unsigned tA = (blk[0 * step] - blk[4 * step]) * 32768 + rnd;
99  const unsigned tB = (blk[0 * step] + blk[4 * step]) * 32768 + rnd;
100  blk[0 * step] = (int)( t4 + t9 + tB) >> shift;
101  blk[1 * step] = (int)( t6 + t7 + t8 + tA) >> shift;
102  blk[2 * step] = (int)( t6 - t7 - t8 + tA) >> shift;
103  blk[3 * step] = (int)( t5 - t9 + tB) >> shift;
104  blk[4 * step] = (int)( -t5 - t9 + tB) >> shift;
105  blk[5 * step] = (int)(-(t6 - t7) - t8 + tA) >> shift;
106  blk[6 * step] = (int)(-(t6 + t7) + t8 + tA) >> shift;
107  blk[7 * step] = (int)( -t4 + t9 + tB) >> shift;
108 }
109 
110 static void fic_idct_put(uint8_t *dst, int stride, int16_t *block)
111 {
112  int i, j;
113  int16_t *ptr;
114 
115  ptr = block;
116  fic_idct(ptr++, 8, 13, (1 << 12) + (1 << 17));
117  for (i = 1; i < 8; i++) {
118  fic_idct(ptr, 8, 13, 1 << 12);
119  ptr++;
120  }
121 
122  ptr = block;
123  for (i = 0; i < 8; i++) {
124  fic_idct(ptr, 1, 20, 0);
125  ptr += 8;
126  }
127 
128  ptr = block;
129  for (j = 0; j < 8; j++) {
130  for (i = 0; i < 8; i++)
131  dst[i] = av_clip_uint8(ptr[i]);
132  dst += stride;
133  ptr += 8;
134  }
135 }
137  uint8_t *dst, int stride, int16_t *block)
138 {
139  int i, num_coeff;
140 
141  /* Is it a skip block? */
142  if (get_bits1(gb)) {
143  /* This is a P-frame. */
144  ctx->frame->key_frame = 0;
146 
147  return 0;
148  }
149 
150  memset(block, 0, sizeof(*block) * 64);
151 
152  num_coeff = get_bits(gb, 7);
153  if (num_coeff > 64)
154  return AVERROR_INVALIDDATA;
155 
156  for (i = 0; i < num_coeff; i++)
157  block[ff_zigzag_direct[i]] = get_se_golomb(gb) *
158  ctx->qmat[ff_zigzag_direct[i]];
159 
160  fic_idct_put(dst, stride, block);
161 
162  return 0;
163 }
164 
165 static int fic_decode_slice(AVCodecContext *avctx, void *tdata)
166 {
167  FICContext *ctx = avctx->priv_data;
168  FICThreadContext *tctx = tdata;
169  GetBitContext gb;
170  uint8_t *src = tctx->src;
171  int slice_h = tctx->slice_h;
172  int src_size = tctx->src_size;
173  int y_off = tctx->y_off;
174  int x, y, p;
175 
176  init_get_bits(&gb, src, src_size * 8);
177 
178  for (p = 0; p < 3; p++) {
179  int stride = ctx->frame->linesize[p];
180  uint8_t* dst = ctx->frame->data[p] + (y_off >> !!p) * stride;
181 
182  for (y = 0; y < (slice_h >> !!p); y += 8) {
183  for (x = 0; x < (ctx->aligned_width >> !!p); x += 8) {
184  int ret;
185 
186  if ((ret = fic_decode_block(ctx, &gb, dst + x, stride, tctx->block)) != 0)
187  return ret;
188  }
189 
190  dst += 8 * stride;
191  }
192  }
193 
194  return 0;
195 }
196 
198  int size, uint8_t *alpha)
199 {
200  int i;
201 
202  for (i = 0; i < size; i++)
203  dst[i] += ((src[i] - dst[i]) * alpha[i]) >> 8;
204 }
205 
206 static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y)
207 {
208  FICContext *ctx = avctx->priv_data;
209  uint8_t *ptr = ctx->cursor_buf;
210  uint8_t *dstptr[3];
211  uint8_t planes[4][1024];
212  uint8_t chroma[3][256];
213  int i, j, p;
214 
215  /* Convert to YUVA444. */
216  for (i = 0; i < 1024; i++) {
217  planes[0][i] = (( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16;
218  planes[1][i] = ((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128;
219  planes[2][i] = ((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128;
220  planes[3][i] = ptr[3];
221 
222  ptr += 4;
223  }
224 
225  /* Subsample chroma. */
226  for (i = 0; i < 32; i += 2)
227  for (j = 0; j < 32; j += 2)
228  for (p = 0; p < 3; p++)
229  chroma[p][16 * (i / 2) + j / 2] = (planes[p + 1][32 * i + j ] +
230  planes[p + 1][32 * i + j + 1] +
231  planes[p + 1][32 * (i + 1) + j ] +
232  planes[p + 1][32 * (i + 1) + j + 1]) / 4;
233 
234  /* Seek to x/y pos of cursor. */
235  for (i = 0; i < 3; i++)
236  dstptr[i] = ctx->final_frame->data[i] +
237  (ctx->final_frame->linesize[i] * (cur_y >> !!i)) +
238  (cur_x >> !!i) + !!i;
239 
240  /* Copy. */
241  for (i = 0; i < FFMIN(32, avctx->height - cur_y) - 1; i += 2) {
242  int lsize = FFMIN(32, avctx->width - cur_x);
243  int csize = lsize / 2;
244 
245  fic_alpha_blend(dstptr[0],
246  planes[0] + i * 32, lsize, planes[3] + i * 32);
247  fic_alpha_blend(dstptr[0] + ctx->final_frame->linesize[0],
248  planes[0] + (i + 1) * 32, lsize, planes[3] + (i + 1) * 32);
249  fic_alpha_blend(dstptr[1],
250  chroma[0] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
251  fic_alpha_blend(dstptr[2],
252  chroma[1] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
253 
254  dstptr[0] += ctx->final_frame->linesize[0] * 2;
255  dstptr[1] += ctx->final_frame->linesize[1];
256  dstptr[2] += ctx->final_frame->linesize[2];
257  }
258 }
259 
260 static int fic_decode_frame(AVCodecContext *avctx, void *data,
261  int *got_frame, AVPacket *avpkt)
262 {
263  FICContext *ctx = avctx->priv_data;
264  uint8_t *src = avpkt->data;
265  int ret;
266  int slice, nslices;
267  int msize;
268  int tsize;
269  int cur_x, cur_y;
270  int skip_cursor = ctx->skip_cursor;
271  uint8_t *sdata;
272 
273  if ((ret = ff_reget_buffer(avctx, ctx->frame)) < 0)
274  return ret;
275 
276  /* Header + at least one slice (4) */
277  if (avpkt->size < FIC_HEADER_SIZE + 4) {
278  av_log(avctx, AV_LOG_ERROR, "Frame data is too small.\n");
279  return AVERROR_INVALIDDATA;
280  }
281 
282  /* Check for header. */
283  if (memcmp(src, fic_header, 7))
284  av_log(avctx, AV_LOG_WARNING, "Invalid FIC Header.\n");
285 
286  /* Is it a skip frame? */
287  if (src[17]) {
288  if (!ctx->final_frame) {
289  av_log(avctx, AV_LOG_WARNING, "Initial frame is skipped\n");
290  return AVERROR_INVALIDDATA;
291  }
292  goto skip;
293  }
294 
295  nslices = src[13];
296  if (!nslices) {
297  av_log(avctx, AV_LOG_ERROR, "Zero slices found.\n");
298  return AVERROR_INVALIDDATA;
299  }
300 
301  /* High or Low Quality Matrix? */
302  ctx->qmat = src[23] ? fic_qmat_hq : fic_qmat_lq;
303 
304  /* Skip cursor data. */
305  tsize = AV_RB24(src + 24);
306  if (tsize > avpkt->size - FIC_HEADER_SIZE) {
307  av_log(avctx, AV_LOG_ERROR,
308  "Packet is too small to contain cursor (%d vs %d bytes).\n",
309  tsize, avpkt->size - FIC_HEADER_SIZE);
310  return AVERROR_INVALIDDATA;
311  }
312 
313  if (!tsize)
314  skip_cursor = 1;
315 
316  if (!skip_cursor && tsize < 32) {
317  av_log(avctx, AV_LOG_WARNING,
318  "Cursor data too small. Skipping cursor.\n");
319  skip_cursor = 1;
320  }
321 
322  /* Cursor position. */
323  cur_x = AV_RL16(src + 33);
324  cur_y = AV_RL16(src + 35);
325  if (!skip_cursor && (cur_x > avctx->width || cur_y > avctx->height)) {
326  av_log(avctx, AV_LOG_WARNING,
327  "Invalid cursor position: (%d,%d). Skipping cusor.\n",
328  cur_x, cur_y);
329  skip_cursor = 1;
330  }
331 
332  if (!skip_cursor && (AV_RL16(src + 37) != 32 || AV_RL16(src + 39) != 32)) {
333  av_log(avctx, AV_LOG_WARNING,
334  "Invalid cursor size. Skipping cursor.\n");
335  skip_cursor = 1;
336  }
337 
338  if (!skip_cursor && avpkt->size < CURSOR_OFFSET + sizeof(ctx->cursor_buf)) {
339  skip_cursor = 1;
340  }
341 
342  /* Slice height for all but the last slice. */
343  ctx->slice_h = 16 * (ctx->aligned_height >> 4) / nslices;
344  if (ctx->slice_h % 16)
345  ctx->slice_h = FFALIGN(ctx->slice_h - 16, 16);
346 
347  /* First slice offset and remaining data. */
348  sdata = src + tsize + FIC_HEADER_SIZE + 4 * nslices;
349  msize = avpkt->size - nslices * 4 - tsize - FIC_HEADER_SIZE;
350 
351  if (msize <= 0) {
352  av_log(avctx, AV_LOG_ERROR, "Not enough frame data to decode.\n");
353  return AVERROR_INVALIDDATA;
354  }
355 
356  /*
357  * Set the frametype to I initially. It will be set to P if the frame
358  * has any dependencies (skip blocks). There will be a race condition
359  * inside the slice decode function to set these, but we do not care.
360  * since they will only ever be set to 0/P.
361  */
362  ctx->frame->key_frame = 1;
364 
365  /* Allocate slice data. */
367  nslices * sizeof(ctx->slice_data[0]));
368  if (!ctx->slice_data_size) {
369  av_log(avctx, AV_LOG_ERROR, "Could not allocate slice data.\n");
370  return AVERROR(ENOMEM);
371  }
372  memset(ctx->slice_data, 0, nslices * sizeof(ctx->slice_data[0]));
373 
374  for (slice = 0; slice < nslices; slice++) {
375  unsigned slice_off = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4);
376  unsigned slice_size;
377  int y_off = ctx->slice_h * slice;
378  int slice_h = ctx->slice_h;
379 
380  /*
381  * Either read the slice size, or consume all data left.
382  * Also, special case the last slight height.
383  */
384  if (slice == nslices - 1) {
385  slice_size = msize;
386  slice_h = FFALIGN(avctx->height - ctx->slice_h * (nslices - 1), 16);
387  } else {
388  slice_size = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4);
389  }
390 
391  if (slice_size < slice_off || slice_size > msize)
392  continue;
393 
394  slice_size -= slice_off;
395 
396  ctx->slice_data[slice].src = sdata + slice_off;
397  ctx->slice_data[slice].src_size = slice_size;
398  ctx->slice_data[slice].slice_h = slice_h;
399  ctx->slice_data[slice].y_off = y_off;
400  }
401 
402  if ((ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data,
403  NULL, nslices, sizeof(ctx->slice_data[0]))) < 0)
404  return ret;
405 
406  av_frame_free(&ctx->final_frame);
407  ctx->final_frame = av_frame_clone(ctx->frame);
408  if (!ctx->final_frame) {
409  av_log(avctx, AV_LOG_ERROR, "Could not clone frame buffer.\n");
410  return AVERROR(ENOMEM);
411  }
412 
413  /* Make sure we use a user-supplied buffer. */
414  if ((ret = ff_reget_buffer(avctx, ctx->final_frame)) < 0) {
415  av_log(avctx, AV_LOG_ERROR, "Could not make frame writable.\n");
416  return ret;
417  }
418 
419  /* Draw cursor. */
420  if (!skip_cursor) {
421  memcpy(ctx->cursor_buf, src + CURSOR_OFFSET, sizeof(ctx->cursor_buf));
422  fic_draw_cursor(avctx, cur_x, cur_y);
423  }
424 
425 skip:
426  *got_frame = 1;
427  if ((ret = av_frame_ref(data, ctx->final_frame)) < 0)
428  return ret;
429 
430  return avpkt->size;
431 }
432 
434 {
435  FICContext *ctx = avctx->priv_data;
436 
437  av_freep(&ctx->slice_data);
438  av_frame_free(&ctx->final_frame);
439  av_frame_free(&ctx->frame);
440 
441  return 0;
442 }
443 
445 {
446  FICContext *ctx = avctx->priv_data;
447 
448  /* Initialize various context values */
449  ctx->avctx = avctx;
450  ctx->aligned_width = FFALIGN(avctx->width, 16);
451  ctx->aligned_height = FFALIGN(avctx->height, 16);
452 
453  avctx->pix_fmt = AV_PIX_FMT_YUV420P;
454  avctx->bits_per_raw_sample = 8;
455 
456  ctx->frame = av_frame_alloc();
457  if (!ctx->frame)
458  return AVERROR(ENOMEM);
459 
460  return 0;
461 }
462 
463 static const AVOption options[] = {
464 { "skip_cursor", "skip the cursor", offsetof(FICContext, skip_cursor), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM },
465 { NULL },
466 };
467 
468 static const AVClass fic_decoder_class = {
469  .class_name = "FIC encoder",
470  .item_name = av_default_item_name,
471  .option = options,
472  .version = LIBAVUTIL_VERSION_INT,
473 };
474 
476  .name = "fic",
477  .long_name = NULL_IF_CONFIG_SMALL("Mirillis FIC"),
478  .type = AVMEDIA_TYPE_VIDEO,
479  .id = AV_CODEC_ID_FIC,
480  .priv_data_size = sizeof(FICContext),
483  .close = fic_decode_close,
485  .priv_class = &fic_decoder_class,
486 };
#define NULL
Definition: coverity.c:32
static av_always_inline void fic_alpha_blend(uint8_t *dst, uint8_t *src, int size, uint8_t *alpha)
Definition: fic.c:197
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
static int shift(int a, int b)
Definition: sonic.c:82
#define t9
Definition: regdef.h:54
This structure describes decoded (raw) audio or video data.
Definition: frame.h:171
AVOption.
Definition: opt.h:255
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
Definition: golomb.h:183
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:261
int slice_h
Definition: fic.c:53
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
#define LIBAVUTIL_VERSION_INT
Definition: version.h:62
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
int size
Definition: avcodec.h:1434
#define AV_RB24
Definition: intreadwrite.h:64
#define DECLARE_ALIGNED(n, t, v)
Definition: mem.h:53
const uint8_t * qmat
Definition: fic.c:48
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1732
#define AV_RL16
Definition: intreadwrite.h:42
AVFrame * final_frame
Definition: fic.c:43
int aligned_height
Definition: fic.c:52
#define t8
Definition: regdef.h:53
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:3013
int num_slices
Definition: fic.c:53
#define blk(i)
Definition: sha.c:185
int aligned_width
Definition: fic.c:52
AVCodec.
Definition: avcodec.h:3482
#define FFALIGN(x, a)
Definition: common.h:97
static av_cold int fic_decode_close(AVCodecContext *avctx)
Definition: fic.c:433
#define t7
Definition: regdef.h:35
int skip_cursor
Definition: fic.c:56
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
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
AVOptions.
#define AV_RB32
Definition: intreadwrite.h:130
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
int src_size
Definition: fic.c:35
#define t0
Definition: regdef.h:28
static const uint8_t fic_header[7]
Definition: fic.c:81
uint8_t * data
Definition: avcodec.h:1433
bitstream reader API header.
ptrdiff_t size
Definition: opengl_enc.c:101
#define av_log(a,...)
#define U(x)
Definition: vp56_arith.h:37
Definition: fic.c:39
static double alpha(void *priv, double x, double y)
Definition: vf_geq.c:99
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
static void fic_idct_put(uint8_t *dst, int stride, int16_t *block)
Definition: fic.c:110
av_default_item_name
#define AVERROR(e)
Definition: error.h:43
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
static const uint8_t fic_qmat_lq[64]
Definition: fic.c:70
#define t1
Definition: regdef.h:29
const char * name
Name of the codec implementation.
Definition: avcodec.h:3489
#define t3
Definition: regdef.h:31
Libavcodec external API header.
static int fic_decode_block(FICContext *ctx, GetBitContext *gb, uint8_t *dst, int stride, int16_t *block)
Definition: fic.c:136
AVCodec ff_fic_decoder
Definition: fic.c:475
enum AVPictureType cur_frame_type
Definition: fic.c:50
static const AVOption options[]
Definition: fic.c:463
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
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:242
#define FFMIN(a, b)
Definition: common.h:92
float y
static const AVClass fic_decoder_class
Definition: fic.c:468
int width
picture width / height.
Definition: avcodec.h:1691
static av_cold int fic_decode_init(AVCodecContext *avctx)
Definition: fic.c:444
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:452
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: avcodec.h:924
uint8_t * src
Definition: fic.c:33
AVS_Value src
Definition: avisynth_c.h:482
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:199
#define AV_OPT_FLAG_VIDEO_PARAM
Definition: opt.h:291
main external API structure.
Definition: avcodec.h:1512
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:305
#define CURSOR_OFFSET
Definition: fic.c:84
Describe the class of an AVClass context structure.
Definition: log.h:67
int slice_data_size
Definition: fic.c:46
static void chroma(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column)
Definition: vf_waveform.c:785
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:286
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:415
const uint8_t ff_zigzag_direct[64]
Definition: mathtables.c:98
int y_off
Definition: fic.c:36
AVPictureType
Definition: avutil.h:264
#define t5
Definition: regdef.h:33
FICThreadContext * slice_data
Definition: fic.c:45
static const uint8_t fic_qmat_hq[64]
Definition: fic.c:59
static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd)
Definition: fic.c:86
static int fic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: fic.c:260
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:182
AVCodecContext * avctx
Definition: fic.c:41
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:521
int16_t block[64]
Definition: fic.c:32
GLint GLenum GLboolean GLsizei stride
Definition: opengl_enc.c:105
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
Definition: mem.c:499
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:63
common internal api header.
#define FIC_HEADER_SIZE
Definition: fic.c:83
common internal and external API header
#define t6
Definition: regdef.h:34
#define rnd()
Definition: checkasm.h:43
int slice_h
Definition: fic.c:34
void * priv_data
Definition: avcodec.h:1554
#define t4
Definition: regdef.h:32
int(* execute)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size)
The codec may call this to execute several independent things.
Definition: avcodec.h:3083
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:237
static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y)
Definition: fic.c:206
AVFrame * frame
Definition: fic.c:42
uint8_t cursor_buf[4096]
Definition: fic.c:55
#define av_freep(p)
#define av_always_inline
Definition: attributes.h:37
#define stride
static int fic_decode_slice(AVCodecContext *avctx, void *tdata)
Definition: fic.c:165
exp golomb vlc stuff
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
#define t2
Definition: regdef.h:30
Predicted.
Definition: avutil.h:267
static int16_t block[64]
Definition: dct-test.c:110