45 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
46 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
47 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
48 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
49 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
50 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
51 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
52 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
53 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
54 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
55 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
56 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
57 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1,
58 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
59 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
60 -1, -1, -1, -1, -1, -1, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0,
64 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
65 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
66 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
67 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
68 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
69 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
70 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
71 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
72 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
73 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
74 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
75 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
76 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
77 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
78 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
79 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1,
83 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
84 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
85 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
86 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
87 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
88 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
89 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
90 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
91 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
92 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
93 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
94 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
95 -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3,
96 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
97 -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
98 -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -0, -0, -0, -0,
102 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
103 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
104 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
105 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
106 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
107 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
108 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
109 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
110 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
111 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
112 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
113 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
114 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
115 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -4, -4,
116 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
117 -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -1,
121 0, 10, 10, 10, 10, 16, 16, 16, 28, 16, 16, 29, 42, 49, 20, 49,
122 59, 25, 26, 26, 27, 31, 33, 33, 33, 34, 34, 37, 67, 38, 39, 39,
123 40, 40, 41, 79, 43, 44, 45, 45, 48, 48, 64, 50, 51, 52, 88, 52,
124 53, 74, 55, 57, 58, 58, 74, 60, 101, 61, 62, 84, 66, 66, 68, 69,
125 87, 82, 71, 97, 73, 73, 82, 75, 111, 77, 94, 78, 87, 81, 83, 97,
126 85, 83, 94, 86, 99, 89, 90, 99, 111, 92, 93, 134, 95, 98, 105, 98,
127 105, 110, 102, 108, 102, 118, 103, 106, 106, 113, 109, 112, 114, 112, 116, 125,
128 115, 116, 117, 117, 126, 119, 125, 121, 121, 123, 145, 124, 126, 131, 127, 129,
129 165, 130, 132, 138, 133, 135, 145, 136, 137, 139, 146, 141, 143, 142, 144, 148,
130 147, 155, 151, 149, 151, 150, 152, 157, 153, 154, 156, 168, 158, 162, 161, 160,
131 172, 163, 169, 164, 166, 184, 167, 170, 177, 174, 171, 173, 182, 176, 180, 178,
132 175, 189, 179, 181, 186, 183, 192, 185, 200, 187, 191, 188, 190, 197, 193, 196,
133 197, 194, 195, 196, 198, 202, 199, 201, 210, 203, 207, 204, 205, 206, 208, 214,
134 209, 211, 221, 212, 213, 215, 224, 216, 217, 218, 219, 220, 222, 228, 223, 225,
135 226, 224, 227, 229, 240, 230, 231, 232, 233, 234, 235, 236, 238, 239, 237, 242,
136 241, 243, 242, 244, 245, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255,
145 for (i = 1; i < 256; i++)
146 l2tab[i] =
log2(i / 256.0);
148 for (i = 0; i < 256; i++) {
149 double best_len[256];
150 double p = i / 256.0;
152 for (j = 0; j < 256; j++)
153 best_len[j] = 1 << 30;
155 for (j =
FFMAX(i - 10, 1); j <
FFMIN(i + 11, 256); j++) {
156 double occ[256] = { 0 };
163 for (k = 0; k < 256; k++) {
164 double newocc[256] = { 0 };
165 for (m = 1; m < 256; m++)
167 len -=occ[m]*( p *l2tab[ m]
168 + (1-p)*l2tab[256-m]);
170 if (len < best_len[k]) {
172 best_state[i][k] = j;
174 for (m = 1; m < 256; m++)
176 newocc[ one_state[ m]] += occ[m] * p;
177 newocc[256 - one_state[256 - m]] += occ[m] * (1 - p);
179 memcpy(occ, newocc,
sizeof(occ));
193 #define put_rac(C, S, B) \
196 rc_stat[*(S)][B]++; \
197 rc_stat2[(S) - state][B]++; \
207 for (i = 0; i < e; i++)
211 for (i = e - 1; i >= 0; i--)
212 put_rac(c, state + 22 + i, (a >> i) & 1);
215 put_rac(c, state + 11 + e, v < 0);
217 for (i = 0; i < e; i++)
221 for (i = e - 1; i >= 0; i--)
225 put_rac(c, state + 11 + 10, v < 0);
234 int v,
int is_signed)
248 while (i < state->error_sum) {
255 code = v ^ ((2 * state->
drift + state->
count) >> 31);
257 ff_dlog(
NULL,
"v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code,
265 #define RENAME(name) name
271 #define RENAME(name) name ## 32
275 int stride,
int plane_index,
int pixel_stride)
284 for (y = 0; y <
h; y++) {
286 sample[i] = s->
sample_buffer + (w + 6) * ((h + i - y) % ring_size) + 3;
288 sample[0][-1]= sample[1][0 ];
289 sample[1][
w]= sample[1][w-1];
292 for (x = 0; x <
w; x++)
293 sample[0][x] = src[x * pixel_stride + stride * y];
294 if((ret = encode_line(s, w, sample, plane_index, 8)) < 0)
298 for (x = 0; x <
w; x++) {
299 sample[0][x] = ((uint16_t*)(src + stride*y))[x];
302 for (x = 0; x <
w; x++) {
319 memset(state, 128,
sizeof(state));
321 for (i = 1; i < 128; i++)
322 if (quant_table[i] != quant_table[i - 1]) {
333 for (i = 0; i < 5; i++)
343 memset(state, 128,
sizeof(state));
349 for (i = 1; i < 256; i++)
392 memset(state2, 128,
sizeof(state2));
393 memset(state, 128,
sizeof(state));
396 (11 * 11 * 5 * 5 * 5 + 11 * 11 * 11) * 32;
414 for (i = 1; i < 256; i++)
462 int i, i2, changed,
print = 0;
466 for (i = 12; i < 244; i++) {
467 for (i2 = i + 1; i2 < 245 && i2 < i + 4; i2++) {
469 #define COST(old, new) \
470 s->rc_stat[old][0] * -log2((256 - (new)) / 256.0) + \
471 s->rc_stat[old][1] * -log2((new) / 256.0)
473 #define COST2(old, new) \
474 COST(old, new) + COST(256 - (old), 256 - (new))
478 if (size0 - sizeX > size0*(1e-14) && i != 128 && i2 != 128) {
480 FFSWAP(
int, stt[i], stt[i2]);
484 FFSWAP(
int, stt[256 - i], stt[256 - i2]);
488 for (j = 1; j < 256; j++) {
491 else if (stt[j] == i2)
494 if (stt[256 - j] == 256 - i)
495 stt[256 - j] = 256 - i2;
496 else if (stt[256 - j] == 256 - i2)
497 stt[256 - j] = 256 - i;
547 av_log(avctx,
AV_LOG_ERROR,
"Version 2 needed for requested features but version 2 is experimental and not enabled\n");
551 #if FF_API_CODER_TYPE
696 "bits_per_raw_sample > 8, forcing range coder\n");
700 #if FF_API_PRIVATE_OPT
712 for (i = 1; i < 256; i++)
717 for (i = 1; i < 256; i++)
721 for (i = 0; i < 256; i++) {
759 #if FF_API_CODED_FRAME
795 for (j = 0; j < 256; j++)
796 for (i = 0; i < 2; i++) {
797 s->
rc_stat[j][i] = strtol(p, &next, 0);
800 "2Pass file invalid at %d %d [%s]\n", j, i, p);
808 for (k = 0; k < 32; k++)
809 for (m = 0; m < 2; m++) {
810 s->
rc_stat2[i][j][k][m] = strtol(p, &next, 0);
813 "2Pass file invalid at %d %d %d %d [%s]\n",
821 gob_count = strtol(p, &next, 0);
822 if (next == p || gob_count <= 0) {
828 while (*p ==
'\n' || *p ==
' ')
839 for (k = 0; k < 32; k++) {
846 p = 256.0 *
b / (a +
b);
848 best_state[av_clip(
round(p), 1, 255)][av_clip_uint8((a +
b) / gob_count)];
849 for(jp++; jp<j; jp++)
856 p = 256.0 *
b / (a +
b);
859 best_state[av_clip(
round(p), 1, 255)][av_clip_uint8((a +
b) / gob_count)];
887 "Unsupported number %d of slices requested, please specify a "
888 "supported number with -slices (ex:4,6,9,12,16, ...)\n",
902 #define STATS_OUT_SIZE 1024 * 1024 * 6
926 memset(state, 128,
sizeof(state));
956 #define NB_Y_COEFF 15
957 static const int rct_y_coeff[15][2] = {
977 int x, y, i, p, best;
981 for (y = 0; y <
h; y++) {
982 int lastr=0, lastg=0, lastb=0;
983 for (p = 0; p < 3; p++)
986 for (x = 0; x <
w; x++) {
990 unsigned v = *((
const uint32_t*)(src[0] + x*4 + stride[0]*y));
993 r = (v >> 16) & 0xFF;
995 b = *((
const uint16_t*)(src[0] + x*2 + stride[0]*y));
996 g = *((
const uint16_t*)(src[1] + x*2 + stride[1]*y));
997 r = *((
const uint16_t*)(src[2] + x*2 + stride[2]*y));
1004 int bg = ag - sample[0][x];
1005 int bb = ab - sample[1][x];
1006 int br = ar - sample[2][x];
1012 stat[i] +=
FFABS(bg + ((br*rct_y_coeff[i][0] + bb*rct_y_coeff[i][1])>>2));
1028 if (stat[i] < stat[best])
1079 const int cx = x >>
f->chroma_h_shift;
1080 const int cy = y >>
f->chroma_v_shift;
1084 if (
f->chroma_planes) {
1085 ret |=
encode_plane(
fs, p->data[1] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1, 1);
1086 ret |=
encode_plane(
fs, p->data[2] + ps*cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1, 1);
1088 if (
fs->transparency)
1093 }
else if (
f->use32bit) {
1102 if (
fs->version < 4 || !
fs->ac) {
1107 fs->slice_coding_mode = 1;
1116 const AVFrame *pict,
int *got_packet)
1140 for (i = 0; i < 256; i++) {
1146 for (m = 0; m < 32; m++) {
1153 for (j = 0; j < 256; j++) {
1154 snprintf(p, end - p,
"%" PRIu64
" %" PRIu64
" ",
1162 for (m = 0; m < 32; m++) {
1163 snprintf(p, end - p,
"%" PRIu64
" %" PRIu64
" ",
1177 av_log(avctx,
AV_LOG_WARNING,
"Cannot allocate worst case packet size, the encoding could fail\n");
1190 #if FF_API_CODED_FRAME
1208 for (i = 1; i < 256; i++) {
1242 if (i > 0 || f->
version > 2) {
1246 AV_WB24(buf_p + bytes, bytes);
1262 #if FF_API_CODED_FRAME
1284 #define OFFSET(x) offsetof(FFV1Context, x)
1285 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1289 { .i64 = 0 }, -2, 2,
VE,
"coder" },
1296 {
"ac",
"Range with custom table (the ac option exists for compatibility and is deprecated)", 0,
AV_OPT_TYPE_CONST,
1297 { .i64 = 1 }, INT_MIN, INT_MAX,
VE,
"coder" },
1299 { .i64 = 0 }, 0, 1,
VE },
1311 #if FF_API_CODER_TYPE
1351 #if FF_API_CODER_TYPE
static av_always_inline int fold(int diff, int bits)
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
static const AVCodecDefault ffv1_defaults[]
#define AV_PIX_FMT_YUVA422P16
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUVA422P9
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
static void encode_slice_header(FFV1Context *f, FFV1Context *fs)
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUV444P14
8 bits gray, 8 bits alpha
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA422P10
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#define AV_LOG_WARNING
Something somehow does not look correct.
int16_t quant_table[MAX_CONTEXT_INPUTS][256]
#define LIBAVUTIL_VERSION_INT
static av_cold int init(AVCodecContext *avctx)
#define AV_PIX_FMT_RGBA64
#define MAX_CONTEXT_INPUTS
#define AV_PIX_FMT_GBRP10
const char * av_default_item_name(void *ptr)
Return the context name.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_PIX_FMT_YUV420P12
char * stats_in
pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed he...
static av_always_inline av_flatten void put_symbol_inline(RangeCoder *c, uint8_t *state, int v, int is_signed, uint64_t rc_stat[256][2], uint64_t rc_stat2[32][2])
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static int ring_size(RingBuffer *ring)
uint64_t(*[MAX_QUANT_TABLES] rc_stat2)[32][2]
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
FF Video Codec 1 (a lossless codec)
Macro definitions for various function/variable attributes.
#define AV_PIX_FMT_GRAY10
int ff_rac_terminate(RangeCoder *c)
static void write_quant_tables(RangeCoder *c, int16_t quant_table[MAX_CONTEXT_INPUTS][256])
#define AV_PIX_FMT_GRAY12
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
static av_noinline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define fs(width, name, subs,...)
static av_cold int end(AVCodecContext *avctx)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
av_cold int ff_ffv1_common_init(AVCodecContext *avctx)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static av_cold int encode_init(AVCodecContext *avctx)
#define AV_PIX_FMT_YUVA420P9
static const int8_t quant11[256]
uint8_t(*[MAX_QUANT_TABLES] initial_states)[32]
Public header for CRC hash function implementation.
av_cold int ff_ffv1_close(AVCodecContext *avctx)
attribute_deprecated int context_model
static int encode_slice(AVCodecContext *c, void *arg)
static void choose_rct_params(FFV1Context *fs, const uint8_t *src[3], const int stride[3], int w, int h)
#define AV_PIX_FMT_YUV444P16
int interlaced_frame
The content of the picture is interlaced.
#define AV_PIX_FMT_YUV422P12
char * stats_out
pass1 encoding statistics output buffer
#define AV_PIX_FMT_YUVA420P16
high precision timer, useful to profile code
#define AV_INPUT_BUFFER_MIN_SIZE
minimum encoding buffer size Used to avoid some checks during header writing.
static int write_extradata(FFV1Context *f)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int sort_stt(FFV1Context *s, uint8_t stt[256])
static const uint8_t ver2_state[256]
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
av_cold int ff_ffv1_init_slices_state(FFV1Context *f)
int16_t quant_tables[MAX_QUANT_TABLES][MAX_CONTEXT_INPUTS][256]
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_PIX_FMT_YUVA444P16
int flags
AV_CODEC_FLAG_*.
#define AV_PIX_FMT_GBRAP12
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
static av_always_inline av_const double round(double x)
static const int8_t quant5[256]
#define AV_PIX_FMT_YUV444P10
int ff_ffv1_allocate_initial_states(FFV1Context *f)
#define AV_PIX_FMT_GBRAP16
int flags
A combination of AV_PKT_FLAG values.
static int put_bits_count(PutBitContext *s)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int ac
1=range coder <-> 0=golomb rice
int16_t quant_table[MAX_CONTEXT_INPUTS][256]
#define AC_RANGE_CUSTOM_TAB
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
#define AV_PIX_FMT_YUV422P9
static const struct @304 planes[]
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
static av_cold int encode_close(AVCodecContext *avctx)
uint8_t state_transition[256]
uint8_t nb_components
The number of components each pixel has, (1-4)
enum AVPictureType pict_type
Picture type of the frame.
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GRAY16
int width
picture width / height.
static float quant_table[96]
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
static void update_vlc_state(VlcState *const state, const int v)
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
void ff_build_rac_states(RangeCoder *c, int factor, int max_p)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
#define AV_PIX_FMT_YUVA444P10
int ac_byte_count
number of bytes used for AC coding
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_GBRP14
attribute_deprecated int coder_type
static const AVOption options[]
static const float pred[4]
#define AV_PIX_FMT_YUV420P16
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
#define AV_LOG_INFO
Standard information.
#define AV_PIX_FMT_YUV420P14
int context_count[MAX_QUANT_TABLES]
static const int8_t quant9_10bit[256]
Libavcodec external API header.
#define AC_RANGE_DEFAULT_TAB_FORCE
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
static void find_best_state(uint8_t best_state[256][256], const uint8_t one_state[256])
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static void write_quant_table(RangeCoder *c, int16_t *quant_table)
Describe the class of an AVClass context structure.
av_cold void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size)
static void put_vlc_symbol(PutBitContext *pb, VlcState *const state, int v, int bits)
static int encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index, int pixel_stride)
static void set_sr_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len)
write signed golomb rice code (ffv1).
#define AV_PIX_FMT_YUV440P12
#define AC_RANGE_DEFAULT_TAB
static const AVClass ffv1_class
#define AV_PIX_FMT_YUV420P9
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GBRP12
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
GLint GLenum GLboolean GLsizei stride
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static const int8_t quant5_10bit[256]
void ff_ffv1_clear_slice_state(FFV1Context *f, FFV1Context *fs)
#define AV_PIX_FMT_YUVA444P9
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
uint8_t * bytestream_start
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
int slices
Number of slices.
PlaneContext plane[MAX_PLANES]
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.
#define FF_ENABLE_DEPRECATION_WARNINGS
int top_field_first
If the content is interlaced, is top field displayed first.
int key_frame
1 -> keyframe, 0-> not
static void write_header(FFV1Context *f)
struct FFV1Context * slice_context[MAX_SLICES]
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
#define av_malloc_array(a, b)
#define FFSWAP(type, a, b)
AVPixelFormat
Pixel format.
This structure stores compressed data.
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
static void print(AVTreeNode *t, int depth)
#define AV_PIX_FMT_YUV422P16
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int step
Number of elements between 2 horizontally consecutive pixels.
#define AV_PIX_FMT_0RGB32
#define AV_CEIL_RSHIFT(a, b)