diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2008-03-04 00:07:41 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2008-03-04 00:07:41 +0000 |
commit | 5a6a9e78ab332bb54bf36761c85609881561149a (patch) | |
tree | d1def9e91601b87d3bead012e48319f9f2a91f1a /libavcodec/dsputil.c | |
parent | ce7f71a2ddf795f451e5acd79fd81f5149e8e87b (diff) | |
download | ffmpeg-streaming-5a6a9e78ab332bb54bf36761c85609881561149a.zip ffmpeg-streaming-5a6a9e78ab332bb54bf36761c85609881561149a.tar.gz |
move draw_edges() into dsputil
Originally committed as revision 12309 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r-- | libavcodec/dsputil.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 055486d..af6341a 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -404,6 +404,35 @@ int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){ } #endif +/* 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) +{ + 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++) { + memset(ptr - w, ptr[0], 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 */ + } +} + static void get_pixels_c(DCTELEM *restrict block, const uint8_t *pixels, int line_size) { int i; @@ -4203,6 +4232,8 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c; c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c; + c->draw_edges = draw_edges_c; + #ifdef CONFIG_CAVS_DECODER ff_cavsdsp_init(c,avctx); #endif |