Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
aom-rav1e
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
aom-rav1e
Commits
c9dfa3f7
Commit
c9dfa3f7
authored
10 years ago
by
Dmitry Kovalev
Browse files
Options
Downloads
Patches
Plain Diff
Cleaning up vp9_full_range_search_c() function.
Change-Id: Ifc9114aeacd493cfa04d4cb3d071bf1de80e0568
parent
bc811075
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vp9/encoder/vp9_mcomp.c
+44
-66
44 additions, 66 deletions
vp9/encoder/vp9_mcomp.c
with
44 additions
and
66 deletions
vp9/encoder/vp9_mcomp.c
+
44
−
66
View file @
c9dfa3f7
...
...
@@ -878,89 +878,67 @@ int vp9_full_range_search_c(const MACROBLOCK *x,
const
vp9_variance_fn_ptr_t
*
fn_ptr
,
const
MV
*
center_mv
)
{
const
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
const
uint8_t
*
what
=
x
->
plane
[
0
].
src
.
buf
;
const
int
what_stride
=
x
->
plane
[
0
].
src
.
stride
;
const
uint8_t
*
in_what
;
const
int
in_what_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
unsigned
int
bestsad
=
INT_MAX
;
int
ref_row
,
ref_col
;
unsigned
int
thissad
;
const
struct
buf_2d
*
const
what
=
&
x
->
plane
[
0
].
src
;
const
struct
buf_2d
*
const
in_what
=
&
xd
->
plane
[
0
].
pre
[
0
];
const
int
range
=
64
;
const
MV
fcenter_mv
=
{
center_mv
->
row
>>
3
,
center_mv
->
col
>>
3
};
int
tr
,
tc
;
int
best_tr
=
0
;
int
best_tc
=
0
;
int
range
=
64
;
int
start_col
,
end_col
;
int
start_row
,
end_row
;
int
i
;
unsigned
int
best_sad
=
INT_MAX
;
int
r
,
c
,
i
;
int
start_col
,
end_col
,
start_row
,
end_row
;
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
;
ref_col
=
ref_mv
->
col
;
*
best_mv
=
*
ref_mv
;
*
num00
=
11
;
best_mv
->
row
=
ref_row
;
best_mv
->
col
=
ref_col
;
// Work out the start point for the search
in_what
=
xd
->
plane
[
0
].
pre
[
0
].
buf
+
ref_row
*
in_what_stride
+
ref_col
;
// Check the starting position
bestsad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
in_what
,
in_what_stride
,
0x7fffffff
)
+
mvsad_err_cost
(
x
,
best_mv
,
&
fcenter_mv
,
sad_per_bit
);
start_row
=
MAX
(
-
range
,
x
->
mv_row_min
-
ref_row
);
start_col
=
MAX
(
-
range
,
x
->
mv_col_min
-
ref_col
);
end_row
=
MIN
(
range
,
x
->
mv_row_max
-
ref_row
);
end_col
=
MIN
(
range
,
x
->
mv_col_max
-
ref_col
);
for
(
tr
=
start_row
;
tr
<=
end_row
;
++
tr
)
{
for
(
tc
=
start_col
;
tc
<=
end_col
;
tc
+=
4
)
{
if
((
tc
+
3
)
<=
end_col
)
{
unsigned
int
sad_array
[
4
];
unsigned
char
const
*
addr_ref
[
4
];
for
(
i
=
0
;
i
<
4
;
++
i
)
addr_ref
[
i
]
=
in_what
+
tr
*
in_what_stride
+
tc
+
i
;
best_sad
=
fn_ptr
->
sdf
(
what
->
buf
,
what
->
stride
,
get_buf_from_mv
(
in_what
,
ref_mv
),
in_what
->
stride
,
0x7fffffff
)
+
mvsad_err_cost
(
x
,
ref_mv
,
&
fcenter_mv
,
sad_per_bit
);
start_row
=
MAX
(
-
range
,
x
->
mv_row_min
-
ref_mv
->
row
);
start_col
=
MAX
(
-
range
,
x
->
mv_col_min
-
ref_mv
->
col
);
end_row
=
MIN
(
range
,
x
->
mv_row_max
-
ref_mv
->
row
);
end_col
=
MIN
(
range
,
x
->
mv_col_max
-
ref_mv
->
col
);
for
(
r
=
start_row
;
r
<=
end_row
;
++
r
)
{
for
(
c
=
start_col
;
c
<=
end_col
;
c
+=
4
)
{
if
(
c
+
3
<=
end_col
)
{
unsigned
int
sads
[
4
];
const
uint8_t
*
addrs
[
4
];
for
(
i
=
0
;
i
<
4
;
++
i
)
{
const
MV
mv
=
{
ref_mv
->
row
+
r
,
ref_mv
->
col
+
c
+
i
};
addrs
[
i
]
=
get_buf_from_mv
(
in_what
,
&
mv
);
}
fn_ptr
->
sdx4df
(
what
,
what
_
stride
,
addr
_ref
,
in_what
_
stride
,
sad
_array
);
fn_ptr
->
sdx4df
(
what
->
buf
,
what
->
stride
,
addr
s
,
in_what
->
stride
,
sad
s
);
for
(
i
=
0
;
i
<
4
;
++
i
)
{
if
(
sad_array
[
i
]
<
bestsad
)
{
const
MV
this_mv
=
{
ref_row
+
tr
,
ref_col
+
tc
+
i
};
thissad
=
sad_array
[
i
]
+
mvsad_err_cost
(
x
,
&
this_mv
,
&
fcenter_mv
,
sad_per_bit
);
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
best_tr
=
tr
;
best_tc
=
tc
+
i
;
if
(
sads
[
i
]
<
best_sad
)
{
const
MV
mv
=
{
ref_mv
->
row
+
r
,
ref_mv
->
col
+
c
+
i
};
const
unsigned
int
sad
=
sads
[
i
]
+
mvsad_err_cost
(
x
,
&
mv
,
&
fcenter_mv
,
sad_per_bit
);
if
(
sad
<
best_sad
)
{
best_sad
=
sad
;
*
best_mv
=
mv
;
}
}
}
}
else
{
for
(
i
=
0
;
i
<
end_col
-
tc
;
++
i
)
{
const
uint8_t
*
check_here
=
in_what
+
tr
*
in_what_stride
+
tc
+
i
;
thissad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
check_here
,
in_what_stride
,
bestsad
);
if
(
thissad
<
bestsad
)
{
const
MV
this_mv
=
{
ref_row
+
tr
,
ref_col
+
tc
+
i
};
thissad
+=
mvsad_err_cost
(
x
,
&
this_mv
,
&
fcenter_mv
,
sad_per_bit
);
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
best_tr
=
tr
;
best_tc
=
tc
+
i
;
for
(
i
=
0
;
i
<
end_col
-
c
;
++
i
)
{
const
MV
mv
=
{
ref_mv
->
row
+
r
,
ref_mv
->
col
+
c
+
i
};
unsigned
int
sad
=
fn_ptr
->
sdf
(
what
->
buf
,
what
->
stride
,
get_buf_from_mv
(
in_what
,
&
mv
),
in_what
->
stride
,
best_sad
);
if
(
sad
<
best_sad
)
{
sad
+=
mvsad_err_cost
(
x
,
&
mv
,
&
fcenter_mv
,
sad_per_bit
);
if
(
sad
<
best_sad
)
{
best_sad
=
sad
;
*
best_mv
=
mv
;
}
}
}
}
}
}
best_mv
->
row
+=
best_tr
;
best_mv
->
col
+=
best_tc
;
return
bestsad
;
return
best_sad
;
}
int
vp9_diamond_search_sad_c
(
const
MACROBLOCK
*
x
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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