Changeset 1246 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
14 Jul 2015, 00:26:07 (10 years ago)
Author:
seregin
Message:

port rev 4240

Location:
branches/SHM-dev/source/Lib/TLibEncoder
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/NALwrite.cpp

    r1237 r1246  
    9999      zeroCount=0;
    100100    }
    101     if (v==0) zeroCount++; else zeroCount=0;
     101
     102    if (v==0)
     103    {
     104      zeroCount++;
     105    }
     106    else
     107    {
     108      zeroCount=0;
     109    }
    102110    outputBuffer[outputAmount++]=v;
    103111  }
     
    108116   * to 0x03 is appended to the end of the data.
    109117   */
    110   if (zeroCount>0) outputBuffer[outputAmount++]=emulation_prevention_three_byte[0];
     118  if (zeroCount>0)
     119  {
     120    outputBuffer[outputAmount++]=emulation_prevention_three_byte[0];
     121  }
    111122  out.write((Char*)&(*outputBuffer.begin()), outputAmount);
    112123}
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r1235 r1246  
    247247#if ENC_DEC_TRACE
    248248  if (g_HLSTraceEnable)
    249   xTraceSEIHeader();
     249  {
     250    xTraceSEIHeader();
     251  }
    250252#endif
    251253
     
    267269#if ENC_DEC_TRACE
    268270  if (g_HLSTraceEnable)
    269   xTraceSEIMessageType(sei.payloadType());
     271  {
     272    xTraceSEIMessageType(sei.payloadType());
     273  }
    270274#endif
    271275
     
    592596  WRITE_FLAG( sei.m_arrangementCancelFlag,          "frame_packing_arrangement_cancel_flag" );
    593597
    594   if( sei.m_arrangementCancelFlag == 0 ) {
     598  if( sei.m_arrangementCancelFlag == 0 )
     599  {
    595600    WRITE_CODE( sei.m_arrangementType, 7,           "frame_packing_arrangement_type" );
    596601
     
    890895            WRITE_FLAG(currentTimeSet.hoursFlag, "hours_flag");
    891896            if(currentTimeSet.hoursFlag)
     897            {
    892898              WRITE_CODE(currentTimeSet.hoursValue, 5, "hours_value");
     899            }
    893900          }
    894901        }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncAnalyze.h

    r1029 r1246  
    108108    Int maximumBitDepth = g_bitDepth[0];
    109109    for (UInt channelTypeIndex = 1; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     110    {
    110111      if (g_bitDepth[channelTypeIndex] > maximumBitDepth)
     112      {
    111113        maximumBitDepth = g_bitDepth[channelTypeIndex];
     114      }
     115    }
    112116
    113117    const UInt maxval                = 255 << (maximumBitDepth - 8);
     
    148152        const ComponentID compID = ComponentID(componentIndex);
    149153
    150         if (getNumPic() == 0) MSEBasedSNR[compID] = 0 * dScale; // this is the same calculation that will be evaluated for any other statistic when there are no frames (it should result in NaN). We use it here so all the output is consistent.
     154        if (getNumPic() == 0)
     155        {
     156          MSEBasedSNR[compID] = 0 * dScale; // this is the same calculation that will be evaluated for any other statistic when there are no frames (it should result in NaN). We use it here so all the output is consistent.
     157        }
    151158        else
    152159        {
     
    171178          printf( "         \tTotal Frames |   "   "Bitrate     "  "Y-PSNR" );
    172179
    173           if (printSequenceMSE) printf( "    Y-MSE\n" );
    174           else printf("\n");
     180          if (printSequenceMSE)
     181          {
     182            printf( "    Y-MSE\n" );
     183          }
     184          else
     185          {
     186            printf("\n");
     187          }
    175188
    176189          //printf( "\t------------ "  " ----------"   " -------- "  " -------- "  " --------\n" );
     
    192205            printf( "  %8.4lf\n", m_MSEyuvframe[COMPONENT_Y ] / (Double)getNumPic() );
    193206          }
    194           else printf("\n");
     207          else
     208          {
     209            printf("\n");
     210          }
    195211
    196212#if SVC_EXTENSION
     
    208224          printf( "\tTotal Frames |   "   "Bitrate     "  "Y-PSNR" );
    209225
    210           if (printSequenceMSE) printf( "    Y-MSE\n" );
    211           else printf("\n");
     226          if (printSequenceMSE)
     227          {
     228            printf( "    Y-MSE\n" );
     229          }
     230          else
     231          {
     232            printf("\n");
     233          }
    212234
    213235          //printf( "\t------------ "  " ----------"   " -------- "  " -------- "  " --------\n" );
     
    226248            printf( "  %8.4lf\n", m_MSEyuvframe[COMPONENT_Y ] / (Double)getNumPic() );
    227249          }
    228           else printf("\n");
     250          else
     251          {
     252            printf("\n");
     253          }
    229254        }
    230255        break;
     
    246271            printf( "         \tTotal Frames |   "   "Bitrate     "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR    "  "YUV-PSNR " );
    247272
    248             if (printSequenceMSE) printf( " Y-MSE     "  "U-MSE     "  "V-MSE    "  "YUV-MSE \n" );
    249             else printf("\n");
     273            if (printSequenceMSE)
     274            {
     275              printf( " Y-MSE     "  "U-MSE     "  "V-MSE    "  "YUV-MSE \n" );
     276            }
     277            else
     278            {
     279              printf("\n");
     280            }
    250281
    251282            //printf( "\t------------ "  " ----------"   " -------- "  " -------- "  " --------\n" );
     
    272303                     MSEyuv );
    273304            }
    274             else printf("\n");
     305            else
     306            {
     307              printf("\n");
     308            }
    275309
    276310#if SVC_EXTENSION
     
    295329            printf( "\tTotal Frames |   "   "Bitrate     "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR    "  "YUV-PSNR " );
    296330           
    297             if (printSequenceMSE) printf( " Y-MSE     "  "U-MSE     "  "V-MSE    "  "YUV-MSE \n" );
    298             else printf("\n");
     331            if (printSequenceMSE)
     332            {
     333              printf( " Y-MSE     "  "U-MSE     "  "V-MSE    "  "YUV-MSE \n" );
     334            }
     335            else
     336            {
     337              printf("\n");
     338            }
    299339
    300340            //printf( "\t------------ "  " ----------"   " -------- "  " -------- "  " --------\n" );
     
    321361                     MSEyuv );
    322362            }
    323             else printf("\n");
     363            else
     364            {
     365              printf("\n");
     366            }
    324367          }
    325368        }
     
    390433                MSEyuv );
    391434          }
    392           else fprintf(pFile, "\n");
     435          else
     436          {
     437            fprintf(pFile, "\n");
     438          }
    393439
    394440          break;
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp

    r1029 r1246  
    230230#ifdef DEBUG_CABAC_BINS
    231231  if ((g_debugCounter + debugCabacBinWindow) >= debugCabacBinTargetLine)
     232  {
    232233    std::cout << g_debugCounter << ": coding bin value " << binValue << ", range = [" << startingRange << "->" << m_uiRange << "]\n";
     234  }
    233235
    234236  if (g_debugCounter >= debugCabacBinTargetLine)
     
    237239    breakPointThis = 7;
    238240  }
    239   if (g_debugCounter >= (debugCabacBinTargetLine + debugCabacBinWindow)) exit(0);
     241  if (g_debugCounter >= (debugCabacBinTargetLine + debugCabacBinWindow))
     242  {
     243    exit(0);
     244  }
     245
    240246  g_debugCounter++;
    241247#endif
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp

    r1029 r1246  
    8484#ifdef DEBUG_ENCODER_SEARCH_BINS
    8585  if ((g_debugCounter + debugEncoderSearchBinWindow) >= debugEncoderSearchBinTargetLine)
     86  {
    8687    std::cout << g_debugCounter << ": coding bin value " << binValue << ", fracBits = [" << startingFracBits << "->" << m_fracBits << "]\n";
     88  }
    8789
    8890  if (g_debugCounter >= debugEncoderSearchBinTargetLine)
     
    9193    breakPointThis = 7;
    9294  }
    93   if (g_debugCounter >= (debugEncoderSearchBinTargetLine + debugEncoderSearchBinWindow)) exit(0);
     95  if (g_debugCounter >= (debugEncoderSearchBinTargetLine + debugEncoderSearchBinWindow))
     96  {
     97    exit(0);
     98  }
    9499  g_debugCounter++;
    95100#endif
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1237 r1246  
    11551155    {
    11561156       WRITE_FLAG( pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA), "slice_sao_luma_flag" );
    1157        if (chromaEnabled) WRITE_FLAG( pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA), "slice_sao_chroma_flag" );
     1157       if (chromaEnabled)
     1158       {
     1159         WRITE_FLAG( pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA), "slice_sao_chroma_flag" );
     1160       }
    11581161    }
    11591162
     
    12741277    if (pcSlice->getPPS()->getSliceChromaQpFlag())
    12751278    {
    1276       if (numberValidComponents > COMPONENT_Cb) { WRITE_SVLC( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb), "slice_qp_delta_cb" ); }
    1277       if (numberValidComponents > COMPONENT_Cr) { WRITE_SVLC( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr), "slice_qp_delta_cr" ); }
     1279      if (numberValidComponents > COMPONENT_Cb)
     1280      {
     1281        WRITE_SVLC( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb), "slice_qp_delta_cb" );
     1282      }
     1283      if (numberValidComponents > COMPONENT_Cr)
     1284      {
     1285        WRITE_SVLC( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr), "slice_qp_delta_cr" );
     1286      }
    12781287      assert(numberValidComponents <= COMPONENT_Cr+1);
    12791288    }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r1235 r1246  
    239239
    240240  Int       m_iWaveFrontSynchro;
    241   Int       m_iWaveFrontSubstreams;
    242241
    243242  Int       m_decodedPictureHashSEIEnabled;              ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp

    r1243 r1246  
    955955      {
    956956        if (m_pcEncCfg->getCostMode()==COST_MIXED_LOSSLESS_LOSSY_CODING)
     957        {
    957958          rpcBestCU->getTotalCost()=rpcTempCU->getTotalCost() + (1.0 / m_pcRdCost->getLambda());
     959        }
    958960        else
     961        {
    959962          rpcBestCU->getTotalCost()=rpcTempCU->getTotalCost()+1;
     963        }
    960964      }
    961965
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncEntropy.cpp

    r1235 r1246  
    240240  const Bool bDebugRQT=g_bFinalEncode && DebugOptionList::DebugRQT.getInt()!=0;
    241241  if (bDebugRQT)
     242  {
    242243    printf("x..codeTransform: offsetLuma=%d offsetChroma=%d absPartIdx=%d, uiDepth=%d\n width=%d, height=%d, uiTrIdx=%d, uiInnerQuadIdx=%d\n",
    243244           rTu.getCoefficientOffset(COMPONENT_Y), rTu.getCoefficientOffset(COMPONENT_Cb), uiAbsPartIdx, uiDepth, rTu.getRect(COMPONENT_Y).width, rTu.getRect(COMPONENT_Y).height, rTu.GetTransformDepthRel(), rTu.GetSectionNumber());
     245  }
    244246#endif
    245247  const UInt uiSubdiv = pcCU->getTransformIdx( uiAbsPartIdx ) > uiTrIdx;// + pcCU->getDepth( uiAbsPartIdx ) > uiDepth;
     
    260262    {
    261263      bHaveACodedBlock = true;
    262       if (isChroma(compID)) bHaveACodedChromaBlock = true;
     264      if (isChroma(compID))
     265      {
     266        bHaveACodedChromaBlock = true;
     267      }
    263268    }
    264269  }
     
    322327    {
    323328      xEncodeTransform( bCodeDQP, codeChromaQpAdj, tuRecurseChild );
    324     }
    325     while (tuRecurseChild.nextSection(rTu));
     329    } while (tuRecurseChild.nextSection(rTu));
    326330  }
    327331  else
     
    378382        {
    379383#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
    380           if (bDebugRQT) printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, rTu.getRect(compID).width, rTu.getRect(compID).height, 1);
     384          if (bDebugRQT)
     385          {
     386            printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, rTu.getRect(compID).width, rTu.getRect(compID).height, 1);
     387          }
    381388#endif
    382389
     
    393400              {
    394401#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
    395                 if (bDebugRQT) printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, subTUIterator.getRect(compID).width, subTUIterator.getRect(compID).height, 1);
     402                if (bDebugRQT)
     403                {
     404                  printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, subTUIterator.getRect(compID).width, subTUIterator.getRect(compID).height, 1);
     405                }
    396406#endif
    397407                m_pcEntropyCoderIf->codeCoeffNxN( subTUIterator, (pcCU->getCoeff(compID) + subTUIterator.getCoefficientOffset(compID)), compID );
     
    435445  {
    436446    UInt cdir=pcCU->getIntraDir(CHANNEL_TYPE_CHROMA, uiAbsPartIdx);
    437     if (cdir==36) cdir=pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx);
     447    if (cdir==36)
     448    {
     449      cdir=pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx);
     450    }
    438451    printf("coding chroma Intra dir: %d, uiAbsPartIdx: %d, luma dir: %d\n", cdir, uiAbsPartIdx, pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx));
    439452  }
     
    683696  TComTURecurse tuRecurse(pcCU, uiAbsPartIdx, uiDepth);
    684697#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
    685   if (bDebugRQT) printf("..codeCoeff: uiAbsPartIdx=%d, PU format=%d, 2Nx2N=%d, NxN=%d\n", uiAbsPartIdx, pcCU->getPartitionSize(uiAbsPartIdx), SIZE_2Nx2N, SIZE_NxN);
     698  if (bDebugRQT)
     699  {
     700    printf("..codeCoeff: uiAbsPartIdx=%d, PU format=%d, 2Nx2N=%d, NxN=%d\n", uiAbsPartIdx, pcCU->getPartitionSize(uiAbsPartIdx), SIZE_2Nx2N, SIZE_NxN);
     701  }
    686702#endif
    687703
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1237 r1246  
    598598    sei_time_code.numClockTs = m_pcCfg->getNumberOfTimesets();
    599599    for(Int i = 0; i < sei_time_code.numClockTs; i++)
     600    {
    600601      sei_time_code.timeSetArray[i] = m_pcCfg->getTimeSet(i);
     602    }
    601603
    602604    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
     
    15421544                {
    15431545                  if(m_pcCfg->getGOPEntry(kk).m_POC==tPoc)
     1546                  {
    15441547                    break;
     1548                  }
    15451549                }
    15461550                Int tTid=m_pcCfg->getGOPEntry(kk).m_temporalId;
     
    30403044                flag = 1;
    30413045              }
    3042               else                            ui64Tmp = maxDiff - tmp + 1;
     3046              else
     3047              {
     3048                ui64Tmp = maxDiff - tmp + 1;
     3049              }
    30433050            }
    30443051            pCRD[ i ] = (UInt)ui64Tmp - uiPrev - 1;
     
    32453252  delete pcBitstreamRedirect;
    32463253
    3247   if( accumBitsDU != NULL) delete accumBitsDU;
    3248   if( accumNalsDU != NULL) delete accumNalsDU;
     3254  if( accumBitsDU != NULL)
     3255  {
     3256    delete accumBitsDU;
     3257  }
     3258  if( accumNalsDU != NULL)
     3259  {
     3260    delete accumNalsDU;
     3261  }
    32493262
    32503263#if SVC_EXTENSION
     
    33173330
    33183331  if (!bCalcDist)
     3332  {
    33193333    ruiDist = xFindDistortionFrame(pcPic->getPicYuvOrg(), pcPic->getPicYuvRec());
     3334  }
    33203335}
    33213336
     
    35563571
    35573572  Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');
    3558   if (!pcSlice->isReferenced()) c += 32;
     3573  if (!pcSlice->isReferenced())
     3574  {
     3575    c += 32;
     3576  }
    35593577
    35603578#if SVC_EXTENSION
     
    38243842      vRL[i] = 0;
    38253843      for( Int j = i - RVM_VCEGAM10_M ; j <= i + RVM_VCEGAM10_M - 1 ; j++ )
     3844      {
    38263845        vRL[i] += m_vRVM_RP[j];
     3846      }
    38273847      vRL[i] /= ( 2 * RVM_VCEGAM10_M );
    38283848      vB[i] = vB[i-1] + m_vRVM_RP[i] - vRL[i];
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncPreanalyzer.h

    r595 r1246  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2014, ITU/ISO/IEC
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r1029 r1246  
    519519        for(Int classIdx=0; classIdx<NUM_SAO_EO_CLASSES; classIdx++)
    520520        {
    521           if(classIdx==SAO_CLASS_EO_FULL_VALLEY && quantOffsets[classIdx] < 0) quantOffsets[classIdx] =0;
    522           if(classIdx==SAO_CLASS_EO_HALF_VALLEY && quantOffsets[classIdx] < 0) quantOffsets[classIdx] =0;
    523           if(classIdx==SAO_CLASS_EO_HALF_PEAK   && quantOffsets[classIdx] > 0) quantOffsets[classIdx] =0;
    524           if(classIdx==SAO_CLASS_EO_FULL_PEAK   && quantOffsets[classIdx] > 0) quantOffsets[classIdx] =0;
     521          if(classIdx==SAO_CLASS_EO_FULL_VALLEY && quantOffsets[classIdx] < 0)
     522          {
     523            quantOffsets[classIdx] =0;
     524          }
     525          if(classIdx==SAO_CLASS_EO_HALF_VALLEY && quantOffsets[classIdx] < 0)
     526          {
     527            quantOffsets[classIdx] =0;
     528          }
     529          if(classIdx==SAO_CLASS_EO_HALF_PEAK   && quantOffsets[classIdx] > 0)
     530          {
     531            quantOffsets[classIdx] =0;
     532          }
     533          if(classIdx==SAO_CLASS_EO_FULL_PEAK   && quantOffsets[classIdx] > 0)
     534          {
     535            quantOffsets[classIdx] =0;
     536          }
    525537
    526538          if( quantOffsets[classIdx] != 0 ) //iterative adjustment only when derived offset is not zero
     
    818830  {
    819831    if (sliceEnabled[compId])
     832    {
    820833      allBlksDisabled = false;
     834    }
    821835  }
    822836
     
    953967    m_lineBufWidth = m_maxCUWidth;
    954968
    955     if (m_signLineBuf1) delete[] m_signLineBuf1; m_signLineBuf1 = NULL;
     969    if (m_signLineBuf1)
     970    {
     971      delete[] m_signLineBuf1;
     972      m_signLineBuf1 = NULL;
     973    }
    956974    m_signLineBuf1 = new Char[m_lineBufWidth+1];
    957975
    958     if (m_signLineBuf2) delete[] m_signLineBuf2; m_signLineBuf2 = NULL;
     976    if (m_signLineBuf2)
     977    {
     978      delete[] m_signLineBuf2;
     979      m_signLineBuf2 = NULL;
     980    }
    959981    m_signLineBuf2 = new Char[m_lineBufWidth+1];
    960982  }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.cpp

    r1244 r1246  
    109109  SliceType eSliceType  = m_pcSlice->getSliceType();
    110110
    111   SliceType encCABACTableIdx = m_pcSlice->getEncCABACTableIdx();;
     111  SliceType encCABACTableIdx = m_pcSlice->getEncCABACTableIdx();
    112112  if (!m_pcSlice->isIntra() && (encCABACTableIdx==B_SLICE || encCABACTableIdx==P_SLICE) && m_pcSlice->getPPS()->getCabacInitPresentFlag())
    113113  {
     
    407407  m_pcBinIf->copyState( pSrc->m_pcBinIf );
    408408  if (isLuma(chType))
     409  {
    409410    this->m_cCUIntraPredSCModel      .copyFrom( &pSrc->m_cCUIntraPredSCModel       );
     411  }
    410412  else
     413  {
    411414    this->m_cCUChromaPredSCModel     .copyFrom( &pSrc->m_cCUChromaPredSCModel      );
     415  }
    412416}
    413417
     
    613617{
    614618  if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
     619  {
    615620    return;
     621  }
    616622
    617623  UInt uiCtx           = pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth );
     
    832838  TComDataCU *pcCU = rTu.getCU();
    833839
    834   if( isLuma(compID) || !pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction() ) return;
     840  if( isLuma(compID) || !pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction() )
     841  {
     842    return;
     843  }
    835844
    836845  const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU();
     
    12661275      beValid = false;
    12671276      if ( (!pcCU->isIntra(uiAbsPartIdx)) && pcCU->isRDPCMEnabled(uiAbsPartIdx))
     1277      {
    12681278        codeExplicitRdpcmMode( rTu, compID);
     1279      }
    12691280    }
    12701281    else
     
    13261337      uiNumSig--;
    13271338    }
    1328   }
    1329   while ( uiNumSig > 0 );
     1339  } while ( uiNumSig > 0 );
    13301340
    13311341  // Code position of last coefficient
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r1244 r1246  
    239239    {
    240240      if (iIdx < iNum)
     241      {
    241242        m_auiMVPIdxCost[iIdx][iNum] = xGetMvpIdxBits(iIdx, iNum);
     243      }
    242244      else
     245      {
    243246        m_auiMVPIdxCost[iIdx][iNum] = MAX_INT;
     247      }
    244248    }
    245249  }
     
    365369
    366370    if ( m_cDistParam.iRows > 32 )
     371    {
    367372      m_cDistParam.iSubShift = 4;
     373    }
    368374    else if ( m_cDistParam.iRows > 16 )
     375    {
    369376      m_cDistParam.iSubShift = 3;
     377    }
    370378    else if ( m_cDistParam.iRows > 8 )
     379    {
    371380      m_cDistParam.iSubShift = 2;
     381    }
    372382    else
     383    {
    373384      m_cDistParam.iSubShift = 1;
     385    }
    374386
    375387    Distortion uiTempSad = m_cDistParam.DistFunc( &m_cDistParam );
     
    385397        uiSad += uiTempSad >>  m_cDistParam.iSubShift;
    386398        if(((uiSad << isubShift) + uiBitCost) > rcStruct.uiBestSad)
     399        {
    387400          break;
     401        }
    388402
    389403        m_cDistParam.iSubShift--;
     
    898912      const ComponentID compID=ComponentID(ch);
    899913      if( rTu.ProcessingAllQuadrants(compID) && (uiTrDepth==0 || pcCU->getCbf( uiAbsPartIdx, compID, uiTrDepth-1 ) ))
     914      {
    900915        m_pcEntropyCoder->encodeQtCbf(rTu, compID, (uiSubdiv == 0));
     916      }
    901917    }
    902918  }
     
    10071023    {
    10081024      UInt uiQNumParts = pcCU->getTotalNumPart() >> 2;
    1009       if (uiTrDepth>0 && (uiAbsPartIdx%uiQNumParts)==0) m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx );
     1025      if (uiTrDepth>0 && (uiAbsPartIdx%uiQNumParts)==0)
     1026      {
     1027        m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx );
     1028      }
    10101029    }
    10111030  }
     
    10841103                                     )
    10851104{
    1086   if (!rTu.ProcessComponentSection(compID)) return;
     1105  if (!rTu.ProcessComponentSection(compID))
     1106  {
     1107    return;
     1108  }
    10871109  const Bool       bIsLuma = isLuma(compID);
    10881110  const TComRectangle &rect= rTu.getRect(compID);
     
    12081230    if (bUseCrossCPrediction)
    12091231    {
    1210       if (xCalcCrossComponentPredictionAlpha( rTu, compID, lumaResidualForEstimate, piResi, uiWidth, uiHeight, MAX_CU_SIZE, uiStride ) == 0) return;
     1232      if (xCalcCrossComponentPredictionAlpha( rTu, compID, lumaResidualForEstimate, piResi, uiWidth, uiHeight, MAX_CU_SIZE, uiStride ) == 0)
     1233      {
     1234        return;
     1235      }
    12111236      TComTrQuant::crossComponentPrediction ( rTu, compID, reconstructedLumaResidual, piResi, piResi, uiWidth, uiHeight, MAX_CU_SIZE, uiStride, uiStride, false );
    12121237    }
     
    13071332          }
    13081333        }
    1309         if (bDebugResi) ss << " - resi: ";
     1334        if (bDebugResi)
     1335        {
     1336          ss << " - resi: ";
     1337        }
    13101338        for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    13111339        {
    1312           if (bDebugResi) ss << pResi[ uiX ] << ", ";
     1340          if (bDebugResi)
     1341          {
     1342            ss << pResi[ uiX ] << ", ";
     1343          }
    13131344          pReco    [ uiX ] = Pel(ClipBD<Int>( Int(pPred[uiX]) + Int(pResi[uiX]), clipbd ));
    13141345          pRecQt   [ uiX ] = pReco[ uiX ];
     
    15271558        xLoadIntraResultQT(COMPONENT_Y, rTu );
    15281559        if (rTu.ProcessComponentSection(COMPONENT_Y))
     1560        {
    15291561          pcCU->setCbfSubParts  ( uiSingleCbfLuma << uiTrDepth, COMPONENT_Y, uiAbsPartIdx, rTu.GetTransformDepthTotalAdj(COMPONENT_Y) );
     1562        }
    15301563
    15311564        m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiFullDepth ][ CI_TEMP_BEST ] );
     
    19021935  if(  uiTrMode == uiTrDepth )
    19031936  {
    1904     if (!rTu.ProcessChannelSection(CHANNEL_TYPE_CHROMA)) return;
     1937    if (!rTu.ProcessChannelSection(CHANNEL_TYPE_CHROMA))
     1938    {
     1939      return;
     1940    }
    19051941
    19061942    const UInt uiFullDepth = rTu.GetTransformDepthTotal();
     
    20412077        pcCU ->setCrossComponentPredictionAlphaPartRange( bestCrossCPredictionAlpha, compID, subTUAbsPartIdx, partIdxesPerSubTU );
    20422078        ruiDist += singleDistC;
    2043       }
    2044       while (TUIterator.nextSection(rTu));
    2045 
    2046       if (splitIntoSubTUs) offsetSubTUCBFs(rTu, compID);
     2079      } while (TUIterator.nextSection(rTu));
     2080
     2081      if (splitIntoSubTUs)
     2082      {
     2083        offsetSubTUCBFs(rTu, compID);
     2084      }
    20472085    }
    20482086  }
     
    20922130TEncSearch::xSetIntraResultChromaQT(TComYuv*    pcRecoYuv, TComTU &rTu)
    20932131{
    2094   if (!rTu.ProcessChannelSection(CHANNEL_TYPE_CHROMA)) return;
     2132  if (!rTu.ProcessChannelSection(CHANNEL_TYPE_CHROMA))
     2133  {
     2134    return;
     2135  }
    20952136  TComDataCU *pcCU=rTu.getCU();
    20962137  const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU();
     
    22082249
    22092250    if (tuRecurseWithPU.ProcessComponentSection(COMPONENT_Y))
     2251    {
    22102252      initAdiPatternChType( tuRecurseWithPU, bAboveAvail, bLeftAvail, COMPONENT_Y, true DEBUG_STRING_PASS_INTO(sTemp2) );
     2253    }
    22112254
    22122255    Bool doFastSearch = (numModesForFullRD != numModesAvailable);
     
    23332376    UInt max=numModesForFullRD;
    23342377
    2335     if (DebugOptionList::ForceLumaMode.isSet()) max=0;  // we are forcing a direction, so don't bother with mode check
     2378    if (DebugOptionList::ForceLumaMode.isSet())
     2379    {
     2380      max=0;  // we are forcing a direction, so don't bother with mode check
     2381    }
    23362382    for ( UInt uiMode = 0; uiMode < max; uiMode++)
    23372383#else
     
    24242470#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
    24252471      if (DebugOptionList::ForceLumaMode.isSet())
     2472      {
    24262473        uiOrgMode = DebugOptionList::ForceLumaMode.getInt();
     2474      }
    24272475#endif
    24282476
     
    25872635        {
    25882636          uiMinMode=DebugOptionList::ForceChromaMode.getInt();
    2589           if (uiModeList[uiMinMode]==34) uiMinMode=4; // if the fixed mode has been renumbered because DM_CHROMA covers it, use DM_CHROMA.
     2637          if (uiModeList[uiMinMode]==34)
     2638          {
     2639            uiMinMode=4; // if the fixed mode has been renumbered because DM_CHROMA covers it, use DM_CHROMA.
     2640          }
    25902641          uiMaxMode=uiMinMode+1;
    25912642        }
     
    30833134        {
    30843135          uiBitsTemp += iRefIdxTemp+1;
    3085           if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--;
     3136          if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 )
     3137          {
     3138            uiBitsTemp--;
     3139          }
    30863140        }
    30873141
     
    32093263        {
    32103264          uiMotBits[1] += bestBiPRefIdxL1+1;
    3211           if ( bestBiPRefIdxL1 == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiMotBits[1]--;
     3265          if ( bestBiPRefIdxL1 == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 )
     3266          {
     3267            uiMotBits[1]--;
     3268          }
    32123269        }
    32133270
     
    33193376          {
    33203377            uiBitsTemp += iRefIdxTemp+1;
    3321             if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--;
     3378            if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 )
     3379            {
     3380              uiBitsTemp--;
     3381            }
    33223382          }
    33233383          uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
     
    36983758  assert(pcAMVPInfo->m_acMvCand[riMVPIdx] == rcMvPred);
    36993759
    3700   if (pcAMVPInfo->iN < 2) return;
     3760  if (pcAMVPInfo->iN < 2)
     3761  {
     3762    return;
     3763  }
    37013764
    37023765  m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(0) );
     
    37123775  for (Int iMVPIdx = 0; iMVPIdx < pcAMVPInfo->iN; iMVPIdx++)
    37133776  {
    3714     if (iMVPIdx == riMVPIdx) continue;
     3777    if (iMVPIdx == riMVPIdx)
     3778    {
     3779      continue;
     3780    }
    37153781
    37163782    m_pcRdCost->setPredictor( pcAMVPInfo->m_acMvCand[iMVPIdx] );
     
    38393905  TComMv      cMvPred = *pcMvPred;
    38403906
    3841   if ( bBi )  xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB );
    3842   else        xSetSearchRange   ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB );
     3907  if ( bBi )
     3908  {
     3909    xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB );
     3910  }
     3911  else
     3912  {
     3913    xSetSearchRange   ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB );
     3914  }
    38433915
    38443916  m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
     
    45094581  if( (pcCU->getWidth(0) > pcCU->getSlice()->getSPS()->getMaxTrSize()) )
    45104582  {
    4511     while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++;
     4583    while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) )
     4584    {
     4585      uiTrLevel++;
     4586    }
    45124587  }
    45134588
     
    49915066                currCompCost = m_pcRdCost->calcRdCost(currCompBits, currCompDist);
    49925067                 
    4993                 if (pcCU->isLosslessCoded(0)) nonCoeffCost = MAX_DOUBLE;
     5068                if (pcCU->isLosslessCoded(0))
     5069                {
     5070                  nonCoeffCost = MAX_DOUBLE;
     5071                }
    49945072              }
    49955073              else if ((transformSkipModeId == 1) && !bUseCrossCPrediction)
     
    50865164          pcCU->setCbfPartRange                          ((((uiAbsSum                    [compID][subTUIndex] > 0) ? 1 : 0) << uiTrMode), compID, subTUAbsPartIdx, partIdxesPerSubTU );
    50875165          pcCU->setCrossComponentPredictionAlphaPartRange(   bestCrossCPredictionAlpha   [compID][subTUIndex],                            compID, subTUAbsPartIdx, partIdxesPerSubTU );
    5088         } //end of sub-TU loop
    5089         while (TUIterator.nextSection(rTu));
     5166        } while (TUIterator.nextSection(rTu)); //end of sub-TU loop
    50905167      } // processing section
    50915168    } // component loop
     
    51295206
    51305207        m_pcEntropyCoder->encodeCoeffNxN( rTu, pcCoeffCurr[compID], compID );
    5131         for (UInt subTUIndex = 0; subTUIndex < 2; subTUIndex++) uiSingleDist += uiSingleDistComp[compID][subTUIndex];
     5208        for (UInt subTUIndex = 0; subTUIndex < 2; subTUIndex++)
     5209        {
     5210          uiSingleDist += uiSingleDistComp[compID][subTUIndex];
     5211        }
    51325212      }
    51335213    }
     
    51685248
    51695249          for (UInt subTU = 0; subTU < 2; subTU++)
     5250          {
    51705251            bestsubTUCBF[compID][subTU] = pcCU->getCbf ((uiAbsPartIdx + (subTU * partIdxesPerSubTU)), compID, subTUDepth);
     5252          }
    51715253        }
    51725254      }
     
    51895271      for(UInt ch = 0; ch < numValidComp; ch++)
    51905272      {
    5191         if (lastPos!=std::string::npos && childString.find(debug_reorder_data_inter_token[ch], lastPos)==lastPos) lastPos+=strlen(debug_reorder_data_inter_token[ch]); // skip leading string
     5273        if (lastPos!=std::string::npos && childString.find(debug_reorder_data_inter_token[ch], lastPos)==lastPos)
     5274        {
     5275          lastPos+=strlen(debug_reorder_data_inter_token[ch]); // skip leading string
     5276        }
    51925277        std::size_t pos=childString.find(debug_reorder_data_inter_token[ch+1], lastPos);
    5193         if (pos!=std::string::npos && pos>endStrng) lastPos=endStrng;
     5278        if (pos!=std::string::npos && pos>endStrng)
     5279        {
     5280          lastPos=endStrng;
     5281        }
    51945282        sSplitString[ch]+=childString.substr(lastPos, (pos==std::string::npos)? std::string::npos : (pos-lastPos) );
    51955283        lastPos=pos;
    51965284      }
    51975285#endif
    5198     }
    5199     while ( tuRecurseChild.nextSection(rTu) ) ;
     5286    } while ( tuRecurseChild.nextSection(rTu) ) ;
    52005287
    52015288    UInt uiCbfAny=0;
     
    54745561  m_pcEntropyCoder->resetBits();
    54755562  if (isLuma(chType))
     5563  {
    54765564    m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPartOffset);
     5565  }
    54775566  else
     5567  {
    54785568    m_pcEntropyCoder->encodeIntraDirModeChroma ( pcCU, uiPartOffset);
     5569  }
    54795570
    54805571  rIntraDirVal = origVal; // restore
     
    54915582  UInt shift=0;
    54925583
    5493   while ( shift<uiFastCandNum && uiCost<CandCostList[ uiFastCandNum-1-shift ] ) shift++;
     5584  while ( shift<uiFastCandNum && uiCost<CandCostList[ uiFastCandNum-1-shift ] )
     5585  {
     5586    shift++;
     5587  }
    54945588
    54955589  if( shift!=0 )
     
    57935887  m_cDistParam.bApplyWeight = ( pcSlice->getSliceType()==P_SLICE && pcSlice->testWeightPred() ) || ( pcSlice->getSliceType()==B_SLICE && pcSlice->testWeightBiPred() ) ;
    57945888
    5795   if ( !m_cDistParam.bApplyWeight ) return;
     5889  if ( !m_cDistParam.bApplyWeight )
     5890  {
     5891    return;
     5892  }
    57965893
    57975894  Int iRefIdx0 = ( eRefPicListCur == REF_PIC_LIST_0 ) ? iRefIdx : (-1);
     
    58005897  getWpScaling( pcCU, iRefIdx0, iRefIdx1, wp0 , wp1 );
    58015898
    5802   if ( iRefIdx0 < 0 ) wp0 = NULL;
    5803   if ( iRefIdx1 < 0 ) wp1 = NULL;
     5899  if ( iRefIdx0 < 0 )
     5900  {
     5901    wp0 = NULL;
     5902  }
     5903  if ( iRefIdx1 < 0 )
     5904  {
     5905    wp1 = NULL;
     5906  }
    58045907
    58055908  m_cDistParam.wpCur  = NULL;
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r1235 r1246  
    9898
    9999  // free lambda and QP arrays
    100   if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; }
    101   if ( m_pdRdPicQp     ) { xFree( m_pdRdPicQp     ); m_pdRdPicQp     = NULL; }
    102   if ( m_piRdPicQp     ) { xFree( m_piRdPicQp     ); m_piRdPicQp     = NULL; }
     100  if ( m_pdRdPicLambda )
     101  {
     102    xFree( m_pdRdPicLambda );
     103    m_pdRdPicLambda = NULL;
     104  }
     105  if ( m_pdRdPicQp )
     106  {
     107    xFree( m_pdRdPicQp );
     108    m_pdRdPicQp = NULL;
     109  }
     110  if ( m_piRdPicQp )
     111  {
     112    xFree( m_piRdPicQp );
     113    m_piRdPicQp = NULL;
     114  }
    103115}
    104116
     
    952964
    953965    if (boundingCtuTsAddr <= ctuTsAddr)
     966    {
    954967      break;
     968    }
    955969
    956970    pcSlice->setSliceBits( (UInt)(pcSlice->getSliceBits() + numberOfWrittenBits) );
     
    11231137        ComponentID compId=ComponentID(comp);
    11241138        sliceEnabled[compId] = pcSlice->getSaoEnabledFlag(toChannelType(compId)) && (comp < pcPic->getNumberValidComponents());
    1125         if (sliceEnabled[compId]) bIsSAOSliceEnabled=true;
     1139        if (sliceEnabled[compId])
     1140        {
     1141          bIsSAOSliceEnabled=true;
     1142        }
    11261143      }
    11271144      if (bIsSAOSliceEnabled)
     
    12281245      break;
    12291246    case FIXED_NUMBER_OF_BYTES:
    1230       if (encodingSlice)
    1231         boundingCtuTSAddrSlice  = sliceCurEndCtuTSAddr;
    1232       else
    1233         boundingCtuTSAddrSlice  = numberOfCtusInFrame;
     1247      boundingCtuTSAddrSlice  = (encodingSlice) ? sliceCurEndCtuTSAddr : numberOfCtusInFrame;
    12341248      break;
    12351249    case FIXED_NUMBER_OF_TILES:
     
    13021316 * \returns Updates startCtuTsAddr, boundingCtuTsAddr with appropriate CTU address
    13031317 */
    1304 Void TEncSlice::xDetermineStartAndBoundingCtuTsAddr  ( UInt& startCtuTsAddr, UInt& boundingCtuTsAddr, TComPic* pcPic, const Bool encodingSlice )
     1318Void TEncSlice::xDetermineStartAndBoundingCtuTsAddr  ( UInt& startCtuTsAddr, UInt& boundingCtuTsAddr, TComPic* pcPic, const Bool encodingSlice ) // TODO: this is now only ever called with encodingSlice=false
    13051319{
    13061320  TComSlice* pcSlice                 = pcPic->getSlice(getSliceIdx());
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r1235 r1246  
    15161516  {
    15171517    for(Int i=0; i<m_iNumRowsMinus1; i++)
     1518    {
    15181519      uiCummulativeRowHeight += m_tileRowHeight[i];
     1520    }
    15191521
    15201522    if( uiCummulativeRowHeight >= iHeightInCU )
  • branches/SHM-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r1235 r1246  
    9292
    9393      for(Int y = 0; y < iHeight; y++, pPel+=iStride )
     94      {
    9495        for(Int x = 0; x < iWidth; x++ )
     96        {
    9597          iOrgDC += (Int)( pPel[x] );
     98        }
     99      }
    96100    }
    97101
     
    103107
    104108      for(Int y = 0; y < iHeight; y++, pPel += iStride )
     109      {
    105110        for(Int x = 0; x < iWidth; x++ )
     111        {
    106112          iOrgAC += abs( (Int)pPel[x] - (Int)iOrgNormDC );
     113        }
     114      }
    107115    }
    108116
     
    117125  slice->setWpAcDcParam(weightACDCParam);
    118126}
     127
    119128
    120129/** check weighted pred or non-weighted pred
     
    296305
    297306        if(deltaWeight >= range || deltaWeight < -range)
     307        {
    298308          return false;
     309        }
    299310
    300311#if SVC_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.