diff options
Diffstat (limited to 'libavcodec/videodsp_template.c')
-rw-r--r-- | libavcodec/videodsp_template.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c index 5d5a32ff60..350a28cc6c 100644 --- a/libavcodec/videodsp_template.c +++ b/libavcodec/videodsp_template.c @@ -20,20 +20,25 @@ */ #include "bit_depth_template.c" - -static void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, - ptrdiff_t linesize, +void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, + ptrdiff_t linesize_arg, 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; + int linesize = linesize_arg; + + if (!w || !h) + return; if (src_y >= h) { - src += (h - 1 - src_y) * linesize; + src -= src_y * linesize; + src += (h - 1) * linesize; src_y = h - 1; } else if (src_y <= -block_h) { - src += (1 - block_h - src_y) * linesize; + src -= src_y * linesize; + src += (1 - block_h) * linesize; src_y = 1 - block_h; } if (src_x >= w) { @@ -48,8 +53,8 @@ static void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, start_x = FFMAX(0, -src_x); end_y = FFMIN(block_h, h-src_y); end_x = FFMIN(block_w, w-src_x); - assert(start_y < end_y && block_h); - assert(start_x < end_x && block_w); + av_assert2(start_y < end_y && block_h); + av_assert2(start_x < end_x && block_w); w = end_x - start_x; src += start_y * linesize + start_x * sizeof(pixel); |