comparison motion_est.c @ 295:6622b0fd036c libavcodec

mpeg4 4MV encoding
author michaelni
date Thu, 28 Mar 2002 04:25:35 +0000
parents 944632089814
children 5753d57e7e6b
comparison
equal deleted inserted replaced
294:944632089814 295:6622b0fd036c
928 const int mot_xy = s->block_index[block]; 928 const int mot_xy = s->block_index[block];
929 const int block_x= mb_x*2 + (block&1); 929 const int block_x= mb_x*2 + (block&1);
930 const int block_y= mb_y*2 + (block>>1); 930 const int block_y= mb_y*2 + (block>>1);
931 931
932 const int rel_xmin4= xmin - block_x*8; 932 const int rel_xmin4= xmin - block_x*8;
933 const int rel_xmax4= xmax - block_x*8; 933 const int rel_xmax4= xmax - block_x*8 + 8;
934 const int rel_ymin4= ymin - block_y*8; 934 const int rel_ymin4= ymin - block_y*8;
935 const int rel_ymax4= ymax - block_y*8; 935 const int rel_ymax4= ymax - block_y*8 + 8;
936 936
937 P[0][0] = s->motion_val[mot_xy ][0]; 937 P[0][0] = s->motion_val[mot_xy ][0];
938 P[0][1] = s->motion_val[mot_xy ][1]; 938 P[0][1] = s->motion_val[mot_xy ][1];
939 P[1][0] = s->motion_val[mot_xy - 1][0]; 939 P[1][0] = s->motion_val[mot_xy - 1][0];
940 P[1][1] = s->motion_val[mot_xy - 1][1]; 940 P[1][1] = s->motion_val[mot_xy - 1][1];
949 P[2][1] = s->motion_val[mot_xy - mot_stride ][1]; 949 P[2][1] = s->motion_val[mot_xy - mot_stride ][1];
950 P[3][0] = s->motion_val[mot_xy - mot_stride + off[block]][0]; 950 P[3][0] = s->motion_val[mot_xy - mot_stride + off[block]][0];
951 P[3][1] = s->motion_val[mot_xy - mot_stride + off[block]][1]; 951 P[3][1] = s->motion_val[mot_xy - mot_stride + off[block]][1];
952 if(P[2][1] > (rel_ymax4<<shift)) P[2][1]= (rel_ymax4<<shift); 952 if(P[2][1] > (rel_ymax4<<shift)) P[2][1]= (rel_ymax4<<shift);
953 if(P[3][0] < (rel_xmin4<<shift)) P[3][0]= (rel_xmin4<<shift); 953 if(P[3][0] < (rel_xmin4<<shift)) P[3][0]= (rel_xmin4<<shift);
954 if(P[3][0] > (rel_xmax4<<shift)) P[3][0]= (rel_xmax4<<shift);
954 if(P[3][1] > (rel_ymax4<<shift)) P[3][1]= (rel_ymax4<<shift); 955 if(P[3][1] > (rel_ymax4<<shift)) P[3][1]= (rel_ymax4<<shift);
955 956
956 P[4][0]= mid_pred(P[1][0], P[2][0], P[3][0]); 957 P[4][0]= mid_pred(P[1][0], P[2][0], P[3][0]);
957 P[4][1]= mid_pred(P[1][1], P[2][1], P[3][1]); 958 P[4][1]= mid_pred(P[1][1], P[2][1], P[3][1]);
958 } 959 }