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


C++ PicArray::CSort方法代码示例

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


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

示例1: DiagFilter

// Does a diagnonal prefilter
void dirac::DiagFilter( PicArray& pic_data, const float qf, const int strength ){
    // One quadrant of the filter taps


    float ffactor = (8.0+strength-4.0 - qf )/5.0;
    int factor = std::max(0, std::min( 256, int( ffactor*256.0 ) ) ) ;

    float bw = (1.0-ffactor)*0.6+0.4;

    //std::cout<<std::endl<<"Diagonal prefiltering with bandwidth = "<<bw;

    if (bw>0.9)
        return;

    TwoDArray<int> filter = GetDiagLPFilter( bw );

    filter[0][0] = ( factor*filter[0][0] + ( (1<<8)-factor )*(1<<16) + (1<<7) ) >> 8;

    for (int i=1;i<7; ++i )
        filter[0][i] = ( factor*filter[0][i] + (1<<7) ) >> 8;

    for (int j=1;j<7; ++j )
        for (int i=0;i<7; ++i )
            filter[j][i] = ( factor*filter[j][i] + (1<<7) ) >> 8;


    PicArray tmp_data( pic_data.LengthY(), pic_data.LengthX(), pic_data.CSort() );

    const int shift = 16;

    for (int j=0; j<7;++j)
        for (int i=0; i<pic_data.LengthX();++i)
            tmp_data[j][i] = DiagFilterBchkD( pic_data, i, j, filter, shift);

    for (int j=7; j<pic_data.LengthY()-7;++j){
        for (int i=0; i<7;++i)
            tmp_data[j][i] = DiagFilterBchkD( pic_data, i, j, filter, shift );

        for (int i=7; i<pic_data.LengthX()-7;++i)
            tmp_data[j][i] = DiagFilterD( pic_data, i, j, filter, shift );

        for (int i=pic_data.LengthX()-7; i<pic_data.LengthX();++i)
            tmp_data[j][i] = DiagFilterBchkD( pic_data, i, j, filter, shift );

    }

    for (int j=pic_data.LengthY()-7; j<pic_data.LengthY();++j)
        for (int i=0; i<pic_data.LengthX();++i)
            tmp_data[j][i] = DiagFilterBchkD( pic_data, i, j, filter, shift );

    pic_data = tmp_data;

}
开发者ID:cheeyeo,项目名称:dirac,代码行数:54,代码来源:prefilter.cpp

示例2: Compress

void CompCompressor::Compress(PicArray& pic_data)
{

    //need to transform, select quantisers for each band, and then compress each component in turn
    m_csort=pic_data.CSort();
    const int depth=4;
    unsigned int num_band_bits;

    // A pointer to an object  for coding the subband data
    BandCodec* bcoder;

    // A pointer to an object for outputting the subband data
    UnitOutputManager* band_op;

    const size_t CONTEXTS_REQUIRED = 24;

    Subband node;

    //set up Lagrangian params    
    if (m_fsort == I_frame) 
        m_lambda= m_encparams.ILambda();
    else if (m_fsort == L1_frame) 
        m_lambda= m_encparams.L1Lambda();
    else 
        m_lambda= m_encparams.L2Lambda();

     if (m_csort == U_COMP) 
         m_lambda*= m_encparams.UFactor();
     if (m_csort == V_COMP) 
         m_lambda*= m_encparams.VFactor();

    WaveletTransform wtransform(depth);

    wtransform.Transform( FORWARD , pic_data );
    wtransform.SetBandWeights( m_encparams.CPD() , m_fparams.FSort() , m_fparams.CFormat(), m_csort);

    SubbandList& bands=wtransform.BandList();

    // Generate all the quantisation data
    GenQuantList();

    // Choose all the quantisers
    OneDArray<unsigned int> estimated_bits( Range( 1 , bands.Length() ) );
    SelectQuantisers( pic_data , bands , estimated_bits );  

    // Loop over all the bands (from DC to HF) quantising and coding them
    for (int b=bands.Length() ; b>=1 ; --b )
    {
        band_op = & m_encparams.BitsOut().FrameOutput().BandOutput( m_csort , b );

        GolombCode( band_op->Header() , bands(b).Qf(0) );

        if (bands(b).Qf(0) != -1)
        {   // If not skipped ...

            bands(b).SetQf( 0 , m_qflist[bands(b).Qf(0)] );

             // Pick the right codec according to the frame type and subband
            if (b >= bands.Length())
            {
                if ( m_fsort == I_frame && b == bands.Length() )
                    bcoder=new IntraDCBandCodec( &( band_op->Data() ) , CONTEXTS_REQUIRED , bands);
                else
                    bcoder=new LFBandCodec( &( band_op->Data() ) ,CONTEXTS_REQUIRED, bands , b);
            }
            else
                bcoder=new BandCodec( &( band_op->Data() ) , CONTEXTS_REQUIRED , bands , b);

            num_band_bits = bcoder->Compress(pic_data);

             // Update the entropy correction factors
            m_encparams.EntropyFactors().Update(b , m_fsort , m_csort , estimated_bits[b] , num_band_bits);

            // Write the length of the data chunk into the header, and flush everything out to file
            UnsignedGolombCode( band_op->Header() , num_band_bits);

            delete bcoder;            
        }
        else
        {   // ... skipped

            if (b == bands.Length() && m_fsort == I_frame)
                SetToVal( pic_data , bands(b) , 2692 );
            else
                SetToVal( pic_data , bands(b) , 0 );
        }        
    }//b

    // Transform back into the picture domain
    wtransform.Transform( BACKWARD , pic_data );

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


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