FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups 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 
85 static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd)
86 {
87  const int t0 = 27246 * blk[3 * step] + 18405 * blk[5 * step];
88  const int t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step];
89  const int t2 = 6393 * blk[7 * step] + 32139 * blk[1 * step];
90  const int t3 = 6393 * blk[1 * step] - 32139 * blk[7 * step];
91  const int t4 = 5793 * (t2 + t0 + 0x800 >> 12);
92  const int t5 = 5793 * (t3 + t1 + 0x800 >> 12);
93  const int t6 = t2 - t0;
94  const int t7 = t3 - t1;
95  const int t8 = 17734 * blk[2 * step] - 42813 * blk[6 * step];
96  const int t9 = 17734 * blk[6 * step] + 42814 * blk[2 * step];
97  const int tA = (blk[0 * step] - blk[4 * step] << 15) + rnd;
98  const int tB = (blk[0 * step] + blk[4 * step] << 15) + rnd;
99  blk[0 * step] = ( t4 + t9 + tB) >> shift;
100  blk[1 * step] = ( t6 + t7 + t8 + tA) >> shift;
101  blk[2 * step] = ( t6 - t7 - t8 + tA) >> shift;
102  blk[3 * step] = ( t5 - t9 + tB) >> shift;
103  blk[4 * step] = ( -t5 - t9 + tB) >> shift;
104  blk[5 * step] = (-(t6 - t7) - t8 + tA) >> shift;
105  blk[6 * step] = (-(t6 + t7) + t8 + tA) >> shift;
106  blk[7 * step] = ( -t4 + t9 + tB) >> shift;
107 }
108 
109 static void fic_idct_put(uint8_t *dst, int stride, int16_t *block)
110 {
111  int i, j;
112  int16_t *ptr;
113 
114  ptr = block;
115  fic_idct(ptr++, 8, 13, (1 << 12) + (1 << 17));
116  for (i = 1; i < 8; i++) {
117  fic_idct(ptr, 8, 13, 1 << 12);
118  ptr++;
119  }
120 
121  ptr = block;
122  for (i = 0; i < 8; i++) {
123  fic_idct(ptr, 1, 20, 0);
124  ptr += 8;
125  }
126 
127  ptr = block;
128  for (j = 0; j < 8; j++) {
129  for (i = 0; i < 8; i++)
130  dst[i] = av_clip_uint8(ptr[i]);
131  dst += stride;
132  ptr += 8;
133  }
134 }
136  uint8_t *dst, int stride, int16_t *block)
137 {
138  int i, num_coeff;
139 
140  /* Is it a skip block? */
141  if (get_bits1(gb)) {
142  /* This is a P-frame. */
143  ctx->frame->key_frame = 0;
145 
146  return 0;
147  }
148 
149  memset(block, 0, sizeof(*block) * 64);
150 
151  num_coeff = get_bits(gb, 7);
152  if (num_coeff > 64)
153  return AVERROR_INVALIDDATA;
154 
155  for (i = 0; i < num_coeff; i++)
156  block[ff_zigzag_direct[i]] = get_se_golomb(gb) *
157  ctx->qmat[ff_zigzag_direct[i]];
158 
159  fic_idct_put(dst, stride, block);
160 
161  return 0;
162 }
163 
164 static int fic_decode_slice(AVCodecContext *avctx, void *tdata)
165 {
166  FICContext *ctx = avctx->priv_data;
167  FICThreadContext *tctx = tdata;
168  GetBitContext gb;
169  uint8_t *src = tctx->src;
170  int slice_h = tctx->slice_h;
171  int src_size = tctx->src_size;
172  int y_off = tctx->y_off;
173  int x, y, p;
174 
175  init_get_bits(&gb, src, src_size * 8);
176 
177  for (p = 0; p < 3; p++) {
178  int stride = ctx->frame->linesize[p];
179  uint8_t* dst = ctx->frame->data[p] + (y_off >> !!p) * stride;
180 
181  for (y = 0; y < (slice_h >> !!p); y += 8) {
182  for (x = 0; x < (ctx->aligned_width >> !!p); x += 8) {
183  int ret;
184 
185  if ((ret = fic_decode_block(ctx, &gb, dst + x, stride, tctx->block)) != 0)
186  return ret;
187  }
188 
189  dst += 8 * stride;
190  }
191  }
192 
193  return 0;
194 }
195 
197  int size, uint8_t *alpha)
198 {
199  int i;
200 
201  for (i = 0; i < size; i++)
202  dst[i] += ((src[i] - dst[i]) * alpha[i]) >> 8;
203 }
204 
205 static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y)
206 {
207  FICContext *ctx = avctx->priv_data;
208  uint8_t *ptr = ctx->cursor_buf;
209  uint8_t *dstptr[3];
210  uint8_t planes[4][1024];
211  uint8_t chroma[3][256];
212  int i, j, p;
213 
214  /* Convert to YUVA444. */
215  for (i = 0; i < 1024; i++) {
216  planes[0][i] = (( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16;
217  planes[1][i] = ((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128;
218  planes[2][i] = ((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128;
219  planes[3][i] = ptr[3];
220 
221  ptr += 4;
222  }
223 
224  /* Subsample chroma. */
225  for (i = 0; i < 32; i += 2)
226  for (j = 0; j < 32; j += 2)
227  for (p = 0; p < 3; p++)
228  chroma[p][16 * (i / 2) + j / 2] = (planes[p + 1][32 * i + j ] +
229  planes[p + 1][32 * i + j + 1] +
230  planes[p + 1][32 * (i + 1) + j ] +
231  planes[p + 1][32 * (i + 1) + j + 1]) / 4;
232 
233  /* Seek to x/y pos of cursor. */
234  for (i = 0; i < 3; i++)
235  dstptr[i] = ctx->final_frame->data[i] +
236  (ctx->final_frame->linesize[i] * (cur_y >> !!i)) +
237  (cur_x >> !!i) + !!i;
238 
239  /* Copy. */
240  for (i = 0; i < FFMIN(32, avctx->height - cur_y) - 1; i += 2) {
241  int lsize = FFMIN(32, avctx->width - cur_x);
242  int csize = lsize / 2;
243 
244  fic_alpha_blend(dstptr[0],
245  planes[0] + i * 32, lsize, planes[3] + i * 32);
246  fic_alpha_blend(dstptr[0] + ctx->final_frame->linesize[0],
247  planes[0] + (i + 1) * 32, lsize, planes[3] + (i + 1) * 32);
248  fic_alpha_blend(dstptr[1],
249  chroma[0] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
250  fic_alpha_blend(dstptr[2],
251  chroma[1] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
252 
253  dstptr[0] += ctx->final_frame->linesize[0] * 2;
254  dstptr[1] += ctx->final_frame->linesize[1];
255  dstptr[2] += ctx->final_frame->linesize[2];
256  }
257 }
258 
259 static int fic_decode_frame(AVCodecContext *avctx, void *data,
260  int *got_frame, AVPacket *avpkt)
261 {
262  FICContext *ctx = avctx->priv_data;
263  uint8_t *src = avpkt->data;
264  int ret;
265  int slice, nslices;
266  int msize;
267  int tsize;
268  int cur_x, cur_y;
269  int skip_cursor = ctx->skip_cursor;
270  uint8_t *sdata;
271 
272  if ((ret = ff_reget_buffer(avctx, ctx->frame)) < 0)
273  return ret;
274 
275  /* Header + at least one slice (4) */
276  if (avpkt->size < FIC_HEADER_SIZE + 4) {
277  av_log(avctx, AV_LOG_ERROR, "Frame data is too small.\n");
278  return AVERROR_INVALIDDATA;
279  }
280 
281  /* Check for header. */
282  if (memcmp(src, fic_header, 7))
283  av_log(avctx, AV_LOG_WARNING, "Invalid FIC Header.\n");
284 
285  /* Is it a skip frame? */
286  if (src[17]) {
287  if (!ctx->final_frame) {
288  av_log(avctx, AV_LOG_WARNING, "Initial frame is skipped\n");
289  return AVERROR_INVALIDDATA;
290  }
291  goto skip;
292  }
293 
294  nslices = src[13];
295  if (!nslices) {
296  av_log(avctx, AV_LOG_ERROR, "Zero slices found.\n");
297  return AVERROR_INVALIDDATA;
298  }
299 
300  /* High or Low Quality Matrix? */
301  ctx->qmat = src[23] ? fic_qmat_hq : fic_qmat_lq;
302 
303  /* Skip cursor data. */
304  tsize = AV_RB24(src + 24);
305  if (tsize > avpkt->size - FIC_HEADER_SIZE) {
306  av_log(avctx, AV_LOG_ERROR,
307  "Packet is too small to contain cursor (%d vs %d bytes).\n",
308  tsize, avpkt->size - FIC_HEADER_SIZE);
309  return AVERROR_INVALIDDATA;
310  }
311 
312  if (!tsize || !AV_RL16(src + 37) || !AV_RL16(src + 39))
313  skip_cursor = 1;
314 
315  if (!skip_cursor && tsize < 32) {
316  av_log(avctx, AV_LOG_WARNING,
317  "Cursor data too small. Skipping cursor.\n");
318  skip_cursor = 1;
319  }
320 
321  /* Cursor position. */
322  cur_x = AV_RL16(src + 33);
323  cur_y = AV_RL16(src + 35);
324  if (!skip_cursor && (cur_x > avctx->width || cur_y > avctx->height)) {
325  av_log(avctx, AV_LOG_DEBUG,
326  "Invalid cursor position: (%d,%d). Skipping cursor.\n",
327  cur_x, cur_y);
328  skip_cursor = 1;
329  }
330 
331  if (!skip_cursor && (AV_RL16(src + 37) != 32 || AV_RL16(src + 39) != 32)) {
332  av_log(avctx, AV_LOG_WARNING,
333  "Invalid cursor size. Skipping cursor.\n");
334  skip_cursor = 1;
335  }
336 
337  /* Slice height for all but the last slice. */
338  ctx->slice_h = 16 * (ctx->aligned_height >> 4) / nslices;
339  if (ctx->slice_h % 16)
340  ctx->slice_h = FFALIGN(ctx->slice_h - 16, 16);
341 
342  /* First slice offset and remaining data. */
343  sdata = src + tsize + FIC_HEADER_SIZE + 4 * nslices;
344  msize = avpkt->size - nslices * 4 - tsize - FIC_HEADER_SIZE;
345 
346  if (msize <= 0) {
347  av_log(avctx, AV_LOG_ERROR, "Not enough frame data to decode.\n");
348  return AVERROR_INVALIDDATA;
349  }
350 
351  /*
352  * Set the frametype to I initially. It will be set to P if the frame
353  * has any dependencies (skip blocks). There will be a race condition
354  * inside the slice decode function to set these, but we do not care.
355  * since they will only ever be set to 0/P.
356  */
357  ctx->frame->key_frame = 1;
359 
360  /* Allocate slice data. */
362  nslices * sizeof(ctx->slice_data[0]));
363  if (!ctx->slice_data_size) {
364  av_log(avctx, AV_LOG_ERROR, "Could not allocate slice data.\n");
365  return AVERROR(ENOMEM);
366  }
367  memset(ctx->slice_data, 0, nslices * sizeof(ctx->slice_data[0]));
368 
369  for (slice = 0; slice < nslices; slice++) {
370  unsigned slice_off = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4);
371  unsigned slice_size;
372  int y_off = ctx->slice_h * slice;
373  int slice_h = ctx->slice_h;
374 
375  /*
376  * Either read the slice size, or consume all data left.
377  * Also, special case the last slight height.
378  */
379  if (slice == nslices - 1) {
380  slice_size = msize;
381  slice_h = FFALIGN(avctx->height - ctx->slice_h * (nslices - 1), 16);
382  } else {
383  slice_size = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4);
384  }
385 
386  if (slice_size < slice_off || slice_size > msize)
387  continue;
388 
389  slice_size -= slice_off;
390 
391  ctx->slice_data[slice].src = sdata + slice_off;
392  ctx->slice_data[slice].src_size = slice_size;
393  ctx->slice_data[slice].slice_h = slice_h;
394  ctx->slice_data[slice].y_off = y_off;
395  }
396 
397  if ((ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data,
398  NULL, nslices, sizeof(ctx->slice_data[0]))) < 0)
399  return ret;
400 
401  av_frame_free(&ctx->final_frame);
402  ctx->final_frame = av_frame_clone(ctx->frame);
403  if (!ctx->final_frame) {
404  av_log(avctx, AV_LOG_ERROR, "Could not clone frame buffer.\n");
405  return AVERROR(ENOMEM);
406  }
407 
408  /* Make sure we use a user-supplied buffer. */
409  if ((ret = ff_reget_buffer(avctx, ctx->final_frame)) < 0) {
410  av_log(avctx, AV_LOG_ERROR, "Could not make frame writable.\n");
411  return ret;
412  }
413 
414  /* Draw cursor. */
415  if (!skip_cursor) {
416  memcpy(ctx->cursor_buf, src + 59, 32 * 32 * 4);
417  fic_draw_cursor(avctx, cur_x, cur_y);
418  }
419 
420 skip:
421  *got_frame = 1;
422  if ((ret = av_frame_ref(data, ctx->final_frame)) < 0)
423  return ret;
424 
425  return avpkt->size;
426 }
427 
429 {
430  FICContext *ctx = avctx->priv_data;
431 
432  av_freep(&ctx->slice_data);
433  av_frame_free(&ctx->final_frame);
434  av_frame_free(&ctx->frame);
435 
436  return 0;
437 }
438 
440 {
441  FICContext *ctx = avctx->priv_data;
442 
443  /* Initialize various context values */
444  ctx->avctx = avctx;
445  ctx->aligned_width = FFALIGN(avctx->width, 16);
446  ctx->aligned_height = FFALIGN(avctx->height, 16);
447 
448  avctx->pix_fmt = AV_PIX_FMT_YUV420P;
449  avctx->bits_per_raw_sample = 8;
450 
451  ctx->frame = av_frame_alloc();
452  if (!ctx->frame)
453  return AVERROR(ENOMEM);
454 
455  return 0;
456 }
457 
458 static const AVOption options[] = {
459 { "skip_cursor", "skip the cursor", offsetof(FICContext, skip_cursor), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM },
460 { NULL },
461 };
462 
463 static const AVClass fic_decoder_class = {
464  .class_name = "FIC encoder",
465  .item_name = av_default_item_name,
466  .option = options,
467  .version = LIBAVUTIL_VERSION_INT,
468 };
469 
471  .name = "fic",
472  .long_name = NULL_IF_CONFIG_SMALL("Mirillis FIC"),
473  .type = AVMEDIA_TYPE_VIDEO,
474  .id = AV_CODEC_ID_FIC,
475  .priv_data_size = sizeof(FICContext),
478  .close = fic_decode_close,
480  .priv_class = &fic_decoder_class,
481 };
#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:196
#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
static av_always_inline void chroma(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset_y, int offset_x, int column, int mirror)
Definition: vf_waveform.c:1318
This structure describes decoded (raw) audio or video data.
Definition: frame.h:184
AVOption.
Definition: opt.h:245
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:247
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:70
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
int size
Definition: avcodec.h:1581
#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:1877
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:3049
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:3542
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:87
static av_cold int fic_decode_close(AVCodecContext *avctx)
Definition: fic.c:428
static int16_t block[64]
Definition: dct.c:113
#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:82
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:140
AVOptions.
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:374
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:87
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:1580
bitstream reader API header.
ptrdiff_t size
Definition: opengl_enc.c:101
#define FFALIGN(x, a)
Definition: macros.h:48
#define av_log(a,...)
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:109
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:153
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static const uint8_t fic_qmat_lq[64]
Definition: fic.c:70
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
#define t1
Definition: regdef.h:29
const char * name
Name of the codec implementation.
Definition: avcodec.h:3549
#define t3
Definition: regdef.h:31
static int fic_decode_block(FICContext *ctx, GetBitContext *gb, uint8_t *dst, int stride, int16_t *block)
Definition: fic.c:135
AVCodec ff_fic_decoder
Definition: fic.c:470
enum AVPictureType cur_frame_type
Definition: fic.c:50
static const AVOption options[]
Definition: fic.c:458
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:977
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:258
#define FFMIN(a, b)
Definition: common.h:96
static const AVClass fic_decoder_class
Definition: fic.c:463
int width
picture width / height.
Definition: avcodec.h:1836
AVFormatContext * ctx
Definition: movenc.c:48
static av_cold int fic_decode_init(AVCodecContext *avctx)
Definition: fic.c:439
#define src
Definition: vp9dsp.c:530
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:471
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: avcodec.h:1023
uint8_t * src
Definition: fic.c:33
Libavcodec external API header.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
Definition: bytestream.h:87
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:215
#define AV_OPT_FLAG_VIDEO_PARAM
Definition: opt.h:281
main external API structure.
Definition: avcodec.h:1649
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:299
Describe the class of an AVClass context structure.
Definition: log.h:67
int slice_data_size
Definition: fic.c:46
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:276
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:406
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:85
static int fic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: fic.c:259
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:198
AVCodecContext * avctx
Definition: fic.c:41
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:722
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:62
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:66
int slice_h
Definition: fic.c:34
void * priv_data
Definition: avcodec.h:1691
#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:3119
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:253
static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y)
Definition: fic.c:205
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:39
#define stride
static int fic_decode_slice(AVCodecContext *avctx, void *tdata)
Definition: fic.c:164
exp golomb vlc stuff
This structure stores compressed data.
Definition: avcodec.h:1557
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:956
#define t2
Definition: regdef.h:30
Predicted.
Definition: avutil.h:267