---
libavcodec/dsputil.c | 11 ++++++++---
libavcodec/dsputil.h | 4 +++-
libavcodec/i386/dsputil_mmx.c | 7 ++++++-
libavcodec/mpegvideo.c | 6 +++---
libavcodec/snow.c | 6 +++---
5 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 80efd07..670d2b0 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -431,7 +431,7 @@ int w97_32_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;
@@ -439,8 +439,8 @@ static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
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);
+ if (sides&EDGE_TOP) memcpy(buf - (i + 1) * wrap, buf, width);
+ if (sides&EDGE_BOTTOM) memcpy(last_line + (i + 1) * wrap, last_line, width);
}
/* left and right */
ptr = buf;
@@ -451,10 +451,15 @@ static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
}
/* corners */
for(i=0;i<w;i++) {
+ if (sides&EDGE_TOP) {
memset(buf - (i + 1) * wrap - w, buf[0], w); /* top left */
memset(buf - (i + 1) * wrap + width, buf[width-1], w); /* top right */
+ }
+
+ if (sides&EDGE_BOTTOM) {
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 */
+ }
}
}
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 3b7b879..1d51347 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -415,8 +415,10 @@ typedef struct DSPContext {
#define BASIS_SHIFT 16
#define RECON_SHIFT 6
- void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w);
+ void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w, int sides);
#define EDGE_WIDTH 16
+#define EDGE_TOP 1
+#define EDGE_BOTTOM 2
/* h264 functions */
void (*h264_idct_add)(uint8_t *dst, DCTELEM *block, int stride);
diff --git a/libavcodec/i386/dsputil_mmx.c b/libavcodec/i386/dsputil_mmx.c
index 60511a3..bee3760 100644
--- a/libavcodec/i386/dsputil_mmx.c
+++ b/libavcodec/i386/dsputil_mmx.c
@@ -701,7 +701,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;
@@ -756,6 +756,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w)
for(i=0;i<w;i+=4) {
/* top and bottom (and hopefully also the corners) */
+ if (sides&EDGE_TOP) {
ptr= buf - (i + 1) * wrap - w;
asm volatile(
"1: \n\t"
@@ -770,6 +771,9 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w)
: "+r" (ptr)
: "r" ((x86_reg)buf - (x86_reg)ptr - w), "r" ((x86_reg)-wrap), "r" ((x86_reg)-wrap*3), "r" (ptr+width+2*w)
);
+ }
+
+ if (sides&EDGE_BOTTOM) {
ptr= last_line + (i + 1) * wrap - w;
asm volatile(
"1: \n\t"
@@ -784,6 +788,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w)
: "+r" (ptr)
: "r" ((x86_reg)last_line - (x86_reg)ptr - w), "r" ((x86_reg)wrap), "r" ((x86_reg)wrap*3), "r" (ptr+width+2*w)
);
+ }
}
}
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1726108..cc444a2 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1021,9 +1021,9 @@ void MPV_frame_end(MpegEncContext *s)
}else
#endif
if(s->unrestricted_mv && s->current_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 2f00279..cf94641 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -4112,9 +4112,9 @@ 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);
}
tmp= s->last_picture[s->max_ref_frames-1];
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc