comparison h264_cabac.c @ 11544:0eb476c1730d libavcodec

h264: Use + instead of | in some places 6 insns less on x86-64/gcc 4.2.
author astrange
date Fri, 26 Mar 2010 05:04:03 +0000
parents 08723d0e5266
children b94e1810ce4c
comparison
equal deleted inserted replaced
11543:965eca23972e 11544:0eb476c1730d
825 825
826 cbp_a = h->left_cbp; 826 cbp_a = h->left_cbp;
827 cbp_b = h->top_cbp; 827 cbp_b = h->top_cbp;
828 828
829 ctx = !(cbp_a & 0x02) + 2 * !(cbp_b & 0x04); 829 ctx = !(cbp_a & 0x02) + 2 * !(cbp_b & 0x04);
830 cbp |= get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]); 830 cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]);
831 ctx = !(cbp & 0x01) + 2 * !(cbp_b & 0x08); 831 ctx = !(cbp & 0x01) + 2 * !(cbp_b & 0x08);
832 cbp |= get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 1; 832 cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 1;
833 ctx = !(cbp_a & 0x08) + 2 * !(cbp & 0x01); 833 ctx = !(cbp_a & 0x08) + 2 * !(cbp & 0x01);
834 cbp |= get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 2; 834 cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 2;
835 ctx = !(cbp & 0x04) + 2 * !(cbp & 0x02); 835 ctx = !(cbp & 0x04) + 2 * !(cbp & 0x02);
836 cbp |= get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 3; 836 cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 3;
837 return cbp; 837 return cbp;
838 } 838 }
839 static int decode_cabac_mb_cbp_chroma( H264Context *h) { 839 static int decode_cabac_mb_cbp_chroma( H264Context *h) {
840 int ctx; 840 int ctx;
841 int cbp_a, cbp_b; 841 int cbp_a, cbp_b;
1242 }else if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) { 1242 }else if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) {
1243 mb_type= 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); /* B_L[01]_16x16 */ 1243 mb_type= 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); /* B_L[01]_16x16 */
1244 }else{ 1244 }else{
1245 int bits; 1245 int bits;
1246 bits = get_cabac_noinline( &h->cabac, &h->cabac_state[27+4] ) << 3; 1246 bits = get_cabac_noinline( &h->cabac, &h->cabac_state[27+4] ) << 3;
1247 bits|= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 2; 1247 bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 2;
1248 bits|= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 1; 1248 bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 1;
1249 bits|= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); 1249 bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
1250 if( bits < 8 ){ 1250 if( bits < 8 ){
1251 mb_type= bits + 3; /* B_Bi_16x16 through B_L1_L0_16x8 */ 1251 mb_type= bits + 3; /* B_Bi_16x16 through B_L1_L0_16x8 */
1252 }else if( bits == 13 ){ 1252 }else if( bits == 13 ){
1253 mb_type= decode_cabac_intra_mb_type(h, 32, 0); 1253 mb_type= decode_cabac_intra_mb_type(h, 32, 0);
1254 goto decode_intra_mb; 1254 goto decode_intra_mb;
1255 }else if( bits == 14 ){ 1255 }else if( bits == 14 ){
1256 mb_type= 11; /* B_L1_L0_8x16 */ 1256 mb_type= 11; /* B_L1_L0_8x16 */
1257 }else if( bits == 15 ){ 1257 }else if( bits == 15 ){
1258 mb_type= 22; /* B_8x8 */ 1258 mb_type= 22; /* B_8x8 */
1259 }else{ 1259 }else{
1260 bits= ( bits<<1 ) | get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); 1260 bits= ( bits<<1 ) + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
1261 mb_type= bits - 4; /* B_L0_Bi_* through B_Bi_Bi_* */ 1261 mb_type= bits - 4; /* B_L0_Bi_* through B_Bi_Bi_* */
1262 } 1262 }
1263 } 1263 }
1264 partition_count= b_mb_type_info[mb_type].partition_count; 1264 partition_count= b_mb_type_info[mb_type].partition_count;
1265 mb_type= b_mb_type_info[mb_type].type; 1265 mb_type= b_mb_type_info[mb_type].type;