Changeset 28 in 3DVCSoftware for branches/0.3-poznan-univ/source/Lib/TLibCommon


Ignore:
Timestamp:
24 Feb 2012, 20:22:58 (13 years ago)
Author:
poznan-univ
Message:

Poznan Tools

  • Encoding only disoccluded CUs in depended views
  • Depth based motion prediction
  • Texture QP adjustment based on depth data
  • Nonlinear depth representation
Location:
branches/0.3-poznan-univ/source/Lib/TLibCommon
Files:
2 added
21 edited

Legend:

Unmodified
Added
Removed
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/CommonDef.h

    r21 r28  
    138138
    139139
    140 #if ( HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED )
     140#if ( HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED || POZNAN_MP_USE_DEPTH_MAP_GENERATION)
    141141#define DEPTH_MAP_GENERATION        1
    142142#else
    143143#define DEPTH_MAP_GENERATION        0
     144#endif
     145
     146#if POZNAN_NONLINEAR_DEPTH
     147#define POZNAN_LUT_INCREASED_PRECISION 0 // 1 //to do
     148#else
     149#define POZNAN_LUT_INCREASED_PRECISION 0
    144150#endif
    145151
     
    174180#define OUTPUT_RESIDUAL_PICTURES          0         // output residual pictures (for debugging)
    175181
    176 #define HHI_MPI_MERGE_POS                     0         // position of mvi in merge list (0..5)
    177 
     182#define HHI_MPI_MERGE_POS                 0         // position of mvi in merge list (0..5)
     183
     184// ====================================================================================================================
     185// POZNAN DEFINE SECTION
     186// ====================================================================================================================
     187#define POZNAN_OUTPUT_AVAILABLE_MAP       0           // output available map (for debugging)
     188#define POZNAN_OUTPUT_SYNTH               0           // output synthesised view (for debugging)
     189
     190#if POZNAN_DBMP
     191#define POZNAN_DBMP_MERGE_POS             0         // position of DBMP candidate in merge list for coding (0..6) - overwrites PDM_MERGE_POS settings, is overwritten by HHI_MPI_MERGE_POS settings!!!
     192#endif
     193
     194#if POZNAN_NONLINEAR_DEPTH
     195inline UChar quantizeDepthPower(Float fDepthPower)
     196{
     197  Int r = (Int) ( (fDepthPower-1.0f)*128.0f + 0.5f);
     198  if (r<=0) return 0;
     199  if (r>255) r=255; 
     200  return r;
     201};
     202
     203inline Float dequantizeDepthPower(Int iDepthQuant)
     204{
     205  return iDepthQuant/128.0f + 1.0f; 
     206};
     207#endif
    178208
    179209// ====================================================================================================================
     
    186216#define Clip(x)                     ( Min(g_uiIBDI_MAX, Max( 0, (x)) ) )                              ///< clip with bit-depth range
    187217#define Clip3( MinVal, MaxVal, a)   ( ((a)<(MinVal)) ? (MinVal) : (((a)>(MaxVal)) ? (MaxVal) :(a)) )  ///< general min/max clip
    188 #define RemoveBitIncrement(x)       ( (x + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement )     ///< Remove Bit increment
     218#define RemoveBitIncrement(x)       ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement )     ///< Remove Bit increment
     219
     220#if POZNAN_LUT_INCREASED_PRECISION
     221#define RemoveBitIncrementLUT(x)       (x)     ///< Remove Bit increment
     222#define SizeOfLUT                      (256 << g_uiBitIncrement) 
     223#else
     224#define SizeOfLUT                      256
     225#define RemoveBitIncrementLUT(x)       ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement )     ///< Remove Bit increment
     226#endif
    189227
    190228#define DATA_ALIGN                  1                                                                 ///< use 32-bit aligned malloc/free
     
    216254#define AMVP_MAX_NUM_CANDS          6           ///< max number of final candidates
    217255// MERGE
     256#if POZNAN_DBMP
     257#define MRG_MAX_NUM_CANDS           7
     258#define POZNAN_DBMP_MRG_CAND    MRG_MAX_NUM_CANDS-1                     // position of DBMP candidate in merge list (0..6)
     259#else
    218260#define MRG_MAX_NUM_CANDS           6
     261#endif
    219262
    220263// Reference memory management
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/ContextTables.h

    r5 r28  
    5353#define NUM_MERGE_FLAG_EXT_CTX        3       ///< number of context models for merge flag of merge extended
    5454#define NUM_MERGE_IDX_EXT_CTX         4       ///< number of context models for merge index of merge extended
     55#if POZNAN_DBMP
     56#define NUM_MV_MERGE_IDX_EXT_CTX      6       ///< number of context models for merge index of merge extended
     57#else
    5558#define NUM_MV_MERGE_IDX_EXT_CTX      5       ///< number of context models for merge index of merge extended
     59#endif
    5660#define NUM_RES_PRED_FLAG_CTX         3       ///< number of context for residual prediction flag     
    5761
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComDataCU.cpp

    r21 r28  
    187187    m_acCUMvField[1].create( uiNumPartition );
    188188   
     189#if POZNAN_DBMP_CALC_PRED_DATA
     190    m_acCUMvField2nd[0].create( uiNumPartition );
     191    m_acCUMvField2nd[1].create( uiNumPartition );
     192#endif
     193   
    189194#if HHI_DMM_WEDGE_INTRA
    190195    m_puiWedgeFullTabIdx       = (UInt*)xMalloc(UInt, uiNumPartition);
     
    210215    m_acCUMvField[0].setNumPartition(uiNumPartition );
    211216    m_acCUMvField[1].setNumPartition(uiNumPartition );
     217
     218#if POZNAN_DBMP_CALC_PRED_DATA
     219    m_acCUMvField2nd[0].setNumPartition(uiNumPartition );
     220    m_acCUMvField2nd[1].setNumPartition(uiNumPartition );
     221#endif
    212222  }
    213223 
     
    296306    if ( m_piContourPredTexDeltaDC2  ) { xFree(m_piContourPredTexDeltaDC2);  m_piContourPredTexDeltaDC2  = NULL; }
    297307#endif   
     308   
     309#if POZNAN_DBMP_CALC_PRED_DATA
     310    m_acCUMvField2nd[0].destroy();
     311    m_acCUMvField2nd[1].destroy();
     312#endif
     313
    298314  }
    299315 
     
    388404  m_acCUMvField[0].clearMvField();
    389405  m_acCUMvField[1].clearMvField();
     406 
     407#if POZNAN_DBMP_CALC_PRED_DATA
     408  m_acCUMvField2nd[0].clearMvField();
     409  m_acCUMvField2nd[1].clearMvField();
     410#endif
    390411 
    391412  UInt uiTmp = m_puhWidth[0]*m_puhHeight[0];
     
    508529  m_acCUMvField[1].clearMvField();
    509530
     531#if POZNAN_DBMP_CALC_PRED_DATA
     532  m_acCUMvField2nd[0].clearMvField();
     533  m_acCUMvField2nd[1].clearMvField();
     534#endif
     535
    510536#if HHI_DMM_WEDGE_INTRA
    511537  memset( m_puiWedgeFullTabIdx,  0, iSizeInUInt   );
     
    617643  m_uiEntropySliceStartCU   = pcCU->getEntropySliceStartCU();
    618644
     645#if POZNAN_DBMP_CALC_PRED_DATA
     646  m_acCUMvField2nd[0].clearMvField();
     647  m_acCUMvField2nd[1].clearMvField();
     648#endif
     649
    619650#if HHI_DMM_WEDGE_INTRA
    620651  memset( m_puiWedgeFullTabIdx,  0, iSizeInUInt   );
     
    719750  m_acCUMvField[1].setMvdPtr(pcCU->getCUMvField(REF_PIC_LIST_1)->getMvd()    + uiPart);
    720751  m_acCUMvField[1].setRefIdxPtr(pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx() + uiPart);
     752
     753#if POZNAN_DBMP_CALC_PRED_DATA
     754  m_acCUMvField2nd[0].setMvPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getMv()     + uiPart);
     755  m_acCUMvField2nd[0].setMvdPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getMvd()    + uiPart);
     756  m_acCUMvField2nd[0].setRefIdxPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getRefIdx() + uiPart);
     757  m_acCUMvField2nd[1].setMvPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getMv()     + uiPart);
     758  m_acCUMvField2nd[1].setMvdPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getMvd()    + uiPart);
     759  m_acCUMvField2nd[1].setRefIdxPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getRefIdx() + uiPart);
     760#endif
     761
    721762  m_uiSliceStartCU        = pcCU->getSliceStartCU();
    722763  m_uiEntropySliceStartCU = pcCU->getEntropySliceStartCU();
     
    787828  m_acCUMvField[eRefPicList].setMvdPtr(pcCU->getCUMvField(eRefPicList)->getMvd()    + uiAbsPartIdx);
    788829  m_acCUMvField[eRefPicList].setRefIdxPtr(pcCU->getCUMvField(eRefPicList)->getRefIdx() + uiAbsPartIdx);
     830
     831#if POZNAN_DBMP_CALC_PRED_DATA
     832  m_acCUMvField2nd[eRefPicList].setMvPtr(pcCU->getCUMvField2nd(eRefPicList)->getMv()     + uiAbsPartIdx);
     833  m_acCUMvField2nd[eRefPicList].setMvdPtr(pcCU->getCUMvField2nd(eRefPicList)->getMvd()    + uiAbsPartIdx);
     834  m_acCUMvField2nd[eRefPicList].setRefIdxPtr(pcCU->getCUMvField2nd(eRefPicList)->getRefIdx() + uiAbsPartIdx);
     835#endif
     836
    789837#if HHI_MPI
    790838  m_piTextureModeDepth = pcCU->getTextureModeDepth() + uiAbsPartIdx;
     
    857905  m_acCUMvField[1].copyFrom( pcCU->getCUMvField( REF_PIC_LIST_1 ), pcCU->getTotalNumPart(), uiOffset );
    858906 
     907#if POZNAN_DBMP_CALC_PRED_DATA
     908  m_acCUMvField2nd[0].copyFrom( pcCU->getCUMvField2nd( REF_PIC_LIST_0 ), pcCU->getTotalNumPart(), uiOffset );
     909  m_acCUMvField2nd[1].copyFrom( pcCU->getCUMvField2nd( REF_PIC_LIST_1 ), pcCU->getTotalNumPart(), uiOffset );
     910#endif
     911
    859912  UInt uiTmp  = g_uiMaxCUWidth*g_uiMaxCUHeight >> (uiDepth<<1);
    860913  UInt uiTmp2 = uiPartUnitIdx*uiTmp;
     
    943996  m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU );
    944997  m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU );
     998 
     999#if POZNAN_DBMP_CALC_PRED_DATA
     1000  m_acCUMvField2nd[0].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU );
     1001  m_acCUMvField2nd[1].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU );
     1002#endif
    9451003 
    9461004  UInt uiTmp  = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>(uhDepth<<1);
     
    10301088  m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart );
    10311089  m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart );
     1090 
     1091#if POZNAN_DBMP_CALC_PRED_DATA
     1092  m_acCUMvField2nd[0].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart );
     1093  m_acCUMvField2nd[1].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart );
     1094#endif
    10321095 
    10331096  UInt uiTmp  = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>((uhDepth+uiPartDepth)<<1);
     
    26972760#endif
    26982761 
     2762#if POZNAN_DBMP
     2763  Bool bDBMPMerge = getSlice()->getMP()->isDBMPEnabled();
     2764  UInt uiDBMPAddr = POZNAN_DBMP_MRG_CAND;
     2765#endif
     2766 
    26992767  bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    27002768  for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui )
     
    27112779    pcCULeft = NULL;
    27122780  }
    2713   if( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) )
     2781  if( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx )
     2782#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     2783    && !pcCULeft->isCUSkiped( uiLeftPartIdx )
     2784#endif
     2785  )
    27142786  {
    27152787    abCandIsInter[uiLeftAddr] = true;
     
    27372809    pcCUAbove = NULL;
    27382810  }
    2739   if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) )
     2811  if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
     2812#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     2813    && !pcCUAbove->isCUSkiped( uiAbovePartIdx )
     2814#endif
     2815  )
    27402816  {
    27412817    abCandIsInter[uiAboveAddr] = true;
     
    31833259#endif
    31843260
     3261#if POZNAN_DBMP
     3262  //===== add point-to-point merge with depth maps =====
     3263  if ( bDBMPMerge )
     3264  {
     3265    //prediction of motion data for points with disocclusion:
     3266        UInt uiRefArrayAddr = uiDBMPAddr;
     3267        for(UInt ui=0; ui<MRG_MAX_NUM_CANDS; ui++) if ( ui!=uiDBMPAddr && abCandIsInter[ui] ) {uiRefArrayAddr = ui; break;}     
     3268        if(uiRefArrayAddr != uiDBMPAddr)
     3269        {
     3270                puhInterDirNeighbours[uiDBMPAddr] = puhInterDirNeighbours[uiRefArrayAddr];
     3271                pcMvFieldNeighbours[uiDBMPAddr << 1].setMvField(pcMvFieldNeighbours[uiRefArrayAddr << 1].getMv(),pcMvFieldNeighbours[uiRefArrayAddr << 1].getRefIdx());
     3272                pcMvFieldNeighbours[(uiDBMPAddr << 1)+1].setMvField(pcMvFieldNeighbours[(uiRefArrayAddr << 1)+1].getMv(),pcMvFieldNeighbours[(uiRefArrayAddr << 1)+1].getRefIdx());
     3273        }
     3274        else
     3275        {
     3276                TComMv cMVzero; cMVzero.setZero();
     3277                if( getSlice()->isInterB() )
     3278                {
     3279                        puhInterDirNeighbours[uiDBMPAddr] = 3;
     3280                        pcMvFieldNeighbours[uiDBMPAddr << 1].setMvField(cMVzero,0);
     3281                        pcMvFieldNeighbours[(uiDBMPAddr << 1)+1].setMvField(cMVzero,0);
     3282                }
     3283                else
     3284                {
     3285                        if(getSlice()->getNumRefIdx(REF_PIC_LIST_0)>0)
     3286                        {
     3287                                puhInterDirNeighbours[uiDBMPAddr] = 1;
     3288                                pcMvFieldNeighbours[uiDBMPAddr << 1].setMvField(cMVzero,0);
     3289                        }
     3290                        else if(getSlice()->getNumRefIdx(REF_PIC_LIST_1)>0)
     3291                        {
     3292                                puhInterDirNeighbours[uiDBMPAddr] = 2;
     3293                                pcMvFieldNeighbours[(uiDBMPAddr << 1)+1].setMvField(cMVzero,0);
     3294                        }
     3295                        else puhInterDirNeighbours[uiDBMPAddr] = 0;
     3296                }
     3297        }       
     3298        if(puhInterDirNeighbours[uiDBMPAddr])
     3299        {               
     3300                abCandIsInter[uiDBMPAddr] = true;
     3301                puiNeighbourCandIdx[uiDBMPAddr] = uiDBMPAddr + 1;
     3302        }
     3303  }
     3304#endif
     3305
    31853306
    31863307  //===== remove duplicates =====
    31873308  for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ )
    31883309  {
     3310#if POZNAN_DBMP
     3311    if(uiOuter==POZNAN_DBMP_MRG_CAND) continue;
     3312#endif
    31893313    if( abCandIsInter[ uiOuter ] && ( puiNeighbourCandIdx[uiOuter] == uiOuter + 1 ) )
    31903314    {
    31913315      for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ )
    31923316      {
     3317#if POZNAN_DBMP
     3318        if(uiIter==POZNAN_DBMP_MRG_CAND) continue;
     3319#endif
    31933320        if( abCandIsInter[ uiIter ] )
    31943321        {
     
    32713398  if( uiIter == 0 )
    32723399  {
    3273     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     3400    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     3401#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     3402       && !pcCorner->isCUSkiped( uiCornerPUIdx )
     3403#endif
     3404    )
    32743405    {
    32753406      rbValidCand = true;
     
    33063437  else
    33073438  {
    3308     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     3439    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     3440#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     3441       && !pcCorner->isCUSkiped( uiCornerPUIdx )
     3442#endif
     3443    )
    33093444    {
    33103445      rbValidCand = true;
     
    44644599    return false;
    44654600 
     4601#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     4602  if (pColCU->isSkipped(uiPartIdxCenter))
     4603    return false;
     4604#endif
     4605 
    44664606  if( m_pcSlice->getRefPic(eRefPicList, iRefIdx)->getViewIdx() != m_pcSlice->getViewIdx() )
    44674607    return false;
     
    48214961  }
    48224962#endif
     4963
     4964#if POZNAN_DBMP_CALC_PRED_DATA
     4965  pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->copyTo( &m_acCUMvField2nd[0], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition );
     4966  pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->copyTo( &m_acCUMvField2nd[1], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition );
     4967#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     4968  for( UInt ui = 0; ui < uiNumPartition; ui++ )
     4969  {
     4970    m_acCUMvField2nd[0].getMv( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 );
     4971    m_acCUMvField2nd[0].getMv( uiAbsPartIdxDst + ui ) >>= 2;
     4972
     4973    m_acCUMvField2nd[1].getMv( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 );
     4974    m_acCUMvField2nd[1].getMv( uiAbsPartIdxDst + ui ) >>= 2;
     4975
     4976    m_acCUMvField2nd[0].getMvd( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 );
     4977    m_acCUMvField2nd[0].getMvd( uiAbsPartIdxDst + ui ) >>= 2;
     4978
     4979    m_acCUMvField2nd[1].getMvd( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 );
     4980    m_acCUMvField2nd[1].getMvd( uiAbsPartIdxDst + ui ) >>= 2;
     4981  }
     4982#endif
     4983#endif
    48234984}
    48244985#endif
     
    48294990  riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 
    48304991}
     4992#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     4993Int TComDataCU::CuQpIncrementFunction(Pel uiBlockMax)
     4994{
     4995  if((uiBlockMax >> g_uiBitIncrement) >= 256 || (uiBlockMax >> g_uiBitIncrement) <0)
     4996  {
     4997    fprintf(stderr, "Bitincrement = %d, uiBlockMax = %d\n", g_uiBitIncrement, uiBlockMax);
     4998    exit(333);
     4999  }
     5000  Float fVal = (Float)((255 - (uiBlockMax >> g_uiBitIncrement)) >> 4);
     5001  fVal = (fVal * fVal);
     5002#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     5003  fVal = (Float)( fVal + getPic()->getTexDqpAccordingToDepthOffset() * 32); // add offset, if offset is negative than objects in front will have smaller QP than originaly - quality in front will be increased and in bacground will be decreased
     5004  fVal = (Float)( fVal * getPic()->getTexDqpAccordingToDepthMul()); //
     5005#else
     5006  fVal = (Float)( fVal + POZNAN_TEXTURE_TU_DELTA_QP_OFFSET * 32); // add offset, if offset is negative objects in front will have smaller QP than in original approach - quality in front will be increased and in bacground will be decreased
     5007  fVal = (Float)( fVal * POZNAN_TEXTURE_TU_DELTA_QP_MUL); //
     5008#endif
     5009  return (Int)fVal >> 5;
     5010}
     5011 Int  TComDataCU::getQpOffsetForTextCU(UInt uiPartIdx, Bool bIsIntra)
     5012 {
     5013   if(!getPic()->getSlice(0)->getSPS()->getUseTexDqpAccordingToDepth())
     5014   {
     5015     return 0;
     5016   }
     5017   if(this->getPic()->getSlice(0)->getSPS()->isDepth())
     5018   {
     5019     return 0;
     5020   }
     5021#if POZNAN_TEXTURE_TU_DELTA_QP_NOT_IN_BASE_VIEW
     5022   //if(!getPic()->getIsSideView())
     5023   if(this->getPic()->getViewIdx() == 0)
     5024   {
     5025     return 0;
     5026   }
     5027#endif
     5028   UInt iCuAddr = getAddr();
     5029   //TComPic * pcDepthPic = getPic()->getDepthPic();
     5030   TComPicYuv * pcDepthPicYUV = getPic()->getPicYuvSynthDepth();
     5031   if(pcDepthPicYUV /*pcDepthPic*/ == NULL)
     5032   {
     5033    char errortext[200];
     5034    sprintf(errortext, "depth map expected");
     5035    fprintf(stderr, "%s\n", errortext);
     5036    exit(123);
     5037   }
     5038   //TComDataCU* rpcCUDepth = pcDepthPic->getCU(iCuAddr);
     5039   Pel uiDepthLumaTransformBlockMax;
     5040   if(bIsIntra)
     5041   {
     5042     // in intra block CU each TU block has QP chosen separatly so dQP is calculated for TU
     5043     uiDepthLumaTransformBlockMax = getDepthLumaTransformBlockMax( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx );
     5044   }
     5045   else
     5046   {
     5047     // in inter block CU all TU block has the same QP so dQP is calculated for CU
     5048     uiDepthLumaTransformBlockMax = getDepthLumaCodingBlockMax( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx );
     5049   }
     5050#if POZNAN_NONLINEAR_DEPTH
     5051   TComNonlinearDepthBackward cNonlinearDepthBwd(getSlice()->getSPS()->getDepthPower(), g_uiBitIncrement, g_uiBitIncrement);
     5052   uiDepthLumaTransformBlockMax = (Pel)( cNonlinearDepthBwd(uiDepthLumaTransformBlockMax) + 0.5);
     5053#endif
     5054   Int iDeltaQP = CuQpIncrementFunction(uiDepthLumaTransformBlockMax);
     5055#if POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW
     5056   //Int iMaxCUHeight = this->getPic()->getPicSym()->getMaxCUHeight();
     5057   //Int iPicHeight   = this->getPic()->getPicSym()->getPicHeight();
     5058   Int iMaxCUHeight = this->getPic()->getPicYuvRec()->getMaxCuHeight();
     5059   Int iPicHeight   = this->getPic()->getPicYuvRec()->getHeight();
     5060   Int iLastPelYInFirstCURow = 0 + iMaxCUHeight;
     5061   Int iFirstPelYInLastCURow = iPicHeight - iMaxCUHeight;
     5062   Int iCUStartPelY = getCUPelY();
     5063   if((iCUStartPelY <= iLastPelYInFirstCURow) || (iCUStartPelY >= iFirstPelYInLastCURow))
     5064   {
     5065#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     5066     iDeltaQP += getPic()->getTexDqpAccordingToDepthTopBottomRow();// POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW;
     5067#else
     5068     iDeltaQP += POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_ROW_VAL;// POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW;
     5069#endif
     5070   }
     5071#endif
     5072   return iDeltaQP;
     5073 }
     5074
     5075Int cmpProc(const Void *arg1, const Void *arg2)
     5076{
     5077    return *((Pel*)arg2) - *((Pel*)arg1);
     5078}
     5079
     5080// Function gets median value of depth block that has the same size and position as texture block that calls this function
     5081Pel  TComDataCU::getDepthLumaCodingBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5082
     5083  static Pel pSortTable [64 * 64];
     5084  Int CUWidth, CUHeight;
     5085  sortDepthLumaCodingBlock( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, CUWidth, CUHeight );
     5086  return pSortTable[(CUHeight * CUWidth) / 2];
     5087}
     5088
     5089// Function gets maximal value of depth block that has the same size and position as texture block that calls this function
     5090Pel TComDataCU::getDepthLumaCodingBlockMax( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5091
     5092  return maxDepthLumaCodingBlock( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx); 
     5093}
     5094Void TComDataCU::sortDepthLumaCodingBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& CUWidth, Int& CUHeight )
     5095{
     5096  Int x, y;
     5097  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5098  // CU size:
     5099  CUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5100  CUWidth  = getWidth(uiPartIdx);
     5101  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5102  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5103  Int iNumBase4x4InBlock = (CUWidth >> 2) * (CUHeight >> 2);
     5104
     5105  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5106  // Address of block
     5107  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5108
     5109  Int p =0;
     5110  Int iStride  = getPic()->getPicYuvRec()->getStride();
     5111  for ( y = CUHeight - 1; y >= 0; y-- )
     5112  {
     5113    for ( x = CUWidth - 1; x >= 0; x-- )
     5114    {
     5115      pSortTable[p] = pPel[x]; ++p;
     5116    }
     5117    pPel += iStride;
     5118  }
     5119  // sort elements
     5120  qsort(pSortTable, CUHeight * CUWidth, sizeof(Pel), cmpProc);
     5121}
     5122
     5123Pel TComDataCU::maxDepthLumaCodingBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx)
     5124{
     5125  Int x, y;
     5126  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5127  // CU size:
     5128  Int CUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5129  Int CUWidth  = getWidth(uiPartIdx);
     5130  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5131  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5132  Int iNumBase4x4InBlock = (CUWidth >> 2) * (CUHeight >> 2);
     5133
     5134  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5135  // Address of block
     5136  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5137
     5138  Pel  pValue = 0;
     5139  Int  iStride = getPic()->getPicYuvRec()->getStride();
     5140  for ( y = CUHeight - 1; y >= 0; y-- )
     5141  {
     5142    for ( x = CUWidth - 1; x >= 0; x-- )
     5143    {
     5144      if (pPel[x]>pValue) pValue = pPel[x];
     5145    }
     5146    pPel += iStride;
     5147  }
     5148  return pValue;
     5149}
     5150
     5151// Function gets median value of depth block that has the same size and position as texture block that calls this function
     5152Pel  TComDataCU::getDepthLumaTransformBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5153
     5154  static Pel pSortTable [64 * 64];
     5155  Int TUWidth, TUHeight;
     5156  sortDepthLumaTransformBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, TUWidth, TUHeight );
     5157  return pSortTable[(TUHeight * TUWidth) / 2];
     5158}
     5159
     5160// Function gets maximal value of depth block that has the same size and position as texture block that calls this function
     5161Pel TComDataCU::getDepthLumaTransformBlockMax( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5162
     5163  return maxDepthLumaTransformBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx );
     5164}
     5165Void TComDataCU::sortDepthLumaTransformBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& TUWidth, Int& TUHeight )
     5166{
     5167  Int x, y;
     5168  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5169  // CU size:
     5170  TUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5171  TUWidth  = getWidth(uiPartIdx);
     5172  // correct CU size to trnsform size:
     5173  if( getTransformIdx(uiPartIdx) )
     5174  {
     5175    TUWidth  = TUWidth >> 1;
     5176    TUHeight = TUHeight >> 1;
     5177  }
     5178  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5179  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5180  Int iNumBase4x4InBlock = (TUWidth >> 2) * (TUHeight >> 2);
     5181
     5182  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5183  // Address of block
     5184  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5185
     5186  int p = 0;
     5187  Int  iStride  = getPic()->getPicYuvRec()->getStride();
     5188  for ( y = TUHeight - 1; y >= 0; y-- )
     5189  {
     5190    for ( x = TUWidth - 1; x >= 0; x-- )
     5191    {
     5192      pSortTable[p] = pPel[x];
     5193    }
     5194    pPel += iStride;
     5195  }
     5196  // sort elements
     5197  qsort(pSortTable, TUHeight * TUWidth, sizeof(Pel), cmpProc);
     5198}
     5199Pel TComDataCU::maxDepthLumaTransformBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx)
     5200{
     5201  Int x, y;
     5202  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5203  // CU size:
     5204  Int TUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5205  Int TUWidth  = getWidth(uiPartIdx);
     5206  // correct CU size to trnsform size:
     5207  if( getTransformIdx(uiPartIdx) )
     5208  {
     5209    TUWidth  = TUWidth >> 1;
     5210    TUHeight = TUHeight >> 1;
     5211  }
     5212  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5213  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5214  Int iNumBase4x4InBlock = (TUWidth >> 2) * (TUHeight >> 2);
     5215
     5216  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5217  // Address of block
     5218  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5219
     5220  Pel pValue = 0;
     5221  Int iStride  = getPic()->getPicYuvRec()->getStride();
     5222  for ( y = TUHeight - 1; y >= 0; y-- )
     5223  {
     5224    for ( x = TUWidth - 1; x >= 0; x-- )
     5225    {
     5226      if (pPel[x]>pValue) pValue = pPel[x];
     5227    }
     5228    pPel += iStride;
     5229  }
     5230  return pValue;
     5231}
     5232// Function gets median value of depth block that has the same size and position as texture block that calls this function
     5233Pel  TComDataCU::getDepthLumaPredictionBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5234
     5235  static Pel pSortTable [64 * 64];
     5236  Int PUWidth, PUHeight;
     5237  sortDepthLumaPredictionBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, PUWidth, PUHeight );
     5238  return pSortTable[(PUHeight * PUWidth) / 2];
     5239}
     5240
     5241// Function gets maximal value of depth block that has the same size and position as texture block that calls this function
     5242Pel  TComDataCU::getDepthLumaPredictionBlockMax( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5243
     5244  static Pel pSortTable [64 * 64];
     5245  Int PUWidth, PUHeight;
     5246  sortDepthLumaPredictionBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, PUWidth, PUHeight );
     5247  return pSortTable[0];
     5248}
     5249Void TComDataCU::sortDepthLumaPredictionBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& PUWidth, Int& PUHeight )
     5250{
     5251  Int x, y;
     5252  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5253  // CU size:
     5254  PUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5255  PUWidth  = getWidth(uiPartIdx);
     5256  // correct CU size to partition size:
     5257  if( getPartitionSize(uiPartIdx) == SIZE_Nx2N || getPartitionSize(uiPartIdx) == SIZE_NxN )
     5258  {
     5259    PUWidth = PUWidth >> 1;
     5260  }
     5261  if( getPartitionSize(uiPartIdx) == SIZE_2NxN || getPartitionSize(uiPartIdx) == SIZE_NxN )
     5262  {
     5263    PUHeight = PUHeight >> 1;
     5264  }
     5265 
     5266  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5267  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5268  Int iNumBase4x4InBlock = (PUWidth >> 2) * (PUHeight >> 2);
     5269  if(getPartitionSize(uiPartIdx) == SIZE_Nx2N)
     5270  {
     5271    iNumBase4x4InBlock = iNumBase4x4InBlock << 1; // KUBA if PU is Nx2N than to count start z-order idx we need to make such trick
     5272  }
     5273  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5274  // Address of block
     5275  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5276
     5277  UInt  uiStride  = getPic()->getPicYuvRec()->getStride();
     5278  for ( y = PUHeight - 1; y >= 0; y-- )
     5279  {
     5280    for ( x = PUWidth - 1; x >= 0; x-- )
     5281    {
     5282      pSortTable[y*PUWidth + x] = pPel[y*uiStride + x];
     5283    }
     5284  }
     5285  // sort elements
     5286  qsort(pSortTable, PUHeight * PUWidth, sizeof(Pel), cmpProc);
     5287}
     5288#endif
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComDataCU.h

    r5 r28  
    105105#endif//SNY_DQP
    106106 
     107#if POZNAN_DBMP_CALC_PRED_DATA
     108  TComCUMvField m_acCUMvField2nd[2];              ///< array of motion vectors selected for points with no MP prediction available
     109#endif
     110 
    107111  // -------------------------------------------------------------------------------------------------------------------
    108112  // neighbour access variables
     
    310314#endif
    311315 
     316#if POZNAN_DBMP_CALC_PRED_DATA
     317  TComCUMvField* getCUMvField2nd         ( RefPicList e )          { return  &m_acCUMvField2nd[e];  }
     318#endif
     319 
    312320  // -------------------------------------------------------------------------------------------------------------------
    313321  // member functions for coding tool information
     
    529537  Bool          isIntra   ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; }
    530538  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
     539#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     540  Bool          isCUSkiped( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_SYNTH; }
     541#endif
    531542 
    532543  // -------------------------------------------------------------------------------------------------------------------
     
    585596#endif //QC_MDCS
    586597
     598#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     599 Int            CuQpIncrementFunction  ( Pel uiBlockMax );
     600 Int            getQpOffsetForTextCU   ( UInt uiPartIdx, Bool bIsIntra );
     601 Pel            getDepthLumaCodingBlockMedian    ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     602 Pel            getDepthLumaCodingBlockMax       ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     603 Void           sortDepthLumaCodingBlock         ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& TUWidth, Int& TUHeight);
     604 Pel            maxDepthLumaCodingBlock          ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     605 Pel            getDepthLumaTransformBlockMedian ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     606 Pel            getDepthLumaTransformBlockMax    ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     607 Void           sortDepthLumaTransformBlock      ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx , Pel * pSortTable, Int& TUWidth, Int& TUHeight);
     608 Pel            maxDepthLumaTransformBlock       ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     609 Pel            getDepthLumaPredictionBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     610 Pel            getDepthLumaPredictionBlockMax   ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     611 Void           sortDepthLumaPredictionBlock     ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx , Pel * pSortTable, Int& PUWidth, Int& PUHeight);
     612#endif
    587613};
    588614
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComDepthMapGenerator.cpp

    r21 r28  
    985985    xInterPredictCUDepthMap( pcSubCU, pcSubDM );
    986986    break;
     987#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     988  case MODE_SYNTH:
     989    //What to do? Need Fix!
     990    xIntraPredictCUDepthMap( pcSubCU, pcSubDM );
     991    break;
     992#endif
    987993  default:
    988994    AOT( true );
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComLoopFilter.cpp

    r5 r28  
    444444 
    445445  //-- Set BS for Intra MB : BS = 4 or 3
    446   if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ) )
     446  if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ)
     447#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     448     || pcCUP->isCUSkiped(uiPartP) || pcCUQ->isCUSkiped(uiPartQ)
     449#endif
     450  )
    447451  {
    448452    uiBs = bAtCUBoundary ? 4 : 3;   // Intra MB && MB boundary
     
    450454 
    451455  //-- Set BS for not Intra MB : BS = 2 or 1 or 0
    452   if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ) )
     456  if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ)
     457#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     458     && !pcCUP->isCUSkiped(uiPartP) && !pcCUQ->isCUSkiped(uiPartQ)
     459#endif
     460  )
    453461  {
    454462    if ( pcCUQ->getCbf( uiPartQ, TEXT_LUMA, pcCUQ->getTransformIdx(uiPartQ)) != 0 || pcCUP->getCbf( uiPartP, TEXT_LUMA, pcCUP->getTransformIdx(uiPartP) ) != 0)
     
    528536  }   // enf of "if( not Intra )"
    529537 
     538#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU //if one of the block is CUSkipped dont use loop filter
     539  if ( pcCUP->isCUSkiped(uiPartP) || pcCUQ->isCUSkiped(uiPartQ))
     540  {
     541    uiBs = 0;
     542  }
     543#endif
     544
    530545  m_aapucBS[iDir][0][uiAbsPartIdx] = uiBs;
    531546  if ( bAtCUBoundary || bAtCUHalf )
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPic.cpp

    r21 r28  
    5050  m_apcPicYuv[0]      = NULL;
    5151  m_apcPicYuv[1]      = NULL;
     52#if POZNAN_AVAIL_MAP
     53  m_apcPicYuvAvail     = NULL;
     54#endif
     55#if POZNAN_SYNTH_VIEW
     56  m_apcPicYuvSynth     = NULL;
     57#endif
     58#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     59  m_apcPicYuvSynthDepth= NULL;
     60#endif
    5261#if DEPTH_MAP_GENERATION
    5362  m_pcPredDepthMap    = NULL;
     
    118127    m_apcPicYuv[1]  = NULL;
    119128  }
     129#if POZNAN_AVAIL_MAP
     130  if (m_apcPicYuvAvail)
     131  {
     132    m_apcPicYuvAvail->destroy();
     133    delete m_apcPicYuvAvail;
     134    m_apcPicYuvAvail  = NULL;
     135  }
     136#endif
     137
     138#if POZNAN_SYNTH_VIEW
     139  if (m_apcPicYuvSynth)
     140  {
     141    m_apcPicYuvSynth->destroy();
     142    delete m_apcPicYuvSynth;
     143    m_apcPicYuvSynth  = NULL;
     144  }
     145#endif
     146#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     147  if (m_apcPicYuvSynthDepth)
     148  {
     149    m_apcPicYuvSynthDepth->destroy();
     150    delete m_apcPicYuvSynthDepth;
     151    m_apcPicYuvSynthDepth  = NULL;
     152  }
     153#endif
    120154 
    121155#if DEPTH_MAP_GENERATION
     
    195229}
    196230
     231#if POZNAN_AVAIL_MAP
     232Void
     233TComPic::addAvailabilityBuffer()
     234{
     235  AOT( m_apcPicYuvAvail );
     236  AOF( m_apcPicYuv[1] );
     237  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
     238  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
     239  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
     240  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
     241  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
     242  m_apcPicYuvAvail      = new TComPicYuv;
     243  m_apcPicYuvAvail      ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
     244}
     245#endif
     246
     247#if POZNAN_SYNTH_VIEW
     248Void
     249TComPic::addSynthesisBuffer()
     250{
     251  AOT( m_apcPicYuvSynth );
     252  AOF( m_apcPicYuv[1] );
     253  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
     254  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
     255  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
     256  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
     257  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
     258  m_apcPicYuvSynth      = new TComPicYuv;
     259  m_apcPicYuvSynth      ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
     260}
     261#endif
     262
     263#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     264Void
     265TComPic::addSynthesisDepthBuffer()
     266{
     267  AOT( m_apcPicYuvSynthDepth );
     268  AOF( m_apcPicYuv[1] );
     269  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
     270  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
     271  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
     272  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
     273  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
     274  m_apcPicYuvSynthDepth      = new TComPicYuv;
     275  m_apcPicYuvSynthDepth      ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
     276}
     277#endif
     278
    197279#if PARALLEL_MERGED_DEBLK
    198280Void
     
    286368}
    287369
     370#if POZNAN_AVAIL_MAP
     371Void
     372TComPic::removeAvailabilityBuffer()
     373{
     374  if( m_apcPicYuvAvail )
     375  {
     376    m_apcPicYuvAvail->destroy();
     377    delete m_apcPicYuvAvail;
     378    m_apcPicYuvAvail  = NULL;
     379  }
     380}
     381#endif
     382
     383#if POZNAN_SYNTH_VIEW
     384Void
     385TComPic::removeSynthesisBuffer()
     386{
     387  if( m_apcPicYuvSynth )
     388  {
     389    m_apcPicYuvSynth->destroy();
     390    delete m_apcPicYuvSynth;
     391    m_apcPicYuvSynth  = NULL;
     392  }
     393}
     394#endif
     395
     396#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     397Void
     398TComPic::removeSynthesisDepthBuffer()
     399{
     400  if( m_apcPicYuvSynthDepth )
     401  {
     402    m_apcPicYuvSynthDepth->destroy();
     403    delete m_apcPicYuvSynthDepth;
     404    m_apcPicYuvSynthDepth  = NULL;
     405  }
     406}
     407#endif
     408
    288409#if PARALLEL_MERGED_DEBLK
    289410Void
     
    351472#endif
    352473
     474#if POZNAN_AVAIL_MAP
     475Void TComPic::checkSynthesisAvailability( TComDataCU*& rpcCU, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, Bool *&rpbCUSynthesied )
     476{
     477  rpbCUSynthesied[0] = true;
     478  rpbCUSynthesied[1] = true;
     479  rpbCUSynthesied[2] = true;
     480  rpbCUSynthesied[3] = true;
     481
     482  if (!getPicYuvAvail())
     483  {
     484    rpbCUSynthesied[0] = false;
     485    rpbCUSynthesied[1] = false;
     486    rpbCUSynthesied[2] = false;
     487    rpbCUSynthesied[3] = false;
     488    return;   
     489  }
     490 
     491  Int x, y;
     492  Bool bAvailable = true;
     493  Pel* pAvail  = getPicYuvAvail()->getLumaAddr ( iCuAddr, uiAbsZorderIdx );
     494  Int CUHeight = g_uiMaxCUHeight >> uiPartDepth; //rpcCU->getHeight(uiAbsZorderIdx);
     495  Int CUWidth  = g_uiMaxCUWidth  >> uiPartDepth; //rpcCU->getWidth(uiAbsZorderIdx);
     496 
     497  Int  iStride  = getPicYuvAvail()->getStride();
     498  for ( y = ((CUHeight - 1) >> 1); y >= 0; y-- )
     499  {
     500    for ( x = ((CUWidth - 1) >> 1); x >= 0; x-- )
     501    {
     502      rpbCUSynthesied[0] &= (pAvail[x] != 0);
     503    }
     504    for ( x = CUWidth - 1; x >= ((CUWidth) >> 1); x-- )
     505    {
     506      rpbCUSynthesied[1] &= (pAvail[x] != 0);
     507    }
     508    pAvail += iStride;
     509  }
     510  //for ( y = CUHeight - 1; y >= ((CUHeight) >> 1); y-- )
     511  for ( y = ((CUHeight - 1) >> 1); y >= 0; y-- ) //Owieczka
     512  {
     513    for ( x = ((CUWidth - 1) >> 1); x >= 0; x-- )
     514    {
     515      rpbCUSynthesied[2] &= (pAvail[x] != 0);
     516    }
     517    for ( x = CUWidth - 1; x >= ((CUWidth) >> 1); x-- )
     518    {
     519      rpbCUSynthesied[3] &= (pAvail[x] != 0);
     520    }
     521    pAvail += iStride;
     522  }
     523
     524  //rpbCUSynthesied[0] = !rpbCUSynthesied[0];
     525  //rpbCUSynthesied[1] = !rpbCUSynthesied[1];
     526  //rpbCUSynthesied[2] = !rpbCUSynthesied[2];
     527  //rpbCUSynthesied[3] = !rpbCUSynthesied[3];
     528}
     529#endif
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPic.h

    r21 r28  
    6161
    6262  TComPicYuv*           m_apcPicYuv[2];           //  Texture,  0:org / 1:rec
     63
     64#if POZNAN_AVAIL_MAP
     65  TComPicYuv*           m_apcPicYuvAvail;         //  Availability Map - Does the given pixel can be synthesised in receiver
     66#endif
     67
     68#if POZNAN_SYNTH_VIEW
     69  TComPicYuv*           m_apcPicYuvSynth;         //  Sythesied image
     70#endif
     71#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     72  TComPicYuv*           m_apcPicYuvSynthDepth;         //  Sythesied depth image
     73#endif
     74
    6375#if DEPTH_MAP_GENERATION
    6476  TComPicYuv*           m_pcPredDepthMap;         //  estimated depth map
     
    101113#if HHI_INTERVIEW_SKIP
    102114  TComPicYuv*           m_pcUsedPelsMap;
     115#endif
     116#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     117  Double                m_dTexDqpAccordingToDepthOffset;
     118  Double                m_dTexDqpAccordingToDepthMul;
     119  Int                   m_iTexDqpAccordingToDepthTopBottomRow;
    103120#endif
    104121
     
    129146  TComPicYuv*   getPicYuvOrg()        { return  m_apcPicYuv[0]; }
    130147  TComPicYuv*   getPicYuvRec()        { return  m_apcPicYuv[1]; }
     148
     149#if POZNAN_AVAIL_MAP
     150  TComPicYuv*   getPicYuvAvail()      { return  m_apcPicYuvAvail; } //Owieczka - returns available map from other pic image
     151#endif
     152
     153#if POZNAN_SYNTH_VIEW
     154  TComPicYuv*   getPicYuvSynth()      { return  m_apcPicYuvSynth; } //Owieczka - returns synth form other pic in image
     155#endif
     156#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     157  TComPicYuv*   getPicYuvSynthDepth() { return  m_apcPicYuvSynthDepth; };    //  Sythesied depth image
     158#endif
    131159
    132160#if DEPTH_MAP_GENERATION
     
    203231
    204232  Void          addOriginalBuffer       ();
     233#if POZNAN_AVAIL_MAP
     234  Void          addAvailabilityBuffer   ();
     235#endif
     236#if POZNAN_SYNTH_VIEW
     237  Void          addSynthesisBuffer      ();
     238#endif
     239#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     240  Void          addSynthesisDepthBuffer ();
     241#endif
    205242#if PARALLEL_MERGED_DEBLK
    206243  Void          addDeblockBuffer        ();
     
    221258
    222259  Void          removeOriginalBuffer    ();
     260#if POZNAN_SYNTH_VIEW
     261  Void          removeSynthesisBuffer   ();
     262#endif
     263#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     264  Void          removeSynthesisDepthBuffer ();
     265#endif
     266#if POZNAN_AVAIL_MAP
     267  Void          removeAvailabilityBuffer();
     268#endif
    223269#if PARALLEL_MERGED_DEBLK
    224270  Void          removeDeblockBuffer     ();
     
    235281#if HHI_INTERVIEW_SKIP
    236282  Void          removeUsedPelsMapBuffer ();
     283#endif
     284
     285#if POZNAN_AVAIL_MAP
     286  Void          checkSynthesisAvailability(  TComDataCU*& rpcBestCU, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, Bool *&rpbCUSynthesied);
    237287#endif
    238288
     
    254304  const SEImessages* getSEIs() const { return m_SEIs; }
    255305
     306#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     307  Double getTexDqpAccordingToDepthOffset( )      { return m_dTexDqpAccordingToDepthOffset;}
     308  Double getTexDqpAccordingToDepthMul( )         { return m_dTexDqpAccordingToDepthMul;}
     309  Int    getTexDqpAccordingToDepthTopBottomRow( ){ return m_iTexDqpAccordingToDepthTopBottomRow;}
     310  Void   setTexDqpAccordingToDepthOffset      ( Double dTexDqpAccordingToDepthOffset    ){ m_dTextureCuDeltaQpOffset       = dTexDqpAccordingToDepthOffset; }
     311  Void   setTexDqpAccordingToDepthMul         ( Double dTexDqpAccordingToDepthMul       ){ m_dTexDqpAccordingToDepthMul          = dTexDqpAccordingToDepthMul; }
     312  Void   setTexDqpAccordingToDepthTopBottomRow( Int iTexDqpAccordingToDepthTopBottomRow ){ m_iTexDqpAccordingToDepthTopBottomRow = iTexDqpAccordingToDepthTopBottomRow; } 
     313#endif
    256314};// END CLASS DEFINITION TComPic
    257315
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicSym.h

    r5 r28  
    4343
    4444// Include files
     45#if POZNAN_MP
     46#include "../TLibCommon/TComMP.h"
     47#endif
     48
    4549#include "CommonDef.h"
    4650#include "TComSlice.h"
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicYuv.cpp

    r17 r28  
    88#include <assert.h>
    99#include <memory.h>
     10#include <math.h>
    1011
    1112#ifdef __APPLE__
     
    455456  }
    456457}
     458#if POZNAN_NONLINEAR_DEPTH
     459Void TComPicYuv::nonlinearDepthForward(TComPicYuv *pcPicDst, Float p)
     460{
     461  Int           x,y;
     462  TComNonlinearDepthForward cNonlinearDepthFwd(p, g_uiBitIncrement, g_uiBitIncrement);
     463
     464  // Luma
     465  Pel* pPelSrc = getLumaAddr();
     466  Pel* pPelDst = pcPicDst->getLumaAddr();
     467  for(y=0; y<m_iPicHeight; y++)
     468        {
     469    for(x=0; x<m_iPicWidth; x++)
     470    {
     471      pPelDst[x] = (Pel)( cNonlinearDepthFwd(pPelSrc[x]) + 0.5);
     472    }
     473    pPelDst += pcPicDst->getStride();
     474    pPelSrc += getStride();
     475  }
     476  // Chroma
     477  copyToPicCb(pcPicDst);
     478  copyToPicCr(pcPicDst);
     479}
     480Void TComPicYuv::nonlinearDepthBackward(TComPicYuv *pcPicDst, Float p)
     481{
     482  Int           x,y;
     483  TComNonlinearDepthBackward cNonlinearDepthBwd(p, g_uiBitIncrement, g_uiBitIncrement);
     484
     485  // Luma
     486  Pel* pPelSrc = getLumaAddr();
     487  Pel* pPelDst = pcPicDst->getLumaAddr();
     488  for(y=0; y<m_iPicHeight; y++)
     489        {
     490    for(x=0; x<m_iPicWidth; x++)
     491    {
     492      pPelDst[x] = (Pel)( cNonlinearDepthBwd(pPelSrc[x]) + 0.5);
     493    }
     494    pPelDst += pcPicDst->getStride();
     495    pPelSrc += getStride();
     496  }
     497  // Chroma
     498  copyToPicCb(pcPicDst);
     499  copyToPicCr(pcPicDst);
     500}
     501#endif
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicYuv.h

    r5 r28  
    4444#include "CommonDef.h"
    4545
     46#if POZNAN_NONLINEAR_DEPTH
     47
     48#include <math.h>
     49
     50class TComNonlinearDepthForward // OLGIERD - Z-NL-Power conversion
     51{
     52private:
     53  Double m_fMul;
     54  Float m_fPower;
     55
     56public:
     57
     58  TComNonlinearDepthForward(Float fPower, Int iInputBitIncrement, Int iOutputBitIncrement)
     59  {
     60    m_fPower = fPower;
     61    Double fPostMul = (1<<(8+iOutputBitIncrement))-1; // OLGIERD ToDo - should be or not?
     62    Double fPreMul  = 1.0/((1<<(8+iInputBitIncrement))-1);
     63    m_fMul = fPostMul*pow(fPreMul,(Double)fPower);
     64  };
     65
     66  inline Double operator() (Double Value)
     67  {   
     68    if (Value<0) return -pow( -Value,(Double)m_fPower)*m_fMul;
     69    return pow(Value,(Double)m_fPower)*m_fMul;
     70  };
     71};
     72
     73class TComNonlinearDepthBackward // OLGIERD - Z-NL-Power conversion
     74{
     75private:
     76  Double m_fMul;
     77  Float m_fPower;
     78
     79public:
     80
     81  TComNonlinearDepthBackward(Float fPower, Int iInputBitIncrement, Int iOutputBitIncrement)
     82  {     
     83    m_fPower = fPower = 1.0/fPower;
     84    Double fPostMul = (1<<(8+iOutputBitIncrement))-1; // OLGIERD ToDo - should be or not?
     85    Double fPreMul  = 1.0/((1<<(8+iInputBitIncrement))-1);
     86    m_fMul = fPostMul*pow(fPreMul,(Double)fPower);
     87  };
     88
     89  inline Double operator() (Double Value)
     90  {   
     91    if (Value<0) return -pow( -Value,(Double)m_fPower)*m_fMul;
     92    return pow(Value,(Double)m_fPower)*m_fMul;
     93  };
     94};
     95#endif
    4696// ====================================================================================================================
    4797// Class definition
     
    175225  Void  setChromaTo  ( Pel pVal ); 
    176226
     227#if POZNAN_NONLINEAR_DEPTH
     228  Void nonlinearDepthForward(TComPicYuv *pcPicDst, Float p);
     229  Void nonlinearDepthBackward(TComPicYuv *pcPicDst, Float p);
     230#endif
    177231};// END CLASS DEFINITION TComPicYuv
    178232
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPrediction.cpp

    r21 r28  
    15211521    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
    15221522
     1523#if POZNAN_DBMP
     1524        if(pcCU->getMergeIndex(uiPartAddr)==POZNAN_DBMP_MRG_CAND)
     1525        {
     1526#if DEPTH_MAP_GENERATION
     1527                motionCompensation_DBMP( pcCU, pcYuvPred, eRefPicList, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     1528#else
     1529                motionCompensation_DBMP( pcCU, pcYuvPred, eRefPicList, iPartIdx );
     1530#endif
     1531                return;
     1532        }
     1533#endif
     1534
    15231535#if DEPTH_MAP_GENERATION
    15241536    if( bPrdDepthMap )
     
    15581570    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
    15591571
     1572#if POZNAN_DBMP
     1573        if(pcCU->getMergeIndex(uiPartAddr)==POZNAN_DBMP_MRG_CAND)
     1574        {
     1575#if DEPTH_MAP_GENERATION
     1576                motionCompensation_DBMP( pcCU, pcYuvPred, eRefPicList, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     1577#else
     1578                motionCompensation_DBMP( pcCU, pcYuvPred, eRefPicList, iPartIdx );
     1579#endif
     1580                continue;
     1581        }
     1582#endif
     1583
    15601584#if DEPTH_MAP_GENERATION
    15611585    if( bPrdDepthMap )
     
    15911615  return;
    15921616}
     1617
     1618#if POZNAN_DBMP
     1619#if DEPTH_MAP_GENERATION
     1620Void TComPrediction::motionCompensation_DBMP ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
     1621#else
     1622Void TComPrediction::motionCompensation_DBMP ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx )
     1623#endif
     1624{
     1625  if(!pcCU->getSlice()->getMP()->isDBMPEnabled()) return;
     1626
     1627  Int         iPartIdxOrg = iPartIdx;
     1628  Int         iWidth;
     1629  Int         iHeight;
     1630  UInt        uiPartAddr;
     1631
     1632  Int             x,y;
     1633  Int             px,py,iCUBaseX,iCUBaseY;
     1634  Int             ref_frame0, ref_frame1;
     1635  Int             ref_frame0_idx, ref_frame1_idx;
     1636  TComMv          mv0,mv1;
     1637 
     1638  Int             ref_frame0_idx_2nd, ref_frame1_idx_2nd;
     1639  TComMv          mv0_2nd,mv1_2nd;
     1640
     1641  Pel* piDstCb;
     1642  Pel* piDstCr;
     1643  Pel aiUTab[MAX_CU_SIZE];
     1644  Pel aiVTab[MAX_CU_SIZE];
     1645  Pel iULast;
     1646  Pel iVLast;
     1647  Pel iTemp;
     1648
     1649  TComMP* pcMP = pcCU->getSlice()->getMP();
     1650  UInt uiViewId = pcCU->getSlice()->getSPS()->getViewId();
     1651  Bool bIsDepth = pcCU->getSlice()->getSPS()->isDepth();
     1652
     1653#if POZNAN_DBMP_CALC_PRED_DATA
     1654  UInt uiPointCnt;
     1655#endif
     1656   
     1657  for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartInter(); iPartIdx++ )
     1658  {
     1659        if ( iPartIdxOrg >= 0 ) iPartIdx = iPartIdxOrg;
     1660
     1661    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
     1662
     1663        //get motion data used for no-MP predicted points
     1664#if POZNAN_DBMP_CALC_PRED_DATA
     1665        ref_frame0_idx_2nd = pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getRefIdx(uiPartAddr);
     1666        mv0_2nd = pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     1667
     1668        ref_frame1_idx_2nd = pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getRefIdx(uiPartAddr);
     1669        mv1_2nd = pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->getMv( uiPartAddr );
     1670#else
     1671        ref_frame0_idx_2nd = pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr);
     1672        mv0_2nd = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     1673
     1674        ref_frame1_idx_2nd = pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr);
     1675        mv1_2nd = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr );
     1676#endif
     1677
     1678        iCUBaseX = pcCU->getCUPelX()+g_auiRasterToPelX[ g_auiZscanToRaster[uiPartAddr] ];
     1679        iCUBaseY = pcCU->getCUPelY()+g_auiRasterToPelY[ g_auiZscanToRaster[uiPartAddr] ];
     1680
     1681#if DEPTH_MAP_GENERATION
     1682    if( bPrdDepthMap )
     1683    {
     1684      iWidth  >>= uiSubSampExpX;
     1685      iHeight >>= uiSubSampExpY;
     1686    }
     1687#endif
     1688
     1689#if POZNAN_DBMP_CALC_PRED_DATA
     1690        uiPointCnt = 0;
     1691#endif
     1692
     1693        for( py = 0; py < iHeight; py++)
     1694        {
     1695                for( px = 0; px < iWidth; px++)
     1696                {
     1697#if DEPTH_MAP_GENERATION
     1698                        if( bPrdDepthMap )
     1699                        {
     1700                                x = iCUBaseX+(px<<uiSubSampExpX);
     1701                                y = iCUBaseY+(py<<uiSubSampExpY);
     1702                        }
     1703                        else
     1704#endif
     1705                        {
     1706                                x = iCUBaseX+px;
     1707                                y = iCUBaseY+py;
     1708                        }
     1709
     1710                        pcMP->getDBMPPredData(pcCU, x, y, ref_frame0, ref_frame0_idx, mv0, ref_frame0_idx_2nd, mv0_2nd,
     1711                                                                                ref_frame1, ref_frame1_idx, mv1, ref_frame1_idx_2nd, mv1_2nd);
     1712
     1713                        pcCU->getCUMvField(REF_PIC_LIST_0)->setRefIdx(ref_frame0_idx, uiPartAddr);
     1714                        pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv0, uiPartAddr );
     1715
     1716                        pcCU->getCUMvField(REF_PIC_LIST_1)->setRefIdx(ref_frame1_idx, uiPartAddr);
     1717                        pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv1, uiPartAddr );
     1718
     1719                        if ( eRefPicList != REF_PIC_LIST_X )
     1720                        {
     1721#if DEPTH_MAP_GENERATION
     1722                          xPredInterUni_DBMP (pcCU, uiPartAddr, px, py, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     1723#else
     1724                          xPredInterUni_DBMP (pcCU, uiPartAddr, px, py, eRefPicList, pcYuvPred, iPartIdx );
     1725#endif
     1726#ifdef WEIGHT_PRED
     1727                          if ( pcCU->getSlice()->getPPS()->getUseWP() )
     1728                          {
     1729                            xWeightedPredictionUni_DBMP( pcCU, pcYuvPred, uiPartAddr, px, py, eRefPicList, pcYuvPred, iPartIdx );
     1730                          }
     1731#endif
     1732                        }
     1733                        else
     1734                        {
     1735#if DEPTH_MAP_GENERATION
     1736                          xPredInterBi_DBMP  (pcCU, uiPartAddr, px, py, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     1737#else
     1738                          xPredInterBi_DBMP  (pcCU, uiPartAddr, px, py, pcYuvPred, iPartIdx );
     1739#endif
     1740                        }                       
     1741
     1742                        if(!pcCU->getSlice()->getSPS()->isDepth()) // Chroma check only for non depth
     1743                        {
     1744                        piDstCb = pcYuvPred->getCbAddr( uiPartAddr ) + (py>>1)*pcYuvPred->getCStride();
     1745                        piDstCr = pcYuvPred->getCrAddr( uiPartAddr ) + (py>>1)*pcYuvPred->getCStride();
     1746
     1747                        //Chroma decimation 16x16 -> 8x8:
     1748                        if(py%2 && px%2)
     1749                        {
     1750                                iTemp = (aiUTab[px-1] + aiUTab[px] + iULast + piDstCb[px>>1] + 2)>>2;
     1751                                aiUTab[px-1] = iULast;
     1752                                iULast = piDstCb[px>>1];
     1753                                piDstCb[px>>1] = iTemp;
     1754
     1755                                iTemp = (aiVTab[px-1] + aiVTab[px] + iVLast + piDstCr[px>>1] + 2)>>2;
     1756                                aiVTab[px-1] = iVLast;
     1757                                iVLast = piDstCr[px>>1];
     1758                                piDstCr[px>>1] = iTemp;
     1759                        }
     1760                        else
     1761                        {
     1762                                aiUTab[(px==0)? iWidth-1 : (px-1)] = iULast;   
     1763                                iULast = piDstCb[px>>1];
     1764
     1765                                aiVTab[(px==0)? iWidth-1 : (px-1)] = iVLast;                           
     1766                                iVLast = piDstCr[px>>1];
     1767                        }       
     1768                        }
     1769
     1770#if !POZNAN_DBMP_COMPRESS_ME_DATA
     1771                        //save motion data for every CU point
     1772#if DEPTH_MAP_GENERATION
     1773                        if( !bPrdDepthMap )
     1774#endif
     1775                        {
     1776                                pcMP->setL0RefPOC(uiViewId,bIsDepth,x,y,ref_frame0);
     1777                                pcMP->setL0MvX(uiViewId,bIsDepth,x,y,mv0.getHor());
     1778                                pcMP->setL0MvY(uiViewId,bIsDepth,x,y,mv0.getVer());
     1779
     1780                                pcMP->setL1RefPOC(uiViewId,bIsDepth,x,y,ref_frame1);
     1781                                pcMP->setL1MvX(uiViewId,bIsDepth,x,y,mv1.getHor());
     1782                                pcMP->setL1MvY(uiViewId,bIsDepth,x,y,mv1.getVer());
     1783                        }
     1784#endif
     1785
     1786#if POZNAN_DBMP_CALC_PRED_DATA
     1787#if DEPTH_MAP_GENERATION
     1788                        if( !bPrdDepthMap )
     1789#endif
     1790                        {
     1791                                pcMP->getTempL0RefIdx()[uiPointCnt] = ref_frame0_idx;
     1792                                pcMP->getTempL0MvX()[uiPointCnt] = mv0.getHor();
     1793                                pcMP->getTempL0MvY()[uiPointCnt] = mv0.getVer();
     1794
     1795                                pcMP->getTempL1RefIdx()[uiPointCnt] = ref_frame1_idx;
     1796                                pcMP->getTempL1MvX()[uiPointCnt] = mv1.getHor();
     1797                                pcMP->getTempL1MvY()[uiPointCnt] = mv1.getVer();                       
     1798                        }
     1799                        uiPointCnt++;
     1800#endif
     1801
     1802                }
     1803        }
     1804
     1805        //set motion data representing CU with DBMP
     1806#if DEPTH_MAP_GENERATION
     1807        if( !bPrdDepthMap )
     1808#endif
     1809        {
     1810                PartSize ePartSize = pcCU->getPartitionSize( uiPartAddr ); //PartSize ePartSize = pcCU->getPartitionSize( 0 );
     1811#if POZNAN_DBMP_CALC_PRED_DATA
     1812                pcMP->xCalcDBMPPredData(uiPointCnt, ref_frame0_idx, mv0, ref_frame1_idx, mv1);
     1813               
     1814                pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( mv0, ref_frame0_idx, ePartSize, uiPartAddr, iPartIdx, 0 );         
     1815                pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( mv1, ref_frame1_idx, ePartSize, uiPartAddr, iPartIdx, 0 );
     1816#else
     1817                pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( mv0_2nd, ref_frame0_idx_2nd, ePartSize, uiPartAddr, iPartIdx, 0 );
     1818                pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( mv1_2nd, ref_frame1_idx_2nd, ePartSize, uiPartAddr, iPartIdx, 0 );
     1819#endif
     1820        }
     1821
     1822        if ( iPartIdxOrg >= 0 ) break;
     1823  }
     1824  return;
     1825}
     1826#endif
    15931827
    15941828#if HIGH_ACCURACY_BI
     
    21352369}
    21362370
     2371
     2372
     2373#if POZNAN_DBMP
     2374
     2375#if HIGH_ACCURACY_BI
     2376#if DEPTH_MAP_GENERATION
     2377Void TComPrediction::xPredInterUni_DBMP ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi )
     2378#else
     2379Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi )
     2380#endif
     2381#else
     2382#if DEPTH_MAP_GENERATION
     2383Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
     2384#else
     2385Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx )
     2386#endif
     2387#endif
     2388{
     2389  Int         iRefIdx     = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           assert (iRefIdx >= 0);
     2390  TComMv      cMv         = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     2391  pcCU->clipMv(cMv);
     2392
     2393#if DEPTH_MAP_GENERATION
     2394  if( bPrdDepthMap )
     2395  {
     2396        UInt uiRShift = 0;
     2397        xPredInterPrdDepthMap_DBMP( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMap(), uiPartAddr, &cMv, iPosX, iPosY, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift );
     2398    return;
     2399  }
     2400#endif
     2401
     2402#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     2403  if( pcCU->getSlice()->getSPS()->isDepth() )
     2404  {
     2405#if HIGH_ACCURACY_BI
     2406    UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 );
     2407#else
     2408    UInt uiRShift = 0;
     2409#endif
     2410#if DEPTH_MAP_GENERATION
     2411    xPredInterPrdDepthMap_DBMP( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, 0, 0, rpcYuvPred, uiRShift );
     2412#else
     2413    xPredInterPrdDepthMap_DBMP( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred, uiRShift );
     2414#endif
     2415  }
     2416  else
     2417  {
     2418#endif
     2419#if HIGH_ACCURACY_BI
     2420  if(!bi)
     2421  {
     2422    xPredInterLumaBlk_DBMP ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2423  }
     2424  else
     2425  {
     2426    xPredInterLumaBlk_DBMP_ha  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2427  }
     2428#else
     2429  xPredInterLumaBlk_DBMP       ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2430#endif
     2431#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     2432  }
     2433#endif
     2434
     2435#if HIGH_ACCURACY_BI
     2436  if (!bi)
     2437  {
     2438        xPredInterChromaBlk_DBMP     ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2439  }
     2440  else
     2441  {
     2442        xPredInterChromaBlk_DBMP_ha ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec()    , uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2443  }
     2444#else
     2445  xPredInterChromaBlk_DBMP     ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2446#endif
     2447}
     2448
     2449#if DEPTH_MAP_GENERATION
     2450Void TComPrediction::xPredInterBi_DBMP ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
     2451#else
     2452Void TComPrediction::xPredInterBi_DBMP ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, TComYuv*& rpcYuvPred, Int iPartIdx )
     2453#endif
     2454{
     2455  TComYuv* pcMbYuv;
     2456  Int      iRefIdx[2] = {-1, -1};
     2457
     2458  for ( Int iRefList = 0; iRefList < 2; iRefList++ )
     2459  {
     2460    RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
     2461    iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
     2462
     2463    if ( iRefIdx[iRefList] < 0 )
     2464    {
     2465      continue;
     2466    }
     2467
     2468    assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) );
     2469
     2470    pcMbYuv = &m_acYuvPred[iRefList];
     2471#if HIGH_ACCURACY_BI
     2472    if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 )
     2473#if DEPTH_MAP_GENERATION
     2474      xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     2475#else
     2476      xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, true );
     2477#endif
     2478    else
     2479#if DEPTH_MAP_GENERATION
     2480      xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     2481#else
     2482      xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx );
     2483#endif
     2484#else
     2485#if DEPTH_MAP_GENERATION
     2486    xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     2487#else
     2488    xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx );
     2489#endif
     2490#endif
     2491  }
     2492
     2493#ifdef WEIGHT_PRED
     2494  if ( pcCU->getSlice()->getPPS()->getWPBiPredIdc() )
     2495  {
     2496    xWeightedPredictionBi_DBMP( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred );
     2497  }
     2498  else
     2499#endif
     2500
     2501#if DEPTH_MAP_GENERATION
     2502  if ( bPrdDepthMap )
     2503  {
     2504    xWeightedAveragePdm_DBMP( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred, uiSubSampExpX, uiSubSampExpY );
     2505  }
     2506  else
     2507  {
     2508    xWeightedAverage_DBMP( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred );
     2509  }
     2510#else
     2511  xWeightedAverage_DBMP( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred );
     2512#endif
     2513}
     2514
     2515Void
     2516#if DEPTH_MAP_GENERATION
     2517TComPrediction::xPredInterPrdDepthMap_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift )
     2518#else
     2519TComPrediction::xPredInterPrdDepthMap_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv, UInt uiRShift )
     2520#endif
     2521{
     2522#if DEPTH_MAP_GENERATION
     2523  Int     iShiftX     = 2 + uiSubSampExpX;
     2524  Int     iShiftY     = 2 + uiSubSampExpY;
     2525  Int     iAddX       = ( 1 << iShiftX ) >> 1;
     2526  Int     iAddY       = ( 1 << iShiftY ) >> 1;
     2527  Int     iHor        = ( pcMv->getHor() + iAddX ) >> iShiftX;
     2528  Int     iVer        = ( pcMv->getVer() + iAddY ) >> iShiftY;
     2529#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     2530  if( pcCU->getSlice()->getSPS()->isDepth() )
     2531  {
     2532    iHor = pcMv->getHor();
     2533    iVer = pcMv->getVer();
     2534  }
     2535#endif
     2536  Int     iRefStride  = pcPicYuvRef->getStride();
     2537  Int     iDstStride  = rpcYuv->getStride();
     2538  Int     iRefOffset  = iHor + iVer * iRefStride;
     2539#else
     2540  Int     iFPelMask   = ~3;
     2541  Int     iRefStride  = pcPicYuvRef->getStride();
     2542  Int     iDstStride  = rpcYuv->getStride();
     2543  Int     iHor        = ( pcMv->getHor() + 2 ) & iFPelMask;
     2544  Int     iVer        = ( pcMv->getVer() + 2 ) & iFPelMask;
     2545#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     2546  if( pcCU->getSlice()->getSPS()->isDepth() )
     2547  {
     2548    iHor = pcMv->getHor() * 4;
     2549    iVer = pcMv->getVer() * 4;
     2550  }
     2551#endif
     2552  Int     ixFrac      = iHor & 0x3;
     2553  Int     iyFrac      = iVer & 0x3;
     2554  Int     iRefOffset  = ( iHor >> 2 ) + ( iVer >> 2 ) * iRefStride;
     2555#endif
     2556
     2557  Pel*    piRefY      = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2558  Pel*    piDstY      = rpcYuv->getLumaAddr( uiPartAddr );
     2559
     2560  piDstY[ iPosY*iDstStride + iPosX ] = piRefY[ iPosY*iRefStride + iPosX ] << uiRShift;
     2561}
     2562
     2563
     2564#if HIGH_ACCURACY_BI
     2565
     2566Void  TComPrediction::xPredInterLumaBlk_DBMP_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv )
     2567{
     2568  Int     iRefStride = pcPicYuvRef->getStride();
     2569  Int     iDstStride = rpcYuv->getStride();
     2570
     2571  Int     iRefOffset = ( pcMv->getHor() >> 2 ) + ( pcMv->getVer() >> 2 ) * iRefStride;
     2572  Pel*    piRefY     = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2573
     2574  Int     ixFrac  = pcMv->getHor() & 0x3;
     2575  Int     iyFrac  = pcMv->getVer() & 0x3;
     2576
     2577  Pel* piDstY = rpcYuv->getLumaAddr( uiPartAddr );
     2578  UInt shiftNum = 14-g_uiBitDepth-g_uiBitIncrement;
     2579
     2580  piDstY += iPosY*iDstStride+iPosX;
     2581  piRefY += iPosY*iRefStride+iPosX;
     2582
     2583  //  Integer point
     2584  if ( ixFrac == 0 && iyFrac == 0 )
     2585  {
     2586    *piDstY = (*piRefY)<<shiftNum;
     2587    return;
     2588  }
     2589
     2590  Int iWidth = 1;
     2591  Int iHeight = 1;
     2592
     2593  //  Half-pel horizontal
     2594  if ( ixFrac == 2 && iyFrac == 0 )
     2595  {
     2596    xCTI_FilterHalfHor_ha ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2597    return;
     2598  }
     2599
     2600  //  Half-pel vertical
     2601  if ( ixFrac == 0 && iyFrac == 2 )
     2602  {
     2603    xCTI_FilterHalfVer_ha ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2604    return;
     2605  }
     2606
     2607  Int   iExtStride = m_iYuvExtStride;//m_cYuvExt.getStride();
     2608  Int*  piExtY     = m_piYuvExt;//m_cYuvExt.getLumaAddr();
     2609
     2610  //  Half-pel center
     2611  if ( ixFrac == 2 && iyFrac == 2 )
     2612  {
     2613    xCTI_FilterHalfVer (piRefY - 3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2614    xCTI_FilterHalfHor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2615    return;
     2616  }
     2617
     2618  //  Quater-pel horizontal
     2619  if ( iyFrac == 0)
     2620  {
     2621    if ( ixFrac == 1)
     2622    {
     2623      xCTI_FilterQuarter0Hor_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2624      return;
     2625    }
     2626    if ( ixFrac == 3)
     2627    {
     2628      xCTI_FilterQuarter1Hor_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2629      return;
     2630    }
     2631  }
     2632  if ( iyFrac == 2 )
     2633  {
     2634    if ( ixFrac == 1)
     2635    {
     2636      xCTI_FilterHalfVer (piRefY -3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2637      xCTI_FilterQuarter0Hor_ha (piExtY + 3,  iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2638      return;
     2639    }
     2640    if ( ixFrac == 3)
     2641    {
     2642      xCTI_FilterHalfVer (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2643      xCTI_FilterQuarter1Hor_ha (piExtY + 3,  iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2644      return;
     2645    }
     2646  }
     2647
     2648  //  Quater-pel vertical
     2649  if( ixFrac == 0 )
     2650  {
     2651    if( iyFrac == 1 )
     2652    {
     2653      xCTI_FilterQuarter0Ver_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2654      return;
     2655    }
     2656    if( iyFrac == 3 )
     2657    {
     2658      xCTI_FilterQuarter1Ver_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2659      return;
     2660    }
     2661  }
     2662
     2663  if( ixFrac == 2 )
     2664  {
     2665    if( iyFrac == 1 )
     2666    {
     2667      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2668      xCTI_FilterHalfHor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2669
     2670      return;
     2671    }
     2672    if( iyFrac == 3 )
     2673    {
     2674      xCTI_FilterQuarter1Ver (piRefY -3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2675      xCTI_FilterHalfHor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2676      return;
     2677    }
     2678  }
     2679
     2680  /// Quarter-pel center
     2681  if ( iyFrac == 1)
     2682  {
     2683    if ( ixFrac == 1)
     2684    {
     2685      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2686      xCTI_FilterQuarter0Hor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2687      return;
     2688    }
     2689    if ( ixFrac == 3)
     2690    {
     2691      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2692      xCTI_FilterQuarter1Hor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2693
     2694      return;
     2695    }
     2696  }
     2697  if ( iyFrac == 3 )
     2698  {
     2699    if ( ixFrac == 1)
     2700    {
     2701      xCTI_FilterQuarter1Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2702      xCTI_FilterQuarter0Hor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2703      return;
     2704    }
     2705    if ( ixFrac == 3)
     2706    {
     2707      xCTI_FilterQuarter1Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2708      xCTI_FilterQuarter1Hor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2709      return;
     2710    }
     2711  }
     2712}
     2713
     2714#endif
     2715
     2716Void  TComPrediction::xPredInterLumaBlk_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv )
     2717{
     2718  Int     iRefStride = pcPicYuvRef->getStride();
     2719  Int     iDstStride = rpcYuv->getStride();
     2720
     2721  Int     iRefOffset = ( pcMv->getHor() >> 2 ) + ( pcMv->getVer() >> 2 ) * iRefStride;
     2722  Pel*    piRefY     = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2723
     2724  Int     ixFrac  = pcMv->getHor() & 0x3;
     2725  Int     iyFrac  = pcMv->getVer() & 0x3;
     2726
     2727  Pel* piDstY = rpcYuv->getLumaAddr( uiPartAddr );
     2728 
     2729  piDstY += iPosY*iDstStride+iPosX;
     2730  piRefY += iPosY*iRefStride+iPosX;
     2731
     2732  //  Integer point
     2733  if ( ixFrac == 0 && iyFrac == 0 )
     2734  {
     2735    ::memcpy(piDstY, piRefY, sizeof(Pel));
     2736    return;
     2737  }
     2738
     2739  Int iWidth = 1;
     2740  Int iHeight = 1;
     2741
     2742  //  Half-pel horizontal
     2743  if ( ixFrac == 2 && iyFrac == 0 )
     2744  {
     2745    xCTI_FilterHalfHor ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2746    return;
     2747  }
     2748
     2749  //  Half-pel vertical
     2750  if ( ixFrac == 0 && iyFrac == 2 )
     2751  {
     2752    xCTI_FilterHalfVer ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2753    return;
     2754  }
     2755
     2756  Int   iExtStride = m_iYuvExtStride;//m_cYuvExt.getStride();
     2757  Int*  piExtY     = m_piYuvExt;//m_cYuvExt.getLumaAddr();
     2758
     2759  //  Half-pel center
     2760  if ( ixFrac == 2 && iyFrac == 2 )
     2761  {
     2762
     2763    xCTI_FilterHalfVer (piRefY - 3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2764    xCTI_FilterHalfHor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2765    return;
     2766  }
     2767
     2768  //  Quater-pel horizontal
     2769  if ( iyFrac == 0)
     2770  {
     2771    if ( ixFrac == 1)
     2772    {
     2773      xCTI_FilterQuarter0Hor( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2774      return;
     2775    }
     2776    if ( ixFrac == 3)
     2777    {
     2778      xCTI_FilterQuarter1Hor( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2779      return;
     2780    }
     2781  }
     2782  if ( iyFrac == 2 )
     2783  {
     2784    if ( ixFrac == 1)
     2785    {
     2786      xCTI_FilterHalfVer (piRefY -3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2787      xCTI_FilterQuarter0Hor (piExtY + 3,  iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2788      return;
     2789    }
     2790    if ( ixFrac == 3)
     2791    {
     2792      xCTI_FilterHalfVer (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2793      xCTI_FilterQuarter1Hor (piExtY + 3,  iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2794      return;
     2795    }
     2796  }
     2797
     2798  //  Quater-pel vertical
     2799  if( ixFrac == 0 )
     2800  {
     2801    if( iyFrac == 1 )
     2802    {
     2803      xCTI_FilterQuarter0Ver( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2804      return;
     2805    }
     2806    if( iyFrac == 3 )
     2807    {
     2808      xCTI_FilterQuarter1Ver( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2809      return;
     2810    }
     2811  }
     2812
     2813  if( ixFrac == 2 )
     2814  {
     2815    if( iyFrac == 1 )
     2816    {
     2817      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2818      xCTI_FilterHalfHor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2819      return;
     2820    }
     2821    if( iyFrac == 3 )
     2822    {
     2823      xCTI_FilterQuarter1Ver (piRefY -3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2824      xCTI_FilterHalfHor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2825      return;
     2826    }
     2827  }
     2828
     2829  /// Quarter-pel center
     2830  if ( iyFrac == 1)
     2831  {
     2832    if ( ixFrac == 1)
     2833    {
     2834      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2835      xCTI_FilterQuarter0Hor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2836      return;
     2837    }
     2838    if ( ixFrac == 3)
     2839    {
     2840      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2841      xCTI_FilterQuarter1Hor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2842      return;
     2843    }
     2844  }
     2845  if ( iyFrac == 3 )
     2846  {
     2847    if ( ixFrac == 1)
     2848    {
     2849      xCTI_FilterQuarter1Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2850      xCTI_FilterQuarter0Hor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2851      return;
     2852    }
     2853    if ( ixFrac == 3)
     2854    {
     2855      xCTI_FilterQuarter1Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2856      xCTI_FilterQuarter1Hor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2857      return;
     2858    }
     2859  }
     2860}
     2861
     2862#if HIGH_ACCURACY_BI
     2863Void TComPrediction::xPredInterChromaBlk_DBMP_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv )
     2864{
     2865  Int     iRefStride  = pcPicYuvRef->getCStride();
     2866  Int     iDstStride  = rpcYuv->getCStride();
     2867
     2868  Int     iRefOffset  = (pcMv->getHor() >> 3) + (pcMv->getVer() >> 3) * iRefStride;
     2869
     2870  Pel*    piRefCb     = pcPicYuvRef->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2871  Pel*    piRefCr     = pcPicYuvRef->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2872
     2873  Pel* piDstCb = rpcYuv->getCbAddr( uiPartAddr );
     2874  Pel* piDstCr = rpcYuv->getCrAddr( uiPartAddr );
     2875
     2876  Int     ixFrac  = pcMv->getHor() & 0x7;
     2877  Int     iyFrac  = pcMv->getVer() & 0x7;
     2878  UInt    uiCWidth  = 1;
     2879  UInt    uiCHeight = 1;
     2880
     2881  piDstCb += (iPosY>>1)*iDstStride+(iPosX>>1);
     2882  piDstCr += (iPosY>>1)*iDstStride+(iPosX>>1);
     2883  piRefCb += (iPosY>>1)*iRefStride+(iPosX>>1);
     2884  piRefCr += (iPosY>>1)*iRefStride+(iPosX>>1);
     2885
     2886  xDCTIF_FilterC_ha(piRefCb, iRefStride,piDstCb,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac);
     2887  xDCTIF_FilterC_ha(piRefCr, iRefStride,piDstCr,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac);
     2888  return;
     2889}
     2890#endif
     2891
     2892//--
     2893Void TComPrediction::xPredInterChromaBlk_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv )
     2894{
     2895  Int     iRefStride  = pcPicYuvRef->getCStride();
     2896  Int     iDstStride  = rpcYuv->getCStride();
     2897
     2898  Int     iRefOffset  = (pcMv->getHor() >> 3) + (pcMv->getVer() >> 3) * iRefStride;
     2899
     2900  Pel*    piRefCb     = pcPicYuvRef->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2901  Pel*    piRefCr     = pcPicYuvRef->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2902
     2903  Pel* piDstCb = rpcYuv->getCbAddr( uiPartAddr );
     2904  Pel* piDstCr = rpcYuv->getCrAddr( uiPartAddr );
     2905
     2906  Int     ixFrac  = pcMv->getHor() & 0x7;
     2907  Int     iyFrac  = pcMv->getVer() & 0x7;
     2908  UInt    uiCWidth  = 1;
     2909  UInt    uiCHeight = 1;
     2910
     2911  piDstCb += (iPosY>>1)*iDstStride+(iPosX>>1);
     2912  piDstCr += (iPosY>>1)*iDstStride+(iPosX>>1);
     2913  piRefCb += (iPosY>>1)*iRefStride+(iPosX>>1);
     2914  piRefCr += (iPosY>>1)*iRefStride+(iPosX>>1);
     2915
     2916  xDCTIF_FilterC(piRefCb, iRefStride,piDstCb,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac);
     2917  xDCTIF_FilterC(piRefCr, iRefStride,piDstCr,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac);
     2918  return;
     2919}
     2920
     2921#endif
     2922
     2923
    21372924Void  TComPrediction::xDCTIF_FilterC ( Pel*  piRefC, Int iRefStride,Pel*  piDstC,Int iDstStride,
    21382925                                       Int iWidth, Int iHeight,Int iMVyFrac,Int iMVxFrac)
     
    22603047  }
    22613048}
     3049
     3050#if POZNAN_DBMP
     3051
     3052#if DEPTH_MAP_GENERATION
     3053Void TComPrediction::xWeightedAveragePdm_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY )
     3054{
     3055  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
     3056  {
     3057    rpcYuvDst->addAvgPdm_DBMP( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY, uiSubSampExpX, uiSubSampExpY );
     3058  }
     3059  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     3060  {
     3061    pcYuvSrc0->copyPartToPartYuvPdm_DBMP( rpcYuvDst, uiPartIdx, iPosX, iPosY, uiSubSampExpX, uiSubSampExpY );
     3062  }
     3063  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
     3064  {
     3065    pcYuvSrc1->copyPartToPartYuvPdm_DBMP( rpcYuvDst, uiPartIdx, iPosX, iPosY, uiSubSampExpX, uiSubSampExpY );
     3066  }
     3067  else
     3068  {
     3069    assert (0);
     3070  }
     3071}
     3072#endif
     3073
     3074Void TComPrediction::xWeightedAverage_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst )
     3075{
     3076  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
     3077  {
     3078#ifdef ROUNDING_CONTROL_BIPRED
     3079    rpcYuvDst->addAvg_DBMP( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY, pcCU->getSlice()->isRounding());
     3080#else
     3081    rpcYuvDst->addAvg_DBMP( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY );
     3082#endif
     3083  }
     3084  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     3085  {
     3086    pcYuvSrc0->copyPartToPartYuv_DBMP( rpcYuvDst, uiPartIdx, iPosX, iPosY );
     3087  }
     3088  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
     3089  {
     3090    pcYuvSrc1->copyPartToPartYuv_DBMP( rpcYuvDst, uiPartIdx, iPosX, iPosY );
     3091  }
     3092  else
     3093  {
     3094    assert (0);
     3095  }
     3096}
     3097#endif
    22623098
    22633099// AMVP
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPrediction.h

    r21 r28  
    5252#endif
    5353
     54#if POZNAN_MP
     55#include "../TLibCommon/TComMP.h"
     56#endif
     57
    5458// ====================================================================================================================
    5559// Class definition
     
    124128#endif
    125129
     130#if POZNAN_DBMP
     131#if HIGH_ACCURACY_BI
     132#if DEPTH_MAP_GENERATION
     133  Void xPredInterUni_DBMP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false          );
     134#else
     135  Void xPredInterUni_DBMP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false          );
     136#endif
     137#else
     138#if DEPTH_MAP_GENERATION
     139  Void xPredInterUni_DBMP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
     140#else
     141  Void xPredInterUni_DBMP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx          );
     142#endif
     143#endif
     144#if DEPTH_MAP_GENERATION
     145  Void xPredInterBi_DBMP        ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
     146  Void xPredInterPrdDepthMap_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift );
     147#else
     148  Void xPredInterBi_DBMP             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY,                         TComYuv*& rpcYuvPred, Int iPartIdx );
     149  Void xPredInterPrdDepthMap_DBMP    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv, UInt uiRShift );
     150#endif
     151 
     152  Void xPredInterLumaBlk_DBMP   ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv );
     153  Void xPredInterChromaBlk_DBMP ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv );
     154 
     155#if DEPTH_MAP_GENERATION
     156  Void xWeightedAveragePdm_DBMP      ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY );
     157#endif
     158  Void xWeightedAverage_DBMP         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst );
     159 
     160#if HIGH_ACCURACY_BI
     161  Void xPredInterLumaBlk_DBMP_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv );
     162  Void xPredInterChromaBlk_DBMP_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv                            );
     163#endif
     164#endif
     165
    126166#if HHI_DMM_WEDGE_INTRA
    127167  Void xPredIntraWedgeFull       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft, Bool bEncoder, Bool bDelta, UInt uiTabIdx, Int iDeltaDC1 = 0, Int iDeltaDC2 = 0 );
     
    160200#else
    161201  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
     202#endif
     203 
     204#if POZNAN_DBMP
     205#if DEPTH_MAP_GENERATION
     206  Void motionCompensation_DBMP         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
     207#else
     208  Void motionCompensation_DBMP         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
     209#endif
     210 
    162211#endif
    163212 
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComResidualGenerator.cpp

    r21 r28  
    306306    xSetRecResidualInterCU( pcSubCU, pcSubRes );
    307307    break;
     308#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     309  case MODE_SYNTH:
     310    xSetRecResidualIntraCU( pcSubCU, pcSubRes ); //MayBe it should be seperate function
     311    break;
     312#endif
    308313  default:
    309314    AOT( true );
     
    336341  UInt    uiLumaTrMode, uiChromaTrMode;
    337342  pcCU->convertTransIdx             ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode );
     343#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     344  m_pcTrQuant->setQPforQuant        ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(0/*uiAbsPartIdx*/, false), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     345#else
    338346  m_pcTrQuant->setQPforQuant        ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     347#endif
    339348  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pRes, 0, pcCUResidual->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
    340349  // chroma Cb
     
    343352  piCoeff     = pcCU->getCoeffCb();
    344353  pRes        = pcCUResidual->getCbAddr();
     354#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     355  m_pcTrQuant->setQPforQuant        ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(0/*uiAbsPartIdx*/, false), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     356#else
    345357  m_pcTrQuant->setQPforQuant        ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     358#endif
    346359  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
    347360  // chroma Cr
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.cpp

    r21 r28  
    8989  initWpAcDcParam();
    9090#endif
     91
     92#if POZNAN_MP
     93  m_pcMP = NULL;
     94#endif
    9195}
    9296
    9397TComSlice::~TComSlice()
    9498{
     99#if POZNAN_MP
     100  m_pcMP = NULL;
     101#endif
    95102}
    96103
     
    681688#endif
    682689
     690#if POZNAN_DBMP
     691  m_uiDBMP = 0;
     692#endif
     693
     694#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     695  m_uiUseCUSkip = 0;
     696#endif
     697
     698
    683699  // AMVP parameter
    684700  ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) );
     
    730746    }
    731747  }
     748#if POZNAN_NONLINEAR_DEPTH
     749  m_fDepthPower = 1.0;
     750#endif
     751#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     752  m_bUseTexDqpAccordingToDepth = false;
     753#endif
    732754}
    733755
     
    745767  ::memset( m_aaiCodedScale,  0x00, sizeof( m_aaiCodedScale  ) );
    746768  ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) );
     769#if POZNAN_NONLINEAR_DEPTH
     770  m_fDepthPower = 1.0;
     771#endif
    747772}
    748773
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.h

    r21 r28  
    5757#endif
    5858
     59#if POZNAN_MP
     60//#include "../TLibCommon/TComMP.h"
     61class TComMP;
     62#endif
     63
    5964// ====================================================================================================================
    6065// Class definition
     
    148153#endif
    149154
     155#if POZNAN_DBMP
     156  UInt  m_uiDBMP;
     157#endif
     158
     159#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     160  UInt  m_uiUseCUSkip;
     161#endif
     162
    150163#if DEPTH_MAP_GENERATION
    151164  TComDepthMapGenerator* m_pcDepthMapGenerator;
     
    153166#if HHI_INTER_VIEW_RESIDUAL_PRED
    154167  TComResidualGenerator* m_pcResidualGenerator;
     168#endif
     169
     170#if POZNAN_NONLINEAR_DEPTH
     171  Float  m_fDepthPower;
     172#endif
     173
     174#if POZNAN_MP
     175  TComMP* m_pcMP;
     176#endif
     177#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     178  Bool   m_bUseTexDqpAccordingToDepth;
    155179#endif
    156180
     
    208232
    209233  // Tool list
     234#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     235  Bool getUseALF      ()         { return (getViewId()>0)?false:m_bUseALF;}  //todo fix ALF
     236#else
    210237  Bool getUseALF      ()         { return m_bUseALF;        }
     238#endif
    211239  Bool getUseDQP      ()         { return m_bUseDQP;        }
    212240
     
    266294#if MTK_SAO
    267295  Void setUseSAO                  (Bool bVal)  {m_bUseSAO = bVal;}
     296#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU //todo fix SAO
     297  Bool getUseSAO     ()         { return (getViewId()>0)?false:m_bUseSAO;}
     298#else
    268299  Bool getUseSAO                  ()           {return m_bUseSAO;}
     300#endif
    269301#endif
    270302
     
    282314#if HHI_INTER_VIEW_RESIDUAL_PRED
    283315  Void  setMultiviewResPredMode  ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; }
     316#endif
     317
     318#if POZNAN_DBMP
     319  Void  setDBMP                  ( UInt uiDBMP )       { m_uiDBMP = uiDBMP; }
     320#endif
     321
     322#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     323  Void  setUseCUSkip                ( UInt uiUseCUSkip )     { m_uiUseCUSkip = uiUseCUSkip; }
    284324#endif
    285325
     
    297337#endif
    298338
     339#if POZNAN_DBMP
     340  UInt  getDBMP                  ()          { return m_uiDBMP;   }
     341#endif
     342
     343#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     344  UInt  getUseCUSkip                ()          { return m_uiUseCUSkip;   }
     345#endif
     346
    299347#if DEPTH_MAP_GENERATION
    300348  Void                    setDepthMapGenerator( TComDepthMapGenerator* pcDepthMapGenerator )  { m_pcDepthMapGenerator = pcDepthMapGenerator; }
     
    304352  Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
    305353  TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
     354#endif
     355#if POZNAN_NONLINEAR_DEPTH
     356  inline Void    setDepthPower(Float p)   {m_fDepthPower = p;}
     357  inline Float   getDepthPower()          {return m_fDepthPower;}
     358#else
     359  inline Float   getDepthPower()          {return 1.0f;}
     360#endif
     361#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     362  Void setUseTexDqpAccordingToDepth    (Bool bVal)  {m_bUseTexDqpAccordingToDepth = bVal;}
     363  Bool getUseTexDqpAccordingToDepth    ()           {return m_bUseTexDqpAccordingToDepth;}
    306364#endif
    307365};
     
    448506#endif
    449507
     508#if POZNAN_MP
     509  TComMP* m_pcMP;
     510#endif
     511
    450512public:
    451513  TComSlice();
     514#if POZNAN_MP
     515  ~TComSlice();
     516#else
    452517  virtual ~TComSlice();
     518#endif
    453519
    454520  Void      initSlice       ();
     
    614680#endif
    615681
     682#if POZNAN_MP
     683  Void setMP(TComMP* pcMP) { m_pcMP = pcMP; }
     684  TComMP* getMP() { return m_pcMP; }
     685#endif
     686
    616687protected:
    617688#if 0
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComWeightPrediction.cpp

    r5 r28  
    393393}
    394394
     395#if POZNAN_DBMP
     396
     397Void TComWeightPrediction::addWeightBi_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound )
     398{
     399  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     400  Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
     401  Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
     402 
     403  Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
     404  Pel* pSrcU1  = pcYuvSrc1->getCbAddr  ( iPartUnitIdx );
     405  Pel* pSrcV1  = pcYuvSrc1->getCrAddr  ( iPartUnitIdx );
     406 
     407  Pel* pDstY   = rpcYuvDst->getLumaAddr( iPartUnitIdx );
     408  Pel* pDstU   = rpcYuvDst->getCbAddr  ( iPartUnitIdx );
     409  Pel* pDstV   = rpcYuvDst->getCrAddr  ( iPartUnitIdx );
     410 
     411  // Luma : --------------------------------------------
     412  Int w0      = wp0[0].w;
     413  Int o0      = wp0[0].o;
     414  Int offset  = wp0[0].offset;
     415  Int shiftNum = 14 - (g_uiBitDepth + g_uiBitIncrement);
     416  Int shift   = wp0[0].shift + shiftNum;
     417  Int round   = (1<<(shift-1)) * bRound;
     418  Int w1      = wp1[0].w;
     419  Int o1      = wp1[0].o;
     420
     421  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     422  UInt  iSrc1Stride = pcYuvSrc1->getStride();
     423  UInt  iDstStride  = rpcYuvDst->getStride();
     424 
     425  pDstY[iPosY*iDstStride+iPosX] = weightBidir(w0,pSrcY0[iPosY*iSrc0Stride+iPosX], w1,pSrcY1[iPosY*iSrc1Stride+iPosX], round, shift, offset);
     426   
     427  // Chromas : --------------------------------------------
     428  iSrc0Stride = pcYuvSrc0->getCStride();
     429  iSrc1Stride = pcYuvSrc1->getCStride();
     430  iDstStride  = rpcYuvDst->getCStride();
     431 
     432  iPosX = iPosX>>1;
     433  iPosY = iPosY>>1;
     434
     435  // Chroma U : --------------------------------------------
     436  w0      = wp0[1].w;
     437  o0      = wp0[1].o;
     438  offset  = wp0[1].offset;
     439  shift   = wp0[1].shift + shiftNum;
     440  round   = (1<<(shift-1));
     441  w1      = wp1[1].w;
     442  o1      = wp1[1].o;
     443 
     444  pDstU[iPosY*iDstStride+iPosX] = weightBidir(w0,pSrcU0[iPosY*iSrc0Stride+iPosX], w1,pSrcU1[iPosY*iSrc1Stride+iPosX], round, shift, offset);
     445
     446  // Chroma V : --------------------------------------------
     447  w0      = wp0[2].w;
     448  o0      = wp0[2].o;
     449  offset  = wp0[2].offset;
     450  shift   = wp0[2].shift + shiftNum;
     451  round   = (1<<(shift-1));
     452  w1      = wp1[2].w;
     453  o1      = wp1[2].o;
     454
     455  pDstV[iPosY*iDstStride+iPosX] = weightBidir(w0,pSrcV0[iPosY*iSrc0Stride+iPosX], w1,pSrcV1[iPosY*iSrc1Stride+iPosX], round, shift, offset);
     456}
     457
     458Void TComWeightPrediction::addWeightUni_DBMP( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, TComYuv* rpcYuvDst )
     459{
     460  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     461  Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
     462  Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
     463 
     464  Pel* pDstY   = rpcYuvDst->getLumaAddr( iPartUnitIdx );
     465  Pel* pDstU   = rpcYuvDst->getCbAddr  ( iPartUnitIdx );
     466  Pel* pDstV   = rpcYuvDst->getCrAddr  ( iPartUnitIdx );
     467 
     468  // Luma : --------------------------------------------
     469  Int w0      = wp0[0].w;
     470  Int offset  = wp0[0].offset;
     471  Int shift   = wp0[0].shift;
     472  Int round   = wp0[0].round;
     473
     474  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     475  UInt  iDstStride  = rpcYuvDst->getStride();
     476 
     477  pDstY[iPosY*iDstStride+iPosX] = weightUnidir(w0,pSrcY0[iPosY*iSrc0Stride+iPosX], round, shift, offset);
     478   
     479  // Chromas : --------------------------------------------
     480  iSrc0Stride = pcYuvSrc0->getCStride();
     481  iDstStride  = rpcYuvDst->getCStride();
     482 
     483  iPosX = iPosX>>1;
     484  iPosY = iPosY>>1;
     485
     486  // Chroma U : --------------------------------------------
     487  w0      = wp0[1].w;
     488  offset  = wp0[1].offset;
     489  shift   = wp0[1].shift;
     490  round   = wp0[1].round;
     491 
     492  pDstU[iPosY*iDstStride+iPosX] = weightUnidir(w0,pSrcU0[iPosY*iSrc0Stride+iPosX], round, shift, offset);
     493
     494  // Chroma V : --------------------------------------------
     495  w0      = wp0[2].w;
     496  offset  = wp0[2].offset;
     497  shift   = wp0[2].shift;
     498  round   = wp0[2].round;
     499
     500  pDstV[iPosY*iDstStride+iPosX] = weightUnidir(w0,pSrcV0[iPosY*iSrc0Stride+iPosX], round, shift, offset);
     501}
     502
     503Void TComWeightPrediction::xWeightedPredictionUni_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx )
     504{
     505  wpScalingParam  *pwp, *pwpTmp;
     506  Int             iRefIdx   = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           assert (iRefIdx >= 0);
     507  Int             ibdi = (g_uiBitDepth+g_uiBitIncrement);
     508
     509  if ( eRefPicList == REF_PIC_LIST_0 )
     510  {
     511    getWpScaling(pcCU, iRefIdx, -1, pwp, pwpTmp, ibdi);
     512  }
     513  else
     514  {
     515    getWpScaling(pcCU, -1, iRefIdx, pwpTmp, pwp, ibdi);
     516  }
     517  addWeightUni_DBMP( pcYuvSrc, uiPartAddr, iPosX, iPosY, pwp, rpcYuvPred );
     518}
     519
     520Void TComWeightPrediction::xWeightedPredictionBi_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv* rpcYuvDst )
     521{
     522  wpScalingParam  *pwp0, *pwp1;
     523  TComPPS         *pps = pcCU->getSlice()->getPPS();
     524
     525  if ( !pps->getUseWP() ) {
     526    printf("TComWeightPrediction::xWeightedPredictionBi():\tassert failed: useWP is false.\n");
     527    exit(0);
     528  }
     529
     530  Int ibdi = (g_uiBitDepth+g_uiBitIncrement);
     531  getWpScaling(pcCU, iRefIdx0, iRefIdx1, pwp0, pwp1, ibdi);
     532
     533  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
     534  {
     535    addWeightBi_DBMP(pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY, pwp0, pwp1, rpcYuvDst );
     536  }
     537  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     538  {
     539    addWeightUni_DBMP( pcYuvSrc0, uiPartIdx, iPosX, iPosY, pwp0, rpcYuvDst );
     540  }
     541  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
     542  {
     543    addWeightUni_DBMP( pcYuvSrc1, uiPartIdx, iPosX, iPosY, pwp1, rpcYuvDst );
     544  }
     545  else
     546    assert (0);
     547
     548}
     549#endif
     550
    395551#endif  // WEIGHT_PRED
    396552
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComWeightPrediction.h

    r2 r28  
    3737  Void  xWeightedPredictionBi( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* rpcYuvDst );
    3838
     39#if POZNAN_DBMP
     40  Void  addWeightBi_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound=true );
     41  Void  addWeightUni_DBMP( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, TComYuv* rpcYuvDst );
     42
     43  Void  xWeightedPredictionUni_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx );
     44  Void  xWeightedPredictionBi_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv* rpcYuvDst );
     45#endif
     46
    3947  __inline  Pel   xClip  ( Int x );
    4048  __inline  Pel   weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset);
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComYuv.cpp

    r21 r28  
    387387}
    388388
     389#if POZNAN_DBMP
     390
     391Void TComYuv::copyPartToPartYuv_DBMP   ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY )
     392{
     393  copyPartToPartLuma_DBMP   (pcYuvDst, uiPartIdx, uiPosX, uiPosY );
     394  copyPartToPartChroma_DBMP (pcYuvDst, uiPartIdx, uiPosX>>1, uiPosY>>1 );
     395}
     396
     397Void TComYuv::copyPartToPartLuma_DBMP  ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY )
     398{
     399  Pel* pSrc =           getLumaAddr(uiPartIdx);
     400  Pel* pDst = pcYuvDst->getLumaAddr(uiPartIdx);
     401  if( pSrc == pDst )
     402  {
     403    //th not a good idea
     404    //th best would be to fix the caller
     405    return ;
     406  }
     407 
     408  UInt  iSrcStride = getStride();
     409  UInt  iDstStride = pcYuvDst->getStride();
     410
     411  ::memcpy( pDst+uiPosY*iDstStride+uiPosX, pSrc+uiPosY*iSrcStride+uiPosX, sizeof(Pel) );
     412}
     413
     414Void TComYuv::copyPartToPartChroma_DBMP( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY )
     415{
     416  Pel*  pSrcU =           getCbAddr(uiPartIdx);
     417  Pel*  pSrcV =           getCrAddr(uiPartIdx);
     418  Pel*  pDstU = pcYuvDst->getCbAddr(uiPartIdx);
     419  Pel*  pDstV = pcYuvDst->getCrAddr(uiPartIdx);
     420 
     421  if( getCbAddr() == NULL || getCrAddr() == NULL || pcYuvDst->getCbAddr() == NULL || pcYuvDst->getCrAddr() == NULL ) //KUBA CHROMA
     422  {
     423    return ;
     424  }
     425  if( pSrcU == pDstU && pSrcV == pDstV)
     426  {
     427    //th not a good idea
     428    //th best would be to fix the caller
     429    return ;
     430  }
     431 
     432  UInt   iSrcStride = getCStride();
     433  UInt   iDstStride = pcYuvDst->getCStride();
     434
     435  ::memcpy( pDstU+uiPosY*iDstStride+uiPosX, pSrcU+uiPosY*iSrcStride+uiPosX, sizeof(Pel) );
     436  ::memcpy( pDstV+uiPosY*iDstStride+uiPosX, pSrcV+uiPosY*iSrcStride+uiPosX, sizeof(Pel) );
     437}
     438
     439#if DEPTH_MAP_GENERATION
     440Void TComYuv::copyPartToPartYuvPdm_DBMP   ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY, UInt uiSubSampExpX, UInt uiSubSampExpY )
     441{
     442  copyPartToPartLumaPdm_DBMP   (pcYuvDst, uiPartIdx, uiPosX, uiPosY, uiSubSampExpX, uiSubSampExpY );
     443}
     444
     445Void TComYuv::copyPartToPartLumaPdm_DBMP  ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY, UInt uiSubSampExpX, UInt uiSubSampExpY )
     446{
     447  UInt uiBlkX = g_auiRasterToPelX[ g_auiZscanToRaster[ uiPartIdx ] ] >> uiSubSampExpX;
     448  UInt uiBlkY = g_auiRasterToPelY[ g_auiZscanToRaster[ uiPartIdx ] ] >> uiSubSampExpY;
     449  Pel* pSrc   = getLumaAddr(uiPartIdx);
     450  Pel* pDst   = pcYuvDst->getLumaAddr() + uiBlkY * pcYuvDst->getStride() + uiBlkX;
     451 
     452  if( pSrc == pDst )
     453  {
     454    //th not a good idea
     455    //th best would be to fix the caller
     456    return ;
     457  }
     458 
     459  UInt  iSrcStride = getStride();
     460  UInt  iDstStride = pcYuvDst->getStride();
     461
     462  ::memcpy( pDst+uiPosY*iDstStride+uiPosX, pSrc+uiPosY*iSrcStride+uiPosX, sizeof(Pel) );
     463}
     464
     465#endif
     466
     467#endif
     468
    389469Void TComYuv::addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
    390470{
     
    862942#endif
    863943
     944#if POZNAN_DBMP
     945
     946#ifdef ROUNDING_CONTROL_BIPRED
     947
     948Void TComYuv::addAvg_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, Bool bRound )
     949{
     950  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     951  Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
     952  Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
     953 
     954  Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
     955  Pel* pSrcU1  = pcYuvSrc1->getCbAddr  ( iPartUnitIdx );
     956  Pel* pSrcV1  = pcYuvSrc1->getCrAddr  ( iPartUnitIdx );
     957 
     958  Pel* pDstY   = getLumaAddr( iPartUnitIdx );
     959  Pel* pDstU   = getCbAddr  ( iPartUnitIdx );
     960  Pel* pDstV   = getCrAddr  ( iPartUnitIdx );
     961 
     962  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     963  UInt  iSrc1Stride = pcYuvSrc1->getStride();
     964  UInt  iDstStride  = getStride();
     965
     966#if HIGH_ACCURACY_BI
     967  Int shiftNum = 15 - (g_uiBitDepth + g_uiBitIncrement);
     968  Int offset = (1<<(shiftNum - 1));
     969 
     970  //Luma
     971  (pDstY+iPosY*iDstStride)[iPosX] = Clip(((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + offset) >> shiftNum );
     972   
     973  iSrc0Stride = pcYuvSrc0->getCStride();
     974  iSrc1Stride = pcYuvSrc1->getCStride();
     975  iDstStride  = getCStride();
     976
     977  //Chroma
     978  (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum );
     979  (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum );
     980 
     981#else
     982
     983  //Luma
     984  (pDstY+iPosY*iDstStride)[iPosX] = ((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + bRound) >> 1;
     985   
     986  iSrc0Stride = pcYuvSrc0->getCStride();
     987  iSrc1Stride = pcYuvSrc1->getCStride();
     988  iDstStride  = getCStride();
     989 
     990  //Chroma
     991  (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + bRound) >> 1;
     992  (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + bRound) >> 1;
     993#endif
     994}
     995
     996#endif
     997
     998Void TComYuv::addAvg_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY )
     999{
     1000  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     1001  Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
     1002  Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
     1003 
     1004  Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
     1005  Pel* pSrcU1  = pcYuvSrc1->getCbAddr  ( iPartUnitIdx );
     1006  Pel* pSrcV1  = pcYuvSrc1->getCrAddr  ( iPartUnitIdx );
     1007 
     1008  Pel* pDstY   = getLumaAddr( iPartUnitIdx );
     1009  Pel* pDstU   = getCbAddr  ( iPartUnitIdx );
     1010  Pel* pDstV   = getCrAddr  ( iPartUnitIdx );
     1011 
     1012  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     1013  UInt  iSrc1Stride = pcYuvSrc1->getStride();
     1014  UInt  iDstStride  = getStride();
     1015#if HIGH_ACCURACY_BI
     1016  Int shiftNum = 15 - (g_uiBitDepth + g_uiBitIncrement);
     1017  Int offset = (1<<(shiftNum - 1));
     1018 
     1019  //Luma
     1020  (pDstY+iPosY*iDstStride)[iPosX] = Clip(((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + offset) >> shiftNum );
     1021
     1022  iSrc0Stride = pcYuvSrc0->getCStride();
     1023  iSrc1Stride = pcYuvSrc1->getCStride();
     1024  iDstStride  = getCStride();
     1025 
     1026  //Chroma
     1027  (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum );
     1028  (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum );
     1029
     1030#else 
     1031  //Luma
     1032  (pDstY+iPosY*iDstStride)[iPosX] = ((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + 1) >> 1;
     1033   
     1034  iSrc0Stride = pcYuvSrc0->getCStride();
     1035  iSrc1Stride = pcYuvSrc1->getCStride();
     1036  iDstStride  = getCStride();
     1037 
     1038  //Chroma
     1039  (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + 1) >> 1;
     1040  (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + 1) >> 1;
     1041#endif
     1042}
     1043
     1044#if DEPTH_MAP_GENERATION
     1045Void TComYuv::addAvgPdm_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY )
     1046{
     1047  UInt uiBlkX  = g_auiRasterToPelX[ g_auiZscanToRaster[ iPartUnitIdx ] ] >> uiSubSampExpX;
     1048  UInt uiBlkY  = g_auiRasterToPelY[ g_auiZscanToRaster[ iPartUnitIdx ] ] >> uiSubSampExpY;
     1049  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     1050  Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
     1051  Pel* pDstY   = getLumaAddr() + uiBlkY * getStride() + uiBlkX;
     1052 
     1053  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     1054  UInt  iSrc1Stride = pcYuvSrc1->getStride();
     1055  UInt  iDstStride  = getStride();
     1056
     1057  pDstY[iPosY*iDstStride+iPosX] = (pSrcY0[iPosY*iSrc0Stride+iPosX] + pSrcY1[iPosY*iSrc1Stride+iPosX] + 1) >> 1;
     1058}
     1059#endif
     1060
     1061#endif
    8641062
    8651063Void TComYuv::removeHighFreq( TComYuv* pcYuvSrc, UInt uiWidht, UInt uiHeight )
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComYuv.h

    r21 r28  
    118118#endif
    119119 
     120#if POZNAN_DBMP
     121  Void    copyPartToPartYuv_DBMP        ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY ); 
     122  Void    copyPartToPartLuma_DBMP   ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY );
     123  Void    copyPartToPartChroma_DBMP ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY );
     124#if DEPTH_MAP_GENERATION
     125  Void    copyPartToPartYuvPdm_DBMP  ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY, UInt uiSubSampExpX, UInt uiSubSampExpY );
     126  Void    copyPartToPartLumaPdm_DBMP ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY, UInt uiSubSampExpX, UInt uiSubSampExpY );
     127#endif
     128#endif
     129 
    120130  // ------------------------------------------------------------------------------------------------------------------
    121131  //  Algebraic operation for YUV buffer
     
    143153#endif
    144154
     155#if POZNAN_DBMP
     156#ifdef ROUNDING_CONTROL_BIPRED
     157  Void    addAvg_DBMP            ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, Bool bRound );
     158#endif
     159  Void    addAvg_DBMP            ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY );
     160#if DEPTH_MAP_GENERATION
     161  Void    addAvgPdm_DBMP         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY );
     162#endif
     163#endif
     164
    145165  //   Remove High frequency
    146166  Void    removeHighFreq    ( TComYuv* pcYuvSrc, UInt uiWidht, UInt uiHeight );
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TypeDef.h

    r21 r28  
    6565//<<<<< HHI 3DV tools <<<<<
    6666
    67 
     67//<<<<< Poznan 3DV tools <<<<<<
     68#define POZNAN_CU_SKIP              1 //Poznan Cu Skip
     69#define POZNAN_CU_SYNTH             1 //Poznan Cu Synth
     70
     71#define POZNAN_AVAIL_MAP            1 //Creates Availibity buffers in all needed classes
     72
     73#define POZNAN_SYNTH_VIEW           1 //Creates view synthesis buffers in all needed classes
     74#define POZNAN_SYNTH_DEPTH          1
     75
     76#define POZNAN_SYNTH                1 //Creates aligned synthesis classes in encoder and decoder
     77
     78#define POZNAN_ENCODE_ONLY_DISOCCLUDED_CU          1 //Poznan CU Skip
     79#define POZNAN_FILL_OCCLUDED_CU_WITH_SYNTHESIS     1 //Fill not sended CUs with synthesized data
     80
     81#define POZNAN_VSO_FIX              0
     82
     83#define POZNAN_CU_SKIP_PSNR         1 //Poznan Cu Skip Display psnr of the codded CUs only
     84
     85#define POZNAN_NONLINEAR_DEPTH              1    /// Non-linear depth processing (Maciej Kurc)
     86#define POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE 1    /// Send DepthPower as byte instead of float
     87
     88#if POZNAN_SYNTH
     89#define POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 1 /// Increase QP for texture CUs that are in the background (according to proper depth map). This QP change is not encoded in a bitstream
     90#endif
     91#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH     
     92 #define POZNAN_TEXTURE_TU_DELTA_QP_NOT_IN_BASE_VIEW 1     /// should not be disabled in current software version - no depth synthesis map is available for base view anyway 
     93 #define POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW 1    /// increase of QP param for top and bottom LCU row in frame
     94 #define POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 0 /// used for optimization of function calculating dQP from depth block max value. Standard values set if disabled. If enabled params are set in cfg file for encoder (no decoder is supported in that case).
     95  #if !POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     96    #define POZNAN_TEXTURE_TU_DELTA_QP_OFFSET (-2.6)
     97    #define POZNAN_TEXTURE_TU_DELTA_QP_MUL (1)
     98    #define POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_ROW_VAL (0)
     99  #endif
     100#endif
     101
     102#define POZNAN_MP                                  1    /// Depth-Based Multiview Prediction of CU parameters
     103#if POZNAN_MP
     104
     105#define POZNAN_MP_USE_DEPTH_MAP_GENERATION 0 // determines if DEPTH_MAP_GENERATION is used for calculating corresponding pixel position in PUT multiview prediction (POZNAN_MP):
     106                                                                                                                                        //                      POZNAN_MP_USE_DEPTH_MAP_GENERATION=1 - use DEPTH_MAP_GENERATION,
     107                                                                                                                                        //                      POZNAN_MP_USE_DEPTH_MAP_GENERATION=0 - use reconstructed depth maps from neighboring views
     108
     109#define POZNAN_MP_FILL                             1    // Depth-Based Multiview Prediction of CU parameters with fill option for occluded areas
     110#if POZNAN_MP_FILL
     111#define POZNAN_MP_FILL_TYPE                        0    // Variant of fill algorithm used for occluded areas (0 - smaller disparity, 1 - larger disparity)
     112#endif
     113
     114// ---------------------------------------
     115
     116#define POZNAN_DBMP                                1    // Depth Based Motion Prediction prediction for MERGE
     117#if POZNAN_DBMP
     118#define POZNAN_DBMP_USE_FOR_TEXTURE                  1    //use Depth Based Motion Prediction in texture pictures (0 - no, 1 -yes)
     119#define POZNAN_DBMP_USE_FOR_DEPTH                  1    // use Depth Based Motion Prediction in depth pictures (0 - no, 1 -yes)
     120
     121#define POZNAN_DBMP_CALC_PRED_DATA              1    // Depth Based Motion Prediction motion data used for prediction in other CUs is calculated based on all CU points (otherwise motion data for none-MP points is used for prediction)
     122#define POZNAN_DBMP_COMPRESS_ME_DATA            0    // Depth Based Motion Prediction derives representative motion data from reference CUs even if they are DBMP-based predicted (otherwise motion data is derived with per-point resolution for DBMP-based predicted reference CUs)
     123#define POZNAN_DBMP_USE_IN_NONANCHOR_PIC_ONLY           1    // determines if Depth Based Motion Prediction is used in non-anchor pictures only
     124#endif
     125
     126#endif
     127
     128
     129//<<<<< Poznan 3DV tools <<<<<<
    68130
    69131////////////////////////////
     
    345407typedef       unsigned long       ULong;
    346408typedef       double              Double;
     409typedef       float               Float;
    347410
    348411// ====================================================================================================================
     
    580643  MODE_INTER,           ///< inter-prediction mode
    581644  MODE_INTRA,           ///< intra-prediction mode
     645#if POZNAN_SYNTH
     646  MODE_SYNTH,           ///< synth-mode
     647#endif
    582648  MODE_NONE = 15
    583649};
Note: See TracChangeset for help on using the changeset viewer.