summaryrefslogtreecommitdiff
path: root/libavcodec/videodsp_template.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@gmail.com>2013-10-14 03:13:10 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-11-15 10:16:27 +0100
commit458446acfa1441d283dacf9e6e545beb083b8bb0 (patch)
tree49178dd81fe5208c996c942fb0c7e7a08f2e51db /libavcodec/videodsp_template.c
parent3cbe1126530449336e2ce59b194bdb8c4eb4abb4 (diff)
lavc: Edge emulation with dst/src linesize
Allow supporting files for which the image stride is smaller than the maximum block size + number of subpel mc taps, e.g. a 64x64 VP9 file or a 16x16 VP8 file with -fflags +emu_edge.
Diffstat (limited to 'libavcodec/videodsp_template.c')
-rw-r--r--libavcodec/videodsp_template.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c
index 5d5a32ff60..98313ac5cd 100644
--- a/libavcodec/videodsp_template.c
+++ b/libavcodec/videodsp_template.c
@@ -22,7 +22,8 @@
#include "bit_depth_template.c"
static void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
- ptrdiff_t linesize,
+ ptrdiff_t buf_linesize,
+ ptrdiff_t src_linesize,
int block_w, int block_h,
int src_x, int src_y, int w, int h)
{
@@ -30,10 +31,10 @@ static void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
int start_y, start_x, end_y, end_x;
if (src_y >= h) {
- src += (h - 1 - src_y) * linesize;
+ src += (h - 1 - src_y) * src_linesize;
src_y = h - 1;
} else if (src_y <= -block_h) {
- src += (1 - block_h - src_y) * linesize;
+ src += (1 - block_h - src_y) * src_linesize;
src_y = 1 - block_h;
}
if (src_x >= w) {
@@ -52,30 +53,30 @@ static void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
assert(start_x < end_x && block_w);
w = end_x - start_x;
- src += start_y * linesize + start_x * sizeof(pixel);
+ src += start_y * src_linesize + start_x * sizeof(pixel);
buf += start_x * sizeof(pixel);
// top
for (y = 0; y < start_y; y++) {
memcpy(buf, src, w * sizeof(pixel));
- buf += linesize;
+ buf += buf_linesize;
}
// copy existing part
for (; y < end_y; y++) {
memcpy(buf, src, w * sizeof(pixel));
- src += linesize;
- buf += linesize;
+ src += src_linesize;
+ buf += buf_linesize;
}
// bottom
- src -= linesize;
+ src -= src_linesize;
for (; y < block_h; y++) {
memcpy(buf, src, w * sizeof(pixel));
- buf += linesize;
+ buf += buf_linesize;
}
- buf -= block_h * linesize + start_x * sizeof(pixel);
+ buf -= block_h * buf_linesize + start_x * sizeof(pixel);
while (block_h--) {
pixel *bufp = (pixel *) buf;
@@ -88,6 +89,6 @@ static void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
for (x = end_x; x < block_w; x++) {
bufp[x] = bufp[end_x - 1];
}
- buf += linesize;
+ buf += buf_linesize;
}
}