Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Guillaume Martres
aom-rav1e
Commits
109a2edf
Commit
109a2edf
authored
May 27, 2015
by
Marco
Committed by
Gerrit Code Review
May 27, 2015
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Refactor set_vbp_thresholds."
parents
30181c46
f76d42a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
48 deletions
+38
-48
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_encodeframe.c
+36
-46
vp9/encoder/vp9_encodeframe.h
vp9/encoder/vp9_encodeframe.h
+1
-1
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_encoder.c
+1
-1
No files found.
vp9/encoder/vp9_encodeframe.c
View file @
109a2edf
...
...
@@ -464,46 +464,53 @@ static int set_vt_partitioning(VP9_COMP *cpi,
return
0
;
}
void
vp9_set_vbp_thresholds
(
VP9_COMP
*
cpi
,
int
q
)
{
// Set the variance split thresholds for following the block sizes:
// 0 - threshold_64x64, 1 - threshold_32x32, 2 - threshold_16x16,
// 3 - vbp_threshold_8x8. vbp_threshold_8x8 (to split to 4x4 partition) is
// currently only used on key frame.
static
void
set_vbp_thresholds
(
VP9_COMP
*
cpi
,
int64_t
thresholds
[],
int
q
)
{
VP9_COMMON
*
const
cm
=
&
cpi
->
common
;
const
int
is_key_frame
=
(
cm
->
frame_type
==
KEY_FRAME
);
const
int
threshold_multiplier
=
is_key_frame
?
20
:
1
;
const
int64_t
threshold_base
=
(
int64_t
)(
threshold_multiplier
*
cpi
->
y_dequant
[
q
][
1
]);
if
(
is_key_frame
)
{
thresholds
[
0
]
=
threshold_base
;
thresholds
[
1
]
=
threshold_base
>>
2
;
thresholds
[
2
]
=
threshold_base
>>
2
;
thresholds
[
3
]
=
threshold_base
<<
2
;
}
else
{
thresholds
[
1
]
=
threshold_base
;
if
(
cm
->
width
<=
352
&&
cm
->
height
<=
288
)
{
thresholds
[
0
]
=
threshold_base
>>
2
;
thresholds
[
2
]
=
threshold_base
<<
3
;
}
else
{
thresholds
[
0
]
=
threshold_base
;
thresholds
[
1
]
=
(
5
*
threshold_base
)
>>
2
;
thresholds
[
2
]
=
threshold_base
<<
cpi
->
oxcf
.
speed
;
}
}
}
void
vp9_set_variance_partition_thresholds
(
VP9_COMP
*
cpi
,
int
q
)
{
VP9_COMMON
*
const
cm
=
&
cpi
->
common
;
SPEED_FEATURES
*
const
sf
=
&
cpi
->
sf
;
const
int
is_key_frame
=
(
cm
->
frame_type
==
KEY_FRAME
);
if
(
sf
->
partition_search_type
!=
VAR_BASED_PARTITION
&&
sf
->
partition_search_type
!=
REFERENCE_PARTITION
)
{
return
;
}
else
{
VP9_COMMON
*
const
cm
=
&
cpi
->
common
;
const
int
is_key_frame
=
(
cm
->
frame_type
==
KEY_FRAME
);
const
int
threshold_multiplier
=
is_key_frame
?
20
:
1
;
const
int64_t
threshold_base
=
(
int64_t
)(
threshold_multiplier
*
cpi
->
y_dequant
[
q
][
1
]);
// TODO(marpan): Allow 4x4 partitions for inter-frames.
// use_4x4_partition = (variance4x4downsample[i2 + j] == 1);
// If 4x4 partition is not used, then 8x8 partition will be selected
// if variance of 16x16 block is very high, so use larger threshold
// for 16x16 (threshold_bsize_min) in that case.
// Array index: 0 - threshold_64x64; 1 - threshold_32x32;
// 2 - threshold_16x16; 3 - vbp_threshold_8x8;
set_vbp_thresholds
(
cpi
,
cpi
->
vbp_thresholds
,
q
);
// The thresholds below are not changed locally.
if
(
is_key_frame
)
{
cpi
->
vbp_thresholds
[
0
]
=
threshold_base
;
cpi
->
vbp_thresholds
[
1
]
=
threshold_base
>>
2
;
cpi
->
vbp_thresholds
[
2
]
=
threshold_base
>>
2
;
cpi
->
vbp_thresholds
[
3
]
=
threshold_base
<<
2
;
cpi
->
vbp_threshold_sad
=
0
;
cpi
->
vbp_bsize_min
=
BLOCK_8X8
;
}
else
{
cpi
->
vbp_thresholds
[
1
]
=
threshold_base
;
if
(
cm
->
width
<=
352
&&
cm
->
height
<=
288
)
{
cpi
->
vbp_thresholds
[
0
]
=
threshold_base
>>
2
;
cpi
->
vbp_thresholds
[
2
]
=
threshold_base
<<
3
;
if
(
cm
->
width
<=
352
&&
cm
->
height
<=
288
)
cpi
->
vbp_threshold_sad
=
100
;
}
else
{
cpi
->
vbp_thresholds
[
0
]
=
threshold_base
;
cpi
->
vbp_thresholds
[
1
]
=
(
5
*
threshold_base
)
>>
2
;
cpi
->
vbp_thresholds
[
2
]
=
threshold_base
<<
cpi
->
oxcf
.
speed
;
else
cpi
->
vbp_threshold_sad
=
(
cpi
->
y_dequant
[
q
][
1
]
<<
1
)
>
1000
?
(
cpi
->
y_dequant
[
q
][
1
]
<<
1
)
:
1000
;
}
cpi
->
vbp_bsize_min
=
BLOCK_16X16
;
}
cpi
->
vbp_threshold_minmax
=
15
+
(
q
>>
3
);
...
...
@@ -552,23 +559,6 @@ static int compute_minmax_8x8(const uint8_t *s, int sp, const uint8_t *d,
return
(
minmax_max
-
minmax_min
);
}
static
void
modify_vbp_thresholds
(
VP9_COMP
*
cpi
,
int64_t
thresholds
[],
int
q
)
{
VP9_COMMON
*
const
cm
=
&
cpi
->
common
;
const
int64_t
threshold_base
=
(
int64_t
)(
cpi
->
y_dequant
[
q
][
1
]);
// Array index: 0 - threshold_64x64; 1 - threshold_32x32;
// 2 - threshold_16x16; 3 - vbp_threshold_8x8;
thresholds
[
1
]
=
threshold_base
;
if
(
cm
->
width
<=
352
&&
cm
->
height
<=
288
)
{
thresholds
[
0
]
=
threshold_base
>>
2
;
thresholds
[
2
]
=
threshold_base
<<
3
;
}
else
{
thresholds
[
0
]
=
threshold_base
;
thresholds
[
1
]
=
(
5
*
threshold_base
)
>>
2
;
thresholds
[
2
]
=
threshold_base
<<
cpi
->
oxcf
.
speed
;
}
}
static
void
fill_variance_4x4avg
(
const
uint8_t
*
s
,
int
sp
,
const
uint8_t
*
d
,
int
dp
,
int
x8_idx
,
int
y8_idx
,
v8x8
*
vst
,
#if CONFIG_VP9_HIGHBITDEPTH
...
...
@@ -681,7 +671,7 @@ static int choose_partitioning(VP9_COMP *cpi,
if
(
cyclic_refresh_segment_id_boosted
(
segment_id
))
{
int
q
=
vp9_get_qindex
(
&
cm
->
seg
,
segment_id
,
cm
->
base_qindex
);
modify
_vbp_thresholds
(
cpi
,
thresholds
,
q
);
set
_vbp_thresholds
(
cpi
,
thresholds
,
q
);
}
}
...
...
vp9/encoder/vp9_encodeframe.h
View file @
109a2edf
...
...
@@ -40,7 +40,7 @@ void vp9_init_tile_data(struct VP9_COMP *cpi);
void
vp9_encode_tile
(
struct
VP9_COMP
*
cpi
,
struct
ThreadData
*
td
,
int
tile_row
,
int
tile_col
);
void
vp9_set_v
bp
_thresholds
(
struct
VP9_COMP
*
cpi
,
int
q
);
void
vp9_set_v
ariance_partition
_thresholds
(
struct
VP9_COMP
*
cpi
,
int
q
);
#ifdef __cplusplus
}
// extern "C"
...
...
vp9/encoder/vp9_encoder.c
View file @
109a2edf
...
...
@@ -3031,7 +3031,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi) {
set_size_dependent_vars
(
cpi
,
&
q
,
&
bottom_index
,
&
top_index
);
vp9_set_quantizer
(
cm
,
q
);
vp9_set_v
bp
_thresholds
(
cpi
,
q
);
vp9_set_v
ariance_partition
_thresholds
(
cpi
,
q
);
setup_frame
(
cpi
);
...
...
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