Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
aom-rav1e
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
aom-rav1e
Commits
3755be94
Commit
3755be94
authored
Dec 16, 2013
by
Dmitry Kovalev
Committed by
Gerrit Code Review
Dec 16, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Using MV struct instead of int_mv union in encoder (2)."
parents
bb7b4bad
095b0323
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
93 deletions
+90
-93
vp9/encoder/vp9_firstpass.c
vp9/encoder/vp9_firstpass.c
+18
-21
vp9/encoder/vp9_mcomp.c
vp9/encoder/vp9_mcomp.c
+68
-68
vp9/encoder/vp9_mcomp.h
vp9/encoder/vp9_mcomp.h
+2
-2
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_rdopt.c
+2
-2
No files found.
vp9/encoder/vp9_firstpass.c
View file @
3755be94
...
...
@@ -393,14 +393,14 @@ static unsigned int zz_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
}
static
void
first_pass_motion_search
(
VP9_COMP
*
cpi
,
MACROBLOCK
*
x
,
int_mv
*
ref_mv
,
MV
*
best_mv
,
MV
*
ref_mv
,
MV
*
best_mv
,
YV12_BUFFER_CONFIG
*
recon_buffer
,
int
*
best_motion_err
,
int
recon_yoffset
)
{
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
int
num00
;
int_mv
tmp_mv
;
int_mv
ref_mv_full
;
MV
tmp_mv
=
{
0
,
0
}
;
MV
ref_mv_full
;
int
tmp_err
;
int
step_param
=
3
;
...
...
@@ -440,21 +440,20 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
xd
->
plane
[
0
].
pre
[
0
].
buf
=
recon_buffer
->
y_buffer
+
recon_yoffset
;
// Initial step/diamond search centred on best mv
tmp_mv
.
as_int
=
0
;
ref_mv_full
.
as_mv
.
col
=
ref_mv
->
as_mv
.
col
>>
3
;
ref_mv_full
.
as_mv
.
row
=
ref_mv
->
as_mv
.
row
>>
3
;
tmp_err
=
cpi
->
diamond_search_sad
(
x
,
&
ref_mv_full
.
as_mv
,
&
tmp_mv
.
as_mv
,
ref_mv_full
.
col
=
ref_mv
->
col
>>
3
;
ref_mv_full
.
row
=
ref_mv
->
row
>>
3
;
tmp_err
=
cpi
->
diamond_search_sad
(
x
,
&
ref_mv_full
,
&
tmp_mv
,
step_param
,
x
->
sadperbit16
,
&
num00
,
&
v_fn_ptr
,
x
->
nmvjointcost
,
x
->
mvcost
,
&
ref_mv
->
as
_mv
);
x
->
mvcost
,
ref
_mv
);
if
(
tmp_err
<
INT_MAX
-
new_mv_mode_penalty
)
tmp_err
+=
new_mv_mode_penalty
;
if
(
tmp_err
<
*
best_motion_err
)
{
*
best_motion_err
=
tmp_err
;
best_mv
->
row
=
tmp_mv
.
as_mv
.
row
;
best_mv
->
col
=
tmp_mv
.
as_mv
.
col
;
best_mv
->
row
=
tmp_mv
.
row
;
best_mv
->
col
=
tmp_mv
.
col
;
}
// Further step/diamond searches as necessary
...
...
@@ -467,18 +466,18 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
if
(
num00
)
{
num00
--
;
}
else
{
tmp_err
=
cpi
->
diamond_search_sad
(
x
,
&
ref_mv_full
.
as_mv
,
&
tmp_mv
.
as
_mv
,
tmp_err
=
cpi
->
diamond_search_sad
(
x
,
&
ref_mv_full
,
&
tmp
_mv
,
step_param
+
n
,
x
->
sadperbit16
,
&
num00
,
&
v_fn_ptr
,
x
->
nmvjointcost
,
x
->
mvcost
,
&
ref_mv
->
as
_mv
);
x
->
mvcost
,
ref
_mv
);
if
(
tmp_err
<
INT_MAX
-
new_mv_mode_penalty
)
tmp_err
+=
new_mv_mode_penalty
;
if
(
tmp_err
<
*
best_motion_err
)
{
*
best_motion_err
=
tmp_err
;
best_mv
->
row
=
tmp_mv
.
as_mv
.
row
;
best_mv
->
col
=
tmp_mv
.
as_mv
.
col
;
best_mv
->
row
=
tmp_mv
.
row
;
best_mv
->
col
=
tmp_mv
.
col
;
}
}
}
...
...
@@ -649,9 +648,8 @@ void vp9_first_pass(VP9_COMP *cpi) {
// Test last reference frame using the previous best mv as the
// starting point (best reference) for the search
first_pass_motion_search
(
cpi
,
x
,
&
best_ref_mv
,
&
mv
.
as_mv
,
lst_yv12
,
&
motion_error
,
recon_yoffset
);
first_pass_motion_search
(
cpi
,
x
,
&
best_ref_mv
.
as_mv
,
&
mv
.
as_mv
,
lst_yv12
,
&
motion_error
,
recon_yoffset
);
if
(
cpi
->
oxcf
.
aq_mode
==
VARIANCE_AQ
)
{
vp9_clear_system_state
();
// __asm emms;
motion_error
*=
error_weight
;
...
...
@@ -661,7 +659,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
// based search as well.
if
(
best_ref_mv
.
as_int
)
{
tmp_err
=
INT_MAX
;
first_pass_motion_search
(
cpi
,
x
,
&
zero_ref_mv
,
&
tmp_mv
.
as_mv
,
first_pass_motion_search
(
cpi
,
x
,
&
zero_ref_mv
.
as_mv
,
&
tmp_mv
.
as_mv
,
lst_yv12
,
&
tmp_err
,
recon_yoffset
);
if
(
cpi
->
oxcf
.
aq_mode
==
VARIANCE_AQ
)
{
vp9_clear_system_state
();
// __asm emms;
...
...
@@ -679,9 +677,8 @@ void vp9_first_pass(VP9_COMP *cpi) {
// Simple 0,0 motion with no mv overhead
gf_motion_error
=
zz_motion_search
(
cpi
,
x
,
gld_yv12
,
recon_yoffset
);
first_pass_motion_search
(
cpi
,
x
,
&
zero_ref_mv
,
&
tmp_mv
.
as_mv
,
gld_yv12
,
&
gf_motion_error
,
recon_yoffset
);
first_pass_motion_search
(
cpi
,
x
,
&
zero_ref_mv
.
as_mv
,
&
tmp_mv
.
as_mv
,
gld_yv12
,
&
gf_motion_error
,
recon_yoffset
);
if
(
cpi
->
oxcf
.
aq_mode
==
VARIANCE_AQ
)
{
vp9_clear_system_state
();
// __asm emms;
gf_motion_error
*=
error_weight
;
...
...
vp9/encoder/vp9_mcomp.c
View file @
3755be94
...
...
@@ -688,7 +688,7 @@ int vp9_find_best_sub_pixel_comp_tree(MACROBLOCK *x,
if (thissad < bestsad)\
{\
if (use_mvcost) \
thissad += mvsad_err_cost(&this_mv, &fcenter_mv
.as_mv
, \
thissad += mvsad_err_cost(&this_mv, &fcenter_mv, \
mvjsadcost, mvsadcost, \
sad_per_bit);\
if (thissad < bestsad)\
...
...
@@ -741,13 +741,13 @@ static int vp9_pattern_search(MACROBLOCK *x,
int
k
=
-
1
;
int
all_in
;
int
best_site
=
-
1
;
int_mv
fcenter_mv
;
MV
fcenter_mv
;
int
best_init_s
=
search_param_to_steps
[
search_param
];
int
*
mvjsadcost
=
x
->
nmvjointsadcost
;
int
*
mvsadcost
[
2
]
=
{
x
->
nmvsadcost
[
0
],
x
->
nmvsadcost
[
1
]};
fcenter_mv
.
as_mv
.
row
=
center_mv
->
row
>>
3
;
fcenter_mv
.
as_mv
.
col
=
center_mv
->
col
>>
3
;
fcenter_mv
.
row
=
center_mv
->
row
>>
3
;
fcenter_mv
.
col
=
center_mv
->
col
>>
3
;
// adjust ref_mv to make sure it is within MV range
clamp_mv
(
ref_mv
,
x
->
mv_col_min
,
x
->
mv_col_max
,
x
->
mv_row_min
,
x
->
mv_row_max
);
...
...
@@ -760,7 +760,7 @@ static int vp9_pattern_search(MACROBLOCK *x,
this_mv
.
row
=
br
;
this_mv
.
col
=
bc
;
bestsad
=
vfp
->
sdf
(
what
,
what_stride
,
this_offset
,
in_what_stride
,
0x7fffffff
)
+
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
.
as_mv
,
+
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
// Search all possible scales upto the search param around the center point
...
...
@@ -1212,13 +1212,13 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
uint8_t
*
check_here
;
int
thissad
;
int_mv
fcenter_mv
;
MV
fcenter_mv
;
int
*
mvjsadcost
=
x
->
nmvjointsadcost
;
int
*
mvsadcost
[
2
]
=
{
x
->
nmvsadcost
[
0
],
x
->
nmvsadcost
[
1
]};
fcenter_mv
.
as_mv
.
row
=
center_mv
->
row
>>
3
;
fcenter_mv
.
as_mv
.
col
=
center_mv
->
col
>>
3
;
fcenter_mv
.
row
=
center_mv
->
row
>>
3
;
fcenter_mv
.
col
=
center_mv
->
col
>>
3
;
clamp_mv
(
ref_mv
,
x
->
mv_col_min
,
x
->
mv_col_max
,
x
->
mv_row_min
,
x
->
mv_row_max
);
ref_row
=
ref_mv
->
row
;
...
...
@@ -1234,7 +1234,7 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
// Check the starting position
bestsad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
in_what
,
in_what_stride
,
0x7fffffff
)
+
mvsad_err_cost
(
best_mv
,
&
fcenter_mv
.
as_mv
,
+
mvsad_err_cost
(
best_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
// search_param determines the length of the initial step and hence the number
...
...
@@ -1263,7 +1263,7 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
if
(
thissad
<
bestsad
)
{
this_mv
.
row
=
this_row_offset
;
this_mv
.
col
=
this_col_offset
;
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
.
as_mv
,
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
if
(
thissad
<
bestsad
)
{
...
...
@@ -1295,7 +1295,7 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
if
(
thissad
<
bestsad
)
{
this_mv
.
row
=
this_row_offset
;
this_mv
.
col
=
this_col_offset
;
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
.
as_mv
,
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
...
...
@@ -1356,13 +1356,13 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
uint8_t
*
check_here
;
unsigned
int
thissad
;
int_mv
fcenter_mv
;
MV
fcenter_mv
;
int
*
mvjsadcost
=
x
->
nmvjointsadcost
;
int
*
mvsadcost
[
2
]
=
{
x
->
nmvsadcost
[
0
],
x
->
nmvsadcost
[
1
]};
fcenter_mv
.
as_mv
.
row
=
center_mv
->
row
>>
3
;
fcenter_mv
.
as_mv
.
col
=
center_mv
->
col
>>
3
;
fcenter_mv
.
row
=
center_mv
->
row
>>
3
;
fcenter_mv
.
col
=
center_mv
->
col
>>
3
;
clamp_mv
(
ref_mv
,
x
->
mv_col_min
,
x
->
mv_col_max
,
x
->
mv_row_min
,
x
->
mv_row_max
);
ref_row
=
ref_mv
->
row
;
...
...
@@ -1378,7 +1378,7 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
// Check the starting position
bestsad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
in_what
,
in_what_stride
,
0x7fffffff
)
+
mvsad_err_cost
(
best_mv
,
&
fcenter_mv
.
as_mv
,
+
mvsad_err_cost
(
best_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
// search_param determines the length of the initial step and hence the number
...
...
@@ -1420,7 +1420,7 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
if
(
sad_array
[
t
]
<
bestsad
)
{
this_mv
.
row
=
best_mv
->
row
+
ss
[
i
].
mv
.
row
;
this_mv
.
col
=
best_mv
->
col
+
ss
[
i
].
mv
.
col
;
sad_array
[
t
]
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
.
as_mv
,
sad_array
[
t
]
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
if
(
sad_array
[
t
]
<
bestsad
)
{
...
...
@@ -1447,7 +1447,7 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
if
(
thissad
<
bestsad
)
{
this_mv
.
row
=
this_row_offset
;
this_mv
.
col
=
this_col_offset
;
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
.
as_mv
,
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
if
(
thissad
<
bestsad
)
{
...
...
@@ -1478,7 +1478,7 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
if
(
thissad
<
bestsad
)
{
this_mv
.
row
=
this_row_offset
;
this_mv
.
col
=
this_col_offset
;
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
.
as_mv
,
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
...
...
@@ -1585,7 +1585,7 @@ int vp9_full_search_sad_c(MACROBLOCK *x, MV *ref_mv,
int
in_what_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
int
mv_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
uint8_t
*
bestaddress
;
int_mv
*
best_mv
=
&
x
->
e_mbd
.
mi_8x8
[
0
]
->
bmi
[
n
].
as_mv
[
0
]
;
MV
*
best_mv
=
&
x
->
e_mbd
.
mi_8x8
[
0
]
->
bmi
[
n
].
as_mv
[
0
].
as_mv
;
MV
this_mv
;
int
bestsad
=
INT_MAX
;
int
r
,
c
;
...
...
@@ -1612,13 +1612,13 @@ int vp9_full_search_sad_c(MACROBLOCK *x, MV *ref_mv,
in_what
=
xd
->
plane
[
0
].
pre
[
0
].
buf
;
bestaddress
=
in_what
+
(
ref_row
*
xd
->
plane
[
0
].
pre
[
0
].
stride
)
+
ref_col
;
best_mv
->
as_mv
.
row
=
ref_row
;
best_mv
->
as_mv
.
col
=
ref_col
;
best_mv
->
row
=
ref_row
;
best_mv
->
col
=
ref_col
;
// Baseline value at the centre
bestsad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
bestaddress
,
in_what_stride
,
0x7fffffff
)
+
mvsad_err_cost
(
&
best_mv
->
as
_mv
,
&
fcenter_mv
,
+
mvsad_err_cost
(
best
_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
// Apply further limits to prevent us looking using vectors that stretch
...
...
@@ -1642,8 +1642,8 @@ int vp9_full_search_sad_c(MACROBLOCK *x, MV *ref_mv,
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
best_mv
->
as_mv
.
row
=
r
;
best_mv
->
as_mv
.
col
=
c
;
best_mv
->
row
=
r
;
best_mv
->
col
=
c
;
bestaddress
=
check_here
;
}
...
...
@@ -1651,8 +1651,8 @@ int vp9_full_search_sad_c(MACROBLOCK *x, MV *ref_mv,
}
}
this_mv
.
row
=
best_mv
->
as_mv
.
row
*
8
;
this_mv
.
col
=
best_mv
->
as_mv
.
col
*
8
;
this_mv
.
row
=
best_mv
->
row
*
8
;
this_mv
.
col
=
best_mv
->
col
*
8
;
if
(
bestsad
<
INT_MAX
)
return
fn_ptr
->
vf
(
what
,
what_stride
,
bestaddress
,
in_what_stride
,
...
...
@@ -1674,7 +1674,7 @@ int vp9_full_search_sadx3(MACROBLOCK *x, MV *ref_mv,
int
in_what_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
int
mv_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
uint8_t
*
bestaddress
;
int_mv
*
best_mv
=
&
x
->
e_mbd
.
mi_8x8
[
0
]
->
bmi
[
n
].
as_mv
[
0
]
;
MV
*
best_mv
=
&
x
->
e_mbd
.
mi_8x8
[
0
]
->
bmi
[
n
].
as_mv
[
0
].
as_mv
;
MV
this_mv
;
unsigned
int
bestsad
=
INT_MAX
;
int
r
,
c
;
...
...
@@ -1703,13 +1703,13 @@ int vp9_full_search_sadx3(MACROBLOCK *x, MV *ref_mv,
in_what
=
xd
->
plane
[
0
].
pre
[
0
].
buf
;
bestaddress
=
in_what
+
(
ref_row
*
xd
->
plane
[
0
].
pre
[
0
].
stride
)
+
ref_col
;
best_mv
->
as_mv
.
row
=
ref_row
;
best_mv
->
as_mv
.
col
=
ref_col
;
best_mv
->
row
=
ref_row
;
best_mv
->
col
=
ref_col
;
// Baseline value at the centre
bestsad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
bestaddress
,
in_what_stride
,
0x7fffffff
)
+
mvsad_err_cost
(
&
best_mv
->
as
_mv
,
&
fcenter_mv
,
+
mvsad_err_cost
(
best
_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
// Apply further limits to prevent us looking using vectors that stretch
...
...
@@ -1739,8 +1739,8 @@ int vp9_full_search_sadx3(MACROBLOCK *x, MV *ref_mv,
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
best_mv
->
as_mv
.
row
=
r
;
best_mv
->
as_mv
.
col
=
c
;
best_mv
->
row
=
r
;
best_mv
->
col
=
c
;
bestaddress
=
check_here
;
}
}
...
...
@@ -1761,8 +1761,8 @@ int vp9_full_search_sadx3(MACROBLOCK *x, MV *ref_mv,
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
best_mv
->
as_mv
.
row
=
r
;
best_mv
->
as_mv
.
col
=
c
;
best_mv
->
row
=
r
;
best_mv
->
col
=
c
;
bestaddress
=
check_here
;
}
}
...
...
@@ -1772,8 +1772,8 @@ int vp9_full_search_sadx3(MACROBLOCK *x, MV *ref_mv,
}
}
this_mv
.
row
=
best_mv
->
as_mv
.
row
*
8
;
this_mv
.
col
=
best_mv
->
as_mv
.
col
*
8
;
this_mv
.
row
=
best_mv
->
row
*
8
;
this_mv
.
col
=
best_mv
->
col
*
8
;
if
(
bestsad
<
INT_MAX
)
return
fn_ptr
->
vf
(
what
,
what_stride
,
bestaddress
,
in_what_stride
,
...
...
@@ -1796,7 +1796,7 @@ int vp9_full_search_sadx8(MACROBLOCK *x, MV *ref_mv,
int
in_what_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
int
mv_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
uint8_t
*
bestaddress
;
int_mv
*
best_mv
=
&
x
->
e_mbd
.
mi_8x8
[
0
]
->
bmi
[
n
].
as_mv
[
0
]
;
MV
*
best_mv
=
&
x
->
e_mbd
.
mi_8x8
[
0
]
->
bmi
[
n
].
as_mv
[
0
].
as_mv
;
MV
this_mv
;
unsigned
int
bestsad
=
INT_MAX
;
int
r
,
c
;
...
...
@@ -1826,13 +1826,13 @@ int vp9_full_search_sadx8(MACROBLOCK *x, MV *ref_mv,
in_what
=
xd
->
plane
[
0
].
pre
[
0
].
buf
;
bestaddress
=
in_what
+
(
ref_row
*
xd
->
plane
[
0
].
pre
[
0
].
stride
)
+
ref_col
;
best_mv
->
as_mv
.
row
=
ref_row
;
best_mv
->
as_mv
.
col
=
ref_col
;
best_mv
->
row
=
ref_row
;
best_mv
->
col
=
ref_col
;
// Baseline value at the cent
re
// Baseline value at the cent
er
bestsad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
bestaddress
,
in_what_stride
,
0x7fffffff
)
+
mvsad_err_cost
(
&
best_mv
->
as
_mv
,
&
fcenter_mv
,
+
mvsad_err_cost
(
best
_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
// Apply further limits to prevent us looking using vectors that stretch
...
...
@@ -1862,8 +1862,8 @@ int vp9_full_search_sadx8(MACROBLOCK *x, MV *ref_mv,
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
best_mv
->
as_mv
.
row
=
r
;
best_mv
->
as_mv
.
col
=
c
;
best_mv
->
row
=
r
;
best_mv
->
col
=
c
;
bestaddress
=
check_here
;
}
}
...
...
@@ -1888,8 +1888,8 @@ int vp9_full_search_sadx8(MACROBLOCK *x, MV *ref_mv,
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
best_mv
->
as_mv
.
row
=
r
;
best_mv
->
as_mv
.
col
=
c
;
best_mv
->
row
=
r
;
best_mv
->
col
=
c
;
bestaddress
=
check_here
;
}
}
...
...
@@ -1910,8 +1910,8 @@ int vp9_full_search_sadx8(MACROBLOCK *x, MV *ref_mv,
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
best_mv
->
as_mv
.
row
=
r
;
best_mv
->
as_mv
.
col
=
c
;
best_mv
->
row
=
r
;
best_mv
->
col
=
c
;
bestaddress
=
check_here
;
}
}
...
...
@@ -1921,8 +1921,8 @@ int vp9_full_search_sadx8(MACROBLOCK *x, MV *ref_mv,
}
}
this_mv
.
row
=
best_mv
->
as_mv
.
row
*
8
;
this_mv
.
col
=
best_mv
->
as_mv
.
col
*
8
;
this_mv
.
row
=
best_mv
->
row
*
8
;
this_mv
.
col
=
best_mv
->
col
*
8
;
if
(
bestsad
<
INT_MAX
)
return
fn_ptr
->
vf
(
what
,
what_stride
,
bestaddress
,
in_what_stride
,
...
...
@@ -2136,9 +2136,9 @@ int vp9_refining_search_sadx4(MACROBLOCK *x,
* mode.
*/
int
vp9_refining_search_8p_c
(
MACROBLOCK
*
x
,
int_mv
*
ref_mv
,
int
error_per_bit
,
MV
*
ref_mv
,
int
error_per_bit
,
int
search_range
,
vp9_variance_fn_ptr_t
*
fn_ptr
,
int
*
mvjcost
,
int
*
mvcost
[
2
],
int_mv
*
center_mv
,
int
*
mvjcost
,
int
*
mvcost
[
2
],
const
MV
*
center_mv
,
const
uint8_t
*
second_pred
,
int
w
,
int
h
)
{
const
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
MV
neighbors
[
8
]
=
{{
-
1
,
0
},
{
0
,
-
1
},
{
0
,
1
},
{
1
,
0
},
...
...
@@ -2150,32 +2150,32 @@ int vp9_refining_search_8p_c(MACROBLOCK *x,
int
in_what_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
uint8_t
*
what
=
x
->
plane
[
0
].
src
.
buf
;
uint8_t
*
best_address
=
xd
->
plane
[
0
].
pre
[
0
].
buf
+
(
ref_mv
->
as_mv
.
row
*
xd
->
plane
[
0
].
pre
[
0
].
stride
)
+
ref_mv
->
as_mv
.
col
;
(
ref_mv
->
row
*
xd
->
plane
[
0
].
pre
[
0
].
stride
)
+
ref_mv
->
col
;
uint8_t
*
check_here
;
unsigned
int
thissad
;
int_mv
this_mv
;
MV
this_mv
;
unsigned
int
bestsad
=
INT_MAX
;
int_mv
fcenter_mv
;
MV
fcenter_mv
;
int
*
mvjsadcost
=
x
->
nmvjointsadcost
;
int
*
mvsadcost
[
2
]
=
{
x
->
nmvsadcost
[
0
],
x
->
nmvsadcost
[
1
]};
fcenter_mv
.
as_mv
.
row
=
center_mv
->
as_mv
.
row
>>
3
;
fcenter_mv
.
as_mv
.
col
=
center_mv
->
as_mv
.
col
>>
3
;
fcenter_mv
.
row
=
center_mv
->
row
>>
3
;
fcenter_mv
.
col
=
center_mv
->
col
>>
3
;
/* Get compound pred by averaging two pred blocks. */
bestsad
=
fn_ptr
->
sdaf
(
what
,
what_stride
,
best_address
,
in_what_stride
,
second_pred
,
0x7fffffff
)
+
mvsad_err_cost
(
&
ref_mv
->
as_mv
,
&
fcenter_mv
.
as
_mv
,
mvsad_err_cost
(
ref_mv
,
&
fcenter
_mv
,
mvjsadcost
,
mvsadcost
,
error_per_bit
);
for
(
i
=
0
;
i
<
search_range
;
i
++
)
{
int
best_site
=
-
1
;
for
(
j
=
0
;
j
<
8
;
j
++
)
{
this_row_offset
=
ref_mv
->
as_mv
.
row
+
neighbors
[
j
].
row
;
this_col_offset
=
ref_mv
->
as_mv
.
col
+
neighbors
[
j
].
col
;
this_row_offset
=
ref_mv
->
row
+
neighbors
[
j
].
row
;
this_col_offset
=
ref_mv
->
col
+
neighbors
[
j
].
col
;
if
((
this_col_offset
>
x
->
mv_col_min
)
&&
(
this_col_offset
<
x
->
mv_col_max
)
&&
...
...
@@ -2189,9 +2189,9 @@ int vp9_refining_search_8p_c(MACROBLOCK *x,
second_pred
,
bestsad
);
if
(
thissad
<
bestsad
)
{
this_mv
.
as_mv
.
row
=
this_row_offset
;
this_mv
.
as_mv
.
col
=
this_col_offset
;
thissad
+=
mvsad_err_cost
(
&
this_mv
.
as_mv
,
&
fcenter_mv
.
as
_mv
,
this_mv
.
row
=
this_row_offset
;
this_mv
.
col
=
this_col_offset
;
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter
_mv
,
mvjsadcost
,
mvsadcost
,
error_per_bit
);
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
...
...
@@ -2204,22 +2204,22 @@ int vp9_refining_search_8p_c(MACROBLOCK *x,
if
(
best_site
==
-
1
)
{
break
;
}
else
{
ref_mv
->
as_mv
.
row
+=
neighbors
[
best_site
].
row
;
ref_mv
->
as_mv
.
col
+=
neighbors
[
best_site
].
col
;
ref_mv
->
row
+=
neighbors
[
best_site
].
row
;
ref_mv
->
col
+=
neighbors
[
best_site
].
col
;
best_address
+=
(
neighbors
[
best_site
].
row
)
*
in_what_stride
+
neighbors
[
best_site
].
col
;
}
}
this_mv
.
as_mv
.
row
=
ref_mv
->
as_mv
.
row
*
8
;
this_mv
.
as_mv
.
col
=
ref_mv
->
as_mv
.
col
*
8
;
this_mv
.
row
=
ref_mv
->
row
*
8
;
this_mv
.
col
=
ref_mv
->
col
*
8
;
if
(
bestsad
<
INT_MAX
)
{
// FIXME(rbultje, yunqing): add full-pixel averaging variance functions
// so we don't have to use the subpixel with xoff=0,yoff=0 here.
return
fn_ptr
->
svaf
(
best_address
,
in_what_stride
,
0
,
0
,
what
,
what_stride
,
(
unsigned
int
*
)(
&
thissad
),
second_pred
)
+
mv_err_cost
(
&
this_mv
.
as_mv
,
&
center_mv
->
as
_mv
,
mv_err_cost
(
&
this_mv
,
center
_mv
,
mvjcost
,
mvcost
,
x
->
errorperbit
);
}
else
{
return
INT_MAX
;
...
...
vp9/encoder/vp9_mcomp.h
View file @
3755be94
...
...
@@ -124,9 +124,9 @@ typedef int (*vp9_diamond_search_fn_t)(MACROBLOCK *x,
const
MV
*
center_mv
);
int
vp9_refining_search_8p_c
(
MACROBLOCK
*
x
,
int_mv
*
ref_mv
,
int
error_per_bit
,
MV
*
ref_mv
,
int
error_per_bit
,
int
search_range
,
vp9_variance_fn_ptr_t
*
fn_ptr
,
int
*
mvjcost
,
int
*
mvcost
[
2
],
int_mv
*
center_mv
,
const
uint8_t
*
second_pred
,
const
MV
*
center_mv
,
const
uint8_t
*
second_pred
,
int
w
,
int
h
);
#endif // VP9_ENCODER_VP9_MCOMP_H_
vp9/encoder/vp9_rdopt.c
View file @
3755be94
...
...
@@ -2532,11 +2532,11 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
tmp_mv
.
as_mv
.
row
>>=
3
;
// Small-range full-pixel motion search
bestsme
=
vp9_refining_search_8p_c
(
x
,
&
tmp_mv
,
sadpb
,
bestsme
=
vp9_refining_search_8p_c
(
x
,
&
tmp_mv
.
as_mv
,
sadpb
,
search_range
,
&
cpi
->
fn_ptr
[
bsize
],
x
->
nmvjointcost
,
x
->
mvcost
,
&
ref_mv
[
id
],
second_pred
,
&
ref_mv
[
id
]
.
as_mv
,
second_pred
,
pw
,
ph
);
x
->
mv_col_min
=
tmp_col_min
;
...
...
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