Ignore:
Timestamp:
8 Apr 2015, 15:26:52 (9 years ago)
Author:
tech
Message:

Clean up Part 3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp

    r1185 r1187  
    5454  m_pDepthBlock = (Int*) malloc(MAX_NUM_SPU_W*MAX_NUM_SPU_W*sizeof(Int));
    5555  if (m_pDepthBlock == NULL)
     56  {
    5657      printf("ERROR: UKTGHU, No memory allocated.\n");
     58  }
    5759#endif
    5860}
     
    6264#if H_3D_VSP
    6365  if (m_pDepthBlock != NULL)
    64       free(m_pDepthBlock);
     66  {
     67    free(m_pDepthBlock);
     68  }
    6569  m_cYuvDepthOnVsp.destroy();
    6670#endif
     
    513517
    514518#if H_3D_DIM_DMM
    515   if( dimType == DMM4_IDX && dmm4Segmentation == NULL ) { dmmSegmentation->destroy(); delete dmmSegmentation; }
     519  if( dimType == DMM4_IDX && dmm4Segmentation == NULL )
     520  {
     521    dmmSegmentation->destroy();
     522    delete dmmSegmentation;
     523  }
    516524#endif
    517525}
     
    635643  // segmentation of texture block --> mask IDs
    636644  Pel*  pDepthBlockStart      = pDepthPels;
    637  
     645
    638646  // first compute average of depth block for thresholding
    639647  Int iSumDepth = 0;
     
    648656  Int iBlkX = ( pcCU->getAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getHor()+2)>>2);
    649657  Int iBlkY = ( pcCU->getAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getVer()+2)>>2);
     658 
    650659  UInt t=0;
    651660
    652661  for (Int y=0; y<uiSize; y+=iSubSample)
    653    {
     662  {
    654663    for (Int x=0; x<uiSize; x+=iSubSample)
    655    {
    656 if (iBlkX+x>iPictureWidth)
    657 {
    658     Int depthPel = pDepthPels[t];
    659     iSumDepth += depthPel;
    660 }
    661 else
    662 {
    663     Int depthPel = pDepthPels[x];
    664     t=x;
    665     iSumDepth += depthPel;
    666 }
    667    }
    668    
     664    {
     665      if (iBlkX+x>iPictureWidth)
     666      {
     667        Int depthPel = pDepthPels[t];
     668        iSumDepth += depthPel;
     669      }
     670      else
     671      {
     672        Int depthPel = pDepthPels[x];
     673        t=x;
     674        iSumDepth += depthPel;
     675      }
     676    }
     677
    669678    // next row
    670679    if (!(iBlkY+y+4>iPictureHeight))
    671     pDepthPels += uiDepthStride*iSubSample;
    672   }
    673  
     680    {
     681      pDepthPels += uiDepthStride*iSubSample;
     682    }
     683  }
     684
    674685  Int iSizeInBits = g_aucConvertToBit[uiSize] - g_aucConvertToBit[iSubSample];  // respect sub-sampling factor
    675686  Int iMean = iSumDepth >> iSizeInBits*2;       // iMean /= (uiSize*uiSize);
    676  
     687
    677688  // start again for segmentation
    678689  pDepthPels = pDepthBlockStart;
    679  
     690
    680691  // start mapping process
    681692  Int matchedPartSum[2][2] = {{0,0},{0,0}}; // counter for each part size and boolean option
    682693  PartSize virtualPartSizes[2] = { SIZE_Nx2N, SIZE_2NxN};
    683  
     694
    684695  UInt uiHalfSize = uiSize>>1;
    685696  for (Int y=0; y<uiSize; y+=iSubSample)
     
    688699    {
    689700      Int depthPel = 0;
    690 if (iBlkX+x>iPictureWidth)
    691 {
    692     depthPel = pDepthPels[t];
    693 }
    694 else
    695 {
    696     depthPel = pDepthPels[x];
    697      t=x;
    698 }
    699      
     701      if (iBlkX+x>iPictureWidth)
     702      {
     703        depthPel = pDepthPels[t];
     704      }
     705      else
     706      {
     707        depthPel = pDepthPels[x];
     708        t=x;
     709      }
     710
    700711      // decide which segment this pixel belongs to
    701712      Int ucSegment = (Int)(depthPel>iMean);
    702      
     713
    703714      // Matched Filter to find optimal (conventional) partitioning
    704      
     715
    705716      // SIZE_Nx2N
    706717      if(x<uiHalfSize)  // left
     
    712723        matchedPartSum[0][1-ucSegment]++;
    713724      }
    714      
     725
    715726      // SIZE_2NxN
    716727      if(y<uiHalfSize)  // top
     
    723734      }
    724735    }
    725    
     736
    726737    // next row
    727738    if (!(iBlkY+y+4>iPictureHeight))
    728     pDepthPels += uiDepthStride*iSubSample;
    729   }
    730  
     739    {
     740      pDepthPels += uiDepthStride*iSubSample;
     741    }
     742  }
     743
    731744  PartSize matchedPartSize = SIZE_NONE;
    732  
     745
    733746  Int iMaxMatchSum = 0;
    734747  for(Int p=0; p<2; p++)  // loop over partition
     
    743756    }
    744757  }
    745  
     758
    746759  AOF( matchedPartSize != SIZE_NONE );
    747  
     760
    748761  return matchedPartSize;
    749762}
     
    761774  uiMaxDepth = pDepthPels[ 0 ];
    762775  iSumDepth  = pDepthPels[ 0 ];
    763   UInt t=0;
     776 
    764777  Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth();
    765778  Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(); 
     
    835848
    836849  // generate mask
     850  UInt t=0;
    837851  UInt uiSumPix[2] = {0,0};
    838852  for (Int y=0; y<uiHeight; y++)
     
    952966  }
    953967
    954   if ( tmpTar    ) { xFree(tmpTar);             tmpTar        = NULL; }
     968  if ( tmpTar    )
     969  {
     970    xFree(tmpTar);             
     971    tmpTar        = NULL;
     972  }
    955973 
    956974  // now combine chroma
     
    10551073  }
    10561074
    1057   if ( tmpTarU    ) { xFree(tmpTarU);             tmpTarU        = NULL; }
    1058   if ( tmpTarV    ) { xFree(tmpTarV);             tmpTarV        = NULL; }
     1075  if( tmpTarU )
     1076  {
     1077    xFree(tmpTarU);
     1078    tmpTarU        = NULL;
     1079  }
     1080  if ( tmpTarV    )
     1081  {
     1082    xFree(tmpTarV);
     1083    tmpTarV        = NULL;
     1084  }
    10591085}
    10601086#endif
     
    12431269  pcCU->clipMv(cMv);
    12441270#if H_MV
    1245   pcCU->checkMV_V(cMv, eRefPicList, iRefIdx );
     1271  pcCU->checkMvVertRest(cMv, eRefPicList, iRefIdx );
    12461272#endif
    12471273#if H_3D_ARP
     
    23672393    for( UInt k = 0; k < (patternStride * patternStride); k++ )
    23682394    {
    2369       if( true == biSegPattern[k] ) { ptrDst[k] = valDC2; }
    2370       else                          { ptrDst[k] = valDC1; }
     2395      if( true == biSegPattern[k] )
     2396      {
     2397        ptrDst[k] = valDC2;
     2398      }
     2399      else                         
     2400      {
     2401        ptrDst[k] = valDC1;
     2402      }
    23712403    }
    23722404  }
     
    23782410      for( UInt uiX = 0; uiX < patternStride; uiX++ )
    23792411      {
    2380         if( true == biSegPattern[uiX] ) { piTemp[uiX] = valDC2; }
    2381         else                            { piTemp[uiX] = valDC1; }
     2412        if( true == biSegPattern[uiX] )
     2413        {
     2414          piTemp[uiX] = valDC2;
     2415        }
     2416        else                           
     2417        {
     2418          piTemp[uiX] = valDC1;
     2419        }
    23822420      }
    23832421      piTemp       += dstStride;
     
    24492487  Int iSumPix[2];
    24502488  memset(iSumPix, 0, sizeof(Int)*2);
     2489
    24512490  for( Int i = 0; i < uiNumSegments; i++ )
    24522491  {
    2453     rpSegMeans[i] = 0;
    2454   }
    2455   if (orgDC == false)
     2492    rpSegMeans[i] = 0; 
     2493  }
     2494
     2495  if ( !orgDC )
    24562496  {
    24572497    Pel* pLeftTop = pOrig;
     
    24732513    subSamplePix = 1;
    24742514  }
     2515
    24752516  for (Int y=0; y<uiSize; y+=subSamplePix)
    24762517  {
     
    24922533  {
    24932534    if( iSumPix[ucSeg] > 0 )
     2535    {
    24942536      rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg];
     2537    }
    24952538    else
     2539    {
    24962540      rpSegMeans[ucSeg] = 0;  // this happens for zero-segments
     2541    }
    24972542  }
    24982543}
Note: See TracChangeset for help on using the changeset viewer.