Changeset 1386 in 3DVCSoftware for trunk/source


Ignore:
Timestamp:
13 Nov 2015, 16:29:39 (9 years ago)
Author:
tech
Message:

Merged 15.1-dev1@1381.

Location:
trunk/source
Files:
117 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/source/App/TAppDecoder/TAppDecCfg.cpp

    r1356 r1386  
    6262    \param argv array of arguments
    6363 */
    64 Bool TAppDecCfg::parseCfg( Int argc, Char* argv[] )
     64Bool TAppDecCfg::parseCfg( Int argc, TChar* argv[] )
    6565{
    6666  Bool do_help = false;
    67   string cfg_BitstreamFile;
    68   string cfg_ReconFile;
    6967  string cfg_TargetDecLayerIdSetFile;
    7068#if NH_3D
     
    7977
    8078  ("help",                      do_help,                               false,      "this help text")
    81   ("BitstreamFile,b",           cfg_BitstreamFile,                     string(""), "bitstream input file name")
    82   ("ReconFile,o",               cfg_ReconFile,                         string(""), "reconstructed YUV output file name\n"
     79  ("BitstreamFile,b",           m_bitstreamFileName,                   string(""), "bitstream input file name")
     80  ("ReconFile,o",               m_reconFileName,                       string(""), "reconstructed YUV output file name\n"
    8381                                                                                   "YUV writing is skipped if omitted")
    8482#if NH_3D
     
    9290  ("OutputColourSpaceConvert",  outputColourSpaceConvert,              string(""), "Colour space conversion to apply to input 444 video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(false))
    9391#if NH_MV
    94   ("TargetOptLayerSetIdx,x",    m_targetOptLayerSetIdx,                -1,        "Target output layer set index. (default: -1, determine automatically to be equal to highest layer set index") // Should actually equal to 0 as default. However, this would cause only the base layer to be decoded. 
     92  ("TargetOptLayerSetIdx,x", m_targetOptLayerSetInd, std::vector<Int>(1,-1), "Target output layer set index. (default: -1, determine automatically to be equal to highest layer set index") // Should actually equal to 0 as default. However, this would cause only the base layer to be decoded. 
    9593#endif
    9694  ("MaxTemporalLayer,t",        m_iMaxTemporalLayer,                   -1,         "Maximum Temporal Layer to be decoded. -1 to decode all layers")
     
    106104  ("PrintNalus,n",              m_printReceivedNalus,                 false,        "Print information on received NAL units")
    107105#endif
     106  ("SEIColourRemappingInfoFilename",  m_colourRemapSEIFileName,        string(""), "Colour Remapping YUV output file name. If empty, no remapping is applied (ignore SEI message)\n")
     107
    108108#if O0043_BEST_EFFORT_DECODING
    109109  ("ForceDecodeBitDepth",       m_forceDecodeBitDepth,                 0U,         "Force the decoder to operate at a particular bit-depth (best effort decoding)")
    110110#endif
    111 #if NH_MV_SEI
     111#if NH_MV
    112112  ("OutputDecodedSEIMessagesFilename,m",  m_outputDecodedSEIMessagesFilename,    string(""), "When non empty, output decoded SEI messages to the indicated file. If file is '-', then output to stdout\n")
    113113#else
     
    119119  po::setDefaults(opts);
    120120  po::ErrorReporter err;
    121   const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv, err);
    122 
    123   for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
     121  const list<const TChar*>& argv_unhandled = po::scanArgv(opts, argc, (const TChar**) argv, err);
     122
     123  for (list<const TChar*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
    124124  {
    125125    fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
     
    148148  }
    149149
    150   /* convert std::string to c string for compatability */
    151   m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    152   m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    153 
    154150#if NH_3D
    155151  m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());
    156152#endif
    157153
    158   if (!m_pchBitstreamFile)
     154  if (m_bitstreamFileName.empty())
    159155  {
    160156    fprintf(stderr, "No input file specified, aborting\n");
     
    217213
    218214#if NH_MV
    219 Void TAppDecCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName)
     215Void TAppDecCfg::xAppendToFileNameEnd( const TChar* pchInputFileName, const TChar* pchStringToAppend, TChar*& rpchOutputFileName)
    220216{
    221217  size_t iInLength     = strlen(pchInputFileName);
    222218  size_t iAppendLength = strlen(pchStringToAppend);
    223219
    224   rpchOutputFileName = (Char*) malloc(iInLength+iAppendLength+1);                       
    225   Char* pCDot = strrchr(pchInputFileName,'.');         
     220  rpchOutputFileName = (TChar*) malloc(iInLength+iAppendLength+1);                       
     221  const TChar* pCDot = strrchr(pchInputFileName,'.');         
    226222  pCDot = pCDot ? pCDot : pchInputFileName + iInLength;       
    227223  size_t iCharsToDot = pCDot - pchInputFileName ;
  • TabularUnified trunk/source/App/TAppDecoder/TAppDecCfg.h

    r1356 r1386  
    6060{
    6161protected:
    62   Char*         m_pchBitstreamFile;                     ///< input bitstream file name
    63   Char*         m_pchReconFile;                         ///< output reconstruction file name
     62  std::string   m_bitstreamFileName;                    ///< input bitstream file name
     63  std::string   m_reconFileName;                        ///< output reconstruction file name
    6464  Int           m_iSkipFrame;                           ///< counter for frames prior to the random access point to skip
    6565  Int           m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit depth used for writing output
     
    6969  Int           m_decodedPictureHashSEIEnabled;       ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
    7070  Bool          m_decodedNoDisplaySEIEnabled;         ///< Enable(true)/disable(false) writing only pictures that get displayed based on the no display SEI message
     71  std::string   m_colourRemapSEIFileName;             ///< output Colour Remapping file name
    7172  std::vector<Int> m_targetDecLayerIdSet;             ///< set of LayerIds to be included in the sub-bitstream extraction process.
    7273
     
    7879  Bool          m_bClipOutputVideoToRec709Range;      ///< If true, clip the output video to the Rec 709 range on saving.
    7980#if NH_MV
    80   std::vector<Char*> m_pchReconFiles;                   ///< array of output reconstruction file name create from output reconstruction file name
     81  std::vector<TChar*> m_pchReconFiles;                ///< array of output reconstruction file name create from output reconstruction file name
    8182
    82   Int           m_targetOptLayerSetIdx;                 ///< target output layer set index
     83  std::vector<Int> m_targetOptLayerSetInd;            ///< target output layer set indices (multiple decoding when more than one element, e.g. for additional layer sets)
     84  Int           m_targetOptLayerSetIdx;               ///< current target output layer set index
     85
    8386  Int           m_targetDecLayerSetIdx;
    8487  Int           m_baseLayerOutputFlag;
    8588  Int           m_baseLayerPicOutputFlag;
    8689  Int           m_auOutputFlag;
    87   Int           m_maxLayerId;                           ///< maximum nuh_layer_id decoded
     90  Int           m_maxLayerId;                         ///< maximum nuh_layer_id decoded
    8891  std::ifstream m_bitstreamFile;
    8992  Int           m_highestTid;
    9093  Bool          m_targetDecLayerIdSetFileEmpty;       ///< indication if target layers are given by file
    9194
    92   Bool          m_printVpsInfo;                      ///< Output VPS information
     95  Bool          m_printVpsInfo;                       ///< Output VPS information
    9396  Bool          m_printPicOutput;                     ///< Print information on picture output
    9497  Bool          m_printReceivedNalus;                 ///< Print information on received NAL units
    9598#if NH_3D
    96   Char*         m_pchScaleOffsetFile;                   ///< output coded scale and offset parameters
     99  TChar*        m_pchScaleOffsetFile;                   ///< output coded scale and offset parameters
    97100  Bool          m_depth420OutputFlag;                   ///< output depth layers in 4:2:0
    98101#endif
    99102
    100   Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName); ///< create filenames
     103  Void xAppendToFileNameEnd( const TChar* pchInputFileName, const TChar* pchStringToAppend, TChar*& rpchOutputFileName); ///< create filenames
    101104#endif
    102105
    103106public:
    104107  TAppDecCfg()
    105   : m_pchBitstreamFile(NULL)
    106   , m_pchReconFile(NULL)
     108  : m_bitstreamFileName()
     109  , m_reconFileName()
    107110  , m_iSkipFrame(0)
     111  // m_outputBitDepth array initialised below
    108112  , m_outputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
    109113  , m_iMaxTemporalLayer(-1)
    110114  , m_decodedPictureHashSEIEnabled(0)
    111115  , m_decodedNoDisplaySEIEnabled(false)
     116  , m_colourRemapSEIFileName()
     117  , m_targetDecLayerIdSet()
    112118  , m_respectDefDispWindow(0)
    113119#if O0043_BEST_EFFORT_DECODING
    114120  , m_forceDecodeBitDepth(0)
    115121#endif
     122  , m_outputDecodedSEIMessagesFilename()
     123  , m_bClipOutputVideoToRec709Range(false)
    116124#if NH_MV
    117125  , m_highestTid(-1)
     
    131139  virtual ~TAppDecCfg() {}
    132140
    133   Bool  parseCfg        ( Int argc, Char* argv[] );   ///< initialize option class from configuration
     141  Bool  parseCfg        ( Int argc, TChar* argv[] );   ///< initialize option class from configuration
     142#if NH_MV
     143  Int   getNumDecodings ( ) { return (Int) m_targetOptLayerSetInd.size();  };
     144#endif
    134145};
    135146
  • TabularUnified trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r1321 r1386  
    6262: m_numDecoders( 0 )
    6363#endif
     64 ,m_pcSeiColourRemappingInfoPrevious(NULL)
    6465{
    6566#if NH_MV
     
    118119  xDestroyDecLib();
    119120#endif
    120 
    121   if (m_pchBitstreamFile)
    122   {
    123     free (m_pchBitstreamFile);
    124     m_pchBitstreamFile = NULL;
    125   }
     121  m_bitstreamFileName.clear();
    126122#if NH_MV
    127123  for (Int decIdx = 0; decIdx < m_numDecoders; decIdx++)
     
    134130  }
    135131#endif
    136   if (m_pchReconFile)
    137   {
    138     free (m_pchReconFile);
    139     m_pchReconFile = NULL;
    140   }
     132  m_reconFileName.clear();
    141133#if NH_3D
    142134  if (m_pchScaleOffsetFile)
     
    160152 .
    161153 */
    162 
    163154#if NH_MV
    164 Void TAppDecTop::decode()
    165 {
     155Void TAppDecTop::decode( Int num )
     156{
     157  m_targetOptLayerSetIdx = m_targetOptLayerSetInd[ num ];
    166158  // create & initialize internal classes
    167159  xInitFileIO  ();
     
    221213
    222214#if !NH_MV
    223 Void TAppDecTop::decode()
     215Void TAppDecTop::decode( )
    224216{
    225217  Int                 poc;
    226218  TComList<TComPic*>* pcListPic = NULL;
    227219
    228   ifstream bitstreamFile(m_pchBitstreamFile, ifstream::in | ifstream::binary);
     220  ifstream bitstreamFile(m_bitstreamFileName.c_str(), ifstream::in | ifstream::binary);
    229221  if (!bitstreamFile)
    230222  {
    231     fprintf(stderr, "\nfailed to open bitstream file `%s' for reading\n", m_pchBitstreamFile);
     223    fprintf(stderr, "\nfailed to open bitstream file `%s' for reading\n", m_bitstreamFileName.c_str());
    232224    exit(EXIT_FAILURE);
    233225  }
     
    250242
    251243  m_iPOCLastDisplay += m_iSkipFrame;      // set the last displayed POC correctly for skip forward.
     244
     245  // clear contents of colour-remap-information-SEI output file
     246  if (!m_colourRemapSEIFileName.empty())
     247  {
     248    std::ofstream ofile(m_colourRemapSEIFileName.c_str());
     249    if (!ofile.good() || !ofile.is_open())
     250    {
     251      fprintf(stderr, "\nUnable to open file '%s' for writing colour-remap-information-SEI video\n", m_colourRemapSEIFileName.c_str());
     252      exit(EXIT_FAILURE);
     253    }
     254  }
    252255
    253256  // main decoder loop
     
    336339    if( pcListPic )
    337340    {
    338       if ( m_pchReconFile && !openedReconFile )
     341      if ( (!m_reconFileName.empty()) && (!openedReconFile) )
    339342      {
    340343        const BitDepths &bitDepths=pcListPic->front()->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture.
     
    346349          }
    347350        }
    348         m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
     351
     352        m_cTVideoIOYuvReconFile.open( m_reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
    349353        openedReconFile = true;
    350354      }
     
    436440  }
    437441#else
    438   if ( m_pchReconFile )
     442  if ( !m_reconFileName.empty() )
    439443  {
    440444    m_cTVideoIOYuvReconFile. close();
     
    444448  m_cTDecTop.destroy();
    445449#endif
     450  if (m_pcSeiColourRemappingInfoPrevious != NULL)
     451  {
     452    delete m_pcSeiColourRemappingInfoPrevious;
     453    m_pcSeiColourRemappingInfoPrevious = NULL;
     454  }
    446455#if NH_3D
    447456  m_cCamParsCollector.uninit();
     
    474483  }
    475484#endif
     485  if (m_pcSeiColourRemappingInfoPrevious != NULL)
     486  {
     487    delete m_pcSeiColourRemappingInfoPrevious;
     488    m_pcSeiColourRemappingInfoPrevious = NULL;
     489  }
    476490}
    477491
     
    549563        // write to file
    550564        numPicsNotYetDisplayed = numPicsNotYetDisplayed-2;
    551         if ( m_pchReconFile )
     565        if ( !m_reconFileName.empty() )
    552566        {
    553567          const Window &conf = pcPicTop->getConformanceWindow();
     
    617631          dpbFullness--;
    618632        }
    619         if ( m_pchReconFile )
     633        if ( !m_reconFileName.empty() )
    620634        {
    621635          const Window &conf    = pcPic->getConformanceWindow();
     
    631645        }
    632646
     647        if (!m_colourRemapSEIFileName.empty())
     648        {
     649          xOutputColourRemapPic(pcPic);
     650        }
     651
    633652        // update POC of display order
    634653        m_iPOCLastDisplay = pcPic->getPOC();
     
    678697        // write to file
    679698
    680         if ( m_pchReconFile )
     699        if ( !m_reconFileName.empty() )
    681700        {
    682701          const Window &conf = pcPicTop->getConformanceWindow();
     
    736755      {
    737756        // write to file
    738         if ( m_pchReconFile )
     757        if ( !m_reconFileName.empty() )
    739758        {
    740759          const Window &conf    = pcPic->getConformanceWindow();
     
    749768        }
    750769
     770        if (!m_colourRemapSEIFileName.empty())
     771        {
     772          xOutputColourRemapPic(pcPic);
     773        }
     774
    751775        // update POC of display order
    752776        m_iPOCLastDisplay = pcPic->getPOC();
     
    10681092    m_newVpsActivatedbyCurAu  = true; //TBD
    10691093    m_newVpsActivatedbyCurPic = true;
    1070 #if NH_3D
     1094#if NH_3D_VSO
    10711095    m_dpb.setVPS( m_vps );
    10721096#endif
     
    12321256  }
    12331257
    1234   if ( m_printVpsInfo  && ( m_decProcCvsg == ANNEX_F ) )
     1258  if ( m_printVpsInfo  && ( m_decProcCvsg == ANNEX_F ) && ( m_targetOptLayerSetIdx == m_targetOptLayerSetInd[ 0 ] ) )
    12351259  {
    12361260    m_vps->printScalabilityId();
     
    19792003      // - After all slices of the current picture have been decoded, the decoding process for ending the decoding of a
    19802004      //   coded picture with nuh_layer_id greater than 0 specified in clause F.8.1.6 is invoked.
    1981       xF816decProcEndDecOfCodPicLIdGrtZero( );
     2005      xF816decProcEndDecOfCodPicLIdGrtZero( );     
    19822006    }
    19832007
     
    26712695
    26722696    // create recon file related stuff
    2673     Char* pchTempFilename = NULL;
    2674     if ( m_pchReconFile )
    2675     {
    2676       Char buffer[4];
     2697    TChar* pchTempFilename = NULL;
     2698    if ( !m_reconFileName.empty() )
     2699    {
     2700      TChar buffer[4];
    26772701      sprintf(buffer,"_%i", layerId );
    2678       assert ( m_pchReconFile );
    2679       xAppendToFileNameEnd( m_pchReconFile , buffer, pchTempFilename );
     2702      assert ( !m_reconFileName.empty() );
     2703      xAppendToFileNameEnd( m_reconFileName.c_str() , buffer, pchTempFilename );
    26802704      assert( m_pchReconFiles.size() == m_numDecoders );
    26812705    }
     
    28702894Void TAppDecTop::xInitFileIO()
    28712895{
    2872   m_bitstreamFile.open(m_pchBitstreamFile, ifstream::in | ifstream::binary);
     2896  m_bitstreamFile.open(m_bitstreamFileName.c_str(), ifstream::in | ifstream::binary);
    28732897
    28742898  if ( !m_bitstreamFile)
    28752899  {
    2876     fprintf(stderr, "\nUnable to open bitstream file `%s' for reading\n", m_pchBitstreamFile);
     2900    fprintf(stderr, "\nUnable to open bitstream file `%s' for reading\n", m_bitstreamFileName.c_str());
    28772901    exit(EXIT_FAILURE);
    28782902  }
     
    29052929  Int decIdx = xGetDecoderIdx( curPic->getLayerId() );
    29062930
    2907   if ( m_pchReconFile && !m_reconOpen[decIdx] )
     2931  if ( !m_reconFileName.empty() && !m_reconOpen[decIdx] )
    29082932  {
    29092933    const BitDepths &bitDepths= curPic->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture.
     
    30073031
    30083032#endif
     3033
     3034Void TAppDecTop::xOutputColourRemapPic(TComPic* pcPic)
     3035{
     3036  const TComSPS &sps=pcPic->getPicSym()->getSPS();
     3037  SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO );
     3038  SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL;
     3039
     3040  if (colourRemappingInfo.size() > 1)
     3041  {
     3042    printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first.");
     3043  }
     3044  if (seiColourRemappingInfo)
     3045  {
     3046    applyColourRemapping(*pcPic->getPicYuvRec(), *seiColourRemappingInfo, sps);
     3047
     3048    // save the last CRI SEI received
     3049    if (m_pcSeiColourRemappingInfoPrevious == NULL)
     3050    {
     3051      m_pcSeiColourRemappingInfoPrevious = new SEIColourRemappingInfo();
     3052    }
     3053    m_pcSeiColourRemappingInfoPrevious->copyFrom(*seiColourRemappingInfo);
     3054  }
     3055  else  // using the last CRI SEI received
     3056  {
     3057    // TODO: prevent persistence of CRI SEI across C(L)VS.
     3058    if (m_pcSeiColourRemappingInfoPrevious != NULL)
     3059    {
     3060      if (m_pcSeiColourRemappingInfoPrevious->m_colourRemapPersistenceFlag == false)
     3061      {
     3062        printf("Warning No SEI-CRI message is present for the current picture, persistence of the CRI is not managed\n");
     3063      }
     3064      applyColourRemapping(*pcPic->getPicYuvRec(), *m_pcSeiColourRemappingInfoPrevious, sps);
     3065    }
     3066  }
     3067}
     3068
     3069// compute lut from SEI
     3070// use at lutPoints points aligned on a power of 2 value
     3071// SEI Lut must be in ascending values of coded Values
     3072static std::vector<Int>
     3073initColourRemappingInfoLut(const Int                                          bitDepth_in,     // bit-depth of the input values of the LUT
     3074                           const Int                                          nbDecimalValues, // Position of the fixed point
     3075                           const std::vector<SEIColourRemappingInfo::CRIlut> &lut,
     3076                           const Int                                          maxValue, // maximum output value
     3077                           const Int                                          lutOffset)
     3078{
     3079  const Int lutPoints = (1 << bitDepth_in) + 1 ;
     3080  std::vector<Int> retLut(lutPoints);
     3081
     3082  // missing values: need to define default values before first definition (check codedValue[0] == 0)
     3083  Int iTargetPrev = (lut.size() && lut[0].codedValue == 0) ? lut[0].targetValue: 0;
     3084  Int startPivot = (lut.size())? ((lut[0].codedValue == 0)? 1: 0): 1;
     3085  Int iCodedPrev  = 0;
     3086  // set max value with the coded bit-depth
     3087  // + ((1 << nbDecimalValues) - 1) is for the added bits
     3088  const Int maxValueFixedPoint = (maxValue << nbDecimalValues) + ((1 << nbDecimalValues) - 1);
     3089
     3090  Int iValue = 0;
     3091
     3092  for ( Int iPivot=startPivot ; iPivot < (Int)lut.size(); iPivot++ )
     3093  {
     3094    Int iCodedNext  = lut[iPivot].codedValue;
     3095    Int iTargetNext = lut[iPivot].targetValue;
     3096
     3097    // ensure correct bit depth and avoid overflow in lut address
     3098    Int iCodedNext_bitDepth = std::min(iCodedNext, (1 << bitDepth_in));
     3099
     3100    const Int divValue =  (iCodedNext - iCodedPrev > 0)? (iCodedNext - iCodedPrev): 1;
     3101    const Int lutValInit = (lutOffset + iTargetPrev) << nbDecimalValues;
     3102    const Int roundValue = divValue / 2;
     3103    for ( ; iValue<iCodedNext_bitDepth; iValue++ )
     3104    {
     3105      Int value = iValue;
     3106      Int interpol = ((((value-iCodedPrev) * (iTargetNext - iTargetPrev)) << nbDecimalValues) + roundValue) / divValue;               
     3107      retLut[iValue]  = std::min(lutValInit + interpol , maxValueFixedPoint);
     3108    }
     3109    iCodedPrev  = iCodedNext;
     3110    iTargetPrev = iTargetNext;
     3111  }
     3112  // fill missing values if necessary
     3113  if(iCodedPrev < (1 << bitDepth_in)+1)
     3114  {
     3115    Int iCodedNext  = (1 << bitDepth_in);
     3116    Int iTargetNext = (1 << bitDepth_in) - 1;
     3117
     3118    const Int divValue =  (iCodedNext - iCodedPrev > 0)? (iCodedNext - iCodedPrev): 1;
     3119    const Int lutValInit = (lutOffset + iTargetPrev) << nbDecimalValues;
     3120    const Int roundValue = divValue / 2;
     3121
     3122    for ( ; iValue<=iCodedNext; iValue++ )
     3123    {
     3124      Int value = iValue;
     3125      Int interpol = ((((value-iCodedPrev) * (iTargetNext - iTargetPrev)) << nbDecimalValues) + roundValue) / divValue;
     3126      retLut[iValue]  = std::min(lutValInit + interpol , maxValueFixedPoint);
     3127    }
     3128  }
     3129  return retLut;
     3130}
     3131
     3132static Void
     3133initColourRemappingInfoLuts(std::vector<Int>      (&preLut)[3],
     3134                            std::vector<Int>      (&postLut)[3],
     3135                            SEIColourRemappingInfo &pCriSEI,
     3136                            const Int               maxBitDepth)
     3137{
     3138  Int internalBitDepth = pCriSEI.m_colourRemapBitDepth;
     3139  for ( Int c=0 ; c<3 ; c++ )
     3140  {
     3141    std::sort(pCriSEI.m_preLut[c].begin(), pCriSEI.m_preLut[c].end()); // ensure preLut is ordered in ascending values of codedValues   
     3142    preLut[c] = initColourRemappingInfoLut(pCriSEI.m_colourRemapInputBitDepth, maxBitDepth - pCriSEI.m_colourRemapInputBitDepth, pCriSEI.m_preLut[c], ((1 << internalBitDepth) - 1), 0); //Fill preLut
     3143
     3144    std::sort(pCriSEI.m_postLut[c].begin(), pCriSEI.m_postLut[c].end()); // ensure postLut is ordered in ascending values of codedValues       
     3145    postLut[c] = initColourRemappingInfoLut(pCriSEI.m_colourRemapBitDepth, maxBitDepth - pCriSEI.m_colourRemapBitDepth, pCriSEI.m_postLut[c], (1 << internalBitDepth) - 1, 0); //Fill postLut
     3146  }
     3147}
     3148
     3149// apply lut.
     3150// Input lut values are aligned on power of 2 boundaries
     3151static Int
     3152applyColourRemappingInfoLut1D(Int inVal, const std::vector<Int> &lut, const Int inValPrecisionBits)
     3153{
     3154  const Int roundValue = (inValPrecisionBits)? 1 << (inValPrecisionBits - 1): 0;
     3155  inVal = std::min(std::max(0, inVal), (Int)(((lut.size()-1) << inValPrecisionBits)));
     3156  Int index  = (Int) std::min((inVal >> inValPrecisionBits), (Int)(lut.size()-2));
     3157  Int outVal = (( inVal - (index<<inValPrecisionBits) ) * (lut[index+1] - lut[index]) + roundValue) >> inValPrecisionBits;
     3158  outVal +=  lut[index] ;
     3159
     3160  return outVal;
     3161
     3162
     3163static Int
     3164applyColourRemappingInfoMatrix(const Int (&colourRemapCoeffs)[3], const Int postOffsetShift, const Int p0, const Int p1, const Int p2, const Int offset)
     3165{
     3166  Int YUVMat = (colourRemapCoeffs[0]* p0 + colourRemapCoeffs[1]* p1 + colourRemapCoeffs[2]* p2  + offset) >> postOffsetShift;
     3167  return YUVMat;
     3168}
     3169
     3170static Void
     3171setColourRemappingInfoMatrixOffset(Int (&matrixOffset)[3], Int offset0, Int offset1, Int offset2)
     3172{
     3173  matrixOffset[0] = offset0;
     3174  matrixOffset[1] = offset1;
     3175  matrixOffset[2] = offset2;
     3176}
     3177
     3178static Void
     3179setColourRemappingInfoMatrixOffsets(      Int  (&matrixInputOffset)[3],
     3180                                          Int  (&matrixOutputOffset)[3],
     3181                                    const Int  bitDepth,
     3182                                    const Bool crInputFullRangeFlag,
     3183                                    const Int  crInputMatrixCoefficients,
     3184                                    const Bool crFullRangeFlag,
     3185                                    const Int  crMatrixCoefficients)
     3186{
     3187  // set static matrix offsets
     3188  Int crInputOffsetLuma = (crInputFullRangeFlag)? 0:-(16 << (bitDepth-8));
     3189  Int crOffsetLuma = (crFullRangeFlag)? 0:(16 << (bitDepth-8));
     3190  Int crInputOffsetChroma = 0;
     3191  Int crOffsetChroma = 0;
     3192
     3193  switch(crInputMatrixCoefficients)
     3194  {
     3195    case MATRIX_COEFFICIENTS_RGB:
     3196      crInputOffsetChroma = 0;
     3197      if(!crInputFullRangeFlag)
     3198      {
     3199        fprintf(stderr, "WARNING: crInputMatrixCoefficients set to MATRIX_COEFFICIENTS_RGB and crInputFullRangeFlag not set\n");
     3200        crInputOffsetLuma = 0;
     3201      }
     3202      break;
     3203    case MATRIX_COEFFICIENTS_UNSPECIFIED:
     3204    case MATRIX_COEFFICIENTS_BT709:
     3205    case MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE:
     3206      crInputOffsetChroma = -(1 << (bitDepth-1));
     3207      break;
     3208    default:
     3209      fprintf(stderr, "WARNING: crInputMatrixCoefficients set to undefined value: %d\n", crInputMatrixCoefficients);
     3210  }
     3211
     3212  switch(crMatrixCoefficients)
     3213  {
     3214    case MATRIX_COEFFICIENTS_RGB:
     3215      crOffsetChroma = 0;
     3216      if(!crFullRangeFlag)
     3217      {
     3218        fprintf(stderr, "WARNING: crMatrixCoefficients set to MATRIX_COEFFICIENTS_RGB and crInputFullRangeFlag not set\n");
     3219        crOffsetLuma = 0;
     3220      }
     3221      break;
     3222    case MATRIX_COEFFICIENTS_UNSPECIFIED:
     3223    case MATRIX_COEFFICIENTS_BT709:
     3224    case MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE:
     3225      crOffsetChroma = (1 << (bitDepth-1));
     3226      break;
     3227    default:
     3228      fprintf(stderr, "WARNING: crMatrixCoefficients set to undefined value: %d\n", crMatrixCoefficients);
     3229  }
     3230
     3231  setColourRemappingInfoMatrixOffset(matrixInputOffset, crInputOffsetLuma, crInputOffsetChroma, crInputOffsetChroma);
     3232  setColourRemappingInfoMatrixOffset(matrixOutputOffset, crOffsetLuma, crOffsetChroma, crOffsetChroma);
     3233}
     3234
     3235Void TAppDecTop::applyColourRemapping(const TComPicYuv& pic, SEIColourRemappingInfo& criSEI, const TComSPS &activeSPS)
     3236
     3237  const Int maxBitDepth = 16;
     3238
     3239  // create colour remapped picture
     3240  if( !criSEI.m_colourRemapCancelFlag && pic.getChromaFormat()!=CHROMA_400) // 4:0:0 not supported.
     3241  {
     3242    const Int          iHeight         = pic.getHeight(COMPONENT_Y);
     3243    const Int          iWidth          = pic.getWidth(COMPONENT_Y);
     3244    const ChromaFormat chromaFormatIDC = pic.getChromaFormat();
     3245
     3246    TComPicYuv picYuvColourRemapped;
     3247    picYuvColourRemapped.createWithoutCUInfo( iWidth, iHeight, chromaFormatIDC );
     3248
     3249    const Int  iStrideIn   = pic.getStride(COMPONENT_Y);
     3250    const Int  iCStrideIn  = pic.getStride(COMPONENT_Cb);
     3251    const Int  iStrideOut  = picYuvColourRemapped.getStride(COMPONENT_Y);
     3252    const Int  iCStrideOut = picYuvColourRemapped.getStride(COMPONENT_Cb);
     3253    const Bool b444        = ( pic.getChromaFormat() == CHROMA_444 );
     3254    const Bool b422        = ( pic.getChromaFormat() == CHROMA_422 );
     3255    const Bool b420        = ( pic.getChromaFormat() == CHROMA_420 );
     3256
     3257    std::vector<Int> preLut[3];
     3258    std::vector<Int> postLut[3];
     3259    Int matrixInputOffset[3];
     3260    Int matrixOutputOffset[3];
     3261    const Pel *YUVIn[MAX_NUM_COMPONENT];
     3262    Pel *YUVOut[MAX_NUM_COMPONENT];
     3263    YUVIn[COMPONENT_Y]  = pic.getAddr(COMPONENT_Y);
     3264    YUVIn[COMPONENT_Cb] = pic.getAddr(COMPONENT_Cb);
     3265    YUVIn[COMPONENT_Cr] = pic.getAddr(COMPONENT_Cr);
     3266    YUVOut[COMPONENT_Y]  = picYuvColourRemapped.getAddr(COMPONENT_Y);
     3267    YUVOut[COMPONENT_Cb] = picYuvColourRemapped.getAddr(COMPONENT_Cb);
     3268    YUVOut[COMPONENT_Cr] = picYuvColourRemapped.getAddr(COMPONENT_Cr);
     3269
     3270    const Int bitDepth = criSEI.m_colourRemapBitDepth;
     3271    BitDepths        bitDepthsCriFile;
     3272    bitDepthsCriFile.recon[CHANNEL_TYPE_LUMA]   = bitDepth;
     3273    bitDepthsCriFile.recon[CHANNEL_TYPE_CHROMA] = bitDepth; // Different bitdepth is not implemented
     3274
     3275    const Int postOffsetShift = criSEI.m_log2MatrixDenom;
     3276    const Int matrixRound = 1 << (postOffsetShift - 1);
     3277    const Int postLutInputPrecision = (maxBitDepth - criSEI.m_colourRemapBitDepth);
     3278
     3279    if ( ! criSEI.m_colourRemapVideoSignalInfoPresentFlag ) // setting default
     3280    {
     3281      setColourRemappingInfoMatrixOffsets(matrixInputOffset, matrixOutputOffset, maxBitDepth,
     3282          activeSPS.getVuiParameters()->getVideoFullRangeFlag(), activeSPS.getVuiParameters()->getMatrixCoefficients(),
     3283          activeSPS.getVuiParameters()->getVideoFullRangeFlag(), activeSPS.getVuiParameters()->getMatrixCoefficients());
     3284    }
     3285    else
     3286    {
     3287      setColourRemappingInfoMatrixOffsets(matrixInputOffset, matrixOutputOffset, maxBitDepth,
     3288          activeSPS.getVuiParameters()->getVideoFullRangeFlag(), activeSPS.getVuiParameters()->getMatrixCoefficients(),
     3289          criSEI.m_colourRemapFullRangeFlag, criSEI.m_colourRemapMatrixCoefficients);
     3290    }
     3291
     3292    // add matrix rounding to output matrix offsets
     3293    matrixOutputOffset[0] = (matrixOutputOffset[0] << postOffsetShift) + matrixRound;
     3294    matrixOutputOffset[1] = (matrixOutputOffset[1] << postOffsetShift) + matrixRound;
     3295    matrixOutputOffset[2] = (matrixOutputOffset[2] << postOffsetShift) + matrixRound;
     3296
     3297    // Merge   matrixInputOffset and matrixOutputOffset to matrixOutputOffset
     3298    matrixOutputOffset[0] += applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[0], 0, matrixInputOffset[0], matrixInputOffset[1], matrixInputOffset[2], 0);
     3299    matrixOutputOffset[1] += applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[1], 0, matrixInputOffset[0], matrixInputOffset[1], matrixInputOffset[2], 0);
     3300    matrixOutputOffset[2] += applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[2], 0, matrixInputOffset[0], matrixInputOffset[1], matrixInputOffset[2], 0);
     3301
     3302    // rescaling output: include CRI/output frame difference
     3303    const Int scaleShiftOut_neg = abs(bitDepth - maxBitDepth);
     3304    const Int scaleOut_round = 1 << (scaleShiftOut_neg-1);
     3305
     3306    initColourRemappingInfoLuts(preLut, postLut, criSEI, maxBitDepth);
     3307
     3308    assert(pic.getChromaFormat() != CHROMA_400);
     3309    const Int hs = pic.getComponentScaleX(ComponentID(COMPONENT_Cb));
     3310    const Int maxOutputValue = (1 << bitDepth) - 1;
     3311
     3312    for( Int y = 0; y < iHeight; y++ )
     3313    {
     3314      for( Int x = 0; x < iWidth; x++ )
     3315      {
     3316        const Int xc = (x>>hs);
     3317        Bool computeChroma = b444 || ((b422 || !(y&1)) && !(x&1));
     3318
     3319        Int YUVPre_0 = applyColourRemappingInfoLut1D(YUVIn[COMPONENT_Y][x], preLut[0], 0);
     3320        Int YUVPre_1 = applyColourRemappingInfoLut1D(YUVIn[COMPONENT_Cb][xc], preLut[1], 0);
     3321        Int YUVPre_2 = applyColourRemappingInfoLut1D(YUVIn[COMPONENT_Cr][xc], preLut[2], 0);
     3322
     3323        Int YUVMat_0 = applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[0], postOffsetShift, YUVPre_0, YUVPre_1, YUVPre_2, matrixOutputOffset[0]);
     3324        Int YUVLutB_0 = applyColourRemappingInfoLut1D(YUVMat_0, postLut[0], postLutInputPrecision);
     3325        YUVOut[COMPONENT_Y][x] = std::min(maxOutputValue, (YUVLutB_0 + scaleOut_round) >> scaleShiftOut_neg);
     3326
     3327        if( computeChroma )
     3328        {
     3329          Int YUVMat_1 = applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[1], postOffsetShift, YUVPre_0, YUVPre_1, YUVPre_2, matrixOutputOffset[1]);
     3330          Int YUVLutB_1 = applyColourRemappingInfoLut1D(YUVMat_1, postLut[1], postLutInputPrecision);
     3331          YUVOut[COMPONENT_Cb][xc] = std::min(maxOutputValue, (YUVLutB_1 + scaleOut_round) >> scaleShiftOut_neg);
     3332
     3333          Int YUVMat_2 = applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[2], postOffsetShift, YUVPre_0, YUVPre_1, YUVPre_2, matrixOutputOffset[2]);
     3334          Int YUVLutB_2 = applyColourRemappingInfoLut1D(YUVMat_2, postLut[2], postLutInputPrecision);
     3335          YUVOut[COMPONENT_Cr][xc] = std::min(maxOutputValue, (YUVLutB_2 + scaleOut_round) >> scaleShiftOut_neg);
     3336        }
     3337      }
     3338
     3339      YUVIn[COMPONENT_Y]  += iStrideIn;
     3340      YUVOut[COMPONENT_Y] += iStrideOut;
     3341      if( !(b420 && !(y&1)) )
     3342      {
     3343         YUVIn[COMPONENT_Cb]  += iCStrideIn;
     3344         YUVIn[COMPONENT_Cr]  += iCStrideIn;
     3345         YUVOut[COMPONENT_Cb] += iCStrideOut;
     3346         YUVOut[COMPONENT_Cr] += iCStrideOut;
     3347      }
     3348    }
     3349    //Write remapped picture in display order
     3350    picYuvColourRemapped.dump( m_colourRemapSEIFileName, bitDepthsCriFile, true );
     3351    picYuvColourRemapped.destroy();
     3352  }
     3353}
    30093354//! \}
  • TabularUnified trunk/source/App/TAppDecoder/TAppDecTop.h

    r1321 r1386  
    128128#endif
    129129  std::ofstream                   m_seiMessageFileStream;         ///< Used for outputing SEI messages. 
     130
     131  SEIColourRemappingInfo*         m_pcSeiColourRemappingInfoPrevious;
     132
    130133public:
    131134  TAppDecTop();
     
    134137  Void  create            (); ///< create internal members
    135138  Void  destroy           (); ///< destroy internal members
    136   Void  decode            (); ///< main decoding function
     139 
    137140#if NH_MV
     141  Void  decode            ( Int i ); ///< main decoding function
    138142  UInt  getNumberOfChecksumErrorsDetected( ) const;
    139143  UInt  getNumberOfChecksumErrorsDetected( Int decIdx ) const { return m_tDecTop[decIdx]->getNumberOfChecksumErrorsDetected(); }
    140144#else
     145  Void  decode            ( ); ///< main decoding function
    141146  UInt  getNumberOfChecksumErrorsDetected() const { return m_cTDecTop.getNumberOfChecksumErrorsDetected(); }
    142147#endif
     
    206211  Void  xCropAndOutput                     ( TComPic* curPic ); 
    207212#endif
     213
     214private:
     215  Void applyColourRemapping(const TComPicYuv& pic, SEIColourRemappingInfo& pCriSEI, const TComSPS &activeSPS);
     216  Void xOutputColourRemapPic(TComPic* pcPic);
    208217};
    209218
  • TabularUnified trunk/source/App/TAppDecoder/decmain.cpp

    r1313 r1386  
    5151{
    5252  Int returnCode = EXIT_SUCCESS;
     53#if !NH_MV
    5354  TAppDecTop  cTAppDecTop;
    54 
     55#endif
    5556  // print information
    5657  fprintf( stdout, "\n" );
     
    6566  fprintf( stdout, "\n" );
    6667
    67   // create application decoder class
    68   cTAppDecTop.create();
     68#if NH_MV
     69  Int numDecodings = 1;
     70  Int curDecoding  = 0;
     71  Double dResult = 0;
     72  do {
     73    TAppDecTop  cTAppDecTop;
     74#endif
     75    // create application decoder class
     76    cTAppDecTop.create();
    6977
    70   // parse configuration
    71   if(!cTAppDecTop.parseCfg( argc, argv ))
    72   {
    73     cTAppDecTop.destroy();
    74     returnCode = EXIT_FAILURE;
    75     return returnCode;
    76   }
     78    // parse configuration
     79    if(!cTAppDecTop.parseCfg( argc, argv ))
     80    {
     81      cTAppDecTop.destroy();
     82      returnCode = EXIT_FAILURE;
     83      return returnCode;
     84    }
     85#if NH_MV
     86    numDecodings = cTAppDecTop.getNumDecodings();
     87#endif
    7788
    78   // starting time
     89    // starting time   
     90#if !NH_MV
    7991  Double dResult;
    80   clock_t lBefore = clock();
     92#endif
     93    clock_t lBefore = clock();
    8194
    82   // call decoding function
    83   cTAppDecTop.decode();
     95    // call decoding function
     96#if NH_MV
     97    cTAppDecTop.decode( curDecoding );
     98#else
     99    cTAppDecTop.decode();
     100#endif
    84101
    85   if (cTAppDecTop.getNumberOfChecksumErrorsDetected() != 0)
    86   {
    87     printf("\n\n***ERROR*** A decoding mismatch occured: signalled md5sum does not match\n");
    88     returnCode = EXIT_FAILURE;
    89   }
     102    if (cTAppDecTop.getNumberOfChecksumErrorsDetected() != 0)
     103    {
     104      printf("\n\n***ERROR*** A decoding mismatch occured: signalled md5sum does not match\n");
     105      returnCode = EXIT_FAILURE;
     106    }
    90107
    91   // ending time
     108    // ending time
     109#if NH_MV
     110    dResult += (double)(clock()-lBefore) / CLOCKS_PER_SEC;
     111#else
    92112  dResult = (Double)(clock()-lBefore) / CLOCKS_PER_SEC;
    93113  printf("\n Total Time: %12.3f sec.\n", dResult);
     114#endif
    94115
    95   // destroy application decoder class
    96   cTAppDecTop.destroy();
     116    // destroy application decoder class
     117    cTAppDecTop.destroy();
     118#if NH_MV
     119    curDecoding++;
     120  }
     121  while ( curDecoding < numDecodings );
    97122
     123  printf("\n Total Time: %12.3f sec.\n", dResult);
     124#endif
    98125  return returnCode;
    99126}
  • TabularUnified trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r1356 r1386  
    109109
    110110TAppEncCfg::TAppEncCfg()
    111 #if NH_MV
    112 : m_pchBitstreamFile()
    113 #else
    114 : m_pchInputFile()
    115 , m_pchBitstreamFile()
    116 , m_pchReconFile()
    117 #endif
    118 , m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
     111: m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
    119112, m_snrInternalColourSpace(false)
    120113, m_outputInternalColourSpace(false)
    121 , m_pchdQPFile()
    122 , m_scalingListFile()
    123114{
    124115#if !NH_MV
     
    171162    m_targetPivotValue = NULL;
    172163  }
    173 #if !NH_MV
    174   free(m_pchInputFile);
    175 #endif
    176   free(m_pchBitstreamFile);
    177164#if NH_MV
    178165  for(Int i = 0; i< m_pchReconFileList.size(); i++ )
     
    181168      free (m_pchReconFileList[i]);
    182169  }
    183 #else
    184   free(m_pchReconFile);
    185 #endif
    186   free(m_pchdQPFile);
    187   free(m_scalingListFile);
    188 #if NH_MV
     170
    189171  for( Int i = 0; i < m_GOPListMvc.size(); i++ )
    190172  {
     
    195177    }
    196178  }
    197 #endif
    198 #if NH_3D
     179
     180  if ( m_pchBaseViewCameraNumbers != NULL )
     181  {
     182    free ( m_pchBaseViewCameraNumbers );
     183  }
     184#endif
    199185#if NH_3D_VSO
    200186  if (  m_pchVSOConfig != NULL)
     
    202188    free (  m_pchVSOConfig );
    203189  }
    204 #endif
     190 
    205191  if ( m_pchCameraParameterFile != NULL )
    206192  {
    207193    free ( m_pchCameraParameterFile );
    208   }
    209 
    210   if ( m_pchBaseViewCameraNumbers != NULL )
    211   {
    212     free ( m_pchBaseViewCameraNumbers );
    213194  }
    214195#endif
     
    224205
    225206
    226 #if NH_MV_SEI
     207#if NH_MV
    227208Void TAppEncCfg::xParseSeiCfg()
    228209{
     
    302283}
    303284
    304 Bool confirmPara(Bool bflag, const Char* message);
     285Bool confirmPara(Bool bflag, const TChar* message);
    305286
    306287static inline ChromaFormat numberToChromaFormat(const Int val)
     
    318299static const struct MapStrToProfile
    319300{
    320   const Char* str;
     301  const TChar* str;
    321302  Profile::Name value;
    322303}
     
    340321static const struct MapStrToExtendedProfile
    341322{
    342   const Char* str;
     323  const TChar* str;
    343324  ExtendedProfileName value;
    344325}
     
    405386static const struct MapStrToTier
    406387{
    407   const Char* str;
     388  const TChar* str;
    408389  Level::Tier value;
    409390}
     
    416397static const struct MapStrToLevel
    417398{
    418   const Char* str;
     399  const TChar* str;
    419400  Level::Name value;
    420401}
     
    438419};
    439420
     421#if U0132_TARGET_BITS_SATURATION
     422UInt g_uiMaxCpbSize[2][21] =
     423{
     424  //         LEVEL1,        LEVEL2,LEVEL2_1,     LEVEL3, LEVEL3_1,      LEVEL4, LEVEL4_1,       LEVEL5,  LEVEL5_1,  LEVEL5_2,    LEVEL6,  LEVEL6_1,  LEVEL6_2
     425  { 0, 0, 0, 350000, 0, 0, 1500000, 3000000, 0, 6000000, 10000000, 0, 12000000, 20000000, 0,  25000000,  40000000,  60000000,  60000000, 120000000, 240000000 },
     426  { 0, 0, 0,      0, 0, 0,       0,       0, 0,       0,        0, 0, 30000000, 50000000, 0, 100000000, 160000000, 240000000, 240000000, 480000000, 800000000 }
     427};
     428#endif
     429
    440430static const struct MapStrToCostMode
    441431{
    442   const Char* str;
     432  const TChar* str;
    443433  CostMode    value;
    444434}
     
    453443static const struct MapStrToScalingListMode
    454444{
    455   const Char* str;
     445  const TChar* str;
    456446  ScalingListMode value;
    457447}
     
    533523{
    534524  const T              minValIncl;
    535   const T              maxValIncl; // Use 0 for unlimited
     525  const T              maxValIncl;
    536526  const std::size_t    minNumValuesIncl;
    537527  const std::size_t    maxNumValuesIncl; // Use 0 for unlimited
     
    545535  SMultiValueInput<T> &operator=(const std::vector<T> &userValues) { values=userValues; return *this; }
    546536  SMultiValueInput<T> &operator=(const SMultiValueInput<T> &userValues) { values=userValues.values; return *this; }
     537
     538  T readValue(const TChar *&pStr, Bool &bSuccess);
     539
     540  istream& readValues(std::istream &in);
    547541};
    548542
    549 static inline istream& operator >> (istream &in, SMultiValueInput<UInt> &values)
     543template <class T>
     544static inline istream& operator >> (std::istream &in, SMultiValueInput<T> &values)
    550545{
    551   values.values.clear();
     546  return values.readValues(in);
     547  }
     548
     549template<>
     550UInt SMultiValueInput<UInt>::readValue(const TChar *&pStr, Bool &bSuccess)
     551    {
     552  TChar *eptr;
     553      UInt val=strtoul(pStr, &eptr, 0);
     554  pStr=eptr;
     555  bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<minValIncl || val>maxValIncl);
     556  return val;
     557      }
     558
     559template<>
     560Int SMultiValueInput<Int>::readValue(const TChar *&pStr, Bool &bSuccess)
     561      {
     562  TChar *eptr;
     563  Int val=strtol(pStr, &eptr, 0);
     564      pStr=eptr;
     565  bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<minValIncl || val>maxValIncl);
     566  return val;
     567}
     568
     569template<>
     570Double SMultiValueInput<Double>::readValue(const TChar *&pStr, Bool &bSuccess)
     571  {
     572  TChar *eptr;
     573  Double val=strtod(pStr, &eptr);
     574  pStr=eptr;
     575  bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<minValIncl || val>maxValIncl);
     576  return val;
     577  }
     578
     579template<>
     580Bool SMultiValueInput<Bool>::readValue(const TChar *&pStr, Bool &bSuccess)
     581    {
     582  TChar *eptr;
     583      Int val=strtol(pStr, &eptr, 0);
     584      pStr=eptr;
     585  bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<Int(minValIncl) || val>Int(maxValIncl));
     586  return val!=0;
     587}
     588
     589template <class T>
     590istream& SMultiValueInput<T>::readValues(std::istream &in)
     591{
     592  values.clear();
    552593  string str;
    553594  while (!in.eof())
     
    557598  if (!str.empty())
    558599  {
    559     const Char *pStr=str.c_str();
     600    const TChar *pStr=str.c_str();
    560601    // soak up any whitespace
    561602    for(;isspace(*pStr);pStr++);
     
    563604    while (*pStr != 0)
    564605    {
    565       Char *eptr;
    566       UInt val=strtoul(pStr, &eptr, 0);
    567       if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     606      Bool bSuccess=true;
     607      T val=readValue(pStr, bSuccess);
     608      if (!bSuccess)
    568609      {
    569610        in.setstate(ios::failbit);
    570611        break;
    571612      }
    572       if (val<values.minValIncl || val>values.maxValIncl)
     613
     614      if (maxNumValuesIncl != 0 && values.size() >= maxNumValuesIncl)
    573615      {
    574616        in.setstate(ios::failbit);
    575617        break;
    576618      }
    577 
    578       if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
    579       {
    580         in.setstate(ios::failbit);
    581         break;
    582       }
    583       values.values.push_back(val);
     619      values.push_back(val);
    584620      // soak up any whitespace and up to 1 comma.
    585       pStr=eptr;
    586621      for(;isspace(*pStr);pStr++);
    587622      if (*pStr == ',')
     
    592627    }
    593628  }
    594   if (values.values.size() < values.minNumValuesIncl)
    595   {
    596     in.setstate(ios::failbit);
    597   }
    598   return in;
    599 }
    600 
    601 static inline istream& operator >> (istream &in, SMultiValueInput<Int> &values)
    602 {
    603   values.values.clear();
    604   string str;
    605   while (!in.eof())
    606   {
    607     string tmp; in >> tmp; str+=" " + tmp;
    608   }
    609   if (!str.empty())
    610   {
    611     const Char *pStr=str.c_str();
    612     // soak up any whitespace
    613     for(;isspace(*pStr);pStr++);
    614 
    615     while (*pStr != 0)
    616     {
    617       Char *eptr;
    618       Int val=strtol(pStr, &eptr, 0);
    619       if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
    620       {
    621         in.setstate(ios::failbit);
    622         break;
    623       }
    624       if (val<values.minValIncl || val>values.maxValIncl)
    625       {
    626         in.setstate(ios::failbit);
    627         break;
    628       }
    629 
    630       if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
    631       {
    632         in.setstate(ios::failbit);
    633         break;
    634       }
    635       values.values.push_back(val);
    636       // soak up any whitespace and up to 1 comma.
    637       pStr=eptr;
    638       for(;isspace(*pStr);pStr++);
    639       if (*pStr == ',')
    640       {
    641         pStr++;
    642       }
    643       for(;isspace(*pStr);pStr++);
    644     }
    645   }
    646   if (values.values.size() < values.minNumValuesIncl)
    647   {
    648     in.setstate(ios::failbit);
    649   }
    650   return in;
    651 }
    652 
    653 static inline istream& operator >> (istream &in, SMultiValueInput<Bool> &values)
    654 {
    655   values.values.clear();
    656   string str;
    657   while (!in.eof())
    658   {
    659     string tmp; in >> tmp; str+=" " + tmp;
    660   }
    661   if (!str.empty())
    662   {
    663     const Char *pStr=str.c_str();
    664     // soak up any whitespace
    665     for(;isspace(*pStr);pStr++);
    666 
    667     while (*pStr != 0)
    668     {
    669       Char *eptr;
    670       Int val=strtol(pStr, &eptr, 0);
    671       if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
    672       {
    673         in.setstate(ios::failbit);
    674         break;
    675       }
    676       if (val<Int(values.minValIncl) || val>Int(values.maxValIncl))
    677       {
    678         in.setstate(ios::failbit);
    679         break;
    680       }
    681 
    682       if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
    683       {
    684         in.setstate(ios::failbit);
    685         break;
    686       }
    687       values.values.push_back(val!=0);
    688       // soak up any whitespace and up to 1 comma.
    689       pStr=eptr;
    690       for(;isspace(*pStr);pStr++);
    691       if (*pStr == ',')
    692       {
    693         pStr++;
    694       }
    695       for(;isspace(*pStr);pStr++);
    696     }
    697   }
    698   if (values.values.size() < values.minNumValuesIncl)
     629  if (values.size() < minNumValuesIncl)
    699630  {
    700631    in.setstate(ios::failbit);
     
    786717    \retval             true when success
    787718 */
    788 Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] )
     719Bool TAppEncCfg::parseCfg( Int argc, TChar* argv[] )
    789720{
    790721  Bool do_help = false;
    791722
    792 #if !NH_MV
    793   string cfg_InputFile;
    794 #endif
    795   string cfg_BitstreamFile;
    796 #if !NH_MV
    797   string cfg_ReconFile;
    798 #endif
    799723#if NH_MV
    800724  vector<Int>   cfg_dimensionLength;
     
    809733#endif
    810734#endif
    811   string cfg_dQPFile;
    812   string cfg_ScalingListFile;
    813735
    814736  Int tmpChromaFormat;
    815737  Int tmpInputChromaFormat;
    816738  Int tmpConstraintChromaFormat;
     739  Int tmpWeightedPredictionMethod;
     740  Int tmpFastInterSearchMode;
     741  Int tmpMotionEstimationSearchMethod;
     742  Int tmpSliceMode;
     743  Int tmpSliceSegmentMode;
     744  Int tmpDecodedPictureHashSEIMappedType;
    817745  string inputColourSpaceConvert;
    818746#if NH_MV
     
    829757  SMultiValueInput<Int>  cfg_codedPivotValue                 (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
    830758  SMultiValueInput<Int>  cfg_targetPivotValue                (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     759
     760  SMultiValueInput<Double> cfg_adIntraLambdaModifier         (0, std::numeric_limits<Double>::max(), 0, MAX_TLAYER); ///< Lambda modifier for Intra pictures, one for each temporal layer. If size>temporalLayer, then use [temporalLayer], else if size>0, use [size()-1], else use m_adLambdaModifier.
     761
    831762
    832763  const UInt defaultInputKneeCodes[3]  = { 600, 800, 900 };
     
    866797  ("InputFile_%d,i_%d",       m_pchInputFileList,       (char *) 0 , MAX_NUM_LAYER_IDS , "original Yuv input file name %d")
    867798#else
    868   ("InputFile,i",                                     cfg_InputFile,                               string(""), "Original YUV input file name")
    869 #endif
    870   ("BitstreamFile,b",                                 cfg_BitstreamFile,                           string(""), "Bitstream output file name")
     799  ("InputFile,i",                                     m_inputFileName,                             string(""), "Original YUV input file name")
     800#endif
     801  ("BitstreamFile,b",                                 m_bitstreamFileName,                         string(""), "Bitstream output file name")
    871802#if NH_MV
    872803  ("ReconFile_%d,o_%d",       m_pchReconFileList,       (char *) 0 , MAX_NUM_LAYER_IDS , "reconstructed Yuv output file name %d")
    873804#else
    874   ("ReconFile,o",                                     cfg_ReconFile,                               string(""), "Reconstructed YUV output file name")
    875 #endif
    876 #if NH_MV
    877   ("NumberOfLayers",        m_numberOfLayers     , 1,                     "Number of layers")
    878 #if !NH_3D
    879   ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary")   
    880 #else
    881   ("ScalabilityMask",       m_scalabilityMask    , 3                    , "Scalability Mask, 1: Texture 3: Texture + Depth ")   
     805  ("ReconFile,o",                                     m_reconFileName,                             string(""), "Reconstructed YUV output file name")
     806#endif
     807#if NH_MV
     808  ("NumberOfLayers",                 m_numberOfLayers     , 1,                     "Number of layers")
     809#if !NH_3D                           
     810  ("ScalabilityMask",                m_scalabilityMask    , 2                    , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary")   
     811#else                               
     812  ("ScalabilityMask",                m_scalabilityMask    , 3                    , "Scalability Mask, 1: Texture 3: Texture + Depth ")   
    882813#endif 
    883   ("DimensionIdLen",        m_dimensionIdLen     , cfg_dimensionLength  , "Number of bits used to store dimensions Id")
     814  ("DimensionIdLen",                 m_dimensionIdLen     , cfg_dimensionLength  , "Number of bits used to store dimensions Id")
    884815  ("ViewOrderIndex",                 m_viewOrderIndex              , IntAry1d(1,0),                                 "View Order Index per layer")
    885816  ("ViewId",                         m_viewId                      , IntAry1d(1,0),                                 "View Id per View Order Index")
    886817  ("AuxId",                          m_auxId                       , IntAry1d(1,0),                                 "AuxId per layer")
    887 #if NH_3D
     818#if NH_3D_VSO
    888819  ("DepthFlag",                      m_depthFlag                   , IntAry1d(1,0),                                 "Depth Flag")
    889820#endif
    890821  ("TargetEncLayerIdList",           m_targetEncLayerIdList        , IntAry1d(0,0),                                 "LayerIds in Nuh to be encoded") 
    891822  ("LayerIdInNuh",                   m_layerIdInNuh                , IntAry1d(1,0),                                 "LayerId in Nuh") 
    892   ("SplittingFlag",         m_splittingFlag       , false                , "Splitting Flag")   
     823  ("SplittingFlag",                  m_splittingFlag               , false,                                        "Splitting Flag")   
    893824
    894825  // Layer Sets + Output Layer Sets + Profile Tier Level
    895   ("VpsNumLayerSets",       m_vpsNumLayerSets    , 1                    , "Number of layer sets")   
    896   ("LayerIdsInSet_%d"              , m_layerIdsInSets              , IntAry1d(1,0) , MAX_VPS_OP_SETS_PLUS1      ,   "LayerIds of Layer set") 
    897   ("NumAddLayerSets"     , m_numAddLayerSets     , 0                                              , "NumAddLayerSets     ")
     826  ("VpsNumLayerSets"               , m_vpsNumLayerSets             , 1                                          ,  "Number of layer sets")   
     827  ("LayerIdsInSet_%d"              , m_layerIdxInVpsInSets         , IntAry1d(1,0) , MAX_VPS_OP_SETS_PLUS1      ,   "Layer indices in VPS of layers in layer set") 
     828  ("NumAddLayerSets"               , m_numAddLayerSets             , 0 ,                                            "NumAddLayerSets     ")
    898829  ("HighestLayerIdxPlus1_%d"       , m_highestLayerIdxPlus1        , IntAry1d(0,0) , MAX_VPS_NUM_ADD_LAYER_SETS ,   "HighestLayerIdxPlus1")
    899   ("DefaultTargetOutputLayerIdc"     , m_defaultOutputLayerIdc     , 0, "Specifies output layers of layer sets, 0: output all layers, 1: output highest layer, 2: specified by LayerIdsInDefOutputLayerSet")
     830  ("DefaultTargetOutputLayerIdc"   , m_defaultOutputLayerIdc       , 0 ,                                            "Specifies output layers of layer sets, 0: output all layers, 1: output highest layer, 2: specified by LayerIdsInDefOutputLayerSet")
    900831  ("OutputLayerSetIdx"             , m_outputLayerSetIdx           , IntAry1d(0,0)                              ,   "Indices of layer sets used as additional output layer sets")
    901832  ("LayerIdsInAddOutputLayerSet_%d", m_layerIdsInAddOutputLayerSet , IntAry1d(0,0) , MAX_VPS_ADD_OUTPUT_LAYER_SETS, "Indices in VPS of output layers in additional output layer set") 
     
    941872  ("ConfWinTop",                                      m_confWinTop,                                         0, "Top offset for window conformance mode 3")
    942873  ("ConfWinBottom",                                   m_confWinBottom,                                      0, "Bottom offset for window conformance mode 3")
     874  ("AccessUnitDelimiter",                             m_AccessUnitDelimiter,                            false, "Enable Access Unit Delimiter NALUs")
    943875  ("FrameRate,-fr",                                   m_iFrameRate,                                         0, "Frame rate")
    944876  ("FrameSkip,-fs",                                   m_FrameSkip,                                         0u, "Number of frames to skip at start of input YUV")
     
    1003935  // motion search options
    1004936  ("DisableIntraInInter",                             m_bDisableIntraPUsInInterSlices,                  false, "Flag to disable intra PUs in inter slices")
    1005   ("FastSearch",                                      m_iFastSearch,                                        1, "0:Full search  1:Diamond  2:PMVFAST")
     937  ("FastSearch",                                      tmpMotionEstimationSearchMethod,  Int(MESEARCH_DIAMOND), "0:Full search 1:Diamond 2:Selective 3:Enhanced Diamond")
    1006938  ("SearchRange,-sr",                                 m_iSearchRange,                                      96, "Motion search range")
    1007939#if NH_MV
     
    1010942#endif
    1011943  ("BipredSearchRange",                               m_bipredSearchRange,                                  4, "Motion search range for bipred refinement")
     944  ("MinSearchWindow",                                 m_minSearchWindow,                                    8, "Minimum motion search window size for the adaptive window ME")
     945  ("RestrictMESampling",                              m_bRestrictMESampling,                            false, "Restrict ME Sampling for selective inter motion search")
    1012946  ("ClipForBiPredMEEnabled",                          m_bClipForBiPredMeEnabled,                        false, "Enables clipping in the Bi-Pred ME. It is disabled to reduce encoder run-time")
    1013947  ("FastMEAssumingSmootherMVEnabled",                 m_bFastMEAssumingSmootherMVEnabled,                true, "Enables fast ME assuming a smoother MV.")
     
    1017951
    1018952  // Mode decision parameters
    1019   ("LambdaModifier0,-LM0",                            m_adLambdaModifier[ 0 ],                  ( Double )1.0, "Lambda modifier for temporal layer 0")
    1020   ("LambdaModifier1,-LM1",                            m_adLambdaModifier[ 1 ],                  ( Double )1.0, "Lambda modifier for temporal layer 1")
    1021   ("LambdaModifier2,-LM2",                            m_adLambdaModifier[ 2 ],                  ( Double )1.0, "Lambda modifier for temporal layer 2")
    1022   ("LambdaModifier3,-LM3",                            m_adLambdaModifier[ 3 ],                  ( Double )1.0, "Lambda modifier for temporal layer 3")
    1023   ("LambdaModifier4,-LM4",                            m_adLambdaModifier[ 4 ],                  ( Double )1.0, "Lambda modifier for temporal layer 4")
    1024   ("LambdaModifier5,-LM5",                            m_adLambdaModifier[ 5 ],                  ( Double )1.0, "Lambda modifier for temporal layer 5")
    1025   ("LambdaModifier6,-LM6",                            m_adLambdaModifier[ 6 ],                  ( Double )1.0, "Lambda modifier for temporal layer 6")
     953  ("LambdaModifier0,-LM0",                            m_adLambdaModifier[ 0 ],                  ( Double )1.0, "Lambda modifier for temporal layer 0. If LambdaModifierI is used, this will not affect intra pictures")
     954  ("LambdaModifier1,-LM1",                            m_adLambdaModifier[ 1 ],                  ( Double )1.0, "Lambda modifier for temporal layer 1. If LambdaModifierI is used, this will not affect intra pictures")
     955  ("LambdaModifier2,-LM2",                            m_adLambdaModifier[ 2 ],                  ( Double )1.0, "Lambda modifier for temporal layer 2. If LambdaModifierI is used, this will not affect intra pictures")
     956  ("LambdaModifier3,-LM3",                            m_adLambdaModifier[ 3 ],                  ( Double )1.0, "Lambda modifier for temporal layer 3. If LambdaModifierI is used, this will not affect intra pictures")
     957  ("LambdaModifier4,-LM4",                            m_adLambdaModifier[ 4 ],                  ( Double )1.0, "Lambda modifier for temporal layer 4. If LambdaModifierI is used, this will not affect intra pictures")
     958  ("LambdaModifier5,-LM5",                            m_adLambdaModifier[ 5 ],                  ( Double )1.0, "Lambda modifier for temporal layer 5. If LambdaModifierI is used, this will not affect intra pictures")
     959  ("LambdaModifier6,-LM6",                            m_adLambdaModifier[ 6 ],                  ( Double )1.0, "Lambda modifier for temporal layer 6. If LambdaModifierI is used, this will not affect intra pictures")
     960  ("LambdaModifierI,-LMI",                            cfg_adIntraLambdaModifier,    cfg_adIntraLambdaModifier, "Lambda modifiers for Intra pictures, comma separated, up to one the number of temporal layer. If entry for temporalLayer exists, then use it, else if some are specified, use the last, else use the standard LambdaModifiers.")
     961  ("IQPFactor,-IQF",                                  m_dIntraQpFactor,                                  -1.0, "Intra QP Factor for Lambda Computation. If negative, use the default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? (GopSize-1)/2 : GopSize-1) ))")
    1026962
    1027963  /* Quantization parameters */
     
    1046982  ("AdaptiveQP,-aq",                                  m_bUseAdaptiveQP,                                 false, "QP adaptation based on a psycho-visual model")
    1047983  ("MaxQPAdaptationRange,-aqr",                       m_iQPAdaptationRange,                                 6, "QP adaptation range")
    1048   ("dQPFile,m",                                       cfg_dQPFile,                                 string(""), "dQP file name")
     984  ("dQPFile,m",                                       m_dQPFileName,                               string(""), "dQP file name")
    1049985  ("RDOQ",                                            m_useRDOQ,                                         true)
    1050986  ("RDOQTS",                                          m_useRDOQTS,                                       true)
     
    10901026  ("MaxNumOffsetsPerPic",                             m_maxNumOffsetsPerPic,                             2048, "Max number of SAO offset per picture (Default: 2048)")
    10911027  ("SAOLcuBoundary",                                  m_saoCtuBoundary,                                 false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
    1092   ("SliceMode",                                       m_sliceMode,                                          0, "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
     1028  ("SliceMode",                                       tmpSliceMode,                            Int(NO_SLICES), "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
    10931029  ("SliceArgument",                                   m_sliceArgument,                                      0, "Depending on SliceMode being:"
    10941030                                                                                                               "\t1: max number of CTUs per slice"
    10951031                                                                                                               "\t2: max number of bytes per slice"
    10961032                                                                                                               "\t3: max number of tiles per slice")
    1097   ("SliceSegmentMode",                                m_sliceSegmentMode,                                   0, "0: Disable all slice segment limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
     1033  ("SliceSegmentMode",                                tmpSliceSegmentMode,                     Int(NO_SLICES), "0: Disable all slice segment limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
    10981034  ("SliceSegmentArgument",                            m_sliceSegmentArgument,                               0, "Depending on SliceSegmentMode being:"
    10991035                                                                                                               "\t1: max number of CTUs per slice segment"
     
    11121048  ("PCMInputBitDepthFlag",                            m_bPCMInputBitDepthFlag,                           true)
    11131049  ("PCMFilterDisableFlag",                            m_bPCMFilterDisableFlag,                          false)
    1114   ("IntraReferenceSmoothing",                         m_enableIntraReferenceSmoothing,                   true, "0: Disable use of intra reference smoothing. 1: Enable use of intra reference smoothing (not valid in V1 profiles)")
     1050  ("IntraReferenceSmoothing",                         m_enableIntraReferenceSmoothing,                   true, "0: Disable use of intra reference smoothing (not valid in V1 profiles). 1: Enable use of intra reference smoothing (same as V1)")
    11151051  ("WeightedPredP,-wpP",                              m_useWeightedPred,                                false, "Use weighted prediction in P slices")
    11161052  ("WeightedPredB,-wpB",                              m_useWeightedBiPred,                              false, "Use weighted (bidirectional) prediction in B slices")
     1053  ("WeightedPredMethod,-wpM",                         tmpWeightedPredictionMethod, Int(WP_PER_PICTURE_WITH_SIMPLE_DC_COMBINED_COMPONENT), "Weighted prediction method")
    11171054  ("Log2ParallelMergeLevel",                          m_log2ParallelMergeLevel,                            2u, "Parallel merge estimation region")
    11181055    //deprecated copies of renamed tile parameters
     
    11271064  ("TileRowHeightArray",                              cfg_RowHeight,                            cfg_RowHeight, "Array containing tile row height values in units of CTU")
    11281065  ("LFCrossTileBoundaryFlag",                         m_bLFCrossTileBoundaryFlag,                        true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
    1129   ("WaveFrontSynchro",                                m_iWaveFrontSynchro,                                  0, "0: no synchro; 1 synchro with top-right-right")
     1066  ("WaveFrontSynchro",                                m_entropyCodingSyncEnabledFlag,                   false, "0: entropy coding sync disabled; 1 entropy coding sync enabled")
    11301067  ("ScalingList",                                     m_useScalingListId,                    SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
    1131   ("ScalingListFile",                                 cfg_ScalingListFile,                         string(""), "Scaling list file name. Use an empty string to produce help.")
     1068  ("ScalingListFile",                                 m_scalingListFileName,                       string(""), "Scaling list file name. Use an empty string to produce help.")
    11321069  ("SignHideFlag,-SBH",                               m_signHideFlag,                                    true)
    11331070  ("MaxNumMergeCand",                                 m_maxNumMergeCand,                                   5u, "Maximum number of merge candidates")
    11341071  /* Misc. */
    1135   ("SEIDecodedPictureHash",                           m_decodedPictureHashSEIEnabled,                       0, "Control generation of decode picture hash SEI messages\n"
     1072  ("SEIDecodedPictureHash",                           tmpDecodedPictureHashSEIMappedType,                   0, "Control generation of decode picture hash SEI messages\n"
    11361073                                                                                                               "\t3: checksum\n"
    11371074                                                                                                               "\t2: CRC\n"
     
    11391076                                                                                                               "\t0: disable")
    11401077  ("TMVPMode",                                        m_TMVPModeId,                                         1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only")
    1141   ("FEN",                                             m_bUseFastEnc,                                    false, "fast encoder setting")
     1078  ("FEN",                                             tmpFastInterSearchMode,   Int(FASTINTERSEARCH_DISABLED), "fast encoder setting")
    11421079  ("ECU",                                             m_bUseEarlyCU,                                    false, "Early CU setting")
    11431080  ("FDM",                                             m_useFastDecisionForMerge,                         true, "Fast decision for Merge RD Cost")
     
    11521089  ( "RCForceIntraQP",                                 m_RCForceIntraQP,                                 false, "Rate control: force intra QP to be equal to initial QP" )
    11531090
     1091#if U0132_TARGET_BITS_SATURATION
     1092  ( "RCCpbSaturation",                                m_RCCpbSaturationEnabled,                         false, "Rate control: enable target bits saturation to avoid CPB overflow and underflow" )
     1093  ( "RCCpbSize",                                      m_RCCpbSize,                                         0u, "Rate control: CPB size" )
     1094  ( "RCInitialCpbFullness",                           m_RCInitialCpbFullness,                             0.9, "Rate control: initial CPB fullness" )
     1095#endif
     1096
    11541097#if KWU_RC_VIEWRC_E0227
    11551098  ("ViewWiseTargetBits, -vtbr" ,  m_viewTargetBits,  std::vector<Int>(1, 32), "View-wise target bit-rate setting")
     
    11621105// A lot of this stuff could should actually be derived by the encoder.
    11631106  // VPS VUI
    1164   ("VpsVuiPresentFlag"           , m_vpsVuiPresentFlag           , false                                           , "VpsVuiPresentFlag           ")
    1165   ("CrossLayerPicTypeAlignedFlag", m_crossLayerPicTypeAlignedFlag, false                                           , "CrossLayerPicTypeAlignedFlag")  // Could actually be derived by the encoder
    1166   ("CrossLayerIrapAlignedFlag"   , m_crossLayerIrapAlignedFlag   , false                                           , "CrossLayerIrapAlignedFlag   ")  // Could actually be derived by the encoder
    1167   ("AllLayersIdrAlignedFlag"     , m_allLayersIdrAlignedFlag     , false                                           , "CrossLayerIrapAlignedFlag   ")  // Could actually be derived by the encoder
    1168   ("BitRatePresentVpsFlag"       , m_bitRatePresentVpsFlag       , false                                           , "BitRatePresentVpsFlag       ")
    1169   ("PicRatePresentVpsFlag"       , m_picRatePresentVpsFlag       , false                                           , "PicRatePresentVpsFlag       ")
    1170   ("BitRatePresentFlag"          , m_bitRatePresentFlag          , BoolAry1d(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "BitRatePresentFlag per sub layer for the N-th layer set")
    1171   ("PicRatePresentFlag"          , m_picRatePresentFlag          , BoolAry1d(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "PicRatePresentFlag per sub layer for the N-th layer set")
    1172   ("AvgBitRate"                  , m_avgBitRate                   , IntAry1d (1,0), MAX_VPS_OP_SETS_PLUS1, "AvgBitRate         per sub layer for the N-th layer set")
    1173   ("MaxBitRate"                  , m_maxBitRate                   , IntAry1d (1,0), MAX_VPS_OP_SETS_PLUS1, "MaxBitRate         per sub layer for the N-th layer set")
    1174   ("ConstantPicRateIdc"          , m_constantPicRateIdc           , IntAry1d (1,0), MAX_VPS_OP_SETS_PLUS1, "ConstantPicRateIdc per sub layer for the N-th layer set")
    1175   ("AvgPicRate"                  , m_avgPicRate                   , IntAry1d (1,0), MAX_VPS_OP_SETS_PLUS1, "AvgPicRate         per sub layer for the N-th layer set")
    1176   ("TilesNotInUseFlag"            , m_tilesNotInUseFlag            , true                                          , "TilesNotInUseFlag            ")
     1107  ("VpsVuiPresentFlag"            , m_vpsVuiPresentFlag            , false                                , "VpsVuiPresentFlag           ")
     1108  ("CrossLayerPicTypeAlignedFlag" , m_crossLayerPicTypeAlignedFlag , false                                , "CrossLayerPicTypeAlignedFlag")  // Could actually be derived by the encoder
     1109  ("CrossLayerIrapAlignedFlag"    , m_crossLayerIrapAlignedFlag    , false                                , "CrossLayerIrapAlignedFlag   ")  // Could actually be derived by the encoder
     1110  ("AllLayersIdrAlignedFlag"      , m_allLayersIdrAlignedFlag      , false                                , "CrossLayerIrapAlignedFlag   ")  // Could actually be derived by the encoder
     1111  ("BitRatePresentVpsFlag"        , m_bitRatePresentVpsFlag        , false                                , "BitRatePresentVpsFlag       ")
     1112  ("PicRatePresentVpsFlag"        , m_picRatePresentVpsFlag        , false                                , "PicRatePresentVpsFlag       ")
     1113  ("BitRatePresentFlag"           , m_bitRatePresentFlag           , BoolAry1d(1,0), MAX_VPS_OP_SETS_PLUS1, "BitRatePresentFlag per sub layer for the N-th layer set")
     1114  ("PicRatePresentFlag"           , m_picRatePresentFlag           , BoolAry1d(1,0), MAX_VPS_OP_SETS_PLUS1, "PicRatePresentFlag per sub layer for the N-th layer set")
     1115  ("AvgBitRate"                   , m_avgBitRate                   , IntAry1d (1,0), MAX_VPS_OP_SETS_PLUS1, "AvgBitRate         per sub layer for the N-th layer set")
     1116  ("MaxBitRate"                   , m_maxBitRate                   , IntAry1d (1,0), MAX_VPS_OP_SETS_PLUS1, "MaxBitRate         per sub layer for the N-th layer set")
     1117  ("ConstantPicRateIdc"           , m_constantPicRateIdc           , IntAry1d (1,0), MAX_VPS_OP_SETS_PLUS1, "ConstantPicRateIdc per sub layer for the N-th layer set")
     1118  ("AvgPicRate"                   , m_avgPicRate                   , IntAry1d (1,0), MAX_VPS_OP_SETS_PLUS1, "AvgPicRate         per sub layer for the N-th layer set")
     1119  ("TilesNotInUseFlag"            , m_tilesNotInUseFlag            , true                                 , "TilesNotInUseFlag            ")
    11771120  ("TilesInUseFlag"               , m_tilesInUseFlag               , BoolAry1d(1,false)                   , "TilesInUseFlag               ")
    1178   ("LoopFilterNotAcrossTilesFlag" , m_loopFilterNotAcrossTilesFlag , BoolAry1d(1,false)                  , "LoopFilterNotAcrossTilesFlag ")
    1179   ("WppNotInUseFlag"              , m_wppNotInUseFlag              , true                                          , "WppNotInUseFlag              ")
    1180   ("WppInUseFlag"                 , m_wppInUseFlag                 , BoolAry1d(1,0)                      , "WppInUseFlag                 ")
    1181   ("TileBoundariesAlignedFlag"   , m_tileBoundariesAlignedFlag   , BoolAry1d(1,0)  ,MAX_NUM_LAYERS       , "TileBoundariesAlignedFlag    per direct reference for the N-th layer")
    1182   ("IlpRestrictedRefLayersFlag"  , m_ilpRestrictedRefLayersFlag  , false                                           , "IlpRestrictedRefLayersFlag")
    1183   ("MinSpatialSegmentOffsetPlus1", m_minSpatialSegmentOffsetPlus1 , IntAry1d (1,0), MAX_NUM_LAYERS       , "MinSpatialSegmentOffsetPlus1 per direct reference for the N-th layer")
    1184   ("CtuBasedOffsetEnabledFlag"   , m_ctuBasedOffsetEnabledFlag   , BoolAry1d(1,0)  ,MAX_NUM_LAYERS       , "CtuBasedOffsetEnabledFlag    per direct reference for the N-th layer")
    1185   ("MinHorizontalCtuOffsetPlus1" , m_minHorizontalCtuOffsetPlus1  , IntAry1d (1,0), MAX_NUM_LAYERS       , "MinHorizontalCtuOffsetPlus1  per direct reference for the N-th layer")
    1186   ("SingleLayerForNonIrapFlag", m_singleLayerForNonIrapFlag, false                                          , "SingleLayerForNonIrapFlag")
    1187   ("HigherLayerIrapSkipFlag"  , m_higherLayerIrapSkipFlag  , false                                          , "HigherLayerIrapSkipFlag  ")
     1121  ("LoopFilterNotAcrossTilesFlag" , m_loopFilterNotAcrossTilesFlag , BoolAry1d(1,false)                   , "LoopFilterNotAcrossTilesFlag ")
     1122  ("WppNotInUseFlag"              , m_wppNotInUseFlag              , true                                 , "WppNotInUseFlag              ")
     1123  ("WppInUseFlag"                 , m_wppInUseFlag                 , BoolAry1d(1,0)                       , "WppInUseFlag                 ")
     1124  ("TileBoundariesAlignedFlag"    , m_tileBoundariesAlignedFlag    , BoolAry1d(1,0)  ,MAX_NUM_LAYERS      , "TileBoundariesAlignedFlag    per direct reference for the N-th layer")
     1125  ("IlpRestrictedRefLayersFlag"   , m_ilpRestrictedRefLayersFlag   , false                                , "IlpRestrictedRefLayersFlag")
     1126  ("MinSpatialSegmentOffsetPlus1" , m_minSpatialSegmentOffsetPlus1 , IntAry1d (1,0), MAX_NUM_LAYERS       , "MinSpatialSegmentOffsetPlus1 per direct reference for the N-th layer")
     1127  ("CtuBasedOffsetEnabledFlag"    , m_ctuBasedOffsetEnabledFlag    , BoolAry1d(1,0)  ,MAX_NUM_LAYERS      , "CtuBasedOffsetEnabledFlag    per direct reference for the N-th layer")
     1128  ("MinHorizontalCtuOffsetPlus1"  , m_minHorizontalCtuOffsetPlus1  , IntAry1d (1,0), MAX_NUM_LAYERS       , "MinHorizontalCtuOffsetPlus1  per direct reference for the N-th layer")
     1129  ("SingleLayerForNonIrapFlag"    , m_singleLayerForNonIrapFlag    , false                                , "SingleLayerForNonIrapFlag")
     1130  ("HigherLayerIrapSkipFlag"      , m_higherLayerIrapSkipFlag      , false                                , "HigherLayerIrapSkipFlag  ")
    11881131#endif
    11891132
     
    12271170  ("Log2MaxMvLengthHorizontal",                       m_log2MaxMvLengthHorizontal,                         15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
    12281171  ("Log2MaxMvLengthVertical",                         m_log2MaxMvLengthVertical,                           15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
    1229   ("SEIRecoveryPoint",                                m_recoveryPointSEIEnabled,                            0, "Control generation of recovery point SEI messages")
    1230   ("SEIBufferingPeriod",                              m_bufferingPeriodSEIEnabled,                          0, "Control generation of buffering period SEI messages")
    1231   ("SEIPictureTiming",                                m_pictureTimingSEIEnabled,                            0, "Control generation of picture timing SEI messages")
     1172  ("SEIColourRemappingInfoFileRoot,-cri",             m_colourRemapSEIFileRoot,                    string(""), "Colour Remapping Information SEI parameters root file name (wo num ext)")
     1173  ("SEIRecoveryPoint",                                m_recoveryPointSEIEnabled,                        false, "Control generation of recovery point SEI messages")
     1174  ("SEIBufferingPeriod",                              m_bufferingPeriodSEIEnabled,                      false, "Control generation of buffering period SEI messages")
     1175  ("SEIPictureTiming",                                m_pictureTimingSEIEnabled,                        false, "Control generation of picture timing SEI messages")
    12321176  ("SEIToneMappingInfo",                              m_toneMappingInfoSEIEnabled,                      false, "Control generation of Tone Mapping SEI messages")
    12331177  ("SEIToneMapId",                                    m_toneMapId,                                          0, "Specifies Id of Tone Mapping SEI message for a given session")
     
    12621206  ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,                   235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
    12631207  ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,                  300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
    1264   ("SEIChromaSamplingFilterHint",                     m_chromaSamplingFilterSEIenabled,                 false, "Control generation of the chroma sampling filter hint SEI message")
    1265   ("SEIChromaSamplingHorizontalFilterType",           m_chromaSamplingHorFilterIdc,                         2, "Defines the Index of the chroma sampling horizontal filter\n"
     1208  ("SEIChromaResamplingFilterHint",                   m_chromaResamplingFilterSEIenabled,               false, "Control generation of the chroma sampling filter hint SEI message")
     1209  ("SEIChromaResamplingHorizontalFilterType",         m_chromaResamplingHorFilterIdc,                       2, "Defines the Index of the chroma sampling horizontal filter\n"
    12661210                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
    12671211                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
    12681212                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
    1269   ("SEIChromaSamplingVerticalFilterType",             m_chromaSamplingVerFilterIdc,                         2, "Defines the Index of the chroma sampling vertical filter\n"
     1213  ("SEIChromaResamplingVerticalFilterType",           m_chromaResamplingVerFilterIdc,                         2, "Defines the Index of the chroma sampling vertical filter\n"
    12701214                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
    12711215                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
    12721216                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
    1273   ("SEIFramePacking",                                 m_framePackingSEIEnabled,                             0, "Control generation of frame packing SEI messages")
     1217  ("SEIFramePacking",                                 m_framePackingSEIEnabled,                         false, "Control generation of frame packing SEI messages")
    12741218  ("SEIFramePackingType",                             m_framePackingSEIType,                                0, "Define frame packing arrangement\n"
    12751219                                                                                                               "\t3: side by side - frames are displayed horizontally\n"
     
    12821226                                                                                                               "\t1: stereo pair, frame0 represents left view\n"
    12831227                                                                                                               "\t2: stereo pair, frame0 represents right view")
    1284   ("SEISegmentedRectFramePacking",                    m_segmentedRectFramePackingSEIEnabled,                0, "Controls generation of segmented rectangular frame packing SEI messages")
     1228  ("SEISegmentedRectFramePacking",                    m_segmentedRectFramePackingSEIEnabled,            false, "Controls generation of segmented rectangular frame packing SEI messages")
    12851229  ("SEISegmentedRectFramePackingCancel",              m_segmentedRectFramePackingSEICancel,             false, "If equal to 1, cancels the persistence of any previous SRFPA SEI message")
    12861230  ("SEISegmentedRectFramePackingType",                m_segmentedRectFramePackingSEIType,                   0, "Specifies the arrangement of the frames in the reconstructed picture")
     
    12891233                                                                                                               "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
    12901234                                                                                                               "\t0: disable")
    1291   ("SEITemporalLevel0Index",                          m_temporalLevel0IndexSEIEnabled,                      0, "Control generation of temporal level 0 index SEI messages")
    1292   ("SEIGradualDecodingRefreshInfo",                   m_gradualDecodingRefreshInfoEnabled,                  0, "Control generation of gradual decoding refresh information SEI message")
     1235  ("SEITemporalLevel0Index",                          m_temporalLevel0IndexSEIEnabled,                  false, "Control generation of temporal level 0 index SEI messages")
     1236  ("SEIGradualDecodingRefreshInfo",                   m_gradualDecodingRefreshInfoEnabled,              false, "Control generation of gradual decoding refresh information SEI message")
    12931237  ("SEINoDisplay",                                    m_noDisplaySEITLayer,                                 0, "Control generation of no display SEI message\n"
    12941238                                                                                                               "\tN: 0 < N enable no display SEI message for temporal layer N or higher\n"
    12951239                                                                                                               "\t0: disable")
    1296   ("SEIDecodingUnitInfo",                             m_decodingUnitInfoSEIEnabled,                         0, "Control generation of decoding unit information SEI message.")
    1297   ("SEISOPDescription",                               m_SOPDescriptionSEIEnabled,                           0, "Control generation of SOP description SEI messages")
    1298   ("SEIScalableNesting",                              m_scalableNestingSEIEnabled,                          0, "Control generation of scalable nesting SEI messages")
     1240  ("SEIDecodingUnitInfo",                             m_decodingUnitInfoSEIEnabled,                     false, "Control generation of decoding unit information SEI message.")
     1241  ("SEISOPDescription",                               m_SOPDescriptionSEIEnabled,                       false, "Control generation of SOP description SEI messages")
     1242  ("SEIScalableNesting",                              m_scalableNestingSEIEnabled,                      false, "Control generation of scalable nesting SEI messages")
    12991243  ("SEITempMotionConstrainedTileSets",                m_tmctsSEIEnabled,                                false, "Control generation of temporal motion constrained tile sets SEI message")
    13001244  ("SEITimeCodeEnabled",                              m_timeCodeSEIEnabled,                             false, "Control generation of time code information SEI message")
     
    13321276  ("SEIMasteringDisplayWhitePoint",                   cfg_DisplayWhitePointCode,     cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
    13331277#if NH_MV
    1334 #if !NH_MV_SEI
    1335   ("SubBitstreamPropSEIEnabled",                      m_subBistreamPropSEIEnabled,    false                     ,"Enable signaling of sub-bitstream property SEI message")
    1336   ("SEISubBitstreamNumAdditionalSubStreams",          m_sbPropNumAdditionalSubStreams,0                         ,"Number of substreams for which additional information is signalled")
    1337   ("SEISubBitstreamSubBitstreamMode",                 m_sbPropSubBitstreamMode,       IntAry1d (1,0)            ,"Specifies mode of generation of the i-th sub-bitstream (0 or 1)")
    1338   ("SEISubBitstreamOutputLayerSetIdxToVps",           m_sbPropOutputLayerSetIdxToVps, IntAry1d (1,0)            ,"Specifies output layer set index of the i-th sub-bitstream ")
    1339   ("SEISubBitstreamHighestSublayerId",                m_sbPropHighestSublayerId,      IntAry1d (1,0)            ,"Specifies highest TemporalId of the i-th sub-bitstream")
    1340   ("SEISubBitstreamAvgBitRate",                       m_sbPropAvgBitRate,             IntAry1d (1,0)            ,"Specifies average bit rate of the i-th sub-bitstream")
    1341   ("SEISubBitstreamMaxBitRate",                       m_sbPropMaxBitRate,             IntAry1d (1,0)            ,"Specifies maximum bit rate of the i-th sub-bitstream")
    1342 #else
    1343   ("SeiCfgFileName_%d",                               m_seiCfgFileNames,             (Char *) 0 , MAX_NUM_SEIS , "SEI cfg file name %d")
    1344 #endif
     1278  ("SeiCfgFileName_%d",                               m_seiCfgFileNames,             (TChar *) 0 ,MAX_NUM_SEIS , "SEI cfg file name %d")
    13451279  ("OutputVpsInfo",                                   m_outputVpsInfo,                false                     ,"Output information about the layer dependencies and layer sets")
     1280
     1281/* Camera parameters */   
     1282  ("BaseViewCameraNumbers",                           m_pchBaseViewCameraNumbers,   (TChar *) 0                 , "Numbers of base views")
    13461283#endif
    13471284#if NH_3D
    1348 /* Camera parameters */ 
    13491285  ("Depth420OutputFlag",                              m_depth420OutputFlag,           true                     , "Output depth layers in 4:2:0 ")
    1350   ("CameraParameterFile,cpf",                         m_pchCameraParameterFile,    (Char *) 0,                    "Camera Parameter File Name")
    1351   ("BaseViewCameraNumbers",                           m_pchBaseViewCameraNumbers,  (Char *) 0,                    "Numbers of base views")
     1286#endif
     1287#if NH_3D_VSO 
     1288  ("CameraParameterFile,cpf",                         m_pchCameraParameterFile,    (TChar *) 0                 , "Camera Parameter File Name")
    13521289  ("CodedCamParsPrecision",                           m_iCodedCamParPrecision,      STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
    13531290
    1354 #if NH_3D_VSO
    13551291  /* View Synthesis Optimization */
    1356   ("VSOConfig",                                       m_pchVSOConfig            , (Char *) 0                    ,"VSO configuration")
     1292  ("VSOConfig",                                       m_pchVSOConfig            , (TChar *) 0                   ,"VSO configuration")
    13571293  ("VSO",                                             m_bUseVSO                 , false                         ,"Use VSO" )   
    13581294  ("VSOMode",                                         m_uiVSOMode               , (UInt)   4                    ,"VSO Mode")
     
    13711307#endif //HHI_VSO
    13721308/* 3D- HEVC Tools */                                                           
     1309#if NH_3D_QTL
    13731310  ("QTL"                   ,                          m_bUseQTL                 , true                          , "Use depth quad tree limitation (encoder only)" )
     1311#endif
     1312#if NH_3D
     1313
    13741314  ("IvMvPredFlag"          ,                          m_ivMvPredFlag            , BoolAry1d(2,true)             , "Inter-view motion prediction"              )
    13751315  ("IvMvScalingFlag"       ,                          m_ivMvScalingFlag         , BoolAry1d(2,true)             , "Inter-view motion vector scaling"          )
     
    14471387  po::setDefaults(opts);
    14481388  po::ErrorReporter err;
    1449   const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv, err);
    1450 
    1451   for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
     1389  const list<const TChar*>& argv_unhandled = po::scanArgv(opts, argc, (const TChar**) argv, err);
     1390
     1391  for (list<const TChar*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
    14521392  {
    14531393    fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
     
    14731413   * Set any derived parameters
    14741414   */
    1475   /* convert std::string to c string for compatability */
    1476 #if !NH_MV
    1477   m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
    1478 #endif
    1479   m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    1480 #if !NH_MV
    1481   m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    1482 #endif
    1483   m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    1484 
     1415  m_adIntraLambdaModifier = cfg_adIntraLambdaModifier.values;
    14851416  if(m_isField)
    14861417  {
     
    15451476  }
    15461477
    1547   m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    1548 
    15491478  /* rules for input, output and internal bitdepths as per help text */
    15501479  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0)
     
    15791508  m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
    15801509  m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
     1510
     1511
     1512  assert(tmpWeightedPredictionMethod>=0 && tmpWeightedPredictionMethod<=WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION);
     1513  if (!(tmpWeightedPredictionMethod>=0 && tmpWeightedPredictionMethod<=WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION))
     1514  {
     1515    exit(EXIT_FAILURE);
     1516  }
     1517  m_weightedPredictionMethod = WeightedPredictionMethod(tmpWeightedPredictionMethod);
     1518
     1519  assert(tmpFastInterSearchMode>=0 && tmpFastInterSearchMode<=FASTINTERSEARCH_MODE3);
     1520  if (tmpFastInterSearchMode<0 || tmpFastInterSearchMode>FASTINTERSEARCH_MODE3)
     1521  {
     1522    exit(EXIT_FAILURE);
     1523  }
     1524  m_fastInterSearchMode = FastInterSearchMode(tmpFastInterSearchMode);
     1525
     1526  assert(tmpMotionEstimationSearchMethod>=0 && tmpMotionEstimationSearchMethod<MESEARCH_NUMBER_OF_METHODS);
     1527  if (tmpMotionEstimationSearchMethod<0 || tmpMotionEstimationSearchMethod>=MESEARCH_NUMBER_OF_METHODS)
     1528  {
     1529    exit(EXIT_FAILURE);
     1530  }
     1531  m_motionEstimationSearchMethod=MESearchMethod(tmpMotionEstimationSearchMethod);
    15811532
    15821533#if NH_MV
     
    18021753  }
    18031754
     1755  if (tmpSliceMode<0 || tmpSliceMode>=Int(NUMBER_OF_SLICE_CONSTRAINT_MODES))
     1756  {
     1757    fprintf(stderr, "Error: bad slice mode\n");
     1758    exit(EXIT_FAILURE);
     1759  }
     1760  m_sliceMode = SliceConstraint(tmpSliceMode);
     1761  if (tmpSliceSegmentMode<0 || tmpSliceSegmentMode>=Int(NUMBER_OF_SLICE_CONSTRAINT_MODES))
     1762  {
     1763    fprintf(stderr, "Error: bad slice segment mode\n");
     1764    exit(EXIT_FAILURE);
     1765  }
     1766  m_sliceSegmentMode = SliceConstraint(tmpSliceSegmentMode);
     1767
     1768  if (tmpDecodedPictureHashSEIMappedType<0 || tmpDecodedPictureHashSEIMappedType>=Int(NUMBER_OF_HASHTYPES))
     1769  {
     1770    fprintf(stderr, "Error: bad checksum mode\n");
     1771    exit(EXIT_FAILURE);
     1772  }
     1773  // Need to map values to match those of the SEI message:
     1774  if (tmpDecodedPictureHashSEIMappedType==0)
     1775  {
     1776    m_decodedPictureHashSEIType=HASHTYPE_NONE;
     1777  }
     1778  else
     1779  {
     1780    m_decodedPictureHashSEIType=HashType(tmpDecodedPictureHashSEIMappedType-1);
     1781  }
     1782
    18041783  // allocate slice-based dQP values
    18051784#if NH_MV
     
    18281807  xResizeVector( m_auxId );
    18291808
    1830 #if NH_3D
     1809#if NH_3D_VSO
    18311810  xResizeVector( m_depthFlag );
    18321811#endif
     
    19231902
    19241903  // reading external dQP description from file
    1925   if ( m_pchdQPFile )
    1926   {
    1927     FILE* fpt=fopen( m_pchdQPFile, "r" );
     1904  if ( !m_dQPFileName.empty() )
     1905  {
     1906    FILE* fpt=fopen( m_dQPFileName.c_str(), "r" );
    19281907    if ( fpt )
    19291908    {
     
    19531932  }
    19541933
    1955 #if NH_MV_SEI
     1934#if NH_MV
    19561935  xParseSeiCfg();
    19571936#endif
     
    20372016  }
    20382017
    2039 #if NH_3D
     2018
    20402019#if NH_3D_VSO
    20412020  // Table base optimization
     
    20542033    for (Int layer = 0; layer < m_numberOfLayers; layer++ )
    20552034    {
    2056       if ( m_depthFlag[ layer ])
     2035      if ( m_depthFlag[ layer ]  || m_auxId[ layer ] == 2 )
    20572036      {
    20582037        firstDepthLayer = layer;
     
    20912070      LOG2_DISP_PREC_LUT );
    20922071  }
     2072#if NH_3D
    20932073  else
    20942074  {
     
    21042084      LOG2_DISP_PREC_LUT );
    21052085  }
    2106 #else
    2107   m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2108     m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    2109     (UInt) m_iCodedCamParPrecision,
    2110     m_FrameSkip,
    2111     (UInt) m_framesToBeEncoded,
    2112     m_pchCameraParameterFile,
    2113     m_pchBaseViewCameraNumbers,
    2114     NULL,
    2115     NULL,
    2116     LOG2_DISP_PREC_LUT );
    2117 #endif
    21182086  m_cCameraData.check( false, true );
     2087#endif
    21192088#endif
    21202089
     
    21452114Void TAppEncCfg::xCheckParameter()
    21462115{
    2147   if (!m_decodedPictureHashSEIEnabled)
     2116  if (m_decodedPictureHashSEIType==HASHTYPE_NONE)
    21482117  {
    21492118    fprintf(stderr, "******************************************************************\n");
     
    21732142#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
    21742143
    2175   xConfirmPara(m_pchBitstreamFile==NULL, "A bitstream file name must be specified (BitstreamFile)");
     2144  xConfirmPara(m_bitstreamFileName.empty(), "A bitstream file name must be specified (BitstreamFile)");
    21762145  const UInt maxBitDepth=(m_chromaFormatIDC==CHROMA_400) ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
    21772146  xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value");
     
    23012270#endif
    23022271
    2303 #if NH_3D
     2272#if NH_3D_VSO
    23042273  if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
    23052274  {
     
    23972366    if (lsIdx == 0)
    23982367    {
    2399       xConfirmPara( m_layerIdsInSets[lsIdx].size() != 1 || m_layerIdsInSets[lsIdx][0] != 0 , "0-th layer shall only include layer 0. ");
    2400     }
    2401     for ( Int i = 0; i < m_layerIdsInSets[lsIdx].size(); i++ )
    2402     {
    2403       xConfirmPara( m_layerIdsInSets[lsIdx][i] < 0 || m_layerIdsInSets[lsIdx][i] >= MAX_NUM_LAYER_IDS, "LayerIdsInSet must be greater than 0 and less than MAX_NUM_LAYER_IDS" );
     2368      xConfirmPara( m_layerIdxInVpsInSets[lsIdx].size() != 1 || m_layerIdxInVpsInSets[lsIdx][0] != 0 , "0-th layer shall only include layer 0. ");
     2369    }
     2370    for ( Int i = 0; i < m_layerIdxInVpsInSets[lsIdx].size(); i++ )
     2371    {
     2372      xConfirmPara( m_layerIdxInVpsInSets[lsIdx][i] < 0 || m_layerIdxInVpsInSets[lsIdx][i] >= MAX_NUM_LAYER_IDS, "LayerIdsInSet must be greater than 0 and less than MAX_NUM_LAYER_IDS" );
    24042373    }
    24052374  }
     
    24342403      {
    24352404        Bool inLayerSetFlag = false;
    2436         for (Int j = 0; j < m_layerIdsInSets[ lsIdx].size(); j++ )
     2405        for (Int j = 0; j < m_layerIdxInVpsInSets[ lsIdx].size(); j++ )
    24372406        {
    2438           if ( m_layerIdsInSets[ lsIdx ][ j ] == m_layerIdsInDefOutputLayerSet[ lsIdx ][ i ] )
     2407          if ( m_layerIdxInVpsInSets[ lsIdx ][ j ] == m_layerIdsInDefOutputLayerSet[ lsIdx ][ i ] )
    24392408          {
    24402409            inLayerSetFlag = true;
     
    25442513  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,        "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
    25452514  xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,            "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
    2546   xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2,                                     "Fast Search Mode is not supported value (0:Full search  1:Diamond  2:PMVFAST)" );
    25472515  xConfirmPara( m_iSearchRange < 0 ,                                                        "Search Range must be more than 0" );
    2548   xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
     2516  xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Bi-prediction refinement search range must be more than 0" );
     2517  xConfirmPara( m_minSearchWindow < 0,                                                      "Minimum motion search window size for the adaptive window ME must be greater than or equal to 0" );
    25492518#if NH_MV
    25502519  xConfirmPara( m_iVerticalDisparitySearchRange <= 0 ,                                      "Vertical Disparity Search Range must be more than 0" );
     
    26242593  }
    26252594
    2626   xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" );
    2627   if (m_sliceMode!=0)
     2595  if (m_sliceMode!=NO_SLICES)
    26282596  {
    26292597    xConfirmPara( m_sliceArgument < 1 ,         "SliceArgument should be larger than or equal to 1" );
    26302598  }
    2631   xConfirmPara( m_sliceSegmentMode < 0 || m_sliceSegmentMode > 3, "SliceSegmentMode exceeds supported range (0 to 3)" );
    2632   if (m_sliceSegmentMode!=0)
     2599  if (m_sliceSegmentMode!=NO_SLICES)
    26332600  {
    26342601    xConfirmPara( m_sliceSegmentArgument < 1 ,         "SliceSegmentArgument should be larger than or equal to 1" );
     
    26382605  if (m_profile!=Profile::HIGHTHROUGHPUTREXT)
    26392606  {
    2640     xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together, except in the High Throughput Intra 4:4:4 16 profile");
     2607    xConfirmPara( tileFlag && m_entropyCodingSyncEnabledFlag, "Tiles and entropy-coding-sync (Wavefronts) can not be applied together, except in the High Throughput Intra 4:4:4 16 profile");
    26412608  }
    26422609
     
    26622629  }
    26632630
    2664 #if NH_3D
     2631#if NH_3D_VSO
    26652632  xConfirmPara( m_pchCameraParameterFile    == 0                ,   "CameraParameterFile must be given");
    26662633  xConfirmPara( m_pchBaseViewCameraNumbers  == 0                ,   "BaseViewCameraNumbers must be given" );
    26672634  xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() ,   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
    26682635  xConfirmPara    ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5,       "CodedCamParsPrecision must be in range of 0..5" );
    2669 #if NH_3D_VSO
    26702636    if( m_bUseVSO )
    26712637    {
     
    26732639      xConfirmPara( m_uiVSOMode > 4 ,                                                "VSO Mode must be less than 5");
    26742640    }
    2675 #endif
    26762641#endif
    26772642  // max CU width and height should be power of 2
     
    32373202      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4;
    32383203    }
    3239     else if(m_iWaveFrontSynchro)
     3204    else if(m_entropyCodingSyncEnabledFlag)
    32403205    {
    32413206      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4;
     
    32503215    }
    32513216  }
    3252 
    3253   xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" );
    3254 
    3255   xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n");
    32563217
    32573218  if (m_toneMappingInfoSEIEnabled)
     
    32823243  }
    32833244
     3245  if (m_chromaResamplingFilterSEIenabled)
     3246  {
     3247    xConfirmPara( (m_chromaFormatIDC == CHROMA_400 ), "chromaResamplingFilterSEI is not allowed to be present when ChromaFormatIDC is equal to zero (4:0:0)" );
     3248    xConfirmPara(m_vuiParametersPresentFlag && m_chromaLocInfoPresentFlag && (m_chromaSampleLocTypeTopField != m_chromaSampleLocTypeBottomField ), "When chromaResamplingFilterSEI is enabled, ChromaSampleLocTypeTopField has to be equal to ChromaSampleLocTypeBottomField" );
     3249  }
     3250
    32843251  if ( m_RCEnableRateControl )
    32853252  {
     
    32933260    }
    32943261    xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    3295   }
     3262#if U0132_TARGET_BITS_SATURATION
     3263#if NH_MV
     3264    if ((m_RCCpbSaturationEnabled) && (m_level[0]!=Level::NONE) && (m_profile!=Profile::NONE))
     3265    {
     3266      UInt uiLevelIdx = (m_level[0] / 10) + (UInt)((m_level[0] % 10) / 3);    // (m_level / 30)*3 + ((m_level % 10) / 3);
     3267      xConfirmPara(m_RCCpbSize > g_uiMaxCpbSize[m_levelTier[0]][uiLevelIdx], "RCCpbSize should be smaller than or equal to Max CPB size according to tier and level");
     3268      xConfirmPara(m_RCInitialCpbFullness > 1, "RCInitialCpbFullness should be smaller than or equal to 1");
     3269    }
     3270#else
     3271    if ((m_RCCpbSaturationEnabled) && (m_level!=Level::NONE) && (m_profile!=Profile::NONE))
     3272    {
     3273      UInt uiLevelIdx = (m_level / 10) + (UInt)((m_level % 10) / 3);    // (m_level / 30)*3 + ((m_level % 10) / 3);
     3274      xConfirmPara(m_RCCpbSize > g_uiMaxCpbSize[m_levelTier][uiLevelIdx], "RCCpbSize should be smaller than or equal to Max CPB size according to tier and level");
     3275      xConfirmPara(m_RCInitialCpbFullness > 1, "RCInitialCpbFullness should be smaller than or equal to 1");
     3276    }
     3277#endif
     3278#endif
     3279  }
     3280#if U0132_TARGET_BITS_SATURATION
     3281  else
     3282  {
     3283    xConfirmPara( m_RCCpbSaturationEnabled != 0, "Target bits saturation cannot be processed without Rate control" );
     3284  }
     3285#endif
     3286
    32963287#if NH_MV
    32973288  // VPS VUI
     
    33283319  }
    33293320  }
    3330 #if !NH_MV_SEI
    3331   // Check input parameters for Sub-bitstream property SEI message
    3332   if( m_subBistreamPropSEIEnabled )
    3333   {
    3334     xConfirmPara(
    3335       (this->m_sbPropNumAdditionalSubStreams != m_sbPropAvgBitRate.size() )
    3336       || (this->m_sbPropNumAdditionalSubStreams != m_sbPropHighestSublayerId.size() )
    3337       || (this->m_sbPropNumAdditionalSubStreams != m_sbPropMaxBitRate.size() )
    3338       || (this->m_sbPropNumAdditionalSubStreams != m_sbPropOutputLayerSetIdxToVps.size() )
    3339       || (this->m_sbPropNumAdditionalSubStreams != m_sbPropSubBitstreamMode.size()), "Some parameters of some sub-bitstream not defined");
    3340 
    3341     for( Int i = 0; i < m_sbPropNumAdditionalSubStreams; i++ )
    3342     {
    3343       xConfirmPara( m_sbPropSubBitstreamMode[i] < 0 || m_sbPropSubBitstreamMode[i] > 1, "Mode value should be 0 or 1" );
    3344       xConfirmPara( m_sbPropHighestSublayerId[i] < 0 || m_sbPropHighestSublayerId[i] > MAX_TLAYER-1, "Maximum sub-layer ID out of range" );
    3345       xConfirmPara( m_sbPropOutputLayerSetIdxToVps[i] < 0 || m_sbPropOutputLayerSetIdxToVps[i] >= MAX_VPS_OUTPUTLAYER_SETS, "OutputLayerSetIdxToVps should be within allowed range" );
    3346     }
    3347   }
    3348 #endif
    33493321#endif
    33503322
    33513323  if (m_segmentedRectFramePackingSEIEnabled)
    33523324  {
    3353     xConfirmPara(m_framePackingSEIEnabled > 0 , "SEISegmentedRectFramePacking must be 0 when SEIFramePacking is 1");
     3325    xConfirmPara(m_framePackingSEIEnabled , "SEISegmentedRectFramePacking must be 0 when SEIFramePacking is 1");
    33543326  }
    33553327
     
    33723344}
    33733345
    3374 const Char *profileToString(const Profile::Name profile)
     3346const TChar *profileToString(const Profile::Name profile)
    33753347{
    33763348  static const UInt numberOfProfiles = sizeof(strToProfile)/sizeof(*strToProfile);
     
    34003372  }
    34013373#else
    3402   printf("Input          File               : %s\n", m_pchInputFile          );
    3403 #endif
    3404   printf("Bitstream      File               : %s\n", m_pchBitstreamFile      );
     3374  printf("Input          File                    : %s\n", m_inputFileName.c_str()          );
     3375#endif
     3376  printf("Bitstream      File                    : %s\n", m_bitstreamFileName.c_str()      );
    34053377#if NH_MV
    34063378  for( Int layer = 0; layer < m_numberOfLayers; layer++)
     
    34093381  }
    34103382#else
    3411   printf("Reconstruction File               : %s\n", m_pchReconFile          );
     3383  printf("Reconstruction File                    : %s\n", m_reconFileName.c_str()          );
    34123384#endif
    34133385#if NH_MV
     
    34213393  xPrintParaVector( "AuxId", m_auxId );
    34223394#endif
    3423 #if NH_3D
     3395#if NH_3D_VSO
    34243396  xPrintParaVector( "DepthLayerFlag", m_depthFlag );
    34253397  printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision); 
     
    35813553
    35823554  printf("RateControl                       : %d\n", m_RCEnableRateControl );
     3555  printf("WPMethod                               : %d\n", Int(m_weightedPredictionMethod));
    35833556
    35843557  if(m_RCEnableRateControl)
     
    35913564    printf("ForceIntraQP                      : %d\n", m_RCForceIntraQP );
    35923565
     3566#if U0132_TARGET_BITS_SATURATION
     3567    printf("CpbSaturation                          : %d\n", m_RCCpbSaturationEnabled );
     3568    if (m_RCCpbSaturationEnabled)
     3569    {
     3570      printf("CpbSize                                : %d\n", m_RCCpbSize);
     3571      printf("InitalCpbFullness                      : %.2f\n", m_RCInitialCpbFullness);
     3572    }
     3573#endif
     3574
    35933575#if KWU_RC_MADPRED_E0227
    35943576    printf("Depth based MAD prediction   : %d\n", m_depthMADPred);
     
    36133595
    36143596  printf("Max Num Merge Candidates          : %d\n", m_maxNumMergeCand);
    3615 #if NH_3D
     3597#if NH_3D_VSO
    36163598  printf("BaseViewCameraNumbers             : %s\n", m_pchBaseViewCameraNumbers );
    36173599  printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision);
    3618 #if NH_3D_VSO
    36193600  printf("Force use of Lambda Scale         : %d\n", m_bForceLambdaScaleVSO );
    36203601
     
    36343615  }
    36353616#endif //HHI_VSO
    3636 #endif //NH_3D
    36373617  printf("\n");
    36383618#if NH_MV
     
    36483628  printf("SQP:%d ", m_uiDeltaQpRD         );
    36493629  printf("ASR:%d ", m_bUseASR             );
    3650   printf("FEN:%d ", m_bUseFastEnc         );
     3630  printf("MinSearchWindow:%d ", m_minSearchWindow        );
     3631  printf("RestrictMESampling:%d ", m_bRestrictMESampling );
     3632  printf("FEN:%d ", Int(m_fastInterSearchMode)           );
    36513633  printf("ECU:%d ", m_bUseEarlyCU         );
    36523634  printf("FDM:%d ", m_useFastDecisionForMerge );
     
    36573639  printf("TransformSkipFast:%d ", m_useTransformSkipFast       );
    36583640  printf("TransformSkipLog2MaxSize:%d ", m_log2MaxTransformSkipBlockSize);
    3659   printf("Slice: M=%d ", m_sliceMode);
     3641  printf("Slice: M=%d ", Int(m_sliceMode));
    36603642  if (m_sliceMode!=NO_SLICES)
    36613643  {
     
    36853667  printf("WPB:%d ", (Int)m_useWeightedBiPred);
    36863668  printf("PME:%d ", m_log2ParallelMergeLevel);
    3687   const Int iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    3688   printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d",
    3689           m_iWaveFrontSynchro, iWaveFrontSubstreams);
     3669  const Int iWaveFrontSubstreams = m_entropyCodingSyncEnabledFlag ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
     3670  printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_entropyCodingSyncEnabledFlag?1:0, iWaveFrontSubstreams);
    36903671  printf(" ScalingList:%d ", m_useScalingListId );
    36913672  printf("TMVPMode:%d ", m_TMVPModeId     );
     
    37003681  printf("WVSO:%d ", m_bUseWVSO ); 
    37013682#endif
     3683#if NH_3D_QTL
     3684  printf( "QTL:%d "                  , m_bUseQTL);
     3685#endif
    37023686#if NH_3D
    3703   printf( "QTL:%d "                  , m_bUseQTL);
    37043687  printf( "IlluCompEnable:%d "       , m_abUseIC);
    37053688  printf( "IlluCompLowLatencyEnc:%d ",  m_bUseLowLatencyICEnc);
     
    37303713}
    37313714
    3732 Bool confirmPara(Bool bflag, const Char* message)
     3715Bool confirmPara(Bool bflag, const TChar* message)
    37333716{
    37343717  if (!bflag)
  • TabularUnified trunk/source/App/TAppEncoder/TAppEncCfg.h

    r1356 r1386  
    6262  // file I/O
    6363#if NH_MV
    64   std::vector<char*>     m_pchInputFileList;                  ///< source file names
    65 #else
    66   Char*     m_pchInputFile;                                   ///< source file name
    67 #endif
    68   Char*     m_pchBitstreamFile;                               ///< output bitstream file
     64  std::vector<TChar*>     m_pchInputFileList;                  ///< source file names
     65#else
     66  std::string m_inputFileName;                                ///< source file name
     67#endif
     68  std::string m_bitstreamFileName;                            ///< output bitstream file
    6969#if NH_MV
    7070  std::vector<char*>     m_pchReconFileList;                  ///< output reconstruction file names
     
    7272  Int                    m_iNumberOfViews;                    ///< number of Layers that are views
    7373#else
    74   Char*     m_pchReconFile;                                   ///< output reconstruction file
     74  std::string m_reconFileName;                                ///< output reconstruction file
    7575#endif
    7676  #if NH_MV
     
    8080  IntAry1d               m_viewOrderIndex;                    ///< view order index 
    8181  IntAry1d               m_auxId;                             ///< auxiliary id
    82 #if NH_3D
     82#if NH_3D_VSO
    8383  IntAry1d               m_depthFlag;                         ///< depth flag
    8484#endif
     
    9191// layer sets   
    9292  Int                    m_vpsNumLayerSets;                   ///< Number of layer sets
    93   IntAry2d m_layerIdsInSets;           ///< LayerIds in vps of layer set
     93  IntAry2d m_layerIdxInVpsInSets;           ///< LayerIds in vps of layer set
    9494  Int                    m_numAddLayerSets;                    ///< Number of additional layer sets
    9595  IntAry2d m_highestLayerIdxPlus1;      ///< HighestLayerIdxPlus1 for each additional layer set and each independent layer (value with index 0 will be ignored)
     
    112112  Bool m_bitRatePresentVpsFlag;
    113113  Bool m_picRatePresentVpsFlag;
    114   BoolAry2d              m_bitRatePresentFlag;
    115   BoolAry2d              m_picRatePresentFlag;
    116   IntAry2d               m_avgBitRate;
    117   IntAry2d               m_maxBitRate;
    118   IntAry2d               m_constantPicRateIdc;
    119   IntAry2d               m_avgPicRate;
    120   Bool                              m_tilesNotInUseFlag;
    121   BoolAry1d               m_tilesInUseFlag;
    122   BoolAry1d               m_loopFilterNotAcrossTilesFlag;
    123   Bool                              m_wppNotInUseFlag;
    124   BoolAry1d               m_wppInUseFlag;
    125 
    126   BoolAry2d              m_tileBoundariesAlignedFlag; 
    127   Bool m_ilpRestrictedRefLayersFlag;
    128   IntAry2d               m_minSpatialSegmentOffsetPlus1;
    129   BoolAry2d              m_ctuBasedOffsetEnabledFlag;
    130   IntAry2d               m_minHorizontalCtuOffsetPlus1;
    131   Bool m_singleLayerForNonIrapFlag;
    132   Bool m_higherLayerIrapSkipFlag;
    133 
    134 
     114  BoolAry2d m_bitRatePresentFlag;
     115  BoolAry2d m_picRatePresentFlag;
     116  IntAry2d  m_avgBitRate;
     117  IntAry2d  m_maxBitRate;
     118  IntAry2d  m_constantPicRateIdc;
     119  IntAry2d  m_avgPicRate;
     120  Bool      m_tilesNotInUseFlag;
     121  BoolAry1d m_tilesInUseFlag;
     122  BoolAry1d m_loopFilterNotAcrossTilesFlag;
     123  Bool      m_wppNotInUseFlag;
     124  BoolAry1d m_wppInUseFlag;
     125
     126  BoolAry2d m_tileBoundariesAlignedFlag; 
     127  Bool      m_ilpRestrictedRefLayersFlag;
     128  IntAry2d  m_minSpatialSegmentOffsetPlus1;
     129  BoolAry2d m_ctuBasedOffsetEnabledFlag;
     130  IntAry2d  m_minHorizontalCtuOffsetPlus1;
     131  Bool      m_singleLayerForNonIrapFlag;
     132  Bool      m_higherLayerIrapSkipFlag;
    135133#if NH_3D
    136134  Bool      m_abUseIC;
    137135  Bool      m_bUseLowLatencyICEnc;
    138136#endif
    139 
    140 #endif
     137#endif
     138  // Lambda modifiers
    141139  Double    m_adLambdaModifier[ MAX_TLAYER ];                 ///< Lambda modifier array for each temporal layer
     140  std::vector<Double> m_adIntraLambdaModifier;                ///< Lambda modifier for Intra pictures, one for each temporal layer. If size>temporalLayer, then use [temporalLayer], else if size>0, use [size()-1], else use m_adLambdaModifier.
     141  Double    m_dIntraQpFactor;                                 ///< Intra Q Factor. If negative, use a default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? (GopSize-1)/2 : GopSize-1) ))
     142
    142143  // source specification
    143144  Int       m_iFrameRate;                                     ///< source frame-rates (Hz)
     
    160161  Int       m_framesToBeEncoded;                              ///< number of encoded frames
    161162  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
     163  Bool      m_AccessUnitDelimiter;                            ///< add Access Unit Delimiter NAL units
    162164  InputColourSpaceConversion m_inputColourSpaceConvert;       ///< colour space conversion to apply to input video
    163165  Bool      m_snrInternalColourSpace;                       ///< if true, then no colour space conversion is applied for snr calculation, otherwise inverse of input is applied.
     
    237239  Int       m_iQP;                                            ///< QP value of key-picture (integer)
    238240#endif
    239   Char*     m_pchdQPFile;                                     ///< QP offset for each slice (initialized from external file)
     241  std::string m_dQPFileName;                                  ///< QP offset for each slice (initialized from external file)
    240242#if NH_MV
    241243  std::vector<Int*> m_aidQP;                                    ///< array of slice QP values for each layer
     
    256258#endif
    257259  TComSEIMasteringDisplay m_masteringDisplay;
    258 #if NH_MV_SEI
     260#if NH_MV
    259261  std::vector<char*>     m_seiCfgFileNames;               ///< SEI message files.
    260262  SEIMessages            m_seiMessages;                       ///< Buffer for SEI messages.
     
    338340  Int       m_rdPenalty;                                      ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
    339341  Bool      m_bDisableIntraPUsInInterSlices;                  ///< Flag for disabling intra predicted PUs in inter slices.
    340   Int       m_iFastSearch;                                    ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
     342  MESearchMethod m_motionEstimationSearchMethod;
     343  Bool      m_bRestrictMESampling;                            ///< Restrict sampling for the Selective ME
    341344  Int       m_iSearchRange;                                   ///< ME search range
    342345  Int       m_bipredSearchRange;                              ///< ME search range for bipred refinement
     346  Int       m_minSearchWindow;                                ///< ME minimum search window size for the Adaptive Window ME
    343347  Bool      m_bClipForBiPredMeEnabled;                        ///< Enables clipping for Bi-Pred ME.
    344348  Bool      m_bFastMEAssumingSmootherMVEnabled;               ///< Enables fast ME assuming a smoother MV.
     
    347351  Int       m_iVerticalDisparitySearchRange;                  ///< ME vertical search range for inter-view prediction
    348352#endif
    349   Bool      m_bUseFastEnc;                                    ///< flag for using fast encoder setting
     353  FastInterSearchMode m_fastInterSearchMode;                  ///< Parameter that controls fast encoder settings
    350354  Bool      m_bUseEarlyCU;                                    ///< flag for using Early CU setting
    351355  Bool      m_useFastDecisionForMerge;                        ///< flag for using Fast Decision Merge RD-Cost
    352356  Bool      m_bUseCbfFastMode;                              ///< flag for using Cbf Fast PU Mode Decision
    353357  Bool      m_useEarlySkipDetection;                         ///< flag for using Early SKIP Detection
    354   Int       m_sliceMode;                                     ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice,
    355                                                              ///< 3: max number of tiles per slice
     358  SliceConstraint m_sliceMode;
    356359  Int       m_sliceArgument;                                 ///< argument according to selected slice mode
    357   Int       m_sliceSegmentMode;                              ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment,
    358                                                              ///< 3: max number of tiles per slice segment
     360  SliceConstraint m_sliceSegmentMode;
    359361  Int       m_sliceSegmentArgument;                          ///< argument according to selected slice segment mode
    360362
     
    366368  std::vector<Int> m_tileColumnWidth;
    367369  std::vector<Int> m_tileRowHeight;
    368   Int       m_iWaveFrontSynchro; //< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current.
    369   Int       m_iWaveFrontFlush; //< enable(1)/disable(0) the CABAC flush at the end of each line of LCUs.
     370  Bool      m_entropyCodingSyncEnabledFlag;
    370371
    371372  Bool      m_bUseConstrainedIntraPred;                       ///< flag for using constrained intra prediction
     
    374375  Bool      m_bUseBLambdaForNonKeyLowDelayPictures;
    375376
    376   Int       m_decodedPictureHashSEIEnabled;                    ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
    377   Int       m_recoveryPointSEIEnabled;
    378   Int       m_bufferingPeriodSEIEnabled;
    379   Int       m_pictureTimingSEIEnabled;
     377  HashType  m_decodedPictureHashSEIType;                      ///< Checksum mode for decoded picture hash SEI message
     378  Bool      m_recoveryPointSEIEnabled;
     379  Bool      m_bufferingPeriodSEIEnabled;
     380  Bool      m_pictureTimingSEIEnabled;
    380381  Bool      m_toneMappingInfoSEIEnabled;
    381   Bool      m_chromaSamplingFilterSEIenabled;
    382   Int       m_chromaSamplingHorFilterIdc;
    383   Int       m_chromaSamplingVerFilterIdc;
     382  Bool      m_chromaResamplingFilterSEIenabled;
     383  Int       m_chromaResamplingHorFilterIdc;
     384  Int       m_chromaResamplingVerFilterIdc;
    384385  Int       m_toneMapId;
    385386  Bool      m_toneMapCancelFlag;
     
    408409  Int*      m_codedPivotValue;
    409410  Int*      m_targetPivotValue;
    410   Int       m_framePackingSEIEnabled;
     411  Bool      m_framePackingSEIEnabled;
    411412  Int       m_framePackingSEIType;
    412413  Int       m_framePackingSEIId;
    413414  Int       m_framePackingSEIQuincunx;
    414415  Int       m_framePackingSEIInterpretation;
    415   Int       m_segmentedRectFramePackingSEIEnabled;
     416  Bool      m_segmentedRectFramePackingSEIEnabled;
    416417  Bool      m_segmentedRectFramePackingSEICancel;
    417418  Int       m_segmentedRectFramePackingSEIType;
    418419  Bool      m_segmentedRectFramePackingSEIPersistence;
    419420  Int       m_displayOrientationSEIAngle;
    420   Int       m_temporalLevel0IndexSEIEnabled;
    421   Int       m_gradualDecodingRefreshInfoEnabled;
     421  Bool      m_temporalLevel0IndexSEIEnabled;
     422  Bool      m_gradualDecodingRefreshInfoEnabled;
    422423  Int       m_noDisplaySEITLayer;
    423   Int       m_decodingUnitInfoSEIEnabled;
    424   Int       m_SOPDescriptionSEIEnabled;
    425   Int       m_scalableNestingSEIEnabled;
     424  Bool      m_decodingUnitInfoSEIEnabled;
     425  Bool      m_SOPDescriptionSEIEnabled;
     426  Bool      m_scalableNestingSEIEnabled;
    426427  Bool      m_tmctsSEIEnabled;
    427428  Bool      m_timeCodeSEIEnabled;
     
    442443  Bool      m_useWeightedPred;                    ///< Use of weighted prediction in P slices
    443444  Bool      m_useWeightedBiPred;                  ///< Use of bi-directional weighted prediction in B slices
     445  WeightedPredictionMethod m_weightedPredictionMethod;
    444446
    445447  UInt      m_log2ParallelMergeLevel;                         ///< Parallel merge estimation region
     
    455457  Int       m_RCInitialQP;                        ///< inital QP for rate control
    456458  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
    457  
     459
     460#if U0132_TARGET_BITS_SATURATION
     461  Bool      m_RCCpbSaturationEnabled;             ///< enable target bits saturation to avoid CPB overflow and underflow
     462  UInt      m_RCCpbSize;                          ///< CPB size
     463  Double    m_RCInitialCpbFullness;               ///< initial CPB fullness
     464#endif
     465
    458466#if KWU_RC_VIEWRC_E0227
    459467  vector<Int>     m_viewTargetBits;
     
    464472#endif
    465473
    466 ScalingListMode m_useScalingListId;                         ///< using quantization matrix
    467   Char*     m_scalingListFile;                                ///< quantization matrix file name
     474  ScalingListMode m_useScalingListId;                         ///< using quantization matrix
     475  std::string m_scalingListFileName;                          ///< quantization matrix file name
    468476
    469477  Bool      m_TransquantBypassEnableFlag;                     ///< transquant_bypass_enable_flag setting in PPS.
     
    509517  Int       m_log2MaxMvLengthHorizontal;                      ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units
    510518  Int       m_log2MaxMvLengthVertical;                        ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units
     519  std::string m_colourRemapSEIFileRoot;
     520
    511521  std::string m_summaryOutFilename;                           ///< filename to use for producing summary output file.
    512522  std::string m_summaryPicFilenameBase;                       ///< Base filename to use for producing summary picture output files. The actual filenames used will have I.txt, P.txt and B.txt appended.
    513523  UInt        m_summaryVerboseness;                           ///< Specifies the level of the verboseness of the text output.
    514524#if NH_MV
    515 #if !NH_MV_SEI
    516   Bool              m_subBistreamPropSEIEnabled;
    517   Int               m_sbPropNumAdditionalSubStreams;
    518   IntAry1d          m_sbPropSubBitstreamMode;
    519   IntAry1d          m_sbPropOutputLayerSetIdxToVps;
    520   IntAry1d          m_sbPropHighestSublayerId;
    521   IntAry1d          m_sbPropAvgBitRate;
    522   IntAry1d          m_sbPropMaxBitRate;
    523 #endif
    524525  Bool              m_outputVpsInfo;
    525 #endif
     526  TChar*            m_pchBaseViewCameraNumbers;
     527#endif
     528
    526529#if NH_3D
    527530  // Output Format
    528531  Bool      m_depth420OutputFlag;                             ///< Output depth layers in 4:2:0 format
    529   // Camera parameters
    530   Char*     m_pchCameraParameterFile;                         ///< camera parameter file
    531   Char*     m_pchBaseViewCameraNumbers;
     532#endif
     533    // Camera parameters
     534#if NH_3D_VSO
     535  TChar*    m_pchCameraParameterFile;                         ///< camera parameter file
    532536  TAppComCamPara m_cCameraData;
    533537  Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
    534 #if NH_3D_VSO
    535   Char*     m_pchVSOConfig;
     538  TChar*    m_pchVSOConfig;
    536539  Bool      m_bUseVSO;                                        ///< flag for using View Synthesis Optimization
    537540  Bool      m_bVSOLSTable;                                    ///< Depth QP dependent Lagrange parameter optimization (m23714)
     
    556559  TRenModSetupStrParser       m_cRenModStrParser;
    557560#endif
    558 
     561#if NH_3D
    559562  Bool       m_useDLT;                                        ///< flag for using DLT
     563#endif
     564#if NH_3D_QTL
    560565  Bool       m_bUseQTL;                                        ///< flag for using depth QuadTree Limitation
     566#endif
     567#if NH_3D
    561568  BoolAry1d  m_ivMvPredFlag;
    562569  BoolAry1d  m_ivMvScalingFlag;
     
    660667  Void xPrintVectorElem( Double elem ) { printf(" %5.2f", elem            );}; 
    661668  Void xPrintVectorElem( Bool   elem ) { printf(" %d"   , ( elem ? 1 : 0 ));};
    662 #if NH_MV_SEI
    663669  Void xParseSeiCfg();
    664 #endif
    665 #endif
    666 #if NH_MV
     670
    667671  Int   getGOPSize() { return m_iGOPSize; }
    668672#endif
     
    674678  Void  create    ();                                         ///< create option handling class
    675679  Void  destroy   ();                                         ///< destroy option handling class
    676   Bool  parseCfg  ( Int argc, Char* argv[] );                 ///< parse configuration file to fill member variables
     680  Bool  parseCfg  ( Int argc, TChar* argv[] );                ///< parse configuration file to fill member variables
    677681
    678682};// END CLASS DEFINITION TAppEncCfg
  • TabularUnified trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r1356 r1386  
    147147#if NH_3D
    148148  xSetCamPara              ( vps );
     149#endif
     150#if NH_3D_VSO
    149151  m_ivPicLists.setVPS      ( &vps );
    150152#endif
     
    186188  for (Int d = 0; d < 2; d++)
    187189  { 
    188     m_sps3dExtension.setIvMvPredFlag          ( d, m_ivMvPredFlag[d]       );
    189     m_sps3dExtension.setIvMvScalingFlag       ( d, m_ivMvScalingFlag[d]    );
     190    m_sps3dExtension.setIvDiMcEnabledFlag          ( d, m_ivMvPredFlag[d]       );
     191    m_sps3dExtension.setIvMvScalEnabledFlag       ( d, m_ivMvScalingFlag[d]    );
    190192    if (d == 0 )
    191193    {   
    192       m_sps3dExtension.setLog2SubPbSizeMinus3   ( d, m_log2SubPbSizeMinus3   );
    193       m_sps3dExtension.setIvResPredFlag         ( d, m_ivResPredFlag         );
    194       m_sps3dExtension.setDepthRefinementFlag   ( d, m_depthRefinementFlag   );
    195       m_sps3dExtension.setViewSynthesisPredFlag ( d, m_viewSynthesisPredFlag );
    196       m_sps3dExtension.setDepthBasedBlkPartFlag ( d, m_depthBasedBlkPartFlag );
     194      m_sps3dExtension.setLog2IvmcSubPbSizeMinus3   ( d, m_log2SubPbSizeMinus3   );
     195      m_sps3dExtension.setIvResPredEnabledFlag         ( d, m_ivResPredFlag         );
     196      m_sps3dExtension.setDepthRefEnabledFlag   ( d, m_depthRefinementFlag   );
     197      m_sps3dExtension.setVspMcEnabledFlag ( d, m_viewSynthesisPredFlag );
     198      m_sps3dExtension.setDbbpEnabledFlag ( d, m_depthBasedBlkPartFlag );
    197199    }
    198200    else
    199201    {   
    200       m_sps3dExtension.setMpiFlag               ( d, m_mpiFlag               );
    201       m_sps3dExtension.setLog2MpiSubPbSizeMinus3( d, m_log2MpiSubPbSizeMinus3);
    202       m_sps3dExtension.setIntraContourFlag      ( d, m_intraContourFlag      );
    203       m_sps3dExtension.setIntraSdcWedgeFlag     ( d, m_intraSdcFlag || m_intraWedgeFlag     );
    204       m_sps3dExtension.setQtPredFlag            ( d, m_qtPredFlag            );
    205       m_sps3dExtension.setInterSdcFlag          ( d, m_interSdcFlag          );
    206       m_sps3dExtension.setDepthIntraSkipFlag    ( d, m_depthIntraSkipFlag    ); 
     202      m_sps3dExtension.setTexMcEnabledFlag               ( d, m_mpiFlag               );
     203      m_sps3dExtension.setLog2TexmcSubPbSizeMinus3( d, m_log2MpiSubPbSizeMinus3);
     204      m_sps3dExtension.setIntraContourEnabledFlag      ( d, m_intraContourFlag      );
     205      m_sps3dExtension.setIntraDcOnlyWedgeEnabledFlag     ( d, m_intraSdcFlag || m_intraWedgeFlag     );
     206      m_sps3dExtension.setCqtCuPartPredEnabledFlag            ( d, m_qtPredFlag            );
     207      m_sps3dExtension.setInterDcOnlyEnabledFlag          ( d, m_interSdcFlag          );
     208      m_sps3dExtension.setSkipIntraEnabledFlag    ( d, m_depthIntraSkipFlag    ); 
    207209    }
    208210  }
     
    276278    m_cTEncTop.setViewId                       ( vps.getViewId      (  layerId ) );
    277279    m_cTEncTop.setViewIndex                    ( vps.getViewIndex   (  layerId ) );
    278 #if NH_3D
    279     Bool isDepth = ( vps.getDepthId     ( layerId ) != 0 ) ;
    280     m_cTEncTop.setIsDepth                      ( isDepth );
     280#if NH_3D_VSO
     281    Bool isDepth    = ( vps.getDepthId     ( layerId ) != 0  ) ;
     282    Bool isAuxDepth = ( vps.getAuxId       ( layerId ) ==  2 ) ; // TBD: define 2 as AUX_DEPTH
     283    m_cTEncTop.setIsDepth                  ( isDepth    );
     284    m_cTEncTop.setIsAuxDepth               ( isAuxDepth );
    281285    //====== Camera Parameters =========
    282286    m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
    283 #if NH_3D_VSO
    284287    //====== VSO =========
    285288    m_cTEncTop.setRenderModelParameters        ( &m_cRenModStrParser );
    286     m_cTEncTop.setForceLambdaScaleVSO          ( isDepth ? m_bForceLambdaScaleVSO : false );
    287     m_cTEncTop.setLambdaScaleVSO               ( isDepth ? m_dLambdaScaleVSO      : 1     );
    288     m_cTEncTop.setVSOMode                      ( isDepth ? m_uiVSOMode            : 0     );
    289 
    290     m_cTEncTop.setAllowNegDist                 ( isDepth ? m_bAllowNegDist        : false );
     289    m_cTEncTop.setForceLambdaScaleVSO          ( isDepth || isAuxDepth ? m_bForceLambdaScaleVSO : false );
     290    m_cTEncTop.setLambdaScaleVSO               ( isDepth || isAuxDepth ? m_dLambdaScaleVSO      : 1     );
     291    m_cTEncTop.setVSOMode                      ( isDepth || isAuxDepth ? m_uiVSOMode            : 0     );
     292
     293    m_cTEncTop.setAllowNegDist                 ( isDepth || isAuxDepth ? m_bAllowNegDist        : false );
    291294
    292295    // SAIT_VSO_EST_A0033
    293     m_cTEncTop.setUseEstimatedVSD              ( isDepth ? m_bUseEstimatedVSD     : false );
     296    m_cTEncTop.setUseEstimatedVSD              ( isDepth || isAuxDepth ? m_bUseEstimatedVSD     : false );
    294297
    295298    // LGE_WVSO_A0119
    296     m_cTEncTop.setUseWVSO                      ( isDepth ? m_bUseWVSO             : false );   
    297     m_cTEncTop.setVSOWeight                    ( isDepth ? m_iVSOWeight           : 0     );
    298     m_cTEncTop.setVSDWeight                    ( isDepth ? m_iVSDWeight           : 0     );
    299     m_cTEncTop.setDWeight                      ( isDepth ? m_iDWeight             : 0     );
     299    m_cTEncTop.setUseWVSO                      ( isDepth || isAuxDepth ? m_bUseWVSO             : false );   
     300    m_cTEncTop.setVSOWeight                    ( isDepth || isAuxDepth ? m_iVSOWeight           : 0     );
     301    m_cTEncTop.setVSDWeight                    ( isDepth || isAuxDepth ? m_iVSDWeight           : 0     );
     302    m_cTEncTop.setDWeight                      ( isDepth || isAuxDepth ? m_iDWeight             : 0     );
    300303#endif // H_3D_VSO
     304#if NH_3D
    301305#if NH_3D_IC
    302306    m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );
     
    308312    m_cTEncTop.setUseSDC                       ( isDepth ? m_intraSdcFlag     : false );
    309313    m_cTEncTop.setUseDLT                       ( isDepth ? m_useDLT   : false );
    310     m_cTEncTop.setUseQTL                       ( isDepth ? m_bUseQTL  : false );
     314#endif
     315#if NH_3D_QTL
     316    m_cTEncTop.setUseQTL                       ( isDepth || isAuxDepth ? m_bUseQTL  : false );
     317#endif
     318#if NH_3D
    311319    m_cTEncTop.setSps3dExtension               ( m_sps3dExtension );
    312320#endif // NH_3D
     
    378386    m_cTEncTop.setLambdaModifier                                  ( uiLoop, m_adLambdaModifier[ uiLoop ] );
    379387  }
     388  m_cTEncTop.setIntraLambdaModifier                               ( m_adIntraLambdaModifier );
     389  m_cTEncTop.setIntraQpFactor                                     ( m_dIntraQpFactor );
     390
    380391#if NH_MV
    381392  m_cTEncTop.setQP                                                ( m_iQP[layerIdInVps] );
     
    385396
    386397  m_cTEncTop.setPad                                               ( m_aiPad );
    387 
     398  m_cTEncTop.setAccessUnitDelimiter                               ( m_AccessUnitDelimiter );
    388399#if NH_MV
    389400  m_cTEncTop.setMaxTempLayer                                      ( m_maxTempLayerMvc[layerIdInVps] );
     
    408419  //====== Motion search ========
    409420  m_cTEncTop.setDisableIntraPUsInInterSlices                      ( m_bDisableIntraPUsInInterSlices );
    410   m_cTEncTop.setFastSearch                                        ( m_iFastSearch  );
     421  m_cTEncTop.setMotionEstimationSearchMethod                      ( m_motionEstimationSearchMethod  );
    411422  m_cTEncTop.setSearchRange                                       ( m_iSearchRange );
    412423  m_cTEncTop.setBipredSearchRange                                 ( m_bipredSearchRange );
    413424  m_cTEncTop.setClipForBiPredMeEnabled                            ( m_bClipForBiPredMeEnabled );
    414425  m_cTEncTop.setFastMEAssumingSmootherMVEnabled                   ( m_bFastMEAssumingSmootherMVEnabled );
     426  m_cTEncTop.setMinSearchWindow                                   ( m_minSearchWindow );
     427  m_cTEncTop.setRestrictMESampling                                ( m_bRestrictMESampling );
    415428
    416429#if NH_MV
     
    439452  m_cTEncTop.setExtendedPrecisionProcessingFlag                   ( m_extendedPrecisionProcessingFlag );
    440453  m_cTEncTop.setHighPrecisionOffsetsEnabledFlag                   ( m_highPrecisionOffsetsEnabledFlag );
     454
     455  m_cTEncTop.setWeightedPredictionMethod( m_weightedPredictionMethod );
     456
    441457  //====== Tool list ========
    442458  m_cTEncTop.setDeltaQpRD                                         ( m_uiDeltaQpRD  );
     
    463479  m_cTEncTop.setQuadtreeTUMaxDepthInter                           ( m_uiQuadtreeTUMaxDepthInter );
    464480  m_cTEncTop.setQuadtreeTUMaxDepthIntra                           ( m_uiQuadtreeTUMaxDepthIntra );
    465   m_cTEncTop.setUseFastEnc                                        ( m_bUseFastEnc );
     481  m_cTEncTop.setFastInterSearchMode                               ( m_fastInterSearchMode );
    466482  m_cTEncTop.setUseEarlyCU                                        ( m_bUseEarlyCU  );
    467483  m_cTEncTop.setUseFastDecisionForMerge                           ( m_useFastDecisionForMerge  );
     
    513529
    514530  //====== Slice ========
    515   m_cTEncTop.setSliceMode                                         ( (SliceConstraint) m_sliceMode );
     531  m_cTEncTop.setSliceMode                                         ( m_sliceMode );
    516532  m_cTEncTop.setSliceArgument                                     ( m_sliceArgument            );
    517533
    518534  //====== Dependent Slice ========
    519   m_cTEncTop.setSliceSegmentMode                                  (  (SliceConstraint) m_sliceSegmentMode );
     535  m_cTEncTop.setSliceSegmentMode                                  ( m_sliceSegmentMode );
    520536  m_cTEncTop.setSliceSegmentArgument                              ( m_sliceSegmentArgument     );
    521537
     
    540556
    541557  m_cTEncTop.setIntraSmoothingDisabledFlag                        (!m_enableIntraReferenceSmoothing );
    542   m_cTEncTop.setDecodedPictureHashSEIEnabled                      ( m_decodedPictureHashSEIEnabled );
     558  m_cTEncTop.setDecodedPictureHashSEIType                         ( m_decodedPictureHashSEIType );
    543559  m_cTEncTop.setRecoveryPointSEIEnabled                           ( m_recoveryPointSEIEnabled );
    544560  m_cTEncTop.setBufferingPeriodSEIEnabled                         ( m_bufferingPeriodSEIEnabled );
     
    571587  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue              ( m_nominalWhiteLevelLumaCodeValue );
    572588  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue             ( m_extendedWhiteLevelLumaCodeValue );
    573   m_cTEncTop.setChromaSamplingFilterHintEnabled                   ( m_chromaSamplingFilterSEIenabled );
    574   m_cTEncTop.setChromaSamplingHorFilterIdc                        ( m_chromaSamplingHorFilterIdc );
    575   m_cTEncTop.setChromaSamplingVerFilterIdc                        ( m_chromaSamplingVerFilterIdc );
     589  m_cTEncTop.setChromaResamplingFilterHintEnabled                 ( m_chromaResamplingFilterSEIenabled );
     590  m_cTEncTop.setChromaResamplingHorFilterIdc                      ( m_chromaResamplingHorFilterIdc );
     591  m_cTEncTop.setChromaResamplingVerFilterIdc                      ( m_chromaResamplingVerFilterIdc );
    576592  m_cTEncTop.setFramePackingArrangementSEIEnabled                 ( m_framePackingSEIEnabled );
    577593  m_cTEncTop.setFramePackingArrangementSEIType                    ( m_framePackingSEIType );
     
    590606  m_cTEncTop.setSOPDescriptionSEIEnabled                          ( m_SOPDescriptionSEIEnabled );
    591607  m_cTEncTop.setScalableNestingSEIEnabled                         ( m_scalableNestingSEIEnabled );
    592 #if NH_MV
    593 #if !NH_MV_SEI
    594   m_cTEncTop.setSubBitstreamPropSEIEnabled                        ( m_subBistreamPropSEIEnabled );
    595   if( m_subBistreamPropSEIEnabled )                               
    596   {                                                               
    597     m_cTEncTop.setNumAdditionalSubStreams                         ( m_sbPropNumAdditionalSubStreams );
    598     m_cTEncTop.setSubBitstreamMode                                ( m_sbPropSubBitstreamMode );
    599     m_cTEncTop.setOutputLayerSetIdxToVps                          ( m_sbPropOutputLayerSetIdxToVps );
    600     m_cTEncTop.setHighestSublayerId                               ( m_sbPropHighestSublayerId );
    601     m_cTEncTop.setAvgBitRate                                      ( m_sbPropAvgBitRate );
    602     m_cTEncTop.setMaxBitRate                                      ( m_sbPropMaxBitRate );
    603   }
    604 #endif
    605 #endif
    606 
    607608  m_cTEncTop.setTMCTSSEIEnabled                                   ( m_tmctsSEIEnabled );
    608609  m_cTEncTop.setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
     
    623624  m_cTEncTop.setKneeSEIInputKneePoint                             ( m_kneeSEIInputKneePoint );
    624625  m_cTEncTop.setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
     626  m_cTEncTop.setColourRemapInfoSEIFileRoot                        ( m_colourRemapSEIFileRoot );
    625627  m_cTEncTop.setMasteringDisplaySEI                               ( m_masteringDisplay );
    626628
    627 #if NH_MV_SEI
     629#if NH_MV
    628630  m_cTEncTop.setSeiMessages                                       ( &m_seiMessages );
    629631#endif
     
    644646  }
    645647  m_cTEncTop.setLFCrossTileBoundaryFlag                           ( m_bLFCrossTileBoundaryFlag );
    646   m_cTEncTop.setWaveFrontSynchro                                  ( m_iWaveFrontSynchro );
     648  m_cTEncTop.setEntropyCodingSyncEnabledFlag                      ( m_entropyCodingSyncEnabledFlag );
    647649  m_cTEncTop.setTMVPModeId                                        ( m_TMVPModeId );
    648650  m_cTEncTop.setUseScalingListId                                  ( m_useScalingListId  );
    649   m_cTEncTop.setScalingListFile                                   ( m_scalingListFile  );
     651  m_cTEncTop.setScalingListFileName                               ( m_scalingListFileName );
    650652  m_cTEncTop.setSignHideFlag                                      ( m_signHideFlag);
    651653#if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227
     
    669671  m_cTEncTop.setInitialQP                                         ( m_RCInitialQP );
    670672  m_cTEncTop.setForceIntraQP                                      ( m_RCForceIntraQP );
     673#if U0132_TARGET_BITS_SATURATION
     674  m_cTEncTop.setCpbSaturationEnabled                              ( m_RCCpbSaturationEnabled );
     675  m_cTEncTop.setCpbSize                                           ( m_RCCpbSize );
     676  m_cTEncTop.setInitialCpbFullness                                ( m_RCInitialCpbFullness );
     677#endif
     678
    671679#if KWU_RC_MADPRED_E0227
    672680  if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
     
    796804        TEncTop* pcEncTop =  m_acTEncTopList[ layer ];
    797805        Int iViewNum      = pcEncTop->getViewIndex();
    798         Int iContent      = pcEncTop->getIsDepth() ? 1 : 0;
     806        Int iContent      = pcEncTop->getIsDepth() || pcEncTop->getIsAuxDepth() ? 1 : 0;
    799807        Int iNumOfModels  = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);
    800808
     
    843851#else
    844852  // Video I/O
    845   m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
     853  m_cTVideoIOYuvInputFile.open( m_inputFileName,     false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
    846854  m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC);
    847855
    848   if (m_pchReconFile)
    849   {
    850     m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth);  // write mode
     856  if (!m_reconFileName.empty())
     857  {
     858    m_cTVideoIOYuvReconFile.open(m_reconFileName, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth);  // write mode
    851859  }
    852860
     
    917925Void TAppEncTop::encode()
    918926{
    919   fstream bitstreamFile(m_pchBitstreamFile, fstream::binary | fstream::out);
     927  fstream bitstreamFile(m_bitstreamFileName.c_str(), fstream::binary | fstream::out);
    920928  if (!bitstreamFile)
    921929  {
    922     fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pchBitstreamFile);
     930    fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_bitstreamFileName.c_str());
    923931    exit(EXIT_FAILURE);
    924932  }
     
    10281036    for ( Int gopId=0; gopId < gopSize; gopId++ )
    10291037    {
    1030 #if NH_3D
     1038#if NH_3D_VSO
    10311039      UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
    10321040      if ( iNextPoc < m_framesToBeEncoded )
     
    11501158  printRateSummary();
    11511159
    1152 #if H_3D_REN_MAX_DEV_OUT
     1160#if NH_3D_REN_MAX_DEV_OUT
    11531161  Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();
    11541162
     
    12951303  }
    12961304#else
    1297       if (m_pchReconFile)
     1305      if (!m_reconFileName.empty())
    12981306      {
    12991307        m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
     
    13521360  }
    13531361#else
    1354       if (m_pchReconFile)
     1362      if (!m_reconFileName.empty())
    13551363      {
    13561364        m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom,
     
    16701678          if( m_depthFlag[ curLayerIdInVps ] && ( m_mpiFlag|| m_qtPredFlag || m_intraContourFlag ) )
    16711679          {         
    1672             Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false );
     1680            Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false, 0 );
    16731681            if ( nuhLayerIdTex == refLayerIdInNuh )
    16741682            {
     
    16961704                for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++ )
    16971705                {
    1698                   Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[j] ) ), true );
     1706                  Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[j] ) ), true, 0 );
    16991707                  if ( nuhLayerIdDep == refLayerIdInNuh )
    17001708                  {
     
    20632071      vps.setLayerIdIncludedFlag( false, lsIdx, layerId );
    20642072    }
    2065     for ( Int i = 0; i < m_layerIdsInSets[lsIdx].size(); i++)
     2073    for ( Int i = 0; i < m_layerIdxInVpsInSets[lsIdx].size(); i++)
    20662074    {       
    2067       vps.setLayerIdIncludedFlag( true, lsIdx, vps.getLayerIdInNuh( m_layerIdsInSets[lsIdx][i] ) );
     2075      vps.setLayerIdIncludedFlag( true, lsIdx, vps.getLayerIdInNuh( m_layerIdxInVpsInSets[lsIdx][i] ) );
    20682076    }
    20692077  }
  • TabularUnified trunk/source/App/TAppEncoder/TAppEncTop.h

    r1313 r1386  
    4646#include "TLibCommon/AccessUnit.h"
    4747#include "TAppEncCfg.h"
    48 #if NH_3D
     48#if NH_3D_VSO
    4949#include "../../Lib/TLibRenderer/TRenTop.h"
    5050#endif
  • TabularUnified trunk/source/App/TAppExtractor/TAppExtrCfg.cpp

    r1179 r1386  
    5858    \param argv array of arguments
    5959 */
    60 Bool TAppExtrCfg::parseCfg( Int argc, Char* argv[] )
     60Bool TAppExtrCfg::parseCfg( Int argc, TChar* argv[] )
    6161{
    6262  bool do_help = false;
  • TabularUnified trunk/source/App/TAppExtractor/TAppExtrCfg.h

    r1179 r1386  
    6565  virtual ~TAppExtrCfg() {}
    6666 
    67   Bool  parseCfg        ( Int argc, Char* argv[] );    ///< initialize option class from configuration
     67  Bool  parseCfg        ( Int argc, TChar* argv[] );    ///< initialize option class from configuration
    6868
    6969protected:
  • TabularUnified trunk/source/App/TAppRenderer/RendererMain.cpp

    r1313 r1386  
    3535#include <time.h>
    3636#include "../../Lib/TLibCommon/CommonDef.h"
    37 #if NH_3D
     37#if NH_3D_VSO
    3838#include "TAppRendererTop.h"
    3939// ====================================================================================================================
  • TabularUnified trunk/source/App/TAppRenderer/TAppRendererCfg.cpp

    r1313 r1386  
    4444#include "../../Lib/TAppCommon/program_options_lite.h"
    4545
    46 #if NH_3D
     46#if NH_3D_VSO
    4747
    4848using namespace std;
     
    111111\retval             true when success
    112112*/
    113 Bool TAppRendererCfg::parseCfg( Int argc, Char* argv[] )
     113Bool TAppRendererCfg::parseCfg( Int argc, TChar* argv[] )
    114114{
    115115  bool do_help = false;
     
    121121
    122122    /* File I/O */
    123     ("VideoInputFileBaseName,v",  m_pchVideoInputFileBaseName,  (Char*) 0, "Basename to generate video input file names")
    124     ("DepthInputFileBaseName,d",  m_pchDepthInputFileBaseName,  (Char*) 0, "Basename to generate depth input file names")
    125     ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (Char*) 0, "Basename to generate synthesized output file names")
     123    ("VideoInputFileBaseName,v",  m_pchVideoInputFileBaseName,  (TChar*) 0, "Basename to generate video input file names")
     124    ("DepthInputFileBaseName,d",  m_pchDepthInputFileBaseName,  (TChar*) 0, "Basename to generate depth input file names")
     125    ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (TChar*) 0, "Basename to generate synthesized output file names")
    126126    ("ContOutputFileNumbering", m_bContOutputFileNumbering  ,  false   , "Continuous Output File Numbering")
    127127    ("Sweep"                  , m_bSweep                    ,  false   , "Store all views in first Output File")
    128128
    129     ("VideoInputFile_%d,v_%d",  m_pchVideoInputFileList ,    (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")
    130     ("DepthInputFile_%d,d_%d",  m_pchDepthInputFileList ,    (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")
    131     ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList,    (Char *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")
     129    ("VideoInputFile_%d,v_%d",  m_pchVideoInputFileList ,    (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")
     130    ("DepthInputFile_%d,d_%d",  m_pchDepthInputFileList ,    (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")
     131    ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList,    (TChar *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")
    132132
    133133    ("InputBitDepth",           m_inputBitDepth[0],                     8, "Bit-depth of input file")
     
    146146
    147147    /* Camera Specification */
    148     ("CameraParameterFile,-cpf", m_pchCameraParameterFile,          (Char *) 0, "Camera Parameter File Name")
    149     ("BaseViewCameraNumbers"  , m_pchBaseViewCameraNumbers,        (Char *) 0, "Numbers of base views")
    150     ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers,       (Char *) 0, "Numbers of views to synthesis")
    151     ("ViewConfig"             , m_pchViewConfig,                   (Char *) 0, "View Configuration"               )
     148    ("CameraParameterFile,-cpf", m_pchCameraParameterFile,         (TChar *) 0, "Camera Parameter File Name")
     149    ("BaseViewCameraNumbers"  , m_pchBaseViewCameraNumbers,        (TChar *) 0, "Numbers of base views")
     150    ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers,       (TChar *) 0, "Numbers of views to synthesis")
     151    ("ViewConfig"             , m_pchViewConfig,                   (TChar *) 0, "View Configuration"               )
    152152
    153153    /* Renderer Modes */
     
    458458}
    459459
    460 Void TAppRendererCfg::xAddNumberToFileName( Char* pchSourceFileName, Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter )
     460Void TAppRendererCfg::xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter )
    461461{
    462462
     
    468468  }
    469469
    470   Char pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];
    471   Char pchPrintBuffer[10];
     470  TChar pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];
     471  TChar pchPrintBuffer[10];
    472472
    473473  Double dNumberToAdd = ( (Double) iNumberToAdd ) / VIEW_NUM_PREC;
     
    488488  size_t iAddLength = strlen(pchNumberBuffer);
    489489
    490   rpchTargetFileName = (Char*) malloc(iInLength+iAddLength+1);
    491 
    492   Char* pchPlaceHolder = strrchr(pchSourceFileName,'$');
     490  rpchTargetFileName = (TChar*) malloc(iInLength+iAddLength+1);
     491
     492  TChar* pchPlaceHolder = strrchr(pchSourceFileName,'$');
    493493  assert( pchPlaceHolder );
    494494
  • TabularUnified trunk/source/App/TAppRenderer/TAppRendererCfg.h

    r1313 r1386  
    4747#include <vector>
    4848
    49 #if NH_3D
     49#if NH_3D_VSO
    5050
    5151// ====================================================================================================================
     
    5959
    6060  //// file I/O ////
    61   Char*              m_pchVideoInputFileBaseName;      ///< input video  file base name, placeholder for numbering $$
    62   Char*              m_pchDepthInputFileBaseName;      ///< input depth  file base name, placeholder for numbering $$
    63   Char*              m_pchSynthOutputFileBaseName;     ///< output synth file base name, placeholder for numbering $$
     61  TChar*             m_pchVideoInputFileBaseName;      ///< input video  file base name, placeholder for numbering $$
     62  TChar*             m_pchDepthInputFileBaseName;      ///< input depth  file base name, placeholder for numbering $$
     63  TChar*             m_pchSynthOutputFileBaseName;     ///< output synth file base name, placeholder for numbering $$
    6464  Bool               m_bContOutputFileNumbering;       ///< use continous numbering instead of view numbering
    6565  Bool               m_bSweep;                         ///< 1: Store view range in file
     
    7373
    7474  // derived
    75   std::vector<Char*> m_pchVideoInputFileList;          ///< source file names
    76   std::vector<Char*> m_pchDepthInputFileList;          ///< source depth file names
    77   std::vector<Char*> m_pchSynthOutputFileList;         ///< output reconstruction file names
     75  std::vector<TChar*> m_pchVideoInputFileList;         ///< source file names
     76  std::vector<TChar*> m_pchDepthInputFileList;         ///< source depth file names
     77  std::vector<TChar*> m_pchSynthOutputFileList;        ///< output reconstruction file names
    7878
    7979  //// source specification ////
     
    8484
    8585  ////camera specification ////
    86   Char*               m_pchCameraParameterFile;         ///< camera parameter file
    87   Char*               m_pchSynthViewCameraNumbers;      ///< numbers of views to synthesize
    88   Char*               m_pchViewConfig;                  ///< String to setup renderer
    89   Char*               m_pchBaseViewCameraNumbers;       ///< numbers of base views
     86  TChar*             m_pchCameraParameterFile;         ///< camera parameter file
     87  TChar*             m_pchSynthViewCameraNumbers;      ///< numbers of views to synthesize
     88  TChar*             m_pchViewConfig;                  ///< String to setup renderer
     89  TChar*             m_pchBaseViewCameraNumbers;       ///< numbers of base views
    9090
    9191  // derived
     
    123123  Void xCreateFileNames();
    124124  Void xGetMaxPrecision( IntAry1d adIn, Int& iPrecBefore, Int& iPrecAfter );
    125   Void xAddNumberToFileName( Char* pchSourceFileName, Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter );
     125  Void xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter );
    126126public:
    127127  TAppRendererCfg();
     
    131131  Void  create    ();                                         ///< create option handling class
    132132  Void  destroy   ();                                         ///< destroy option handling class
    133   Bool  parseCfg  ( Int argc, Char* argv[] );                 ///< parse configuration file to fill member variables
    134   Bool  xConfirmParameter(Bool bflag, const Char* message);
     133  Bool  parseCfg  ( Int argc, TChar* argv[] );                 ///< parse configuration file to fill member variables
     134  Bool  xConfirmParameter(Bool bflag, const TChar* message);
    135135
    136136
  • TabularUnified trunk/source/App/TAppRenderer/TAppRendererTop.cpp

    r1313 r1386  
    4141#include "TAppRendererTop.h"
    4242
    43 #if NH_3D
     43#if NH_3D_VSO
    4444
    4545// ====================================================================================================================
     
    488488  }
    489489
    490 #if H_3D_REN_MAX_DEV_OUT
     490#if NH_3D_REN_MAX_DEV_OUT
    491491  Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();
    492492
  • TabularUnified trunk/source/App/TAppRenderer/TAppRendererTop.h

    r1313 r1386  
    4040#define __TAppRendererTOP__
    4141#include "../../Lib/TLibCommon/CommonDef.h"
    42 #if NH_3D
     42#if NH_3D_VSO
    4343#include "../../Lib/TLibRenderer/TRenTop.h"
    4444#include "../../Lib/TLibVideoIO/TVideoIOYuv.h"
  • TabularUnified trunk/source/App/utils/convert_NtoMbit_YCbCr.cpp

    r1313 r1386  
    105105
    106106  TComPicYuv frame;
    107   frame.create( width, height, chromaFormatIDC, width, height, 0, false);
     107  frame.createWithoutCUInfo( width, height, chromaFormatIDC);
    108108
    109109  Int pad[2] = {0, 0};
    110110
    111111  TComPicYuv cPicYuvTrueOrg;
    112   cPicYuvTrueOrg.create( width, height, chromaFormatIDC, width, height, 0, false );
     112  cPicYuvTrueOrg.createWithoutCUInfo( width, height, chromaFormatIDC );
    113113
    114114  UInt num_frames_processed = 0;
  • TabularUnified trunk/source/Lib/TAppCommon/TAppComCamPara.cpp

    r1313 r1386  
    4949#include <functional>
    5050#include <string>
    51 #if NH_3D
     51#if NH_3D_VSO
    5252
    5353
     
    115115
    116116Void
    117 TAppComCamPara::convertNumberString( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec )
     117TAppComCamPara::convertNumberString( TChar* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec )
    118118{
    119119  Bool bStringIsRange = false;
     
    131131  }
    132132
    133   Char* pcNextStart = pchViewNumberString;
    134   Char* pcEnd       = pcNextStart + iIdx;
    135   Char* pcOldStart  = 0;
     133  TChar* pcNextStart = pchViewNumberString;
     134  TChar* pcEnd       = pcNextStart + iIdx;
     135  TChar* pcOldStart  = 0;
    136136
    137137  while( pcNextStart < pcEnd )
     
    192192
    193193Void
    194 TAppComCamPara::xReadCameraParameterFile( Char* pchCfgFileName )
    195 {
     194TAppComCamPara::xReadCameraParameterFile( TChar* pchCfgFileName )
     195{
     196  assert( pchCfgFileName != NULL );
     197
    196198  std::ifstream cCfgStream( pchCfgFileName, std::ifstream::in );
    197199  if( !cCfgStream )
     
    220222    }
    221223
    222     Char* pcNextStart = (Char*) cLine.data();
    223     Char* pcEnd = pcNextStart + cLine.length();
     224    TChar* pcNextStart = (TChar*) cLine.data();
     225    TChar* pcEnd = pcNextStart + cLine.length();
    224226
    225227    std::vector<Double> caNewLine;
    226228    caNewLine.clear();
    227229
    228     Char* pcOldStart = 0;
     230    TChar* pcOldStart = 0;
    229231    while( pcNextStart < pcEnd )
    230232    {
     
    880882
    881883        // maximum deviation
    882 #if H_3D_REN_MAX_DEV_OUT
     884#if NH_3D_REN_MAX_DEV_OUT
    883885        m_dMaxShiftDeviation = std::max( m_dMaxShiftDeviation, fabs( Double( (Int) iShiftLuma   ) - dShiftLuma   ) / Double( 1 << m_iLog2Precision ) );       
    884886#endif
     
    981983  m_bCamParsCodedPrecSet      = false;
    982984
    983 #if H_3D_REN_MAX_DEV_OUT
     985#if NH_3D_REN_MAX_DEV_OUT
    984986  m_dMaxShiftDeviation        = -1;
    985987#endif
     
    10941096}
    10951097
    1096 Void TAppComCamPara::xSetupBaseViews( Char* pchBaseViewNumbers, UInt uiNumBaseViews )
     1098Void TAppComCamPara::xSetupBaseViews( TChar* pchBaseViewNumbers, UInt uiNumBaseViews )
    10971099  {
    10981100    // init list
     
    11421144                      UInt   uiStartFrameId,
    11431145                      UInt   uiNumFrames,
    1144                       Char* pchCfgFileName,
    1145                       Char* pchBaseViewNumbers,
    1146                       Char* pchSynthViewNumbers,
     1146                      TChar* pchCfgFileName,
     1147                      TChar* pchBaseViewNumbers,
     1148                      TChar* pchSynthViewNumbers,
    11471149                      std::vector<Int>* paiSynthViewNumbers,
    11481150                      Int    iLog2Precision )
  • TabularUnified trunk/source/Lib/TAppCommon/TAppComCamPara.h

    r1313 r1386  
    6767  Bool                m_bCamParsCodedPrecSet;                 ///< Coded Cam Para precision set for current frame;
    6868 
    69 #if H_3D_REN_MAX_DEV_OUT
     69#if NH_3D_REN_MAX_DEV_OUT
    7070  Double              m_dMaxShiftDeviation;                   ///< Maximum deviation of shifts with integer precision compare to double precision
    7171#endif
     
    113113
    114114  // functions for reading, initialization, sorting, getting data, etc.
    115   Void  xReadCameraParameterFile  ( Char* pchCfgFileName );
     115  Void  xReadCameraParameterFile  ( TChar* pchCfgFileName );
    116116  Bool  xGetCameraDataRow         ( Int iView, UInt uiFrame, UInt& ruiFoundLine );
    117117
     
    129129#endif
    130130  Void  xSetupBaseViewsFromCoded  ();
    131   Void  xSetupBaseViews           ( Char* pchBaseViewNumbers, UInt uiNumBaseViews );
     131  Void  xSetupBaseViews           ( TChar* pchBaseViewNumbers, UInt uiNumBaseViews );
    132132  Bool  xIsIn                     ( std::vector<Int>& rVec, Int iNumber);
    133133
     
    156156                UInt    uiStartFrameId,
    157157                UInt    uiNumFrames,
    158                 Char*   pchCfgFileName,
    159                 Char*   pchBaseViewNumbers,
    160                 Char*   pchSynthViewNumbers,
     158                TChar*   pchCfgFileName,
     159                TChar*   pchBaseViewNumbers,
     160                TChar*   pchSynthViewNumbers,
    161161                std::vector<Int>* paiSynthViewNumbers,
    162162                Int     iLog2Precision );
     
    165165                UInt    uiStartFrameId,
    166166                UInt    uiNumFrames,
    167                 Char*   pchCfgFileName,
    168                 Char*   pchSynthViewNumbers,
     167                TChar*   pchCfgFileName,
     168                TChar*   pchSynthViewNumbers,
    169169                std::vector<Int>* paiSynthViewNumbers,
    170170                Int     iLog2Precision
     
    183183  Int                 getRelDistLeft            ( Int iSynthViewIdx, Int   iLeftViewIdx, Int iRightViewIdx );
    184184  UInt                getCurFrameId             ()  { return m_iCurrentFrameId;   }
    185   static Void         convertNumberString       ( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec );
    186 #if H_3D_REN_MAX_DEV_OUT
     185  static Void         convertNumberString       ( TChar* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec );
     186#if NH_3D_REN_MAX_DEV_OUT
    187187  Double              getMaxShiftDeviation      () { return m_dMaxShiftDeviation; };
    188188#endif
  • TabularUnified trunk/source/Lib/TAppCommon/program_options_lite.cpp

    r1356 r1386  
    111111    }
    112112
    113 #if NH_MV_SEI
     113#if NH_MV
    114114    static void setOptions(Options::NamesPtrList& opt_list, const std::vector<int> idcs, const string& value, ErrorReporter& error_reporter)
    115115#else
     
    121121      for (Options::NamesPtrList::iterator it = opt_list.begin(); it != opt_list.end(); ++it)
    122122      {
    123         #if NH_MV_SEI
     123#if NH_MV
    124124          Bool doParsing = (*it)->opt->checkDim( idcs, error_reporter );
    125125          if ( doParsing )
     
    127127            (*it)->opt->parse(value, idcs, error_reporter);
    128128          }
    129          
    130         #else
     129#else
    131130        (*it)->opt->parse(value, error_reporter);
    132         #endif
     131#endif
    133132      }
    134133    }
     
    290289    bool OptionWriter::storePair(bool allow_long, bool allow_short, const string& name, const string& value)
    291290    {
    292 #if NH_MV_SEI
     291#if NH_MV
    293292      std::vector<int> idcs;             
    294293     
     
    324323          found = true;
    325324        }
    326 #if NH_MV_SEI
     325#if NH_MV
    327326        if ( idcs.size() > 0 )
    328327        {
     
    347346          found = true;
    348347        }
    349 #if NH_MV_SEI
     348#if NH_MV
    350349        if ( idcs.size() > 0 )
    351350        {
     
    362361      }
    363362
    364 #if NH_MV_SEI
     363#if NH_MV
    365364    if ( !found_idcs )
    366365    {
     
    370369      if (!found)
    371370      {
    372 #if NH_MV_SEI
     371#if NH_MV
    373372        if (error_reporter.output_on_unknow_parameter )
    374373        {       
     
    377376        error_reporter.error(where())
    378377          << "Unknown option `" << name << "' (value:`" << value << "')\n";
    379 #if NH_MV_SEI
     378#if NH_MV
    380379        }
    381380#endif
     
    383382      }
    384383
    385 #if NH_MV_SEI
     384#if NH_MV
    386385      setOptions((*opt_it).second, idcs, value, error_reporter);
    387386#else
  • TabularUnified trunk/source/Lib/TAppCommon/program_options_lite.h

    r1356 r1386  
    3737#include <map>
    3838#include  "../TLibCommon/CommonDef.h"
    39 
    4039#if NH_MV
    4140#include <vector>
     
    7877    struct ErrorReporter
    7978    {
    80 #if NH_MV_SEI
     79#if NH_MV
    8180      ErrorReporter() : is_errored(0), output_on_unknow_parameter(true)  {}
    8281#else
     
    8786      virtual std::ostream& warn(const std::string& where);
    8887      bool is_errored;
    89 #if NH_MV_SEI
     88#if NH_MV
    9089      bool output_on_unknow_parameter;
    9190#endif
     
    105104    {
    106105#if NH_MV     
    107 #if NH_MV_SEI     
    108106      OptionBase(const std::string& name, const std::string& desc, bool duplicate = false, std::vector< int > maxdim = std::vector< int >(0) )
    109107        : opt_string(name), opt_desc(desc), opt_duplicate(duplicate), max_dim( maxdim )
    110108#else
    111       OptionBase(const std::string& name, const std::string& desc, bool duplicate = false)
    112         : opt_string(name), opt_desc(desc), opt_duplicate(duplicate)
    113 #endif
    114 #else
    115109      OptionBase(const std::string& name, const std::string& desc)
    116110      : opt_string(name), opt_desc(desc)
     
    121115
    122116      /* parse argument arg, to obtain a value for the option */
    123 #if NH_MV_SEI
     117#if NH_MV
    124118      virtual void parse(const std::string& arg, const std::vector<int>& idcs,  ErrorReporter&) = 0;
    125119     
     
    221215#if NH_MV
    222216      bool        opt_duplicate;
    223 #if NH_MV_SEI
    224217      std::vector<int> max_dim;
    225 #endif
    226218#endif
    227219    };
     
    232224    {
    233225#if NH_MV
    234 #if NH_MV_SEI
    235226      Option(const std::string& name, T& storage, T default_val, const std::string& desc, bool duplicate = false, std::vector< int > maxdim = std::vector< int >(0) )
    236227        : OptionBase(name, desc, duplicate, maxdim), opt_storage(storage), opt_default_val(default_val)
    237228#else
    238       Option(const std::string& name, T& storage, T default_val, const std::string& desc, bool duplicate = false)
    239         : OptionBase(name, desc, duplicate), opt_storage(storage), opt_default_val(default_val)
    240 #endif
    241 #else
    242229      Option(const std::string& name, T& storage, T default_val, const std::string& desc)
    243230      : OptionBase(name, desc), opt_storage(storage), opt_default_val(default_val)
     
    245232      {}
    246233
    247 #if NH_MV_SEI
     234#if NH_MV
    248235      void parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter&);
    249236#else
     
    263250    template<typename T>
    264251    inline void
    265 #if NH_MV_SEI
     252#if NH_MV
    266253    Option<T>::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter&)
    267254#else
     
    269256#endif
    270257    {
    271 #if NH_MV_SEI
     258#if NH_MV
    272259      assert( idcs.size() == 0 );
    273260#endif
     
    289276    template<>
    290277    inline void
    291 #if NH_MV_SEI
     278#if NH_MV
    292279    Option<std::string>::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter&)
    293 #else
    294     Option<std::string>::parse(const std::string& arg, ErrorReporter&)
    295 #endif
    296     {
    297 #if NH_MV_SEI
     280    {
    298281      assert( idcs.size() == 0 );
    299 #endif
    300282      opt_storage = arg;
    301283    }
     284#else
     285    Option<std::string>::parse(const std::string& arg, ErrorReporter&)
     286    {
     287      opt_storage = arg;
     288    }
     289#endif
    302290
    303291#if NH_MV   
    304292    template<>
    305293    inline void
    306 #if NH_MV_SEI
    307294      Option<char*>::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter&)
    308 #else
    309       Option<char*>::parse(const std::string& arg, ErrorReporter&)
    310 #endif
    311     {
    312 #if NH_MV_SEI
     295    {
    313296      assert( idcs.size() == 0 );
    314 #endif
    315297      opt_storage = arg.empty() ? NULL : strdup(arg.c_str()) ;
    316298    }
    317299
    318 #if !NH_MV_SEI
    319 
    320     template<>
    321     inline void
    322       Option< std::vector<char*> >::parse(const std::string& arg, ErrorReporter&)
    323     {
    324       opt_storage.clear();
    325 
    326       char* pcStart = (char*) arg.data();     
    327       char* pcEnd = strtok (pcStart," ");
    328 
    329       while (pcEnd != NULL)
    330       {
    331         size_t uiStringLength = pcEnd - pcStart;
    332         char* pcNewStr = (char*) malloc( uiStringLength + 1 );
    333         strncpy( pcNewStr, pcStart, uiStringLength);
    334         pcNewStr[uiStringLength] = '\0';
    335         pcStart = pcEnd+1;
    336         pcEnd = strtok (NULL, " ,.-");
    337         opt_storage.push_back( pcNewStr );
    338       }     
    339     }
    340 #endif
    341 
    342300    template<>   
    343301    inline void
    344 #if NH_MV_SEI
    345302      Option< std::vector<double> >::parse(const std::string& arg, const std::vector< int > & idcs, ErrorReporter&)
    346 #else
    347       Option< std::vector<double> >::parse(const std::string& arg, ErrorReporter&)
    348 #endif
    349     {
    350 #if NH_MV_SEI
     303    {
    351304      assert( idcs.size() == 0 );
    352 #endif
    353305      char* pcNextStart = (char*) arg.data();
    354306      char* pcEnd = pcNextStart + arg.length();
     
    384336
    385337
    386 #if NH_MV_SEI
    387338    template<>
    388339    inline void
     
    405356      xParseVec ( arg, opt_storage[ idcs[0] ][ idcs[1] ] );
    406357    };
    407 #if SEI_DRI_F0169
     358
    408359    template<>
    409360    inline void
     
    439390            while( (pcNextStart < pcEnd) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++; 
    440391            pcOldStart = pcNextStart;
    441 
    442         }       
    443 
    444 
     392        }
    445393    }
    446 #endif
    447 #else
    448     template<>
    449     inline void
    450       Option< std::vector<int> >::parse(const std::string& arg, ErrorReporter&)
    451     {
    452       opt_storage.clear();
    453 
    454 
    455       char* pcNextStart = (char*) arg.data();
    456       char* pcEnd = pcNextStart + arg.length();
    457 
    458       char* pcOldStart = 0;
    459 
    460       size_t iIdx = 0;
    461 
    462 
    463       while (pcNextStart < pcEnd)
    464       {
    465 
    466         if ( iIdx < opt_storage.size() )
    467         {
    468           opt_storage[iIdx] = (int) strtol(pcNextStart, &pcNextStart,10);
    469         }
    470         else
    471         {
    472           opt_storage.push_back( (int) strtol(pcNextStart, &pcNextStart,10)) ;
    473         }
    474         iIdx++;
    475         if ( errno == ERANGE || (pcNextStart == pcOldStart) )
    476         {
    477           std::cerr << "Error Parsing Integers: `" << arg << "'" << std::endl;
    478           exit(EXIT_FAILURE);
    479         };   
    480         while( (pcNextStart < pcEnd) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++; 
    481         pcOldStart = pcNextStart;
    482       }
    483     }
    484 #endif
    485 
    486 #if NH_MV_SEI
     394
    487395
    488396    template<>
     
    531439      xParseVec( arg, opt_storage[idcs[0]][idcs[1]] );
    532440    };
    533 #else
    534     template<>
    535     inline void
    536       Option< std::vector<bool> >::parse(const std::string& arg, ErrorReporter&)
    537     {
    538       char* pcNextStart = (char*) arg.data();
    539       char* pcEnd = pcNextStart + arg.length();
    540 
    541       char* pcOldStart = 0;
    542 
    543       size_t iIdx = 0;
    544 
    545       while (pcNextStart < pcEnd)
    546       {
    547         if ( iIdx < opt_storage.size() )
    548         {
    549           opt_storage[iIdx] = (strtol(pcNextStart, &pcNextStart,10) != 0);
    550         }
    551         else
    552         {
    553           opt_storage.push_back(strtol(pcNextStart, &pcNextStart,10) != 0) ;
    554         }
    555         iIdx++;
    556 
    557         if ( errno == ERANGE || (pcNextStart == pcOldStart) )
    558         {
    559           std::cerr << "Error Parsing Bools: `" << arg << "'" << std::endl;
    560           exit(EXIT_FAILURE);
    561         };   
    562         while( (pcNextStart < pcEnd) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++; 
    563         pcOldStart = pcNextStart;
    564       }
    565     }
    566 #endif
    567441#endif
    568442    /** Option class for argument handling using a user provided function */
     
    575449      {}
    576450
    577 #if NH_MV_SEI
     451#if NH_MV
    578452      void parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter& error_reporter)
    579453#else
     
    651525        operator()(const std::string& name, std::vector<T>& storage, T default_val, unsigned uiMaxNum, const std::string& desc = "" )
    652526      {
    653 #if NH_MV_SEI
    654527        std::vector<T> defVal;
    655528        defVal.resize( uiMaxNum, default_val );
     
    679552        return *this;
    680553      }
    681 #else
    682         std::string cNameBuffer;
    683         std::string cDescBuffer;
    684 
    685         storage.resize(uiMaxNum);
    686         for ( unsigned int uiK = 0; uiK < uiMaxNum; uiK++ )
    687         {
    688           cNameBuffer       .resize( name.size() + 10 );
    689           cDescBuffer.resize( desc.size() + 10 );
    690 
    691           Bool duplicate = (uiK != 0);
    692           // isn't there are sprintf function for string??
    693           sprintf((char*) cNameBuffer.c_str()       ,name.c_str(),uiK,uiK);
    694 
    695           if ( !duplicate )
    696           {         
    697             sprintf((char*) cDescBuffer.c_str(),desc.c_str(),uiK,uiK);
    698           }
    699 
    700           cNameBuffer.resize( std::strlen(cNameBuffer.c_str()) ); 
    701           cDescBuffer.resize( std::strlen(cDescBuffer.c_str()) );
    702          
    703 
    704           parent.addOption(new Option<T>( cNameBuffer, (storage[uiK]), default_val, cDescBuffer, duplicate ));
    705         }
    706 
    707         return *this;
    708       }
    709 #endif
    710554#endif
    711555      /**
  • TabularUnified trunk/source/Lib/TLibCommon/CommonDef.h

    r1357 r1386  
    4242#include <iostream>
    4343#include <assert.h>
     44#include <limits>
    4445
    4546#if _MSC_VER > 1000
     
    5354//
    5455#endif // _MSC_VER > 1000
    55 
    56 
    5756#include "TypeDef.h"
    5857#ifdef _MSC_VER
     
    7574#define HM_VERSION        "16.6"                ///<
    7675#else
    77 #define NV_VERSION        "16.6"                 ///< Current software version
     76#define NV_VERSION        "16.7"                 ///< Current software version
    7877#endif
    7978// ====================================================================================================================
     
    141140
    142141static const Int AMVP_MAX_NUM_CANDS =                               2; ///< AMVP: advanced motion vector prediction - max number of final candidates
    143 static const Int AMVP_MAX_NUM_CANDS_MEM =                           3; ///< AMVP: advanced motion vector prediction - max number of candidates
    144142static const Int AMVP_DECIMATION_FACTOR =                           4;
    145143static const Int MRG_MAX_NUM_CANDS =                                5; ///< MERGE
     
    173171#if NH_MV
    174172static const Int MAX_NUM_LAYER_IDS =                               63;
    175 #if NH_MV_SEI
    176173static const Int MAX_NUM_SEIS      =                               1000;
    177 #endif
    178174#else
    179175static const Int MAX_NUM_LAYER_IDS =                               64;
     
    283279static const Int  MAX_NUM_PICS_RPS          =                     16 ;
    284280static const Int  MAX_NUM_REF_LAYERS        =                     63 ; 
    285 #if NH_MV_SEI
     281
    286282static IntAry1d getRangeVec( Int rngStart, Int rngEnd ) { IntAry1d rng; for (Int i = rngStart; i<=rngEnd; i++) rng.push_back(i);  return rng; };
    287283static const IntAry1d IDR_NAL_UNIT_TYPES   = getRangeVec( NAL_UNIT_CODED_SLICE_IDR_W_RADL, NAL_UNIT_CODED_SLICE_IDR_N_LP );
    288284static const IntAry1d IRAP_NAL_UNIT_TYPES  = getRangeVec( NAL_UNIT_CODED_SLICE_BLA_W_LP  , NAL_UNIT_CODED_SLICE_CRA      );
    289 
    290 #endif
    291285#endif
    292286
     
    448442#endif
    449443
    450 #if NH_3D
     444#if NH_3D_VSO
    451445//PICYUV
    452446#define PICYUV_PAD         16
  • TabularUnified trunk/source/Lib/TLibCommon/Debug.cpp

    r1321 r1386  
    4949#if DEBUG_STRING
    5050// these strings are used to reorder the debug output so that the encoder and decoder match.
    51 const Char *debug_reorder_data_inter_token[MAX_NUM_COMPONENT+1]
     51const TChar *debug_reorder_data_inter_token[MAX_NUM_COMPONENT+1]
    5252 = {"Start of channel 0 inter debug\n", "Start of channel 1 inter debug\n", "Start of channel 2 inter debug\n", "End of inter residual debug\n"} ;
    53 const Char *partSizeToString[NUMBER_OF_PART_SIZES]={"2Nx2N(0)", "2NxN(1)", "Nx2N(2)", "NxN(3)", "2Nx(N/2+3N/2)(4)", "2Nx(3N/2+N/2)(5)", "(N/2+3N/2)x2N(6)", "(3N/2+N/2)x2N(7)"};
     53const TChar *partSizeToString[NUMBER_OF_PART_SIZES]={"2Nx2N(0)", "2NxN(1)", "Nx2N(2)", "NxN(3)", "2Nx(N/2+3N/2)(4)", "2Nx(3N/2+N/2)(5)", "(N/2+3N/2)x2N(6)", "(3N/2+N/2)x2N(7)"};
    5454#endif
    5555
     
    179179  PRINT_CONSTANT(O0043_BEST_EFFORT_DECODING,                                        settingNameWidth, settingValueWidth);
    180180
     181  PRINT_CONSTANT(ME_ENABLE_ROUNDING_OF_MVS,                                         settingNameWidth, settingValueWidth);
     182  PRINT_CONSTANT(U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING,        settingNameWidth, settingValueWidth);
     183
    181184  //------------------------------------------------
    182185
     
    418421
    419422
    420 Void printBlockToStream( std::ostream &ss, const Char *pLinePrefix, TComYuv &src, const UInt numSubBlocksAcross, const UInt numSubBlocksUp, const UInt defWidth )
     423Void printBlockToStream( std::ostream &ss, const TChar *pLinePrefix, TComYuv &src, const UInt numSubBlocksAcross, const UInt numSubBlocksUp, const UInt defWidth )
    421424{
    422425  const UInt numValidComp=src.getNumberValidComponents();
  • TabularUnified trunk/source/Lib/TLibCommon/Debug.h

    r1313 r1386  
    4747#include <TLibCommon/CommonDef.h>
    4848#if DEBUG_STRING
    49 extern const Char *debug_reorder_data_inter_token[MAX_NUM_COMPONENT+1];
    50 extern const Char *partSizeToString[NUMBER_OF_PART_SIZES];
     49extern const TChar *debug_reorder_data_inter_token[MAX_NUM_COMPONENT+1];
     50extern const TChar *partSizeToString[NUMBER_OF_PART_SIZES];
    5151#endif
    5252
     
    149149UInt getZScanIndex(const UInt x, const UInt y);
    150150
    151 //template specialisation for Char types to get it to render as a number
     151//template specialisation for SChar/UChar types to get it to render as a number
    152152template <typename ValueType> inline Void writeValueToStream       (const ValueType &value, std::ostream &stream, const UInt outputWidth) { stream << std::setw(outputWidth) <<      value;  }
    153 template <>                   inline Void writeValueToStream<Char >(const Char      &value, std::ostream &stream, const UInt outputWidth) { stream << std::setw(outputWidth) <<  Int(value); }
     153template <>                   inline Void writeValueToStream<SChar>(const SChar     &value, std::ostream &stream, const UInt outputWidth) { stream << std::setw(outputWidth) <<  Int(value); }
    154154template <>                   inline Void writeValueToStream<UChar>(const UChar     &value, std::ostream &stream, const UInt outputWidth) { stream << std::setw(outputWidth) << UInt(value); }
    155155
     
    231231
    232232template <typename T>
    233 Void printBlockToStream( std::ostream &ss, const Char *pLinePrefix, const T * blkSrc, const UInt width, const UInt height, const UInt stride, const UInt subBlockWidth=0, const UInt subBlockHeight=0, const UInt defWidth=3 )
     233Void printBlockToStream( std::ostream &ss, const TChar *pLinePrefix, const T * blkSrc, const UInt width, const UInt height, const UInt stride, const UInt subBlockWidth=0, const UInt subBlockHeight=0, const UInt defWidth=3 )
    234234{
    235235  for (UInt y=0; y<height; y++)
     
    255255
    256256class TComYuv;
    257 Void printBlockToStream( std::ostream &ss, const Char *pLinePrefix, TComYuv &src, const UInt numSubBlocksAcross=1, const UInt numSubBlocksUp=1, const UInt defWidth=3 );
     257Void printBlockToStream( std::ostream &ss, const TChar *pLinePrefix, TComYuv &src, const UInt numSubBlocksAcross=1, const UInt numSubBlocksUp=1, const UInt defWidth=3 );
    258258
    259259// ---------------------------------------------------------------------------------------------- //
  • TabularUnified trunk/source/Lib/TLibCommon/SEI.cpp

    r1356 r1386  
    3232 */
    3333
    34 /** \file     #SEI.cpp
     34/** \file     SEI.cpp
    3535    \brief    helper functions for SEI handling
    3636*/
     
    3838#include "CommonDef.h"
    3939#include "SEI.h"
    40 #if NH_MV_SEI
     40#if NH_MV
    4141#include "TComSlice.h"
    4242#endif
     
    118118
    119119// Static member
    120 const Char *SEI::getSEIMessageString(SEI::PayloadType payloadType)
     120const TChar *SEI::getSEIMessageString(SEI::PayloadType payloadType)
    121121{
    122122  switch (payloadType)
     
    151151    case SEI::SEGM_RECT_FRAME_PACKING:              return "Segmented rectangular frame packing arrangement";
    152152    case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:    return "Temporal motion constrained tile sets";
    153     case SEI::CHROMA_SAMPLING_FILTER_HINT:          return "Chroma sampling filter hint";
     153    case SEI::CHROMA_RESAMPLING_FILTER_HINT:        return "Chroma sampling filter hint";
     154    case SEI::COLOUR_REMAPPING_INFO:                return "Colour remapping info";
     155
    154156#if NH_MV
    155     case SEI::COLOUR_REMAPPING_INFO:                     return "Colour remapping information";
    156157    case SEI::DEINTERLACED_FIELD_IDENTIFICATION:         return "Deinterlaced field identification";
    157158    case SEI::LAYERS_NOT_PRESENT:                        return "Layers not present";
     
    177178}
    178179
    179 #if NH_MV_SEI
     180#if NH_MV
    180181SEI::SEI()
    181182{
     
    223224    case SEI::CHROMA_SAMPLING_FILTER_HINT:          return new SEIChromaSamplingFilterHint
    224225#endif
    225 #if NH_MV_SEI
    226 #if NH_MV_LAYERS_NOT_PRESENT_SEI
    227226  case SEI::LAYERS_NOT_PRESENT                    :               return new SEILayersNotPresent;
    228 #endif
    229227  case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS     :               return new SEIInterLayerConstrainedTileSets;
    230228#if NH_MV_SEI_TBD
     
    240238#endif
    241239  case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:            return new SEIThreeDimensionalReferenceDisplaysInfo;
    242 #if SEI_DRI_F0169
    243240  case SEI::DEPTH_REPRESENTATION_INFO             :               return new SEIDepthRepresentationInfo;
    244 #endif
    245241  case SEI::MULTIVIEW_SCENE_INFO                  :               return new SEIMultiviewSceneInfo;
    246242  case SEI::MULTIVIEW_ACQUISITION_INFO            :               return new SEIMultiviewAcquisitionInfo;
     
    249245  case SEI::ALTERNATIVE_DEPTH_INFO                :               return new SEIAlternativeDepthInfo;
    250246#endif
    251 #endif
    252247  default:                                        assert( false ); return NULL;
    253248  }
     
    266261}
    267262
    268 Void SEI::setupFromCfgFile( const Char* cfgFile )
     263Void SEI::setupFromCfgFile( const TChar* cfgFile )
    269264{
    270265  assert( false );
     
    304299}
    305300
    306 Void SEI::xCheckCfgRange( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const Char* seName )
     301Void SEI::xCheckCfgRange( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const TChar* seName )
    307302{
    308303  if ( val < minVal || val > maxVal  )
     
    329324}
    330325
    331 Void SEI::xCheckCfg( Bool& wrongConfig, Bool cond, const Char* errStr )
     326Void SEI::xCheckCfg( Bool& wrongConfig, Bool cond, const TChar* errStr )
    332327{
    333328  if ( !cond  )
     
    339334}
    340335
    341 
    342 #if NH_MV_LAYERS_NOT_PRESENT_SEI
    343 Void SEILayersNotPresent::setupFromCfgFile(const Char* cfgFile)
     336Void SEILayersNotPresent::setupFromCfgFile(const TChar* cfgFile)
    344337{
    345338  // Set default values
     
    398391      return wrongConfig;
    399392  };
    400 #endif
    401 
    402 
    403 Void SEIInterLayerConstrainedTileSets::setupFromCfgFile(const Char* cfgFile)
     393
     394
     395
     396Void SEIInterLayerConstrainedTileSets::setupFromCfgFile(const TChar* cfgFile)
    404397{
    405398  // Set default values
     
    483476};
    484477
    485 Void SEIBspNesting::setupFromCfgFile(const Char* cfgFile)
     478Void SEIBspNesting::setupFromCfgFile(const TChar* cfgFile)
    486479{
    487480  // Set default values
     
    556549};
    557550
    558 Void SEIBspInitialArrivalTime::setupFromCfgFile(const Char* cfgFile)
     551Void SEIBspInitialArrivalTime::setupFromCfgFile(const TChar* cfgFile)
    559552{
    560553  // Set default values
     
    605598#endif
    606599
    607 Void SEISubBitstreamProperty::setupFromCfgFile(const Char* cfgFile)
     600Void SEISubBitstreamProperty::setupFromCfgFile(const TChar* cfgFile)
    608601{
    609602  // Set default values
     
    681674}
    682675
    683 Void SEIAlphaChannelInfo::setupFromCfgFile(const Char* cfgFile)
     676Void SEIAlphaChannelInfo::setupFromCfgFile(const TChar* cfgFile)
    684677{
    685678  // Set default values
     
    744737{ };
    745738
    746 Void SEIOverlayInfo::setupFromCfgFile(const Char* cfgFile)
     739Void SEIOverlayInfo::setupFromCfgFile(const TChar* cfgFile)
    747740{
    748741  // Set default values
     
    828821
    829822
    830 Void SEITemporalMvPredictionConstraints::setupFromCfgFile(const Char* cfgFile)
     823Void SEITemporalMvPredictionConstraints::setupFromCfgFile(const TChar* cfgFile)
    831824{
    832825  // Set default values
     
    870863
    871864#if NH_MV_SEI_TBD
    872 Void SEIFrameFieldInfo::setupFromCfgFile(const Char* cfgFile)
     865Void SEIFrameFieldInfo::setupFromCfgFile(const TChar* cfgFile)
    873866{
    874867  // Set default values
     
    922915#endif
    923916
    924 Void SEIThreeDimensionalReferenceDisplaysInfo::setupFromCfgFile(const Char* cfgFile)
     917Void SEIThreeDimensionalReferenceDisplaysInfo::setupFromCfgFile(const TChar* cfgFile)
    925918{
    926919  // Set default values
     
    10181011};
    10191012
    1020 #if SEI_DRI_F0169
    10211013Void SEIDepthRepresentationInfo::setupFromSlice  ( const TComSlice* slice )
    10221014{
     
    10251017};
    10261018
    1027 Void SEIDepthRepresentationInfo::setupFromCfgFile(const Char* cfgFile)
     1019Void SEIDepthRepresentationInfo::setupFromCfgFile(const TChar* cfgFile)
    10281020{
    10291021  // Set default values
     
    11951187    return wrongConfig;
    11961188}
    1197 #endif
    1198 
    1199 Void SEIMultiviewSceneInfo::setupFromCfgFile(const Char* cfgFile)
     1189
     1190
     1191Void SEIMultiviewSceneInfo::setupFromCfgFile(const TChar* cfgFile)
    12001192{
    12011193  // Set default values
     
    12431235};
    12441236
    1245 Void SEIMultiviewAcquisitionInfo::setupFromCfgFile(const Char* cfgFile)
     1237Void SEIMultiviewAcquisitionInfo::setupFromCfgFile(const TChar* cfgFile)
    12461238{
    12471239  // Set default values
     
    14051397}
    14061398
    1407 Void SEIMultiviewViewPosition::setupFromCfgFile(const Char* cfgFile)
     1399Void SEIMultiviewViewPosition::setupFromCfgFile(const TChar* cfgFile)
    14081400{
    14091401  // Set default values
     
    14561448
    14571449#if NH_3D
    1458 Void SEIAlternativeDepthInfo::setupFromCfgFile(const Char* cfgFile)
     1450Void SEIAlternativeDepthInfo::setupFromCfgFile(const TChar* cfgFile)
    14591451{
    14601452  // Set default values
  • TabularUnified trunk/source/Lib/TLibCommon/SEI.h

    r1356 r1386  
    4444
    4545
    46 #if NH_MV_SEI
     46#if NH_MV
    4747#include "TAppCommon/program_options_lite.h"
    4848using namespace std;
     
    5353//! \{
    5454class TComSPS;
    55 #if NH_MV_SEI
     55#if NH_MV
    5656class TComSlice;
    5757class SEIScalableNesting;
     
    9494    SEGM_RECT_FRAME_PACKING              = 138,
    9595    TEMP_MOTION_CONSTRAINED_TILE_SETS    = 139,
    96     CHROMA_SAMPLING_FILTER_HINT          = 140,
    97     KNEE_FUNCTION_INFO                   = 141
    98 #if NH_MV_SEI
    99     ,COLOUR_REMAPPING_INFO                    = 142,
     96    CHROMA_RESAMPLING_FILTER_HINT        = 140,
     97    KNEE_FUNCTION_INFO                   = 141,
     98    COLOUR_REMAPPING_INFO                = 142,
    10099    DEINTERLACED_FIELD_IDENTIFICATION         = 143,
    101100    LAYERS_NOT_PRESENT                        = 160,
     
    116115    ,ALTERNATIVE_DEPTH_INFO                    = 181
    117116#endif
     117
     118  };
     119
     120#if NH_MV
     121  SEI();
     122#else
     123  SEI() {}
    118124#endif
    119125
    120   };
    121 
    122   SEI();
    123126
    124127  virtual ~SEI() {}
     128
     129  static const TChar *getSEIMessageString(SEI::PayloadType payloadType);
     130
     131  virtual PayloadType payloadType() const = 0;
     132
     133#if NH_MV
    125134  virtual SEI*       getCopy( ) const;
    126   static const Char *getSEIMessageString(SEI::PayloadType payloadType );
    127   virtual PayloadType payloadType() const = 0;
    128 
    129 #if NH_MV_SEI
    130135  static SEI*        getNewSEIMessage         ( SEI::PayloadType payloadType );
    131136  Bool               insertSei                ( Int curLayerId, Int curPoc, Int curTid, Int curNaluType ) const;
     
    133138
    134139  virtual Void       setupFromSlice           ( const TComSlice* slice );
    135   virtual Void       setupFromCfgFile         ( const Char* cfgFile );
     140  virtual Void       setupFromCfgFile         ( const TChar*  cfgFile );
    136141  virtual Bool       checkCfg                 ( const TComSlice* slice   );
    137142
    138143  Void               xPrintCfgErrorIntro();
    139   Void               xCheckCfgRange           ( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const Char* seName );
    140   Void               xCheckCfg                ( Bool& wrongConfig, Bool cond, const Char* errStr );
     144  Void               xCheckCfgRange           ( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const TChar* seName );
     145  Void               xCheckCfg                ( Bool& wrongConfig, Bool cond, const TChar* errStr );
    141146  Void               xAddGeneralOpts          ( po::Options &opts, IntAry1d defAppLayerIds, IntAry1d defAppPocs, IntAry1d defAppTids, IntAry1d defAppVclNaluTypes,
    142147                                                Int defSeiNaluId, Int defPositionInSeiNalu, Bool defModifyByEncoder );
     
    186191  virtual ~SEIDecodedPictureHash() {}
    187192
    188   enum Method
    189   {
    190     MD5,
    191     CRC,
    192     CHECKSUM,
    193     RESERVED,
    194   } method;
     193  HashType method;
    195194
    196195  TComPictureHash m_pictureHash;
     
    482481};
    483482
    484 class SEIChromaSamplingFilterHint : public SEI
    485 {
    486 public:
    487   PayloadType payloadType() const {return CHROMA_SAMPLING_FILTER_HINT;}
    488   SEIChromaSamplingFilterHint() {}
    489   virtual ~SEIChromaSamplingFilterHint() {
    490     if(m_verChromaFilterIdc == 1)
     483class SEIColourRemappingInfo : public SEI
     484{
     485public:
     486
     487  struct CRIlut
     488  {
     489    Int codedValue;
     490    Int targetValue;
     491    bool operator < (const CRIlut& a) const
    491492    {
    492       for(Int i = 0; i < m_numVerticalFilters; i ++)
     493      return codedValue < a.codedValue;
     494    }
     495  };
     496
     497  PayloadType payloadType() const { return COLOUR_REMAPPING_INFO; }
     498  SEIColourRemappingInfo() {}
     499  ~SEIColourRemappingInfo() {}
     500
     501  Void copyFrom( const SEIColourRemappingInfo &seiCriInput)
    493502      {
    494         free(m_verFilterCoeff[i]);
    495       }
    496       free(m_verFilterCoeff);
    497       free(m_verTapLengthMinus1);
    498     }
    499     if(m_horChromaFilterIdc == 1)
    500     {
    501       for(Int i = 0; i < m_numHorizontalFilters; i ++)
    502       {
    503         free(m_horFilterCoeff[i]);
    504       }
    505       free(m_horFilterCoeff);
    506       free(m_horTapLengthMinus1);
    507     }
     503    (*this) = seiCriInput;
    508504  }
     505
     506  UInt                m_colourRemapId;
     507  Bool                m_colourRemapCancelFlag;
     508  Bool                m_colourRemapPersistenceFlag;
     509  Bool                m_colourRemapVideoSignalInfoPresentFlag;
     510  Bool                m_colourRemapFullRangeFlag;
     511  Int                 m_colourRemapPrimaries;
     512  Int                 m_colourRemapTransferFunction;
     513  Int                 m_colourRemapMatrixCoefficients;
     514  Int                 m_colourRemapInputBitDepth;
     515  Int                 m_colourRemapBitDepth;
     516  Int                 m_preLutNumValMinus1[3];
     517  std::vector<CRIlut> m_preLut[3];
     518  Bool                m_colourRemapMatrixPresentFlag;
     519  Int                 m_log2MatrixDenom;
     520  Int                 m_colourRemapCoeffs[3][3];
     521  Int                 m_postLutNumValMinus1[3];
     522  std::vector<CRIlut> m_postLut[3];
     523};
     524
     525class SEIChromaResamplingFilterHint : public SEI
     526{
     527public:
     528  PayloadType payloadType() const {return CHROMA_RESAMPLING_FILTER_HINT;}
     529  SEIChromaResamplingFilterHint() {}
     530  virtual ~SEIChromaResamplingFilterHint() {}
    509531
    510532  Int   m_verChromaFilterIdc;
    511533  Int   m_horChromaFilterIdc;
    512   Bool  m_verFilteringProcessFlag;
     534  Bool                           m_verFilteringFieldProcessingFlag;
    513535  Int   m_targetFormatIdc;
    514536  Bool  m_perfectReconstructionFlag;
    515   Int   m_numVerticalFilters;
    516   Int*  m_verTapLengthMinus1;
    517   Int** m_verFilterCoeff;
    518   Int   m_numHorizontalFilters;
    519   Int*  m_horTapLengthMinus1;
    520   Int** m_horFilterCoeff;
     537  std::vector<std::vector<Int> > m_verFilterCoeff;
     538  std::vector<std::vector<Int> > m_horFilterCoeff;
    521539};
    522540
     
    530548    TComSEIMasteringDisplay values;
    531549};
    532 
    533 #if NH_MV
    534 #if !NH_MV_SEI
    535 class SEISubBitstreamProperty : public SEI
    536 {
    537 public:
    538   PayloadType payloadType() const { return SUB_BITSTREAM_PROPERTY; }
    539 
    540   SEISubBitstreamProperty():   m_activeVpsId(-1), m_numAdditionalSubStreams(0) {}
    541   virtual ~SEISubBitstreamProperty() {}
    542 
    543   Int  m_activeVpsId;
    544   Int  m_numAdditionalSubStreams;
    545   std::vector<Int>  m_subBitstreamMode;
    546   std::vector<Int>  m_outputLayerSetIdxToVps;
    547   std::vector<Int>  m_highestSublayerId;
    548   std::vector<Int>  m_avgBitRate;
    549   std::vector<Int>  m_maxBitRate;
    550 };
    551 #endif
    552 #endif
    553550
    554551typedef std::list<SEI*> SEIMessages;
     
    658655
    659656};
    660 
    661 #if NH_MV_SEI
    662 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     657#if NH_MV
    663658class SEILayersNotPresent : public SEI
    664659{
     
    669664  SEI* getCopy( ) const { return new SEILayersNotPresent(*this); };
    670665
    671   Void setupFromCfgFile( const Char*      cfgFile );
     666  Void setupFromCfgFile( const TChar*     cfgFile );
    672667  Bool checkCfg        ( const TComSlice* slice   );
    673668
     
    681676  }
    682677};
    683 #endif
    684678
    685679class SEIInterLayerConstrainedTileSets : public SEI
     
    691685  SEI* getCopy( ) const { return new SEIInterLayerConstrainedTileSets(*this); };
    692686
    693   Void setupFromCfgFile( const Char*      cfgFile );
     687  Void setupFromCfgFile( const TChar*     cfgFile );
    694688  Bool checkCfg        ( const TComSlice* slice   );
    695689
     
    733727  SEI* getCopy( ) const { return new SEIBspNesting(*this); };
    734728
    735   Void setupFromCfgFile( const Char*      cfgFile );
     729  Void setupFromCfgFile( const TChar*      cfgFile );
    736730  Void setupFromSlice  ( const TComSlice* slice   );
    737731  Bool checkCfg        ( const TComSlice* slice   );
     
    752746  SEI* getCopy( ) const { return new SEIBspInitialArrivalTime(*this); };
    753747
    754   Void setupFromCfgFile( const Char*      cfgFile );
     748  Void setupFromCfgFile( const TChar*      cfgFile );
    755749  Void setupFromSlice  ( const TComSlice* slice   );
    756750  Bool checkCfg        ( const TComSlice* slice   );
     
    769763  SEI* getCopy( ) const { return new SEISubBitstreamProperty(*this); };
    770764
    771   Void setupFromCfgFile( const Char*      cfgFile );
     765  Void setupFromCfgFile( const TChar*     cfgFile );
    772766  Bool checkCfg        ( const TComSlice* slice   );
    773767  Void resizeArrays    ( );
     
    790784  SEI* getCopy( ) const { return new SEIAlphaChannelInfo(*this); };
    791785
    792   Void setupFromCfgFile( const Char*      cfgFile );
     786  Void setupFromCfgFile( const TChar*     cfgFile );
    793787  Bool checkCfg        ( const TComSlice* slice   );
    794788
     
    811805  SEI* getCopy( ) const { return new SEIOverlayInfo(*this); };
    812806
    813   Void setupFromCfgFile( const Char*      cfgFile );
     807  Void setupFromCfgFile( const TChar*     cfgFile );
    814808  Bool checkCfg        ( const TComSlice* slice   );
    815809
     
    848842  SEI* getCopy( ) const { return new SEITemporalMvPredictionConstraints(*this); };
    849843
    850   Void setupFromCfgFile( const Char*      cfgFile );
     844  Void setupFromCfgFile( const TChar*     cfgFile );
    851845  Bool checkCfg        ( const TComSlice* slice   );
    852846
     
    864858  SEI* getCopy( ) const { return new SEIFrameFieldInfo(*this); };
    865859
    866   Void setupFromCfgFile( const Char*      cfgFile );
     860  Void setupFromCfgFile( const TChar*     cfgFile );
    867861  Void setupFromSlice  ( const TComSlice* slice   );
    868862  Bool checkCfg        ( const TComSlice* slice   );
     
    882876  SEI* getCopy( ) const { return new SEIThreeDimensionalReferenceDisplaysInfo(*this); };
    883877
    884   Void setupFromCfgFile( const Char*      cfgFile );
     878  Void setupFromCfgFile( const TChar*     cfgFile );
    885879  Bool checkCfg        ( const TComSlice* slice   );
    886880
     
    924918};
    925919
    926 #if SEI_DRI_F0169
    927920class SEIDepthRepresentationInfo : public SEI
    928921{
     
    936929        SEI* getCopy( ) const { return new SEIDepthRepresentationInfo(*this); };
    937930
    938         Void setupFromCfgFile( const Char*      cfgFile );
     931        Void setupFromCfgFile( const TChar*     cfgFile );
    939932        Void setupFromSlice  ( const TComSlice* slice   );
    940933        Bool checkCfg        ( const TComSlice* slice   );
     
    993986        IntAry2d       m_depth_nonlinear_representation_model;
    994987};
    995 #endif
     988
    996989
    997990class SEIMultiviewSceneInfo : public SEI
     
    1003996  SEI* getCopy( ) const { return new SEIMultiviewSceneInfo(*this); };
    1004997
    1005   Void setupFromCfgFile( const Char*      cfgFile );
     998  Void setupFromCfgFile( const TChar*     cfgFile );
    1006999  Bool checkCfg        ( const TComSlice* slice   );
    10071000
     
    10191012  SEI* getCopy( ) const { return new SEIMultiviewAcquisitionInfo(*this); };
    10201013
    1021   Void setupFromCfgFile( const Char*      cfgFile );
     1014  Void setupFromCfgFile( const TChar*     cfgFile );
    10221015  Bool checkCfg        ( const TComSlice* slice   );
    10231016
     
    11311124  SEI* getCopy( ) const { return new SEIMultiviewViewPosition(*this); };
    11321125
    1133   Void setupFromCfgFile( const Char*      cfgFile );
     1126  Void setupFromCfgFile( const TChar*     cfgFile );
    11341127  Void setupFromSlice  ( const TComSlice* slice   );
    11351128  Bool checkCfg        ( const TComSlice* slice   );
     
    11481141  SEI* getCopy( ) const { return new SEIAlternativeDepthInfo(*this); };
    11491142
    1150   Void setupFromCfgFile( const Char*      cfgFile );
     1143  Void setupFromCfgFile( const TChar*     cfgFile );
    11511144  Bool checkCfg        ( const TComSlice* slice   );
    11521145
     
    13571350#endif
    13581351#endif
    1359 
    13601352#endif
     1353
    13611354//! \}
  • TabularUnified trunk/source/Lib/TLibCommon/TComBitStream.cpp

    r1321 r1386  
    9393}
    9494
    95 Char* TComOutputBitstream::getByteStream() const
    96 {
    97   return (Char*) &m_fifo.front();
     95UChar* TComOutputBitstream::getByteStream() const
     96{
     97  return (UChar*) &m_fifo.front();
    9898}
    9999
     
    260260  m_numBitsRead += uiNumberOfBits;
    261261
    262 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     262#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    263263  if ( g_traceBitsRead )
    264264  {
  • TabularUnified trunk/source/Lib/TLibCommon/TComBitStream.h

    r1313 r1386  
    115115   * bytestream are stored in ascending addresses.
    116116   */
    117   Char* getByteStream() const;
     117  UChar* getByteStream() const;
    118118
    119119  /**
  • TabularUnified trunk/source/Lib/TLibCommon/TComCodingStatistics.h

    r1321 r1386  
    120120};
    121121
    122 static inline const Char* getName(TComCodingStatisticsType name)
     122static inline const TChar* getName(TComCodingStatisticsType name)
    123123{
    124   static const Char *statNames[]=
     124  static const TChar *statNames[]=
    125125  {
    126126    "NAL_UNIT_TOTAL_BODY", // This is a special case and is not included in the total sums.
     
    189189#endif
    190190  };
    191   assert(STATS__NUM_STATS == sizeof(statNames)/sizeof(Char *) && name < STATS__NUM_STATS);
     191  assert(STATS__NUM_STATS == sizeof(statNames)/sizeof(TChar *) && name < STATS__NUM_STATS);
    192192  return statNames[name];
    193193}
     
    229229  }
    230230
    231   static const Char *GetSubClassString(const UInt subClass)
     231  static const TChar *GetSubClassString(const UInt subClass)
    232232  {
    233233    assert (subClass<CODING_STATS_NUM_SUBCLASSES);
    234     static const Char *strings[1+MAX_NUM_COMPONENT+MAX_NUM_CHANNEL_TYPE]={"-", "Y", "Cb", "Cr", "Luma", "Chroma"};
     234    static const TChar *strings[1+MAX_NUM_COMPONENT+MAX_NUM_CHANNEL_TYPE]={"-", "Y", "Cb", "Cr", "Luma", "Chroma"};
    235235    return strings[subClass/CODING_STATS_NUM_WIDTHS];
    236236  }
     
    289289    { }
    290290
    291     static Void OutputLine(const Char *pName, const Char sep, UInt width, const Char *pSubClassStr, const SStat &sCABAC, const SStat &sEP)
     291    static Void OutputLine(const TChar *pName, const TChar sep, UInt width, const TChar *pSubClassStr, const SStat &sCABAC, const SStat &sEP)
    292292    {
    293293      if (width==0)
     
    302302      }
    303303    }
    304     static Void OutputLine(const Char *pName, const Char sep, const Char *pWidthString, const Char *pSubClassStr, const SStat &sCABAC, const SStat &sEP)
     304    static Void OutputLine(const TChar *pName, const TChar sep, const TChar *pWidthString, const TChar *pSubClassStr, const SStat &sCABAC, const SStat &sEP)
    305305    {
    306306      printf("%c%-45s%c  %6s %6s %12lld %12lld %12lld %12lld %12lld %12lld %12lld (%12lld)%c\n",
     
    308308              sCABAC.count, sCABAC.sum, sCABAC.bits, sEP.count, sEP.sum, sEP.bits, sCABAC.bits+sEP.bits, (sCABAC.bits+sEP.bits)/8, sep=='~'?']':' ');
    309309    }
    310     static Void OutputLine(const Char *pName, const Char sep, const Char *pWidthString, const Char *pSubClassStr,  const SStat &sEP)
     310    static Void OutputLine(const TChar *pName, const TChar sep, const TChar *pWidthString, const TChar *pSubClassStr,  const SStat &sEP)
    311311    {
    312312      printf("%c%-45s%c  %6s %6s %12s %12s %12s %12lld %12lld %12lld %12lld (%12lld)%c\n",
     
    315315    }
    316316
    317     static Void OutputDashedLine(const Char *pText)
     317    static Void OutputDashedLine(const TChar *pText)
    318318    {
    319319      printf("--%s",pText);
     
    360360        SStat cabacSubTotal, epSubTotal;
    361361        Bool bHadClassifiedEntry=false;
    362         const Char *pName=getName(TComCodingStatisticsType(i));
     362        const TChar *pName=getName(TComCodingStatisticsType(i));
    363363
    364364        for(UInt c=0; c<CODING_STATS_NUM_SUBCLASSES; c++)
     
    488488    static SStat &GetStatisticEP(const std::string &str) { return GetSingletonInstance().data.mappings_ep[str]; }
    489489
    490     static SStat &GetStatisticEP(const Char *pKey) {return GetStatisticEP(std::string(pKey)); }
     490    static SStat &GetStatisticEP(const TChar *pKey) {return GetStatisticEP(std::string(pKey)); }
    491491
    492492    static Void IncrementStatisticEP(const TComCodingStatisticsClassType &stat, const Int numBits, const Int value)
     
    506506    }
    507507
    508     static Void IncrementStatisticEP(const Char *pKey, const Int numBits, const Int value)
     508    static Void IncrementStatisticEP(const TChar *pKey, const Int numBits, const Int value)
    509509    {
    510510      SStat &s=GetStatisticEP(pKey);
  • TabularUnified trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r1356 r1386  
    160160  if ( !bDecSubCu )
    161161  {
    162     m_phQP               = (Char*     )xMalloc(Char,     uiNumPartition);
     162    m_phQP               = (SChar*    )xMalloc(SChar,    uiNumPartition);
    163163    m_puhDepth           = (UChar*    )xMalloc(UChar,    uiNumPartition);
    164164    m_puhWidth           = (UChar*    )xMalloc(UChar,    uiNumPartition);
     
    171171    m_ucDISType          = (UChar*)xMalloc(UChar, uiNumPartition);
    172172#endif
    173     m_pePartSize         = new Char[ uiNumPartition ];
     173    m_pePartSize         = new SChar[ uiNumPartition ];
    174174    memset( m_pePartSize, NUMBER_OF_PART_SIZES,uiNumPartition * sizeof( *m_pePartSize ) );
    175     m_pePredMode         = new Char[ uiNumPartition ];
     175    m_pePredMode         = new SChar[ uiNumPartition ];
    176176    m_CUTransquantBypass = new Bool[ uiNumPartition ];
    177177
     
    179179    m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
    180180#if NH_3D_VSP
    181     m_piVSPFlag          = (Char*  )xMalloc(Char,  uiNumPartition);
     181    m_piVSPFlag          = (SChar* )xMalloc(SChar, uiNumPartition);
    182182#endif
    183183#if NH_3D_SPIVMP
     
    196196    {
    197197      const RefPicList rpl=RefPicList(i);
    198       m_apiMVPIdx[rpl]       = new Char[ uiNumPartition ];
    199       m_apiMVPNum[rpl]       = new Char[ uiNumPartition ];
    200       memset( m_apiMVPIdx[rpl], -1,uiNumPartition * sizeof( Char ) );
     198      m_apiMVPIdx[rpl]       = new SChar[ uiNumPartition ];
     199      m_apiMVPNum[rpl]       = new SChar[ uiNumPartition ];
     200      memset( m_apiMVPIdx[rpl], -1,uiNumPartition * sizeof( SChar ) );
    201201    }
    202202
     
    212212      const UInt totalSize   = (uiWidth * uiHeight) >> chromaShift;
    213213
    214       m_crossComponentPredictionAlpha[compID] = (Char*  )xMalloc(Char,   uiNumPartition);
     214      m_crossComponentPredictionAlpha[compID] = (SChar* )xMalloc(SChar,  uiNumPartition);
    215215      m_puhTransformSkip[compID]              = (UChar* )xMalloc(UChar,  uiNumPartition);
    216216      m_explicitRdpcmMode[compID]             = (UChar* )xMalloc(UChar,  uiNumPartition);
     
    524524}
    525525
    526 Bool TComDataCU::isLastSubCUOfCtu(const UInt absPartIdx)
     526Bool TComDataCU::isLastSubCUOfCtu(const UInt absPartIdx) const
    527527{
    528528  const TComSPS &sps=*(getSlice()->getSPS());
     
    844844  Int iSizeInUchar = sizeof( UChar  ) * m_uiNumPartition;
    845845  Int iSizeInBool  = sizeof( Bool   ) * m_uiNumPartition;
    846   Int sizeInChar = sizeof( Char  ) * m_uiNumPartition;
     846  Int sizeInChar = sizeof( SChar  ) * m_uiNumPartition;
    847847
    848848  memset( m_phQP,              qp,  sizeInChar );
     
    850850  memset( m_puhMergeIndex,      0, iSizeInUchar );
    851851#if NH_3D_VSP
    852   memset( m_piVSPFlag,          0, sizeof( Char ) * m_uiNumPartition );
     852  memset( m_piVSPFlag,          0, sizeof( SChar ) * m_uiNumPartition );
    853853#endif
    854854#if NH_3D_SPIVMP
     
    11211121
    11221122// Copy inter prediction info from the biggest CU
    1123 Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
    11241123#if NH_3D_NBDV
    1125   , Bool bNBDV
    1126 #endif
    1127 )
     1124Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList   , Bool bNBDV )
     1125#else
     1126Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList )
     1127#endif
    11281128{
    11291129  m_pcPic              = pcCU->getPic();
     
    12191219  Int iSizeInBool   = sizeof( Bool  ) * uiNumPartition;
    12201220
    1221   Int sizeInChar  = sizeof( Char ) * uiNumPartition;
     1221  Int sizeInChar  = sizeof( SChar ) * uiNumPartition;
    12221222  memcpy( m_skipFlag   + uiOffset, pcCU->getSkipFlag(),       sizeof( *m_skipFlag )   * uiNumPartition );
    12231223#if NH_3D_DIS
     
    12331233  memcpy( m_puhMergeIndex       + uiOffset, pcCU->getMergeIndex(),        iSizeInUchar );
    12341234#if NH_3D_VSP
    1235   memcpy( m_piVSPFlag           + uiOffset, pcCU->getVSPFlag(),           sizeof( Char ) * uiNumPartition );
     1235  memcpy( m_piVSPFlag           + uiOffset, pcCU->getVSPFlag(),           sizeof( SChar ) * uiNumPartition );
    12361236  memcpy( m_pDvInfo             + uiOffset, pcCU->getDvInfo(),            sizeof( *m_pDvInfo ) * uiNumPartition );
    12371237#endif
     
    13351335  Int iSizeInUchar  = sizeof( UChar ) * m_uiNumPartition;
    13361336  Int iSizeInBool   = sizeof( Bool  ) * m_uiNumPartition;
    1337   Int sizeInChar  = sizeof( Char ) * m_uiNumPartition;
     1337  Int sizeInChar  = sizeof( SChar ) * m_uiNumPartition;
    13381338
    13391339  memcpy( pCtu->getSkipFlag() + m_absZIdxInCtu, m_skipFlag, sizeof( *m_skipFlag ) * m_uiNumPartition );
     
    13551355  memcpy( pCtu->getMergeIndex()        + m_absZIdxInCtu, m_puhMergeIndex,       iSizeInUchar );
    13561356#if NH_3D_VSP
    1357   memcpy( pCtu->getVSPFlag()           + m_absZIdxInCtu, m_piVSPFlag,           sizeof( Char ) * m_uiNumPartition );
     1357  memcpy( pCtu->getVSPFlag()           + m_absZIdxInCtu, m_piVSPFlag,           sizeof( SChar ) * m_uiNumPartition );
    13581358#endif
    13591359#if NH_3D_DBBP
     
    14471447// --------------------------------------------------------------------------------------------------------------------
    14481448
    1449 TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx,
     1449const TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx,
    14501450                                   UInt uiCurrPartUnitIdx,
    14511451                                   Bool bEnforceSliceRestriction,
    1452                                    Bool bEnforceTileRestriction )
     1452                                         Bool bEnforceTileRestriction ) const
    14531453{
    14541454  UInt uiAbsPartIdx       = g_auiZscanToRaster[uiCurrPartUnitIdx];
     
    14791479
    14801480
    1481 TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx,
     1481const TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx,
    14821482                                    UInt uiCurrPartUnitIdx,
    14831483                                    Bool bEnforceSliceRestriction,
    14841484                                    Bool planarAtCtuBoundary,
    1485                                     Bool bEnforceTileRestriction )
     1485                                          Bool bEnforceTileRestriction ) const
    14861486{
    14871487  UInt uiAbsPartIdx       = g_auiZscanToRaster[uiCurrPartUnitIdx];
     
    15171517}
    15181518
    1519 TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction )
     1519const TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) const
    15201520{
    15211521  UInt uiAbsPartIdx       = g_auiZscanToRaster[uiCurrPartUnitIdx];
     
    15641564}
    15651565
    1566 TComDataCU* TComDataCU::getPUBelowLeft(UInt& uiBLPartUnitIdx,  UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction)
     1566const TComDataCU* TComDataCU::getPUBelowLeft(UInt& uiBLPartUnitIdx,  UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) const
    15671567{
    15681568  UInt uiAbsPartIdxLB     = g_auiZscanToRaster[uiCurrPartUnitIdx];
     
    16081608}
    16091609
    1610 TComDataCU* TComDataCU::getPUAboveRight(UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction)
     1610const TComDataCU* TComDataCU::getPUAboveRight(UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) const
    16111611{
    16121612  UInt uiAbsPartIdxRT     = g_auiZscanToRaster[uiCurrPartUnitIdx];
     
    16681668*\returns TComDataCU*   point of TComDataCU of left QpMinCu
    16691669*/
    1670 TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu )
     1670const TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const
    16711671{
    16721672  const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth();
     
    16951695*\returns TComDataCU*   point of TComDataCU of above QpMinCu
    16961696*/
    1697 TComDataCU* TComDataCU::getQpMinCuAbove( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu )
     1697const TComDataCU* TComDataCU::getQpMinCuAbove( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const
    16981698{
    16991699  const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth();
     
    17211721/** Get reference QP from left QpMinCu or latest coded QP
    17221722*\param   uiCurrAbsIdxInCtu
    1723 *\returns Char   reference QP value
     1723*\returns SChar   reference QP value
    17241724*/
    1725 Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInCtu )
     1725SChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInCtu ) const
    17261726{
    17271727  UInt lPartIdx = MAX_UINT;
    17281728  UInt aPartIdx = MAX_UINT;
    1729   TComDataCU* cULeft  = getQpMinCuLeft ( lPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );
    1730   TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );
     1729  const TComDataCU* cULeft  = getQpMinCuLeft ( lPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );
     1730  const TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );
    17311731  return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInCtu )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInCtu )) + 1) >> 1);
    17321732}
    17331733
    1734 Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx )
     1734Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) const
    17351735{
    17361736  Int iLastValidPartIdx = iAbsPartIdx-1;
     
    17441744}
    17451745
    1746 Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx )
     1746SChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) const
    17471747{
    17481748  UInt uiQUPartIdxMask = ~((1<<((getSlice()->getSPS()->getMaxTotalCUDepth() - getSlice()->getPPS()->getMaxCuDQPDepth())<<1))-1);
     
    17841784 * \returns true if the CU is coded in lossless coding mode; false if otherwise
    17851785 */
    1786 Bool TComDataCU::isLosslessCoded(UInt absPartIdx)
     1786Bool TComDataCU::isLosslessCoded(UInt absPartIdx) const
    17871787{
    17881788  return (getSlice()->getPPS()->getTransquantBypassEnableFlag() && getCUTransquantBypass (absPartIdx));
     
    17961796*\param   [out] uiModeList pointer to chroma intra modes array
    17971797*/
    1798 Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt uiModeList[NUM_CHROMA_MODE] )
     1798Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt uiModeList[NUM_CHROMA_MODE] ) const
    17991799{
    18001800  uiModeList[0] = PLANAR_IDX;
     
    18241824*\returns Number of MPM
    18251825*/
    1826 Void TComDataCU::getIntraDirPredictor( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode  )
    1827 {
    1828   TComDataCU* pcCULeft, *pcCUAbove;
     1826Void TComDataCU::getIntraDirPredictor( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode ) const
     1827{
    18291828  UInt        LeftPartIdx  = MAX_UINT;
    18301829  UInt        AbovePartIdx = MAX_UINT;
     
    18361835  const ChromaFormat chForm = getPic()->getChromaFormat();
    18371836  // Get intra direction of left PU
    1838   pcCULeft = getPULeft( LeftPartIdx, m_absZIdxInCtu + uiAbsPartIdx );
     1837  const TComDataCU *pcCULeft = getPULeft( LeftPartIdx, m_absZIdxInCtu + uiAbsPartIdx );
    18391838
    18401839  if (isChroma(compID))
     
    18481847
    18491848  // Get intra direction of above PU
    1850   pcCUAbove = getPUAbove( AbovePartIdx, m_absZIdxInCtu + uiAbsPartIdx, true, true );
     1849  const TComDataCU *pcCUAbove = getPUAbove( AbovePartIdx, m_absZIdxInCtu + uiAbsPartIdx, true, true );
    18511850
    18521851  if (isChroma(compID))
     
    19171916}
    19181917
    1919 UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth )
    1920 {
    1921   TComDataCU* pcTempCU;
     1918UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) const
     1919{
     1920  const TComDataCU* pcTempCU;
    19221921  UInt        uiTempPartIdx;
    19231922  UInt        uiCtx;
     
    19331932}
    19341933
    1935 UInt TComDataCU::getCtxQtCbf( TComTU &rTu, const ChannelType chType )
     1934UInt TComDataCU::getCtxQtCbf( TComTU &rTu, const ChannelType chType ) const
    19361935{
    19371936  const UInt transformDepth = rTu.GetTransformDepthRel();
     
    19481947}
    19491948
    1950 UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx )
     1949UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) const
    19511950{
    19521951  UInt log2CbSize = g_aucConvertToBit[getWidth( absPartIdx )] + 2;
     
    19751974}
    19761975
    1977 UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx )
    1978 {
    1979   TComDataCU* pcTempCU;
     1976UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) const
     1977{
     1978  const TComDataCU* pcTempCU;
    19801979  UInt        uiTempPartIdx;
    19811980  UInt        uiCtx = 0;
     
    19941993UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx )
    19951994{
    1996   TComDataCU* pcTempCU;
     1995  const TComDataCU* pcTempCU;
    19971996  UInt        uiTempPartIdx;
    19981997  UInt        uiCtx = 0;
    1999  
     1998
    20001999  pcTempCU = getPULeft( uiTempPartIdx, m_absZIdxInCtu + uiAbsPartIdx );
    20012000  uiCtx    = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0;
    2002     return uiCtx;
     2001  return uiCtx;
    20032002}
    20042003#endif
     
    20862085
    20872086
    2088 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx )
     2087UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) const
    20892088{
    20902089  return getDepth( uiAbsPartIdx );
     
    20922091
    20932092
    2094 UChar TComDataCU::getQtRootCbf( UInt uiIdx )
     2093UChar TComDataCU::getQtRootCbf( UInt uiIdx ) const
    20952094{
    20962095  const UInt numberValidComponents = getPic()->getNumberValidComponents();
     
    21482147}
    21492148
    2150 Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth)
     2149Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) const
    21512150{
    21522151  UInt uiPartNumb = m_pcPic->getNumPartitionsInCtu() >> (uiDepth << 1);
     
    23762375
    23772376#if NH_3D_VSP
    2378 Void TComDataCU::setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    2379 {
    2380   setSubPart<Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
     2377Void TComDataCU::setVSPFlagSubParts( SChar iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     2378{
     2379  setSubPart<SChar>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
    23812380}
    23822381template<typename T>
     
    25232522Void TComDataCU::setMVPIdxSubParts( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    25242523{
    2525   setSubPart<Char>( iMVPIdx, m_apiMVPIdx[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx );
     2524  setSubPart<SChar>( iMVPIdx, m_apiMVPIdx[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx );
    25262525}
    25272526
    25282527Void TComDataCU::setMVPNumSubParts( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    25292528{
    2530   setSubPart<Char>( iMVPNum, m_apiMVPNum[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx );
     2529  setSubPart<SChar>( iMVPNum, m_apiMVPNum[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx );
    25312530}
    25322531
     
    25612560}
    25622561
    2563 Void TComDataCU::setCrossComponentPredictionAlphaPartRange( Char alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes )
    2564 {
    2565   memset((m_crossComponentPredictionAlpha[compID] + uiAbsPartIdx), alphaValue, (sizeof(Char) * uiCoveredPartIdxes));
     2562Void TComDataCU::setCrossComponentPredictionAlphaPartRange( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes )
     2563{
     2564  memset((m_crossComponentPredictionAlpha[compID] + uiAbsPartIdx), alphaValue, (sizeof(SChar) * uiCoveredPartIdxes));
    25662565}
    25672566
     
    25792578}
    25802579
    2581 UChar TComDataCU::getNumPartitions(const UInt uiAbsPartIdx)
     2580UChar TComDataCU::getNumPartitions(const UInt uiAbsPartIdx) const
    25822581{
    25832582  UChar iNumPart = 0;
     
    26012600// This is for use by a leaf/sub CU object only, with no additional AbsPartIdx
    26022601#if NH_3D_IC || NH_3D_VSP
    2603 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU)
     2602Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) const
    26042603{
    26052604  UInt uiNumPartition  = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition;
     
    26452644#else
    26462645
    2647 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight )
     2646Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight )  const
    26482647{
    26492648  switch ( m_pePartSize[0] )
     
    26862685#endif
    26872686
    2688 
    2689 Void TComDataCU::getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField )
     2687// static member function
     2688Void TComDataCU::getMvField ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField )
    26902689{
    26912690  if ( pcCU == NULL )  // OUT OF BOUNDARY
     
    26962695  }
    26972696
    2698   TComCUMvField*  pcCUMvField = pcCU->getCUMvField( eRefPicList );
     2697  const TComCUMvField*  pcCUMvField = pcCU->getCUMvField( eRefPicList );
    26992698  rcMvField.setMvField( pcCUMvField->getMv( uiAbsPartIdx ), pcCUMvField->getRefIdx( uiAbsPartIdx ) );
    27002699}
    27012700
    2702 Void TComDataCU::deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT )
     2701Void TComDataCU::deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const
    27032702{
    27042703  ruiPartIdxLT = m_absZIdxInCtu + uiAbsPartIdx;
     
    27492748}
    27502749
    2751 Void TComDataCU::deriveLeftBottomIdxGeneral( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB )
     2750Void TComDataCU::deriveLeftBottomIdxGeneral( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const
    27522751{
    27532752  UInt uiPUHeight = 0;
     
    27962795}
    27972796
    2798 Void TComDataCU::deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT )
     2797Void TComDataCU::deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const
    27992798{
    28002799  ruiPartIdxLT = m_absZIdxInCtu;
     
    28362835}
    28372836
    2838 Void TComDataCU::deriveLeftBottomIdx( UInt  uiPartIdx,      UInt&      ruiPartIdxLB )
     2837Void TComDataCU::deriveLeftBottomIdx( UInt  uiPartIdx,      UInt&      ruiPartIdxLB ) const
    28392838{
    28402839  ruiPartIdxLB      = g_auiRasterToZscan [g_auiZscanToRaster[ m_absZIdxInCtu ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInCtuWidth()];
     
    28762875 * \param [out] ruiPartIdxRB  partition index of neighbouring bottom right block
    28772876 */
    2878 Void TComDataCU::deriveRightBottomIdx( UInt uiPartIdx, UInt &ruiPartIdxRB )
     2877Void TComDataCU::deriveRightBottomIdx( UInt uiPartIdx, UInt &ruiPartIdxRB ) const
    28792878{
    28802879  ruiPartIdxRB      = g_auiRasterToZscan [g_auiZscanToRaster[ m_absZIdxInCtu ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInCtuWidth() +  m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1];
     
    29122911}
    29132912
    2914 Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx )
     2913Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const
    29152914{
    29162915  if ( getInterDir( uiAbsPartIdx ) != pcCandCU->getInterDir( uiCandAbsPartIdx ) )
     
    30983097
    30993098
    3100 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     3099#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    31013100  if ( g_traceMergeCandListConst )
    31023101  {
     
    31773176  }
    31783177
    3179 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     3178#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    31803179  if ( g_traceMergeCandListConst )
    31813180  {
     
    33063305  //left
    33073306  UInt uiLeftPartIdx = 0;
    3308   TComDataCU* pcCULeft = 0;
     3307  const TComDataCU* pcCULeft = 0;
    33093308  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 
    33103309
     
    37833782
    37843783//! Construct a list of merging candidates
     3784#if NH_3D
    37853785Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     3786#else
     3787Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) const
     3788#endif
    37863789{
    37873790  UInt uiAbsPartAddr = m_absZIdxInCtu + uiAbsPartIdx;
     
    38113814  //left
    38123815  UInt uiLeftPartIdx = 0;
    3813   TComDataCU* pcCULeft = 0;
    3814   pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
     3816  const TComDataCU *pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
    38153817
    38163818  Bool isAvailableA1 = pcCULeft &&
     
    38283830    puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
    38293831    // get Mv from Left
    3830     pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3832    TComDataCU::getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    38313833    if ( getSlice()->isInterB() )
    38323834    {
    3833       pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3835      TComDataCU::getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    38343836    }
    38353837    if ( mrgCandIdx == iCount )
     
    38473849  // above
    38483850  UInt uiAbovePartIdx = 0;
    3849   TComDataCU* pcCUAbove = 0;
    3850   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
     3851  const TComDataCU *pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
    38513852
    38523853  Bool isAvailableB1 = pcCUAbove &&
     
    38643865    puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
    38653866    // get Mv from Left
    3866     pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3867    TComDataCU::getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    38673868    if ( getSlice()->isInterB() )
    38683869    {
    3869       pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3870      TComDataCU::getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    38703871    }
    38713872    if ( mrgCandIdx == iCount )
     
    38833884  // above right
    38843885  UInt uiAboveRightPartIdx = 0;
    3885   TComDataCU* pcCUAboveRight = 0;
    3886   pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
     3886  const TComDataCU *pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
    38873887
    38883888  Bool isAvailableB0 = pcCUAboveRight &&
     
    38993899    puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx );
    39003900    // get Mv from Left
    3901     pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3901    TComDataCU::getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    39023902    if ( getSlice()->isInterB() )
    39033903    {
    3904       pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3904      TComDataCU::getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    39053905    }
    39063906    if ( mrgCandIdx == iCount )
     
    39183918  //left bottom
    39193919  UInt uiLeftBottomPartIdx = 0;
    3920   TComDataCU* pcCULeftBottom = 0;
    3921   pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
     3920  const TComDataCU *pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
    39223921
    39233922  Bool isAvailableA0 = pcCULeftBottom &&
     
    39343933    puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx );
    39353934    // get Mv from Left
    3936     pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3935    TComDataCU::getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    39373936    if ( getSlice()->isInterB() )
    39383937    {
    3939       pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3938      TComDataCU::getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    39403939    }
    39413940    if ( mrgCandIdx == iCount )
     
    39553954  {
    39563955    UInt uiAboveLeftPartIdx = 0;
    3957     TComDataCU* pcCUAboveLeft = 0;
    3958     pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
     3956    const TComDataCU *pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
    39593957
    39603958    Bool isAvailableB2 = pcCUAboveLeft &&
     
    39723970      puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx );
    39733971      // get Mv from Left
    3974       pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3972      TComDataCU::getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    39753973      if ( getSlice()->isInterB() )
    39763974      {
    3977         pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3975        TComDataCU::getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    39783976      }
    39793977      if ( mrgCandIdx == iCount )
     
    41664164 * \param xP, yP   location of the upper-left corner pixel of the current PU
    41674165 */
    4168 Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP)
     4166Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) const
    41694167{
    41704168
     
    41864184 * \param nPSW, nPSH    size of the current PU
    41874185 */
    4188 Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH)
     4186Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) const
    41894187{
    41904188  UInt col = m_uiCUPelX;
     
    42474245}
    42484246
    4249 /** Constructs a list of candidates for AMVP
     4247/** Constructs a list of candidates for AMVP (See specification, section "Derivation process for motion vector predictor candidates")
    42504248 * \param uiPartIdx
    42514249 * \param uiPartAddr
     
    42544252 * \param pInfo
    42554253 */
    4256 Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo )
    4257 {
    4258   TComMv cMvPred;
    4259   Bool bAddedSmvp = false;
    4260 
     4254Void TComDataCU::fillMvpCand ( const UInt partIdx, const UInt partAddr, const RefPicList eRefPicList, const Int refIdx, AMVPInfo* pInfo ) const
     4255{
    42614256  pInfo->iN = 0;
    4262   if (iRefIdx < 0)
     4257  if (refIdx < 0)
    42634258  {
    42644259    return;
     
    42664261
    42674262  //-- Get Spatial MV
    4268   UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
    4269   const UInt numPartInCtuWidth  = m_pcPic->getNumPartInCtuWidth();
    4270   const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight();
    4271   Bool bAdded = false;
    4272 
    4273   deriveLeftRightTopIdx( uiPartIdx, uiPartIdxLT, uiPartIdxRT );
    4274   deriveLeftBottomIdx( uiPartIdx, uiPartIdxLB );
    4275 
    4276   TComDataCU* tmpCU = NULL;
    4277   UInt idx;
    4278   tmpCU = getPUBelowLeft(idx, uiPartIdxLB);
    4279   bAddedSmvp = (tmpCU != NULL) && (tmpCU->isInter(idx));
    4280 
    4281   if (!bAddedSmvp)
    4282   {
    4283     tmpCU = getPULeft(idx, uiPartIdxLB);
    4284     bAddedSmvp = (tmpCU != NULL) && (tmpCU->isInter(idx));
     4263  UInt partIdxLT, partIdxRT, partIdxLB;
     4264  deriveLeftRightTopIdx( partIdx, partIdxLT, partIdxRT );
     4265  deriveLeftBottomIdx( partIdx, partIdxLB );
     4266
     4267  Bool isScaledFlagLX = false; /// variable name from specification; true when the PUs below left or left are available (availableA0 || availableA1).
     4268  {
     4269    UInt idx;
     4270    const TComDataCU* tmpCU = getPUBelowLeft(idx, partIdxLB);
     4271    isScaledFlagLX = (tmpCU != NULL) && (tmpCU->isInter(idx));
     4272    if (!isScaledFlagLX)
     4273    {
     4274      tmpCU = getPULeft(idx, partIdxLB);
     4275      isScaledFlagLX = (tmpCU != NULL) && (tmpCU->isInter(idx));
     4276    }
    42854277  }
    42864278
    42874279  // Left predictor search
    4288   bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT);
    4289   if (!bAdded)
    4290   {
    4291     bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT );
    4292   }
    4293 
    4294   if(!bAdded)
    4295   {
    4296     bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT);
     4280  if (isScaledFlagLX)
     4281  {
     4282    Bool bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLB, MD_BELOW_LEFT);
    42974283    if (!bAdded)
    42984284    {
    4299       xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT );
     4285      bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLB, MD_LEFT );
     4286      if(!bAdded)
     4287      {
     4288        bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLB, MD_BELOW_LEFT);
     4289        if (!bAdded)
     4290        {
     4291          xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLB, MD_LEFT );
     4292        }
     4293      }
    43004294    }
    43014295  }
    43024296
    43034297  // Above predictor search
    4304   bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT);
    4305 
    4306   if (!bAdded)
    4307   {
    4308     bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE);
    4309   }
    4310 
    4311   if(!bAdded)
    4312   {
    4313     xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
    4314   }
    4315 
    4316   if(!bAddedSmvp)
    4317   {
    4318     bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT);
     4298  {
     4299    Bool bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE_RIGHT);
    43194300    if (!bAdded)
    43204301    {
    4321       bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE);
    4322     }
    4323 
    4324     if(!bAdded)
    4325     {
    4326       xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
     4302      bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE);
     4303      if(!bAdded)
     4304      {
     4305        xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLT, MD_ABOVE_LEFT);
     4306      }
     4307    }
     4308  }
     4309
     4310  if(!isScaledFlagLX)
     4311  {
     4312    Bool bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE_RIGHT);
     4313    if (!bAdded)
     4314    {
     4315      bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE);
     4316      if(!bAdded)
     4317      {
     4318        xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLT, MD_ABOVE_LEFT);
     4319      }
    43274320    }
    43284321  }
     
    43364329  }
    43374330
    4338   if ( getSlice()->getEnableTMVPFlag() )
     4331  if (pInfo->iN < AMVP_MAX_NUM_CANDS && getSlice()->getEnableTMVPFlag() )
    43394332  {
    43404333    // Get Temporal Motion Predictor
    4341     Int iRefIdx_Col = iRefIdx;
     4334    const UInt numPartInCtuWidth  = m_pcPic->getNumPartInCtuWidth();
     4335    const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight();
     4336#if NH_3D_TMVP
     4337    Int refIdx_Col = refIdx;
     4338#else
     4339    const Int refIdx_Col = refIdx;
     4340#endif
    43424341    TComMv cColMv;
    4343     UInt uiPartIdxRB;
    4344     UInt uiAbsPartIdx;
    4345     UInt uiAbsPartAddr;
    4346 
    4347     deriveRightBottomIdx( uiPartIdx, uiPartIdxRB );
    4348     uiAbsPartAddr = m_absZIdxInCtu + uiPartAddr;
     4342    UInt partIdxRB;
     4343    UInt absPartIdx;
     4344
     4345    deriveRightBottomIdx( partIdx, partIdxRB );
     4346    UInt absPartAddr = m_absZIdxInCtu + partAddr;
    43494347
    43504348    //----  co-located RightBottom Temporal Predictor (H) ---//
    4351     uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB];
     4349    absPartIdx = g_auiZscanToRaster[partIdxRB];
    43524350    Int ctuRsAddr = -1;
    4353     if (  ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () )  // image boundary check
    4354        && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
    4355     {
    4356       if ( ( uiAbsPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) &&  // is not at the last column of CTU
    4357            ( uiAbsPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) )  // is not at the last row    of CTU
    4358       {
    4359         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + numPartInCtuWidth + 1 ];
     4351    if (  ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[absPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () )  // image boundary check
     4352      && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[absPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     4353    {
     4354      if ( ( absPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) &&  // is not at the last column of CTU
     4355        ( absPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) )  // is not at the last row    of CTU
     4356      {
     4357        absPartAddr = g_auiRasterToZscan[ absPartIdx + numPartInCtuWidth + 1 ];
    43604358        ctuRsAddr = getCtuRsAddr();
    43614359      }
    4362       else if ( uiAbsPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 )  // is not at the last column of CTU But is last row of CTU
    4363       {
    4364         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ];
    4365       }
    4366       else if ( uiAbsPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) // is not at the last row of CTU But is last column of CTU
    4367       {
    4368         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + 1 ];
     4360      else if ( absPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 )  // is not at the last column of CTU But is last row of CTU
     4361      {
     4362        absPartAddr = g_auiRasterToZscan[ (absPartIdx + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ];
     4363      }
     4364      else if ( absPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) // is not at the last row of CTU But is last column of CTU
     4365      {
     4366        absPartAddr = g_auiRasterToZscan[ absPartIdx + 1 ];
    43694367        ctuRsAddr = getCtuRsAddr() + 1;
    43704368      }
    43714369      else //is the right bottom corner of CTU
    43724370      {
    4373         uiAbsPartAddr = 0;
    4374       }
    4375     }
    4376     if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx_Col
     4371        absPartAddr = 0;
     4372      }
     4373    }
    43774374#if NH_3D_TMVP
    4378          , 0
    4379 #endif
    4380  ) )
     4375        if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, absPartAddr, cColMv, refIdx_Col  , 0 ) )
     4376#else
     4377    if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, absPartAddr, cColMv, refIdx_Col ) )
     4378#endif
    43814379    {
    43824380      pInfo->m_acMvCand[pInfo->iN++] = cColMv;
     
    43854383    {
    43864384      UInt uiPartIdxCenter;
    4387       xDeriveCenterIdx( uiPartIdx, uiPartIdxCenter );
    4388       if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter,  cColMv, iRefIdx_Col
     4385      xDeriveCenterIdx( partIdx, uiPartIdxCenter );
    43894386#if NH_3D_TMVP
    4390          , 0
    4391 #endif
    4392 ))
     4387      if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter,  cColMv, refIdx_Col , 0 ))
     4388#else
     4389      if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter,  cColMv, refIdx_Col ))
     4390#endif
    43934391      {
    43944392        pInfo->m_acMvCand[pInfo->iN++] = cColMv;
     
    43964394    }
    43974395    //----  co-located RightBottom Temporal Predictor  ---//
    4398   }
    4399 
    4400   if (pInfo->iN > AMVP_MAX_NUM_CANDS)
    4401   {
    4402     pInfo->iN = AMVP_MAX_NUM_CANDS;
    44034396  }
    44044397
     
    44124405
    44134406
    4414 Bool TComDataCU::isBipredRestriction(UInt puIdx)
     4407Bool TComDataCU::isBipredRestriction(UInt puIdx) const
    44154408{
    44164409  Int width = 0;
     
    44344427
    44354428
    4436 Void TComDataCU::clipMv    (TComMv&  rcMv)
     4429Void TComDataCU::clipMv    (TComMv&  rcMv) const
    44374430{
    44384431  const TComSPS &sps=*(m_pcSlice->getSPS());
     
    44704463#endif
    44714464
    4472 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx)
     4465UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) const
    44734466{
    44744467  UInt uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 );
     
    45074500 * \returns true if the current the block is skipped
    45084501 */
    4509 Bool TComDataCU::isSkipped( UInt uiPartIdx )
     4502Bool TComDataCU::isSkipped( UInt uiPartIdx ) const
    45104503{
    45114504  return ( getSkipFlag( uiPartIdx ) );
     
    45164509// ====================================================================================================================
    45174510
    4518 Bool TComDataCU::xAddMVPCand( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir )
    4519 {
    4520   TComDataCU* pcTmpCU = NULL;
    4521   UInt uiIdx;
     4511Bool TComDataCU::xAddMVPCandUnscaled( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const
     4512{
     4513  const TComDataCU* neibCU = NULL;
     4514  UInt neibPUPartIdx;
    45224515  switch( eDir )
    45234516  {
    45244517    case MD_LEFT:
    45254518    {
    4526       pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);
     4519      neibCU = getPULeft(neibPUPartIdx, uiPartUnitIdx);
    45274520      break;
    45284521    }
    45294522    case MD_ABOVE:
    45304523    {
    4531       pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx);
     4524      neibCU = getPUAbove(neibPUPartIdx, uiPartUnitIdx);
    45324525      break;
    45334526    }
    45344527    case MD_ABOVE_RIGHT:
    45354528    {
    4536       pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx);
     4529      neibCU = getPUAboveRight(neibPUPartIdx, uiPartUnitIdx);
    45374530      break;
    45384531    }
    45394532    case MD_BELOW_LEFT:
    45404533    {
    4541       pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);
     4534      neibCU = getPUBelowLeft(neibPUPartIdx, uiPartUnitIdx);
    45424535      break;
    45434536    }
    45444537    case MD_ABOVE_LEFT:
    45454538    {
    4546       pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx);
     4539      neibCU = getPUAboveLeft(neibPUPartIdx, uiPartUnitIdx);
    45474540      break;
    45484541    }
     
    45534546  }
    45544547
    4555   if ( pcTmpCU == NULL )
     4548  if ( neibCU == NULL )
    45564549  {
    45574550    return false;
    45584551  }
    45594552
    4560   if ( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC() == pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ))
    4561   {
    4562     TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    4563 
    4564     pInfo->m_acMvCand[ pInfo->iN++] = cMvPred;
    4565     return true;
    4566   }
    4567 
    4568   RefPicList eRefPicList2nd = REF_PIC_LIST_0;
    4569   if(       eRefPicList == REF_PIC_LIST_0 )
    4570   {
    4571     eRefPicList2nd = REF_PIC_LIST_1;
    4572   }
    4573   else if ( eRefPicList == REF_PIC_LIST_1)
    4574   {
    4575     eRefPicList2nd = REF_PIC_LIST_0;
    4576   }
    4577 
    4578 
    4579   Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC();
    4580   Int iNeibRefPOC;
    4581 
    4582 
    4583   if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0 )
    4584   {
    4585     iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) );
    4586     if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List//
    4587     {
    4588       TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
    4589       pInfo->m_acMvCand[ pInfo->iN++] = cMvPred;
     4553  const Int        currRefPOC     = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC();
     4554  const RefPicList eRefPicList2nd = (eRefPicList == REF_PIC_LIST_0) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     4555
     4556  for(Int predictorSource=0; predictorSource<2; predictorSource++) // examine the indicated reference picture list, then if not available, examine the other list.
     4557  {
     4558    const RefPicList eRefPicListIndex = (predictorSource==0) ? eRefPicList : eRefPicList2nd;
     4559    const Int        neibRefIdx       = neibCU->getCUMvField(eRefPicListIndex)->getRefIdx(neibPUPartIdx);
     4560
     4561    if ( neibRefIdx >= 0 && currRefPOC == neibCU->getSlice()->getRefPOC( eRefPicListIndex, neibRefIdx ))
     4562    {
     4563      info.m_acMvCand[info.iN++] = neibCU->getCUMvField(eRefPicListIndex)->getMv(neibPUPartIdx);
    45904564      return true;
    45914565    }
     
    46024576 * \returns Bool
    46034577 */
    4604 Bool TComDataCU::xAddMVPCandOrder( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir )
    4605 {
    4606   TComDataCU* pcTmpCU = NULL;
    4607   UInt uiIdx;
     4578Bool TComDataCU::xAddMVPCandWithScaling( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const
     4579{
     4580  const TComDataCU* neibCU = NULL;
     4581  UInt neibPUPartIdx;
    46084582  switch( eDir )
    46094583  {
    46104584  case MD_LEFT:
    46114585    {
    4612       pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);
     4586      neibCU = getPULeft(neibPUPartIdx, uiPartUnitIdx);
    46134587      break;
    46144588    }
    46154589  case MD_ABOVE:
    46164590    {
    4617       pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx);
     4591      neibCU = getPUAbove(neibPUPartIdx, uiPartUnitIdx);
    46184592      break;
    46194593    }
    46204594  case MD_ABOVE_RIGHT:
    46214595    {
    4622       pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx);
     4596      neibCU = getPUAboveRight(neibPUPartIdx, uiPartUnitIdx);
    46234597      break;
    46244598    }
    46254599  case MD_BELOW_LEFT:
    46264600    {
    4627       pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);
     4601      neibCU = getPUBelowLeft(neibPUPartIdx, uiPartUnitIdx);
    46284602      break;
    46294603    }
    46304604  case MD_ABOVE_LEFT:
    46314605    {
    4632       pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx);
     4606      neibCU = getPUAboveLeft(neibPUPartIdx, uiPartUnitIdx);
    46334607      break;
    46344608    }
     
    46394613  }
    46404614
    4641   if ( pcTmpCU == NULL )
     4615  if ( neibCU == NULL )
    46424616  {
    46434617    return false;
    46444618  }
    46454619
    4646   RefPicList eRefPicList2nd = REF_PIC_LIST_0;
    4647   if(       eRefPicList == REF_PIC_LIST_0 )
    4648   {
    4649     eRefPicList2nd = REF_PIC_LIST_1;
    4650   }
    4651   else if ( eRefPicList == REF_PIC_LIST_1)
    4652   {
    4653     eRefPicList2nd = REF_PIC_LIST_0;
    4654   }
    4655 
    4656   Int iCurrPOC = m_pcSlice->getPOC();
    4657   Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC();
    4658   Int iNeibPOC = iCurrPOC;
    4659   Int iNeibRefPOC;
    4660   Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm();
    4661   Bool bIsNeibRefLongTerm = false;
    4662 
    4663   //---------------  V1 (END) ------------------//
    4664   if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0)
    4665   {
    4666     iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) );
    4667     TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    4668     TComMv rcMv;
    4669 
    4670     bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) )->getIsLongTerm();
    4671     if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm )
    4672     {
    4673       if ( bIsCurrRefLongTerm || bIsNeibRefLongTerm )
    4674       {
    4675         rcMv = cMvPred;
    4676       }
    4677       else
    4678       {
    4679         Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
    4680         if ( iScale == 4096 )
     4620  const RefPicList eRefPicList2nd = (eRefPicList == REF_PIC_LIST_0) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     4621
     4622  const Int  currPOC            = m_pcSlice->getPOC();
     4623  const Int  currRefPOC         = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC();
     4624  const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm();
     4625  const Int  neibPOC            = currPOC;
     4626
     4627  for(Int predictorSource=0; predictorSource<2; predictorSource++) // examine the indicated reference picture list, then if not available, examine the other list.
     4628  {
     4629    const RefPicList eRefPicListIndex = (predictorSource==0) ? eRefPicList : eRefPicList2nd;
     4630    const Int        neibRefIdx       = neibCU->getCUMvField(eRefPicListIndex)->getRefIdx(neibPUPartIdx);
     4631    if( neibRefIdx >= 0)
     4632    {
     4633      const Bool bIsNeibRefLongTerm = neibCU->getSlice()->getRefPic( eRefPicListIndex, neibRefIdx )->getIsLongTerm();
     4634
     4635      if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm )
     4636      {
     4637        const TComMv &cMvPred = neibCU->getCUMvField(eRefPicListIndex)->getMv(neibPUPartIdx);
     4638        TComMv rcMv;
     4639        if ( bIsCurrRefLongTerm /* || bIsNeibRefLongTerm*/ )
    46814640        {
    46824641          rcMv = cMvPred;
     
    46844643        else
    46854644        {
    4686           rcMv = cMvPred.scaleMv( iScale );
     4645          const Int neibRefPOC = neibCU->getSlice()->getRefPOC( eRefPicListIndex, neibRefIdx );
     4646          const Int scale      = xGetDistScaleFactor( currPOC, currRefPOC, neibPOC, neibRefPOC );
     4647          if ( scale == 4096 )
     4648          {
     4649            rcMv = cMvPred;
     4650          }
     4651          else
     4652          {
     4653            rcMv = cMvPred.scaleMv( scale );
     4654          }
    46874655        }
    4688       }
    4689 
    4690       pInfo->m_acMvCand[ pInfo->iN++] = rcMv;
    4691       return true;
    4692     }
    4693   }
    4694   //---------------------- V2(END) --------------------//
    4695   if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0)
    4696   {
    4697     iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) );
    4698     TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
    4699     TComMv rcMv;
    4700 
    4701     bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) )->getIsLongTerm();
    4702     if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm )
    4703     {
    4704       if ( bIsCurrRefLongTerm || bIsNeibRefLongTerm )
    4705       {
    4706         rcMv = cMvPred;
    4707       }
    4708       else
    4709       {
    4710         Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
    4711         if ( iScale == 4096 )
    4712         {
    4713           rcMv = cMvPred;
    4714         }
    4715         else
    4716         {
    4717           rcMv = cMvPred.scaleMv( iScale );
    4718         }
    4719       }
    4720 
    4721       pInfo->m_acMvCand[ pInfo->iN++] = rcMv;
    4722       return true;
    4723     }
    4724   }
    4725   //---------------------- V3(END) --------------------//
     4656
     4657        info.m_acMvCand[info.iN++] = rcMv;
     4658        return true;
     4659      }
     4660    }
     4661  }
    47264662  return false;
    47274663}
    47284664
    4729 Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
    47304665#if NH_3D_TMVP
    4731   , Bool bMRG
    4732 #endif
    4733 )
    4734 {
    4735   UInt uiAbsPartAddr = uiPartUnitIdx;
    4736 
    4737   RefPicList  eColRefPicList;
    4738   Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale;
    4739   TComMv cColMv;
     4666Bool TComDataCU::xGetColMVP( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG  ) const
     4667#else
     4668Bool TComDataCU::xGetColMVP( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const
     4669#endif
     4670{
     4671  const UInt absPartAddr = partUnitIdx;
    47404672
    47414673  // use coldir.
    4742   TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
    4743   TComDataCU *pColCtu = pColPic->getCtu( ctuRsAddr );
    4744   if(pColCtu->getPic()==0||pColCtu->getPartitionSize(uiPartUnitIdx)==NUMBER_OF_PART_SIZES)
     4674  const TComPic    * const pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
     4675  const TComDataCU * const pColCtu = pColPic->getCtu( ctuRsAddr );
     4676  if(pColCtu->getPic()==0 || pColCtu->getPartitionSize(partUnitIdx)==NUMBER_OF_PART_SIZES)
    47454677  {
    47464678    return false;
    47474679  }
    4748   iCurrPOC = m_pcSlice->getPOC();
    4749   iColPOC = pColCtu->getSlice()->getPOC();
    4750 
    4751   if (!pColCtu->isInter(uiAbsPartAddr))
     4680
     4681  if (!pColCtu->isInter(absPartAddr))
    47524682  {
    47534683    return false;
    47544684  }
    47554685
    4756   eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag());
    4757 
    4758   Int iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr);
     4686  RefPicList eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag());
     4687  Int iColRefIdx            = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr);
    47594688
    47604689  if (iColRefIdx < 0 )
    47614690  {
    47624691    eColRefPicList = RefPicList(1 - eColRefPicList);
    4763     iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr);
     4692    iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr);
    47644693
    47654694    if (iColRefIdx < 0 )
     
    47694698  }
    47704699
    4771   // Scale the vector.
    4772   iColRefPOC = pColCtu->getSlice()->getRefPOC(eColRefPicList, iColRefIdx);
    4773   cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
    4774 
    4775   iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
    4776 
    4777   Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm();
    4778   Bool bIsColRefLongTerm = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx);
     4700#if NH_3D_TMVP
     4701  Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm();
     4702#else
     4703  const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm();
     4704#endif
     4705  const Bool bIsColRefLongTerm  = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx);
    47794706
    47804707  if ( bIsCurrRefLongTerm != bIsColRefLongTerm )
     
    47844711    if(bMRG && iAlterRefIdx > 0)
    47854712    {
    4786       riRefIdx = iAlterRefIdx;
    4787       bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm();
    4788       iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
     4713      refIdx = iAlterRefIdx;
     4714      bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm();
    47894715      assert(bIsCurrRefLongTerm == bIsColRefLongTerm);
    47904716    }
     
    47924718    {
    47934719#endif
    4794     return false;
     4720      return false;
    47954721#if NH_3D_TMVP
    47964722    }
    47974723#endif
    47984724  }
    4799 
     4725  // Scale the vector.
     4726  const TComMv &cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(absPartAddr);
     4727
     4728#if NH_3D_TMVP
    48004729  if ( bIsCurrRefLongTerm || bIsColRefLongTerm )
     4730#else
     4731  if ( bIsCurrRefLongTerm /*|| bIsColRefLongTerm*/ )
     4732#endif
    48014733  {
    48024734#if NH_3D_TMVP
    4803     Int iCurrViewId    = m_pcSlice->getViewId ();
    4804     Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId ();
    4805     Int iColViewId     = pColCtu->getSlice()->getViewId();
    4806     Int iColRefViewId  = pColCtu->getSlice()->getRefPic( eColRefPicList, pColCtu->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewId();
    4807     iScale = 4096;
     4735    const Int iCurrViewId    = m_pcSlice->getViewId ();
     4736    const Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, refIdx)->getViewId ();
     4737    const Int iColViewId     = pColCtu->getSlice()->getViewId();
     4738    const Int iColRefViewId  = pColCtu->getSlice()->getRefPic( eColRefPicList, pColCtu->getCUMvField(eColRefPicList)->getRefIdx(absPartAddr))->getViewId();
     4739    Int scale = 4096;
    48084740    if ( iCurrRefViewId != iCurrViewId && iColViewId != iColRefViewId )
    48094741    {
    4810       iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
    4811     }
    4812     if ( bMRG && iScale != 4096 && m_pcSlice->getIvMvScalingFlag( ) )
    4813     {
    4814       rcMv = cColMv.scaleMv( iScale );
     4742      scale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
     4743    }
     4744    if ( bMRG && scale != 4096 && m_pcSlice->getIvMvScalingFlag( ) )
     4745    {
     4746      rcMv = cColMv.scaleMv( scale );
    48154747    }
    48164748    else
    48174749    {
    48184750#endif
    4819     rcMv = cColMv;
     4751      rcMv = cColMv;
    48204752#if NH_3D_TMVP
    48214753    }
     
    48244756  else
    48254757  {
    4826     iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
    4827     if ( iScale == 4096 )
     4758    const Int currPOC    = m_pcSlice->getPOC();
     4759    const Int colPOC     = pColCtu->getSlice()->getPOC();
     4760    const Int colRefPOC  = pColCtu->getSlice()->getRefPOC(eColRefPicList, iColRefIdx);
     4761    const Int currRefPOC = m_pcSlice->getRefPic(eRefPicList, refIdx)->getPOC();
     4762    const Int scale      = xGetDistScaleFactor(currPOC, currRefPOC, colPOC, colRefPOC);
     4763    if ( scale == 4096 )
    48284764    {
    48294765      rcMv = cColMv;
     
    48314767    else
    48324768    {
    4833       rcMv = cColMv.scaleMv( iScale );
     4769      rcMv = cColMv.scaleMv( scale );
    48344770    }
    48354771  }
     
    48384774}
    48394775
     4776// Static member
    48404777Int TComDataCU::xGetDistScaleFactor(Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC)
    48414778{
     
    48574794}
    48584795
    4859 Void TComDataCU::xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter )
     4796Void TComDataCU::xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const
    48604797{
    48614798  UInt uiPartAddr;
     
    50014938 
    50024939  UInt uiMidPart, uiPartNeighbor; 
    5003   TComDataCU* pcCUNeighbor;
     4940  const TComDataCU* pcCUNeighbor;
    50044941  Bool bDepAvail = false;
    50054942  Pel *pDepth  = this->getPic()->getPicYuvRec()->getAddr(COMPONENT_Y);
     
    51335070#if NH_3D_NBDV_REF
    51345071        TComPic* picDepth = NULL;   
    5135 #if H_3D_FCO_VSP_DONBDV_E0163
     5072#if H_3D_FCO
    51365073        picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
    51375074        if ( picDepth->getPicYuvRec() != NULL  ) 
     
    51615098  UInt uiIdx = 0;
    51625099  Bool        bCheckMcpDv = false;   
    5163   TComDataCU* pcTmpCU     = NULL;
     5100  const TComDataCU* pcTmpCU     = NULL;
    51645101
    51655102  //// ******* Get disparity from left block ******* /////
     5103#if NH_3D_FIX_TICKET_91
     5104    pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
     5105#else
    51665106  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
     5107#endif
    51675108  bCheckMcpDv = true;
    51685109  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFT
     
    51995140          pDInfo->m_aVIdxCan = cIDVInfo.m_aVIdxCan[iList][ curPos ];
    52005141#if NH_3D_NBDV_REF
    5201 #if H_3D_FCO_VSP_DONBDV_E0163
     5142#if H_3D_FCO
    52025143          TComPic* picDepth  = NULL;
    52035144
     
    52385179#if NH_3D_NBDV_REF
    52395180    TComPic* picDepth = NULL;
    5240 #if H_3D_FCO_VSP_DONBDV_E0163
     5181#if H_3D_FCO
    52415182    picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
    52425183    if ( picDepth->getPicYuvRec() != NULL ) 
     
    53075248
    53085249
    5309 Bool TComDataCU::xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paIDVInfo, UInt uiMvpDvPos
     5250Bool TComDataCU::xCheckSpatialNBDV( const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paIDVInfo, UInt uiMvpDvPos
    53105251#if NH_3D_NBDV_REF
    53115252, Bool bDepthRefine
     
    53325273          TComPic* picDepth = NULL;
    53335274          assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC());           
    5334 #if H_3D_FCO_VSP_DONBDV_E0163
     5275#if H_3D_FCO
    53355276          picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
    53365277          if ( picDepth->getPicYuvRec() != NULL ) 
     
    54665407    }
    54675408
    5468 #if NH_3D_FIX_NBDV_COL
    54695409    // The picture pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx) might not be in DPB anymore
    54705410    // So don't access it directly.
    54715411    iColRefViewIdx = pColCU->getSlice()->getVPS()->getViewOrderIdx( pColCU->getSlice()->getRefLayerId( eColRefPicList, iColRefIdx ) );       
    5472 #else
    5473     iColRefViewIdx = pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx)->getViewIndex();
    5474 #endif
    54755412
    54765413
     
    60656002  Int depthRefViewIdx = pcCU->getDvInfo(partAddr).m_aVIdxCan;
    60666003 
    6067 #if H_3D_FCO_VSP_DONBDV_E0163
     6004#if H_3D_FCO
    60686005  TComPic* pRefPicBaseDepth = 0;
    60696006  Bool     bIsCurrDepthCoded = false;
     
    61006037  pcCU->clipMv(cDv);
    61016038
    6102 #if H_3D_FCO_VSP_DONBDV_E0163
     6039#if H_3D_FCO
    61036040  if ( bIsCurrDepthCoded )
    61046041  {
  • TabularUnified trunk/source/Lib/TLibCommon/TComDataCU.h

    r1321 r1386  
    112112  UChar*         m_ucDISType;
    113113#endif
    114   Char*          m_pePartSize;         ///< array of partition sizes
    115   Char*          m_pePredMode;         ///< array of prediction modes
    116   Char*          m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values
     114  SChar*          m_pePartSize;         ///< array of partition sizes
     115  SChar*        m_pePredMode;                           ///< array of prediction modes
     116  SChar*        m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values
    117117  Bool*          m_CUTransquantBypass;   ///< array of cu_transquant_bypass flags
    118   Char*          m_phQP;               ///< array of QP values
     118  SChar*        m_phQP;                                 ///< array of QP values
    119119  UChar*         m_ChromaQpAdj;        ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1
    120120  UInt           m_codedChromaQpAdj;
     
    125125  TCoeff*        m_pcTrCoeff[MAX_NUM_COMPONENT];       ///< array of transform coefficient buffers (0->Y, 1->Cb, 2->Cr)
    126126#if ADAPTIVE_QP_SELECTION
    127   TCoeff*        m_pcArlCoeff[MAX_NUM_COMPONENT];  // ARL coefficient buffer (0->Y, 1->Cb, 2->Cr)
     127  TCoeff*       m_pcArlCoeff[MAX_NUM_COMPONENT];        ///< ARL coefficient buffer (0->Y, 1->Cb, 2->Cr)
    128128  Bool           m_ArlCoeffIsAliasedAllocation;  ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
    129129#endif
     
    154154  Bool          m_bIsMergeAMP;
    155155#endif
    156   UChar*        m_puhIntraDir[MAX_NUM_CHANNEL_TYPE]; // 0-> Luma, 1-> Chroma
     156  UChar*        m_puhIntraDir[MAX_NUM_CHANNEL_TYPE];
    157157  UChar*        m_puhInterDir;        ///< array of inter directions
    158   Char*         m_apiMVPIdx[NUM_REF_PIC_LIST_01];       ///< array of motion vector predictor candidates
    159   Char*         m_apiMVPNum[NUM_REF_PIC_LIST_01];       ///< array of number of possible motion vectors predictors
     158  SChar*        m_apiMVPIdx[NUM_REF_PIC_LIST_01];       ///< array of motion vector predictor candidates
     159  SChar*        m_apiMVPNum[NUM_REF_PIC_LIST_01];       ///< array of number of possible motion vectors predictors
    160160  Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
    161161#if NH_3D_NBDV
     
    163163#endif
    164164#if NH_3D_VSP
    165   Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not  ///< 0: non-VSP; 1: VSP
     165  SChar*        m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not  ///< 0: non-VSP; 1: VSP
    166166#endif
    167167#if NH_3D_SPIVMP
     
    208208  UInt          m_uiTotalBits;        ///< sum of partition bits
    209209  UInt          m_uiTotalBins;        ///< sum of partition bins
    210   Char          m_codedQP;
     210  SChar         m_codedQP;
    211211#if NH_3D_MLC
    212212  DisInfo         m_cDefaultDisInfo;    ///< Default disparity information for initializing
     
    219219protected:
    220220
    221   /// add possible motion vector predictor candidates
    222   Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    223   Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
     221  /// adds a single possible motion vector predictor candidate
     222  Bool          xAddMVPCandUnscaled           ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const;
     223  Bool          xAddMVPCandWithScaling        ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const;
     224
    224225#if NH_3D_VSP
    225226  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount);
     
    229230#endif
    230231
    231   Void          deriveRightBottomIdx        ( UInt uiPartIdx, UInt& ruiPartIdxRB );
    232   Bool          xGetColMVP( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
     232  Void          deriveRightBottomIdx          ( UInt uiPartIdx, UInt& ruiPartIdxRB ) const;
     233
    233234#if NH_3D_TMVP
    234   ,  Bool bMRG = true
    235 #endif
    236  );
    237 
     235  Bool          xGetColMVP                    ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG = true  ) const;
     236#else
     237  Bool          xGetColMVP                    ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const;
     238#endif
    238239
    239240  /// compute scaling factor from POC difference
    240241#if !NH_3D_ARP
    241   Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
    242 #endif
    243 
    244   Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter );
     242  static Int    xGetDistScaleFactor           ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
     243#endif
     244  Void          xDeriveCenterIdx              ( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const;
    245245
    246246#if NH_3D_VSP
     
    249249
    250250public:
     251
     252#if NH_3D_ARP
     253  static Int    xGetDistScaleFactor           ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
     254#endif
     255
    251256  TComDataCU();
    252257  virtual ~TComDataCU();
     
    255260  // create / destroy / initialize / copy
    256261  // -------------------------------------------------------------------------------------------------------------------
    257 #if NH_3D_ARP
    258   /// compute scaling factor from POC difference
    259   Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
    260 #endif
    261262  Void          create                ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
    262263#if ADAPTIVE_QP_SELECTION
     
    275276
    276277  Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx );
    277   Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
    278278#if NH_3D_NBDV
    279   , Bool bNBDV = false
    280 #endif
    281 );
     279    Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, Bool bNBDV = false );
     280#else
     281  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList );
     282#endif
    282283  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
    283284
     
    315316  // -------------------------------------------------------------------------------------------------------------------
    316317
    317   Char*         getPartitionSize      ()                        { return m_pePartSize;        }
    318   PartSize      getPartitionSize      ( UInt uiIdx )            { return static_cast<PartSize>( m_pePartSize[uiIdx] ); }
     318  SChar*        getPartitionSize              ( )                                                          { return m_pePartSize;                       }
     319  PartSize      getPartitionSize              ( UInt uiIdx ) const                                         { return static_cast<PartSize>( m_pePartSize[uiIdx] ); }
    319320  Void          setPartitionSize      ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh;   }
    320321  Void          setPartSizeSubParts   ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth );
     
    326327 
    327328  Bool*         getSkipFlag            ()                        { return m_skipFlag;          }
    328   Bool          getSkipFlag            (UInt idx)                { return m_skipFlag[idx];     }
     329  Bool          getSkipFlag                   ( UInt idx ) const                                           { return m_skipFlag[idx];                    }
    329330  Void          setSkipFlag           ( UInt idx, Bool skip)     { m_skipFlag[idx] = skip;   }
    330331  Void          setSkipFlagSubParts   ( Bool skip, UInt absPartIdx, UInt depth );
     
    340341  Void         setDISTypeSubParts    ( UChar ucDISType, UInt uiAbsPartIdx, UInt uiDepth );
    341342#endif
    342   Char*         getPredictionMode     ()                        { return m_pePredMode;        }
    343   PredMode      getPredictionMode     ( UInt uiIdx )            { return static_cast<PredMode>( m_pePredMode[uiIdx] ); }
     343  SChar*        getPredictionMode             ( )                                                          { return m_pePredMode;                       }
     344  PredMode      getPredictionMode             ( UInt uiIdx ) const                                         { return static_cast<PredMode>( m_pePredMode[uiIdx] ); }
    344345  Void          setPredictionMode     ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;   }
    345346  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
    346347
    347348#if NH_3D_DBBP
    348   Bool*         getDBBPFlag           ()                        { return m_pbDBBPFlag;               }
    349   Bool          getDBBPFlag           ( UInt uiIdx )            { return m_pbDBBPFlag[uiIdx];        }
     349  Bool*         getDBBPFlag           ()                        const { return m_pbDBBPFlag;               }
     350  Bool          getDBBPFlag           ( UInt uiIdx )            const { return m_pbDBBPFlag[uiIdx];        }
    350351  Void          setDBBPFlag           ( UInt uiIdx, Bool b )    { m_pbDBBPFlag[uiIdx] = b;           }
    351352  Void          setDBBPFlagSubParts   ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     
    353354#endif
    354355
    355   Char*         getCrossComponentPredictionAlpha( ComponentID compID )             { return m_crossComponentPredictionAlpha[compID];         }
    356   Char          getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID ) { return m_crossComponentPredictionAlpha[compID][uiIdx]; }
     356  SChar*        getCrossComponentPredictionAlpha( ComponentID compID )                                     { return m_crossComponentPredictionAlpha[compID];        }
     357  SChar         getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID )                         { return m_crossComponentPredictionAlpha[compID][uiIdx]; }
    357358
    358359  Bool*         getCUTransquantBypass ()                        { return m_CUTransquantBypass;        }
    359   Bool          getCUTransquantBypass( UInt uiIdx )             { return m_CUTransquantBypass[uiIdx]; }
     360  Bool          getCUTransquantBypass         ( UInt uiIdx ) const                                         { return m_CUTransquantBypass[uiIdx];        }
    360361
    361362  UChar*        getWidth              ()                        { return m_puhWidth;          }
    362   UChar         getWidth              ( UInt uiIdx )            { return m_puhWidth[uiIdx];   }
     363  UChar         getWidth                      ( UInt uiIdx ) const                                         { return m_puhWidth[uiIdx];                  }
    363364  Void          setWidth              ( UInt uiIdx, UChar  uh ) { m_puhWidth[uiIdx] = uh;     }
    364365
    365366  UChar*        getHeight             ()                        { return m_puhHeight;         }
    366   UChar         getHeight             ( UInt uiIdx )            { return m_puhHeight[uiIdx];  }
     367  UChar         getHeight                     ( UInt uiIdx ) const                                         { return m_puhHeight[uiIdx];                 }
    367368  Void          setHeight             ( UInt uiIdx, UChar  uh ) { m_puhHeight[uiIdx] = uh;    }
    368369
    369370  Void          setSizeSubParts       ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );
    370371
    371   Char*         getQP                 ()                        { return m_phQP;              }
    372   Char          getQP                 ( UInt uiIdx ) const      { return m_phQP[uiIdx];       }
    373   Void          setQP                 ( UInt uiIdx, Char value ){ m_phQP[uiIdx] =  value;     }
     372  SChar*        getQP                         ( )                                                          { return m_phQP;                             }
     373  SChar         getQP                         ( UInt uiIdx ) const                                         { return m_phQP[uiIdx];                      }
     374  Void          setQP                         ( UInt uiIdx, SChar value )                                  { m_phQP[uiIdx] =  value;                    }
    374375  Void          setQPSubParts         ( Int qp,   UInt uiAbsPartIdx, UInt uiDepth );
    375   Int           getLastValidPartIdx   ( Int iAbsPartIdx );
    376   Char          getLastCodedQP        ( UInt uiAbsPartIdx );
     376  Int           getLastValidPartIdx           ( Int iAbsPartIdx ) const;
     377  SChar         getLastCodedQP                ( UInt uiAbsPartIdx ) const;
    377378  Void          setQPSubCUs           ( Int qp, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf );
    378   Void          setCodedQP            ( Char qp )               { m_codedQP = qp;             }
    379   Char          getCodedQP            ()                        { return m_codedQP;           }
     379  Void          setCodedQP                    ( SChar qp )                                                 { m_codedQP = qp;                            }
     380  SChar         getCodedQP                    ( ) const                                                    { return m_codedQP;                          }
    380381
    381382  UChar*        getChromaQpAdj        ()                        { return m_ChromaQpAdj;       } ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1
     
    383384  Void          setChromaQpAdj        (Int idx, UChar val)      { m_ChromaQpAdj[idx] = val;   } ///< When val = 0,   cu_chroma_qp_offset_flag=0; when val>0,   indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=val-1
    384385  Void          setChromaQpAdjSubParts( UChar val, Int absPartIdx, Int depth );
    385   Void          setCodedChromaQpAdj   ( Char qp )               { m_codedChromaQpAdj = qp;    }
    386   Char          getCodedChromaQpAdj   ()                        { return m_codedChromaQpAdj;  }
    387 
    388   Bool          isLosslessCoded       ( UInt absPartIdx );
     386  Void          setCodedChromaQpAdj           ( SChar qp )                                                 { m_codedChromaQpAdj = qp;                   }
     387  SChar         getCodedChromaQpAdj           ( ) const                                                    { return m_codedChromaQpAdj;                 }
     388
     389  Bool          isLosslessCoded               ( UInt absPartIdx ) const;
    389390
    390391  UChar*        getTransformIdx       ()                        { return m_puhTrIdx;          }
    391   UChar         getTransformIdx       ( UInt uiIdx )            { return m_puhTrIdx[uiIdx];   }
     392  UChar         getTransformIdx               ( UInt uiIdx ) const                                         { return m_puhTrIdx[uiIdx];                  }
    392393  Void          setTrIdxSubParts      ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth );
    393394
    394395  UChar*        getTransformSkip      ( ComponentID compID )    { return m_puhTransformSkip[compID];}
    395   UChar         getTransformSkip      ( UInt uiIdx, ComponentID compID)    { return m_puhTransformSkip[compID][uiIdx];}
     396  UChar         getTransformSkip              ( UInt uiIdx, ComponentID compID ) const                     { return m_puhTransformSkip[compID][uiIdx];  }
    396397  Void          setTransformSkipSubParts  ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth);
    397398  Void          setTransformSkipSubParts  ( const UInt useTransformSkip[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth );
    398399
    399400  UChar*        getExplicitRdpcmMode      ( ComponentID component ) { return m_explicitRdpcmMode[component]; }
    400   UChar         getExplicitRdpcmMode      ( ComponentID component, UInt partIdx ) {return m_explicitRdpcmMode[component][partIdx]; }
     401  UChar         getExplicitRdpcmMode          ( ComponentID component, UInt partIdx ) const                { return m_explicitRdpcmMode[component][partIdx]; }
    401402  Void          setExplicitRdpcmModePartRange ( UInt rdpcmMode, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes );
    402403
    403   Bool          isRDPCMEnabled         ( UInt uiAbsPartIdx )  { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); }
    404 
    405   Void          setCrossComponentPredictionAlphaPartRange    ( Char alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes );
     404  Bool          isRDPCMEnabled                ( UInt uiAbsPartIdx ) const                                  { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); }
     405
     406  Void          setCrossComponentPredictionAlphaPartRange ( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes );
    406407  Void          setTransformSkipPartRange                    ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes );
    407408
    408   UInt          getQuadtreeTULog2MinSizeInCU( UInt uiIdx );
     409  UInt          getQuadtreeTULog2MinSizeInCU  ( UInt uiIdx ) const;
    409410
    410411  TComCUMvField* getCUMvField         ( RefPicList e )          { return  &m_acCUMvField[e];  }
     412  const TComCUMvField* getCUMvField           ( RefPicList e ) const                                       { return &m_acCUMvField[e];                  }
    411413
    412414  TCoeff*       getCoeff              (ComponentID component)   { return m_pcTrCoeff[component]; }
     
    417419  Pel*          getPCMSample          ( ComponentID component ) { return m_pcIPCMSample[component]; }
    418420
    419   UChar         getCbf    ( UInt uiIdx, ComponentID eType )                  { return m_puhCbf[eType][uiIdx];  }
     421  UChar         getCbf                        ( UInt uiIdx, ComponentID eType ) const                      { return m_puhCbf[eType][uiIdx];             }
    420422  UChar*        getCbf    ( ComponentID eType )                              { return m_puhCbf[eType];         }
    421   UChar         getCbf    ( UInt uiIdx, ComponentID eType, UInt uiTrDepth )  { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }
     423  UChar         getCbf                        ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ) const      { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }
    422424  Void          setCbf    ( UInt uiIdx, ComponentID eType, UChar uh )        { m_puhCbf[eType][uiIdx] = uh;    }
    423425  Void          clearCbf  ( UInt uiIdx, ComponentID eType, UInt uiNumParts );
    424   UChar         getQtRootCbf          ( UInt uiIdx );
     426  UChar         getQtRootCbf                  ( UInt uiIdx ) const;
    425427
    426428  Void          setCbfSubParts        ( const UInt uiCbf[MAX_NUM_COMPONENT],  UInt uiAbsPartIdx, UInt uiDepth           );
     
    436438
    437439  Bool*         getMergeFlag          ()                        { return m_pbMergeFlag;               }
    438   Bool          getMergeFlag          ( UInt uiIdx )            { return m_pbMergeFlag[uiIdx];        }
     440  Bool          getMergeFlag                  ( UInt uiIdx ) const                                         { return m_pbMergeFlag[uiIdx];               }
    439441  Void          setMergeFlag          ( UInt uiIdx, Bool b )    { m_pbMergeFlag[uiIdx] = b;           }
    440442  Void          setMergeFlagSubParts  ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    441443
    442444  UChar*        getMergeIndex         ()                        { return m_puhMergeIndex;                         }
    443   UChar         getMergeIndex         ( UInt uiIdx )            { return m_puhMergeIndex[uiIdx];                  }
     445  UChar         getMergeIndex                 ( UInt uiIdx ) const                                         { return m_puhMergeIndex[uiIdx];             }
    444446  Void          setMergeIndex         ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;  }
    445447  Void          setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     
    453455#if AMP_MRG
    454456  Void          setMergeAMP( Bool b )      { m_bIsMergeAMP = b; }
    455   Bool          getMergeAMP( )             { return m_bIsMergeAMP; }
     457  Bool          getMergeAMP                   ( ) const                                                    { return m_bIsMergeAMP;                      }
    456458#endif
    457459
     
    465467
    466468  UChar*        getInterDir           ()                        { return m_puhInterDir;               }
    467   UChar         getInterDir           ( UInt uiIdx )            { return m_puhInterDir[uiIdx];        }
     469  UChar         getInterDir                   ( UInt uiIdx ) const                                         { return m_puhInterDir[uiIdx];               }
    468470  Void          setInterDir           ( UInt uiIdx, UChar  uh ) { m_puhInterDir[uiIdx] = uh;          }
    469471  Void          setInterDirSubParts   ( UInt uiDir,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    470472  Bool*         getIPCMFlag           ()                        { return m_pbIPCMFlag;               }
    471   Bool          getIPCMFlag           (UInt uiIdx )             { return m_pbIPCMFlag[uiIdx];        }
     473  Bool          getIPCMFlag                   ( UInt uiIdx ) const                                         { return m_pbIPCMFlag[uiIdx];                }
    472474  Void          setIPCMFlag           (UInt uiIdx, Bool b )     { m_pbIPCMFlag[uiIdx] = b;           }
    473475  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
     
    482484#if NH_3D_NBDV
    483485  Void          xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
    484   Bool          xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,
     486  Bool          xCheckSpatialNBDV (const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,
    485487                                   UInt uiMvpDvPos
    486488#if NH_3D_NBDV_REF
     
    525527#endif
    526528#if NH_3D_ARP
    527   UChar*        getARPW            ()                        { return m_puhARPW;               }
    528   UChar         getARPW            ( UInt uiIdx )            { return m_puhARPW[uiIdx];        }
     529  UChar*        getARPW            ()              const          { return m_puhARPW;               }
     530  UChar         getARPW            ( UInt uiIdx )  const          { return m_puhARPW[uiIdx];        }
    529531  Void          setARPW            ( UInt uiIdx, UChar w )   { m_puhARPW[uiIdx] = w;           }
    530532  Void          setARPWSubParts    ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );
     
    536538  Void          setICFlagSubParts  ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    537539  Bool          isICFlagRequired   ( UInt uiAbsPartIdx );
    538   Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
     540  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const;
    539541#elif NH_3D_VSP
    540   Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
     542  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const;
    541543#else
    542544  // -------------------------------------------------------------------------------------------------------------------
     
    544546  // -------------------------------------------------------------------------------------------------------------------
    545547
    546   Void          getPartIndexAndSize   ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx
    547 #endif
    548   UChar         getNumPartitions      ( const UInt uiAbsPartIdx = 0 );
    549   Bool          isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth);
     548  Void          getPartIndexAndSize           ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const; // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx
     549#endif
     550  UChar         getNumPartitions              ( const UInt uiAbsPartIdx = 0 ) const;
     551  Bool          isFirstAbsZorderIdxInDepth    ( UInt uiAbsPartIdx, UInt uiDepth ) const;
    550552
    551553#if NH_3D_DMM
     
    575577  // -------------------------------------------------------------------------------------------------------------------
    576578
    577   Void          getMvField            ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );
    578 
    579   Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
    580   Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
    581   Void          getPartPosition       ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
     579  static Void   getMvField                    ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );
     580
     581  Void          fillMvpCand                   ( const UInt uiPartIdx, const UInt uiPartAddr, const RefPicList eRefPicList, const Int iRefIdx, AMVPInfo* pInfo ) const;
     582  Bool          isDiffMER                     ( Int xN, Int yN, Int xP, Int yP ) const;
     583  Void          getPartPosition               ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH ) const;
    582584
    583585  Void          setMVPIdx             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;  }
    584   Int           getMVPIdx             ( RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx];     }
    585   Char*         getMVPIdx             ( RefPicList eRefPicList )                          { return m_apiMVPIdx[eRefPicList];            }
     586  Int           getMVPIdx                     ( RefPicList eRefPicList, UInt uiIdx) const                  { return m_apiMVPIdx[eRefPicList][uiIdx];    }
     587  SChar*        getMVPIdx                     ( RefPicList eRefPicList )                                   { return m_apiMVPIdx[eRefPicList];           }
    586588
    587589  Void          setMVPNum             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum;  }
    588   Int           getMVPNum             ( RefPicList eRefPicList, UInt uiIdx )              { return m_apiMVPNum[eRefPicList][uiIdx];     }
    589   Char*         getMVPNum             ( RefPicList eRefPicList )                          { return m_apiMVPNum[eRefPicList];            }
     590  Int           getMVPNum                     ( RefPicList eRefPicList, UInt uiIdx ) const                 { return m_apiMVPNum[eRefPicList][uiIdx];    }
     591  SChar*        getMVPNum                     ( RefPicList eRefPicList )                                   { return m_apiMVPNum[eRefPicList];           }
    590592
    591593  Void          setMVPIdxSubParts     ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    592594  Void          setMVPNumSubParts     ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    593595
    594   Void          clipMv                ( TComMv&     rcMv     );
     596  Void          clipMv                        ( TComMv&     rcMv     ) const;
     597
    595598#if NH_MV
    596599  Void          checkMvVertRest (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx );
    597600#endif
    598   Void          getMvPredLeft         ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldA.getMv(); }
    599   Void          getMvPredAbove        ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldB.getMv(); }
    600   Void          getMvPredAboveRight   ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldC.getMv(); }
     601  Void          getMvPredLeft                 ( TComMv&     rcMvPred ) const                               { rcMvPred = m_cMvFieldA.getMv();            }
     602  Void          getMvPredAbove                ( TComMv&     rcMvPred ) const                               { rcMvPred = m_cMvFieldB.getMv();            }
     603  Void          getMvPredAboveRight           ( TComMv&     rcMvPred ) const                               { rcMvPred = m_cMvFieldC.getMv();            }
    601604#if NH_3D
    602605  Void          compressMV            ( Int scale );
     
    618621  Bool          CUIsFromSameSliceAndTile    ( const TComDataCU *pCU /* Can be NULL */) const;
    619622  Bool          CUIsFromSameSliceTileAndWavefrontRow( const TComDataCU *pCU /* Can be NULL */) const;
    620   Bool          isLastSubCUOfCtu(const UInt absPartIdx);
    621 
    622 
    623   TComDataCU*   getPULeft                   ( UInt& uiLPartUnitIdx,
     623  Bool          isLastSubCUOfCtu              ( const UInt absPartIdx ) const;
     624
     625
     626  const TComDataCU*   getPULeft               ( UInt& uiLPartUnitIdx,
    624627                                              UInt uiCurrPartUnitIdx,
    625628                                              Bool bEnforceSliceRestriction=true,
    626                                               Bool bEnforceTileRestriction=true );
    627   TComDataCU*   getPUAbove                  ( UInt&  uiAPartUnitIdx,
     629                                                Bool  bEnforceTileRestriction=true ) const;
     630
     631  const TComDataCU*   getPUAbove              ( UInt& uiAPartUnitIdx,
    628632                                              UInt uiCurrPartUnitIdx,
    629633                                              Bool bEnforceSliceRestriction=true,
    630634                                              Bool planarAtCTUBoundary = false,
    631                                               Bool bEnforceTileRestriction=true );
    632   TComDataCU*   getPUAboveLeft              ( UInt&  uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true );
    633 
    634   TComDataCU*   getQpMinCuLeft              ( UInt&  uiLPartUnitIdx , UInt uiCurrAbsIdxInCtu );
    635   TComDataCU*   getQpMinCuAbove             ( UInt&  uiAPartUnitIdx , UInt uiCurrAbsIdxInCtu );
    636   Char          getRefQP                    ( UInt   uiCurrAbsIdxInCtu                       );
     635                                                Bool  bEnforceTileRestriction=true ) const;
     636
     637  const TComDataCU*   getPUAboveLeft          ( UInt&  uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ) const;
     638
     639  const TComDataCU*   getQpMinCuLeft          ( UInt&  uiLPartUnitIdx,  UInt uiCurrAbsIdxInCtu ) const;
     640  const TComDataCU*   getQpMinCuAbove         ( UInt&  uiAPartUnitIdx,  UInt uiCurrAbsIdxInCtu ) const;
    637641
    638642  /// returns CU and part index of the PU above the top row of the current uiCurrPartUnitIdx of the CU, at a horizontal offset (to the right) of uiPartUnitOffset (in parts)
    639   TComDataCU*   getPUAboveRight             ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );
     643  const TComDataCU*   getPUAboveRight         ( UInt&  uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const;
    640644  /// returns CU and part index of the PU left of the lefthand column of the current uiCurrPartUnitIdx of the CU, at a vertical offset (below) of uiPartUnitOffset (in parts)
    641   TComDataCU*   getPUBelowLeft              ( UInt&  uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );
    642 
    643   Void          deriveLeftRightTopIdx       ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
    644   Void          deriveLeftBottomIdx         ( UInt uiPartIdx, UInt& ruiPartIdxLB );
    645 
    646   Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
     645  const TComDataCU*   getPUBelowLeft          ( UInt&  uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const;
     646
     647  SChar         getRefQP                      ( UInt uiCurrAbsIdxInCtu ) const;
     648
     649  Void          deriveLeftRightTopIdx         ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const;
     650  Void          deriveLeftBottomIdx           ( UInt uiPartIdx, UInt& ruiPartIdxLB ) const;
     651
    647652#if NH_3D
    648653  Bool          hasEqualMotion              ( Int dirA, const TComMvField* mvFieldA,  Int dirB, const TComMvField* mvFieldB  );
    649654#endif
     655  Bool          hasEqualMotion                ( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const;
     656
    650657#if NH_3D_MLC
    651658  Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;   }
     
    670677  , Int& numValidMergeCand, Int mrgCandIdx = -1 );
    671678#endif
     679#if NH_3D
    672680  Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
     681#else
     682  Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ) const;
     683#endif
    673684
    674685#if NH_3D_VSP
    675686#if NH_3D_SPIVMP
    676   Bool*         getSPIVMPFlag        ()                        { return m_pbSPIVMPFlag;          }
    677   Bool          getSPIVMPFlag        ( UInt uiIdx )            { return m_pbSPIVMPFlag[uiIdx];   }
     687  Bool*         getSPIVMPFlag        ()                        const { return m_pbSPIVMPFlag;          }
     688  Bool          getSPIVMPFlag        ( UInt uiIdx )            const { return m_pbSPIVMPFlag[uiIdx];   }
    678689  Void          setSPIVMPFlag        ( UInt uiIdx, Bool n )     { m_pbSPIVMPFlag[uiIdx] = n;      }
    679690  Void          setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    680691#endif
    681692
    682   Char*         getVSPFlag        ()                        { return m_piVSPFlag;          }
    683   Char          getVSPFlag        ( UInt uiIdx )            { return m_piVSPFlag[uiIdx];   }
     693  SChar*        getVSPFlag        ()                        const { return m_piVSPFlag;          }
     694  SChar         getVSPFlag        ( UInt uiIdx )            const { return m_piVSPFlag[uiIdx];   }
    684695  Void          setVSPFlag        ( UInt uiIdx, Int n )     { m_piVSPFlag[uiIdx] = n;      }
    685   Void          setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     696  Void          setVSPFlagSubParts( SChar iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    686697  Void          setMvFieldPUForVSP    ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize );
    687698#endif
    688   Void          deriveLeftRightTopIdxGeneral  ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
    689   Void          deriveLeftBottomIdxGeneral    ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
    690 
     699  Void          deriveLeftRightTopIdxGeneral  ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const;
     700  Void          deriveLeftBottomIdxGeneral    ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const;
    691701  // -------------------------------------------------------------------------------------------------------------------
    692702  // member functions for modes
     
    695705  Bool          isIntra            ( UInt uiPartIdx )  const { return m_pePredMode[ uiPartIdx ] == MODE_INTRA;                                              }
    696706  Bool          isInter            ( UInt uiPartIdx )  const { return m_pePredMode[ uiPartIdx ] == MODE_INTER;                                              }
    697   Bool          isSkipped          ( UInt uiPartIdx );                                                    ///< returns true, if the partiton is skipped
    698   Bool          isBipredRestriction( UInt puIdx );
     707  Bool          isSkipped                     ( UInt uiPartIdx ) const; ///< returns true, if the partiton is skipped
     708  Bool          isBipredRestriction           ( UInt puIdx     ) const;
    699709
    700710  // -------------------------------------------------------------------------------------------------------------------
     
    702712  // -------------------------------------------------------------------------------------------------------------------
    703713
    704   UInt          getIntraSizeIdx                 ( UInt uiAbsPartIdx                                       );
    705 
    706   Void          getAllowedChromaDir             ( UInt uiAbsPartIdx, UInt* uiModeList );
    707   Void          getIntraDirPredictor            ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL );
     714  UInt          getIntraSizeIdx               ( UInt uiAbsPartIdx ) const;
     715
     716  Void          getAllowedChromaDir           ( UInt uiAbsPartIdx, UInt* uiModeList ) const;
     717  Void          getIntraDirPredictor          ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL ) const;
    708718
    709719  // -------------------------------------------------------------------------------------------------------------------
     
    711721  // -------------------------------------------------------------------------------------------------------------------
    712722
    713   UInt          getCtxSplitFlag                 ( UInt   uiAbsPartIdx, UInt uiDepth                   );
    714   UInt          getCtxQtCbf                     ( TComTU &rTu, const ChannelType chType );
    715 
    716   UInt          getCtxSkipFlag                  ( UInt   uiAbsPartIdx                                 );
    717   UInt          getCtxInterDir                  ( UInt   uiAbsPartIdx                                 );
     723  UInt          getCtxSplitFlag               ( UInt   uiAbsPartIdx, UInt uiDepth     ) const;
     724  UInt          getCtxQtCbf                   ( TComTU &rTu, const ChannelType chType ) const;
     725
     726  UInt          getCtxSkipFlag                ( UInt   uiAbsPartIdx ) const;
     727  UInt          getCtxInterDir                ( UInt   uiAbsPartIdx ) const;
    718728#if NH_3D_ARP
    719729  UInt          getCTXARPWFlag                  ( UInt   uiAbsPartIdx                                 );
  • TabularUnified trunk/source/Lib/TLibCommon/TComInterpolationFilter.cpp

    r1313 r1386  
    360360 * \param  bitDepth   Bit depth
    361361 */
    362 Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth
    363 #if NH_3D_ARP
    364     , Bool filterType
    365 #endif
    366 )
     362#if NH_3D_ARP
     363Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth, Bool filterType )
     364#else
     365Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth )
     366#endif
     367
    367368{
    368369  if ( frac == 0 )
     
    423424 * \param  bitDepth   Bit depth
    424425 */
    425 Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth
    426 #if NH_3D_ARP
    427     , Bool filterType
    428 #endif
    429 )
     426#if NH_3D_ARP
     427Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth, Bool filterType )
     428#else
     429Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth )
     430#endif
    430431{
    431432  if ( frac == 0 )
  • TabularUnified trunk/source/Lib/TLibCommon/TComInterpolationFilter.h

    r1313 r1386  
    8282  ~TComInterpolationFilter() {}
    8383
    84   Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast, const ChromaFormat fmt, const Int bitDepth
    8584#if NH_3D_ARP
    86     , Bool filterType = false
     85  Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast, const ChromaFormat fmt, const Int bitDepth , Bool filterType = false );
     86#else
     87  Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast, const ChromaFormat fmt, const Int bitDepth );
    8788#endif
    88 );
    89   Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth
     89
    9090#if NH_3D_ARP
    91     , Bool filterType = false
     91  Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac,               Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth , Bool filterType = false );
     92#else
     93  Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac,               Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth );
    9294#endif
    93 );
    9495};
    9596
  • TabularUnified trunk/source/Lib/TLibCommon/TComLoopFilter.cpp

    r1313 r1386  
    365365  UInt uiY           = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsZorderIdx ] ];
    366366
    367   TComDataCU* pcTempCU;
    368367  UInt        uiTempPartIdx;
    369368
     
    380379  if ( m_stLFCUParam.bLeftEdge )
    381380  {
    382     pcTempCU = pcCU->getPULeft( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);
     381    const TComDataCU* pcTempCU = pcCU->getPULeft( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);
    383382
    384383    if ( pcTempCU != NULL )
     
    402401  if ( m_stLFCUParam.bTopEdge )
    403402  {
    404     pcTempCU = pcCU->getPUAbove( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
     403    const TComDataCU* pcTempCU = pcCU->getPUAbove( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
    405404
    406405    if ( pcTempCU != NULL )
     
    425424
    426425  UInt uiPartP;
    427   TComDataCU* pcCUP;
     426  const TComDataCU* pcCUP;
    428427  UInt uiBs = 0;
    429428
     
    459458      {
    460459        Int iRefIdx;
    461         TComPic *piRefP0, *piRefP1, *piRefQ0, *piRefQ1;
    462460        iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartP);
    463         piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);
     461        const TComPic *piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);
    464462        iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartP);
    465         piRefP1 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_1, iRefIdx);
     463        const TComPic *piRefP1 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_1, iRefIdx);
    466464        iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartQ);
    467         piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);
     465        const TComPic *piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);
    468466        iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartQ);
    469         piRefQ1 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx);
     467        const TComPic *piRefQ1 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx);
    470468
    471469        TComMv pcMvP0 = pcCUP->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartP);
     
    530528      {
    531529        Int iRefIdx;
    532         TComPic *piRefP0, *piRefQ0;
    533530        iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartP);
    534         piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);
     531        const TComPic *piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);
    535532        iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartQ);
    536         piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);
     533        const TComPic *piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);
    537534        TComMv pcMvP0 = pcCUP->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartP);
    538535        TComMv pcMvQ0 = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartQ);
     
    583580  UInt  uiPartPIdx = 0;
    584581  UInt  uiPartQIdx = 0;
    585   TComDataCU* pcCUP = pcCU;
     582  const TComDataCU* pcCUP = pcCU;
    586583  TComDataCU* pcCUQ = pcCU;
    587584  Int  betaOffsetDiv2 = pcCUQ->getSlice()->getDeblockingFilterBetaOffsetDiv2();
     
    758755      UInt  uiPartQIdx = uiBsAbsIdx;
    759756      // Derive neighboring PU index
    760       TComDataCU* pcCUP;
     757      const TComDataCU* pcCUP;
    761758      UInt  uiPartPIdx;
    762759
  • TabularUnified trunk/source/Lib/TLibCommon/TComMotionInfo.cpp

    r1321 r1386  
    6666  m_pcMv     = new TComMv[ uiNumPartition ];
    6767  m_pcMvd    = new TComMv[ uiNumPartition ];
    68   m_piRefIdx = new Char [ uiNumPartition ];
     68  m_piRefIdx = new SChar [ uiNumPartition ];
    6969
    7070  m_uiNumPartition = uiNumPartition;
     
    321321Void TComCUMvField::setAllRefIdx ( Int iRefIdx, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx )
    322322{
    323   setAll(m_piRefIdx, static_cast<Char>(iRefIdx), eCUMode, iPartAddr, uiDepth, iPartIdx);
     323  setAll(m_piRefIdx, static_cast<SChar>(iRefIdx), eCUMode, iPartAddr, uiDepth, iPartIdx);
    324324}
    325325
     
    358358 * \param scale      Factor by which to subsample motion information
    359359 */
    360 Void TComCUMvField::compress(Char* pePredMode, Int scale)
     360Void TComCUMvField::compress(SChar* pePredMode, Int scale)
    361361{
    362362  Int N = scale * scale;
     
    381381
    382382#if NH_MV
    383 Void TComCUMvField::print(Char* pePredMode)
     383Void TComCUMvField::print(SChar* pePredMode)
    384384{
    385385  for ( Int uiPartIdx = 0; uiPartIdx < m_uiNumPartition; uiPartIdx += 1 )
  • TabularUnified trunk/source/Lib/TLibCommon/TComMotionInfo.h

    r1321 r1386  
    5757typedef struct _AMVPInfo
    5858{
    59   TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS_MEM ];  ///< array of motion vector predictor candidates
     59  TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS ];  ///< array of motion vector predictor candidates
    6060  Int    iN;                                ///< number of motion vector predictor candidates
    6161} AMVPInfo;
     
    122122  TComMv*   m_pcMv;
    123123  TComMv*   m_pcMvd;
    124   Char*     m_piRefIdx;
     124  SChar*    m_piRefIdx;
    125125  UInt      m_uiNumPartition;
    126126  AMVPInfo  m_cAMVPInfo;
     
    188188  }
    189189 
    190   Void compress(Char* pePredMode, Int scale);
     190  Void compress(SChar* pePredMode, Int scale);
    191191#if NH_MV
    192   Void print   (Char* pePredMode);
     192  Void print   (SChar* pePredMode);
    193193#endif
    194194};
  • TabularUnified trunk/source/Lib/TLibCommon/TComMv.h

    r1313 r1386  
    100100  Void  setHor    ( Short i )                   { m_iHor = i;                               }
    101101  Void  setVer    ( Short i )                   { m_iVer = i;                               }
    102   Void  setZero   ()                            { m_iHor = m_iVer = 0;
    103  #if NH_3D_NBDV
    104    m_bIDV = false; m_iIDVHor = m_iIDVVer = 0;
    105    m_iIDVVId = 0;
    106 #endif
    107  }
    108 #if NH_3D_NBDV
     102#if NH_3D_NBDV
     103  Void  setZero   ()                            { m_iHor = m_iVer = 0; m_bIDV = false; m_iIDVHor = m_iIDVVer = 0; m_iIDVVId = 0;  }
    109104  Void   setIDVHor  (Short i)                    {m_iIDVHor = i;}
    110105  Void   setIDVVer  (Short i)                    {m_iIDVVer = i;}
    111106  Void   setIDVFlag (Bool b )                    {m_bIDV    = b;}
    112107  Void   setIDVVId  (Short i)                    {m_iIDVVId = i;}
     108#else
     109  Void  setZero   ()                            { m_iHor = m_iVer = 0;  }
    113110#endif
    114111  // ------------------------------------------------------------------------------------------------------------------
     
    145142  }
    146143
     144#if NH_3D
     145#if ME_ENABLE_ROUNDING_OF_MVS
     146
    147147  const TComMv& operator>>= (const Int i)
    148148  {
     
    151151    return  *this;
    152152  }
     153#endif
     154#endif
     155
     156#if !ME_ENABLE_ROUNDING_OF_MVS
     157  const TComMv& operator>>= (const Int i)
     158  {
     159    m_iHor >>= i;
     160    m_iVer >>= i;
     161    return  *this;
     162  }
     163#endif
     164
     165#if ME_ENABLE_ROUNDING_OF_MVS
     166  //! shift right with rounding
     167  Void divideByPowerOf2 (const Int i)
     168  {
     169    Int offset = (i == 0) ? 0 : 1 << (i - 1);
     170    m_iHor += offset;
     171    m_iVer += offset;
     172
     173    m_iHor >>= i;
     174    m_iVer >>= i;
     175  }
     176#endif
    153177
    154178  const TComMv& operator<<= (const Int i)
  • TabularUnified trunk/source/Lib/TLibCommon/TComPattern.cpp

    r1313 r1386  
    6666
    6767/// constrained intra prediction
    68 Bool  isAboveLeftAvailable  ( TComDataCU* pcCU, UInt uiPartIdxLT );
    69 Int   isAboveAvailable      ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags );
    70 Int   isLeftAvailable       ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags );
    71 Int   isAboveRightAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags );
    72 Int   isBelowLeftAvailable  ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags );
     68Bool  isAboveLeftAvailable  ( const TComDataCU* pcCU, UInt uiPartIdxLT );
     69Int   isAboveAvailable      ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags );
     70Int   isLeftAvailable       ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags );
     71Int   isAboveRightAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags );
     72Int   isBelowLeftAvailable  ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags );
    7373
    7474
     
    566566}
    567567
    568 Bool isAboveLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT )
     568Bool isAboveLeftAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT )
    569569{
    570570  Bool bAboveLeftFlag;
    571571  UInt uiPartAboveLeft;
    572   TComDataCU* pcCUAboveLeft = pcCU->getPUAboveLeft( uiPartAboveLeft, uiPartIdxLT );
     572  const TComDataCU* pcCUAboveLeft = pcCU->getPUAboveLeft( uiPartAboveLeft, uiPartIdxLT );
    573573  if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred())
    574574  {
     
    582582}
    583583
    584 Int isAboveAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )
     584Int isAboveAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )
    585585{
    586586  const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT];
     
    593593  {
    594594    UInt uiPartAbove;
    595     TComDataCU* pcCUAbove = pcCU->getPUAbove( uiPartAbove, g_auiRasterToZscan[uiRasterPart] );
     595    const TComDataCU* pcCUAbove = pcCU->getPUAbove( uiPartAbove, g_auiRasterToZscan[uiRasterPart] );
    596596    if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred())
    597597    {
     
    623623}
    624624
    625 Int isLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )
     625Int isLeftAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )
    626626{
    627627  const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT];
     
    634634  {
    635635    UInt uiPartLeft;
    636     TComDataCU* pcCULeft = pcCU->getPULeft( uiPartLeft, g_auiRasterToZscan[uiRasterPart] );
     636    const TComDataCU* pcCULeft = pcCU->getPULeft( uiPartLeft, g_auiRasterToZscan[uiRasterPart] );
    637637    if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred())
    638638    {
     
    665665}
    666666
    667 Int isAboveRightAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )
     667Int isAboveRightAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )
    668668{
    669669  const UInt uiNumUnitsInPU = g_auiZscanToRaster[uiPartIdxRT] - g_auiZscanToRaster[uiPartIdxLT] + 1;
     
    674674  {
    675675    UInt uiPartAboveRight;
    676     TComDataCU* pcCUAboveRight = pcCU->getPUAboveRight( uiPartAboveRight, uiPartIdxRT, uiOffset );
     676    const TComDataCU* pcCUAboveRight = pcCU->getPUAboveRight( uiPartAboveRight, uiPartIdxRT, uiOffset );
    677677    if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred())
    678678    {
     
    705705}
    706706
    707 Int isBelowLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )
     707Int isBelowLeftAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )
    708708{
    709709  const UInt uiNumUnitsInPU = (g_auiZscanToRaster[uiPartIdxLB] - g_auiZscanToRaster[uiPartIdxLT]) / pcCU->getPic()->getNumPartInCtuWidth() + 1;
     
    714714  {
    715715    UInt uiPartBelowLeft;
    716     TComDataCU* pcCUBelowLeft = pcCU->getPUBelowLeft( uiPartBelowLeft, uiPartIdxLB, uiOffset );
     716    const TComDataCU* pcCUBelowLeft = pcCU->getPUBelowLeft( uiPartBelowLeft, uiPartIdxLB, uiOffset );
    717717    if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred())
    718718    {
  • TabularUnified trunk/source/Lib/TLibCommon/TComPattern.h

    r1313 r1386  
    6969    return  m_piROIOrigin;
    7070  }
     71  __inline const Pel*  getROIOrigin() const
     72  {
     73    return  m_piROIOrigin;
     74  }
    7175
    7276  /// set parameters from Pel buffer for accessing neighbouring pixels
     
    9397  // ROI & pattern information, (ROI = &pattern[AboveOffset][LeftOffset])
    9498  Pel*  getROIY()                 { return m_cPatternY.getROIOrigin();    }
    95   Int   getROIYWidth()            { return m_cPatternY.m_iROIWidth;       }
    96   Int   getROIYHeight()           { return m_cPatternY.m_iROIHeight;      }
    97   Int   getPatternLStride()       { return m_cPatternY.m_iPatternStride;  }
    98   Int   getBitDepthY()            { return m_cPatternY.m_bitDepth; }
     99  const Pel*  getROIY() const     { return m_cPatternY.getROIOrigin();    }
     100  Int   getROIYWidth() const      { return m_cPatternY.m_iROIWidth;       }
     101  Int   getROIYHeight() const     { return m_cPatternY.m_iROIHeight;      }
     102  Int   getPatternLStride() const { return m_cPatternY.m_iPatternStride;  }
     103  Int   getBitDepthY() const      { return m_cPatternY.m_bitDepth;        }
    99104
    100105#if NH_3D_IC
    101   Bool  getICFlag()               { return m_bICFlag; }
     106  Bool  getICFlag()               const { return m_bICFlag; }
    102107  Void  setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; }
    103108#endif
    104109#if NH_3D_SDC_INTER
    105   Bool  getSDCMRSADFlag()         { return m_bSDCMRSADFlag; }
     110  Bool  getSDCMRSADFlag()         const { return m_bSDCMRSADFlag; }
    106111  Void  setSDCMRSADFlag( Bool bSDCMRSADFlag )    { m_bSDCMRSADFlag = bSDCMRSADFlag; }
    107112#endif
  • TabularUnified trunk/source/Lib/TLibCommon/TComPic.cpp

    r1321 r1386  
    6060, m_viewId                                (0)
    6161, m_bPicOutputFlag                        (false)
    62 #if NH_3D
     62#if NH_3D_VSO
    6363, m_viewIndex                             (0)
    6464, m_isDepth                               (false)
     
    449449          m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = false;
    450450          Int iColViewIdx    = pcCandColSlice->getViewIndex();
    451 #if H_3D_FIX_ARP_CHECK_NOT_IN_DPB
    452451          // The picture pcCandColSlice->getRefPic((RefPicList)iColRefDir, iColRefIdx) might not be in DPB anymore
    453452          // So don't access it directly.
    454453          Int iColRefViewIdx = pcCandColSlice->getVPS()->getViewOrderIdx( pcCandColSlice->getRefLayerId( (RefPicList)iColRefDir, iColRefIdx ) );       
    455 #else
    456           Int iColRefViewIdx = pcCandColSlice->getRefPic((RefPicList)iColRefDir, iColRefIdx)->getViewIndex();
    457 #endif
    458454          if(iColViewIdx == iColRefViewIdx)
    459455          {
     
    993989}
    994990
    995 #if NH_3D
    996 TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon )
     991#if NH_3D_VSO
     992TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int auxId, Int poc, Bool recon )
    997993
    998   Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag );
     994  Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag, auxId );
    999995  return getPicYuv( layerIdInNuh, poc, recon );
    1000996}
    1001997
    1002 TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int poc )
    1003 {
    1004   return getPic   ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc );
     998TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int auxId, Int poc )
     999{
     1000  return getPic   ( m_vps->getLayerIdInNuh( viewIndex, depthFlag, auxId ), poc );
    10051001}
    10061002
  • TabularUnified trunk/source/Lib/TLibCommon/TComPic.h

    r1321 r1386  
    154154  TComDecodedRps        m_decodedRps;
    155155#endif
    156 #if NH_3D
     156#if NH_3D_VSO
    157157  Int                   m_viewIndex;
    158158  Bool                  m_isDepth;
     
    189189
    190190  TComPicSym*   getPicSym()           { return  &m_picSym;    }
     191  const TComPicSym* getPicSym() const { return  &m_picSym;    }
    191192  TComSlice*    getSlice(Int i)       { return  m_picSym.getSlice(i);  }
    192193  Int           getPOC() const        { return  m_picSym.getSlice(m_uiCurrSliceIdx)->getPOC();  }
     
    247248#if NH_MV
    248249   Void          setLayerId            ( Int layerId )    { m_layerId      = layerId; }
    249    Int           getLayerId            ()                 { return m_layerId;    }
     250   Int           getLayerId            () const           { return m_layerId;    }
    250251   
    251252   Void          setViewId             ( Int viewId )     { m_viewId = viewId;   }
    252    Int           getViewId             ()                 { return m_viewId;     }
     253   Int           getViewId             () const           { return m_viewId;     }
    253254
    254255   Void          setPicOutputFlag(Bool b)                 { m_bPicOutputFlag = b;      }
    255    Bool          getPicOutputFlag()                       { return m_bPicOutputFlag ;  }
     256   Bool          getPicOutputFlag() const                 { return m_bPicOutputFlag ;  }
    256257
    257258   Bool          getPocResetPeriodId();
     
    310311   Void          print( Int outputLevel );
    311312
    312 #if NH_3D
     313#if NH_3D_VSO
    313314   Void          setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
    314    Int           getViewIndex          ()                 { return m_viewIndex;     }
     315   Int           getViewIndex          () const           { return m_viewIndex;     }
    315316
    316317   Void          setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
     
    403404  TComList<TComSubDpb*>       m_subDpbs;
    404405  Bool                        m_printPicOutput;
    405 #if NH_3D                     
     406#if NH_3D_VSO
    406407  const TComVPS*              m_vps;
    407408#endif
     
    447448  Void                   print();
    448449
    449 #if NH_3D                                   
     450#if NH_3D_VSO
    450451  Void                   setVPS                        ( const TComVPS* vps ) { m_vps = vps;  };
    451   TComPic*               getPic                        ( Int viewIndex, Bool depthFlag, Int poc );
    452   TComPicYuv*            getPicYuv                     ( Int viewIndex, Bool depthFlag, Int poc, Bool recon );
     452  TComPic*               getPic                        ( Int viewIndex, Bool depthFlag, Int auxId, Int poc );
     453  TComPicYuv*            getPicYuv                     ( Int viewIndex, Bool depthFlag, Int auxId, Int poc, Bool recon );
    453454#endif 
    454455
  • TabularUnified trunk/source/Lib/TLibCommon/TComPicSym.cpp

    r1313 r1386  
    140140  clearSliceBuffer();
    141141
     142  if (m_pictureCtuArray)
     143  {
    142144  for (Int i = 0; i < m_numCtusInFrame; i++)
    143145  {
     146      if (m_pictureCtuArray[i])
     147      {
    144148    m_pictureCtuArray[i]->destroy();
    145149    delete m_pictureCtuArray[i];
    146150    m_pictureCtuArray[i] = NULL;
    147151  }
     152    }
    148153  delete [] m_pictureCtuArray;
    149154  m_pictureCtuArray = NULL;
     155  }
    150156
    151157  delete [] m_ctuTsToRsAddrMap;
  • TabularUnified trunk/source/Lib/TLibCommon/TComPicYuv.cpp

    r1313 r1386  
    7979
    8080
    81 Void TComPicYuv::create ( const Int iPicWidth,                ///< picture width
    82                           const Int iPicHeight,               ///< picture height
     81Void TComPicYuv::createWithoutCUInfo ( const Int picWidth,                 ///< picture width
     82                                       const Int picHeight,                ///< picture height
     83                                       const ChromaFormat chromaFormatIDC, ///< chroma format
     84                                       const Bool bUseMargin,              ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image.
     85                                       const UInt maxCUWidth,              ///< used for margin only
     86                                       const UInt maxCUHeight)             ///< used for margin only
     87
     88{
     89  m_picWidth          = picWidth;
     90  m_picHeight         = picHeight;
     91
     92#if NH_3D_IV_MERGE
     93  m_iCuWidth        = maxCUWidth;
     94  m_iCuHeight       = maxCUHeight;
     95
     96  m_iNumCuInWidth   = picWidth / m_iCuWidth;
     97  m_iNumCuInWidth  += ( picHeight % m_iCuWidth ) ? 1 : 0;
     98  // Check if m_iBaseUnitWidth and m_iBaseUnitHeight need to be derived here
     99#endif
     100
     101  m_chromaFormatIDC   = chromaFormatIDC;
     102  m_marginX          = (bUseMargin?maxCUWidth:0) + 16;   // for 16-byte alignment
     103  m_marginY          = (bUseMargin?maxCUHeight:0) + 16;  // margin for 8-tap filter and infinite padding
     104  m_bIsBorderExtended = false;
     105
     106  // assign the picture arrays and set up the ptr to the top left of the original picture
     107  for(UInt comp=0; comp<getNumberValidComponents(); comp++)
     108  {
     109    const ComponentID ch=ComponentID(comp);
     110    m_apiPicBuf[comp] = (Pel*)xMalloc( Pel, getStride(ch) * getTotalHeight(ch));
     111    m_piPicOrg[comp]  = m_apiPicBuf[comp] + (m_marginY >> getComponentScaleY(ch)) * getStride(ch) + (m_marginX >> getComponentScaleX(ch));
     112  }
     113  // initialize pointers for unused components to NULL
     114  for(UInt comp=getNumberValidComponents();comp<MAX_NUM_COMPONENT; comp++)
     115  {
     116    m_apiPicBuf[comp] = NULL;
     117    m_piPicOrg[comp]  = NULL;
     118  }
     119
     120  for(Int chan=0; chan<MAX_NUM_CHANNEL_TYPE; chan++)
     121    {
     122    m_ctuOffsetInBuffer[chan]   = NULL;
     123    m_subCuOffsetInBuffer[chan] = NULL;
     124    }
     125  }
     126
     127
     128
     129Void TComPicYuv::create ( const Int picWidth,                 ///< picture width
     130                          const Int picHeight,                ///< picture height
    83131                          const ChromaFormat chromaFormatIDC, ///< chroma format
    84                           const UInt uiMaxCUWidth,            ///< used for generating offsets to CUs. Can use iPicWidth if no offsets are required
    85                           const UInt uiMaxCUHeight,           ///< used for generating offsets to CUs. Can use iPicHeight if no offsets are required
    86                           const UInt uiMaxCUDepth,            ///< used for generating offsets to CUs. Can use 0 if no offsets are required
     132                          const UInt maxCUWidth,              ///< used for generating offsets to CUs.
     133                          const UInt maxCUHeight,             ///< used for generating offsets to CUs.
     134                          const UInt maxCUDepth,              ///< used for generating offsets to CUs.
    87135                          const Bool bUseMargin)              ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image.
    88136
    89137{
    90   m_iPicWidth         = iPicWidth;
    91   m_iPicHeight        = iPicHeight;
     138  createWithoutCUInfo(picWidth, picHeight, chromaFormatIDC, bUseMargin, maxCUWidth, maxCUHeight);
    92139
    93140#if NH_3D_IV_MERGE
    94   m_iCuWidth        = uiMaxCUWidth;
    95   m_iCuHeight       = uiMaxCUHeight;
    96 
    97   m_iNumCuInWidth   = m_iPicWidth / m_iCuWidth;
    98   m_iNumCuInWidth  += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0;
    99 
    100   m_iBaseUnitWidth  = uiMaxCUWidth  >> uiMaxCUDepth;
    101   m_iBaseUnitHeight = uiMaxCUHeight >> uiMaxCUDepth;
    102 #endif
    103 
    104   m_chromaFormatIDC   = chromaFormatIDC;
    105   m_iMarginX          = (bUseMargin?uiMaxCUWidth:0) + 16;   // for 16-byte alignment
    106   m_iMarginY          = (bUseMargin?uiMaxCUHeight:0) + 16;  // margin for 8-tap filter and infinite padding
    107   m_bIsBorderExtended = false;
    108 
    109   // assign the picture arrays and set up the ptr to the top left of the original picture
    110   {
    111     Int chan=0;
    112     for(; chan<getNumberValidComponents(); chan++)
    113     {
    114       const ComponentID ch=ComponentID(chan);
    115       m_apiPicBuf[chan] = (Pel*)xMalloc( Pel, getStride(ch)       * getTotalHeight(ch));
    116       m_piPicOrg[chan]  = m_apiPicBuf[chan] + (m_iMarginY >> getComponentScaleY(ch))   * getStride(ch)       + (m_iMarginX >> getComponentScaleX(ch));
    117     }
    118     for(;chan<MAX_NUM_COMPONENT; chan++)
    119     {
    120       m_apiPicBuf[chan] = NULL;
    121       m_piPicOrg[chan]  = NULL;
    122     }
    123   }
    124 
    125 
    126   const Int numCuInWidth  = m_iPicWidth  / uiMaxCUWidth  + (m_iPicWidth  % uiMaxCUWidth  != 0);
    127   const Int numCuInHeight = m_iPicHeight / uiMaxCUHeight + (m_iPicHeight % uiMaxCUHeight != 0);
    128   for(Int chan=0; chan<2; chan++)
    129   {
    130     const ComponentID ch=ComponentID(chan);
    131     const Int ctuHeight=uiMaxCUHeight>>getComponentScaleY(ch);
    132     const Int ctuWidth=uiMaxCUWidth>>getComponentScaleX(ch);
     141  m_iBaseUnitWidth  = maxCUWidth  >> maxCUDepth;
     142  m_iBaseUnitHeight = maxCUHeight >> maxCUDepth;
     143#endif
     144
     145
     146  const Int numCuInWidth  = m_picWidth  / maxCUWidth  + (m_picWidth  % maxCUWidth  != 0);
     147  const Int numCuInHeight = m_picHeight / maxCUHeight + (m_picHeight % maxCUHeight != 0);
     148  for(Int chan=0; chan<MAX_NUM_CHANNEL_TYPE; chan++)
     149  {
     150    const ChannelType ch= ChannelType(chan);
     151    const Int ctuHeight = maxCUHeight>>getChannelTypeScaleY(ch);
     152    const Int ctuWidth  = maxCUWidth>>getChannelTypeScaleX(ch);
    133153    const Int stride = getStride(ch);
    134154
     
    143163    }
    144164
    145     m_subCuOffsetInBuffer[chan] = new Int[(size_t)1 << (2 * uiMaxCUDepth)];
    146 
    147     const Int numSubBlockPartitions=(1<<uiMaxCUDepth);
    148     const Int minSubBlockHeight    =(ctuHeight >> uiMaxCUDepth);
    149     const Int minSubBlockWidth     =(ctuWidth  >> uiMaxCUDepth);
     165    m_subCuOffsetInBuffer[chan] = new Int[(size_t)1 << (2 * maxCUDepth)];
     166
     167    const Int numSubBlockPartitions=(1<<maxCUDepth);
     168    const Int minSubBlockHeight    =(ctuHeight >> maxCUDepth);
     169    const Int minSubBlockWidth     =(ctuWidth  >> maxCUDepth);
    150170
    151171    for (Int buRow = 0; buRow < numSubBlockPartitions; buRow++)
     
    153173      for (Int buCol = 0; buCol < numSubBlockPartitions; buCol++)
    154174      {
    155         m_subCuOffsetInBuffer[chan][(buRow << uiMaxCUDepth) + buCol] = stride  * buRow * minSubBlockHeight + buCol * minSubBlockWidth;
    156       }
    157     }
    158   }
    159   return;
     175        m_subCuOffsetInBuffer[chan][(buRow << maxCUDepth) + buCol] = stride  * buRow * minSubBlockHeight + buCol * minSubBlockWidth;
     176      }
     177    }
     178  }
    160179}
    161180
     
    164183Void TComPicYuv::destroy()
    165184{
    166   for(Int chan=0; chan<MAX_NUM_COMPONENT; chan++)
    167   {
    168     m_piPicOrg[chan] = NULL;
    169 
    170     if( m_apiPicBuf[chan] )
    171     {
    172       xFree( m_apiPicBuf[chan] );
    173       m_apiPicBuf[chan] = NULL;
     185  for(Int comp=0; comp<MAX_NUM_COMPONENT; comp++)
     186  {
     187    m_piPicOrg[comp] = NULL;
     188
     189    if( m_apiPicBuf[comp] )
     190    {
     191      xFree( m_apiPicBuf[comp] );
     192      m_apiPicBuf[comp] = NULL;
    174193    }
    175194  }
     
    194213Void  TComPicYuv::copyToPic (TComPicYuv*  pcPicYuvDst) const
    195214{
    196   assert( m_iPicWidth  == pcPicYuvDst->getWidth(COMPONENT_Y)  );
    197   assert( m_iPicHeight == pcPicYuvDst->getHeight(COMPONENT_Y) );
    198215  assert( m_chromaFormatIDC == pcPicYuvDst->getChromaFormat() );
    199216
    200   for(Int chan=0; chan<getNumberValidComponents(); chan++)
    201   {
    202     const ComponentID ch=ComponentID(chan);
    203     ::memcpy ( pcPicYuvDst->getBuf(ch), m_apiPicBuf[ch], sizeof (Pel) * getStride(ch) * getTotalHeight(ch));
    204   }
    205   return;
     217  for(Int comp=0; comp<getNumberValidComponents(); comp++)
     218  {
     219    const ComponentID compId=ComponentID(comp);
     220    const Int width     = getWidth(compId);
     221    const Int height    = getHeight(compId);
     222    const Int strideSrc = getStride(compId);
     223    assert(pcPicYuvDst->getWidth(compId) == width);
     224    assert(pcPicYuvDst->getHeight(compId) == height);
     225    if (strideSrc==pcPicYuvDst->getStride(compId))
     226  {
     227      ::memcpy ( pcPicYuvDst->getBuf(compId), getBuf(compId), sizeof(Pel)*strideSrc*getTotalHeight(compId));
     228    }
     229    else
     230    {
     231      const Pel *pSrc       = getAddr(compId);
     232            Pel *pDest      = pcPicYuvDst->getAddr(compId);
     233      const UInt strideDest = pcPicYuvDst->getStride(compId);
     234
     235      for(Int y=0; y<height; y++, pSrc+=strideSrc, pDest+=strideDest)
     236      {
     237        ::memcpy(pDest, pSrc, width*sizeof(Pel));
     238      }
     239    }
     240  }
    206241}
    207242
     
    214249  }
    215250
    216   for(Int chan=0; chan<getNumberValidComponents(); chan++)
    217   {
    218     const ComponentID ch=ComponentID(chan);
    219     Pel *piTxt=getAddr(ch); // piTxt = point to (0,0) of image within bigger picture.
    220     const Int iStride=getStride(ch);
    221     const Int iWidth=getWidth(ch);
    222     const Int iHeight=getHeight(ch);
    223     const Int iMarginX=getMarginX(ch);
    224     const Int iMarginY=getMarginY(ch);
     251  for(Int comp=0; comp<getNumberValidComponents(); comp++)
     252  {
     253    const ComponentID compId=ComponentID(comp);
     254    Pel *piTxt=getAddr(compId); // piTxt = point to (0,0) of image within bigger picture.
     255    const Int stride=getStride(compId);
     256    const Int width=getWidth(compId);
     257    const Int height=getHeight(compId);
     258    const Int marginX=getMarginX(compId);
     259    const Int marginY=getMarginY(compId);
    225260
    226261    Pel*  pi = piTxt;
    227262    // do left and right margins
    228     for (Int y = 0; y < iHeight; y++)
    229     {
    230       for (Int x = 0; x < iMarginX; x++ )
    231       {
    232         pi[ -iMarginX + x ] = pi[0];
    233         pi[    iWidth + x ] = pi[iWidth-1];
    234       }
    235       pi += iStride;
     263    for (Int y = 0; y < height; y++)
     264    {
     265      for (Int x = 0; x < marginX; x++ )
     266      {
     267        pi[ -marginX + x ] = pi[0];
     268        pi[    width + x ] = pi[width-1];
     269      }
     270      pi += stride;
    236271    }
    237272
    238273    // pi is now the (0,height) (bottom left of image within bigger picture
    239     pi -= (iStride + iMarginX);
     274    pi -= (stride + marginX);
    240275    // pi is now the (-marginX, height-1)
    241     for (Int y = 0; y < iMarginY; y++ )
    242     {
    243       ::memcpy( pi + (y+1)*iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );
     276    for (Int y = 0; y < marginY; y++ )
     277    {
     278      ::memcpy( pi + (y+1)*stride, pi, sizeof(Pel)*(width + (marginX<<1)) );
    244279    }
    245280
    246281    // pi is still (-marginX, height-1)
    247     pi -= ((iHeight-1) * iStride);
     282    pi -= ((height-1) * stride);
    248283    // pi is now (-marginX, 0)
    249     for (Int y = 0; y < iMarginY; y++ )
    250     {
    251       ::memcpy( pi - (y+1)*iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );
     284    for (Int y = 0; y < marginY; y++ )
     285    {
     286      ::memcpy( pi - (y+1)*stride, pi, sizeof(Pel)*(width + (marginX<<1)) );
    252287    }
    253288  }
     
    259294
    260295// NOTE: This function is never called, but may be useful for developers.
    261 Void TComPicYuv::dump (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd) const
    262 {
    263   FILE* pFile;
    264   if (!bAdd)
    265   {
    266     pFile = fopen (pFileName, "wb");
    267   }
    268   else
    269   {
    270     pFile = fopen (pFileName, "ab");
    271   }
    272 
    273 
    274   for(Int chan = 0; chan < getNumberValidComponents(); chan++)
    275   {
    276     const ComponentID  ch     = ComponentID(chan);
    277     const Int          shift  = bitDepths.recon[toChannelType(ch)] - 8;
    278     const Int          offset = (shift>0)?(1<<(shift-1)):0;
    279     const Pel         *pi     = getAddr(ch);
    280     const Int          stride = getStride(ch);
    281     const Int          height = getHeight(ch);
    282     const Int          width  = getWidth(ch);
    283 
     296Void TComPicYuv::dump (const std::string &fileName, const BitDepths &bitDepths, const Bool bAppend, const Bool bForceTo8Bit) const
     297{
     298  FILE *pFile = fopen (fileName.c_str(), bAppend?"ab":"wb");
     299
     300  Bool is16bit=false;
     301  for(Int comp = 0; comp < getNumberValidComponents() && !bForceTo8Bit; comp++)
     302  {
     303    if (bitDepths.recon[toChannelType(ComponentID(comp))]>8)
     304  {
     305      is16bit=true;
     306    }
     307  }
     308
     309  for(Int comp = 0; comp < getNumberValidComponents(); comp++)
     310  {
     311    const ComponentID  compId = ComponentID(comp);
     312    const Pel         *pi     = getAddr(compId);
     313    const Int          stride = getStride(compId);
     314    const Int          height = getHeight(compId);
     315    const Int          width  = getWidth(compId);
     316
     317    if (is16bit)
     318    {
    284319    for (Int y = 0; y < height; y++ )
    285320    {
    286321      for (Int x = 0; x < width; x++ )
    287322      {
    288         UChar uc = (UChar)Clip3<Pel>(0, 255, (pi[x]+offset)>>shift);
     323          UChar uc = (UChar)((pi[x]>>0) & 0xff);
    289324        fwrite( &uc, sizeof(UChar), 1, pFile );
     325          uc = (UChar)((pi[x]>>8) & 0xff);
     326          fwrite( &uc, sizeof(UChar), 1, pFile );
    290327      }
    291328      pi += stride;
     329    }
     330  }
     331    else
     332    {
     333      const Int shift  = bitDepths.recon[toChannelType(compId)] - 8;
     334      const Int offset = (shift>0)?(1<<(shift-1)):0;
     335      for (Int y = 0; y < height; y++ )
     336      {
     337        for (Int x = 0; x < width; x++ )
     338        {
     339          UChar uc = (UChar)Clip3<Pel>(0, 255, (pi[x]+offset)>>shift);
     340          fwrite( &uc, sizeof(UChar), 1, pFile );
     341        }
     342        pi += stride;
     343      }
    292344    }
    293345  }
  • TabularUnified trunk/source/Lib/TLibCommon/TComPicYuv.h

    r1321 r1386  
    6969  // ------------------------------------------------------------------------------------------------
    7070
    71   Int   m_iPicWidth;                                ///< Width of picture in pixels
    72   Int   m_iPicHeight;                               ///< Height of picture in pixels
     71  Int   m_picWidth;                                 ///< Width of picture in pixels
     72  Int   m_picHeight;                                ///< Height of picture in pixels
    7373  ChromaFormat m_chromaFormatIDC;                   ///< Chroma Format
    7474
     
    7676  Int*  m_subCuOffsetInBuffer[MAX_NUM_CHANNEL_TYPE];///< Gives an offset in the buffer for a given sub-CU (and channel), relative to start of CTU
    7777
    78   Int   m_iMarginX;                                 ///< margin of Luma channel (chroma's may be smaller, depending on ratio)
    79   Int   m_iMarginY;                                 ///< margin of Luma channel (chroma's may be smaller, depending on ratio)
     78  Int   m_marginX;                                  ///< margin of Luma channel (chroma's may be smaller, depending on ratio)
     79  Int   m_marginY;                                  ///< margin of Luma channel (chroma's may be smaller, depending on ratio)
    8080
    8181  Bool  m_bIsBorderExtended;
     
    100100  // ------------------------------------------------------------------------------------------------
    101101
    102   Void          create            (const Int iPicWidth,
    103                                    const Int iPicHeight,
     102  Void          create            (const Int picWidth,
     103                                   const Int picHeight,
    104104                                   const ChromaFormat chromaFormatIDC,
    105                                    const UInt uiMaxCUWidth,  ///< used for generating offsets to CUs. Can use iPicWidth if no offsets are required
    106                                    const UInt uiMaxCUHeight, ///< used for generating offsets to CUs. Can use iPicHeight if no offsets are required
    107                                    const UInt uiMaxCUDepth,  ///< used for generating offsets to CUs. Can use 0 if no offsets are required
     105                                   const UInt maxCUWidth,  ///< used for generating offsets to CUs.
     106                                   const UInt maxCUHeight, ///< used for generating offsets to CUs.
     107                                   const UInt maxCUDepth,  ///< used for generating offsets to CUs.
    108108                                   const Bool bUseMargin);   ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image.
     109
     110  Void          createWithoutCUInfo(const Int picWidth,
     111                                    const Int picHeight,
     112                                    const ChromaFormat chromaFormatIDC,
     113                                    const Bool bUseMargin=false, ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image.
     114                                    const UInt maxCUWidth=0,   ///< used for margin only
     115                                    const UInt maxCUHeight=0); ///< used for margin only
    109116
    110117  Void          destroy           ();
     
    118125  // ------------------------------------------------------------------------------------------------
    119126
    120   Int           getWidth          (const ComponentID id) const { return  m_iPicWidth >> getComponentScaleX(id);   }
    121   Int           getHeight         (const ComponentID id) const { return  m_iPicHeight >> getComponentScaleY(id);  }
     127  Int           getWidth          (const ComponentID id) const { return  m_picWidth >> getComponentScaleX(id);   }
     128  Int           getHeight         (const ComponentID id) const { return  m_picHeight >> getComponentScaleY(id);  }
    122129  ChromaFormat  getChromaFormat   ()                     const { return m_chromaFormatIDC; }
    123130  UInt          getNumberValidComponents() const { return ::getNumberValidComponents(m_chromaFormatIDC); }
    124131
    125   Int           getStride         (const ComponentID id) const { return ((m_iPicWidth     ) + (m_iMarginX  <<1)) >> getComponentScaleX(id); }
    126   Int           getTotalHeight    (const ComponentID id) const { return ((m_iPicHeight    ) + (m_iMarginY  <<1)) >> getComponentScaleY(id); }
    127 
    128   Int           getMarginX        (const ComponentID id) const { return m_iMarginX >> getComponentScaleX(id);  }
    129   Int           getMarginY        (const ComponentID id) const { return m_iMarginY >> getComponentScaleY(id);  }
     132  Int           getStride         (const ComponentID id) const { return ((m_picWidth     ) + (m_marginX  <<1)) >> getComponentScaleX(id); }
     133private:
     134  Int           getStride         (const ChannelType id) const { return ((m_picWidth     ) + (m_marginX  <<1)) >> getChannelTypeScaleX(id); }
     135public:
     136  Int           getTotalHeight    (const ComponentID id) const { return ((m_picHeight    ) + (m_marginY  <<1)) >> getComponentScaleY(id); }
     137
     138  Int           getMarginX        (const ComponentID id) const { return m_marginX >> getComponentScaleX(id);  }
     139  Int           getMarginY        (const ComponentID id) const { return m_marginY >> getComponentScaleY(id);  }
    130140
    131141  // ------------------------------------------------------------------------------------------------
     
    135145  //  Access starting position of picture buffer with margin
    136146  Pel*          getBuf            (const ComponentID ch)       { return  m_apiPicBuf[ch];   }
     147  const Pel*    getBuf            (const ComponentID ch) const { return  m_apiPicBuf[ch];   }
    137148
    138149  //  Access starting position of original picture
     
    151162  UInt          getComponentScaleY(const ComponentID id) const { return ::getComponentScaleY(id, m_chromaFormatIDC); }
    152163
     164  UInt          getChannelTypeScaleX(const ChannelType id) const { return ::getChannelTypeScaleX(id, m_chromaFormatIDC); }
     165  UInt          getChannelTypeScaleY(const ChannelType id) const { return ::getChannelTypeScaleY(id, m_chromaFormatIDC); }
     166
    153167  // ------------------------------------------------------------------------------------------------
    154168  //  Miscellaneous
     
    162176
    163177  //  Dump picture
    164   Void          dump              (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd = false) const ;
     178  Void          dump              (const std::string &fileName, const BitDepths &bitDepths, const Bool bAppend=false, const Bool bForceTo8Bit=false) const ;
    165179
    166180  // Set border extension flag
     
    169183  Bool          getBorderExtension( )     { return m_bIsBorderExtended; }
    170184#endif
    171 #if NH_3D
     185#if NH_3D_VSO
    172186  // Set Function
    173187  Void  setLumaTo    ( Pel pVal ); 
    174188  Void  setChromaTo  ( Pel pVal ); 
     189#endif
     190#if NH_3D
    175191#if NH_3D_IV_MERGE
    176192  // sample to block and block to sample conversion
  • TabularUnified trunk/source/Lib/TLibCommon/TComPicYuvMD5.cpp

    r1313 r1386  
    209209std::string hashToString(const TComPictureHash &digest, Int numChar)
    210210{
    211   static const Char* hex = "0123456789abcdef";
     211  static const TChar* hex = "0123456789abcdef";
    212212  std::string result;
    213213
  • TabularUnified trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r1321 r1386  
    562562      Int RefPOCL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getPOC();
    563563      Int RefPOCL1 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getPOC();
    564 #if NH_MV_FIX_TICKET_106
    565564#if NH_MV
    566565      Int layerIdL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getLayerId();
     
    573572#else
    574573      if(RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))
    575 #endif
    576 #else
    577 #if NH_3D_ARP
    578       if(!pcCU->getARPW(PartAddr) && RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))
    579 #else
    580       if(RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))
    581 #endif
    582574#endif
    583575      {
     
    11391131  Int         iHeight;
    11401132  UInt        uiPartAddr;
     1133  const TComSlice *pSlice    = pcCU->getSlice();
     1134  const SliceType  sliceType = pSlice->getSliceType();
     1135  const TComPPS   &pps       = *(pSlice->getPPS());
    11411136
    11421137  if ( iPartIdx >= 0 )
     
    11471142    {
    11481143#endif
    1149       if ( eRefPicList != REF_PIC_LIST_X )
    1150       {
    1151         if( pcCU->getSlice()->getPPS()->getUseWP())
    1152         {
    1153           xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
    1154         }
    1155         else
    1156         {
    1157           xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    1158         }
    1159         if ( pcCU->getSlice()->getPPS()->getUseWP() )
    1160         {
    1161           xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    1162         }
     1144     if ( eRefPicList != REF_PIC_LIST_X )
     1145     {
     1146      if( (sliceType == P_SLICE && pps.getUseWP()) || (sliceType == B_SLICE && pps.getWPBiPred()))
     1147      {
     1148        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
     1149        xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    11631150      }
    11641151      else
    11651152      {
     1153        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
     1154      }
     1155     }
     1156     else
     1157     {
    11661158#if NH_3D_SPIVMP
    11671159        if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0) 
     
    12351227    if ( eRefPicList != REF_PIC_LIST_X )
    12361228    {
    1237       if( pcCU->getSlice()->getPPS()->getUseWP())
     1229      if( (sliceType == P_SLICE && pps.getUseWP()) || (sliceType == B_SLICE && pps.getWPBiPred()))
    12381230      {
    12391231        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
     1232        xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    12401233      }
    12411234      else
    12421235      {
    12431236        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    1244       }
    1245       if ( pcCU->getSlice()->getPPS()->getUseWP() )
    1246       {
    1247         xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    12481237      }
    12491238    }
     
    13171306  pcCU->clipMv(cMv);
    13181307
    1319 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     1308#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    13201309  if ( g_traceMotionInfoBeforUniPred  )
    13211310  {
     
    14491438      Int iCurrPOC    = pcCU->getSlice()->getPOC();
    14501439      Int iColRefPOC  = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx );
    1451     Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, arpRefIdx );
    1452       Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC);
     1440      Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, arpRefIdx );
     1441      Int iScale      = pcCU->xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC);
    14531442      if ( iScale != 4096 )
    14541443      {
    14551444        cMv = cMv.scaleMv( iScale );
    14561445      }
    1457     iRefIdx = arpRefIdx;
    1458   }
     1446      iRefIdx = arpRefIdx;
     1447    }
    14591448
    14601449  pcCU->clipMv(cMv);
     
    18301819
    18311820
     1821#if NH_3D
    18321822Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth
    18331823#if NH_3D_ARP
     
    18381828#endif
    18391829)
     1830#else
     1831Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth )
     1832#endif
    18401833{
    18411834#if NH_MV
     
    18731866  if ( yFrac == 0 )
    18741867  {
     1868#if NH_3D
     1869    m_if.filterHor(compID, ref, refStride, dst,  dstStride, cxWidth, cxHeight, xFrac, !bi
    18751870#if NH_3D_IC
    1876     m_if.filterHor(compID, ref, refStride, dst,  dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag, chFmt, bitDepth
    1877 #else
    1878     m_if.filterHor(compID, ref, refStride, dst,  dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt, bitDepth
    1879 #endif
     1871     || bICFlag
     1872#endif
     1873    , chFmt, bitDepth
    18801874#if NH_3D_ARP
    18811875    , filterType
    18821876#endif
    18831877);
     1878#else
     1879    m_if.filterHor(compID, ref, refStride, dst,  dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt, bitDepth );
     1880#endif
    18841881  }
    18851882  else if ( xFrac == 0 )
    18861883  {
     1884#if NH_3D
     1885  m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi
    18871886#if NH_3D_IC
    1888     m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag, chFmt, bitDepth
    1889 #else
    1890     m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt, bitDepth
    1891 #endif
     1887    || bICFlag
     1888#endif
     1889    , chFmt, bitDepth
    18921890#if NH_3D_ARP
    18931891    , filterType
    18941892#endif
    18951893);
     1894#else
     1895    m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt, bitDepth );
     1896
     1897#endif
    18961898  }
    18971899  else
     
    19021904    const Int vFilterSize = isLuma(compID) ? NTAPS_LUMA : NTAPS_CHROMA;
    19031905
    1904     m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false,      chFmt, bitDepth
    19051906#if NH_3D_ARP
    1906     , filterType
     1907    m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false,      chFmt, bitDepth, filterType );
     1908#else
     1909    m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false,      chFmt, bitDepth );
    19071910#endif
    1908 );
     1911
     1912#if NH_3D
     1913    m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight,               yFrac, false, !bi
    19091914#if NH_3D_IC
    1910     m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight,               yFrac, false, !bi || bICFlag, chFmt, bitDepth
    1911 #else
    1912     m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight,               yFrac, false, !bi, chFmt, bitDepth
    1913 #endif
     1915    || bICFlag
     1916#endif
     1917    , chFmt, bitDepth
    19141918#if NH_3D_ARP
    19151919    , filterType
    19161920#endif
    19171921);
     1922#else
     1923    m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight,               yFrac, false, !bi, chFmt, bitDepth );
     1924#endif
    19181925  }
    19191926
     
    19541961}
    19551962
    1956 Void TComPrediction::xWeightedAverage( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths
    1957  )
     1963Void TComPrediction::xWeightedAverage( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths )
    19581964{
    19591965  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
  • TabularUnified trunk/source/Lib/TLibCommon/TComPrediction.h

    r1321 r1386  
    115115#endif
    116116
     117#if NH_3D
    117118  Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth
    118119#if NH_3D_ARP
     
    123124#endif
    124125 );
    125 
     126#else
     127  Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth );
     128#endif
    126129#if NH_3D_VSP
    127130  Void xPredInterUniSubPU        ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );
  • TabularUnified trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r1321 r1386  
    4141#include "TComRom.h"
    4242#include "TComRdCost.h"
    43 #if NH_3D
     43#if NH_3D_VSO
    4444#include "TComDataCU.h"
    4545#include "TComRectangle.h"
     
    6464// Calculate RD functions
    6565#if NH_3D_VSO
    66 Double TComRdCost::calcRdCost( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc )
     66Double TComRdCost::calcRdCost( Double numBits, Dist intDistortion, DFunc eDFunc )
     67{
     68  Double distortion = (Double) intDistortion;
    6769#else
    68 Double TComRdCost::calcRdCost( UInt uiBits, Distortion uiDistortion, Bool bFlag, DFunc eDFunc )
    69 #endif
    70 {
    71   Double dRdCost = 0.0;
    72   Double dLambda = 0.0;
     70Double TComRdCost::calcRdCost( Double numBits, Double distortion, DFunc eDFunc )
     71{
     72#endif
     73 
     74  Double lambda = 1.0;
    7375
    7476  switch ( eDFunc )
     
    7880      break;
    7981    case DF_SAD:
    80 #if RExt__HIGH_BIT_DEPTH_SUPPORT
    81       dLambda = m_dLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate.
    82 #else
    83       dLambda = (Double)m_uiLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate.
    84 #endif
     82      lambda = m_dLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate.
    8583      break;
    8684    case DF_DEFAULT:
    87       dLambda =        m_dLambda;
     85      lambda = m_dLambda;
    8886      break;
    8987    case DF_SSE_FRAME:
    90       dLambda =        m_dFrameLambda;
     88      lambda = m_dFrameLambda;
    9189      break;
    9290    default:
     
    9593  }
    9694
    97   if (bFlag) //NOTE: this "bFlag" is never true
    98   {
    99     // Intra8x8, Intra4x4 Block only...
     95#if NH_MV
     96  // D_PRINT_INDENT( g_traceRDCost,  "Dist: " + n2s(distortion) + " Bits: " + n2s(numBits) + " RD Cost: " + n2s(dRdCost));
     97   D_PRINT_INDENT( g_traceRDCost,  "Dist: " + n2s(distortion) + " Bits: " + n2s(numBits) );
     98#endif
     99
     100  if (eDFunc == DF_SAD)
     101  {
    100102    if (m_costMode != COST_STANDARD_LOSSY)
    101103    {
    102       dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.
     104      return ((distortion * 65536.0) / lambda) + numBits; // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.
    103105    }
    104106    else
    105107    {
    106       dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda));
     108      return distortion + (((numBits * lambda) ) / 65536.0);
    107109    }
    108110  }
    109111  else
    110112  {
    111     if (eDFunc == DF_SAD)
    112     {
    113       if (m_costMode != COST_STANDARD_LOSSY)
    114       {
    115         dRdCost = ((Double(uiDistortion) * 65536) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.
    116       }
    117       else
    118       {
    119         dRdCost = floor(Double(uiDistortion) + (floor((Double(uiBits) * dLambda) + 0.5) / 65536.0));
    120       }
     113    if (m_costMode != COST_STANDARD_LOSSY)
     114    {
     115      return (distortion / lambda) + numBits; // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.
    121116    }
    122117    else
    123118    {
    124       if (m_costMode != COST_STANDARD_LOSSY)
    125       {
    126         dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.
    127       }
    128       else
    129       {
    130         dRdCost = floor(Double(uiDistortion) + (Double(uiBits) * dLambda) + 0.5);
    131       }
    132     }
    133   }
    134 
    135 #if NH_MV
    136   D_PRINT_INDENT( g_traceRDCost,  "Dist: " + n2s(uiDistortion) + " Bits: " + n2s(uiBits) + " RD Cost: " + n2s(dRdCost));
    137 #endif
    138   return dRdCost;
    139 }
    140 
    141 #if NH_3D_VSO
    142 Double TComRdCost::calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag, DFunc eDFunc )
    143 #else
    144 Double TComRdCost::calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag, DFunc eDFunc )
    145 #endif
    146 {
    147   Double dRdCost = 0.0;
    148   Double dLambda = 0.0;
    149 
    150   switch ( eDFunc )
    151   {
    152     case DF_SSE:
    153       assert(0);
    154       break;
    155     case DF_SAD:
    156 #if RExt__HIGH_BIT_DEPTH_SUPPORT
    157       dLambda = m_dLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate.
    158 #else
    159       dLambda = (Double)m_uiLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate.
    160 #endif
    161       break;
    162     case DF_DEFAULT:
    163       dLambda =         m_dLambda;
    164       break;
    165     case DF_SSE_FRAME:
    166       dLambda =         m_dFrameLambda;
    167       break;
    168     default:
    169       assert (0);
    170       break;
    171   }
    172 
    173   if (bFlag) //NOTE: this "bFlag" is never true
    174   {
    175     // Intra8x8, Intra4x4 Block only...
    176     if (m_costMode != COST_STANDARD_LOSSY)
    177     {
    178       dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.
    179     }
    180     else
    181     {
    182       dRdCost = (((Double)(Int64)uiDistortion) + ((Double)(Int64)uiBits * dLambda));
    183     }
    184   }
    185   else
    186   {
    187     if (eDFunc == DF_SAD)
    188     {
    189       if (m_costMode != COST_STANDARD_LOSSY)
    190       {
    191         dRdCost = ((Double(uiDistortion) * 65536) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.
    192       }
    193       else
    194       {
    195         dRdCost = floor(Double(uiDistortion) + (floor((Double(uiBits) * dLambda) + 0.5) / 65536.0));
    196       }
    197     }
    198     else
    199     {
    200       if (m_costMode != COST_STANDARD_LOSSY)
    201       {
    202         dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.
    203       }
    204       else
    205       {
    206         dRdCost = floor(Double(uiDistortion) + (Double(uiBits) * dLambda) + 0.5);
    207       }
    208     }
    209   }
    210 
    211   return dRdCost;
     119      return distortion + (numBits * lambda);
     120    }
     121  }
    212122}
    213123
     
    216126  m_dLambda           = dLambda;
    217127  m_sqrtLambda        = sqrt(m_dLambda);
    218 #if RExt__HIGH_BIT_DEPTH_SUPPORT
    219128  m_dLambdaMotionSAD[0] = 65536.0 * m_sqrtLambda;
    220129  m_dLambdaMotionSSE[0] = 65536.0 * m_dLambda;
     
    226135  m_dLambdaMotionSAD[1] = 65536.0 * sqrt(dLambda);
    227136  m_dLambdaMotionSSE[1] = 65536.0 * dLambda;
    228 #else
    229   m_uiLambdaMotionSAD[0] = (UInt)floor(65536.0 * m_sqrtLambda);
    230   m_uiLambdaMotionSSE[0] = (UInt)floor(65536.0 * m_dLambda   );
    231 #if FULL_NBIT
    232   dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12) / 3.0));
    233 #else
    234   dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (bitDepths.recon[CHANNEL_TYPE_LUMA] - 8)) / 3.0));
    235 #endif
    236   m_uiLambdaMotionSAD[1] = (UInt)floor(65536.0 * sqrt(dLambda));
    237   m_uiLambdaMotionSSE[1] = (UInt)floor(65536.0 * dLambda   );
    238 #endif
    239137}
    240138
     
    298196  m_costMode                   = COST_STANDARD_LOSSY;
    299197
    300 #if RExt__HIGH_BIT_DEPTH_SUPPORT
    301   m_dCost                      = 0;
    302 #else
    303   m_uiCost                     = 0;
    304 #endif
     198  m_motionLambda               = 0;
    305199  m_iCostScale                 = 0;
    306200
     
    370264  // initialize
    371265  rcDistParam.iSubShift  = 0;
     266  rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max();
    372267}
    373268
    374269// Setting the Distortion Parameter for Inter (ME)
    375 Void TComRdCost::setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, DistParam& rcDistParam )
     270Void TComRdCost::setDistParam( const TComPattern* const pcPatternKey, const Pel* piRefY, Int iRefStride, DistParam& rcDistParam )
    376271{
    377272  // set Original & Curr Pointer / Stride
     
    386281  rcDistParam.iRows    = pcPatternKey->getROIYHeight();
    387282  rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
     283  rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max();
    388284
    389285  if (rcDistParam.iCols == 12)
     
    411307
    412308// Setting the Distortion Parameter for Inter (subpel ME with step)
    413 Void TComRdCost::setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME )
     309Void TComRdCost::setDistParam( const TComPattern* const pcPatternKey, const Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME )
    414310{
    415311  // set Original & Curr Pointer / Stride
     
    427323  rcDistParam.iRows    = pcPatternKey->getROIYHeight();
    428324
     325  rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max();
     326
    429327  // set distortion function
    430328  if ( !bHADME )
     
    459357}
    460358
    461 Void TComRdCost::setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard )
     359Void TComRdCost::setDistParam( DistParam& rcDP, Int bitDepth, const Pel* p1, Int iStride1, const Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard )
    462360{
    463361  rcDP.pOrg       = p1;
     
    471369  rcDP.bitDepth   = bitDepth;
    472370  rcDP.DistFunc   = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ];
     371  rcDP.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max();
    473372#if NH_3D_DBBP
    474373  if( m_bUseMask )
     
    479378}
    480379
    481 Distortion TComRdCost::calcHAD( Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight )
     380Distortion TComRdCost::calcHAD( Int bitDepth, const Pel* pi0, Int iStride0, const Pel* pi1, Int iStride1, Int iWidth, Int iHeight )
    482381{
    483382  Distortion uiSum = 0;
     
    550449
    551450
    552 Distortion TComRdCost::getDistPart( Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc )
     451Distortion TComRdCost::getDistPart( Int bitDepth, const Pel* piCur, Int iCurStride,  const Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc )
    553452{
    554453  DistParam cDtParam;
     
    604503
    605504  cDtParam.bitDepth   = bitDepth;
    606 
     505#if NH_3D
    607506  cDtParam.bUseIC       = false;
     507#endif
    608508#if NH_3D_SDC_INTER
    609509  cDtParam.bUseSDCMRSAD = false;
     
    663563UInt TComRdCost::xGetMaskedSSE( DistParam* pcDtParam )
    664564{
    665   Pel* piOrg   = pcDtParam->pOrg;
    666   Pel* piCur   = pcDtParam->pCur;
     565  const Pel* piOrg   = pcDtParam->pOrg;
     566  const Pel* piCur   = pcDtParam->pCur;
    667567  Int  iRows   = pcDtParam->iRows;
    668568  Int  iCols   = pcDtParam->iCols;
     
    701601#endif
    702602 
    703   Pel* piOrg   = pcDtParam->pOrg;
    704   Pel* piCur   = pcDtParam->pCur;
     603  const Pel* piOrg   = pcDtParam->pOrg;
     604  const Pel* piCur   = pcDtParam->pCur;
    705605  Int  iRows   = pcDtParam->iRows;
    706606  Int  iCols   = pcDtParam->iCols;
     
    729629UInt TComRdCost::xGetMaskedVSD( DistParam* pcDtParam )
    730630{
    731   Pel* piOrg    = pcDtParam->pOrg;
    732   Pel* piCur    = pcDtParam->pCur;
    733   Pel* piVirRec = pcDtParam->pVirRec;
    734   Pel* piVirOrg = pcDtParam->pVirOrg;
     631  const Pel* piOrg    = pcDtParam->pOrg;
     632  const Pel* piCur    = pcDtParam->pCur;
     633  const Pel* piVirRec = pcDtParam->pVirRec;
     634  const Pel* piVirOrg = pcDtParam->pVirOrg;
    735635  Int  iRows    = pcDtParam->iRows;
    736636  Int  iCols    = pcDtParam->iCols;
     
    786686  const Pel* piOrg   = pcDtParam->pOrg;
    787687  const Pel* piCur   = pcDtParam->pCur;
    788   Int  iRows   = pcDtParam->iRows;
    789   Int  iCols   = pcDtParam->iCols;
    790   Int  iStrideCur = pcDtParam->iStrideCur;
    791   Int  iStrideOrg = pcDtParam->iStrideOrg;
     688  const Int  iCols           = pcDtParam->iCols;
     689  const Int  iStrideCur      = pcDtParam->iStrideCur;
     690  const Int  iStrideOrg      = pcDtParam->iStrideOrg;
     691  const UInt distortionShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
    792692
    793693  Distortion uiSum = 0;
    794694
    795   for( ; iRows != 0; iRows-- )
     695  for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- )
    796696  {
    797697    for (Int n = 0; n < iCols; n++ )
     
    799699      uiSum += abs( piOrg[n] - piCur[n] );
    800700    }
    801     piOrg += iStrideOrg;
    802     piCur += iStrideCur;
    803   }
    804 
    805   return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) );
     701    if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift ))
     702    {
     703      return ( uiSum >> distortionShift );
     704    }
     705    piOrg += iStrideOrg;
     706    piCur += iStrideCur;
     707  }
     708
     709  return ( uiSum >> distortionShift );
    806710}
    807711
     
    14031307    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    14041308  }
    1405   Pel* piOrg   = pcDtParam->pOrg;
    1406   Pel* piCur   = pcDtParam->pCur;
     1309  const Pel* piOrg   = pcDtParam->pOrg;
     1310  const Pel* piCur   = pcDtParam->pCur;
    14071311  Int  iRows   = pcDtParam->iRows;
    14081312  Int  iCols   = pcDtParam->iCols;
     
    14511355    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    14521356  }
    1453   Pel* piOrg   = pcDtParam->pOrg;
    1454   Pel* piCur   = pcDtParam->pCur;
     1357  const Pel* piOrg   = pcDtParam->pOrg;
     1358  const Pel* piCur   = pcDtParam->pCur;
    14551359  Int  iRows   = pcDtParam->iRows;
    14561360  Int  iSubShift  = pcDtParam->iSubShift;
     
    15081412    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    15091413  }
    1510   Pel* piOrg      = pcDtParam->pOrg;
    1511   Pel* piCur      = pcDtParam->pCur;
     1414  const Pel* piOrg      = pcDtParam->pOrg;
     1415  const Pel* piCur      = pcDtParam->pCur;
    15121416  Int  iRows      = pcDtParam->iRows;
    15131417  Int  iSubShift  = pcDtParam->iSubShift;
     
    15771481    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    15781482  }
    1579   Pel* piOrg   = pcDtParam->pOrg;
    1580   Pel* piCur   = pcDtParam->pCur;
     1483  const Pel* piOrg   = pcDtParam->pOrg;
     1484  const Pel* piCur   = pcDtParam->pCur;
    15811485  Int  iRows   = pcDtParam->iRows;
    15821486  Int  iSubShift  = pcDtParam->iSubShift;
     
    16701574    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    16711575  }
    1672   Pel* piOrg   = pcDtParam->pOrg;
    1673   Pel* piCur   = pcDtParam->pCur;
     1576  const Pel* piOrg   = pcDtParam->pOrg;
     1577  const Pel* piCur   = pcDtParam->pCur;
    16741578  Int  iRows   = pcDtParam->iRows;
    16751579  Int  iSubShift  = pcDtParam->iSubShift;
     
    17481652UInt TComRdCost::xGetSAD16Nic( DistParam* pcDtParam )
    17491653{
    1750   Pel* piOrg   = pcDtParam->pOrg;
    1751   Pel* piCur   = pcDtParam->pCur;
     1654  const Pel* piOrg   = pcDtParam->pOrg;
     1655  const Pel* piCur   = pcDtParam->pCur;
    17521656  Int  iRows   = pcDtParam->iRows;
    17531657  Int  iCols   = pcDtParam->iCols;
     
    18451749    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    18461750  }
    1847   Pel* piOrg   = pcDtParam->pOrg;
    1848   Pel* piCur   = pcDtParam->pCur;
     1751  const Pel* piOrg   = pcDtParam->pOrg;
     1752  const Pel* piCur   = pcDtParam->pCur;
    18491753  Int  iRows   = pcDtParam->iRows;
    18501754  Int  iSubShift  = pcDtParam->iSubShift;
     
    19871891    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    19881892  }
    1989   Pel* piOrg   = pcDtParam->pOrg;
    1990   Pel* piCur   = pcDtParam->pCur;
     1893  const Pel* piOrg   = pcDtParam->pOrg;
     1894  const Pel* piCur   = pcDtParam->pCur;
    19911895  Int  iRows   = pcDtParam->iRows;
    19921896  Int  iSubShift  = pcDtParam->iSubShift;
     
    21042008    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    21052009  }
    2106   Pel* piOrg   = pcDtParam->pOrg;
    2107   Pel* piCur   = pcDtParam->pCur;
     2010  const Pel* piOrg   = pcDtParam->pOrg;
     2011  const Pel* piCur   = pcDtParam->pCur;
    21082012  Int  iRows   = pcDtParam->iRows;
    21092013  Int  iSubShift  = pcDtParam->iSubShift;
     
    23432247  }
    23442248
    2345   Pel* piOrg   = pcDtParam->pOrg;
    2346   Pel* piCur   = pcDtParam->pCur;
     2249  const Pel* piOrg   = pcDtParam->pOrg;
     2250  const Pel* piCur   = pcDtParam->pCur;
    23472251  Int  iRows   = pcDtParam->iRows;
    23482252  Int  iSubShift  = pcDtParam->iSubShift;
     
    28792783#if NH_3D_VSO
    28802784//SAIT_VSO_EST_A0033
    2881 UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride,  Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y )
     2785UInt TComRdCost::getVSDEstimate( Int dDM, const Pel* pOrg, Int iOrgStride, const Pel* pVirRec, const Pel* pVirOrg, Int iVirStride, Int x, Int y )
    28822786{
    28832787  // change to use bit depth from DistParam struct
     
    28942798UInt TComRdCost::xGetVSD( DistParam* pcDtParam )
    28952799{
    2896   Pel* piOrg    = pcDtParam->pOrg;
    2897   Pel* piCur    = pcDtParam->pCur;
    2898   Pel* piVirRec = pcDtParam->pVirRec;
    2899   Pel* piVirOrg = pcDtParam->pVirOrg;
     2800  const Pel* piOrg    = pcDtParam->pOrg;
     2801  const Pel* piCur    = pcDtParam->pCur;
     2802  const Pel* piVirRec = pcDtParam->pVirRec;
     2803  const Pel* piVirOrg = pcDtParam->pVirOrg;
    29002804  Int  iRows    = pcDtParam->iRows;
    29012805  Int  iCols    = pcDtParam->iCols;
     
    29252829UInt TComRdCost::xGetVSD4( DistParam* pcDtParam )
    29262830{
    2927   Pel* piOrg   = pcDtParam->pOrg;
    2928   Pel* piCur   = pcDtParam->pCur;
    2929   Pel* piVirRec = pcDtParam->pVirRec;
    2930   Pel* piVirOrg = pcDtParam->pVirOrg;
     2831  const Pel* piOrg   = pcDtParam->pOrg;
     2832  const Pel* piCur   = pcDtParam->pCur;
     2833  const Pel* piVirRec = pcDtParam->pVirRec;
     2834  const Pel* piVirOrg = pcDtParam->pVirOrg;
    29312835  Int  iRows   = pcDtParam->iRows;
    29322836  Int  iStrideOrg = pcDtParam->iStrideOrg;
     
    29552859UInt TComRdCost::xGetVSD8( DistParam* pcDtParam )
    29562860{
    2957   Pel* piOrg   = pcDtParam->pOrg;
    2958   Pel* piCur   = pcDtParam->pCur;
    2959   Pel* piVirRec = pcDtParam->pVirRec;
    2960   Pel* piVirOrg = pcDtParam->pVirOrg;
     2861  const Pel* piOrg   = pcDtParam->pOrg;
     2862  const Pel* piCur   = pcDtParam->pCur;
     2863  const Pel* piVirRec = pcDtParam->pVirRec;
     2864  const Pel* piVirOrg = pcDtParam->pVirOrg;
    29612865  Int  iRows   = pcDtParam->iRows;
    29622866  Int  iStrideOrg = pcDtParam->iStrideOrg;
     
    29852889UInt TComRdCost::xGetVSD16( DistParam* pcDtParam )
    29862890{
    2987   Pel* piOrg   = pcDtParam->pOrg;
    2988   Pel* piCur   = pcDtParam->pCur;
    2989   Pel* piVirRec = pcDtParam->pVirRec;
    2990   Pel* piVirOrg = pcDtParam->pVirOrg;
     2891  const Pel* piOrg   = pcDtParam->pOrg;
     2892  const Pel* piCur   = pcDtParam->pCur;
     2893  const Pel* piVirRec = pcDtParam->pVirRec;
     2894  const Pel* piVirOrg = pcDtParam->pVirOrg;
    29912895  Int  iRows   = pcDtParam->iRows;
    29922896  Int  iStrideOrg = pcDtParam->iStrideOrg;
     
    30152919UInt TComRdCost::xGetVSD16N( DistParam* pcDtParam )
    30162920{
    3017   Pel* piOrg   = pcDtParam->pOrg;
    3018   Pel* piCur   = pcDtParam->pCur;
    3019   Pel* piVirRec = pcDtParam->pVirRec;
    3020   Pel* piVirOrg = pcDtParam->pVirOrg;
     2921  const Pel* piOrg   = pcDtParam->pOrg;
     2922  const Pel* piCur   = pcDtParam->pCur;
     2923  const Pel* piVirRec = pcDtParam->pVirRec;
     2924  const Pel* piVirOrg = pcDtParam->pVirOrg;
    30212925  Int  iRows   = pcDtParam->iRows;
    30222926  Int  iCols   = pcDtParam->iCols;
     
    30492953UInt TComRdCost::xGetVSD32( DistParam* pcDtParam )
    30502954{
    3051   Pel* piOrg   = pcDtParam->pOrg;
    3052   Pel* piCur   = pcDtParam->pCur;
    3053   Pel* piVirRec = pcDtParam->pVirRec;
    3054   Pel* piVirOrg = pcDtParam->pVirOrg;
     2955  const Pel* piOrg   = pcDtParam->pOrg;
     2956  const Pel* piCur   = pcDtParam->pCur;
     2957  const Pel* piVirRec = pcDtParam->pVirRec;
     2958  const Pel* piVirOrg = pcDtParam->pVirOrg;
    30552959  Int  iRows   = pcDtParam->iRows;
    30562960  Int  iStrideOrg = pcDtParam->iStrideOrg;
     
    30792983UInt TComRdCost::xGetVSD64( DistParam* pcDtParam )
    30802984{
    3081   Pel* piOrg      = pcDtParam->pOrg;
    3082   Pel* piCur      = pcDtParam->pCur;
    3083   Pel* piVirRec   = pcDtParam->pVirRec;
    3084   Pel* piVirOrg   = pcDtParam->pVirOrg;
     2985  const Pel* piOrg      = pcDtParam->pOrg;
     2986  const Pel* piCur      = pcDtParam->pCur;
     2987  const Pel* piVirRec   = pcDtParam->pVirRec;
     2988  const Pel* piVirOrg   = pcDtParam->pVirOrg;
    30852989  Int  iRows      = pcDtParam->iRows;
    30862990  Int  iStrideOrg = pcDtParam->iStrideOrg;
     
    31133017// --------------------------------------------------------------------------------------------------------------------
    31143018
    3115 Distortion TComRdCost::xCalcHADs2x2( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep )
     3019Distortion TComRdCost::xCalcHADs2x2( const Pel *piOrg, const Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep )
    31163020{
    31173021  Distortion satd = 0;
     
    31353039}
    31363040
    3137 Distortion TComRdCost::xCalcHADs4x4( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep )
     3041Distortion TComRdCost::xCalcHADs4x4( const Pel *piOrg, const Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep )
    31383042{
    31393043  Int k;
     
    32313135}
    32323136
    3233 Distortion TComRdCost::xCalcHADs8x8( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep )
     3137Distortion TComRdCost::xCalcHADs8x8( const Pel *piOrg, const Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep )
    32343138{
    32353139  Int k, i, j, jj;
     
    33483252#endif
    33493253
    3350   Pel* piOrg   = pcDtParam->pOrg;
    3351   Pel* piCur   = pcDtParam->pCur;
    3352   Int  iRows   = pcDtParam->iRows;
    3353   Int  iCols   = pcDtParam->iCols;
    3354   Int  iStrideCur = pcDtParam->iStrideCur;
    3355   Int  iStrideOrg = pcDtParam->iStrideOrg;
    3356   Int  iStep  = pcDtParam->iStep;
     3254  const Pel* piOrg      = pcDtParam->pOrg;
     3255  const Pel* piCur      = pcDtParam->pCur;
     3256  const Int  iRows      = pcDtParam->iRows;
     3257  const Int  iCols      = pcDtParam->iCols;
     3258  const Int  iStrideCur = pcDtParam->iStrideCur;
     3259  const Int  iStrideOrg = pcDtParam->iStrideOrg;
     3260  const Int  iStep      = pcDtParam->iStep;
    33573261
    33583262  Int  x, y;
     
    34183322    return TComRdCostWeightPrediction::xGetHADsw( pcDtParam );
    34193323  }
    3420   Pel* piOrg   = pcDtParam->pOrg;
    3421   Pel* piCur   = pcDtParam->pCur;
     3324  const Pel* piOrg   = pcDtParam->pOrg;
     3325  const Pel* piCur   = pcDtParam->pCur;
     3326 
    34223327  Int  iRows   = pcDtParam->iRows;
    34233328  Int  iCols   = pcDtParam->iCols;
     
    34493354  iDeltaC = (iOrigAvg - iCurAvg)/iRows/iCols;
    34503355
     3356  const Int orgMaxSize = MAX_CU_SIZE*MAX_CU_SIZE;
     3357  assert( iRows * iCols <= orgMaxSize );
     3358 
     3359  Pel orgMinusDeltaDc[ orgMaxSize ];
     3360  Pel* tempOrgMinusDeltaDc = orgMinusDeltaDc;
     3361 
    34513362  for ( y=0; y<iRows; y++ )
    34523363  {
    34533364    for ( x=0; x<iCols; x++ )
    34543365    {       
    3455       piOrg[x] -= iDeltaC;
    3456     }
    3457     piOrg += iStrideOrg;
    3458   }
     3366      tempOrgMinusDeltaDc[x] = (piOrg[x] - iDeltaC);
     3367    }
     3368    piOrg               += iStrideOrg;
     3369    tempOrgMinusDeltaDc += iStrideOrg;
     3370  }
     3371
     3372  tempOrgMinusDeltaDc = orgMinusDeltaDc;
    34593373
    34603374  piOrg   = pcDtParam->pOrg;
     
    34723386      for ( x=0; x<iCols; x+= 8 )
    34733387      {
    3474         uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     3388        uiSum += xCalcHADs8x8( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
    34753389      }
    3476       piOrg += iOffsetOrg;
    3477       piCur += iOffsetCur;
     3390      tempOrgMinusDeltaDc += iOffsetOrg;
     3391      piCur               += iOffsetCur;
    34783392    }
    34793393  }
     
    34873401      for ( x=0; x<iCols; x+= 16 )
    34883402      {
    3489         uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     3403        uiSum += xCalcHADs16x4( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
    34903404      }
    3491       piOrg += iOffsetOrg;
    3492       piCur += iOffsetCur;
     3405      tempOrgMinusDeltaDc += iOffsetOrg;
     3406      piCur               += iOffsetCur;
    34933407    }
    34943408  }
     
    35013415      for ( x=0; x<iCols; x+= 4 )
    35023416      {
    3503         uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     3417        uiSum += xCalcHADs4x16( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
    35043418      }
    3505       piOrg += iOffsetOrg;
    3506       piCur += iOffsetCur;
     3419      tempOrgMinusDeltaDc += iOffsetOrg;
     3420      piCur               += iOffsetCur;
    35073421    }
    35083422  }
     
    35173431      for ( x=0; x<iCols; x+= 4 )
    35183432      {
    3519         uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     3433        uiSum += xCalcHADs4x4( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
    35203434      }
    3521       piOrg += iOffsetOrg;
    3522       piCur += iOffsetCur;
     3435      tempOrgMinusDeltaDc += iOffsetOrg;
     3436      piCur               += iOffsetCur;
    35233437    }
    35243438  }
     
    35313445      for ( x=0; x<iCols; x+=2 )
    35323446      {
    3533         uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     3447        uiSum += xCalcHADs2x2( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
    35343448      }
    3535       piOrg += iOffsetOrg;
    3536       piCur += iOffsetCur;
     3449      tempOrgMinusDeltaDc += iOffsetOrg;
     3450      piCur               += iOffsetCur;
    35373451    }
    35383452  }
     
    35403454  {
    35413455    assert(false);
    3542   }
    3543 
    3544   piOrg   = pcDtParam->pOrg;
    3545 
    3546   for ( y=0; y<iRows; y++ )
    3547   {
    3548     for ( x=0; x<iCols; x++ )
    3549     {       
    3550       piOrg[x] += iDeltaC;
    3551     }
    3552     piOrg += iStrideOrg;
    35533456  }
    35543457
  • TabularUnified trunk/source/Lib/TLibCommon/TComRdCost.h

    r1313 r1386  
    4646#include "TComSlice.h"
    4747#include "TComRdCostWeightPrediction.h"
    48 #if NH_3D
     48#if NH_3D_VSO
    4949#include "../TLibRenderer/TRenModel.h"
    5050#include "TComYuv.h"
     
    5757class DistParam;
    5858class TComPattern;
    59 #if NH_3D
     59#if NH_3D_VSO
    6060class TComRdCost;
    6161#endif
     
    6868typedef Distortion (*FpDistFunc) (DistParam*); // TODO: can this pointer be replaced with a reference? - there are no NULL checks on pointer.
    6969
    70 #if NH_3D
     70
    7171#if NH_3D_VSO
    7272typedef Dist (TComRdCost::*FpDistFuncVSO) ( Int, Int, Pel*, Int, Pel*, Int, UInt, UInt, Bool );
    73 #endif
    7473#endif
    7574// ====================================================================================================================
     
    8180{
    8281public:
    83   Pel*  pOrg;
    84   Pel*  pCur;
     82  const Pel*            pOrg;
     83  const Pel*            pCur;
    8584  Int   iStrideOrg;
    8685  Int   iStrideCur;
     
    104103
    105104  Bool            bApplyWeight;     // whether weighted prediction is used or not
    106   WPScalingParam  *wpCur;           // weighted prediction scaling parameters for current ref
     105  Bool                  bIsBiPred;
     106
     107  const WPScalingParam *wpCur;           // weighted prediction scaling parameters for current ref
    107108  ComponentID     compIdx;
     109  Distortion            m_maximumDistortionForEarlyExit; /// During cost calculations, if distortion exceeds this value, cost calculations may early-terminate.
    108110
    109111  // (vertical) subsampling shift (for reducing complexity)
     
    112114
    113115  DistParam()
     116   : pOrg(NULL),
     117     pCur(NULL),
     118     iStrideOrg(0),
     119     iStrideCur(0),
     120     iRows(0),
     121     iCols(0),
     122     iStep(1),
     123     DistFunc(NULL),
     124     bitDepth(0),
     125     bApplyWeight(false),
     126     bIsBiPred(false),
     127     wpCur(NULL),
     128     compIdx(MAX_NUM_COMPONENT),
     129     m_maximumDistortionForEarlyExit(std::numeric_limits<Distortion>::max()),
     130     iSubShift(0)
    114131  {
    115     pOrg = NULL;
    116     pCur = NULL;
    117     iStrideOrg = 0;
    118     iStrideCur = 0;
    119     iRows = 0;
    120     iCols = 0;
    121     iStep = 1;
    122     DistFunc = NULL;
    123     iSubShift = 0;
    124     bitDepth = 0;
    125132#if NH_3D_VSO
    126133    // SAIT_VSO_EST_A0033
     
    146153  Double                  m_dLambda;
    147154  Double                  m_sqrtLambda;
    148 #if RExt__HIGH_BIT_DEPTH_SUPPORT
    149155  Double                  m_dLambdaMotionSAD[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/];
    150156  Double                  m_dLambdaMotionSSE[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/];
    151 #else
    152   UInt                    m_uiLambdaMotionSAD[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/];
    153   UInt                    m_uiLambdaMotionSSE[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/];
    154 #endif
    155157  Double                  m_dFrameLambda;
    156158#if NH_3D_VSO
     
    161163  // for motion cost
    162164  TComMv                  m_mvPredictor;
    163 #if RExt__HIGH_BIT_DEPTH_SUPPORT
    164   Double                  m_dCost;
    165 #else
    166   UInt                    m_uiCost;
    167 #endif
     165  Double                  m_motionLambda;
    168166  Int                     m_iCostScale;
    169167#if NH_3D_DBBP
     
    175173  virtual ~TComRdCost();
    176174#if NH_3D_VSO
    177   Double  calcRdCost  ( UInt   uiBits, Dist  uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
    178   Double  calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
     175  Double  calcRdCost64( UInt64 uiBits , Dist64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
     176  Double  calcRdCost( Double numBits, Dist intDistortion, DFunc eDFunc = DF_DEFAULT );
    179177#else
    180   Double  calcRdCost  ( UInt   uiBits, Distortion uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
    181   Double  calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
    182 #endif
     178  Double calcRdCost( Double numBits, Double distortion, DFunc eDFunc = DF_DEFAULT );
     179#endif
     180
    183181
    184182  Void    setDistortionWeight  ( const ComponentID compID, const Double distortionWeight ) { m_distortionWeight[compID] = distortionWeight; }
     
    202200
    203201  Void    setDistParam( UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc, DistParam& rcDistParam );
    204   Void    setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride,            DistParam& rcDistParam );
    205   Void    setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false );
    206   Void    setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false );
     202  Void    setDistParam( const TComPattern* const pcPatternKey, const Pel* piRefY, Int iRefStride,            DistParam& rcDistParam );
     203  Void    setDistParam( const TComPattern* const pcPatternKey, const Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false );
     204  Void    setDistParam( DistParam& rcDP, Int bitDepth, const Pel* p1, Int iStride1, const Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false );
    207205
    208206#if NH_3D_DBBP
     
    210208#endif
    211209
    212   Distortion calcHAD(Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight );
     210  Distortion calcHAD(Int bitDepth, const Pel* pi0, Int iStride0, const Pel* pi1, Int iStride1, Int iWidth, Int iHeight );
    213211
    214212#if NH_3D_ENC_DEPTH
     
    218216  // for motion cost
    219217  static UInt    xGetExpGolombNumberOfBits( Int iVal );
    220 #if RExt__HIGH_BIT_DEPTH_SUPPORT
    221   Void    getMotionCost( Bool bSad, Int iAdd, Bool bIsTransquantBypass ) { m_dCost = (bSad ? m_dLambdaMotionSAD[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING) ?1:0] + iAdd : m_dLambdaMotionSSE[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING)?1:0] + iAdd); }
    222 #else
    223   Void    getMotionCost( Bool bSad, Int iAdd, Bool bIsTransquantBypass ) { m_uiCost = (bSad ? m_uiLambdaMotionSAD[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING) ?1:0] + iAdd : m_uiLambdaMotionSSE[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING)?1:0] + iAdd); }
    224 #endif
     218  Void    selectMotionLambda( Bool bSad, Int iAdd, Bool bIsTransquantBypass ) { m_motionLambda = (bSad ? m_dLambdaMotionSAD[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING) ?1:0] + iAdd : m_dLambdaMotionSSE[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING)?1:0] + iAdd); }
    225219  Void    setPredictor( TComMv& rcMv )
    226220  {
     
    228222  }
    229223  Void    setCostScale( Int iCostScale )    { m_iCostScale = iCostScale; }
    230   __inline Distortion getCost( Int x, Int y )
     224  Distortion getCost( UInt b )                 { return Distortion(( m_motionLambda * b ) / 65536.0); }
     225  Distortion getCostOfVectorWithPredictor( const Int x, const Int y )
    231226  {
    232 #if RExt__HIGH_BIT_DEPTH_SUPPORT
    233     return Distortion((m_dCost * getBits(x, y)) / 65536.0);
    234 #else
    235     return m_uiCost * getBits(x, y) >> 16;
    236 #endif
     227    return Distortion((m_motionLambda * getBitsOfVectorWithPredictor(x, y)) / 65536.0);
    237228  }
    238 #if RExt__HIGH_BIT_DEPTH_SUPPORT
    239   Distortion getCost( UInt b )                 { return Distortion(( m_dCost * b ) / 65536.0); }
    240 #else
    241   Distortion getCost( UInt b )                 { return ( m_uiCost * b ) >> 16; }
    242 #endif
    243   UInt    getBits( Int x, Int y )
     229  UInt getBitsOfVectorWithPredictor( const Int x, const Int y )
    244230  {
    245231    return xGetExpGolombNumberOfBits((x << m_iCostScale) - m_mvPredictor.getHor())
     
    299285
    300286  static Distortion xGetHADs          ( DistParam* pcDtParam );
    301   static Distortion xCalcHADs2x2      ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );
    302   static Distortion xCalcHADs4x4      ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );
    303   static Distortion xCalcHADs8x8      ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );
     287  static Distortion xCalcHADs2x2      ( const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );
     288  static Distortion xCalcHADs4x4      ( const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );
     289  static Distortion xCalcHADs8x8      ( const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );
    304290#if NH_3D_DBBP
    305291  static UInt xGetMaskedSSE     ( DistParam* pcDtParam );
     
    311297public:
    312298
    313   Distortion   getDistPart(Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc = DF_SSE );
     299  Distortion   getDistPart(Int bitDepth, const Pel* piCur, Int iCurStride, const Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc = DF_SSE );
    314300
    315301#if KWU_RC_MADPRED_E0227
     
    320306  // SAIT_VSO_EST_A0033
    321307  UInt        getDistPartVSD( TComDataCU* pcCu, UInt uiPartOffset, Int bitDepth, Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHad, DFunc eDFunc = DF_VSD);
    322   static UInt getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride,  Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y );
     308  static UInt getVSDEstimate( Int dDM, const Pel* pOrg, Int iOrgStride,  const Pel* pVirRec, const Pel* pVirOrg, Int iVirStride, Int x, Int y );
    323309
    324310private:
  • TabularUnified trunk/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp

    r1313 r1386  
    7070  const Int             shift      = wpCur.shift;
    7171  const Int             round      = wpCur.round;
     72  const Int        distortionShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    7273
    7374  Distortion uiSum = 0;
    7475
     76#if !U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING
    7577  for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- )
    7678  {
     
    8082
    8183      uiSum += abs( piOrg[n] - pred );
     84    }
     85    if (pcDtParam->m_maximumDistortionForEarlyExit <  ( uiSum >> distortionShift))
     86    {
     87      return uiSum >> distortionShift;
    8288    }
    8389    piOrg += iStrideOrg;
     
    8692
    8793  pcDtParam->compIdx = MAX_NUM_COMPONENT;  // reset for DEBUG (assert test)
    88 
    89   return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     94#else
     95  // Default weight
     96  if (w0 == 1 << shift)
     97  {
     98    // no offset
     99    if (offset == 0)
     100    {
     101      for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- )
     102      {
     103        for (Int n = 0; n < iCols; n++ )
     104        {
     105          uiSum += abs( piOrg[n] - piCur[n] );
     106        }
     107        if (pcDtParam->m_maximumDistortionForEarlyExit <  ( uiSum >> distortionShift))
     108        {
     109          return uiSum >> distortionShift;
     110        }
     111        piOrg += iStrideOrg;
     112        piCur += iStrideCur;
     113      }
     114    }
     115    else
     116    {
     117      // Lets not clip for the bipredictive case since clipping should be done after
     118      // combining both elements. Unfortunately the code uses the suboptimal "subtraction"
     119      // method, which is faster but introduces the clipping issue (therefore Bipred is suboptimal).
     120      if (pcDtParam->bIsBiPred)
     121      {
     122        for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- )
     123        {
     124          for (Int n = 0; n < iCols; n++ )
     125          {
     126            uiSum += abs( piOrg[n] - (piCur[n] + offset) );
     127          }
     128          if (pcDtParam->m_maximumDistortionForEarlyExit <  ( uiSum >> distortionShift))
     129          {
     130            return uiSum >> distortionShift;
     131          }
     132
     133          piOrg += iStrideOrg;
     134          piCur += iStrideCur;
     135        }
     136      }
     137      else
     138      {
     139        const Pel iMaxValue = (Pel) ((1 << pcDtParam->bitDepth) - 1);
     140        for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- )
     141        {
     142          for (Int n = 0; n < iCols; n++ )
     143          {
     144            const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (piCur[n] + offset)) ;
     145
     146            uiSum += abs( piOrg[n] - pred );
     147          }
     148          if (pcDtParam->m_maximumDistortionForEarlyExit <  ( uiSum >> distortionShift))
     149          {
     150            return uiSum >> distortionShift;
     151          }
     152          piOrg += iStrideOrg;
     153          piCur += iStrideCur;
     154        }
     155      }
     156    }
     157  }
     158  else
     159  {
     160    // Lets not clip for the bipredictive case since clipping should be done after
     161    // combining both elements. Unfortunately the code uses the suboptimal "subtraction"
     162    // method, which is faster but introduces the clipping issue (therefore Bipred is suboptimal).
     163    if (pcDtParam->bIsBiPred)
     164    {
     165      for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- )
     166      {
     167        for (Int n = 0; n < iCols; n++ )
     168        {
     169          const Pel pred = ( (w0*piCur[n] + round) >> shift ) + offset ;
     170          uiSum += abs( piOrg[n] - pred );
     171        }
     172        if (pcDtParam->m_maximumDistortionForEarlyExit <  ( uiSum >> distortionShift))
     173        {
     174          return uiSum >> distortionShift;
     175        }
     176
     177        piOrg += iStrideOrg;
     178        piCur += iStrideCur;
     179      }
     180    }
     181    else
     182    {
     183      const Pel iMaxValue = (Pel) ((1 << pcDtParam->bitDepth) - 1);
     184
     185      if (offset == 0)
     186      {
     187        for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- )
     188        {
     189          for (Int n = 0; n < iCols; n++ )
     190          {
     191            const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (( (w0*piCur[n] + round) >> shift ))) ;
     192
     193            uiSum += abs( piOrg[n] - pred );
     194          }
     195          if (pcDtParam->m_maximumDistortionForEarlyExit <  ( uiSum >> distortionShift))
     196          {
     197            return uiSum >> distortionShift;
     198          }
     199          piOrg += iStrideOrg;
     200          piCur += iStrideCur;
     201        }
     202      }
     203      else
     204      {
     205        for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- )
     206        {
     207          for (Int n = 0; n < iCols; n++ )
     208          {
     209            const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (( (w0*piCur[n] + round) >> shift ) + offset)) ;
     210
     211            uiSum += abs( piOrg[n] - pred );
     212          }
     213          if (pcDtParam->m_maximumDistortionForEarlyExit <  ( uiSum >> distortionShift))
     214          {
     215            return uiSum >> distortionShift;
     216          }
     217          piOrg += iStrideOrg;
     218          piCur += iStrideCur;
     219        }
     220      }
     221    }
     222  }
     223  //pcDtParam->compIdx = MAX_NUM_COMPONENT;  // reset for DEBUG (assert test)
     224#endif
     225
     226  return uiSum >> distortionShift;
    90227}
    91228
     
    119256  Distortion sum = 0;
    120257
     258#if !U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING
    121259  for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- )
    122260  {
     
    132270
    133271  pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test)
     272#else
     273  if (pcDtParam->bIsBiPred)
     274  {
     275    for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- )
     276    {
     277      for (Int n = 0; n < iCols; n++ )
     278      {
     279        const Pel pred     = ( (w0*piCur[n] + round) >> shift ) + offset ;
     280        const Pel residual = piOrg[n] - pred;
     281        sum += ( Distortion(residual) * Distortion(residual) ) >> distortionShift;
     282      }
     283      piOrg += iStrideOrg;
     284      piCur += iStrideCur;
     285    }
     286  }
     287  else
     288  {
     289    const Pel iMaxValue = (Pel) ((1 << pcDtParam->bitDepth) - 1);
     290
     291    for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- )
     292    {
     293      for (Int n = 0; n < iCols; n++ )
     294      {
     295        const Pel pred     = Clip3((Pel) 0, iMaxValue, (Pel) (( (w0*piCur[n] + round) >> shift ) + offset)) ;
     296        const Pel residual = piOrg[n] - pred;
     297        sum += ( Distortion(residual) * Distortion(residual) ) >> distortionShift;
     298      }
     299      piOrg += iStrideOrg;
     300      piCur += iStrideCur;
     301    }
     302  }
     303
     304  //pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test)
     305#endif
    134306
    135307  return sum;
     
    416588  const ComponentID compIdx    = pcDtParam->compIdx;
    417589  assert(compIdx<MAX_NUM_COMPONENT);
    418   const WPScalingParam  wpCur    = pcDtParam->wpCur[compIdx];
     590  const WPScalingParam &wpCur  = pcDtParam->wpCur[compIdx];
    419591
    420592  Distortion uiSum = 0;
  • TabularUnified trunk/source/Lib/TLibCommon/TComRom.cpp

    r1321 r1386  
    4747//! \ingroup TLibCommon
    4848//! \{
    49 const Char* nalUnitTypeToString(NalUnitType type)
     49const TChar* nalUnitTypeToString(NalUnitType type)
    5050{
    5151  switch (type)
     
    221221  }
    222222#if NH_MV
    223 #if H_MV_HLS_PTL_LIMITS
     223#if NH_MV_HLS_PTL_LIMITS
    224224 g_generalTierAndLevelLimits[ Level::LEVEL1   ] = TComGeneralTierAndLevelLimits(    36864,     350,  MIN_INT,   16,   1,   1 );
    225225 g_generalTierAndLevelLimits[ Level::LEVEL2   ] = TComGeneralTierAndLevelLimits(   122880,    1500,  MIN_INT,   16,   1,   1 );
     
    532532// Misc.
    533533// ====================================================================================================================
    534 Char  g_aucConvertToBit  [ MAX_CU_SIZE+1 ];
     534SChar  g_aucConvertToBit  [ MAX_CU_SIZE+1 ];
    535535#if ENC_DEC_TRACE
    536536FILE*  g_hTrace = NULL; // Set to NULL to open up a file. Set to stdout to use the current output
     
    540540Bool   g_bJustDoIt = false;
    541541UInt64 g_nSymbolCounter = 0;
    542 #if H_MV_ENC_DEC_TRAC
     542#if NH_MV_ENC_DEC_TRAC
    543543Bool g_traceCU = false;
    544544Bool g_tracePU = false;
     
    582582const UInt g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ] = {0,1,2,3,4,6,8,12,16,24};
    583583const UInt g_uiGroupIdx[ MAX_TU_SIZE ]   = {0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9};
    584 const Char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] =
     584const TChar *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] =
    585585{
    586586  {
     
    617617  },
    618618};
    619 const Char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] =
     619const TChar *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] =
    620620{
    621621  {
     
    671671const UInt g_scalingListSize   [SCALING_LIST_SIZE_NUM] = {16,64,256,1024};
    672672const UInt g_scalingListSizeX  [SCALING_LIST_SIZE_NUM] = { 4, 8, 16,  32};
    673 #if H_MV_ENC_DEC_TRAC
     673#if NH_MV_ENC_DEC_TRAC
    674674#if ENC_DEC_TRACE
    675 Void tracePSHeader( const Char* psName, Int layerId )
     675Void tracePSHeader( const TChar* psName, Int layerId )
    676676
    677677  if ( !g_disableHLSTrace  )
     
    727727  } 
    728728}
    729 Void writeToTraceFile( const Char* symbolName, Int val, Bool doIt )
     729Void writeToTraceFile( const TChar* symbolName, Int val, Bool doIt )
    730730{
    731731  if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  )
     
    749749  return g_nSymbolCounter;
    750750}
    751 Void writeToTraceFile( const Char* symbolName, Bool doIt )
     751Void writeToTraceFile( const TChar* symbolName, Bool doIt )
    752752{
    753753  if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  )
  • TabularUnified trunk/source/Lib/TLibCommon/TComRom.h

    r1321 r1386  
    112112// ====================================================================================================================
    113113extern const TMatrixCoeff g_as_DST_MAT_4 [TRANSFORM_NUMBER_OF_DIRECTIONS][4][4];
    114 #if H_MV_HLS_PTL_LIMITS
     114#if NH_MV_HLS_PTL_LIMITS
    115115class TComGeneralTierAndLevelLimits
    116116{
     
    149149// Misc.
    150150// ====================================================================================================================
    151 extern       Char   g_aucConvertToBit  [ MAX_CU_SIZE+1 ];   // from width to log2(width)-2
     151extern       SChar   g_aucConvertToBit  [ MAX_CU_SIZE+1 ];   // from width to log2(width)-2
    152152#if NH_MV
    153153// Change later
     
    172172#define DTRACE_CABAC_R( x,y ) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, x,    y );
    173173#define DTRACE_CABAC_N        if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "\n"    );
    174 #if H_MV_ENC_DEC_TRAC
     174#if NH_MV_ENC_DEC_TRAC
    175175 extern Bool   g_traceCU;
    176176 extern Bool   g_tracePU ;
     
    206206#define D_PRINT_INC_INDENT( b, str ) prinStrIncIndent( b, str );
    207207#define D_PRINT_INDENT( b, str )     printStrIndent   ( b, str);
    208  Void           tracePSHeader   ( const Char* psName, Int layerId );
    209  Void           writeToTraceFile( const Char* symbolName, Int val, Bool doIt );
    210  Void           writeToTraceFile( const Char* symbolName, Bool doIt );
     208 Void           tracePSHeader   ( const TChar* psName, Int layerId );
     209 Void           writeToTraceFile( const TChar* symbolName, Int val, Bool doIt );
     210 Void           writeToTraceFile( const TChar* symbolName, Bool doIt );
    211211 UInt64         incSymbolCounter();         
    212212 Void           stopAtPos       ( Int poc, Int layerId, Int cuPelX, Int cuPelY, Int cuWidth, Int cuHeight );           
     
    243243#endif
    244244#endif
    245 const Char* nalUnitTypeToString(NalUnitType type);
    246 extern const Char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM];
    247 extern const Char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM];
     245const TChar* nalUnitTypeToString(NalUnitType type);
     246
     247extern const TChar *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM];
     248extern const TChar *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM];
    248249extern const Int g_quantTSDefault4x4[4*4];
    249250extern const Int g_quantIntraDefault8x8[8*8];
  • TabularUnified trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp

    r1313 r1386  
    324324      m_signLineBuf1 = NULL;
    325325    }
    326     m_signLineBuf1 = new Char[m_lineBufWidth+1];
     326    m_signLineBuf1 = new SChar[m_lineBufWidth+1];
    327327
    328328    if (m_signLineBuf2)
     
    331331      m_signLineBuf2 = NULL;
    332332    }
    333     m_signLineBuf2 = new Char[m_lineBufWidth+1];
     333    m_signLineBuf2 = new SChar[m_lineBufWidth+1];
    334334  }
    335335
     
    338338  Int x,y, startX, startY, endX, endY, edgeType;
    339339  Int firstLineStartX, firstLineEndX, lastLineStartX, lastLineEndX;
    340   Char signLeft, signRight, signDown;
     340  SChar signLeft, signRight, signDown;
    341341
    342342  Pel* srcLine = srcBlk;
     
    352352      for (y=0; y< height; y++)
    353353      {
    354         signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]);
     354        signLeft = (SChar)sgn(srcLine[startX] - srcLine[startX-1]);
    355355        for (x=startX; x< endX; x++)
    356356        {
    357           signRight = (Char)sgn(srcLine[x] - srcLine[x+1]);
     357          signRight = (SChar)sgn(srcLine[x] - srcLine[x+1]);
    358358          edgeType =  signRight + signLeft;
    359359          signLeft  = -signRight;
     
    370370    {
    371371      offset += 2;
    372       Char *signUpLine = m_signLineBuf1;
     372      SChar *signUpLine = m_signLineBuf1;
    373373
    374374      startY = isAboveAvail ? 0 : 1;
     
    383383      for (x=0; x< width; x++)
    384384      {
    385         signUpLine[x] = (Char)sgn(srcLine[x] - srcLineAbove[x]);
     385        signUpLine[x] = (SChar)sgn(srcLine[x] - srcLineAbove[x]);
    386386      }
    387387
     
    393393        for (x=0; x< width; x++)
    394394        {
    395           signDown  = (Char)sgn(srcLine[x] - srcLineBelow[x]);
     395          signDown  = (SChar)sgn(srcLine[x] - srcLineBelow[x]);
    396396          edgeType = signDown + signUpLine[x];
    397397          signUpLine[x]= -signDown;
     
    408408    {
    409409      offset += 2;
    410       Char *signUpLine, *signDownLine, *signTmpLine;
     410      SChar *signUpLine, *signDownLine, *signTmpLine;
    411411
    412412      signUpLine  = m_signLineBuf1;
     
    420420      for (x=startX; x< endX+1; x++)
    421421      {
    422         signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x- 1]);
     422        signUpLine[x] = (SChar)sgn(srcLineBelow[x] - srcLine[x- 1]);
    423423      }
    424424
     
    444444        for (x=startX; x<endX; x++)
    445445        {
    446           signDown =  (Char)sgn(srcLine[x] - srcLineBelow[x+ 1]);
     446          signDown =  (SChar)sgn(srcLine[x] - srcLineBelow[x+ 1]);
    447447          edgeType =  signDown + signUpLine[x];
    448448          resLine[x] = Clip3<Int>(0, maxSampleValueIncl, srcLine[x] + offset[edgeType]);
     
    450450          signDownLine[x+1] = -signDown;
    451451        }
    452         signDownLine[startX] = (Char)sgn(srcLineBelow[startX] - srcLine[startX-1]);
     452        signDownLine[startX] = (SChar)sgn(srcLineBelow[startX] - srcLine[startX-1]);
    453453
    454454        signTmpLine  = signUpLine;
     
    475475    {
    476476      offset += 2;
    477       Char *signUpLine = m_signLineBuf1+1;
     477      SChar *signUpLine = m_signLineBuf1+1;
    478478
    479479      startX = isLeftAvail ? 0 : 1;
     
    484484      for (x=startX-1; x< endX; x++)
    485485      {
    486         signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x+1]);
     486        signUpLine[x] = (SChar)sgn(srcLineBelow[x] - srcLine[x+1]);
    487487      }
    488488
     
    507507        for(x= startX; x< endX; x++)
    508508        {
    509           signDown =  (Char)sgn(srcLine[x] - srcLineBelow[x-1]);
     509          signDown =  (SChar)sgn(srcLine[x] - srcLineBelow[x-1]);
    510510          edgeType =  signDown + signUpLine[x];
    511511          resLine[x] = Clip3<Int>(0, maxSampleValueIncl, srcLine[x] + offset[edgeType]);
    512512          signUpLine[x-1] = -signDown;
    513513        }
    514         signUpLine[endX-1] = (Char)sgn(srcLineBelow[endX-1] - srcLine[endX]);
     514        signUpLine[endX-1] = (SChar)sgn(srcLineBelow[endX-1] - srcLine[endX]);
    515515        srcLine  += srcStride;
    516516        resLine += resStride;
  • TabularUnified trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h

    r1313 r1386  
    9696
    9797  Int m_lineBufWidth;
    98   Char* m_signLineBuf1;
    99   Char* m_signLineBuf2;
     98  SChar* m_signLineBuf1;
     99  SChar* m_signLineBuf2;
    100100  ChromaFormat m_chromaFormatIDC;
    101101private:
  • TabularUnified trunk/source/Lib/TLibCommon/TComSlice.cpp

    r1321 r1386  
    118118, m_viewId                        (0)
    119119, m_viewIndex                     (0)
    120 #if NH_3D
     120#if NH_3D_VSO
    121121, m_isDepth                       (false)
    122122#endif
     
    452452Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr )
    453453{
    454   if (!checkNumPocTotalCurr)
    455   {
    456454    if (m_eSliceType == I_SLICE)
    457455    {
     
    459457      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
    460458
     459    if (!checkNumPocTotalCurr)
     460    {
    461461      return;
    462462    }
    463 
    464     m_aiNumRefIdx[REF_PIC_LIST_0] = getNumRefIdx(REF_PIC_LIST_0);
    465     m_aiNumRefIdx[REF_PIC_LIST_1] = getNumRefIdx(REF_PIC_LIST_1);
    466463  }
    467464
     
    536533    if (m_eSliceType == I_SLICE)
    537534    {
    538       ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
    539       ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
    540 
    541535      return;
    542536    }
     
    545539    // general tier and level limit:
    546540    assert(numPicTotalCurr <= 8);
    547 
    548     m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    549     m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
    550541  }
    551542
     
    19321923  for ( Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++)
    19331924  {
     1925#if !NH_3D_FIX_TICKET_107
    19341926    m_layerSetIdxForOlsMinus1[i]  = -1;
     1927#endif
    19351928    for ( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++)
    19361929    {
     
    21912184}
    21922185
    2193 #if NH_3D
    2194 Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag ) const
     2186#if NH_3D_VSO
     2187Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag, Int auxId ) const
    21952188{
    21962189  Int foundLayerIdinNuh = -1;
     
    21992192  {
    22002193    Int layerIdInNuh = getLayerIdInNuh( layerIdInVps );
     2194#if !NH_3D
     2195    if( ( getViewIndex( layerIdInNuh ) == viewIndex ) && ( getAuxId( layerIdInNuh ) == ( depthFlag ? 2 : 0 ) )  )
     2196#else
    22012197    if( ( getViewIndex( layerIdInNuh ) == viewIndex ) && ( getDepthId( layerIdInNuh ) == ( depthFlag ? 1 : 0 ) )  )
     2198#endif
    22022199    {
    22032200      foundLayerIdinNuh = layerIdInNuh;
     
    22072204  return foundLayerIdinNuh;
    22082205}
    2209 
     2206#endif
     2207#if NH_3D
    22102208Void TComVPS::createCamPars(Int iNumViews)
    22112209{
     
    27672765    m_uiSpsMaxLatencyIncreasePlus1[i] = 0;
    27682766#else
    2769     m_uiMaxLatencyIncrease[i] = 0;
     2767    m_uiMaxLatencyIncreasePlus1[i] = 0;
    27702768#endif
    27712769    m_uiMaxDecPicBuffering[i] = 1;
     
    36763674    }
    36773675    tempRefPicInListsFlag = (getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0) && getDefaultRefViewIdxAvailableFlag();
    3678     m_nARPStepNum = tempRefPicInListsFlag ?  H_3D_ARP_WFNR : 0;
     3676    m_nARPStepNum = tempRefPicInListsFlag ? 3 : 0;
    36793677  }
    36803678
     
    38663864}
    38673865#endif
    3868 #if NH_3D
     3866#if NH_3D_QTL
    38693867Void TComSlice::setIvPicLists( TComPicLists* m_ivPicLists )
    38703868
     
    38733871    for ( Int depthId = 0; depthId < 2; depthId++ )
    38743872    {
    3875       m_ivPicsCurrPoc[ depthId ][ i ] = ( i <= m_viewIndex ) ? m_ivPicLists->getPic( i, ( depthId == 1) , getPOC() ) : NULL;
     3873      m_ivPicsCurrPoc[ depthId ][ i ] = ( i <= m_viewIndex ) ? m_ivPicLists->getPic( i, ( depthId == 1) , 0, getPOC() ) : NULL;
    38763874    }       
    38773875  } 
    38783876}
     3877#endif
     3878#if NH_3D
    38793879Void TComSlice::setDepthToDisparityLUTs()
    38803880{
     
    39373937  {
    39383938    Int iInVoi = vps->getVoiInVps( i );
    3939 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     3939#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    39403940    if ( g_traceCameraParameters )
    39413941    {
     
    43204320  const TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();
    43214321
    4322   m_ivMvPredFlag           = sps3dExt->getIvMvPredFlag         ( depthFlag ) && nRLLG0                       ;                             
    4323   m_ivMvScalingFlag        = sps3dExt->getIvMvScalingFlag      ( depthFlag )                                 ;                             
    4324   m_ivResPredFlag          = sps3dExt->getIvResPredFlag        ( depthFlag ) && nRLLG0                       ;                               
    4325   m_depthRefinementFlag    = sps3dExt->getDepthRefinementFlag  ( depthFlag )           && getInCompPredFlag() && m_cpAvailableFlag;
    4326   m_viewSynthesisPredFlag  = sps3dExt->getViewSynthesisPredFlag( depthFlag ) && nRLLG0 && getInCompPredFlag() && m_cpAvailableFlag;
    4327   m_depthBasedBlkPartFlag  = sps3dExt->getDepthBasedBlkPartFlag( depthFlag )           && getInCompPredFlag();                         
    4328   m_mpiFlag                = sps3dExt->getMpiFlag              ( depthFlag )           && getInCompPredFlag();
    4329   m_intraContourFlag       = sps3dExt->getIntraContourFlag     ( depthFlag )           && getInCompPredFlag();
    4330   m_intraSdcWedgeFlag      = sps3dExt->getIntraSdcWedgeFlag    ( depthFlag )                                 ;                         
    4331   m_qtPredFlag             = sps3dExt->getQtPredFlag           ( depthFlag )           && getInCompPredFlag();
    4332   m_interSdcFlag           = sps3dExt->getInterSdcFlag         ( depthFlag )                                 ; 
    4333   m_depthIntraSkipFlag     = sps3dExt->getDepthIntraSkipFlag   ( depthFlag )                                 ;                         
    4334 
    4335   m_subPbSize              =  1 << ( sps3dExt->getLog2SubPbSizeMinus3  ( depthFlag ) + 3 ); 
    4336   m_mpiSubPbSize           =  1 << ( sps3dExt->getLog2MpiSubPbSizeMinus3( depthFlag ) + 3 );
    4337 
    4338 
    4339 #if H_3D_OUTPUT_ACTIVE_TOOLS
     4322  m_ivMvPredFlag           = sps3dExt->getIvDiMcEnabledFlag          ( depthFlag ) && nRLLG0                       ;                             
     4323  m_ivMvScalingFlag        = sps3dExt->getIvMvScalEnabledFlag        ( depthFlag )                                 ;                             
     4324  m_ivResPredFlag          = sps3dExt->getIvResPredEnabledFlag       ( depthFlag ) && nRLLG0                       ;                               
     4325  m_depthRefinementFlag    = sps3dExt->getDepthRefEnabledFlag        ( depthFlag )           && getInCompPredFlag() && m_cpAvailableFlag;
     4326  m_viewSynthesisPredFlag  = sps3dExt->getVspMcEnabledFlag           ( depthFlag ) && nRLLG0 && getInCompPredFlag() && m_cpAvailableFlag;
     4327  m_depthBasedBlkPartFlag  = sps3dExt->getDbbpEnabledFlag            ( depthFlag )           && getInCompPredFlag();                         
     4328  m_mpiFlag                = sps3dExt->getTexMcEnabledFlag           ( depthFlag )           && getInCompPredFlag();
     4329  m_intraContourFlag       = sps3dExt->getIntraContourEnabledFlag    ( depthFlag )           && getInCompPredFlag();
     4330  m_intraSdcWedgeFlag      = sps3dExt->getIntraDcOnlyWedgeEnabledFlag( depthFlag )                                 ;                         
     4331  m_qtPredFlag             = sps3dExt->getCqtCuPartPredEnabledFlag   ( depthFlag )           && getInCompPredFlag();
     4332  m_interSdcFlag           = sps3dExt->getInterDcOnlyEnabledFlag     ( depthFlag )                                 ; 
     4333  m_depthIntraSkipFlag     = sps3dExt->getSkipIntraEnabledFlag       ( depthFlag )                                 ;                         
     4334
     4335  m_subPbSize              =  1 << ( sps3dExt->getLog2IvmcSubPbSizeMinus3 ( depthFlag ) + 3 ); 
     4336  m_mpiSubPbSize           =  1 << ( sps3dExt->getLog2TexmcSubPbSizeMinus3( depthFlag ) + 3 );
     4337
     4338
     4339#if NH_3D_OUTPUT_ACTIVE_TOOLS
    43404340  std::cout << "Layer:                  :" << getLayerId()             << std::endl;
    43414341  std::cout << "DepthFlag:              :" << getIsDepth()             << std::endl;
     
    44154415    if( !getIsDepth() )
    44164416    {
    4417       m_inCmpPredAvailFlag = sps3dExt->getViewSynthesisPredFlag( getIsDepth() ) ||
    4418         sps3dExt->getDepthBasedBlkPartFlag( getIsDepth() ) ||
    4419         sps3dExt->getDepthRefinementFlag  ( getIsDepth() );                           
     4417      m_inCmpPredAvailFlag = sps3dExt->getVspMcEnabledFlag( getIsDepth() ) ||
     4418        sps3dExt->getDbbpEnabledFlag( getIsDepth() ) ||
     4419        sps3dExt->getDepthRefEnabledFlag  ( getIsDepth() );                           
    44204420    }
    44214421    else
    44224422    {
    4423       m_inCmpPredAvailFlag = sps3dExt->getIntraContourFlag( getIsDepth() ) ||
    4424         sps3dExt->getQtPredFlag( getIsDepth() ) ||
    4425         sps3dExt->getMpiFlag( getIsDepth() );                                 
     4423      m_inCmpPredAvailFlag = sps3dExt->getIntraContourEnabledFlag( getIsDepth() ) ||
     4424        sps3dExt->getCqtCuPartPredEnabledFlag( getIsDepth() ) ||
     4425        sps3dExt->getTexMcEnabledFlag( getIsDepth() );                                 
    44264426    }
    44274427  }
     
    45454545}
    45464546
    4547 Bool TComScalingList::xParseScalingList(Char* pchFile)
     4547Bool TComScalingList::xParseScalingList(const std::string &fileName)
    45484548{
    45494549  static const Int LINE_SIZE=1024;
    45504550  FILE *fp = NULL;
    4551   Char line[LINE_SIZE];
    4552 
    4553   if (pchFile == NULL)
     4551  TChar line[LINE_SIZE];
     4552
     4553  if (fileName.empty())
    45544554  {
    45554555    fprintf(stderr, "Error: no scaling list file specified. Help on scaling lists being output\n");
     
    45604560    return true;
    45614561  }
    4562   else if ((fp = fopen(pchFile,"r")) == (FILE*)NULL)
    4563   {
    4564     fprintf(stderr, "Error: cannot open scaling list file %s for reading\n",pchFile);
     4562  else if ((fp = fopen(fileName.c_str(),"r")) == (FILE*)NULL)
     4563  {
     4564    fprintf(stderr, "Error: cannot open scaling list file %s for reading\n", fileName.c_str());
    45654565    return true;
    45664566  }
     
    45904590          while ((!feof(fp)) && (!bFound))
    45914591          {
    4592             Char *ret = fgets(line, LINE_SIZE, fp);
    4593             Char *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType[sizeIdc][listIdc]);
     4592            TChar *ret = fgets(line, LINE_SIZE, fp);
     4593            TChar *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType[sizeIdc][listIdc]);
    45944594            // This could be a match against the DC string as well, so verify it isn't
    45954595            if (findNamePosition!= NULL && (MatrixType_DC[sizeIdc][listIdc]==NULL || strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL))
     
    46004600          if (!bFound)
    46014601          {
    4602             fprintf(stderr, "Error: cannot find Matrix %s from scaling list file %s\n", MatrixType[sizeIdc][listIdc], pchFile);
     4602            fprintf(stderr, "Error: cannot find Matrix %s from scaling list file %s\n", MatrixType[sizeIdc][listIdc], fileName.c_str());
    46034603            return true;
    46044604          }
     
    46094609          if (fscanf(fp, "%d,", &data)!=1)
    46104610          {
    4611             fprintf(stderr, "Error: cannot read value #%d for Matrix %s from scaling list file %s at file position %ld\n", i, MatrixType[sizeIdc][listIdc], pchFile, ftell(fp));
     4611            fprintf(stderr, "Error: cannot read value #%d for Matrix %s from scaling list file %s at file position %ld\n", i, MatrixType[sizeIdc][listIdc], fileName.c_str(), ftell(fp));
    46124612            return true;
    46134613          }
    46144614          if (data<0 || data>255)
    46154615          {
    4616             fprintf(stderr, "Error: QMatrix entry #%d of value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", i, data, MatrixType[sizeIdc][listIdc], pchFile, ftell(fp));
     4616            fprintf(stderr, "Error: QMatrix entry #%d of value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", i, data, MatrixType[sizeIdc][listIdc], fileName.c_str(), ftell(fp));
    46174617            return true;
    46184618          }
     
    46304630            while ((!feof(fp)) && (!bFound))
    46314631            {
    4632               Char *ret = fgets(line, LINE_SIZE, fp);
    4633               Char *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType_DC[sizeIdc][listIdc]);
     4632              TChar *ret = fgets(line, LINE_SIZE, fp);
     4633              TChar *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType_DC[sizeIdc][listIdc]);
    46344634              if (findNamePosition!= NULL)
    46354635              {
     
    46404640            if (!bFound)
    46414641            {
    4642               fprintf(stderr, "Error: cannot find DC Matrix %s from scaling list file %s\n", MatrixType_DC[sizeIdc][listIdc], pchFile);
     4642              fprintf(stderr, "Error: cannot find DC Matrix %s from scaling list file %s\n", MatrixType_DC[sizeIdc][listIdc], fileName.c_str());
    46434643              return true;
    46444644            }
     
    46474647          if (fscanf(fp, "%d,", &data)!=1)
    46484648          {
    4649             fprintf(stderr, "Error: cannot read DC %s from scaling list file %s at file position %ld\n", MatrixType_DC[sizeIdc][listIdc], pchFile, ftell(fp));
     4649            fprintf(stderr, "Error: cannot read DC %s from scaling list file %s at file position %ld\n", MatrixType_DC[sizeIdc][listIdc], fileName.c_str(), ftell(fp));
    46504650            return true;
    46514651          }
    46524652          if (data<0 || data>255)
    46534653          {
    4654             fprintf(stderr, "Error: DC value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", data, MatrixType[sizeIdc][listIdc], pchFile, ftell(fp));
     4654            fprintf(stderr, "Error: DC value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", data, MatrixType[sizeIdc][listIdc], fileName.c_str(), ftell(fp));
    46554655            return true;
    46564656          }
  • TabularUnified trunk/source/Lib/TLibCommon/TComSlice.h

    r1321 r1386  
    292292  Void       checkDcOfMatrix();
    293293  Void       processRefMatrix(UInt sizeId, UInt listId , UInt refListId );
    294   Bool       xParseScalingList(Char* pchFile);
     294  Bool       xParseScalingList(const std::string &fileName);
    295295#if NH_MV
    296296  Void       inferFrom                      ( const TComScalingList& srcScLi );
     
    13841384  /// VPS EXTENSION 2 SYNTAX ELEMENTS
    13851385  Int     getDepthId                   ( Int layerIdInNuh)             const    { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPTH_ID ); }
    1386 #if NH_3D                                                             
     1386#if NH_3D_VSO                                                             
    13871387  Bool    getVpsDepthFlag              ( Int layerIdInNuh)             const    { return (getDepthId( layerIdInNuh ) > 0);  }
    1388   Int     getLayerIdInNuh              ( Int viewIndex, Bool depthFlag ) const;   
    1389          
     1388  Int     getLayerIdInNuh              ( Int viewIndex, Bool depthFlag, Int auxId ) const;   
     1389#endif
     1390#if NH_3D
    13901391  Void    createCamPars                ( Int iNumViews ); 
    13911392  Void    initCamParaVPS               ( Int vOIdxInVps, Int numCp, Bool cpInSliceSegmentHeaderFlag, Int* cpRefVoi, Int** aaiScale, Int** aaiOffset );                                               
     
    14261427#endif
    14271428
    1428   template <typename T, typename S, typename U> Void xPrintArray( const Char* name, Int numElemDim1, U idx, S numElemDim2, T vec, Bool printNumber, Bool printIdx = true ) const
     1429  template <typename T, typename S, typename U> Void xPrintArray( const TChar* name, Int numElemDim1, U idx, S numElemDim2, T vec, Bool printNumber, Bool printIdx = true ) const
    14291430  {
    14301431    std::cout << std::endl;
     
    18101811    for (Int d = 0; d < 2; d++)
    18111812    {
    1812       m_ivMvPredFlag          [d] = false;
    1813       m_ivMvScalingFlag       [d] = false;
    1814       m_log2SubPbSizeMinus3   [d] = 3;
    1815       m_ivResPredFlag         [d] = false;
    1816       m_depthRefinementFlag   [d] = false;
    1817       m_viewSynthesisPredFlag [d] = false;
    1818       m_depthBasedBlkPartFlag [d] = false;
    1819       m_mpiFlag               [d] = false;
    1820       m_log2MpiSubPbSizeMinus3[d] = 3;
    1821       m_intraContourFlag      [d] = false;
    1822       m_intraSdcWedgeFlag     [d] = false;
    1823       m_qtPredFlag            [d] = false;
    1824       m_interSdcFlag          [d] = false;
    1825       m_depthIntraSkipFlag    [d] = false;   
     1813      m_ivDiMcEnabledFlag          [d] = false;
     1814      m_ivMvScalEnabledFlag       [d] = false;
     1815      m_log2IvmcSubPbSizeMinus3   [d] = 3;
     1816      m_ivResPredEnabledFlag         [d] = false;
     1817      m_depthRefEnabledFlag   [d] = false;
     1818      m_vspMcEnabledFlag [d] = false;
     1819      m_dbbpEnabledFlag [d] = false;
     1820      m_texMcEnabledFlag               [d] = false;
     1821      m_log2TexmcSubPbSizeMinus3[d] = 3;
     1822      m_intraContourEnabledFlag      [d] = false;
     1823      m_intraDcOnlyWedgeEnabledFlag     [d] = false;
     1824      m_cqtCuPartPredEnabledFlag            [d] = false;
     1825      m_interDcOnlyEnabledFlag          [d] = false;
     1826      m_skipIntraEnabledFlag    [d] = false;   
    18261827    }
    18271828  }
    18281829
    1829   Void          setIvMvPredFlag( Int d, Bool flag )         { m_ivMvPredFlag[d] = flag;             }
    1830   Bool          getIvMvPredFlag( Int d ) const              { return m_ivMvPredFlag[d];             }
    1831 
    1832   Void          setIvMvScalingFlag( Int d, Bool flag )      { m_ivMvScalingFlag[d] = flag;          }
    1833   Bool          getIvMvScalingFlag( Int d ) const           { return m_ivMvScalingFlag[d];          }
    1834 
    1835   Void          setLog2SubPbSizeMinus3( Int d, Int  val )   { m_log2SubPbSizeMinus3[d] = val;       }
    1836   Int           getLog2SubPbSizeMinus3( Int d ) const       { return m_log2SubPbSizeMinus3[d];      }
    1837 
    1838   Void          setIvResPredFlag( Int d, Bool flag )        { m_ivResPredFlag[d] = flag;            }
    1839   Bool          getIvResPredFlag( Int d ) const             { return m_ivResPredFlag[d];            }
    1840 
    1841   Void          setDepthRefinementFlag( Int d, Bool flag )  { m_depthRefinementFlag[d] = flag;      }
    1842   Bool          getDepthRefinementFlag( Int d ) const       { return m_depthRefinementFlag[d];      }
    1843 
    1844   Void          setViewSynthesisPredFlag( Int d, Bool flag ) { m_viewSynthesisPredFlag[d] = flag;   }
    1845   Bool          getViewSynthesisPredFlag( Int d ) const     { return m_viewSynthesisPredFlag[d];    }
    1846 
    1847   Void          setDepthBasedBlkPartFlag( Int d, Bool flag ) { m_depthBasedBlkPartFlag[d] = flag;   }
    1848   Bool          getDepthBasedBlkPartFlag( Int d ) const     { return m_depthBasedBlkPartFlag[d];    }
    1849 
    1850   Void          setMpiFlag( Int d, Bool flag )              { m_mpiFlag[d] = flag;                  }
    1851   Bool          getMpiFlag( Int d ) const                   { return m_mpiFlag[d];                  }
    1852 
    1853   Void          setLog2MpiSubPbSizeMinus3( Int d, Int  val ) { m_log2MpiSubPbSizeMinus3[d] = val;   }
    1854   Int           getLog2MpiSubPbSizeMinus3( Int d ) const    { return m_log2MpiSubPbSizeMinus3[d];   }
    1855 
    1856   Void          setIntraContourFlag( Int d, Bool flag )     { m_intraContourFlag[d] = flag;         }
    1857   Bool          getIntraContourFlag( Int d ) const          { return m_intraContourFlag[d];         }
    1858 
    1859   Void          setIntraSdcWedgeFlag( Int d, Bool flag )    { m_intraSdcWedgeFlag[d] = flag;        }
    1860   Bool          getIntraSdcWedgeFlag( Int d ) const         { return m_intraSdcWedgeFlag[d];        }
    1861 
    1862   Void          setQtPredFlag( Int d, Bool flag )           { m_qtPredFlag[d] = flag;               }
    1863   Bool          getQtPredFlag( Int d ) const                { return m_qtPredFlag[d];               }
    1864 
    1865   Void          setInterSdcFlag( Int d, Bool flag )         { m_interSdcFlag[d] = flag;             }
    1866   Bool          getInterSdcFlag( Int d ) const              { return m_interSdcFlag[d];             }
    1867 
    1868   Void          setDepthIntraSkipFlag( Int d, Bool flag )   { m_depthIntraSkipFlag[d] = flag;       }
    1869   Bool          getDepthIntraSkipFlag( Int d ) const        { return m_depthIntraSkipFlag[d];       }
     1830  Void          setIvDiMcEnabledFlag( Int d, Bool flag )        { m_ivDiMcEnabledFlag[d] = flag;             }
     1831  Bool          getIvDiMcEnabledFlag( Int d ) const             { return m_ivDiMcEnabledFlag[d];             }
     1832
     1833  Void          setIvMvScalEnabledFlag( Int d, Bool flag )      { m_ivMvScalEnabledFlag[d] = flag;          }
     1834  Bool          getIvMvScalEnabledFlag( Int d ) const           { return m_ivMvScalEnabledFlag[d];          }
     1835
     1836  Void          setLog2IvmcSubPbSizeMinus3( Int d, Int  val )   { m_log2IvmcSubPbSizeMinus3[d] = val;       }
     1837  Int           getLog2IvmcSubPbSizeMinus3( Int d ) const       { return m_log2IvmcSubPbSizeMinus3[d];      }
     1838
     1839  Void          setIvResPredEnabledFlag( Int d, Bool flag )     { m_ivResPredEnabledFlag[d] = flag;            }
     1840  Bool          getIvResPredEnabledFlag( Int d ) const          { return m_ivResPredEnabledFlag[d];            }
     1841
     1842  Void          setDepthRefEnabledFlag( Int d, Bool flag )      { m_depthRefEnabledFlag[d] = flag;      }
     1843  Bool          getDepthRefEnabledFlag( Int d ) const           { return m_depthRefEnabledFlag[d];      }
     1844
     1845  Void          setVspMcEnabledFlag( Int d, Bool flag )         { m_vspMcEnabledFlag[d] = flag;   }
     1846  Bool          getVspMcEnabledFlag( Int d ) const              { return m_vspMcEnabledFlag[d];    }
     1847
     1848  Void          setDbbpEnabledFlag( Int d, Bool flag )          { m_dbbpEnabledFlag[d] = flag;   }
     1849  Bool          getDbbpEnabledFlag( Int d ) const               { return m_dbbpEnabledFlag[d];    }
     1850
     1851  Void          setTexMcEnabledFlag( Int d, Bool flag )         { m_texMcEnabledFlag[d] = flag;                  }
     1852  Bool          getTexMcEnabledFlag( Int d ) const              { return m_texMcEnabledFlag[d];                  }
     1853
     1854  Void          setLog2TexmcSubPbSizeMinus3( Int d, Int  val )  { m_log2TexmcSubPbSizeMinus3[d] = val;   }
     1855  Int           getLog2TexmcSubPbSizeMinus3( Int d ) const      { return m_log2TexmcSubPbSizeMinus3[d];   }
     1856
     1857  Void          setIntraContourEnabledFlag( Int d, Bool flag )  { m_intraContourEnabledFlag[d] = flag;         }
     1858  Bool          getIntraContourEnabledFlag( Int d ) const       { return m_intraContourEnabledFlag[d];         }
     1859
     1860  Void          setIntraDcOnlyWedgeEnabledFlag( Int d, Bool flag ) { m_intraDcOnlyWedgeEnabledFlag[d] = flag;        }
     1861  Bool          getIntraDcOnlyWedgeEnabledFlag( Int d ) const      { return m_intraDcOnlyWedgeEnabledFlag[d];        }
     1862
     1863  Void          setCqtCuPartPredEnabledFlag( Int d, Bool flag )    { m_cqtCuPartPredEnabledFlag[d] = flag;               }
     1864  Bool          getCqtCuPartPredEnabledFlag( Int d ) const         { return m_cqtCuPartPredEnabledFlag[d];               }
     1865
     1866  Void          setInterDcOnlyEnabledFlag( Int d, Bool flag )      { m_interDcOnlyEnabledFlag[d] = flag;             }
     1867  Bool          getInterDcOnlyEnabledFlag( Int d ) const           { return m_interDcOnlyEnabledFlag[d];             }
     1868
     1869  Void          setSkipIntraEnabledFlag( Int d, Bool flag )        { m_skipIntraEnabledFlag[d] = flag;       }
     1870  Bool          getSkipIntraEnabledFlag( Int d ) const             { return m_skipIntraEnabledFlag[d];       }
    18701871private:
    18711872
    1872   Bool        m_ivMvPredFlag          [2];
    1873   Bool        m_ivMvScalingFlag       [2];
    1874   Int         m_log2SubPbSizeMinus3   [2];
    1875   Bool        m_ivResPredFlag         [2];
    1876   Bool        m_depthRefinementFlag   [2];
    1877   Bool        m_viewSynthesisPredFlag [2];
    1878   Bool        m_depthBasedBlkPartFlag [2];
    1879   Bool        m_mpiFlag               [2];
    1880   Int         m_log2MpiSubPbSizeMinus3[2];
    1881   Bool        m_intraContourFlag      [2];
    1882   Bool        m_intraSdcWedgeFlag     [2];
    1883   Bool        m_qtPredFlag            [2];
    1884   Bool        m_interSdcFlag          [2];
    1885   Bool        m_depthIntraSkipFlag    [2]; 
     1873  Bool        m_ivDiMcEnabledFlag          [2];
     1874  Bool        m_ivMvScalEnabledFlag        [2];
     1875  Int         m_log2IvmcSubPbSizeMinus3    [2];
     1876  Bool        m_ivResPredEnabledFlag       [2];
     1877  Bool        m_depthRefEnabledFlag        [2];
     1878  Bool        m_vspMcEnabledFlag          [2];
     1879  Bool        m_dbbpEnabledFlag            [2];
     1880  Bool        m_texMcEnabledFlag           [2];
     1881  Int         m_log2TexmcSubPbSizeMinus3   [2];
     1882  Bool        m_intraContourEnabledFlag    [2];
     1883  Bool        m_intraDcOnlyWedgeEnabledFlag[2];
     1884  Bool        m_cqtCuPartPredEnabledFlag   [2];
     1885  Bool        m_interDcOnlyEnabledFlag     [2];
     1886  Bool        m_skipIntraEnabledFlag       [2]; 
    18861887};
    18871888
     
    19551956#if NH_MV
    19561957  UInt             m_uiSpsMaxLatencyIncreasePlus1[MAX_TLAYER]; 
    1957   // Calling a member m_uiMaxLatencyIncrease although it is m_uiMaxLatencyIncreasePlus1 is really bad style. 
    19581958#else
    1959   UInt             m_uiMaxLatencyIncrease[MAX_TLAYER];  // Really max latency increase plus 1 (value 0 expresses no limit)
     1959  UInt             m_uiMaxLatencyIncreasePlus1[MAX_TLAYER];
    19601960#endif
    19611961
     
    21352135  Bool                   getScalingListPresentFlag() const                                               { return m_scalingListPresentFlag;                                     }
    21362136  Void                   setScalingListPresentFlag( Bool b )                                             { m_scalingListPresentFlag  = b;                                       }
    2137   Void                   setScalingList( TComScalingList *scalingList);
    21382137  TComScalingList&       getScalingList()                                                                { return m_scalingList;                                                }
    21392138  const TComScalingList& getScalingList() const                                                          { return m_scalingList;                                                }
     
    21462145  Int                    getSpsMaxLatencyPictures( Int i )  const                                       { return ( getSpsMaxNumReorderPics(i) + getSpsMaxLatencyIncreasePlus1(i)-1); }
    21472146#else
    2148   UInt                   getMaxLatencyIncrease(UInt tlayer) const                                        { return m_uiMaxLatencyIncrease[tlayer];                               }
    2149   Void                   setMaxLatencyIncrease( UInt ui , UInt tlayer)                                   { m_uiMaxLatencyIncrease[tlayer] = ui;                                 }
     2147  UInt                   getMaxLatencyIncreasePlus1(UInt tlayer) const                                   { return m_uiMaxLatencyIncreasePlus1[tlayer];                          }
     2148  Void                   setMaxLatencyIncreasePlus1( UInt ui , UInt tlayer)                              { m_uiMaxLatencyIncreasePlus1[tlayer] = ui;                            }
    21502149#endif
    21512150
     
    21662165  const TComSPSRExt&     getSpsRangeExtension() const                                                    { return m_spsRangeExtension;                                          }
    21672166  TComSPSRExt&           getSpsRangeExtension()                                                          { return m_spsRangeExtension;                                          }
    2168 
    2169   // Sequence parameter set range extension syntax
    2170   // WAS: getUseResidualRotation and setUseResidualRotation
    2171   // Now getSpsRangeExtension().getTransformSkipRotationEnabledFlag and getSpsRangeExtension().setTransformSkipRotationEnabledFlag
    2172 
    2173   // WAS: getUseSingleSignificanceMapContext and setUseSingleSignificanceMapContext
    2174   // Now: getSpsRangeExtension().getTransformSkipContextEnabledFlag and getSpsRangeExtension().setTransformSkipContextEnabledFlag
    2175 
    2176   // WAS: getUseResidualDPCM and setUseResidualDPCM
    2177   // Now: getSpsRangeExtension().getRdpcmEnabledFlag and getSpsRangeExtension().setRdpcmEnabledFlag and
    2178 
    2179   // WAS: getUseExtendedPrecision and setUseExtendedPrecision
    2180   // Now: getSpsRangeExtension().getExtendedPrecisionProcessingFlag and getSpsRangeExtension().setExtendedPrecisionProcessingFlag
    2181 
    2182   // WAS: getDisableIntraReferenceSmoothing and setDisableIntraReferenceSmoothing
    2183   // Now: getSpsRangeExtension().getIntraSmoothingDisabledFlag and getSpsRangeExtension().setIntraSmoothingDisabledFlag
    2184 
    2185   // WAS: getUseHighPrecisionPredictionWeighting and setUseHighPrecisionPredictionWeighting
    2186   // Now: getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag and getSpsRangeExtension().setHighPrecisionOffsetsEnabledFlag
    2187 
    2188   // WAS: getUseGolombRiceParameterAdaptation and setUseGolombRiceParameterAdaptation
    2189   // Now: getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag and getSpsRangeExtension().setPersistentRiceAdaptationEnabledFlag
    2190 
    2191   // WAS: getAlignCABACBeforeBypass and setAlignCABACBeforeBypass
    2192   // Now: getSpsRangeExtension().getCabacBypassAlignmentEnabledFlag and getSpsRangeExtension().setCabacBypassAlignmentEnabledFlag
    2193 
    21942167
    21952168#if NH_MV
     
    22742247  virtual ~TComRefPicListModification();
    22752248
    2276   Void    create();
    2277   Void    destroy();
    22782249
    22792250  Bool    getRefPicListModificationFlagL0() const        { return m_refPicListModificationFlagL0;                                  }
     
    22992270  Void    setListEntryL0( Int i, Int  val )                      { m_RefPicSetIdxL0[i] = val;                                          }
    23002271  Void    setListEntryL1( Int i, Int  val )                      { m_RefPicSetIdxL1[i] = val;                                          }
    2301 
    2302 
    23032272#endif
    23042273};
     2274
    23052275
    23062276/// PPS RExt class
     
    25562526  const TComPPSRExt&     getPpsRangeExtension() const                                     { return m_ppsRangeExtension;                   }
    25572527  TComPPSRExt&           getPpsRangeExtension()                                           { return m_ppsRangeExtension;                   }
    2558 
    2559   // WAS: getTransformSkipLog2MaxSize and setTransformSkipLog2MaxSize
    2560   // Now: getPpsRangeExtension().getLog2MaxTransformSkipBlockSize and getPpsRangeExtension().setLog2MaxTransformSkipBlockSize
    2561 
    2562   // WAS: getUseCrossComponentPrediction and setUseCrossComponentPrediction
    2563   // Now: getPpsRangeExtension().getCrossComponentPredictionEnabledFlag and getPpsRangeExtension().setCrossComponentPredictionEnabledFlag
    2564 
    2565   // WAS: clearChromaQpAdjTable
    2566   // Now: getPpsRangeExtension().clearChromaQpOffsetList
    2567 
    2568   // WAS: getMaxCuChromaQpAdjDepth and setMaxCuChromaQpAdjDepth
    2569   // Now: getPpsRangeExtension().getDiffCuChromaQpOffsetDepth and getPpsRangeExtension().setDiffCuChromaQpOffsetDepth
    2570 
    2571   // WAS: getChromaQpAdjTableSize
    2572   // Now: getPpsRangeExtension().getChromaQpOffsetListLen
    2573 
    2574   // WAS: getChromaQpAdjTableAt and setChromaQpAdjTableAt
    2575   // Now: getPpsRangeExtension().getChromaQpOffsetListEntry and getPpsRangeExtension().setChromaQpOffsetListEntry
    2576 
    2577   // WAS: getSaoOffsetBitShift and setSaoOffsetBitShift
    2578   // Now: getPpsRangeExtension().getLog2SaoOffsetScale and getPpsRangeExtension().setLog2SaoOffsetScale
    2579 
    25802528#if NH_MV
    25812529  Void    setLayerId( Int  val )                                                     { m_layerId = val;                                           }
     
    27532701  Int        m_viewId;
    27542702  Int        m_viewIndex;
    2755 #if NH_3D
     2703#if NH_3D_VSO
    27562704  Bool       m_isDepth;
    27572705#endif
     
    28052753  Bool       m_cpAvailableFlag;
    28062754  Int        m_numViews;
     2755#endif
     2756#if NH_3D_QTL
    28072757  TComPic*   m_ivPicsCurrPoc [2][MAX_NUM_LAYERS]; 
     2758#endif
     2759#if NH_3D
    28082760  Int**      m_depthToDisparityB;
    28092761  Int**      m_depthToDisparityF;
     
    28762828  Int                         getPOC() const                                         { return m_iPOC;                                                }
    28772829  Int                         getSliceQp() const                                     { return m_iSliceQp;                                            }
     2830  Bool                        getUseWeightedPrediction() const                       { return( (m_eSliceType==P_SLICE && testWeightPred()) || (m_eSliceType==B_SLICE && testWeightBiPred()) ); }
    28782831  Bool                        getDependentSliceSegmentFlag() const                   { return m_dependentSliceSegmentFlag;                           }
    28792832  Void                        setDependentSliceSegmentFlag(Bool val)                 { m_dependentSliceSegmentFlag = val;                            }
     
    28922845  TComPic*                    getPic()                                               { return m_pcPic;                                               }
    28932846  TComPic*                    getRefPic( RefPicList e, Int iRefIdx)                  { return m_apcRefPicList[e][iRefIdx];                           }
    2894   Int                         getRefPOC( RefPicList e, Int iRefIdx)                  { return m_aiRefPOCList[e][iRefIdx];                            }
     2847  const TComPic*              getRefPic( RefPicList e, Int iRefIdx) const            { return m_apcRefPicList[e][iRefIdx];                           }
     2848  Int                         getRefPOC( RefPicList e, Int iRefIdx) const            { return m_aiRefPOCList[e][iRefIdx];                            }
    28952849#if NH_3D
    28962850  Bool                        getInCmpPredAvailFlag( )                 const         { return m_inCmpPredAvailFlag;                                  }
     
    29012855  Int                         getNumCurCmpLIds( )                      const         { return (Int) m_inCmpRefViewIdcs.size();                       }
    29022856  TComPic*                    getIvPic( Bool depthFlag, Int viewIndex) const         { return  m_ivPicsCurrPoc[ depthFlag ? 1 : 0 ][ viewIndex ];    }
     2857#endif
     2858#if NH_3D_QTL
    29032859  TComPic*                    getTexturePic       ()                                 { return  m_ivPicsCurrPoc[0][ m_viewIndex ];                    }
     2860
    29042861#endif                           
    29052862#if NH_3D_IC                                                                                                                                         
     
    31803137
    31813138  Void                        setEnableTMVPFlag( Bool   b )                          { m_enableTMVPFlag = b;                                         }
    3182   Bool                        getEnableTMVPFlag()                                    { return m_enableTMVPFlag;                                      }
     3139  Bool                        getEnableTMVPFlag() const                              { return m_enableTMVPFlag;                                      }
    31833140
    31843141  Void                        setEncCABACTableIdx( SliceType idx )                   { m_encCABACTableIdx = idx;                                     }
     
    32063163  Int                         getFirstTRefIdx        ( RefPicList e )                { return  m_aiFirstTRefIdx[e];                                  }
    32073164  Void                        setFirstTRefIdx        ( RefPicList e, Int i )         { m_aiFirstTRefIdx[e]    = i;                                   }
    3208   Bool                        getArpRefPicAvailable  ( RefPicList e, Int viewIdx)    { return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, 0)]; }
     3165
     3166  Bool                        getArpRefPicAvailable  ( RefPicList e, Int viewIdx)    { return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, false, 0 )]; }
    32093167  IntAry1d                    getPocsInCurrRPSs()                                    { return m_pocsInCurrRPSs;                                      }
    3210 #endif                                                                                                                                               
     3168#endif                       
     3169#endif
     3170#if NH_3D_VSO
    32113171  Void                        setIsDepth            ( Bool isDepth )                 { m_isDepth = isDepth;                                          }
    32123172  Bool                        getIsDepth            () const                         { return m_isDepth;                                             }
     3173#endif
     3174#if NH_3D
    32133175  Void                        setCamparaSlice       ( Int** aaiScale = 0, Int** aaiOffset = 0 );     
    32143176
     
    32303192  Int                         getCpInvOff( Int j )                                   { return m_aaiCodedOffset[1][j];                                }
    32313193                                                                                                                                                       
     3194#endif
     3195#if NH_3D_QTL
    32323196  Void                        setIvPicLists( TComPicLists* m_ivPicLists );                                                                             
     3197#endif
     3198#if NH_3D
    32333199  Void                        setDepthToDisparityLUTs();                                                                                               
    32343200                                                                                                                                                       
  • TabularUnified trunk/source/Lib/TLibCommon/TComWeightPrediction.cpp

    r1313 r1386  
    5555}
    5656
     57static inline Pel noWeightUnidir( Pel P0, Int round, Int shift, Int offset, Int clipBD)
     58{
     59  return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ) + offset, clipBD );
     60}
     61
     62static inline Pel noWeightOffsetUnidir( Pel P0, Int round, Int shift, Int clipBD)
     63{
     64  return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ), clipBD );
     65}
     66
     67
    5768// ====================================================================================================================
    5869// Class definition
     
    154165    const Int  shiftNum    = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD));
    155166    const Int  shift       = wp0[compID].shift + shiftNum;
    156     const Int  round       = (shift > 0) ? (1<<(shift-1)) : 0;
    157167    const UInt iSrc0Stride = pcYuvSrc0->getStride(compID);
    158168    const UInt iDstStride  = pcYuvDst->getStride(compID);
     
    162172    const Int  iWidth      = uiWidth>>csx;
    163173
     174    if (w0 != 1 << wp0[compID].shift)
     175    {
     176      const Int  round       = (shift > 0) ? (1<<(shift-1)) : 0;
    164177    for (Int y = iHeight-1; y >= 0; y-- )
    165178    {
     
    178191      pSrc0 += iSrc0Stride;
    179192      pDst  += iDstStride;
     193    }
     194  }
     195    else
     196    {
     197      const Int  round       = (shiftNum > 0) ? (1<<(shiftNum-1)) : 0;
     198      if (offset == 0)
     199      {
     200        for (Int y = iHeight-1; y >= 0; y-- )
     201        {
     202          Int x = iWidth-1;
     203          for ( ; x >= 3; )
     204          {
     205            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
     206            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
     207            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
     208            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
     209          }
     210          for( ; x >= 0; x--)
     211          {
     212            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD);
     213          }
     214          pSrc0 += iSrc0Stride;
     215          pDst  += iDstStride;
     216        }
     217      }
     218      else
     219      {
     220        for (Int y = iHeight-1; y >= 0; y-- )
     221        {
     222          Int x = iWidth-1;
     223          for ( ; x >= 3; )
     224          {
     225            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
     226            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
     227            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
     228            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
     229          }
     230          for( ; x >= 0; x--)
     231          {
     232            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD);
     233          }
     234          pSrc0 += iSrc0Stride;
     235          pDst  += iDstStride;
     236        }
     237      }
    180238    }
    181239  }
     
    197255        TComSlice *const pcSlice  = pcCU->getSlice();
    198256  const Bool             wpBiPred = pcCU->getSlice()->getPPS()->getWPBiPred();
    199   const Bool             bBiDir   = (iRefIdx0>=0 && iRefIdx1>=0);
    200   const Bool             bUniDir  = !bBiDir;
    201 
    202   if ( bUniDir || wpBiPred )
     257  const Bool             bBiPred  = (iRefIdx0>=0 && iRefIdx1>=0);
     258  const Bool             bUniPred = !bBiPred;
     259
     260  if ( bUniPred || wpBiPred )
    203261  { // explicit --------------------
    204262    if ( iRefIdx0 >= 0 )
     
    228286  const Bool bUseHighPrecisionPredictionWeighting = pcSlice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag();
    229287
    230   if ( bBiDir )
    231   { // Bi-Dir case
     288  if ( bBiPred )
     289  { // Bi-predictive case
    232290    for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ )
    233291    {
     
    248306  }
    249307  else
    250   {  // Unidir
     308  {  // UniPred
    251309    WPScalingParam *const pwp = (iRefIdx0>=0) ? wp0 : wp1 ;
    252310
  • TabularUnified trunk/source/Lib/TLibCommon/TComYuv.cpp

    r1313 r1386  
    124124  {
    125125    ::memcpy( pDst, pSrc, sizeof(Pel)*iWidth);
    126 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     126#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    127127    if ( g_traceCopyBack && compID == COMPONENT_Y)
    128128    {
  • TabularUnified trunk/source/Lib/TLibCommon/TComYuv.h

    r1313 r1386  
    204204  UInt         getComponentScaleX         (const ComponentID id) const { return ::getComponentScaleX(id, m_chromaFormatIDC); }
    205205  UInt         getComponentScaleY         (const ComponentID id) const { return ::getComponentScaleY(id, m_chromaFormatIDC); }
     206#if NH_3D_VSO
     207  Void         addClipPartLuma( Int bitDepth, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
     208#endif
    206209#if NH_3D
    207   Void         addClipPartLuma( Int bitDepth, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
    208210#if NH_3D_ARP
    209211  Void         addARP                     ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip, const BitDepths &clipBitDepths );
  • TabularUnified trunk/source/Lib/TLibCommon/TypeDef.h

    r1356 r1386  
    3232 */
    3333/** \file     TypeDef.h
    34     \brief    Define basic types, new types and enumerations
     34    \brief    Define macros, basic types, new types and enumerations
    3535*/
    3636#ifndef __TYPEDEF__
     
    6464/////////////////////////////////////////////////////////////////////////////////////////
    6565#if NH_MV
    66 #define NH_MV_SEI_TBD                             0
    67 #define NH_MV_SEI                                 1
    68 #define NH_MV_FIX_TICKET_106                      1 // Identical motion check.
     66// Recent bug fixes
     67#define NH_3D_FIX_TICKET_107                     1 // Clean up.
     68#define NH_3D_FIX_TICKET_91                      1 // NBDV availability in case of tiles.
     69// Things that needs to be fixed also in the Specification ...
    6970#define NH_MV_FIX_NO_REF_PICS_CHECK               1 // !!SPEC!!
    7071#define NH_MV_FIX_INIT_NUM_ACTIVE_REF_LAYER_PICS  1 // Derivation of NumActiveRefLayerPIcs. !!SPEC!!
    7172#define NH_MV_FIX_NUM_POC_TOTAL_CUR               1 // Derivation of NumPocTotalCur for IDR pictures. !!SPEC!!
    72 #define NH_MV_LAYERS_NOT_PRESENT_SEI              1 // Layers not present SEI message JCTMV-M0043
    73 #if NH_MV_SEI
    74 #define SEI_DRI_F0169 1
    75 #endif
    76 #endif
    77 #if NH_3D
    78 #define H_3D_FIX_ARP_CHECK_NOT_IN_DPB     1
    79 #define NH_3D_FIX_NBDV_COL                1
     73// To be done
     74#define NH_MV_HLS_PTL_LIMITS                       0
     75#define NH_MV_SEI_TBD                             0
    8076#endif
    8177/////////////////////////////////////////////////////////////////////////////////////////
     
    8379/////////////////////////////////////////////////////////////////////////////////////////
    8480#if NH_MV
    85 #define H_MV_ENC_DEC_TRAC                 1  //< CU/PU level tracking
     81#define NH_MV_ENC_DEC_TRAC                 1  //< CU/PU level tracking
    8682#if NH_3D
    8783#define NH_3D_INTEGER_MV_DEPTH            1
     
    104100                                             // SEC_ARP_VIEW_REF_CHECK_J0037    Signaling iv_res_pred_weight_idx when the current slice has both view and temporal reference picture(s), JCT3V-J0037 item1
    105101                                             // SEC_ARP_REM_ENC_RESTRICT_K0035    Removal of encoder restriction of ARP, JCT3V-K0035
     102#define NH_3D_QTL                          1
    106103#define NH_3D_QTLPC                        1   // OL_QTLIMIT_PREDCODING_B0068 //JCT3V-B0068
    107104                                              // HHI_QTLPC_RAU_OFF_C0160 JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units
     
    275272                                              // MTK_FAST_TEXTURE_ENCODING_E0173
    276273//HLS
    277                                              // HHI_DEPENDENCY_SIGNALLING_I1_J0107
    278                                              // HHI_TOOL_PARAMETERS_I2_J0107
    279                                              // HHI_VPS_3D_EXTENSION_I3_J0107
    280                                              // HHI_INTER_COMP_PRED_K0052
    281                                              // HHI_RES_PRED_K0052
    282                                              // HHI_CAM_PARA_K0052
    283                                              // H_3D_DIRECT_DEP_TYPE
     274                                              // HHI_DEPENDENCY_SIGNALLING_I1_J0107
     275                                              // HHI_TOOL_PARAMETERS_I2_J0107
     276                                              // HHI_VPS_3D_EXTENSION_I3_J0107
     277                                              // HHI_INTER_COMP_PRED_K0052
     278                                              // HHI_RES_PRED_K0052
     279                                              // HHI_CAM_PARA_K0052
     280                                              // H_3D_DIRECT_DEP_TYPE
     281#endif // NH_3D
     282#if NH_MV
     283////////////////////////
     284/// Consider Removal
     285////////////////////////
    284286// Rate Control
    285287#define KWU_FIX_URQ                       0
    286288#define KWU_RC_VIEWRC_E0227               0  ///< JCT3V-E0227, view-wise target bitrate allocation
    287289#define KWU_RC_MADPRED_E0227              0  ///< JCT3V-E0227, inter-view MAD prediction
    288 #endif // NH_3D
     290#define NH_MV_HLS_PTL_LIMITS               0
     291#if NH_3D
     292// Unclear Fix
     293#define H_3D_PPS_FIX_DEPTH                     0
     294#endif
     295#endif
    289296/////////////////////////////////////////////////////////////////////////////////////////
    290297///////////////////////////////////   DERIVED DEFINES ///////////////////////////////////
    291298/////////////////////////////////////////////////////////////////////////////////////////
    292299#if NH_3D
    293 #define H_3D_OUTPUT_ACTIVE_TOOLS               0
    294 #define H_3D_REN_MAX_DEV_OUT                   0
     300#define NH_3D_OUTPUT_ACTIVE_TOOLS               0
     301#define NH_3D_REN_MAX_DEV_OUT                   0
    295302#endif
    296303///// ***** VIEW SYNTHESIS OPTIMIZAION *********
     
    307314#define DVFROM_ABOVE                      1
    308315#define IDV_CANDS                         2
    309 #endif
    310 ///// ***** ADVANCED INTERVIEW RESIDUAL PREDICTION *********
    311 #if NH_3D_ARP
    312 #define H_3D_ARP_WFNR                     3
    313316#endif
    314317/////////////////////////////////////////////////////////////////////////////////////
     
    325328#if NH_3D_DBBP
    326329#define DBBP_INVALID_SHORT                (-4)
    327 #define DBBP_PACK_MODE               SIZE_2NxN
    328 #endif
    329 ///// ***** FCO *********
    330 #if H_3D_FCO
    331 #define H_3D_FCO_VSP_DONBDV_E0163               1   // Adaptive depth reference for flexible coding order
    332 #else
    333 #define H_3D_FCO_VSP_DONBDV_E0163               0   // Adaptive depth reference for flexible coding order
    334 #endif
    335 #if H_3D
    336 #define PPS_FIX_DEPTH                           1
    337 #endif
    338 /////////////////////////////////////////////////////////////////////////////////
    339 ///////////////////////////////////   MV_HEVC HLS  //////////////////////////////
    340 /////////////////////////////////////////////////////////////////////////////////
    341 // TBD: Check if integration is necessary.
    342 #define H_MV_HLS_PTL_LIMITS                  0
     330#endif
    343331/////////////////////////////////////////////////////////////////////////////////////////
    344332///////////////////////////////////   HM RELATED DEFINES ////////////////////////////////
     
    373361#define DECODER_CHECK_SUBSTREAM_AND_SLICE_TRAILING_BYTES  1 ///< TODO: integrate this macro into a broader conformance checking system.
    374362#define T0196_SELECTIVE_RDOQ                              1 ///< selective RDOQ
     363#define U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING 1
    375364// ====================================================================================================================
    376365// Tool Switches
     
    389378#define MATRIX_MULT                                       0 ///< Brute force matrix multiplication instead of partial butterfly
    390379#define O0043_BEST_EFFORT_DECODING                        0 ///< 0 (default) = disable code related to best effort decoding, 1 = enable code relating to best effort decoding [ decode-side only ].
     380#define ME_ENABLE_ROUNDING_OF_MVS                         1 ///< 0 (default) = disables rounding of motion vectors when right shifted,  1 = enables rounding
    391381#define RDOQ_CHROMA_LAMBDA                                1 ///< F386: weighting of chroma for RDOQ
    392382// This can be enabled by the makefile
     
    394384#define RExt__HIGH_BIT_DEPTH_SUPPORT                                           0 ///< 0 (default) use data type definitions for 8-10 bit video, 1 = use larger data types to allow for up to 16-bit video (originally developed as part of N0188)
    395385#endif
     386#define U0132_TARGET_BITS_SATURATION                      1 ///< Rate control with target bits saturation method
    396387// ====================================================================================================================
    397388// Derived macros
     
    443434typedef       void                Void;
    444435typedef       bool                Bool;
    445 #ifdef __arm__
    446 typedef       signed char         Char;
    447 #else
    448 typedef       char                Char;
    449 #endif
    450 typedef       unsigned char       UChar;
     436typedef       char                TChar; // Used for text/characters
     437typedef       signed char         SChar; // Signed 8-bit values
     438typedef       unsigned char       UChar; // Unsigned 8-bit values
    451439typedef       short               Short;
    452440typedef       unsigned short      UShort;
     
    576564  IPCOLOURSPACE_RGBtoGBR                = 3,
    577565  NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS = 4
     566};
     567enum MATRIX_COEFFICIENTS // Table E.5 (Matrix coefficients)
     568{
     569  MATRIX_COEFFICIENTS_RGB                           = 0,
     570  MATRIX_COEFFICIENTS_BT709                         = 1,
     571  MATRIX_COEFFICIENTS_UNSPECIFIED                   = 2,
     572  MATRIX_COEFFICIENTS_RESERVED_BY_ITUISOIEC         = 3,
     573  MATRIX_COEFFICIENTS_USFCCT47                      = 4,
     574  MATRIX_COEFFICIENTS_BT601_625                     = 5,
     575  MATRIX_COEFFICIENTS_BT601_525                     = 6,
     576  MATRIX_COEFFICIENTS_SMPTE240                      = 7,
     577  MATRIX_COEFFICIENTS_YCGCO                         = 8,
     578  MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE = 9,
     579  MATRIX_COEFFICIENTS_BT2020_CONSTANT_LUMINANCE     = 10,
    578580};
    579581enum DeblockEdgeDir
     
    713715enum MESearchMethod
    714716{
    715   FULL_SEARCH                = 0,     ///< Full search
    716   DIAMOND                    = 1,     ///< Fast search
    717   SELECTIVE                  = 2      ///< Selective search
     717  MESEARCH_FULL              = 0,
     718  MESEARCH_DIAMOND           = 1,
     719  MESEARCH_SELECTIVE         = 2,
     720  MESEARCH_DIAMOND_ENHANCED  = 3,
     721  MESEARCH_NUMBER_OF_METHODS = 4
    718722};
    719723/// coefficient scanning type used in ACS
     
    760764  FIXED_NUMBER_OF_BYTES  = 2,          ///< Limit maximum number of bytes in a slice / slice segment
    761765  FIXED_NUMBER_OF_TILES  = 3,          ///< slices / slice segments span an integer number of tiles
     766  NUMBER_OF_SLICE_CONSTRAINT_MODES = 4
     767};
     768// For use with decoded picture hash SEI messages, generated by encoder.
     769enum HashType
     770{
     771  HASHTYPE_MD5             = 0,
     772  HASHTYPE_CRC             = 1,
     773  HASHTYPE_CHECKSUM        = 2,
     774  HASHTYPE_NONE            = 3,
     775  NUMBER_OF_HASHTYPES      = 4
    762776};
    763777enum SAOMode //mode
     
    860874  COST_LOSSLESS_CODING             = 2,
    861875  COST_MIXED_LOSSLESS_LOSSY_CODING = 3
     876};
     877enum WeightedPredictionMethod
     878{
     879  WP_PER_PICTURE_WITH_SIMPLE_DC_COMBINED_COMPONENT                          =0,
     880  WP_PER_PICTURE_WITH_SIMPLE_DC_PER_COMPONENT                               =1,
     881  WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT                           =2,
     882  WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING              =3,
     883  WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION=4
     884};
     885enum FastInterSearchMode
     886{
     887  FASTINTERSEARCH_DISABLED = 0,
     888  FASTINTERSEARCH_MODE1    = 1, // TODO: assign better names to these.
     889  FASTINTERSEARCH_MODE2    = 2,
     890  FASTINTERSEARCH_MODE3    = 3
    862891};
    863892enum SPSExtensionFlagIndex
     
    961990};
    962991#endif
    963 #if NH_3D
     992#if NH_3D_VSO
    964993// Renderer
    965994enum BlenMod
  • TabularUnified trunk/source/Lib/TLibDecoder/SEIread.cpp

    r1356 r1386  
    6363#endif
    6464
    65 Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const Char *pSymbolName)
     65Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName)
    6666{
    6767  READ_CODE(uiLength, ruiCode, pSymbolName);
     
    7272}
    7373
    74 Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName)
     74Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName)
    7575{
    7676  READ_UVLC(ruiCode, pSymbolName);
     
    8181}
    8282
    83 Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const Char *pSymbolName)
     83Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const TChar *pSymbolName)
    8484{
    8585  READ_SVLC(ruiCode, pSymbolName);
     
    9090}
    9191
    92 Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName)
     92Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName)
    9393{
    9494  READ_FLAG(ruiCode, pSymbolName);
     
    9999}
    100100
    101 Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const Char *pSymbolName)
     101#if NH_MV
     102Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const TChar *pSymbolName)
    102103{
    103104  READ_STRING(uiBufSize, pucCode, ruiLength, pSymbolName);
     
    107108  }
    108109}
    109 
    110 #if NH_MV_SEI
    111110inline Void SEIReader::output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize)
    112111#else
     
    118117    std::string seiMessageHdr(SEI::getSEIMessageString(sei.payloadType())); seiMessageHdr+=" SEI message";
    119118    (*pDecodedMessageOutputStream) << std::setfill('-') << std::setw(seiMessageHdr.size()) << "-" << std::setfill(' ') << "\n" << seiMessageHdr << " (" << payloadSize << " bytes)"<< "\n";
    120 #if NH_MV_SEI
     119#if NH_MV
    121120    (*pDecodedMessageOutputStream) << std::setfill(' ') << "LayerId: " << m_layerId << std::setw(2) << " Picture: " << m_decOrder << std::setw( 5 ) << std::endl;
    122121#endif
     
    133132 * unmarshal a single SEI message from bitstream bs
    134133 */
    135 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     134#if NH_MV
    136135Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    137136#else
     
    144143  do
    145144  {
    146 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     145#if NH_MV
    147146    xReadSEImessage(seis, nalUnitType, vps, sps, pDecodedMessageOutputStream);
    148147#else
     
    158157}
    159158
    160 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     159#if NH_MV
    161160Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    162161#else
     
    281280    case SEI::SCALABLE_NESTING:
    282281      sei = new SEIScalableNesting;
    283 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     282#if NH_MV
    284283      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, vps, sps, pDecodedMessageOutputStream);
    285284#else
     
    295294      xParseSEITimeCode((SEITimeCode&) *sei, payloadSize, pDecodedMessageOutputStream);
    296295      break;
    297     case SEI::CHROMA_SAMPLING_FILTER_HINT:
    298       sei = new SEIChromaSamplingFilterHint;
    299       xParseSEIChromaSamplingFilterHint((SEIChromaSamplingFilterHint&) *sei, payloadSize/*, sps*/, pDecodedMessageOutputStream);
     296    case SEI::CHROMA_RESAMPLING_FILTER_HINT:
     297      sei = new SEIChromaResamplingFilterHint;
     298      xParseSEIChromaResamplingFilterHint((SEIChromaResamplingFilterHint&) *sei, payloadSize, pDecodedMessageOutputStream);
    300299      //}
    301300      break;
     
    304303      xParseSEIKneeFunctionInfo((SEIKneeFunctionInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
    305304      break;
     305    case SEI::COLOUR_REMAPPING_INFO:
     306      sei = new SEIColourRemappingInfo;
     307      xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
     308      break;
    306309    case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:
    307310      sei = new SEIMasteringDisplayColourVolume;
    308311      xParseSEIMasteringDisplayColourVolume((SEIMasteringDisplayColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream);
    309312      break;
    310 #if !NH_MV_SEI
    311     case SEI::SUB_BITSTREAM_PROPERTY:
    312       sei = new SEISubBitstreamProperty;
    313       xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei, payloadSize, pDecodedMessageOutputStream );
    314       break;
    315 #else
    316 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     313#if NH_MV
    317314    case SEI::LAYERS_NOT_PRESENT:
    318315      if (!vps)
     
    326323      }
    327324      break;
    328 #endif
    329325    case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
    330326      sei = new SEIInterLayerConstrainedTileSets;
     
    367363      xParseSEIThreeDimensionalReferenceDisplaysInfo((SEIThreeDimensionalReferenceDisplaysInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
    368364      break;
    369 #if SEI_DRI_F0169
    370365    case SEI::DEPTH_REPRESENTATION_INFO:
    371366        sei = new SEIDepthRepresentationInfo;
    372367        xParseSEIDepthRepresentationInfo((SEIDepthRepresentationInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
    373368        break;
    374 #endif
    375369    case SEI::MULTIVIEW_SCENE_INFO:
    376370      sei = new SEIMultiviewSceneInfo;
     
    531525  UInt val;
    532526  sei_read_code( pDecodedMessageOutputStream, 8, val, "hash_type");
    533   sei.method = static_cast<SEIDecodedPictureHash::Method>(val); bytesRead++;
    534 
    535   const Char *traceString="\0";
     527  sei.method = static_cast<HashType>(val); bytesRead++;
     528
     529  const TChar *traceString="\0";
    536530  switch (sei.method)
    537531  {
    538     case SEIDecodedPictureHash::MD5: traceString="picture_md5"; break;
    539     case SEIDecodedPictureHash::CRC: traceString="picture_crc"; break;
    540     case SEIDecodedPictureHash::CHECKSUM: traceString="picture_checksum"; break;
     532    case HASHTYPE_MD5: traceString="picture_md5"; break;
     533    case HASHTYPE_CRC: traceString="picture_crc"; break;
     534    case HASHTYPE_CHECKSUM: traceString="picture_checksum"; break;
    541535    default: assert(false); break;
    542536  }
     
    916910}
    917911
    918 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     912#if NH_MV
    919913Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    920914#else
     
    962956  do
    963957  {
    964 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     958#if NH_MV
    965959    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, pDecodedMessageOutputStream);
    966960#else
     
    974968  }
    975969}
    976 
    977 #if NH_MV
    978 #if !NH_MV_SEI
    979 Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
    980 {
    981   UInt code;
    982   output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    983   sei_read_code( pDecodedMessageOutputStream, 4, code, "active_vps_id" );                      sei.m_activeVpsId = code;
    984   sei_read_uvlc( pDecodedMessageOutputStream, code, "num_additional_sub_streams_minus1" );     sei.m_numAdditionalSubStreams = code + 1;
    985 
    986   xResizeSubBitstreamPropertySeiArrays(sei);
    987   for( Int i = 0; i < sei.m_numAdditionalSubStreams; i++ )
    988   {
    989     sei_read_code( pDecodedMessageOutputStream,   2, code, "sub_bitstream_mode[i]"           ); sei.m_subBitstreamMode[i] = code;
    990     sei_read_uvlc( pDecodedMessageOutputStream,  code, "output_layer_set_idx_to_vps[i]"      ); sei.m_outputLayerSetIdxToVps[i] = code;
    991     sei_read_code( pDecodedMessageOutputStream,   3, code, "highest_sub_layer_id[i]"         ); sei.m_highestSublayerId[i] = code;
    992     sei_read_code( pDecodedMessageOutputStream,  16, code, "avg_bit_rate[i]"                 ); sei.m_avgBitRate[i] = code;
    993     sei_read_code( pDecodedMessageOutputStream,  16, code, "max_bit_rate[i]"                 ); sei.m_maxBitRate[i] = code;
    994   }
    995 }
    996 
    997 Void SEIReader::xResizeSubBitstreamPropertySeiArrays(SEISubBitstreamProperty &sei)
    998 {
    999   sei.m_subBitstreamMode.resize( sei.m_numAdditionalSubStreams );
    1000   sei.m_outputLayerSetIdxToVps.resize( sei.m_numAdditionalSubStreams );
    1001   sei.m_highestSublayerId.resize( sei.m_numAdditionalSubStreams );
    1002   sei.m_avgBitRate.resize( sei.m_numAdditionalSubStreams );
    1003   sei.m_maxBitRate.resize( sei.m_numAdditionalSubStreams );
    1004 }
    1005 #endif
    1006 #endif
    1007970
    1008971
     
    11231086}
    11241087
    1125 Void SEIReader::xParseSEIChromaSamplingFilterHint(SEIChromaSamplingFilterHint& sei, UInt payloadSize/*, TComSPS* sps*/, std::ostream *pDecodedMessageOutputStream)
     1088Void SEIReader::xParseSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    11261089{
    11271090  UInt uiCode;
     
    11301093  sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "ver_chroma_filter_idc"); sei.m_verChromaFilterIdc = uiCode;
    11311094  sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "hor_chroma_filter_idc"); sei.m_horChromaFilterIdc = uiCode;
    1132   sei_read_flag( pDecodedMessageOutputStream, uiCode, "ver_filtering_process_flag"); sei.m_verFilteringProcessFlag = uiCode;
     1095  sei_read_flag( pDecodedMessageOutputStream, uiCode, "ver_filtering_field_processing_flag"); sei.m_verFilteringFieldProcessingFlag = uiCode;
    11331096  if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1)
    11341097  {
     
    11361099    if(sei.m_verChromaFilterIdc == 1)
    11371100    {
    1138       sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_vertical_filters"); sei.m_numVerticalFilters = uiCode;
    1139       if(sei.m_numVerticalFilters > 0)
    1140       {
    1141         sei.m_verTapLengthMinus1 = (Int*)malloc(sei.m_numVerticalFilters * sizeof(Int));
    1142         sei.m_verFilterCoeff = (Int**)malloc(sei.m_numVerticalFilters * sizeof(Int*));
    1143         for(Int i = 0; i < sei.m_numVerticalFilters; i ++)
    1144         {
    1145           sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "ver_tap_length_minus_1"); sei.m_verTapLengthMinus1[i] = uiCode;
    1146           sei.m_verFilterCoeff[i] = (Int*)malloc(sei.m_verTapLengthMinus1[i] * sizeof(Int));
    1147           for(Int j = 0; j < sei.m_verTapLengthMinus1[i]; j ++)
     1101      UInt numVerticalFilters;
     1102      sei_read_uvlc( pDecodedMessageOutputStream, numVerticalFilters, "num_vertical_filters"); sei.m_verFilterCoeff.resize(numVerticalFilters);
     1103      if(numVerticalFilters > 0)
     1104      {
     1105        for(Int i = 0; i < numVerticalFilters; i++)
     1106        {
     1107          UInt verTapLengthMinus1;
     1108          sei_read_uvlc( pDecodedMessageOutputStream, verTapLengthMinus1, "ver_tap_length_minus_1"); sei.m_verFilterCoeff[i].resize(verTapLengthMinus1+1);
     1109          for(Int j = 0; j < (verTapLengthMinus1 + 1); j++)
    11481110          {
    11491111            sei_read_svlc( pDecodedMessageOutputStream, sei.m_verFilterCoeff[i][j], "ver_filter_coeff");
     
    11541116    if(sei.m_horChromaFilterIdc == 1)
    11551117    {
    1156       sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_horizontal_filters"); sei.m_numHorizontalFilters = uiCode;
    1157       if(sei.m_numHorizontalFilters  > 0)
    1158       {
    1159         sei.m_horTapLengthMinus1 = (Int*)malloc(sei.m_numHorizontalFilters * sizeof(Int));
    1160         sei.m_horFilterCoeff = (Int**)malloc(sei.m_numHorizontalFilters * sizeof(Int*));
    1161         for(Int i = 0; i < sei.m_numHorizontalFilters; i ++)
    1162         {
    1163           sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "hor_tap_length_minus_1"); sei.m_horTapLengthMinus1[i] = uiCode;
    1164           sei.m_horFilterCoeff[i] = (Int*)malloc(sei.m_horTapLengthMinus1[i] * sizeof(Int));
    1165           for(Int j = 0; j < sei.m_horTapLengthMinus1[i]; j ++)
     1118      UInt numHorizontalFilters;
     1119      sei_read_uvlc( pDecodedMessageOutputStream, numHorizontalFilters, "num_horizontal_filters"); sei.m_horFilterCoeff.resize(numHorizontalFilters);
     1120      if(numHorizontalFilters  > 0)
     1121      {
     1122        for(Int i = 0; i < numHorizontalFilters; i++)
     1123        {
     1124          UInt horTapLengthMinus1;
     1125          sei_read_uvlc( pDecodedMessageOutputStream, horTapLengthMinus1, "hor_tap_length_minus_1"); sei.m_horFilterCoeff[i].resize(horTapLengthMinus1+1);
     1126          for(Int j = 0; j < (horTapLengthMinus1 + 1); j++)
    11661127          {
    11671128            sei_read_svlc( pDecodedMessageOutputStream, sei.m_horFilterCoeff[i][j], "hor_filter_coeff");
     
    12001161}
    12011162
     1163Void SEIReader::xParseSEIColourRemappingInfo(SEIColourRemappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1164{
     1165  UInt  uiVal;
     1166  Int   iVal;
     1167  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1168
     1169  sei_read_uvlc( pDecodedMessageOutputStream, uiVal, "colour_remap_id" );          sei.m_colourRemapId = uiVal;
     1170  sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_cancel_flag" ); sei.m_colourRemapCancelFlag = uiVal;
     1171  if( !sei.m_colourRemapCancelFlag )
     1172  {
     1173    sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_persistence_flag" );                sei.m_colourRemapPersistenceFlag = uiVal;
     1174    sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_video_signal_info_present_flag" );  sei.m_colourRemapVideoSignalInfoPresentFlag = uiVal;
     1175    if ( sei.m_colourRemapVideoSignalInfoPresentFlag )
     1176    {
     1177      sei_read_flag( pDecodedMessageOutputStream, uiVal,    "colour_remap_full_range_flag" );            sei.m_colourRemapFullRangeFlag = uiVal;
     1178      sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_primaries" );                  sei.m_colourRemapPrimaries = uiVal;
     1179      sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_transfer_function" );          sei.m_colourRemapTransferFunction = uiVal;
     1180      sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_matrix_coefficients" );        sei.m_colourRemapMatrixCoefficients = uiVal;
     1181    }
     1182    sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_input_bit_depth" );              sei.m_colourRemapInputBitDepth = uiVal;
     1183    sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_bit_depth" );                    sei.m_colourRemapBitDepth = uiVal;
     1184 
     1185    for( Int c=0 ; c<3 ; c++ )
     1186    {
     1187      sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "pre_lut_num_val_minus1[c]" ); sei.m_preLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal;
     1188      sei.m_preLut[c].resize(sei.m_preLutNumValMinus1[c]+1);
     1189      if( uiVal> 0 )
     1190      {
     1191        for ( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ )
     1192        {
     1193          sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapInputBitDepth   + 7 ) >> 3 ) << 3, uiVal, "pre_lut_coded_value[c][i]" );  sei.m_preLut[c][i].codedValue  = uiVal;
     1194          sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_target_value[c][i]" ); sei.m_preLut[c][i].targetValue = uiVal;
     1195        }
     1196      }
     1197      else // pre_lut_num_val_minus1[c] == 0
     1198      {
     1199        sei.m_preLut[c][0].codedValue  = 0;
     1200        sei.m_preLut[c][0].targetValue = 0;
     1201        sei.m_preLut[c][1].codedValue  = (1 << sei.m_colourRemapInputBitDepth) - 1 ;
     1202        sei.m_preLut[c][1].targetValue = (1 << sei.m_colourRemapBitDepth) - 1 ;
     1203      }
     1204    }
     1205
     1206    sei_read_flag( pDecodedMessageOutputStream, uiVal,      "colour_remap_matrix_present_flag" ); sei.m_colourRemapMatrixPresentFlag = uiVal;
     1207    if( sei.m_colourRemapMatrixPresentFlag )
     1208    {
     1209      sei_read_code( pDecodedMessageOutputStream, 4, uiVal, "log2_matrix_denom" ); sei.m_log2MatrixDenom = uiVal;
     1210      for ( Int c=0 ; c<3 ; c++ )
     1211      {
     1212        for ( Int i=0 ; i<3 ; i++ )
     1213        {
     1214          sei_read_svlc( pDecodedMessageOutputStream, iVal, "colour_remap_coeffs[c][i]" ); sei.m_colourRemapCoeffs[c][i] = iVal;
     1215        }
     1216      }
     1217    }
     1218    else // setting default matrix (I3)
     1219    {
     1220      sei.m_log2MatrixDenom = 10;
     1221      for ( Int c=0 ; c<3 ; c++ )
     1222      {
     1223        for ( Int i=0 ; i<3 ; i++ )
     1224        {
     1225          sei.m_colourRemapCoeffs[c][i] = (c==i) << sei.m_log2MatrixDenom;
     1226        }
     1227      }
     1228    }
     1229    for( Int c=0 ; c<3 ; c++ )
     1230    {
     1231      sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "post_lut_num_val_minus1[c]" ); sei.m_postLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal;
     1232      sei.m_postLut[c].resize(sei.m_postLutNumValMinus1[c]+1);
     1233      if( uiVal > 0 )
     1234      {
     1235        for ( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ )
     1236        {
     1237          sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_coded_value[c][i]" );  sei.m_postLut[c][i].codedValue = uiVal;
     1238          sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_target_value[c][i]" ); sei.m_postLut[c][i].targetValue = uiVal;
     1239        }
     1240      }
     1241      else
     1242      {
     1243        sei.m_postLut[c][0].codedValue  = 0;
     1244        sei.m_postLut[c][0].targetValue = 0;
     1245        sei.m_postLut[c][1].targetValue = (1 << sei.m_colourRemapBitDepth) - 1;
     1246        sei.m_postLut[c][1].codedValue  = (1 << sei.m_colourRemapBitDepth) - 1;
     1247      }
     1248    }
     1249  }
     1250}
     1251
     1252
    12021253Void SEIReader::xParseSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    12031254{
     
    12211272  sei_read_code( pDecodedMessageOutputStream, 32, code, "min_display_mastering_luminance" ); sei.values.minLuminance = code;
    12221273}
    1223 
    1224 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     1274#if NH_MV
    12251275Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
    12261276{
     
    12391289  }
    12401290};
    1241 #endif
    12421291
    12431292Void SEIReader::xParseSEIInterLayerConstrainedTileSets(SEIInterLayerConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     
    15061555};
    15071556
    1508 #if SEI_DRI_F0169
    15091557Void SEIReader::xParseSEIDepthRepInfoElement(double& f,std::ostream *pDecodedMessageOutputStream)
    15101558{
     
    16091657    }
    16101658}
    1611 #endif
     1659
    16121660Void SEIReader::xParseSEIMultiviewSceneInfo(SEIMultiviewSceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    16131661{
     
    18201868};
    18211869#endif
     1870#endif
    18221871
    18231872//! \}
  • TabularUnified trunk/source/Lib/TLibDecoder/SEIread.h

    r1356 r1386  
    5656  SEIReader() {};
    5757  virtual ~SEIReader() {};
    58 #if NH_MV_LAYERS_NOT_PRESENT_SEI
    59   Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     58#if NH_MV
     59  Void setLayerId( Int   layerId ) { m_layerId = layerId; };
     60  Void setDecOrder( Int64 decOrder ) { m_decOrder = decOrder; };
     61  Void parseSEImessage( TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream );
    6062#else
    6163  Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    6264#endif
    63 #if NH_MV_SEI
    64   Void setLayerId                            ( Int   layerId )   { m_layerId  = layerId; };
    65   Void setDecOrder                           ( Int64 decOrder )  { m_decOrder = decOrder; };
    66 #endif
    6765protected:
    68 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     66#if NH_MV
    6967  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    7068#else
     
    8684  Void xParseSEIToneMappingInfo               (SEIToneMappingInfo& sei,               UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    8785  Void xParseSEISOPDescription                (SEISOPDescription &sei,                UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    88 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     86#if NH_MV
    8987  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    9088#else
     
    9391  Void xParseSEITempMotionConstraintsTileSets (SEITempMotionConstrainedTileSets& sei, UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    9492  Void xParseSEITimeCode                      (SEITimeCode& sei,                      UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    95   Void xParseSEIChromaSamplingFilterHint      (SEIChromaSamplingFilterHint& sei,      UInt payloadSize/*,TComSPS* */,       std::ostream *pDecodedMessageOutputStream);
     93  Void xParseSEIChromaResamplingFilterHint    (SEIChromaResamplingFilterHint& sei,    UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    9694  Void xParseSEIKneeFunctionInfo              (SEIKneeFunctionInfo& sei,              UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    9795  Void xParseSEIMasteringDisplayColourVolume  (SEIMasteringDisplayColourVolume& sei,  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     96  Void xParseSEIColourRemappingInfo           (SEIColourRemappingInfo& sei,           UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    9897#if NH_MV
    99 #if !NH_MV_SEI
    100   Void  xParseSEISubBitstreamProperty         (SEISubBitstreamProperty &sei        ,  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    101   Void  xResizeSubBitstreamPropertySeiArrays  (SEISubBitstreamProperty &sei);
    102 #endif
    103 #endif
    104 #if NH_MV_LAYERS_NOT_PRESENT_SEI
    10598  Void xParseSEILayersNotPresent              (SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps ,std::ostream *pDecodedMessageOutputStream);
    106 #endif
    10799  Void xParseSEIInterLayerConstrainedTileSets (SEIInterLayerConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    108100#if NH_MV_SEI_TBD
     
    118110#endif
    119111  Void xParseSEIThreeDimensionalReferenceDisplaysInfo (SEIThreeDimensionalReferenceDisplaysInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    120 #if SEI_DRI_F0169
    121112  Void xParseSEIDepthRepInfoElement           (double &f,std::ostream *pDecodedMessageOutputStream);
    122113  Void xParseSEIDepthRepresentationInfo       (SEIDepthRepresentationInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    123 #endif
    124114  Void xParseSEIMultiviewSceneInfo            (SEIMultiviewSceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    125 
    126115  Void xParseSEIMultiviewAcquisitionInfo      (SEIMultiviewAcquisitionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    127 
    128 #if NH_MV_SEI
    129116  Void xParseSEIMultiviewViewPosition         (SEIMultiviewViewPosition& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    130 #endif
    131117#if NH_3D
    132118  Void xParseSEIAlternativeDepthInfo          (SEIAlternativeDepthInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    133119#endif
    134 
    135   Void sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const Char *pSymbolName);
    136   Void sei_read_uvlc(std::ostream *pOS,                UInt& ruiCode, const Char *pSymbolName);
    137   Void sei_read_svlc(std::ostream *pOS,                Int&  ruiCode, const Char *pSymbolName);
    138   Void sei_read_flag(std::ostream *pOS,                UInt& ruiCode, const Char *pSymbolName);
    139   Void sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const Char *pSymbolName);
    140 #if NH_MV_SEI
     120#endif
     121  Void sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName);
     122  Void sei_read_uvlc(std::ostream *pOS,                UInt& ruiCode, const TChar *pSymbolName);
     123  Void sei_read_svlc(std::ostream *pOS,                Int&  ruiCode, const TChar *pSymbolName);
     124  Void sei_read_flag(std::ostream *pOS,                UInt& ruiCode, const TChar *pSymbolName);
     125#if NH_MV
     126  Void sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const TChar *pSymbolName);
    141127  inline Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize);
    142128private:
  • TabularUnified trunk/source/Lib/TLibDecoder/SyntaxElementParser.cpp

    r1356 r1386  
    4949#if ENC_DEC_TRACE
    5050
    51 Void  SyntaxElementParser::xReadCodeTr           (UInt length, UInt& rValue, const Char *pSymbolName)
     51Void  SyntaxElementParser::xReadCodeTr           (UInt length, UInt& rValue, const TChar *pSymbolName)
    5252{
    5353#if RExt__DECODER_DEBUG_BIT_STATISTICS
     
    5656  xReadCode (length, rValue);
    5757#endif
    58 #if H_MV_ENC_DEC_TRAC
     58#if NH_MV_ENC_DEC_TRAC
    5959  if ( g_disableHLSTrace || !g_HLSTraceEnable )
    6060  {
     
    8080}
    8181
    82 Void  SyntaxElementParser::xReadUvlcTr           (UInt& rValue, const Char *pSymbolName)
     82Void  SyntaxElementParser::xReadUvlcTr           (UInt& rValue, const TChar *pSymbolName)
    8383{
    8484#if RExt__DECODER_DEBUG_BIT_STATISTICS
     
    8787  xReadUvlc (rValue);
    8888#endif
    89 #if H_MV_ENC_DEC_TRAC
     89#if NH_MV_ENC_DEC_TRAC
    9090  if ( g_disableHLSTrace || !g_HLSTraceEnable )
    9191  {
     
    104104}
    105105
    106 Void  SyntaxElementParser::xReadSvlcTr           (Int& rValue, const Char *pSymbolName)
     106Void  SyntaxElementParser::xReadSvlcTr           (Int& rValue, const TChar *pSymbolName)
    107107{
    108108#if RExt__DECODER_DEBUG_BIT_STATISTICS
     
    111111  xReadSvlc (rValue);
    112112#endif
    113 #if H_MV_ENC_DEC_TRAC
     113#if NH_MV_ENC_DEC_TRAC
    114114  if ( g_disableHLSTrace || !g_HLSTraceEnable )
    115115  {
     
    128128}
    129129
    130 Void  SyntaxElementParser::xReadFlagTr           (UInt& rValue, const Char *pSymbolName)
     130Void  SyntaxElementParser::xReadFlagTr           (UInt& rValue, const TChar *pSymbolName)
    131131{
    132132#if RExt__DECODER_DEBUG_BIT_STATISTICS
     
    135135  xReadFlag (rValue);
    136136#endif
    137 #if H_MV_ENC_DEC_TRAC
     137#if NH_MV_ENC_DEC_TRAC
    138138  if ( g_disableHLSTrace || !g_HLSTraceEnable )
    139139  {
     
    152152}
    153153
    154 Void  SyntaxElementParser::xReadStringTr        (UInt buSize, UChar *pValue, UInt& rLength, const Char *pSymbolName)
     154#if NH_MV
     155Void  SyntaxElementParser::xReadStringTr        (UInt buSize, UChar *pValue, UInt& rLength, const TChar *pSymbolName)
    155156{
    156157#if RExt__DECODER_DEBUG_BIT_STATISTICS
     
    163164  fflush ( g_hTrace );
    164165}
    165 
     166#endif
    166167Void  xTraceAccessUnitDelimiter ()
    167168{
     
    181182// ====================================================================================================================
    182183#if RExt__DECODER_DEBUG_BIT_STATISTICS
    183 Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& ruiCode, const Char *pSymbolName)
     184Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& ruiCode, const TChar *pSymbolName)
    184185#else
    185186Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& ruiCode)
     
    194195
    195196#if RExt__DECODER_DEBUG_BIT_STATISTICS
    196 Void SyntaxElementParser::xReadUvlc( UInt& ruiVal, const Char *pSymbolName)
     197Void SyntaxElementParser::xReadUvlc( UInt& ruiVal, const TChar *pSymbolName)
    197198#else
    198199Void SyntaxElementParser::xReadUvlc( UInt& ruiVal)
     
    232233
    233234#if RExt__DECODER_DEBUG_BIT_STATISTICS
    234 Void SyntaxElementParser::xReadSvlc( Int& riVal, const Char *pSymbolName)
     235Void SyntaxElementParser::xReadSvlc( Int& riVal, const TChar *pSymbolName)
    235236#else
    236237Void SyntaxElementParser::xReadSvlc( Int& riVal)
     
    270271
    271272#if RExt__DECODER_DEBUG_BIT_STATISTICS
    272 Void SyntaxElementParser::xReadFlag (UInt& ruiCode, const Char *pSymbolName)
     273Void SyntaxElementParser::xReadFlag (UInt& ruiCode, const TChar *pSymbolName)
    273274#else
    274275Void SyntaxElementParser::xReadFlag (UInt& ruiCode)
     
    281282}
    282283
    283 #if RExt__DECODER_DEBUG_BIT_STATISTICS
    284 Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength, const Char *pSymbolName)
     284#if NH_MV
     285#if RExt__DECODER_DEBUG_BIT_STATISTICS
     286Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength, const TChar *pSymbolName)
    285287#else
    286288Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength)
     
    302304  assert( pVal[rLength] == 0 ); 
    303305}
     306#endif
    304307
    305308Void SyntaxElementParser::xReadRbspTrailingBits()
  • TabularUnified trunk/source/Lib/TLibDecoder/SyntaxElementParser.h

    r1356 r1386  
    4949#define READ_SVLC(        code, name)     xReadSvlcTr (         code, name )
    5050#define READ_FLAG(        code, name)     xReadFlagTr (         code, name )
     51#if NH_MV
    5152#define READ_STRING(bufSize, code, length, name)   xReadStringTr ( bufSize, code, length, name )
    52 
     53#endif
    5354#else
    5455
     
    5960#define READ_SVLC(        code, name)     xReadSvlc (         code, name )
    6061#define READ_FLAG(        code, name)     xReadFlag (         code, name )
     62#if NH_MV
    6163#define READ_STRING(bufSize, code, length, name)   xReadString ( bufSize, code, length, name )
    62 
     64#endif
    6365#else
    6466
     
    6769#define READ_SVLC(        code, name)     xReadSvlc (         code )
    6870#define READ_FLAG(        code, name)     xReadFlag (         code )
     71#if NH_MV
    6972#define READ_STRING(bufSize, code, length, name)   xReadString ( bufSize, code, length )
     73#endif
    7074
    7175#endif
     
    9195
    9296#if RExt__DECODER_DEBUG_BIT_STATISTICS
    93   Void  xReadCode    ( UInt   length, UInt& val, const Char *pSymbolName );
    94   Void  xReadUvlc    ( UInt&  val, const Char *pSymbolName );
    95   Void  xReadSvlc    ( Int&   val, const Char *pSymbolName );
    96   Void  xReadFlag    ( UInt&  val, const Char *pSymbolName );
    97   Void  xReadString  ( UInt bufSize, UChar *val, UInt& length, const Char *pSymbolName);
     97  Void  xReadCode    ( UInt   length, UInt& val, const TChar *pSymbolName );
     98  Void  xReadUvlc    ( UInt&  val, const TChar *pSymbolName );
     99  Void  xReadSvlc    ( Int&   val, const TChar *pSymbolName );
     100  Void  xReadFlag    ( UInt&  val, const TChar *pSymbolName );
     101#if NH_MV
     102  Void  xReadString  ( UInt bufSize, UChar *val, UInt& length, const TChar *pSymbolName);
     103#endif
    98104#else
    99105  Void  xReadCode    ( UInt   length, UInt& val );
     
    101107  Void  xReadSvlc    ( Int&   val );
    102108  Void  xReadFlag    ( UInt&  val );
     109#if NH_MV
    103110  Void  xReadString  ( UInt bufSize, UChar *val, UInt& length);
    104111#endif
     112#endif
    105113#if ENC_DEC_TRACE
    106   Void  xReadCodeTr  (UInt  length, UInt& rValue, const Char *pSymbolName);
    107   Void  xReadUvlcTr  (              UInt& rValue, const Char *pSymbolName);
    108   Void  xReadSvlcTr  (               Int& rValue, const Char *pSymbolName);
    109   Void  xReadFlagTr  (              UInt& rValue, const Char *pSymbolName);
    110   Void  xReadStringTr(UInt bufSize, UChar *pValue, UInt& rLength, const Char *pSymbolName);
     114  Void  xReadCodeTr  (UInt  length, UInt& rValue, const TChar *pSymbolName);
     115  Void  xReadUvlcTr  (              UInt& rValue, const TChar *pSymbolName);
     116  Void  xReadSvlcTr  (               Int& rValue, const TChar *pSymbolName);
     117  Void  xReadFlagTr  (              UInt& rValue, const TChar *pSymbolName);
     118#if NH_MV
     119  Void  xReadStringTr(UInt bufSize, UChar *pValue, UInt& rLength, const TChar *pSymbolName);
     120#endif
    111121#endif
    112122public:
  • TabularUnified trunk/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp

    r1313 r1386  
    169169  if (g_debugCounter >= debugCabacBinTargetLine)
    170170  {
    171     Char breakPointThis;
     171    UChar breakPointThis;
    172172    breakPointThis = 7;
    173173  }
  • TabularUnified trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1321 r1386  
    5151
    5252#if ENC_DEC_TRACE
    53 #if !H_MV_ENC_DEC_TRAC
     53#if !NH_MV_ENC_DEC_TRAC
    5454Void  xTraceVPSHeader ()
    5555{
     
    234234{
    235235#if ENC_DEC_TRACE
    236 #if H_MV_ENC_DEC_TRAC
     236#if NH_MV_ENC_DEC_TRAC
    237237  tracePSHeader( "PPS", pcPPS->getLayerId() );
    238238#else
     
    454454#else
    455455#if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS
    456     static const char *syntaxStrings[]={ "pps_range_extension_flag",
     456    static const TChar *syntaxStrings[]={ "pps_range_extension_flag",
    457457                                         "pps_multilayer_extension_flag",
    458458                                         "pps_extension_6bits[0]",
     
    871871{
    872872#if ENC_DEC_TRACE
    873 #if H_MV_ENC_DEC_TRAC
     873#if NH_MV_ENC_DEC_TRAC
    874874  tracePSHeader( "SPS", pcSPS->getLayerId() );
    875875#else
     
    10171017    pcSPS->setSpsMaxLatencyIncreasePlus1( uiCode, i );
    10181018#else
    1019     pcSPS->setMaxLatencyIncrease( uiCode, i );
     1019    pcSPS->setMaxLatencyIncreasePlus1( uiCode, i );
    10201020#endif
    10211021
     
    10291029        pcSPS->setSpsMaxLatencyIncreasePlus1(pcSPS->getSpsMaxLatencyIncreasePlus1(0), i);
    10301030#else
    1031         pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i);
     1031        pcSPS->setMaxLatencyIncreasePlus1(pcSPS->getMaxLatencyIncreasePlus1(0), i);
    10321032#endif
    10331033      }
     
    11651165    if ( pcSPS->getSpsRangeExtensionsFlag() )
    11661166    {
    1167               TComSPSRExt &spsRangeExtension = pcSPS->getSpsRangeExtension();
    1168               READ_FLAG( uiCode, "transform_skip_rotation_enabled_flag");     spsRangeExtension.setTransformSkipRotationEnabledFlag(uiCode != 0);
    1169               READ_FLAG( uiCode, "transform_skip_context_enabled_flag");      spsRangeExtension.setTransformSkipContextEnabledFlag (uiCode != 0);
    1170               READ_FLAG( uiCode, "implicit_rdpcm_enabled_flag");              spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0));
    1171               READ_FLAG( uiCode, "explicit_rdpcm_enabled_flag");              spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0));
    1172               READ_FLAG( uiCode, "extended_precision_processing_flag");       spsRangeExtension.setExtendedPrecisionProcessingFlag (uiCode != 0);
    1173               READ_FLAG( uiCode, "intra_smoothing_disabled_flag");            spsRangeExtension.setIntraSmoothingDisabledFlag      (uiCode != 0);
    1174               READ_FLAG( uiCode, "high_precision_offsets_enabled_flag");      spsRangeExtension.setHighPrecisionOffsetsEnabledFlag (uiCode != 0);
    1175               READ_FLAG( uiCode, "persistent_rice_adaptation_enabled_flag");  spsRangeExtension.setPersistentRiceAdaptationEnabledFlag (uiCode != 0);
    1176               READ_FLAG( uiCode, "cabac_bypass_alignment_enabled_flag");      spsRangeExtension.setCabacBypassAlignmentEnabledFlag  (uiCode != 0);
     1167      TComSPSRExt &spsRangeExtension = pcSPS->getSpsRangeExtension();
     1168      READ_FLAG( uiCode, "transform_skip_rotation_enabled_flag");     spsRangeExtension.setTransformSkipRotationEnabledFlag(uiCode != 0);
     1169      READ_FLAG( uiCode, "transform_skip_context_enabled_flag");      spsRangeExtension.setTransformSkipContextEnabledFlag (uiCode != 0);
     1170      READ_FLAG( uiCode, "implicit_rdpcm_enabled_flag");              spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0));
     1171      READ_FLAG( uiCode, "explicit_rdpcm_enabled_flag");              spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0));
     1172      READ_FLAG( uiCode, "extended_precision_processing_flag");       spsRangeExtension.setExtendedPrecisionProcessingFlag (uiCode != 0);
     1173      READ_FLAG( uiCode, "intra_smoothing_disabled_flag");            spsRangeExtension.setIntraSmoothingDisabledFlag      (uiCode != 0);
     1174      READ_FLAG( uiCode, "high_precision_offsets_enabled_flag");      spsRangeExtension.setHighPrecisionOffsetsEnabledFlag (uiCode != 0);
     1175      READ_FLAG( uiCode, "persistent_rice_adaptation_enabled_flag");  spsRangeExtension.setPersistentRiceAdaptationEnabledFlag (uiCode != 0);
     1176      READ_FLAG( uiCode, "cabac_bypass_alignment_enabled_flag");      spsRangeExtension.setCabacBypassAlignmentEnabledFlag  (uiCode != 0);
    11771177    }
    11781178
     
    12061206
    12071207#if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS
    1208     static const char *syntaxStrings[]={ "sps_range_extension_flag",
     1208    static const TChar *syntaxStrings[]={ "sps_range_extension_flag",
    12091209                                         "sps_multilayer_extension_flag",
    12101210                                         "sps_extension_6bits[0]",
     
    12771277  for( Int d = 0; d  <=  1; d++ )
    12781278  {
    1279     READ_FLAG( uiCode, "iv_mv_pred_flag" ); sps3dExt.setIvMvPredFlag( d, uiCode == 1 );
    1280     READ_FLAG( uiCode, "iv_mv_scaling_flag" ); sps3dExt.setIvMvScalingFlag( d, uiCode == 1 );
     1279    READ_FLAG( uiCode, "iv_di_mc_enabled_flag" );              sps3dExt.setIvDiMcEnabledFlag( d, uiCode == 1 );
     1280    READ_FLAG( uiCode, "iv_mv_scal_enabled_flag" );            sps3dExt.setIvMvScalEnabledFlag( d, uiCode == 1 );
    12811281    if( d  ==  0 )
    12821282    {
    1283       READ_UVLC( uiCode, "log2_sub_pb_size_minus3" ); sps3dExt.setLog2SubPbSizeMinus3( d, uiCode );
    1284       READ_FLAG( uiCode, "iv_res_pred_flag" ); sps3dExt.setIvResPredFlag( d, uiCode == 1 );
    1285       READ_FLAG( uiCode, "depth_refinement_flag" ); sps3dExt.setDepthRefinementFlag( d, uiCode == 1 );
    1286       READ_FLAG( uiCode, "view_synthesis_pred_flag" ); sps3dExt.setViewSynthesisPredFlag( d, uiCode == 1 );
    1287       READ_FLAG( uiCode, "depth_based_blk_part_flag" ); sps3dExt.setDepthBasedBlkPartFlag( d, uiCode == 1 );
     1283      READ_UVLC( uiCode, "log2_sub_pb_size_minus3" );          sps3dExt.setLog2IvmcSubPbSizeMinus3( d, uiCode );
     1284      READ_FLAG( uiCode, "iv_res_pred_enabled_flag" );         sps3dExt.setIvResPredEnabledFlag( d, uiCode == 1 );
     1285      READ_FLAG( uiCode, "depth_ref_enabled_flag" );           sps3dExt.setDepthRefEnabledFlag( d, uiCode == 1 );
     1286      READ_FLAG( uiCode, "vsp_mc_enabled_flag" );              sps3dExt.setVspMcEnabledFlag( d, uiCode == 1 );
     1287      READ_FLAG( uiCode, "dbbp_enabled_flag" );                sps3dExt.setDbbpEnabledFlag( d, uiCode == 1 );
    12881288    }
    12891289    else
    12901290    {
    1291       READ_FLAG( uiCode, "mpi_flag" ); sps3dExt.setMpiFlag( d, uiCode == 1 );
    1292       READ_UVLC( uiCode, "log2_mpi_sub_pb_size_minus3" ); sps3dExt.setLog2MpiSubPbSizeMinus3( d, uiCode );
    1293       READ_FLAG( uiCode, "intra_contour_flag" ); sps3dExt.setIntraContourFlag( d, uiCode == 1 );
    1294       READ_FLAG( uiCode, "intra_sdc_wedge_flag" ); sps3dExt.setIntraSdcWedgeFlag( d, uiCode == 1 );
    1295       READ_FLAG( uiCode, "qt_pred_flag" ); sps3dExt.setQtPredFlag( d, uiCode == 1 );
    1296       READ_FLAG( uiCode, "inter_sdc_flag" ); sps3dExt.setInterSdcFlag( d, uiCode == 1 );
    1297       READ_FLAG( uiCode, "intra_skip_flag" ); sps3dExt.setDepthIntraSkipFlag( d, uiCode == 1 );
     1291      READ_FLAG( uiCode, "tex_mc_enabled_flag" );              sps3dExt.setTexMcEnabledFlag( d, uiCode == 1 );
     1292      READ_UVLC( uiCode, "log2_texmc_sub_pb_size_minus3" );    sps3dExt.setLog2TexmcSubPbSizeMinus3( d, uiCode );
     1293      READ_FLAG( uiCode, "intra_contour_enabled_flag" );       sps3dExt.setIntraContourEnabledFlag( d, uiCode == 1 );
     1294      READ_FLAG( uiCode, "intra_dc_only_wedge_enabled_flag" ); sps3dExt.setIntraDcOnlyWedgeEnabledFlag( d, uiCode == 1 );
     1295      READ_FLAG( uiCode, "cqt_cu_part_pred_enabled_flag" );    sps3dExt.setCqtCuPartPredEnabledFlag( d, uiCode == 1 );
     1296      READ_FLAG( uiCode, "inter_dc_only_enabled_flag" );       sps3dExt.setInterDcOnlyEnabledFlag( d, uiCode == 1 );
     1297      READ_FLAG( uiCode, "skip_intra_enabled_flag" );          sps3dExt.setSkipIntraEnabledFlag( d, uiCode == 1 );
    12981298    }
    12991299  }
     
    13581358{
    13591359#if ENC_DEC_TRACE
    1360 #if H_MV_ENC_DEC_TRAC
     1360#if NH_MV_ENC_DEC_TRAC
    13611361  tracePSHeader( "VPS", getDecTop()->getLayerId() );
    13621362#else
  • TabularUnified trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r1321 r1386  
    213213  UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    214214  UInt uiBPelY   = uiTPelY + (maxCuHeight>>uiDepth) - 1;
    215 #if H_MV_ENC_DEC_TRAC
     215#if NH_MV_ENC_DEC_TRAC
    216216  DTRACE_CU_S("=========== coding_quadtree ===========\n")
    217217  DTRACE_CU("x0", uiLPelX)
     
    270270  }
    271271
    272 #if H_MV_ENC_DEC_TRAC
     272#if NH_MV_ENC_DEC_TRAC
    273273  DTRACE_CU_S("=========== coding_unit ===========\n")
    274 #if H_MV_ENC_DEC_TRAC
     274#if NH_MV_ENC_DEC_TRAC
    275275#if ENC_DEC_TRACE
    276276    stopAtPos  ( pcCU->getSlice()->getPOC(),
     
    359359      }
    360360#endif
    361 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC   
     361#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC   
    362362      if ( g_decTraceDispDer )
    363363      {
     
    396396  if( pcCU->isSkipped(uiAbsPartIdx) )
    397397  {
    398 #if H_MV_ENC_DEC_TRAC
     398#if NH_MV_ENC_DEC_TRAC
    399399    DTRACE_PU_S("=========== prediction_unit ===========\n")
    400400    DTRACE_PU("x0", uiLPelX)
     
    493493        }
    494494#endif
    495 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC   
     495#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC   
    496496        if ( g_decTraceMvFromMerge )
    497497        {       
     
    531531        pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
    532532      }
    533 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     533#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    534534      if ( g_traceSubPBMotion )
    535535      {
  • TabularUnified trunk/source/Lib/TLibDecoder/TDecEntropy.cpp

    r1321 r1386  
    267267  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
    268268  {
    269 #if H_MV_ENC_DEC_TRAC
     269#if NH_MV_ENC_DEC_TRAC
    270270    DTRACE_PU_S("=========== prediction_unit ===========\n")
    271271    // ToDo:
     
    484484  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
    485485  {
    486 #if H_MV_ENC_DEC_TRAC
     486#if NH_MV_ENC_DEC_TRAC
    487487    DTRACE_PU_S("=========== prediction_unit ===========\n")
    488488    // ToDo:
     
    505505#endif
    506506
    507       UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     507      const UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    508508      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
    509509      {
     
    547547      else
    548548      {
    549         uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    550549
    551550#if NH_3D_MLC
     
    742741  {
    743742    m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx );
    744 #if H_MV_ENC_DEC_TRAC
     743#if NH_MV_ENC_DEC_TRAC
    745744#if ENC_DEC_TRACE
    746745    if ( eRefList == REF_PIC_LIST_0 )
     
    799798  {
    800799    m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx );
    801 #if H_MV_ENC_DEC_TRAC
     800#if NH_MV_ENC_DEC_TRAC
    802801#if ENC_DEC_TRACE
    803802    if ( eRefList == REF_PIC_LIST_0 )
     
    834833  const UInt uiTrDepth = rTu.GetTransformDepthRel();
    835834
    836 #if H_MV_ENC_DEC_TRAC
     835#if NH_MV_ENC_DEC_TRAC
    837836#if ENC_DEC_TRACE
    838837  UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
     
    941940    pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth );
    942941
    943 #if !H_MV_ENC_DEC_TRAC
     942#if !NH_MV_ENC_DEC_TRAC
    944943    {
    945944      DTRACE_CABAC_VL( g_nSymbolCounter++ );
  • TabularUnified trunk/source/Lib/TLibDecoder/TDecGop.cpp

    r1313 r1386  
    177177  pcPic->compressMotion();
    178178#endif
    179   Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');
     179  TChar c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');
    180180  if (!pcSlice->isReferenced())
    181181  {
     
    255255  TComPictureHash recon_digest;
    256256  Int numChar=0;
    257   const Char* hashType = "\0";
     257  const TChar* hashType = "\0";
    258258
    259259  if (pictureHashSEI)
     
    261261    switch (pictureHashSEI->method)
    262262    {
    263       case SEIDecodedPictureHash::MD5:
     263      case HASHTYPE_MD5:
    264264        {
    265265          hashType = "MD5";
     
    267267          break;
    268268        }
    269       case SEIDecodedPictureHash::CRC:
     269      case HASHTYPE_CRC:
    270270        {
    271271          hashType = "CRC";
     
    273273          break;
    274274        }
    275       case SEIDecodedPictureHash::CHECKSUM:
     275      case HASHTYPE_CHECKSUM:
    276276        {
    277277          hashType = "Checksum";
     
    288288
    289289  /* compare digest against received version */
    290   const Char* ok = "(unk)";
     290  const TChar* ok = "(unk)";
    291291  Bool mismatch = false;
    292292
  • TabularUnified trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r1313 r1386  
    423423  m_pcTDecBinIf->decodeBinTrm(uiSymbol);
    424424
    425 #if H_MV_ENC_DEC_TRAC
     425#if NH_MV_ENC_DEC_TRAC
    426426  DTRACE_CU("pcm_flag", uiSymbol)
    427427#endif
     
    467467  UInt uiSymbol;
    468468  m_pcTDecBinIf->decodeBin( uiSymbol, m_CUTransquantBypassFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__TQ_BYPASS_FLAG) );
    469 #if H_MV_ENC_DEC_TRAC
     469#if NH_MV_ENC_DEC_TRAC
    470470  DTRACE_CU("cu_transquant_bypass_flag", uiSymbol);
    471471#endif
     
    490490  UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx );
    491491  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__SKIP_FLAG) );
    492 #if !H_MV_ENC_DEC_TRAC
     492#if !NH_MV_ENC_DEC_TRAC
    493493  DTRACE_CABAC_VL( g_nSymbolCounter++ );
    494494  DTRACE_CABAC_T( "\tSkipFlag" );
     
    507507    pcCU->setMergeFlagSubParts( true , uiAbsPartIdx, 0, uiDepth );
    508508  }
    509 #if H_MV_ENC_DEC_TRAC
     509#if NH_MV_ENC_DEC_TRAC
    510510  DTRACE_CU("cu_skip_flag", uiSymbol);
    511511#endif
     
    570570  UInt uiSymbol;
    571571  m_pcTDecBinIf->decodeBin( uiSymbol, *m_cCUMergeFlagExtSCModel.get( 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__MERGE_FLAG) );
    572 #if H_MV_ENC_DEC_TRAC
     572#if NH_MV_ENC_DEC_TRAC
    573573  DTRACE_PU("merge_flag", uiSymbol)
    574574#endif
    575575  pcCU->setMergeFlagSubParts( uiSymbol ? true : false, uiAbsPartIdx, uiPUIdx, uiDepth );
    576 #if !H_MV_ENC_DEC_TRAC
     576#if !NH_MV_ENC_DEC_TRAC
    577577  DTRACE_CABAC_VL( g_nSymbolCounter++ );
    578578  DTRACE_CABAC_T( "\tMergeFlag: " );
     
    608608      }
    609609    }
    610 #if H_MV_ENC_DEC_TRAC
     610#if NH_MV_ENC_DEC_TRAC
    611611    DTRACE_PU("merge_idx", uiUnaryIdx)
    612612#endif
     
    614614  ruiMergeIndex = uiUnaryIdx;
    615615
    616 #if !H_MV_ENC_DEC_TRAC
     616#if !NH_MV_ENC_DEC_TRAC
    617617  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    618618  DTRACE_CABAC_T( "\tparseMergeIndex()" )
     
    666666#endif
    667667  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSplitFlagSCModel.get( 0, 0, pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ) ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    668 #if H_MV_ENC_DEC_TRAC
     668#if NH_MV_ENC_DEC_TRAC
    669669    DTRACE_CU("split_cu_flag", uiSymbol);
    670670#else
     
    748748    {
    749749      m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    750 #if H_MV_ENC_DEC_TRAC         
     750#if NH_MV_ENC_DEC_TRAC         
    751751        DTRACE_CU("part_mode", uiSymbol)
    752752#endif       
     
    884884      }
    885885#endif
    886 #if H_MV_ENC_DEC_TRAC         
     886#if NH_MV_ENC_DEC_TRAC         
    887887      DTRACE_CU("part_mode", eMode )
    888888#endif
     
    914914  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPredModeSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__PRED_MODE) );
    915915  iPredMode += uiSymbol;
    916 #if H_MV_ENC_DEC_TRAC         
     916#if NH_MV_ENC_DEC_TRAC         
    917917  DTRACE_CU("pred_mode_flag", uiSymbol)
    918918#endif       
     
    948948    m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    949949    mpmPred[j] = symbol;
    950 #if H_MV_ENC_DEC_TRAC         
     950#if NH_MV_ENC_DEC_TRAC         
    951951      DTRACE_CU("prev_intra_luma_pred_flag", symbol)
    952952#endif
     
    971971        symbol++;
    972972      }
    973 #if H_MV_ENC_DEC_TRAC         
     973#if NH_MV_ENC_DEC_TRAC         
    974974        DTRACE_CU("mpm_idx", symbol)
    975975#endif
     
    980980      m_pcTDecBinIf->decodeBinsEP( symbol, 5 RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    981981      intraPredMode = symbol;
    982 #if H_MV_ENC_DEC_TRAC         
     982#if NH_MV_ENC_DEC_TRAC         
    983983        DTRACE_CU("rem_intra_luma_pred_mode", symbol)
    984984#endif       
     
    10201020  if( uiSymbol == 0 )
    10211021  {
    1022 #if H_MV_ENC_DEC_TRAC         
     1022#if NH_MV_ENC_DEC_TRAC         
    10231023    DTRACE_CU("intra_chroma_pred_mode", uiSymbol )
    10241024#endif       
     
    10291029    UInt uiIPredMode;
    10301030    m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    1031 #if H_MV_ENC_DEC_TRAC         
     1031#if NH_MV_ENC_DEC_TRAC         
    10321032      DTRACE_CU("intra_chroma_pred_mode", uiIPredMode )
    10331033#endif       
     
    10641064  uiSymbol++;
    10651065  ruiInterDir = uiSymbol;
    1066 #if H_MV_ENC_DEC_TRAC
     1066#if NH_MV_ENC_DEC_TRAC
    10671067    DTRACE_PU("inter_pred_idc", ruiInterDir - 1 )   
    10681068#endif
     
    11011101  }
    11021102  riRefFrmIdx = uiSymbol;
    1103 #if H_MV_ENC_DEC_TRAC
     1103#if NH_MV_ENC_DEC_TRAC
    11041104#if ENC_DEC_TRACE
    11051105  if ( eRefList == REF_PIC_LIST_0 )
     
    11941194  if (!pcCU->isIntra(uiAbsPartIdx) || (pcCU->getIntraDir( CHANNEL_TYPE_CHROMA, uiAbsPartIdx ) == DM_CHROMA_IDX))
    11951195  {
    1196     Char alpha = 0;
     1196    SChar alpha = 0;
    11971197    UInt symbol = 0;
    11981198
     
    12391239      RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(TComCodingStatisticsClassType(STATS__CABAC_BITS__TRANSFORM_SUBDIV_FLAG, 5-uiLog2TransformBlockSize))
    12401240                          );
    1241 #if !H_MV_ENC_DEC_TRAC
     1241#if !NH_MV_ENC_DEC_TRAC
    12421242  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    12431243  DTRACE_CABAC_T( "\tparseTransformSubdivFlag()" )
     
    12581258  const UInt uiCtx = 0;
    12591259  m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtRootCbfSCModel.get( 0, 0, uiCtx ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__QT_ROOT_CBF) );
    1260 #if !H_MV_ENC_DEC_TRAC
     1260#if !NH_MV_ENC_DEC_TRAC
    12611261  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    12621262  DTRACE_CABAC_T( "\tparseQtRootCbf()" )
     
    13861386      pcCU->setCbfPartRange((uiCbf << subTUDepth), compID, subTUAbsPartIdx, partIdxesPerSubTU);
    13871387      combinedSubTUCBF |= uiCbf;
    1388 #if !H_MV_ENC_DEC_TRAC 
     1388#if !NH_MV_ENC_DEC_TRAC 
    13891389      DTRACE_CABAC_VL( g_nSymbolCounter++ )
    13901390      DTRACE_CABAC_T( "\tparseQtCbf()" )
     
    14301430
    14311431    pcCU->setCbfSubParts((uiCbf << lowestTUDepth), compID, absPartIdx, rTu.GetTransformDepthTotalAdj(compID));
    1432 #if !H_MV_ENC_DEC_TRAC
     1432#if !NH_MV_ENC_DEC_TRAC
    14331433    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    14341434    DTRACE_CABAC_T( "\tparseQtCbf()" )
     
    14911491                          );
    14921492
    1493 #if !H_MV_ENC_DEC_TRAC
     1493#if !NH_MV_ENC_DEC_TRAC
    14941494  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    14951495  DTRACE_CABAC_T("\tparseTransformSkip()");
     
    16051605  TCoeff* pcCoef=(pcCU->getCoeff(compID)+rTu.getCoefficientOffset(compID));
    16061606  const TComSPS &sps=*(pcCU->getSlice()->getSPS());
    1607 #if !H_MV_ENC_DEC_TRAC
     1607#if !NH_MV_ENC_DEC_TRAC
    16081608  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    16091609  DTRACE_CABAC_T( "\tparseCoeffNxN()\teType=" )
     
    22842284    uiW += ( 1 == uiCode ? 1 : 0 );
    22852285  }
    2286 #if H_MV_ENC_DEC_TRAC
     2286#if NH_MV_ENC_DEC_TRAC
    22872287  DTRACE_CU("iv_res_pred_weight_idx", uiW )
    22882288#endif
     
    23032303  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__3D_IC) );
    23042304
    2305 #if !H_MV_ENC_DEC_TRAC
     2305#if !NH_MV_ENC_DEC_TRAC
    23062306  DTRACE_CABAC_VL( g_nSymbolCounter++ );
    23072307  DTRACE_CABAC_T( "\tICFlag" );
     
    23942394    }
    23952395  }
    2396 #if H_MV_ENC_DEC_TRAC
     2396#if NH_MV_ENC_DEC_TRAC
    23972397  DTRACE_CU("delta_dc", rValDeltaDC);
    23982398#endif
     
    24952495
    24962496  m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__SDC_INTRA_FLAG) );
    2497 #if H_MV_ENC_DEC_TRAC
     2497#if NH_MV_ENC_DEC_TRAC
    24982498  DTRACE_CU("dc_only_flag", uiSymbol)
    24992499#endif
  • TabularUnified trunk/source/Lib/TLibDecoder/TDecSlice.cpp

    r1313 r1386  
    9090  g_bJustDoIt = g_bEncDecTraceEnable;
    9191#endif
    92 #if H_MV_ENC_DEC_TRAC
     92#if NH_MV_ENC_DEC_TRAC
    9393#if ENC_DEC_TRACE
    9494  incSymbolCounter();
     
    100100  DTRACE_CABAC_T( "\tPOC: " );
    101101  DTRACE_CABAC_V( pcPic->getPOC() );
    102 #if H_MV_ENC_DEC_TRAC
     102#if NH_MV_ENC_DEC_TRAC
    103103  DTRACE_CABAC_T( " Layer: " );
    104104  DTRACE_CABAC_V( pcPic->getLayerId() );
  • TabularUnified trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r1356 r1386  
    687687      }
    688688    }
    689 #if NH_MV_SEI
    690689    m_seiReader.setLayerId ( newPic->getLayerId      ( ) );
    691690    m_seiReader.setDecOrder( newPic->getDecodingOrder( ) );
    692 #endif
    693691#endif
    694692
     
    839837    InputNALUnit &nalu=*m_prefixSEINALUs.front();
    840838#if NH_MV
    841 #if NH_MV_LAYERS_NOT_PRESENT_SEI
    842839    m_seiReader.parseSEImessage(&(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(getLayerId()), m_pDecodedSEIOutputStream);
    843 #else
    844     m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
    845 #endif
    846840#else
    847841    m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
     
    13151309      {
    13161310#if NH_MV
    1317 #if NH_MV_LAYERS_NOT_PRESENT_SEI
    13181311      m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(getLayerId()), m_pDecodedSEIOutputStream);
    1319 #else
    1320       m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
    1321 #endif
    13221312#else
    13231313        m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
     
    17711761        xG813DecProcForInterLayerRefPicSet();
    17721762      }
     1763      else
     1764      {
     1765#if NH_MV_FIX_INIT_NUM_ACTIVE_REF_LAYER_PICS
     1766        TComDecodedRps* decRps = m_pcPic->getDecodedRps();
     1767        decRps->m_numActiveRefLayerPics0 = 0;
     1768        decRps->m_numActiveRefLayerPics1 = 0;     
     1769#endif
     1770      }
    17731771    }
    17741772  }
  • TabularUnified trunk/source/Lib/TLibEncoder/AnnexBwrite.h

    r1313 r1386  
    6060    UInt size = 0; /* size of annexB unit in bytes */
    6161
    62     static const Char start_code_prefix[] = {0,0,0,1};
     62    static const UChar start_code_prefix[] = {0,0,0,1};
    6363    if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS)
    6464    {
     
    7171       *    7.4.1.2.3.
    7272       */
    73       out.write(start_code_prefix, 4);
     73      out.write(reinterpret_cast<const TChar*>(start_code_prefix), 4);
    7474      size += 4;
    7575    }
    7676    else
    7777    {
    78       out.write(start_code_prefix+1, 3);
     78      out.write(reinterpret_cast<const TChar*>(start_code_prefix+1), 3);
    7979      size += 3;
    8080    }
  • TabularUnified trunk/source/Lib/TLibEncoder/NALwrite.cpp

    r1313 r1386  
    4545//! \{
    4646
    47 static const Char emulation_prevention_three_byte[] = {3};
     47static const UChar emulation_prevention_three_byte[] = {3};
    4848
    4949Void writeNalUnitHeader(ostream& out, OutputNALUnit& nalu)       // nal_unit_header()
     
    6060  bsNALUHeader.write(nalu.m_temporalId+1, 3); // nuh_temporal_id_plus1
    6161
    62   out.write(bsNALUHeader.getByteStream(), bsNALUHeader.getByteStreamLength());
     62  out.write(reinterpret_cast<const TChar*>(bsNALUHeader.getByteStream()), bsNALUHeader.getByteStreamLength());
    6363}
    6464/**
     
    124124    outputBuffer[outputAmount++]=emulation_prevention_three_byte[0];
    125125  }
    126   out.write((Char*)&(*outputBuffer.begin()), outputAmount);
     126  out.write(reinterpret_cast<const TChar*>(&(*outputBuffer.begin())), outputAmount);
    127127}
    128128
  • TabularUnified trunk/source/Lib/TLibEncoder/SEIEncoder.cpp

    r1356 r1386  
    294294  assert (pcPic!=NULL);
    295295
    296   if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 1)
    297   {
    298     decodedPictureHashSEI->method = SEIDecodedPictureHash::MD5;
     296  decodedPictureHashSEI->method = m_pcCfg->getDecodedPictureHashSEIType();
     297  switch (m_pcCfg->getDecodedPictureHashSEIType())
     298  {
     299    case HASHTYPE_MD5:
     300  {
    299301    UInt numChar=calcMD5(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths);
    300302    rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar);
    301303  }
    302   else if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 2)
    303   {
    304     decodedPictureHashSEI->method = SEIDecodedPictureHash::CRC;
     304      break;
     305    case HASHTYPE_CRC:
     306  {
    305307    UInt numChar=calcCRC(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths);
    306308    rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar);
    307309  }
    308   else if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 3)
    309   {
    310     decodedPictureHashSEI->method = SEIDecodedPictureHash::CHECKSUM;
     310      break;
     311    case HASHTYPE_CHECKSUM:
     312    default:
     313  {
    311314    UInt numChar=calcChecksum(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths);
    312315    rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar);
     316  }
     317      break;
    313318  }
    314319}
     
    397402  }
    398403}
    399 
    400 Void SEIEncoder::initSEIChromaSamplingFilterHint(SEIChromaSamplingFilterHint *seiChromaSamplingFilterHint, Int iHorFilterIndex, Int iVerFilterIndex)
    401 {
    402   assert (m_isInitialized);
    403   assert (seiChromaSamplingFilterHint!=NULL);
    404 
    405   seiChromaSamplingFilterHint->m_verChromaFilterIdc = iVerFilterIndex;
    406   seiChromaSamplingFilterHint->m_horChromaFilterIdc = iHorFilterIndex;
    407   seiChromaSamplingFilterHint->m_verFilteringProcessFlag = 1;
    408   seiChromaSamplingFilterHint->m_targetFormatIdc = 3;
    409   seiChromaSamplingFilterHint->m_perfectReconstructionFlag = false;
    410   if(seiChromaSamplingFilterHint->m_verChromaFilterIdc == 1)
    411   {
    412     seiChromaSamplingFilterHint->m_numVerticalFilters = 1;
    413     seiChromaSamplingFilterHint->m_verTapLengthMinus1 = (Int*)malloc(seiChromaSamplingFilterHint->m_numVerticalFilters * sizeof(Int));
    414     seiChromaSamplingFilterHint->m_verFilterCoeff =    (Int**)malloc(seiChromaSamplingFilterHint->m_numVerticalFilters * sizeof(Int*));
    415     for(Int i = 0; i < seiChromaSamplingFilterHint->m_numVerticalFilters; i ++)
    416     {
    417       seiChromaSamplingFilterHint->m_verTapLengthMinus1[i] = 0;
    418       seiChromaSamplingFilterHint->m_verFilterCoeff[i] = (Int*)malloc(seiChromaSamplingFilterHint->m_verTapLengthMinus1[i] * sizeof(Int));
    419       for(Int j = 0; j < seiChromaSamplingFilterHint->m_verTapLengthMinus1[i]; j ++)
    420       {
    421         seiChromaSamplingFilterHint->m_verFilterCoeff[i][j] = 0;
    422       }
    423     }
     404template <typename T>
     405static Void readTokenValue(T            &returnedValue, /// value returned
     406                           Bool         &failed,        /// used and updated
     407                           std::istream &is,            /// stream to read token from
     408                           const TChar  *pToken)        /// token string
     409{
     410  returnedValue=T();
     411  if (failed)
     412  {
     413    return;
     414  }
     415
     416  Int c;
     417  // Ignore any whitespace
     418  while ((c=is.get())!=EOF && isspace(c));
     419  // test for comment mark
     420  while (c=='#')
     421  {
     422    // Ignore to the end of the line
     423    while ((c=is.get())!=EOF && (c!=10 && c!=13));
     424    // Ignore any white space at the start of the next line
     425    while ((c=is.get())!=EOF && isspace(c));
     426  }
     427  // test first character of token
     428  failed=(c!=pToken[0]);
     429  // test remaining characters of token
     430  Int pos;
     431  for(pos=1;!failed && pToken[pos]!=0 && is.get()==pToken[pos]; pos++);
     432  failed|=(pToken[pos]!=0);
     433  // Ignore any whitespace before the ':'
     434  while (!failed && (c=is.get())!=EOF && isspace(c));
     435  failed|=(c!=':');
     436  // Now read the value associated with the token:
     437  if (!failed)
     438  {
     439    is >> returnedValue;
     440    failed=!is.good();
     441    if (!failed)
     442    {
     443      c=is.get();
     444      failed=(c!=EOF && !isspace(c));
     445    }
     446  }
     447  if (failed)
     448  {
     449    std::cerr << "Unable to read token '" << pToken << "'\n";
     450  }
     451}
     452
     453template <typename T>
     454static Void readTokenValueAndValidate(T            &returnedValue, /// value returned
     455                                      Bool         &failed,        /// used and updated
     456                                      std::istream &is,            /// stream to read token from
     457                                      const TChar  *pToken,        /// token string
     458                                      const T      &minInclusive,  /// minimum value allowed, inclusive
     459                                      const T      &maxInclusive)  /// maximum value allowed, inclusive
     460{
     461  readTokenValue(returnedValue, failed, is, pToken);
     462  if (!failed)
     463  {
     464    if (returnedValue<minInclusive || returnedValue>maxInclusive)
     465    {
     466      failed=true;
     467      std::cerr << "Value for token " << pToken << " must be in the range " << minInclusive << " to " << maxInclusive << " (inclusive); value read: " << returnedValue << std::endl;
     468    }
     469  }
     470}
     471
     472// Bool version does not have maximum and minimum values.
     473static Void readTokenValueAndValidate(Bool         &returnedValue, /// value returned
     474                                      Bool         &failed,        /// used and updated
     475                                      std::istream &is,            /// stream to read token from
     476                                      const TChar  *pToken)        /// token string
     477{
     478  readTokenValue(returnedValue, failed, is, pToken);
     479}
     480
     481Bool SEIEncoder::initSEIColourRemappingInfo(SEIColourRemappingInfo* seiColourRemappingInfo, Int currPOC) // returns true on success, false on failure.
     482{
     483  assert (m_isInitialized);
     484  assert (seiColourRemappingInfo!=NULL);
     485
     486  // reading external Colour Remapping Information SEI message parameters from file
     487  if( !m_pcCfg->getColourRemapInfoSEIFileRoot().empty())
     488  {
     489    Bool failed=false;
     490
     491    // building the CRI file name with poc num in prefix "_poc.txt"
     492    std::string colourRemapSEIFileWithPoc(m_pcCfg->getColourRemapInfoSEIFileRoot());
     493    {
     494      std::stringstream suffix;
     495      suffix << "_" << currPOC << ".txt";
     496      colourRemapSEIFileWithPoc+=suffix.str();
     497    }
     498
     499    std::ifstream fic(colourRemapSEIFileWithPoc.c_str());
     500    if (!fic.good() || !fic.is_open())
     501    {
     502      std::cerr <<  "No Colour Remapping Information SEI parameters file " << colourRemapSEIFileWithPoc << " for POC " << currPOC << std::endl;
     503      return false;
     504    }
     505
     506    // TODO: identify and remove duplication with decoder parsing through abstraction.
     507
     508    readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapId,         failed, fic, "colour_remap_id",        UInt(0), UInt(0x7fffffff) );
     509    readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapCancelFlag, failed, fic, "colour_remap_cancel_flag" );
     510    if( !seiColourRemappingInfo->m_colourRemapCancelFlag )
     511    {
     512      readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapPersistenceFlag,            failed, fic, "colour_remap_persistence_flag" );
     513      readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapVideoSignalInfoPresentFlag, failed, fic, "colour_remap_video_signal_info_present_flag");
     514      if( seiColourRemappingInfo->m_colourRemapVideoSignalInfoPresentFlag )
     515      {
     516        readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapFullRangeFlag,      failed, fic, "colour_remap_full_range_flag" );
     517        readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapPrimaries,          failed, fic, "colour_remap_primaries",           Int(0), Int(255) );
     518        readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapTransferFunction,   failed, fic, "colour_remap_transfer_function",   Int(0), Int(255) );
     519        readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapMatrixCoefficients, failed, fic, "colour_remap_matrix_coefficients", Int(0), Int(255) );
     520      }
     521      readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapInputBitDepth, failed, fic, "colour_remap_input_bit_depth",            Int(8), Int(16) );
     522      readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapBitDepth,      failed, fic, "colour_remap_bit_depth",                  Int(8), Int(16) );
     523
     524      const Int maximumInputValue    = (1 << (((seiColourRemappingInfo->m_colourRemapInputBitDepth + 7) >> 3) << 3)) - 1;
     525      const Int maximumRemappedValue = (1 << (((seiColourRemappingInfo->m_colourRemapBitDepth      + 7) >> 3) << 3)) - 1;
     526
     527      for( Int c=0 ; c<3 ; c++ )
     528      {
     529        readTokenValueAndValidate(seiColourRemappingInfo->m_preLutNumValMinus1[c],         failed, fic, "pre_lut_num_val_minus1[c]",        Int(0), Int(32) );
     530        if( seiColourRemappingInfo->m_preLutNumValMinus1[c]>0 )
     531        {
     532          seiColourRemappingInfo->m_preLut[c].resize(seiColourRemappingInfo->m_preLutNumValMinus1[c]+1);
     533          for( Int i=0 ; i<=seiColourRemappingInfo->m_preLutNumValMinus1[c] ; i++ )
     534          {
     535            readTokenValueAndValidate(seiColourRemappingInfo->m_preLut[c][i].codedValue,   failed, fic, "pre_lut_coded_value[c][i]",  Int(0), maximumInputValue    );
     536            readTokenValueAndValidate(seiColourRemappingInfo->m_preLut[c][i].targetValue,  failed, fic, "pre_lut_target_value[c][i]", Int(0), maximumRemappedValue );
     537          }
     538        }
     539      }
     540      readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapMatrixPresentFlag, failed, fic, "colour_remap_matrix_present_flag" );
     541      if( seiColourRemappingInfo->m_colourRemapMatrixPresentFlag )
     542      {
     543        readTokenValueAndValidate(seiColourRemappingInfo->m_log2MatrixDenom, failed, fic, "log2_matrix_denom", Int(0), Int(15) );
     544        for( Int c=0 ; c<3 ; c++ )
     545        {
     546          for( Int i=0 ; i<3 ; i++ )
     547          {
     548            readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapCoeffs[c][i], failed, fic, "colour_remap_coeffs[c][i]", -32768, 32767 );
     549          }
     550        }
     551      }
     552      for( Int c=0 ; c<3 ; c++ )
     553      {
     554        readTokenValueAndValidate(seiColourRemappingInfo->m_postLutNumValMinus1[c], failed, fic, "post_lut_num_val_minus1[c]", Int(0), Int(32) );
     555        if( seiColourRemappingInfo->m_postLutNumValMinus1[c]>0 )
     556        {
     557          seiColourRemappingInfo->m_postLut[c].resize(seiColourRemappingInfo->m_postLutNumValMinus1[c]+1);
     558          for( Int i=0 ; i<=seiColourRemappingInfo->m_postLutNumValMinus1[c] ; i++ )
     559          {
     560            readTokenValueAndValidate(seiColourRemappingInfo->m_postLut[c][i].codedValue,  failed, fic, "post_lut_coded_value[c][i]",  Int(0), maximumRemappedValue );
     561            readTokenValueAndValidate(seiColourRemappingInfo->m_postLut[c][i].targetValue, failed, fic, "post_lut_target_value[c][i]", Int(0), maximumRemappedValue );
     562          }
     563        }
     564      }
     565    }
     566
     567    if( failed )
     568    {
     569      std::cerr << "Error while reading Colour Remapping Information SEI parameters file '" << colourRemapSEIFileWithPoc << "'" << std::endl;
     570      exit(EXIT_FAILURE);
     571    }
     572  }
     573  return true;
     574}
     575
     576
     577Void SEIEncoder::initSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint *seiChromaResamplingFilterHint, Int iHorFilterIndex, Int iVerFilterIndex)
     578{
     579  assert (m_isInitialized);
     580  assert (seiChromaResamplingFilterHint!=NULL);
     581
     582  seiChromaResamplingFilterHint->m_verChromaFilterIdc = iVerFilterIndex;
     583  seiChromaResamplingFilterHint->m_horChromaFilterIdc = iHorFilterIndex;
     584  seiChromaResamplingFilterHint->m_verFilteringFieldProcessingFlag = 1;
     585  seiChromaResamplingFilterHint->m_targetFormatIdc = 3;
     586  seiChromaResamplingFilterHint->m_perfectReconstructionFlag = false;
     587
     588  // this creates some example filter values, if explicit filter definition is selected
     589  if (seiChromaResamplingFilterHint->m_verChromaFilterIdc == 1)
     590    {
     591    const Int numVerticalFilters = 3;
     592    const Int verTapLengthMinus1[] = {5,3,3};
     593
     594    seiChromaResamplingFilterHint->m_verFilterCoeff.resize(numVerticalFilters);
     595    for(Int i = 0; i < numVerticalFilters; i ++)
     596      {
     597      seiChromaResamplingFilterHint->m_verFilterCoeff[i].resize(verTapLengthMinus1[i]+1);
     598    }
     599    // Note: C++11 -> seiChromaResamplingFilterHint->m_verFilterCoeff[0] = {-3,13,31,23,3,-3};
     600    seiChromaResamplingFilterHint->m_verFilterCoeff[0][0] = -3;
     601    seiChromaResamplingFilterHint->m_verFilterCoeff[0][1] = 13;
     602    seiChromaResamplingFilterHint->m_verFilterCoeff[0][2] = 31;
     603    seiChromaResamplingFilterHint->m_verFilterCoeff[0][3] = 23;
     604    seiChromaResamplingFilterHint->m_verFilterCoeff[0][4] = 3;
     605    seiChromaResamplingFilterHint->m_verFilterCoeff[0][5] = -3;
     606
     607    seiChromaResamplingFilterHint->m_verFilterCoeff[1][0] = -1;
     608    seiChromaResamplingFilterHint->m_verFilterCoeff[1][1] = 25;
     609    seiChromaResamplingFilterHint->m_verFilterCoeff[1][2] = 247;
     610    seiChromaResamplingFilterHint->m_verFilterCoeff[1][3] = -15;
     611
     612    seiChromaResamplingFilterHint->m_verFilterCoeff[2][0] = -20;
     613    seiChromaResamplingFilterHint->m_verFilterCoeff[2][1] = 186;
     614    seiChromaResamplingFilterHint->m_verFilterCoeff[2][2] = 100;
     615    seiChromaResamplingFilterHint->m_verFilterCoeff[2][3] = -10;
    424616  }
    425617  else
    426618  {
    427     seiChromaSamplingFilterHint->m_numVerticalFilters = 0;
    428     seiChromaSamplingFilterHint->m_verTapLengthMinus1 = NULL;
    429     seiChromaSamplingFilterHint->m_verFilterCoeff = NULL;
    430   }
    431   if(seiChromaSamplingFilterHint->m_horChromaFilterIdc == 1)
    432   {
    433     seiChromaSamplingFilterHint->m_numHorizontalFilters = 1;
    434     seiChromaSamplingFilterHint->m_horTapLengthMinus1 = (Int*)malloc(seiChromaSamplingFilterHint->m_numHorizontalFilters * sizeof(Int));
    435     seiChromaSamplingFilterHint->m_horFilterCoeff = (Int**)malloc(seiChromaSamplingFilterHint->m_numHorizontalFilters * sizeof(Int*));
    436     for(Int i = 0; i < seiChromaSamplingFilterHint->m_numHorizontalFilters; i ++)
    437     {
    438       seiChromaSamplingFilterHint->m_horTapLengthMinus1[i] = 0;
    439       seiChromaSamplingFilterHint->m_horFilterCoeff[i] = (Int*)malloc(seiChromaSamplingFilterHint->m_horTapLengthMinus1[i] * sizeof(Int));
    440       for(Int j = 0; j < seiChromaSamplingFilterHint->m_horTapLengthMinus1[i]; j ++)
    441       {
    442         seiChromaSamplingFilterHint->m_horFilterCoeff[i][j] = 0;
    443       }
    444     }
     619    seiChromaResamplingFilterHint->m_verFilterCoeff.resize(0);
     620  }
     621
     622  if (seiChromaResamplingFilterHint->m_horChromaFilterIdc == 1)
     623    {
     624    Int const numHorizontalFilters = 1;
     625    const Int horTapLengthMinus1[] = {3};
     626
     627    seiChromaResamplingFilterHint->m_horFilterCoeff.resize(numHorizontalFilters);
     628    for(Int i = 0; i < numHorizontalFilters; i ++)
     629      {
     630      seiChromaResamplingFilterHint->m_horFilterCoeff[i].resize(horTapLengthMinus1[i]+1);
     631    }
     632    seiChromaResamplingFilterHint->m_horFilterCoeff[0][0] = 1;
     633    seiChromaResamplingFilterHint->m_horFilterCoeff[0][1] = 6;
     634    seiChromaResamplingFilterHint->m_horFilterCoeff[0][2] = 1;
    445635  }
    446636  else
    447637  {
    448     seiChromaSamplingFilterHint->m_numHorizontalFilters = 0;
    449     seiChromaSamplingFilterHint->m_horTapLengthMinus1 = NULL;
    450     seiChromaSamplingFilterHint->m_horFilterCoeff = NULL;
     638    seiChromaResamplingFilterHint->m_horFilterCoeff.resize(0);
    451639  }
    452640}
     
    465653
    466654#if NH_MV
    467 #if !NH_MV_SEI
    468 Void SEIEncoder::initSEISubBitstreamProperty(SEISubBitstreamProperty *seiSubBitstreamProperty, const TComSPS *sps)
    469 {
    470   seiSubBitstreamProperty->m_activeVpsId = sps->getVPSId();
    471   /* These values can be determined by the encoder; for now we will use the input parameter */ 
    472   seiSubBitstreamProperty->m_numAdditionalSubStreams = m_pcCfg->getNumAdditionalSubStreams();
    473   seiSubBitstreamProperty->m_subBitstreamMode        = m_pcCfg->getSubBitstreamMode();
    474   seiSubBitstreamProperty->m_outputLayerSetIdxToVps  = m_pcCfg->getOutputLayerSetIdxToVps();
    475   seiSubBitstreamProperty->m_highestSublayerId       = m_pcCfg->getHighestSublayerId();
    476   seiSubBitstreamProperty->m_avgBitRate              = m_pcCfg->getAvgBitRate();
    477   seiSubBitstreamProperty->m_maxBitRate              = m_pcCfg->getMaxBitRate(); 
    478 }
    479 #else
    480655Void SEIEncoder::createAnnexFGISeiMessages( SEIMessages& seiMessage, const TComSlice* slice )
    481656{
     
    509684}
    510685#endif
    511 #endif
    512686
    513687//! \}
  • TabularUnified trunk/source/Lib/TLibEncoder/SEIEncoder.h

    r1356 r1386  
    7979  Void initSEITempMotionConstrainedTileSets (SEITempMotionConstrainedTileSets *sei, const TComPPS *pps);
    8080  Void initSEIKneeFunctionInfo(SEIKneeFunctionInfo *sei);
    81   Void initSEIChromaSamplingFilterHint(SEIChromaSamplingFilterHint *sei, Int iHorFilterIndex, Int iVerFilterIndex);
     81  Void initSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint *sei, Int iHorFilterIndex, Int iVerFilterIndex);
    8282  Void initSEITimeCode(SEITimeCode *sei);
     83  Bool initSEIColourRemappingInfo(SEIColourRemappingInfo *sei, Int currPOC); // returns true on success, false on failure.
    8384
    8485  // trailing SEIs
     
    8687  Void initTemporalLevel0IndexSEI(SEITemporalLevel0Index *sei, TComSlice *slice);
    8788#if NH_MV
    88 #if !NH_MV_SEI
    89   Void initSEISubBitstreamProperty(SEISubBitstreamProperty *seiSubBitstreamProperty, const TComSPS *sps);
    90 #else
    9189  Void createAnnexFGISeiMessages( SEIMessages& seiMessage, const TComSlice* slice );;
    92 #endif
    9390#endif
    9491private:
  • TabularUnified trunk/source/Lib/TLibEncoder/SEIwrite.cpp

    r1356 r1386  
    106106    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);
    107107    break;
    108   case SEI::CHROMA_SAMPLING_FILTER_HINT:
    109     xWriteSEIChromaSamplingFilterHint(*static_cast<const SEIChromaSamplingFilterHint*>(&sei)/*, sps*/);
     108  case SEI::CHROMA_RESAMPLING_FILTER_HINT:
     109    xWriteSEIChromaResamplingFilterHint(*static_cast<const SEIChromaResamplingFilterHint*>(&sei));
    110110    break;
    111111  case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:
     
    118118    xWriteSEIKneeFunctionInfo(*static_cast<const SEIKneeFunctionInfo*>(&sei));
    119119    break;
     120  case SEI::COLOUR_REMAPPING_INFO:
     121    xWriteSEIColourRemappingInfo(*static_cast<const SEIColourRemappingInfo*>(&sei));
     122    break;
    120123  case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:
    121124    xWriteSEIMasteringDisplayColourVolume(*static_cast<const SEIMasteringDisplayColourVolume*>(&sei));
    122125    break;
    123126#if NH_MV
    124 #if !NH_MV_SEI
    125    case SEI::SUB_BITSTREAM_PROPERTY:
    126    xWriteSEISubBitstreamProperty(*static_cast<const SEISubBitstreamProperty*>(&sei));
    127    break;
    128 #endif
    129 #endif
    130 #if NH_MV_SEI
    131 #if NH_MV_LAYERS_NOT_PRESENT_SEI
    132127   case SEI::LAYERS_NOT_PRESENT:
    133128       xWriteSEILayersNotPresent(*static_cast<const SEILayersNotPresent*>(&sei));
    134129     break;
    135 #endif
    136130   case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
    137131     xWriteSEIInterLayerConstrainedTileSets(*static_cast<const SEIInterLayerConstrainedTileSets*>(&sei));
     
    165159     xWriteSEIThreeDimensionalReferenceDisplaysInfo(*static_cast<const SEIThreeDimensionalReferenceDisplaysInfo*>(&sei));
    166160     break;
    167 #if SEI_DRI_F0169
    168161   case SEI::DEPTH_REPRESENTATION_INFO:
    169162       xWriteSEIDepthRepresentationInfo(*static_cast<const SEIDepthRepresentationInfo*>(&sei));
    170163       break;
    171 #endif
    172164   case SEI::MULTIVIEW_SCENE_INFO:
    173165     xWriteSEIMultiviewSceneInfo(*static_cast<const SEIMultiviewSceneInfo*>(&sei));
     
    189181
    190182  default:
    191     assert(!"Unhandled SEI message");
     183    assert(!"Trying to write unhandled SEI message");
    192184    break;
    193185  }
     
    277269Void SEIWriter::xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei)
    278270{
    279   const Char *traceString="\0";
     271  const TChar *traceString="\0";
    280272  switch (sei.method)
    281273  {
    282     case SEIDecodedPictureHash::MD5: traceString="picture_md5"; break;
    283     case SEIDecodedPictureHash::CRC: traceString="picture_crc"; break;
    284     case SEIDecodedPictureHash::CHECKSUM: traceString="picture_checksum"; break;
     274    case HASHTYPE_MD5: traceString="picture_md5"; break;
     275    case HASHTYPE_CRC: traceString="picture_crc"; break;
     276    case HASHTYPE_CHECKSUM: traceString="picture_checksum"; break;
    285277    default: assert(false); break;
    286278  }
     
    726718}
    727719
    728 Void SEIWriter::xWriteSEIChromaSamplingFilterHint(const SEIChromaSamplingFilterHint &sei/*, TComSPS* sps*/)
     720Void SEIWriter::xWriteSEIChromaResamplingFilterHint(const SEIChromaResamplingFilterHint &sei)
    729721{
    730722  WRITE_CODE(sei.m_verChromaFilterIdc, 8, "ver_chroma_filter_idc");
    731723  WRITE_CODE(sei.m_horChromaFilterIdc, 8, "hor_chroma_filter_idc");
    732   WRITE_FLAG(sei.m_verFilteringProcessFlag, "ver_filtering_process_flag");
     724  WRITE_FLAG(sei.m_verFilteringFieldProcessingFlag, "ver_filtering_field_processing_flag");
    733725  if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1)
    734726  {
    735     writeUserDefinedCoefficients(sei);
    736   }
    737 }
    738 
    739 // write hardcoded chroma filter coefficients in the SEI messages
    740 Void SEIWriter::writeUserDefinedCoefficients(const SEIChromaSamplingFilterHint &sei)
    741 {
    742   Int const iNumVerticalFilters = 3;
    743   Int verticalTapLength_minus1[iNumVerticalFilters] = {5,3,3};
    744   Int* userVerticalCoefficients[iNumVerticalFilters];
    745   for(Int i = 0; i < iNumVerticalFilters; i ++)
    746   {
    747     userVerticalCoefficients[i] = (Int*)malloc( (verticalTapLength_minus1[i]+1) * sizeof(Int));
    748   }
    749   userVerticalCoefficients[0][0] = -3;
    750   userVerticalCoefficients[0][1] = 13;
    751   userVerticalCoefficients[0][2] = 31;
    752   userVerticalCoefficients[0][3] = 23;
    753   userVerticalCoefficients[0][4] = 3;
    754   userVerticalCoefficients[0][5] = -3;
    755 
    756   userVerticalCoefficients[1][0] = -1;
    757   userVerticalCoefficients[1][1] = 25;
    758   userVerticalCoefficients[1][2] = 247;
    759   userVerticalCoefficients[1][3] = -15;
    760 
    761   userVerticalCoefficients[2][0] = -20;
    762   userVerticalCoefficients[2][1] = 186;
    763   userVerticalCoefficients[2][2] = 100;
    764   userVerticalCoefficients[2][3] = -10;
    765 
    766   Int const iNumHorizontalFilters = 1;
    767   Int horizontalTapLength_minus1[iNumHorizontalFilters] = {3};
    768   Int* userHorizontalCoefficients[iNumHorizontalFilters];
    769   for(Int i = 0; i < iNumHorizontalFilters; i ++)
    770   {
    771     userHorizontalCoefficients[i] = (Int*)malloc( (horizontalTapLength_minus1[i]+1) * sizeof(Int));
    772   }
    773   userHorizontalCoefficients[0][0] = 1;
    774   userHorizontalCoefficients[0][1] = 6;
    775   userHorizontalCoefficients[0][2] = 1;
    776 
    777   WRITE_UVLC(3, "target_format_idc");
    778   if(sei.m_verChromaFilterIdc == 1)
    779   {
    780     WRITE_UVLC(iNumVerticalFilters, "num_vertical_filters");
    781     if(iNumVerticalFilters > 0)
    782     {
    783       for(Int i = 0; i < iNumVerticalFilters; i ++)
    784       {
    785         WRITE_UVLC(verticalTapLength_minus1[i], "ver_tap_length_minus_1");
    786         for(Int j = 0; j < verticalTapLength_minus1[i]; j ++)
    787         {
    788           WRITE_SVLC(userVerticalCoefficients[i][j], "ver_filter_coeff");
    789         }
    790       }
    791     }
    792   }
    793   if(sei.m_horChromaFilterIdc == 1)
    794   {
    795     WRITE_UVLC(iNumHorizontalFilters, "num_horizontal_filters");
    796     if(iNumHorizontalFilters > 0)
    797     {
    798       for(Int i = 0; i < iNumHorizontalFilters; i ++)
    799       {
    800         WRITE_UVLC(horizontalTapLength_minus1[i], "hor_tap_length_minus_1");
    801         for(Int j = 0; j < horizontalTapLength_minus1[i]; j ++)
    802         {
    803           WRITE_SVLC(userHorizontalCoefficients[i][j], "hor_filter_coeff");
    804         }
    805       }
    806     }
    807   }
    808 }
    809 
    810 #if NH_MV
    811 #if !NH_MV_SEI
    812 Void SEIWriter::xWriteSEISubBitstreamProperty(const SEISubBitstreamProperty &sei)
    813 {
    814   WRITE_CODE( sei.m_activeVpsId, 4, "active_vps_id" );
    815   assert( sei.m_numAdditionalSubStreams >= 1 );
    816   WRITE_UVLC( sei.m_numAdditionalSubStreams - 1, "num_additional_sub_streams_minus1" );
    817 
    818   for( Int i = 0; i < sei.m_numAdditionalSubStreams; i++ )
    819   {
    820     WRITE_CODE( sei.m_subBitstreamMode[i],       2, "sub_bitstream_mode[i]"           );
    821     WRITE_UVLC( sei.m_outputLayerSetIdxToVps[i],    "output_layer_set_idx_to_vps[i]"  );
    822     WRITE_CODE( sei.m_highestSublayerId[i],      3, "highest_sub_layer_id[i]"         );
    823     WRITE_CODE( sei.m_avgBitRate[i],            16, "avg_bit_rate[i]"                 );
    824     WRITE_CODE( sei.m_maxBitRate[i],            16, "max_bit_rate[i]"                 );
    825   }
    826   xWriteByteAlign();
    827 }
    828 #endif
    829 #endif
     727    WRITE_UVLC(sei.m_targetFormatIdc, "target_format_idc");
     728    if(sei.m_verChromaFilterIdc == 1)
     729    {
     730      const Int numVerticalFilter = (Int)sei.m_verFilterCoeff.size();
     731      WRITE_UVLC(numVerticalFilter, "num_vertical_filters");
     732      if(numVerticalFilter > 0)
     733      {
     734        for(Int i = 0; i < numVerticalFilter; i ++)
     735        {
     736          const Int verTapLengthMinus1 = (Int) sei.m_verFilterCoeff[i].size() - 1;
     737          WRITE_UVLC(verTapLengthMinus1, "ver_tap_length_minus_1");
     738          for(Int j = 0; j < (verTapLengthMinus1 + 1); j ++)
     739          {
     740            WRITE_SVLC(sei.m_verFilterCoeff[i][j], "ver_filter_coeff");
     741          }
     742        }
     743      }
     744    }
     745    if(sei.m_horChromaFilterIdc == 1)
     746    {
     747      const Int numHorizontalFilter = (Int) sei.m_horFilterCoeff.size();
     748      WRITE_UVLC(numHorizontalFilter, "num_horizontal_filters");
     749      if(numHorizontalFilter > 0)
     750      {
     751        for(Int i = 0; i < numHorizontalFilter; i ++)
     752        {
     753          const Int horTapLengthMinus1 = (Int) sei.m_horFilterCoeff[i].size() - 1;
     754          WRITE_UVLC(horTapLengthMinus1, "hor_tap_length_minus_1");
     755          for(Int j = 0; j < (horTapLengthMinus1 + 1); j ++)
     756          {
     757            WRITE_SVLC(sei.m_horFilterCoeff[i][j], "hor_filter_coeff");
     758          }
     759        }
     760      }
     761    }
     762  }
     763}
    830764
    831765Void SEIWriter::xWriteSEIKneeFunctionInfo(const SEIKneeFunctionInfo &sei)
     
    849783}
    850784
     785Void SEIWriter::xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei)
     786{
     787  WRITE_UVLC( sei.m_colourRemapId,                             "colour_remap_id" );
     788  WRITE_FLAG( sei.m_colourRemapCancelFlag,                     "colour_remap_cancel_flag" );
     789  if( !sei.m_colourRemapCancelFlag )
     790  {
     791    WRITE_FLAG( sei.m_colourRemapPersistenceFlag,              "colour_remap_persistence_flag" );
     792    WRITE_FLAG( sei.m_colourRemapVideoSignalInfoPresentFlag,   "colour_remap_video_signal_info_present_flag" );
     793    if ( sei.m_colourRemapVideoSignalInfoPresentFlag )
     794    {
     795      WRITE_FLAG( sei.m_colourRemapFullRangeFlag,              "colour_remap_full_range_flag" );
     796      WRITE_CODE( sei.m_colourRemapPrimaries,               8, "colour_remap_primaries" );
     797      WRITE_CODE( sei.m_colourRemapTransferFunction,        8, "colour_remap_transfer_function" );
     798      WRITE_CODE( sei.m_colourRemapMatrixCoefficients,      8, "colour_remap_matrix_coefficients" );
     799    }
     800    WRITE_CODE( sei.m_colourRemapInputBitDepth,             8, "colour_remap_input_bit_depth" );
     801    WRITE_CODE( sei.m_colourRemapBitDepth,                  8, "colour_remap_bit_depth" );
     802    for( Int c=0 ; c<3 ; c++ )
     803    {
     804      WRITE_CODE( sei.m_preLutNumValMinus1[c],              8, "pre_lut_num_val_minus1[c]" );
     805      if( sei.m_preLutNumValMinus1[c]>0 )
     806      {
     807        for( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ )
     808        {
     809          WRITE_CODE( sei.m_preLut[c][i].codedValue,  (( sei.m_colourRemapInputBitDepth + 7 ) >> 3 ) << 3, "pre_lut_coded_value[c][i]" );
     810          WRITE_CODE( sei.m_preLut[c][i].targetValue, (( sei.m_colourRemapBitDepth      + 7 ) >> 3 ) << 3, "pre_lut_target_value[c][i]" );
     811        }
     812      }
     813    }
     814    WRITE_FLAG( sei.m_colourRemapMatrixPresentFlag,            "colour_remap_matrix_present_flag" );
     815    if( sei.m_colourRemapMatrixPresentFlag )
     816    {
     817      WRITE_CODE( sei.m_log2MatrixDenom,                    4, "log2_matrix_denom" );
     818      for( Int c=0 ; c<3 ; c++ )
     819      {
     820        for( Int i=0 ; i<3 ; i++ )
     821        {
     822          WRITE_SVLC( sei.m_colourRemapCoeffs[c][i],           "colour_remap_coeffs[c][i]" );
     823        }
     824      }
     825    }
     826
     827    for( Int c=0 ; c<3 ; c++ )
     828    {
     829      WRITE_CODE( sei.m_postLutNumValMinus1[c],             8, "m_postLutNumValMinus1[c]" );
     830      if( sei.m_postLutNumValMinus1[c]>0 )
     831      {
     832        for( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ )
     833        {
     834          WRITE_CODE( sei.m_postLut[c][i].codedValue, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "post_lut_coded_value[c][i]" );
     835          WRITE_CODE( sei.m_postLut[c][i].targetValue, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "post_lut_target_value[c][i]" );
     836        }
     837      }
     838    }
     839  }
     840}
    851841
    852842Void SEIWriter::xWriteSEIMasteringDisplayColourVolume(const SEIMasteringDisplayColourVolume& sei)
     
    863853  WRITE_CODE( sei.values.whitePoint[0],    16,  "white_point_x" );
    864854  WRITE_CODE( sei.values.whitePoint[1],    16,  "white_point_y" );
    865 
     855   
    866856  WRITE_CODE( sei.values.maxLuminance,     32,  "max_display_mastering_luminance" );
    867857  WRITE_CODE( sei.values.minLuminance,     32,  "min_display_mastering_luminance" );
     
    881871}
    882872
    883 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     873#if NH_MV
    884874Void SEIWriter::xWriteSEILayersNotPresent(const SEILayersNotPresent& sei)
    885875{
     
    890880  }
    891881};
    892 #endif
    893 
    894 
    895882
    896883Void SEIWriter::xWriteSEIInterLayerConstrainedTileSets( const SEIInterLayerConstrainedTileSets& sei)
     
    10681055};
    10691056
     1057
    10701058Void SEIWriter::xWriteSEITemporalMvPredictionConstraints( const SEITemporalMvPredictionConstraints& sei)
    10711059{
     
    11121100};
    11131101
    1114 #if SEI_DRI_F0169
    11151102Void SEIWriter::xWriteSEIDepthRepresentationInfo( const SEIDepthRepresentationInfo& sei)
    11161103{
     
    12391226
    12401227};
    1241 #endif
     1228
    12421229Void SEIWriter::xWriteSEIMultiviewSceneInfo( const SEIMultiviewSceneInfo& sei)
    12431230{
     
    12991286};
    13001287
    1301 
    1302 #if NH_MV_SEI
    13031288Void SEIWriter::xWriteSEIMultiviewViewPosition( const SEIMultiviewViewPosition& sei)
    13041289{
     
    13091294  }
    13101295};
    1311 #endif
    13121296
    13131297#if NH_3D
     
    14341418};
    14351419#endif
    1436 
     1420#endif
    14371421
    14381422//! \}
  • TabularUnified trunk/source/Lib/TLibEncoder/SEIwrite.h

    r1356 r1386  
    5353
    5454protected:
    55   Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComSPS *sps);
    5655  Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei);
    5756  Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei);
     
    6059  Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const TComSPS *sps);
    6160  Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, const TComSPS *sps);
    62   TComSPS *m_pSPS;
    6361  Void xWriteSEIRecoveryPoint(const SEIRecoveryPoint& sei);
    6462  Void xWriteSEIFramePacking(const SEIFramePacking& sei);
     
    7169  Void xWriteSEISOPDescription(const SEISOPDescription& sei);
    7270  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, const TComSPS *sps);
    73 #if NH_MV
    74 #if !NH_MV_SEI
    75   Void xWriteSEISubBitstreamProperty(const SEISubBitstreamProperty &sei);
    76 #endif
    77 #endif
    7871  Void xWriteSEITempMotionConstrainedTileSets(const SEITempMotionConstrainedTileSets& sei);
    7972  Void xWriteSEITimeCode(const SEITimeCode& sei);
    80   Void xWriteSEIChromaSamplingFilterHint(const SEIChromaSamplingFilterHint& sei/*, TComSPS *sps*/);
    81   Void writeUserDefinedCoefficients(const SEIChromaSamplingFilterHint& sei);
     73  Void xWriteSEIChromaResamplingFilterHint(const SEIChromaResamplingFilterHint& sei);
    8274  Void xWriteSEIKneeFunctionInfo(const SEIKneeFunctionInfo &sei);
     75  Void xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei);
    8376  Void xWriteSEIMasteringDisplayColourVolume( const SEIMasteringDisplayColourVolume& sei);
    8477
    85 #if NH_MV_SEI
    86 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     78#if NH_MV
    8779  Void xWriteSEILayersNotPresent              ( const SEILayersNotPresent& sei);
    88 #endif
    8980  Void xWriteSEIInterLayerConstrainedTileSets ( const SEIInterLayerConstrainedTileSets& sei);
    9081#if NH_MV_SEI_TBD
     
    10091#endif
    10192  Void xWriteSEIThreeDimensionalReferenceDisplaysInfo ( const SEIThreeDimensionalReferenceDisplaysInfo& sei);
    102 #if SEI_DRI_F0169
    10393  Void xWriteSEIDepthRepInfoElement           ( double f);
    10494  Void xWriteSEIDepthRepresentationInfo       ( const SEIDepthRepresentationInfo& sei);
    105 #endif
    10695  Void xWriteSEIMultiviewSceneInfo            ( const SEIMultiviewSceneInfo& sei);
    10796  Void xWriteSEIMultiviewAcquisitionInfo      ( const SEIMultiviewAcquisitionInfo& sei);
     
    11099  Void xWriteSEIAlternativeDepthInfo          ( const SEIAlternativeDepthInfo& sei);
    111100#endif
     101#endif
     102
     103  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComSPS *sps);
    112104  Void xWriteByteAlign();
    113105};
    114 #endif
    115106
    116107//! \}
  • TabularUnified trunk/source/Lib/TLibEncoder/SyntaxElementWriter.cpp

    r1356 r1386  
    4444#if ENC_DEC_TRACE
    4545
    46 Void  SyntaxElementWriter::xWriteCodeTr (UInt value, UInt  length, const Char *pSymbolName)
     46Void  SyntaxElementWriter::xWriteCodeTr (UInt value, UInt  length, const TChar *pSymbolName)
    4747{
    4848  xWriteCode (value,length);
    4949  if( g_HLSTraceEnable )
    5050  {
    51 #if H_MV_ENC_DEC_TRAC
     51#if NH_MV_ENC_DEC_TRAC
    5252    if ( !g_disableNumbering )
    5353    {
     
    7070}
    7171
    72 Void  SyntaxElementWriter::xWriteUvlcTr (UInt value, const Char *pSymbolName)
     72Void  SyntaxElementWriter::xWriteUvlcTr (UInt value, const TChar *pSymbolName)
    7373{
    7474  xWriteUvlc (value);
    7575  if( g_HLSTraceEnable )
    7676  {
    77 #if H_MV_ENC_DEC_TRAC
     77#if NH_MV_ENC_DEC_TRAC
    7878    if ( !g_disableNumbering )
    7979    {
     
    8989}
    9090
    91 Void  SyntaxElementWriter::xWriteSvlcTr (Int value, const Char *pSymbolName)
     91Void  SyntaxElementWriter::xWriteSvlcTr (Int value, const TChar *pSymbolName)
    9292{
    9393  xWriteSvlc(value);
    9494  if( g_HLSTraceEnable )
    9595  {
    96 #if H_MV_ENC_DEC_TRAC
     96#if NH_MV_ENC_DEC_TRAC
    9797    if ( !g_disableNumbering )
    9898    {
     
    108108}
    109109
    110 Void  SyntaxElementWriter::xWriteFlagTr(UInt value, const Char *pSymbolName)
     110Void  SyntaxElementWriter::xWriteFlagTr(UInt value, const TChar *pSymbolName)
    111111{
    112112  xWriteFlag(value);
    113113  if( g_HLSTraceEnable )
    114114  {
    115 #if H_MV_ENC_DEC_TRAC
     115#if NH_MV_ENC_DEC_TRAC
    116116    if ( !g_disableNumbering )
    117117    {
     
    127127}
    128128
     129#if NH_MV_ENC_DEC_TRAC
    129130Void  SyntaxElementWriter::xWriteStringTr( UChar* value, UInt length, const Char *pSymbolName)
    130131{
     
    136137  }
    137138}
    138 
     139#endif
    139140#endif
    140141
     
    176177}
    177178
     179#if NH_MV_ENC_DEC_TRAC
    178180Void  SyntaxElementWriter::xWriteString( UChar* sCode, UInt uiLength)
    179181{
     
    185187  m_pcBitIf->write( 0, 8 ); //zero-termination byte
    186188}
    187 
     189#endif
    188190Void SyntaxElementWriter::xWriteRbspTrailingBits()
    189191{
  • TabularUnified trunk/source/Lib/TLibEncoder/SyntaxElementWriter.h

    r1356 r1386  
    5656#define WRITE_SVLC( value,         name)    xWriteSvlcTr ( value,         name )
    5757#define WRITE_FLAG( value,         name)    xWriteFlagTr ( value,         name )
     58#if NH_MV
    5859#define WRITE_STRING( value, length, name)   xWriteStringTr( value, length, name )
     60#endif
    5961
    6062#else
     
    6466#define WRITE_SVLC( value,         name)     xWriteSvlc ( value )
    6567#define WRITE_FLAG( value,         name)     xWriteFlag ( value )
     68#if NH_MV
    6669#define WRITE_STRING( value, length, name)   xWriteString( value, length )
    67 
     70#endif
    6871#endif
    6972
     
    8487  Void  xWriteSvlc            ( Int  iCode   );
    8588  Void  xWriteFlag            ( UInt uiCode );
     89#if NH_MV
    8690  Void  xWriteString          ( UChar* sCode, UInt uiLength);
     91#endif
    8792#if ENC_DEC_TRACE
    88   Void  xWriteCodeTr          ( UInt value, UInt  length, const Char *pSymbolName);
    89   Void  xWriteUvlcTr          ( UInt value,               const Char *pSymbolName);
    90   Void  xWriteSvlcTr          ( Int  value,               const Char *pSymbolName);
    91   Void  xWriteFlagTr          ( UInt value,               const Char *pSymbolName);
     93  Void  xWriteCodeTr          ( UInt value, UInt  length, const TChar *pSymbolName);
     94  Void  xWriteUvlcTr          ( UInt value,               const TChar *pSymbolName);
     95  Void  xWriteSvlcTr          ( Int  value,               const TChar *pSymbolName);
     96  Void  xWriteFlagTr          ( UInt value,               const TChar *pSymbolName);
     97#if NH_MV
    9298  Void  xWriteStringTr        ( UChar* value, UInt length, const Char *pSymbolName);
     99#endif
    93100#endif
    94101  Void xWriteRbspTrailingBits();
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncAnalyze.h

    r1313 r1386  
    137137
    138138
    139   Void    printOut ( Char cDelim, const ChromaFormat chFmt, const Bool printMSEBasedSNR, const Bool printSequenceMSE, const BitDepths &bitDepths )
     139  Void    printOut ( TChar cDelim, const ChromaFormat chFmt, const Bool printMSEBasedSNR, const Bool printSequenceMSE, const BitDepths &bitDepths )
    140140  {
    141141    Double dFps     =   m_dFrmRate; //--CFG_KDY
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp

    r1321 r1386  
    246246  if (g_debugCounter >= debugCabacBinTargetLine)
    247247  {
    248     Char breakPointThis;
     248    UChar breakPointThis;
    249249    breakPointThis = 7;
    250250  }
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp

    r1321 r1386  
    9797  if (g_debugCounter >= debugEncoderSearchBinTargetLine)
    9898  {
    99     Char breakPointThis;
     99    UChar breakPointThis;
    100100    breakPointThis = 7;
    101101  }
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1321 r1386  
    4949#if ENC_DEC_TRACE
    5050
    51 #if !H_MV_ENC_DEC_TRAC
     51#if !NH_MV_ENC_DEC_TRAC
    5252Void  xTraceVPSHeader ()
    5353{
     
    6969  fprintf( g_hTrace, "=========== Slice ===========\n");
    7070}
    71 #endif
    72 #endif
     71
     72Void  xTraceAccessUnitDelimiter ()
     73{
     74  fprintf( g_hTrace, "=========== Access Unit Delimiter ===========\n");
     75}
     76
     77#endif
     78#endif
     79
     80Void AUDWriter::codeAUD(TComBitIf& bs, const Int pictureType)
     81{
     82#if ENC_DEC_TRACE
     83  xTraceAccessUnitDelimiter();
     84#endif
     85
     86  assert (pictureType < 3);
     87  setBitstream(&bs);
     88  WRITE_CODE(pictureType, 3, "pic_type");
     89  xWriteRbspTrailingBits();
     90}
     91
    7392// ====================================================================================================================
    7493// Constructor / destructor / create / destroy
     
    154173{
    155174#if ENC_DEC_TRACE
    156 #if H_MV_ENC_DEC_TRAC
     175#if NH_MV_ENC_DEC_TRAC
    157176  tracePSHeader( "PPS", pcPPS->getLayerId() );
    158177#else
     
    167186  WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" );
    168187  WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0,   "cabac_init_present_flag" );
    169 #if PPS_FIX_DEPTH
     188#if H_3D_PPS_FIX_DEPTH
    170189  if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )
    171190  {
     
    178197  WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive()-1,     "num_ref_idx_l0_default_active_minus1");
    179198  WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive()-1,     "num_ref_idx_l1_default_active_minus1");
    180 #if PPS_FIX_DEPTH
     199#if H_3D_PPS_FIX_DEPTH
    181200  }
    182201#endif
     
    238257    codeScalingList( pcPPS->getScalingList() );
    239258  }
    240 #if PPS_FIX_DEPTH
     259#if H_3D_PPS_FIX_DEPTH
    241260  if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )
    242261  {
     
    266285  {
    267286#if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS
    268     static const char *syntaxStrings[]={ "pps_range_extension_flag",
     287    static const TChar *syntaxStrings[]={ "pps_range_extension_flag",
    269288                                         "pps_multilayer_extension_flag",
    270289                                         "pps_extension_6bits[0]",
     
    330349    if ( pcPPS->getPpsRangeExtensionsFlag() )
    331350    {
    332               const TComPPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension();
    333               if (pcPPS->getUseTransformSkip())
    334               {
    335                 WRITE_UVLC( ppsRangeExtension.getLog2MaxTransformSkipBlockSize()-2,            "log2_max_transform_skip_block_size_minus2");
    336               }
    337 
    338               WRITE_FLAG((ppsRangeExtension.getCrossComponentPredictionEnabledFlag() ? 1 : 0), "cross_component_prediction_enabled_flag" );
    339 
    340               WRITE_FLAG(UInt(ppsRangeExtension.getChromaQpOffsetListEnabledFlag()),           "chroma_qp_offset_list_enabled_flag" );
    341               if (ppsRangeExtension.getChromaQpOffsetListEnabledFlag())
    342               {
    343                 WRITE_UVLC(ppsRangeExtension.getDiffCuChromaQpOffsetDepth(),                   "diff_cu_chroma_qp_offset_depth");
    344                 WRITE_UVLC(ppsRangeExtension.getChromaQpOffsetListLen() - 1,                   "chroma_qp_offset_list_len_minus1");
    345                 /* skip zero index */
    346                 for (Int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx < ppsRangeExtension.getChromaQpOffsetListLen(); cuChromaQpOffsetIdx++)
    347                 {
    348                   WRITE_SVLC(ppsRangeExtension.getChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1).u.comp.CbOffset,     "cb_qp_offset_list[i]");
    349                   WRITE_SVLC(ppsRangeExtension.getChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1).u.comp.CrOffset,     "cr_qp_offset_list[i]");
    350                 }
    351               }
    352 
    353               WRITE_UVLC( ppsRangeExtension.getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA),           "log2_sao_offset_scale_luma"   );
    354               WRITE_UVLC( ppsRangeExtension.getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA),         "log2_sao_offset_scale_chroma" );
     351      const TComPPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension();
     352      if (pcPPS->getUseTransformSkip())
     353      {
     354        WRITE_UVLC( ppsRangeExtension.getLog2MaxTransformSkipBlockSize()-2,            "log2_max_transform_skip_block_size_minus2");
     355      }
     356
     357      WRITE_FLAG((ppsRangeExtension.getCrossComponentPredictionEnabledFlag() ? 1 : 0), "cross_component_prediction_enabled_flag" );
     358
     359      WRITE_FLAG(UInt(ppsRangeExtension.getChromaQpOffsetListEnabledFlag()),           "chroma_qp_offset_list_enabled_flag" );
     360      if (ppsRangeExtension.getChromaQpOffsetListEnabledFlag())
     361      {
     362        WRITE_UVLC(ppsRangeExtension.getDiffCuChromaQpOffsetDepth(),                   "diff_cu_chroma_qp_offset_depth");
     363        WRITE_UVLC(ppsRangeExtension.getChromaQpOffsetListLen() - 1,                   "chroma_qp_offset_list_len_minus1");
     364        /* skip zero index */
     365        for (Int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx < ppsRangeExtension.getChromaQpOffsetListLen(); cuChromaQpOffsetIdx++)
     366        {
     367          WRITE_SVLC(ppsRangeExtension.getChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1).u.comp.CbOffset,     "cb_qp_offset_list[i]");
     368          WRITE_SVLC(ppsRangeExtension.getChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1).u.comp.CrOffset,     "cr_qp_offset_list[i]");
     369        }
     370      }
     371
     372      WRITE_UVLC( ppsRangeExtension.getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA),           "log2_sao_offset_scale_luma"   );
     373      WRITE_UVLC( ppsRangeExtension.getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA),         "log2_sao_offset_scale_chroma" );
    355374    }
    356375
     
    662681
    663682#if ENC_DEC_TRACE
    664 #if H_MV_ENC_DEC_TRAC
     683#if NH_MV_ENC_DEC_TRAC
    665684  tracePSHeader( "SPS", pcSPS->getLayerId() );
    666685#else
     
    748767    WRITE_UVLC( pcSPS->getSpsMaxLatencyIncreasePlus1(i),   "sps_max_latency_increase_plus1[i]" );
    749768#else
    750     WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "sps_max_latency_increase_plus1[i]" );
     769    WRITE_UVLC( pcSPS->getMaxLatencyIncreasePlus1(i),      "sps_max_latency_increase_plus1[i]" );
    751770#endif
    752771    if (!subLayerOrderingInfoPresentFlag)
     
    858877  {
    859878#if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS
    860     static const char *syntaxStrings[]={ "sps_range_extension_flag",
     879    static const TChar *syntaxStrings[]={ "sps_range_extension_flag",
    861880      "sps_multilayer_extension_flag",
    862881      "sps_extension_6bits[0]",
     
    971990  for( Int d = 0; d  <=  1; d++ )
    972991  {
    973     WRITE_FLAG( sps3dExt->getIvMvPredFlag( d ) ? 1 : 0 , "iv_mv_pred_flag" );
    974     WRITE_FLAG( sps3dExt->getIvMvScalingFlag( d ) ? 1 : 0 , "iv_mv_scaling_flag" );
     992    WRITE_FLAG( sps3dExt->getIvDiMcEnabledFlag( d ) ? 1 : 0 , "iv_di_mc_enabled_flag" );
     993    WRITE_FLAG( sps3dExt->getIvMvScalEnabledFlag( d ) ? 1 : 0 , "iv_mv_scal_enabled_flag" );
    975994    if( d  ==  0 )
    976995    {
    977       WRITE_UVLC( sps3dExt->getLog2SubPbSizeMinus3( d ), "log2_sub_pb_size_minus3" );
    978       WRITE_FLAG( sps3dExt->getIvResPredFlag( d ) ? 1 : 0 , "iv_res_pred_flag" );
    979       WRITE_FLAG( sps3dExt->getDepthRefinementFlag( d ) ? 1 : 0 , "depth_refinement_flag" );
    980       WRITE_FLAG( sps3dExt->getViewSynthesisPredFlag( d ) ? 1 : 0 , "view_synthesis_pred_flag" );
    981       WRITE_FLAG( sps3dExt->getDepthBasedBlkPartFlag( d ) ? 1 : 0 , "depth_based_blk_part_flag" );
     996      WRITE_UVLC( sps3dExt->getLog2IvmcSubPbSizeMinus3( d ), "log2_sub_pb_size_minus3" );
     997      WRITE_FLAG( sps3dExt->getIvResPredEnabledFlag( d ) ? 1 : 0 , "iv_res_pred_enabled_flag" );
     998      WRITE_FLAG( sps3dExt->getDepthRefEnabledFlag( d ) ? 1 : 0 , "depth_ref_enabled_flag" );
     999      WRITE_FLAG( sps3dExt->getVspMcEnabledFlag( d ) ? 1 : 0 , "vsp_mc_enabled_flag" );
     1000      WRITE_FLAG( sps3dExt->getDbbpEnabledFlag( d ) ? 1 : 0 , "dbbp_enabled_flag" );
    9821001    }
    9831002    else
    9841003    {
    985       WRITE_FLAG( sps3dExt->getMpiFlag( d ) ? 1 : 0 , "mpi_flag" );
    986       WRITE_UVLC( sps3dExt->getLog2MpiSubPbSizeMinus3( d ), "log2_mpi_sub_pb_size_minus3" );
    987       WRITE_FLAG( sps3dExt->getIntraContourFlag( d ) ? 1 : 0 , "intra_contour_flag" );
    988       WRITE_FLAG( sps3dExt->getIntraSdcWedgeFlag( d ) ? 1 : 0 , "intra_sdc_wedge_flag" );
    989       WRITE_FLAG( sps3dExt->getQtPredFlag( d ) ? 1 : 0 , "qt_pred_flag" );
    990       WRITE_FLAG( sps3dExt->getInterSdcFlag( d ) ? 1 : 0 , "inter_sdc_flag" );
    991       WRITE_FLAG( sps3dExt->getDepthIntraSkipFlag( d ) ? 1 : 0 , "intra_skip_flag" );
     1004      WRITE_FLAG( sps3dExt->getTexMcEnabledFlag( d ) ? 1 : 0 , "tex_mc_enabled_flag" );
     1005      WRITE_UVLC( sps3dExt->getLog2TexmcSubPbSizeMinus3( d ), "log2_texmc_sub_pb_size_minus3" );
     1006      WRITE_FLAG( sps3dExt->getIntraContourEnabledFlag( d ) ? 1 : 0 , "intra_contour_enabled_flag" );
     1007      WRITE_FLAG( sps3dExt->getIntraDcOnlyWedgeEnabledFlag( d ) ? 1 : 0 , "intra_dc_only_wedge_enabled_flag" );
     1008      WRITE_FLAG( sps3dExt->getCqtCuPartPredEnabledFlag( d ) ? 1 : 0 , "cqt_cu_part_pred_enabled_flag" );
     1009      WRITE_FLAG( sps3dExt->getInterDcOnlyEnabledFlag( d ) ? 1 : 0 , "inter_dc_only_enabled_flag" );
     1010      WRITE_FLAG( sps3dExt->getSkipIntraEnabledFlag( d ) ? 1 : 0 , "skip_intra_enabled_flag" );
    9921011    }
    9931012  }
     
    9991018{
    10001019#if ENC_DEC_TRACE
    1001 #if H_MV_ENC_DEC_TRAC
     1020#if NH_MV_ENC_DEC_TRAC
    10021021  tracePSHeader( "VPS", getEncTop()->getLayerId() );
    10031022#else
     
    17641783    WRITE_FLAG( pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag" );
    17651784  }
    1766 #if PPS_FIX_DEPTH
     1785#if H_3D_PPS_FIX_DEPTH
    17671786  if( pcSlice->getIsDepth() )
    17681787  {
     
    20352054    {
    20362055      Bool overrideFlag = (pcSlice->getNumRefIdx( REF_PIC_LIST_0 )!=pcSlice->getPPS()->getNumRefIdxL0DefaultActive()||(pcSlice->isInterB()&&pcSlice->getNumRefIdx( REF_PIC_LIST_1 )!=pcSlice->getPPS()->getNumRefIdxL1DefaultActive()));
    2037 #if PPS_FIX_DEPTH
     2056#if H_3D_PPS_FIX_DEPTH
    20382057      overrideFlag |= (pcSlice->getIsDepth() && !pcSlice->getViewIndex());
    20392058#endif
     
    20572076      pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0);
    20582077    }
    2059 #if PPS_FIX_DEPTH
     2078#if H_3D_PPS_FIX_DEPTH
    20602079    if( (pcSlice->getPPS()->getListsModificationPresentFlag() || (pcSlice->getIsDepth() && !pcSlice->getViewIndex())) && pcSlice->getNumRpsCurrTempList() > 1)
    20612080#else
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncCavlc.h

    r1321 r1386  
    5858// ====================================================================================================================
    5959
     60class AUDWriter : public SyntaxElementWriter
     61{
     62public:
     63  AUDWriter() {};
     64  virtual ~AUDWriter() {};
     65
     66  Void  codeAUD(TComBitIf& bs, const Int pictureType);
     67};
     68
    6069/// CAVLC encoder class
    6170class TEncCavlc : public SyntaxElementWriter, public TEncEntropyIf
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncCfg.h

    r1356 r1386  
    4646#include "TLibCommon/TComSlice.h"
    4747#include <assert.h>
    48 #if NH_3D
     48#if NH_3D_VSO
    4949#include "TAppCommon/TAppComCamPara.h"
    5050#include "TLibRenderer/TRenModSetupStrParser.h"
     
    6565  Bool m_refPic;
    6666  Int m_numRefPicsActive;
    67   Char m_sliceType;
     67  SChar m_sliceType;
    6868  Int m_numRefPics;
    6969  Int m_referencePics[MAX_NUM_REF_PICS];
     
    137137  Int       m_framesToBeEncoded;
    138138  Double    m_adLambdaModifier[ MAX_TLAYER ];
     139  std::vector<Double> m_adIntraLambdaModifier;
     140  Double    m_dIntraQpFactor;                                 ///< Intra Q Factor. If negative, use a default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? (GopSize-1)/2 : GopSize-1) ))
    139141
    140142  Bool      m_printMSEBasedSequencePSNR;
     
    174176  Int       m_aiPad[2];
    175177
     178  Bool      m_AccessUnitDelimiter;               ///< add Access Unit Delimiter NAL units
    176179
    177180  Int       m_iMaxRefPicNum;                     ///< this is used to mimic the sliding mechanism used by the decoder
     
    206209  //====== Motion search ========
    207210  Bool      m_bDisableIntraPUsInInterSlices;
    208   Int       m_iFastSearch;                      //  0:Full search  1:Diamond  2:PMVFAST
     211  MESearchMethod m_motionEstimationSearchMethod;
    209212  Int       m_iSearchRange;                     //  0:Full frame
    210213  Int       m_bipredSearchRange;
    211214  Bool      m_bClipForBiPredMeEnabled;
    212215  Bool      m_bFastMEAssumingSmootherMVEnabled;
     216  Int       m_minSearchWindow;
     217  Bool      m_bRestrictMESampling;
    213218
    214219#if NH_MV
     
    243248#endif
    244249  UInt      m_rdPenalty;
    245   Bool      m_bUseFastEnc;
     250  FastInterSearchMode m_fastInterSearchMode;
    246251  Bool      m_bUseEarlyCU;
    247252  Bool      m_useFastDecisionForMerge;
     
    289294  std::vector<Int> m_tileRowHeight;
    290295
    291   Int       m_iWaveFrontSynchro;
    292 
    293   Int       m_decodedPictureHashSEIEnabled;              ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
    294   Int       m_bufferingPeriodSEIEnabled;
    295   Int       m_pictureTimingSEIEnabled;
    296   Int       m_recoveryPointSEIEnabled;
     296  Bool      m_entropyCodingSyncEnabledFlag;
     297
     298  HashType  m_decodedPictureHashSEIType;
     299  Bool      m_bufferingPeriodSEIEnabled;
     300  Bool      m_pictureTimingSEIEnabled;
     301  Bool      m_recoveryPointSEIEnabled;
    297302  Bool      m_toneMappingInfoSEIEnabled;
    298303  Int       m_toneMapId;
     
    322327  Int*      m_codedPivotValue;
    323328  Int*      m_targetPivotValue;
    324   Int       m_framePackingSEIEnabled;
     329  Bool      m_framePackingSEIEnabled;
    325330  Int       m_framePackingSEIType;
    326331  Int       m_framePackingSEIId;
    327332  Int       m_framePackingSEIQuincunx;
    328333  Int       m_framePackingSEIInterpretation;
    329   Int       m_segmentedRectFramePackingSEIEnabled;
     334  Bool      m_segmentedRectFramePackingSEIEnabled;
    330335  Bool      m_segmentedRectFramePackingSEICancel;
    331336  Int       m_segmentedRectFramePackingSEIType;
    332337  Bool      m_segmentedRectFramePackingSEIPersistence;
    333338  Int       m_displayOrientationSEIAngle;
    334   Int       m_temporalLevel0IndexSEIEnabled;
    335   Int       m_gradualDecodingRefreshInfoEnabled;
     339  Bool      m_temporalLevel0IndexSEIEnabled;
     340  Bool      m_gradualDecodingRefreshInfoEnabled;
    336341  Int       m_noDisplaySEITLayer;
    337   Int       m_decodingUnitInfoSEIEnabled;
    338   Int       m_SOPDescriptionSEIEnabled;
    339   Int       m_scalableNestingSEIEnabled;
     342  Bool      m_decodingUnitInfoSEIEnabled;
     343  Bool      m_SOPDescriptionSEIEnabled;
     344  Bool      m_scalableNestingSEIEnabled;
    340345  Bool      m_tmctsSEIEnabled;
    341346  Bool      m_timeCodeSEIEnabled;
     
    353358  Int*      m_kneeSEIInputKneePoint;
    354359  Int*      m_kneeSEIOutputKneePoint;
     360  std::string m_colourRemapSEIFileRoot;          ///< SEI Colour Remapping File (initialized from external file)
    355361  TComSEIMasteringDisplay m_masteringDisplay;
    356 #if NH_MV_SEI
     362#if NH_MV
    357363  SEIMessages* m_seiMessages;
    358364#endif
     
    360366  Bool      m_useWeightedPred;       //< Use of Weighting Prediction (P_SLICE)
    361367  Bool      m_useWeightedBiPred;    //< Use of Bi-directional Weighting Prediction (B_SLICE)
     368  WeightedPredictionMethod m_weightedPredictionMethod;
    362369  UInt      m_log2ParallelMergeLevelMinus2;       ///< Parallel merge estimation region
    363370  UInt      m_maxNumMergeCand;                    ///< Maximum number of merge candidates
    364371  ScalingListMode m_useScalingListId;            ///< Using quantization matrix i.e. 0=off, 1=default, 2=file.
    365   Char*     m_scalingListFile;          ///< quantization matrix file name
     372  std::string m_scalingListFileName;              ///< quantization matrix file name
    366373  Int       m_TMVPModeId;
    367374  Bool      m_signHideFlag;
     
    373380  Int       m_RCInitialQP;
    374381  Bool      m_RCForceIntraQP;
     382#if U0132_TARGET_BITS_SATURATION
     383  Bool      m_RCCpbSaturationEnabled;                   
     384  UInt      m_RCCpbSize;
     385  Double    m_RCInitialCpbFullness;
     386#endif
    375387
    376388#if KWU_RC_MADPRED_E0227
     
    398410  Bool      m_vuiParametersPresentFlag;                       ///< enable generation of VUI parameters
    399411  Bool      m_aspectRatioInfoPresentFlag;                     ///< Signals whether aspect_ratio_idc is present
    400   Bool      m_chromaSamplingFilterHintEnabled;                ///< Signals whether chroma sampling filter hint data is present
    401   Int       m_chromaSamplingHorFilterIdc;                     ///< Specifies the Index of filter to use
    402   Int       m_chromaSamplingVerFilterIdc;                     ///< Specifies the Index of filter to use
     412  Bool      m_chromaResamplingFilterHintEnabled;              ///< Signals whether chroma sampling filter hint data is present
     413  Int       m_chromaResamplingHorFilterIdc;                   ///< Specifies the Index of filter to use
     414  Int       m_chromaResamplingVerFilterIdc;                   ///< Specifies the Index of filter to use
    403415  Int       m_aspectRatioIdc;                                 ///< aspect_ratio_idc
    404416  Int       m_sarWidth;                                       ///< horizontal size of the sample aspect ratio
     
    438450  UInt        m_summaryVerboseness;                           ///< Specifies the level of the verboseness of the text output.
    439451
    440 #if NH_MV
    441 #if !NH_MV_SEI
    442   Bool              m_subBistreamPropSEIEnabled;
    443   Int               m_numAdditionalSubStreams;
    444   std::vector<Int>  m_subBitstreamMode;
    445   std::vector<Int>  m_outputLayerSetIdxToVps;
    446   std::vector<Int>  m_highestSublayerId;
    447   std::vector<Int>  m_avgBitRate;
    448   std::vector<Int>  m_maxBitRate;
    449 #endif
    450 #endif
    451452
    452453#if NH_MV
     
    457458#endif
    458459
    459 #if NH_3D
     460#if NH_3D_VSO
    460461  Bool      m_isDepth;
     462  Bool      m_isAuxDepth;
    461463
    462464  //====== Camera Parameters ======
    463465  TAppComCamPara* m_cameraParameters;
    464466 
    465 #if NH_3D_VSO
    466467  //====== View Synthesis Optimization ======
    467468  TRenModSetupStrParser* m_renderModelParameters;
     
    480481  Double    m_dDispCoeff;
    481482#endif
     483#if NH_3D
    482484
    483485  Bool      m_bUseIC;
     
    486488  Bool      m_useSDC;
    487489  Bool      m_useDLT;
     490#endif
     491#if NH_3D_QTL
    488492  Bool      m_bUseQTL;
     493#endif
     494#if NH_3D
    489495  Int       m_profileIdc;
    490 
    491496#endif
    492497public:
     
    499504  , m_viewId(-1)
    500505  , m_viewIndex(-1)
     506#if NH_3D_VSO
     507  , m_isDepth(false)
     508  , m_isAuxDepth(false)
     509  , m_bUseVSO(false)
     510#endif
    501511#if NH_3D
    502   , m_isDepth(false)
    503 #if NH_3D_VSO
    504   , m_bUseVSO(false)
    505 #endif
    506512  , m_profileIdc( -1 )
    507513#endif
     
    549555  Void      setViewIndex                     ( Int viewIndex  )   { m_viewIndex  = viewIndex;  }
    550556  Int       getViewIndex                     ()                   { return m_viewIndex;    }
    551 #if NH_3D
     557#if NH_3D_VSO
    552558  Void      setIsDepth                       ( Bool isDepth )   { m_isDepth = isDepth; }
    553559  Bool      getIsDepth                       ()                 { return m_isDepth; }
     560  Void      setIsAuxDepth                    ( Bool isAuxDepth ) { m_isAuxDepth = isAuxDepth; }
     561  Bool      getIsAuxDepth                       ()               { return m_isAuxDepth; }
     562
     563
    554564#endif
    555565#endif
     
    606616  //====== Motion search ========
    607617  Void      setDisableIntraPUsInInterSlices ( Bool  b )      { m_bDisableIntraPUsInInterSlices = b; }
    608   Void      setFastSearch                   ( Int   i )      { m_iFastSearch = i; }
     618  Void      setMotionEstimationSearchMethod ( MESearchMethod e ) { m_motionEstimationSearchMethod = e; }
    609619  Void      setSearchRange                  ( Int   i )      { m_iSearchRange = i; }
    610620  Void      setBipredSearchRange            ( Int   i )      { m_bipredSearchRange = i; }
    611621  Void      setClipForBiPredMeEnabled       ( Bool  b )      { m_bClipForBiPredMeEnabled = b; }
    612622  Void      setFastMEAssumingSmootherMVEnabled ( Bool b )    { m_bFastMEAssumingSmootherMVEnabled = b; }
     623  Void      setMinSearchWindow              ( Int   i )      { m_minSearchWindow = i; }
     624  Void      setRestrictMESampling           ( Bool  b )      { m_bRestrictMESampling = b; }
     625
    613626#if NH_MV
    614627  Void      setUseDisparitySearchRangeRestriction ( Bool   b )      { m_bUseDisparitySearchRangeRestriction = b; }
     
    649662  Int       getSourceHeight                 ()      { return  m_iSourceHeight; }
    650663  Int       getFramesToBeEncoded            ()      { return  m_framesToBeEncoded; }
     664 
     665  //====== Lambda Modifiers ========
    651666  Void setLambdaModifier                    ( UInt uiIndex, Double dValue ) { m_adLambdaModifier[ uiIndex ] = dValue; }
    652667  Double getLambdaModifier                  ( UInt uiIndex ) const { return m_adLambdaModifier[ uiIndex ]; }
     668  Void      setIntraLambdaModifier          ( const std::vector<Double> &dValue )               { m_adIntraLambdaModifier = dValue;       }
     669  const std::vector<Double>& getIntraLambdaModifier()                        const { return m_adIntraLambdaModifier;         }
     670  Void      setIntraQpFactor                ( Double dValue )               { m_dIntraQpFactor = dValue;              }
     671  Double    getIntraQpFactor                ()                        const { return m_dIntraQpFactor;                }
    653672
    654673  //==== Coding Structure ========
     
    662681  Int       getPad                          ( Int i )      { assert (i < 2 );                      return  m_aiPad[i]; }
    663682
     683  Bool      getAccessUnitDelimiter() const  { return m_AccessUnitDelimiter; }
     684  Void      setAccessUnitDelimiter(Bool val){ m_AccessUnitDelimiter = val; }
     685
    664686  //======== Transform =============
    665687  UInt      getQuadtreeTULog2MaxSize        ()      const { return m_uiQuadtreeTULog2MaxSize; }
     
    677699  //==== Motion search ========
    678700  Bool      getDisableIntraPUsInInterSlices () const { return m_bDisableIntraPUsInInterSlices; }
    679   Int       getFastSearch                   () const { return m_iFastSearch; }
     701  MESearchMethod getMotionEstimationSearchMethod ( ) const { return m_motionEstimationSearchMethod; }
    680702  Int       getSearchRange                  () const { return m_iSearchRange; }
    681703  Bool      getClipForBiPredMeEnabled       () const { return m_bClipForBiPredMeEnabled; }
    682704  Bool      getFastMEAssumingSmootherMVEnabled ( ) const { return m_bFastMEAssumingSmootherMVEnabled; }
     705  Int       getMinSearchWindow                 () const { return m_minSearchWindow; }
     706  Bool      getRestrictMESampling              () const { return m_bRestrictMESampling; }
     707
    683708#if NH_MV
    684709  Bool      getUseDisparitySearchRangeRestriction ()      { return  m_bUseDisparitySearchRangeRestriction; }
     
    701726  Void      setUseSelectiveRDOQ             ( Bool b )      { m_useSelectiveRDOQ = b; }
    702727#endif
    703   Void      setRDpenalty                 ( UInt  b )     { m_rdPenalty  = b; }
    704   Void      setUseFastEnc                   ( Bool  b )     { m_bUseFastEnc = b; }
     728  Void      setRDpenalty                    ( UInt  u )     { m_rdPenalty  = u; }
     729  Void      setFastInterSearchMode          ( FastInterSearchMode m ) { m_fastInterSearchMode = m; }
    705730  Void      setUseEarlyCU                   ( Bool  b )     { m_bUseEarlyCU = b; }
    706731  Void      setUseFastDecisionForMerge      ( Bool  b )     { m_useFastDecisionForMerge = b; }
     
    729754#endif
    730755  Int       getRDpenalty                    ()      { return m_rdPenalty;  }
    731   Bool      getUseFastEnc                   ()      { return m_bUseFastEnc; }
     756  FastInterSearchMode getFastInterSearchMode() const{ return m_fastInterSearchMode; }
    732757  Bool      getUseEarlyCU                   ()      { return m_bUseEarlyCU; }
    733758  Bool      getUseFastDecisionForMerge      ()      { return m_useFastDecisionForMerge; }
     
    812837  UInt  getRowHeight                   ( UInt rowIdx )               { return m_tileRowHeight[rowIdx]; }
    813838  Void  xCheckGSParameters();
    814   Void  setWaveFrontSynchro(Int iWaveFrontSynchro)                   { m_iWaveFrontSynchro = iWaveFrontSynchro; }
    815   Int   getWaveFrontsynchro()                                        { return m_iWaveFrontSynchro; }
    816   Void  setDecodedPictureHashSEIEnabled(Int b)                       { m_decodedPictureHashSEIEnabled = b; }
    817   Int   getDecodedPictureHashSEIEnabled()                            { return m_decodedPictureHashSEIEnabled; }
    818   Void  setBufferingPeriodSEIEnabled(Int b)                          { m_bufferingPeriodSEIEnabled = b; }
    819   Int   getBufferingPeriodSEIEnabled()                               { return m_bufferingPeriodSEIEnabled; }
    820   Void  setPictureTimingSEIEnabled(Int b)                            { m_pictureTimingSEIEnabled = b; }
    821   Int   getPictureTimingSEIEnabled()                                 { return m_pictureTimingSEIEnabled; }
    822   Void  setRecoveryPointSEIEnabled(Int b)                            { m_recoveryPointSEIEnabled = b; }
    823   Int   getRecoveryPointSEIEnabled()                                 { return m_recoveryPointSEIEnabled; }
     839  Void  setEntropyCodingSyncEnabledFlag(Bool b)                      { m_entropyCodingSyncEnabledFlag = b; }
     840  Bool  getEntropyCodingSyncEnabledFlag() const                      { return m_entropyCodingSyncEnabledFlag; }
     841  Void  setDecodedPictureHashSEIType(HashType m)                     { m_decodedPictureHashSEIType = m; }
     842  HashType getDecodedPictureHashSEIType() const                      { return m_decodedPictureHashSEIType; }
     843  Void  setBufferingPeriodSEIEnabled(Bool b)                         { m_bufferingPeriodSEIEnabled = b; }
     844  Bool  getBufferingPeriodSEIEnabled() const                         { return m_bufferingPeriodSEIEnabled; }
     845  Void  setPictureTimingSEIEnabled(Bool b)                           { m_pictureTimingSEIEnabled = b; }
     846  Bool  getPictureTimingSEIEnabled() const                           { return m_pictureTimingSEIEnabled; }
     847  Void  setRecoveryPointSEIEnabled(Bool b)                           { m_recoveryPointSEIEnabled = b; }
     848  Bool  getRecoveryPointSEIEnabled() const                           { return m_recoveryPointSEIEnabled; }
    824849  Void  setToneMappingInfoSEIEnabled(Bool b)                         { m_toneMappingInfoSEIEnabled = b;  }
    825850  Bool  getToneMappingInfoSEIEnabled()                               { return m_toneMappingInfoSEIEnabled;  }
     
    876901  Void  setTMISEIExtendedWhiteLevelLumaCodeValue(Int b)              { m_extendedWhiteLevelLumaCodeValue =b;  }
    877902  Int   getTMISEIExtendedWhiteLevelLumaCodeValue()                   { return m_extendedWhiteLevelLumaCodeValue;  }
    878   Void  setFramePackingArrangementSEIEnabled(Int b)                  { m_framePackingSEIEnabled = b; }
    879   Int   getFramePackingArrangementSEIEnabled()                       { return m_framePackingSEIEnabled; }
     903  Void  setFramePackingArrangementSEIEnabled(Bool b)                 { m_framePackingSEIEnabled = b; }
     904  Bool  getFramePackingArrangementSEIEnabled() const                 { return m_framePackingSEIEnabled; }
    880905  Void  setFramePackingArrangementSEIType(Int b)                     { m_framePackingSEIType = b; }
    881906  Int   getFramePackingArrangementSEIType()                          { return m_framePackingSEIType; }
     
    886911  Void  setFramePackingArrangementSEIInterpretation(Int b)           { m_framePackingSEIInterpretation = b; }
    887912  Int   getFramePackingArrangementSEIInterpretation()                { return m_framePackingSEIInterpretation; }
    888   Void  setSegmentedRectFramePackingArrangementSEIEnabled(Int b)     { m_segmentedRectFramePackingSEIEnabled = b; }
    889   Int   getSegmentedRectFramePackingArrangementSEIEnabled()          { return m_segmentedRectFramePackingSEIEnabled; }
     913  Void  setSegmentedRectFramePackingArrangementSEIEnabled(Bool b)    { m_segmentedRectFramePackingSEIEnabled = b; }
     914  Bool  getSegmentedRectFramePackingArrangementSEIEnabled() const    { return m_segmentedRectFramePackingSEIEnabled; }
    890915  Void  setSegmentedRectFramePackingArrangementSEICancel(Int b)      { m_segmentedRectFramePackingSEICancel = b; }
    891916  Int   getSegmentedRectFramePackingArrangementSEICancel()           { return m_segmentedRectFramePackingSEICancel; }
     
    896921  Void  setDisplayOrientationSEIAngle(Int b)                         { m_displayOrientationSEIAngle = b; }
    897922  Int   getDisplayOrientationSEIAngle()                              { return m_displayOrientationSEIAngle; }
    898   Void  setTemporalLevel0IndexSEIEnabled(Int b)                      { m_temporalLevel0IndexSEIEnabled = b; }
    899   Int   getTemporalLevel0IndexSEIEnabled()                           { return m_temporalLevel0IndexSEIEnabled; }
    900   Void  setGradualDecodingRefreshInfoEnabled(Int b)                  { m_gradualDecodingRefreshInfoEnabled = b;    }
    901   Int   getGradualDecodingRefreshInfoEnabled()                       { return m_gradualDecodingRefreshInfoEnabled; }
     923  Void  setTemporalLevel0IndexSEIEnabled(Bool b)                     { m_temporalLevel0IndexSEIEnabled = b; }
     924  Bool  getTemporalLevel0IndexSEIEnabled() const                     { return m_temporalLevel0IndexSEIEnabled; }
     925  Void  setGradualDecodingRefreshInfoEnabled(Bool b)                 { m_gradualDecodingRefreshInfoEnabled = b;    }
     926  Bool  getGradualDecodingRefreshInfoEnabled() const                 { return m_gradualDecodingRefreshInfoEnabled; }
    902927  Void  setNoDisplaySEITLayer(Int b)                                 { m_noDisplaySEITLayer = b;    }
    903928  Int   getNoDisplaySEITLayer()                                      { return m_noDisplaySEITLayer; }
    904   Void  setDecodingUnitInfoSEIEnabled(Int b)                         { m_decodingUnitInfoSEIEnabled = b;    }
    905   Int   getDecodingUnitInfoSEIEnabled()                              { return m_decodingUnitInfoSEIEnabled; }
    906   Void  setSOPDescriptionSEIEnabled(Int b)                           { m_SOPDescriptionSEIEnabled = b; }
    907   Int   getSOPDescriptionSEIEnabled()                                { return m_SOPDescriptionSEIEnabled; }
    908   Void  setScalableNestingSEIEnabled(Int b)                          { m_scalableNestingSEIEnabled = b; }
    909   Int   getScalableNestingSEIEnabled()                               { return m_scalableNestingSEIEnabled; }
     929  Void  setDecodingUnitInfoSEIEnabled(Bool b)                        { m_decodingUnitInfoSEIEnabled = b;    }
     930  Bool  getDecodingUnitInfoSEIEnabled() const                        { return m_decodingUnitInfoSEIEnabled; }
     931  Void  setSOPDescriptionSEIEnabled(Bool b)                          { m_SOPDescriptionSEIEnabled = b; }
     932  Bool  getSOPDescriptionSEIEnabled() const                          { return m_SOPDescriptionSEIEnabled; }
     933  Void  setScalableNestingSEIEnabled(Bool b)                         { m_scalableNestingSEIEnabled = b; }
     934  Bool  getScalableNestingSEIEnabled() const                         { return m_scalableNestingSEIEnabled; }
    910935  Void  setTMCTSSEIEnabled(Bool b)                                   { m_tmctsSEIEnabled = b; }
    911936  Bool  getTMCTSSEIEnabled()                                         { return m_tmctsSEIEnabled; }
     
    939964  Void  setKneeSEIOutputKneePoint(Int *p)                            { m_kneeSEIOutputKneePoint = p; }
    940965  Int*  getKneeSEIOutputKneePoint()                                  { return m_kneeSEIOutputKneePoint; }
     966  Void  setColourRemapInfoSEIFileRoot( const std::string &s )        { m_colourRemapSEIFileRoot = s; }
     967  const std::string &getColourRemapInfoSEIFileRoot() const           { return m_colourRemapSEIFileRoot; }
     968
    941969  Void  setMasteringDisplaySEI(const TComSEIMasteringDisplay &src)   { m_masteringDisplay = src; }
    942970  const TComSEIMasteringDisplay &getMasteringDisplaySEI() const      { return m_masteringDisplay; }
    943971#if NH_MV
    944 #if NH_MV_SEI
    945972  Void setSeiMessages(SEIMessages *p)                                { m_seiMessages = p;    }
    946973  const SEIMessages*  getSeiMessages()                               { return m_seiMessages; }
    947 #else
    948   Bool   getSubBitstreamPropSEIEnabled()                             { return m_subBistreamPropSEIEnabled;}
    949   Void   setSubBitstreamPropSEIEnabled(Bool x)                       { m_subBistreamPropSEIEnabled = x;}
    950                                                                      
    951   Int    getNumAdditionalSubStreams()                                { return m_numAdditionalSubStreams;}
    952   Void   setNumAdditionalSubStreams(Int x)                           { m_numAdditionalSubStreams = x;}
    953 
    954   std::vector<Int> const &getSubBitstreamMode()                      { return m_subBitstreamMode;}
    955   Int   getSubBitstreamMode(Int idx)                                 { return m_subBitstreamMode[idx];}
    956   Void  setSubBitstreamMode(std::vector<Int> &x)                     { m_subBitstreamMode = x;}
    957 
    958   std::vector<Int> const &getOutputLayerSetIdxToVps()                { return m_outputLayerSetIdxToVps;}
    959   Int   getOutputLayerSetIdxToVps(Int idx)                           { return m_outputLayerSetIdxToVps[idx];}
    960   Void  setOutputLayerSetIdxToVps(std::vector<Int> &x)               { m_outputLayerSetIdxToVps = x;}
    961                                                                      
    962   std::vector<Int> const &getHighestSublayerId()                     { return m_highestSublayerId;}
    963   Int   getHighestSublayerId(Int idx)                                { return m_highestSublayerId[idx];}
    964   Void  setHighestSublayerId(std::vector<Int> &x)                    { m_highestSublayerId = x;}
    965                                                                      
    966   std::vector<Int> const &getAvgBitRate()                            { return m_avgBitRate;}
    967   Int   getAvgBitRate(Int idx)                                       { return m_avgBitRate[idx];}
    968   Void  setAvgBitRate(std::vector<Int> &x)                           { m_avgBitRate = x;}
    969                                                                      
    970   std::vector<Int> const &getMaxBitRate()                            { return m_maxBitRate;}
    971   Int   getMaxBitRate(Int idx)                                       { return m_maxBitRate[idx];}
    972   Void  setMaxBitRate(std::vector<Int> &x)                           { m_maxBitRate = x;}
    973 #endif
    974 #endif
    975 
     974#endif
    976975  Void         setUseWP               ( Bool b )                     { m_useWeightedPred   = b;    }
    977976  Void         setWPBiPred            ( Bool b )                     { m_useWeightedBiPred = b;    }
     
    984983  Void         setUseScalingListId    ( ScalingListMode u )          { m_useScalingListId       = u;   }
    985984  ScalingListMode getUseScalingListId    ()                          { return m_useScalingListId;      }
    986   Void         setScalingListFile     ( Char*  pch )                 { m_scalingListFile     = pch; }
    987   Char*        getScalingListFile     ()                             { return m_scalingListFile;    }
     985  Void         setScalingListFileName       ( const std::string &s ) { m_scalingListFileName = s;      }
     986  const std::string& getScalingListFileName () const                 { return m_scalingListFileName;   }
    988987  Void         setTMVPModeId ( Int  u )                              { m_TMVPModeId = u;    }
    989988  Int          getTMVPModeId ()                                      { return m_TMVPModeId; }
     989  WeightedPredictionMethod getWeightedPredictionMethod() const       { return m_weightedPredictionMethod; }
     990  Void         setWeightedPredictionMethod( WeightedPredictionMethod m ) { m_weightedPredictionMethod = m; }
    990991  Void         setSignHideFlag( Bool signHideFlag )                  { m_signHideFlag = signHideFlag; }
    991992  Bool         getSignHideFlag()                                     { return m_signHideFlag; }
     
    10041005  Bool         getForceIntraQP        ()                             { return m_RCForceIntraQP;        }
    10051006  Void         setForceIntraQP        ( Bool b )                     { m_RCForceIntraQP = b;           }
     1007
     1008#if U0132_TARGET_BITS_SATURATION
     1009  Bool         getCpbSaturationEnabled()                             { return m_RCCpbSaturationEnabled;}
     1010  Void         setCpbSaturationEnabled( Bool b )                     { m_RCCpbSaturationEnabled = b;   }
     1011  UInt         getCpbSize             ()                             { return m_RCCpbSize;}
     1012  Void         setCpbSize             ( UInt ui )                    { m_RCCpbSize = ui;   }
     1013  Double       getInitialCpbFullness  ()                             { return m_RCInitialCpbFullness;  }
     1014  Void         setInitialCpbFullness  (Double f)                     { m_RCInitialCpbFullness = f;     }
     1015#endif
    10061016
    10071017#if KWU_RC_MADPRED_E0227
     
    11321142  Bool         getLowerBitRateConstraintFlag() const                 { return m_lowerBitRateConstraintFlag; }
    11331143  Void         setLowerBitRateConstraintFlag(Bool b)                 { m_lowerBitRateConstraintFlag=b; }
    1134   Bool      getChromaSamplingFilterHintEnabled()                     { return m_chromaSamplingFilterHintEnabled;}
    1135   Void      setChromaSamplingFilterHintEnabled(Bool i)               { m_chromaSamplingFilterHintEnabled = i;}
    1136   Int       getChromaSamplingHorFilterIdc()                          { return m_chromaSamplingHorFilterIdc;}
    1137   Void      setChromaSamplingHorFilterIdc(Int i)                     { m_chromaSamplingHorFilterIdc = i;}
    1138   Int       getChromaSamplingVerFilterIdc()                          { return m_chromaSamplingVerFilterIdc;}
    1139   Void      setChromaSamplingVerFilterIdc(Int i)                     { m_chromaSamplingVerFilterIdc = i;}
     1144  Bool         getChromaResamplingFilterHintEnabled()                { return m_chromaResamplingFilterHintEnabled;}
     1145  Void         setChromaResamplingFilterHintEnabled(Bool i)          { m_chromaResamplingFilterHintEnabled = i;}
     1146  Int          getChromaResamplingHorFilterIdc()                     { return m_chromaResamplingHorFilterIdc;}
     1147  Void         setChromaResamplingHorFilterIdc(Int i)                { m_chromaResamplingHorFilterIdc = i;}
     1148  Int          getChromaResamplingVerFilterIdc()                     { return m_chromaResamplingVerFilterIdc;}
     1149  Void         setChromaResamplingVerFilterIdc(Int i)                { m_chromaResamplingVerFilterIdc = i;}
    11401150
    11411151  Void      setSummaryOutFilename(const std::string &s)              { m_summaryOutFilename = s; }
     
    11471157  UInt      getSummaryVerboseness( ) const                           { return m_summaryVerboseness; }
    11481158
    1149 #if NH_3D
     1159#if NH_3D_VSO
    11501160  // Only flags that are not in the SPS3dExtension should go here.
    11511161  /// 3D Tools
     
    11531163 //==== CAMERA PARAMETERS  ==========
    11541164  Void      setCameraParameters             ( TAppComCamPara* c) { m_cameraParameters   = c; }
    1155 
    1156 #if NH_3D_VSO
    11571165 //==== VSO  ==========
    11581166  Void      setRenderModelParameters ( TRenModSetupStrParser* c ) { m_renderModelParameters = c; }
     
    11841192  Void      setDispCoeff                    ( Double  d )   { m_dDispCoeff  = d; }
    11851193#endif // NH_3D_VSO
    1186 
     1194#if NH_3D
    11871195  Bool      getUseDMM                       ()        { return m_useDMM; }
    11881196  Void      setUseDMM                       ( Bool b) { m_useDMM = b;    }
     
    11921200  Bool      getUseDLT                       ()        { return m_useDLT; }
    11931201  Void      setUseDLT                       ( Bool b) { m_useDLT = b;    }
    1194 
     1202#endif
     1203
     1204#if NH_3D_QTL
    11951205  Void      setUseQTL                       ( Bool b ) { m_bUseQTL = b;    }
    11961206  Bool      getUseQTL                       ()         { return m_bUseQTL; }
     1207#endif
     1208#if NH_3D
    11971209
    11981210  Void      setProfileIdc( Int a )    { assert( a == 1 || a == 6 || a == 8 ); m_profileIdc = a;  }
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r1321 r1386  
    420420  const UInt fastDeltaQPCuMaxSize    = Clip3(sps.getMaxCUHeight()>>sps.getLog2DiffMaxMinCodingBlockSize(), sps.getMaxCUHeight(), 32u);
    421421
    422 
     422#if NH_3D_QTL
    423423#if NH_3D_QTLPC
    424424  Bool  bLimQtPredFalg    = pcPic->getSlice(0)->getQtPredFlag();
     425#else
     426  Bool  bLimQtPredFalg    = false;
     427#endif
    425428  TComPic *pcTexture      = rpcBestCU->getSlice()->getTexturePic();
    426429
     
    437440  m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getCtuRsAddr(), rpcBestCU->getZorderIdxInCtu() );
    438441
    439 #if NH_3D_QTLPC 
     442#if NH_3D_QTL 
    440443  Bool    bTrySplit     = true;
    441444  Bool    bTrySplitDQP  = true;
     
    459462  const UInt uiWidth   = rpcBestCU->getWidth(0);
    460463
    461 #if H_MV_ENC_DEC_TRAC
     464#if NH_MV_ENC_DEC_TRAC
    462465#if ENC_DEC_TRACE
    463466    stopAtPos  ( rpcBestCU->getSlice()->getPOC(),
     
    534537      }
    535538
    536 #if NH_3D_QTLPC
     539#if NH_3D_QTL
    537540      bTrySplit    = true;
    538541#endif
     
    552555
    553556      rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    554 #if NH_3D_QTLPC
     557#if NH_3D_QTL
    555558      //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU
    556559#if H_3D_FCO
     
    734737#endif
    735738      }
    736 #if NH_3D_QTLPC     
     739#if NH_3D_QTL
    737740      if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ))
    738741      {
     
    789792          {
    790793            if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() && doNotBlockPu
    791 #if NH_3D_QTLPC
     794#if NH_3D_QTL
    792795                && bTrySplit
    793796#endif
     
    809812
    810813          if(doNotBlockPu
    811 #if NH_3D_QTLPC
     814#if NH_3D_QTL
    812815            && bTryNx2N
    813816#endif
     
    830833          }
    831834          if(doNotBlockPu
    832 #if NH_3D_QTLPC
     835#if NH_3D_QTL
    833836            && bTry2NxN
    834837#endif
     
    871874            {
    872875              if(doNotBlockPu
    873 #if NH_3D_QTLPC
     876#if NH_3D_QTL
    874877                && bTry2NxN
    875878#endif
     
    891894              }
    892895              if(doNotBlockPu
    893 #if NH_3D_QTLPC
     896#if NH_3D_QTL
    894897                && bTry2NxN
    895898#endif
     
    917920            {
    918921              if(doNotBlockPu
    919 #if NH_3D_QTLPC
     922#if NH_3D_QTL
    920923                && bTry2NxN
    921924#endif
     
    939942              }
    940943              if(doNotBlockPu
    941 #if NH_3D_QTLPC
     944#if NH_3D_QTL
    942945                && bTry2NxN
    943946#endif
     
    966969            {
    967970              if(doNotBlockPu
    968 #if NH_3D_QTLPC
     971#if NH_3D_QTL
    969972                && bTryNx2N
    970973#endif
     
    987990              }
    988991              if(doNotBlockPu
    989 #if NH_3D_QTLPC
     992#if NH_3D_QTL
    990993                && bTryNx2N
    991994#endif
     
    10071010            {
    10081011              if(doNotBlockPu
    1009 #if NH_3D_QTLPC
     1012#if NH_3D_QTL
    10101013                && bTryNx2N
    10111014#endif
     
    10271030              }
    10281031              if(doNotBlockPu
    1029 #if NH_3D_QTLPC
     1032#if NH_3D_QTL
    10301033                && bTryNx2N
    10311034#endif
     
    10481051
    10491052#else
    1050 #if NH_3D_QTLPC
     1053#if NH_3D_QTL
    10511054            if (bTry2NxN)
    10521055            {
     
    10631066            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    10641067#endif
    1065 #if NH_3D_QTLPC
     1068#if NH_3D_QTL
    10661069            }
    10671070            if (bTryNx2N)
     
    10781081            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    10791082#endif
    1080 #if NH_3D_QTLPC
     1083#if NH_3D_QTL
    10811084            }
    10821085#endif
     
    11341137          if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() )
    11351138          {
    1136 #if NH_3D_QTLPC //Try IntraNxN
     1139#if NH_3D_QTL //Try IntraNxN
    11371140              if(bTrySplit)
    11381141              {
     
    11501153              rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    11511154            }
    1152 #if NH_3D_QTLPC
     1155#if NH_3D_QTL
    11531156              }
    11541157#endif
     
    12521255  const Bool bSubBranch = bBoundary || !( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->getTotalCost()!=MAX_DOUBLE && rpcBestCU->isSkipped(0) );
    12531256#endif
    1254 #if NH_3D_QTLPC
     1257#if NH_3D_QTL
    12551258  if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() && (!getFastDeltaQp() || uiWidth > fastDeltaQPCuMaxSize || bBoundary) && bTrySplitDQP )
    12561259#else
     
    15161519  const UInt uiBPelY   = uiTPelY + (maxCUHeight>>uiDepth) - 1;
    15171520
    1518 #if H_MV_ENC_DEC_TRAC
     1521#if NH_MV_ENC_DEC_TRAC
    15191522  DTRACE_CU_S("=========== coding_quadtree ===========\n")
    15201523  DTRACE_CU("x0", uiLPelX)
     
    15581561  }
    15591562
    1560 #if H_MV_ENC_DEC_TRAC
     1563#if NH_MV_ENC_DEC_TRAC
    15611564  DTRACE_CU_S("=========== coding_unit ===========\n")
    15621565#endif
     
    15851588  if( pcCU->isSkipped( uiAbsPartIdx ) )
    15861589  {
    1587 #if H_MV_ENC_DEC_TRAC
     1590#if NH_MV_ENC_DEC_TRAC
    15881591    DTRACE_PU_S("=========== prediction_unit ===========\n")
    15891592    DTRACE_PU("x0", uiLPelX)
     
    22162219          *earlyDetectionSkipMode = true;
    22172220        }
    2218         else if(m_pcEncCfg->getFastSearch() != SELECTIVE)
     2221        else if(m_pcEncCfg->getMotionEstimationSearchMethod() != MESEARCH_SELECTIVE)
    22192222        {
    22202223          Int absoulte_MV=0;
     
    23052308    for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ )
    23062309    {
    2307 #if DEBUG_STRING && H_MV_ENC_DEC_TRAC
     2310#if DEBUG_STRING && NH_MV_ENC_DEC_TRAC
    23082311      sTest.clear();
    23092312#endif
     
    27412744  m_pcPredSearch  ->estIntraPredDIS      ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false );
    27422745
    2743 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     2746#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    27442747  Int oldTraceCopyBack = g_traceCopyBack;
    27452748  g_traceCopyBack = false; 
    27462749#endif
    27472750  m_ppcRecoYuvTemp[uiDepth]->copyToPicComponent(COMPONENT_Y, rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getCtuRsAddr(), rpcTempCU->getZorderIdxInCtu() );
    2748 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 
     2751#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 
    27492752  g_traceCopyBack = oldTraceCopyBack;
    27502753#endif
     
    30773080  m_ppcRecoYuvBest[uiSrcDepth]->copyToPicYuv( rpcPic->getPicYuvRec (), uiCUAddr, uiAbsPartIdx, uiDepth - uiSrcDepth, uiPartIdx);
    30783081
    3079 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     3082#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    30803083  Bool oldtraceCopyBack = g_traceCopyBack;
    30813084  g_traceCopyBack = false;
     
    30833086  m_ppcPredYuvBest[uiSrcDepth]->copyToPicYuv( rpcPic->getPicYuvPred (), uiCUAddr, uiAbsPartIdx, uiDepth - uiSrcDepth, uiPartIdx);
    30843087
    3085 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     3088#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    30863089  g_traceCopyBack = oldtraceCopyBack;
    30873090#endif
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncEntropy.cpp

    r1321 r1386  
    281281  const UInt uiTrIdx = rTu.GetTransformDepthRel();
    282282  const UInt uiDepth = rTu.GetTransformDepthTotal();
    283 #if H_MV_ENC_DEC_TRAC
     283#if NH_MV_ENC_DEC_TRAC
    284284#if ENC_DEC_TRACE
    285285  UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
     
    388388  else
    389389  {
    390 #if !H_MV_ENC_DEC_TRAC
     390#if !NH_MV_ENC_DEC_TRAC
    391391    {
    392392      DTRACE_CABAC_VL( g_nSymbolCounter++ );
     
    557557  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
    558558  {
    559 #if H_MV_ENC_DEC_TRAC
     559#if NH_MV_ENC_DEC_TRAC
    560560    DTRACE_PU_S("=========== prediction_unit ===========\n")
    561561       //Todo:
     
    795795Void TEncEntropy::encodeCoeffNxN( TComTU &rTu, TCoeff* pcCoef, const ComponentID compID)
    796796{
    797 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     797#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    798798  Bool oldTraceFracBits = g_traceEncFracBits;
    799799  g_traceEncFracBits = false;
     
    827827    }
    828828  }
    829 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     829#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    830830  g_traceEncFracBits = oldTraceFracBits;
    831831#endif
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncEntropy.h

    r1321 r1386  
    139139  Void    setBitstream              ( TComBitIf* p )          { m_pcEntropyCoderIf->setBitstream(p);  }
    140140  Void    resetBits                 ()                        { m_pcEntropyCoderIf->resetBits();      }
     141#if NH_MV
    141142  UInt    getNumberOfWrittenBits    ()                        {
    142 #if NH_MV
    143143      D_PRINT_INDENT(g_encNumberOfWrittenBits,  "NumBits: " +  n2s( m_pcEntropyCoderIf->getNumberOfWrittenBits() ))
    144 #endif
    145144 return m_pcEntropyCoderIf->getNumberOfWrittenBits(); }
     145#else
     146  UInt    getNumberOfWrittenBits    ()                        { return m_pcEntropyCoderIf->getNumberOfWrittenBits(); }
     147#endif
    146148  Void    resetEntropy              (const TComSlice *pSlice) { m_pcEntropyCoderIf->resetEntropy(pSlice);  }
    147149  SliceType determineCabacInitIdx   (const TComSlice *pSlice) { return m_pcEntropyCoderIf->determineCabacInitIdx(pSlice); }
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r1356 r1386  
    219219}
    220220
     221Void TEncGOP::xWriteAccessUnitDelimiter (AccessUnit &accessUnit, TComSlice *slice)
     222{
     223  AUDWriter audWriter;
     224  OutputNALUnit nalu(NAL_UNIT_ACCESS_UNIT_DELIMITER);
     225
     226  Int picType = slice->isIntra() ? 0 : (slice->isInterP() ? 1 : 2);
     227
     228  audWriter.codeAUD(nalu.m_Bitstream, picType);
     229  accessUnit.push_front(new NALUnitEBSP(nalu));
     230}
     231
    221232// write SEI list into one NAL unit and add it to the Access unit at auPos
    222233Void TEncGOP::xWriteSEI (NalUnitType naluType, SEIMessages& seiMessages, AccessUnit &accessUnit, AccessUnit::iterator &auPos, Int temporalId, const TComSPS *sps)
     
    329340  xClearSEIs(currentMessages, !testWrite);
    330341
    331 #if NH_MV_LAYERS_NOT_PRESENT_SEI
     342#if NH_MV
    332343  // Layers not present SEI message
    333344  currentMessages = extractSeisByType(localMessages, SEI::LAYERS_NOT_PRESENT);
     
    485496  }
    486497
    487 #if NH_MV
    488 #if !NH_MV_SEI
    489   if( m_pcCfg->getSubBitstreamPropSEIEnabled() && ( getLayerId() == 0 ) )
    490   {
    491     SEISubBitstreamProperty *sei = new SEISubBitstreamProperty;
    492     m_seiEncoder.initSEISubBitstreamProperty( sei, sps );
    493     seiMessages.push_back(sei);
    494   }
    495 #endif
    496 #endif
     498  if(m_pcCfg->getChromaResamplingFilterHintEnabled())
     499  {
     500    SEIChromaResamplingFilterHint *seiChromaResamplingFilterHint = new SEIChromaResamplingFilterHint;
     501    m_seiEncoder.initSEIChromaResamplingFilterHint(seiChromaResamplingFilterHint, m_pcCfg->getChromaResamplingHorFilterIdc(), m_pcCfg->getChromaResamplingVerFilterIdc());
     502    seiMessages.push_back(seiChromaResamplingFilterHint);
     503  }
    497504}
    498505
     
    545552  }
    546553
    547   if(slice->getSPS()->getVuiParametersPresentFlag() && m_pcCfg->getChromaSamplingFilterHintEnabled() && ( slice->getSliceType() == I_SLICE ))
    548   {
    549     SEIChromaSamplingFilterHint *seiChromaSamplingFilterHint = new SEIChromaSamplingFilterHint;
    550     m_seiEncoder.initSEIChromaSamplingFilterHint(seiChromaSamplingFilterHint, m_pcCfg->getChromaSamplingHorFilterIdc(), m_pcCfg->getChromaSamplingVerFilterIdc());
    551     seiMessages.push_back(seiChromaSamplingFilterHint);
    552   }
    553 
    554554  if( m_pcEncTop->getNoDisplaySEITLayer() && ( slice->getTLayer() >= m_pcEncTop->getNoDisplaySEITLayer() ) )
    555555  {
     
    557557    seiNoDisplay->m_noDisplay = true;
    558558    seiMessages.push_back(seiNoDisplay);
     559  }
     560
     561  // insert one Colour Remapping Info SEI for the picture (if the file exists)
     562  if (!m_pcCfg->getColourRemapInfoSEIFileRoot().empty())
     563  {
     564    SEIColourRemappingInfo *seiColourRemappingInfo = new SEIColourRemappingInfo();
     565    const Bool success = m_seiEncoder.initSEIColourRemappingInfo(seiColourRemappingInfo, slice->getPOC() );
     566
     567    if(success)
     568    {
     569      seiMessages.push_back(seiColourRemappingInfo);
     570    }
     571    else
     572    {
     573      delete seiColourRemappingInfo;
     574    }
    559575  }
    560576}
     
    577593Void TEncGOP::xCreatePictureTimingSEI  (Int IRAPGOPid, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, SEIMessages& duInfoSeiMessages, TComSlice *slice, Bool isField, std::deque<DUData> &duData)
    578594{
    579   Int picSptDpbOutputDuDelay = 0;
    580 #if !NH_MV
    581   SEIPictureTiming *pictureTimingSEI = new SEIPictureTiming();
    582 #endif
    583595
    584596  const TComVUI *vui = slice->getSPS()->getVuiParameters();
     
    590602    (  hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) )
    591603  {
    592 #if NH_MV
    593     // Preliminary fix to avoid memory leak.
     604    Int picSptDpbOutputDuDelay = 0;
    594605    SEIPictureTiming *pictureTimingSEI = new SEIPictureTiming();
    595 #endif
    596606
    597607    // DU parameters
     
    712722      }
    713723    }
     724
     725    if( !m_pcCfg->getPictureTimingSEIEnabled() && pictureTimingSEI )
     726    {
     727      delete pictureTimingSEI;
     728    }
    714729  }
    715730}
     
    745760
    746761  // The last DU may have a trailing SEI
    747   if (m_pcCfg->getDecodedPictureHashSEIEnabled())
     762  if (m_pcCfg->getDecodedPictureHashSEIType()!=HASHTYPE_NONE)
    748763  {
    749764    duData.back().accumBitsDU += ( 20 << 3 ); // probably around 20 bytes - should be further adjusted, e.g. by type
     
    867882      if (cabacZeroWordPaddingEnabled)
    868883      {
    869         std::vector<Char> zeroBytesPadding(numberOfAdditionalCabacZeroBytes, Char(0));
     884        std::vector<UChar> zeroBytesPadding(numberOfAdditionalCabacZeroBytes, UChar(0));
    870885        for(std::size_t i=0; i<numberOfAdditionalCabacZeroWords; i++)
    871886        {
    872887          zeroBytesPadding[i*3+2]=3;  // 00 00 03
    873888        }
    874         nalUnitData.write(&(zeroBytesPadding[0]), numberOfAdditionalCabacZeroBytes);
     889        nalUnitData.write(reinterpret_cast<const TChar*>(&(zeroBytesPadding[0])), numberOfAdditionalCabacZeroBytes);
    875890        printf("Adding %d bytes of padding\n", UInt(numberOfAdditionalCabacZeroWords*3));
    876891      }
     
    10581073  {
    10591074    return 1;
     1075  }
     1076}
     1077
     1078
     1079static Void
     1080printHash(const HashType hashType, const std::string &digestStr)
     1081{
     1082  const TChar *decodedPictureHashModeName;
     1083  switch (hashType)
     1084  {
     1085    case HASHTYPE_MD5:
     1086      decodedPictureHashModeName = "MD5";
     1087      break;
     1088    case HASHTYPE_CRC:
     1089      decodedPictureHashModeName = "CRC";
     1090      break;
     1091    case HASHTYPE_CHECKSUM:
     1092      decodedPictureHashModeName = "Checksum";
     1093      break;
     1094    default:
     1095      decodedPictureHashModeName = NULL;
     1096      break;
     1097  }
     1098  if (decodedPictureHashModeName != NULL)
     1099  {
     1100    if (digestStr.empty())
     1101    {
     1102      printf(" [%s:%s]", decodedPictureHashModeName, "?");
     1103    }
     1104    else
     1105    {
     1106      printf(" [%s:%s]", decodedPictureHashModeName, digestStr.c_str());
     1107    }
    10601108  }
    10611109}
     
    13741422    Int numDirectRefLayers = vps    ->getNumDirectRefLayers( getLayerId() );
    13751423#endif
     1424#if NH_3D_QTL
     1425    pcSlice->setIvPicLists( m_ivPicLists );
     1426#endif
    13761427#if NH_3D
    1377     pcSlice->setIvPicLists( m_ivPicLists );
     1428
    13781429
    13791430    Int gopNum = (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid;
     
    15941645    pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false, pcSlice->getPOC(), flagRec ) );
    15951646    pcRdCost->setDepthPicYuv   ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), true, pcSlice->getPOC(), false ) );
    1596 #else
    1597     pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false , pcSlice->getPOC(), true ) );
    1598     pcRdCost->setDepthPicYuv   ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), true  , pcSlice->getPOC(), false ) );
    1599 #endif
    1600 
     1647#else   
     1648    Int curAuxId     = pcSlice->getVPS()->getAuxId( getLayerId() );
     1649    Int curDepthFlag = pcSlice->getIsDepth();
     1650    assert( curAuxId == 2 || curDepthFlag  );
     1651    pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false       , 0       , pcSlice->getPOC(), true ) );
     1652    pcRdCost->setDepthPicYuv   ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), curDepthFlag, curAuxId, pcSlice->getPOC(), false ) );
     1653#endif
    16011654    // LGE_WVSO_A0119
    16021655    Bool bUseWVSO  = m_pcEncTop->getUseWVSO();
     
    16051658  }
    16061659#endif
    1607 
    1608     /////////////////////////////////////////////////////////////////////////////////////////////////// Compress a slice
    1609     //  Slice compression
    1610     if (m_pcCfg->getUseASR())
     1660    // set adaptive search range for non-intra-slices
     1661    if (m_pcCfg->getUseASR() && pcSlice->getSliceType()!=I_SLICE)
    16111662    {
    16121663      m_pcSliceEncoder->setSearchRange(pcSlice);
     
    16541705      }
    16551706      m_pcRateCtrl->initRCPic( frameLevel );
     1707      estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits();
    16561708
    16571709#if KWU_RC_MADPRED_E0227
     
    16621714#endif
    16631715
    1664       estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits();
     1716#if U0132_TARGET_BITS_SATURATION
     1717      if (m_pcRateCtrl->getCpbSaturationEnabled() && frameLevel != 0)
     1718      {
     1719        Int estimatedCpbFullness = m_pcRateCtrl->getCpbState() + m_pcRateCtrl->getBufferingRate();
     1720
     1721        // prevent overflow
     1722        if (estimatedCpbFullness - estimatedBits > (Int)(m_pcRateCtrl->getCpbSize()*0.9f))
     1723        {
     1724          estimatedBits = estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.9f);
     1725        }
     1726
     1727        estimatedCpbFullness -= m_pcRateCtrl->getBufferingRate();
     1728        // prevent underflow
     1729        if (estimatedCpbFullness - estimatedBits < (Int)(m_pcRateCtrl->getCpbSize()*0.1f))
     1730        {
     1731          estimatedBits = max(200, estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.1f));
     1732        }
     1733
     1734        m_pcRateCtrl->getRCPic()->setTargetBits(estimatedBits);
     1735      }
     1736#endif
    16651737
    16661738      Int sliceQP = m_pcCfg->getInitialQP();
     
    16831755          Int bits = m_pcRateCtrl->getRCSeq()->getLeftAverageBits();
    16841756          bits = m_pcRateCtrl->getRCPic()->getRefineBitsForIntra( bits );
     1757
     1758#if U0132_TARGET_BITS_SATURATION
     1759          if (m_pcRateCtrl->getCpbSaturationEnabled() )
     1760          {
     1761            Int estimatedCpbFullness = m_pcRateCtrl->getCpbState() + m_pcRateCtrl->getBufferingRate();
     1762
     1763            // prevent overflow
     1764            if (estimatedCpbFullness - bits > (Int)(m_pcRateCtrl->getCpbSize()*0.9f))
     1765            {
     1766              bits = estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.9f);
     1767            }
     1768
     1769            estimatedCpbFullness -= m_pcRateCtrl->getBufferingRate();
     1770            // prevent underflow
     1771            if (estimatedCpbFullness - bits < (Int)(m_pcRateCtrl->getCpbSize()*0.1f))
     1772            {
     1773              bits = estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.1f);
     1774            }
     1775          }
     1776#endif
     1777
    16851778          if ( bits < 200 )
    16861779          {
     
    18201913      // write various parameter sets
    18211914      actualTotalBits += xWriteParameterSets(accessUnit, pcSlice);
    1822 #if PPS_FIX_DEPTH
     1915#if H_3D_PPS_FIX_DEPTH
    18231916      if(!pcSlice->getIsDepth() || !pcSlice->getViewIndex() )
    18241917      {
    18251918#endif
    1826 #if PPS_FIX_DEPTH
     1919#if H_3D_PPS_FIX_DEPTH
    18271920      }
    18281921#endif
     
    18341927
    18351928      m_bSeqFirst = false;
     1929    }
     1930    if (m_pcCfg->getAccessUnitDelimiter())
     1931    {
     1932      xWriteAccessUnitDelimiter(accessUnit, pcSlice);
    18361933    }
    18371934
     
    18411938    xCreatePerPictureSEIMessages(iGOPid, leadingSeiMessages, nestedSeiMessages, pcSlice);
    18421939
    1843 #if NH_MV_SEI
     1940#if NH_MV
    18441941    m_seiEncoder.createAnnexFGISeiMessages( leadingSeiMessages, pcSlice );
    18451942#endif
     
    20022099
    20032100    std::string digestStr;
    2004     if (m_pcCfg->getDecodedPictureHashSEIEnabled())
     2101    if (m_pcCfg->getDecodedPictureHashSEIType()!=HASHTYPE_NONE)
    20052102    {
    20062103      SEIDecodedPictureHash *decodedPictureHashSei = new SEIDecodedPictureHash();
     
    20142111    xCalculateAddPSNRs( isField, isTff, iGOPid, pcPic, accessUnit, rcListPic, dEncTime, snr_conversion, printFrameMSE );
    20152112
    2016     if (!digestStr.empty())
    2017     {
    2018       if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 1)
    2019       {
    2020         printf(" [MD5:%s]", digestStr.c_str());
    2021       }
    2022       else if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 2)
    2023       {
    2024         printf(" [CRC:%s]", digestStr.c_str());
    2025       }
    2026       else if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 3)
    2027       {
    2028         printf(" [Checksum:%s]", digestStr.c_str());
    2029       }
    2030     }
     2113    printHash(m_pcCfg->getDecodedPictureHashSEIType(), digestStr);
    20312114
    20322115    if ( m_pcCfg->getUseRateCtrl() )
     
    20512134        m_pcRateCtrl->getRCGOP()->updateAfterPicture( estimatedBits );
    20522135      }
     2136#if U0132_TARGET_BITS_SATURATION
     2137      if (m_pcRateCtrl->getCpbSaturationEnabled())
     2138      {
     2139        m_pcRateCtrl->updateCpbState(actualTotalBits);
     2140        printf(" [CPB %6d bits]", m_pcRateCtrl->getCpbState());
     2141      }
     2142#endif
    20532143    }
    20542144
     
    23522442  if (conversion!=IPCOLOURSPACE_UNCHANGED)
    23532443  {
    2354     cscd.create(pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), pcPicD->getChromaFormat(), pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), 0, false);
     2444    cscd.createWithoutCUInfo(pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), pcPicD->getChromaFormat() );
    23552445    TVideoIOYuv::ColourSpaceConvert(*pcPicD, cscd, conversion, false);
    23562446  }
     
    24522542  }
    24532543
    2454   Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');
     2544  TChar c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');
    24552545  if (!pcSlice->isReferenced())
    24562546  {
     
    25062596  printf(" [ET %5.0f ]", dEncTime );
    25072597
     2598  // printf(" [WP %d]", pcSlice->getUseWeightedPrediction());
     2599
    25082600  for (Int iRefList = 0; iRefList < 2; iRefList++)
    25092601  {
     
    25552647    {
    25562648      TComPicYuv &reconField=*(apcPicRecFields[fieldNum]);
    2557       cscd[fieldNum].create(reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), reconField.getChromaFormat(), reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), 0, false);
     2649      cscd[fieldNum].createWithoutCUInfo(reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), reconField.getChromaFormat() );
    25582650      TVideoIOYuv::ColourSpaceConvert(reconField, cscd[fieldNum], conversion, false);
    25592651      apcPicRecFields[fieldNum]=cscd+fieldNum;
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncGOP.h

    r1313 r1386  
    220220  Double xCalculateRVM();
    221221
     222  Void xWriteAccessUnitDelimiter (AccessUnit &accessUnit, TComSlice *slice);
     223
    222224  Void xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const TComSPS *sps, const TComPPS *pps);
    223225  Void xCreatePerPictureSEIMessages (Int picInGOP, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, TComSlice *slice);
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncPreanalyzer.cpp

    r1313 r1386  
    8787        UInt64 uiSum[4] = {0, 0, 0, 0};
    8888        UInt64 uiSumSq[4] = {0, 0, 0, 0};
    89         UInt uiNumPixInAQPart = 0;
    9089        UInt by = 0;
    9190        for ( ; by < uiCurrAQPartHeight>>1; by++ )
    9291        {
    9392          UInt bx = 0;
    94           for ( ; bx < uiCurrAQPartWidth>>1; bx++, uiNumPixInAQPart++ )
     93          for ( ; bx < uiCurrAQPartWidth>>1; bx++ )
    9594          {
    9695            uiSum  [0] += pBlkY[bx];
    9796            uiSumSq[0] += pBlkY[bx] * pBlkY[bx];
    9897          }
    99           for ( ; bx < uiCurrAQPartWidth; bx++, uiNumPixInAQPart++ )
     98          for ( ; bx < uiCurrAQPartWidth; bx++ )
    10099          {
    101100            uiSum  [1] += pBlkY[bx];
     
    107106        {
    108107          UInt bx = 0;
    109           for ( ; bx < uiCurrAQPartWidth>>1; bx++, uiNumPixInAQPart++ )
     108          for ( ; bx < uiCurrAQPartWidth>>1; bx++ )
    110109          {
    111110            uiSum  [2] += pBlkY[bx];
    112111            uiSumSq[2] += pBlkY[bx] * pBlkY[bx];
    113112          }
    114           for ( ; bx < uiCurrAQPartWidth; bx++, uiNumPixInAQPart++ )
     113          for ( ; bx < uiCurrAQPartWidth; bx++ )
    115114          {
    116115            uiSum  [3] += pBlkY[bx];
     
    120119        }
    121120
     121        assert ((uiCurrAQPartWidth&1)==0);
     122        assert ((uiCurrAQPartHeight&1)==0);
     123        const UInt pixelWidthOfQuadrants  = uiCurrAQPartWidth >>1;
     124        const UInt pixelHeightOfQuadrants = uiCurrAQPartHeight>>1;
     125        const UInt numPixInAQPart         = pixelWidthOfQuadrants * pixelHeightOfQuadrants;
     126
    122127        Double dMinVar = DBL_MAX;
     128        if (numPixInAQPart!=0)
     129        {
    123130        for ( Int i=0; i<4; i++)
    124131        {
    125           const Double dAverage = Double(uiSum[i]) / uiNumPixInAQPart;
    126           const Double dVariance = Double(uiSumSq[i]) / uiNumPixInAQPart - dAverage * dAverage;
     132            const Double dAverage = Double(uiSum[i]) / numPixInAQPart;
     133            const Double dVariance = Double(uiSumSq[i]) / numPixInAQPart - dAverage * dAverage;
    127134          dMinVar = min(dMinVar, dVariance);
     135        }
     136        }
     137        else
     138        {
     139          dMinVar = 0.0;
    128140        }
    129141        const Double dActivity = 1.0 + dMinVar;
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncRateCtrl.cpp

    r1313 r1386  
    16391639    m_encRCSeq->initLCUPara();
    16401640  }
     1641#if U0132_TARGET_BITS_SATURATION
     1642  m_CpbSaturationEnabled = false;
     1643  m_cpbSize              = targetBitrate;
     1644  m_cpbState             = (UInt)(m_cpbSize*0.5f);
     1645  m_bufferingRate        = (Int)(targetBitrate / frameRate);
     1646#endif
    16411647
    16421648#if KWU_RC_MADPRED_E0227
     
    16641670}
    16651671
     1672#if U0132_TARGET_BITS_SATURATION
     1673Int  TEncRateCtrl::updateCpbState(Int actualBits)
     1674{
     1675  Int cpbState = 1;
     1676
     1677  m_cpbState -= actualBits;
     1678  if (m_cpbState < 0)
     1679  {
     1680    cpbState = -1;
     1681  }
     1682
     1683  m_cpbState += m_bufferingRate;
     1684  if (m_cpbState > m_cpbSize)
     1685  {
     1686    cpbState = 0;
     1687  }
     1688
     1689  return cpbState;
     1690}
     1691
     1692Void TEncRateCtrl::initHrdParam(const TComHRD* pcHrd, Int iFrameRate, Double fInitialCpbFullness)
     1693{
     1694  m_CpbSaturationEnabled = true;
     1695  m_cpbSize = (pcHrd->getCpbSizeValueMinus1(0, 0, 0) + 1) << (4 + pcHrd->getCpbSizeScale());
     1696  m_cpbState = (UInt)(m_cpbSize*fInitialCpbFullness);
     1697  m_bufferingRate = (UInt)(((pcHrd->getBitRateValueMinus1(0, 0, 0) + 1) << (6 + pcHrd->getBitRateScale())) / iFrameRate);
     1698  printf("\nHRD - [Initial CPB state %6d] [CPB Size %6d] [Buffering Rate %6d]\n", m_cpbState, m_cpbSize, m_bufferingRate);
     1699}
     1700#endif
     1701
    16661702Void TEncRateCtrl::destroyRCGOP()
    16671703{
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncRateCtrl.h

    r1313 r1386  
    285285  TRCLCU& getLCU( Int LCUIdx )                            { return m_LCUs[LCUIdx]; }
    286286  Int  getPicActualHeaderBits()                           { return m_picActualHeaderBits; }
     287#if U0132_TARGET_BITS_SATURATION
     288  Void setBitLeft(Int bits)                               { m_bitsLeft = bits; }
     289#endif
    287290  Void setTargetBits( Int bits )                          { m_targetBits = bits; m_bitsLeft = bits;}
    288291  Void setTotalIntraCost(Double cost)                     { m_totalCostIntra = cost; }
     
    369372  Void setLayerID(Int layerid)     { m_LayerID = layerid; }
    370373#endif
     374#if U0132_TARGET_BITS_SATURATION
     375  Bool       getCpbSaturationEnabled()  { return m_CpbSaturationEnabled;  }
     376  UInt       getCpbState()              { return m_cpbState;       }
     377  UInt       getCpbSize()               { return m_cpbSize;        }
     378  UInt       getBufferingRate()         { return m_bufferingRate;  }
     379  Int        updateCpbState(Int actualBits);
     380  Void       initHrdParam(const TComHRD* pcHrd, Int iFrameRate, Double fInitialCpbFullness);
     381#endif
     382
    371383private:
    372384  TEncRCSeq* m_encRCSeq;
     
    375387  list<TEncRCPic*> m_listRCPictures;
    376388  Int        m_RCQP;
     389#if U0132_TARGET_BITS_SATURATION
     390  Bool       m_CpbSaturationEnabled;    // Enable target bits saturation to avoid CPB overflow and underflow
     391  Int        m_cpbState;                // CPB State
     392  UInt       m_cpbSize;                 // CPB size
     393  UInt       m_bufferingRate;           // Buffering rate
     394#endif
     395
    377396#if KWU_RC_MADPRED_E0227
    378397  Int m_LayerID;
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r1321 r1386  
    908908      m_signLineBuf1 = NULL;
    909909    }
    910     m_signLineBuf1 = new Char[m_lineBufWidth+1];
     910    m_signLineBuf1 = new SChar[m_lineBufWidth+1];
    911911
    912912    if (m_signLineBuf2)
     
    915915      m_signLineBuf2 = NULL;
    916916    }
    917     m_signLineBuf2 = new Char[m_lineBufWidth+1];
     917    m_signLineBuf2 = new SChar[m_lineBufWidth+1];
    918918  }
    919919
    920920  Int x,y, startX, startY, endX, endY, edgeType, firstLineStartX, firstLineEndX;
    921   Char signLeft, signRight, signDown;
     921  SChar signLeft, signRight, signDown;
    922922  Int64 *diff, *count;
    923923  Pel *srcLine, *orgLine;
     
    949949        for (y=0; y<endY; y++)
    950950        {
    951           signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]);
     951          signLeft = (SChar)sgn(srcLine[startX] - srcLine[startX-1]);
    952952          for (x=startX; x<endX; x++)
    953953          {
    954             signRight =  (Char)sgn(srcLine[x] - srcLine[x+1]);
     954            signRight =  (SChar)sgn(srcLine[x] - srcLine[x+1]);
    955955            edgeType  =  signRight + signLeft;
    956956            signLeft  = -signRight;
     
    971971            for(y=0; y<skipLinesB[typeIdx]; y++)
    972972            {
    973               signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]);
     973              signLeft = (SChar)sgn(srcLine[startX] - srcLine[startX-1]);
    974974              for (x=startX; x<endX; x++)
    975975              {
    976                 signRight =  (Char)sgn(srcLine[x] - srcLine[x+1]);
     976                signRight =  (SChar)sgn(srcLine[x] - srcLine[x+1]);
    977977                edgeType  =  signRight + signLeft;
    978978                signLeft  = -signRight;
     
    992992        diff +=2;
    993993        count+=2;
    994         Char *signUpLine = m_signLineBuf1;
     994        SChar *signUpLine = m_signLineBuf1;
    995995
    996996        startX = (!isCalculatePreDeblockSamples) ? 0
     
    10111011        for (x=startX; x<endX; x++)
    10121012        {
    1013           signUpLine[x] = (Char)sgn(srcLine[x] - srcLineAbove[x]);
     1013          signUpLine[x] = (SChar)sgn(srcLine[x] - srcLineAbove[x]);
    10141014        }
    10151015
     
    10211021          for (x=startX; x<endX; x++)
    10221022          {
    1023             signDown  = (Char)sgn(srcLine[x] - srcLineBelow[x]);
     1023            signDown  = (SChar)sgn(srcLine[x] - srcLineBelow[x]);
    10241024            edgeType  = signDown + signUpLine[x];
    10251025            signUpLine[x]= -signDown;
     
    10611061        diff +=2;
    10621062        count+=2;
    1063         Char *signUpLine, *signDownLine, *signTmpLine;
     1063        SChar *signUpLine, *signDownLine, *signTmpLine;
    10641064
    10651065        signUpLine  = m_signLineBuf1;
     
    10791079        for (x=startX; x<endX+1; x++)
    10801080        {
    1081           signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x-1]);
     1081          signUpLine[x] = (SChar)sgn(srcLineBelow[x] - srcLine[x-1]);
    10821082        }
    10831083
     
    11031103          for (x=startX; x<endX; x++)
    11041104          {
    1105             signDown = (Char)sgn(srcLine[x] - srcLineBelow[x+1]);
     1105            signDown = (SChar)sgn(srcLine[x] - srcLineBelow[x+1]);
    11061106            edgeType = signDown + signUpLine[x];
    11071107            diff [edgeType] += (orgLine[x] - srcLine[x]);
     
    11101110            signDownLine[x+1] = -signDown;
    11111111          }
    1112           signDownLine[startX] = (Char)sgn(srcLineBelow[startX] - srcLine[startX-1]);
     1112          signDownLine[startX] = (SChar)sgn(srcLineBelow[startX] - srcLine[startX-1]);
    11131113
    11141114          signTmpLine  = signUpLine;
     
    11481148        diff +=2;
    11491149        count+=2;
    1150         Char *signUpLine = m_signLineBuf1+1;
     1150        SChar *signUpLine = m_signLineBuf1+1;
    11511151
    11521152        startX = (!isCalculatePreDeblockSamples) ? (isLeftAvail  ? 0 : 1)
     
    11621162        for (x=startX-1; x<endX; x++)
    11631163        {
    1164           signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x+1]);
     1164          signUpLine[x] = (SChar)sgn(srcLineBelow[x] - srcLine[x+1]);
    11651165        }
    11661166
     
    11911191          for(x=startX; x<endX; x++)
    11921192          {
    1193             signDown = (Char)sgn(srcLine[x] - srcLineBelow[x-1]);
     1193            signDown = (SChar)sgn(srcLine[x] - srcLineBelow[x-1]);
    11941194            edgeType = signDown + signUpLine[x];
    11951195
     
    11991199            signUpLine[x-1] = -signDown;
    12001200          }
    1201           signUpLine[endX-1] = (Char)sgn(srcLineBelow[endX-1] - srcLine[endX]);
     1201          signUpLine[endX-1] = (SChar)sgn(srcLineBelow[endX-1] - srcLine[endX]);
    12021202          srcLine  += srcStride;
    12031203          orgLine  += orgStride;
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncSbac.cpp

    r1313 r1386  
    550550
    551551  xWriteUnaryMaxSymbol(iSymbol, m_cMVPIdxSCModel.get(0), 1, iNum-1);
    552 #if H_MV_ENC_DEC_TRAC
     552#if NH_MV_ENC_DEC_TRAC
    553553#if ENC_DEC_TRACE
    554554  if ( eRefList == REF_PIC_LIST_0 )
     
    606606    {
    607607      m_pcBinIf->encodeBin( eSize == SIZE_2Nx2N? 1 : 0, m_cCUPartSizeSCModel.get( 0, 0, 0 ) );
    608 #if H_MV_ENC_DEC_TRAC
     608#if NH_MV_ENC_DEC_TRAC
    609609      DTRACE_CU("part_mode", eSize == SIZE_2Nx2N? 1 : 0)
    610610#endif       
     
    613613    return;
    614614  }
    615 #if H_MV_ENC_DEC_TRAC         
     615#if NH_MV_ENC_DEC_TRAC         
    616616  DTRACE_CU("part_mode", eSize )
    617617#endif       
     
    781781  // get context function is here
    782782  m_pcBinIf->encodeBin( pcCU->isIntra( uiAbsPartIdx ) ? 1 : 0, m_cCUPredModeSCModel.get( 0, 0, 0 ) );
    783 #if H_MV_ENC_DEC_TRAC
     783#if NH_MV_ENC_DEC_TRAC
    784784  DTRACE_CU("pred_mode_flag", pcCU->isIntra( uiAbsPartIdx ) ? 1 : 0);
    785785#endif
     
    791791  UInt uiSymbol = pcCU->getCUTransquantBypass(uiAbsPartIdx);
    792792  m_pcBinIf->encodeBin( uiSymbol, m_CUTransquantBypassFlagSCModel.get( 0, 0, 0 ) );
    793 #if H_MV_ENC_DEC_TRAC
     793#if NH_MV_ENC_DEC_TRAC
    794794  DTRACE_CU("cu_transquant_bypass_flag", uiSymbol);
    795795#endif
     
    808808  UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx ) ;
    809809  m_pcBinIf->encodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) );
    810 #if !H_MV_ENC_DEC_TRAC
     810#if !NH_MV_ENC_DEC_TRAC
    811811  DTRACE_CABAC_VL( g_nSymbolCounter++ );
    812812  DTRACE_CABAC_T( "\tSkipFlag" );
     
    831831  m_pcBinIf->encodeBin( uiSymbol, *m_cCUMergeFlagExtSCModel.get( 0 ) );
    832832
    833 #if H_MV_ENC_DEC_TRAC
     833#if NH_MV_ENC_DEC_TRAC
    834834  DTRACE_PU("merge_flag", uiSymbol);
    835835#else
     
    872872      }
    873873    }
    874 #if H_MV_ENC_DEC_TRAC
     874#if NH_MV_ENC_DEC_TRAC
    875875    DTRACE_PU("merge_idx", uiUnaryIdx);
    876876#endif
    877877  }
    878 #if !H_MV_ENC_DEC_TRAC
     878#if !NH_MV_ENC_DEC_TRAC
    879879  DTRACE_CABAC_VL( g_nSymbolCounter++ );
    880880  DTRACE_CABAC_T( "\tparseMergeIndex()" );
     
    899899     m_pcBinIf->encodeBin( ( iW == iMaxW ) ? 1 : 0, m_cCUPUARPWSCModel.get( 0, 0, 2 ) );
    900900  }
    901 #if H_MV_ENC_DEC_TRAC
     901#if NH_MV_ENC_DEC_TRAC
    902902  DTRACE_CU("iv_res_pred_weight_idx", iW);
    903903#endif
     
    916916  UInt uiSymbol = pcCU->getICFlag( uiAbsPartIdx ) ? 1 : 0;
    917917  m_pcBinIf->encodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) );
    918 #if !H_MV_ENC_DEC_TRAC
     918#if !NH_MV_ENC_DEC_TRAC
    919919  DTRACE_CABAC_VL( g_nSymbolCounter++ );
    920920  DTRACE_CABAC_T( "\tICFlag" );
     
    971971
    972972  m_pcBinIf->encodeBin( uiCurrSplitFlag, m_cCUSplitFlagSCModel.get( 0, 0, uiCtx ) );
    973 #if !H_MV_ENC_DEC_TRAC
     973#if !NH_MV_ENC_DEC_TRAC
    974974  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    975975  DTRACE_CABAC_T( "\tSplitFlag\n" )
     
    983983{
    984984  m_pcBinIf->encodeBin( uiSymbol, m_cCUTransSubdivFlagSCModel.get( 0, 0, uiCtx ) );
    985 #if !H_MV_ENC_DEC_TRAC
     985#if !NH_MV_ENC_DEC_TRAC
    986986  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    987987  DTRACE_CABAC_T( "\tparseTransformSubdivFlag()" )
     
    10271027    }
    10281028    m_pcBinIf->encodeBin((predIdx[j] != -1)? 1 : 0, m_cCUIntraPredSCModel.get( 0, 0, 0 ) );
    1029 #if H_MV_ENC_DEC_TRAC
     1029#if NH_MV_ENC_DEC_TRAC
    10301030      DTRACE_CU("prev_intra_luma_pred_flag", (predIdx[j] != -1)? 1 : 0);
    10311031#endif
     
    10481048        m_pcBinIf->encodeBinEP( predIdx[j]-1 );
    10491049      }
    1050 #if H_MV_ENC_DEC_TRAC
     1050#if NH_MV_ENC_DEC_TRAC
    10511051        DTRACE_CU("mpm_idx", predIdx[j] );
    10521052#endif
     
    10711071      }
    10721072      m_pcBinIf->encodeBinsEP( dir[j], 5 );
    1073 #if H_MV_ENC_DEC_TRAC
     1073#if NH_MV_ENC_DEC_TRAC
    10741074        DTRACE_CU("rem_intra_luma_pred_mode", dir[j] );
    10751075#endif
     
    10891089  {
    10901090    m_pcBinIf->encodeBin( 0, m_cCUChromaPredSCModel.get( 0, 0, 0 ) );
    1091 #if H_MV_ENC_DEC_TRAC
     1091#if NH_MV_ENC_DEC_TRAC
    10921092    DTRACE_CU("intra_chroma_pred_mode", 0 );
    10931093#endif
     
    11101110
    11111111    m_pcBinIf->encodeBinsEP( uiIntraDirChroma, 2 );
    1112 #if H_MV_ENC_DEC_TRAC
     1112#if NH_MV_ENC_DEC_TRAC
    11131113    DTRACE_CU("intra_chroma_pred_mode", uiIntraDirChroma );
    11141114#endif
     
    11341134    m_pcBinIf->encodeBin( uiInterDir, *( pCtx + 4 ) );
    11351135  }
    1136 #if H_MV_ENC_DEC_TRAC
     1136#if NH_MV_ENC_DEC_TRAC
    11371137  DTRACE_PU("inter_pred_idc", uiInterDir );
    11381138#endif
     
    11691169    }
    11701170  }
    1171 #if H_MV_ENC_DEC_TRAC
     1171#if NH_MV_ENC_DEC_TRAC
    11721172#if ENC_DEC_TRACE
    11731173    iRefFrame = pcCU->getCUMvField( eRefList )->getRefIdx( uiAbsPartIdx );
     
    13661366
    13671367      m_pcBinIf->encodeBin(uiCbf, m_cCUQtCbfSCModel.get(0, contextSet, uiCtx));
    1368 #if !H_MV_ENC_DEC_TRAC
     1368#if !NH_MV_ENC_DEC_TRAC
    13691369      DTRACE_CABAC_VL( g_nSymbolCounter++ )
    13701370      DTRACE_CABAC_T( "\tparseQtCbf()" )
     
    14001400    const UInt uiCbf = pcCU->getCbf( absPartIdx, compID, lowestTUDepth );
    14011401    m_pcBinIf->encodeBin( uiCbf , m_cCUQtCbfSCModel.get( 0, contextSet, uiCtx ) );
    1402 #if !H_MV_ENC_DEC_TRAC
     1402#if !NH_MV_ENC_DEC_TRAC
    14031403    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    14041404    DTRACE_CABAC_T( "\tparseQtCbf()" )
     
    14481448  UInt useTransformSkip = pcCU->getTransformSkip( uiAbsPartIdx,component);
    14491449  m_pcBinIf->encodeBin( useTransformSkip, m_cTransformSkipSCModel.get( 0, toChannelType(component), 0 ) );
    1450 #if !H_MV_ENC_DEC_TRAC
     1450#if !NH_MV_ENC_DEC_TRAC
    14511451  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    14521452  DTRACE_CABAC_T("\tparseTransformSkip()");
     
    14761476
    14771477  m_pcBinIf->encodeBinTrm (uiIPCM);
    1478 #if H_MV_ENC_DEC_TRAC         
     1478#if NH_MV_ENC_DEC_TRAC         
    14791479  DTRACE_CU("pcm_flag", uiIPCM)
    14801480#endif
     
    15121512  UInt uiCtx = 0;
    15131513  m_pcBinIf->encodeBin( uiCbf , m_cCUQtRootCbfSCModel.get( 0, 0, uiCtx ) );
    1514 #if !H_MV_ENC_DEC_TRAC
     1514#if !NH_MV_ENC_DEC_TRAC
    15151515  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    15161516  DTRACE_CABAC_T( "\tparseQtRootCbf()" )
     
    16291629  const UInt uiHeight=tuRect.height;
    16301630  const TComSPS &sps=*(pcCU->getSlice()->getSPS());
    1631 #if !H_MV_ENC_DEC_TRAC
     1631#if !NH_MV_ENC_DEC_TRAC
    16321632
    16331633  DTRACE_CABAC_VL( g_nSymbolCounter++ )
     
    25262526Void TEncSbac::xCodeDeltaDC( Pel valDeltaDC, UInt uiNumSeg )
    25272527{
    2528 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     2528#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    25292529  DTRACE_CU("delta_dc", valDeltaDC);
    25302530#endif
     
    26182618{
    26192619  UInt uiSymbol = pcCU->getSDCFlag( uiAbsPartIdx ) ? 1 : 0;
    2620 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     2620#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    26212621  DTRACE_CU("dc_only_flag", uiSymbol)
    26222622#endif
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncSearch.cpp

    r1321 r1386  
    7474};
    7575
    76 static const UInt s_auiDFilter[9] =
    77 {
    78   0, 1, 0,
    79   2, 3, 2,
    80   0, 1, 0
    81 };
    82 
    8376static Void offsetSubTUCBFs(TComTU &rTu, const ComponentID compID)
    8477{
     
    120113, m_iSearchRange (0)
    121114, m_bipredSearchRange (0)
    122 , m_iFastSearch (0)
     115, m_motionEstimationSearchMethod (MESEARCH_FULL)
    123116, m_pppcRDSbacCoder (NULL)
    124117, m_pcRDGoOnSbacCoder (NULL)
    125118, m_pTempPel (NULL)
    126 , m_puiDFilter (NULL)
    127119, m_isInitialized (false)
    128120{
     
    130122  {
    131123    m_ppcQTTempCoeff[ch]                           = NULL;
    132     m_pcQTTempCoeff[ch]                            = NULL;
    133124#if ADAPTIVE_QP_SELECTION
    134125    m_ppcQTTempArlCoeff[ch]                        = NULL;
    135     m_pcQTTempArlCoeff[ch]                         = NULL;
    136126#endif
    137127    m_puhQTTempCbf[ch]                             = NULL;
     
    181171      }
    182172      delete[] m_ppcQTTempCoeff[ch];
    183       delete[] m_pcQTTempCoeff[ch];
    184173      delete[] m_puhQTTempCbf[ch];
    185174#if ADAPTIVE_QP_SELECTION
    186175      delete[] m_ppcQTTempArlCoeff[ch];
    187       delete[] m_pcQTTempArlCoeff[ch];
    188176#endif
    189177    }
     
    229217                      Int           iSearchRange,
    230218                      Int           bipredSearchRange,
    231                       Int           iFastSearch,
     219                      MESearchMethod motionEstimationSearchMethod,
    232220                      const UInt    maxCUWidth,
    233221                      const UInt    maxCUHeight,
     
    244232  m_iSearchRange         = iSearchRange;
    245233  m_bipredSearchRange    = bipredSearchRange;
    246   m_iFastSearch          = iFastSearch;
     234  m_motionEstimationSearchMethod = motionEstimationSearchMethod;
    247235  m_pcEntropyCoder       = pcEntropyCoder;
    248236  m_pcRdCost             = pcRdCost;
     
    258246    }
    259247  }
    260 
    261   m_puiDFilter = s_auiDFilter + 4;
    262248
    263249  // initialize motion cost
     
    289275    const UInt csy=::getComponentScaleY(ComponentID(ch), cform);
    290276    m_ppcQTTempCoeff[ch] = new TCoeff* [uiNumLayersToAllocate];
    291     m_pcQTTempCoeff[ch]   = new TCoeff [(maxCUWidth*maxCUHeight)>>(csx+csy)   ];
    292277#if ADAPTIVE_QP_SELECTION
    293278    m_ppcQTTempArlCoeff[ch]  = new TCoeff*[uiNumLayersToAllocate];
    294     m_pcQTTempArlCoeff[ch]   = new TCoeff [(maxCUWidth*maxCUHeight)>>(csx+csy)   ];
    295279#endif
    296280    m_puhQTTempCbf[ch] = new UChar  [uiNumPartitions];
     
    304288    }
    305289
    306     m_phQTTempCrossComponentPredictionAlpha[ch]    = new Char  [uiNumPartitions];
     290    m_phQTTempCrossComponentPredictionAlpha[ch]    = new SChar  [uiNumPartitions];
    307291    m_pSharedPredTransformSkip[ch]                 = new Pel   [MAX_CU_SIZE*MAX_CU_SIZE];
    308292    m_pcQTTempTUCoeff[ch]                          = new TCoeff[MAX_CU_SIZE*MAX_CU_SIZE];
     
    323307}
    324308
    325 #define TZ_SEARCH_CONFIGURATION                                                                                 \
    326 const Int  iRaster                  = 5;  /* TZ soll von aussen ?ergeben werden */                            \
    327 const Bool bTestOtherPredictedMV    = 0;                                                                      \
    328 const Bool bTestZeroVector          = 1;                                                                      \
    329 const Bool bTestZeroVectorStart     = 0;                                                                      \
    330 const Bool bTestZeroVectorStop      = 0;                                                                      \
    331 const Bool bFirstSearchDiamond      = 1;  /* 1 = xTZ8PointDiamondSearch   0 = xTZ8PointSquareSearch */        \
    332 const Bool bFirstSearchStop         = m_pcEncCfg->getFastMEAssumingSmootherMVEnabled();                       \
    333 const UInt uiFirstSearchRounds      = 3;  /* first search stop X rounds after best match (must be >=1) */     \
    334 const Bool bEnableRasterSearch      = 1;                                                                      \
    335 const Bool bAlwaysRasterSearch      = 0;  /* ===== 1: BETTER but factor 2 slower ===== */                     \
    336 const Bool bRasterRefinementEnable  = 0;  /* enable either raster refinement or star refinement */            \
    337 const Bool bRasterRefinementDiamond = 0;  /* 1 = xTZ8PointDiamondSearch   0 = xTZ8PointSquareSearch */        \
    338 const Bool bStarRefinementEnable    = 1;  /* enable either star refinement or raster refinement */            \
    339 const Bool bStarRefinementDiamond   = 1;  /* 1 = xTZ8PointDiamondSearch   0 = xTZ8PointSquareSearch */        \
    340 const Bool bStarRefinementStop      = 0;                                                                      \
    341 const UInt uiStarRefinementRounds   = 2;  /* star refinement stop X rounds after best match (must be >=1) */  \
    342 
    343 
    344 #define SEL_SEARCH_CONFIGURATION                                                                                 \
    345   const Bool bTestOtherPredictedMV    = 1;                                                                       \
    346   const Bool bTestZeroVector          = 1;                                                                       \
    347   const Bool bEnableRasterSearch      = 1;                                                                       \
    348   const Bool bAlwaysRasterSearch      = 0;  /* ===== 1: BETTER but factor 15x slower ===== */                    \
    349   const Bool bStarRefinementEnable    = 1;  /* enable either star refinement or raster refinement */             \
    350   const Bool bStarRefinementDiamond   = 1;  /* 1 = xTZ8PointDiamondSearch   0 = xTZ8PointSquareSearch */         \
    351   const Bool bStarRefinementStop      = 0;                                                                       \
    352   const UInt uiStarRefinementRounds   = 2;  /* star refinement stop X rounds after best match (must be >=1) */   \
    353   const UInt uiSearchRange            = m_iSearchRange;                                                          \
    354   const Int  uiSearchRangeInitial     = m_iSearchRange >> 2;                                                     \
    355   const Int  uiSearchStep             = 4;                                                                       \
    356   const Int  iMVDistThresh            = 8;                                                                       \
    357 
    358 
    359 
    360 __inline Void TEncSearch::xTZSearchHelp( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance )
     309
     310
     311
     312__inline Void TEncSearch::xTZSearchHelp( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance )
    361313{
    362314  Distortion  uiSad = 0;
    363315
    364   Pel*  piRefSrch;
    365 
    366   piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX;
     316  const Pel* const  piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX;
     317
    367318#if NH_3D_IC
    368319  m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     
    374325  m_pcRdCost->setDistParam( pcPatternKey, piRefSrch, rcStruct.iYStride,  m_cDistParam );
    375326
    376   if(m_pcEncCfg->getFastSearch() != SELECTIVE)
    377   {
    378     // fast encoder decision: use subsampled SAD when rows > 8 for integer ME
    379     if ( m_pcEncCfg->getUseFastEnc() )
    380     {
    381       if ( m_cDistParam.iRows > 8 )
    382       {
    383         m_cDistParam.iSubShift = 1;
    384       }
    385     }
    386   }
    387 
    388327  setDistParamComp(COMPONENT_Y);
    389328
    390329  // distortion
    391330  m_cDistParam.bitDepth = pcPatternKey->getBitDepthY();
    392   if(m_pcEncCfg->getFastSearch() == SELECTIVE)
     331  m_cDistParam.m_maximumDistortionForEarlyExit = rcStruct.uiBestSad;
     332
     333  if((m_pcEncCfg->getRestrictMESampling() == false) && m_pcEncCfg->getMotionEstimationSearchMethod() == MESEARCH_SELECTIVE)
    393334  {
    394335    Int isubShift = 0;
    395336    // motion cost
    396     Distortion uiBitCost = m_pcRdCost->getCost( iSearchX, iSearchY );
    397 
     337    Distortion uiBitCost = m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY );
     338
     339    // Skip search if bit cost is already larger than best SAD
     340    if (uiBitCost < rcStruct.uiBestSad)
     341    {
    398342    if ( m_cDistParam.iRows > 32 )
    399343    {
     
    443387          rcStruct.uiBestRound    = 0;
    444388          rcStruct.ucPointNr      = ucPointNr;
     389            m_cDistParam.m_maximumDistortionForEarlyExit = uiSad;
     390          }
    445391        }
    446392      }
     
    449395  else
    450396  {
     397    // fast encoder decision: use subsampled SAD when rows > 8 for integer ME
     398    if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE3 )
     399    {
     400      if ( m_cDistParam.iRows > 8 )
     401      {
     402        m_cDistParam.iSubShift = 1;
     403      }
     404    }
     405
    451406    uiSad = m_cDistParam.DistFunc( &m_cDistParam );
    452407
     408    // only add motion cost if uiSad is smaller than best. Otherwise pointless
     409    // to add motion cost.
     410    if( uiSad < rcStruct.uiBestSad )
     411    {
    453412    // motion cost
    454     uiSad += m_pcRdCost->getCost( iSearchX, iSearchY );
     413      uiSad += m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY );
    455414
    456415    if( uiSad < rcStruct.uiBestSad )
     
    462421      rcStruct.uiBestRound    = 0;
    463422      rcStruct.ucPointNr      = ucPointNr;
     423        m_cDistParam.m_maximumDistortionForEarlyExit = uiSad;
     424      }
    464425    }
    465426  }
     
    469430
    470431
    471 __inline Void TEncSearch::xTZ2PointSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB )
     432__inline Void TEncSearch::xTZ2PointSearch( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB )
    472433{
    473434  Int   iSrchRngHorLeft   = pcMvSrchRngLT->getHor();
     
    602563
    603564
    604 __inline Void TEncSearch::xTZ8PointSquareSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist )
     565__inline Void TEncSearch::xTZ8PointSquareSearch( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist )
    605566{
    606   Int   iSrchRngHorLeft   = pcMvSrchRngLT->getHor();
    607   Int   iSrchRngHorRight  = pcMvSrchRngRB->getHor();
    608   Int   iSrchRngVerTop    = pcMvSrchRngLT->getVer();
    609   Int   iSrchRngVerBottom = pcMvSrchRngRB->getVer();
     567  const Int   iSrchRngHorLeft   = pcMvSrchRngLT->getHor();
     568  const Int   iSrchRngHorRight  = pcMvSrchRngRB->getHor();
     569  const Int   iSrchRngVerTop    = pcMvSrchRngLT->getVer();
     570  const Int   iSrchRngVerBottom = pcMvSrchRngRB->getVer();
    610571
    611572  // 8 point search,                   //   1 2 3
     
    660621
    661622
    662 __inline Void TEncSearch::xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist )
     623__inline Void TEncSearch::xTZ8PointDiamondSearch( const TComPattern*const  pcPatternKey,
     624                                                  IntTZSearchStruct& rcStruct,
     625                                                  const TComMv*const  pcMvSrchRngLT,
     626                                                  const TComMv*const  pcMvSrchRngRB,
     627                                                  const Int iStartX,
     628                                                  const Int iStartY,
     629                                                  const Int iDist,
     630                                                  const Bool bCheckCornersAtDist1 )
    663631{
    664   Int   iSrchRngHorLeft   = pcMvSrchRngLT->getHor();
    665   Int   iSrchRngHorRight  = pcMvSrchRngRB->getHor();
    666   Int   iSrchRngVerTop    = pcMvSrchRngLT->getVer();
    667   Int   iSrchRngVerBottom = pcMvSrchRngRB->getVer();
     632  const Int   iSrchRngHorLeft   = pcMvSrchRngLT->getHor();
     633  const Int   iSrchRngHorRight  = pcMvSrchRngRB->getHor();
     634  const Int   iSrchRngVerTop    = pcMvSrchRngLT->getVer();
     635  const Int   iSrchRngVerBottom = pcMvSrchRngRB->getVer();
    668636
    669637  // 8 point search,                   //   1 2 3
     
    677645  rcStruct.uiBestRound += 1;
    678646
    679   if ( iDist == 1 ) // iDist == 1
     647  if ( iDist == 1 )
    680648  {
    681649    if ( iTop >= iSrchRngVerTop ) // check top
    682650    {
     651      if (bCheckCornersAtDist1)
     652      {
     653        if ( iLeft >= iSrchRngHorLeft) // check top-left
     654        {
     655          xTZSearchHelp( pcPatternKey, rcStruct, iLeft, iTop, 1, iDist );
     656        }
     657        xTZSearchHelp( pcPatternKey, rcStruct, iStartX, iTop, 2, iDist );
     658        if ( iRight <= iSrchRngHorRight ) // check middle right
     659        {
     660          xTZSearchHelp( pcPatternKey, rcStruct, iRight, iTop, 3, iDist );
     661        }
     662      }
     663      else
     664      {
    683665      xTZSearchHelp( pcPatternKey, rcStruct, iStartX, iTop, 2, iDist );
    684666    }
     667    }
    685668    if ( iLeft >= iSrchRngHorLeft ) // check middle left
    686669    {
     
    693676    if ( iBottom <= iSrchRngVerBottom ) // check bottom
    694677    {
     678      if (bCheckCornersAtDist1)
     679      {
     680        if ( iLeft >= iSrchRngHorLeft) // check top-left
     681        {
     682          xTZSearchHelp( pcPatternKey, rcStruct, iLeft, iBottom, 6, iDist );
     683        }
     684        xTZSearchHelp( pcPatternKey, rcStruct, iStartX, iBottom, 7, iDist );
     685        if ( iRight <= iSrchRngHorRight ) // check middle right
     686        {
     687          xTZSearchHelp( pcPatternKey, rcStruct, iRight, iBottom, 8, iDist );
     688        }
     689      }
     690      else
     691      {
    695692      xTZSearchHelp( pcPatternKey, rcStruct, iStartX, iBottom, 7, iDist );
    696693    }
    697694  }
    698   else // if (iDist != 1)
     695  }
     696  else
    699697  {
    700698    if ( iDist <= 8 )
     
    770768        for ( Int index = 1; index < 4; index++ )
    771769        {
    772           Int iPosYT = iTop    + ((iDist>>2) * index);
    773           Int iPosYB = iBottom - ((iDist>>2) * index);
    774           Int iPosXL = iStartX - ((iDist>>2) * index);
    775           Int iPosXR = iStartX + ((iDist>>2) * index);
     770          const Int iPosYT = iTop    + ((iDist>>2) * index);
     771          const Int iPosYB = iBottom - ((iDist>>2) * index);
     772          const Int iPosXL = iStartX - ((iDist>>2) * index);
     773          const Int iPosXR = iStartX + ((iDist>>2) * index);
    776774          xTZSearchHelp( pcPatternKey, rcStruct, iPosXL, iPosYT, 0, iDist );
    777775          xTZSearchHelp( pcPatternKey, rcStruct, iPosXR, iPosYT, 0, iDist );
     
    800798        for ( Int index = 1; index < 4; index++ )
    801799        {
    802           Int iPosYT = iTop    + ((iDist>>2) * index);
    803           Int iPosYB = iBottom - ((iDist>>2) * index);
    804           Int iPosXL = iStartX - ((iDist>>2) * index);
    805           Int iPosXR = iStartX + ((iDist>>2) * index);
     800          const Int iPosYT = iTop    + ((iDist>>2) * index);
     801          const Int iPosYB = iBottom - ((iDist>>2) * index);
     802          const Int iPosXL = iStartX - ((iDist>>2) * index);
     803          const Int iPosXR = iStartX + ((iDist>>2) * index);
    806804
    807805          if ( iPosYT >= iSrchRngVerTop ) // check top
     
    833831}
    834832
    835 
    836 
    837 
    838 
    839 //<--
    840 
    841833Distortion TEncSearch::xPatternRefinement( TComPattern* pcPatternKey,
    842834                                           TComMv baseRefMv,
     
    886878    m_cDistParam.bitDepth = pcPatternKey->getBitDepthY();
    887879    uiDist = m_cDistParam.DistFunc( &m_cDistParam );
    888     uiDist += m_pcRdCost->getCost( cMvTest.getHor(), cMvTest.getVer() );
     880    uiDist += m_pcRdCost->getCostOfVectorWithPredictor( cMvTest.getHor(), cMvTest.getVer() );
    889881
    890882    if ( uiDist < uiDistBest )
     
    892884      uiDistBest  = uiDist;
    893885      uiDirecBest = i;
     886      m_cDistParam.m_maximumDistortionForEarlyExit = uiDist;
    894887    }
    895888  }
     
    24102403}
    24112404
    2412 Char
     2405SChar
    24132406TEncSearch::xCalcCrossComponentPredictionAlpha(       TComTU &rTu,
    24142407                                                const ComponentID compID,
     
    24272420  const Int diffBitDepth = pCU->getSlice()->getSPS()->getDifferentialLumaChromaBitDepth();
    24282421
    2429   Char alpha = 0;
     2422  SChar alpha = 0;
    24302423  Int SSxy  = 0;
    24312424  Int SSxx  = 0;
     
    24472440  {
    24482441    Double dAlpha = SSxy / Double( SSxx );
    2449     alpha = Char(Clip3<Int>(-16, 16, (Int)(dAlpha * 16)));
    2450 
    2451     static const Char alphaQuant[17] = {0, 1, 1, 2, 2, 2, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8};
     2442    alpha = SChar(Clip3<Int>(-16, 16, (Int)(dAlpha * 16)));
     2443
     2444    static const SChar alphaQuant[17] = {0, 1, 1, 2, 2, 2, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8};
    24522445
    24532446    alpha = (alpha < 0) ? -alphaQuant[Int(-alpha)] : alphaQuant[Int(alpha)];
     
    25402533        Double     singleCostTmp             = 0;
    25412534        UInt       singleCbfCTmp             = 0;
    2542         Char       bestCrossCPredictionAlpha = 0;
     2535        SChar      bestCrossCPredictionAlpha = 0;
    25432536        Int        bestTransformSkipMode     = 0;
    25442537
     
    36893682              ::memcpy( m_puhQTTempCbf[compID], pcCU->getCbf( compID )+uiPartOffset, uiQPartNum * sizeof( UChar ) );
    36903683              ::memcpy( m_puhQTTempTransformSkipFlag[compID], pcCU->getTransformSkip( compID )+uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3691               ::memcpy( m_phQTTempCrossComponentPredictionAlpha[compID], pcCU->getCrossComponentPredictionAlpha(compID)+uiPartOffset, uiQPartNum * sizeof( Char ) );
     3684              ::memcpy( m_phQTTempCrossComponentPredictionAlpha[compID], pcCU->getCrossComponentPredictionAlpha(compID)+uiPartOffset, uiQPartNum * sizeof( SChar ) );
    36923685            }
    36933686          }
     
    37023695          ::memcpy( pcCU->getCbf( compID )+uiPartOffset, m_puhQTTempCbf[compID], uiQPartNum * sizeof( UChar ) );
    37033696          ::memcpy( pcCU->getTransformSkip( compID )+uiPartOffset, m_puhQTTempTransformSkipFlag[compID], uiQPartNum * sizeof( UChar ) );
    3704           ::memcpy( pcCU->getCrossComponentPredictionAlpha(compID)+uiPartOffset, m_phQTTempCrossComponentPredictionAlpha[compID], uiQPartNum * sizeof( Char ) );
     3697          ::memcpy( pcCU->getCrossComponentPredictionAlpha(compID)+uiPartOffset, m_phQTTempCrossComponentPredictionAlpha[compID], uiQPartNum * sizeof( SChar ) );
    37053698        }
    37063699      }
     
    38123805{
    38133806  UInt        uiDepth      = pcCU->getDepth(0);
    3814   const UInt  uiDistortion = 0;
     3807  const Distortion  uiDistortion = 0;
    38153808  UInt        uiBits;
    38163809
     
    43254318            /*correct the bit-rate part of the current ref*/
    43264319            m_pcRdCost->setPredictor  ( cMvPred[iRefList][iRefIdxTemp] );
    4327             uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );
     4320            uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );
    43284321            /*calculate the correct cost*/
    43294322            uiCostTemp += m_pcRdCost->getCost( uiBitsTemp );
     
    43744367    }
    43754368
    4376     //  Bi-directional prediction
     4369    //  Bi-predictive Motion estimation
    43774370    if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) )
    43784371    {
     
    44294422
    44304423      // fast encoder setting: only one iteration
    4431       if ( m_pcEncCfg->getUseFastEnc() || pcCU->getSlice()->getMvdL1ZeroFlag())
     4424      if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE2 || pcCU->getSlice()->getMvdL1ZeroFlag() )
    44324425      {
    44334426        iNumIter = 1;
     
    44384431        Int         iRefList    = iIter % 2;
    44394432
    4440         if ( m_pcEncCfg->getUseFastEnc() )
     4433        if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE2 )
    44414434        {
    44424435          if( uiCost[0] <= uiCost[1] )
     
    46294622      TComMvField cMEMvField[2];
    46304623
    4631       m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
     4624      m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
    46324625
    46334626#if AMP_MRG
     
    46524645      // save ME result.
    46534646      uiMEInterDir = pcCU->getInterDir( uiPartAddr );
    4654       pcCU->getMvField( pcCU, uiPartAddr, REF_PIC_LIST_0, cMEMvField[0] );
    4655       pcCU->getMvField( pcCU, uiPartAddr, REF_PIC_LIST_1, cMEMvField[1] );
     4647      TComDataCU::getMvField( pcCU, uiPartAddr, REF_PIC_LIST_0, cMEMvField[0] );
     4648      TComDataCU::getMvField( pcCU, uiPartAddr, REF_PIC_LIST_1, cMEMvField[1] );
    46564649
    46574650      // find Merge result
     
    50405033  }
    50415034
    5042   m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(0) );
     5035  m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(0) );
    50435036  m_pcRdCost->setCostScale ( 0    );
    50445037
     
    50465039
    50475040  m_pcRdCost->setPredictor( rcMvPred );
    5048   Int iOrgMvBits  = m_pcRdCost->getBits(cMv.getHor(), cMv.getVer());
     5041  Int iOrgMvBits  = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer());
    50495042  iOrgMvBits += m_auiMVPIdxCost[riMVPIdx][AMVP_MAX_NUM_CANDS];
    50505043  Int iBestMvBits = iOrgMvBits;
     
    50595052    m_pcRdCost->setPredictor( pcAMVPInfo->m_acMvCand[iMVPIdx] );
    50605053
    5061     Int iMvBits = m_pcRdCost->getBits(cMv.getHor(), cMv.getVer());
     5054    Int iMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer());
    50625055    iMvBits += m_auiMVPIdxCost[iMVPIdx][AMVP_MAX_NUM_CANDS];
    50635056
     
    51345127
    51355128  uiCost = m_pcRdCost->getDistPart( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), pcTemplateCand->getAddr(COMPONENT_Y, uiPartAddr), pcTemplateCand->getStride(COMPONENT_Y), pcOrgYuv->getAddr(COMPONENT_Y, uiPartAddr), pcOrgYuv->getStride(COMPONENT_Y), iSizeX, iSizeY, COMPONENT_Y, DF_SAD );
    5136   uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, false, DF_SAD );
     5129  uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, DF_SAD );
    51375130  return uiCost;
    51385131}
     
    51765169#endif
    51775170
    5178   if ( bBi )
     5171  if ( bBi ) // Bipredictive ME
    51795172  {
    51805173    TComYuv*  pcYuvOther = &m_acYuvPred[1-(Int)eRefPicList];
     
    51875180    fWeight = 0.5;
    51885181  }
     5182  m_cDistParam.bIsBiPred = bBi;
    51895183
    51905184  //  Search key pattern initialization
     
    52125206  }
    52135207
    5214   m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
     5208  m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
    52155209
    52165210  m_pcRdCost->setPredictor  ( *pcMvPred );
     
    52315225  setWpScalingDistParam( pcCU, iRefIdxPred, eRefPicList );
    52325226  //  Do integer search
    5233   if ( !m_iFastSearch || bBi )
     5227  if ( (m_motionEstimationSearchMethod==MESEARCH_FULL) || bBi )
    52345228  {
    52355229    xPatternSearch      ( pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost );
     
    52505244  }
    52515245
    5252   m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
     5246  m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
    52535247#if NH_3D_INTEGER_MV_DEPTH
    52545248  if( ! pcCU->getSlice()->getIsDepth() )
     
    52685262#endif
    52695263
    5270   UInt uiMvBits = m_pcRdCost->getBits( rcMv.getHor(), rcMv.getVer() );
     5264  UInt uiMvBits = m_pcRdCost->getBitsOfVectorWithPredictor( rcMv.getHor(), rcMv.getVer() );
    52715265#if NH_3D_INTEGER_MV_DEPTH
    52725266  if( pcCU->getSlice()->getIsDepth() )
     
    52855279
    52865280
    5287 Void TEncSearch::xSetSearchRange ( TComDataCU* pcCU, TComMv& cMvPred, Int iSrchRng, TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB )
     5281Void TEncSearch::xSetSearchRange ( const TComDataCU* const pcCU, const TComMv& cMvPred, const Int iSrchRng,
     5282                                   TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB )
    52885283{
    52895284  Int  iMvShift = 2;
     
    53175312  pcCU->clipMv        ( rcMvSrchRngRB );
    53185313
     5314#if ME_ENABLE_ROUNDING_OF_MVS
     5315  rcMvSrchRngLT.divideByPowerOf2(iMvShift);
     5316  rcMvSrchRngRB.divideByPowerOf2(iMvShift);
     5317#else
    53195318  rcMvSrchRngLT >>= iMvShift;
    53205319  rcMvSrchRngRB >>= iMvShift;
     5320#endif
    53215321}
    53225322
    53235323
    5324 
    5325 
    5326 Void TEncSearch::xPatternSearch( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, TComMv& rcMv, Distortion& ruiSAD )
     5324Void TEncSearch::xPatternSearch( const TComPattern* const pcPatternKey,
     5325                                 const Pel*               piRefY,
     5326                                 const Int                iRefStride,
     5327                                 const TComMv* const      pcMvSrchRngLT,
     5328                                 const TComMv* const      pcMvSrchRngRB,
     5329                                 TComMv&      rcMv,
     5330                                 Distortion&  ruiSAD )
    53275331{
    53285332  Int   iSrchRngHorLeft   = pcMvSrchRngLT->getHor();
     
    53365340  Int         iBestY = 0;
    53375341
    5338   Pel*  piRefSrch;
    5339 
    53405342  //-- jclee for using the SAD function pointer
    53415343  m_pcRdCost->setDistParam( pcPatternKey, piRefY, iRefStride,  m_cDistParam );
    53425344
    53435345  // fast encoder decision: use subsampled SAD for integer ME
    5344   if ( m_pcEncCfg->getUseFastEnc() )
     5346  if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE3 )
    53455347  {
    53465348    if ( m_cDistParam.iRows > 8 )
     
    53565358    {
    53575359      //  find min. distortion position
    5358       piRefSrch = piRefY + x;
    5359       m_cDistParam.pCur = piRefSrch;
     5360      m_cDistParam.pCur = piRefY + x;
    53605361
    53615362      setDistParamComp(COMPONENT_Y);
     
    53735374
    53745375      // motion cost
    5375       uiSad += m_pcRdCost->getCost( x, y );
     5376      uiSad += m_pcRdCost->getCostOfVectorWithPredictor( x, y );
    53765377
    53775378      if ( uiSad < uiSadBest )
     
    53805381        iBestX    = x;
    53815382        iBestY    = y;
     5383        m_cDistParam.m_maximumDistortionForEarlyExit = uiSad;
    53825384      }
    53835385    }
     
    53875389  rcMv.set( iBestX, iBestY );
    53885390
    5389   ruiSAD = uiSadBest - m_pcRdCost->getCost( iBestX, iBestY );
     5391  ruiSAD = uiSadBest - m_pcRdCost->getCostOfVectorWithPredictor( iBestX, iBestY );
    53905392  return;
    53915393}
     
    53935395
    53945396
    5395 Void TEncSearch::xPatternSearchFast( TComDataCU*   pcCU,
    5396                                      TComPattern* pcPatternKey,
    5397                                      Pel*          piRefY,
    5398                                      Int           iRefStride,
    5399                                      TComMv*       pcMvSrchRngLT,
    5400                                      TComMv*       pcMvSrchRngRB,
     5397Void TEncSearch::xPatternSearchFast( const TComDataCU* const  pcCU,
     5398                                     const TComPattern* const pcPatternKey,
     5399                                     const Pel* const         piRefY,
     5400                                     const Int                iRefStride,
     5401                                     const TComMv* const      pcMvSrchRngLT,
     5402                                     const TComMv* const      pcMvSrchRngRB,
    54015403                                     TComMv       &rcMv,
    54025404                                     Distortion   &ruiSAD,
    5403                                      const TComMv* pIntegerMv2Nx2NPred )
     5405                                     const TComMv* const      pIntegerMv2Nx2NPred )
    54045406{
    54055407  assert (MD_LEFT < NUM_MV_PREDICTORS);
     
    54105412  pcCU->getMvPredAboveRight ( m_acMvPredictors[MD_ABOVE_RIGHT] );
    54115413
    5412   switch ( m_iFastSearch )
    5413   {
    5414     case 1:
    5415       xTZSearch( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred );
     5414  switch ( m_motionEstimationSearchMethod )
     5415  {
     5416    case MESEARCH_DIAMOND:
     5417      xTZSearch( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred, false );
    54165418      break;
    54175419
    5418     case 2:
     5420    case MESEARCH_SELECTIVE:
    54195421      xTZSearchSelective( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred );
    54205422      break;
     5423
     5424    case MESEARCH_DIAMOND_ENHANCED:
     5425      xTZSearch( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred, true );
     5426      break;
     5427
     5428    case MESEARCH_FULL: // shouldn't get here.
    54215429    default:
    54225430      break;
     
    54275435
    54285436
    5429 Void TEncSearch::xTZSearch( TComDataCU* pcCU,
    5430                             TComPattern* pcPatternKey,
    5431                             Pel*         piRefY,
    5432                             Int          iRefStride,
    5433                             TComMv*      pcMvSrchRngLT,
    5434                             TComMv*      pcMvSrchRngRB,
     5437Void TEncSearch::xTZSearch( const TComDataCU* const pcCU,
     5438                            const TComPattern* const pcPatternKey,
     5439                            const Pel* const         piRefY,
     5440                            const Int                iRefStride,
     5441                            const TComMv* const      pcMvSrchRngLT,
     5442                            const TComMv* const      pcMvSrchRngRB,
    54355443                            TComMv      &rcMv,
    54365444                            Distortion  &ruiSAD,
    5437                             const TComMv* pIntegerMv2Nx2NPred )
     5445                            const TComMv* const      pIntegerMv2Nx2NPred,
     5446                            const Bool               bExtendedSettings)
    54385447{
    5439   Int   iSrchRngHorLeft   = pcMvSrchRngLT->getHor();
    5440   Int   iSrchRngHorRight  = pcMvSrchRngRB->getHor();
    5441   Int   iSrchRngVerTop    = pcMvSrchRngLT->getVer();
    5442   Int   iSrchRngVerBottom = pcMvSrchRngRB->getVer();
    5443 
    5444   TZ_SEARCH_CONFIGURATION
     5448  const Bool bUseAdaptiveRaster                      = bExtendedSettings;
     5449  const Int  iRaster                                 = 5;
     5450  const Bool bTestOtherPredictedMV                   = bExtendedSettings;
     5451  const Bool bTestZeroVector                         = true;
     5452  const Bool bTestZeroVectorStart                    = bExtendedSettings;
     5453  const Bool bTestZeroVectorStop                     = false;
     5454  const Bool bFirstSearchDiamond                     = true;  // 1 = xTZ8PointDiamondSearch   0 = xTZ8PointSquareSearch
     5455  const Bool bFirstCornersForDiamondDist1            = bExtendedSettings;
     5456  const Bool bFirstSearchStop                        = m_pcEncCfg->getFastMEAssumingSmootherMVEnabled();
     5457  const UInt uiFirstSearchRounds                     = 3;     // first search stop X rounds after best match (must be >=1)
     5458  const Bool bEnableRasterSearch                     = true;
     5459  const Bool bAlwaysRasterSearch                     = bExtendedSettings;  // true: BETTER but factor 2 slower
     5460  const Bool bRasterRefinementEnable                 = false; // enable either raster refinement or star refinement
     5461  const Bool bRasterRefinementDiamond                = false; // 1 = xTZ8PointDiamondSearch   0 = xTZ8PointSquareSearch
     5462  const Bool bRasterRefinementCornersForDiamondDist1 = bExtendedSettings;
     5463  const Bool bStarRefinementEnable                   = true;  // enable either star refinement or raster refinement
     5464  const Bool bStarRefinementDiamond                  = true;  // 1 = xTZ8PointDiamondSearch   0 = xTZ8PointSquareSearch
     5465  const Bool bStarRefinementCornersForDiamondDist1   = bExtendedSettings;
     5466  const Bool bStarRefinementStop                     = false;
     5467  const UInt uiStarRefinementRounds                  = 2;  // star refinement stop X rounds after best match (must be >=1)
     5468  const Bool bNewZeroNeighbourhoodTest               = bExtendedSettings;
    54455469
    54465470  UInt uiSearchRange = m_iSearchRange;
     
    54495473  if( ! pcCU->getSlice()->getIsDepth() )
    54505474#endif
     5475#if ME_ENABLE_ROUNDING_OF_MVS
     5476  rcMv.divideByPowerOf2(2);
     5477#else
    54515478  rcMv >>= 2;
     5479#endif
     5480
    54525481  // init TZSearchStruct
    54535482  IntTZSearchStruct cStruct;
     
    54705499      {     
    54715500#endif
    5472         cMv >>= 2;
     5501#if ME_ENABLE_ROUNDING_OF_MVS
     5502      cMv.divideByPowerOf2(2);
     5503#else
     5504      cMv >>= 2;
     5505#endif
     5506
    54735507#if NH_3D_INTEGER_MV_DEPTH
    54745508      }
    54755509#endif
    5476 
     5510      if (cMv != rcMv && (cMv.getHor() != cStruct.iBestX && cMv.getVer() != cStruct.iBestY))
     5511      {
     5512        // only test cMV if not obviously previously tested.
    54775513      xTZSearchHelp( pcPatternKey, cStruct, cMv.getHor(), cMv.getVer(), 0, 0 );
    54785514    }
     5515  }
    54795516  }
    54805517
     
    54825519  if ( bTestZeroVector )
    54835520  {
     5521    if ((rcMv.getHor() != 0 || rcMv.getVer() != 0) &&
     5522        (0 != cStruct.iBestX || 0 != cStruct.iBestY))
     5523    {
     5524      // only test 0-vector if not obviously previously tested.
    54845525    xTZSearchHelp( pcPatternKey, cStruct, 0, 0, 0, 0 );
    54855526  }
     5527  }
     5528
     5529  Int   iSrchRngHorLeft   = pcMvSrchRngLT->getHor();
     5530  Int   iSrchRngHorRight  = pcMvSrchRngRB->getHor();
     5531  Int   iSrchRngVerTop    = pcMvSrchRngLT->getVer();
     5532  Int   iSrchRngVerBottom = pcMvSrchRngRB->getVer();
    54865533
    54875534  if (pIntegerMv2Nx2NPred != 0)
     
    54905537    integerMv2Nx2NPred <<= 2;
    54915538    pcCU->clipMv( integerMv2Nx2NPred );
     5539#if ME_ENABLE_ROUNDING_OF_MVS
     5540    integerMv2Nx2NPred.divideByPowerOf2(2);
     5541#else
    54925542    integerMv2Nx2NPred >>= 2;
     5543#endif
     5544    if ((rcMv != integerMv2Nx2NPred) &&
     5545        (integerMv2Nx2NPred.getHor() != cStruct.iBestX || integerMv2Nx2NPred.getVer() != cStruct.iBestY))
     5546    {
     5547      // only test integerMv2Nx2NPred if not obviously previously tested.
    54935548    xTZSearchHelp(pcPatternKey, cStruct, integerMv2Nx2NPred.getHor(), integerMv2Nx2NPred.getVer(), 0, 0);
     5549    }
    54945550
    54955551    // reset search range
     
    55115567  Int  iStartY = cStruct.iBestY;
    55125568
    5513   // first search
     5569  const Bool bBestCandidateZero = (cStruct.iBestX == 0) && (cStruct.iBestY == 0);
     5570
     5571  // first search around best position up to now.
     5572  // The following works as a "subsampled/log" window search around the best candidate
    55145573  for ( iDist = 1; iDist <= (Int)uiSearchRange; iDist*=2 )
    55155574  {
    55165575    if ( bFirstSearchDiamond == 1 )
    55175576    {
    5518       xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist );
     5577      xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist, bFirstCornersForDiamondDist1 );
    55195578    }
    55205579    else
     
    55295588  }
    55305589
     5590  if (!bNewZeroNeighbourhoodTest)
     5591  {
    55315592  // test whether zero Mv is a better start point than Median predictor
    55325593  if ( bTestZeroVectorStart && ((cStruct.iBestX != 0) || (cStruct.iBestY != 0)) )
     
    55385599      for ( iDist = 1; iDist <= (Int)uiSearchRange; iDist*=2 )
    55395600      {
    5540         xTZ8PointDiamondSearch( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, 0, 0, iDist );
     5601          xTZ8PointDiamondSearch( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, 0, 0, iDist, false );
    55415602        if ( bTestZeroVectorStop && (cStruct.uiBestRound > 0) ) // stop criterion
     5603        {
     5604          break;
     5605        }
     5606      }
     5607    }
     5608  }
     5609  }
     5610  else
     5611  {
     5612    // Test also zero neighbourhood but with half the range
     5613    // It was reported that the original (above) search scheme using bTestZeroVectorStart did not
     5614    // make sense since one would have already checked the zero candidate earlier
     5615    // and thus the conditions for that test would have not been satisfied
     5616    if (bTestZeroVectorStart == true && bBestCandidateZero != true)
     5617    {
     5618      for ( iDist = 1; iDist <= ((Int)uiSearchRange >> 1); iDist*=2 )
     5619      {
     5620        xTZ8PointDiamondSearch( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, 0, 0, iDist, false );
     5621        if ( bTestZeroVectorStop && (cStruct.uiBestRound > 2) ) // stop criterion
    55425622        {
    55435623          break;
     
    55555635
    55565636  // raster search if distance is too big
     5637  if (bUseAdaptiveRaster)
     5638  {
     5639    int iWindowSize = iRaster;
     5640    Int   iSrchRngRasterLeft   = iSrchRngHorLeft;
     5641    Int   iSrchRngRasterRight  = iSrchRngHorRight;
     5642    Int   iSrchRngRasterTop    = iSrchRngVerTop;
     5643    Int   iSrchRngRasterBottom = iSrchRngVerBottom;
     5644
     5645    if (!(bEnableRasterSearch && ( ((Int)(cStruct.uiBestDistance) > iRaster))))
     5646    {
     5647      iWindowSize ++;
     5648      iSrchRngRasterLeft /= 2;
     5649      iSrchRngRasterRight /= 2;
     5650      iSrchRngRasterTop /= 2;
     5651      iSrchRngRasterBottom /= 2;
     5652    }
     5653    cStruct.uiBestDistance = iWindowSize;
     5654    for ( iStartY = iSrchRngRasterTop; iStartY <= iSrchRngRasterBottom; iStartY += iWindowSize )
     5655    {
     5656      for ( iStartX = iSrchRngRasterLeft; iStartX <= iSrchRngRasterRight; iStartX += iWindowSize )
     5657      {
     5658        xTZSearchHelp( pcPatternKey, cStruct, iStartX, iStartY, 0, iWindowSize );
     5659      }
     5660    }
     5661  }
     5662  else
     5663  {
    55575664  if ( bEnableRasterSearch && ( ((Int)(cStruct.uiBestDistance) > iRaster) || bAlwaysRasterSearch ) )
    55585665  {
     
    55655672      }
    55665673    }
     5674  }
    55675675  }
    55685676
     
    55795687        if ( bRasterRefinementDiamond == 1 )
    55805688        {
    5581           xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist );
     5689          xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist, bRasterRefinementCornersForDiamondDist1 );
    55825690        }
    55835691        else
     
    55995707  }
    56005708
    5601   // start refinement
     5709  // star refinement
    56025710  if ( bStarRefinementEnable && cStruct.uiBestDistance > 0 )
    56035711  {
     
    56125720        if ( bStarRefinementDiamond == 1 )
    56135721        {
    5614           xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist );
     5722          xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist, bStarRefinementCornersForDiamondDist1 );
    56155723        }
    56165724        else
     
    56385746  // write out best match
    56395747  rcMv.set( cStruct.iBestX, cStruct.iBestY );
    5640   ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCost( cStruct.iBestX, cStruct.iBestY );
     5748  ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY );
    56415749}
    56425750
    56435751
    5644 Void TEncSearch::xTZSearchSelective( TComDataCU*   pcCU,
    5645                                      TComPattern*  pcPatternKey,
    5646                                      Pel*          piRefY,
    5647                                      Int           iRefStride,
    5648                                      TComMv*       pcMvSrchRngLT,
    5649                                      TComMv*       pcMvSrchRngRB,
     5752Void TEncSearch::xTZSearchSelective( const TComDataCU* const   pcCU,
     5753                                     const TComPattern* const  pcPatternKey,
     5754                                     const Pel* const          piRefY,
     5755                                     const Int                 iRefStride,
     5756                                     const TComMv* const       pcMvSrchRngLT,
     5757                                     const TComMv* const       pcMvSrchRngRB,
    56505758                                     TComMv       &rcMv,
    56515759                                     Distortion   &ruiSAD,
    5652                                      const TComMv* pIntegerMv2Nx2NPred )
     5760                                     const TComMv* const       pIntegerMv2Nx2NPred )
    56535761{
    5654   SEL_SEARCH_CONFIGURATION
     5762  const Bool bTestOtherPredictedMV    = true;
     5763  const Bool bTestZeroVector          = true;
     5764  const Bool bEnableRasterSearch      = true;
     5765  const Bool bAlwaysRasterSearch      = false;  // 1: BETTER but factor 15x slower
     5766  const Bool bStarRefinementEnable    = true;   // enable either star refinement or raster refinement
     5767  const Bool bStarRefinementDiamond   = true;   // 1 = xTZ8PointDiamondSearch   0 = xTZ8PointSquareSearch
     5768  const Bool bStarRefinementStop      = false;
     5769  const UInt uiStarRefinementRounds   = 2;  // star refinement stop X rounds after best match (must be >=1)
     5770  const UInt uiSearchRange            = m_iSearchRange;
     5771  const Int  uiSearchRangeInitial     = m_iSearchRange >> 2;
     5772  const Int  uiSearchStep             = 4;
     5773  const Int  iMVDistThresh            = 8;
    56555774
    56565775  Int   iSrchRngHorLeft         = pcMvSrchRngLT->getHor();
     
    56695788
    56705789  pcCU->clipMv( rcMv );
     5790#if ME_ENABLE_ROUNDING_OF_MVS
     5791  rcMv.divideByPowerOf2(2);
     5792#else
    56715793  rcMv >>= 2;
     5794#endif
    56725795  // init TZSearchStruct
    56735796  IntTZSearchStruct cStruct;
     
    56895812      TComMv cMv = m_acMvPredictors[index];
    56905813      pcCU->clipMv( cMv );
     5814#if ME_ENABLE_ROUNDING_OF_MVS
     5815      cMv.divideByPowerOf2(2);
     5816#else
    56915817      cMv >>= 2;
     5818#endif
    56925819      xTZSearchHelp( pcPatternKey, cStruct, cMv.getHor(), cMv.getVer(), 0, 0 );
    56935820    }
     
    57055832    integerMv2Nx2NPred <<= 2;
    57065833    pcCU->clipMv( integerMv2Nx2NPred );
     5834#if ME_ENABLE_ROUNDING_OF_MVS
     5835    integerMv2Nx2NPred.divideByPowerOf2(2);
     5836#else
    57075837    integerMv2Nx2NPred >>= 2;
     5838#endif
    57085839    xTZSearchHelp(pcPatternKey, cStruct, integerMv2Nx2NPred.getHor(), integerMv2Nx2NPred.getVer(), 0, 0);
    57095840
     
    57345865    {
    57355866      xTZSearchHelp( pcPatternKey, cStruct, iStartX, iStartY, 0, 0 );
    5736       xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, 1 );
    5737       xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, 2 );
     5867      xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, 1, false );
     5868      xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, 2, false );
    57385869    }
    57395870  }
     
    57665897        if ( bStarRefinementDiamond == 1 )
    57675898        {
    5768           xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist );
     5899          xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist, false );
    57695900        }
    57705901        else
     
    57925923  // write out best match
    57935924  rcMv.set( cStruct.iBestX, cStruct.iBestY );
    5794   ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCost( cStruct.iBestX, cStruct.iBestY );
     5925  ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY );
    57955926
    57965927}
     
    59686099  }
    59696100
    5970 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     6101#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    59716102  Bool oldTraceRDCost = g_traceRDCost;     
    59726103  g_traceRDCost = false;
     
    59816112  xEstimateInterResidualQT( pcYuvResi,  pcYuvOrg, pcYuvPred, nonZeroCost, nonZeroBits, nonZeroDistortion, &zeroDistortion, tuLevel0 DEBUG_STRING_PASS_INTO(sDebug) );   
    59826113
    5983 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     6114#if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC
    59846115  g_traceRDCost = oldTraceRDCost;
    59856116  g_traceEncFracBits = oldTraceFracBits;
     
    60276158      const ComponentID component = ComponentID(comp);
    60286159      ::memset( pcCU->getCbf( component ) , 0, uiQPartNum * sizeof(UChar) );
    6029       ::memset( pcCU->getCrossComponentPredictionAlpha(component), 0, ( uiQPartNum * sizeof(Char) ) );
     6160      ::memset( pcCU->getCrossComponentPredictionAlpha(component), 0, ( uiQPartNum * sizeof(SChar) ) );
    60306161    }
    60316162    static const UInt useTS[MAX_NUM_COMPONENT]={0,0,0};
     
    63156446  //  Stores the best explicit RDPCM mode for a TU encoded without split
    63166447  UInt       bestExplicitRdpcmModeUnSplit[MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{3,3}, {3,3}, {3,3}};
    6317   Char       bestCrossCPredictionAlpha   [MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{0,0},{0,0},{0,0}};
     6448  SChar      bestCrossCPredictionAlpha   [MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{0,0},{0,0},{0,0}};
    63186449
    63196450  m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] );
     
    63866517                                                         && (pcCU->getCbf(subTUAbsPartIdx, COMPONENT_Y, uiTrMode) != 0);
    63876518
    6388           Char preCalcAlpha = 0;
     6519          SChar preCalcAlpha = 0;
    63896520          const Pel *pLumaResi = m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( COMPONENT_Y, rTu.getRect( COMPONENT_Y ).x0, rTu.getRect( COMPONENT_Y ).y0 );
    63906521
     
    65786709              }
    65796710
    6580 
    65816711              DEBUG_STRING_NEW(sSingleStringTest)
    65826712#if NH_MV
     
    65886718                D_PRINT_INC_INDENT(g_traceModeCheck, "NonZero");
    65896719#endif
    6590 
    65916720                if (isFirstMode)
    65926721                {
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncSearch.h

    r1321 r1386  
    6868private:
    6969  TCoeff**        m_ppcQTTempCoeff[MAX_NUM_COMPONENT /* 0->Y, 1->Cb, 2->Cr*/];
    70   TCoeff*         m_pcQTTempCoeff[MAX_NUM_COMPONENT];
    7170#if ADAPTIVE_QP_SELECTION
    7271  TCoeff**        m_ppcQTTempArlCoeff[MAX_NUM_COMPONENT];
    73   TCoeff*         m_pcQTTempArlCoeff[MAX_NUM_COMPONENT];
    7472#endif
    7573  UChar*          m_puhQTTempTrIdx;
     
    7977  TComYuv         m_tmpYuvPred; // To be used in xGetInterPredictionError() to avoid constant memory allocation/deallocation
    8078
    81   Char*           m_phQTTempCrossComponentPredictionAlpha[MAX_NUM_COMPONENT];
     79  SChar*          m_phQTTempCrossComponentPredictionAlpha[MAX_NUM_COMPONENT];
    8280  Pel*            m_pSharedPredTransformSkip[MAX_NUM_COMPONENT];
    8381  TCoeff*         m_pcQTTempTUCoeff[MAX_NUM_COMPONENT];
     
    10098  Int             m_iSearchRange;
    10199  Int             m_bipredSearchRange; // Search range for bi-prediction
    102   Int             m_iFastSearch;
     100  MESearchMethod  m_motionEstimationSearchMethod;
    103101#if NH_MV
    104102  Bool            m_vertRestriction;
    105103#endif
    106104  Int             m_aaiAdaptSR[MAX_NUM_REF_LIST_ADAPT_SR][MAX_IDX_ADAPT_SR];
    107   TComMv          m_cSrchRngLT;
    108   TComMv          m_cSrchRngRB;
    109105  TComMv          m_acMvPredictors[NUM_MV_PREDICTORS]; // Left, Above, AboveRight. enum MVP_DIR first NUM_MV_PREDICTORS entries are suitable for accessing.
    110106
     
    116112  // Misc.
    117113  Pel*            m_pTempPel;
    118   const UInt*     m_puiDFilter;
    119114
    120115#if NH_3D_VSO // M17
     
    136131            Int           iSearchRange,
    137132            Int           bipredSearchRange,
    138             Int           iFastSearch,
     133            MESearchMethod motionEstimationSearchMethod,
    139134            const UInt    maxCUWidth,
    140135            const UInt    maxCUHeight,
     
    157152  typedef struct
    158153  {
    159     Pel*        piRefY;
     154    const Pel*  piRefY;
    160155    Int         iYStride;
    161156    Int         iBestX;
     
    168163
    169164  // sub-functions for ME
    170   __inline Void xTZSearchHelp         ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance );
    171   __inline Void xTZ2PointSearch       ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB );
    172   __inline Void xTZ8PointSquareSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist );
    173   __inline Void xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist );
     165  __inline Void xTZSearchHelp         ( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance );
     166  __inline Void xTZ2PointSearch       ( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB );
     167  __inline Void xTZ8PointSquareSearch ( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist );
     168  __inline Void xTZ8PointDiamondSearch( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist, const Bool bCheckCornersAtDist1 );
    174169
    175170  Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, Distortion& ruiSAD, Bool Hadamard );
     
    322317                                               const Int     strideBest );
    323318
    324   Char xCalcCrossComponentPredictionAlpha    (       TComTU &rTu,
     319  SChar xCalcCrossComponentPredictionAlpha   (       TComTU &rTu,
    325320                                               const ComponentID compID,
    326321                                               const Pel*        piResiL,
     
    446441                                    Bool         bBi = false  );
    447442
    448   Void xTZSearch                  ( TComDataCU*  pcCU,
    449                                     TComPattern* pcPatternKey,
    450                                     Pel*         piRefY,
    451                                     Int          iRefStride,
    452                                     TComMv*      pcMvSrchRngLT,
    453                                     TComMv*      pcMvSrchRngRB,
     443  Void xTZSearch                  ( const TComDataCU* const  pcCU,
     444                                    const TComPattern* const pcPatternKey,
     445                                    const Pel* const         piRefY,
     446                                    const Int                iRefStride,
     447                                    const TComMv* const      pcMvSrchRngLT,
     448                                    const TComMv* const      pcMvSrchRngRB,
    454449                                    TComMv&      rcMv,
    455450                                    Distortion&  ruiSAD,
    456                                     const TComMv *pIntegerMv2Nx2NPred
     451                                    const TComMv* const      pIntegerMv2Nx2NPred,
     452                                    const Bool               bExtendedSettings
    457453                                    );
    458454
    459   Void xTZSearchSelective         ( TComDataCU*  pcCU,
    460                                     TComPattern* pcPatternKey,
    461                                     Pel*         piRefY,
    462                                     Int          iRefStride,
    463                                     TComMv*      pcMvSrchRngLT,
    464                                     TComMv*      pcMvSrchRngRB,
     455  Void xTZSearchSelective         ( const TComDataCU* const  pcCU,
     456                                    const TComPattern* const pcPatternKey,
     457                                    const Pel* const         piRefY,
     458                                    const Int                iRefStride,
     459                                    const TComMv* const      pcMvSrchRngLT,
     460                                    const TComMv* const      pcMvSrchRngRB,
    465461                                    TComMv&      rcMv,
    466462                                    Distortion&  ruiSAD,
    467                                     const TComMv *pIntegerMv2Nx2NPred
     463                                    const TComMv* const      pIntegerMv2Nx2NPred
    468464                                    );
    469465
    470   Void xSetSearchRange            ( TComDataCU* pcCU,
    471                                     TComMv&      cMvPred,
    472                                     Int          iSrchRng,
     466  Void xSetSearchRange            ( const TComDataCU* const pcCU,
     467                                    const TComMv&      cMvPred,
     468                                    const Int          iSrchRng,
    473469                                    TComMv&      rcMvSrchRngLT,
    474470                                    TComMv&      rcMvSrchRngRB );
    475471
    476   Void xPatternSearchFast         ( TComDataCU*  pcCU,
    477                                     TComPattern* pcPatternKey,
    478                                     Pel*         piRefY,
    479                                     Int          iRefStride,
    480                                     TComMv*      pcMvSrchRngLT,
    481                                     TComMv*      pcMvSrchRngRB,
     472  Void xPatternSearchFast         ( const TComDataCU* const  pcCU,
     473                                    const TComPattern* const pcPatternKey,
     474                                    const Pel* const         piRefY,
     475                                    const Int                iRefStride,
     476                                    const TComMv* const      pcMvSrchRngLT,
     477                                    const TComMv* const      pcMvSrchRngRB,
    482478                                    TComMv&      rcMv,
    483479                                    Distortion&  ruiSAD,
    484                                     const TComMv* pIntegerMv2Nx2NPred
     480                                    const TComMv* const      pIntegerMv2Nx2NPred
    485481                                  );
    486482
    487   Void xPatternSearch             ( TComPattern* pcPatternKey,
    488                                     Pel*         piRefY,
    489                                     Int          iRefStride,
    490                                     TComMv*      pcMvSrchRngLT,
    491                                     TComMv*      pcMvSrchRngRB,
     483  Void xPatternSearch             ( const TComPattern* const pcPatternKey,
     484                                    const Pel*               piRefY,
     485                                    const Int                iRefStride,
     486                                    const TComMv* const      pcMvSrchRngLT,
     487                                    const TComMv* const      pcMvSrchRngRB,
    492488                                    TComMv&      rcMv,
    493489                                    Distortion&  ruiSAD );
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r1313 r1386  
    203203Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, Int layerId, bool isField )
    204204#else
    205 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iGOPid, TComSlice*& rpcSlice, Bool isField )
     205Void TEncSlice::initEncSlice( TComPic* pcPic, const Int pocLast, const Int pocCurr, const Int iGOPid, TComSlice*& rpcSlice, const Bool isField )
    206206#endif
    207207{
     
    318318  else
    319319  {
     320#if NH_MV
    320321#if 0 // Check this! NH_MV
    321322    rpcSlice->setTemporalLayerNonReferenceFlag(!m_pcCfg->getGOPEntry( (eSliceTypeBaseView == I_SLICE) ? MAX_GOP : iGOPid ).m_refPic);
     323#else
     324    rpcSlice->setTemporalLayerNonReferenceFlag(!m_pcCfg->getGOPEntry(iGOPid).m_refPic);
     325#endif
    322326#else
    323327    rpcSlice->setTemporalLayerNonReferenceFlag(!m_pcCfg->getGOPEntry(iGOPid).m_refPic);
     
    372376    Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
    373377    Int    SHIFT_QP = 12;
    374 
    375     Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? NumberBFrames/2 : NumberBFrames) );
    376378
    377379#if FULL_NBIT
     
    397399#endif
    398400    {
    399       dQPFactor=0.57*dLambda_scale;
     401      if (m_pcCfg->getIntraQpFactor()>=0.0 && m_pcCfg->getGOPEntry(iGOPid).m_sliceType != I_SLICE)
     402      {
     403        dQPFactor=m_pcCfg->getIntraQpFactor();
     404      }
     405      else
     406      {
     407        Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? NumberBFrames/2 : NumberBFrames) );
     408       
     409        dQPFactor=0.57*dLambda_scale;
     410      }
    400411    }
    401412    dLambda = dQPFactor*pow( 2.0, qp_temp/3.0 );
     
    428439  iQP     = m_piRdPicQp    [0];
    429440
    430   if( rpcSlice->getSliceType( ) != I_SLICE )
    431   {
     441
    432442#if NH_MV
    433     dLambda *= m_pcCfg->getLambdaModifier( m_pcCfg->getGOPEntry((eSliceTypeBaseView == I_SLICE) ? MAX_GOP : iGOPid).m_temporalId );
    434 #else
    435     dLambda *= m_pcCfg->getLambdaModifier( m_pcCfg->getGOPEntry(iGOPid).m_temporalId );
    436 #endif
    437   }
    438 
     443  const Int temporalId=m_pcCfg->getGOPEntry((eSliceTypeBaseView == I_SLICE) ? MAX_GOP : iGOPid).m_temporalId;
     444#else
     445  const Int temporalId=m_pcCfg->getGOPEntry(iGOPid).m_temporalId;
     446#endif
     447  const std::vector<Double> &intraLambdaModifiers=m_pcCfg->getIntraLambdaModifier();
     448
     449  Double lambdaModifier;
     450  if( rpcSlice->getSliceType( ) != I_SLICE || intraLambdaModifiers.empty())
     451  {
     452    lambdaModifier = m_pcCfg->getLambdaModifier( temporalId );
     453  }
     454  else
     455  {
     456    lambdaModifier = intraLambdaModifiers[ (temporalId < intraLambdaModifiers.size()) ? temporalId : (intraLambdaModifiers.size()-1) ];
     457  }
     458
     459  dLambda *= lambdaModifier;
    439460  setUpLambda(rpcSlice, dLambda, iQP);
    440461
    441462#if NH_3D_VSO
    442   m_pcRdCost->setUseLambdaScaleVSO  ( (m_pcCfg->getUseVSO() ||  m_pcCfg->getForceLambdaScaleVSO()) && m_pcCfg->getIsDepth() );
     463  m_pcRdCost->setUseLambdaScaleVSO  ( (m_pcCfg->getUseVSO() ||  m_pcCfg->getForceLambdaScaleVSO()) && ( m_pcCfg->getIsDepth()  | m_pcCfg->getIsAuxDepth() ) );
    443464  m_pcRdCost->setLambdaVSO          ( dLambda * m_pcCfg->getLambdaScaleVSO() );
    444465
     
    449470
    450471  // LGE_WVSO_A0119
    451   if( m_pcCfg->getUseWVSO() && m_pcCfg->getIsDepth() )
     472  if( m_pcCfg->getUseWVSO() && ( m_pcCfg->getIsDepth() || m_pcCfg->getIsAuxDepth() ) )
    452473  {
    453474    m_pcRdCost->setDWeight  ( m_pcCfg->getDWeight()   );
     
    547568  rpcSlice->setDepth            ( depth );
    548569
    549 #if NH_MV
    550   pcPic->setTLayer( m_pcCfg->getGOPEntry( (eSliceTypeBaseView == I_SLICE) ? MAX_GOP : iGOPid ).m_temporalId );
    551 #else
    552   pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId );
    553 #endif
     570  pcPic->setTLayer( temporalId );
    554571  if(eSliceType==I_SLICE)
    555572  {
     
    589606// ====================================================================================================================
    590607
     608//! set adaptive search range based on poc difference
    591609Void TEncSlice::setSearchRange( TComSlice* pcSlice )
    592610{
     
    598616  Int iNumPredDir = pcSlice->isInterP() ? 1 : 2;
    599617
    600   for (Int iDir = 0; iDir <= iNumPredDir; iDir++)
    601   {
    602     //RefPicList e = (RefPicList)iDir;
     618  for (Int iDir = 0; iDir < iNumPredDir; iDir++)
     619  {
    603620    RefPicList  e = ( iDir ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    604621    for (Int iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(e); iRefIdx++)
    605622    {
    606623      iRefPOC = pcSlice->getRefPic(e, iRefIdx)->getPOC();
    607       Int iNewSR = Clip3(8, iMaxSR, (iMaxSR*ADAPT_SR_SCALE*abs(iCurrPOC - iRefPOC)+iOffset)/iGOPSize);
    608       m_pcPredSearch->setAdaptiveSearchRange(iDir, iRefIdx, iNewSR);
     624      Int newSearchRange = Clip3(m_pcCfg->getMinSearchWindow(), iMaxSR, (iMaxSR*ADAPT_SR_SCALE*abs(iCurrPOC - iRefPOC)+iOffset)/iGOPSize);
     625      m_pcPredSearch->setAdaptiveSearchRange(iDir, iRefIdx, newSearchRange);
    609626    }
    610627  }
     
    696713
    697714    // compute RD cost and choose the best
    698     Double dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits, uiPicDist, true, DF_SSE_FRAME); // NOTE: Is the 'true' parameter really necessary?
     715#if NH_3D_VSO
     716    Double dPicRdCost = m_pcRdCost->calcRdCost( (Double)m_uiPicTotalBits, uiPicDist, DF_SSE_FRAME);
     717#else
     718    Double dPicRdCost = m_pcRdCost->calcRdCost( (Double)m_uiPicTotalBits, (Double)uiPicDist, DF_SSE_FRAME);
     719#endif
    699720#if H_3D
    700721    // Above calculation need to be fixed for VSO, including frameLambda value.
     
    805826    }
    806827
    807     xEstimateWPParamSlice( pcSlice );
     828    xEstimateWPParamSlice( pcSlice, m_pcCfg->getWeightedPredictionMethod() );
    808829    pcSlice->initWpScaling(pcSlice->getSPS());
    809830
     
    849870    {
    850871      // This will only occur if dependent slice-segments (m_entropyCodingSyncContextState=true) are being used.
    851       if( pCurrentTile->getTileWidthInCtus() >= 2 || !m_pcCfg->getWaveFrontsynchro() )
     872      if( pCurrentTile->getTileWidthInCtus() >= 2 || !m_pcCfg->getEntropyCodingSyncEnabledFlag() )
    852873      {
    853874        m_pppcRDSbacCoder[0][CI_CURR_BEST]->loadContexts( &m_lastSliceSegmentEndContextState );
     
    878899        iLastPosY = iCurPosY;         
    879900        TEncTop* pcEncTop = (TEncTop*) m_pcCfg; // Fix this later.
    880         pcEncTop->setupRenModel( pcSlice->getPOC() , pcSlice->getViewIndex(), pcSlice->getIsDepth() ? 1 : 0, iCurPosY, pcSlice->getSPS()->getMaxCUHeight() );
     901        pcEncTop->setupRenModel( pcSlice->getPOC() , pcSlice->getViewIndex(), pcSlice->getIsDepth() || pcSlice->getVPS()->getAuxId( pcSlice->getLayerId()  ) ? 1 : 0, iCurPosY, pcSlice->getSPS()->getMaxCUHeight() );
    881902      }
    882903    }
     
    892913      m_pppcRDSbacCoder[0][CI_CURR_BEST]->resetEntropy(pcSlice);
    893914    }
    894     else if ( ctuXPosInCtus == tileXPosInCtus && m_pcCfg->getWaveFrontsynchro())
     915    else if ( ctuXPosInCtus == tileXPosInCtus && m_pcCfg->getEntropyCodingSyncEnabledFlag())
    895916    {
    896917      // reset and then update contexts to the state at the end of the top-right CTU (if within current slice and tile).
     
    10311052
    10321053    // Store probabilities of second CTU in line into buffer - used only if wavefront-parallel-processing is enabled.
    1033     if ( ctuXPosInCtus == tileXPosInCtus+1 && m_pcCfg->getWaveFrontsynchro())
     1054    if ( ctuXPosInCtus == tileXPosInCtus+1 && m_pcCfg->getEntropyCodingSyncEnabledFlag())
    10341055    {
    10351056      m_entropyCodingSyncContextState.loadContexts(m_pppcRDSbacCoder[0][CI_CURR_BEST]);
     
    11231144  g_bJustDoIt = g_bEncDecTraceEnable;
    11241145#endif
    1125 #if H_MV_ENC_DEC_TRAC
     1146#if NH_MV_ENC_DEC_TRAC
    11261147#if ENC_DEC_TRACE
    11271148  incSymbolCounter();
     
    11331154  DTRACE_CABAC_T( "\tPOC: " );
    11341155  DTRACE_CABAC_V( pcPic->getPOC() );
    1135 #if H_MV_ENC_DEC_TRAC
     1156#if NH_MV_ENC_DEC_TRAC
    11361157  DTRACE_CABAC_T( " Layer: " );
    11371158  DTRACE_CABAC_V( pcPic->getLayerId() );
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncSlice.h

    r1313 r1386  
    120120                                Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, Int layerId, bool isField  );
    121121#else
    122   Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr,
    123                                 Int iGOPid,   TComSlice*& rpcSlice, Bool isField );
     122  Void    initEncSlice        ( TComPic*  pcPic, const Int pocLast, const Int pocCurr,
     123                                const Int iGOPid,   TComSlice*& rpcSlice, const Bool isField );
    124124#endif
    125125  Void    resetQP             ( TComPic* pic, Int sliceQP, Double lambda );
  • TabularUnified trunk/source/Lib/TLibEncoder/TEncTop.cpp

    r1321 r1386  
    4444#endif
    4545#if NH_MV
    46 #include "../../App/TAppEncoder/TAppEncTop.h"
     46//#include "../../App/TAppEncoder/TAppEncTop.h"
    4747#endif
    4848
     
    216216  xInitVPS();
    217217
     218#if U0132_TARGET_BITS_SATURATION
     219  if (m_RCCpbSaturationEnabled)
     220  {
     221    m_cRateCtrl.initHrdParam(m_cSPS.getVuiParameters()->getHrdParameters(), m_iFrameRate, m_RCInitialCpbFullness);
     222  }
     223#endif
    218224  m_cRdCost.setCostMode(m_costMode);
    219225
     
    264270
    265271  // initialize encoder search class
    266   m_cSearch.init( this, &m_cTrQuant, m_iSearchRange, m_bipredSearchRange, m_iFastSearch, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, &m_cEntropyCoder, &m_cRdCost, getRDSbacCoder(), getRDGoOnSbacCoder() );
     272  m_cSearch.init( this, &m_cTrQuant, m_iSearchRange, m_bipredSearchRange, m_motionEstimationSearchMethod, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, &m_cEntropyCoder, &m_cRdCost, getRDSbacCoder(), getRDGoOnSbacCoder() );
    267273
    268274  m_iMaxRefPicNum = 0;
     
    299305  {
    300306    m_cSPS.getScalingList().setDefaultScalingList ();
    301     if(m_cSPS.getScalingList().xParseScalingList(getScalingListFile()))
     307    if(m_cSPS.getScalingList().xParseScalingList(getScalingListFileName()))
    302308    {
    303309      Bool bParsedScalingList=false; // Use of boolean so that assertion outputs useful string
     
    842848    m_cSPS.setUsedByCurrPicLtSPSFlag(k, 0);
    843849  }
     850
     851#if U0132_TARGET_BITS_SATURATION
     852  if( getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() || getCpbSaturationEnabled() )
     853#else
    844854  if( getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() )
     855#endif
    845856  {
    846857    xInitHrdParameters();
     
    866877  m_cSPS.setSpsRangeExtensionsFlag( m_cSPS.getSpsRangeExtension().settingsDifferFromDefaults() );
    867878#endif
    868 
    869 }
    870 
     879}
     880#if U0132_TARGET_BITS_SATURATION
     881// calculate scale value of bitrate and initial delay
     882Int calcScale(Int x)
     883{
     884  UInt iMask = 0xffffffff;
     885  Int ScaleValue = 32;
     886
     887  while ((x&iMask) != 0)
     888  {
     889    ScaleValue--;
     890    iMask = (iMask >> 1);
     891}
     892
     893  return ScaleValue;
     894}
     895#endif
    871896Void TEncTop::xInitHrdParameters()
    872897{
     
    874899  Int  bitRate         = getTargetBitrate();
    875900  Bool isRandomAccess  = getIntraPeriod() > 0;
    876 
     901# if U0132_TARGET_BITS_SATURATION
     902  Int cpbSize          = getCpbSize();
     903
     904  if( !getVuiParametersPresentFlag() && !getCpbSaturationEnabled() )
     905#else
    877906  if( !getVuiParametersPresentFlag() )
     907#endif
    878908  {
    879909    return;
     
    925955  }
    926956
     957#if U0132_TARGET_BITS_SATURATION
     958  if (calcScale(bitRate) <= 6)
     959  {
     960    hrd->setBitRateScale(0);
     961  }
     962  else
     963  {
     964    hrd->setBitRateScale(calcScale(bitRate) - 6);
     965  }
     966
     967  if (calcScale(cpbSize) <= 4)
     968  {
     969    hrd->setCpbSizeScale(0);
     970  }
     971  else
     972  {
     973    hrd->setCpbSizeScale(calcScale(cpbSize) - 4);
     974  }
     975#else
    927976  hrd->setBitRateScale( 4 );                                       // in units of 2^( 6 + 4 ) = 1,024 bps
    928977  hrd->setCpbSizeScale( 6 );                                       // in units of 2^( 4 + 6 ) = 1,024 bit
     978#endif
     979
    929980  hrd->setDuCpbSizeScale( 6 );                                     // in units of 2^( 4 + 6 ) = 1,024 bit
    930981
     
    9581009    bitrateValue = bitRate / (1 << (6 + hrd->getBitRateScale()) );      // bitRate is in bits, so it needs to be scaled down
    9591010    // CpbSize[ i ] = ( cpb_size_value_minus1[ i ] + 1 ) * 2^( 4 + cpb_size_scale )
     1011#if U0132_TARGET_BITS_SATURATION
     1012    cpbSizeValue = cpbSize / (1 << (4 + hrd->getCpbSizeScale()) );      // using bitRate results in 1 second CPB size
     1013#else
    9601014    cpbSizeValue = bitRate / (1 << (4 + hrd->getCpbSizeScale()) );      // using bitRate results in 1 second CPB size
     1015#endif
     1016
    9611017
    9621018    // DU CPB size could be smaller (i.e. bitrateValue / number of DUs), but we don't know
     
    10661122  m_cPPS.setQpOffset(COMPONENT_Cr, m_chromaCrQpOffset );
    10671123
    1068   m_cPPS.setEntropyCodingSyncEnabledFlag( m_iWaveFrontSynchro > 0 );
     1124  m_cPPS.setEntropyCodingSyncEnabledFlag( m_entropyCodingSyncEnabledFlag );
    10691125  m_cPPS.setTilesEnabledFlag( (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0) );
    10701126  m_cPPS.setUseWP( m_useWeightedPred );
     
    15091565    Int iBaseViewIdx = m_cameraParameters->getBaseSortedId2Id()[ iBaseViewSIdx ];
    15101566
    1511     TComPicYuv* pcPicYuvVideoRec  = m_ivPicLists->getPicYuv( iBaseViewIdx, false, iPoc, true  );
    1512     TComPicYuv* pcPicYuvDepthRec  = m_ivPicLists->getPicYuv( iBaseViewIdx, true , iPoc, true  );
    1513     TComPicYuv* pcPicYuvVideoOrg  = m_ivPicLists->getPicYuv( iBaseViewIdx, false, iPoc, false );
    1514     TComPicYuv* pcPicYuvDepthOrg  = m_ivPicLists->getPicYuv( iBaseViewIdx, true , iPoc, false );   
     1567    Int  auxId     =   getVPS()->getAuxId  ( getLayerId() );     
     1568    Bool depthFlag = ( getVPS()->getDepthId( getLayerId() ) == 1 );
     1569
     1570    if( auxId == 0 && !depthFlag  )
     1571    {
     1572      // Defaults for texture layers
     1573#if NH_3D
     1574      depthFlag = true;
     1575      auxId     = 0;
     1576#else
     1577      depthFlag = false;
     1578      auxId     = 2;
     1579#endif
     1580    }
     1581
     1582    TComPicYuv* pcPicYuvVideoRec  = m_ivPicLists->getPicYuv( iBaseViewIdx, false    , 0    , iPoc, true  );
     1583    TComPicYuv* pcPicYuvDepthRec  = m_ivPicLists->getPicYuv( iBaseViewIdx, depthFlag, auxId, iPoc, true  );
     1584    TComPicYuv* pcPicYuvVideoOrg  = m_ivPicLists->getPicYuv( iBaseViewIdx, false,     0    , iPoc, false );
     1585    TComPicYuv* pcPicYuvDepthOrg  = m_ivPicLists->getPicYuv( iBaseViewIdx, depthFlag, auxId, iPoc, false );   
    15151586
    15161587    TComPicYuv* pcPicYuvVideoRef  = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg  : NULL;
     
    15771648    if ( iOrgRefBaseViewSIdx != -1 )
    15781649    {
    1579       pcPicYuvOrgRef = m_ivPicLists->getPicYuv(  m_cameraParameters->getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , false, iPoc, false );
     1650      pcPicYuvOrgRef = m_ivPicLists->getPicYuv(  m_cameraParameters->getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , false, 0, iPoc, false );
    15801651      AOF ( pcPicYuvOrgRef );
    15811652    }
  • TabularUnified trunk/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r1313 r1386  
    4141#include "../TLibCommon/TComPicYuv.h"
    4242#include "WeightPredAnalysis.h"
    43 
    44 #define ABS(a)    ((a) < 0 ? - (a) : (a))
    45 #define DTHRESH (0.99)
     43#include <limits>
     44
     45static const Double WEIGHT_PRED_SAD_RELATIVE_TO_NON_WEIGHT_PRED_SAD=0.99; // NOTE: U0040 used 0.95
     46
     47//! calculate SAD values for both WP version and non-WP version.
     48static
     49Int64 xCalcSADvalueWP(const Int   bitDepth,
     50                      const Pel  *pOrgPel,
     51                      const Pel  *pRefPel,
     52                      const Int   width,
     53                      const Int   height,
     54                      const Int   orgStride,
     55                      const Int   refStride,
     56                      const Int   log2Denom,
     57                      const Int   weight,
     58                      const Int   offset,
     59                      const Bool  useHighPrecision);
     60
     61//! calculate SAD values for both WP version and non-WP version.
     62static
     63Int64 xCalcSADvalueWPOptionalClip(const Int   bitDepth,
     64                                  const Pel  *pOrgPel,
     65                                  const Pel  *pRefPel,
     66                                  const Int   width,
     67                                  const Int   height,
     68                                  const Int   orgStride,
     69                                  const Int   refStride,
     70                                  const Int   log2Denom,
     71                                  const Int   weight,
     72                                  const Int   offset,
     73                                  const Bool  useHighPrecision,
     74                                  const Bool  clipped);
     75
     76// -----------------------------------------------------------------------------
     77// Helper functions
     78
     79
     80//! calculate Histogram for array of pixels
     81static
     82Void xCalcHistogram(const Pel  *pPel,
     83                    std::vector<Int> &histogram,
     84                    const Int   width,
     85                    const Int   height,
     86                    const Int   stride,
     87                    const Int   maxPel)
     88{
     89  histogram.clear();
     90  histogram.resize(maxPel);
     91  for( Int y = 0; y < height; y++ )
     92  {
     93    for( Int x = 0; x < width; x++ )
     94    {
     95      const Pel v=pPel[x];
     96      histogram[v<0?0:(v>=maxPel)?maxPel-1:v]++;
     97    }
     98    pPel += stride;
     99  }
     100}
     101
     102static
     103Distortion xCalcHistDistortion (const std::vector<Int> &histogram0,
     104                                const std::vector<Int> &histogram1)
     105{
     106  Distortion distortion = 0;
     107  assert(histogram0.size()==histogram1.size());
     108  const Int numElements=Int(histogram0.size());
     109
     110  // Scan histograms to compute histogram distortion
     111  for (Int i = 0; i <= numElements; i++)
     112  {
     113    distortion += (Distortion)(abs(histogram0[i] - histogram1[i]));
     114  }
     115
     116  return distortion;
     117}
     118
     119static
     120void xScaleHistogram(const std::vector<Int> &histogramInput,
     121                           std::vector<Int> &histogramOutput, // cannot be the same as the input
     122                     const Int               bitDepth,
     123                     const Int               log2Denom,
     124                     const Int               weight,
     125                     const Int               offset,
     126                     const Bool              bHighPrecision)
     127{
     128  assert(&histogramInput != &histogramOutput);
     129  const Int numElements=Int(histogramInput.size());
     130  histogramOutput.clear();
     131  histogramOutput.resize(numElements);
     132
     133  const Int64 iRealLog2Denom = bHighPrecision ? 0 : (bitDepth - 8);
     134  const Int64 iRealOffset    = ((Int64)offset)<<iRealLog2Denom;
     135
     136  const Int divOffset = log2Denom == 0 ? 0 : 1 << (log2Denom - 1);
     137  // Scan histogram and apply illumination parameters appropriately
     138  // Then compute updated histogram.
     139  // Note that this technique only works with single list weights/offsets.
     140
     141  for (Int i = 0; i < numElements; i++)
     142  {
     143    const Int j = Clip3(0, numElements - 1, (Int)(((weight * i + divOffset) >> log2Denom) + iRealOffset));
     144    histogramOutput[j] += histogramInput[i];
     145  }
     146}
     147
     148static
     149Distortion xSearchHistogram(const std::vector<Int> &histogramSource,
     150                            const std::vector<Int> &histogramRef,
     151                                  std::vector<Int> &outputHistogram,
     152                            const Int               bitDepth,
     153                            const Int               log2Denom,
     154                                  Int              &weightToUpdate,
     155                                  Int              &offsetToUpdate,
     156                            const Bool              bHighPrecision,
     157                            const ComponentID       compID)
     158{
     159  const Int initialWeight   = weightToUpdate;
     160  const Int initialOffset   = offsetToUpdate;
     161  const Int weightRange     = 10;
     162  const Int offsetRange     = 10;
     163  const Int maxOffset       = 1 << ((bHighPrecision == true) ? (bitDepth - 1) : 7);
     164  const Int range           = bHighPrecision ? (1<<bitDepth) / 2 : 128;
     165  const Int defaultWeight   = (1<<log2Denom);
     166  const Int minSearchWeight = std::max<Int>(initialWeight - weightRange, defaultWeight - range);
     167  const Int maxSearchWeight = std::min<Int>(initialWeight + weightRange+1, defaultWeight + range);
     168
     169  Distortion minDistortion   = std::numeric_limits<Distortion>::max();
     170  Int        bestWeight      = initialWeight;
     171  Int        bestOffset      = initialOffset;
     172
     173  for (Int searchWeight = minSearchWeight; searchWeight < maxSearchWeight; searchWeight++)
     174  {
     175    if (compID == COMPONENT_Y)
     176    {
     177      for (Int searchOffset = std::max<Int>(initialOffset - offsetRange, -maxOffset);
     178               searchOffset <= initialOffset + offsetRange && searchOffset<=(maxOffset-1);
     179               searchOffset++)
     180      {
     181        xScaleHistogram(histogramRef, outputHistogram, bitDepth, log2Denom, searchWeight, searchOffset, bHighPrecision);
     182        const Distortion distortion = xCalcHistDistortion(histogramSource, outputHistogram);
     183
     184        if (distortion < minDistortion)
     185        {
     186          minDistortion = distortion;
     187          bestWeight    = searchWeight;
     188          bestOffset    = searchOffset;
     189        }
     190      }
     191    }
     192    else
     193    {
     194      const Int pred        = ( maxOffset - ( ( maxOffset*searchWeight)>>(log2Denom) ) );
     195
     196      for (Int searchOffset = initialOffset - offsetRange; searchOffset <= initialOffset + offsetRange; searchOffset++)
     197      {
     198        const Int deltaOffset   = Clip3( -4*maxOffset, 4*maxOffset-1, (searchOffset - pred) ); // signed 10bit (if !bHighPrecision)
     199        const Int clippedOffset = Clip3( -1*maxOffset, 1*maxOffset-1, (deltaOffset  + pred) ); // signed 8bit  (if !bHighPrecision)
     200        xScaleHistogram(histogramRef, outputHistogram, bitDepth, log2Denom, searchWeight, clippedOffset, bHighPrecision);
     201        const Distortion distortion = xCalcHistDistortion(histogramSource, outputHistogram);
     202
     203        if (distortion < minDistortion)
     204        {
     205          minDistortion = distortion;
     206          bestWeight    = searchWeight;
     207          bestOffset    = clippedOffset;
     208        }
     209      }
     210    }
     211  }
     212
     213  weightToUpdate = bestWeight;
     214  offsetToUpdate = bestOffset;
     215
     216  // regenerate best histogram
     217  xScaleHistogram(histogramRef, outputHistogram, bitDepth, log2Denom, bestWeight, bestOffset, bHighPrecision);
     218
     219  return minDistortion;
     220}
     221
     222
     223// -----------------------------------------------------------------------------
     224// Member functions
    46225
    47226WeightPredAnalysis::WeightPredAnalysis()
     
    49228  for ( UInt lst =0 ; lst<NUM_REF_PIC_LIST_01 ; lst++ )
    50229  {
    51     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
     230    for ( Int refIdx=0 ; refIdx<MAX_NUM_REF ; refIdx++ )
    52231    {
    53232      for ( Int comp=0 ; comp<MAX_NUM_COMPONENT ;comp++ )
    54233      {
    55         WPScalingParam  *pwp   = &(m_wp[lst][iRefIdx][comp]);
     234        WPScalingParam  *pwp   = &(m_wp[lst][refIdx][comp]);
    56235        pwp->bPresentFlag      = false;
    57236        pwp->uiLog2WeightDenom = 0;
     
    78257    // calculate DC/AC value for channel
    79258
    80     const Int iStride = pPic->getStride(compID);
    81     const Int iWidth  = pPic->getWidth(compID);
    82     const Int iHeight = pPic->getHeight(compID);
    83 
    84     const Int iSample = iWidth*iHeight;
    85 
    86     Int64 iOrgDC = 0;
     259    const Int stride = pPic->getStride(compID);
     260    const Int width  = pPic->getWidth(compID);
     261    const Int height = pPic->getHeight(compID);
     262
     263    const Int sample = width*height;
     264
     265    Int64 orgDC = 0;
    87266    {
    88267      const Pel *pPel = pPic->getAddr(compID);
    89268
    90       for(Int y = 0; y < iHeight; y++, pPel+=iStride )
    91       {
    92         for(Int x = 0; x < iWidth; x++ )
    93         {
    94           iOrgDC += (Int)( pPel[x] );
    95         }
    96       }
    97     }
    98 
    99     const Int64 iOrgNormDC = ((iOrgDC+(iSample>>1)) / iSample);
    100 
    101     Int64 iOrgAC = 0;
     269      for(Int y = 0; y < height; y++, pPel+=stride )
     270      {
     271        for(Int x = 0; x < width; x++ )
     272        {
     273          orgDC += (Int)( pPel[x] );
     274        }
     275      }
     276    }
     277
     278    const Int64 orgNormDC = ((orgDC+(sample>>1)) / sample);
     279
     280    Int64 orgAC = 0;
    102281    {
    103282      const Pel *pPel = pPic->getAddr(compID);
    104283
    105       for(Int y = 0; y < iHeight; y++, pPel += iStride )
    106       {
    107         for(Int x = 0; x < iWidth; x++ )
    108         {
    109           iOrgAC += abs( (Int)pPel[x] - (Int)iOrgNormDC );
     284      for(Int y = 0; y < height; y++, pPel += stride )
     285      {
     286        for(Int x = 0; x < width; x++ )
     287        {
     288          orgAC += abs( (Int)pPel[x] - (Int)orgNormDC );
    110289        }
    111290      }
     
    113292
    114293    const Int fixedBitShift = (slice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag())?RExt__PREDICTION_WEIGHTING_ANALYSIS_DC_PRECISION:0;
    115     weightACDCParam[compID].iDC = (((iOrgDC<<fixedBitShift)+(iSample>>1)) / iSample);
    116     weightACDCParam[compID].iAC = iOrgAC;
     294    weightACDCParam[compID].iDC = (((orgDC<<fixedBitShift)+(sample>>1)) / sample);
     295    weightACDCParam[compID].iAC = orgAC;
    117296  }
    118297
     
    126305  const TComPicYuv *pPic = slice->getPic()->getPicYuvOrg();
    127306
    128   Int iPresentCnt = 0;
     307  Int presentCnt = 0;
    129308  for ( UInt lst=0 ; lst<NUM_REF_PIC_LIST_01 ; lst++ )
    130309  {
    131     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
     310    for ( Int refIdx=0 ; refIdx<MAX_NUM_REF ; refIdx++ )
    132311    {
    133312      for(Int componentIndex = 0; componentIndex < pPic->getNumberValidComponents(); componentIndex++)
    134313      {
    135         WPScalingParam  *pwp = &(m_wp[lst][iRefIdx][componentIndex]);
    136         iPresentCnt += (Int)pwp->bPresentFlag;
    137       }
    138     }
    139   }
    140 
    141   if(iPresentCnt==0)
     314        WPScalingParam  *pwp = &(m_wp[lst][refIdx][componentIndex]);
     315        presentCnt += (Int)pwp->bPresentFlag;
     316      }
     317    }
     318  }
     319
     320  if(presentCnt==0)
    142321  {
    143322    slice->setTestWeightPred(false);
     
    146325    for ( UInt lst=0 ; lst<NUM_REF_PIC_LIST_01 ; lst++ )
    147326    {
    148       for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
     327      for ( Int refIdx=0 ; refIdx<MAX_NUM_REF ; refIdx++ )
    149328      {
    150329        for(Int componentIndex = 0; componentIndex < pPic->getNumberValidComponents(); componentIndex++)
    151330        {
    152           WPScalingParam  *pwp = &(m_wp[lst][iRefIdx][componentIndex]);
     331          WPScalingParam  *pwp = &(m_wp[lst][refIdx][componentIndex]);
    153332
    154333          pwp->bPresentFlag      = false;
     
    163342  else
    164343  {
    165     slice->setTestWeightPred(slice->getPPS()->getUseWP());
     344    slice->setTestWeightPred  (slice->getPPS()->getUseWP());
    166345    slice->setTestWeightBiPred(slice->getPPS()->getWPBiPred());
    167346  }
     
    170349
    171350//! estimate wp tables for explicit wp
    172 Void WeightPredAnalysis::xEstimateWPParamSlice(TComSlice *const slice)
     351Void WeightPredAnalysis::xEstimateWPParamSlice(TComSlice *const slice, const WeightedPredictionMethod method)
    173352{
    174353  Int  iDenom         = 6;
     
    191370  // selecting whether WP is used, or not (fast search)
    192371  // NOTE: This is not operating on a slice, but the entire picture.
    193   xSelectWP(slice, iDenom);
     372  switch (method)
     373  {
     374    case WP_PER_PICTURE_WITH_SIMPLE_DC_COMBINED_COMPONENT:
     375      xSelectWP(slice, iDenom);
     376      break;
     377    case WP_PER_PICTURE_WITH_SIMPLE_DC_PER_COMPONENT:
     378      xSelectWPHistExtClip(slice, iDenom, false, false, false);
     379      break;
     380    case WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT:
     381      xSelectWPHistExtClip(slice, iDenom, false, false, true);
     382      break;
     383    case WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING:
     384      xSelectWPHistExtClip(slice, iDenom, false, true, true);
     385      break;
     386    case WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION:
     387      xSelectWPHistExtClip(slice, iDenom, true, true, true);
     388      break;
     389    default:
     390      assert(0);
     391      exit(1);
     392  }
    194393
    195394  slice->setWpScaling( m_wp );
     
    251450        // Weighting factor limitation
    252451        const Int defaultWeight = (1<<log2Denom);
    253         const Int deltaWeight   = (defaultWeight - weight);
     452        const Int deltaWeight   = (weight - defaultWeight);
    254453
    255454        if(deltaWeight >= range || deltaWeight < -range)
     
    269468
    270469
     470/** select whether weighted pred enables or not.
     471 * \param TComSlice *slice
     472 * \param log2Denom
     473 * \returns Bool
     474 */
     475Bool WeightPredAnalysis::xSelectWPHistExtClip(TComSlice *const slice, const Int log2Denom, const Bool bDoEnhancement, const Bool bClipInitialSADWP, const Bool bUseHistogram)
     476{
     477  const TComPicYuv *const pPic             = slice->getPic()->getPicYuvOrg();
     478  const Int               defaultWeight    = 1<<log2Denom;
     479  const Int               numPredDir       = slice->isInterP() ? 1 : 2;
     480  const Bool              useHighPrecision = slice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag();
     481
     482  assert (numPredDir <= Int(NUM_REF_PIC_LIST_01));
     483
     484  for ( Int refList = 0; refList < numPredDir; refList++ )
     485  {
     486    const RefPicList eRefPicList = ( refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
     487
     488    for ( Int refIdxTemp = 0; refIdxTemp < slice->getNumRefIdx(eRefPicList); refIdxTemp++ )
     489    {
     490      Bool  useChromaWeight = false;
     491
     492      for(Int comp=0; comp<pPic->getNumberValidComponents(); comp++)
     493      {
     494        const ComponentID  compID     = ComponentID(comp);
     495        const Pel         *pOrg       = pPic->getAddr(compID);
     496        const Pel         *pRef       = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getAddr(compID);
     497        const Int          orgStride  = pPic->getStride(compID);
     498        const Int          refStride  = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getStride(compID);
     499        const Int          width      = pPic->getWidth(compID);
     500        const Int          height     = pPic->getHeight(compID);
     501        const Int          bitDepth   = slice->getSPS()->getBitDepth(toChannelType(compID));
     502              WPScalingParam &wp      = m_wp[refList][refIdxTemp][compID];
     503              Int          weight     = wp.iWeight;
     504              Int          offset     = wp.iOffset;
     505              Int          weightDef  = defaultWeight;
     506              Int          offsetDef  = 0;
     507
     508        // calculate SAD costs with/without wp for luma
     509        const Int64 SADnoWP = xCalcSADvalueWPOptionalClip(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, defaultWeight, 0, useHighPrecision, bClipInitialSADWP);
     510        if (SADnoWP > 0)
     511        {
     512          const Int64 SADWP   = xCalcSADvalueWPOptionalClip(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weight,   offset, useHighPrecision, bClipInitialSADWP);
     513          const Double dRatioSAD = (Double)SADWP / (Double)SADnoWP;
     514          Double dRatioSr0SAD = std::numeric_limits<Double>::max();
     515          Double dRatioSrSAD  = std::numeric_limits<Double>::max();
     516
     517          if (bUseHistogram)
     518          {
     519            std::vector<Int> histogramOrg;// = pPic->getHistogram(compID);
     520            std::vector<Int> histogramRef;// = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getHistogram(compID);
     521            std::vector<Int> searchedHistogram;
     522
     523            // Compute histograms
     524            xCalcHistogram(pOrg, histogramOrg, width, height, orgStride, 1 << bitDepth);
     525            xCalcHistogram(pRef, histogramRef, width, height, refStride, 1 << bitDepth);
     526
     527            // Do a histogram search around DC WP parameters; resulting distortion and 'searchedHistogram' is discarded
     528            xSearchHistogram(histogramOrg, histogramRef, searchedHistogram, bitDepth, log2Denom, weight, offset, useHighPrecision, compID);
     529            // calculate updated WP SAD
     530            const Int64 SADSrWP = xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weight, offset, useHighPrecision);
     531            dRatioSrSAD  = (Double)SADSrWP  / (Double)SADnoWP;
     532
     533            if (bDoEnhancement)
     534            {
     535              // Do the same around the default ones; resulting distortion and 'searchedHistogram' is discarded
     536              xSearchHistogram(histogramOrg, histogramRef, searchedHistogram, bitDepth, log2Denom, weightDef, offsetDef, useHighPrecision, compID);
     537              // calculate updated WP SAD
     538              const Int64 SADSr0WP = xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weightDef, offsetDef, useHighPrecision);
     539              dRatioSr0SAD = (Double)SADSr0WP / (Double)SADnoWP;
     540            }
     541          }
     542
     543          if(min(dRatioSr0SAD, min(dRatioSAD, dRatioSrSAD)) >= WEIGHT_PRED_SAD_RELATIVE_TO_NON_WEIGHT_PRED_SAD)
     544          {
     545            wp.bPresentFlag      = false;
     546            wp.iOffset           = 0;
     547            wp.iWeight           = defaultWeight;
     548            wp.uiLog2WeightDenom = log2Denom;
     549          }
     550          else
     551          {
     552            if (compID != COMPONENT_Y)
     553            {
     554              useChromaWeight = true;
     555            }
     556
     557            if (dRatioSr0SAD < dRatioSrSAD && dRatioSr0SAD < dRatioSAD)
     558            {
     559              wp.bPresentFlag      = true;
     560              wp.iOffset           = offsetDef;
     561              wp.iWeight           = weightDef;
     562              wp.uiLog2WeightDenom = log2Denom;
     563            }
     564            else if (dRatioSrSAD < dRatioSAD)
     565            {
     566              wp.bPresentFlag      = true;
     567              wp.iOffset           = offset;
     568              wp.iWeight           = weight;
     569              wp.uiLog2WeightDenom = log2Denom;
     570            }
     571          }
     572        }
     573        else // (SADnoWP <= 0)
     574        {
     575          wp.bPresentFlag      = false;
     576          wp.iOffset           = 0;
     577          wp.iWeight           = defaultWeight;
     578          wp.uiLog2WeightDenom = log2Denom;
     579        }
     580      }
     581
     582      for(Int comp=1; comp<pPic->getNumberValidComponents(); comp++)
     583      {
     584        m_wp[refList][refIdxTemp][comp].bPresentFlag = useChromaWeight;
     585      }
     586    }
     587  }
     588
     589  return true;
     590}
     591
    271592//! select whether weighted pred enables or not.
    272593Bool WeightPredAnalysis::xSelectWP(TComSlice *const slice, const Int log2Denom)
    273594{
    274595        TComPicYuv *const pPic                                = slice->getPic()->getPicYuvOrg();
    275   const Int               iDefaultWeight                      = ((Int)1<<log2Denom);
    276   const Int               iNumPredDir                         = slice->isInterP() ? 1 : 2;
     596  const Int               defaultWeight                       = 1<<log2Denom;
     597  const Int               numPredDir                          = slice->isInterP() ? 1 : 2;
    277598  const Bool              useHighPrecisionPredictionWeighting = slice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag();
    278599
    279   assert (iNumPredDir <= Int(NUM_REF_PIC_LIST_01));
    280 
    281   for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ )
    282   {
    283     const RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    284 
    285     for ( Int iRefIdxTemp = 0; iRefIdxTemp < slice->getNumRefIdx(eRefPicList); iRefIdxTemp++ )
    286     {
    287       Int64 iSADWP = 0, iSADnoWP = 0;
     600  assert (numPredDir <= Int(NUM_REF_PIC_LIST_01));
     601
     602  for ( Int refList = 0; refList < numPredDir; refList++ )
     603  {
     604    const RefPicList eRefPicList = ( refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
     605
     606    for ( Int refIdxTemp = 0; refIdxTemp < slice->getNumRefIdx(eRefPicList); refIdxTemp++ )
     607    {
     608      Int64 SADWP = 0, SADnoWP = 0;
    288609
    289610      for(Int comp=0; comp<pPic->getNumberValidComponents(); comp++)
     
    291612        const ComponentID  compID     = ComponentID(comp);
    292613              Pel         *pOrg       = pPic->getAddr(compID);
    293               Pel         *pRef       = slice->getRefPic(eRefPicList, iRefIdxTemp)->getPicYuvRec()->getAddr(compID);
    294         const Int          iOrgStride = pPic->getStride(compID);
    295         const Int          iRefStride = slice->getRefPic(eRefPicList, iRefIdxTemp)->getPicYuvRec()->getStride(compID);
    296         const Int          iWidth     = pPic->getWidth(compID);
    297         const Int          iHeight    = pPic->getHeight(compID);
     614              Pel         *pRef       = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getAddr(compID);
     615        const Int          orgStride = pPic->getStride(compID);
     616        const Int          refStride = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getStride(compID);
     617        const Int          width     = pPic->getWidth(compID);
     618        const Int          height    = pPic->getHeight(compID);
    298619        const Int          bitDepth   = slice->getSPS()->getBitDepth(toChannelType(compID));
    299620
    300621        // calculate SAD costs with/without wp for luma
    301         iSADWP   += xCalcSADvalueWP(bitDepth, pOrg, pRef, iWidth, iHeight, iOrgStride, iRefStride, log2Denom, m_wp[iRefList][iRefIdxTemp][compID].iWeight, m_wp[iRefList][iRefIdxTemp][compID].iOffset, useHighPrecisionPredictionWeighting);
    302         iSADnoWP += xCalcSADvalueWP(bitDepth, pOrg, pRef, iWidth, iHeight, iOrgStride, iRefStride, log2Denom, iDefaultWeight, 0, useHighPrecisionPredictionWeighting);
    303       }
    304 
    305       const Double dRatio = ((Double)iSADWP / (Double)iSADnoWP);
    306       if(dRatio >= (Double)DTHRESH)
     622        SADWP   += xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, m_wp[refList][refIdxTemp][compID].iWeight, m_wp[refList][refIdxTemp][compID].iOffset, useHighPrecisionPredictionWeighting);
     623        SADnoWP += xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, defaultWeight, 0, useHighPrecisionPredictionWeighting);
     624      }
     625
     626      const Double dRatio = SADnoWP > 0 ? (((Double)SADWP / (Double)SADnoWP)) : std::numeric_limits<Double>::max();
     627      if(dRatio >= WEIGHT_PRED_SAD_RELATIVE_TO_NON_WEIGHT_PRED_SAD)
    307628      {
    308629        for(Int comp=0; comp<pPic->getNumberValidComponents(); comp++)
    309630        {
    310           m_wp[iRefList][iRefIdxTemp][comp].bPresentFlag      = false;
    311           m_wp[iRefList][iRefIdxTemp][comp].iOffset           = 0;
    312           m_wp[iRefList][iRefIdxTemp][comp].iWeight           = iDefaultWeight;
    313           m_wp[iRefList][iRefIdxTemp][comp].uiLog2WeightDenom = log2Denom;
     631          WPScalingParam &wp=m_wp[refList][refIdxTemp][comp];
     632          wp.bPresentFlag      = false;
     633          wp.iOffset           = 0;
     634          wp.iWeight           = defaultWeight;
     635          wp.uiLog2WeightDenom = log2Denom;
    314636        }
    315637      }
     
    320642}
    321643
    322 
    323 //! calculate SAD values for both WP version and non-WP version.
    324 Int64 WeightPredAnalysis::xCalcSADvalueWP(const Int   bitDepth,
    325                                           const Pel  *pOrgPel,
    326                                           const Pel  *pRefPel,
    327                                           const Int   iWidth,
    328                                           const Int   iHeight,
    329                                           const Int   iOrgStride,
    330                                           const Int   iRefStride,
    331                                           const Int   iLog2Denom,
    332                                           const Int   iWeight,
    333                                           const Int   iOffset,
    334                                           const Bool  useHighPrecisionPredictionWeighting)
    335 {
    336   const Int64 iSize          = iWidth*iHeight;
    337   const Int64 iRealLog2Denom = useHighPrecisionPredictionWeighting ? iLog2Denom : (iLog2Denom + (bitDepth - 8));
    338 
    339   Int64 iSAD = 0;
    340   for( Int y = 0; y < iHeight; y++ )
    341   {
    342     for( Int x = 0; x < iWidth; x++ )
    343     {
    344       iSAD += ABS(( ((Int64)pOrgPel[x]<<(Int64)iLog2Denom) - ( (Int64)pRefPel[x] * (Int64)iWeight + ((Int64)iOffset<<iRealLog2Denom) ) ) );
    345     }
    346     pOrgPel += iOrgStride;
    347     pRefPel += iRefStride;
    348   }
    349 
    350   return (iSAD/iSize);
    351 }
     644// Alternatively, a SSE-based measure could be used instead.
     645// The respective function has been removed as it currently redundant.
     646static
     647Int64 xCalcSADvalueWP(const Int   bitDepth,
     648                      const Pel  *pOrgPel,
     649                      const Pel  *pRefPel,
     650                      const Int   width,
     651                      const Int   height,
     652                      const Int   orgStride,
     653                      const Int   refStride,
     654                      const Int   log2Denom,
     655                      const Int   weight,
     656                      const Int   offset,
     657                      const Bool  useHighPrecision)
     658{
     659  //const Int64 iSize          = iWidth*iHeight;
     660  const Int64 realLog2Denom = useHighPrecision ? log2Denom : (log2Denom + (bitDepth - 8));
     661  const Int64 realOffset    = ((Int64)offset)<<realLog2Denom;
     662
     663  Int64 SAD = 0;
     664  for( Int y = 0; y < height; y++ )
     665  {
     666    for( Int x = 0; x < width; x++ )
     667    {
     668      SAD += abs(( ((Int64)pOrgPel[x] << (Int64) log2Denom) - ( (Int64) pRefPel[x] * (Int64) weight + (realOffset) ) ) );
     669    }
     670    pOrgPel += orgStride;
     671    pRefPel += refStride;
     672  }
     673
     674  //return (iSAD/iSize);
     675  return SAD;
     676}
     677
     678static
     679Int64 xCalcSADvalueWPOptionalClip(const Int   bitDepth,
     680                                  const Pel  *pOrgPel,
     681                                  const Pel  *pRefPel,
     682                                  const Int   width,
     683                                  const Int   height,
     684                                  const Int   orgStride,
     685                                  const Int   refStride,
     686                                  const Int   log2Denom,
     687                                  const Int   weight,
     688                                  const Int   offset,
     689                                  const Bool  useHighPrecision,
     690                                  const Bool  clipped)
     691{
     692  Int64 SAD = 0;
     693  if (clipped)
     694  {
     695    const Int64 realLog2Denom = useHighPrecision ? 0 : (bitDepth - 8);
     696    const Int64 realOffset    = (Int64)offset<<realLog2Denom;
     697    const Int64 roundOffset = (log2Denom == 0) ? 0 : 1 << (log2Denom - 1);
     698    const Int64 minValue = 0;
     699    const Int64 maxValue = (1 << bitDepth) - 1;
     700
     701    for( Int y = 0; y < height; y++ )
     702    {
     703      for( Int x = 0; x < width; x++ )
     704      {
     705        Int64 scaledValue = Clip3(minValue, maxValue,  ((((Int64) pRefPel[x] * (Int64) weight + roundOffset) ) >>  (Int64) log2Denom) + realOffset);
     706        SAD += abs((Int64)pOrgPel[x] -  scaledValue);
     707      }
     708      pOrgPel += orgStride;
     709      pRefPel += refStride;
     710    }
     711  }
     712  else
     713  {
     714    //const Int64 iSize          = iWidth*iHeight;
     715    const Int64 realLog2Denom = useHighPrecision ? log2Denom : (log2Denom + (bitDepth - 8));
     716    const Int64 realOffset    = ((Int64)offset)<<realLog2Denom;
     717
     718    for( Int y = 0; y < height; y++ )
     719    {
     720      for( Int x = 0; x < width; x++ )
     721      {
     722        SAD += abs(( ((Int64)pOrgPel[x] << (Int64) log2Denom) - ( (Int64) pRefPel[x] * (Int64) weight + (realOffset) ) ) );
     723      }
     724      pOrgPel += orgStride;
     725      pRefPel += refStride;
     726    }
     727  }
     728  return SAD;
     729}
  • TabularUnified trunk/source/Lib/TLibEncoder/WeightPredAnalysis.h

    r1313 r1386  
    5252
    5353  Bool  xSelectWP            (TComSlice *const slice, const Int log2Denom);
     54  Bool  xSelectWPHistExtClip (TComSlice *const slice, const Int log2Denom, const Bool bDoEnhancement, const Bool bClipInitialSADWP, const Bool bUseHistogram);
    5455  Bool  xUpdatingWPParameters(TComSlice *const slice, const Int log2Denom);
    55 
    56   Int64 xCalcSADvalueWP      (const Int   bitDepth,
    57                               const Pel  *pOrgPel,
    58                               const Pel  *pRefPel,
    59                               const Int   iWidth,
    60                               const Int   iHeight,
    61                               const Int   iOrgStride,
    62                               const Int   iRefStride,
    63                               const Int   iLog2Denom,
    64                               const Int   iWeight,
    65                               const Int   iOffset,
    66                               const Bool  useHighPrecisionPredictionWeighting);
    6756
    6857public:
     
    7261  // WP analysis :
    7362  Void  xCalcACDCParamSlice  (TComSlice *const slice);
    74   Void  xEstimateWPParamSlice(TComSlice *const slice);
     63  Void  xEstimateWPParamSlice(TComSlice *const slice, const WeightedPredictionMethod method);
    7564  Void  xCheckWPEnable       (TComSlice *const slice);
    7665};
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenFilter.cpp

    r1313 r1386  
    3636#include "TRenFilter.h"
    3737#include "TRenInterpFilter.h"
    38 #if NH_3D
     38#if NH_3D_VSO
    3939
    4040///// COMMON /////
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenFilter.h

    r1313 r1386  
    3939#include "TRenImage.h"
    4040#include "TRenInterpFilter.h"
    41 #if NH_3D
     41#if NH_3D_VSO
    4242
    4343typedef Int (TRenInterpFilter<REN_BIT_DEPTH>::*FpChromaIntFilt) ( Pel*, Int );
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenImage.cpp

    r1313 r1386  
    3737#include "TRenFilter.h"
    3838#include "assert.h"
    39 #if NH_3D
     39#if NH_3D_VSO
    4040
    4141
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenImage.h

    r1313 r1386  
    3939#include "../TLibCommon/TComPicYuv.h"
    4040#include "TRenImagePlane.h"
    41 #if NH_3D
     41#if NH_3D_VSO
    4242
    4343
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenImagePlane.cpp

    r1313 r1386  
    3636#include "TRenFilter.h"
    3737#include <string.h>
    38 #if NH_3D
     38#if NH_3D_VSO
    3939
    4040/////// TRenImagePlane ///////
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenImagePlane.h

    r1313 r1386  
    3939#include "../TLibCommon/TComPicYuv.h"
    4040
    41 #if NH_3D
     41#if NH_3D_VSO
    4242#define PelImagePlane     TRenImagePlane<Pel>
    4343#define DoubleImagePlane  TRenImagePlane<Double>
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenInterpFilter.cpp

    r1313 r1386  
    3939
    4040#include "TRenInterpFilter.h"
    41 #if NH_3D
     41#if NH_3D_VSO
    4242
    4343// ====================================================================================================================
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenInterpFilter.h

    r1313 r1386  
    4444#include "TLibCommon/CommonDef.h"
    4545#include "assert.h"
    46 #if NH_3D
     46#if NH_3D_VSO
    4747
    4848// ====================================================================================================================
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenModSetupStrParser.cpp

    r1313 r1386  
    3737#include "TRenModSetupStrParser.h"
    3838
    39 #if NH_3D
     39#if NH_3D_VSO
    4040Int
    4141TRenModSetupStrParser::getNumOfModels()
     
    153153
    154154Void
    155 TRenModSetupStrParser::setString( Int iNumOfBaseViews, Char* pchSetStr )
     155TRenModSetupStrParser::setString( Int iNumOfBaseViews, TChar* pchSetStr )
    156156{
    157157  for (Int iContent = 0; iContent < 2; iContent++)
     
    178178TRenModSetupStrParser::xParseString()
    179179{
    180   Char cChar;
     180  TChar cChar;
    181181  xGetNextChar(cChar);
    182182  while(  cChar != '\0' )
     
    220220  m_bCurrentViewSet = false;
    221221
    222   Char cChar;
     222  TChar cChar;
    223223  xGetNextCharGoOn( cChar );
    224224  xError( cChar != '[' );
     
    249249
    250250Void
    251 TRenModSetupStrParser::xReadViews( Char cType )
    252 {
    253   Char cChar;
     251TRenModSetupStrParser::xReadViews( TChar cType )
     252{
     253  TChar cChar;
    254254  xGetNextCharGoOn( cChar );
    255255  xError( cChar != '(' );
     
    272272
    273273Void
    274 TRenModSetupStrParser::xReadViewInfo( Char cType )
     274TRenModSetupStrParser::xReadViewInfo( TChar cType )
    275275{
    276276  std::vector<Int> aiViewNums;
     
    280280  {
    281281  case 'B':
    282     Char cVideoType;
    283     Char cDepthType;
     282    TChar cVideoType;
     283    TChar cDepthType;
    284284
    285285    xGetNextCharGoOn   ( cVideoType );
     
    317317  case 'L':
    318318  case 'R':
    319     Char cRefType;
     319    TChar cRefType;
    320320    xGetNextCharGoOn   ( cRefType   );
    321321    xGetViewNumberRange( aiViewNums );
     
    328328
    329329Void
    330 TRenModSetupStrParser::xAddBaseView( Int iViewIdx, Char cVideoType, Char cDepthType )
     330TRenModSetupStrParser::xAddBaseView( Int iViewIdx, TChar cVideoType, TChar cDepthType )
    331331{
    332332  AOF( m_bCurrentViewSet );
     
    334334  if ( cDepthType == 'x' ) cDepthType = 'o';
    335335  if ( cVideoType == 'x' ) cVideoType = 'o';
    336 
    337 
    338 
     336 
    339337  xError( cDepthType != 'o' && cDepthType != 'c' && cVideoType != 'r' );
    340338  xError( cVideoType != 'o' && cVideoType != 'c' && cVideoType != 'r' );
     
    346344
    347345Void
    348 TRenModSetupStrParser::xAddSynthView( Int iViewNum, Char cType, Char cRefType )
     346TRenModSetupStrParser::xAddSynthView( Int iViewNum, TChar cType, TChar cRefType )
    349347{
    350348  AOF( m_bCurrentViewSet );
     
    399397  size_t iStartPos;
    400398  size_t iEndPos;
    401   Char cChar;
     399  TChar cChar;
    402400  xGetNextCharGoOn(cChar );
    403401  if (cChar == '{')
     
    424422
    425423  size_t iNumElem = iEndPos - iStartPos + 1;
    426   Char* pcTempBuffer = new Char[  iNumElem + 1];
     424  TChar* pcTempBuffer = new TChar[  iNumElem + 1];
    427425  strncpy( pcTempBuffer, m_pchSetStr + iStartPos, iNumElem );
    428426  pcTempBuffer[iNumElem] = '\0';
     
    433431
    434432Void
    435 TRenModSetupStrParser::xGetNextCharGoOn( Char& rcNextChar )
     433TRenModSetupStrParser::xGetNextCharGoOn( TChar& rcNextChar )
    436434{
    437435  while ( m_pchSetStr[m_iPosInStr] == ' ' || m_pchSetStr[m_iPosInStr] == ',' )
     
    445443
    446444Void
    447 TRenModSetupStrParser::xGetNextChar( Char& rcNextChar )
     445TRenModSetupStrParser::xGetNextChar( TChar& rcNextChar )
    448446{
    449447  size_t iPos = m_iPosInStr;
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenModSetupStrParser.h

    r1356 r1386  
    3939#include "../TLibCommon/TypeDef.h"
    4040#include "../TAppCommon/TAppComCamPara.h"
    41 #if NH_3D
     41#if NH_3D_VSO
    4242
    4343
     
    9292  TRenModSetupStrParser();
    9393
    94   Void setString( Int iNumOfBaseViews, Char* pchSetStr );
     94  Void setString( Int iNumOfBaseViews, TChar* pchSetStr );
    9595
    9696private:
     
    112112  Int                              m_iNumberOfModels;
    113113
    114   Char*                            m_pchSetStr;
     114  TChar*                            m_pchSetStr;
    115115  size_t                           m_iPosInStr;
    116116
     
    118118  Void xParseString();
    119119  Void xParseSourceView();
    120   Void xReadViews         ( Char cType );
    121   Void xReadViewInfo      ( Char cType );
    122   Void xAddBaseView       ( Int iViewIdx, Char cVideoType, Char cDepthType );
    123   Void xAddSynthView      ( Int iViewNum, Char cType, Char cRefType );
     120  Void xReadViews         ( TChar cType );
     121  Void xReadViewInfo      ( TChar cType );
     122  Void xAddBaseView       ( Int iViewIdx, TChar cVideoType, TChar cDepthType );
     123  Void xAddSynthView      ( Int iViewNum, TChar cType, TChar cRefType );
    124124  Void xError             ( Bool bIsError );
    125125  Void xGetViewNumberRange( std::vector<Int>& raiViewNumbers );
    126   Void xGetNextCharGoOn   ( Char& rcNextChar );
    127   Void xGetNextChar       ( Char& rcNextChar );
     126  Void xGetNextCharGoOn   ( TChar& rcNextChar );
     127  Void xGetNextChar       ( TChar& rcNextChar );
    128128};
    129129
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenTop.cpp

    r1313 r1386  
    4040#include <math.h>
    4141#include "../TLibCommon/CommonDef.h"
    42 #if NH_3D
     42#if NH_3D_VSO
    4343
    4444
  • TabularUnified trunk/source/Lib/TLibRenderer/TRenTop.h

    r1313 r1386  
    3939#include "../TLibCommon/TComPicYuv.h"
    4040
    41 #if NH_3D
     41#if NH_3D_VSO
    4242#include <list>
    4343#include <vector>
  • TabularUnified trunk/source/Lib/TLibVideoIO/TVideoIOYuv.cpp

    r1313 r1386  
    9595}
    9696
     97static Void
     98copyPlane(const TComPicYuv &src, const ComponentID srcPlane, TComPicYuv &dest, const ComponentID destPlane);
    9799
    98100// ====================================================================================================================
     
    116118 * \param internalBitDepth bit-depth array to scale image data to/from when reading/writing.
    117119 */
    118 Void TVideoIOYuv::open( Char* pchFile, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] )
     120Void TVideoIOYuv::open( const std::string &fileName, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] )
    119121{
    120122  //NOTE: files cannot have bit depth greater than 16
     
    141143  if ( bWriteMode )
    142144  {
    143     m_cHandle.open( pchFile, ios::binary | ios::out );
     145    m_cHandle.open( fileName.c_str(), ios::binary | ios::out );
    144146
    145147    if( m_cHandle.fail() )
     
    151153  else
    152154  {
    153     m_cHandle.open( pchFile, ios::binary | ios::in );
     155    m_cHandle.open( fileName.c_str(), ios::binary | ios::in );
    154156
    155157    if( m_cHandle.fail() )
     
    217219
    218220  /* fall back to consuming the input */
    219   Char buf[512];
     221  TChar buf[512];
    220222  const streamoff offset_mod_bufsize = offset % sizeof(buf);
    221223  for (streamoff i = 0; i < offset - offset_mod_bufsize; i += sizeof(buf))
     
    274276  const UInt stride_file      = (width444 * (is16bit ? 2 : 1)) >> csx_file;
    275277
    276   UChar  *buf   = new UChar[stride_file];
     278  std::vector<UChar> bufVec(stride_file);
     279  UChar *buf=&(bufVec[0]);
    277280
    278281  if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || destFormat==CHROMA_400))
     
    297300      if (fd.eof() || fd.fail() )
    298301      {
    299         delete[] buf;
    300302        return false;
    301303      }
     
    311313      {
    312314        // read a new line
    313         fd.read(reinterpret_cast<Char*>(buf), stride_file);
     315        fd.read(reinterpret_cast<TChar*>(buf), stride_file);
    314316        if (fd.eof() || fd.fail() )
    315317        {
    316           delete[] buf;
    317318          return false;
    318319        }
     
    381382    }
    382383  }
    383   delete[] buf;
    384384  return true;
    385385}
     
    419419  const UInt height_file      = height444>>csy_file;
    420420
    421   UChar  *buf   = new UChar[stride_file];
     421  std::vector<UChar> bufVec(stride_file);
     422  UChar *buf=&(bufVec[0]);
    422423
    423424  if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || srcFormat==CHROMA_400))
     
    447448        }
    448449
    449         fd.write(reinterpret_cast<Char*>(buf), stride_file);
     450        fd.write(reinterpret_cast<const TChar*>(buf), stride_file);
    450451        if (fd.eof() || fd.fail() )
    451452        {
    452           delete[] buf;
    453453          return false;
    454454        }
     
    506506        }
    507507
    508         fd.write(reinterpret_cast<Char*>(buf), stride_file);
     508        fd.write(reinterpret_cast<const TChar*>(buf), stride_file);
    509509        if (fd.eof() || fd.fail() )
    510510        {
    511           delete[] buf;
    512511          return false;
    513512        }
     
    521520    }
    522521  }
    523   delete[] buf;
    524522  return true;
    525523}
     
    544542  const UInt height_file      = height444>>csy_file;
    545543
    546   UChar  *buf   = new UChar[stride_file * 2];
     544  std::vector<UChar> bufVec(stride_file * 2);
     545  UChar *buf=&(bufVec[0]);
    547546
    548547  if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || srcFormat==CHROMA_400))
     
    577576        }
    578577
    579         fd.write(reinterpret_cast<Char*>(buf), (stride_file * 2));
     578        fd.write(reinterpret_cast<const TChar*>(buf), (stride_file * 2));
    580579        if (fd.eof() || fd.fail() )
    581580        {
    582           delete[] buf;
    583581          return false;
    584582        }
     
    642640        }
    643641
    644         fd.write(reinterpret_cast<Char*>(buf), (stride_file * 2));
     642        fd.write(reinterpret_cast<const TChar*>(buf), (stride_file * 2));
    645643        if (fd.eof() || fd.fail() )
    646644        {
    647           delete[] buf;
    648645          return false;
    649646        }
     
    658655    }
    659656  }
    660   delete[] buf;
    661657  return true;
    662658}
     
    760756  if (ipCSC!=IPCOLOURSPACE_UNCHANGED)
    761757  {
    762     cPicYuvCSCd.create(pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), pPicYuvUser->getChromaFormat(), pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), 0, false);
     758    cPicYuvCSCd.createWithoutCUInfo(pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), pPicYuvUser->getChromaFormat() );
    763759    ColourSpaceConvert(*pPicYuvUser, cPicYuvCSCd, ipCSC, false);
    764760  }
     
    766762
    767763  // compute actual YUV frame size excluding padding size
    768   const Int   iStride444 = pPicYuv->getStride(COMPONENT_Y);
    769   const UInt width444  = pPicYuv->getWidth(COMPONENT_Y) - confLeft - confRight;
    770   const UInt height444 = pPicYuv->getHeight(COMPONENT_Y) -  confTop  - confBottom;
    771764  Bool is16bit = false;
    772765  Bool nonZeroBitDepthShift=false;
    773 
    774   if ((width444 == 0) || (height444 == 0))
    775   {
    776     printf ("\nWarning: writing %d x %d luma sample output picture!", width444, height444);
    777   }
    778766
    779767  for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     
    799787  {
    800788    dstPicYuv = new TComPicYuv;
    801     dstPicYuv->create( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat(), pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), 0, false );
    802     pPicYuv->copyToPic(dstPicYuv);
     789    dstPicYuv->createWithoutCUInfo( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat() );
    803790
    804791    for(UInt comp=0; comp<dstPicYuv->getNumberValidComponents(); comp++)
     
    810797      const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1;
    811798
     799      copyPlane(*pPicYuv, compID, *dstPicYuv, compID);
    812800      scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval);
    813801    }
     
    817805    dstPicYuv = pPicYuv;
    818806  }
     807
     808  const Int  stride444 = dstPicYuv->getStride(COMPONENT_Y);
     809  const UInt width444  = dstPicYuv->getWidth(COMPONENT_Y) - confLeft - confRight;
     810  const UInt height444 = dstPicYuv->getHeight(COMPONENT_Y) -  confTop  - confBottom;
     811
     812  if ((width444 == 0) || (height444 == 0))
     813  {
     814    printf ("\nWarning: writing %d x %d luma sample output picture!", width444, height444);
     815  }
     816
    819817#if NH_3D
    820818  for(UInt comp=0; retval && comp< ::getNumberValidComponents(format); comp++)
     
    825823    const ComponentID compID = ComponentID(comp);
    826824    const ChannelType ch=toChannelType(compID);
    827     const UInt csx = pPicYuv->getComponentScaleX(compID);
    828     const UInt csy = pPicYuv->getComponentScaleY(compID);
    829     const Int planeOffset =  (confLeft>>csx) + (confTop>>csy) * pPicYuv->getStride(compID);
    830     if (! writePlane(m_cHandle, dstPicYuv->getAddr(compID) + planeOffset, is16bit, iStride444, width444, height444, compID, dstPicYuv->getChromaFormat(), format, m_fileBitdepth[ch]))
     825    const UInt csx = dstPicYuv->getComponentScaleX(compID);
     826    const UInt csy = dstPicYuv->getComponentScaleY(compID);
     827    const Int planeOffset =  (confLeft>>csx) + (confTop>>csy) * dstPicYuv->getStride(compID);
     828    if (! writePlane(m_cHandle, dstPicYuv->getAddr(compID) + planeOffset, is16bit, stride444, width444, height444, compID, dstPicYuv->getChromaFormat(), format, m_fileBitdepth[ch]))
    831829    {
    832830      retval=false;
     
    852850  if (ipCSC!=IPCOLOURSPACE_UNCHANGED)
    853851  {
    854     cPicYuvTopCSCd   .create(pPicYuvUserTop   ->getWidth(COMPONENT_Y), pPicYuvUserTop   ->getHeight(COMPONENT_Y), pPicYuvUserTop   ->getChromaFormat(), pPicYuvUserTop   ->getWidth(COMPONENT_Y), pPicYuvUserTop   ->getHeight(COMPONENT_Y), 0, false);
    855     cPicYuvBottomCSCd.create(pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), pPicYuvUserBottom->getChromaFormat(), pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), 0, false);
     852    cPicYuvTopCSCd   .createWithoutCUInfo(pPicYuvUserTop   ->getWidth(COMPONENT_Y), pPicYuvUserTop   ->getHeight(COMPONENT_Y), pPicYuvUserTop   ->getChromaFormat() );
     853    cPicYuvBottomCSCd.createWithoutCUInfo(pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), pPicYuvUserBottom->getChromaFormat() );
    856854    ColourSpaceConvert(*pPicYuvUserTop,    cPicYuvTopCSCd,    ipCSC, false);
    857855    ColourSpaceConvert(*pPicYuvUserBottom, cPicYuvBottomCSCd, ipCSC, false);
     
    892890    {
    893891      dstPicYuv = new TComPicYuv;
    894       dstPicYuv->create( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat(), pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), 0, false );
    895       pPicYuv->copyToPic(dstPicYuv);
     892      dstPicYuv->createWithoutCUInfo( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat() );
    896893
    897894      for(UInt comp=0; comp<dstPicYuv->getNumberValidComponents(); comp++)
     
    903900        const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1;
    904901
     902        copyPlane(*pPicYuv, compID, *dstPicYuv, compID);
    905903        scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval);
    906904      }
     
    916914  assert(dstPicYuvTop->getNumberValidComponents() == dstPicYuvBottom->getNumberValidComponents());
    917915  assert(dstPicYuvTop->getChromaFormat()          == dstPicYuvBottom->getChromaFormat()         );
    918   assert(dstPicYuvTop->getWidth(COMPONENT_Y)      == dstPicYuvBottom->getWidth(COMPONENT_Y)    );
    919   assert(dstPicYuvTop->getHeight(COMPONENT_Y)     == dstPicYuvBottom->getHeight(COMPONENT_Y)    );
    920   assert(dstPicYuvTop->getStride(COMPONENT_Y)     == dstPicYuvBottom->getStride(COMPONENT_Y)    );
    921916
    922917  for(UInt comp=0; retval && comp<dstPicYuvTop->getNumberValidComponents(); comp++)
     
    925920    const ChannelType ch=toChannelType(compID);
    926921
     922    assert(dstPicYuvTop->getWidth          (compID) == dstPicYuvBottom->getWidth          (compID));
     923    assert(dstPicYuvTop->getHeight         (compID) == dstPicYuvBottom->getHeight         (compID));
    927924    assert(dstPicYuvTop->getComponentScaleX(compID) == dstPicYuvBottom->getComponentScaleX(compID));
    928925    assert(dstPicYuvTop->getComponentScaleY(compID) == dstPicYuvBottom->getComponentScaleY(compID));
  • TabularUnified trunk/source/Lib/TLibVideoIO/TVideoIOYuv.h

    r1313 r1386  
    6464  virtual ~TVideoIOYuv()  {}
    6565
    66   Void  open  ( Char* pchFile, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ); ///< open or create file
     66  Void  open  ( const std::string &fileName, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ); ///< open or create file
    6767  Void  close ();                                           ///< close file
    6868
Note: See TracChangeset for help on using the changeset viewer.