From 1500be13f204acb7e74dac4325ef0052576fa2a9 Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Sat, 26 Mar 2011 17:31:13 -0400 Subject: [PATCH] dsputil: allow to skip drawing of top/bottom edges. --- libavcodec/dsputil.c | 25 +++++++--------- libavcodec/dsputil.h | 4 ++- libavcodec/mpegvideo.c | 12 ++++++-- libavcodec/snow.c | 12 ++++++-- libavcodec/x86/dsputil_mmx.c | 69 ++++++++++++++++++++++++-------------------- 5 files changed, 70 insertions(+), 52 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 15925f6..33fc78a 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;icurrent_picture.reference && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) { - s->dsp.draw_edges(s->current_picture.data[0], s->linesize , s->h_edge_pos , s->v_edge_pos , EDGE_WIDTH ); - s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2); - s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2); + s->dsp.draw_edges(s->current_picture.data[0], s->linesize , + s->h_edge_pos , s->v_edge_pos , + EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); + s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, + s->h_edge_pos>>1, s->v_edge_pos>>1, + EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM); + s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, + s->h_edge_pos>>1, s->v_edge_pos>>1, + EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM); } emms_c(); diff --git a/libavcodec/snow.c b/libavcodec/snow.c index de5d2dc..42145f5 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -1976,9 +1976,15 @@ static int frame_start(SnowContext *s){ int h= s->avctx->height; if(s->current_picture.data[0]){ - s->dsp.draw_edges(s->current_picture.data[0], s->current_picture.linesize[0], w , h , EDGE_WIDTH ); - s->dsp.draw_edges(s->current_picture.data[1], s->current_picture.linesize[1], w>>1, h>>1, EDGE_WIDTH/2); - s->dsp.draw_edges(s->current_picture.data[2], s->current_picture.linesize[2], w>>1, h>>1, EDGE_WIDTH/2); + s->dsp.draw_edges(s->current_picture.data[0], + s->current_picture.linesize[0], w , h , + EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); + s->dsp.draw_edges(s->current_picture.data[1], + s->current_picture.linesize[1], w>>1, h>>1, + EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM); + s->dsp.draw_edges(s->current_picture.data[2], + s->current_picture.linesize[2], w>>1, h>>1, + EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM); } release_buffer(s->avctx); diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 4d1a305..f98e6ae 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -783,7 +783,7 @@ static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){ /* draw the edges of width 'w' of an image of size width, height this mmx version can only handle w==8 || w==16 */ -static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w) +static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w, int sides) { uint8_t *ptr, *last_line; int i; @@ -836,36 +836,43 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w) ); } - for(i=0;i