Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
libvpx
Commits
aa823f86
Commit
aa823f86
authored
Aug 26, 2013
by
Paul Wilkins
Committed by
Gerrit Code Review
Aug 26, 2013
Browse files
Merge "Changes to adaptive inter rd thresholds."
parents
642696b6
aa5b67ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
71 deletions
+14
-71
vp9/encoder/vp9_onyx_if.c
vp9/encoder/vp9_onyx_if.c
+6
-11
vp9/encoder/vp9_onyx_int.h
vp9/encoder/vp9_onyx_int.h
+0
-2
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_rdopt.c
+8
-58
No files found.
vp9/encoder/vp9_onyx_if.c
View file @
aa823f86
...
...
@@ -766,7 +766,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf
->
static_segmentation
=
0
;
#endif
sf
->
use_avoid_tested_higherror
=
1
;
sf
->
adaptive_rd_thresh
=
1
;
sf
->
adaptive_rd_thresh
=
MIN
((
speed
+
1
),
4
)
;
if
(
speed
==
1
)
{
sf
->
comp_inter_joint_search_thresh
=
BLOCK_SIZES
;
...
...
@@ -1402,7 +1402,7 @@ static void cal_nmvsadcosts_hp(int *mvsadcost[2]) {
}
VP9_PTR
vp9_create_compressor
(
VP9_CONFIG
*
oxcf
)
{
int
i
;
int
i
,
j
;
volatile
union
{
VP9_COMP
*
cpi
;
VP9_PTR
ptr
;
...
...
@@ -1604,9 +1604,10 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) {
vp9_set_speed_features
(
cpi
);
// Set starting values of RD threshold multipliers (128 = *1)
for
(
i
=
0
;
i
<
MAX_MODES
;
i
++
)
cpi
->
rd_thresh_mult
[
i
]
=
128
;
// Default rd threshold factors for mode selection
for
(
i
=
0
;
i
<
BLOCK_SIZES
;
++
i
)
for
(
j
=
0
;
j
<
MAX_MODES
;
++
j
)
cpi
->
rd_thresh_freq_fact
[
i
][
j
]
=
32
;
#define BFP(BT, SDF, SDAF, VF, SVF, SVAF, SVFHH, SVFHV, SVFHHV, \
SDX3F, SDX8F, SDX4DF)\
...
...
@@ -2636,8 +2637,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
// Set various flags etc to special state if it is a key frame
if
(
cm
->
frame_type
==
KEY_FRAME
)
{
int
i
;
// Reset the loop filter deltas and segmentation map
setup_features
(
cm
);
...
...
@@ -2650,10 +2649,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
// The alternate reference frame cannot be active for a key frame
cpi
->
source_alt_ref_active
=
0
;
// Reset the RD threshold multipliers to default of * 1 (128)
for
(
i
=
0
;
i
<
MAX_MODES
;
i
++
)
cpi
->
rd_thresh_mult
[
i
]
=
128
;
cm
->
error_resilient_mode
=
(
cpi
->
oxcf
.
error_resilient_mode
!=
0
);
cm
->
frame_parallel_decoding_mode
=
(
cpi
->
oxcf
.
frame_parallel_decoding_mode
!=
0
);
...
...
vp9/encoder/vp9_onyx_int.h
View file @
aa823f86
...
...
@@ -381,8 +381,6 @@ typedef struct VP9_COMP {
int
ref_frame_mask
;
int
set_ref_frame_mask
;
int
rd_thresh_mult
[
MAX_MODES
];
int
rd_baseline_thresh
[
BLOCK_SIZES
][
MAX_MODES
];
int
rd_threshes
[
BLOCK_SIZES
][
MAX_MODES
];
int
rd_thresh_freq_fact
[
BLOCK_SIZES
][
MAX_MODES
];
...
...
vp9/encoder/vp9_rdopt.c
View file @
aa823f86
...
...
@@ -104,9 +104,8 @@ const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
static
int
rd_thresh_block_size_factor
[
BLOCK_SIZES
]
=
{
2
,
3
,
3
,
4
,
6
,
6
,
8
,
12
,
12
,
16
,
24
,
24
,
32
};
#define BASE_RD_THRESH_FREQ_FACT 16
#define MAX_RD_THRESH_FREQ_FACT 32
#define MAX_RD_THRESH_FREQ_INC 1
#define MAX_RD_THRESH_FACT 64
#define RD_THRESH_INC 1
static
void
fill_token_costs
(
vp9_coeff_cost
*
c
,
vp9_coeff_probs_model
(
*
p
)[
BLOCK_TYPES
])
{
...
...
@@ -212,12 +211,6 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
}
else
{
cpi
->
rd_threshes
[
bsize
][
i
]
=
INT_MAX
;
}
cpi
->
rd_baseline_thresh
[
bsize
][
i
]
=
cpi
->
rd_threshes
[
bsize
][
i
];
if
(
cpi
->
sf
.
adaptive_rd_thresh
)
cpi
->
rd_thresh_freq_fact
[
bsize
][
i
]
=
MAX_RD_THRESH_FREQ_FACT
;
else
cpi
->
rd_thresh_freq_fact
[
bsize
][
i
]
=
BASE_RD_THRESH_FREQ_FACT
;
}
}
}
else
{
...
...
@@ -236,12 +229,6 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
}
else
{
cpi
->
rd_threshes
[
bsize
][
i
]
=
INT_MAX
;
}
cpi
->
rd_baseline_thresh
[
bsize
][
i
]
=
cpi
->
rd_threshes
[
bsize
][
i
];
if
(
cpi
->
sf
.
adaptive_rd_thresh
)
cpi
->
rd_thresh_freq_fact
[
bsize
][
i
]
=
MAX_RD_THRESH_FREQ_FACT
;
else
cpi
->
rd_thresh_freq_fact
[
bsize
][
i
]
=
BASE_RD_THRESH_FREQ_FACT
;
}
}
}
...
...
@@ -3227,7 +3214,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
// Test best rd so far against threshold for trying this mode.
if
((
best_rd
<
((
cpi
->
rd_threshes
[
bsize
][
mode_index
]
*
cpi
->
rd_thresh_freq_fact
[
bsize
][
mode_index
])
>>
4
))
||
cpi
->
rd_thresh_freq_fact
[
bsize
][
mode_index
])
>>
5
))
||
cpi
->
rd_threshes
[
bsize
][
mode_index
]
==
INT_MAX
)
continue
;
...
...
@@ -3788,29 +3775,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
}
}
#if 0
// Testing this mode gave rise to an improvement in best error score.
// Lower threshold a bit for next time
cpi->rd_thresh_mult[mode_index] =
(cpi->rd_thresh_mult[mode_index] >= (MIN_THRESHMULT + 2)) ?
cpi->rd_thresh_mult[mode_index] - 2 : MIN_THRESHMULT;
cpi->rd_threshes[mode_index] =
(cpi->rd_baseline_thresh[mode_index] >> 7)
* cpi->rd_thresh_mult[mode_index];
#endif
}
else
{
// If the mode did not help improve the best error case then
// raise the threshold for testing that mode next time around.
#if 0
cpi->rd_thresh_mult[mode_index] += 4;
if (cpi->rd_thresh_mult[mode_index] > MAX_THRESHMULT)
cpi->rd_thresh_mult[mode_index] = MAX_THRESHMULT;
cpi->rd_threshes[mode_index] =
(cpi->rd_baseline_thresh[mode_index] >> 7)
* cpi->rd_thresh_mult[mode_index];
#endif
}
/* keep record of best compound/single-only prediction */
...
...
@@ -3953,33 +3917,19 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if
(
cpi
->
sf
.
adaptive_rd_thresh
)
{
for
(
mode_index
=
0
;
mode_index
<
MAX_MODES
;
++
mode_index
)
{
if
(
mode_index
==
best_mode_index
)
{
cpi
->
rd_thresh_freq_fact
[
bsize
][
mode_index
]
=
BASE_RD_THRESH_FREQ_FACT
;
cpi
->
rd_thresh_freq_fact
[
bsize
][
mode_index
]
-=
(
cpi
->
rd_thresh_freq_fact
[
bsize
][
mode_index
]
>>
3
);
}
else
{
cpi
->
rd_thresh_freq_fact
[
bsize
][
mode_index
]
+=
MAX_
RD_THRESH_
FREQ_
INC
;
cpi
->
rd_thresh_freq_fact
[
bsize
][
mode_index
]
+=
RD_THRESH_INC
;
if
(
cpi
->
rd_thresh_freq_fact
[
bsize
][
mode_index
]
>
(
cpi
->
sf
.
adaptive_rd_thresh
*
MAX_RD_THRESH_
FREQ_
FACT
))
{
(
cpi
->
sf
.
adaptive_rd_thresh
*
MAX_RD_THRESH_FACT
))
{
cpi
->
rd_thresh_freq_fact
[
bsize
][
mode_index
]
=
cpi
->
sf
.
adaptive_rd_thresh
*
MAX_RD_THRESH_
FREQ_
FACT
;
cpi
->
sf
.
adaptive_rd_thresh
*
MAX_RD_THRESH_FACT
;
}
}
}
}
// TODO(rbultje) integrate with RD trd_thresh_freq_facthresholding
#if 0
// Reduce the activation RD thresholds for the best choice mode
if ((cpi->rd_baseline_thresh[best_mode_index] > 0) &&
(cpi->rd_baseline_thresh[best_mode_index] < (INT_MAX >> 2))) {
int best_adjustment = (cpi->rd_thresh_mult[best_mode_index] >> 2);
cpi->rd_thresh_mult[best_mode_index] =
(cpi->rd_thresh_mult[best_mode_index] >= (MIN_THRESHMULT + best_adjustment)) ?
cpi->rd_thresh_mult[best_mode_index] - best_adjustment : MIN_THRESHMULT;
cpi->rd_threshes[best_mode_index] =
(cpi->rd_baseline_thresh[best_mode_index] >> 7) * cpi->rd_thresh_mult[best_mode_index];
}
#endif
// macroblock modes
*
mbmi
=
best_mbmode
;
x
->
skip
|=
best_skip2
;
...
...
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