comparison h264.c @ 7181:069ef3bf1cef libavcodec

Reindent.
author astrange
date Wed, 02 Jul 2008 22:12:01 +0000
parents 4acdafd254bf
children ea851fc7ea27
comparison
equal deleted inserted replaced
7180:4acdafd254bf 7181:069ef3bf1cef
5340 static av_always_inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx, int is_dc ) { 5340 static av_always_inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx, int is_dc ) {
5341 int nza, nzb; 5341 int nza, nzb;
5342 int ctx = 0; 5342 int ctx = 0;
5343 5343
5344 if( is_dc ) { 5344 if( is_dc ) {
5345 if( cat == 0 ) { 5345 if( cat == 0 ) {
5346 nza = h->left_cbp&0x100; 5346 nza = h->left_cbp&0x100;
5347 nzb = h-> top_cbp&0x100; 5347 nzb = h-> top_cbp&0x100;
5348 } else {
5349 nza = (h->left_cbp>>(6+idx))&0x01;
5350 nzb = (h-> top_cbp>>(6+idx))&0x01;
5351 }
5348 } else { 5352 } else {
5349 nza = (h->left_cbp>>(6+idx))&0x01; 5353 if( cat == 1 || cat == 2 ) {
5350 nzb = (h-> top_cbp>>(6+idx))&0x01; 5354 nza = h->non_zero_count_cache[scan8[idx] - 1];
5351 } 5355 nzb = h->non_zero_count_cache[scan8[idx] - 8];
5352 } else { 5356 } else {
5353 if( cat == 1 || cat == 2 ) { 5357 assert(cat == 4);
5354 nza = h->non_zero_count_cache[scan8[idx] - 1]; 5358 nza = h->non_zero_count_cache[scan8[16+idx] - 1];
5355 nzb = h->non_zero_count_cache[scan8[idx] - 8]; 5359 nzb = h->non_zero_count_cache[scan8[16+idx] - 8];
5356 } else { 5360 }
5357 assert(cat == 4);
5358 nza = h->non_zero_count_cache[scan8[16+idx] - 1];
5359 nzb = h->non_zero_count_cache[scan8[16+idx] - 8];
5360 }
5361 } 5361 }
5362 5362
5363 if( nza > 0 ) 5363 if( nza > 0 )
5364 ctx++; 5364 ctx++;
5365 5365
5445 5445
5446 /* read coded block flag */ 5446 /* read coded block flag */
5447 if( is_dc || cat != 5 ) { 5447 if( is_dc || cat != 5 ) {
5448 if( get_cabac( CC, &h->cabac_state[85 + get_cabac_cbf_ctx( h, cat, n, is_dc ) ] ) == 0 ) { 5448 if( get_cabac( CC, &h->cabac_state[85 + get_cabac_cbf_ctx( h, cat, n, is_dc ) ] ) == 0 ) {
5449 if( !is_dc ) { 5449 if( !is_dc ) {
5450 if( cat == 1 || cat == 2 ) 5450 if( cat == 1 || cat == 2 )
5451 h->non_zero_count_cache[scan8[n]] = 0; 5451 h->non_zero_count_cache[scan8[n]] = 0;
5452 else 5452 else
5453 h->non_zero_count_cache[scan8[16+n]] = 0; 5453 h->non_zero_count_cache[scan8[16+n]] = 0;
5454 } 5454 }
5455 5455
5456 #ifdef CABAC_ON_STACK 5456 #ifdef CABAC_ON_STACK
5457 h->cabac.range = cc.range ; 5457 h->cabac.range = cc.range ;
5458 h->cabac.low = cc.low ; 5458 h->cabac.low = cc.low ;
5497 #endif 5497 #endif
5498 } 5498 }
5499 assert(coeff_count > 0); 5499 assert(coeff_count > 0);
5500 5500
5501 if( is_dc ) { 5501 if( is_dc ) {
5502 if( cat == 0 ) 5502 if( cat == 0 )
5503 h->cbp_table[h->mb_xy] |= 0x100; 5503 h->cbp_table[h->mb_xy] |= 0x100;
5504 else 5504 else
5505 h->cbp_table[h->mb_xy] |= 0x40 << n; 5505 h->cbp_table[h->mb_xy] |= 0x40 << n;
5506 } else { 5506 } else {
5507 if( cat == 1 || cat == 2 ) 5507 if( cat == 1 || cat == 2 )
5508 h->non_zero_count_cache[scan8[n]] = coeff_count; 5508 h->non_zero_count_cache[scan8[n]] = coeff_count;
5509 else if( cat == 4 ) 5509 else if( cat == 4 )
5510 h->non_zero_count_cache[scan8[16+n]] = coeff_count; 5510 h->non_zero_count_cache[scan8[16+n]] = coeff_count;
5511 else { 5511 else {
5512 assert( cat == 5 ); 5512 assert( cat == 5 );
5513 fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1); 5513 fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
5514 } 5514 }
5515 } 5515 }
5516 5516
5517 for( coeff_count--; coeff_count >= 0; coeff_count-- ) { 5517 for( coeff_count--; coeff_count >= 0; coeff_count-- ) {
5518 uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; 5518 uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base;
5519 5519