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--)
217 for (
i = 0;
i < e;
i++)
221 for (
i = e - 1;
i >= 0;
i--)
234 int v,
int is_signed)
248 while (i < state->error_sum) {
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)
278 const int ring_size =
s->context_model ? 3 : 2;
282 memset(
s->sample_buffer, 0,
ring_size * (
w + 6) *
sizeof(*
s->sample_buffer));
284 for (y = 0; y <
h; y++) {
291 if (
s->bits_per_raw_sample <= 8) {
292 for (x = 0; x <
w; x++)
294 if((
ret = encode_line(
s,
w,
sample, plane_index, 8)) < 0)
297 if (
s->packed_at_lsb) {
298 for (x = 0; x <
w; x++) {
302 for (x = 0; x <
w; x++) {
303 sample[0][x] = ((uint16_t*)(
src +
stride*y))[x] >> (16 -
s->bits_per_raw_sample);
306 if((
ret = encode_line(
s,
w,
sample, plane_index,
s->bits_per_raw_sample)) < 0)
321 for (
i = 1;
i < 128;
i++)
333 for (
i = 0;
i < 5;
i++)
345 if (
f->version < 2) {
349 for (
i = 1;
i < 256;
i++)
351 f->state_transition[
i] -
c->one_state[
i], 1);
362 }
else if (
f->version < 3) {
364 for (
i = 0;
i <
f->slice_count;
i++) {
367 (
fs->slice_x + 1) *
f->num_h_slices /
f->width, 0);
369 (
fs->slice_y + 1) *
f->num_v_slices /
f->height, 0);
371 (
fs->slice_width + 1) *
f->num_h_slices /
f->width - 1,
374 (
fs->slice_height + 1) *
f->num_v_slices /
f->height - 1,
376 for (j = 0; j <
f->plane_count; j++) {
378 av_assert0(
f->plane[j].quant_table_index ==
f->context_model);
392 memset(state2, 128,
sizeof(state2));
395 f->avctx->extradata_size = 10000 + 4 +
396 (11 * 11 * 5 * 5 * 5 + 11 * 11 * 11) * 32;
398 if (!
f->avctx->extradata)
404 if (
f->version > 2) {
405 if (
f->version == 3) {
406 f->micro_version = 4;
407 }
else if (
f->version == 4)
408 f->micro_version = 2;
414 for (
i = 1;
i < 256;
i++)
427 for (
i = 0;
i <
f->quant_table_count;
i++)
430 for (
i = 0;
i <
f->quant_table_count;
i++) {
432 if (
f->initial_states[
i] &&
f->initial_states[
i][0][j] != 128)
436 for (j = 0; j <
f->context_count[
i]; j++)
438 int pred = j ?
f->initial_states[
i][j - 1][k] : 128;
440 (int8_t)(
f->initial_states[
i][j][k] -
pred), 1);
447 if (
f->version > 2) {
454 AV_WL32(
f->avctx->extradata +
f->avctx->extradata_size, v);
455 f->avctx->extradata_size += 4;
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) {
481 FFSWAP(
int,
s->rc_stat[
i][0],
s->rc_stat[i2][0]);
482 FFSWAP(
int,
s->rc_stat[
i][1],
s->rc_stat[i2][1]);
484 FFSWAP(
int, stt[256 -
i], stt[256 - i2]);
485 FFSWAP(
int,
s->rc_stat[256 -
i][0],
s->rc_stat[256 - i2][0]);
486 FFSWAP(
int,
s->rc_stat[256 -
i][1],
s->rc_stat[256 - i2][1]);
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;
521 s->version =
FFMAX(
s->version, 2);
525 s->version =
FFMAX(
s->version, 2);
539 s->ec = (
s->version >= 3);
544 s->version =
FFMAX(
s->version, 3);
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
573 s->bits_per_raw_sample = 9;
583 s->bits_per_raw_sample = 10;
590 s->bits_per_raw_sample = 12;
595 s->bits_per_raw_sample = 14;
596 s->packed_at_lsb = 1;
605 s->bits_per_raw_sample = 16;
606 }
else if (!
s->bits_per_raw_sample) {
609 if (
s->bits_per_raw_sample <= 8) {
613 s->version =
FFMAX(
s->version, 1);
625 s->chroma_planes =
desc->nb_components < 3 ? 0 : 1;
629 s->bits_per_raw_sample = 8;
630 else if (!
s->bits_per_raw_sample)
631 s->bits_per_raw_sample = 8;
636 s->chroma_planes = 1;
637 s->bits_per_raw_sample = 8;
642 s->chroma_planes = 1;
643 s->bits_per_raw_sample = 16;
645 s->version =
FFMAX(
s->version, 1);
649 s->chroma_planes = 1;
650 s->bits_per_raw_sample = 16;
652 s->version =
FFMAX(
s->version, 1);
656 s->chroma_planes = 1;
657 s->bits_per_raw_sample = 8;
661 s->bits_per_raw_sample = 9;
665 s->bits_per_raw_sample = 10;
669 s->bits_per_raw_sample = 12;
672 s->bits_per_raw_sample = 14;
676 s->bits_per_raw_sample = 16;
677 else if (!
s->bits_per_raw_sample)
681 s->chroma_planes = 1;
682 if (
s->bits_per_raw_sample >= 16) {
685 s->version =
FFMAX(
s->version, 1);
693 if (
s->bits_per_raw_sample > 8) {
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++)
718 s->state_transition[
i] =
c.one_state[
i];
721 for (
i = 0;
i < 256;
i++) {
722 s->quant_table_count = 2;
723 if (
s->bits_per_raw_sample <= 8) {
729 s->quant_tables[1][2][
i]= 11*11*
quant5 [
i];
730 s->quant_tables[1][3][
i]= 5*11*11*
quant5 [
i];
731 s->quant_tables[1][4][
i]= 5*5*11*11*
quant5 [
i];
743 s->context_count[0] = (11 * 11 * 11 + 1) / 2;
744 s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
745 memcpy(
s->quant_table,
s->quant_tables[
s->context_model],
746 sizeof(
s->quant_table));
748 for (
i = 0;
i <
s->plane_count;
i++) {
759 #if FF_API_CODED_FRAME
765 if (!
s->transparency)
767 if (!
s->chroma_planes &&
s->version > 3)
774 s->picture_number = 0;
777 for (
i = 0;
i <
s->quant_table_count;
i++) {
779 sizeof(*
s->rc_stat2[
i]));
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);
806 for (
i = 0;
i <
s->quant_table_count;
i++)
807 for (j = 0; j <
s->context_count[
i]; j++) {
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",
828 while (*p ==
'\n' || *p ==
' ')
838 for (
i = 0;
i <
s->quant_table_count;
i++) {
839 for (k = 0; k < 32; k++) {
842 for (j = 0; j <
s->context_count[
i]; j++) {
844 if (
s->rc_stat2[
i][j][k][0] +
s->rc_stat2[
i][j][k][1] > 200 && j ||
a+
b > 200) {
846 p = 256.0 *
b / (
a +
b);
847 s->initial_states[
i][jp][k] =
849 for(jp++; jp<j; jp++)
850 s->initial_states[
i][jp][k] =
s->initial_states[
i][jp-1][k];
853 a +=
s->rc_stat2[
i][j][k][0];
854 b +=
s->rc_stat2[
i][j][k][1];
856 p = 256.0 *
b / (
a +
b);
858 s->initial_states[
i][j][k] =
866 if (
s->version > 1) {
872 s->num_v_slices =
FFMIN(
s->num_v_slices, max_v_slices);
874 for (;
s->num_v_slices < 32;
s->num_v_slices++) {
875 for (
s->num_h_slices =
s->num_v_slices;
s->num_h_slices < 2*
s->num_v_slices;
s->num_h_slices++) {
876 int maxw = (
avctx->
width +
s->num_h_slices - 1) /
s->num_h_slices;
877 int maxh = (
avctx->
height +
s->num_v_slices - 1) /
s->num_v_slices;
878 if (
s->num_h_slices > max_h_slices ||
s->num_v_slices > max_v_slices)
880 if (maxw * maxh * (int64_t)(
s->bits_per_raw_sample+1) *
plane_count > 8<<24)
887 "Unsupported number %d of slices requested, please specify a "
888 "supported number with -slices (ex:4,6,9,12,16, ...)\n",
898 s->slice_count =
s->max_slice_count;
902 #define STATS_OUT_SIZE 1024 * 1024 * 6
907 for (
i = 0;
i <
s->quant_table_count;
i++)
908 for (j = 0; j <
s->max_slice_count; j++) {
932 for (j=0; j<
f->plane_count; j++) {
934 av_assert0(
f->plane[j].quant_table_index ==
f->context_model);
936 if (!
f->picture.f->interlaced_frame)
942 if (
f->version > 3) {
944 if (
fs->slice_coding_mode == 1)
947 if (
fs->slice_coding_mode != 1) {
956 #define NB_Y_COEFF 15
957 static const int rct_y_coeff[15][2] = {
977 int x, y,
i, p, best;
979 int lbd =
fs->bits_per_raw_sample <= 8;
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])
1032 fs->slice_rct_by_coef = rct_y_coeff[best][1];
1033 fs->slice_rct_ry_coef = rct_y_coeff[best][0];
1042 int x =
fs->slice_x;
1043 int y =
fs->slice_y;
1044 const AVFrame *
const p =
f->picture.f;
1053 fs->slice_coding_mode = 0;
1054 if (
f->version > 3) {
1057 fs->slice_rct_by_coef = 1;
1058 fs->slice_rct_ry_coef = 1;
1064 if (
f->version > 2) {
1070 fs->c.bytestream_start +
fs->ac_byte_count,
1071 fs->c.bytestream_end -
fs->c.bytestream_start -
fs->ac_byte_count);
1077 const int cx = x >>
f->chroma_h_shift;
1078 const int cy = y >>
f->chroma_v_shift;
1082 if (
f->chroma_planes) {
1086 if (
fs->transparency)
1091 }
else if (
f->use32bit) {
1100 if (
fs->version < 4 || !
fs->ac) {
1105 fs->slice_coding_mode = 1;
1114 const AVFrame *pict,
int *got_packet)
1131 memset(
f->rc_stat, 0,
sizeof(
f->rc_stat));
1132 for (
i = 0;
i <
f->quant_table_count;
i++)
1133 memset(
f->rc_stat2[
i], 0,
f->context_count[
i] *
sizeof(*
f->rc_stat2[
i]));
1136 for (j = 0; j <
f->slice_count; j++) {
1138 for (
i = 0;
i < 256;
i++) {
1139 f->rc_stat[
i][0] +=
fs->rc_stat[
i][0];
1140 f->rc_stat[
i][1] +=
fs->rc_stat[
i][1];
1142 for (
i = 0;
i <
f->quant_table_count;
i++) {
1143 for (k = 0; k <
f->context_count[
i]; k++)
1144 for (m = 0; m < 32; m++) {
1145 f->rc_stat2[
i][k][m][0] +=
fs->rc_stat2[
i][k][m][0];
1146 f->rc_stat2[
i][k][m][1] +=
fs->rc_stat2[
i][k][m][1];
1151 for (j = 0; j < 256; j++) {
1153 f->rc_stat[j][0],
f->rc_stat[j][1]);
1158 for (
i = 0;
i <
f->quant_table_count;
i++) {
1159 for (j = 0; j <
f->context_count[
i]; j++)
1160 for (m = 0; m < 32; m++) {
1162 f->rc_stat2[
i][j][m][0],
f->rc_stat2[
i][j][m][1]);
1188 #if FF_API_CODED_FRAME
1206 for (
i = 1;
i < 256;
i++) {
1207 c->one_state[
i] =
f->state_transition[
i];
1208 c->zero_state[256 -
i] = 256 -
c->one_state[
i];
1212 for (
i = 0;
i <
f->slice_count;
i++) {
1221 fs->c.bytestream_end =
fs->c.bytestream_start +
len;
1225 f->slice_count,
sizeof(
void *));
1228 for (
i = 0;
i <
f->slice_count;
i++) {
1238 if (
i > 0 ||
f->version > 2) {
1240 memmove(buf_p,
fs->c.bytestream_start, bytes);
1242 AV_WB24(buf_p + bytes, bytes);
1258 #if FF_API_CODED_FRAME
1264 f->picture_number++;
1280 #define OFFSET(x) offsetof(FFV1Context, x)
1281 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1285 { .i64 = 0 }, -2, 2,
VE,
"coder" },
1292 {
"ac",
"Range with custom table (the ac option exists for compatibility and is deprecated)", 0,
AV_OPT_TYPE_CONST,
1293 { .i64 = 1 }, INT_MIN, INT_MAX,
VE,
"coder" },
1295 { .i64 = 0 }, 0, 1,
VE },
1307 #if FF_API_CODER_TYPE
1347 #if FF_API_CODER_TYPE