当前位置: 首页>>代码示例>>C++>>正文


C++ MvData类代码示例

本文整理汇总了C++中MvData的典型用法代码示例。如果您正苦于以下问题:C++ MvData类的具体用法?C++ MvData怎么用?C++ MvData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MvData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: abs

void MvDataCodec::CodeMv2(const MvData& in_data)
{
    const MvArray& mv_array = in_data.Vectors(2);
    const MVector pred = Mv2Prediction( mv_array , in_data.Mode() );     

    const int valx = mv_array[b_yp][b_xp].x - pred.x; 
    const int abs_valx = abs(valx); 
    
    for (int bin = 1; bin <= abs_valx; ++bin)
        EncodeSymbol( 0 , ChooseREF2xContext( in_data , bin ) ); 

    EncodeSymbol( 1 , ChooseREF2xContext( in_data , abs_valx + 1 ) ); 
    
    if (valx != 0)
        EncodeSymbol( ( (valx > 0)? 1 : 0) , ChooseREF2xSignContext( in_data ) ); 

    const int valy = mv_array[b_yp][b_xp].y-pred.y; 
    const int abs_valy = std::abs(valy);     
    
    for (int bin = 1; bin<=abs_valy; ++bin )
        EncodeSymbol( 0 , ChooseREF2yContext( in_data , bin ) ); 
    
    EncodeSymbol( 1 , ChooseREF2yContext( in_data , abs_valy + 1 ) ); 
    
    if (valy != 0)
        EncodeSymbol( ( (valy > 0)? 1 : 0) , ChooseREF2ySignContext( in_data ) ); 
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:27,代码来源:mv_codec.cpp

示例2: DoWorkCode

// Main code function
void PredModeCodec::DoWorkCode( MvData& in_data )
{
    int step,max; 
    int split_depth;  

    for (m_sb_yp = 0, m_sb_tlb_y = 0;  m_sb_yp < in_data.SBSplit().LengthY();  ++m_sb_yp, m_sb_tlb_y += 4)
    {
        for (m_sb_xp = 0,m_sb_tlb_x = 0; m_sb_xp < in_data.SBSplit().LengthX(); ++m_sb_xp,m_sb_tlb_x += 4)
        {
            split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp]; 

            step = 4  >>  (split_depth); 
            max = (1 << split_depth); 
                        
            //now do all the block modes and mvs in the mb            
            for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
            {
                for (m_b_xp = m_sb_tlb_x; m_b_xp < m_sb_tlb_x+4; m_b_xp += step)
                {
                    CodeVal(in_data);
                }//m_b_xp
            }//m_b_yp    
            
        }//m_sb_xp
    }//m_sb_yp    
} 
开发者ID:MOXfiles,项目名称:dirac-research,代码行数:27,代码来源:mv_codec.cpp

示例3: CodeVal

void SplitModeCodec::CodeVal(const MvData& in_data)
{
    int val = in_data.SBSplit()[m_sb_yp][m_sb_xp] - Prediction( in_data.SBSplit() ); 
    
    if (val < 0) val+=3; //produce prediction mod 3

    EncodeUInt(val, SB_SPLIT_BIN1_CTX, SB_SPLIT_BIN2_CTX);
}
开发者ID:MOXfiles,项目名称:dirac-research,代码行数:8,代码来源:mv_codec.cpp

示例4: CodeMBCom

