Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
875f6955
Commit
875f6955
authored
Mar 25, 2017
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/vp9: misc cosmetics
Imported from Libav
parent
ff8436ba
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
337 additions
and
302 deletions
+337
-302
vp9.c
libavcodec/vp9.c
+31
-29
vp9block.c
libavcodec/vp9block.c
+112
-86
vp9data.c
libavcodec/vp9data.c
+47
-47
vp9mvs.c
libavcodec/vp9mvs.c
+106
-107
vp9prob.c
libavcodec/vp9prob.c
+41
-33
No files found.
libavcodec/vp9.c
View file @
875f6955
...
...
@@ -252,7 +252,7 @@ static int update_block_buffers(AVCodecContext *avctx)
return
0
;
}
//
for some reason t
he sign bit is at the end, not the start, of a bit sequence
//
T
he sign bit is at the end, not the start, of a bit sequence
static
av_always_inline
int
get_sbits_inv
(
GetBitContext
*
gb
,
int
n
)
{
int
v
=
get_bits
(
gb
,
n
);
...
...
@@ -292,13 +292,13 @@ static int update_prob(VP56RangeCoder *c, int p)
/* This code is trying to do a differential probability update. For a
* current probability A in the range [1, 255], the difference to a new
* probability of any value can be expressed differentially as 1-A,255-A
* probability of any value can be expressed differentially as 1-A,
255-A
* where some part of this (absolute range) exists both in positive as
* well as the negative part, whereas another part only exists in one
* half. We're trying to code this shared part differentially, i.e.
* times two where the value of the lowest bit specifies the sign, and
* the single part is then coded on top of this. This absolute difference
* then again has a value of [0,254], but a bigger value in this range
* then again has a value of [0,
254], but a bigger value in this range
* indicates that we're further away from the original value A, so we
* can code this as a VLC code, since higher values are increasingly
* unlikely. The first 20 values in inv_map_table[] allow 'cheap, rough'
...
...
@@ -414,12 +414,15 @@ static int decode_frame_header(AVCodecContext *avctx,
*
ref
=
get_bits
(
&
s
->
gb
,
3
);
return
0
;
}
s
->
last_keyframe
=
s
->
s
.
h
.
keyframe
;
s
->
s
.
h
.
keyframe
=
!
get_bits1
(
&
s
->
gb
);
last_invisible
=
s
->
s
.
h
.
invisible
;
s
->
s
.
h
.
invisible
=
!
get_bits1
(
&
s
->
gb
);
s
->
s
.
h
.
errorres
=
get_bits1
(
&
s
->
gb
);
s
->
s
.
h
.
keyframe
=
!
get_bits1
(
&
s
->
gb
);
last_invisible
=
s
->
s
.
h
.
invisible
;
s
->
s
.
h
.
invisible
=
!
get_bits1
(
&
s
->
gb
);
s
->
s
.
h
.
errorres
=
get_bits1
(
&
s
->
gb
);
s
->
s
.
h
.
use_last_frame_mvs
=
!
s
->
s
.
h
.
errorres
&&
!
last_invisible
;
if
(
s
->
s
.
h
.
keyframe
)
{
if
(
get_bits_long
(
&
s
->
gb
,
24
)
!=
VP9_SYNCCODE
)
{
// synccode
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid sync code
\n
"
);
...
...
@@ -434,8 +437,8 @@ static int decode_frame_header(AVCodecContext *avctx,
if
(
get_bits1
(
&
s
->
gb
))
// display size
skip_bits
(
&
s
->
gb
,
32
);
}
else
{
s
->
s
.
h
.
intraonly
=
s
->
s
.
h
.
invisible
?
get_bits1
(
&
s
->
gb
)
:
0
;
s
->
s
.
h
.
resetctx
=
s
->
s
.
h
.
errorres
?
0
:
get_bits
(
&
s
->
gb
,
2
);
s
->
s
.
h
.
intraonly
=
s
->
s
.
h
.
invisible
?
get_bits1
(
&
s
->
gb
)
:
0
;
s
->
s
.
h
.
resetctx
=
s
->
s
.
h
.
errorres
?
0
:
get_bits
(
&
s
->
gb
,
2
);
if
(
s
->
s
.
h
.
intraonly
)
{
if
(
get_bits_long
(
&
s
->
gb
,
24
)
!=
VP9_SYNCCODE
)
{
// synccode
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid sync code
\n
"
);
...
...
@@ -565,11 +568,10 @@ static int decode_frame_header(AVCodecContext *avctx,
for
(
i
=
0
;
i
<
7
;
i
++
)
s
->
s
.
h
.
segmentation
.
prob
[
i
]
=
get_bits1
(
&
s
->
gb
)
?
get_bits
(
&
s
->
gb
,
8
)
:
255
;
if
((
s
->
s
.
h
.
segmentation
.
temporal
=
get_bits1
(
&
s
->
gb
)))
{
if
((
s
->
s
.
h
.
segmentation
.
temporal
=
get_bits1
(
&
s
->
gb
)))
for
(
i
=
0
;
i
<
3
;
i
++
)
s
->
s
.
h
.
segmentation
.
pred_prob
[
i
]
=
get_bits1
(
&
s
->
gb
)
?
get_bits
(
&
s
->
gb
,
8
)
:
255
;
}
}
if
(
get_bits1
(
&
s
->
gb
))
{
...
...
@@ -734,9 +736,9 @@ static int decode_frame_header(AVCodecContext *avctx,
}
else
{
memset
(
&
s
->
counts
,
0
,
sizeof
(
s
->
counts
));
}
/
/
FIXME is it faster to not copy here, but do it down in the fw updates
//
as explicit copies if the fw update is missing (and skip the copy upon
// fw update)?
/
*
FIXME is it faster to not copy here, but do it down in the fw updates
*
as explicit copies if the fw update is missing (and skip the copy upon
* fw update)? */
s
->
prob
.
p
=
s
->
prob_ctx
[
c
].
p
;
// txfm updates
...
...
@@ -777,11 +779,10 @@ static int decode_frame_header(AVCodecContext *avctx,
if
(
m
>=
3
&&
l
==
0
)
// dc only has 3 pt
break
;
for
(
n
=
0
;
n
<
3
;
n
++
)
{
if
(
vp56_rac_get_prob_branchy
(
&
s
->
c
,
252
))
{
if
(
vp56_rac_get_prob_branchy
(
&
s
->
c
,
252
))
p
[
n
]
=
update_prob
(
&
s
->
c
,
r
[
n
]);
}
else
{
else
p
[
n
]
=
r
[
n
];
}
}
p
[
3
]
=
0
;
}
...
...
@@ -866,7 +867,8 @@ static int decode_frame_header(AVCodecContext *avctx,
for
(
k
=
0
;
k
<
3
;
k
++
)
if
(
vp56_rac_get_prob_branchy
(
&
s
->
c
,
252
))
s
->
prob
.
p
.
partition
[
3
-
i
][
j
][
k
]
=
update_prob
(
&
s
->
c
,
s
->
prob
.
p
.
partition
[
3
-
i
][
j
][
k
]);
update_prob
(
&
s
->
c
,
s
->
prob
.
p
.
partition
[
3
-
i
][
j
][
k
]);
// mv fields don't use the update_prob subexp model for some reason
for
(
i
=
0
;
i
<
3
;
i
++
)
...
...
@@ -875,7 +877,8 @@ static int decode_frame_header(AVCodecContext *avctx,
for
(
i
=
0
;
i
<
2
;
i
++
)
{
if
(
vp56_rac_get_prob_branchy
(
&
s
->
c
,
252
))
s
->
prob
.
p
.
mv_comp
[
i
].
sign
=
(
vp8_rac_get_uint
(
&
s
->
c
,
7
)
<<
1
)
|
1
;
s
->
prob
.
p
.
mv_comp
[
i
].
sign
=
(
vp8_rac_get_uint
(
&
s
->
c
,
7
)
<<
1
)
|
1
;
for
(
j
=
0
;
j
<
10
;
j
++
)
if
(
vp56_rac_get_prob_branchy
(
&
s
->
c
,
252
))
...
...
@@ -883,7 +886,8 @@ static int decode_frame_header(AVCodecContext *avctx,
(
vp8_rac_get_uint
(
&
s
->
c
,
7
)
<<
1
)
|
1
;
if
(
vp56_rac_get_prob_branchy
(
&
s
->
c
,
252
))
s
->
prob
.
p
.
mv_comp
[
i
].
class0
=
(
vp8_rac_get_uint
(
&
s
->
c
,
7
)
<<
1
)
|
1
;
s
->
prob
.
p
.
mv_comp
[
i
].
class0
=
(
vp8_rac_get_uint
(
&
s
->
c
,
7
)
<<
1
)
|
1
;
for
(
j
=
0
;
j
<
10
;
j
++
)
if
(
vp56_rac_get_prob_branchy
(
&
s
->
c
,
252
))
...
...
@@ -1210,11 +1214,11 @@ static void loopfilter_sb(AVCodecContext *avctx, struct VP9Filter *lflvl,
uint8_t
(
*
uv_masks
)[
8
][
4
]
=
lflvl
->
mask
[
s
->
ss_h
|
s
->
ss_v
];
int
p
;
/
/ FIXME i
n how far can we interleave the v/h loopfilter calls? E.g.
//
if you think of them as acting on a 8x8 block max, we can interleave
//
each v/h within the single x loop, but that only works if we work on
//
8 pixel blocks, and we won't always do that (we want at least 16px
// to use SSE2 optimizations, perhaps 32 for AVX2)
/
* FIXME: I
n how far can we interleave the v/h loopfilter calls? E.g.
*
if you think of them as acting on a 8x8 block max, we can interleave
*
each v/h within the single x loop, but that only works if we work on
*
8 pixel blocks, and we won't always do that (we want at least 16px
* to use SSE2 optimizations, perhaps 32 for AVX2) */
filter_plane_cols
(
s
,
col
,
0
,
0
,
lflvl
->
level
,
lflvl
->
mask
[
0
][
0
],
dst
,
ls_y
);
filter_plane_rows
(
s
,
row
,
0
,
0
,
lflvl
->
level
,
lflvl
->
mask
[
0
][
1
],
dst
,
ls_y
);
...
...
@@ -1485,14 +1489,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
yoff2
,
uvoff2
,
BL_64X64
);
}
}
if
(
s
->
pass
!=
2
)
{
if
(
s
->
pass
!=
2
)
memcpy
(
&
s
->
c_b
[
tile_col
],
&
s
->
c
,
sizeof
(
s
->
c
));
}
}
if
(
s
->
pass
==
1
)
{
if
(
s
->
pass
==
1
)
continue
;
}
// backup pre-loopfilter reconstruction data for intra
// prediction of next row of sb64s
...
...
libavcodec/vp9block.c
View file @
875f6955
This diff is collapsed.
Click to expand it.
libavcodec/vp9data.c
View file @
875f6955
...
...
@@ -23,9 +23,9 @@
#include "vp9data.h"
const
int8_t
ff_vp9_partition_tree
[
3
][
2
]
=
{
{
-
PARTITION_NONE
,
1
},
// '0'
{
-
PARTITION_H
,
2
},
// '10'
{
-
PARTITION_V
,
-
PARTITION_SPLIT
},
// '110', '111'
{
-
PARTITION_NONE
,
1
},
// '0'
{
-
PARTITION_H
,
2
},
// '10'
{
-
PARTITION_V
,
-
PARTITION_SPLIT
},
// '110', '111'
};
const
uint8_t
ff_vp9_default_kf_partition_probs
[
4
][
4
][
3
]
=
{
...
...
@@ -54,24 +54,24 @@ const uint8_t ff_vp9_default_kf_partition_probs[4][4][3] = {
const
int8_t
ff_vp9_segmentation_tree
[
7
][
2
]
=
{
{
1
,
2
},
{
3
,
4
},
{
5
,
6
},
{
-
0
,
-
1
},
// '00x'
{
-
2
,
-
3
},
// '01x'
{
-
4
,
-
5
},
// '10x'
{
-
6
,
-
7
},
// '11x'
{
3
,
4
},
{
5
,
6
},
{
-
0
,
-
1
},
// '00x'
{
-
2
,
-
3
},
// '01x'
{
-
4
,
-
5
},
// '10x'
{
-
6
,
-
7
},
// '11x'
};
const
int8_t
ff_vp9_intramode_tree
[
9
][
2
]
=
{
{
-
DC_PRED
,
1
},
// '0'
{
-
TM_VP8_PRED
,
2
},
// '10'
{
-
VERT_PRED
,
3
},
// '110'
{
4
,
6
},
{
-
HOR_PRED
,
5
},
// '11100'
{
-
DIAG_DOWN_RIGHT_PRED
,
-
VERT_RIGHT_PRED
},
// '11101x'
{
-
DIAG_DOWN_LEFT_PRED
,
7
},
// '11110'
{
-
VERT_LEFT_PRED
,
8
},
// '111110'
{
-
HOR_DOWN_PRED
,
-
HOR_UP_PRED
},
// '111111x'
{
-
DC_PRED
,
1
},
// '0'
{
-
TM_VP8_PRED
,
2
},
// '10'
{
-
VERT_PRED
,
3
},
// '110'
{
4
,
6
},
{
-
HOR_PRED
,
5
},
// '11100'
{
-
DIAG_DOWN_RIGHT_PRED
,
-
VERT_RIGHT_PRED
},
// '11101x'
{
-
DIAG_DOWN_LEFT_PRED
,
7
},
// '11110'
{
-
VERT_LEFT_PRED
,
8
},
// '111110'
{
-
HOR_DOWN_PRED
,
-
HOR_UP_PRED
},
// '111111x'
};
const
uint8_t
ff_vp9_default_kf_ymode_probs
[
10
][
10
][
9
]
=
{
...
...
@@ -202,14 +202,14 @@ const uint8_t ff_vp9_default_kf_uvmode_probs[10][9] = {
};
const
int8_t
ff_vp9_inter_mode_tree
[
3
][
2
]
=
{
{
-
ZEROMV
,
1
},
// '0'
{
-
NEARESTMV
,
2
},
// '10'
{
-
NEARMV
,
-
NEWMV
},
// '11x'
{
-
ZEROMV
,
1
},
// '0'
{
-
NEARESTMV
,
2
},
// '10'
{
-
NEARMV
,
-
NEWMV
},
// '11x'
};
const
int8_t
ff_vp9_filter_tree
[
2
][
2
]
=
{
{
-
0
,
1
},
// '0'
{
-
1
,
-
2
},
// '1x'
{
-
0
,
1
},
// '0'
{
-
1
,
-
2
},
// '1x'
};
const
enum
FilterMode
ff_vp9_filter_lut
[
3
]
=
{
...
...
@@ -1445,13 +1445,13 @@ const ProbContext ff_vp9_default_probs = {
{
34
,
3
,
},
{
149
,
144
,
},
},
{
/* mv_mode */
{
2
,
173
,
34
},
// 0 = both zero mv
{
7
,
145
,
85
},
// 1 = one zero mv + one a predicted mv
{
7
,
166
,
63
},
// 2 = two predicted mvs
{
7
,
94
,
66
},
// 3 = one predicted/zero and one new mv
{
8
,
64
,
46
},
// 4 = two new mvs
{
17
,
81
,
31
},
// 5 = one intra neighbou
r + x
{
25
,
29
,
30
},
// 6 = two intra neighbou
rs
{
2
,
173
,
34
},
// 0 = both zero mv
{
7
,
145
,
85
},
// 1 = one zero mv + one a predicted mv
{
7
,
166
,
63
},
// 2 = two predicted mvs
{
7
,
94
,
66
},
// 3 = one predicted/zero and one new mv
{
8
,
64
,
46
},
// 4 = two new mvs
{
17
,
81
,
31
},
// 5 = one intra neighbo
r + x
{
25
,
29
,
30
},
// 6 = two intra neighbo
rs
},
{
/* intra */
9
,
102
,
187
,
225
},
{
/* comp */
...
...
@@ -1481,7 +1481,7 @@ const ProbContext ff_vp9_default_probs = {
128
,
/* sign */
{
224
,
144
,
192
,
168
,
192
,
176
,
192
,
198
,
198
,
245
},
/* class */
216
,
/* class0 */
{
136
,
140
,
148
,
160
,
176
,
192
,
224
,
234
,
234
,
240
},
/* bits */
{
136
,
140
,
148
,
160
,
176
,
192
,
224
,
234
,
234
,
240
},
/* bits */
{
/* class0_fp */
{
128
,
128
,
64
},
{
96
,
112
,
64
}
...
...
@@ -2212,26 +2212,26 @@ const uint8_t ff_vp9_default_coef_probs[4][2][2][6][6][3] = {
};
const
int8_t
ff_vp9_mv_joint_tree
[
3
][
2
]
=
{
{
-
MV_JOINT_ZERO
,
1
},
// '0'
{
-
MV_JOINT_H
,
2
},
// '10'
{
-
MV_JOINT_V
,
-
MV_JOINT_HV
},
// '11x'
{
-
MV_JOINT_ZERO
,
1
},
// '0'
{
-
MV_JOINT_H
,
2
},
// '10'
{
-
MV_JOINT_V
,
-
MV_JOINT_HV
},
// '11x'
};
const
int8_t
ff_vp9_mv_class_tree
[
10
][
2
]
=
{
{
-
0
,
1
},
// '0'
{
-
1
,
2
},
// '10'
{
3
,
4
},
{
-
2
,
-
3
},
// '110x'
{
5
,
6
},
{
-
4
,
-
5
},
// '1110x'
{
-
6
,
7
},
// '11110'
{
8
,
9
},
{
-
7
,
-
8
},
// '111110x'
{
-
9
,
-
10
},
// '111111x'
{
-
0
,
1
},
// '0'
{
-
1
,
2
},
// '10'
{
3
,
4
},
{
-
2
,
-
3
},
// '110x'
{
5
,
6
},
{
-
4
,
-
5
},
// '1110x'
{
-
6
,
7
},
// '11110'
{
8
,
9
},
{
-
7
,
-
8
},
// '111110x'
{
-
9
,
-
10
},
// '111111x'
};
const
int8_t
ff_vp9_mv_fp_tree
[
3
][
2
]
=
{
{
-
0
,
1
},
// '0'
{
-
1
,
2
},
// '10'
{
-
2
,
-
3
},
// '11x'
{
-
0
,
1
},
// '0'
{
-
1
,
2
},
// '10'
{
-
2
,
-
3
},
// '11x'
};
libavcodec/vp9mvs.c
View file @
875f6955
This diff is collapsed.
Click to expand it.
libavcodec/vp9prob.c
View file @
875f6955
...
...
@@ -76,33 +76,36 @@ void ff_vp9_adapt_probs(VP9Context *s)
// skip flag
for
(
i
=
0
;
i
<
3
;
i
++
)
adapt_prob
(
&
p
->
skip
[
i
],
s
->
counts
.
skip
[
i
][
0
],
s
->
counts
.
skip
[
i
][
1
],
20
,
128
);
adapt_prob
(
&
p
->
skip
[
i
],
s
->
counts
.
skip
[
i
][
0
],
s
->
counts
.
skip
[
i
][
1
],
20
,
128
);
// intra/inter flag
for
(
i
=
0
;
i
<
4
;
i
++
)
adapt_prob
(
&
p
->
intra
[
i
],
s
->
counts
.
intra
[
i
][
0
],
s
->
counts
.
intra
[
i
][
1
],
20
,
128
);
adapt_prob
(
&
p
->
intra
[
i
],
s
->
counts
.
intra
[
i
][
0
],
s
->
counts
.
intra
[
i
][
1
],
20
,
128
);
// comppred flag
if
(
s
->
s
.
h
.
comppredmode
==
PRED_SWITCHABLE
)
{
for
(
i
=
0
;
i
<
5
;
i
++
)
adapt_prob
(
&
p
->
comp
[
i
],
s
->
counts
.
comp
[
i
][
0
],
s
->
counts
.
comp
[
i
][
1
],
20
,
128
);
for
(
i
=
0
;
i
<
5
;
i
++
)
adapt_prob
(
&
p
->
comp
[
i
],
s
->
counts
.
comp
[
i
][
0
],
s
->
counts
.
comp
[
i
][
1
],
20
,
128
);
}
// reference frames
if
(
s
->
s
.
h
.
comppredmode
!=
PRED_SINGLEREF
)
{
for
(
i
=
0
;
i
<
5
;
i
++
)
adapt_prob
(
&
p
->
comp_ref
[
i
],
s
->
counts
.
comp_ref
[
i
][
0
],
s
->
counts
.
comp_ref
[
i
][
1
],
20
,
128
);
for
(
i
=
0
;
i
<
5
;
i
++
)
adapt_prob
(
&
p
->
comp_ref
[
i
],
s
->
counts
.
comp_ref
[
i
][
0
],
s
->
counts
.
comp_ref
[
i
][
1
],
20
,
128
);
}
if
(
s
->
s
.
h
.
comppredmode
!=
PRED_COMPREF
)
{
for
(
i
=
0
;
i
<
5
;
i
++
)
{
uint8_t
*
pp
=
p
->
single_ref
[
i
];
unsigned
(
*
c
)[
2
]
=
s
->
counts
.
single_ref
[
i
];
for
(
i
=
0
;
i
<
5
;
i
++
)
{
uint8_t
*
pp
=
p
->
single_ref
[
i
];
unsigned
(
*
c
)[
2
]
=
s
->
counts
.
single_ref
[
i
];
adapt_prob
(
&
pp
[
0
],
c
[
0
][
0
],
c
[
0
][
1
],
20
,
128
);
adapt_prob
(
&
pp
[
1
],
c
[
1
][
0
],
c
[
1
][
1
],
20
,
128
);
}
adapt_prob
(
&
pp
[
0
],
c
[
0
][
0
],
c
[
0
][
1
],
20
,
128
);
adapt_prob
(
&
pp
[
1
],
c
[
1
][
0
],
c
[
1
][
1
],
20
,
128
);
}
}
// block partitioning
...
...
@@ -118,16 +121,17 @@ void ff_vp9_adapt_probs(VP9Context *s)
// tx size
if
(
s
->
s
.
h
.
txfmmode
==
TX_SWITCHABLE
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
unsigned
*
c16
=
s
->
counts
.
tx16p
[
i
],
*
c32
=
s
->
counts
.
tx32p
[
i
];
adapt_prob
(
&
p
->
tx8p
[
i
],
s
->
counts
.
tx8p
[
i
][
0
],
s
->
counts
.
tx8p
[
i
][
1
],
20
,
128
);
adapt_prob
(
&
p
->
tx16p
[
i
][
0
],
c16
[
0
],
c16
[
1
]
+
c16
[
2
],
20
,
128
);
adapt_prob
(
&
p
->
tx16p
[
i
][
1
],
c16
[
1
],
c16
[
2
],
20
,
128
);
adapt_prob
(
&
p
->
tx32p
[
i
][
0
],
c32
[
0
],
c32
[
1
]
+
c32
[
2
]
+
c32
[
3
],
20
,
128
);
adapt_prob
(
&
p
->
tx32p
[
i
][
1
],
c32
[
1
],
c32
[
2
]
+
c32
[
3
],
20
,
128
);
adapt_prob
(
&
p
->
tx32p
[
i
][
2
],
c32
[
2
],
c32
[
3
],
20
,
128
);
}
for
(
i
=
0
;
i
<
2
;
i
++
)
{
unsigned
*
c16
=
s
->
counts
.
tx16p
[
i
],
*
c32
=
s
->
counts
.
tx32p
[
i
];
adapt_prob
(
&
p
->
tx8p
[
i
],
s
->
counts
.
tx8p
[
i
][
0
],
s
->
counts
.
tx8p
[
i
][
1
],
20
,
128
);
adapt_prob
(
&
p
->
tx16p
[
i
][
0
],
c16
[
0
],
c16
[
1
]
+
c16
[
2
],
20
,
128
);
adapt_prob
(
&
p
->
tx16p
[
i
][
1
],
c16
[
1
],
c16
[
2
],
20
,
128
);
adapt_prob
(
&
p
->
tx32p
[
i
][
0
],
c32
[
0
],
c32
[
1
]
+
c32
[
2
]
+
c32
[
3
],
20
,
128
);
adapt_prob
(
&
p
->
tx32p
[
i
][
1
],
c32
[
1
],
c32
[
2
]
+
c32
[
3
],
20
,
128
);
adapt_prob
(
&
p
->
tx32p
[
i
][
2
],
c32
[
2
],
c32
[
3
],
20
,
128
);
}
}
// interpolation filter
...
...
@@ -169,9 +173,10 @@ void ff_vp9_adapt_probs(VP9Context *s)
adapt_prob
(
&
p
->
mv_comp
[
i
].
sign
,
s
->
counts
.
mv_comp
[
i
].
sign
[
0
],
s
->
counts
.
mv_comp
[
i
].
sign
[
1
],
20
,
128
);
pp
=
p
->
mv_comp
[
i
].
classes
;
c
=
s
->
counts
.
mv_comp
[
i
].
classes
;
sum
=
c
[
1
]
+
c
[
2
]
+
c
[
3
]
+
c
[
4
]
+
c
[
5
]
+
c
[
6
]
+
c
[
7
]
+
c
[
8
]
+
c
[
9
]
+
c
[
10
];
pp
=
p
->
mv_comp
[
i
].
classes
;
c
=
s
->
counts
.
mv_comp
[
i
].
classes
;
sum
=
c
[
1
]
+
c
[
2
]
+
c
[
3
]
+
c
[
4
]
+
c
[
5
]
+
c
[
6
]
+
c
[
7
]
+
c
[
8
]
+
c
[
9
]
+
c
[
10
];
adapt_prob
(
&
pp
[
0
],
c
[
0
],
sum
,
20
,
128
);
sum
-=
c
[
1
];
adapt_prob
(
&
pp
[
1
],
c
[
1
],
sum
,
20
,
128
);
...
...
@@ -196,19 +201,20 @@ void ff_vp9_adapt_probs(VP9Context *s)
for
(
j
=
0
;
j
<
2
;
j
++
)
{
pp
=
p
->
mv_comp
[
i
].
class0_fp
[
j
];
c
=
s
->
counts
.
mv_comp
[
i
].
class0_fp
[
j
];
c
=
s
->
counts
.
mv_comp
[
i
].
class0_fp
[
j
];
adapt_prob
(
&
pp
[
0
],
c
[
0
],
c
[
1
]
+
c
[
2
]
+
c
[
3
],
20
,
128
);
adapt_prob
(
&
pp
[
1
],
c
[
1
],
c
[
2
]
+
c
[
3
],
20
,
128
);
adapt_prob
(
&
pp
[
2
],
c
[
2
],
c
[
3
],
20
,
128
);
}
pp
=
p
->
mv_comp
[
i
].
fp
;
c
=
s
->
counts
.
mv_comp
[
i
].
fp
;
c
=
s
->
counts
.
mv_comp
[
i
].
fp
;
adapt_prob
(
&
pp
[
0
],
c
[
0
],
c
[
1
]
+
c
[
2
]
+
c
[
3
],
20
,
128
);
adapt_prob
(
&
pp
[
1
],
c
[
1
],
c
[
2
]
+
c
[
3
],
20
,
128
);
adapt_prob
(
&
pp
[
2
],
c
[
2
],
c
[
3
],
20
,
128
);
if
(
s
->
s
.
h
.
highprecisionmvs
)
{
adapt_prob
(
&
p
->
mv_comp
[
i
].
class0_hp
,
s
->
counts
.
mv_comp
[
i
].
class0_hp
[
0
],
adapt_prob
(
&
p
->
mv_comp
[
i
].
class0_hp
,
s
->
counts
.
mv_comp
[
i
].
class0_hp
[
0
],
s
->
counts
.
mv_comp
[
i
].
class0_hp
[
1
],
20
,
128
);
adapt_prob
(
&
p
->
mv_comp
[
i
].
hp
,
s
->
counts
.
mv_comp
[
i
].
hp
[
0
],
s
->
counts
.
mv_comp
[
i
].
hp
[
1
],
20
,
128
);
...
...
@@ -226,12 +232,13 @@ void ff_vp9_adapt_probs(VP9Context *s)
adapt_prob
(
&
pp
[
1
],
c
[
TM_VP8_PRED
],
sum
,
20
,
128
);
sum
-=
c
[
VERT_PRED
];
adapt_prob
(
&
pp
[
2
],
c
[
VERT_PRED
],
sum
,
20
,
128
);
s2
=
c
[
HOR_PRED
]
+
c
[
DIAG_DOWN_RIGHT_PRED
]
+
c
[
VERT_RIGHT_PRED
];
s2
=
c
[
HOR_PRED
]
+
c
[
DIAG_DOWN_RIGHT_PRED
]
+
c
[
VERT_RIGHT_PRED
];
sum
-=
s2
;
adapt_prob
(
&
pp
[
3
],
s2
,
sum
,
20
,
128
);
s2
-=
c
[
HOR_PRED
];
adapt_prob
(
&
pp
[
4
],
c
[
HOR_PRED
],
s2
,
20
,
128
);
adapt_prob
(
&
pp
[
5
],
c
[
DIAG_DOWN_RIGHT_PRED
],
c
[
VERT_RIGHT_PRED
],
20
,
128
);
adapt_prob
(
&
pp
[
5
],
c
[
DIAG_DOWN_RIGHT_PRED
],
c
[
VERT_RIGHT_PRED
],
20
,
128
);
sum
-=
c
[
DIAG_DOWN_LEFT_PRED
];
adapt_prob
(
&
pp
[
6
],
c
[
DIAG_DOWN_LEFT_PRED
],
sum
,
20
,
128
);
sum
-=
c
[
VERT_LEFT_PRED
];
...
...
@@ -250,12 +257,13 @@ void ff_vp9_adapt_probs(VP9Context *s)
adapt_prob
(
&
pp
[
1
],
c
[
TM_VP8_PRED
],
sum
,
20
,
128
);
sum
-=
c
[
VERT_PRED
];
adapt_prob
(
&
pp
[
2
],
c
[
VERT_PRED
],
sum
,
20
,
128
);
s2
=
c
[
HOR_PRED
]
+
c
[
DIAG_DOWN_RIGHT_PRED
]
+
c
[
VERT_RIGHT_PRED
];
s2
=
c
[
HOR_PRED
]
+
c
[
DIAG_DOWN_RIGHT_PRED
]
+
c
[
VERT_RIGHT_PRED
];
sum
-=
s2
;
adapt_prob
(
&
pp
[
3
],
s2
,
sum
,
20
,
128
);
s2
-=
c
[
HOR_PRED
];
adapt_prob
(
&
pp
[
4
],
c
[
HOR_PRED
],
s2
,
20
,
128
);
adapt_prob
(
&
pp
[
5
],
c
[
DIAG_DOWN_RIGHT_PRED
],
c
[
VERT_RIGHT_PRED
],
20
,
128
);
adapt_prob
(
&
pp
[
5
],
c
[
DIAG_DOWN_RIGHT_PRED
],
c
[
VERT_RIGHT_PRED
],
20
,
128
);
sum
-=
c
[
DIAG_DOWN_LEFT_PRED
];
adapt_prob
(
&
pp
[
6
],
c
[
DIAG_DOWN_LEFT_PRED
],
sum
,
20
,
128
);
sum
-=
c
[
VERT_LEFT_PRED
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment