H.264句法和语法总结(十三)残差句法

residual( ) { 
    if( !entropy_coding_mode_flag )          
        residual_block = residual_block_cavlc          
    else          
        residual_block = residual_block_cabac          
    if( MbPartPredMode( mb_type, 0 )    = =    Intra_16x16 )          
        residual_block( Intra16x16DCLevel, 16 )    
    for( i8x8 = 0; i8x8 < 4; i8x8++ )    /* each luma 8x8 block */          
        for( i4x4 = 0; i4x4 < 4; i4x4++ )    /* each 4x4 sub-block of block */          
            if( CodedBlockPatternLuma & ( 1 << i8x8 ) ) {            
                if( MbPartPredMode( mb_type, 0 )    = =    Intra_16x16 )          
                    residual_block( Intra16x16ACLevel[ i8x8 * 4 + i4x4 ], 15 )   
                else          
                    residual_block( LumaLevel[ i8x8 * 4 + i4x4 ], 16 )          
            } else {          
                if( MbPartPredMode( mb_type, 0 )    = =    Intra_16x16 )          
                    for( i = 0; i < 15; i++ )            
                        Intra16x16ACLevel[ i8x8 * 4 + i4x4 ][ i ] = 0          
                else          
                    for( i = 0; i < 16; i++ )          
                        LumaLevel[ i8x8 * 4 + i4x4 ][ i ] = 0          
            }          
    for( iCbCr = 0; iCbCr < 2; iCbCr++ )          
        if( CodedBlockPatternChroma & 3 )    /* chroma DC residual present */                   
            residual_block( ChromaDCLevel[ iCbCr ], 4 )       
        else          
            for( i = 0; i < 4; i++ )          
                ChromaDCLevel[ iCbCr ][ i ] = 0          
    for( iCbCr = 0; iCbCr < 2; iCbCr++ )          
        for( i4x4 = 0; i4x4 < 4; i4x4++ )          
            if( CodedBlockPatternChroma & 2 )    
                /* chroma AC residual present */  
                residual_block( ChromaACLevel[ iCbCr ][ i4x4 ], 15 )      
            else          
                for( i = 0; i < 15; i++ )          
                    ChromaACLevel[ iCbCr ][ i4x4 ][ i ] = 0          
}

你可能感兴趣的:(H.264句法和语法总结(十三)残差句法)