summaryrefslogtreecommitdiff
path: root/libavcodec/videodsp_template.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2013-09-20 08:01:19 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2013-09-28 20:28:08 -0400
commitface578d56c2d1375e40d5e2a28acc122132bc55 (patch)
tree8a4fe63c8066b59ea41dd09285b4a82587a65030 /libavcodec/videodsp_template.c
parentf574b4da567cc1c175ab5463fb5b3901cbaa5595 (diff)
downloadffmpeg-face578d56c2d1375e40d5e2a28acc122132bc55.tar.gz
Rewrite emu_edge functions to have separate src/dst_stride arguments.
This allows supporting files for which the image stride is smaller than the max. 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.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c
index 39aad4deec..f7e7bfdb13 100644
--- a/libavcodec/videodsp_template.c
+++ b/libavcodec/videodsp_template.c
@@ -20,10 +20,10 @@
*/
#include "bit_depth_template.c"
-void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
- ptrdiff_t linesize,
- int block_w, int block_h,
- int src_x, int src_y, int w, int h)
+void FUNC(ff_emulated_edge_mc)(uint8_t *buf, ptrdiff_t buf_stride,
+ const uint8_t *src, ptrdiff_t src_stride,
+ int block_w, int block_h,
+ int src_x, int src_y, int w, int h)
{
int x, y;
int start_y, start_x, end_y, end_x;
@@ -32,12 +32,12 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
return;
if (src_y >= h) {
- src -= src_y * linesize;
- src += (h - 1) * linesize;
+ src -= src_y * src_stride;
+ src += (h - 1) * src_stride;
src_y = h - 1;
} else if (src_y <= -block_h) {
- src -= src_y * linesize;
- src += (1 - block_h) * linesize;
+ src -= src_y * src_stride;
+ src += (1 - block_h) * src_stride;
src_y = 1 - block_h;
}
if (src_x >= w) {
@@ -56,30 +56,30 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
av_assert2(start_x < end_x && block_w);
w = end_x - start_x;
- src += start_y * linesize + start_x * sizeof(pixel);
+ src += start_y * src_stride + 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_stride;
}
// copy existing part
for (; y < end_y; y++) {
memcpy(buf, src, w * sizeof(pixel));
- src += linesize;
- buf += linesize;
+ src += src_stride;
+ buf += buf_stride;
}
// bottom
- src -= linesize;
+ src -= src_stride;
for (; y < block_h; y++) {
memcpy(buf, src, w * sizeof(pixel));
- buf += linesize;
+ buf += buf_stride;
}
- buf -= block_h * linesize + start_x * sizeof(pixel);
+ buf -= block_h * buf_stride + start_x * sizeof(pixel);
while (block_h--) {
pixel *bufp = (pixel *) buf;
@@ -92,6 +92,6 @@ 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_stride;
}
}