summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-04-03 01:55:24 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-04-03 01:55:24 +0000
commit8100cab9c67366804e4ba5f93b7e7c2414dcf6ec (patch)
tree1189d0efe60acfd944648777d98277f2ce8f6813
parent13d1512c43c8207c8a3678c9381fab87116af651 (diff)
nicer looking arrows for the motion vector vissualization
Originally committed as revision 2950 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/mpegvideo.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 50aa254009..25a1996b68 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -815,9 +815,9 @@ void MPV_common_end(MpegEncContext *s)
s->last_picture_ptr=
s->next_picture_ptr=
s->current_picture_ptr= NULL;
+
for(i=0; i<3; i++)
- if (s->visualization_buffer[i])
- av_free(s->visualization_buffer[i]);
+ av_freep(&s->visualization_buffer[i]);
}
#ifdef CONFIG_ENCODERS
@@ -1486,7 +1486,7 @@ void MPV_frame_end(MpegEncContext *s)
* @param color color of the arrow
*/
static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){
- int t, x, y, f;
+ int t, x, y, fr, f;
sx= clip(sx, 0, w-1);
sy= clip(sy, 0, h-1);
@@ -1504,8 +1504,10 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h
ex-= sx;
f= ((ey-sy)<<16)/ex;
for(x= 0; x <= ex; x++){
- y= ((x*f) + (1<<15))>>16;
- buf[y*stride + x]+= color;
+ y = (x*f)>>16;
+ fr= (x*f)&0xFFFF;
+ buf[ y *stride + x]+= (color*(0x10000-fr))>>16;
+ buf[(y+1)*stride + x]+= (color* fr )>>16;
}
}else{
if(sy > ey){
@@ -1517,8 +1519,10 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h
if(ey) f= ((ex-sx)<<16)/ey;
else f= 0;
for(y= 0; y <= ey; y++){
- x= ((y*f) + (1<<15))>>16;
- buf[y*stride + x]+= color;
+ x = (y*f)>>16;
+ fr= (y*f)&0xFFFF;
+ buf[y*stride + x ]+= (color*(0x10000-fr))>>16;;
+ buf[y*stride + x+1]+= (color* fr )>>16;;
}
}
}