diff options
author | Alexander Strange <astrange@ithinksw.com> | 2011-03-27 00:31:13 +0300 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-03-27 00:45:38 +0300 |
commit | 1500be13f204acb7e74dac4325ef0052576fa2a9 (patch) | |
tree | 848f4349ffc98e779caa3af34fd57dc3b21f2c16 /libavcodec/dsputil.c | |
parent | c56e618b4b731d761a44fd4666b03829388ad028 (diff) |
dsputil: allow to skip drawing of top/bottom edges.
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r-- | libavcodec/dsputil.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 15925f656b..33fc78a1ea 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -298,17 +298,11 @@ static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) /* draw the edges of width 'w' of an image of size width, height */ //FIXME check that this is ok for mpeg4 interlaced -static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w) +static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w, int sides) { uint8_t *ptr, *last_line; int i; - last_line = buf + (height - 1) * wrap; - for(i=0;i<w;i++) { - /* top and bottom */ - memcpy(buf - (i + 1) * wrap, buf, width); - memcpy(last_line + (i + 1) * wrap, last_line, width); - } /* left and right */ ptr = buf; for(i=0;i<height;i++) { @@ -316,13 +310,16 @@ static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w) memset(ptr + width, ptr[width-1], w); ptr += wrap; } - /* corners */ - for(i=0;i<w;i++) { - memset(buf - (i + 1) * wrap - w, buf[0], w); /* top left */ - memset(buf - (i + 1) * wrap + width, buf[width-1], w); /* top right */ - memset(last_line + (i + 1) * wrap - w, last_line[0], w); /* top left */ - memset(last_line + (i + 1) * wrap + width, last_line[width-1], w); /* top right */ - } + + /* top and bottom + corners */ + buf -= w; + last_line = buf + (height - 1) * wrap; + if (sides & EDGE_TOP) + for(i = 0; i < w; i++) + memcpy(buf - (i + 1) * wrap, buf, width + w + w); // top + if (sides & EDGE_BOTTOM) + for (i = 0; i < w; i++) + memcpy(last_line + (i + 1) * wrap, last_line, width + w + w); // bottom } /** |