Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
01906b53
Commit
01906b53
authored
11 years ago
by
Deb Mukherjee
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Download
Plain Diff
Merge "Refines variance based partitioning search"
parents
962c3bbe
90d13337
v1.14.0-linphone
1.4.X
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
frame_parallel
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
nextgen
nextgenv2
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/hkuang/frame_parallel
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vp9/encoder/vp9_encodeframe.c
+47
-12
vp9/encoder/vp9_encodeframe.c
with
47 additions
and
12 deletions
vp9/encoder/vp9_encodeframe.c
+
47
−
12
View file @
01906b53
...
@@ -94,7 +94,8 @@ static const uint8_t VP9_VAR_OFFS[64] = {
...
@@ -94,7 +94,8 @@ static const uint8_t VP9_VAR_OFFS[64] = {
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
};
};
static
unsigned
int
get_sby_perpixel_variance
(
VP9_COMP
*
cpi
,
MACROBLOCK
*
x
,
static
unsigned
int
get_sby_perpixel_variance
(
VP9_COMP
*
cpi
,
MACROBLOCK
*
x
,
BLOCK_SIZE
bs
)
{
BLOCK_SIZE
bs
)
{
unsigned
int
var
,
sse
;
unsigned
int
var
,
sse
;
var
=
cpi
->
fn_ptr
[
bs
].
vf
(
x
->
plane
[
0
].
src
.
buf
,
x
->
plane
[
0
].
src
.
stride
,
var
=
cpi
->
fn_ptr
[
bs
].
vf
(
x
->
plane
[
0
].
src
.
buf
,
x
->
plane
[
0
].
src
.
stride
,
...
@@ -102,19 +103,49 @@ static unsigned int get_sby_perpixel_variance(VP9_COMP *cpi, MACROBLOCK *x,
...
@@ -102,19 +103,49 @@ static unsigned int get_sby_perpixel_variance(VP9_COMP *cpi, MACROBLOCK *x,
return
ROUND_POWER_OF_TWO
(
var
,
num_pels_log2_lookup
[
bs
]);
return
ROUND_POWER_OF_TWO
(
var
,
num_pels_log2_lookup
[
bs
]);
}
}
static
BLOCK_SIZE
get_rd_var_based_fixed_partition
(
VP9_COMP
*
cpi
)
{
static
unsigned
int
get_sby_perpixel_diff_variance
(
VP9_COMP
*
cpi
,
unsigned
int
var
=
get_sby_perpixel_variance
(
cpi
,
&
cpi
->
mb
,
BLOCK_64X64
);
MACROBLOCK
*
x
,
if
(
var
<
256
)
int
mi_row
,
int
mi_col
,
BLOCK_SIZE
bs
)
{
const
YV12_BUFFER_CONFIG
*
yv12
=
get_ref_frame_buffer
(
cpi
,
LAST_FRAME
);
int
offset
=
(
mi_row
*
MI_SIZE
)
*
yv12
->
y_stride
+
(
mi_col
*
MI_SIZE
);
unsigned
int
var
,
sse
;
var
=
cpi
->
fn_ptr
[
bs
].
vf
(
x
->
plane
[
0
].
src
.
buf
,
x
->
plane
[
0
].
src
.
stride
,
yv12
->
y_buffer
+
offset
,
yv12
->
y_stride
,
&
sse
);
return
ROUND_POWER_OF_TWO
(
var
,
num_pels_log2_lookup
[
bs
]);
}
static
BLOCK_SIZE
get_rd_var_based_fixed_partition
(
VP9_COMP
*
cpi
,
int
mi_row
,
int
mi_col
)
{
unsigned
int
var
=
get_sby_perpixel_diff_variance
(
cpi
,
&
cpi
->
mb
,
mi_row
,
mi_col
,
BLOCK_64X64
);
if
(
var
<
8
)
return
BLOCK_64X64
;
return
BLOCK_64X64
;
else
else
if
(
var
<
128
)
return
BLOCK_32X32
;
return
BLOCK_32X32
;
else
if
(
var
<
2048
)
return
BLOCK_16X16
;
else
return
BLOCK_8X8
;
}
}
static
BLOCK_SIZE
get_nonrd_var_based_fixed_partition
(
VP9_COMP
*
cpi
)
{
static
BLOCK_SIZE
get_nonrd_var_based_fixed_partition
(
VP9_COMP
*
cpi
,
unsigned
int
var
=
get_sby_perpixel_variance
(
cpi
,
&
cpi
->
mb
,
BLOCK_64X64
);
int
mi_row
,
if
(
var
<
1024
)
int
mi_col
)
{
unsigned
int
var
=
get_sby_perpixel_diff_variance
(
cpi
,
&
cpi
->
mb
,
mi_row
,
mi_col
,
BLOCK_64X64
);
if
(
var
<
8
)
return
BLOCK_64X64
;
else
if
(
var
<
64
)
return
BLOCK_32X32
;
return
BLOCK_32X32
;
else
if
(
var
<
4096
)
else
if
(
var
<
2048
)
return
BLOCK_16X16
;
return
BLOCK_16X16
;
else
else
return
BLOCK_8X8
;
return
BLOCK_8X8
;
...
@@ -1265,7 +1296,8 @@ static void rd_use_partition(VP9_COMP *cpi,
...
@@ -1265,7 +1296,8 @@ static void rd_use_partition(VP9_COMP *cpi,
x
->
mb_energy
=
vp9_block_energy
(
cpi
,
x
,
bsize
);
x
->
mb_energy
=
vp9_block_energy
(
cpi
,
x
,
bsize
);
}
}
if
(
cpi
->
sf
.
adjust_partitioning_from_last_frame
)
{
if
(
cpi
->
sf
.
partition_search_type
==
SEARCH_PARTITION
&&
cpi
->
sf
.
adjust_partitioning_from_last_frame
)
{
// Check if any of the sub blocks are further split.
// Check if any of the sub blocks are further split.
if
(
partition
==
PARTITION_SPLIT
&&
subsize
>
BLOCK_8X8
)
{
if
(
partition
==
PARTITION_SPLIT
&&
subsize
>
BLOCK_8X8
)
{
sub_subsize
=
get_subsize
(
subsize
,
PARTITION_SPLIT
);
sub_subsize
=
get_subsize
(
subsize
,
PARTITION_SPLIT
);
...
@@ -1396,6 +1428,7 @@ static void rd_use_partition(VP9_COMP *cpi,
...
@@ -1396,6 +1428,7 @@ static void rd_use_partition(VP9_COMP *cpi,
}
}
if
(
cpi
->
sf
.
adjust_partitioning_from_last_frame
if
(
cpi
->
sf
.
adjust_partitioning_from_last_frame
&&
cpi
->
sf
.
partition_search_type
==
SEARCH_PARTITION
&&
partition
!=
PARTITION_SPLIT
&&
bsize
>
BLOCK_8X8
&&
partition
!=
PARTITION_SPLIT
&&
bsize
>
BLOCK_8X8
&&
(
mi_row
+
ms
<
cm
->
mi_rows
||
mi_row
+
(
ms
>>
1
)
==
cm
->
mi_rows
)
&&
(
mi_row
+
ms
<
cm
->
mi_rows
||
mi_row
+
(
ms
>>
1
)
==
cm
->
mi_rows
)
&&
(
mi_col
+
ms
<
cm
->
mi_cols
||
mi_col
+
(
ms
>>
1
)
==
cm
->
mi_cols
))
{
&&
(
mi_col
+
ms
<
cm
->
mi_cols
||
mi_col
+
(
ms
>>
1
)
==
cm
->
mi_cols
))
{
...
@@ -1995,7 +2028,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
...
@@ -1995,7 +2028,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
// map to the same thing.
// map to the same thing.
BLOCK_SIZE
bsize
;
BLOCK_SIZE
bsize
;
set_offsets
(
cpi
,
tile
,
mi_row
,
mi_col
,
BLOCK_64X64
);
set_offsets
(
cpi
,
tile
,
mi_row
,
mi_col
,
BLOCK_64X64
);
bsize
=
get_rd_var_based_fixed_partition
(
cpi
);
bsize
=
get_rd_var_based_fixed_partition
(
cpi
,
mi_row
,
mi_col
);
set_partitioning
(
cpi
,
tile
,
mi_8x8
,
mi_row
,
mi_col
,
bsize
);
set_partitioning
(
cpi
,
tile
,
mi_8x8
,
mi_row
,
mi_col
,
bsize
);
rd_use_partition
(
cpi
,
tile
,
mi_8x8
,
tp
,
mi_row
,
mi_col
,
BLOCK_64X64
,
rd_use_partition
(
cpi
,
tile
,
mi_8x8
,
tp
,
mi_row
,
mi_col
,
BLOCK_64X64
,
&
dummy_rate
,
&
dummy_dist
,
1
);
&
dummy_rate
,
&
dummy_dist
,
1
);
...
@@ -2377,7 +2410,9 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
...
@@ -2377,7 +2410,9 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
// TODO(debargha): Implement VAR_BASED_PARTITION as a separate case.
// TODO(debargha): Implement VAR_BASED_PARTITION as a separate case.
// Currently both VAR_BASED_FIXED_PARTITION/VAR_BASED_PARTITION
// Currently both VAR_BASED_FIXED_PARTITION/VAR_BASED_PARTITION
// map to the same thing.
// map to the same thing.
BLOCK_SIZE
bsize
=
get_nonrd_var_based_fixed_partition
(
cpi
);
BLOCK_SIZE
bsize
=
get_nonrd_var_based_fixed_partition
(
cpi
,
mi_row
,
mi_col
);
nonrd_use_partition
(
cpi
,
tile
,
mi_8x8
,
tp
,
mi_row
,
mi_col
,
nonrd_use_partition
(
cpi
,
tile
,
mi_8x8
,
tp
,
mi_row
,
mi_col
,
bsize
,
&
dummy_rate
,
&
dummy_dist
,
1
);
bsize
,
&
dummy_rate
,
&
dummy_dist
,
1
);
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
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!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets