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/TLibEncoder/TEncSearch.cpp

    r1185 r1187  
    976976          {
    977977            m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPart * uiQNumParts );
    978 #if H_3D_SDC
     978#if H_3D_DIM_SDC
    979979          }
    980980          m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     
    22112211  // encode pred direction + DC residual data
    22122212  m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
    2213 #if H_3D_SDC
     2213#if H_3D_DIM_SDC
    22142214  m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
    22152215#endif
     
    30163016    pcCU->getPattern()->initPattern   ( pcCU, uiInitTrDepth, uiPartOffset );
    30173017    pcCU->getPattern()->initAdiPattern( pcCU, uiPartOffset, uiInitTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
    3018    
     3018
    30193019    //===== determine set of modes to be tested (using prediction signal only) =====
    30203020    Int numModesAvailable     = 35; //total number of Intra modes
     
    30243024    UInt uiRdModeList[FAST_UDI_MAX_RDMODE_NUM];
    30253025    Int numModesForFullRD = g_aucIntraModeNumFast[ uiWidthBit ];
    3026    
     3026
    30273027#if H_3D_DIM
    30283028    if( bOnlyIVP )
     
    30333033    {
    30343034#endif
    3035     Bool doFastSearch = (numModesForFullRD != numModesAvailable);
    3036     if (doFastSearch)
    3037     {
    3038       assert(numModesForFullRD < numModesAvailable);
    3039 
    3040       for( Int i=0; i < numModesForFullRD; i++ )
    3041       {
    3042         CandCostList[ i ] = MAX_DOUBLE;
    3043       }
    3044       CandNum = 0;
    3045      
    3046       for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )
    3047       {
    3048         UInt uiMode = modeIdx;
    3049 
    3050         predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
     3035      Bool doFastSearch = (numModesForFullRD != numModesAvailable);
     3036      if (doFastSearch)
     3037      {
     3038        assert(numModesForFullRD < numModesAvailable);
     3039
     3040        for( Int i=0; i < numModesForFullRD; i++ )
     3041        {
     3042          CandCostList[ i ] = MAX_DOUBLE;
     3043        }
     3044        CandNum = 0;
     3045
     3046        for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )
     3047        {
     3048          UInt uiMode = modeIdx;
     3049
     3050          predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
    30513051#if H_3D_VSO // M34
    3052         Dist uiSad;
    3053         if ( m_pcRdCost->getUseVSO() )
    3054         {
    3055           if ( m_pcRdCost->getUseEstimatedVSD() )
    3056           {         
    3057             uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) );
     3052          Dist uiSad;
     3053          if ( m_pcRdCost->getUseVSO() )
     3054          {
     3055            if ( m_pcRdCost->getUseEstimatedVSD() )
     3056            {         
     3057              uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) );
     3058            }
     3059            else
     3060            {   
     3061              uiSad = m_pcRdCost->getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true );
     3062            }
    30583063          }
    30593064          else
    3060           {   
    3061             uiSad = m_pcRdCost->getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true );
     3065          {
     3066            uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    30623067          }
    3063         }
    3064         else
    3065         {
    3066           uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    3067         }
    30683068#else       
    3069         // use hadamard transform here
    3070         UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    3071 #endif
    3072        
    3073         UInt   iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth );
     3069          // use hadamard transform here
     3070          UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
     3071#endif
     3072
     3073          UInt   iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth );
    30743074#if H_3D_VSO // M35
    3075         Double dLambda;
    3076         if ( m_pcRdCost->getUseLambdaScaleVSO() )
    3077         {
    3078           dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO();
    3079         }
    3080         else       
    3081         {
    3082           dLambda = m_pcRdCost->getSqrtLambda();       
    3083         }
    3084 
    3085         Double cost      = (Double)uiSad + (Double)iModeBits * dLambda;
     3075          Double dLambda;
     3076          if ( m_pcRdCost->getUseLambdaScaleVSO() )
     3077          {
     3078            dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO();
     3079          }
     3080          else       
     3081          {
     3082            dLambda = m_pcRdCost->getSqrtLambda();       
     3083          }
     3084
     3085          Double cost      = (Double)uiSad + (Double)iModeBits * dLambda;
    30863086#else
    3087         Double cost      = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda();
    3088 #endif
    3089        
    3090         CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );
    3091       }
    3092    
     3087          Double cost      = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda();
     3088#endif
     3089
     3090          CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );
     3091        }
     3092
    30933093#if FAST_UDI_USE_MPM
    3094       Int uiPreds[3] = {-1, -1, -1};
    3095       Int iMode = -1;
    3096       Int numCand = pcCU->getIntraDirLumaPredictor( uiPartOffset, uiPreds, &iMode );
    3097       if( iMode >= 0 )
    3098       {
    3099         numCand = iMode;
    3100       }
    3101      
    3102       for( Int j=0; j < numCand; j++)
    3103 
    3104       {
    3105         Bool mostProbableModeIncluded = false;
    3106         Int mostProbableMode = uiPreds[j];
    3107        
     3094        Int uiPreds[3] = {-1, -1, -1};
     3095        Int iMode = -1;
     3096        Int numCand = pcCU->getIntraDirLumaPredictor( uiPartOffset, uiPreds, &iMode );
     3097        if( iMode >= 0 )
     3098        {
     3099          numCand = iMode;
     3100        }
     3101
     3102        for( Int j=0; j < numCand; j++)
     3103
     3104        {
     3105          Bool mostProbableModeIncluded = false;
     3106          Int mostProbableMode = uiPreds[j];
     3107
     3108          for( Int i=0; i < numModesForFullRD; i++)
     3109          {
     3110            mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]);
     3111          }
     3112          if (!mostProbableModeIncluded)
     3113          {
     3114            uiRdModeList[numModesForFullRD++] = mostProbableMode;
     3115          }
     3116        }
     3117#endif // FAST_UDI_USE_MPM
     3118      }
     3119      else
     3120      {
    31083121        for( Int i=0; i < numModesForFullRD; i++)
    31093122        {
    3110           mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]);
    3111         }
    3112         if (!mostProbableModeIncluded)
    3113         {
    3114           uiRdModeList[numModesForFullRD++] = mostProbableMode;
    3115         }
    3116       }
    3117 #endif // FAST_UDI_USE_MPM
    3118     }
    3119     else
    3120     {
    3121       for( Int i=0; i < numModesForFullRD; i++)
    3122       {
    3123         uiRdModeList[i] = i;
    3124       }
    3125     }
     3123          uiRdModeList[i] = i;
     3124        }
     3125      }
    31263126#if H_3D_DIM
    31273127    }
    31283128#endif
    3129    
     3129
    31303130#if H_3D_DIM
    31313131    //===== determine set of depth intra modes to be tested =====
     
    31483148      {
    31493149#if H_3D_FAST_DEPTH_INTRA
    3150       Int  threshold    = max(((pcCU->getQP(0))>>3)-1,3);
    3151       Int  varThreshold = (Int)( threshold * threshold - 8 );
    3152       UInt varCU      = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0));
     3150        Int  threshold    = max(((pcCU->getQP(0))>>3)-1,3);
     3151        Int  varThreshold = (Int)( threshold * threshold - 8 );
     3152        UInt varCU      = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0));
    31533153#endif
    31543154
    31553155#if H_3D_DIM_DMM
    3156       if( ( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() )  || pcCU->getSlice()->getIntraContourFlag() )
     3156        if( ( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() )  || pcCU->getSlice()->getIntraContourFlag() )
    31573157#if H_3D_FAST_DEPTH_INTRA
    3158          && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
    3159 #endif
    3160         )
    3161       {
    3162         UInt uiStart, uiEnd;
    3163         if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) &&  pcCU->getSlice()->getIntraContourFlag() )
    3164         {
    3165           uiStart = 0;
    3166           uiEnd   = 2;
    3167         }
    3168         else if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) )
    3169         {
    3170           uiStart = 0;
    3171           uiEnd   = 1;
    3172         }
    3173         else if( pcCU->getSlice()->getIntraContourFlag() )
    3174         {
    3175           uiStart = 1;
    3176           uiEnd   = 2;
    3177         }
    3178         else
    3179         {
    3180           uiStart = 0;
    3181           uiEnd   = 0;
    3182         }
    3183         for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ )
    3184         {
     3158          && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
     3159#endif
     3160          )
     3161        {
     3162          UInt uiStart, uiEnd;
     3163          if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) &&  pcCU->getSlice()->getIntraContourFlag() )
     3164          {
     3165            uiStart = 0;
     3166            uiEnd   = 2;
     3167          }
     3168          else if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) )
     3169          {
     3170            uiStart = 0;
     3171            uiEnd   = 1;
     3172          }
     3173          else if( pcCU->getSlice()->getIntraContourFlag() )
     3174          {
     3175            uiStart = 1;
     3176            uiEnd   = 2;
     3177          }
     3178          else
     3179          {
     3180            uiStart = 0;
     3181            uiEnd   = 0;
     3182          }
     3183          for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ )
     3184          {
    31853185#if H_3D_FCO
    31863186            TComPic* picTexture  = pcCU->getSlice()->getIvPic(false, pcCU->getSlice()->getViewIndex() );
     
    31913191#endif
    31923192            {
    3193                 continue;
     3193              continue;
    31943194            }
    31953195#endif
    3196           UInt uiTabIdx = 0;
    3197           TComWedgelet* biSegmentation = NULL;
    3198           Pel deltaDC1 = 0; Pel deltaDC2 = 0;
    3199           switch( dmmType )
    3200           {
    3201           case( DMM1_IDX ):
     3196            UInt uiTabIdx = 0;
     3197            TComWedgelet* biSegmentation = NULL;
     3198            Pel deltaDC1 = 0; Pel deltaDC2 = 0;
     3199            switch( dmmType )
    32023200            {
    3203               xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx );
    3204               pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType,  uiPartOffset, uiDepth + uiInitTrDepth );
    3205               biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ?
     3201            case( DMM1_IDX ):
     3202              {
     3203                xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx );
     3204                pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType,  uiPartOffset, uiDepth + uiInitTrDepth );
     3205                biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ?
    32063206                  &(g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])][uiTabIdx]) : &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
    3207             } break;
    3208 
    3209           case( DMM4_IDX ):
     3207              } break;
     3208
     3209            case( DMM4_IDX ):
     3210              {
     3211                {
     3212                  biSegmentation = new TComWedgelet( uiWidth, uiHeight );
     3213                  xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, biSegmentation );
     3214                }
     3215              } break;
     3216            default: assert(0);
     3217            }
     3218
     3219            if( biSegmentation )
    32103220            {
     3221              if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){
     3222                xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 );
     3223              }
     3224              else
    32113225              {
    3212                 biSegmentation = new TComWedgelet( uiWidth, uiHeight );
    3213                 xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, biSegmentation );
     3226                xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 );
    32143227              }
    3215             } break;
    3216           default: assert(0);
     3228              pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 );
     3229              pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 );
     3230
     3231              uiRdModeList[ numModesForFullRD++ ] = (dmmType  +DIM_OFFSET);
     3232              if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; }
     3233            }
    32173234          }
    3218 
    3219           if( biSegmentation )
    3220           {
    3221             if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){
    3222                 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 );
    3223             }
    3224             else
    3225             {
    3226                 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 );
    3227             }
    3228             pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 );
    3229             pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 );
    3230 
    3231             uiRdModeList[ numModesForFullRD++ ] = (dmmType  +DIM_OFFSET);
    3232             if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; }
    3233           }
    3234         }
    3235       }
     3235        }
    32363236#if H_3D_DIM
    32373237      }
     
    32453245    Double dSecondBestPUCost = MAX_DOUBLE;
    32463246#endif
    3247    
     3247
    32483248    UInt    uiBestPUMode  = 0;
    32493249#if H_3D_FAST_INTRA_SDC
     
    32793279      // set luma prediction mode
    32803280#if !H_3D_FAST_INTRA_SDC
    3281      UInt uiOrgMode = uiRdModeList[uiMode]; 
    3282 #endif
    3283      
     3281      UInt uiOrgMode = uiRdModeList[uiMode]; 
     3282#endif
     3283
    32843284#if H_3D_FAST_INTRA_SDC
    32853285      UInt uiOrgMode;
    32863286      if (uiMode < numModesForFullRD)
    32873287      {   
    3288          uiOrgMode = uiRdModeList[uiMode];
     3288        uiOrgMode = uiRdModeList[uiMode];
    32893289      }
    32903290      else
    32913291      {
    3292            uiOrgMode = uiRdModeList[uiMode - numModesForFullRD];
    3293 
    3294            if (uiBestPUModeConv <= 1 )
    3295            {
    3296            if (uiOrgMode > 1 && varCU < 1) continue;         
    3297            }
    3298            else
    3299            {
    3300               if (uiOrgMode != uiBestPUModeConv && uiOrgMode != uiSecondBestPUModeConv && uiOrgMode != uiThirdBestPUModeConv
    3301                   && uiOrgMode > 1 && uiOrgMode < NUM_INTRA_MODE && varCU < 4)
    3302               continue;
    3303            }
    3304        }
     3292        uiOrgMode = uiRdModeList[uiMode - numModesForFullRD];
     3293
     3294        if (uiBestPUModeConv <= 1 )
     3295        {
     3296          if (uiOrgMode > 1 && varCU < 1) continue;         
     3297        }
     3298        else
     3299        {
     3300          if (uiOrgMode != uiBestPUModeConv && uiOrgMode != uiSecondBestPUModeConv && uiOrgMode != uiThirdBestPUModeConv
     3301            && uiOrgMode > 1 && uiOrgMode < NUM_INTRA_MODE && varCU < 4)
     3302            continue;
     3303        }
     3304      }
    33053305#endif
    33063306
    33073307      pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
    3308      
     3308
    33093309#if H_3D_DIM_SDC
    33103310#if H_3D_FAST_INTRA_SDC
     
    33133313      Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) );
    33143314#endif
    3315      
     3315
    33163316      for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ )
    33173317      {
     
    33523352          }
    33533353#endif
    3354      
     3354
    33553355#if H_3D_DIM_ENC || H_3D_DIM_SDC
    3356       Bool bTestZeroResi = false;
     3356          Bool bTestZeroResi = false;
    33573357#if H_3D_DIM_ENC
    3358       bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP();
     3358          bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP();
    33593359#endif
    33603360#if H_3D_DIM_SDC
    3361       bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);
    3362 #endif
    3363       if( uiSDC != 0 && iSDCDeltaResi != 0 )
    3364       {
    3365         bTestZeroResi = false;
    3366       }
    3367 #endif
    3368      
     3361          bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);
     3362#endif
     3363          if( uiSDC != 0 && iSDCDeltaResi != 0 )
     3364          {
     3365            bTestZeroResi = false;
     3366          }
     3367#endif
     3368
    33693369#if H_3D_DIM_ENC || H_3D_DIM_SDC     
    3370       for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ )
    3371       {
    3372 #endif
    3373         // set context models
    3374         m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
    3375 
    3376         // determine residual for partition
     3370          for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ )
     3371          {
     3372#endif
     3373            // set context models
     3374            m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
     3375
     3376            // determine residual for partition
    33773377#if H_3D_VSO
    3378         Dist   uiPUDistY = 0;
     3378            Dist   uiPUDistY = 0;
    33793379#else
    3380         UInt   uiPUDistY = 0;
    3381 #endif
    3382         UInt   uiPUDistC = 0;
    3383         Double dPUCost   = 0.0;
     3380            UInt   uiPUDistY = 0;
     3381#endif
     3382            UInt   uiPUDistC = 0;
     3383            Double dPUCost   = 0.0;
    33843384#if H_3D_VSO // M36
    3385         if( m_pcRdCost->getUseRenModel() )
    3386         {
    3387           m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
    3388         }
     3385            if( m_pcRdCost->getUseRenModel() )
     3386            {
     3387              m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
     3388            }
    33893389#endif
    33903390#if H_3D_DIM_SDC
    3391         if( pcCU->getSDCFlag(uiPartOffset) )
    3392         {
    3393           pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
    3394           pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
    3395 
    3396           // start encoding with SDC
    3397           xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );
    3398           if ( testZeroResi == 0 && iOffset <= 3 )
    3399           {
    3400             dOffsetCost [iOffset -1] = dPUCost;
    3401           }
    3402         }
    3403         else
    3404         {
     3391            if( pcCU->getSDCFlag(uiPartOffset) )
     3392            {
     3393              pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
     3394              pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
     3395
     3396              // start encoding with SDC
     3397              xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );
     3398              if ( testZeroResi == 0 && iOffset <= 3 )
     3399              {
     3400                dOffsetCost [iOffset -1] = dPUCost;
     3401              }
     3402            }
     3403            else
     3404            {
    34053405#endif
    34063406#if HHI_RQT_INTRA_SPEEDUP
    34073407#if H_3D_DIM_ENC
    3408           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) );
     3408              xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) );
    34093409#if H_3D_FAST_INTRA_SDC   
    3410       if( dPUCost < dBestPUCostConv )
    3411       {
    3412         uiThirdBestPUModeConv = uiSecondBestPUModeConv;
    3413         uiSecondBestPUModeConv = uiBestPUModeConv;
    3414         uiBestPUModeConv  = uiOrgMode;
    3415         dBestPUCostConv   = dPUCost;
    3416       }
     3410              if( dPUCost < dBestPUCostConv )
     3411              {
     3412                uiThirdBestPUModeConv = uiSecondBestPUModeConv;
     3413                uiSecondBestPUModeConv = uiBestPUModeConv;
     3414                uiBestPUModeConv  = uiOrgMode;
     3415                dBestPUCostConv   = dPUCost;
     3416              }
    34173417#endif
    34183418#else
    3419           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost );
     3419              xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost );
    34203420#endif
    34213421#else
    34223422#if H_3D_DIM_ENC
    3423           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost, (testZeroResi != 0) );
     3423              xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost, (testZeroResi != 0) );
    34243424#else
    3425           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost );
     3425              xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost );
    34263426#endif
    34273427#endif
    34283428#if H_3D_DIM_SDC
    3429         }
    3430 #endif
    3431 
    3432         // check r-d cost
    3433         if( dPUCost < dBestPUCost )
    3434         {
     3429            }
     3430#endif
     3431
     3432            // check r-d cost
     3433            if( dPUCost < dBestPUCost )
     3434            {
    34353435#if HHI_RQT_INTRA_SPEEDUP_MOD
    3436           uiSecondBestMode  = uiBestPUMode;
    3437           dSecondBestPUCost = dBestPUCost;
    3438 #endif
    3439           uiBestPUMode  = uiOrgMode;
    3440           uiBestPUDistY = uiPUDistY;
    3441           uiBestPUDistC = uiPUDistC;
    3442           dBestPUCost   = dPUCost;
     3436              uiSecondBestMode  = uiBestPUMode;
     3437              dSecondBestPUCost = dBestPUCost;
     3438#endif
     3439              uiBestPUMode  = uiOrgMode;
     3440              uiBestPUDistY = uiPUDistY;
     3441              uiBestPUDistC = uiPUDistC;
     3442              dBestPUCost   = dPUCost;
    34433443
    34443444#if H_3D_DIM_SDC
    3445           if( pcCU->getSDCFlag(uiPartOffset) )
    3446           {
    3447             bBestUseSDC = true;
    3448 
    3449             // copy reconstruction
    3450             pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight);
    3451 
    3452             // copy DC values
    3453             apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset);
    3454             apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset);
     3445              if( pcCU->getSDCFlag(uiPartOffset) )
     3446              {
     3447                bBestUseSDC = true;
     3448
     3449                // copy reconstruction
     3450                pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight);
     3451
     3452                // copy DC values
     3453                apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset);
     3454                apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset);
     3455              }
     3456              else
     3457              {
     3458                bBestUseSDC = false;
     3459#endif
     3460                xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
     3461
     3462                UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
     3463                ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3464                ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3465                ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3466                ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3467                ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA)     + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3468                ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3469                ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3470#if H_3D_DIM_SDC
     3471              }
     3472#endif
     3473            }
     3474#if HHI_RQT_INTRA_SPEEDUP_MOD
     3475            else if( dPUCost < dSecondBestPUCost )
     3476            {
     3477              uiSecondBestMode  = uiOrgMode;
     3478              dSecondBestPUCost = dPUCost;
     3479            }
     3480#endif
     3481#if H_3D_DIM_ENC || H_3D_DIM_SDC
    34553482          }
    3456           else
    3457           {
    3458             bBestUseSDC = false;
    3459 #endif
    3460             xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
    3461 
    3462             UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
    3463             ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3464             ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3465             ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3466             ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3467             ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA)     + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3468             ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3469             ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3470 #if H_3D_DIM_SDC
    3471           }
    3472 #endif
    3473         }
    3474 #if HHI_RQT_INTRA_SPEEDUP_MOD
    3475         else if( dPUCost < dSecondBestPUCost )
    3476         {
    3477           uiSecondBestMode  = uiOrgMode;
    3478           dSecondBestPUCost = dPUCost;
    3479         }
    3480 #endif
    3481 #if H_3D_DIM_ENC || H_3D_DIM_SDC
    3482       }
    34833483        } // SDC residual loop
    34843484#endif
     
    34873487#endif
    34883488    } // Mode loop
    3489    
     3489
    34903490#if HHI_RQT_INTRA_SPEEDUP
    34913491#if HHI_RQT_INTRA_SPEEDUP_MOD
     
    35023502      UInt uiOrgMode = uiBestPUMode;
    35033503#endif
    3504      
     3504
    35053505      pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
    35063506#if H_3D_DIM_SDC
    35073507      pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth);
    35083508#endif
    3509      
     3509
    35103510      // set context models
    3511         m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
    3512      
     3511      m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
     3512
    35133513      // determine residual for partition
    35143514#if H_3D_VSO
     
    35273527#endif
    35283528      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );
    3529      
     3529
    35303530      // check r-d cost
    35313531      if( dPUCost < dBestPUCost )
     
    35383538        bBestUseSDC   = false;
    35393539#endif
    3540        
     3540
    35413541        xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
    3542        
     3542
    35433543        UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
    35443544        ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     
    35523552    } // Mode loop
    35533553#endif
    3554    
     3554
    35553555    //--- update overall distortion ---
    35563556    uiOverallDistY += uiBestPUDistY;
    35573557    uiOverallDistC += uiBestPUDistC;
    3558    
     3558
    35593559#if H_3D_DIM_SDC
    35603560    if( bBestUseSDC )
     
    35623562      pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
    35633563      pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
    3564      
     3564
    35653565      //=== copy best DC segment values back to CU ====
    35663566      pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset);
     
    35703570    {
    35713571#endif
    3572         //--- update transform index and cbf ---
    3573     UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
    3574     ::memcpy( pcCU->getTransformIdx()       + uiPartOffset, m_puhQTTempTrIdx,  uiQPartNum * sizeof( UChar ) );
    3575     ::memcpy( pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, m_puhQTTempCbf[0], uiQPartNum * sizeof( UChar ) );
    3576     ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) );
    3577     ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) );
    3578     ::memcpy( pcCU->getTransformSkip(TEXT_LUMA)     + uiPartOffset, m_puhQTTempTransformSkipFlag[0], uiQPartNum * sizeof( UChar ) );
    3579     ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) );
    3580     ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) );
     3572      //--- update transform index and cbf ---
     3573      UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
     3574      ::memcpy( pcCU->getTransformIdx()       + uiPartOffset, m_puhQTTempTrIdx,  uiQPartNum * sizeof( UChar ) );
     3575      ::memcpy( pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, m_puhQTTempCbf[0], uiQPartNum * sizeof( UChar ) );
     3576      ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) );
     3577      ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) );
     3578      ::memcpy( pcCU->getTransformSkip(TEXT_LUMA)     + uiPartOffset, m_puhQTTempTransformSkipFlag[0], uiQPartNum * sizeof( UChar ) );
     3579      ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) );
     3580      ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) );
    35813581#if H_3D_DIM_SDC
    35823582    }
     
    35943594        bChromaSame  = true;
    35953595      }
    3596      
     3596
    35973597      UInt    uiCompWidth   = pcCU->getWidth ( 0 ) >> uiInitTrDepth;
    35983598      UInt    uiCompHeight  = pcCU->getHeight( 0 ) >> uiInitTrDepth;
     
    36463646      }
    36473647    }
    3648    
     3648
    36493649    //=== update PU data ====
    36503650    pcCU->setLumaIntraDirSubParts     ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth );
     
    39743974 
    39753975#if H_3D_DBBP
    3976   DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     3976  DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
    39773977  if( pcCU->getDBBPFlag(0) )
    39783978  {
     
    49644964  {
    49654965#if H_3D_DBBP
    4966     DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     4966    DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
    49674967    if( pcCU->getDBBPFlag(0) )
    49684968    {
     
    53265326 
    53275327#if H_MV
    5328   Bool bMv_VRng_Restricted = false;
     5328  Bool motVecVertRngRestricted = false;
    53295329  if( m_pcEncCfg->getUseDisparitySearchRangeRestriction()
    53305330       &&
     
    53325332    )
    53335333  {
    5334       bMv_VRng_Restricted = true;
    5335   }
    5336   if ( bBi )  xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, m_pcEncCfg->getVerticalDisparitySearchRange() );
    5337   else        xSetSearchRange   ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, m_pcEncCfg->getVerticalDisparitySearchRange() );
     5334      motVecVertRngRestricted = true;
     5335  }
     5336  if ( bBi )  xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB, motVecVertRngRestricted, m_pcEncCfg->getVerticalDisparitySearchRange() );
     5337  else        xSetSearchRange   ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, motVecVertRngRestricted, m_pcEncCfg->getVerticalDisparitySearchRange() );
    53385338#else
    53395339  if ( bBi )  xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB );
     
    55235523  if( ! pcCU->getSlice()->getIsDepth() )
    55245524#endif
    5525   rcMv >>= 2;
     5525    rcMv >>= 2;
    55265526  // init TZSearchStruct
    55275527  IntTZSearchStruct cStruct;
Note: See TracChangeset for help on using the changeset viewer.