summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideoencdsp.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-07 15:54:17 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-07 16:17:27 +0200
commit3790801f9cedfae81cb8f055bbb0b14131459658 (patch)
tree4fb4e35103252ce0a7cecf1d01041db506078894 /libavcodec/mpegvideoencdsp.c
parent020865f557ccf06a41ecc461fd13ce6678817d04 (diff)
parent3c650efb81aaa3b395ba4606ee68a47ee4efb57b (diff)
downloadffmpeg-3790801f9cedfae81cb8f055bbb0b14131459658.tar.gz
Merge commit '3c650efb81aaa3b395ba4606ee68a47ee4efb57b'
* commit '3c650efb81aaa3b395ba4606ee68a47ee4efb57b': dsputil: Move draw_edges() to mpegvideoencdsp Conflicts: libavcodec/mpegvideo_enc.c libavcodec/x86/Makefile libavcodec/x86/dsputil_init.c libavcodec/x86/dsputil_mmx.c libavcodec/x86/dsputil_x86.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
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 bde4345750..10ad369a67 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/avassert.h"
@@ -125,6 +126,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)
{
@@ -139,6 +168,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)