Revision 49c79e6c

View differences:

libavcodec/h263dec.c
377 377
    }
378 378
}
379 379

  
380
static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){ 
381
    int dx= ex - sx;
382
    int dy= ey - sy;
383
    
384
    if(dx*dx + dy*dy > 3*3){
385
        int rx=  dx + dy;
386
        int ry= -dx + dy;
387
        int length= ff_sqrt((rx*rx + ry*ry)<<8);
388
        
389
        //FIXME subpixel accuracy
390
        rx= ROUNDED_DIV(rx*3<<4, length);
391
        ry= ROUNDED_DIV(ry*3<<4, length);
392
        
393
        draw_line(buf, sx, sy, sx + rx, sy + ry, w, h, stride, color);
394
        draw_line(buf, sx, sy, sx - ry, sy + rx, w, h, stride, color);
395
    }
396
    draw_line(buf, sx, sy, ex, ey, w, h, stride, color);
397
}
398

  
380 399
int ff_h263_decode_frame(AVCodecContext *avctx, 
381 400
                             void *data, int *data_size,
382 401
                             UINT8 *buf, int buf_size)
......
703 722
                        int xy= 1 + mb_x*2 + (i&1) + (mb_y*2 + 1 + (i>>1))*(s->mb_width*2 + 2);
704 723
                        int mx= (s->motion_val[xy][0]>>shift) + sx;
705 724
                        int my= (s->motion_val[xy][1]>>shift) + sy;
706
                        draw_line(ptr, sx, sy, mx, my, s->width, s->height, s->linesize, 100);
725
                        draw_arrow(ptr, sx, sy, mx, my, s->width, s->height, s->linesize, 100);
707 726
                    }
708 727
                }else{
709 728
                    int sx= mb_x*16 + 8;
......
711 730
                    int xy= 1 + mb_x*2 + (mb_y*2 + 1)*(s->mb_width*2 + 2);
712 731
                    int mx= (s->motion_val[xy][0]>>shift) + sx;
713 732
                    int my= (s->motion_val[xy][1]>>shift) + sy;
714
                    draw_line(ptr, sx, sy, mx, my, s->width, s->height, s->linesize, 100);
733
                    draw_arrow(ptr, sx, sy, mx, my, s->width, s->height, s->linesize, 100);
715 734
                }
716 735
                s->mbskip_table[mb_index]=0;
717 736
            }

Also available in: Unified diff