comparison h264_direct.c @ 11101:a82b9c88682f libavcodec

Branchless calculation of ref_offset. 7 cpu cycles faster.
author michael
date Mon, 08 Feb 2010 03:22:17 +0000
parents 7c89ba8c0fd7
children 3bc0125e19fe
comparison
equal deleted inserted replaced
11100:7c89ba8c0fd7 11101:a82b9c88682f
359 } 359 }
360 } 360 }
361 }else{ /* direct temporal mv pred */ 361 }else{ /* direct temporal mv pred */
362 const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]}; 362 const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]};
363 const int *dist_scale_factor = h->dist_scale_factor; 363 const int *dist_scale_factor = h->dist_scale_factor;
364 int ref_offset= 0; 364 int ref_offset;
365 365
366 if(FRAME_MBAFF && IS_INTERLACED(*mb_type)){ 366 if(FRAME_MBAFF && IS_INTERLACED(*mb_type)){
367 map_col_to_list0[0] = h->map_col_to_list0_field[s->mb_y&1][0]; 367 map_col_to_list0[0] = h->map_col_to_list0_field[s->mb_y&1][0];
368 map_col_to_list0[1] = h->map_col_to_list0_field[s->mb_y&1][1]; 368 map_col_to_list0[1] = h->map_col_to_list0_field[s->mb_y&1][1];
369 dist_scale_factor =h->dist_scale_factor_field[s->mb_y&1]; 369 dist_scale_factor =h->dist_scale_factor_field[s->mb_y&1];
370 } 370 }
371 if(h->ref_list[1][0].mbaff && IS_INTERLACED(mb_type_col[0])) 371 ref_offset = (h->ref_list[1][0].mbaff<<4) & (mb_type_col[0]>>3); //if(h->ref_list[1][0].mbaff && IS_INTERLACED(mb_type_col[0])) ref_offset=16 else 0
372 ref_offset += 16;
373 372
374 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){ 373 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){
375 int y_shift = 2*!IS_INTERLACED(*mb_type); 374 int y_shift = 2*!IS_INTERLACED(*mb_type);
376 assert(h->sps.direct_8x8_inference_flag); 375 assert(h->sps.direct_8x8_inference_flag);
377 376