#include "prj.h" #include int mv2(short frame,short row,short column,short num) { register short mx,my; /* testing motion vectors */ short min_x,min_y,max_x,max_y; /* scale of testing */ short vector_x,vector_y; /* save mv for temp */ int curr_mad,value; /* current minimum mad value and current value */ if(frame<=0 || frame>=FRAME) return 1; if(row<0 || row>ROW-N2) return 1; if(column<0 || column>COLUMN-N2) return 1; min_x=(column-N2<0)? 0:1-N2; max_x=(column+N2>COLUMN)? 0:N2-1; min_y=(row-N2<0)? 0:1-N2; max_y=(row+N2>ROW)? 0:N2-1; vector_x=0; vector_y=0; curr_mad=mad2(frame,row,column,0,0,999999,num); for(my=min_y;my<=max_y;my++) for(mx=min_x;mxmx*mx+my*my){ vector_y=my; vector_x=mx; } } mad_value[frame][row/N2][column/N2]=curr_mad; mv_y[frame][row/N2][column/N2]=vector_y; mv_x[frame][row/N2][column/N2]=vector_x; return 0; }