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


Ignore:
Timestamp:
26 Mar 2012, 09:03:21 (13 years ago)
Author:
poznan-univ
Message:

Adjustment for FlexCO, and high-level syntax improvement.

Location:
branches/0.3-poznan-univ/source/Lib
Files:
22 edited

Legend:

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

    r28 r41  
    144144#endif
    145145
    146 #if POZNAN_NONLINEAR_DEPTH
    147 #define POZNAN_LUT_INCREASED_PRECISION 0 // 1 //to do
    148 #else
    149 #define POZNAN_LUT_INCREASED_PRECISION 0
    150 #endif
    151 
    152146//>>>>> generation and usage of virtual prediction depth maps >>>>>
    153147#define PDM_ONE_DEPTH_PER_PU              1         // use only a single depth for a prediction unit (in update)
     
    192186#endif
    193187
    194 #if POZNAN_NONLINEAR_DEPTH
    195 inline 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 
    203 inline Float dequantizeDepthPower(Int iDepthQuant)
    204 {
    205   return iDepthQuant/128.0f + 1.0f; 
    206 };
    207 #endif
    208 
    209188// ====================================================================================================================
    210189// Macro functions
     
    218197#define RemoveBitIncrement(x)       ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement )     ///< Remove Bit increment
    219198
    220 #if POZNAN_LUT_INCREASED_PRECISION
    221 #define RemoveBitIncrementLUT(x)       (x)     ///< Remove Bit increment
    222 #define SizeOfLUT                      (256 << g_uiBitIncrement) 
    223 #else
    224199#define SizeOfLUT                      256
    225 #define RemoveBitIncrementLUT(x)       ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement )     ///< Remove Bit increment
    226 #endif
    227200
    228201#define DATA_ALIGN                  1                                                                 ///< use 32-bit aligned malloc/free
     
    665638
    666639
     640#if POZNAN_NONLINEAR_DEPTH
     641struct TComNonlinearDepthModel // // OS: cannot be stdarray, due to memcpy done on SlicePilot
     642{
     643  Int m_aiPoints[257];
     644  Int m_iNum;
     645
     646  Int m_aiX[257];
     647  Int m_aiY[257];
     648
     649  Void Clear() { m_iNum=0; m_aiPoints[0]=0; m_aiPoints[1]=0; };
     650  Void Init()
     651  {
     652    for (Int k=m_iNum+1; k>=0; --k)
     653    {
     654      int q = 255*k/(m_iNum+1);
     655      m_aiX[k] = q + m_aiPoints[k];
     656      m_aiY[k] = q - m_aiPoints[k];
     657    }
     658  };
     659
     660  Double xInterpolateD(Int *aiX,Int *aiY, Double x, Double dScale)
     661  {
     662    Int x1 = 0;
     663    Int x2 = m_iNum+1;
     664
     665    for (;;)
     666    {
     667      if (x1+1>=x2)
     668        return ((x-aiX[x1])*(aiY[x2]-aiY[x1])/(aiX[x2]-aiX[x1]) + aiY[x1])*dScale;
     669      Int xm = (x1+x2)>>1;
     670      if (x >= aiX[xm]) x1 = xm;
     671      else              x2 = xm;
     672    }
     673  }
     674
     675  inline Double ForwardD(Double x,  Double dScale) { return xInterpolateD(m_aiX, m_aiY, x, dScale); }
     676  inline Double BackwardD(Double x, Double dScale) { return xInterpolateD(m_aiY, m_aiX, x, dScale); }
     677
     678  Int64 xInterpolateI(Int *aiX,Int *aiY, Int x, Int64 iScale)
     679  {
     680    Int x1 = 0;
     681    Int x2 = m_iNum+1;
     682
     683    for (;;)
     684    {
     685      if (x1+1>=x2)
     686      {         
     687        Int aiXx2x1 = (aiX[x2]-aiX[x1]);
     688        Int64 res = (x-aiX[x1])*(aiY[x2]-aiY[x1])*iScale;
     689        if (res>0) return (res + (aiXx2x1>>1) )/aiXx2x1 + aiY[x1]*iScale;
     690        else       return (res - (aiXx2x1>>1) )/aiXx2x1 + aiY[x1]*iScale;
     691      }
     692      Int xm = (x1+x2)>>1;
     693      if (x >= aiX[xm]) x1 = xm;
     694      else              x2 = xm;
     695    }
     696  }
     697
     698  inline Int64  ForwardI (Int x, Int64 iScale) { return xInterpolateI(m_aiX, m_aiY, x, iScale); }
     699  inline Int64  BackwardI(Int x, Int64 iScale) { return xInterpolateI(m_aiY, m_aiX, x, iScale); }
     700
     701};
     702#endif
     703
    667704#endif // end of #ifndef  __COMMONDEF__
    668705
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComDataCU.cpp

    r30 r41  
    50045004    exit(333);
    50055005  }
    5006   Float fVal = (Float)((255 - (uiBlockMax >> g_uiBitIncrement)) >> 4);
     5006  Double fVal = (Double)((255 - (uiBlockMax >> g_uiBitIncrement)) >> 4); //Owieczka ?? ToDo Convert Double to Int
    50075007  fVal = (fVal * fVal);
    50085008#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
    5009   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
    5010   fVal = (Float)( fVal * getPic()->getTexDqpAccordingToDepthMul()); //
     5009  fVal = (Double)( 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
     5010  fVal = (Double)( fVal * getPic()->getTexDqpAccordingToDepthMul()); //
    50115011#else
    5012   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
    5013   fVal = (Float)( fVal * POZNAN_TEXTURE_TU_DELTA_QP_MUL); //
     5012  fVal = (Double)( 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
     5013  fVal = (Double)( fVal * POZNAN_TEXTURE_TU_DELTA_QP_MUL); //
    50145014#endif
    50155015  return (Int)fVal >> 5;
     
    50345034   UInt iCuAddr = getAddr();
    50355035   //TComPic * pcDepthPic = getPic()->getDepthPic();
     5036#if FLEX_CODING_ORDER
     5037   TComPicYuv * pcDepthPicYUV = NULL;
     5038   // if depth map reconstruction picture is available use it Use synthesis picture otherwise.
     5039   if(getPic()->getSlice(0)->getDepthPic() != NULL && getPic()->getSlice(0)->getDepthPic()->getReconMark())
     5040   {
     5041     pcDepthPicYUV = getPic()->getSlice(0)->getDepthPic()->getPicYuvRec();
     5042   }
     5043   else
     5044   {
     5045      pcDepthPicYUV = getPic()->getPicYuvSynthDepth();
     5046   }
     5047#else
    50365048   TComPicYuv * pcDepthPicYUV = getPic()->getPicYuvSynthDepth();
     5049#endif
    50375050   if(pcDepthPicYUV /*pcDepthPic*/ == NULL)
    50385051   {
     
    50555068   }
    50565069#if POZNAN_NONLINEAR_DEPTH
    5057    TComNonlinearDepthBackward cNonlinearDepthBwd(getSlice()->getSPS()->getDepthPower(), g_uiBitIncrement, g_uiBitIncrement);
    5058    uiDepthLumaTransformBlockMax = (Pel)( cNonlinearDepthBwd(uiDepthLumaTransformBlockMax) + 0.5);
     5070   if( getSlice()->getSPS()->getUseNonlinearDepth() )
     5071    uiDepthLumaTransformBlockMax = (Pel)( getSlice()->getSPS()->getNonlinearDepthModel().BackwardI(RemoveBitIncrement(uiDepthLumaTransformBlockMax), 1<<g_uiBitIncrement ) ) ;
    50595072#endif
    50605073   Int iDeltaQP = CuQpIncrementFunction(uiDepthLumaTransformBlockMax);
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComMP.cpp

    r28 r41  
    4444        //m_pcCameraData = NULL;
    4545        m_aiBaseViewShiftLUT = NULL;
     46#if POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE
     47  m_ppiTempMvPtCorrX = NULL;
     48  m_ppiTempMvPtCorrY = NULL;
     49  m_ppiTempMvPtCorrZ = NULL;
     50#endif
    4651#endif
    4752
     
    96101#endif
    97102
    98 /*
    99         m_ppiMvPtCorrX = new Short*[m_uiHeight];
    100         m_ppiMvPtCorrY = new Short*[m_uiHeight];
    101         m_ppiMvPtCorrZ = new Short*[m_uiHeight];
    102         m_ppiMvPtCorrRefViewIdx = new Short*[m_uiHeight];
    103         m_pppcRefCU = new TComDataCU**[m_uiHeight];
    104         m_ppuicRefPartAddr = new UShort*[m_uiHeight];   
    105         for(Int i=0;i<m_uiHeight;i++)
    106         {
    107                 m_ppiMvPtCorrX[i] = new Short[m_uiWidth];
    108                 m_ppiMvPtCorrY[i] = new Short[m_uiWidth];
    109                 m_ppiMvPtCorrZ[i] = new Short[m_uiWidth];
    110                 m_ppiMvPtCorrRefViewIdx[i] = new Short[m_uiWidth];
    111                 m_pppcRefCU[i] = new TComDataCU*[m_uiWidth];
    112                 m_ppuicRefPartAddr[i]  = new UShort[m_uiWidth];
    113         }
    114 //*/
    115 ///*
    116103        Short* piPtr;
    117104        UShort* puiPtr;
     
    141128        puiPtr = (UShort*)malloc(sizeof(UShort)*m_uiHeight*m_uiWidth);
    142129        for(UInt i=0,addr=0;i<m_uiHeight;i++,addr+=m_uiWidth) m_ppuicRefPartAddr[i] = &(puiPtr[addr]);
    143 //*/
     130
     131#if !POZNAN_MP_USE_DEPTH_MAP_GENERATION && POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE
     132        m_ppiTempMvPtCorrX = (Short**)malloc(sizeof(Short*)*m_uiHeight);
     133        piPtr = (Short*)malloc(sizeof(Short)*m_uiHeight*m_uiWidth);
     134        for(UInt i=0,addr=0;i<m_uiHeight;i++,addr+=m_uiWidth) m_ppiTempMvPtCorrX[i] = &(piPtr[addr]);
     135
     136        m_ppiTempMvPtCorrY = (Short**)malloc(sizeof(Short*)*m_uiHeight);
     137        piPtr = (Short*)malloc(sizeof(Short)*m_uiHeight*m_uiWidth);
     138        for(UInt i=0,addr=0;i<m_uiHeight;i++,addr+=m_uiWidth) m_ppiTempMvPtCorrY[i] = &(piPtr[addr]);
     139
     140        m_ppiTempMvPtCorrZ = (Short**)malloc(sizeof(Short*)*m_uiHeight);
     141        piPtr = (Short*)malloc(sizeof(Short)*m_uiHeight*m_uiWidth);
     142        for(UInt i=0,addr=0;i<m_uiHeight;i++,addr+=m_uiWidth) m_ppiTempMvPtCorrZ[i] = &(piPtr[addr]);
     143#endif
     144
    144145#if POZNAN_DBMP & !POZNAN_DBMP_COMPRESS_ME_DATA
    145146        m_ppiL0RefPOC.clear();
     
    303304        }
    304305
     306#if !POZNAN_MP_USE_DEPTH_MAP_GENERATION && POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE
     307        if(m_ppiTempMvPtCorrX!=NULL)
     308        {
     309                //for(Int i=0;i<m_uiHeight;i++) delete [] m_ppiTempMvPtCorrX[i];
     310                //delete [] m_ppiTempMvPtCorrX;
     311                free(m_ppiTempMvPtCorrX[0]);
     312                free(m_ppiTempMvPtCorrX);
     313                m_ppiTempMvPtCorrX = NULL;
     314        }
     315
     316        if(m_ppiTempMvPtCorrY!=NULL)
     317        {
     318                //for(Int i=0;i<m_uiHeight;i++) delete [] m_ppiTempMvPtCorrY[i];
     319                //delete [] m_ppiTempMvPtCorrY;
     320                free(m_ppiTempMvPtCorrY[0]);
     321                free(m_ppiTempMvPtCorrY);
     322                m_ppiTempMvPtCorrY = NULL;
     323        }
     324
     325        if(m_ppiTempMvPtCorrZ!=NULL)
     326        {
     327                //for(Int i=0;i<m_uiHeight;i++) delete [] m_ppiTempMvPtCorrZ[i];
     328                //delete [] m_ppiTempMvPtCorrZ;
     329                free(m_ppiTempMvPtCorrZ[0]);
     330                free(m_ppiTempMvPtCorrZ);
     331                m_ppiTempMvPtCorrZ = NULL;
     332        }
     333
     334#endif
     335
    305336#if POZNAN_DBMP & !POZNAN_DBMP_COMPRESS_ME_DATA
    306337        PUT_MP_ARRAY_TYPE** ppiTemp;
     
    439470}
    440471
     472#if !POZNAN_MP_USE_DEPTH_MAP_GENERATION && POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE
     473Void TComMP::clearTemp()
     474{
     475        if(!isInit()) return;
     476
     477        for(Int i=0;i<m_uiHeight;i++)
     478                for(Int j=0;j<m_uiWidth;j++)
     479                {
     480                        m_ppiTempMvPtCorrX[i][j] = TComMP::OCCLUSION;
     481                        m_ppiTempMvPtCorrY[i][j] = TComMP::OCCLUSION;
     482                        //m_ppiTempMvPtCorrZ[i][j] = 0x7FFF; //Depth
     483                        m_ppiTempMvPtCorrZ[i][j] = TComMP::OCCLUSION; //Disparity
     484                }
     485}
     486#endif
     487
    441488Bool TComMP::isInit()
    442489{
     
    498545        //Bool bIsLeft;
    499546        Int  iDepth;
     547#if POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE
     548        Int iSrcX, iSrcY;
     549#endif 
    500550#endif 
    501551
     
    547597        }
    548598#else
     599
     600#if POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE
     601        //pcDepthPic = GetPicFromList(m_pcDepthRefPicsList, uiPOC, uiViewId);
     602        if(pcPic->getSlice(0)->getDepthPic()!=NULL && pcPic->getSlice(0)->getDepthPic()->getReconMark())
     603                pcDepthPic = pcPic->getSlice(0)->getDepthPic();
     604        else
     605                pcDepthPic = NULL;
     606
     607        if(pcDepthPic!=NULL)
     608        {
     609          pDepth = pcDepthPic->getPicYuvRec()->getLumaAddr();
     610          iStride = pcDepthPic->getPicYuvRec()->getStride();
     611
     612          for( UInt uiIdx = 0; uiIdx < uiViewId; uiIdx++ )
     613          //for( UInt uiIdx = uiViewId-1; uiIdx >= uiViewId; uiIdx-- )
     614          {
     615            uiRefViewId = uiIdx;
     616
     617                pcRefPic = GetPicFromList(m_pcRefPicsList, uiPOC, uiRefViewId);
     618                assert(pcRefPic!=NULL);//test
     619                if(pcRefPic==NULL) return false; //No ref pic with current POC and RefView found in ref list!!!
     620
     621                if(!pcRefPic->getSlice(0)->isIntra()) bIsRefNoISliceAvailable = true;
     622                else bIsAnchorPicture = true;
     623
     624                //ppiShiftLUTLeft = m_pcCameraData->getBaseViewShiftLUTI()[uiViewId][uiRefViewId];
     625                ppiShiftLUTLeft = m_aiBaseViewShiftLUT[uiViewId][uiRefViewId];
     626
     627                clearTemp();
     628
     629                for(iCurY=0; iCurY<(Int)m_uiHeight; iCurY++)
     630                        for(iCurX=0; iCurX<(Int)m_uiWidth; iCurX++)
     631                        {
     632                                //Check if point already has its reference:
     633                                if(m_ppiMvPtCorrX[iCurY][iCurX]!=TComMP::OCCLUSION && m_ppiMvPtCorrY[iCurY][iCurX]!=TComMP::OCCLUSION) continue;
     634
     635                                iDepth = pDepth[ iCurX + iCurY * iStride ];
     636                                iDepth = RemoveBitIncrement(iDepth);
     637                                assert( iDepth >= 0 && iDepth <= 256 );                                 
     638                               
     639                                //if(bIsLeft) iDisparity = ppiShiftLUTLeft[0][iDepth];
     640                                //else iDisparity = -ppiShiftLUTLeft[0][iDepth];
     641                                iDisparity = ppiShiftLUTLeft[0][iDepth]; //!!!
     642
     643                                iRefX = iCurX - ( ( iDisparity + 2 ) >> 2 );
     644                                iRefY = iCurY;
     645
     646                                if(iRefX>=0 && iRefX<m_uiWidth && iRefY>=0 && iRefY<m_uiHeight)
     647                                {
     648                                        iSrcX = m_ppiTempMvPtCorrX[iRefY][iRefX];
     649                                        iSrcY = m_ppiTempMvPtCorrY[iRefY][iRefX];
     650
     651                                        if(iSrcX==TComMP::OCCLUSION || iSrcY==TComMP::OCCLUSION)
     652                                        {
     653                                                m_ppiMvPtCorrRefViewIdx[iCurY][iCurX] = (Short)uiRefViewId;
     654                                                m_ppiMvPtCorrX[iCurY][iCurX] = (Short)iRefX;
     655                                                m_ppiMvPtCorrY[iCurY][iCurX] = (Short)iRefY;
     656
     657                                                m_ppiMvPtCorrZ[iCurY][iCurX] = (Short)iDepth;
     658                                                //m_ppiMvPtCorrZ[iCurY][iCurX] = (Short)iDisparity;                                             
     659
     660                                                pcRefCU = pcRefPic->getCU((UInt)(iRefY/pcRefPic->getSlice(0)->getSPS()->getMaxCUHeight()*pcRefPic->getFrameWidthInCU() + iRefX/pcRefPic->getSlice(0)->getSPS()->getMaxCUWidth()));
     661
     662                                                m_pppcRefCU[iCurY][iCurX] = pcRefCU;
     663                                                m_ppuicRefPartAddr[iCurY][iCurX] = (UShort)g_auiRasterToZscan[(iRefY-pcRefCU->getCUPelY())/pcRefPic->getMinCUHeight()*pcRefPic->getNumPartInWidth()+(iRefX-pcRefCU->getCUPelX())/pcRefPic->getMinCUWidth()];
     664
     665                                                m_ppiTempMvPtCorrX[iRefY][iRefX] = iCurX;
     666                                                m_ppiTempMvPtCorrY[iRefY][iRefX] = iCurY;
     667                                                m_ppiTempMvPtCorrZ[iRefY][iRefX] = (Short)iDepth;
     668                                                //m_ppiTempMvPtCorrZ[iRefY][iRefX] = (Short)iDisparity;
     669                                        }
     670                                        else if((Short)iDepth>m_ppiTempMvPtCorrZ[iRefY][iRefX]) //Point assigned earlier to this location is occluded
     671                                        //else if((Short)iDisparity>m_ppiTempMvPtCorrZ[iRefY][iRefX]) //Point assigned earlier to this location is occluded
     672                                        {
     673                                                m_ppiMvPtCorrRefViewIdx[iCurY][iCurX] = (Short)uiRefViewId;
     674                                                m_ppiMvPtCorrX[iCurY][iCurX] = (Short)iRefX;
     675                                                m_ppiMvPtCorrY[iCurY][iCurX] = (Short)iRefY;
     676
     677                                                m_ppiMvPtCorrZ[iCurY][iCurX] = (Short)iDepth;
     678                                                //m_ppiMvPtCorrZ[iCurY][iCurX] = (Short)iDisparity;                                             
     679
     680                                                pcRefCU = pcRefPic->getCU((UInt)(iRefY/pcRefPic->getSlice(0)->getSPS()->getMaxCUHeight()*pcRefPic->getFrameWidthInCU() + iRefX/pcRefPic->getSlice(0)->getSPS()->getMaxCUWidth()));
     681
     682                                                m_pppcRefCU[iCurY][iCurX] = pcRefCU;
     683                                                m_ppuicRefPartAddr[iCurY][iCurX] = (UShort)g_auiRasterToZscan[(iRefY-pcRefCU->getCUPelY())/pcRefPic->getMinCUHeight()*pcRefPic->getNumPartInWidth()+(iRefX-pcRefCU->getCUPelX())/pcRefPic->getMinCUWidth()];
     684
     685                                                m_ppiTempMvPtCorrX[iRefY][iRefX] = iCurX;
     686                                                m_ppiTempMvPtCorrY[iRefY][iRefX] = iCurY;
     687                                                m_ppiTempMvPtCorrZ[iRefY][iRefX] = (Short)iDepth;
     688                                                //m_ppiTempMvPtCorrZ[iRefY][iRefX] = (Short)iDisparity;
     689                                               
     690                                                //Mark point assigned earlier to this location as occluded:
     691                                                m_ppiMvPtCorrRefViewIdx[iSrcY][iSrcX] = TComMP::OCCLUSION;
     692                                                m_ppiMvPtCorrX[iSrcY][iSrcX] = TComMP::OCCLUSION;
     693                                                m_ppiMvPtCorrY[iSrcY][iSrcX] = TComMP::OCCLUSION;
     694
     695                                                //m_ppiMvPtCorrZ[iSrcY][iSrcX] = 0x7FFF;
     696                                                m_ppiMvPtCorrZ[iSrcY][iSrcX] = TComMP::OCCLUSION;                                               
     697
     698                                                m_pppcRefCU[iSrcY][iSrcX] = NULL;
     699                                                m_ppuicRefPartAddr[iSrcY][iSrcX] = 0;                                           
     700                                        }
     701                                }
     702                        }
     703          }
     704        }
     705        else
     706#endif
     707        {
    549708        iSynthViewIdx = uiViewId;
    550709
     
    605764                        }
    606765        }
     766      }
    607767#endif
    608768
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComMP.h

    r28 r41  
    6969  Short** m_ppiMvPtCorrZ;
    7070  Short** m_ppiMvPtCorrRefViewIdx;
     71
     72#if !POZNAN_MP_USE_DEPTH_MAP_GENERATION && POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE
     73  Short** m_ppiTempMvPtCorrX;
     74  Short** m_ppiTempMvPtCorrY;
     75  Short** m_ppiTempMvPtCorrZ;
     76#endif
    7177
    7278  TComDataCU*** m_pppcRefCU; //XY array of pointers to reference CU for each point of picture
     
    117123  //Void                        init(UInt uiHeight, UInt uiWidth, TAppComCamPara* pcCameraData);
    118124  Void                  init(UInt uiHeight, UInt uiWidth, Int**** aiBaseViewShiftLUT);
     125#if POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE
     126  Void                  clearTemp();
     127#endif
    119128#endif
    120129  Void                  uninit();
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicYuv.cpp

    r28 r41  
    457457}
    458458#if POZNAN_NONLINEAR_DEPTH
    459 Void TComPicYuv::nonlinearDepthForward(TComPicYuv *pcPicDst, Float p)
    460 {
    461   Int           x,y;
    462   TComNonlinearDepthForward cNonlinearDepthFwd(p, g_uiBitIncrement, g_uiBitIncrement);
     459Void TComPicYuv::nonlinearDepthForward(TComPicYuv *pcPicDst, TComNonlinearDepthModel &rcNonlinearDepthModel)
     460{
     461  Int           x,y,i;
     462  Int   LUT[256];
     463
     464  for (i=0; i<256; ++i)
     465    LUT[i] = (Int)rcNonlinearDepthModel.ForwardI(i, 1<<g_uiBitIncrement);
    463466
    464467  // Luma
     
    469472    for(x=0; x<m_iPicWidth; x++)
    470473    {
    471       pPelDst[x] = (Pel)( cNonlinearDepthFwd(pPelSrc[x]) + 0.5);
     474      pPelDst[x] = LUT[RemoveBitIncrement(pPelSrc[x])];
    472475    }
    473476    pPelDst += pcPicDst->getStride();
     
    478481  copyToPicCr(pcPicDst);
    479482}
    480 Void TComPicYuv::nonlinearDepthBackward(TComPicYuv *pcPicDst, Float p)
    481 {
    482   Int           x,y;
    483   TComNonlinearDepthBackward cNonlinearDepthBwd(p, g_uiBitIncrement, g_uiBitIncrement);
     483
     484Void TComPicYuv::nonlinearDepthBackward(TComPicYuv *pcPicDst, TComNonlinearDepthModel &rcNonlinearDepthModel)
     485{
     486  Int   x,y,i;
     487  Int   LUT[256];
     488
     489  for (i=255; i>=0; --i)
     490    LUT[i] = (Int)rcNonlinearDepthModel.BackwardI(i, 1<<g_uiBitIncrement ); // +0.5;
    484491
    485492  // Luma
     
    490497    for(x=0; x<m_iPicWidth; x++)
    491498    {
    492       pPelDst[x] = (Pel)( cNonlinearDepthBwd(pPelSrc[x]) + 0.5);
     499      pPelDst[x] = LUT[RemoveBitIncrement(pPelSrc[x])];
    493500    }
    494501    pPelDst += pcPicDst->getStride();
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicYuv.h

    r28 r41  
    4444#include "CommonDef.h"
    4545
    46 #if POZNAN_NONLINEAR_DEPTH
    47 
    48 #include <math.h>
    49 
    50 class TComNonlinearDepthForward // OLGIERD - Z-NL-Power conversion
    51 {
    52 private:
    53   Double m_fMul;
    54   Float m_fPower;
    55 
    56 public:
    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 
    73 class TComNonlinearDepthBackward // OLGIERD - Z-NL-Power conversion
    74 {
    75 private:
    76   Double m_fMul;
    77   Float m_fPower;
    78 
    79 public:
    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
    9646// ====================================================================================================================
    9747// Class definition
     
    226176
    227177#if POZNAN_NONLINEAR_DEPTH
    228   Void nonlinearDepthForward(TComPicYuv *pcPicDst, Float p);
    229   Void nonlinearDepthBackward(TComPicYuv *pcPicDst, Float p);
     178  Void nonlinearDepthForward(TComPicYuv *pcPicDst, TComNonlinearDepthModel &rcNonlinearDepthModel);
     179  Void nonlinearDepthBackward(TComPicYuv *pcPicDst, TComNonlinearDepthModel &rcNonlinearDepthModel);
    230180#endif
    231181};// END CLASS DEFINITION TComPicYuv
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPrediction.cpp

    r28 r41  
    16391639  TComMv          mv0_2nd,mv1_2nd;
    16401640
     1641#if DEPTH_MAP_GENERATION
     1642  Int             ref_frame0_idx_1st, ref_frame1_idx_1st;
     1643  TComMv          mv0_1st,mv1_1st;
     1644#endif
     1645
    16411646  Pel* piDstCb;
    16421647  Pel* piDstCr;
     
    16841689      iWidth  >>= uiSubSampExpX;
    16851690      iHeight >>= uiSubSampExpY;
     1691
     1692      //save orginal motion field of CU (it will be overwritten during the motion compensation)
     1693      ref_frame0_idx_1st = pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr);
     1694      mv0_1st = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     1695
     1696      ref_frame1_idx_1st = pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr);
     1697      mv1_1st = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr );
    16861698    }
    16871699#endif
     
    18041816
    18051817        //set motion data representing CU with DBMP
     1818        PartSize ePartSize = pcCU->getPartitionSize( uiPartAddr ); //PartSize ePartSize = pcCU->getPartitionSize( 0 );
    18061819#if DEPTH_MAP_GENERATION
    18071820        if( !bPrdDepthMap )
    18081821#endif
    18091822        {
    1810                 PartSize ePartSize = pcCU->getPartitionSize( uiPartAddr ); //PartSize ePartSize = pcCU->getPartitionSize( 0 );
    18111823#if POZNAN_DBMP_CALC_PRED_DATA
    18121824                pcMP->xCalcDBMPPredData(uiPointCnt, ref_frame0_idx, mv0, ref_frame1_idx, mv1);
     
    18191831#endif
    18201832        }
     1833
     1834#if DEPTH_MAP_GENERATION
     1835        if( bPrdDepthMap )
     1836        {
     1837                pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( mv0_1st, ref_frame0_idx_1st, ePartSize, uiPartAddr, iPartIdx, 0 );
     1838                pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( mv1_1st, ref_frame1_idx_1st, ePartSize, uiPartAddr, iPartIdx, 0 );
     1839        }
     1840#endif
    18211841
    18221842        if ( iPartIdxOrg >= 0 ) break;
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.cpp

    r28 r41  
    8585  ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) );
    8686  m_pcTexturePic = NULL;
     87  m_pcDepthPic = NULL;
    8788#ifdef WEIGHT_PRED
    8889  resetWpScaling(m_weightPredTable);
     
    113114  ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
    114115  m_pcTexturePic = NULL;
     116  m_pcDepthPic = NULL;
    115117 
    116118  initEqualRef();
     
    703705  m_bUseDMM = false;
    704706#endif
     707#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
     708  m_bUseDMM34 = false;
     709#endif
    705710}
    706711
     
    747752  }
    748753#if POZNAN_NONLINEAR_DEPTH
    749   m_fDepthPower = 1.0;
     754  m_cNonlinearDepthModel.Clear();
    750755#endif
    751756#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     
    768773  ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) );
    769774#if POZNAN_NONLINEAR_DEPTH
    770   m_fDepthPower = 1.0;
     775  m_cNonlinearDepthModel.Clear();
    771776#endif
    772777}
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.h

    r28 r41  
    139139  Bool  m_bUseDMM;
    140140#endif
     141#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
     142  Bool  m_bUseDMM34;
     143#endif
    141144
    142145#if DEPTH_MAP_GENERATION
     
    169172
    170173#if POZNAN_NONLINEAR_DEPTH
    171   Float  m_fDepthPower;
     174  TComNonlinearDepthModel m_cNonlinearDepthModel;   
     175  Bool  m_bUseNonlinearDepth;
    172176#endif
    173177
     
    258262  Void setUseDMM( Bool b ) { m_bUseDMM = b;    }
    259263#endif
    260 
     264#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
     265  Bool getUseDMM34()         { return m_bUseDMM34; }
     266  Void setUseDMM34( Bool b ) { m_bUseDMM34 = b;    }
     267#endif
    261268
    262269#if DCM_COMB_LIST
     
    295302  Void setUseSAO                  (Bool bVal)  {m_bUseSAO = bVal;}
    296303#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU //todo fix SAO
    297   Bool getUseSAO     ()         { return (getViewId()>0)?false:m_bUseSAO;}
     304  Bool getUseSAO     ()           { return (getUseCUSkip() && getViewId()>0)?false:m_bUseSAO;}
    298305#else
    299306  Bool getUseSAO                  ()           {return m_bUseSAO;}
     
    354361#endif
    355362#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;}
     363  inline Void                            setNonlinearDepthModel( TComNonlinearDepthModel &rp ){ m_cNonlinearDepthModel = rp; }
     364  inline TComNonlinearDepthModel&        getNonlinearDepthModel()                             { return m_cNonlinearDepthModel; }
     365  Bool                    getUseNonlinearDepth()                                              { return m_bUseNonlinearDepth; }
     366  Void                    setUseNonlinearDepth( Bool bVal )                                   { m_bUseNonlinearDepth = bVal; }
    360367#endif
    361368#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     
    459466  Int         m_iDepth;
    460467  TComPic*    m_pcTexturePic;
     468  TComPic*    m_pcDepthPic;
    461469
    462470  // referenced slice?
     
    664672
    665673  Void setTexturePic( TComPic *pcTexturePic ) { m_pcTexturePic = pcTexturePic; }
     674  Void setDepthPic  ( TComPic *pcDepthPic   ) { m_pcDepthPic   = pcDepthPic;   }
    666675  TComPic *getTexturePic() const { return m_pcTexturePic; }
     676  TComPic *getDepthPic()   const { return m_pcDepthPic; }
    667677
    668678#ifdef WEIGHT_PRED
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TypeDef.h

    r28 r41  
    4040
    4141
    42 
    43 #define SONY_COLPIC_AVAILABILITY                  1
     42#define FLEX_CODING_ORDER               1
     43
     44#define SONY_COLPIC_AVAILABILITY        1
    4445
    4546//>>>>> HHI 3DV tools >>>>>
     
    8384#define POZNAN_CU_SKIP_PSNR         1 //Poznan Cu Skip Display psnr of the codded CUs only
    8485
    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
     86#define POZNAN_NONLINEAR_DEPTH              1    /// Non-linear depth processing
     87#define POZNAN_NONLINEAR_DEPTH_THRESHOLD    1  /// Non-linear depth thrasholding
    8788
    8889#if POZNAN_SYNTH
     
    106107                                                                                                                                        //                      POZNAN_MP_USE_DEPTH_MAP_GENERATION=1 - use DEPTH_MAP_GENERATION,
    107108                                                                                                                                        //                      POZNAN_MP_USE_DEPTH_MAP_GENERATION=0 - use reconstructed depth maps from neighboring views
     109
     110#if !POZNAN_MP_USE_DEPTH_MAP_GENERATION
     111#define POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 1 // Depth-Based Multiview Prediction of CU parameters will use depth picture of current view if this picture is available, otherwise reference view depth is utilized
     112#endif
    108113
    109114#define POZNAN_MP_FILL                             1    // Depth-Based Multiview Prediction of CU parameters with fill option for occluded areas
     
    407412typedef       unsigned long       ULong;
    408413typedef       double              Double;
    409 typedef       float               Float;
    410414
    411415// ====================================================================================================================
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r28 r41  
    238238#endif
    239239#if POZNAN_DBMP
    240           xReadFlag( uiCode );
    241           pcSPS->setDBMP  ( uiCode );
     240  xReadFlag( uiCode ); pcSPS->setDBMP  ( uiCode );
    242241#endif
    243242#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
    244           xReadFlag( uiCode );
    245           pcSPS->setUseCUSkip ( uiCode );
     243  xReadFlag( uiCode ); pcSPS->setUseCUSkip ( uiCode );
    246244#endif
    247245  xReadFlag( uiCode ); // SPS base view flag
     
    279277#endif
    280278#if POZNAN_NONLINEAR_DEPTH
    281 #if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE
    282       uiCode = 0;
    283       xReadCode(8, uiCode);
    284       pcSPS->setDepthPower(dequantizeDepthPower(uiCode));
    285 #else
    286       uiCode = 0;
    287       xReadCode(sizeof(float)*8, uiCode); // We do not send seign
    288       //uiCode &= ~0x80000000;
    289       pcSPS->setDepthPower(*((float*)&uiCode)); 
    290 #endif
    291       printf("\nfDepthPower = %f", pcSPS->getDepthPower());
     279      xReadFlag( uiCode );
     280      pcSPS->setUseNonlinearDepth( uiCode ? true : false );
     281      pcSPS->getNonlinearDepthModel().Clear();
     282      if( uiCode )
     283      {
     284        uiCode = 0; //Owieczka Necessary??
     285        xReadUvlc( uiCode );
     286        int num = pcSPS->getNonlinearDepthModel().m_iNum = uiCode;
     287        for (int i=1; i<=num; ++i)
     288        {
     289          uiCode = 0;
     290          xReadUvlc( uiCode );
     291          pcSPS->getNonlinearDepthModel().m_aiPoints[i] = uiCode;     
     292        }
     293        pcSPS->getNonlinearDepthModel().m_aiPoints[0] = 0;
     294        pcSPS->getNonlinearDepthModel().m_aiPoints[num+1] = 0;
     295        pcSPS->getNonlinearDepthModel().Init();
     296      }
    292297#endif
    293298    }
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.cpp

    r28 r41  
    9090  m_uiMaxViewId             = 0;
    9191#if POZNAN_NONLINEAR_DEPTH
    92   m_fDepthPower             = 1.0;
     92  m_cNonlinearDepthModel.Clear();
     93  m_bUseNonlinearDepth      = false;
    9394#endif
    9495}
     
    140141  Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );
    141142
     143
     144  for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
     145  {
     146
     147    // real-valued look-up tables
    142148#if POZNAN_NONLINEAR_DEPTH
    143   TComNonlinearDepthBackward cNonlinearDepthBwd(m_fDepthPower, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0);
    144 #endif
    145 
    146   for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
    147   {
    148     Double  dDepthValue = (Double)uiDepthValue;
    149     Int64   iDepthValue = (Int64)uiDepthValue;
    150 #if POZNAN_NONLINEAR_DEPTH
    151     dDepthValue = cNonlinearDepthBwd(dDepthValue);
    152     iDepthValue = (Int64)(dDepthValue+0.5);
    153 #endif
    154 #if POZNAN_LUT_INCREASED_PRECISION
    155     dDepthValue /= (1<<g_uiBitIncrement);
    156 #endif
    157 
    158     // real-valued look-up tables
    159     Double  dShiftLuma      = ( dDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     149    Double  dShiftLuma;
     150    if( m_bUseNonlinearDepth )
     151      dShiftLuma      = ( m_cNonlinearDepthModel.BackwardD( (Double)uiDepthValue, dScale) + dOffset ) * Double( 1 << m_iLog2Precision );
     152    else
     153      dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     154#else
     155    Double  dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     156#endif
    160157    Double  dShiftChroma    = dShiftLuma / 2;
    161158    radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
     
    163160
    164161    // integer-valued look-up tables
    165     Int64   iTempScale      = iDepthValue * iScale;
    166 #if POZNAN_LUT_INCREASED_PRECISION
    167     iTempScale >>= g_uiBitIncrement;
     162#if POZNAN_NONLINEAR_DEPTH
     163    Int64   iTempScale;
     164    if( m_bUseNonlinearDepth )
     165      iTempScale      = (Int64)m_cNonlinearDepthModel.BackwardI(uiDepthValue, iScale);
     166    else
     167      iTempScale      = (Int64)uiDepthValue * iScale;
     168#else
     169    Int64   iTempScale      = (Int64)uiDepthValue * iScale;
    168170#endif
    169171    Int64   iTestScale      = ( iTempScale + iOffset       );   // for checking accuracy of camera parameters
     
    233235  {
    234236#if POZNAN_NONLINEAR_DEPTH
    235     m_fDepthPower = pcSlice->getSPS()->getDepthPower();
     237    m_bUseNonlinearDepth = pcSlice->getSPS()->getUseNonlinearDepth();
     238    m_cNonlinearDepthModel = pcSlice->getSPS()->getNonlinearDepthModel();   
    236239#endif
    237240    return;
     
    240243  {
    241244#if POZNAN_NONLINEAR_DEPTH
    242     pcSlice->getSPS()->setDepthPower(m_fDepthPower); // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS.
     245    pcSlice->getSPS()->setUseNonlinearDepth(m_bUseNonlinearDepth);
     246    pcSlice->getSPS()->setNonlinearDepthModel(m_cNonlinearDepthModel); // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS.
    243247#endif
    244248  }
     
    684688
    685689#if DCM_SKIP_DECODING_FRAMES
     690#if FLEX_CODING_ORDER
     691Bool TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame,  Int& iPOCLastDisplay, Bool& bNewPictureType)
     692#else
    686693Bool TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame,  Int& iPOCLastDisplay)
     694#endif
    687695#else
    688696Void TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS )
     
    712720      TComSPS cTempSPS;
    713721      m_cEntropyDecoder.decodeSPS( &cTempSPS );
     722#if FLEX_CODING_ORDER
     723      m_cNewSPS = cTempSPS;
     724#endif
    714725
    715726      if( (m_iViewIdx == cTempSPS.getViewId()) && ( m_bIsDepth == cTempSPS.isDepth() ) )
     
    724735        if(!cTempSPS.isDepth() && cTempSPS.getViewId())
    725736        {
    726           Float fDepthPower = getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getDepthPower();
    727           cTempSPS.setDepthPower(fDepthPower);
     737          cTempSPS.setUseNonlinearDepth(getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getUseNonlinearDepth());
     738          cTempSPS.setNonlinearDepthModel(getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getNonlinearDepthModel());
    728739        }
    729740#endif
     
    802813      {
    803814        m_uiPrevPOC = m_apcSlicePilot->getPOC();
     815#if FLEX_CODING_ORDER
     816        bNewPictureType = m_cNewSPS.isDepth();
     817#endif
    804818        return true;
    805819      }
     
    887901        // Set reference list
    888902        std::vector<TComPic*> apcSpatRefPics = getDecTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_cSPS.isDepth() );
    889         TComPic * const pcTexturePic = m_cSPS.isDepth() ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL;
     903        TComPic * const pcTexturePic = ( m_cSPS.isDepth()) ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL;
     904        TComPic * const pcDepthPic   = (!m_cSPS.isDepth()) ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), true  ) : NULL;
     905#if FLEX_CODING_ORDER
     906        if (pcTexturePic != NULL)
     907        {
     908          assert( ! m_cSPS.isDepth() || pcTexturePic != NULL );
     909          pcSlice->setTexturePic( pcTexturePic );
     910        }
     911        if (pcDepthPic != NULL)
     912        {
     913          assert(   m_cSPS.isDepth() || pcDepthPic != NULL );
     914          pcSlice->setDepthPic( pcDepthPic );
     915        }
     916#else
    890917        assert( ! m_cSPS.isDepth() || pcTexturePic != NULL );
    891918        pcSlice->setTexturePic( pcTexturePic );
     919        pcSlice->setDepthPic( pcDepthPic );
    892920        pcSlice->setViewIdx( pcPic->getViewIdx() );
     921#endif
    893922#if SONY_COLPIC_AVAILABILITY
    894923        pcSlice->setViewOrderIdx( pcPic->getViewOrderIdx() );
     
    949978      //*
    950979#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     980#if FLEX_CODING_ORDER
     981      Bool bHaveReconDepth = (pcSlice->getDepthPic() != NULL) && (pcSlice->getDepthPic()->getReconMark());
     982      if(!getIsDepth() && pcSlice->getSPS()->getUseTexDqpAccordingToDepth() && !bHaveReconDepth )
     983#else
    951984      if(!getIsDepth() && pcSlice->getSPS()->getUseTexDqpAccordingToDepth())
     985#endif
    952986      {
    953987        getDecTop()->storeDepthSynthPicsInBuffer(pcSlice->getViewIdx(),pcSlice->getSPS()->getViewOrderIdx(),pcSlice->getPOC());
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.h

    r28 r41  
    121121#endif
    122122#if POZNAN_NONLINEAR_DEPTH
    123   Float               m_fDepthPower;
     123  TComNonlinearDepthModel m_cNonlinearDepthModel;
     124  Bool m_bUseNonlinearDepth;
    124125#endif
    125126
     
    205206  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
    206207  TComSPS                 m_cSPS;
     208#if FLEX_CODING_ORDER
     209  TComSPS                 m_cNewSPS;
     210#endif
    207211  TComPPS                 m_cPPS;
    208212  TComSlice*              m_apcSlicePilot;
     
    265269  Void  init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance = true );
    266270#if DCM_SKIP_DECODING_FRAMES
     271#if FLEX_CODING_ORDER
     272  Bool  decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay, Bool& bNewPictureType);
     273#else
    267274  Bool  decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay);
     275#endif
    268276#else
    269277  Void  decode ( Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS );
  • branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCavlc.cpp

    r28 r41  
    348348#endif
    349349#if POZNAN_NONLINEAR_DEPTH
    350       // Depth power coefficient
    351 #if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE
    352       UInt  uiCode = quantizeDepthPower(pcSPS->getDepthPower()); 
    353       xWriteCode(uiCode, 8);
    354 #else
    355       float fCode  = pcSPS->getDepthPower();
    356       UInt  uiCode = *((UInt*)&fCode);
    357       //uiCode &= ~0x80000000;
    358       xWriteCode(uiCode, sizeof(float)*8); // we do not send sign?;
    359 #endif
     350      if( pcSPS->getUseNonlinearDepth() )
     351      {
     352        xWriteFlag( 1 ); //Nonlinear Depth Representation
     353        // Nonlinear Depth Model coefficient
     354        xWriteUvlc(pcSPS->getNonlinearDepthModel().m_iNum);
     355        for (int i=1; i<=pcSPS->getNonlinearDepthModel().m_iNum; ++i)
     356          xWriteUvlc(pcSPS->getNonlinearDepthModel().m_aiPoints[i]);
     357      }
     358      else
     359      {
     360        xWriteFlag( 0 ); // Don't use Nonlinear Depth Representation
     361      }
    360362#endif
    361363    }
  • branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCfg.h

    r28 r41  
    159159  Bool m_bUseDMM;
    160160#endif
     161#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
     162  Bool m_bUseDMM34;
     163#endif
    161164#if HHI_MPI
    162165  Bool m_bUseMVI;
     
    232235#endif
    233236#if POZNAN_NONLINEAR_DEPTH
    234   Float         m_fDepthPower;
     237  TComNonlinearDepthModel  m_cNonlinearDepthModel;
     238  Bool        m_bUseNonlinearDepth;
    235239#endif
    236240
     
    335339
    336340#if POZNAN_NONLINEAR_DEPTH
    337   inline Float   getDepthPower()               { return m_fDepthPower; }
    338   inline Void    setDepthPower(Float p)        { m_fDepthPower = p; }
    339 #else
    340  inline Float    getDepthPower()               { return 1.0f; }
     341  inline TComNonlinearDepthModel&   getNonlinearDepthModel()                                    { return m_cNonlinearDepthModel; }
     342  inline Void                       setNonlinearDepthModel( TComNonlinearDepthModel &rp )       { m_cNonlinearDepthModel = rp; }
     343
     344  Void                              setUseNonlinearDepth  ( Bool bVal )                         { m_bUseNonlinearDepth = bVal; }
     345  bool                              getUseNonlinearDepth  ()                                    { return m_bUseNonlinearDepth; }
    341346#endif
    342347
     
    457462  Bool getUseDMM()        { return m_bUseDMM; }
    458463#endif
    459 
     464#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
     465  Void setUseDMM34( Bool b) { m_bUseDMM34 = b;    }
     466  Bool getUseDMM34()        { return m_bUseDMM34; }
     467#endif
    460468#if LM_CHROMA
    461469  Bool getUseLMChroma                       ()      { return m_bUseLMChroma;        }
  • branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncGOP.cpp

    r28 r41  
    175175// GT FIX
    176176  std::vector<TComPic*> apcSpatRefPics = m_pcEncTop->getEncTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_pcEncTop->isDepthCoder() );
    177   TComPic * const pcTexturePic = m_pcEncTop->isDepthCoder() ? m_pcEncTop->getEncTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL;
     177  TComPic * const pcTexturePic = ( m_pcEncTop->isDepthCoder()) ? m_pcEncTop->getEncTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL;
     178  TComPic * const pcDepthPic   = (!m_pcEncTop->isDepthCoder()) ? m_pcEncTop->getEncTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), true  ) : NULL;
    178179  assert( ! m_pcEncTop->isDepthCoder() || pcTexturePic != NULL );
     180  assert(   m_pcEncTop->isDepthCoder() || pcDepthPic   != NULL );
    179181  pcSlice->setTexturePic( pcTexturePic );
     182  pcSlice->setDepthPic  ( pcDepthPic   );
    180183
    181184  pcSlice->setRefPicListFromGOPSTring( rcListPic, apcSpatRefPics );
  • branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSbac.cpp

    r28 r41  
    11781178#endif
    11791179#if HHI_DMM_PRED_TEX
     1180#if FLEX_CODING_ORDER
     1181    if ( !pcCU->getSlice()->getSPS()->getUseDMM34() )
     1182    {
     1183      assert( uiDir != DMM_WEDGE_PREDTEX_D_IDX );
     1184      assert( uiDir != DMM_CONTOUR_PREDTEX_D_IDX );
     1185    }
     1186#endif
    11801187    if( uiDir == DMM_WEDGE_PREDTEX_D_IDX )     { xCodeWedgePredTexDeltaInfo  ( pcCU, uiAbsPartIdx ); }
    11811188    if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX )   { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); }
  • branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.cpp

    r28 r41  
    19341934#endif
    19351935#if HHI_DMM_PRED_TEX
     1936#if FLEX_CODING_ORDER
     1937      if ( pcCU->getSlice()->getSPS()->getUseDMM34() )
     1938      {
     1939#endif
    19361940      TComYuv cTempYuv; cTempYuv.create( uiWidth, uiHeight ); cTempYuv.clear();
    19371941      Pel* piTempY      = cTempYuv.getLumaAddr();
     
    19681972
    19691973      cTempYuv.destroy();
     1974#if FLEX_CODING_ORDER
     1975      }
     1976#endif
    19701977#endif
    19711978    }
     
    19962003#else
    19972004#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     2005#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
     2006      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getUseDMM34() ) )
     2007#else
    19982008      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) )
     2009#endif
    19992010        continue;
    20002011#endif
     
    20842095#else
    20852096#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     2097#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
     2098      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getUseDMM34() ) )
     2099#else
    20862100      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) )
     2101#endif
    20872102        continue;
    20882103#endif
     
    27272742}
    27282743
     2744#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
     2745Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight, Bool bDMMAvailable34 )
     2746#else
    27292747Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight )
     2748#endif
    27302749{
    27312750  if( uiMode <= MAX_MODE_ID_INTRA_DIR ) return true;
     
    27552774      bDMMAvailable = false;
    27562775    }
     2776#if FLEX_CODING_ORDER
     2777    if ( !bDMMAvailable34 )
     2778    {
     2779      bDMMAvailable = false;
     2780    }
     2781#endif
    27572782  }
    27582783
  • branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.h

    r28 r41  
    210210  Bool predIntraLumaDMMAvailable( UInt         uiMode,
    211211                                  UInt         uiWidth,
     212#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
     213                                  UInt         uiHeight,
     214                                  Bool         bDMMAvailable34 );
     215#else
    212216                                  UInt         uiHeight );
     217#endif
    213218#endif
    214219#if HHI_DMM_WEDGE_INTRA
  • branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncTop.cpp

    r28 r41  
    304304
    305305  bool bSomethingCoded = false ;
    306 
     306#if FLEX_CODING_ORDER 
     307  if (TEncTop::m_bPicWaitingForCoding )
     308#else
    307309  if (m_bPicWaitingForCoding )
     310#endif
    308311  {
    309312    std::map<Int, TComPic*>::iterator cIter = m_acInputPicMap.find( (Int)m_cSeqIter.getPoc() );
     
    659662#endif
    660663
    661 #if POZNAN_NONLINEAR_DEPTH
    662   m_cSPS.setDepthPower  ( m_fDepthPower );
    663   // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS.
     664#if POZNAN_NONLINEAR_DEPTH
     665  m_cSPS.setNonlinearDepthModel  ( m_cNonlinearDepthModel );
     666  m_cSPS.setUseNonlinearDepth    ( m_bUseNonlinearDepth );
     667  // OLGIERD: ToDo - QP-Tex should not use getNonlinearDepthModel() from texture SPS.
    664668#endif
    665669
  • branches/0.3-poznan-univ/source/Lib/TLibRenderer/TRenSingleModel.cpp

    r28 r41  
    448448      m_iLastOccludedSPosFP = xRangeLeftL( m_iLastOccludedSPos );
    449449      xExtrapolateMarginL  ( iCurSPos, iEndChangePos, iError );
    450       iMinChangedSPos       = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrementLUT( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iEndChangePos], m_piNewDepthData[iPosXinNewData] )) ]);
     450      iMinChangedSPos       = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iEndChangePos], m_piNewDepthData[iPosXinNewData] )) ]);
    451451      iLastSPos             = iCurSPos;
    452452      m_iLastDepth          = m_iCurDepth;
     
    466466    {
    467467      // Get minimal changed sample position
    468       iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrementLUT( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);
     468      iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);
    469469      Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
    470470      m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
     
    541541      m_iLastOccludedSPosFP = xRangeRightR( m_iLastOccludedSPos );
    542542      xExtrapolateMarginR     ( iCurSPos, iStartChangePos, iError );
    543       iMaxChangedSPos       = Max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrementLUT( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iStartChangePos], m_piNewDepthData[iPosXinNewData] )) ]);
     543      iMaxChangedSPos       = Max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iStartChangePos], m_piNewDepthData[iPosXinNewData] )) ]);
    544544      iLastSPos             = iCurSPos;
    545545      m_iLastDepth          = m_iCurDepth;
     
    559559    {
    560560      // Get minimal changed sample position
    561       iMaxChangedSPos = Max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrementLUT( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);
     561      iMaxChangedSPos = Max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);
    562562      Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
    563563      m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
     
    948948  AOF( iPosInNewData < m_iNewDataWidth );
    949949
    950   return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrementLUT( m_piNewDepthData[iPosInNewData] )];
     950  return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( m_piNewDepthData[iPosInNewData] )];
    951951}
    952952
     
    956956 AOT( iPosX <        0);
    957957 AOF( iPosX < m_iWidth);
    958  return (iPosX  << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrementLUT( m_apiBaseDepthPelRow[m_iCurViewPos][iPosX] )];
     958 return (iPosX  << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( m_apiBaseDepthPelRow[m_iCurViewPos][iPosX] )];
    959959}
    960960
     
    11491149      m_aapiSynthVideoPelRow                                   [1][2][iTargetSPos]  ,
    11501150#endif
    1151       m_piInvZLUTLeft [RemoveBitIncrementLUT(m_iThisDepth)                            ],
    1152       m_piInvZLUTRight[RemoveBitIncrementLUT(m_apiSynthDepthPelRow[1]   [iTargetSPos])],
     1151      m_piInvZLUTLeft [RemoveBitIncrement(m_iThisDepth)                            ],
     1152      m_piInvZLUTRight[RemoveBitIncrement(m_apiSynthDepthPelRow[1]   [iTargetSPos])],
    11531153      iFilled,
    11541154      m_apiFilledRow                                           [1]   [iTargetSPos]  ,
     
    11711171      m_aapiBaseVideoPelRow                                    [1][2][iSourcePos ],
    11721172#endif
    1173       m_piInvZLUTLeft [RemoveBitIncrementLUT(m_apiSynthDepthPelRow[0]   [iTargetSPos])],
    1174       m_piInvZLUTRight[RemoveBitIncrementLUT(m_iThisDepth)                            ],
     1173      m_piInvZLUTLeft [RemoveBitIncrement(m_apiSynthDepthPelRow[0]   [iTargetSPos])],
     1174      m_piInvZLUTRight[RemoveBitIncrement(m_iThisDepth)                            ],
    11751175      m_apiFilledRow                                           [0]   [iTargetSPos],
    11761176      iFilled                                                                     ,
  • branches/0.3-poznan-univ/source/Lib/TLibRenderer/TRenTop.cpp

    r28 r41  
    498498
    499499      // compute disparity and shift
    500       iShiftedPos  = ( iPosX << m_iRelShiftLUTPrec ) - m_aiShiftLUTCur[RemoveBitIncrementLUT( pcDepthData[iPosX])];
     500      iShiftedPos  = ( iPosX << m_iRelShiftLUTPrec ) - m_aiShiftLUTCur[RemoveBitIncrement( pcDepthData[iPosX])];
    501501
    502502      if (iPosX == 0)
     
    652652
    653653        // compute disparity and shift
    654         assert( RemoveBitIncrementLUT(pcDepthData[iPosX]) >= 0 && RemoveBitIncrementLUT(pcDepthData[iPosX]) <= SizeOfLUT );
    655         dPrevShiftedPos  = (Double) iPosX - m_adShiftLUTCur[ RemoveBitIncrementLUT(pcDepthData[iPosX])];
     654        assert( RemoveBitIncrement(pcDepthData[iPosX]) >= 0 && RemoveBitIncrement(pcDepthData[iPosX]) <= SizeOfLUT );
     655        dPrevShiftedPos  = (Double) iPosX - m_adShiftLUTCur[ RemoveBitIncrement(pcDepthData[iPosX])];
    656656
    657657        if (iPosX == 0)
     
    833833    for(Int iPosX = 0; iPosX < iWidth; iPosX++)
    834834    {
    835       assert( RemoveBitIncrementLUT(pcDepthData[iPosX]) >= 0 && RemoveBitIncrementLUT(pcDepthData[iPosX]) <= SizeOfLUT );
    836       Int iShiftedPos = iPosX - m_aiShiftLUTCur[ RemoveBitIncrementLUT(pcDepthData[iPosX])] ;
     835      assert( RemoveBitIncrement(pcDepthData[iPosX]) >= 0 && RemoveBitIncrement(pcDepthData[iPosX]) <= SizeOfLUT );
     836      Int iShiftedPos = iPosX - m_aiShiftLUTCur[ RemoveBitIncrement(pcDepthData[iPosX])] ;
    837837      if (iShiftedPos < iWidth && iShiftedPos >= 0)
    838838      {
     
    908908    for(Int iPosX = 0; iPosX < iOutputWidth; iPosX ++)
    909909    {
    910       Int iBackShiftedPos = (iPosX << m_iRelShiftLUTPrec) - m_aiShiftLUTCur[ RemoveBitIncrementLUT( pcDepthData[iPosX] )];
     910      Int iBackShiftedPos = (iPosX << m_iRelShiftLUTPrec) - m_aiShiftLUTCur[ RemoveBitIncrement( pcDepthData[iPosX] )];
    911911      if( ( pcFilledData[iPosX] == REN_IS_FILLED )  && (iBackShiftedPos >= 0 ) && ( iBackShiftedPos < iInputWidth ) )
    912912      {
     
    981981    {
    982982      // compute disparity and shift
    983       iShiftedPos  =  iPosX - m_aiShiftLUTCur[RemoveBitIncrementLUT(pcDepthData[iPosX])];
     983      iShiftedPos  =  iPosX - m_aiShiftLUTCur[RemoveBitIncrement(pcDepthData[iPosX])];
    984984
    985985      if ( iPosX == 0 )
     
    18661866        if      (  (pcFilledRightData[uiXPos] != REN_IS_HOLE ) && ( pcFilledLeftData[uiXPos] != REN_IS_HOLE) )
    18671867        {
    1868           Int iDepthDifference  = m_piInvZLUTLeft[RemoveBitIncrementLUT(pcLeftDepthData[uiXPos])] - m_piInvZLUTRight[RemoveBitIncrementLUT(pcRightDepthData[uiXPos])];
     1868          Int iDepthDifference  = m_piInvZLUTLeft[RemoveBitIncrement(pcLeftDepthData[uiXPos])] - m_piInvZLUTRight[RemoveBitIncrement(pcRightDepthData[uiXPos])];
    18691869
    18701870          if ( abs ( iDepthDifference ) <= m_iBlendZThres )
     
    18951895        else if ( (pcFilledRightData[uiXPos] == REN_IS_HOLE) && (pcFilledLeftData[uiXPos] == REN_IS_HOLE))
    18961896        {
    1897           pcOutputData[uiXPos] = m_piInvZLUTLeft[RemoveBitIncrementLUT( pcLeftDepthData[uiXPos])]  < m_piInvZLUTRight[RemoveBitIncrementLUT(pcRightDepthData[uiXPos])] ? pcLeftVideoData[uiXPos] : pcRightVideoData[uiXPos];
     1897          pcOutputData[uiXPos] = m_piInvZLUTLeft[RemoveBitIncrement( pcLeftDepthData[uiXPos])]  < m_piInvZLUTRight[RemoveBitIncrement(pcRightDepthData[uiXPos])] ? pcLeftVideoData[uiXPos] : pcRightVideoData[uiXPos];
    18981898        }
    18991899        else
Note: See TracChangeset for help on using the changeset viewer.