From 3c650efb81aaa3b395ba4606ee68a47ee4efb57b Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 3 Feb 2014 11:13:59 -0800 Subject: dsputil: Move draw_edges() to mpegvideoencdsp --- libavcodec/mpegvideoencdsp.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'libavcodec/mpegvideoencdsp.c') diff --git a/libavcodec/mpegvideoencdsp.c b/libavcodec/mpegvideoencdsp.c index ee6327ded9..8202034643 100644 --- a/libavcodec/mpegvideoencdsp.c +++ b/libavcodec/mpegvideoencdsp.c @@ -18,6 +18,7 @@ #include #include +#include #include "config.h" #include "libavutil/attributes.h" @@ -124,6 +125,34 @@ static int pix_norm1_c(uint8_t *pix, int line_size) return s; } +/* draw the edges of width 'w' of an image of size width, height */ +// FIXME: Check that this is OK for MPEG-4 interlaced. +static void draw_edges_8_c(uint8_t *buf, int wrap, int width, int height, + int w, int h, int sides) +{ + uint8_t *ptr = buf, *last_line; + int i; + + /* left and right */ + for (i = 0; i < height; i++) { + memset(ptr - w, ptr[0], w); + memset(ptr + width, ptr[width - 1], w); + ptr += wrap; + } + + /* top and bottom + corners */ + buf -= w; + last_line = buf + (height - 1) * wrap; + if (sides & EDGE_TOP) + for (i = 0; i < h; i++) + // top + memcpy(buf - (i + 1) * wrap, buf, width + w + w); + if (sides & EDGE_BOTTOM) + for (i = 0; i < h; i++) + // bottom + memcpy(last_line + (i + 1) * wrap, last_line, width + w + w); +} + av_cold void ff_mpegvideoencdsp_init(MpegvideoEncDSPContext *c, AVCodecContext *avctx) { @@ -138,6 +167,8 @@ av_cold void ff_mpegvideoencdsp_init(MpegvideoEncDSPContext *c, c->pix_sum = pix_sum_c; c->pix_norm1 = pix_norm1_c; + c->draw_edges = draw_edges_8_c; + if (ARCH_ARM) ff_mpegvideoencdsp_init_arm(c, avctx); if (ARCH_PPC) -- cgit v1.2.3