Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
cf3ee225
Commit
cf3ee225
authored
Apr 28, 2016
by
Debargha Mukherjee
Committed by
Gerrit Code Review
Apr 28, 2016
Browse files
Merge "Make the backward updates work with bitshifts" into nextgenv2
parents
7ff79434
e4bf50b9
Changes
5
Hide whitespace changes
Inline
Side-by-side
vp10/common/entropy.c
View file @
cf3ee225
...
...
@@ -2840,13 +2840,6 @@ void vp10_default_coef_probs(VP10_COMMON *cm) {
#endif // CONFIG_ANS
}
#define COEF_COUNT_SAT 24
#define COEF_MAX_UPDATE_FACTOR 112
#define COEF_COUNT_SAT_KEY 24
#define COEF_MAX_UPDATE_FACTOR_KEY 112
#define COEF_COUNT_SAT_AFTER_KEY 24
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
static
void
adapt_coef_probs
(
VP10_COMMON
*
cm
,
TX_SIZE
tx_size
,
unsigned
int
count_sat
,
unsigned
int
update_factor
)
{
...
...
@@ -2880,9 +2873,9 @@ static void adapt_coef_probs(VP10_COMMON *cm, TX_SIZE tx_size,
{
n1
,
n2
}
};
for
(
m
=
0
;
m
<
UNCONSTRAINED_NODES
;
++
m
)
probs
[
i
][
j
][
k
][
l
][
m
]
=
merge_probs
(
pre_probs
[
i
][
j
][
k
][
l
][
m
],
branch_ct
[
m
],
count_sat
,
update_factor
);
probs
[
i
][
j
][
k
][
l
][
m
]
=
vp10_
merge_probs
(
pre_probs
[
i
][
j
][
k
][
l
][
m
],
branch_ct
[
m
],
count_sat
,
update_factor
);
}
}
...
...
@@ -2890,20 +2883,25 @@ void vp10_adapt_coef_probs(VP10_COMMON *cm) {
TX_SIZE
t
;
unsigned
int
count_sat
,
update_factor
;
if
(
frame_is_intra_only
(
cm
))
{
update_factor
=
COEF_MAX_UPDATE_FACTOR_KEY
;
count_sat
=
COEF_COUNT_SAT_KEY
;
}
else
if
(
cm
->
last_frame_type
==
KEY_FRAME
)
{
#if CONFIG_ENTROPY
if
(
cm
->
last_frame_type
==
KEY_FRAME
)
{
update_factor
=
COEF_MAX_UPDATE_FACTOR_AFTER_KEY_BITS
;
/* adapt quickly */
count_sat
=
COEF_COUNT_SAT_AFTER_KEY_BITS
;
}
else
{
update_factor
=
COEF_MAX_UPDATE_FACTOR_BITS
;
count_sat
=
COEF_COUNT_SAT_BITS
;
}
if
(
cm
->
partial_prob_update
==
1
)
{
update_factor
=
COEF_MAX_UPDATE_FACTOR_BITS
;
}
#else
if
(
cm
->
last_frame_type
==
KEY_FRAME
)
{
update_factor
=
COEF_MAX_UPDATE_FACTOR_AFTER_KEY
;
/* adapt quickly */
count_sat
=
COEF_COUNT_SAT_AFTER_KEY
;
}
else
{
update_factor
=
COEF_MAX_UPDATE_FACTOR
;
count_sat
=
COEF_COUNT_SAT
;
}
#if CONFIG_ENTROPY
if
(
cm
->
partial_prob_update
==
1
)
{
update_factor
=
COEF_MAX_UPDATE_FACTOR
;
}
#endif // CONFIG_ENTROPY
for
(
t
=
TX_4X4
;
t
<=
TX_32X32
;
t
++
)
adapt_coef_probs
(
cm
,
t
,
count_sat
,
update_factor
);
...
...
vp10/common/entropy.h
View file @
cf3ee225
...
...
@@ -231,6 +231,51 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
struct
frame_contexts
;
void
vp10_coef_pareto_cdfs
(
struct
frame_contexts
*
fc
);
#endif // CONFIG_ANS
#if CONFIG_ENTROPY
#define COEF_COUNT_SAT_BITS 5
#define COEF_MAX_UPDATE_FACTOR_BITS 7
#define COEF_COUNT_SAT_AFTER_KEY_BITS 5
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY_BITS 7
#define MODE_MV_COUNT_SAT_BITS 5
#define MODE_MV_MAX_UPDATE_FACTOR_BITS 7
#else
#define COEF_COUNT_SAT 24
#define COEF_MAX_UPDATE_FACTOR 112
#define COEF_COUNT_SAT_AFTER_KEY 24
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
#endif // CONFIG_ENTROPY
static
INLINE
vpx_prob
vp10_merge_probs
(
vpx_prob
pre_prob
,
const
unsigned
int
ct
[
2
],
unsigned
int
count_sat
,
unsigned
int
max_update_factor
)
{
#if CONFIG_ENTROPY
const
vpx_prob
prob
=
get_binary_prob
(
ct
[
0
],
ct
[
1
]);
const
unsigned
int
count
=
VPXMIN
(
ct
[
0
]
+
ct
[
1
],
(
unsigned
int
)(
1
<<
count_sat
));
const
unsigned
int
factor
=
count
<<
(
max_update_factor
-
count_sat
);
return
weighted_prob
(
pre_prob
,
prob
,
factor
);
#else
return
merge_probs
(
pre_prob
,
ct
,
count_sat
,
max_update_factor
);
#endif // CONFIG_ENTROPY
}
static
INLINE
vpx_prob
vp10_mode_mv_merge_probs
(
vpx_prob
pre_prob
,
const
unsigned
int
ct
[
2
])
{
#if CONFIG_ENTROPY
return
vp10_merge_probs
(
pre_prob
,
ct
,
MODE_MV_COUNT_SAT_BITS
,
MODE_MV_MAX_UPDATE_FACTOR_BITS
);
#else
return
mode_mv_merge_probs
(
pre_prob
,
ct
);
#endif // CONFIG_ENTROPY
}
#ifdef __cplusplus
}
// extern "C"
#endif
...
...
vp10/common/entropymode.c
View file @
cf3ee225
...
...
@@ -1266,37 +1266,37 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) {
const
FRAME_COUNTS
*
counts
=
&
cm
->
counts
;
for
(
i
=
0
;
i
<
INTRA_INTER_CONTEXTS
;
i
++
)
fc
->
intra_inter_prob
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
intra_inter_prob
[
i
],
counts
->
intra_inter
[
i
]);
fc
->
intra_inter_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
intra_inter_prob
[
i
],
counts
->
intra_inter
[
i
]);
for
(
i
=
0
;
i
<
COMP_INTER_CONTEXTS
;
i
++
)
fc
->
comp_inter_prob
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
comp_inter_prob
[
i
],
counts
->
comp_inter
[
i
]);
fc
->
comp_inter_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
comp_inter_prob
[
i
],
counts
->
comp_inter
[
i
]);
for
(
i
=
0
;
i
<
REF_CONTEXTS
;
i
++
)
for
(
j
=
0
;
j
<
(
COMP_REFS
-
1
);
j
++
)
fc
->
comp_ref_prob
[
i
][
j
]
=
mode_mv_merge_probs
(
pre_fc
->
comp_ref_prob
[
i
][
j
],
counts
->
comp_ref
[
i
][
j
]);
fc
->
comp_ref_prob
[
i
][
j
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
comp_ref_prob
[
i
][
j
],
counts
->
comp_ref
[
i
][
j
]);
for
(
i
=
0
;
i
<
REF_CONTEXTS
;
i
++
)
for
(
j
=
0
;
j
<
(
SINGLE_REFS
-
1
);
j
++
)
fc
->
single_ref_prob
[
i
][
j
]
=
mode_mv_merge_probs
(
fc
->
single_ref_prob
[
i
][
j
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
single_ref_prob
[
i
][
j
],
counts
->
single_ref
[
i
][
j
]);
#if CONFIG_REF_MV
for
(
i
=
0
;
i
<
NEWMV_MODE_CONTEXTS
;
++
i
)
fc
->
newmv_prob
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
newmv_prob
[
i
],
counts
->
newmv_mode
[
i
]);
fc
->
newmv_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
newmv_prob
[
i
],
counts
->
newmv_mode
[
i
]);
for
(
i
=
0
;
i
<
ZEROMV_MODE_CONTEXTS
;
++
i
)
fc
->
zeromv_prob
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
zeromv_prob
[
i
],
counts
->
zeromv_mode
[
i
]);
fc
->
zeromv_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
zeromv_prob
[
i
],
counts
->
zeromv_mode
[
i
]);
for
(
i
=
0
;
i
<
REFMV_MODE_CONTEXTS
;
++
i
)
fc
->
refmv_prob
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
refmv_prob
[
i
],
counts
->
refmv_mode
[
i
]);
fc
->
refmv_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
refmv_prob
[
i
],
counts
->
refmv_mode
[
i
]);
for
(
i
=
0
;
i
<
DRL_MODE_CONTEXTS
;
++
i
)
fc
->
drl_prob
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
drl_prob
[
i
],
counts
->
drl_mode
[
i
]);
fc
->
drl_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
drl_prob
[
i
],
counts
->
drl_mode
[
i
]);
#if CONFIG_EXT_INTER
fc
->
new2mv_prob
=
mode_mv_merge_probs
(
pre_fc
->
new2mv_prob
,
counts
->
new2mv_mode
);
fc
->
new2mv_prob
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
new2mv_prob
,
counts
->
new2mv_mode
);
#endif // CONFIG_EXT_INTER
#else
for
(
i
=
0
;
i
<
INTER_MODE_CONTEXTS
;
i
++
)
...
...
@@ -1306,16 +1306,16 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) {
#if CONFIG_OBMC
for
(
i
=
BLOCK_8X8
;
i
<
BLOCK_SIZES
;
++
i
)
fc
->
obmc_prob
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
obmc_prob
[
i
],
counts
->
obmc
[
i
]);
fc
->
obmc_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
obmc_prob
[
i
],
counts
->
obmc
[
i
]);
#endif // CONFIG_OBMC
#if CONFIG_SUPERTX
for
(
i
=
0
;
i
<
PARTITION_SUPERTX_CONTEXTS
;
++
i
)
{
int
j
;
for
(
j
=
1
;
j
<
TX_SIZES
;
++
j
)
{
fc
->
supertx_prob
[
i
][
j
]
=
mode_mv_merge_probs
(
pre_fc
->
supertx_prob
[
i
][
j
],
counts
->
supertx
[
i
][
j
]);
fc
->
supertx_prob
[
i
][
j
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
supertx_prob
[
i
][
j
],
counts
->
supertx
[
i
][
j
]);
}
}
#endif // CONFIG_SUPERTX
...
...
@@ -1328,8 +1328,8 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) {
fc
->
inter_compound_mode_probs
[
i
]);
for
(
i
=
0
;
i
<
BLOCK_SIZE_GROUPS
;
++
i
)
{
if
(
is_interintra_allowed_bsize_group
(
i
))
fc
->
interintra_prob
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
interintra_prob
[
i
],
counts
->
interintra
[
i
]);
fc
->
interintra_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
interintra_prob
[
i
],
counts
->
interintra
[
i
]);
}
for
(
i
=
0
;
i
<
BLOCK_SIZE_GROUPS
;
i
++
)
{
vpx_tree_merge_probs
(
...
...
@@ -1338,12 +1338,12 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) {
}
for
(
i
=
0
;
i
<
BLOCK_SIZES
;
++
i
)
{
if
(
is_interintra_allowed_bsize
(
i
)
&&
is_interintra_wedge_used
(
i
))
fc
->
wedge_interintra_prob
[
i
]
=
mode_mv_merge_probs
(
fc
->
wedge_interintra_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
wedge_interintra_prob
[
i
],
counts
->
wedge_interintra
[
i
]);
}
for
(
i
=
0
;
i
<
BLOCK_SIZES
;
++
i
)
{
if
(
is_interinter_wedge_used
(
i
))
fc
->
wedge_interinter_prob
[
i
]
=
mode_mv_merge_probs
(
fc
->
wedge_interinter_prob
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
wedge_interinter_prob
[
i
],
counts
->
wedge_interinter
[
i
]);
}
#endif // CONFIG_EXT_INTER
...
...
@@ -1381,12 +1381,12 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
if
(
cm
->
tx_mode
==
TX_MODE_SELECT
)
for
(
i
=
0
;
i
<
TXFM_PARTITION_CONTEXTS
;
++
i
)
fc
->
txfm_partition_prob
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
txfm_partition_prob
[
i
],
vp10_
mode_mv_merge_probs
(
pre_fc
->
txfm_partition_prob
[
i
],
counts
->
txfm_partition
[
i
]);
#endif
for
(
i
=
0
;
i
<
SKIP_CONTEXTS
;
++
i
)
fc
->
skip_probs
[
i
]
=
mode_mv_merge_probs
(
fc
->
skip_probs
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
skip_probs
[
i
],
counts
->
skip
[
i
]);
#if CONFIG_EXT_TX
...
...
@@ -1429,8 +1429,8 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
if
(
cm
->
seg
.
temporal_update
)
{
for
(
i
=
0
;
i
<
PREDICTION_PROBS
;
i
++
)
fc
->
seg
.
pred_probs
[
i
]
=
mode_mv_merge_probs
(
pre_fc
->
seg
.
pred_probs
[
i
],
counts
->
seg
.
pred
[
i
]);
fc
->
seg
.
pred_probs
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
seg
.
pred_probs
[
i
],
counts
->
seg
.
pred
[
i
]);
vpx_tree_merge_probs
(
vp10_segment_tree
,
pre_fc
->
seg
.
tree_probs
,
counts
->
seg
.
tree_mispred
,
fc
->
seg
.
tree_probs
);
...
...
@@ -1457,7 +1457,7 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
#if CONFIG_EXT_INTRA
for
(
i
=
0
;
i
<
PLANE_TYPES
;
++
i
)
{
fc
->
ext_intra_probs
[
i
]
=
mode_mv_merge_probs
(
fc
->
ext_intra_probs
[
i
]
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
ext_intra_probs
[
i
],
counts
->
ext_intra
[
i
]);
}
...
...
vp10/common/entropymv.c
View file @
cf3ee225
...
...
@@ -202,7 +202,7 @@ void vp10_adapt_mv_probs(VP10_COMMON *cm, int allow_hp) {
vpx_tree_merge_probs
(
vp10_mv_joint_tree
,
pre_fc
->
joints
,
counts
->
joints
,
fc
->
joints
);
#if CONFIG_REF_MV
fc
->
zero_rmv
=
mode_mv_merge_probs
(
pre_fc
->
zero_rmv
,
counts
->
zero_rmv
);
fc
->
zero_rmv
=
vp10_
mode_mv_merge_probs
(
pre_fc
->
zero_rmv
,
counts
->
zero_rmv
);
#endif
for
(
i
=
0
;
i
<
2
;
++
i
)
{
...
...
@@ -210,14 +210,14 @@ void vp10_adapt_mv_probs(VP10_COMMON *cm, int allow_hp) {
const
nmv_component
*
pre_comp
=
&
pre_fc
->
comps
[
i
];
const
nmv_component_counts
*
c
=
&
counts
->
comps
[
i
];
comp
->
sign
=
mode_mv_merge_probs
(
pre_comp
->
sign
,
c
->
sign
);
comp
->
sign
=
vp10_
mode_mv_merge_probs
(
pre_comp
->
sign
,
c
->
sign
);
vpx_tree_merge_probs
(
vp10_mv_class_tree
,
pre_comp
->
classes
,
c
->
classes
,
comp
->
classes
);
vpx_tree_merge_probs
(
vp10_mv_class0_tree
,
pre_comp
->
class0
,
c
->
class0
,
comp
->
class0
);
for
(
j
=
0
;
j
<
MV_OFFSET_BITS
;
++
j
)
comp
->
bits
[
j
]
=
mode_mv_merge_probs
(
pre_comp
->
bits
[
j
],
c
->
bits
[
j
]);
comp
->
bits
[
j
]
=
vp10_
mode_mv_merge_probs
(
pre_comp
->
bits
[
j
],
c
->
bits
[
j
]);
for
(
j
=
0
;
j
<
CLASS0_SIZE
;
++
j
)
vpx_tree_merge_probs
(
vp10_mv_fp_tree
,
pre_comp
->
class0_fp
[
j
],
...
...
@@ -226,9 +226,9 @@ void vp10_adapt_mv_probs(VP10_COMMON *cm, int allow_hp) {
vpx_tree_merge_probs
(
vp10_mv_fp_tree
,
pre_comp
->
fp
,
c
->
fp
,
comp
->
fp
);
if
(
allow_hp
)
{
comp
->
class0_hp
=
mode_mv_merge_probs
(
pre_comp
->
class0_hp
,
c
->
class0_hp
);
comp
->
hp
=
mode_mv_merge_probs
(
pre_comp
->
hp
,
c
->
hp
);
comp
->
class0_hp
=
vp10_
mode_mv_merge_probs
(
pre_comp
->
class0_hp
,
c
->
class0_hp
);
comp
->
hp
=
vp10_
mode_mv_merge_probs
(
pre_comp
->
hp
,
c
->
hp
);
}
}
}
...
...
@@ -245,14 +245,14 @@ void vp10_adapt_mv_probs(VP10_COMMON *cm, int allow_hp) {
const
nmv_component
*
pre_comp
=
&
pre_fc
->
comps
[
i
];
const
nmv_component_counts
*
c
=
&
counts
->
comps
[
i
];
comp
->
sign
=
mode_mv_merge_probs
(
pre_comp
->
sign
,
c
->
sign
);
comp
->
sign
=
vp10_
mode_mv_merge_probs
(
pre_comp
->
sign
,
c
->
sign
);
vpx_tree_merge_probs
(
vp10_mv_class_tree
,
pre_comp
->
classes
,
c
->
classes
,
comp
->
classes
);
vpx_tree_merge_probs
(
vp10_mv_class0_tree
,
pre_comp
->
class0
,
c
->
class0
,
comp
->
class0
);
for
(
j
=
0
;
j
<
MV_OFFSET_BITS
;
++
j
)
comp
->
bits
[
j
]
=
mode_mv_merge_probs
(
pre_comp
->
bits
[
j
],
c
->
bits
[
j
]);
comp
->
bits
[
j
]
=
vp10_
mode_mv_merge_probs
(
pre_comp
->
bits
[
j
],
c
->
bits
[
j
]);
for
(
j
=
0
;
j
<
CLASS0_SIZE
;
++
j
)
vpx_tree_merge_probs
(
vp10_mv_fp_tree
,
pre_comp
->
class0_fp
[
j
],
...
...
@@ -261,8 +261,9 @@ void vp10_adapt_mv_probs(VP10_COMMON *cm, int allow_hp) {
vpx_tree_merge_probs
(
vp10_mv_fp_tree
,
pre_comp
->
fp
,
c
->
fp
,
comp
->
fp
);
if
(
allow_hp
)
{
comp
->
class0_hp
=
mode_mv_merge_probs
(
pre_comp
->
class0_hp
,
c
->
class0_hp
);
comp
->
hp
=
mode_mv_merge_probs
(
pre_comp
->
hp
,
c
->
hp
);
comp
->
class0_hp
=
vp10_mode_mv_merge_probs
(
pre_comp
->
class0_hp
,
c
->
class0_hp
);
comp
->
hp
=
vp10_mode_mv_merge_probs
(
pre_comp
->
hp
,
c
->
hp
);
}
}
#endif
...
...
vp10/encoder/subexp.c
View file @
cf3ee225
...
...
@@ -191,9 +191,9 @@ static int get_cost(unsigned int ct[][2], vpx_prob p, int n) {
total_ct
[
0
]
+=
ct
[
i
][
0
];
total_ct
[
1
]
+=
ct
[
i
][
1
];
if
(
i
<
n
)
p
=
merge_probs
(
p0
,
total_ct
,
24
,
112
);
p
=
vp10_merge_probs
(
p0
,
total_ct
,
COEF_COUNT_SAT_BITS
,
COEF_MAX_UPDATE_FACTOR_BITS
);
}
return
cost
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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