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
0e0a6f84
Commit
0e0a6f84
authored
Jul 31, 2013
by
Dmitry Kovalev
Committed by
Gerrit Code Review
Jul 31, 2013
Browse files
Merge "Consistent update for inter_mode probabilities."
parents
ac7bab75
8701bc11
Changes
5
Hide whitespace changes
Inline
Side-by-side
vp9/common/vp9_entropymode.c
View file @
0e0a6f84
...
...
@@ -356,29 +356,6 @@ void vp9_entropy_mode_init() {
vp9_inter_mode_tree
,
NEARESTMV
);
}
void
vp9_accum_mv_refs
(
VP9_COMMON
*
pc
,
MB_PREDICTION_MODE
m
,
const
int
context
)
{
unsigned
int
(
*
inter_mode_counts
)[
VP9_INTER_MODES
-
1
][
2
]
=
pc
->
counts
.
inter_mode
;
if
(
m
==
ZEROMV
)
{
++
inter_mode_counts
[
context
][
0
][
0
];
}
else
{
++
inter_mode_counts
[
context
][
0
][
1
];
if
(
m
==
NEARESTMV
)
{
++
inter_mode_counts
[
context
][
1
][
0
];
}
else
{
++
inter_mode_counts
[
context
][
1
][
1
];
if
(
m
==
NEARMV
)
{
++
inter_mode_counts
[
context
][
2
][
0
];
}
else
{
++
inter_mode_counts
[
context
][
2
][
1
];
}
}
}
}
#define COUNT_SAT 20
#define MAX_UPDATE_FACTOR 128
...
...
@@ -425,10 +402,11 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
fc
->
single_ref_prob
[
i
][
j
]
=
update_ct2
(
pre_fc
->
single_ref_prob
[
i
][
j
],
counts
->
single_ref
[
i
][
j
]);
for
(
j
=
0
;
j
<
INTER_MODE_CONTEXTS
;
j
++
)
for
(
i
=
0
;
i
<
VP9_INTER_MODES
-
1
;
i
++
)
fc
->
inter_mode_probs
[
j
][
i
]
=
update_ct2
(
pre_fc
->
inter_mode_probs
[
j
][
i
],
counts
->
inter_mode
[
j
][
i
]);
for
(
i
=
0
;
i
<
INTER_MODE_CONTEXTS
;
i
++
)
update_mode_probs
(
VP9_INTER_MODES
,
vp9_inter_mode_tree
,
counts
->
inter_mode
[
i
],
pre_fc
->
inter_mode_probs
[
i
],
fc
->
inter_mode_probs
[
i
],
NEARESTMV
);
for
(
i
=
0
;
i
<
BLOCK_SIZE_GROUPS
;
i
++
)
update_mode_probs
(
VP9_INTRA_MODES
,
vp9_intra_mode_tree
,
counts
->
y_mode
[
i
],
pre_fc
->
y_mode_prob
[
i
],
...
...
vp9/common/vp9_entropymode.h
View file @
0e0a6f84
...
...
@@ -67,10 +67,6 @@ void vp9_init_mbmode_probs(struct VP9Common *x);
void
vp9_adapt_mode_probs
(
struct
VP9Common
*
);
void
vp9_accum_mv_refs
(
struct
VP9Common
*
pc
,
MB_PREDICTION_MODE
m
,
const
int
context
);
void
tx_counts_to_branch_counts_32x32
(
unsigned
int
*
tx_count_32x32p
,
unsigned
int
(
*
ct_32x32p
)[
2
]);
void
tx_counts_to_branch_counts_16x16
(
unsigned
int
*
tx_count_16x16p
,
...
...
vp9/common/vp9_onyxc_int.h
View file @
0e0a6f84
...
...
@@ -64,7 +64,7 @@ typedef struct {
[
COEF_BANDS
][
PREV_COEF_CONTEXTS
];
unsigned
int
switchable_interp
[
VP9_SWITCHABLE_FILTERS
+
1
]
[
VP9_SWITCHABLE_FILTERS
];
unsigned
int
inter_mode
[
INTER_MODE_CONTEXTS
][
VP9_INTER_MODES
-
1
][
2
];
unsigned
int
inter_mode
[
INTER_MODE_CONTEXTS
][
VP9_INTER_MODES
];
unsigned
int
intra_inter
[
INTRA_INTER_CONTEXTS
][
2
];
unsigned
int
comp_inter
[
COMP_INTER_CONTEXTS
][
2
];
unsigned
int
single_ref
[
REF_CONTEXTS
][
2
][
2
];
...
...
vp9/decoder/vp9_decodemv.c
View file @
0e0a6f84
...
...
@@ -30,8 +30,12 @@ static MB_PREDICTION_MODE read_intra_mode(vp9_reader *r, const vp9_prob *p) {
return
(
MB_PREDICTION_MODE
)
treed_read
(
r
,
vp9_intra_mode_tree
,
p
);
}
static
MB_PREDICTION_MODE
read_inter_mode
(
vp9_reader
*
r
,
const
vp9_prob
*
p
)
{
return
(
MB_PREDICTION_MODE
)
treed_read
(
r
,
vp9_inter_mode_tree
,
p
);
static
MB_PREDICTION_MODE
read_inter_mode
(
VP9_COMMON
*
cm
,
vp9_reader
*
r
,
uint8_t
context
)
{
MB_PREDICTION_MODE
mode
=
treed_read
(
r
,
vp9_inter_mode_tree
,
cm
->
fc
.
inter_mode_probs
[
context
]);
++
cm
->
counts
.
inter_mode
[
context
][
inter_mode_offset
(
mode
)];
return
mode
;
}
static
int
read_segment_id
(
vp9_reader
*
r
,
const
struct
segmentation
*
seg
)
{
...
...
@@ -446,7 +450,7 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
int_mv
nearest
,
nearby
,
best_mv
;
int_mv
nearest_second
,
nearby_second
,
best_mv_second
;
vp9_prob
*
mv_ref_p
;
uint8_t
inter_mode_ctx
;
MV_REFERENCE_FRAME
ref0
,
ref1
;
read_ref_frames
(
pbi
,
r
,
mbmi
->
segment_id
,
mbmi
->
ref_frame
);
...
...
@@ -456,14 +460,13 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
vp9_find_mv_refs
(
cm
,
xd
,
mi
,
xd
->
prev_mode_info_context
,
ref0
,
mbmi
->
ref_mvs
[
ref0
],
cm
->
ref_frame_sign_bias
);
mv_ref_p
=
cm
->
fc
.
inter_mode_
probs
[
mbmi
->
mb_mode_context
[
ref0
]
]
;
inter_mode_
ctx
=
mbmi
->
mb_mode_context
[
ref0
];
if
(
vp9_segfeature_active
(
&
xd
->
seg
,
mbmi
->
segment_id
,
SEG_LVL_SKIP
))
{
if
(
vp9_segfeature_active
(
&
xd
->
seg
,
mbmi
->
segment_id
,
SEG_LVL_SKIP
))
mbmi
->
mode
=
ZEROMV
;
}
else
if
(
bsize
>=
BLOCK_SIZE_SB8X8
)
{
mbmi
->
mode
=
read_inter_mode
(
r
,
mv_ref_p
);
vp9_accum_mv_refs
(
cm
,
mbmi
->
mode
,
mbmi
->
mb_mode_context
[
ref0
]);
}
else
if
(
bsize
>=
BLOCK_SIZE_SB8X8
)
mbmi
->
mode
=
read_inter_mode
(
cm
,
r
,
inter_mode_ctx
);
mbmi
->
uv_mode
=
DC_PRED
;
// nearest, nearby
...
...
@@ -495,17 +498,16 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
for
(
idx
=
0
;
idx
<
2
;
idx
+=
num_4x4_w
)
{
int_mv
blockmv
,
secondmv
;
const
int
j
=
idy
*
2
+
idx
;
const
int
b
lock
mode
=
read_inter_mode
(
r
,
mv_ref_p
);
const
int
b
_
mode
=
read_inter_mode
(
cm
,
r
,
inter_mode_ctx
);
vp9_accum_mv_refs
(
cm
,
blockmode
,
mbmi
->
mb_mode_context
[
ref0
]);
if
(
blockmode
==
NEARESTMV
||
blockmode
==
NEARMV
)
{
if
(
b_mode
==
NEARESTMV
||
b_mode
==
NEARMV
)
{
vp9_append_sub8x8_mvs_for_idx
(
cm
,
xd
,
&
nearest
,
&
nearby
,
j
,
0
);
if
(
ref1
>
0
)
vp9_append_sub8x8_mvs_for_idx
(
cm
,
xd
,
&
nearest_second
,
&
nearby_second
,
j
,
1
);
}
switch
(
b
lock
mode
)
{
switch
(
b
_
mode
)
{
case
NEWMV
:
read_mv
(
r
,
&
blockmv
.
as_mv
,
&
best_mv
.
as_mv
,
nmvc
,
&
cm
->
counts
.
mv
,
xd
->
allow_high_precision_mv
);
...
...
@@ -540,7 +542,7 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
mi
->
bmi
[
j
+
2
]
=
mi
->
bmi
[
j
];
if
(
num_4x4_w
==
2
)
mi
->
bmi
[
j
+
1
]
=
mi
->
bmi
[
j
];
mi
->
mbmi
.
mode
=
b
lock
mode
;
mi
->
mbmi
.
mode
=
b
_
mode
;
}
}
...
...
vp9/encoder/vp9_bitstream.c
View file @
0e0a6f84
...
...
@@ -265,12 +265,17 @@ static void update_switchable_interp_probs(VP9_COMP *const cpi,
static
void
update_inter_mode_probs
(
VP9_COMMON
*
pc
,
vp9_writer
*
const
bc
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<
INTER_MODE_CONTEXTS
;
i
++
)
{
for
(
j
=
0
;
j
<
VP9_INTER_MODES
-
1
;
j
++
)
{
for
(
i
=
0
;
i
<
INTER_MODE_CONTEXTS
;
++
i
)
{
unsigned
int
branch_ct
[
VP9_INTER_MODES
-
1
][
2
];
vp9_prob
new_prob
[
VP9_INTER_MODES
-
1
];
vp9_tree_probs_from_distribution
(
vp9_inter_mode_tree
,
new_prob
,
branch_ct
,
pc
->
counts
.
inter_mode
[
i
],
NEARESTMV
);
for
(
j
=
0
;
j
<
VP9_INTER_MODES
-
1
;
++
j
)
vp9_cond_prob_diff_update
(
bc
,
&
pc
->
fc
.
inter_mode_probs
[
i
][
j
],
VP9_MODE_UPDATE_PROB
,
pc
->
counts
.
inter_mode
[
i
][
j
]);
}
VP9_MODE_UPDATE_PROB
,
branch_ct
[
j
]);
}
}
...
...
@@ -468,7 +473,8 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
if
(
!
vp9_segfeature_active
(
seg
,
segment_id
,
SEG_LVL_SKIP
))
{
if
(
bsize
>=
BLOCK_SIZE_SB8X8
)
{
write_sb_mv_ref
(
bc
,
mode
,
mv_ref_p
);
vp9_accum_mv_refs
(
&
cpi
->
common
,
mode
,
mi
->
mb_mode_context
[
rf
]);
++
pc
->
counts
.
inter_mode
[
mi
->
mb_mode_context
[
rf
]]
[
inter_mode_offset
(
mode
)];
}
}
...
...
@@ -494,7 +500,9 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
blockmode
=
x
->
partition_info
->
bmi
[
j
].
mode
;
blockmv
=
m
->
bmi
[
j
].
as_mv
[
0
];
write_sb_mv_ref
(
bc
,
blockmode
,
mv_ref_p
);
vp9_accum_mv_refs
(
&
cpi
->
common
,
blockmode
,
mi
->
mb_mode_context
[
rf
]);
++
pc
->
counts
.
inter_mode
[
mi
->
mb_mode_context
[
rf
]]
[
inter_mode_offset
(
blockmode
)];
if
(
blockmode
==
NEWMV
)
{
#ifdef ENTROPY_STATS
active_section
=
11
;
...
...
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