comparison motion_est.c @ 1938:e2501e6e7ff7 libavcodec

unify table indexing (motion_val,dc_val,ac_val,coded_block changed) minor +-1 bugfix
author michael
date Fri, 16 Apr 2004 01:01:45 +0000
parents 129236143f2e
children a3c60fa850dc
comparison
equal deleted inserted replaced
1937:4d91a9342d95 1938:e2501e6e7ff7
731 s->current_picture.motion_val[0][mot_xy ][0]= mx; 731 s->current_picture.motion_val[0][mot_xy ][0]= mx;
732 s->current_picture.motion_val[0][mot_xy ][1]= my; 732 s->current_picture.motion_val[0][mot_xy ][1]= my;
733 s->current_picture.motion_val[0][mot_xy+1][0]= mx; 733 s->current_picture.motion_val[0][mot_xy+1][0]= mx;
734 s->current_picture.motion_val[0][mot_xy+1][1]= my; 734 s->current_picture.motion_val[0][mot_xy+1][1]= my;
735 735
736 mot_xy += s->block_wrap[0]; 736 mot_xy += s->b8_stride;
737 s->current_picture.motion_val[0][mot_xy ][0]= mx; 737 s->current_picture.motion_val[0][mot_xy ][0]= mx;
738 s->current_picture.motion_val[0][mot_xy ][1]= my; 738 s->current_picture.motion_val[0][mot_xy ][1]= my;
739 s->current_picture.motion_val[0][mot_xy+1][0]= mx; 739 s->current_picture.motion_val[0][mot_xy+1][0]= mx;
740 s->current_picture.motion_val[0][mot_xy+1][1]= my; 740 s->current_picture.motion_val[0][mot_xy+1][1]= my;
741 } 741 }
778 for(block=0; block<4; block++){ 778 for(block=0; block<4; block++){
779 int mx4, my4; 779 int mx4, my4;
780 int pred_x4, pred_y4; 780 int pred_x4, pred_y4;
781 int dmin4; 781 int dmin4;
782 static const int off[4]= {2, 1, 1, -1}; 782 static const int off[4]= {2, 1, 1, -1};
783 const int mot_stride = s->block_wrap[0]; 783 const int mot_stride = s->b8_stride;
784 const int mot_xy = s->block_index[block]; 784 const int mot_xy = s->block_index[block];
785 const int block_x= (block&1); 785 const int block_x= (block&1);
786 const int block_y= (block>>1); 786 const int block_y= (block>>1);
787 uint8_t *src_data[3]= { 787 uint8_t *src_data[3]= {
788 s->new_picture.data[0] + 8*(2*s->mb_x + block_x) + stride *8*(2*s->mb_y + block_y), //FIXME chroma? 788 s->new_picture.data[0] + 8*(2*s->mb_x + block_x) + stride *8*(2*s->mb_y + block_y), //FIXME chroma?
1100 break; 1100 break;
1101 #endif 1101 #endif
1102 case ME_X1: 1102 case ME_X1:
1103 case ME_EPZS: 1103 case ME_EPZS:
1104 { 1104 {
1105 const int mot_stride = s->block_wrap[0]; 1105 const int mot_stride = s->b8_stride;
1106 const int mot_xy = s->block_index[0]; 1106 const int mot_xy = s->block_index[0];
1107 1107
1108 P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0]; 1108 P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0];
1109 P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1]; 1109 P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1];
1110 1110
1250 for(i=1; i<3; i++){ 1250 for(i=1; i<3; i++){
1251 uint8_t *dest_c; 1251 uint8_t *dest_c;
1252 int mean; 1252 int mean;
1253 1253
1254 if(s->out_format == FMT_H263){ 1254 if(s->out_format == FMT_H263){
1255 mean= (s->dc_val[i][mb_x + (mb_y+1)*(s->mb_width+2)] + 4)>>3; //FIXME not exact but simple ;) 1255 mean= (s->dc_val[i][mb_x + mb_y*s->b8_stride] + 4)>>3; //FIXME not exact but simple ;)
1256 }else{ 1256 }else{
1257 mean= (s->last_dc[i] + 4)>>3; 1257 mean= (s->last_dc[i] + 4)>>3;
1258 } 1258 }
1259 dest_c = s->new_picture.data[i] + (mb_y * 8 * (s->uvlinesize)) + mb_x * 8; 1259 dest_c = s->new_picture.data[i] + (mb_y * 8 * (s->uvlinesize)) + mb_x * 8;
1260 1260
1807 1807
1808 if(s->avctx->me_range && range > s->avctx->me_range) range= s->avctx->me_range; 1808 if(s->avctx->me_range && range > s->avctx->me_range) range= s->avctx->me_range;
1809 1809
1810 //printf("%d no:%d %d//\n", clip, noclip, f_code); 1810 //printf("%d no:%d %d//\n", clip, noclip, f_code);
1811 if(s->flags&CODEC_FLAG_4MV){ 1811 if(s->flags&CODEC_FLAG_4MV){
1812 const int wrap= 2+ s->mb_width*2; 1812 const int wrap= s->b8_stride;
1813 1813
1814 /* clip / convert to intra 8x8 type MVs */ 1814 /* clip / convert to intra 8x8 type MVs */
1815 for(y=0; y<s->mb_height; y++){ 1815 for(y=0; y<s->mb_height; y++){
1816 int xy= (y*2 + 1)*wrap + 1; 1816 int xy= y*2*wrap;
1817 int i= y*s->mb_stride; 1817 int i= y*s->mb_stride;
1818 int x; 1818 int x;
1819 1819
1820 for(x=0; x<s->mb_width; x++){ 1820 for(x=0; x<s->mb_width; x++){
1821 if(s->mb_type[i]&CANDIDATE_MB_TYPE_INTER4V){ 1821 if(s->mb_type[i]&CANDIDATE_MB_TYPE_INTER4V){