30 int max_count,
int update_factor)
32 unsigned ct = ct0 + ct1, p2, p1;
37 update_factor =
FASTDIV(update_factor *
FFMIN(ct, max_count), max_count);
39 p2 = ((((int64_t) ct0) << 8) + (ct >> 1)) / ct;
43 *p = p1 + (((p2 - p1) * update_factor + 128) >> 8);
50 int uf = (
s->s.h.keyframe ||
s->s.h.intraonly || !
s->last_keyframe) ? 112 : 128;
53 for (
i = 0;
i < 4;
i++)
54 for (j = 0; j < 2; j++)
55 for (k = 0; k < 2; k++)
56 for (l = 0; l < 6; l++)
57 for (m = 0; m < 6; m++) {
58 uint8_t *pp =
s->prob_ctx[
s->s.h.framectxid].coef[
i][j][k][l][m];
59 unsigned *e =
s->td[0].counts.eob[
i][j][k][l][m];
60 unsigned *
c =
s->td[0].counts.coef[
i][j][k][l][m];
70 if (
s->s.h.keyframe ||
s->s.h.intraonly) {
71 memcpy(p->
skip,
s->prob.p.skip,
sizeof(p->
skip));
72 memcpy(p->
tx32p,
s->prob.p.tx32p,
sizeof(p->
tx32p));
73 memcpy(p->
tx16p,
s->prob.p.tx16p,
sizeof(p->
tx16p));
74 memcpy(p->
tx8p,
s->prob.p.tx8p,
sizeof(p->
tx8p));
79 for (
i = 0;
i < 3;
i++)
81 s->td[0].counts.skip[
i][1], 20, 128);
84 for (
i = 0;
i < 4;
i++)
86 s->td[0].counts.intra[
i][1], 20, 128);
90 for (
i = 0;
i < 5;
i++)
92 s->td[0].counts.comp[
i][1], 20, 128);
97 for (
i = 0;
i < 5;
i++)
99 s->td[0].counts.comp_ref[
i][1], 20, 128);
103 for (
i = 0;
i < 5;
i++) {
105 unsigned (*
c)[2] =
s->td[0].counts.single_ref[
i];
113 for (
i = 0;
i < 4;
i++)
114 for (j = 0; j < 4; j++) {
116 unsigned *
c =
s->td[0].counts.partition[
i][j];
125 for (
i = 0;
i < 2;
i++) {
126 unsigned *c16 =
s->td[0].counts.tx16p[
i], *c32 =
s->td[0].counts.tx32p[
i];
129 s->td[0].counts.tx8p[
i][1], 20, 128);
140 for (
i = 0;
i < 4;
i++) {
142 unsigned *
c =
s->td[0].counts.filter[
i];
150 for (
i = 0;
i < 7;
i++) {
152 unsigned *
c =
s->td[0].counts.mv_mode[
i];
162 unsigned *
c =
s->td[0].counts.mv_joint;
170 for (
i = 0;
i < 2;
i++) {
172 unsigned *
c, (*c2)[2], sum;
175 s->td[0].counts.mv_comp[
i].sign[1], 20, 128);
178 c =
s->td[0].counts.mv_comp[
i].classes;
179 sum =
c[1] +
c[2] +
c[3] +
c[4] +
c[5] +
180 c[6] +
c[7] +
c[8] +
c[9] +
c[10];
197 s->td[0].counts.mv_comp[
i].class0[1], 20, 128);
199 c2 =
s->td[0].counts.mv_comp[
i].bits;
200 for (j = 0; j < 10; j++)
203 for (j = 0; j < 2; j++) {
205 c =
s->td[0].counts.mv_comp[
i].class0_fp[j];
211 c =
s->td[0].counts.mv_comp[
i].fp;
216 if (
s->s.h.highprecisionmvs) {
218 s->td[0].counts.mv_comp[
i].class0_hp[0],
219 s->td[0].counts.mv_comp[
i].class0_hp[1], 20, 128);
221 s->td[0].counts.mv_comp[
i].hp[1], 20, 128);
226 for (
i = 0;
i < 4;
i++) {
228 unsigned *
c =
s->td[0].counts.y_mode[
i], sum,
s2;
230 sum =
c[0] +
c[1] +
c[3] +
c[4] +
c[5] +
c[6] +
c[7] +
c[8] +
c[9];
251 for (
i = 0;
i < 10;
i++) {
253 unsigned *
c =
s->td[0].counts.uv_mode[
i], sum,
s2;
255 sum =
c[0] +
c[1] +
c[3] +
c[4] +
c[5] +
c[6] +
c[7] +
c[8] +
c[9];