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++)
115 f->plane_count = 1 + (
f->chroma_planes ||
f->version<4) +
f->transparency;
119 if (
f->chroma_h_shift > 4
U ||
f->chroma_v_shift > 4
U) {
121 f->chroma_h_shift,
f->chroma_v_shift);
125 if (
f->num_h_slices > (
unsigned)
f->width || !
f->num_h_slices ||
126 f->num_v_slices > (
unsigned)
f->height || !
f->num_v_slices
140 f->quant_table_count = 0;
144 for (
int i = 0;
i <
f->quant_table_count;
i++) {
146 if (
f->context_count[
i] < 0) {
154 for (
int i = 0;
i <
f->quant_table_count;
i++)
156 for (
int j = 0; j <
f->context_count[
i]; j++)
158 int pred = j ?
f->initial_states[
i][j - 1][k] : 128;
159 f->initial_states[
i][j][k] =
164 if (
f->version > 2) {
167 f->crcref = 0x7a8c4079;
168 if (
f->combined_version >= 0x30003)
172 if (
f->version > 2) {
175 f->avctx->extradata,
f->avctx->extradata_size);
176 if (v !=
f->crcref ||
f->avctx->extradata_size < 4) {
180 crc =
AV_RB32(
f->avctx->extradata +
f->avctx->extradata_size - 4);
185 "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",
186 f->version,
f->micro_version,
189 f->avctx->bits_per_raw_sample,
190 f->chroma_planes,
f->chroma_h_shift,
f->chroma_v_shift,
192 f->num_h_slices,
f->num_v_slices,
193 f->quant_table_count,
203 if (
f->version < 2) {
204 int chroma_planes, chroma_h_shift, chroma_v_shift, transparency, colorspace, bits_per_raw_sample;
214 for (
int i = 1;
i < 256;
i++) {
216 if (st < 1 || st > 255) {
220 f->state_transition[
i] = st;
230 if (colorspace == 0 &&
f->avctx->skip_alpha)
233 if (
f->plane_count) {
234 if (colorspace !=
f->colorspace ||
235 bits_per_raw_sample !=
f->avctx->bits_per_raw_sample ||
236 chroma_planes !=
f->chroma_planes ||
237 chroma_h_shift !=
f->chroma_h_shift ||
238 chroma_v_shift !=
f->chroma_v_shift ||
239 transparency !=
f->transparency) {
245 if (chroma_h_shift > 4
U || chroma_v_shift > 4
U) {
247 chroma_h_shift, chroma_v_shift);
251 f->colorspace = colorspace;
252 f->avctx->bits_per_raw_sample = bits_per_raw_sample;
253 f->chroma_planes = chroma_planes;
254 f->chroma_h_shift = chroma_h_shift;
255 f->chroma_v_shift = chroma_v_shift;
256 f->transparency = transparency;
258 f->plane_count = 2 +
f->transparency;
261 if (
f->colorspace == 0) {
262 if (!
f->transparency && !
f->chroma_planes) {
263 if (
f->avctx->bits_per_raw_sample <= 8)
265 else if (
f->avctx->bits_per_raw_sample == 9) {
266 f->packed_at_lsb = 1;
268 }
else if (
f->avctx->bits_per_raw_sample == 10) {
269 f->packed_at_lsb = 1;
271 }
else if (
f->avctx->bits_per_raw_sample == 12) {
272 f->packed_at_lsb = 1;
274 }
else if (
f->avctx->bits_per_raw_sample == 14) {
275 f->packed_at_lsb = 1;
277 }
else if (
f->avctx->bits_per_raw_sample == 16) {
278 f->packed_at_lsb = 1;
280 }
else if (
f->avctx->bits_per_raw_sample < 16) {
284 }
else if (
f->transparency && !
f->chroma_planes) {
285 if (
f->avctx->bits_per_raw_sample <= 8)
289 }
else if (
f->avctx->bits_per_raw_sample<=8 && !
f->transparency) {
290 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
298 }
else if (
f->avctx->bits_per_raw_sample <= 8 &&
f->transparency) {
299 switch(16*
f->chroma_h_shift +
f->chroma_v_shift) {
304 }
else if (
f->avctx->bits_per_raw_sample == 9 && !
f->transparency) {
305 f->packed_at_lsb = 1;
306 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
311 }
else if (
f->avctx->bits_per_raw_sample == 9 &&
f->transparency) {
312 f->packed_at_lsb = 1;
313 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
318 }
else if (
f->avctx->bits_per_raw_sample == 10 && !
f->transparency) {
319 f->packed_at_lsb = 1;
320 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
326 }
else if (
f->avctx->bits_per_raw_sample == 10 &&
f->transparency) {
327 f->packed_at_lsb = 1;
328 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
333 }
else if (
f->avctx->bits_per_raw_sample == 12 && !
f->transparency) {
334 f->packed_at_lsb = 1;
335 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
341 }
else if (
f->avctx->bits_per_raw_sample == 12 &&
f->transparency) {
342 f->packed_at_lsb = 1;
343 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
347 }
else if (
f->avctx->bits_per_raw_sample == 14 && !
f->transparency) {
348 f->packed_at_lsb = 1;
349 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
354 }
else if (
f->avctx->bits_per_raw_sample == 16 && !
f->transparency){
355 f->packed_at_lsb = 1;
356 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
361 }
else if (
f->avctx->bits_per_raw_sample == 16 &&
f->transparency){
362 f->packed_at_lsb = 1;
363 switch(16 *
f->chroma_h_shift +
f->chroma_v_shift) {
369 }
else if (
f->colorspace == 1) {
370 if (
f->chroma_h_shift ||
f->chroma_v_shift) {
372 "chroma subsampling not supported in this colorspace\n");
375 if (
f->avctx->bits_per_raw_sample <= 8 && !
f->transparency)
377 else if (
f->avctx->bits_per_raw_sample <= 8 &&
f->transparency)
379 else if (
f->avctx->bits_per_raw_sample == 9 && !
f->transparency)
381 else if (
f->avctx->bits_per_raw_sample == 10 && !
f->transparency)
383 else if (
f->avctx->bits_per_raw_sample == 10 &&
f->transparency)
385 else if (
f->avctx->bits_per_raw_sample == 12 && !
f->transparency)
387 else if (
f->avctx->bits_per_raw_sample == 12 &&
f->transparency)
389 else if (
f->avctx->bits_per_raw_sample == 14 && !
f->transparency)
391 else if (
f->avctx->bits_per_raw_sample == 14 &&
f->transparency)
393 else if (
f->avctx->bits_per_raw_sample == 16 && !
f->transparency) {
396 }
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