Mercurial > libavcodec.hg
comparison h264_cabac.c @ 11185:6011626999a1 libavcodec
Drop a few redundant slice_num checks.
author | michael |
---|---|
date | Tue, 16 Feb 2010 00:09:30 +0000 |
parents | cc70f8c44019 |
children | 90de754f70d6 |
comparison
equal
deleted
inserted
replaced
11184:cc70f8c44019 | 11185:6011626999a1 |
---|---|
720 static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice) { | 720 static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice) { |
721 uint8_t *state= &h->cabac_state[ctx_base]; | 721 uint8_t *state= &h->cabac_state[ctx_base]; |
722 int mb_type; | 722 int mb_type; |
723 | 723 |
724 if(intra_slice){ | 724 if(intra_slice){ |
725 MpegEncContext * const s = &h->s; | |
726 const int mba_xy = h->left_mb_xy[0]; | |
727 const int mbb_xy = h->top_mb_xy; | |
728 int ctx=0; | 725 int ctx=0; |
729 if( h->slice_table[mba_xy] == h->slice_num && !IS_INTRA4x4( s->current_picture.mb_type[mba_xy] ) ) | 726 if( h->left_type[0] && !IS_INTRA4x4(h->left_type[0])) |
730 ctx++; | 727 ctx++; |
731 if( h->slice_table[mbb_xy] == h->slice_num && !IS_INTRA4x4( s->current_picture.mb_type[mbb_xy] ) ) | 728 if( h->top_type && !IS_INTRA4x4(h->top_type) ) |
732 ctx++; | 729 ctx++; |
733 if( get_cabac_noinline( &h->cabac, &state[ctx] ) == 0 ) | 730 if( get_cabac_noinline( &h->cabac, &state[ctx] ) == 0 ) |
734 return 0; /* I4x4 */ | 731 return 0; /* I4x4 */ |
735 state += 2; | 732 state += 2; |
736 }else{ | 733 }else{ |
804 const int mbb_xy = h->top_mb_xy; | 801 const int mbb_xy = h->top_mb_xy; |
805 | 802 |
806 int ctx = 0; | 803 int ctx = 0; |
807 | 804 |
808 /* No need to test for IS_INTRA4x4 and IS_INTRA16x16, as we set chroma_pred_mode_table to 0 */ | 805 /* No need to test for IS_INTRA4x4 and IS_INTRA16x16, as we set chroma_pred_mode_table to 0 */ |
809 if( h->slice_table[mba_xy] == h->slice_num && h->chroma_pred_mode_table[mba_xy] != 0 ) | 806 if( h->left_type[0] && h->chroma_pred_mode_table[mba_xy] != 0 ) |
810 ctx++; | 807 ctx++; |
811 | 808 |
812 if( h->slice_table[mbb_xy] == h->slice_num && h->chroma_pred_mode_table[mbb_xy] != 0 ) | 809 if( h->top_type && h->chroma_pred_mode_table[mbb_xy] != 0 ) |
813 ctx++; | 810 ctx++; |
814 | 811 |
815 if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+ctx] ) == 0 ) | 812 if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+ctx] ) == 0 ) |
816 return 0; | 813 return 0; |
817 | 814 |
1232 h->prev_mb_skipped = 0; | 1229 h->prev_mb_skipped = 0; |
1233 | 1230 |
1234 fill_decode_neighbors(h, -(MB_FIELD)); | 1231 fill_decode_neighbors(h, -(MB_FIELD)); |
1235 | 1232 |
1236 if( h->slice_type_nos == FF_B_TYPE ) { | 1233 if( h->slice_type_nos == FF_B_TYPE ) { |
1237 const int mba_xy = h->left_mb_xy[0]; | |
1238 const int mbb_xy = h->top_mb_xy; | |
1239 int ctx = 0; | 1234 int ctx = 0; |
1240 assert(h->slice_type_nos == FF_B_TYPE); | 1235 assert(h->slice_type_nos == FF_B_TYPE); |
1241 | 1236 |
1242 if( h->slice_table[mba_xy] == h->slice_num && !IS_DIRECT( s->current_picture.mb_type[mba_xy] ) ) | 1237 if( !IS_DIRECT( h->left_type[0]-1 ) ) |
1243 ctx++; | 1238 ctx++; |
1244 if( h->slice_table[mbb_xy] == h->slice_num && !IS_DIRECT( s->current_picture.mb_type[mbb_xy] ) ) | 1239 if( !IS_DIRECT( h->top_type-1 ) ) |
1245 ctx++; | 1240 ctx++; |
1246 | 1241 |
1247 if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+ctx] ) ){ | 1242 if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+ctx] ) ){ |
1248 mb_type= 0; /* B_Direct_16x16 */ | 1243 mb_type= 0; /* B_Direct_16x16 */ |
1249 }else if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) { | 1244 }else if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) { |