comparison h264.c @ 8433:79bf8321e6fa libavcodec

Negate a few variables, this simplifies the code and makes it 5 cycles faster on pentium dual.
author michael
date Mon, 22 Dec 2008 16:10:35 +0000
parents 05465a76d699
children 1e19ee0298a9
comparison
equal deleted inserted replaced
8432:05465a76d699 8433:79bf8321e6fa
126 if(FRAME_MBAFF){ 126 if(FRAME_MBAFF){
127 const int pair_xy = s->mb_x + (s->mb_y & ~1)*s->mb_stride; 127 const int pair_xy = s->mb_x + (s->mb_y & ~1)*s->mb_stride;
128 const int top_pair_xy = pair_xy - s->mb_stride; 128 const int top_pair_xy = pair_xy - s->mb_stride;
129 const int topleft_pair_xy = top_pair_xy - 1; 129 const int topleft_pair_xy = top_pair_xy - 1;
130 const int topright_pair_xy = top_pair_xy + 1; 130 const int topright_pair_xy = top_pair_xy + 1;
131 const int topleft_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[topleft_pair_xy]); 131 const int topleft_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[topleft_pair_xy]);
132 const int top_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[top_pair_xy]); 132 const int top_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[top_pair_xy]);
133 const int topright_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[topright_pair_xy]); 133 const int topright_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[topright_pair_xy]);
134 const int left_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[pair_xy-1]); 134 const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[pair_xy-1]);
135 const int curr_mb_frame_flag = !IS_INTERLACED(mb_type); 135 const int curr_mb_field_flag = IS_INTERLACED(mb_type);
136 const int bottom = (s->mb_y & 1); 136 const int bottom = (s->mb_y & 1);
137 tprintf(s->avctx, "fill_caches: curr_mb_frame_flag:%d, left_mb_frame_flag:%d, topleft_mb_frame_flag:%d, top_mb_frame_flag:%d, topright_mb_frame_flag:%d\n", curr_mb_frame_flag, left_mb_frame_flag, topleft_mb_frame_flag, top_mb_frame_flag, topright_mb_frame_flag); 137 tprintf(s->avctx, "fill_caches: curr_mb_field_flag:%d, left_mb_field_flag:%d, topleft_mb_field_flag:%d, top_mb_field_flag:%d, topright_mb_field_flag:%d\n", curr_mb_field_flag, left_mb_field_flag, topleft_mb_field_flag, top_mb_field_flag, topright_mb_field_flag);
138 138
139 if (!curr_mb_frame_flag && (bottom || !top_mb_frame_flag)){ 139 if (curr_mb_field_flag && (bottom || top_mb_field_flag)){
140 top_xy -= s->mb_stride; 140 top_xy -= s->mb_stride;
141 } 141 }
142 if (!curr_mb_frame_flag && (bottom || !topleft_mb_frame_flag)){ 142 if (curr_mb_field_flag && (bottom || topleft_mb_field_flag)){
143 topleft_xy -= s->mb_stride; 143 topleft_xy -= s->mb_stride;
144 } else if(bottom && curr_mb_frame_flag && !left_mb_frame_flag) { 144 } else if(bottom && !curr_mb_field_flag && left_mb_field_flag) {
145 topleft_xy += s->mb_stride; 145 topleft_xy += s->mb_stride;
146 // take top left mv from the middle of the mb, as opposed to all other modes which use the bottom right partition 146 // take top left mv from the middle of the mb, as opposed to all other modes which use the bottom right partition
147 topleft_partition = 0; 147 topleft_partition = 0;
148 } 148 }
149 if (!curr_mb_frame_flag && (bottom || !topright_mb_frame_flag)){ 149 if (curr_mb_field_flag && (bottom || topright_mb_field_flag)){
150 topright_xy -= s->mb_stride; 150 topright_xy -= s->mb_stride;
151 } 151 }
152 if (left_mb_frame_flag != curr_mb_frame_flag) { 152 if (left_mb_field_flag != curr_mb_field_flag) {
153 left_xy[1] = left_xy[0] = pair_xy - 1; 153 left_xy[1] = left_xy[0] = pair_xy - 1;
154 if (curr_mb_frame_flag) { 154 if (curr_mb_field_flag) {
155 left_xy[1] += s->mb_stride;
156 left_block = left_block_options[3];
157 } else {
155 if (bottom) { 158 if (bottom) {
156 left_block = left_block_options[1]; 159 left_block = left_block_options[1];
157 } else { 160 } else {
158 left_block= left_block_options[2]; 161 left_block= left_block_options[2];
159 } 162 }
160 } else {
161 left_xy[1] += s->mb_stride;
162 left_block = left_block_options[3];
163 } 163 }
164 } 164 }
165 } 165 }
166 166
167 h->top_mb_xy = top_xy; 167 h->top_mb_xy = top_xy;