Go to the documentation of this file.
33 for (v = 0;
i < 128; v++) {
45 for (
i = 1;
i < 128;
i++)
56 int context_count = 1;
58 for (
i = 0;
i < 5;
i++) {
63 if (context_count > 32768
U) {
67 return (context_count + 1) / 2;
78 memset(state2, 128,
sizeof(state2));
94 f->combined_version =
f->version << 16;
96 c.bytestream_end -= 4;
98 if (
f->micro_version < 0 ||
f->micro_version > 65535)
100 f->combined_version +=
f->micro_version;
105 for (
int i = 1;
i < 256;
i++)
110 for (
int i = 1;
i < 256;
i++)
120 f->plane_count = 1 + (
f->chroma_planes ||
f->version<4) +
f->transparency;
124 if (
f->chroma_h_shift > 4
U ||
f->chroma_v_shift > 4
U) {
126 f->chroma_h_shift,
f->chroma_v_shift);
130 if (
f->num_h_slices > (
unsigned)
f->width || !
f->num_h_slices ||
131 f->num_v_slices > (
unsigned)
f->height || !
f->num_v_slices
145 f->quant_table_count = 0;
149 for (
int i = 0;
i <
f->quant_table_count;
i++) {
151 if (
f->context_count[
i] < 0) {
159 for (
int i = 0;
i <
f->quant_table_count;
i++)
161 for (
int j = 0; j <
f->context_count[
i]; j++)
163 int pred = j ?
f->initial_states[
i][j - 1][k] : 128;
164 f->initial_states[
i][j][k] =
169 if (
f->version > 2) {
172 f->crcref = 0x7a8c4079;
173 if (
f->combined_version >= 0x30003)
177 if (
f->version > 2) {
180 f->avctx->extradata,
f->avctx->extradata_size);
181 if (v !=
f->crcref ||
f->avctx->extradata_size < 4) {
185 crc =
AV_RB32(
f->avctx->extradata +
f->avctx->extradata_size - 4);
190 "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",
191 f->version,
f->micro_version,
194 f->avctx->bits_per_raw_sample,
195 f->chroma_planes,
f->chroma_h_shift,
f->chroma_v_shift,
197 f->num_h_slices,
f->num_v_slices,
198 f->quant_table_count,
208 if (
f->version < 2) {
209 int chroma_planes, chroma_h_shift, chroma_v_shift, transparency, colorspace, bits_per_raw_sample;
219 for (
int i = 1;
i < 256;
i++) {
221 if (st < 1 || st > 255) {
225 f->state_transition[
i] = st;
230 for (
int i = 1;
i < 256;
i++)
240 if (colorspace == 0 &&
f->avctx->skip_alpha)
243 if (
f->plane_count) {
244 if (colorspace !=
f->colorspace ||
245 bits_per_raw_sample !=
f->avctx->bits_per_raw_sample ||
246 chroma_planes !=
f->chroma_planes ||
247 chroma_h_shift !=
f->chroma_h_shift ||
248 chroma_v_shift !=
f->chroma_v_shift ||
249 transparency !=
f->transparency) {
255 if (chroma_h_shift > 4
U || chroma_v_shift > 4
U) {
257 chroma_h_shift, chroma_v_shift);
261 f->colorspace = colorspace;
262 f->avctx->bits_per_raw_sample = bits_per_raw_sample;
263 f->chroma_planes = chroma_planes;
264 f->chroma_h_shift = chroma_h_shift;
265 f->chroma_v_shift = chroma_v_shift;
266 f->transparency = transparency;
268 f->plane_count = 2 +
f->transparency;
271 if (
f->colorspace == 0) {
272 if (!
f->transparency && !
f->chroma_planes) {
273 if (
f->avctx->bits_per_raw_sample <= 8)
275 else if (
f->avctx->bits_per_raw_sample == 9) {
276 f->packed_at_lsb = 1;
278 }
else if (
f->avctx->bits_per_raw_sample == 10) {
279 f->packed_at_lsb = 1;
281 }
else if (
f->avctx->bits_per_raw_sample == 12) {
282 f->packed_at_lsb = 1;
284 }
else if (
f->avctx->bits_per_raw_sample == 14) {
285 f->packed_at_lsb = 1;
287 }
else if (
f->avctx->bits_per_raw_sample == 16) {
288 f->packed_at_lsb = 1;
290 }
else if (
f->avctx->bits_per_raw_sample < 16) {
294 }
else if (
f->transparency && !
f->chroma_planes) {
295 if (
f->avctx->bits_per_raw_sample <= 8)
299 }
else if (
f->avctx->bits_per_raw_sample<=8 && !
f->transparency) {
300 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
308 }
else if (
f->avctx->bits_per_raw_sample <= 8 &&
f->transparency) {
309 switch(16*
f->chroma_h_shift +
f->chroma_v_shift) {
314 }
else if (
f->avctx->bits_per_raw_sample == 9 && !
f->transparency) {
315 f->packed_at_lsb = 1;
316 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
321 }
else if (
f->avctx->bits_per_raw_sample == 9 &&
f->transparency) {
322 f->packed_at_lsb = 1;
323 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
328 }
else if (
f->avctx->bits_per_raw_sample == 10 && !
f->transparency) {
329 f->packed_at_lsb = 1;
330 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
336 }
else if (
f->avctx->bits_per_raw_sample == 10 &&
f->transparency) {
337 f->packed_at_lsb = 1;
338 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
343 }
else if (
f->avctx->bits_per_raw_sample == 12 && !
f->transparency) {
344 f->packed_at_lsb = 1;
345 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
351 }
else if (
f->avctx->bits_per_raw_sample == 12 &&
f->transparency) {
352 f->packed_at_lsb = 1;
353 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
357 }
else if (
f->avctx->bits_per_raw_sample == 14 && !
f->transparency) {
358 f->packed_at_lsb = 1;
359 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
364 }
else if (
f->avctx->bits_per_raw_sample == 16 && !
f->transparency){
365 f->packed_at_lsb = 1;
366 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
371 }
else if (
f->avctx->bits_per_raw_sample == 16 &&
f->transparency){
372 f->packed_at_lsb = 1;
373 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
379 }
else if (
f->colorspace == 1) {
380 if (
f->chroma_h_shift ||
f->chroma_v_shift) {
382 "chroma subsampling not supported in this colorspace\n");
385 if (
f->avctx->bits_per_raw_sample <= 8 && !
f->transparency)
387 else if (
f->avctx->bits_per_raw_sample <= 8 &&
f->transparency)
389 else if (
f->avctx->bits_per_raw_sample == 9 && !
f->transparency)
391 else if (
f->avctx->bits_per_raw_sample == 10 && !
f->transparency)
393 else if (
f->avctx->bits_per_raw_sample == 10 &&
f->transparency)
395 else if (
f->avctx->bits_per_raw_sample == 12 && !
f->transparency)
397 else if (
f->avctx->bits_per_raw_sample == 12 &&
f->transparency)
399 else if (
f->avctx->bits_per_raw_sample == 14 && !
f->transparency)
401 else if (
f->avctx->bits_per_raw_sample == 14 &&
f->transparency)
403 else if (
f->avctx->bits_per_raw_sample == 16 && !
f->transparency) {
406 }
else if (
f->avctx->bits_per_raw_sample == 16 &&
f->transparency) {
#define AV_PIX_FMT_YUVA422P16
int ff_ffv1_parse_header(FFV1Context *f, RangeCoder *c, uint8_t *state)
#define AV_PIX_FMT_GBRAP16
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
8 bits gray, 8 bits alpha
int ff_ffv1_read_extra_header(FFV1Context *f)
int ff_ffv1_read_quant_tables(RangeCoder *c, int16_t quant_table[MAX_CONTEXT_INPUTS][256])
#define AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUV420P10
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
#define AC_RANGE_CUSTOM_TAB
#define AV_PIX_FMT_YUVA422P10
#define FF_DEBUG_PICT_INFO
#define AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_YUV444P10
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP14
#define AV_PIX_FMT_GBRAP12
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUV420P9
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_GRAY14
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define AV_PIX_FMT_GRAY10
static const int16_t quant_table[64]
#define AV_PIX_FMT_GBRP16
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AV_PIX_FMT_YUV440P10
int ff_ffv1_get_symbol(RangeCoder *c, uint8_t *state, int is_signed)
#define AV_PIX_FMT_YUV422P10
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
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
av_cold void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size)
#define AV_PIX_FMT_YUV422P12
void ff_build_rac_states(RangeCoder *c, int factor, int max_p)
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
#define AV_PIX_FMT_YUV444P12
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
#define AV_PIX_FMT_YUVA444P10
#define i(width, name, range_min, range_max)
#define AV_PIX_FMT_GBRP12
static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale)
static int get_rac(RangeCoder *c, uint8_t *const state)
#define AV_PIX_FMT_YUV444P9
#define MAX_CONTEXT_INPUTS
static const float pred[4]
#define AV_PIX_FMT_0RGB32
#define AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P14
int ff_ffv1_allocate_initial_states(FFV1Context *f)
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
#define AV_PIX_FMT_YUVA422P12
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static void scale(int *out, const int *in, const int w, const int h, const int shift)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_GRAY12
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_PIX_FMT_YUV420P14