diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-02-09 00:19:03 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-02-09 00:19:03 +0000 |
commit | daaf6e3e9ed5f68b94428fa05652867604158aa5 (patch) | |
tree | 088224855e755306c18c4fba58e2234d72701028 | |
parent | be4a11326407746cd0efe31523eb8fbc3a4b5928 (diff) | |
download | ffmpeg-daaf6e3e9ed5f68b94428fa05652867604158aa5.tar.gz |
Reorder and factorize mb_type ifs, 1 cpu cycle faster and simpler.
Originally committed as revision 21694 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/h264_direct.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c index f126857811..ed2357dc9d 100644 --- a/libavcodec/h264_direct.c +++ b/libavcodec/h264_direct.c @@ -184,19 +184,18 @@ void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type){ single_col: mb_type_col[0] = mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy]; - if(IS_8X8(mb_type_col[0]) && !h->sps.direct_8x8_inference_flag){ - /* FIXME save sub mb types from previous frames (or derive from MVs) - * so we know exactly what block size to use */ - sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_4x4 */ - *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1; - }else if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){ - sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ + + sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ + if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){ *mb_type |= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_16x16 */ }else if(!is_b8x8 && (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16))){ - sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ *mb_type |= MB_TYPE_L0L1|MB_TYPE_DIRECT2 | (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16)); }else{ - sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ + if(!h->sps.direct_8x8_inference_flag){ + /* FIXME save sub mb types from previous frames (or derive from MVs) + * so we know exactly what block size to use */ + sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_4x4 */ + } *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1; } } |