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
6e9ca1ec
Commit
6e9ca1ec
authored
11 years ago
by
Dmitry Kovalev
Browse files
Options
Download
Patches
Plain Diff
Adding get_buf_from_mv() function.
Change-Id: I21aff45546778b8393e2edf2d810448dec1f4cdb
parent
e0c21264
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_mcomp.c
+52
-69
vp9/encoder/vp9_mcomp.c
with
52 additions
and
69 deletions
vp9/encoder/vp9_mcomp.c
+
52
−
69
View file @
6e9ca1ec
...
...
@@ -23,6 +23,11 @@
// #define NEW_DIAMOND_SEARCH
static
INLINE
const
uint8_t
*
get_buf_from_mv
(
const
struct
buf_2d
*
buf
,
const
MV
*
mv
)
{
return
&
buf
->
buf
[
mv
->
row
*
buf
->
stride
+
mv
->
col
];
}
void
vp9_set_mv_search_range
(
MACROBLOCK
*
x
,
const
MV
*
mv
)
{
int
col_min
=
(
mv
->
col
>>
3
)
-
MAX_FULL_PEL_VAL
+
(
mv
->
col
&
7
?
1
:
0
);
int
row_min
=
(
mv
->
row
>>
3
)
-
MAX_FULL_PEL_VAL
+
(
mv
->
row
&
7
?
1
:
0
);
...
...
@@ -1326,10 +1331,8 @@ int vp9_full_search_sad_c(const MACROBLOCK *x, const MV *ref_mv,
const
MV
*
center_mv
,
MV
*
best_mv
)
{
int
r
,
c
;
const
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
const
uint8_t
*
const
what
=
x
->
plane
[
0
].
src
.
buf
;
const
int
what_stride
=
x
->
plane
[
0
].
src
.
stride
;
const
uint8_t
*
const
in_what
=
xd
->
plane
[
0
].
pre
[
0
].
buf
;
const
int
in_what_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
const
struct
buf_2d
*
const
what
=
&
x
->
plane
[
0
].
src
;
const
struct
buf_2d
*
const
in_what
=
&
xd
->
plane
[
0
].
pre
[
0
];
const
int
row_min
=
MAX
(
ref_mv
->
row
-
distance
,
x
->
mv_row_min
);
const
int
row_max
=
MIN
(
ref_mv
->
row
+
distance
,
x
->
mv_row_max
);
const
int
col_min
=
MAX
(
ref_mv
->
col
-
distance
,
x
->
mv_col_min
);
...
...
@@ -1337,25 +1340,22 @@ int vp9_full_search_sad_c(const MACROBLOCK *x, const MV *ref_mv,
const
int
*
mvjsadcost
=
x
->
nmvjointsadcost
;
int
*
mvsadcost
[
2
]
=
{
x
->
nmvsadcost
[
0
],
x
->
nmvsadcost
[
1
]};
const
MV
fcenter_mv
=
{
center_mv
->
row
>>
3
,
center_mv
->
col
>>
3
};
const
uint8_t
*
best_address
=
&
in_what
[
ref_mv
->
row
*
in_what_stride
+
ref_mv
->
col
];
int
best_sad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
best_address
,
in_what_stride
,
0x7fffffff
)
+
int
best_sad
=
fn_ptr
->
sdf
(
what
->
buf
,
what
->
stride
,
get_buf_from_mv
(
in_what
,
ref_mv
),
in_what
->
stride
,
0x7fffffff
)
+
mvsad_err_cost
(
ref_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
*
best_mv
=
*
ref_mv
;
for
(
r
=
row_min
;
r
<
row_max
;
++
r
)
{
for
(
c
=
col_min
;
c
<
col_max
;
++
c
)
{
const
MV
this_mv
=
{
r
,
c
};
const
uint8_t
*
check_here
=
&
in_what
[
r
*
in_what_stride
+
c
];
const
int
sad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
check_here
,
in_what_stride
,
best_sad
)
+
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
const
MV
mv
=
{
r
,
c
};
const
int
sad
=
fn_ptr
->
sdf
(
what
->
buf
,
what
->
stride
,
get_buf_from_mv
(
in_what
,
&
mv
),
in_what
->
stride
,
best_sad
)
+
mvsad_err_cost
(
&
mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
sad_per_bit
);
if
(
sad
<
best_sad
)
{
best_sad
=
sad
;
*
best_mv
=
this_
mv
;
*
best_mv
=
mv
;
}
}
}
...
...
@@ -1579,41 +1579,34 @@ int vp9_refining_search_sad_c(const MACROBLOCK *x,
const
vp9_variance_fn_ptr_t
*
fn_ptr
,
int
*
mvjcost
,
int
*
mvcost
[
2
],
const
MV
*
center_mv
)
{
const
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
const
MV
neighbors
[
4
]
=
{{
-
1
,
0
},
{
0
,
-
1
},
{
0
,
1
},
{
1
,
0
}};
int
i
,
j
;
const
int
what_stride
=
x
->
plane
[
0
].
src
.
stride
;
const
uint8_t
*
const
what
=
x
->
plane
[
0
].
src
.
buf
;
const
int
in_what_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
const
uint8_t
*
const
in_what
=
xd
->
plane
[
0
].
pre
[
0
].
buf
;
const
uint8_t
*
best_address
=
&
in_what
[
ref_mv
->
row
*
in_what_stride
+
ref_mv
->
col
];
const
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
const
struct
buf_2d
*
const
what
=
&
x
->
plane
[
0
].
src
;
const
struct
buf_2d
*
const
in_what
=
&
xd
->
plane
[
0
].
pre
[
0
];
const
MV
fcenter_mv
=
{
center_mv
->
row
>>
3
,
center_mv
->
col
>>
3
};
const
int
*
mvjsadcost
=
x
->
nmvjointsadcost
;
int
*
mvsadcost
[
2
]
=
{
x
->
nmvsadcost
[
0
],
x
->
nmvsadcost
[
1
]};
unsigned
int
bestsad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
best_address
,
in_what_stride
,
0x7fffffff
)
+
unsigned
int
best_sad
=
fn_ptr
->
sdf
(
what
->
buf
,
what
->
stride
,
get_buf_from_mv
(
in_what
,
ref_mv
),
in_what
->
stride
,
0x7fffffff
)
+
mvsad_err_cost
(
ref_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
error_per_bit
);
int
i
,
j
;
for
(
i
=
0
;
i
<
search_range
;
i
++
)
{
int
best_site
=
-
1
;
for
(
j
=
0
;
j
<
4
;
j
++
)
{
const
MV
this_mv
=
{
ref_mv
->
row
+
neighbors
[
j
].
row
,
ref_mv
->
col
+
neighbors
[
j
].
col
};
if
(
is_mv_in
(
x
,
&
this_mv
))
{
const
uint8_t
*
check_here
=
&
in_what
[
this_mv
.
row
*
in_what_stride
+
this_mv
.
col
];
unsigned
int
thissad
=
fn_ptr
->
sdf
(
what
,
what_stride
,
check_here
,
in_what_stride
,
bestsad
);
if
(
thissad
<
bestsad
)
{
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
error_per_bit
);
if
(
thissad
<
bestsad
)
{
bestsad
=
thissad
;
const
MV
mv
=
{
ref_mv
->
row
+
neighbors
[
j
].
row
,
ref_mv
->
col
+
neighbors
[
j
].
col
};
if
(
is_mv_in
(
x
,
&
mv
))
{
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
(
&
mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
error_per_bit
);
if
(
sad
<
best_sad
)
{
best_sad
=
sad
;
best_site
=
j
;
}
}
...
...
@@ -1627,7 +1620,7 @@ int vp9_refining_search_sad_c(const MACROBLOCK *x,
ref_mv
->
col
+=
neighbors
[
best_site
].
col
;
}
}
return
bestsad
;
return
best
_
sad
;
}
int
vp9_refining_search_sadx4
(
const
MACROBLOCK
*
x
,
...
...
@@ -1735,46 +1728,36 @@ int vp9_refining_search_8p_c(const MACROBLOCK *x,
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
;
const
MV
neighbors
[
8
]
=
{{
-
1
,
0
},
{
0
,
-
1
},
{
0
,
1
},
{
1
,
0
},
{
-
1
,
-
1
},
{
1
,
-
1
},
{
-
1
,
1
},
{
1
,
1
}};
int
i
,
j
;
const
uint8_t
*
what
=
x
->
plane
[
0
].
src
.
buf
;
const
int
what_stride
=
x
->
plane
[
0
].
src
.
stride
;
const
uint8_t
*
in_what
=
xd
->
plane
[
0
].
pre
[
0
].
buf
;
const
int
in_what_stride
=
xd
->
plane
[
0
].
pre
[
0
].
stride
;
const
uint8_t
*
best_address
=
&
in_what
[
ref_mv
->
row
*
in_what_stride
+
ref_mv
->
col
];
const
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
const
struct
buf_2d
*
const
what
=
&
x
->
plane
[
0
].
src
;
const
struct
buf_2d
*
const
in_what
=
&
xd
->
plane
[
0
].
pre
[
0
];
const
MV
fcenter_mv
=
{
center_mv
->
row
>>
3
,
center_mv
->
col
>>
3
};
const
int
*
mvjsadcost
=
x
->
nmvjointsadcost
;
int
*
mvsadcost
[
2
]
=
{
x
->
nmvsadcost
[
0
],
x
->
nmvsadcost
[
1
]};
/* Get compound pred by averaging two pred blocks. */
unsigned
int
bestsad
=
fn_ptr
->
sdaf
(
what
,
what_stride
,
best_address
,
in_what_stride
,
second_pred
,
0x7fffffff
)
+
unsigned
int
best_sad
=
fn_ptr
->
sdaf
(
what
->
buf
,
what
->
stride
,
get_buf_from_mv
(
in_what
,
ref_mv
),
in_what
->
stride
,
second_pred
,
0x7fffffff
)
+
mvsad_err_cost
(
ref_mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
error_per_bit
);
int
i
,
j
;
for
(
i
=
0
;
i
<
search_range
;
++
i
)
{
int
best_site
=
-
1
;
for
(
j
=
0
;
j
<
8
;
j
++
)
{
const
MV
this_
mv
=
{
ref_mv
->
row
+
neighbors
[
j
].
row
,
ref_mv
->
col
+
neighbors
[
j
].
col
};
for
(
j
=
0
;
j
<
8
;
++
j
)
{
const
MV
mv
=
{
ref_mv
->
row
+
neighbors
[
j
].
row
,
ref_mv
->
col
+
neighbors
[
j
].
col
};
if
(
is_mv_in
(
x
,
&
this_mv
))
{
const
uint8_t
*
check_here
=
&
in_what
[
this_mv
.
row
*
in_what_stride
+
this_mv
.
col
];
unsigned
int
thissad
=
fn_ptr
->
sdaf
(
what
,
what_stride
,
check_here
,
in_what_stride
,
second_pred
,
bestsad
);
if
(
thissad
<
bestsad
)
{
thissad
+=
mvsad_err_cost
(
&
this_mv
,
&
fcenter_mv
,
if
(
is_mv_in
(
x
,
&
mv
))
{
unsigned
int
sad
=
fn_ptr
->
sdaf
(
what
->
buf
,
what
->
stride
,
get_buf_from_mv
(
in_what
,
&
mv
),
in_what
->
stride
,
second_pred
,
best_sad
);
if
(
sad
<
best_sad
)
{
sad
+=
mvsad_err_cost
(
&
mv
,
&
fcenter_mv
,
mvjsadcost
,
mvsadcost
,
error_per_bit
);
if
(
this
sad
<
bestsad
)
{
bestsad
=
this
sad
;
if
(
sad
<
best
_
sad
)
{
best
_
sad
=
sad
;
best_site
=
j
;
}
}
...
...
@@ -1788,5 +1771,5 @@ int vp9_refining_search_8p_c(const MACROBLOCK *x,
ref_mv
->
col
+=
neighbors
[
best_site
].
col
;
}
}
return
bestsad
;
return
best
_
sad
;
}
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