comparison h264_direct.c @ 11106:f85c5cb2c402 libavcodec

Reorder and factorize mb_type ifs, 1 cpu cycle faster and simpler.
author michael
date Tue, 09 Feb 2010 00:19:03 +0000
parents 77c5116751b7
children a0c52e951a29
comparison
equal deleted inserted replaced
11105:77c5116751b7 11106:f85c5cb2c402
182 } 182 }
183 }else{ // AFR/FR -> AFR/FR 183 }else{ // AFR/FR -> AFR/FR
184 single_col: 184 single_col:
185 mb_type_col[0] = 185 mb_type_col[0] =
186 mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy]; 186 mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy];
187 if(IS_8X8(mb_type_col[0]) && !h->sps.direct_8x8_inference_flag){ 187
188 /* FIXME save sub mb types from previous frames (or derive from MVs) 188 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
189 * so we know exactly what block size to use */ 189 if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){
190 sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_4x4 */
191 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1;
192 }else if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){
193 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
194 *mb_type |= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_16x16 */ 190 *mb_type |= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_16x16 */
195 }else if(!is_b8x8 && (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16))){ 191 }else if(!is_b8x8 && (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16))){
196 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
197 *mb_type |= MB_TYPE_L0L1|MB_TYPE_DIRECT2 | (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16)); 192 *mb_type |= MB_TYPE_L0L1|MB_TYPE_DIRECT2 | (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16));
198 }else{ 193 }else{
199 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ 194 if(!h->sps.direct_8x8_inference_flag){
195 /* FIXME save sub mb types from previous frames (or derive from MVs)
196 * so we know exactly what block size to use */
197 sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_4x4 */
198 }
200 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1; 199 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1;
201 } 200 }
202 } 201 }
203 } 202 }
204 203