void MvDataCodec::CodeMBCom(const MvData& in_data)
{
    bool val = in_data.MBCommonMode()[mb_yp][mb_xp]; 
    
    if (val != MBCBModePrediction( in_data.MBCommonMode() ))
        EncodeSymbol( 1 , ChooseMBCContext( in_data ) ); 
    else
        EncodeSymbol( 0 , ChooseMBCContext( in_data ) ); 
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:9,代码来源:mv_codec.cpp

示例5: DecodeMBCom

void MvDataCodec::DecodeMBCom( MvData& out_data )
{
    bool bit; 
    DecodeSymbol( bit , ChooseMBCContext( out_data ) ); 
    
    if ( bit )
        out_data.MBCommonMode()[mb_yp][mb_xp] = !MBCBModePrediction( out_data.MBCommonMode() ); 
    else
        out_data.MBCommonMode()[mb_yp][mb_xp] = MBCBModePrediction( out_data.MBCommonMode() ); 
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:10,代码来源:mv_codec.cpp

示例6: DoWorkDecode

// Main decode function
void SplitModeCodec::DoWorkDecode( MvData& out_data)
{

    for (m_sb_yp = 0; m_sb_yp < out_data.SBSplit().LengthY(); ++m_sb_yp)
    {
        for (m_sb_xp = 0; m_sb_xp < out_data.SBSplit().LengthX(); ++m_sb_xp)
        {
            DecodeVal( out_data );
        }//m_sb_xp
    }//m_sb_yp
}  
开发者ID:MOXfiles,项目名称:dirac-research,代码行数:12,代码来源:mv_codec.cpp

示例7: DecodeSymbol

void MvDataCodec::DecodeMv2( MvData& out_data )
{
    MVector pred = Mv2Prediction( out_data.Vectors(2) , out_data.Mode() ); 
    int val = 0; 
    int bin = 1; 
    bool bit; 
    
    do
    {
        DecodeSymbol( bit , ChooseREF2xContext( out_data , bin ) ); 
        
        if ( !bit )
            val++; 
        
        bin++; 
    }
    while ( !bit ); 
    
    if (val != 0)
    {
        DecodeSymbol( bit , ChooseREF2xSignContext( out_data ) ); 
        
        if (!bit)
            val = -val; 
    }
    
    out_data.Vectors(2)[b_yp][b_xp].x = val + pred.x; 

    val = 0; 
    bin = 1; 
    
    do
    {
        DecodeSymbol( bit , ChooseREF2yContext( out_data , bin ) ); 
        
        if ( !bit )
            val++; 
        
        bin++; 
    }
    while ( !bit ); 
    
    if (val != 0)
    {
        DecodeSymbol( bit , ChooseREF2ySignContext( out_data ) ); 
        
        if ( !bit )
            val = -val; 
    }
    
    out_data.Vectors(2)[b_yp][b_xp].y = val + pred.y; 
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:52,代码来源:mv_codec.cpp

示例8: CodePredmode

void MvDataCodec::CodePredmode(const MvData& in_data)
{
    int val = in_data.Mode()[b_yp][b_xp] - BlockModePrediction( in_data.Mode() ); 
    
    if (val < 0)
        val += 4;  //produce value mod 4    
    
    for (int bin = 1;  bin<= val;  ++bin)
        EncodeSymbol( 0 , ChoosePredContext( in_data , bin ) ); 
                 
    if (val  !=  3) //if we've had three zeroes, know we must have value 3
        EncodeSymbol( 1 , ChoosePredContext( in_data , val + 1 ) ); 
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:13,代码来源:mv_codec.cpp

示例9: CodeMBSplit

void MvDataCodec::CodeMBSplit(const MvData& in_data)
{
    int val = in_data.MBSplit()[mb_yp][mb_xp] - MBSplitPrediction( in_data.MBSplit() ); 
    
    if (val < 0)
        val += 3; //produce prediction mod 3    
    
    int ctx; 
    
    for (int bin = 1; bin <= val; ++bin)
    {
        ctx = ChooseMBSContext(in_data,bin); 
        EncodeSymbol(0,ctx); 
    }
    
    if (val != 2)//if we've had two zeroes, know we must have value 2
        EncodeSymbol(1,ChooseMBSContext(in_data,val+1)); 
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:18,代码来源:mv_codec.cpp

示例10: DecodePredmode

void MvDataCodec::DecodePredmode( MvData& out_data )
{
    int val = 0; 
    int bin = 1; 
    bool bit; 
    
    do
    {
        DecodeSymbol( bit , ChoosePredContext( out_data , bin ) ); 
        
        if (!bit)
            val++; 
        
        bin++; 
    }
    while (!bit && val != 3);  
    
    out_data.Mode()[b_yp][b_xp] = PredMode( ( val + BlockModePrediction (out_data.Mode() ) ) %4); 
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:19,代码来源:mv_codec.cpp

示例11: DecodeMBSplit

void MvDataCodec::DecodeMBSplit(MvData& out_data)
{
    int val = 0; 
    int bin = 1; 
    bool bit; 

    do
    {
        DecodeSymbol( bit , ChooseMBSContext( out_data , bin ) ); 
        
        if (!bit)
            val++; 
        
        bin++; 
    }
    while (!bit && val != 2);  
    
    out_data.MBSplit()[mb_yp][mb_xp] = ( val + MBSplitPrediction( out_data.MBSplit() ) ) % 3;     
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:19,代码来源:mv_codec.cpp

示例12: CodeDC

void MvDataCodec::CodeDC(const MvData& in_data)
{    
    //begin with Y DC value    
    const ValueType valY = in_data.DC( Y_COMP )[b_yp][b_xp]
                           - DCPrediction( in_data.DC(Y_COMP) , in_data.Mode() ); 
    const ValueType abs_valY = std::abs( valY ); 

    for (ValueType bin = 1; bin <= abs_valY; ++bin)
        EncodeSymbol( 0 , ChooseYDCContext( in_data , bin ) ); 

    EncodeSymbol( 1 , ChooseYDCContext (in_data , abs_valY + 1 ) ); 
    
    if (valY != 0)
        EncodeSymbol( ( (valY > 0)? 1 : 0) , ChooseYDCSignContext( in_data ) ); 

    //now do U and V if necessary
    if (m_cformat != Yonly)
    {
        //continue with U and V DC values
        const int valU =  in_data.DC(U_COMP)[b_yp][b_xp]
                          - DCPrediction(in_data.DC( U_COMP ) , in_data.Mode()); 
        const int abs_valU = std::abs( valU ); 

        for (ValueType bin = 1;  bin<=abs_valU ; ++bin)
            EncodeSymbol( 0 , ChooseUDCContext( in_data , bin ) ); 
        
        EncodeSymbol( 1 , ChooseUDCContext( in_data , abs_valU + 1 ) ); 
        
        if (valU != 0)
            EncodeSymbol( ( (valU > 0) ? 1 : 0) , ChooseUDCSignContext( in_data ) ); 
        
        const int valV = in_data.DC( V_COMP )[b_yp][b_xp] 
                         - DCPrediction( in_data.DC( V_COMP ) , in_data.Mode() ); 
        const int abs_valV = std::abs( valV ); 

        for (ValueType bin = 1; bin<=abs_valV ; ++bin)
            EncodeSymbol( 0 , ChooseVDCContext( in_data , bin ) ); 

        EncodeSymbol( 1 , ChooseVDCContext( in_data , abs_valV + 1 ) ); 
        
        if (valV != 0)
            EncodeSymbol( ( (valV > 0)? 1 : 0) , ChooseVDCSignContext( in_data ) ); 
    }
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:44,代码来源:mv_codec.cpp

示例13: DecodeVal

void SplitModeCodec::DecodeVal(MvData& out_data)
{
    out_data.SBSplit()[m_sb_yp][m_sb_xp] =
                             (DecodeUInt(SB_SPLIT_BIN1_CTX, SB_SPLIT_BIN2_CTX) +
                             Prediction(out_data.SBSplit())) % 3;
}
开发者ID:MOXfiles,项目名称:dirac-research,代码行数:6,代码来源:mv_codec.cpp

示例14: DoWorkDecode

void MvDataCodec::DoWorkDecode( MvData& out_data, int num_bits)
{
    int step,max; 
    int pstep,pmax;     
    int split_depth; 
    bool common_ref; 
    int xstart,ystart;     

    for (mb_yp = 0,mb_tlb_y = 0; mb_yp < out_data.MBSplit().LengthY(); ++mb_yp,mb_tlb_y += 4)
    {
        for (mb_xp = 0,mb_tlb_x = 0; mb_xp < out_data.MBSplit().LengthX(); ++mb_xp,mb_tlb_x += 4)
        {
             //start with split mode
            DecodeMBSplit( out_data ); 
            split_depth = out_data.MBSplit()[mb_yp][mb_xp]; 
            step =  4  >>  (split_depth); 
            max  = (1 << split_depth); 

            //next do common_ref
            if(split_depth  !=  0)
            {
                DecodeMBCom( out_data ); 
                pstep = step; 
                pmax = max; 
            }
            else
            {
                out_data.MBCommonMode()[mb_yp][mb_xp] = true; 
                pstep = 4; 
                pmax = 1; 
            }
            
            common_ref = out_data.MBCommonMode()[mb_yp][mb_xp]; 

            // do prediction modes
            for (b_yp = mb_tlb_y;  b_yp < mb_tlb_y + 4;  b_yp += pstep)
            {                
                for (b_xp = mb_tlb_x; b_xp < mb_tlb_x + 4;  b_xp += pstep)
                {
                    DecodePredmode(out_data); 
                    
                    // propagate throughout MB                
                    for (int y = b_yp;  y < b_yp + pstep;  y++)
                        for (int x = b_xp;  x < b_xp + pstep;  x++)
                            out_data.Mode()[y][x] = out_data.Mode()[b_yp][b_xp];                                                         
                }
            }

               //now do all the block mvs in the mb
            for (int j = 0; j < max; ++j)
            {                
                for (int i = 0; i < max; ++i)
                {
                    xstart = b_xp = mb_tlb_x + i * step; 
                    ystart = b_yp = mb_tlb_y + j * step;                                             
                    
                    if (out_data.Mode()[b_yp][b_xp] == REF1_ONLY || out_data.Mode()[b_yp][b_xp] == REF1AND2 )
                        DecodeMv1( out_data ); 
                    
                    if (out_data.Mode()[b_yp][b_xp] == REF2_ONLY || out_data.Mode()[b_yp][b_xp] == REF1AND2 )
                        DecodeMv2( out_data ); 
                    
                    if(out_data.Mode()[b_yp][b_xp] == INTRA)
                        DecodeDC( out_data ); 
                    
                      //propagate throughout MB    
                    for (b_yp = ystart; b_yp < ystart+step; b_yp++)
                    {
                        for (b_xp = xstart; b_xp < xstart+step; b_xp++)
                        {                    
                            out_data.Vectors(1)[b_yp][b_xp].x = out_data.Vectors(1)[ystart][xstart].x; 
                            out_data.Vectors(1)[b_yp][b_xp].y = out_data.Vectors(1)[ystart][xstart].y; 
                            out_data.Vectors(2)[b_yp][b_xp].x = out_data.Vectors(2)[ystart][xstart].x; 
                            out_data.Vectors(2)[b_yp][b_xp].y = out_data.Vectors(2)[ystart][xstart].y; 
                            out_data.DC( Y_COMP )[b_yp][b_xp] = out_data.DC( Y_COMP )[ystart][xstart]; 
                            out_data.DC( U_COMP )[b_yp][b_xp] = out_data.DC( U_COMP )[ystart][xstart]; 
                            out_data.DC( V_COMP )[b_yp][b_xp] = out_data.DC( V_COMP )[ystart][xstart]; 
                        }//b_xp
                    }//b_yp
                }//i                    
            }//j

        }//mb_xp
    }//mb_yp

}
开发者ID:Fluffiest,项目名称:splayer,代码行数:86,代码来源:mv_codec.cpp

示例15: DoWorkCode

void MvDataCodec::DoWorkCode( MvData& in_data )
{
    int step,max; 
    int pstep,pmax; 
    int split_depth; 
    bool common_ref; 

    MB_count = 0; 
    
    for (mb_yp = 0, mb_tlb_y = 0;  mb_yp < in_data.MBSplit().LengthY();  ++mb_yp, mb_tlb_y += 4)
    {
        for (mb_xp = 0,mb_tlb_x = 0; mb_xp < in_data.MBSplit().LengthX(); ++mb_xp,mb_tlb_x += 4)
        {
             //start with split mode
            CodeMBSplit(in_data); 
            split_depth = in_data.MBSplit()[mb_yp][mb_xp]; 

            step = 4  >>  (split_depth); 
            max = (1 << split_depth); 

            //next do common_ref
            if(split_depth != 0)
            {
                CodeMBCom(in_data); 
                pstep = step; 
                pmax = max; 
            }
            else
            {
                pstep = 4; 
                pmax = 1; 
            }
            common_ref = in_data.MBCommonMode()[mb_yp][mb_xp]; 


            //do prediction modes            
            for (b_yp = mb_tlb_y; b_yp < mb_tlb_y+4; b_yp += pstep)
                for (b_xp = mb_tlb_x; b_xp < mb_tlb_x+4; b_xp += pstep)
                    CodePredmode(in_data); 
            
            step = 4 >> (split_depth);             
            
               //now do all the block mvs in the mb            
            for (b_yp = mb_tlb_y; b_yp < mb_tlb_y+4; b_yp += step)
            {
                for (b_xp = mb_tlb_x; b_xp < mb_tlb_x+4; b_xp += step)
                {
                    if (in_data.Mode()[b_yp][b_xp] == REF1_ONLY || in_data.Mode()[b_yp][b_xp] == REF1AND2 )
                        CodeMv1(in_data); 
                    
                    if (in_data.Mode()[b_yp][b_xp] == REF2_ONLY || in_data.Mode()[b_yp][b_xp] == REF1AND2 )
                        CodeMv2(in_data); 
                    
                    if(in_data.Mode()[b_yp][b_xp] == INTRA)
                        CodeDC(in_data);                     
                }//b_xp
            }//b_yp    
            
            //TODO: Update all contexts here?
            
        }//mb_xp
    }//mb_yp

}
开发者ID:Fluffiest,项目名称:splayer,代码行数:64,代码来源:mv_codec.cpp


注:本文中的MvData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。