summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideoencdsp.c
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2014-02-03 11:13:59 -0800
committerDiego Biurrun <diego@biurrun.de>2014-07-06 14:48:50 -0700
commit3c650efb81aaa3b395ba4606ee68a47ee4efb57b (patch)
tree1f72694cf002091051d5f13bf25ec212dbbc5a01 /libavcodec/mpegvideoencdsp.c
parentc166148409fe8f0dbccef2fe684286a40ba1e37d (diff)
dsputil: Move draw_edges() to mpegvideoencdsp
Diffstat (limited to 'libavcodec/mpegvideoencdsp.c')
-rw-r--r--libavcodec/mpegvideoencdsp.c31
1 files changed, 31 insertions, 0 deletions
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 <assert.h>
#include <stdint.h>
+#include <string.h>
#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)