[FFmpeg-cvslog] Don't do edge emulation unless the edge pixels will be used in MC.
Ronald S. Bultje
git
Wed Jan 26 04:01:18 CET 2011
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Tue Jan 25 12:25:07 2011 -0500| [ac3c04e4d6532970747d92b5156839b9748adf05] | committer: Michael Niedermayer
Don't do edge emulation unless the edge pixels will be used in MC.
Do not emulate larger edges than we will actually use for this round of
MC. Decoding goes from avg+SE 29.972+/-0.023sec to 29.856+/-0.023, i.e.
0.12sec or ~0.4% faster.
(cherry picked from commit 44002d8323023c35f51d523a7d305e45103ba7a1)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac3c04e4d6532970747d92b5156839b9748adf05
---
libavcodec/vp8.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 80d30e8..52a3f90 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -1218,21 +1218,26 @@ void vp8_mc(VP8Context *s, int luma,
vp8_mc_func mc_func[3][3])
{
if (AV_RN32A(mv)) {
- static const uint8_t idx[8] = { 0, 1, 2, 1, 2, 1, 2, 1 };
- int mx = (mv->x << luma)&7, mx_idx = idx[mx];
- int my = (mv->y << luma)&7, my_idx = idx[my];
+ static const uint8_t idx[3][8] = {
+ { 0, 1, 2, 1, 2, 1, 2, 1 }, // nr. of left extra pixels,
+ // also function pointer index
+ { 0, 3, 5, 3, 5, 3, 5, 3 }, // nr. of extra pixels required
+ { 0, 2, 3, 2, 3, 2, 3, 2 }, // nr. of right extra pixels
+ };
+ int mx = (mv->x << luma)&7, mx_idx = idx[0][mx];
+ int my = (mv->y << luma)&7, my_idx = idx[0][my];
x_off += mv->x >> (3 - luma);
y_off += mv->y >> (3 - luma);
// edge emulation
src += y_off * linesize + x_off;
- if (x_off < 2 || x_off >= width - block_w - 3 ||
- y_off < 2 || y_off >= height - block_h - 3) {
- ff_emulated_edge_mc(s->edge_emu_buffer, src - 2 * linesize - 2, linesize,
- block_w + 5, block_h + 5,
- x_off - 2, y_off - 2, width, height);
- src = s->edge_emu_buffer + 2 + linesize * 2;
+ if (x_off < mx_idx || x_off >= width - block_w - idx[2][mx] ||
+ y_off < my_idx || y_off >= height - block_h - idx[2][my]) {
+ ff_emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize,
+ block_w + idx[1][mx], block_h + idx[1][my],
+ x_off - mx_idx, y_off - my_idx, width, height);
+ src = s->edge_emu_buffer + mx_idx + linesize * my_idx;
}
mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my);
} else
More information about the ffmpeg-cvslog
mailing list