Changeset 5 in 3DVCSoftware for trunk/source/Lib/TLibRenderer/TRenTop.cpp


Ignore:
Timestamp:
12 Dec 2011, 18:35:44 (13 years ago)
Author:
hhi
Message:

Clean version with cfg-files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibRenderer/TRenTop.cpp

    r2 r5  
     1/* The copyright in this software is being made available under the BSD
     2 * License, included below. This software may be subject to other third party
     3 * and contributor rights, including patent rights, and no such rights are
     4 * granted under this license.
     5 *
     6 * Copyright (c) 2010-2011, ISO/IEC
     7 * All rights reserved.
     8 *
     9 * Redistribution and use in source and binary forms, with or without
     10 * modification, are permitted provided that the following conditions are met:
     11 *
     12 *  * Redistributions of source code must retain the above copyright notice,
     13 *    this list of conditions and the following disclaimer.
     14 *  * Redistributions in binary form must reproduce the above copyright notice,
     15 *    this list of conditions and the following disclaimer in the documentation
     16 *    and/or other materials provided with the distribution.
     17 *  * Neither the name of the ISO/IEC nor the names of its contributors may
     18 *    be used to endorse or promote products derived from this software without
     19 *    specific prior written permission.
     20 *
     21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
     25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     31 * THE POSSIBILITY OF SUCH DAMAGE.
     32 */
     33
    134
    235#include "TRenImage.h"
     
    879912Void TRenTop::xShiftPlanePixels8Tap( PelImagePlane** apcInputPlanes, PelImagePlane* pcDepthPlane, PelImagePlane** apcOutputPlanes, PelImagePlane* pcFilledPlane, UInt uiNumberOfPlanes  )
    880913{
    881 
    882914  Bool bRenderDepth = (apcInputPlanes[0] == pcDepthPlane);
    883915
     
    14961528}
    14971529
    1498 Void TRenTop::xChangePixels( PelImage* pcDispImage )
    1499 {
    1500   if (m_uNumelauiChangePixels < 3 )
    1501   {
    1502     return;
    1503   };
    1504 
    1505   UInt* puiCP = m_auiChangePixels;
    1506   UInt uiWidth = pcDispImage->getPlane(0)->getWidth();
    1507 
    1508   for (UInt uiIdx = 0; uiIdx < m_uNumelauiChangePixels; uiIdx+= 3 )
    1509   {
    1510     pcDispImage->getPlane(0)->getPlaneData()[ puiCP[ uiIdx ] * uiWidth + puiCP[ uiIdx + 1 ] ] =  puiCP[uiIdx + 2 ];
    1511   };
    1512 };
    1513 
    15141530
    15151531Void TRenTop::xCutPlaneMargin( PelImagePlane* pcImagePlane, Pel cFill, UInt uiScale )
     
    16031619    Pel* pcLeftImageData   = (*apcLeftPlane)       ->getPlaneData();
    16041620
    1605     //Int iSumLeft        = 0;
    1606     //Int iSumRight       = 0;
    1607     //Int iSumLeftSquare  = 0;
    1608     //Int iSumRightSquare = 0;
     1621 
    16091622
    16101623    for (UInt uiYPos = 0; uiYPos < iHeight; uiYPos++ )
    16111624    {
    1612       //Int iRowSumLeft        = 0;
    1613       //Int iRowSumRight       = 0;
    1614       //Int iRowSumLeftSquare  = 0;
    1615       //Int iRowSumRightSquare = 0;
    1616 
    16171625      for (UInt uiXPos = 0; uiXPos < iWidth; uiXPos++ )
    16181626      {
     
    16211629            aiHistLeft [pcLeftImageData   [uiXPos] ]++;
    16221630            aiHistRight[pcRightImageData  [uiXPos] ]++;
    1623             //iNumElem++;
    1624             //iRowSumLeft        += ;
    1625             //iRowSumRight       += pcRightImageData [uiXPos];
    1626             //iRowSumLeftSquare  += pcLeftImageData  [uiXPos] * pcLeftImageData [uiXPos];
    1627             //iRowSumRightSquare += pcRightImageData [uiXPos] * pcRightImageData[uiXPos];
    16281631          }
    16291632      }
     
    16601663    while( iCurChangeVal <= g_uiIBDI_MAX )
    16611664    {
    1662 #if 0 //GERHARD_DEBUG
    1663       std::cout << iCumSumBase << " " << iCumSumChange << " " << iCurBaseVal << " " << iCurChangeVal << std::endl;
    1664 #endif
    16651665      if ( iCumSumBase == iCumSumChange )
    16661666      {
     
    17101710delete[] aiHistRight;
    17111711delete[] aiConvLUT  ;
    1712 
    1713 
    17141712}
    17151713
     
    18921890}
    18931891
    1894 
    1895 Void TRenTop::xReEstimateDisp( Pel* pcInputLeftImageRow, Pel* pcInputRightImageRow, Int iLeftImageStride, Int iRightImageStride, Int iPosX, Pel cLeftDepth, Pel cRightDepth, Int iLut, Pel& rcBestDepth, Int& riBestSAD )
    1896 {
    1897   Int iHalfBlkSizeMin1 = 3;
    1898   UInt uiStep = m_iRelShiftLUTPrec;
    1899 
    1900   AOT(iHalfBlkSizeMin1 > 3);
    1901 
    1902   Pel cInc = (cRightDepth < cLeftDepth) ? 1 : -1;
    1903 
    1904   UInt uiBestSAD  = -1;
    1905 
    1906   for (Pel cCurDepth = cRightDepth; cCurDepth <= cLeftDepth; cCurDepth += cInc )
    1907   {
    1908     Int iShiftLeft  = m_ppiShiftLUTLeft [iLut][ RemoveBitIncrement( cCurDepth)];
    1909     Int iShiftRight = m_ppiShiftLUTLeft [iLut][ RemoveBitIncrement( cCurDepth)];
    1910 
    1911     Int iShiftedPosLeft  = iPosX - iShiftLeft;
    1912     Int iShiftedPosRight = iPosX - iShiftRight;
    1913 
    1914     if ( !(( iShiftedPosLeft < 0 ) || (iShiftedPosLeft >= m_uiSampledWidth) || ( iShiftedPosRight < 0 ) || (iShiftedPosRight >= m_uiSampledWidth)))
    1915     {
    1916       Pel* pcCurLeftIm  = pcInputLeftImageRow  - iLeftImageStride  * iHalfBlkSizeMin1 - iHalfBlkSizeMin1*uiStep - iShiftLeft;
    1917       Pel* pcCurRightIm = pcInputRightImageRow - iRightImageStride * iHalfBlkSizeMin1 - iHalfBlkSizeMin1*uiStep - iShiftRight;
    1918 
    1919       UInt uiSAD = 0;
    1920 
    1921       for ( Int iCurPosY= 0; iCurPosY < (iHalfBlkSizeMin1 << 1) + 1; iCurPosY++ )
    1922       {
    1923         for ( Int iCurPosX = 0; iCurPosX < (iHalfBlkSizeMin1 << 1) * uiStep + uiStep; iCurPosX += uiStep  )
    1924         {
    1925           uiSAD += abs( pcCurLeftIm[iCurPosX] - pcCurRightIm[iCurPosX] );
    1926         }
    1927         pcCurLeftIm  += iLeftImageStride;
    1928         pcCurRightIm += iRightImageStride;
    1929       }
    1930 
    1931       if (uiSAD < uiBestSAD)
    1932       {
    1933         uiBestSAD = uiSAD;
    1934         rcBestDepth = cCurDepth;
    1935       }
    1936     }
    1937   }
    1938 }
    1939 
    1940 Int TRenTop::xVSRSHoleCount( Pel* pcFilledData, Int iFilledStride, Int iCenterPosX, Int iCenterPosY )
    1941 {
    1942   // Counts holes in a 6x6 Block around iPosX and iPosY
    1943   //GT: currently not supported for rendering in up sampled domain ( padding to less )
    1944   if ( m_iLog2SamplingFactor > 0 )
    1945   {
    1946     return 0;
    1947   }
    1948 
    1949   Int iHalfBlkSizeY = 3;
    1950   Int iHalfBlkSizeX = 3;  // iHalfBlkSizeY * ( 1 << m_iLog2SamplingFactor );
    1951 
    1952   Int iNumOfHolePels = 0;
    1953   pcFilledData -= ( iHalfBlkSizeX + iHalfBlkSizeY * iFilledStride );
    1954 
    1955   for (Int iPosY = 0; iPosY < (iHalfBlkSizeY << 1) + 1; iPosY++)
    1956   {
    1957     for (Int iPosX = 0; iPosX < (iHalfBlkSizeX << 1) + 1; iPosX++)
    1958     {
    1959       if (*pcFilledData == REN_IS_HOLE)
    1960       {
    1961         iNumOfHolePels++;
    1962       }
    1963       pcFilledData++;
    1964     }
    1965     pcFilledData += iFilledStride;
    1966   }
    1967   return iNumOfHolePels;
    1968 }
    1969 
    19701892// Temporal Filter from Zhejiang University: (a little different from m16041: Temporal Improvement Method in View Synthesis)
    19711893Void TRenTop::temporalFilterVSRS( TComPicYuv* pcPicYuvVideoCur, TComPicYuv* pcPicYuvDepthCur, TComPicYuv* pcPicYuvVideoLast, TComPicYuv* pcPicYuvDepthLast, Bool bFirstFrame )
     
    20952017  // PostProcessing
    20962018  m_iPostProcMode        = eRenPostProNone;
    2097 
    2098   //ChangePixels
    2099   m_auiChangePixels[0] = 0;
    2100   m_uNumelauiChangePixels = 0;
    21012019
    21022020  // Cut
     
    22112129  m_iPostProcMode    = iPostProcMode;
    22122130
    2213   //ChangePixels
    2214   m_auiChangePixels[0] = 0;
    2215   m_uNumelauiChangePixels = 0;
    2216 
    22172131  // Used pel map
    22182132  m_iUsedPelMapMarExt     = iUsedPelMapMarExt;
     
    22622176
    22632177
    2264 Void TRenTop::xGetChangePixels( UInt& ruiNumPixels, UInt* & rauiChangePixels )
    2265 {
    2266   ruiNumPixels = m_uNumelauiChangePixels;
    2267   rauiChangePixels = m_auiChangePixels;
    2268 }
    2269 
    22702178TRenTop::~TRenTop()
    22712179{
Note: See TracChangeset for help on using the changeset viewer.