FFmpeg
ffv1_parse.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include "libavutil/crc.h"
20 #include "libavutil/mem.h"
21 #include "libavutil/pixdesc.h"
22 #include "rangecoder.h"
23 #include "ffv1.h"
24 
25 static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale)
26 {
27  int v;
28  int i = 0;
29  uint8_t state[CONTEXT_SIZE];
30 
31  memset(state, 128, sizeof(state));
32 
33  for (v = 0; i < 128; v++) {
34  unsigned len = ff_ffv1_get_symbol(c, state, 0) + 1U;
35 
36  if (len > 128 - i || !len)
37  return AVERROR_INVALIDDATA;
38 
39  while (len--) {
40  quant_table[i] = scale * v;
41  i++;
42  }
43  }
44 
45  for (i = 1; i < 128; i++)
46  quant_table[256 - i] = -quant_table[i];
47  quant_table[128] = -quant_table[127];
48 
49  return 2 * v - 1;
50 }
51 
53  int16_t quant_table[MAX_CONTEXT_INPUTS][256])
54 {
55  int i;
56  int context_count = 1;
57 
58  for (i = 0; i < 5; i++) {
59  int ret = read_quant_table(c, quant_table[i], context_count);
60  if (ret < 0)
61  return ret;
62  context_count *= ret;
63  if (context_count > 32768U) {
64  return AVERROR_INVALIDDATA;
65  }
66  }
67  return (context_count + 1) / 2;
68 }
69 
71 {
72  RangeCoder c;
73  uint8_t state[CONTEXT_SIZE];
74  int ret;
75  uint8_t state2[32][CONTEXT_SIZE];
76  unsigned crc = 0;
77 
78  memset(state2, 128, sizeof(state2));
79  memset(state, 128, sizeof(state));
80 
81  ff_init_range_decoder(&c, f->avctx->extradata, f->avctx->extradata_size);
82  ff_build_rac_states(&c, 0.05 * (1LL << 32), 256 - 8);
83 
84  f->version = ff_ffv1_get_symbol(&c, state, 0);
85  if (f->version < 2) {
86  av_log(f->avctx, AV_LOG_ERROR, "Invalid version in global header\n");
87  return AVERROR_INVALIDDATA;
88  }
89  if (f->version > 4) {
90  av_log(f->avctx, AV_LOG_ERROR, "unsupported version %d\n",
91  f->version);
92  return AVERROR_PATCHWELCOME;
93  }
94  f->combined_version = f->version << 16;
95  if (f->version > 2) {
96  c.bytestream_end -= 4;
97  f->micro_version = ff_ffv1_get_symbol(&c, state, 0);
98  if (f->micro_version < 0 || f->micro_version > 65535)
99  return AVERROR_INVALIDDATA;
100  f->combined_version += f->micro_version;
101  }
102  f->ac = ff_ffv1_get_symbol(&c, state, 0);
103 
104  if (f->ac == AC_RANGE_CUSTOM_TAB) {
105  for (int i = 1; i < 256; i++)
106  f->state_transition[i] = ff_ffv1_get_symbol(&c, state, 1) + c.one_state[i];
107  } else {
108  RangeCoder rc;
109  ff_build_rac_states(&rc, 0.05 * (1LL << 32), 256 - 8);
110  for (int i = 1; i < 256; i++)
111  f->state_transition[i] = rc.one_state[i];
112  }
113 
114  f->colorspace = ff_ffv1_get_symbol(&c, state, 0); //YUV cs type
115  f->avctx->bits_per_raw_sample = ff_ffv1_get_symbol(&c, state, 0);
116  f->chroma_planes = get_rac(&c, state);
117  f->chroma_h_shift = ff_ffv1_get_symbol(&c, state, 0);
118  f->chroma_v_shift = ff_ffv1_get_symbol(&c, state, 0);
119  f->transparency = get_rac(&c, state);
120  f->bayer = (f->colorspace == 2);
121  if (f->bayer) {
122  f->bayer_order = ff_ffv1_get_symbol(&c, state, 0);
123  if (f->bayer_order != 0) {
124  av_log(f->avctx, AV_LOG_ERROR, "Unsupported bayer order %d\n", f->bayer_order);
125  return AVERROR_PATCHWELCOME;
126  }
127  }
128  f->plane_count = 1 + (f->chroma_planes || f->version<4) + f->transparency + f->bayer;
129  f->num_h_slices = 1 + ff_ffv1_get_symbol(&c, state, 0);
130  f->num_v_slices = 1 + ff_ffv1_get_symbol(&c, state, 0);
131 
132  if (f->chroma_h_shift > 4U || f->chroma_v_shift > 4U) {
133  av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
134  f->chroma_h_shift, f->chroma_v_shift);
135  return AVERROR_INVALIDDATA;
136  }
137 
138  if (f->num_h_slices > (unsigned)f->width || !f->num_h_slices ||
139  f->num_v_slices > (unsigned)f->height || !f->num_v_slices
140  ) {
141  av_log(f->avctx, AV_LOG_ERROR, "slice count invalid\n");
142  return AVERROR_INVALIDDATA;
143  }
144 
145  if (f->num_h_slices > MAX_SLICES / f->num_v_slices) {
146  av_log(f->avctx, AV_LOG_ERROR, "slice count unsupported\n");
147  return AVERROR_PATCHWELCOME;
148  }
149 
150  f->quant_table_count = ff_ffv1_get_symbol(&c, state, 0);
151  if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
152  av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
153  f->quant_table_count = 0;
154  return AVERROR_INVALIDDATA;
155  }
156 
157  for (int i = 0; i < f->quant_table_count; i++) {
158  f->context_count[i] = ff_ffv1_read_quant_tables(&c, f->quant_tables[i]);
159  if (f->context_count[i] < 0) {
160  av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
161  return AVERROR_INVALIDDATA;
162  }
163  }
165  return ret;
166 
167  for (int i = 0; i < f->quant_table_count; i++)
168  if (get_rac(&c, state)) {
169  for (int j = 0; j < f->context_count[i]; j++)
170  for (int k = 0; k < CONTEXT_SIZE; k++) {
171  int pred = j ? f->initial_states[i][j - 1][k] : 128;
172  f->initial_states[i][j][k] =
173  (pred + ff_ffv1_get_symbol(&c, state2[k], 1)) & 0xFF;
174  }
175  }
176 
177  if (f->version > 2) {
178  f->ec = ff_ffv1_get_symbol(&c, state, 0);
179  if (f->ec >= 2)
180  f->crcref = 0x7a8c4079;
181  if (f->combined_version >= 0x30003)
182  f->intra = ff_ffv1_get_symbol(&c, state, 0);
183  if (f->combined_version >= 0x40004)
184  f->flt = ff_ffv1_get_symbol(&c, state, 0);
185  }
186 
187  if (f->version > 2) {
188  unsigned v;
189  v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), f->crcref,
190  f->avctx->extradata, f->avctx->extradata_size);
191  if (v != f->crcref || f->avctx->extradata_size < 4) {
192  av_log(f->avctx, AV_LOG_ERROR, "CRC mismatch %X!\n", v);
193  return AVERROR_INVALIDDATA;
194  }
195  crc = AV_RB32(f->avctx->extradata + f->avctx->extradata_size - 4);
196  }
197 
198  if (f->avctx->debug & FF_DEBUG_PICT_INFO)
199  av_log(f->avctx, AV_LOG_DEBUG,
200  "global: ver:%d.%d, coder:%d, colorspace: %d bpr:%d chroma:%d(%d:%d), alpha:%d slices:%dx%d qtabs:%d ec:%d intra:%d CRC:0x%08X\n",
201  f->version, f->micro_version,
202  f->ac,
203  f->colorspace,
204  f->avctx->bits_per_raw_sample,
205  f->chroma_planes, f->chroma_h_shift, f->chroma_v_shift,
206  f->transparency,
207  f->num_h_slices, f->num_v_slices,
208  f->quant_table_count,
209  f->ec,
210  f->intra,
211  crc
212  );
213  return 0;
214 }
215 
217 {
218  if (f->version < 2) {
219  int chroma_planes, chroma_h_shift, chroma_v_shift, transparency, colorspace, bits_per_raw_sample;
220  unsigned v= ff_ffv1_get_symbol(c, state, 0);
221  if (v >= 2) {
222  av_log(f->avctx, AV_LOG_ERROR, "invalid version %d in ver01 header\n", v);
223  return AVERROR_INVALIDDATA;
224  }
225  f->version = v;
226  f->ac = ff_ffv1_get_symbol(c, state, 0);
227 
228  if (f->ac == AC_RANGE_CUSTOM_TAB) {
229  for (int i = 1; i < 256; i++) {
230  int st = ff_ffv1_get_symbol(c, state, 1) + c->one_state[i];
231  if (st < 1 || st > 255) {
232  av_log(f->avctx, AV_LOG_ERROR, "invalid state transition %d\n", st);
233  return AVERROR_INVALIDDATA;
234  }
235  f->state_transition[i] = st;
236  }
237  } else {
238  RangeCoder rc;
239  ff_build_rac_states(&rc, 0.05 * (1LL << 32), 256 - 8);
240  for (int i = 1; i < 256; i++)
241  f->state_transition[i] = rc.one_state[i];
242  }
243 
244  colorspace = ff_ffv1_get_symbol(c, state, 0); //YUV cs type
245  bits_per_raw_sample = f->version > 0 ? ff_ffv1_get_symbol(c, state, 0) : f->avctx->bits_per_raw_sample;
246  chroma_planes = get_rac(c, state);
247  chroma_h_shift = ff_ffv1_get_symbol(c, state, 0);
248  chroma_v_shift = ff_ffv1_get_symbol(c, state, 0);
249  transparency = get_rac(c, state);
250  if (colorspace == 0 && f->avctx->skip_alpha)
251  transparency = 0;
252 
253  if (f->plane_count) {
254  if (colorspace != f->colorspace ||
255  bits_per_raw_sample != f->avctx->bits_per_raw_sample ||
256  chroma_planes != f->chroma_planes ||
257  chroma_h_shift != f->chroma_h_shift ||
258  chroma_v_shift != f->chroma_v_shift ||
259  transparency != f->transparency) {
260  av_log(f->avctx, AV_LOG_ERROR, "Invalid change of global parameters\n");
261  return AVERROR_INVALIDDATA;
262  }
263  }
264 
265  if (chroma_h_shift > 4U || chroma_v_shift > 4U) {
266  av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
267  chroma_h_shift, chroma_v_shift);
268  return AVERROR_INVALIDDATA;
269  }
270 
271  f->colorspace = colorspace;
272  f->avctx->bits_per_raw_sample = bits_per_raw_sample;
273  f->chroma_planes = chroma_planes;
274  f->chroma_h_shift = chroma_h_shift;
275  f->chroma_v_shift = chroma_v_shift;
276  f->transparency = transparency;
277 
278  f->plane_count = 2 + f->transparency;
279  }
280 
281  if (f->colorspace == 0) {
282  if (!f->transparency && !f->chroma_planes) {
283  if (f->avctx->bits_per_raw_sample <= 8)
284  f->pix_fmt = AV_PIX_FMT_GRAY8;
285  else if (f->avctx->bits_per_raw_sample == 9) {
286  f->packed_at_lsb = 1;
287  f->pix_fmt = AV_PIX_FMT_GRAY9;
288  } else if (f->avctx->bits_per_raw_sample == 10) {
289  f->packed_at_lsb = 1;
290  f->pix_fmt = AV_PIX_FMT_GRAY10;
291  } else if (f->avctx->bits_per_raw_sample == 12) {
292  f->packed_at_lsb = 1;
293  f->pix_fmt = AV_PIX_FMT_GRAY12;
294  } else if (f->avctx->bits_per_raw_sample == 14) {
295  f->packed_at_lsb = 1;
296  f->pix_fmt = AV_PIX_FMT_GRAY14;
297  } else if (f->avctx->bits_per_raw_sample == 16) {
298  f->packed_at_lsb = 1;
299  if (f->flt) {
300  f->pix_fmt = AV_PIX_FMT_GRAYF16;
301  } else
302  f->pix_fmt = AV_PIX_FMT_GRAY16;
303  } else if (f->avctx->bits_per_raw_sample < 16) {
304  f->pix_fmt = AV_PIX_FMT_GRAY16;
305  } else
306  return AVERROR(ENOSYS);
307  } else if (f->transparency && !f->chroma_planes) {
308  if (f->avctx->bits_per_raw_sample <= 8 && !f->flt) {
309  f->pix_fmt = AV_PIX_FMT_YA8;
310  } else if (f->avctx->bits_per_raw_sample == 16 && f->flt) {
311  f->pix_fmt = AV_PIX_FMT_YAF16;
312  } else
313  return AVERROR(ENOSYS);
314  } else if (f->avctx->bits_per_raw_sample<=8 && !f->transparency) {
315  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
316  case 0x00: f->pix_fmt = AV_PIX_FMT_YUV444P; break;
317  case 0x01: f->pix_fmt = AV_PIX_FMT_YUV440P; break;
318  case 0x10: f->pix_fmt = AV_PIX_FMT_YUV422P; break;
319  case 0x11: f->pix_fmt = AV_PIX_FMT_YUV420P; break;
320  case 0x20: f->pix_fmt = AV_PIX_FMT_YUV411P; break;
321  case 0x22: f->pix_fmt = AV_PIX_FMT_YUV410P; break;
322  }
323  } else if (f->avctx->bits_per_raw_sample <= 8 && f->transparency) {
324  switch(16*f->chroma_h_shift + f->chroma_v_shift) {
325  case 0x00: f->pix_fmt = AV_PIX_FMT_YUVA444P; break;
326  case 0x10: f->pix_fmt = AV_PIX_FMT_YUVA422P; break;
327  case 0x11: f->pix_fmt = AV_PIX_FMT_YUVA420P; break;
328  }
329  } else if (f->avctx->bits_per_raw_sample == 9 && !f->transparency) {
330  f->packed_at_lsb = 1;
331  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
332  case 0x00: f->pix_fmt = AV_PIX_FMT_YUV444P9; break;
333  case 0x10: f->pix_fmt = AV_PIX_FMT_YUV422P9; break;
334  case 0x11: f->pix_fmt = AV_PIX_FMT_YUV420P9; break;
335  }
336  } else if (f->avctx->bits_per_raw_sample == 9 && f->transparency) {
337  f->packed_at_lsb = 1;
338  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
339  case 0x00: f->pix_fmt = AV_PIX_FMT_YUVA444P9; break;
340  case 0x10: f->pix_fmt = AV_PIX_FMT_YUVA422P9; break;
341  case 0x11: f->pix_fmt = AV_PIX_FMT_YUVA420P9; break;
342  }
343  } else if (f->avctx->bits_per_raw_sample == 10 && !f->transparency) {
344  f->packed_at_lsb = 1;
345  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
346  case 0x00: f->pix_fmt = AV_PIX_FMT_YUV444P10; break;
347  case 0x01: f->pix_fmt = AV_PIX_FMT_YUV440P10; break;
348  case 0x10: f->pix_fmt = AV_PIX_FMT_YUV422P10; break;
349  case 0x11: f->pix_fmt = AV_PIX_FMT_YUV420P10; break;
350  }
351  } else if (f->avctx->bits_per_raw_sample == 10 && f->transparency) {
352  f->packed_at_lsb = 1;
353  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
354  case 0x00: f->pix_fmt = AV_PIX_FMT_YUVA444P10; break;
355  case 0x10: f->pix_fmt = AV_PIX_FMT_YUVA422P10; break;
356  case 0x11: f->pix_fmt = AV_PIX_FMT_YUVA420P10; break;
357  }
358  } else if (f->avctx->bits_per_raw_sample == 12 && !f->transparency) {
359  f->packed_at_lsb = 1;
360  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
361  case 0x00: f->pix_fmt = AV_PIX_FMT_YUV444P12; break;
362  case 0x01: f->pix_fmt = AV_PIX_FMT_YUV440P12; break;
363  case 0x10: f->pix_fmt = AV_PIX_FMT_YUV422P12; break;
364  case 0x11: f->pix_fmt = AV_PIX_FMT_YUV420P12; break;
365  }
366  } else if (f->avctx->bits_per_raw_sample == 12 && f->transparency) {
367  f->packed_at_lsb = 1;
368  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
369  case 0x00: f->pix_fmt = AV_PIX_FMT_YUVA444P12; break;
370  case 0x10: f->pix_fmt = AV_PIX_FMT_YUVA422P12; break;
371  }
372  } else if (f->avctx->bits_per_raw_sample == 14 && !f->transparency) {
373  f->packed_at_lsb = 1;
374  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
375  case 0x00: f->pix_fmt = AV_PIX_FMT_YUV444P14; break;
376  case 0x10: f->pix_fmt = AV_PIX_FMT_YUV422P14; break;
377  case 0x11: f->pix_fmt = AV_PIX_FMT_YUV420P14; break;
378  }
379  } else if (f->avctx->bits_per_raw_sample == 16 && !f->transparency){
380  f->packed_at_lsb = 1;
381  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
382  case 0x00: f->pix_fmt = AV_PIX_FMT_YUV444P16; break;
383  case 0x10: f->pix_fmt = AV_PIX_FMT_YUV422P16; break;
384  case 0x11: f->pix_fmt = AV_PIX_FMT_YUV420P16; break;
385  }
386  } else if (f->avctx->bits_per_raw_sample == 16 && f->transparency){
387  f->packed_at_lsb = 1;
388  switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
389  case 0x00: f->pix_fmt = AV_PIX_FMT_YUVA444P16; break;
390  case 0x10: f->pix_fmt = AV_PIX_FMT_YUVA422P16; break;
391  case 0x11: f->pix_fmt = AV_PIX_FMT_YUVA420P16; break;
392  }
393  }
394  } else if (f->colorspace == 1) {
395  if (f->chroma_h_shift || f->chroma_v_shift) {
396  av_log(f->avctx, AV_LOG_ERROR,
397  "chroma subsampling not supported in this colorspace\n");
398  return AVERROR(ENOSYS);
399  }
400  if ( f->avctx->bits_per_raw_sample <= 8 && !f->transparency)
401  f->pix_fmt = AV_PIX_FMT_0RGB32;
402  else if (f->avctx->bits_per_raw_sample <= 8 && f->transparency)
403  f->pix_fmt = AV_PIX_FMT_RGB32;
404  else if (f->avctx->bits_per_raw_sample == 9 && !f->transparency)
405  f->pix_fmt = AV_PIX_FMT_GBRP9;
406  else if (f->avctx->bits_per_raw_sample == 10 && !f->transparency)
407  f->pix_fmt = AV_PIX_FMT_GBRP10;
408  else if (f->avctx->bits_per_raw_sample == 10 && f->transparency)
409  f->pix_fmt = AV_PIX_FMT_GBRAP10;
410  else if (f->avctx->bits_per_raw_sample == 12 && !f->transparency)
411  f->pix_fmt = AV_PIX_FMT_GBRP12;
412  else if (f->avctx->bits_per_raw_sample == 12 && f->transparency)
413  f->pix_fmt = AV_PIX_FMT_GBRAP12;
414  else if (f->avctx->bits_per_raw_sample == 14 && !f->transparency)
415  f->pix_fmt = AV_PIX_FMT_GBRP14;
416  else if (f->avctx->bits_per_raw_sample == 14 && f->transparency)
417  f->pix_fmt = AV_PIX_FMT_GBRAP14;
418  else if (f->avctx->bits_per_raw_sample == 16 && !f->transparency) {
419  if (f->flt) {
420  f->pix_fmt = AV_PIX_FMT_GBRPF16;
421  } else
422  f->pix_fmt = AV_PIX_FMT_GBRP16;
423  f->use32bit = 1;
424  } else if (f->avctx->bits_per_raw_sample == 16 && f->transparency) {
425  if (f->flt) {
426  f->pix_fmt = AV_PIX_FMT_GBRAPF16;
427  } else
428  f->pix_fmt = AV_PIX_FMT_GBRAP16;
429  f->use32bit = 1;
430  } else if (f->avctx->bits_per_raw_sample == 32 && !f->transparency) {
431  if (f->flt) {
432  f->pix_fmt = AV_PIX_FMT_GBRPF32;
433  }
434  f->use32bit = 1;
435  } else if (f->avctx->bits_per_raw_sample == 32 && f->transparency) {
436  if (f->flt) {
437  f->pix_fmt = AV_PIX_FMT_GBRAPF32;
438  }
439  f->use32bit = 1;
440  }
441  } else if (f->colorspace == 2) {
442  if (f->avctx->bits_per_raw_sample == 16) {
443  f->pix_fmt = AV_PIX_FMT_BAYER_RGGB16;
444  f->use32bit = 1;
445  }
446  } else {
447  av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
448  return AVERROR(ENOSYS);
449  }
450  if (f->pix_fmt == AV_PIX_FMT_NONE) {
451  av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
452  return AVERROR(ENOSYS);
453  }
454 
455  return 0;
456 }
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:596
ff_ffv1_parse_header
int ff_ffv1_parse_header(FFV1Context *f, RangeCoder *c, uint8_t *state)
Definition: ffv1_parse.c:216
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:565
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
AV_PIX_FMT_YA8
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
Definition: pixfmt.h:140
ff_ffv1_read_extra_header
int ff_ffv1_read_extra_header(FFV1Context *f)
Definition: ffv1_parse.c:70
ff_ffv1_read_quant_tables
int ff_ffv1_read_quant_tables(RangeCoder *c, int16_t quant_table[MAX_CONTEXT_INPUTS][256])
Definition: ffv1_parse.c:52
state
static struct @583 state
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:588
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:595
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:590
rangecoder.h
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:539
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
AC_RANGE_CUSTOM_TAB
#define AC_RANGE_CUSTOM_TAB
Definition: ffv1.h:54
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:591
FF_DEBUG_PICT_INFO
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:1393
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:518
crc.h
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:587
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:560
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:558
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:597
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:537
AV_PIX_FMT_GRAYF16
#define AV_PIX_FMT_GRAYF16
Definition: pixfmt.h:581
MAX_SLICES
#define MAX_SLICES
Definition: d3d12va_hevc.c:33
CONTEXT_SIZE
#define CONTEXT_SIZE
Definition: ffv1.h:45
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:522
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:542
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:551
RangeCoder::one_state
uint8_t one_state[256]
Definition: rangecoder.h:41
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:562
AV_PIX_FMT_GBRAP14
#define AV_PIX_FMT_GBRAP14
Definition: pixfmt.h:564
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:563
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:552
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:594
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:536
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:550
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:521
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:519
quant_table
static const int16_t quant_table[64]
Definition: intrax8.c:511
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:561
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:541
ff_ffv1_get_symbol
int ff_ffv1_get_symbol(RangeCoder *c, uint8_t *state, int is_signed)
Definition: ffv1.c:263
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:540
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:557
AV_PIX_FMT_GBRPF16
#define AV_PIX_FMT_GBRPF16
Definition: pixfmt.h:576
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
ff_init_range_decoder
av_cold void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size)
Definition: rangecoder.c:53
f
f
Definition: af_crystalizer.c:122
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
AV_PIX_FMT_GBRPF32
#define AV_PIX_FMT_GBRPF32
Definition: pixfmt.h:578
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:544
ff_build_rac_states
void ff_build_rac_states(RangeCoder *c, int factor, int max_p)
Definition: rangecoder.c:68
AV_RB32
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:96
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:546
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:511
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
av_crc_get_table
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
Definition: crc.c:389
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:592
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:559
ffv1.h
read_quant_table
static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale)
Definition: ffv1_parse.c:25
len
int len
Definition: vorbis_enc_data.h:426
get_rac
static int get_rac(RangeCoder *c, uint8_t *const state)
Definition: rangecoder.h:118
AV_CRC_32_IEEE
@ AV_CRC_32_IEEE
Definition: crc.h:52
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:538
MAX_CONTEXT_INPUTS
#define MAX_CONTEXT_INPUTS
Definition: ffv1.h:50
AV_PIX_FMT_YAF16
#define AV_PIX_FMT_YAF16
Definition: pixfmt.h:584
ret
ret
Definition: filter_design.txt:187
pred
static const float pred[4]
Definition: siprdata.h:259
AV_PIX_FMT_0RGB32
#define AV_PIX_FMT_0RGB32
Definition: pixfmt.h:515
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:589
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:543
U
#define U(x)
Definition: vpx_arith.h:37
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:548
ff_ffv1_allocate_initial_states
int ff_ffv1_allocate_initial_states(FFV1Context *f)
Definition: ffv1.c:185
av_crc
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
Definition: crc.c:421
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:593
AV_PIX_FMT_GBRAPF32
#define AV_PIX_FMT_GBRAPF32
Definition: pixfmt.h:579
AV_PIX_FMT_GBRAPF16
#define AV_PIX_FMT_GBRAPF16
Definition: pixfmt.h:577
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
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:77
mem.h
MAX_QUANT_TABLES
#define MAX_QUANT_TABLES
Definition: ffv1.h:47
FFV1Context
Definition: ffv1.h:122
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: intra.c:278
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:545
RangeCoder
Definition: mss3.c:63
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:549
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:520
AV_PIX_FMT_BAYER_RGGB16
#define AV_PIX_FMT_BAYER_RGGB16
Definition: pixfmt.h:572
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:547