Changeset 1356 in 3DVCSoftware for trunk/source/Lib


Ignore:
Timestamp:
27 Oct 2015, 11:33:16 (9 years ago)
Author:
tech
Message:

Merged 15.1-dev0-NICT@1355.

Location:
trunk/source/Lib
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TAppCommon/program_options_lite.cpp

    r1313 r1356  
    111111    }
    112112
     113#if NH_MV_SEI
     114    static void setOptions(Options::NamesPtrList& opt_list, const std::vector<int> idcs, const string& value, ErrorReporter& error_reporter)
     115#else
    113116    static void setOptions(Options::NamesPtrList& opt_list, const string& value, ErrorReporter& error_reporter)
     117#endif
    114118    {
    115119      /* multiple options may be registered for the same name:
     
    117121      for (Options::NamesPtrList::iterator it = opt_list.begin(); it != opt_list.end(); ++it)
    118122      {
     123        #if NH_MV_SEI
     124          Bool doParsing = (*it)->opt->checkDim( idcs, error_reporter );
     125          if ( doParsing )
     126          {
     127            (*it)->opt->parse(value, idcs, error_reporter);
     128          }
     129         
     130        #else
    119131        (*it)->opt->parse(value, error_reporter);
     132        #endif
    120133      }
    121134    }
     
    277290    bool OptionWriter::storePair(bool allow_long, bool allow_short, const string& name, const string& value)
    278291    {
     292#if NH_MV_SEI
     293      std::vector<int> idcs;             
     294     
     295      std::size_t pos_underscore            = name.find("_" );         
     296      std::size_t pos_last_underscore_plus1 = pos_underscore+1;       
     297      std::size_t pos_first_underscore      = pos_underscore;
     298
     299      while ( pos_underscore != string::npos )
     300      {       
     301        pos_underscore   = name.find("_", pos_last_underscore_plus1  );         
     302        size_t subStrlen = ( pos_underscore == string::npos ) ? string::npos : ( pos_underscore - pos_last_underscore_plus1 );
     303        string idx_str   = name.substr( pos_last_underscore_plus1, subStrlen );
     304        idcs.push_back( atoi( idx_str.c_str()));
     305        pos_last_underscore_plus1 = pos_underscore + 1;         
     306      }
     307
     308      string name_idcs = name.substr(0, pos_first_underscore  );
     309      for (size_t i = 0; i < idcs.size(); i++ )
     310      {
     311        name_idcs += "_%d";
     312      }     
     313
     314      bool found_idcs = false;
     315      Options::NamesMap::iterator opt_it_idcs;
     316#endif
    279317      bool found = false;
    280318      Options::NamesMap::iterator opt_it;
     
    286324          found = true;
    287325        }
     326#if NH_MV_SEI
     327        if ( idcs.size() > 0 )
     328        {
     329          opt_it_idcs = opts.opt_long_map.find(name_idcs);
     330          if (opt_it_idcs != opts.opt_long_map.end() )
     331          {
     332            assert( !found );
     333            found = true;
     334            found_idcs = true;
     335            opt_it = opt_it_idcs; 
     336          }
     337        }
     338#endif
    288339      }
    289340
     
    296347          found = true;
    297348        }
    298       }
    299 
     349#if NH_MV_SEI
     350        if ( idcs.size() > 0 )
     351        {
     352          opt_it = opts.opt_short_map.find(name);
     353          if (opt_it != opts.opt_short_map.end())
     354          {
     355            assert( !found );
     356            found = true;
     357            found_idcs = true;
     358            opt_it = opt_it_idcs; 
     359          }
     360        }
     361#endif
     362      }
     363
     364#if NH_MV_SEI
     365    if ( !found_idcs )
     366    {
     367      idcs.clear();
     368    }
     369#endif
    300370      if (!found)
    301371      {
     372#if NH_MV_SEI
     373        if (error_reporter.output_on_unknow_parameter )
     374        {       
     375#endif
     376
    302377        error_reporter.error(where())
    303378          << "Unknown option `" << name << "' (value:`" << value << "')\n";
     379#if NH_MV_SEI
     380        }
     381#endif
    304382        return false;
    305383      }
    306384
     385#if NH_MV_SEI
     386      setOptions((*opt_it).second, idcs, value, error_reporter);
     387#else
    307388      setOptions((*opt_it).second, value, error_reporter);
     389#endif
    308390      return true;
    309391    }
  • trunk/source/Lib/TAppCommon/program_options_lite.h

    r1313 r1356  
    7878    struct ErrorReporter
    7979    {
     80#if NH_MV_SEI
     81      ErrorReporter() : is_errored(0), output_on_unknow_parameter(true)  {}
     82#else
    8083      ErrorReporter() : is_errored(0) {}
     84#endif
    8185      virtual ~ErrorReporter() {}
    8286      virtual std::ostream& error(const std::string& where);
    8387      virtual std::ostream& warn(const std::string& where);
    8488      bool is_errored;
     89#if NH_MV_SEI
     90      bool output_on_unknow_parameter;
     91#endif
    8592    };
    8693
     
    98105    {
    99106#if NH_MV     
     107#if NH_MV_SEI     
     108      OptionBase(const std::string& name, const std::string& desc, bool duplicate = false, std::vector< int > maxdim = std::vector< int >(0) )
     109        : opt_string(name), opt_desc(desc), opt_duplicate(duplicate), max_dim( maxdim )
     110#else
    100111      OptionBase(const std::string& name, const std::string& desc, bool duplicate = false)
    101112        : opt_string(name), opt_desc(desc), opt_duplicate(duplicate)
     113#endif
    102114#else
    103115      OptionBase(const std::string& name, const std::string& desc)
     
    109121
    110122      /* parse argument arg, to obtain a value for the option */
     123#if NH_MV_SEI
     124      virtual void parse(const std::string& arg, const std::vector<int>& idcs,  ErrorReporter&) = 0;
     125     
     126      bool   checkDim( std::vector< int > dims, ErrorReporter& err )
     127      {     
     128        bool doParsing = true;
     129        if ( dims.size() != max_dim.size() )
     130        {
     131            err.error(" ") << "Number of indices of `" <<  opt_string << "' not matching. Should be " << max_dim.size() << std::endl;
     132            doParsing = false;
     133        }
     134
     135        for (size_t i = 0 ; i < dims.size(); i++ )
     136        {
     137          if ( dims[i] >= max_dim[i] )
     138          {
     139            if (err.output_on_unknow_parameter )
     140            {       
     141              err.warn(" ") << "Index " << i  << " of  " <<  opt_string << " should be less than " << max_dim[i] << std::endl;             
     142              doParsing = false;
     143            }
     144          }
     145        }
     146        return doParsing;
     147      }
     148
     149      void   xParseVec( const std::string& arg, BoolAry1d& storage )
     150      {       
     151        char* pcNextStart = (char*) arg.data();
     152        char* pcEnd = pcNextStart + arg.length();
     153
     154        char* pcOldStart = 0;
     155
     156        size_t iIdx = 0;
     157
     158        while (pcNextStart < pcEnd)
     159        {
     160          if ( iIdx < storage.size() )
     161          {
     162            storage[iIdx] = (strtol(pcNextStart, &pcNextStart,10) != 0);
     163          }
     164          else
     165          {
     166            storage.push_back(strtol(pcNextStart, &pcNextStart,10) != 0) ;
     167          }
     168          iIdx++;
     169
     170          if ( errno == ERANGE || (pcNextStart == pcOldStart) )
     171          {
     172            std::cerr << "Error Parsing Bools: `" << arg << "'" << std::endl;
     173            exit(EXIT_FAILURE);
     174          };   
     175          while( (pcNextStart < pcEnd) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++; 
     176          pcOldStart = pcNextStart;
     177        }
     178      }
     179
     180      void   xParseVec( const std::string& arg, IntAry1d& storage )
     181      {       
     182        storage.clear();
     183
     184        char* pcNextStart = (char*) arg.data();
     185        char* pcEnd = pcNextStart + arg.length();
     186
     187        char* pcOldStart = 0;
     188
     189        size_t iIdx = 0;
     190
     191
     192        while (pcNextStart < pcEnd)
     193        {
     194
     195          if ( iIdx < storage.size() )
     196          {
     197            storage[iIdx] = (int) strtol(pcNextStart, &pcNextStart,10);
     198          }
     199          else
     200          {
     201            storage.push_back( (int) strtol(pcNextStart, &pcNextStart,10)) ;
     202          }
     203          iIdx++;
     204          if ( errno == ERANGE || (pcNextStart == pcOldStart) )
     205          {
     206            std::cerr << "Error Parsing Integers: `" << arg << "'" << std::endl;
     207            exit(EXIT_FAILURE);
     208          };   
     209          while( (pcNextStart < pcEnd) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++; 
     210          pcOldStart = pcNextStart;
     211        }     
     212      }
     213#else
    111214      virtual void parse(const std::string& arg, ErrorReporter&) = 0;
     215#endif
    112216      /* set the argument to the default value */
    113217      virtual void setDefault() = 0;
     
    117221#if NH_MV
    118222      bool        opt_duplicate;
     223#if NH_MV_SEI
     224      std::vector<int> max_dim;
     225#endif
    119226#endif
    120227    };
     
    125232    {
    126233#if NH_MV
     234#if NH_MV_SEI
     235      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) )
     236        : OptionBase(name, desc, duplicate, maxdim), opt_storage(storage), opt_default_val(default_val)
     237#else
    127238      Option(const std::string& name, T& storage, T default_val, const std::string& desc, bool duplicate = false)
    128239        : OptionBase(name, desc, duplicate), opt_storage(storage), opt_default_val(default_val)
     240#endif
    129241#else
    130242      Option(const std::string& name, T& storage, T default_val, const std::string& desc)
     
    133245      {}
    134246
     247#if NH_MV_SEI
     248      void parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter&);
     249#else
    135250      void parse(const std::string& arg, ErrorReporter&);
     251#endif
    136252
    137253      void setDefault()
     
    147263    template<typename T>
    148264    inline void
     265#if NH_MV_SEI
     266    Option<T>::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter&)
     267#else
    149268    Option<T>::parse(const std::string& arg, ErrorReporter&)
    150     {
     269#endif
     270    {
     271#if NH_MV_SEI
     272      assert( idcs.size() == 0 );
     273#endif
     274     
    151275      std::istringstream arg_ss (arg,std::istringstream::in);
    152276      arg_ss.exceptions(std::ios::failbit);
     
    165289    template<>
    166290    inline void
     291#if NH_MV_SEI
     292    Option<std::string>::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter&)
     293#else
    167294    Option<std::string>::parse(const std::string& arg, ErrorReporter&)
    168     {
     295#endif
     296    {
     297#if NH_MV_SEI
     298      assert( idcs.size() == 0 );
     299#endif
    169300      opt_storage = arg;
    170301    }
     
    173304    template<>
    174305    inline void
     306#if NH_MV_SEI
     307      Option<char*>::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter&)
     308#else
    175309      Option<char*>::parse(const std::string& arg, ErrorReporter&)
    176     {
     310#endif
     311    {
     312#if NH_MV_SEI
     313      assert( idcs.size() == 0 );
     314#endif
    177315      opt_storage = arg.empty() ? NULL : strdup(arg.c_str()) ;
    178316    }
     317
     318#if !NH_MV_SEI
    179319
    180320    template<>
     
    198338      }     
    199339    }
    200 
     340#endif
    201341
    202342    template<>   
    203343    inline void
     344#if NH_MV_SEI
     345      Option< std::vector<double> >::parse(const std::string& arg, const std::vector< int > & idcs, ErrorReporter&)
     346#else
    204347      Option< std::vector<double> >::parse(const std::string& arg, ErrorReporter&)
    205     {
     348#endif
     349    {
     350#if NH_MV_SEI
     351      assert( idcs.size() == 0 );
     352#endif
    206353      char* pcNextStart = (char*) arg.data();
    207354      char* pcEnd = pcNextStart + arg.length();
     
    236383    }
    237384
     385
     386#if NH_MV_SEI
     387    template<>
     388    inline void
     389      Option< IntAry1d >::parse(const std::string& arg, const IntAry1d& idcs, ErrorReporter& err)
     390    {
     391      xParseVec( arg, opt_storage );
     392    };
     393
     394    template<>
     395    inline void
     396      Option< IntAry2d >::parse(const std::string& arg, const IntAry1d& idcs, ErrorReporter&)
     397    {
     398      xParseVec( arg, opt_storage[ idcs[0] ] );
     399    };
     400
     401    template<>
     402    inline void
     403      Option< IntAry3d >::parse(const std::string& arg, const IntAry1d& idcs, ErrorReporter&)
     404    {
     405      xParseVec ( arg, opt_storage[ idcs[0] ][ idcs[1] ] );
     406    };
     407#if SEI_DRI_F0169
     408    template<>
     409    inline void
     410    Option< std::vector< std::vector<double> > >::parse(const std::string& arg, const IntAry1d& idcs, ErrorReporter&)
     411    {
     412        // xParseVec ( arg, opt_storage[ idcs[0] ] );
     413        char* pcNextStart = (char*) arg.data();
     414        char* pcEnd = pcNextStart + arg.length();
     415
     416        char* pcOldStart = 0;
     417
     418        size_t iIdx = 0;
     419
     420        while (pcNextStart < pcEnd)
     421        {
     422            errno = 0;
     423
     424            if ( iIdx < opt_storage[idcs[0]].size() )
     425            {
     426                opt_storage[idcs[0]][iIdx] = strtod(pcNextStart, &pcNextStart);
     427            }
     428            else
     429            {
     430                opt_storage[idcs[0]].push_back( strtod(pcNextStart, &pcNextStart)) ;
     431            }
     432            iIdx++;
     433
     434            if ( errno == ERANGE || (pcNextStart == pcOldStart) )
     435            {
     436                std::cerr << "Error Parsing Doubles: `" << arg << "'" << std::endl;
     437                exit(EXIT_FAILURE);   
     438            };   
     439            while( (pcNextStart < pcEnd) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++; 
     440            pcOldStart = pcNextStart;
     441
     442        }       
     443
     444
     445    }
     446#endif
     447#else
    238448    template<>
    239449    inline void
     
    272482      }
    273483    }
    274 
    275 
     484#endif
     485
     486#if NH_MV_SEI
     487
     488    template<>
     489    inline void
     490      Option< StringAry1d  >::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter& err )
     491    {
     492
     493      opt_storage[ idcs[ 0 ] ] = arg;
     494    };
     495
     496    template<>
     497    inline void
     498      Option< StringAry2d  >::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter& err )
     499    {
     500
     501      opt_storage[idcs[0]][idcs[1]] = arg;
     502    };
     503
     504
     505    template<>
     506    inline void
     507      Option< std::vector< char*>  >::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter& err )
     508    {
     509     
     510      opt_storage[ idcs[ 0 ] ] = arg.empty() ? NULL : strdup(arg.c_str()) ;
     511    };
     512
     513    template<>
     514    inline void
     515      Option< BoolAry1d >::parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter& err)
     516    {     
     517      xParseVec( arg, opt_storage );
     518    };
     519
     520    template<>
     521    inline void
     522      Option< BoolAry2d >::parse(const std::string& arg, const IntAry1d& idcs, ErrorReporter& err)
     523    {     
     524      xParseVec( arg, opt_storage[ idcs[0] ] );
     525    };
     526
     527    template<>
     528    inline void
     529      Option< BoolAry3d >::parse(const std::string& arg, const IntAry1d& idcs, ErrorReporter& err )
     530    {     
     531      xParseVec( arg, opt_storage[idcs[0]][idcs[1]] );
     532    };
     533#else
    276534    template<>
    277535    inline void
     
    307565    }
    308566#endif
     567#endif
    309568    /** Option class for argument handling using a user provided function */
    310569    struct OptionFunc : public OptionBase
     
    316575      {}
    317576
     577#if NH_MV_SEI
     578      void parse(const std::string& arg, const std::vector<int>& idcs, ErrorReporter& error_reporter)
     579#else
    318580      void parse(const std::string& arg, ErrorReporter& error_reporter)
     581#endif
    319582      {
    320583        func(parent, arg, error_reporter);
     
    388651        operator()(const std::string& name, std::vector<T>& storage, T default_val, unsigned uiMaxNum, const std::string& desc = "" )
    389652      {
     653#if NH_MV_SEI
     654        std::vector<T> defVal;
     655        defVal.resize( uiMaxNum, default_val );
     656        std::vector< int > maxSize;
     657        maxSize.push_back( uiMaxNum );
     658        parent.addOption(new Option< std::vector<T> >( name, storage, defVal, desc, false, maxSize ));
     659
     660        return *this;
     661      }
     662
     663      template<typename T>
     664      OptionSpecific&
     665        operator()(const std::string& name, std::vector< std::vector<T> >& storage, T default_val, unsigned uiMaxNumDim1, unsigned uiMaxNumDim2, const std::string& desc = "" )
     666      {
     667        std::vector< std::vector<T> > defVal;
     668        defVal.resize(uiMaxNumDim1);
     669        for ( unsigned int idxDim1 = 0; idxDim1 < uiMaxNumDim1; idxDim1++ )
     670        {
     671          defVal[ idxDim1 ].resize(uiMaxNumDim2, default_val );         
     672        }
     673
     674        std::vector< int > maxSize;
     675        maxSize.push_back( uiMaxNumDim1 );
     676        maxSize.push_back( uiMaxNumDim2 );
     677
     678        parent.addOption(new Option< std::vector< std::vector<T> > >( name, storage, defVal, desc, false, maxSize ));
     679        return *this;
     680      }
     681#else
    390682        std::string cNameBuffer;
    391683        std::string cDescBuffer;
     
    415707        return *this;
    416708      }
     709#endif
    417710#endif
    418711      /**
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r1322 r1356  
    173173#if NH_MV
    174174static const Int MAX_NUM_LAYER_IDS =                               63;
     175#if NH_MV_SEI
     176static const Int MAX_NUM_SEIS      =                               1000;
     177#endif
    175178#else
    176179static const Int MAX_NUM_LAYER_IDS =                               64;
     
    280283static const Int  MAX_NUM_PICS_RPS          =                     16 ;
    281284static const Int  MAX_NUM_REF_LAYERS        =                     63 ; 
     285#if NH_MV_SEI
     286static IntAry1d getRangeVec( Int rngStart, Int rngEnd ) { IntAry1d rng; for (Int i = rngStart; i<=rngEnd; i++) rng.push_back(i);  return rng; };
     287static const IntAry1d IDR_NAL_UNIT_TYPES   = getRangeVec( NAL_UNIT_CODED_SLICE_IDR_W_RADL, NAL_UNIT_CODED_SLICE_IDR_N_LP );
     288static const IntAry1d IRAP_NAL_UNIT_TYPES  = getRangeVec( NAL_UNIT_CODED_SLICE_BLA_W_LP  , NAL_UNIT_CODED_SLICE_CRA      );
     289
     290#endif
    282291#endif
    283292
  • trunk/source/Lib/TLibCommon/SEI.cpp

    r1313 r1356  
    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
     41#include "TComSlice.h"
     42#endif
    4043
    4144SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
     
    150153    case SEI::CHROMA_SAMPLING_FILTER_HINT:          return "Chroma sampling filter hint";
    151154#if NH_MV
    152     case SEI::SUB_BITSTREAM_PROPERTY:               return "Sub-bitstream property SEI message";     
     155    case SEI::COLOUR_REMAPPING_INFO:                     return "Colour remapping information";
     156    case SEI::DEINTERLACED_FIELD_IDENTIFICATION:         return "Deinterlaced field identification";
     157    case SEI::LAYERS_NOT_PRESENT:                        return "Layers not present";
     158    case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:         return "Inter-layer constrained tile sets";
     159    case SEI::BSP_NESTING:                               return "Bitstream partition nesting";
     160    case SEI::BSP_INITIAL_ARRIVAL_TIME:                  return "Bitstream partition initial arrival time";
     161    case SEI::SUB_BITSTREAM_PROPERTY:                    return "Sub-bitstream property";
     162    case SEI::ALPHA_CHANNEL_INFO:                        return "Alpha channel information";
     163    case SEI::OVERLAY_INFO:                              return "Overlay information"  ;
     164    case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS:        return "Temporal motion vector prediction constraints";
     165    case SEI::FRAME_FIELD_INFO:                          return "Frame-field information";
     166    case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO: return "3D reference displays information";
     167    case SEI::DEPTH_REPRESENTATION_INFO:                 return "Depth representation information";
     168    case SEI::MULTIVIEW_SCENE_INFO:                      return "Multiview scene information";
     169    case SEI::MULTIVIEW_ACQUISITION_INFO:                return "Multiview acquisition information";
     170    case SEI::MULTIVIEW_VIEW_POSITION:                   return "Multiview view position";
     171#if NH_3D
     172    case SEI::ALTERNATIVE_DEPTH_INFO:                    return "Alternative depth information";
     173#endif
    153174#endif
    154175    default:                                        return "Unknown";
    155176  }
    156177}
     178
     179#if NH_MV_SEI
     180SEI::SEI()
     181{
     182  m_scalNestSeiContThisSei = NULL;
     183}
     184
     185SEI* SEI::getNewSEIMessage(SEI::PayloadType payloadType)
     186{
     187  switch (payloadType)
     188  {
     189#if NH_MV_SEI_TBD
     190    //////////////////////////////////////////////////////////////////////////
     191    // TBD: Modify version 1 SEIs to use the same interfaces as Annex GFI SEI messages.
     192    //////////////////////////////////////////////////////////////////////////
     193
     194    case SEI::BUFFERING_PERIOD:                     return new SEIBufferingPeriod;
     195    case SEI::PICTURE_TIMING:                       return new SEIPictureTiming;
     196    case SEI::PAN_SCAN_RECT:                        return new SEIPanScanRectangle;                    // not currently decoded
     197    case SEI::FILLER_PAYLOAD:                       return new SEIFillerPaylod;                       // not currently decoded
     198    case SEI::USER_DATA_REGISTERED_ITU_T_T35:       return new SEIUserDataRegistered;                 // not currently decoded
     199    case SEI::USER_DATA_UNREGISTERED:               return new SEIuserDataUnregistered;
     200    case SEI::RECOVERY_POINT:                       return new SEIRecoveryPoint;
     201    case SEI::SCENE_INFO:                           return new SEISceneInformation;                    // not currently decoded
     202    case SEI::FULL_FRAME_SNAPSHOT:                  return new SEIPictureSnapshot;                     // not currently decoded
     203    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_START: return new SEIProgressiveRefinementSegmentStart;   // not currently decoded
     204    case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_END:   return new SEIProgressiveRefinementSegmentEnd;     // not currently decoded
     205    case SEI::FILM_GRAIN_CHARACTERISTICS:           return new SEIFilmGrainCharacteristics;            // not currently decoded
     206    case SEI::POST_FILTER_HINT:                     return new SEIPostFilterHint;                      // not currently decoded
     207    case SEI::TONE_MAPPING_INFO:                    return new SEIToneMappingInfo;
     208    case SEI::KNEE_FUNCTION_INFO:                   return new SEIKneeFunctionInfo;
     209    case SEI::FRAME_PACKING:                        return new SEIFramePacking;
     210    case SEI::DISPLAY_ORIENTATION:                  return new SEIDisplayOrientation;
     211    case SEI::SOP_DESCRIPTION:                      return new SEISOPDescription;
     212    case SEI::ACTIVE_PARAMETER_SETS:                return new SEIActiveParameterSets;
     213    case SEI::DECODING_UNIT_INFO:                   return new SEIDecodingUnitInfo;
     214    case SEI::TEMPORAL_LEVEL0_INDEX:                return new SEITemporalLevel0Index
     215    case SEI::DECODED_PICTURE_HASH:                 return new SEIDecodedPictureHash;
     216    case SEI::SCALABLE_NESTING:                     return new SEIScalableNesting;
     217    case SEI::REGION_REFRESH_INFO:                  return new SEIRegionRefreshInfo;
     218    case SEI::NO_DISPLAY:                           return new SEINoDisplay;
     219    case SEI::TIME_CODE:                            return new SEITimeCode;
     220    case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:      return new SEIMasteringDisplayColourVolume;
     221    case SEI::SEGM_RECT_FRAME_PACKING:              return new SEISegmentedRectFramePacking;
     222    case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:    return new SEITempMotionConstrainedTileSets;
     223    case SEI::CHROMA_SAMPLING_FILTER_HINT:          return new SEIChromaSamplingFilterHint
     224#endif
     225#if NH_MV_SEI
     226#if NH_MV_LAYERS_NOT_PRESENT_SEI
     227  case SEI::LAYERS_NOT_PRESENT                    :               return new SEILayersNotPresent;
     228#endif
     229  case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS     :               return new SEIInterLayerConstrainedTileSets;
     230#if NH_MV_SEI_TBD
     231  case SEI::BSP_NESTING                           :               return new SEIBspNesting;
     232  case SEI::BSP_INITIAL_ARRIVAL_TIME              :               return new SEIBspInitialArrivalTime;
     233#endif
     234  case SEI::SUB_BITSTREAM_PROPERTY                :               return new SEISubBitstreamProperty;
     235  case SEI::ALPHA_CHANNEL_INFO                    :               return new SEIAlphaChannelInfo;
     236  case SEI::OVERLAY_INFO                          :               return new SEIOverlayInfo;
     237  case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS    :               return new SEITemporalMvPredictionConstraints;
     238#if NH_MV_SEI_TBD
     239  case SEI::FRAME_FIELD_INFO                      :               return new SEIFrameFieldInfo;
     240#endif
     241  case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:            return new SEIThreeDimensionalReferenceDisplaysInfo;
     242#if SEI_DRI_F0169
     243  case SEI::DEPTH_REPRESENTATION_INFO             :               return new SEIDepthRepresentationInfo;
     244#endif
     245  case SEI::MULTIVIEW_SCENE_INFO                  :               return new SEIMultiviewSceneInfo;
     246  case SEI::MULTIVIEW_ACQUISITION_INFO            :               return new SEIMultiviewAcquisitionInfo;
     247  case SEI::MULTIVIEW_VIEW_POSITION               :               return new SEIMultiviewViewPosition;
     248#if NH_3D
     249  case SEI::ALTERNATIVE_DEPTH_INFO                :               return new SEIAlternativeDepthInfo;
     250#endif
     251#endif
     252  default:                                        assert( false ); return NULL;
     253  }
     254}
     255
     256Void SEI::setupFromSlice  ( const TComSlice* slice )
     257{
     258  xPrintCfgErrorIntro();
     259  std::cout << getSEIMessageString( payloadType() ) << "Setup by the encoder is currently not possible. Using the default SEI cfg-file." << std::endl;
     260}
     261
     262SEI* SEI::getCopy() const
     263{
     264  assert( 0 );
     265  return NULL;
     266}
     267
     268Void SEI::setupFromCfgFile( const Char* cfgFile )
     269{
     270  assert( false );
     271}
     272
     273Bool SEI::insertSei( Int curLayerId, Int curPoc, Int curTid, Int curNaluType ) const
     274{
     275  Bool insertSeiHere = true;
     276  if( !m_applicableLayerIds.empty() )
     277  {
     278    insertSeiHere = insertSeiHere && ( std::find( m_applicableLayerIds.begin(), m_applicableLayerIds.end(), curLayerId) != m_applicableLayerIds.end() ) ;
     279  }
     280  if( !m_applicablePocs     .empty() )
     281  {
     282    insertSeiHere = insertSeiHere && ( std::find( m_applicablePocs    .begin(), m_applicablePocs    .end(), curPoc    ) != m_applicablePocs    .end() ) ;
     283  }
     284  if( !m_applicableTids     .empty() )
     285  {
     286    insertSeiHere = insertSeiHere && ( std::find( m_applicableTids    .begin(), m_applicableTids    .end(), curTid    ) != m_applicableTids    .end() ) ;
     287  }
     288  if( !m_applicableVclNaluTypes.empty() )
     289  {
     290    insertSeiHere = insertSeiHere && ( std::find( m_applicableVclNaluTypes.begin(), m_applicableVclNaluTypes.end(), curNaluType) != m_applicableVclNaluTypes.end() ) ;
     291  }
     292  return insertSeiHere;
     293}
     294
     295Bool SEI::checkCfg( const TComSlice* slice )
     296{
     297  assert( false );
     298  return true;
     299}
     300
     301Void SEI::xPrintCfgErrorIntro()
     302{
     303  std::cout << "Error in configuration of " << getSEIMessageString( payloadType() ) << " SEI: ";
     304}
     305
     306Void SEI::xCheckCfgRange( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const Char* seName )
     307{
     308  if ( val < minVal || val > maxVal  )
     309  {
     310    xPrintCfgErrorIntro();
     311    std::cout << "The value of " << seName << "shall be in the range of " << minVal << " to " << maxVal << ", inclusive." << std::endl;
     312    wrongConfig = true;
     313  }
     314}
     315
     316Void SEI::xAddGeneralOpts(po::Options &opts, IntAry1d defAppLayerIds, IntAry1d deftApplicablePocs,
     317                                            IntAry1d defAppTids,     IntAry1d defAppVclNaluTypes,
     318                                            Int defSeiNaluId, Int defPositionInSeiNalu, Bool defModifyByEncoder)
     319{
     320  opts.addOptions()
     321    ("PayloadType"            , m_payloadType            , -1                    , "Payload Type"                                                         )
     322    ("ApplicableLayerIds"     , m_applicableLayerIds     , defAppLayerIds        , "LayerIds      of layers   to which the SEI is added. (all when empty)")
     323    ("ApplicablePocs"         , m_applicablePocs         , deftApplicablePocs    , "POCs          of pictures to which the SEI is added. (all when empty)")
     324    ("ApplicableTids"         , m_applicableTids         , defAppTids            , "TIds          of pictures to which the SEI is added. (all when empty)")
     325    ("ApplicableVclNaluTypes" , m_applicableVclNaluTypes , defAppVclNaluTypes    , "NaluUnitTypes of picture  to which the SEI is added. (all when empty)")
     326    ("SeiNaluId"              , m_seiNaluId              , defSeiNaluId          , "Identifies to which NAL unit  the SEI is added." )
     327    ("PositionInSeiNalu"      , m_positionInSeiNalu      , defPositionInSeiNalu  , "Identifies the position within the NAL unit.")
     328    ("ModifyByEncoder"        , m_modifyByEncoder        , defModifyByEncoder    , "0: Use payload as specified in cfg file   1: Modify SEI by encoder");
     329}
     330
     331Void SEI::xCheckCfg( Bool& wrongConfig, Bool cond, const Char* errStr )
     332{
     333  if ( !cond  )
     334  {
     335    xPrintCfgErrorIntro();
     336    std::cout << errStr << std::endl;
     337    wrongConfig = true;
     338  }
     339}
     340
     341
     342#if NH_MV_LAYERS_NOT_PRESENT_SEI
     343Void SEILayersNotPresent::setupFromCfgFile(const Char* cfgFile)
     344{
     345  // Set default values
     346  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     347
     348  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     349  // This SEI message doesn't need to be added by default to any Layer / POC / NAL Unit / T Layer. Not sure if empty is right.
     350  defAppLayerIds    .empty( );
     351  defAppPocs        .empty( );
     352  defAppTids        .empty( );
     353  defAppVclNaluTypes.empty( );
     354
     355  Int      defSeiNaluId                  = 0;
     356  Int      defPositionInSeiNalu          = 0;
     357  Bool     defModifyByEncoder            = false;   //0: Use payload as specified in cfg file   1: Modify SEI by encoder
     358
     359  // Setup config file options
     360  po::Options opts;
     361  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     362
     363  opts.addOptions()
     364    ("LnpSeiActiveVpsId"              , m_lnpSeiActiveVpsId                , 0                              , "LnpSeiActiveVpsId"                )   //Why?
     365    ("LayerNotPresentFlag"            , m_layerNotPresentFlag              , BoolAry1d(1,0)                 , "LayerNotPresentFlag"              )
     366    ;
     367
     368  po::setDefaults(opts);
     369
     370  // Parse the cfg file
     371  po::ErrorReporter err;
     372  po::parseConfigFile( opts, cfgFile, err );
     373  m_lnpSeiMaxLayers = (UInt) m_layerNotPresentFlag.size();
     374};
     375
     376  Bool SEILayersNotPresent::checkCfg( const TComSlice* slice )
     377  {
     378  // Check config values
     379    Bool wrongConfig = false;
     380//
     381    const TComVPS* vps = slice->getVPS();
     382//  // TBD: Add constraints on presence of SEI here.
     383    xCheckCfg     ( wrongConfig, m_lnpSeiActiveVpsId == vps->getVPSId(), "The value of lnp_sei_active_vps_id shall be equal to the value of vps_video_parameter_set_id of the active VPS for the VCL NAL units of the access unit containing the SEI message." );
     384    xCheckCfg     ( wrongConfig, m_lnpSeiMaxLayers == vps->getMaxLayersMinus1(), "The number of LayerNotPresent flags shall be equal to vpsMaxLayersMinus1." );
     385
     386
     387    for (Int i = 0; i < vps->getMaxLayersMinus1(); i++)
     388    {
     389      if ( m_layerNotPresentFlag[ i ] && i < vps->getMaxLayersMinus1() )
     390      {
     391        for (Int j = 0; j < vps->getNumPredictedLayers( vps->getLayerIdInNuh( j ) - 1 ); j++ )
     392        {
     393          xCheckCfg     ( wrongConfig, m_layerNotPresentFlag[ vps->getLayerIdInVps( vps->getIdPredictedLayer( vps->getLayerIdInNuh(i),j) )], "When layer_not_present_flag[ i ] is equal to 1 and i is less than MaxLayersMinus1, layer_not_present_flag[ LayerIdxInVps[ IdPredictedLayer[ layer_id_in_nuh[ i ] ][ j ] ] ] shall be equal to 1 for all values of j in the range of 0 to NumPredictedLayers[ layer_id_in_nuh[ i ] ] - 1, inclusive." );
     394        }
     395      }
     396    }
     397
     398      return wrongConfig;
     399  };
     400#endif
     401
     402
     403Void SEIInterLayerConstrainedTileSets::setupFromCfgFile(const Char* cfgFile)
     404{
     405  // Set default values
     406  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     407
     408  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     409  defAppLayerIds    .empty( );
     410  defAppPocs        .push_back( 0 );
     411  defAppTids        .empty( );
     412  defAppVclNaluTypes.empty( );
     413
     414  Int      defSeiNaluId                  = 0;
     415  Int      defPositionInSeiNalu          = 0;
     416  Bool     defModifyByEncoder            = false;
     417
     418  // Setup config file options
     419  po::Options opts;
     420  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     421
     422  const Int maxNumTileInSet = 100;
     423
     424  opts.addOptions()
     425    ("IlAllTilesExactSampleValueMatchFlag", m_ilAllTilesExactSampleValueMatchFlag, false                    , "IlAllTilesExactSampleValueMatchFlag")
     426    ("IlOneTilePerTileSetFlag"        , m_ilOneTilePerTileSetFlag          , false                          , "IlOneTilePerTileSetFlag"          )
     427    ("IlNumSetsInMessageMinus1"       , m_ilNumSetsInMessageMinus1         , 0                              , "IlNumSetsInMessageMinus1"         )
     428    ("SkippedTileSetPresentFlag"      , m_skippedTileSetPresentFlag        , false                          , "SkippedTileSetPresentFlag"        )
     429    ("IlctsId"                        , m_ilctsId                          , IntAry1d (256,0)               , "IlctsId"                          )
     430    ("IlNumTileRectsInSetMinus1"      , m_ilNumTileRectsInSetMinus1        , IntAry1d (256,0)               , "IlNumTileRectsInSetMinus1"        )
     431    ("IlTopLeftTileIndex_%d"          , m_ilTopLeftTileIndex               , IntAry1d (maxNumTileInSet,0), 256, "IlTopLeftTileIndex"               )
     432    ("IlBottomRightTileIndex_%d"      , m_ilBottomRightTileIndex           , IntAry1d (maxNumTileInSet,0), 256, "IlBottomRightTileIndex"           )
     433    ("IlcIdc"                         , m_ilcIdc                           , IntAry1d (256,0)               , "IlcIdc"                           )
     434    ("IlExactSampleValueMatchFlag"    , m_ilExactSampleValueMatchFlag      , BoolAry1d(256,0)               , "IlExactSampleValueMatchFlag"      )
     435    ("AllTilesIlcIdc"                 , m_allTilesIlcIdc                   , 0                              , "AllTilesIlcIdc"                   )
     436    ;
     437
     438  po::setDefaults(opts);
     439
     440  // Parse the cfg file
     441  po::ErrorReporter err;
     442  po::parseConfigFile( opts, cfgFile, err );
     443};
     444
     445Bool SEIInterLayerConstrainedTileSets::checkCfg( const TComSlice* slice )
     446{
     447  // Check config values
     448  Bool wrongConfig = false;
     449  const TComPPS* pps = slice->getPPS();
     450
     451  // Currently only the active PPS checked.
     452  xCheckCfg     ( wrongConfig, pps->getTilesEnabledFlag() , "The inter-layer constrained tile sets SEI message shall not be present for the layer with nuh_layer_id equal to targetLayerId when tiles_enabled_flag is equal to 0 for any PPS that is active for the pictures of the CLVS of the layer with nuh_layer_id equal to targetLayerId." );
     453
     454  if ( m_ilOneTilePerTileSetFlag )
     455  {
     456    xCheckCfg( wrongConfig, ( pps->getNumTileColumnsMinus1() + 1 ) *  ( pps->getNumTileRowsMinus1() + 1 ) <= 256, "It is a requirement of bitstream conformance that when il_one_tile_per_tile_set_flag is equal to 1, the value of ( num_tile_columns_minus1 + 1 ) * ( num_tile_rows_minus1 + 1 ) shall be less than or equal to 256."    );
     457  }
     458  Int numSignificantSets = m_ilNumSetsInMessageMinus1 - m_skippedTileSetPresentFlag + 1;
     459
     460  for (Int i = 0 ; i < numSignificantSets; i++)
     461  {
     462    xCheckCfgRange( wrongConfig, m_ilctsId[i]                         , 0 , (1 << 30) - 1, "ilcts_id"                         );
     463  }
     464
     465  return wrongConfig;
     466};
     467#if NH_MV_SEI_TBD
     468
     469Void SEIBspNesting::setupFromSlice  ( const TComSlice* slice )
     470{
     471  sei.m_seiOlsIdx =  TBD ;
     472  sei.m_seiPartitioningSchemeIdx =  TBD ;
     473  sei.m_bspIdx =  TBD ;
     474  while( !ByteaLigned(() ) );
     475  {
     476    sei.m_bspNestingZeroBit =  TBD ;
     477  }
     478  sei.m_numSeisInBspMinus1 =  TBD ;
     479  for( Int i = 0; i  <=  NumSeisInBspMinus1( ); i++ )
     480  {
     481    SeiMessage(() );
     482  }
     483};
     484
     485Void SEIBspNesting::setupFromCfgFile(const Char* cfgFile)
     486{
     487  // Set default values
     488  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     489
     490  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     491  defAppLayerIds    .push_back( TBD );
     492  defAppPocs        .push_back( TBD );
     493  defAppTids        .push_back( TBD );
     494  defAppVclNaluTypes.push_back( TBD );
     495
     496  Int      defSeiNaluId                  = 0;
     497  Int      defPositionInSeiNalu          = 0;
     498  Bool     defModifyByEncoder            = TBD;
     499
     500  // Setup config file options
     501  po::Options opts;
     502  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     503
     504  opts.addOptions()
     505    ("SeiOlsIdx"                      , m_seiOlsIdx                        , 0                              , "SeiOlsIdx"                        )
     506    ("SeiPartitioningSchemeIdx"       , m_seiPartitioningSchemeIdx         , 0                              , "SeiPartitioningSchemeIdx"         )
     507    ("BspIdx"                         , m_bspIdx                           , 0                              , "BspIdx"                           )
     508    ("BspNestingZeroBit"              , m_bspNestingZeroBit                , 0                              , "BspNestingZeroBit"                )
     509    ("NumSeisInBspMinus1"             , m_numSeisInBspMinus1               , 0                              , "NumSeisInBspMinus1"               )
     510    ;
     511
     512  po::setDefaults(opts);
     513
     514  // Parse the cfg file
     515  po::ErrorReporter err;
     516  po::parseConfigFile( opts, cfgFile, err );
     517};
     518
     519Bool SEIBspNesting::checkCfg( const TComSlice* slice )
     520{
     521  // Check config values
     522  Bool wrongConfig = false;
     523
     524  // TBD: Add constraints on presence of SEI here.
     525  xCheckCfg     ( wrongConfig, TBD , "TBD" );
     526  xCheckCfg     ( wrongConfig, TBD , "TBD" );
     527
     528  // TBD: Modify constraints according to the SEI semantics.
     529  xCheckCfgRange( wrongConfig, m_seiOlsIdx                      , MINVAL , MAXVAL, "sei_ols_idx"          );
     530  xCheckCfgRange( wrongConfig, m_seiPartitioningSchemeIdx       , MINVAL , MAXVAL, "sei_partitioning_scheme_idx"       );
     531  xCheckCfgRange( wrongConfig, m_bspIdx                         , MINVAL , MAXVAL, "bsp_idx"              );
     532  xCheckCfgRange( wrongConfig, m_bspNestingZeroBit              , MINVAL , MAXVAL, "bsp_nesting_zero_bit ");
     533  xCheckCfgRange( wrongConfig, m_numSeisInBspMinus1             , MINVAL , MAXVAL, "num_seis_in_bsp_minus1"           );
     534
     535  return wrongConfig;
     536
     537};
     538
     539Void SEIBspInitialArrivalTime::setupFromSlice  ( const TComSlice* slice )
     540{
     541  psIdx = SeiPartitioningSchemeIdx();
     542  if( nalInitialArrivalDelayPresent )
     543  {
     544    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
     545    {
     546      sei.m_nalInitialArrivalDelay[i] =  TBD ;
     547    }
     548  }
     549  if( vclInitialArrivalDelayPresent )
     550  {
     551    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
     552    {
     553      sei.m_vclInitialArrivalDelay[i] =  TBD ;
     554    }
     555  }
     556};
     557
     558Void SEIBspInitialArrivalTime::setupFromCfgFile(const Char* cfgFile)
     559{
     560  // Set default values
     561  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     562
     563  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     564  defAppLayerIds    .push_back( TBD );
     565  defAppPocs        .push_back( TBD );
     566  defAppTids        .push_back( TBD );
     567  defAppVclNaluTypes.push_back( TBD );
     568
     569  Int      defSeiNaluId                  = 0;
     570  Int      defPositionInSeiNalu          = 0;
     571  Bool     defModifyByEncoder            = TBD;
     572
     573  // Setup config file options
     574  po::Options opts;
     575  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     576
     577  opts.addOptions()
     578    ("NalInitialArrivalDelay"         , m_nalInitialArrivalDelay           , IntAry1d (1,0)                 , "NalInitialArrivalDelay"           )
     579    ("VclInitialArrivalDelay"         , m_vclInitialArrivalDelay           , IntAry1d (1,0)                 , "VclInitialArrivalDelay"           )
     580    ;
     581
     582  po::setDefaults(opts);
     583
     584  // Parse the cfg file
     585  po::ErrorReporter err;
     586  po::parseConfigFile( opts, cfgFile, err );
     587};
     588
     589Bool SEIBspInitialArrivalTime::checkCfg( const TComSlice* slice )
     590{
     591  // Check config values
     592  Bool wrongConfig = false;
     593
     594  // TBD: Add constraints on presence of SEI here.
     595  xCheckCfg     ( wrongConfig, TBD , "TBD" );
     596  xCheckCfg     ( wrongConfig, TBD , "TBD" );
     597
     598  // TBD: Modify constraints according to the SEI semantics.
     599  xCheckCfgRange( wrongConfig, m_nalInitialArrivalDelay[i]      , MINVAL , MAXVAL, "nal_initial_arrival_delay"        );
     600  xCheckCfgRange( wrongConfig, m_vclInitialArrivalDelay[i]      , MINVAL , MAXVAL, "vcl_initial_arrival_delay"        );
     601
     602  return wrongConfig;
     603
     604};
     605#endif
     606
     607Void SEISubBitstreamProperty::setupFromCfgFile(const Char* cfgFile)
     608{
     609  // Set default values
     610  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     611
     612  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     613  defAppLayerIds    .push_back( 0 );
     614  defAppPocs        .push_back( 0 );
     615  defAppTids        .push_back( 0 );
     616  defAppVclNaluTypes = IRAP_NAL_UNIT_TYPES;
     617
     618  Int      defSeiNaluId                  = 0;
     619  Int      defPositionInSeiNalu          = 0;
     620  Bool     defModifyByEncoder            = false;
     621
     622  // Setup config file options
     623  po::Options opts;
     624  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     625
     626  opts.addOptions()
     627    ("SbPropertyActiveVpsId"          , m_sbPropertyActiveVpsId            , 0                              , "SbPropertyActiveVpsId"            )
     628    ("NumAdditionalSubStreamsMinus1"  , m_numAdditionalSubStreamsMinus1    , 0                              , "NumAdditionalSubStreamsMinus1"    )
     629    ("SubBitstreamMode"               , m_subBitstreamMode                 , IntAry1d (1,0)                 , "SubBitstreamMode"                 )
     630    ("OlsIdxToVps"                    , m_olsIdxToVps                      , IntAry1d (1,0)                 , "OlsIdxToVps"                      )
     631    ("HighestSublayerId"              , m_highestSublayerId                , IntAry1d (1,0)                 , "HighestSublayerId"                )
     632    ("AvgSbPropertyBitRate"           , m_avgSbPropertyBitRate             , IntAry1d (1,0)                 , "AvgSbPropertyBitRate"             )
     633    ("MaxSbPropertyBitRate"           , m_maxSbPropertyBitRate             , IntAry1d (1,0)                 , "MaxSbPropertyBitRate"             )
     634    ;
     635
     636  po::setDefaults(opts);
     637
     638  // Parse the cfg file
     639  po::ErrorReporter err;
     640  po::parseConfigFile( opts, cfgFile, err );
     641};
     642
     643Bool SEISubBitstreamProperty::checkCfg( const TComSlice* slice )
     644{
     645  // Check config values
     646  Bool wrongConfig = false;
     647
     648  // For the current encoder, the initial IRAP access unit has always POC zero.
     649  xCheckCfg     ( wrongConfig, slice->isIRAP() && (slice->getPOC() == 0), "When present, the sub-bitstream property SEI message shall be associated with an initial IRAP access unit and the information provided by the SEI messages applies to the bitstream corresponding to the CVS containing the associated initial IRAP access unit.");
     650
     651  Bool sizeNotCorrect =
     652    (    ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_subBitstreamMode    .size() )
     653    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_olsIdxToVps         .size() )
     654    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_highestSublayerId   .size() )
     655    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_avgSbPropertyBitRate.size() )
     656    || ( ( m_numAdditionalSubStreamsMinus1 + 1 ) != m_maxSbPropertyBitRate.size() );
     657
     658  xCheckCfg( wrongConfig, !sizeNotCorrect, "Some parameters of some sub-bitstream not provided." );
     659  xCheckCfg( wrongConfig, slice->getVPS()->getVPSId() == m_sbPropertyActiveVpsId, "The value of sb_property_active_vps_id shall be equal to the value of vps_video_parameter_set_id of the active VPS referred to by the VCL NAL units of the associated access unit." );
     660
     661  xCheckCfgRange( wrongConfig, m_numAdditionalSubStreamsMinus1  , 0 , (1 << 10) - 1 , "num_additional_sub_streams_minus1");
     662
     663  if ( !sizeNotCorrect )
     664  {
     665    for (Int i = 0; i <= m_numAdditionalSubStreamsMinus1; i++ )
     666    {
     667      xCheckCfgRange( wrongConfig, m_subBitstreamMode[i]    , 0 , 1                                          , "sub_bitstream_mode" );
     668      xCheckCfgRange( wrongConfig, m_olsIdxToVps[i]         , 0 , slice->getVPS()->getNumOutputLayerSets()-1 , "ols_idx_to_vps"     );
     669    }
     670  }
     671  return wrongConfig;
     672};
     673
     674Void SEISubBitstreamProperty::resizeArrays( )
     675{
     676  m_subBitstreamMode    .resize( m_numAdditionalSubStreamsMinus1 + 1);
     677  m_olsIdxToVps         .resize( m_numAdditionalSubStreamsMinus1 + 1);
     678  m_highestSublayerId   .resize( m_numAdditionalSubStreamsMinus1 + 1);
     679  m_avgSbPropertyBitRate.resize( m_numAdditionalSubStreamsMinus1 + 1);
     680  m_maxSbPropertyBitRate.resize( m_numAdditionalSubStreamsMinus1 + 1);
     681}
     682
     683Void SEIAlphaChannelInfo::setupFromCfgFile(const Char* cfgFile)
     684{
     685  // Set default values
     686  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     687
     688  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     689  defAppLayerIds    .clear();
     690  defAppPocs        .push_back( 0 );
     691  defAppTids        .push_back( 0 );
     692  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
     693
     694  Int      defSeiNaluId                  = 0;
     695  Int      defPositionInSeiNalu          = 0;
     696  Bool     defModifyByEncoder            = false;
     697
     698  // Setup config file options
     699  po::Options opts;
     700  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     701
     702  opts.addOptions()
     703    ("AlphaChannelCancelFlag"         , m_alphaChannelCancelFlag           , false                          , "AlphaChannelCancelFlag"           )
     704    ("AlphaChannelUseIdc"             , m_alphaChannelUseIdc               , 0                              , "AlphaChannelUseIdc"               )
     705    ("AlphaChannelBitDepthMinus8"     , m_alphaChannelBitDepthMinus8       , 0                              , "AlphaChannelBitDepthMinus8"       )
     706    ("AlphaTransparentValue"          , m_alphaTransparentValue            , 0                              , "AlphaTransparentValue"            )
     707    ("AlphaOpaqueValue"               , m_alphaOpaqueValue                 , 255                            , "AlphaOpaqueValue"                 )
     708    ("AlphaChannelIncrFlag"           , m_alphaChannelIncrFlag             , false                          , "AlphaChannelIncrFlag"             )
     709    ("AlphaChannelClipFlag"           , m_alphaChannelClipFlag             , false                          , "AlphaChannelClipFlag"             )
     710    ("AlphaChannelClipTypeFlag"       , m_alphaChannelClipTypeFlag         , false                          , "AlphaChannelClipTypeFlag"         )
     711    ;
     712
     713  po::setDefaults(opts);
     714
     715  // Parse the cfg file
     716  po::ErrorReporter err;
     717  po::parseConfigFile( opts, cfgFile, err );
     718
     719};
     720
     721Bool SEIAlphaChannelInfo::checkCfg( const TComSlice* slice )
     722{
     723  // Check config values
     724  Bool wrongConfig = false;
     725
     726  int maxInterpretationValue = (1 << (m_alphaChannelBitDepthMinus8+9)) - 1;
     727  xCheckCfgRange( wrongConfig, m_alphaChannelCancelFlag         , 0 , 1, "alpha_channel_cancel_flag"        );
     728  xCheckCfgRange( wrongConfig, m_alphaChannelUseIdc             , 0 , 7, "alpha_channel_use_idc");
     729  xCheckCfgRange( wrongConfig, m_alphaChannelBitDepthMinus8     , 0 , 7, "alpha_channel_bit_depth_minus8"   );
     730  xCheckCfgRange( wrongConfig, m_alphaTransparentValue          , 0 , maxInterpretationValue, "alpha_transparent_value"          );
     731  xCheckCfgRange( wrongConfig, m_alphaOpaqueValue               , 0 , maxInterpretationValue, "alpha_opaque_value"   );
     732  xCheckCfgRange( wrongConfig, m_alphaChannelIncrFlag           , 0 , 1, "alpha_channel_incr_flag"          );
     733  xCheckCfgRange( wrongConfig, m_alphaChannelClipFlag           , 0 , 1, "alpha_channel_clip_flag"          );
     734  xCheckCfgRange( wrongConfig, m_alphaChannelClipTypeFlag       , 0 , 1, "alpha_channel_clip_type_flag"     );
     735
     736  return wrongConfig;
     737
     738};
     739
     740SEIOverlayInfo::SEIOverlayInfo ( )
     741  : m_numOverlaysMax(16)
     742  , m_numOverlayElementsMax(256)
     743  , m_numStringBytesMax(256) //incl. null termination byte
     744{ };
     745
     746Void SEIOverlayInfo::setupFromCfgFile(const Char* cfgFile)
     747{
     748  // Set default values
     749  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     750
     751  // Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     752  defAppLayerIds    .clear();
     753  defAppPocs        .push_back( 0 );
     754  defAppTids        .push_back( 0 );
     755  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
     756
     757  Int      defSeiNaluId                  = 0;
     758  Int      defPositionInSeiNalu          = 0;
     759  Bool     defModifyByEncoder            = false;
     760
     761  // Setup config file options
     762  po::Options opts;
     763  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     764
     765  opts.addOptions()
     766    ("OverlayInfoCancelFlag"          , m_overlayInfoCancelFlag            , false                           , "OverlayInfoCancelFlag"            )
     767    ("OverlayContentAuxIdMinus128"    , m_overlayContentAuxIdMinus128      , 0                               , "OverlayContentAuxIdMinus128"      )
     768    ("OverlayLabelAuxIdMinus128"      , m_overlayLabelAuxIdMinus128        , 0                               , "OverlayLabelAuxIdMinus128"        )
     769    ("OverlayAlphaAuxIdMinus128"      , m_overlayAlphaAuxIdMinus128        , 0                               , "OverlayAlphaAuxIdMinus128"        )
     770    ("OverlayElementLabelValueLengthMinus8", m_overlayElementLabelValueLengthMinus8, 0                       , "OverlayElementLabelValueLengthMinus8")
     771    ("NumOverlaysMinus1"              , m_numOverlaysMinus1                , 0                               , "NumOverlaysMinus1"                )
     772    ("OverlayIdx"                     , m_overlayIdx                       , IntAry1d (16,0)                 , "OverlayIdx"                       )
     773    ("LanguageOverlayPresentFlag"     , m_languageOverlayPresentFlag       , BoolAry1d(16,0)                 , "LanguageOverlayPresentFlag"       )
     774    ("OverlayContentLayerId"          , m_overlayContentLayerId            , IntAry1d (16,0)                 , "OverlayContentLayerId"            )
     775    ("OverlayLabelPresentFlag"        , m_overlayLabelPresentFlag          , BoolAry1d(16,0)                 , "OverlayLabelPresentFlag"          )
     776    ("OverlayLabelLayerId"            , m_overlayLabelLayerId              , IntAry1d (16,0)                 , "OverlayLabelLayerId"              )
     777    ("OverlayAlphaPresentFlag"        , m_overlayAlphaPresentFlag          , BoolAry1d(16,0)                 , "OverlayAlphaPresentFlag"          )
     778    ("OverlayAlphaLayerId"            , m_overlayAlphaLayerId              , IntAry1d (16,0)                 , "OverlayAlphaLayerId"              )
     779    ("NumOverlayElementsMinus1"       , m_numOverlayElementsMinus1         , IntAry1d (16,0)                 , "NumOverlayElementsMinus1"         )
     780    ("OverlayElementLabelMin_%d"      , m_overlayElementLabelMin           , IntAry1d (256,0) ,16            , "OverlayElementLabelMin"           )
     781    ("OverlayElementLabelMax_%d"      , m_overlayElementLabelMax           , IntAry1d (256,0) ,16            , "OverlayElementLabelMax"           )
     782    ("OverlayLanguage_%d"             , m_overlayLanguage                  , std::string(""), 16             , "OverlayLanguage"                  )
     783    ("OverlayName_%d"                 , m_overlayName                      , std::string(""), 16             , "OverlayName"                      )
     784    ("OverlayElementName_%d_%d"       , m_overlayElementName               , std::string(""), 256 ,16        , "OverlayElementName"               )
     785    ("OverlayInfoPersistenceFlag"     , m_overlayInfoPersistenceFlag       , false                           , "OverlayInfoPersistenceFlag"       )
     786    ;
     787
     788  po::setDefaults(opts);
     789
     790  // Parse the cfg file
     791  po::ErrorReporter err;
     792  po::parseConfigFile( opts, cfgFile, err );
     793};
     794
     795
     796Bool SEIOverlayInfo::checkCfg( const TComSlice* slice )
     797{
     798  // Check config values
     799  Bool wrongConfig = false;
     800
     801  xCheckCfgRange( wrongConfig, m_overlayInfoCancelFlag          , 0 ,   1, "overlay_info_cancel_flag"         );
     802  xCheckCfgRange( wrongConfig, m_overlayContentAuxIdMinus128    , 0 ,  31, "overlay_content_aux_id_minus128"  );
     803  xCheckCfgRange( wrongConfig, m_overlayLabelAuxIdMinus128      , 0 ,  31, "overlay_label_aux_id_minus128"    );
     804  xCheckCfgRange( wrongConfig, m_overlayAlphaAuxIdMinus128      , 0 ,  31, "overlay_alpha_aux_id_minus128"    );
     805  xCheckCfgRange( wrongConfig, m_numOverlaysMinus1              , 0 ,  m_numOverlaysMax-1, "num_overlays_minus1"  );
     806  for (Int i=0 ; i<=m_numOverlaysMinus1 ; ++i)
     807  {
     808    xCheckCfgRange( wrongConfig, m_overlayIdx[i]                  , 0 , 255, "overlay_idx"          );
     809    xCheckCfgRange( wrongConfig, m_languageOverlayPresentFlag[i]  , 0 ,   1, "language_overlay_present_flag"    );
     810    xCheckCfgRange( wrongConfig, m_overlayLabelPresentFlag[i]     , 0 ,   1, "overlay_label_present_flag"       );
     811    xCheckCfgRange( wrongConfig, m_overlayAlphaPresentFlag[i]     , 0 ,   1, "overlay_alpha_present_flag"       );
     812    xCheckCfgRange( wrongConfig, m_overlayContentLayerId[i]       , 0 ,   63, "overlay_content_layer_id"    );
     813    xCheckCfgRange( wrongConfig, m_overlayLabelLayerId[i]         , 0 ,   63, "overlay_label_layer_id"    );
     814    xCheckCfgRange( wrongConfig, m_overlayAlphaLayerId[i]         , 0 ,   63, "overlay_alpha_layer_id"    );
     815    xCheckCfgRange( wrongConfig, m_numOverlayElementsMinus1[i]    , 0 , m_numOverlayElementsMax-1, "num_overlay_elements_minus1"       );
     816    for (Int j=0 ; j<=m_numOverlayElementsMinus1[i] ; ++j)
     817    {
     818      Int maxLabelMinMaxValue = ( 1 << ( m_overlayElementLabelValueLengthMinus8 + 8 ) )-1;
     819      xCheckCfgRange( wrongConfig, m_overlayElementLabelMin[i][j] , 0 , maxLabelMinMaxValue , "overlay_element_label_min"    );
     820      xCheckCfgRange( wrongConfig, m_overlayElementLabelMax[i][j] , 0 , maxLabelMinMaxValue , "overlay_element_label_max"    );
     821    }
     822  }
     823  xCheckCfgRange( wrongConfig, m_overlayInfoPersistenceFlag     , 0 ,   1, "overlay_info_persistence_flag"    );
     824
     825  return wrongConfig;
     826
     827};
     828
     829
     830Void SEITemporalMvPredictionConstraints::setupFromCfgFile(const Char* cfgFile)
     831{
     832  // Set default values
     833  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     834
     835  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     836  defAppLayerIds    .clear    (   );
     837  defAppPocs        .push_back( 0 );
     838  defAppTids        .push_back( 0 );
     839  defAppVclNaluTypes.clear    (   );
     840
     841  Int      defSeiNaluId                  = 0;
     842  Int      defPositionInSeiNalu          = 0;
     843  Bool     defModifyByEncoder            = false;
     844
     845  // Setup config file options
     846  po::Options opts;
     847  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     848
     849  opts.addOptions()
     850    ("PrevPicsNotUsedFlag"   , m_prevPicsNotUsedFlag   , false, "PrevPicsNotUsedFlag"    )
     851    ("NoIntraLayerColPicFlag", m_noIntraLayerColPicFlag, false, "NoIntraLayerColPicFlag" )
     852    ;
     853
     854  po::setDefaults(opts);
     855
     856  // Parse the cfg file
     857  po::ErrorReporter err;
     858  po::parseConfigFile( opts, cfgFile, err );
     859};
     860
     861Bool SEITemporalMvPredictionConstraints::checkCfg( const TComSlice* slice )
     862{
     863  // Check config values
     864  Bool wrongConfig = false;
     865
     866  xCheckCfg     ( wrongConfig, slice->getTemporalId() == 0 , "The temporal motion vector prediction constraints SEI message may be present in an access unit with TemporalId equal to 0 and shall not be present in an access unit with TemporalId greater than 0." );
     867
     868  return wrongConfig;
     869};
     870
     871#if NH_MV_SEI_TBD
     872Void SEIFrameFieldInfo::setupFromCfgFile(const Char* cfgFile)
     873{
     874  // Set default values
     875  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     876
     877  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     878  defAppLayerIds    .push_back( TBD );
     879  defAppPocs        .push_back( TBD );
     880  defAppTids        .push_back( TBD );
     881  defAppVclNaluTypes.push_back( TBD );
     882
     883  Int      defSeiNaluId                  = 0;
     884  Int      defPositionInSeiNalu          = 0;
     885  Bool     defModifyByEncoder            = false;
     886
     887  // Setup config file options
     888  po::Options opts;
     889  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     890
     891  opts.addOptions()
     892    ("FfinfoPicStruct"     , m_ffinfoPicStruct     , 0     , "FfinfoPicStruct"     )
     893    ("FfinfoSourceScanType", m_ffinfoSourceScanType, 0     , "FfinfoSourceScanType")
     894    ("FfinfoDuplicateFlag" , m_ffinfoDuplicateFlag , false , "FfinfoDuplicateFlag" )
     895    ;
     896
     897  po::setDefaults(opts);
     898
     899  // Parse the cfg file
     900  po::ErrorReporter err;
     901  po::parseConfigFile( opts, cfgFile, err );
     902};
     903
     904
     905Bool SEIFrameFieldInfo::checkCfg( const TComSlice* slice )
     906{
     907  // Check config values
     908  Bool wrongConfig = false;
     909
     910  // TBD: Add constraints on presence of SEI here.
     911  xCheckCfg     ( wrongConfig, TBD , "TBD" );
     912  xCheckCfg     ( wrongConfig, TBD , "TBD" );
     913
     914  // TBD: Modify constraints according to the SEI semantics.
     915  xCheckCfgRange( wrongConfig, m_ffinfoPicStruct                , MINVAL , MAXVAL, "ffinfo_pic_struct"                );
     916  xCheckCfgRange( wrongConfig, m_ffinfoSourceScanType           , MINVAL , MAXVAL, "ffinfo_source_scan_type"          );
     917  xCheckCfgRange( wrongConfig, m_ffinfoDuplicateFlag            , MINVAL , MAXVAL, "ffinfo_duplicate_flag"            );
     918
     919  return wrongConfig;
     920
     921};
     922#endif
     923
     924Void SEIThreeDimensionalReferenceDisplaysInfo::setupFromCfgFile(const Char* cfgFile)
     925{
     926  // Set default values
     927  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     928
     929  // Default values for which layers, POCS, Tids or Nalu types the SEI should be sent.
     930  defAppLayerIds      .push_back( 0 );
     931  defAppPocs          .push_back( 0 );
     932  defAppTids          .push_back( 0 );
     933  defAppVclNaluTypes = IRAP_NAL_UNIT_TYPES;
     934
     935  Int      defSeiNaluId                  = 0;
     936  Int      defPositionInSeiNalu          = 0;
     937  Bool     defModifyByEncoder            = 0;
     938
     939  // Setup config file options
     940  po::Options opts;
     941  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     942
     943  opts.addOptions()
     944    ("PrecRefDisplayWidth"            , m_precRefDisplayWidth              , 0                              , "PrecRefDisplayWidth"              )
     945    ("RefViewingDistanceFlag"         , m_refViewingDistanceFlag           , false                          , "RefViewingDistanceFlag"           )
     946    ("PrecRefViewingDist"             , m_precRefViewingDist               , 0                              , "PrecRefViewingDist"               )
     947    ("NumRefDisplaysMinus1"           , m_numRefDisplaysMinus1             , 0                              , "NumRefDisplaysMinus1"             )
     948    ("LeftViewId"                     , m_leftViewId                       , IntAry1d (1,0)                 , "LeftViewId"                       )
     949    ("RightViewId"                    , m_rightViewId                      , IntAry1d (1,0)                 , "RightViewId"                      )
     950    ("ExponentRefDisplayWidth"        , m_exponentRefDisplayWidth          , IntAry1d (1,0)                 , "ExponentRefDisplayWidth"          )
     951    ("MantissaRefDisplayWidth"        , m_mantissaRefDisplayWidth          , IntAry1d (1,0)                 , "MantissaRefDisplayWidth"          )
     952    ("ExponentRefViewingDistance"     , m_exponentRefViewingDistance       , IntAry1d (1,0)                 , "ExponentRefViewingDistance"       )
     953    ("MantissaRefViewingDistance"     , m_mantissaRefViewingDistance       , IntAry1d (1,0)                 , "MantissaRefViewingDistance"       )
     954    ("AdditionalShiftPresentFlag"     , m_additionalShiftPresentFlag       , BoolAry1d(1,0)                 , "AdditionalShiftPresentFlag"       )
     955    ("NumSampleShiftPlus512"          , m_numSampleShiftPlus512            , IntAry1d (1,0)                 , "NumSampleShiftPlus512"            )
     956    ("ThreeDimensionalReferenceDisplaysExtensionFlag", m_threeDimensionalReferenceDisplaysExtensionFlag, false                          , "ThreeDimensionalReferenceDisplaysExtensionFlag")
     957    ;
     958
     959  po::setDefaults(opts);
     960
     961  // Parse the cfg file
     962  po::ErrorReporter err;
     963  po::parseConfigFile( opts, cfgFile, err );
     964};
     965
     966
     967UInt SEIThreeDimensionalReferenceDisplaysInfo::getMantissaReferenceDisplayWidthLen( Int i ) const
     968{
     969  return xGetSyntaxElementLen( m_exponentRefDisplayWidth[i], m_precRefDisplayWidth, m_mantissaRefDisplayWidth[ i ] );
     970}
     971
     972UInt SEIThreeDimensionalReferenceDisplaysInfo::getMantissaReferenceViewingDistanceLen( Int i ) const
     973{
     974  return xGetSyntaxElementLen( m_exponentRefViewingDistance[i], m_precRefViewingDist, m_mantissaRefViewingDistance[ i ] );
     975}
     976
     977UInt SEIThreeDimensionalReferenceDisplaysInfo::xGetSyntaxElementLen( Int expo, Int prec, Int val ) const
     978{
     979  UInt len;
     980  if( expo == 0 )
     981  {
     982    len = std::max(0, prec - 30 );
     983  }
     984  else
     985  {
     986    len = std::max( 0, expo + prec - 31 );
     987  }
     988
     989  assert( val >= 0 );
     990  assert( val <= ( ( 1 << len )- 1) );
     991  return len;
     992}
     993
     994Bool SEIThreeDimensionalReferenceDisplaysInfo::checkCfg( const TComSlice* slice )
     995{
     996  // Check config values
     997  Bool wrongConfig = false;
     998
     999  // The 3D reference display SEI should preferably be sent along with the multiview acquisition SEI. For now the multiview acquisition SEI is restricted to POC = 0, so 3D reference displays SEI is restricted to POC = 0 as well.
     1000  xCheckCfg     ( wrongConfig, slice->isIRAP() && (slice->getPOC() == 0)  , "The 3D reference displays SEI message currently is associated with an access unit that contains an IRAP picture." );
     1001
     1002  xCheckCfgRange( wrongConfig, m_precRefDisplayWidth            , 0 , 31, "prec_ref_display_width"  );
     1003  xCheckCfgRange( wrongConfig, m_refViewingDistanceFlag         , 0 , 1, "ref_viewing_distance_flag");
     1004  xCheckCfgRange( wrongConfig, m_precRefViewingDist             , 0 , 31, "prec_ref_viewing_dist"   );
     1005  xCheckCfgRange( wrongConfig, m_numRefDisplaysMinus1           , 0 , 31, "num_ref_displays_minus1" );
     1006
     1007  for (Int i = 0; i <= getNumRefDisplaysMinus1(); i++ )
     1008  {
     1009    xCheckCfgRange( wrongConfig, m_exponentRefDisplayWidth[i]     , 0 , 62, "exponent_ref_display_width"   );
     1010    xCheckCfgRange( wrongConfig, m_exponentRefViewingDistance[i]  , 0 , 62, "exponent_ref_viewing_distance");
     1011    xCheckCfgRange( wrongConfig, m_additionalShiftPresentFlag[i]  , 0 , 1, "additional_shift_present_flag" );
     1012    xCheckCfgRange( wrongConfig, m_numSampleShiftPlus512[i]       , 0 , 1023, "num_sample_shift_plus512"   );
     1013  }
     1014  xCheckCfgRange( wrongConfig, m_threeDimensionalReferenceDisplaysExtensionFlag, 0 , 1, "three_dimensional_reference_displays_extension_flag");
     1015
     1016  return wrongConfig;
     1017
     1018};
     1019
     1020#if SEI_DRI_F0169
     1021Void SEIDepthRepresentationInfo::setupFromSlice  ( const TComSlice* slice )
     1022{
     1023
     1024    m_currLayerID=slice->getLayerIdInVps();
     1025};
     1026
     1027Void SEIDepthRepresentationInfo::setupFromCfgFile(const Char* cfgFile)
     1028{
     1029  // Set default values
     1030  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     1031
     1032  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     1033  //defAppLayerIds    .push_back( TBD );
     1034  defAppPocs        .push_back( 0 );
     1035  //defAppTids        .push_back( TBD );
     1036  //defAppVclNaluTypes.push_back( TBD );
     1037
     1038  Int      defSeiNaluId                  = 0;
     1039  Int      defPositionInSeiNalu          = 0;
     1040  Bool     defModifyByEncoder            = true;
     1041
     1042  // Setup config file options
     1043  po::Options opts;
     1044
     1045  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     1046
     1047  opts.addOptions()
     1048    ("ZNear_%d"                      , m_zNear               , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "ZNear"           )
     1049    ("ZFar_%d"                       , m_zFar                , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "ZFar"            )
     1050    ("DMin_%d"                       , m_dMin                , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "DMin"            )
     1051    ("DMax_%d"                       , m_dMax                , std::vector<double>(0,0)       , MAX_NUM_LAYERS , "DMax"            )
     1052    ("DepthRepresentationInfoSeiPresentFlag_%d",  m_depthRepresentationInfoSeiPresentFlag, BoolAry1d(1,0), MAX_NUM_LAYERS, "DepthRepresentationInfoSeiPresentFlag")
     1053    ("DepthRepresentationType_%d"        , m_depthRepresentationType          , IntAry1d(0,0), MAX_NUM_LAYERS,  "DepthRepresentationType"        )
     1054    ("DisparityRefViewId_%d"             , m_disparityRefViewId               ,  IntAry1d(0,0), MAX_NUM_LAYERS,  "DisparityRefViewId"             )
     1055    ("DepthNonlinearRepresentationNumMinus1_%d", m_depthNonlinearRepresentationNumMinus1, IntAry1d(0,0), MAX_NUM_LAYERS, "DepthNonlinearRepresentationNumMinus1")
     1056    ("DepthNonlinearRepresentationModel_%d"    , m_depth_nonlinear_representation_model ,   IntAry1d(0,0), MAX_NUM_LAYERS, "DepthNonlinearRepresentationModel") ;
     1057
     1058
     1059  po::setDefaults(opts);
     1060
     1061  // Parse the cfg file
     1062  po::ErrorReporter err;
     1063  po::parseConfigFile( opts, cfgFile, err );
     1064
     1065
     1066  for(int i=0;i<MAX_NUM_LAYERS;i++)
     1067  {
     1068    if (m_zNear[i].size()>0)
     1069    {
     1070      m_zNearFlag.push_back(true);
     1071    }
     1072    else
     1073    {
     1074      m_zNearFlag.push_back(false);
     1075    }
     1076
     1077    if (m_zFar[i].size()>0)
     1078    {
     1079      m_zFarFlag.push_back(true);
     1080    }
     1081    else
     1082    {
     1083      m_zFarFlag.push_back(false);
     1084    }
     1085
     1086    if (m_dMin[i].size()>0)
     1087    {
     1088      m_dMinFlag.push_back(true);
     1089    }
     1090    else
     1091    {
     1092      m_dMinFlag.push_back(false);
     1093    }
     1094
     1095    if (m_dMax[i].size()>0)
     1096    {
     1097      m_dMaxFlag.push_back(true);
     1098    }
     1099    else
     1100    {
     1101      m_dMaxFlag.push_back(false);
     1102    }
     1103
     1104
     1105    if (m_depthRepresentationInfoSeiPresentFlag[i][0])
     1106    {
     1107      if ( m_depthRepresentationType[i].size()<=0 )
     1108      {
     1109        printf("DepthRepresentationType_%d must be present for layer %d\n",i,i );
     1110        return;
     1111      }
     1112
     1113      if (  m_depthRepresentationType[i][0]<0 )
     1114      {
     1115        printf("DepthRepresentationType_%d must be equal to or greater than 0\n",i );
     1116        return;
     1117      }
     1118
     1119      if (m_dMinFlag[i] || m_dMaxFlag[i])
     1120      {
     1121        if (m_disparityRefViewId[i].size()<=0)
     1122        {
     1123          printf("DisparityRefViewId_%d must be present for layer %d\n",i,i );
     1124          assert(false);
     1125          return;
     1126        }
     1127        if (m_disparityRefViewId[i][0]<0)
     1128        {
     1129          printf("DisparityRefViewId_%d must be equal to or greater than 0\n",i );
     1130          assert(false);
     1131          return;
     1132        }
     1133      }
     1134
     1135      if (m_depthRepresentationType[i][0]==3)
     1136      {
     1137        if (m_depthNonlinearRepresentationNumMinus1[i].size()<=0)
     1138        {
     1139          printf("DepthNonlinearRepresentationNumMinus1_%d must be present for layer %d\n",i,i );
     1140          assert(false);
     1141          return;
     1142        }
     1143        if (m_depthNonlinearRepresentationNumMinus1[i][0]<0)
     1144        {
     1145          printf("DepthNonlinearRepresentationNumMinus1_%d must be equal to or greater than 0\n",i );
     1146          assert(false);
     1147          return;
     1148        }
     1149
     1150        if (m_depth_nonlinear_representation_model[i].size() != m_depthNonlinearRepresentationNumMinus1[i][0]+1)
     1151        {
     1152          printf("the number of values in Depth_nonlinear_representation_model must be equal to DepthNonlinearRepresentationNumMinus1+1 in layer %d\n",i );
     1153          assert(false);
     1154          return;
     1155        }
     1156      }
     1157    }
     1158  }
     1159
     1160  assert(m_zNearFlag.size()==MAX_NUM_LAYERS);
     1161  assert(m_zFarFlag.size()==MAX_NUM_LAYERS);
     1162  assert(m_dMinFlag.size()==MAX_NUM_LAYERS);
     1163  assert(m_dMaxFlag.size()==MAX_NUM_LAYERS);
     1164}
     1165
     1166Bool SEIDepthRepresentationInfo::checkCfg( const TComSlice* slice )
     1167{
     1168    // Check config values
     1169    Bool wrongConfig = false;
     1170    assert(m_currLayerID>=0);
     1171
     1172    if (m_depthRepresentationInfoSeiPresentFlag[m_currLayerID][0]==false)
     1173    {
     1174        printf("DepthRepresentationInfoSeiPresentFlag_%d should be equal to 1 when  ApplicableLayerIds is empty or ApplicableLayerIds contains  %d\n",m_currLayerID,slice->getLayerId());
     1175        assert(false);
     1176    }
     1177    // TBD: Add constraints on presence of SEI here.
     1178    xCheckCfg     ( wrongConfig, m_depthRepresentationType[m_currLayerID][0] >=0 , "depth_representation_type must be equal to or greater than 0" );
     1179    if ( m_dMaxFlag[m_currLayerID] || m_dMinFlag[m_currLayerID])
     1180    {
     1181        xCheckCfg( wrongConfig , m_disparityRefViewId[m_currLayerID][0]>=0, "disparity_ref_view_id must be equal to or greater than 0 when d_min or d_max are present");
     1182    }
     1183
     1184    if (m_depthRepresentationType[m_currLayerID][0]==3)
     1185    {
     1186        xCheckCfg(wrongConfig , m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]>=0, "depth_nonlinear_representation_num_minus1 must be greater than or equal to 0");
     1187
     1188        if (m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]>=0)
     1189        {
     1190            xCheckCfg( wrongConfig , m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]+1 == m_depth_nonlinear_representation_model[m_currLayerID].size() ,"the number of values in depth_nonlinear_representation_model must be equal to depth_nonlinear_representation_num_minus1+1");
     1191        }
     1192
     1193    }
     1194
     1195    return wrongConfig;
     1196}
     1197#endif
     1198
     1199Void SEIMultiviewSceneInfo::setupFromCfgFile(const Char* cfgFile)
     1200{
     1201  // Set default values
     1202  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     1203
     1204  // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send.
     1205  defAppLayerIds      .clear();
     1206  defAppPocs          .clear();
     1207  defAppTids          .push_back( 0 );
     1208  defAppVclNaluTypes = IRAP_NAL_UNIT_TYPES;
     1209
     1210  Int      defSeiNaluId                  = 0;
     1211  Int      defPositionInSeiNalu          = 0;
     1212  Bool     defModifyByEncoder            = false;
     1213
     1214  // Setup config file options
     1215  po::Options opts;
     1216  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     1217
     1218  opts.addOptions()
     1219    ("MinDisparity"                   , m_minDisparity                     , 0                              , "MinDisparity"                     )
     1220    ("MaxDisparityRange"              , m_maxDisparityRange                , 0                              , "MaxDisparityRange"                )
     1221    ;
     1222
     1223  po::setDefaults(opts);
     1224
     1225  // Parse the cfg file
     1226  po::ErrorReporter err;
     1227  po::parseConfigFile( opts, cfgFile, err );
     1228};
     1229
     1230
     1231Bool SEIMultiviewSceneInfo::checkCfg( const TComSlice* slice )
     1232{
     1233  // Check config values
     1234  Bool wrongConfig = false;
     1235
     1236  xCheckCfg     ( wrongConfig, slice->isIRAP(), "When present, the multiview scene information SEI message shall be associated with an IRAP access unit." );
     1237
     1238  xCheckCfgRange( wrongConfig, m_minDisparity              , -1024 , 1023, "min_disparity"                    );
     1239  xCheckCfgRange( wrongConfig, m_maxDisparityRange         ,     0 , 2047, "max_disparity_range"              );
     1240
     1241  return wrongConfig;
     1242
     1243};
     1244
     1245Void SEIMultiviewAcquisitionInfo::setupFromCfgFile(const Char* cfgFile)
     1246{
     1247  // Set default values
     1248  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     1249
     1250  defAppLayerIds    .clear();
     1251  defAppPocs        .push_back( 0 );
     1252  defAppTids        .push_back( 0 );
     1253  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
     1254
     1255
     1256  Int      defSeiNaluId                  = 0;
     1257  Int      defPositionInSeiNalu          = 0;
     1258  Bool     defModifyByEncoder            = false;
     1259
     1260  // Setup config file options
     1261  po::Options opts;
     1262  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     1263
     1264  opts.addOptions()
     1265    ("IntrinsicParamFlag"               , m_intrinsicParamFlag               , false                              , "IntrinsicParamFlag"               )
     1266    ("ExtrinsicParamFlag"               , m_extrinsicParamFlag               , false                              , "ExtrinsicParamFlag"               )
     1267    ("IntrinsicParamsEqualFlag"         , m_intrinsicParamsEqualFlag         , false                              , "IntrinsicParamsEqualFlag"         )
     1268    ("PrecFocalLength"                  , m_precFocalLength                  , 0                                  , "PrecFocalLength"                  )
     1269    ("PrecPrincipalPoint"               , m_precPrincipalPoint               , 0                                  , "PrecPrincipalPoint"               )
     1270    ("PrecSkewFactor"                   , m_precSkewFactor                   , 0                                  , "PrecSkewFactor"                   )
     1271    ("SignFocalLengthX"                 , m_signFocalLengthX                 , BoolAry1d(1,0)                     , "SignFocalLengthX"                 )
     1272    ("ExponentFocalLengthX"             , m_exponentFocalLengthX             , IntAry1d (1,0)                     , "ExponentFocalLengthX"             )
     1273    ("MantissaFocalLengthX"             , m_mantissaFocalLengthX             , IntAry1d (1,0)                     , "MantissaFocalLengthX"             )
     1274    ("SignFocalLengthY"                 , m_signFocalLengthY                 , BoolAry1d(1,0)                     , "SignFocalLengthY"                 )
     1275    ("ExponentFocalLengthY"             , m_exponentFocalLengthY             , IntAry1d (1,0)                     , "ExponentFocalLengthY"             )
     1276    ("MantissaFocalLengthY"             , m_mantissaFocalLengthY             , IntAry1d (1,0)                     , "MantissaFocalLengthY"             )
     1277    ("SignPrincipalPointX"              , m_signPrincipalPointX              , BoolAry1d(1,0)                     , "SignPrincipalPointX"              )
     1278    ("ExponentPrincipalPointX"          , m_exponentPrincipalPointX          , IntAry1d (1,0)                     , "ExponentPrincipalPointX"          )
     1279    ("MantissaPrincipalPointX"          , m_mantissaPrincipalPointX          , IntAry1d (1,0)                     , "MantissaPrincipalPointX"          )
     1280    ("SignPrincipalPointY"              , m_signPrincipalPointY              , BoolAry1d(1,0)                     , "SignPrincipalPointY"              )
     1281    ("ExponentPrincipalPointY"          , m_exponentPrincipalPointY          , IntAry1d (1,0)                     , "ExponentPrincipalPointY"          )
     1282    ("MantissaPrincipalPointY"          , m_mantissaPrincipalPointY          , IntAry1d (1,0)                     , "MantissaPrincipalPointY"          )
     1283    ("SignSkewFactor"                   , m_signSkewFactor                   , BoolAry1d(1,0)                     , "SignSkewFactor"                   )
     1284    ("ExponentSkewFactor"               , m_exponentSkewFactor               , IntAry1d (1,0)                     , "ExponentSkewFactor"               )
     1285    ("MantissaSkewFactor"               , m_mantissaSkewFactor               , IntAry1d (1,0)                     , "MantissaSkewFactor"               )
     1286    ("PrecRotationParam"                , m_precRotationParam                , 0                                  , "PrecRotationParam"                )
     1287    ("PrecTranslationParam"             , m_precTranslationParam             , 0                                  , "PrecTranslationParam"             )
     1288    ("SignR_%d_%d"                      , m_signR                            , BoolAry1d(3,0) ,MAX_NUM_LAYERS ,3  , "SignR"                            )
     1289    ("ExponentR_%d_%d"                  , m_exponentR                        , IntAry1d (3,0) ,MAX_NUM_LAYERS ,3  , "ExponentR"                        )
     1290    ("MantissaR_%d_%d"                  , m_mantissaR                        , IntAry1d (3,0) ,MAX_NUM_LAYERS ,3  , "MantissaR"                        )
     1291    ("SignT_%d"                         , m_signT                            , BoolAry1d(3,0) ,MAX_NUM_LAYERS     , "SignT"                            )
     1292    ("ExponentT_%d"                     , m_exponentT                        , IntAry1d (3,0) ,MAX_NUM_LAYERS     , "ExponentT"                        )
     1293    ("MantissaT_%d"                     , m_mantissaT                        , IntAry1d (3,0) ,MAX_NUM_LAYERS     , "MantissaT"                        )
     1294    ;
     1295
     1296  po::setDefaults(opts);
     1297
     1298  // Parse the cfg file
     1299  po::ErrorReporter err;
     1300  po::parseConfigFile( opts, cfgFile, err );
     1301};
     1302
     1303UInt SEIMultiviewAcquisitionInfo::getMantissaFocalLengthXLen( Int i ) const
     1304{
     1305  return xGetSyntaxElementLen( m_exponentFocalLengthX[i], m_precFocalLength, m_mantissaFocalLengthX[ i ] );
     1306}
     1307
     1308Bool SEIMultiviewAcquisitionInfo::checkCfg( const TComSlice* slice )
     1309{
     1310  // Check config values
     1311  Bool wrongConfig = false;
     1312
     1313  // Currently the encoder starts with POC 0 for all layers. The condition on POC 0 should be changed, when this changes.
     1314  xCheckCfg     ( wrongConfig, slice->isIRAP() && (slice->getPOC() == 0)  , "When present, the multiview acquisition information SEI message that applies to the current layer shall be included in an access unit that contains an IRAP picture that is the first picture of a CLVS of the current layer." );
     1315
     1316  xCheckCfgRange( wrongConfig, m_precFocalLength         , 0, 31, "prec_focal_length"         );
     1317  xCheckCfgRange( wrongConfig, m_precPrincipalPoint      , 0, 31, "prec_principle_point"      );
     1318  xCheckCfgRange( wrongConfig, m_precSkewFactor          , 0, 31, "prec_skew_factor"          );
     1319
     1320  for (Int i = 0; i <= getNumViewsMinus1(); i++ )
     1321  {
     1322    xCheckCfgRange( wrongConfig, m_exponentFocalLengthX    [ i ], 0, 62, "exponent_focal_length_x"   );
     1323    xCheckCfgRange( wrongConfig, m_exponentFocalLengthY    [ i ], 0, 62, "exponent_focal_length_y"   );
     1324    xCheckCfgRange( wrongConfig, m_exponentPrincipalPointX [ i ], 0, 62, "exponent_principal_point_x");
     1325    xCheckCfgRange( wrongConfig, m_exponentPrincipalPointY [ i ], 0, 62, "exponent_principal_point_y");
     1326    xCheckCfgRange( wrongConfig, m_exponentSkewFactor      [ i ], 0, 62, "exponent_skew_factor"      );
     1327  }
     1328
     1329  xCheckCfgRange( wrongConfig, m_precRotationParam       , 0, 31, "prec_focal_length"         );
     1330  xCheckCfgRange( wrongConfig, m_precTranslationParam    , 0, 31, "prec_focal_length"         );
     1331
     1332  for (Int i = 0; i <= getNumViewsMinus1(); i++ )
     1333  {
     1334    for (Int j = 0; j <= 2; j++)
     1335    {
     1336      xCheckCfgRange( wrongConfig, m_exponentT[i][j]     , 0, 62, "exponent_skew_factor"      );
     1337      for (Int k = 0; k <= 2; k++ )
     1338      {
     1339        xCheckCfgRange( wrongConfig, m_exponentR[i][j][k], 0, 62, "exponent_principal_point_y");
     1340      }
     1341    }
     1342  }
     1343
     1344  return wrongConfig;
     1345
     1346};
     1347
     1348UInt SEIMultiviewAcquisitionInfo::getMantissaFocalLengthYLen( Int i ) const
     1349{
     1350  return xGetSyntaxElementLen( m_exponentFocalLengthY[i], m_precFocalLength, m_mantissaFocalLengthY[ i ]  );
     1351}
     1352
     1353
     1354UInt SEIMultiviewAcquisitionInfo::getMantissaPrincipalPointXLen( Int i ) const
     1355{
     1356  return xGetSyntaxElementLen( m_exponentPrincipalPointX[i], m_precPrincipalPoint, m_mantissaPrincipalPointX[ i ]  );
     1357}
     1358
     1359UInt SEIMultiviewAcquisitionInfo::getMantissaPrincipalPointYLen( Int i ) const
     1360{
     1361  return xGetSyntaxElementLen( m_exponentPrincipalPointY[i], m_precPrincipalPoint, m_mantissaPrincipalPointY[ i ] );
     1362}
     1363
     1364UInt SEIMultiviewAcquisitionInfo::getMantissaSkewFactorLen( Int i ) const
     1365{
     1366  return xGetSyntaxElementLen( m_exponentSkewFactor[ i ], m_precSkewFactor, m_mantissaSkewFactor[ i ] );
     1367}
     1368
     1369UInt SEIMultiviewAcquisitionInfo::getMantissaRLen( Int i, Int j, Int k ) const
     1370{
     1371  return xGetSyntaxElementLen( m_exponentR[ i ][ j ][ k ], m_precRotationParam, m_mantissaR[ i ][ j] [ k ] );
     1372}
     1373
     1374UInt SEIMultiviewAcquisitionInfo::getMantissaTLen( Int i, Int j ) const
     1375{
     1376  return xGetSyntaxElementLen( m_exponentT[ i ][ j ], m_precTranslationParam, m_mantissaT[ i ][ j ] );
     1377}
     1378UInt SEIMultiviewAcquisitionInfo::xGetSyntaxElementLen( Int expo, Int prec, Int val ) const
     1379{
     1380  UInt len;
     1381  if( expo == 0 )
     1382  {
     1383    len = std::max(0, prec - 30 );
     1384  }
     1385  else
     1386  {
     1387    len = std::max( 0, expo + prec - 31 );
     1388  }
     1389
     1390  assert( val >= 0 );
     1391  assert( val <= ( ( 1 << len )- 1) );
     1392  return len;
     1393}
     1394
     1395Void SEIMultiviewViewPosition::setupFromSlice  ( const TComSlice* slice )
     1396{
     1397  const TComVPS* vps = slice->getVPS();
     1398  m_numViewsMinus1 = vps->getNumViews() - 1;
     1399  m_viewPosition.resize( m_numViewsMinus1 + 1 );
     1400  for (Int i = 0; i <= m_numViewsMinus1; i++ )
     1401  {
     1402    // Assuming that view ids indicate the position
     1403    m_viewPosition[i] = vps->getViewIdVal( i );
     1404  }
     1405}
     1406
     1407Void SEIMultiviewViewPosition::setupFromCfgFile(const Char* cfgFile)
     1408{
     1409  // Set default values
     1410  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     1411
     1412  defAppLayerIds    .push_back( 0 );
     1413  defAppPocs        .push_back( 0 );
     1414  defAppTids        .push_back( 0 );
     1415  defAppVclNaluTypes = IDR_NAL_UNIT_TYPES;
     1416
     1417  Int      defSeiNaluId                  = 0;
     1418  Int      defPositionInSeiNalu          = 0;
     1419  Bool     defModifyByEncoder            = true;
     1420
     1421  // Setup config file options
     1422  po::Options opts;
     1423  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     1424
     1425  opts.addOptions()
     1426    ("NumViewsMinus1"         , m_numViewsMinus1                          , 0                       , "NumViewsMinus1")
     1427    ("ViewPosition"           , m_viewPosition                            , IntAry1d (1,0)          , "ViewPosition"  );
     1428  ;
     1429
     1430  po::setDefaults(opts);
     1431
     1432  // Parse the cfg file
     1433  po::ErrorReporter err;
     1434  po::parseConfigFile( opts, cfgFile, err );
     1435};
     1436
     1437Bool SEIMultiviewViewPosition::checkCfg( const TComSlice* slice )
     1438{
     1439  // Check config values
     1440  Bool wrongConfig = false;
     1441
     1442  // TBD: Add constraints on presence of SEI here.
     1443  xCheckCfg     ( wrongConfig, slice->isIRAP() , "When present, the multiview view position SEI message shall be associated with an IRAP access unit."  );
     1444
     1445  // TBD: Modify constraints according to the SEI semantics.
     1446  xCheckCfgRange( wrongConfig, m_numViewsMinus1                 , 0 , 62, "num_views_minus1");
     1447  for(Int i = 0; i <= m_numViewsMinus1; i++)
     1448  {
     1449    xCheckCfgRange( wrongConfig, m_viewPosition[i]                , 0 , 62, "view_position");
     1450  }
     1451
     1452  return wrongConfig;
     1453
     1454};
     1455
     1456
     1457#if NH_3D
     1458Void SEIAlternativeDepthInfo::setupFromCfgFile(const Char* cfgFile)
     1459{
     1460  // Set default values
     1461  IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;
     1462
     1463  defAppLayerIds    .clear();
     1464  defAppPocs        .clear();
     1465  defAppTids        .clear();
     1466  defAppVclNaluTypes.clear();
     1467
     1468  Int      defSeiNaluId                  = 0;
     1469  Int      defPositionInSeiNalu          = 0;
     1470  Bool     defModifyByEncoder            = false;
     1471
     1472  // Setup config file options
     1473  po::Options opts;
     1474  xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );
     1475
     1476  opts.addOptions()
     1477    ("AlternativeDepthInfoCancelFlag" , m_alternativeDepthInfoCancelFlag  , false               , "AlternativeDepthInfoCancelFlag"  )
     1478    ("DepthType"                      , m_depthType                       , 1                   , "DepthType"                       )
     1479    ("NumConstituentViewsGvdMinus1"   , m_numConstituentViewsGvdMinus1    , 1                   , "NumConstituentViewsGvdMinus1"    )
     1480    ("DepthPresentGvdFlag"            , m_depthPresentGvdFlag             , false               , "DepthPresentGvdFlag"             )
     1481    ("ZGvdFlag"                       , m_zGvdFlag                        , false               , "ZGvdFlag"                        )
     1482    ("IntrinsicParamGvdFlag"          , m_intrinsicParamGvdFlag           , false               , "IntrinsicParamGvdFlag"           )
     1483    ("RotationGvdFlag"                , m_rotationGvdFlag                 , false               , "RotationGvdFlag"                 )
     1484    ("TranslationGvdFlag"             , m_translationGvdFlag              , false               , "TranslationGvdFlag"              )
     1485    ("SignGvdZNearFlag_%d"            , m_signGvdZNearFlag                , BoolAry1d(3,0), 3   , "SignGvdZNearFlag"                )
     1486    ("ExpGvdZNear_%d"                 , m_expGvdZNear                     , IntAry1d (3,0), 3   , "ExpGvdZNear"                     )
     1487    ("ManLenGvdZNearMinus1_%d"        , m_manLenGvdZNearMinus1            , IntAry1d (3,0), 3   , "ManLenGvdZNearMinus1"            )
     1488    ("ManGvdZNear_%d"                 , m_manGvdZNear                     , IntAry1d (3,0), 3   , "ManGvdZNear"                     )
     1489    ("SignGvdZFarFlag_%d"             , m_signGvdZFarFlag                 , BoolAry1d(3,0), 3   , "SignGvdZFarFlag"                 )
     1490    ("ExpGvdZFar_%d"                  , m_expGvdZFar                      , IntAry1d (3,0), 3   , "ExpGvdZFar"                      )
     1491    ("ManLenGvdZFarMinus1_%d"         , m_manLenGvdZFarMinus1             , IntAry1d (3,0), 3   , "ManLenGvdZFarMinus1"             )
     1492    ("ManGvdZFar_%d"                  , m_manGvdZFar                      , IntAry1d (3,0), 3   , "ManGvdZFar"                      )
     1493    ("PrecGvdFocalLength"             , m_precGvdFocalLength              , 18                  , "PrecGvdFocalLength"              )
     1494    ("PrecGvdPrincipalPoint"          , m_precGvdPrincipalPoint           , 18                  , "PrecGvdPrincipalPoint"           )
     1495    ("PrecGvdRotationParam"           , m_precGvdRotationParam            , 18                  , "PrecGvdRotationParam"            )
     1496    ("PrecGvdTranslationParam"        , m_precGvdTranslationParam         , 18                  , "PrecGvdTranslationParam"         )
     1497    ("SignGvdFocalLengthX_%d"         , m_signGvdFocalLengthX             , BoolAry1d(3,0), 3   ,"SignGvdFocalLengthX"              )
     1498    ("ExpGvdFocalLengthX_%d"          , m_expGvdFocalLengthX              , IntAry1d (3,0), 3   ,"ExpGvdFocalLengthX"               )
     1499    ("ManGvdFocalLengthX_%d"          , m_manGvdFocalLengthX              , IntAry1d (3,0), 3   ,"ManGvdFocalLengthX"               )
     1500    ("SignGvdFocalLengthY_%d"         , m_signGvdFocalLengthY             , BoolAry1d(3,0), 3   ,"SignGvdFocalLengthY"              )
     1501    ("ExpGvdFocalLengthY_%d"          , m_expGvdFocalLengthY              , IntAry1d (3,0), 3   ,"ExpGvdFocalLengthY"               )
     1502    ("ManGvdFocalLengthY_%d"          , m_manGvdFocalLengthY              , IntAry1d (3,0), 3   ,"ManGvdFocalLengthY"               )
     1503    ("SignGvdPrincipalPointX_%d"      , m_signGvdPrincipalPointX          , BoolAry1d(3,0), 3   ,"SignGvdPrincipalPointX"           )
     1504    ("ExpGvdPrincipalPointX_%d"       , m_expGvdPrincipalPointX           , IntAry1d (3,0), 3   ,"ExpGvdPrincipalPointX"            )
     1505    ("ManGvdPrincipalPointX_%d"       , m_manGvdPrincipalPointX           , IntAry1d (3,0), 3   ,"ManGvdPrincipalPointX"            )
     1506    ("SignGvdPrincipalPointY_%d"      , m_signGvdPrincipalPointY          , BoolAry1d(3,0), 3   ,"SignGvdPrincipalPointY"           )
     1507    ("ExpGvdPrincipalPointY_%d"       , m_expGvdPrincipalPointY           , IntAry1d (3,0), 3   ,"ExpGvdPrincipalPointY"            )
     1508    ("ManGvdPrincipalPointY_%d"       , m_manGvdPrincipalPointY           , IntAry1d (3,0), 3   ,"ManGvdPrincipalPointY"            )
     1509    ("SignGvdR00_%d"                  , m_signGvdR00                      , BoolAry1d(3,0), 3   ,"SignGvdR00"                       )
     1510    ("ExpGvdR00_%d"                   , m_expGvdR00                       , IntAry1d (3,0), 3   ,"ExpGvdR00"                        )
     1511    ("ManGvdR00_%d"                   , m_manGvdR00                       , IntAry1d (3,0), 3   ,"ManGvdR00"                        )
     1512    ("SignGvdR01_%d"                  , m_signGvdR01                      , BoolAry1d(3,0), 3   ,"SignGvdR01"                       )
     1513    ("ExpGvdR01_%d"                   , m_expGvdR01                       , IntAry1d (3,0), 3   ,"ExpGvdR01"                        )
     1514    ("ManGvdR01_%d"                   , m_manGvdR01                       , IntAry1d (3,0), 3   ,"ManGvdR01"                        )
     1515    ("SignGvdR02_%d"                  , m_signGvdR02                      , BoolAry1d(3,0), 3   ,"SignGvdR02"                       )
     1516    ("ExpGvdR02_%d"                   , m_expGvdR02                       , IntAry1d (3,0), 3   ,"ExpGvdR02"                        )
     1517    ("ManGvdR02_%d"                   , m_manGvdR02                       , IntAry1d (3,0), 3   ,"ManGvdR02"                        )
     1518    ("SignGvdR10_%d"                  , m_signGvdR10                      , BoolAry1d(3,0), 3   ,"SignGvdR10"                       )
     1519    ("ExpGvdR10_%d"                   , m_expGvdR10                       , IntAry1d (3,0), 3   ,"ExpGvdR10"                        )
     1520    ("ManGvdR10_%d"                   , m_manGvdR10                       , IntAry1d (3,0), 3   ,"ManGvdR10"                        )
     1521    ("SignGvdR11_%d"                  , m_signGvdR11                      , BoolAry1d(3,0), 3   ,"SignGvdR11"                       )
     1522    ("ExpGvdR11_%d"                   , m_expGvdR11                       , IntAry1d (3,0), 3   ,"ExpGvdR11"                        )
     1523    ("ManGvdR11_%d"                   , m_manGvdR11                       , IntAry1d (3,0), 3   ,"ManGvdR11"                        )
     1524    ("SignGvdR12_%d"                  , m_signGvdR12                      , BoolAry1d(3,0), 3   ,"SignGvdR12"                       )
     1525    ("ExpGvdR12_%d"                   , m_expGvdR12                       , IntAry1d (3,0), 3   ,"ExpGvdR12"                        )
     1526    ("ManGvdR12_%d"                   , m_manGvdR12                       , IntAry1d (3,0), 3   ,"ManGvdR12"                        )
     1527    ("SignGvdR20_%d"                  , m_signGvdR20                      , BoolAry1d(3,0), 3   ,"SignGvdR20"                       )
     1528    ("ExpGvdR20_%d"                   , m_expGvdR20                       , IntAry1d (3,0), 3   ,"ExpGvdR20"                        )
     1529    ("ManGvdR20_%d"                   , m_manGvdR20                       , IntAry1d (3,0), 3   ,"ManGvdR20"                        )
     1530    ("SignGvdR21_%d"                  , m_signGvdR21                      , BoolAry1d(3,0), 3   ,"SignGvdR21"                       )
     1531    ("ExpGvdR21_%d"                   , m_expGvdR21                       , IntAry1d (3,0), 3   ,"ExpGvdR21"                        )
     1532    ("ManGvdR21_%d"                   , m_manGvdR21                       , IntAry1d (3,0), 3   ,"ManGvdR21"                        )
     1533    ("SignGvdR22_%d"                  , m_signGvdR22                      , BoolAry1d(3,0), 3   ,"SignGvdR22"                       )
     1534    ("ExpGvdR22_%d"                   , m_expGvdR22                       , IntAry1d (3,0), 3   ,"ExpGvdR22"                        )
     1535    ("ManGvdR22_%d"                   , m_manGvdR22                       , IntAry1d (3,0), 3   ,"ManGvdR22"                        )
     1536    ("SignGvdTX_%d"                   , m_signGvdTX                       , BoolAry1d(3,0), 3   ,"SignGvdTX"                        )
     1537    ("ExpGvdTX_%d"                    , m_expGvdTX                        , IntAry1d (3,0), 3   ,"ExpGvdTX"                         )
     1538    ("ManGvdTX_%d"                    , m_manGvdTX                        , IntAry1d (3,0), 3   ,"ManGvdTX"                         )
     1539    ("MinOffsetXInt"                  , m_minOffsetXInt                   , 0                   , "MinOffsetXInt"                   )
     1540    ("MinOffsetXFrac"                 , m_minOffsetXFrac                  , 0                   , "MinOffsetXFrac"                  )
     1541    ("MaxOffsetXInt"                  , m_maxOffsetXInt                   , 0                   , "MaxOffsetXInt"                   )
     1542    ("MaxOffsetXFrac"                 , m_maxOffsetXFrac                  , 0                   , "MaxOffsetXFrac"                  )
     1543    ("OffsetYPresentFlag"             , m_offsetYPresentFlag              , false               , "OffsetYPresentFlag"              )
     1544    ("MinOffsetYInt"                  , m_minOffsetYInt                   , 0                   , "MinOffsetYInt"                   )
     1545    ("MinOffsetYFrac"                 , m_minOffsetYFrac                  , 0                   , "MinOffsetYFrac"                  )
     1546    ("MaxOffsetYInt"                  , m_maxOffsetYInt                   , 0                   , "MaxOffsetYInt"                   )
     1547    ("MaxOffsetYFrac"                 , m_maxOffsetYFrac                  , 0                   , "MaxOffsetYFrac"                  )
     1548    ("WarpMapSizePresentFlag"         , m_warpMapSizePresentFlag          , false               , "WarpMapSizePresentFlag"          )
     1549    ("WarpMapWidthMinus2"             , m_warpMapWidthMinus2              , 0                   , "WarpMapWidthMinus2"              )
     1550    ("WarpMapHeightMinus2"            , m_warpMapHeightMinus2             , 0                   , "WarpMapHeightMinus2"             )
     1551    ;
     1552
     1553  po::setDefaults(opts);
     1554
     1555  // Parse the cfg file
     1556  po::ErrorReporter err;
     1557  po::parseConfigFile( opts, cfgFile, err );
     1558};
     1559Bool SEIAlternativeDepthInfo::checkCfg( const TComSlice* slice )
     1560{
     1561  // Check config values
     1562  Bool wrongConfig = false;
     1563
     1564
     1565  xCheckCfgRange( wrongConfig, m_alternativeDepthInfoCancelFlag , 0 , 1, "alternative_depth_info_cancel_flag");
     1566  xCheckCfgRange( wrongConfig, m_depthType                      , 0 , 1, "depth_type"                       );
     1567
     1568  xCheckCfgRange( wrongConfig, m_numConstituentViewsGvdMinus1   , 1 , 1, "num_constituent_views_gvd_minus1 "); // 1: 3 views only, cuurent.
     1569  xCheckCfgRange( wrongConfig, m_depthPresentGvdFlag            , 0 , 1, "depth_present_gvd_flag"           );
     1570  xCheckCfgRange( wrongConfig, m_zGvdFlag                       , 0 , 1, "z_gvd_flag"                       );
     1571  xCheckCfgRange( wrongConfig, m_intrinsicParamGvdFlag          , 0 , 1, "intrinsic_param_gvd_flag"         );
     1572  xCheckCfgRange( wrongConfig, m_rotationGvdFlag                , 0 , 1, "rotation_gvd_flag"                );
     1573  xCheckCfgRange( wrongConfig, m_translationGvdFlag             , 0 , 1, "translation_gvd_flag"             );
     1574
     1575  return wrongConfig;
     1576
     1577};
     1578
     1579UInt SEIAlternativeDepthInfo::getManGvdFocalLengthXLen       ( Int i, int j ) const
     1580{
     1581  UInt rval;
     1582  rval = xGetSyntaxElementLen( m_expGvdFocalLengthX[i][j], m_precGvdFocalLength, m_manGvdFocalLengthX[i][j]  );
     1583  if (rval == 0)
     1584    return m_precGvdFocalLength;
     1585  else
     1586    return rval;
     1587};
     1588
     1589UInt SEIAlternativeDepthInfo::getManGvdFocalLengthYLen       ( Int i, int j ) const
     1590{
     1591  UInt rval;
     1592  rval = xGetSyntaxElementLen( m_expGvdFocalLengthY[i][j], m_precGvdFocalLength, m_manGvdFocalLengthY[i][j]  );
     1593  if (rval == 0)
     1594    return m_precGvdFocalLength;
     1595  else
     1596    return rval;
     1597};
     1598
     1599UInt SEIAlternativeDepthInfo::getManGvdPrincipalPointXLen    ( Int i, int j ) const
     1600{
     1601  UInt rval;
     1602  rval = xGetSyntaxElementLen( m_expGvdPrincipalPointX[i][j], m_precGvdPrincipalPoint, m_manGvdPrincipalPointX[i][j]  );
     1603  if (rval == 0)
     1604    return m_precGvdPrincipalPoint;
     1605  else
     1606    return rval;
     1607};
     1608
     1609UInt SEIAlternativeDepthInfo::getManGvdPrincipalPointYLen    ( Int i, int j ) const
     1610{
     1611  UInt rval;
     1612  rval = xGetSyntaxElementLen( m_expGvdPrincipalPointY[i][j], m_precGvdPrincipalPoint, m_manGvdPrincipalPointY[i][j]  );
     1613  if (rval == 0)
     1614    return m_precGvdPrincipalPoint;
     1615  else
     1616    return rval;
     1617};
     1618
     1619UInt SEIAlternativeDepthInfo::getManGvdTXLen                 ( Int i, int j ) const
     1620{
     1621  UInt rval;
     1622  rval = xGetSyntaxElementLen( m_expGvdTX[i][j], m_precGvdTranslationParam, m_manGvdTX[i][j]  );
     1623  if (rval == 0)
     1624    return m_precGvdTranslationParam;
     1625  else
     1626    return rval;
     1627};
     1628
     1629UInt SEIAlternativeDepthInfo::xGetSyntaxElementLen( Int expo, Int prec, Int val ) const
     1630{
     1631  UInt len;
     1632  if( expo == 0 )
     1633  {
     1634    len = std::max(0, prec - 30 );
     1635  }
     1636  else
     1637  {
     1638    len = std::max( 0, expo + prec - 31 );
     1639  }
     1640
     1641  assert( val >= 0 );
     1642  assert( val <= ( ( 1 << len )- 1) );
     1643  return len;
     1644}
     1645
     1646#endif
     1647
     1648#endif
  • trunk/source/Lib/TLibCommon/SEI.h

    r1313 r1356  
    4242#include "CommonDef.h"
    4343#include "libmd5/MD5.h"
     44
     45
     46#if NH_MV_SEI
     47#include "TAppCommon/program_options_lite.h"
     48using namespace std;
     49namespace po = df::program_options_lite;
     50#endif
     51
    4452//! \ingroup TLibCommon
    4553//! \{
    4654class TComSPS;
     55#if NH_MV_SEI
     56class TComSlice;
     57class SEIScalableNesting;
     58#endif
    4759
    4860/**
     
    8496    CHROMA_SAMPLING_FILTER_HINT          = 140,
    8597    KNEE_FUNCTION_INFO                   = 141
    86 #if NH_MV
    87     ,SUB_BITSTREAM_PROPERTY              = 164
     98#if NH_MV_SEI
     99    ,COLOUR_REMAPPING_INFO                    = 142,
     100    DEINTERLACED_FIELD_IDENTIFICATION         = 143,
     101    LAYERS_NOT_PRESENT                        = 160,
     102    INTER_LAYER_CONSTRAINED_TILE_SETS         = 161,
     103    BSP_NESTING                               = 162,
     104    BSP_INITIAL_ARRIVAL_TIME                  = 163,
     105    SUB_BITSTREAM_PROPERTY                    = 164,
     106    ALPHA_CHANNEL_INFO                        = 165,
     107    OVERLAY_INFO                              = 166,
     108    TEMPORAL_MV_PREDICTION_CONSTRAINTS        = 167,
     109    FRAME_FIELD_INFO                          = 168,
     110    THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO = 176,
     111    DEPTH_REPRESENTATION_INFO                 = 177,
     112    MULTIVIEW_SCENE_INFO                      = 178,
     113    MULTIVIEW_ACQUISITION_INFO                = 179,
     114    MULTIVIEW_VIEW_POSITION                   = 180
     115#if NH_3D
     116    ,ALTERNATIVE_DEPTH_INFO                    = 181
    88117#endif
     118#endif
    89119
    90120  };
    91121
    92   SEI() {}
     122  SEI();
     123
    93124  virtual ~SEI() {}
    94 
    95   static const Char *getSEIMessageString(SEI::PayloadType payloadType);
    96 
     125  virtual SEI*       getCopy( ) const;
     126  static const Char *getSEIMessageString(SEI::PayloadType payloadType );
    97127  virtual PayloadType payloadType() const = 0;
     128
     129#if NH_MV_SEI
     130  static SEI*        getNewSEIMessage         ( SEI::PayloadType payloadType );
     131  Bool               insertSei                ( Int curLayerId, Int curPoc, Int curTid, Int curNaluType ) const;
     132
     133
     134  virtual Void       setupFromSlice           ( const TComSlice* slice );
     135  virtual Void       setupFromCfgFile         ( const Char* cfgFile );
     136  virtual Bool       checkCfg                 ( const TComSlice* slice   );
     137
     138  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 );
     141  Void               xAddGeneralOpts          ( po::Options &opts, IntAry1d defAppLayerIds, IntAry1d defAppPocs, IntAry1d defAppTids, IntAry1d defAppVclNaluTypes,
     142                                                Int defSeiNaluId, Int defPositionInSeiNalu, Bool defModifyByEncoder );
     143    // Filters where to insert SEI in the bitstream.
     144  // When the respected vector is empty, all layersIds, POCs, Tids, and Nalu types are used.
     145  IntAry1d                       m_applicableLayerIds;
     146  IntAry1d                       m_applicablePocs;
     147  IntAry1d                       m_applicableTids;
     148  IntAry1d                       m_applicableVclNaluTypes;
     149
     150  Int                            m_payloadType;              // Payload type
     151  Int                            m_seiNaluId;                // Identifies to which NAL unit  the SEI is added.
     152  Int                            m_positionInSeiNalu;        // Identifies the order within the NAL unit
     153  Bool                           m_modifyByEncoder;          // Don't use the SEI cfg-file, but let let the encoder setup the NALU.
     154
     155  SEIScalableNesting*            m_scalNestSeiContThisSei;   // Pointer to scalable nesting SEI containing the SEI. When NULL, the SEI is not nested.
     156#endif
    98157};
    99158
     
    155214  Bool m_noParameterSetUpdateFlag;
    156215  Int numSpsIdsMinus1;
    157   std::vector<Int> activeSeqParameterSetId; 
     216  std::vector<Int> activeSeqParameterSetId;
    158217};
    159218
     
    468527    SEIMasteringDisplayColourVolume() {}
    469528    virtual ~SEIMasteringDisplayColourVolume(){}
    470    
     529
    471530    TComSEIMasteringDisplay values;
    472531};
    473532
    474533#if NH_MV
     534#if !NH_MV_SEI
    475535class SEISubBitstreamProperty : public SEI
    476536{
     
    490550};
    491551#endif
     552#endif
    492553
    493554typedef std::list<SEI*> SEIMessages;
     
    550611
    551612    public:
    552       Int     m_mcts_id; 
     613      Int     m_mcts_id;
    553614      Bool    m_display_tile_set_flag;
    554615      Int     m_num_tile_rects_in_set; //_minus1;
     
    598659};
    599660
     661#if NH_MV_SEI
     662#if NH_MV_LAYERS_NOT_PRESENT_SEI
     663class SEILayersNotPresent : public SEI
     664{
     665public:
     666  PayloadType payloadType( ) const { return LAYERS_NOT_PRESENT; }
     667  SEILayersNotPresent ( ) { };
     668  ~SEILayersNotPresent( ) { };
     669  SEI* getCopy( ) const { return new SEILayersNotPresent(*this); };
     670
     671  Void setupFromCfgFile( const Char*      cfgFile );
     672  Bool checkCfg        ( const TComSlice* slice   );
     673
     674  Int       m_lnpSeiActiveVpsId;
     675  UInt      m_lnpSeiMaxLayers;
     676  BoolAry1d m_layerNotPresentFlag;
     677
     678  Void resizeDimI( Int sizeDimI )
     679  {
     680    m_layerNotPresentFlag.resize( sizeDimI );
     681  }
     682};
    600683#endif
    601684
     685class SEIInterLayerConstrainedTileSets : public SEI
     686{
     687public:
     688  PayloadType payloadType( ) const { return INTER_LAYER_CONSTRAINED_TILE_SETS; }
     689  SEIInterLayerConstrainedTileSets ( ) { };
     690  ~SEIInterLayerConstrainedTileSets( ) { };
     691  SEI* getCopy( ) const { return new SEIInterLayerConstrainedTileSets(*this); };
     692
     693  Void setupFromCfgFile( const Char*      cfgFile );
     694  Bool checkCfg        ( const TComSlice* slice   );
     695
     696  Bool      m_ilAllTilesExactSampleValueMatchFlag;
     697  Bool      m_ilOneTilePerTileSetFlag;
     698  Int       m_ilNumSetsInMessageMinus1;
     699  Bool      m_skippedTileSetPresentFlag;
     700  IntAry1d  m_ilctsId;
     701  IntAry1d  m_ilNumTileRectsInSetMinus1;
     702  IntAry2d  m_ilTopLeftTileIndex;
     703  IntAry2d  m_ilBottomRightTileIndex;
     704  IntAry1d  m_ilcIdc;
     705  BoolAry1d m_ilExactSampleValueMatchFlag;
     706  Int       m_allTilesIlcIdc;
     707
     708  Void      resizeDimI( Int sizeDimI )
     709  {
     710    m_ilctsId                    .resize( sizeDimI );
     711    m_ilNumTileRectsInSetMinus1  .resize( sizeDimI );
     712    m_ilTopLeftTileIndex         .resize( sizeDimI );
     713    m_ilBottomRightTileIndex     .resize( sizeDimI );
     714    m_ilcIdc                     .resize( sizeDimI );
     715    m_ilExactSampleValueMatchFlag.resize( sizeDimI );
     716  }
     717
     718  Void      resizeDimJ( Int i, Int sizeDimJ )
     719  {
     720    m_ilTopLeftTileIndex    [i].resize( sizeDimJ );
     721    m_ilBottomRightTileIndex[i].resize( sizeDimJ );
     722  }
     723
     724};
     725
     726#if NH_MV_TBD
     727class SEIBspNesting : public SEI
     728{
     729public:
     730  PayloadType payloadType( ) const { return BSP_NESTING; }
     731  SEIBspNesting ( ) { };
     732  ~SEIBspNesting( ) { };
     733  SEI* getCopy( ) const { return new SEIBspNesting(*this); };
     734
     735  Void setupFromCfgFile( const Char*      cfgFile );
     736  Void setupFromSlice  ( const TComSlice* slice   );
     737  Bool checkCfg        ( const TComSlice* slice   );
     738
     739  Int       m_seiOlsIdx;
     740  Int       m_seiPartitioningSchemeIdx;
     741  Int       m_bspIdx;
     742  Int       m_bspNestingZeroBit;
     743  Int       m_numSeisInBspMinus1;
     744};
     745
     746class SEIBspInitialArrivalTime : public SEI
     747{
     748public:
     749  PayloadType payloadType( ) const { return BSP_INITIAL_ARRIVAL_TIME; }
     750  SEIBspInitialArrivalTime ( ) { };
     751  ~SEIBspInitialArrivalTime( ) { };
     752  SEI* getCopy( ) const { return new SEIBspInitialArrivalTime(*this); };
     753
     754  Void setupFromCfgFile( const Char*      cfgFile );
     755  Void setupFromSlice  ( const TComSlice* slice   );
     756  Bool checkCfg        ( const TComSlice* slice   );
     757
     758  IntAry1d  m_nalInitialArrivalDelay;
     759  IntAry1d  m_vclInitialArrivalDelay;
     760};
     761#endif
     762
     763class SEISubBitstreamProperty : public SEI
     764{
     765public:
     766  PayloadType payloadType( ) const { return SUB_BITSTREAM_PROPERTY; }
     767  SEISubBitstreamProperty ( ) { };
     768  ~SEISubBitstreamProperty( ) { };
     769  SEI* getCopy( ) const { return new SEISubBitstreamProperty(*this); };
     770
     771  Void setupFromCfgFile( const Char*      cfgFile );
     772  Bool checkCfg        ( const TComSlice* slice   );
     773  Void resizeArrays    ( );
     774
     775  Int       m_sbPropertyActiveVpsId;
     776  Int       m_numAdditionalSubStreamsMinus1;
     777  IntAry1d  m_subBitstreamMode;
     778  IntAry1d  m_olsIdxToVps;
     779  IntAry1d  m_highestSublayerId;
     780  IntAry1d  m_avgSbPropertyBitRate;
     781  IntAry1d  m_maxSbPropertyBitRate;
     782};
     783
     784class SEIAlphaChannelInfo : public SEI
     785{
     786public:
     787  PayloadType payloadType( ) const { return ALPHA_CHANNEL_INFO; }
     788  SEIAlphaChannelInfo ( ) { };
     789  ~SEIAlphaChannelInfo( ) { };
     790  SEI* getCopy( ) const { return new SEIAlphaChannelInfo(*this); };
     791
     792  Void setupFromCfgFile( const Char*      cfgFile );
     793  Bool checkCfg        ( const TComSlice* slice   );
     794
     795  Bool      m_alphaChannelCancelFlag;
     796  Int       m_alphaChannelUseIdc;
     797  Int       m_alphaChannelBitDepthMinus8;
     798  Int       m_alphaTransparentValue;
     799  Int       m_alphaOpaqueValue;
     800  Bool      m_alphaChannelIncrFlag;
     801  Bool      m_alphaChannelClipFlag;
     802  Bool      m_alphaChannelClipTypeFlag;
     803};
     804
     805class SEIOverlayInfo : public SEI
     806{
     807public:
     808  PayloadType payloadType( ) const { return OVERLAY_INFO; }
     809  SEIOverlayInfo ( );
     810  ~SEIOverlayInfo( ) { };
     811  SEI* getCopy( ) const { return new SEIOverlayInfo(*this); };
     812
     813  Void setupFromCfgFile( const Char*      cfgFile );
     814  Bool checkCfg        ( const TComSlice* slice   );
     815
     816  const Int m_numOverlaysMax;
     817  const Int m_numOverlayElementsMax;
     818  const Int m_numStringBytesMax;  //incl. null termination byte
     819
     820  Bool      m_overlayInfoCancelFlag;
     821  Int       m_overlayContentAuxIdMinus128;
     822  Int       m_overlayLabelAuxIdMinus128;
     823  Int       m_overlayAlphaAuxIdMinus128;
     824  Int       m_overlayElementLabelValueLengthMinus8;
     825  Int       m_numOverlaysMinus1;
     826  IntAry1d  m_overlayIdx;
     827  BoolAry1d m_languageOverlayPresentFlag;
     828  IntAry1d  m_overlayContentLayerId;
     829  BoolAry1d m_overlayLabelPresentFlag;
     830  IntAry1d  m_overlayLabelLayerId;
     831  BoolAry1d m_overlayAlphaPresentFlag;
     832  IntAry1d  m_overlayAlphaLayerId;
     833  IntAry1d  m_numOverlayElementsMinus1;
     834  IntAry2d  m_overlayElementLabelMin;
     835  IntAry2d  m_overlayElementLabelMax;
     836  StringAry1d  m_overlayLanguage;
     837  StringAry1d  m_overlayName;
     838  StringAry2d  m_overlayElementName;
     839  Bool      m_overlayInfoPersistenceFlag;
     840};
     841
     842class SEITemporalMvPredictionConstraints : public SEI
     843{
     844public:
     845  PayloadType payloadType( ) const { return TEMPORAL_MV_PREDICTION_CONSTRAINTS; }
     846  SEITemporalMvPredictionConstraints ( ) { };
     847  ~SEITemporalMvPredictionConstraints( ) { };
     848  SEI* getCopy( ) const { return new SEITemporalMvPredictionConstraints(*this); };
     849
     850  Void setupFromCfgFile( const Char*      cfgFile );
     851  Bool checkCfg        ( const TComSlice* slice   );
     852
     853  Bool      m_prevPicsNotUsedFlag;
     854  Bool      m_noIntraLayerColPicFlag;
     855};
     856
     857#if NH_MV_SEI_TBD
     858class SEIFrameFieldInfo : public SEI
     859{
     860public:
     861  PayloadType payloadType( ) const { return FRAME_FIELD_INFO; }
     862  SEIFrameFieldInfo ( ) { };
     863  ~SEIFrameFieldInfo( ) { };
     864  SEI* getCopy( ) const { return new SEIFrameFieldInfo(*this); };
     865
     866  Void setupFromCfgFile( const Char*      cfgFile );
     867  Void setupFromSlice  ( const TComSlice* slice   );
     868  Bool checkCfg        ( const TComSlice* slice   );
     869
     870  Int       m_ffinfoPicStruct;
     871  Int       m_ffinfoSourceScanType;
     872  Bool      m_ffinfoDuplicateFlag;
     873};
     874#endif
     875
     876class SEIThreeDimensionalReferenceDisplaysInfo : public SEI
     877{
     878public:
     879  PayloadType payloadType( ) const { return THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO; }
     880  SEIThreeDimensionalReferenceDisplaysInfo ( ) { };
     881  ~SEIThreeDimensionalReferenceDisplaysInfo( ) { };
     882  SEI* getCopy( ) const { return new SEIThreeDimensionalReferenceDisplaysInfo(*this); };
     883
     884  Void setupFromCfgFile( const Char*      cfgFile );
     885  Bool checkCfg        ( const TComSlice* slice   );
     886
     887  Int getNumRefDisplaysMinus1( ) const
     888  {
     889    return m_numRefDisplaysMinus1;
     890  }
     891
     892  Int       m_precRefDisplayWidth;
     893  Bool      m_refViewingDistanceFlag;
     894  Int       m_precRefViewingDist;
     895  Int       m_numRefDisplaysMinus1;
     896  IntAry1d  m_leftViewId;
     897  IntAry1d  m_rightViewId;
     898  IntAry1d  m_exponentRefDisplayWidth;
     899  IntAry1d  m_mantissaRefDisplayWidth;
     900  IntAry1d  m_exponentRefViewingDistance;
     901  IntAry1d  m_mantissaRefViewingDistance;
     902  BoolAry1d m_additionalShiftPresentFlag;
     903  IntAry1d  m_numSampleShiftPlus512;
     904  Bool      m_threeDimensionalReferenceDisplaysExtensionFlag;
     905
     906  Void resizeArrays( )
     907  {
     908    Int numReferenceDiaplays = getNumRefDisplaysMinus1() + 1;
     909
     910    m_leftViewId    .resize( numReferenceDiaplays );
     911    m_rightViewId   .resize( numReferenceDiaplays );
     912    m_exponentRefDisplayWidth      .resize( numReferenceDiaplays );
     913    m_mantissaRefDisplayWidth      .resize( numReferenceDiaplays );
     914    m_exponentRefViewingDistance   .resize( numReferenceDiaplays );
     915    m_mantissaRefViewingDistance   .resize( numReferenceDiaplays );
     916    m_additionalShiftPresentFlag   .resize( numReferenceDiaplays );
     917    m_numSampleShiftPlus512        .resize( numReferenceDiaplays );
     918  }
     919
     920  UInt getMantissaReferenceDisplayWidthLen  ( Int i ) const ;
     921  UInt getMantissaReferenceViewingDistanceLen  ( Int i ) const ;
     922private:
     923  UInt xGetSyntaxElementLen( Int expo, Int prec, Int val ) const;
     924};
     925
     926#if SEI_DRI_F0169
     927class SEIDepthRepresentationInfo : public SEI
     928{
     929    public:
     930        PayloadType payloadType( ) const { return DEPTH_REPRESENTATION_INFO; }
     931        SEIDepthRepresentationInfo ( )
     932        {
     933            m_currLayerID=-1;
     934        };
     935        ~SEIDepthRepresentationInfo( ) { };
     936        SEI* getCopy( ) const { return new SEIDepthRepresentationInfo(*this); };
     937
     938        Void setupFromCfgFile( const Char*      cfgFile );
     939        Void setupFromSlice  ( const TComSlice* slice   );
     940        Bool checkCfg        ( const TComSlice* slice   );
     941        Void clear()
     942        {
     943            int i;
     944            m_zNearFlag.clear();
     945            m_zFarFlag.clear();
     946            m_dMinFlag.clear();
     947            m_dMaxFlag.clear();
     948
     949            for(i=0;i<m_zNear.size();i++)
     950                m_zNear[i].clear();
     951            m_zNear.clear();
     952
     953            for(i=0;i<m_zFar.size();i++)
     954                m_zFar[i].clear();
     955            m_zFar.clear();
     956
     957            for(i=0;i<m_dMin.size();i++)
     958                m_dMin[i].clear();
     959            m_dMin.clear();
     960
     961            for(i=0;i<m_dMax.size();i++)
     962                m_dMax[i].clear();
     963            m_dMax.clear();
     964
     965            for(i=0;i<m_depthRepresentationType.size();i++)
     966                m_depthRepresentationType[i].clear();
     967            m_depthRepresentationType.clear();
     968
     969            for(i=0;i<m_disparityRefViewId.size();i++)
     970                m_disparityRefViewId[i].clear();
     971            m_disparityRefViewId.clear();
     972
     973            for(i=0;i<m_depthNonlinearRepresentationNumMinus1.size();i++)
     974                m_depthNonlinearRepresentationNumMinus1[i].clear();
     975            m_depthNonlinearRepresentationNumMinus1.clear();
     976
     977            for(i=0;i<m_depth_nonlinear_representation_model.size();i++)
     978                m_depth_nonlinear_representation_model[i].clear();
     979            m_depth_nonlinear_representation_model.clear();
     980
     981        }
     982        Int m_currLayerID;
     983        BoolAry1d      m_zNearFlag;
     984        BoolAry1d      m_zFarFlag;
     985        BoolAry1d      m_dMinFlag;
     986        BoolAry1d      m_dMaxFlag;
     987        BoolAry2d      m_depthRepresentationInfoSeiPresentFlag;
     988        std::vector< std::vector<Double> > m_zNear,m_zFar,m_dMin,m_dMax;
     989
     990        IntAry2d       m_depthRepresentationType;
     991        IntAry2d       m_disparityRefViewId;
     992        IntAry2d       m_depthNonlinearRepresentationNumMinus1;
     993        IntAry2d       m_depth_nonlinear_representation_model;
     994};
     995#endif
     996
     997class SEIMultiviewSceneInfo : public SEI
     998{
     999public:
     1000  PayloadType payloadType( ) const { return MULTIVIEW_SCENE_INFO; }
     1001  SEIMultiviewSceneInfo ( ) { };
     1002  ~SEIMultiviewSceneInfo( ) { };
     1003  SEI* getCopy( ) const { return new SEIMultiviewSceneInfo(*this); };
     1004
     1005  Void setupFromCfgFile( const Char*      cfgFile );
     1006  Bool checkCfg        ( const TComSlice* slice   );
     1007
     1008  Int       m_minDisparity;
     1009  Int       m_maxDisparityRange;
     1010};
     1011
     1012
     1013class SEIMultiviewAcquisitionInfo : public SEI
     1014{
     1015public:
     1016  PayloadType payloadType( ) const { return MULTIVIEW_ACQUISITION_INFO; }
     1017  SEIMultiviewAcquisitionInfo ( ) { };
     1018  ~SEIMultiviewAcquisitionInfo( ) { };
     1019  SEI* getCopy( ) const { return new SEIMultiviewAcquisitionInfo(*this); };
     1020
     1021  Void setupFromCfgFile( const Char*      cfgFile );
     1022  Bool checkCfg        ( const TComSlice* slice   );
     1023
     1024  Int getNumViewsMinus1( ) const
     1025  {
     1026    Int numViewsMinus1;
     1027    if( m_scalNestSeiContThisSei != NULL )
     1028    {
     1029      numViewsMinus1 = m_scalNestSeiContThisSei->m_nestingNumLayersMinus1;
     1030    }
     1031    else
     1032    {
     1033      numViewsMinus1 = 0;
     1034    }
     1035    return numViewsMinus1;
     1036  }
     1037
     1038  Void resizeArrays( )
     1039  {
     1040    Int numViews = getNumViewsMinus1() + 1;
     1041    m_signFocalLengthX       .resize( numViews );
     1042    m_exponentFocalLengthX   .resize( numViews );
     1043    m_mantissaFocalLengthX   .resize( numViews );
     1044    m_signFocalLengthY       .resize( numViews );
     1045    m_exponentFocalLengthY   .resize( numViews );
     1046    m_mantissaFocalLengthY   .resize( numViews );
     1047    m_signPrincipalPointX    .resize( numViews );
     1048    m_exponentPrincipalPointX.resize( numViews );
     1049    m_mantissaPrincipalPointX.resize( numViews );
     1050    m_signPrincipalPointY    .resize( numViews );
     1051    m_exponentPrincipalPointY.resize( numViews );
     1052    m_mantissaPrincipalPointY.resize( numViews );
     1053    m_signSkewFactor         .resize( numViews );
     1054    m_exponentSkewFactor     .resize( numViews );
     1055    m_mantissaSkewFactor     .resize( numViews );
     1056
     1057    m_signR                  .resize( numViews );
     1058    m_exponentR              .resize( numViews );
     1059    m_mantissaR              .resize( numViews );
     1060    m_signT                  .resize( numViews );
     1061    m_exponentT              .resize( numViews );
     1062    m_mantissaT              .resize( numViews );
     1063
     1064    for( Int i = 0; i  < numViews ; i++ )
     1065    {
     1066      m_signR    [i].resize( 3 );
     1067      m_exponentR[i].resize( 3 );
     1068      m_mantissaR[i].resize( 3 );
     1069      m_signT    [i].resize( 3 );
     1070      m_exponentT[i].resize( 3 );
     1071      m_mantissaT[i].resize( 3 );
     1072
     1073      for (Int j = 0; j < 3; j++)
     1074      {
     1075        m_signR    [i][j].resize( 3 );
     1076        m_exponentR[i][j].resize( 3 );
     1077        m_mantissaR[i][j].resize( 3 );
     1078      }
     1079    }
     1080  }
     1081
     1082  UInt getMantissaFocalLengthXLen   ( Int i ) const ;
     1083  UInt getMantissaFocalLengthYLen   ( Int i ) const ;
     1084  UInt getMantissaPrincipalPointXLen( Int i ) const ;
     1085  UInt getMantissaPrincipalPointYLen( Int i ) const ;
     1086  UInt getMantissaSkewFactorLen     ( Int i ) const ;
     1087  UInt getMantissaRLen              ( Int i, Int j, Int k ) const ;
     1088  UInt getMantissaTLen              ( Int i, Int j )        const ;
     1089
     1090  Bool      m_intrinsicParamFlag;
     1091  Bool      m_extrinsicParamFlag;
     1092  Bool      m_intrinsicParamsEqualFlag;
     1093  Int       m_precFocalLength;
     1094  Int       m_precPrincipalPoint;
     1095  Int       m_precSkewFactor;
     1096  BoolAry1d m_signFocalLengthX;
     1097  IntAry1d  m_exponentFocalLengthX;
     1098  IntAry1d  m_mantissaFocalLengthX;
     1099  BoolAry1d m_signFocalLengthY;
     1100  IntAry1d  m_exponentFocalLengthY;
     1101  IntAry1d  m_mantissaFocalLengthY;
     1102  BoolAry1d m_signPrincipalPointX;
     1103  IntAry1d  m_exponentPrincipalPointX;
     1104  IntAry1d  m_mantissaPrincipalPointX;
     1105  BoolAry1d m_signPrincipalPointY;
     1106  IntAry1d  m_exponentPrincipalPointY;
     1107  IntAry1d  m_mantissaPrincipalPointY;
     1108  BoolAry1d m_signSkewFactor;
     1109  IntAry1d  m_exponentSkewFactor;
     1110  IntAry1d  m_mantissaSkewFactor;
     1111  Int       m_precRotationParam;
     1112  Int       m_precTranslationParam;
     1113  BoolAry3d m_signR;
     1114  IntAry3d  m_exponentR;
     1115  IntAry3d  m_mantissaR;
     1116  BoolAry2d m_signT;
     1117  IntAry2d  m_exponentT;
     1118  IntAry2d  m_mantissaT;
     1119private:
     1120  UInt xGetSyntaxElementLen( Int expo, Int prec, Int val ) const;
     1121};
     1122
     1123
     1124
     1125class SEIMultiviewViewPosition : public SEI
     1126{
     1127public:
     1128  PayloadType payloadType( ) const { return MULTIVIEW_VIEW_POSITION; }
     1129  SEIMultiviewViewPosition ( ) { };
     1130  ~SEIMultiviewViewPosition( ) { };
     1131  SEI* getCopy( ) const { return new SEIMultiviewViewPosition(*this); };
     1132
     1133  Void setupFromCfgFile( const Char*      cfgFile );
     1134  Void setupFromSlice  ( const TComSlice* slice   );
     1135  Bool checkCfg        ( const TComSlice* slice   );
     1136
     1137  Int       m_numViewsMinus1;
     1138  IntAry1d  m_viewPosition;
     1139};
     1140
     1141#if NH_3D
     1142class SEIAlternativeDepthInfo : public SEI
     1143{
     1144public:
     1145  PayloadType payloadType( ) const { return ALTERNATIVE_DEPTH_INFO; }
     1146  SEIAlternativeDepthInfo ( ) { };
     1147  ~SEIAlternativeDepthInfo( ) { };
     1148  SEI* getCopy( ) const { return new SEIAlternativeDepthInfo(*this); };
     1149
     1150  Void setupFromCfgFile( const Char*      cfgFile );
     1151  Bool checkCfg        ( const TComSlice* slice   );
     1152
     1153  UInt getManGvdFocalLengthXLen       ( Int i, Int j ) const;
     1154  UInt getManGvdFocalLengthYLen       ( Int i, Int j ) const;
     1155  UInt getManGvdPrincipalPointXLen    ( Int i, Int j ) const;
     1156  UInt getManGvdPrincipalPointYLen    ( Int i, Int j ) const;
     1157  //UInt getManGvdRLen                  ( Int i, int j ) const;
     1158  UInt getManGvdTXLen                 ( Int i, Int j ) const;
     1159  UInt xGetSyntaxElementLen           ( Int expo, Int prec, Int val ) const;
     1160
     1161  Void resizeArrays( )
     1162  {
     1163    const Int numViews = 3; // getNumConstituentViewsGvdMinus1() + 1;
     1164
     1165    m_signGvdZNearFlag.resize(3);
     1166    m_expGvdZNear.resize(3);
     1167    m_manLenGvdZNearMinus1.resize(3);
     1168    m_manGvdZNear.resize(3);
     1169    m_signGvdZFarFlag.resize(3);
     1170    m_expGvdZFar.resize(3);
     1171    m_manLenGvdZFarMinus1.resize(3);
     1172    m_manGvdZFar.resize(3);
     1173
     1174    m_signGvdFocalLengthX.resize(3);
     1175    m_expGvdFocalLengthX.resize(3);
     1176    m_manGvdFocalLengthX.resize(3);
     1177    m_signGvdFocalLengthY.resize(3);
     1178    m_expGvdFocalLengthY.resize(3);
     1179    m_manGvdFocalLengthY.resize(3);
     1180    m_signGvdPrincipalPointX.resize(3);
     1181    m_expGvdPrincipalPointX.resize(3);
     1182    m_manGvdPrincipalPointX.resize(3);
     1183    m_signGvdPrincipalPointY.resize(3);
     1184    m_expGvdPrincipalPointY.resize(3);
     1185    m_manGvdPrincipalPointY.resize(3);
     1186
     1187    m_signGvdR00.resize(3);
     1188    m_expGvdR00.resize(3);
     1189    m_manGvdR00.resize(3);
     1190    m_signGvdR01.resize(3);
     1191    m_expGvdR01.resize(3);
     1192    m_manGvdR01.resize(3);
     1193    m_signGvdR02.resize(3);
     1194    m_expGvdR02.resize(3);
     1195    m_manGvdR02.resize(3);
     1196    m_signGvdR10.resize(3);
     1197    m_expGvdR10.resize(3);
     1198    m_manGvdR10.resize(3);
     1199    m_signGvdR11.resize(3);
     1200    m_expGvdR11.resize(3);
     1201    m_manGvdR11.resize(3);
     1202    m_signGvdR12.resize(3);
     1203    m_expGvdR12.resize(3);
     1204    m_manGvdR12.resize(3);
     1205    m_signGvdR20.resize(3);
     1206    m_expGvdR20.resize(3);
     1207    m_manGvdR20.resize(3);
     1208    m_signGvdR21.resize(3);
     1209    m_expGvdR21.resize(3);
     1210    m_manGvdR21.resize(3);
     1211    m_signGvdR22.resize(3);
     1212    m_expGvdR22.resize(3);
     1213    m_manGvdR22.resize(3);
     1214
     1215    m_signGvdTX.resize(3);
     1216    m_expGvdTX.resize(3);
     1217    m_manGvdTX.resize(3);
     1218
     1219    for( Int i = 0; i < numViews; i++ )
     1220    {
     1221      m_signGvdZNearFlag[i].resize(3);
     1222      m_expGvdZNear[i].resize(3);
     1223      m_manLenGvdZNearMinus1[i].resize(3);
     1224      m_manGvdZNear[i].resize(3);
     1225      m_signGvdZFarFlag[i].resize(3);
     1226      m_expGvdZFar[i].resize(3);
     1227      m_manLenGvdZFarMinus1[i].resize(3);
     1228      m_manGvdZFar[i].resize(3);
     1229
     1230      m_signGvdFocalLengthX[i].resize(3);
     1231      m_expGvdFocalLengthX[i].resize(3);
     1232      m_manGvdFocalLengthX[i].resize(3);
     1233      m_signGvdFocalLengthY[i].resize(3);
     1234      m_expGvdFocalLengthY[i].resize(3);
     1235      m_manGvdFocalLengthY[i].resize(3);
     1236      m_signGvdPrincipalPointX[i].resize(3);
     1237      m_expGvdPrincipalPointX[i].resize(3);
     1238      m_manGvdPrincipalPointX[i].resize(3);
     1239      m_signGvdPrincipalPointY[i].resize(3);
     1240      m_expGvdPrincipalPointY[i].resize(3);
     1241      m_manGvdPrincipalPointY[i].resize(3);
     1242
     1243      m_signGvdR00[i].resize(3);
     1244      m_expGvdR00[i].resize(3);
     1245      m_manGvdR00[i].resize(3);
     1246      m_signGvdR01[i].resize(3);
     1247      m_expGvdR01[i].resize(3);
     1248      m_manGvdR01[i].resize(3);
     1249      m_signGvdR02[i].resize(3);
     1250      m_expGvdR02[i].resize(3);
     1251      m_manGvdR02[i].resize(3);
     1252      m_signGvdR10[i].resize(3);
     1253      m_expGvdR10[i].resize(3);
     1254      m_manGvdR10[i].resize(3);
     1255      m_signGvdR11[i].resize(3);
     1256      m_expGvdR11[i].resize(3);
     1257      m_manGvdR11[i].resize(3);
     1258      m_signGvdR12[i].resize(3);
     1259      m_expGvdR12[i].resize(3);
     1260      m_manGvdR12[i].resize(3);
     1261      m_signGvdR20[i].resize(3);
     1262      m_expGvdR20[i].resize(3);
     1263      m_manGvdR20[i].resize(3);
     1264      m_signGvdR21[i].resize(3);
     1265      m_expGvdR21[i].resize(3);
     1266      m_manGvdR21[i].resize(3);
     1267      m_signGvdR22[i].resize(3);
     1268      m_expGvdR22[i].resize(3);
     1269      m_manGvdR22[i].resize(3);
     1270
     1271      m_signGvdTX[i].resize(3);
     1272      m_expGvdTX[i].resize(3);
     1273      m_manGvdTX[i].resize(3);
     1274    }
     1275
     1276  }
     1277
     1278  Bool      m_alternativeDepthInfoCancelFlag;
     1279  Int       m_depthType;
     1280  Int       m_numConstituentViewsGvdMinus1;
     1281  Bool      m_depthPresentGvdFlag;
     1282  Bool      m_zGvdFlag;
     1283  Bool      m_intrinsicParamGvdFlag;
     1284  Bool      m_rotationGvdFlag;
     1285  Bool      m_translationGvdFlag;
     1286  BoolAry2d m_signGvdZNearFlag;
     1287  IntAry2d  m_expGvdZNear;
     1288  IntAry2d  m_manLenGvdZNearMinus1;
     1289  IntAry2d  m_manGvdZNear;
     1290  BoolAry2d m_signGvdZFarFlag;
     1291  IntAry2d  m_expGvdZFar;
     1292  IntAry2d  m_manLenGvdZFarMinus1;
     1293  IntAry2d  m_manGvdZFar;
     1294  Int       m_precGvdFocalLength;
     1295  Int       m_precGvdPrincipalPoint;
     1296  Int       m_precGvdRotationParam;
     1297  Int       m_precGvdTranslationParam;
     1298  BoolAry2d m_signGvdFocalLengthX;
     1299  IntAry2d  m_expGvdFocalLengthX;
     1300  IntAry2d  m_manGvdFocalLengthX;
     1301  BoolAry2d m_signGvdFocalLengthY;
     1302  IntAry2d  m_expGvdFocalLengthY;
     1303  IntAry2d  m_manGvdFocalLengthY;
     1304  BoolAry2d m_signGvdPrincipalPointX;
     1305  IntAry2d  m_expGvdPrincipalPointX;
     1306  IntAry2d  m_manGvdPrincipalPointX;
     1307  BoolAry2d m_signGvdPrincipalPointY;
     1308  IntAry2d  m_expGvdPrincipalPointY;
     1309  IntAry2d  m_manGvdPrincipalPointY;
     1310
     1311  BoolAry2d m_signGvdR00;
     1312  IntAry2d  m_expGvdR00;
     1313  IntAry2d  m_manGvdR00;
     1314  BoolAry2d m_signGvdR01;
     1315  IntAry2d  m_expGvdR01;
     1316  IntAry2d  m_manGvdR01;
     1317  BoolAry2d m_signGvdR02;
     1318  IntAry2d  m_expGvdR02;
     1319  IntAry2d  m_manGvdR02;
     1320  BoolAry2d m_signGvdR10;
     1321  IntAry2d  m_expGvdR10;
     1322  IntAry2d  m_manGvdR10;
     1323  BoolAry2d m_signGvdR11;
     1324  IntAry2d  m_expGvdR11;
     1325  IntAry2d  m_manGvdR11;
     1326  BoolAry2d m_signGvdR12;
     1327  IntAry2d  m_expGvdR12;
     1328  IntAry2d  m_manGvdR12;
     1329  BoolAry2d m_signGvdR20;
     1330  IntAry2d  m_expGvdR20;
     1331  IntAry2d  m_manGvdR20;
     1332  BoolAry2d m_signGvdR21;
     1333  IntAry2d  m_expGvdR21;
     1334  IntAry2d  m_manGvdR21;
     1335  BoolAry2d m_signGvdR22;
     1336  IntAry2d  m_expGvdR22;
     1337  IntAry2d  m_manGvdR22;
     1338
     1339  BoolAry2d m_signGvdTX;
     1340  IntAry2d  m_expGvdTX;
     1341  IntAry2d  m_manGvdTX;
     1342
     1343  Int       m_minOffsetXInt;
     1344  Int       m_minOffsetXFrac;
     1345  Int       m_maxOffsetXInt;
     1346  Int       m_maxOffsetXFrac;
     1347  Bool      m_offsetYPresentFlag;
     1348  Int       m_minOffsetYInt;
     1349  Int       m_minOffsetYFrac;
     1350  Int       m_maxOffsetYInt;
     1351  Int       m_maxOffsetYFrac;
     1352  Bool      m_warpMapSizePresentFlag;
     1353  Int       m_warpMapWidthMinus2;
     1354  Int       m_warpMapHeightMinus2;
     1355};
     1356
     1357#endif
     1358#endif
     1359
     1360#endif
    6021361//! \}
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r1321 r1356  
    54665466    }
    54675467
     5468#if NH_3D_FIX_NBDV_COL
     5469    // The picture pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx) might not be in DPB anymore
     5470    // So don't access it directly.
     5471    iColRefViewIdx = pColCU->getSlice()->getVPS()->getViewOrderIdx( pColCU->getSlice()->getRefLayerId( eColRefPicList, iColRefIdx ) );       
     5472#else
    54685473    iColRefViewIdx = pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx)->getViewIndex();
     5474#endif
     5475
    54695476
    54705477    if ( iColViewIdx    == iColRefViewIdx ) // temporal vector
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r1321 r1356  
    4343//! \{
    4444/////////////////////////////////////////////////////////////////////////////////////////
    45 ///////////////////////////////// EXTENSION SELECTION /////////////////////////////////// 
     45///////////////////////////////// EXTENSION SELECTION ///////////////////////////////////
    4646/////////////////////////////////////////////////////////////////////////////////////////
    4747/* HEVC_EXT might be defined by compiler/makefile options.
    48    Linux makefiles support the following settings:   
    49    make             -> HEVC_EXT not defined   
     48   Linux makefiles support the following settings:
     49   make             -> HEVC_EXT not defined
    5050   make HEVC_EXT=0  -> NH_MV=0 H_3D=0   --> plain HM
    51    make HEVC_EXT=1  -> NH_MV=1 H_3D=0   --> MV only 
    52    make HEVC_EXT=2  -> NH_MV=1 H_3D=1   --> full 3D 
     51   make HEVC_EXT=1  -> NH_MV=1 H_3D=0   --> MV only
     52   make HEVC_EXT=2  -> NH_MV=1 H_3D=1   --> full 3D
    5353*/
    5454#ifndef HEVC_EXT
     
    5656#endif
    5757#if ( HEVC_EXT < 0 )||( HEVC_EXT > 2 )
    58 #error HEVC_EXT must be in the range of 0 to 2, inclusive. 
     58#error HEVC_EXT must be in the range of 0 to 2, inclusive.
    5959#endif
    6060#define NH_MV          ( HEVC_EXT != 0)
    6161#define NH_3D          ( HEVC_EXT == 2)
    6262/////////////////////////////////////////////////////////////////////////////////////////
    63 ///////////////////////////////////   FIXES           /////////////////////////////////// 
     63///////////////////////////////////   FIXES AND INTEGRATIONS     ////////////////////////
    6464/////////////////////////////////////////////////////////////////////////////////////////
    6565#if NH_MV
    66 #define NH_MV_FIX_TICKET_106                      1 // Identical motion check.
    67 #define NH_MV_FIX_NO_REF_PICS_CHECK               1 // !!SPEC!!
    68 #define NH_MV_FIX_INIT_NUM_ACTIVE_REF_LAYER_PICS  1 // Derivation of NumActiveRefLayerPIcs. !!SPEC!!
     66#define NH_MV_SEI_TBD                             0
     67#define NH_MV_SEI                                 1
     68#define NH_MV_FIX_TICKET_106                      1 // Identical motion check.
     69#define NH_MV_FIX_NO_REF_PICS_CHECK               1 // !!SPEC!!
     70#define NH_MV_FIX_INIT_NUM_ACTIVE_REF_LAYER_PICS  1 // Derivation of NumActiveRefLayerPIcs. !!SPEC!!
    6971#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
    7076#endif
    7177#if NH_3D
    7278#define H_3D_FIX_ARP_CHECK_NOT_IN_DPB     1
     79#define NH_3D_FIX_NBDV_COL                1
    7380#endif
    7481/////////////////////////////////////////////////////////////////////////////////////////
    75 ///////////////////////////////////   MAJOR DEFINES   /////////////////////////////////// 
     82///////////////////////////////////   MAJOR DEFINES   ///////////////////////////////////
    7683/////////////////////////////////////////////////////////////////////////////////////////
    7784#if NH_MV
     
    9097                                             // LGE_ARP_CTX_F0161                JCT3V-F0161
    9198                                             // MTK_ARP_FLAG_CABAC_SIMP_G0061 Use 2 context for ARP flag referring to only left neighbor block in JCT3V-G0061
    92                                              // MTK_ARP_REF_SELECTION_G0053 ARP Reference picture selection in JCT3V-G0053 
     99                                             // MTK_ARP_REF_SELECTION_G0053 ARP Reference picture selection in JCT3V-G0053
    93100                                             // MTK_ALIGN_SW_WD_BI_PRED_ARP_H0085  Align the SW and WD for the bi-prediction ARP PUs by disallowing non-normative fast bi-prediction for ARP PUs, JCT3V-H0085
    94                                              // QC_I0051_ARP_SIMP         
    95                                              // SHARP_ARP_CHROMA_I0104     
     101                                             // QC_I0051_ARP_SIMP
     102                                             // SHARP_ARP_CHROMA_I0104
    96103                                             // MTK_I0072_IVARP_SCALING_FIX
    97104                                             // 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
    98105                                             // SEC_ARP_REM_ENC_RESTRICT_K0035    Removal of encoder restriction of ARP, JCT3V-K0035
    99106#define NH_3D_QTLPC                        1   // OL_QTLIMIT_PREDCODING_B0068 //JCT3V-B0068
    100                                               // HHI_QTLPC_RAU_OFF_C0160 JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units 
     107                                              // HHI_QTLPC_RAU_OFF_C0160 JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units
    101108                                              // MTK_TEX_DEP_PAR_G0055 Texture-partition-dependent depth partition. JCT3V-G0055
    102 #define NH_3D_VSO                          1   // VSO, View synthesis optimization, includes: 
     109#define NH_3D_VSO                          1   // VSO, View synthesis optimization, includes:
    103110                                              // HHI_VSO
    104111                                              // HHI_VSO_LS_TABLE_M23714 enable table base Lagrange multiplier optimization
     
    106113                                              // LGE_WVSO_A0119
    107114                                              // SCU_HS_VSD_BUGFIX_IMPROV_G0163
    108 #define NH_3D_NBDV                         1   // Neighboring block disparity derivation 
    109                                               // QC_JCT3V-A0097 
     115#define NH_3D_NBDV                         1   // Neighboring block disparity derivation
     116                                              // QC_JCT3V-A0097
    110117                                              // LGE_DVMCP_A0126
    111                                               // LGE_DVMCP_MEM_REDUCTION_B0135     
     118                                              // LGE_DVMCP_MEM_REDUCTION_B0135
    112119                                              // QC_SIMPLE_NBDV_B0047
    113120                                              // FIX_LGE_DVMCP_B0133
    114121                                              // QC_NBDV_LDB_FIX_C0055
    115122                                              // MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
    116                                               // MTK_SIMPLIFY_DVTC_C0135           
     123                                              // MTK_SIMPLIFY_DVTC_C0135
    117124                                              // QC_CU_NBDV_D0181
    118125                                              // SEC_DEFAULT_DV_D0112
     
    154161                                              // NTT_VSP_DC_BUGFIX_E0208 bugfix for sub-PU based DC in VSP, JCT3V-E0208
    155162                                              // NTT_VSP_COMMON_E0207_E0208 common part of JCT3V-E0207 and JCT3V-E0208
    156                                               // MTK_F0109_LG_F0120_VSP_BLOCK MTK_LG_SIMPLIFY_VSP_BLOCK_PARTITION_F0109_F0120 
     163                                              // MTK_F0109_LG_F0120_VSP_BLOCK MTK_LG_SIMPLIFY_VSP_BLOCK_PARTITION_F0109_F0120
    157164                                              // SHARP_VSP_BLOCK_IN_AMP_F0102 VSP partitioning for AMP
    158165                                              // MTK_VSP_SIMPLIFICATION_F0111 1. Inherited VSP also use NBDV of current CU, 2. VSP cannot be inherited from above LCU rowss
    159                                               // LGE_SHARP_VSP_INHERIT_F0104 
     166                                              // LGE_SHARP_VSP_INHERIT_F0104
    160167                                              // NTT_STORE_SPDV_VSP_G0148 Storing Sub-PU based DV for VSP
    161168                                              // Restricted bi-prediction for VSP
     
    164171#define NH_3D_MLC                          1
    165172#define NH_3D_IV_MERGE                     1  // Inter-view motion merge candidate
    166                                               // HHI_INTER_VIEW_MOTION_PRED 
     173                                              // HHI_INTER_VIEW_MOTION_PRED
    167174                                              // SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction
    168175                                              // QC_MRG_CANS_B0048             , JCT3V-B0048, B0086, B0069
    169176                                              // OL_DISMV_POS_B0069            , different pos for disparity MV candidate, B0069
    170177                                              // MTK_INTERVIEW_MERGE_A0049     , second part
    171                                               // QC_AMVP_MRG_UNIFY_IVCAN_C0051     
    172                                               // QC_INRIA_MTK_MRG_E0126 
     178                                              // QC_AMVP_MRG_UNIFY_IVCAN_C0051
     179                                              // QC_INRIA_MTK_MRG_E0126
    173180                                              // ETRIKHU_MERGE_REUSE_F0093 QC_DEPTH_IV_MRG_F0125, JCT3V-F0125: Depth oriented Inter-view MV candidate
    174181                                              // MTK_NBDV_IVREF_FIX_G0067      , Disable IvMC, VSP when IVREF is not available, JCT3V-G0067
     
    187194                                              // TEXTURE MERGING CANDIDATE     , JCT3V-C0137
    188195                                              // EC_MPI_ENABLING_MERGE_F0150, MPI flag in VPS and enabling in Merge mode
    189 #define NH_3D_TMVP                        1   // QC_TMVP_C0047 
     196#define NH_3D_TMVP                        1   // QC_TMVP_C0047
    190197                                              // Sony_M23639
    191198                                              // H_3D_TMVP_SCALING_FIX_K0053       1   // QC/CY for K0053
     
    207214                                              // QC_DIM_DELTADC_UNIFY_F0132 Unify delta DC coding in depth intra modes
    208215                                              // LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135  Use only one context for CABAC of dim_not_present_flag
    209                                               // QC_SIMP_DELTADC_CODING_H0131   Simplify detaDC entropy coding 
     216                                              // QC_SIMP_DELTADC_CODING_H0131   Simplify detaDC entropy coding
    210217                                              // MTK_DMM_SIMP_CODE_H0092        Remove CABAC context for DMM1 mode coding
    211218                                              // MTK_DELTA_DC_FLAG_ONE_CONTEXT_H0084_H0100_H0113 Use only one context for CABAC of delta_dc_flag as in JCTVC-H0084, JCTVC-H0100 and JCTVC-H0113
    212219                                              // HS_DMM_SIGNALLING_I0120
    213                                               // SHARP_DMM1_I0110 LUT size reduction for DMM1 proposed in JCT3V-I0110 
     220                                              // SHARP_DMM1_I0110 LUT size reduction for DMM1 proposed in JCT3V-I0110
    214221                                              // MTK_DMM_SIM_J0035
    215                                               // SHARP_DMM_CLEAN_K0042             1   // Generate DMM pattern with rotation 
     222                                              // SHARP_DMM_CLEAN_K0042             1   // Generate DMM pattern with rotation
    216223#define NH_3D_DLT                         1   // Depth Lookup Table
    217224                                              // HHI_DELTADC_DLT_D0035
    218225                                              // LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 JCT3V-F0159
    219                                               // SEC_NO_RESI_DLT_H0105   
    220                                               // MTK_DLT_CODING_FIX_H0091 
     226                                              // SEC_NO_RESI_DLT_H0105
     227                                              // MTK_DLT_CODING_FIX_H0091
    221228                                              // H_3D_DELTA_DLT
    222229                                              // RWTH_DLT_CLIP_I0057
    223                                               // SHARP_DLT_SIMP_J0029 DLT(DepthValue2Idx[]) table derivation cleanup 
     230                                              // SHARP_DLT_SIMP_J0029 DLT(DepthValue2Idx[]) table derivation cleanup
    224231#define NH_3D_SDC_INTRA                   1   // Segment-wise DC Coding method for INTRA
    225 #define NH_3D_SDC_INTER                   1   // Segment-wise DC Coding method for INTER 
     232#define NH_3D_SDC_INTER                   1   // Segment-wise DC Coding method for INTER
    226233                                              // RWTH_SDC_DLT_B0036
    227234                                              // INTEL_SDC64_D0193
     
    249256                                              // MPI_SUBPU_DEFAULT_MV_H0077_H0099_H0111_H0133
    250257#define NH_3D_DBBP                         1   // DBBP: Depth-based Block Partitioning and Merging
    251                                               // MTK_DBBP_AMP_REM_H0072   
    252                                               // RWTH_DBBP_NO_SPU_H0057   
    253                                               // SEC_DBBP_FILTERING_H0104 
    254                                               // MTK_DBBP_SIGNALING_H0094   
    255                                               // H_3D_FIX_DBBP_IVMP Fix . Enable IVMP is always disabled, when DBBP is enabled. The original intention is to disable Sub-PU IVMP when DBBP is enabled, not to disable IVMP itself. 
     258                                              // MTK_DBBP_AMP_REM_H0072
     259                                              // RWTH_DBBP_NO_SPU_H0057
     260                                              // SEC_DBBP_FILTERING_H0104
     261                                              // MTK_DBBP_SIGNALING_H0094
     262                                              // H_3D_FIX_DBBP_IVMP Fix . Enable IVMP is always disabled, when DBBP is enabled. The original intention is to disable Sub-PU IVMP when DBBP is enabled, not to disable IVMP itself.
    256263                                              // SEC_DBBP_EXPLICIT_SIG_I0077 Remove the partition derivation and signal dbbp_flag only when the partition mode is 2NxN/Nx2N, JCT3V-I0077
    257264                                              // Disallow DBBP in 8x8 CU, JCT3V-I0078
     
    261268                                              // RWTH_DBBP_NO_SATD_K0028
    262269                                              // HS_DBBP_CLEAN_K0048
    263 #define NH_3D_DIS                         1   // Depth intra skip 
     270#define NH_3D_DIS                         1   // Depth intra skip
    264271                                              // SEC_DEPTH_INTRA_SKIP_MODE_K0033  Depth intra skip mode
    265272#define H_3D_FCO                          0   // Flexible coding order for 3D
     
    272279                                             // HHI_VPS_3D_EXTENSION_I3_J0107
    273280                                             // HHI_INTER_COMP_PRED_K0052
    274                                              // HHI_RES_PRED_K0052       
    275                                              // HHI_CAM_PARA_K0052       
    276                                              // H_3D_DIRECT_DEP_TYPE     
     281                                             // HHI_RES_PRED_K0052
     282                                             // HHI_CAM_PARA_K0052
     283                                             // H_3D_DIRECT_DEP_TYPE
    277284// Rate Control
    278285#define KWU_FIX_URQ                       0
     
    281288#endif // NH_3D
    282289/////////////////////////////////////////////////////////////////////////////////////////
    283 ///////////////////////////////////   DERIVED DEFINES /////////////////////////////////// 
     290///////////////////////////////////   DERIVED DEFINES ///////////////////////////////////
    284291/////////////////////////////////////////////////////////////////////////////////////////
    285292#if NH_3D
     
    288295#endif
    289296///// ***** VIEW SYNTHESIS OPTIMIZAION *********
    290 #if NH_3D_VSO                                 
     297#if NH_3D_VSO
    291298#define H_3D_VSO_DIST_INT                 1   // Allow negative synthesized view distortion change
    292 #define H_3D_VSO_COLOR_PLANES             1   // Compute VSO distortion on color planes 
     299#define H_3D_VSO_COLOR_PLANES             1   // Compute VSO distortion on color planes
    293300#define H_3D_VSO_EARLY_SKIP               1   // LGE_VSO_EARLY_SKIP_A0093, A0093 modification 4
    294301#define H_3D_VSO_RM_ASSERTIONS            0   // Output VSO assertions
     
    332339///////////////////////////////////   MV_HEVC HLS  //////////////////////////////
    333340/////////////////////////////////////////////////////////////////////////////////
    334 // TBD: Check if integration is necessary. 
     341// TBD: Check if integration is necessary.
    335342#define H_MV_HLS_PTL_LIMITS                  0
    336343/////////////////////////////////////////////////////////////////////////////////////////
     
    485492typedef       UInt            Distortion;        ///< distortion measurement
    486493#endif
    487 #if NH_MV                         
     494#if NH_MV
     495typedef std::vector< std::string > StringAry1d;
     496typedef std::vector< StringAry1d > StringAry2d;
    488497typedef std::vector< Int >        IntAry1d;
    489 typedef std::vector< IntAry1d >   IntAry2d; 
    490 typedef std::vector< IntAry2d >   IntAry3d; 
    491 typedef std::vector< IntAry3d >   IntAry4d; 
    492 typedef std::vector< IntAry4d >   IntAry5d; 
     498typedef std::vector< IntAry1d >   IntAry2d;
     499typedef std::vector< IntAry2d >   IntAry3d;
     500typedef std::vector< IntAry3d >   IntAry4d;
     501typedef std::vector< IntAry4d >   IntAry5d;
    493502typedef std::vector< Bool >        BoolAry1d;
    494 typedef std::vector< BoolAry1d >   BoolAry2d; 
    495 typedef std::vector< BoolAry2d >   BoolAry3d; 
    496 typedef std::vector< BoolAry3d >   BoolAry4d; 
    497 typedef std::vector< BoolAry4d >   BoolAry5d; 
     503typedef std::vector< BoolAry1d >   BoolAry2d;
     504typedef std::vector< BoolAry2d >   BoolAry3d;
     505typedef std::vector< BoolAry3d >   BoolAry4d;
     506typedef std::vector< BoolAry4d >   BoolAry5d;
    498507#endif
    499508#if NH_3D_VSO
     
    504513#if H_3D_VSO_DIST_INT
    505514typedef       Int64            Dist;       ///< RDO distortion
    506 typedef       Int64            Dist64; 
     515typedef       Int64            Dist64;
    507516#define       RDO_DIST_MIN     MIN_INT
    508517#define       RDO_DIST_MAX     MAX_INT
    509518#else
    510519typedef       UInt             Dist;       ///< RDO distortion
    511 typedef       UInt64           Dist; 
     520typedef       UInt64           Dist;
    512521#define       RDO_DIST_MIN     0
    513522#define       RDO_DIST_MAX     MAX_UINT
     
    797806  ANNEX_G,
    798807  ANNEX_H,
    799   ANNEX_I 
     808  ANNEX_I
    800809};
    801810#endif
     
    813822    ,MULTIVIEWMAIN = 6,
    814823#if NH_3D
    815     MAIN3D = 8, 
     824    MAIN3D = 8,
    816825#endif
    817826#endif
     
    941950enum ScalabilityType
    942951{
    943   DEPTH_ID = 0,   
     952  DEPTH_ID = 0,
    944953  VIEW_ORDER_INDEX  = 1,
    945954  DEPENDENCY_ID = 2,
  • trunk/source/Lib/TLibDecoder/SEIread.cpp

    r1313 r1356  
    9999}
    100100
     101Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const Char *pSymbolName)
     102{
     103  READ_STRING(uiBufSize, pucCode, ruiLength, pSymbolName);
     104  if (pOS)
     105  {
     106    (*pOS) << "  " << pSymbolName << ": " << (const char*) pucCode << "\n";
     107  }
     108}
     109
     110#if NH_MV_SEI
     111inline Void SEIReader::output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize)
     112#else
    101113static inline Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize)
     114#endif
    102115{
    103116  if (pDecodedMessageOutputStream)
     
    105118    std::string seiMessageHdr(SEI::getSEIMessageString(sei.payloadType())); seiMessageHdr+=" SEI message";
    106119    (*pDecodedMessageOutputStream) << std::setfill('-') << std::setw(seiMessageHdr.size()) << "-" << std::setfill(' ') << "\n" << seiMessageHdr << " (" << payloadSize << " bytes)"<< "\n";
     120#if NH_MV_SEI
     121    (*pDecodedMessageOutputStream) << std::setfill(' ') << "LayerId: " << m_layerId << std::setw(2) << " Picture: " << m_decOrder << std::setw( 5 ) << std::endl;
     122#endif
    107123  }
    108124}
     
    117133 * unmarshal a single SEI message from bitstream bs
    118134 */
     135#if NH_MV_LAYERS_NOT_PRESENT_SEI
     136Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     137#else
    119138Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     139#endif
    120140{
    121141  setBitstream(bs);
     
    124144  do
    125145  {
     146#if NH_MV_LAYERS_NOT_PRESENT_SEI
     147    xReadSEImessage(seis, nalUnitType, vps, sps, pDecodedMessageOutputStream);
     148#else
    126149    xReadSEImessage(seis, nalUnitType, sps, pDecodedMessageOutputStream);
    127 
     150#endif
    128151    /* SEI messages are an integer number of bytes, something has failed
    129152    * in the parsing if bitstream not byte-aligned */
     
    135158}
    136159
     160#if NH_MV_LAYERS_NOT_PRESENT_SEI
     161Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     162#else
    137163Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     164#endif
    138165{
    139166#if ENC_DEC_TRACE
     
    254281    case SEI::SCALABLE_NESTING:
    255282      sei = new SEIScalableNesting;
     283#if NH_MV_LAYERS_NOT_PRESENT_SEI
     284      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, vps, sps, pDecodedMessageOutputStream);
     285#else
    256286      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps, pDecodedMessageOutputStream);
     287#endif
    257288      break;
    258289    case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:
     
    277308      xParseSEIMasteringDisplayColourVolume((SEIMasteringDisplayColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream);
    278309      break;
    279 #if NH_MV
     310#if !NH_MV_SEI
    280311    case SEI::SUB_BITSTREAM_PROPERTY:
    281312      sei = new SEISubBitstreamProperty;
    282313      xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei, payloadSize, pDecodedMessageOutputStream );
    283314      break;
     315#else
     316#if NH_MV_LAYERS_NOT_PRESENT_SEI
     317    case SEI::LAYERS_NOT_PRESENT:
     318      if (!vps)
     319      {
     320        printf ("Warning: Found Layers not present SEI message, but no active VPS is available. Ignoring.");
     321      }
     322      else
     323      {
     324        sei = new SEILayersNotPresent;
     325        xParseSEILayersNotPresent((SEILayersNotPresent&) *sei, payloadSize, vps, pDecodedMessageOutputStream);
     326      }
     327      break;
     328#endif
     329    case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
     330      sei = new SEIInterLayerConstrainedTileSets;
     331      xParseSEIInterLayerConstrainedTileSets((SEIInterLayerConstrainedTileSets&) *sei, payloadSize, pDecodedMessageOutputStream );
     332      break;
     333#if NH_MV_TBD
     334    case SEI::BSP_NESTING:
     335      sei = new SEIBspNesting;
     336      xParseSEIBspNesting((SEIBspNesting&) *sei, payloadSize, pDecodedMessageOutputStream );
     337      break;
     338    case SEI::BSP_INITIAL_ARRIVAL_TIME:
     339      sei = new SEIBspInitialArrivalTime;
     340      xParseSEIBspInitialArrivalTime((SEIBspInitialArrivalTime&) *sei, payloadSize, pDecodedMessageOutputStream );
     341      break;
     342#endif
     343    case SEI::SUB_BITSTREAM_PROPERTY:
     344      sei = new SEISubBitstreamProperty;
     345      xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei, payloadSize, pDecodedMessageOutputStream );
     346      break;
     347    case SEI::ALPHA_CHANNEL_INFO:
     348      sei = new SEIAlphaChannelInfo;
     349      xParseSEIAlphaChannelInfo((SEIAlphaChannelInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     350      break;
     351    case SEI::OVERLAY_INFO:
     352      sei = new SEIOverlayInfo;
     353      xParseSEIOverlayInfo((SEIOverlayInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     354      break;
     355    case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS:
     356      sei = new SEITemporalMvPredictionConstraints;
     357      xParseSEITemporalMvPredictionConstraints((SEITemporalMvPredictionConstraints&) *sei, payloadSize, pDecodedMessageOutputStream );
     358      break;
     359#if NH_MV_SEI_TBD
     360    case SEI::FRAME_FIELD_INFO:
     361      sei = new SEIFrameFieldInfo;
     362      xParseSEIFrameFieldInfo((SEIFrameFieldInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     363      break;
     364#endif
     365    case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:
     366      sei = new SEIThreeDimensionalReferenceDisplaysInfo;
     367      xParseSEIThreeDimensionalReferenceDisplaysInfo((SEIThreeDimensionalReferenceDisplaysInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     368      break;
     369#if SEI_DRI_F0169
     370    case SEI::DEPTH_REPRESENTATION_INFO:
     371        sei = new SEIDepthRepresentationInfo;
     372        xParseSEIDepthRepresentationInfo((SEIDepthRepresentationInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     373        break;
     374#endif
     375    case SEI::MULTIVIEW_SCENE_INFO:
     376      sei = new SEIMultiviewSceneInfo;
     377      xParseSEIMultiviewSceneInfo((SEIMultiviewSceneInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     378      break;
     379
     380    case SEI::MULTIVIEW_ACQUISITION_INFO:
     381      sei = new SEIMultiviewAcquisitionInfo;
     382      xParseSEIMultiviewAcquisitionInfo((SEIMultiviewAcquisitionInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     383      break;
     384
     385    case SEI::MULTIVIEW_VIEW_POSITION:
     386      sei = new SEIMultiviewViewPosition;
     387      xParseSEIMultiviewViewPosition((SEIMultiviewViewPosition&) *sei, payloadSize, pDecodedMessageOutputStream );
     388      break;
     389#if NH_3D
     390    case SEI::ALTERNATIVE_DEPTH_INFO:
     391      sei = new SEIAlternativeDepthInfo;
     392      xParseSEIAlternativeDepthInfo((SEIAlternativeDepthInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     393      break;
     394#endif
    284395#endif
    285396    default:
     
    455566Void SEIReader::xParseSEIActiveParameterSets(SEIActiveParameterSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    456567{
    457   UInt val; 
     568  UInt val;
    458569  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    459570
     
    805916}
    806917
     918#if NH_MV_LAYERS_NOT_PRESENT_SEI
     919Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     920#else
    807921Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     922#endif
    808923{
    809924  UInt uiCode;
     
    847962  do
    848963  {
     964#if NH_MV_LAYERS_NOT_PRESENT_SEI
     965    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, pDecodedMessageOutputStream);
     966#else
    849967    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, pDecodedMessageOutputStream);
     968#endif
    850969  } while (m_pcBitstream->getNumBitsLeft() > 8);
    851970
     
    857976
    858977#if NH_MV
     978#if !NH_MV_SEI
    859979Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
    860980{
     
    872992    sei_read_code( pDecodedMessageOutputStream,  16, code, "avg_bit_rate[i]"                 ); sei.m_avgBitRate[i] = code;
    873993    sei_read_code( pDecodedMessageOutputStream,  16, code, "max_bit_rate[i]"                 ); sei.m_maxBitRate[i] = code;
    874   } 
     994  }
    875995}
    876996
     
    8831003  sei.m_maxBitRate.resize( sei.m_numAdditionalSubStreams );
    8841004}
     1005#endif
    8851006#endif
    8861007
     
    11011222}
    11021223
     1224#if NH_MV_LAYERS_NOT_PRESENT_SEI
     1225Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
     1226{
     1227  UInt code;
     1228
     1229  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1230  sei_read_code( pDecodedMessageOutputStream, 4, code, "lnp_sei_active_vps_id" ); sei.m_lnpSeiActiveVpsId = code;
     1231  assert(vps->getVPSId() == sei.m_lnpSeiActiveVpsId);
     1232
     1233  sei.m_lnpSeiMaxLayers = vps->getMaxLayersMinus1() + 1;
     1234  sei.resizeDimI(sei.m_lnpSeiMaxLayers);
     1235  for (Int i = 0; i < sei.m_lnpSeiMaxLayers; i++)
     1236  {
     1237    sei_read_flag( pDecodedMessageOutputStream, code, "layer_not_present_flag" );
     1238    sei.m_layerNotPresentFlag[i] = (code == 1);
     1239  }
     1240};
     1241#endif
     1242
     1243Void SEIReader::xParseSEIInterLayerConstrainedTileSets(SEIInterLayerConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1244{
     1245  UInt code;
     1246  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1247
     1248  sei_read_flag( pDecodedMessageOutputStream, code, "il_all_tiles_exact_sample_value_match_flag" ); sei.m_ilAllTilesExactSampleValueMatchFlag = (code == 1);
     1249  sei_read_flag( pDecodedMessageOutputStream, code, "il_one_tile_per_tile_set_flag"              ); sei.m_ilOneTilePerTileSetFlag             = (code == 1);
     1250  if( !sei.m_ilOneTilePerTileSetFlag )
     1251  {
     1252    sei_read_uvlc( pDecodedMessageOutputStream, code, "il_num_sets_in_message_minus1" ); sei.m_ilNumSetsInMessageMinus1 = code;
     1253    if( sei.m_ilNumSetsInMessageMinus1 )
     1254    {
     1255      sei_read_flag( pDecodedMessageOutputStream, code, "skipped_tile_set_present_flag" ); sei.m_skippedTileSetPresentFlag = (code == 1);
     1256    }
     1257    Int numSignificantSets = sei.m_ilNumSetsInMessageMinus1 - sei.m_skippedTileSetPresentFlag + 1;
     1258
     1259    sei.resizeDimI( numSignificantSets );
     1260    for( Int i = 0; i < numSignificantSets; i++ )
     1261    {
     1262      sei_read_uvlc( pDecodedMessageOutputStream, code, "ilcts_id"                        ); sei.m_ilctsId                  [i] = code;
     1263      sei_read_uvlc( pDecodedMessageOutputStream, code, "il_num_tile_rects_in_set_minus1" ); sei.m_ilNumTileRectsInSetMinus1[i] = code;
     1264
     1265      sei.resizeDimJ( i, sei.m_ilNumTileRectsInSetMinus1[ i ] + 1 );
     1266      for( Int j = 0; j  <=  sei.m_ilNumTileRectsInSetMinus1[ i ]; j++ )
     1267      {
     1268        sei_read_uvlc( pDecodedMessageOutputStream, code, "il_top_left_tile_index"     ); sei.m_ilTopLeftTileIndex    [i][j] = code;
     1269        sei_read_uvlc( pDecodedMessageOutputStream, code, "il_bottom_right_tile_index" ); sei.m_ilBottomRightTileIndex[i][j] = code;
     1270      }
     1271      sei_read_code( pDecodedMessageOutputStream, 2, code, "ilc_idc" ); sei.m_ilcIdc[i] = code;
     1272      if ( !sei.m_ilAllTilesExactSampleValueMatchFlag )
     1273      {
     1274        sei_read_flag( pDecodedMessageOutputStream, code, "il_exact_sample_value_match_flag" ); sei.m_ilExactSampleValueMatchFlag[i] = (code == 1);
     1275      }
     1276    }
     1277  }
     1278  else
     1279  {
     1280    sei_read_code( pDecodedMessageOutputStream, 2, code, "all_tiles_ilc_idc" ); sei.m_allTilesIlcIdc = code;
     1281  }
     1282};
     1283
     1284#if NH_MV_SEI_TBD
     1285Void SEIReader::xParseSEIBspNesting(SEIBspNesting& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1286{
     1287  UInt code;
     1288  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1289
     1290  sei_read_uvlc( pDecodedMessageOutputStream, code, "sei_ols_idx" ); sei.m_seiOlsIdx = code;
     1291  sei_read_uvlc( pDecodedMessageOutputStream, code, "sei_partitioning_scheme_idx" ); sei.m_seiPartitioningSchemeIdx = code;
     1292  sei_read_uvlc( pDecodedMessageOutputStream, code, "bsp_idx" ); sei.m_bspIdx = code;
     1293  while( !ByteaLigned(() ) );
     1294  {
     1295    sei_read_code( pDecodedMessageOutputStream, *equalto0*/u1, code, "bsp_nesting_zero_bit" ); sei.m_bspNestingZeroBit = code;
     1296  }
     1297  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_seis_in_bsp_minus1" ); sei.m_numSeisInBspMinus1 = code;
     1298  for( Int i = 0; i  <=  NumSeisInBspMinus1( ); i++ )
     1299  {
     1300    SeiMessage(() );
     1301  }
     1302};
     1303
     1304Void SEIReader::xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1305{
     1306  UInt code;
     1307  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1308
     1309  psIdx = SeiPartitioningSchemeIdx();
     1310  if( nalInitialArrivalDelayPresent )
     1311  {
     1312    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
     1313    {
     1314      sei_read_code( pDecodedMessageOutputStream, getNalInitialArrivalDelayLen ), code, "nal_initial_arrival_delay" ); sei.m_nalInitialArrivalDelay[i] = code;
     1315    }
     1316  }
     1317  if( vclInitialArrivalDelayPresent )
     1318  {
     1319    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
     1320    {
     1321      sei_read_code( pDecodedMessageOutputStream, getVclInitialArrivalDelayLen ), code, "vcl_initial_arrival_delay" ); sei.m_vclInitialArrivalDelay[i] = code;
     1322    }
     1323  }
     1324};
     1325#endif
     1326
     1327Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1328{
     1329  UInt code;
     1330  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1331
     1332  sei_read_code( pDecodedMessageOutputStream, 4, code, "sb_property_active_vps_id" ); sei.m_sbPropertyActiveVpsId = code;
     1333  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_additional_sub_streams_minus1" ); sei.m_numAdditionalSubStreamsMinus1 = code;
     1334  sei.resizeArrays( );
     1335  for( Int i = 0; i  <=  sei.m_numAdditionalSubStreamsMinus1; i++ )
     1336  {
     1337    sei_read_code( pDecodedMessageOutputStream, 2, code, "sub_bitstream_mode" ); sei.m_subBitstreamMode[i] = code;
     1338    sei_read_uvlc( pDecodedMessageOutputStream, code, "ols_idx_to_vps" ); sei.m_olsIdxToVps[i] = code;
     1339    sei_read_code( pDecodedMessageOutputStream, 3, code, "highest_sublayer_id" ); sei.m_highestSublayerId[i] = code;
     1340    sei_read_code( pDecodedMessageOutputStream, 16, code, "avg_sb_property_bit_rate" ); sei.m_avgSbPropertyBitRate[i] = code;
     1341    sei_read_code( pDecodedMessageOutputStream, 16, code, "max_sb_property_bit_rate" ); sei.m_maxSbPropertyBitRate[i] = code;
     1342  }
     1343};
     1344
     1345Void SEIReader::xParseSEIAlphaChannelInfo(SEIAlphaChannelInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1346{
     1347  UInt code;
     1348  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1349
     1350  sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_cancel_flag" ); sei.m_alphaChannelCancelFlag = (code == 1);
     1351  if( !sei.m_alphaChannelCancelFlag )
     1352  {
     1353    sei_read_code( pDecodedMessageOutputStream, 3, code, "alpha_channel_use_idc" ); sei.m_alphaChannelUseIdc = code;
     1354    sei_read_code( pDecodedMessageOutputStream, 3, code, "alpha_channel_bit_depth_minus8" ); sei.m_alphaChannelBitDepthMinus8 = code;
     1355    sei_read_code( pDecodedMessageOutputStream, sei.m_alphaChannelBitDepthMinus8+9, code, "alpha_transparent_value" ); sei.m_alphaTransparentValue = code;
     1356    sei_read_code( pDecodedMessageOutputStream, sei.m_alphaChannelBitDepthMinus8+9, code, "alpha_opaque_value" ); sei.m_alphaOpaqueValue = code;
     1357    sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_incr_flag" ); sei.m_alphaChannelIncrFlag = (code == 1);
     1358    sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_clip_flag" ); sei.m_alphaChannelClipFlag = (code == 1);
     1359    if( sei.m_alphaChannelClipFlag )
     1360    {
     1361      sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_clip_type_flag" ); sei.m_alphaChannelClipTypeFlag = (code == 1);
     1362    }
     1363  }
     1364};
     1365
     1366Void SEIReader::xParseSEIOverlayInfo(SEIOverlayInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1367{
     1368  UInt code;
     1369  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1370
     1371  sei_read_flag( pDecodedMessageOutputStream, code, "overlay_info_cancel_flag" ); sei.m_overlayInfoCancelFlag = (code == 1);
     1372  if( !sei.m_overlayInfoCancelFlag )
     1373  {
     1374    sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_content_aux_id_minus128" );            sei.m_overlayContentAuxIdMinus128 = code;
     1375    sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_label_aux_id_minus128" );              sei.m_overlayLabelAuxIdMinus128 = code;
     1376    sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_alpha_aux_id_minus128" );              sei.m_overlayAlphaAuxIdMinus128 = code;
     1377    sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_element_label_value_length_minus8" );  sei.m_overlayElementLabelValueLengthMinus8 = code;
     1378    sei_read_uvlc( pDecodedMessageOutputStream, code, "num_overlays_minus1" );                        sei.m_numOverlaysMinus1 = code;
     1379
     1380    sei.m_overlayIdx.resize( sei.m_numOverlaysMinus1+1 );
     1381    sei.m_languageOverlayPresentFlag.resize( sei.m_numOverlaysMinus1+1 );
     1382    sei.m_overlayContentLayerId.resize     ( sei.m_numOverlaysMinus1+1 );
     1383    sei.m_overlayLabelPresentFlag.resize   ( sei.m_numOverlaysMinus1+1 );
     1384    sei.m_overlayLabelLayerId.resize       ( sei.m_numOverlaysMinus1+1 );
     1385    sei.m_overlayAlphaPresentFlag.resize   ( sei.m_numOverlaysMinus1+1 );
     1386    sei.m_overlayAlphaLayerId.resize       ( sei.m_numOverlaysMinus1+1 );
     1387    sei.m_numOverlayElementsMinus1.resize  ( sei.m_numOverlaysMinus1+1 );
     1388    sei.m_overlayElementLabelMin.resize    ( sei.m_numOverlaysMinus1+1 );
     1389    sei.m_overlayElementLabelMax.resize    ( sei.m_numOverlaysMinus1+1 );
     1390    for( Int i = 0; i  <=  sei.m_numOverlaysMinus1; i++ )
     1391    {
     1392      sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_idx" );                    sei.m_overlayIdx[i]                 = code;
     1393      sei_read_flag( pDecodedMessageOutputStream, code, "language_overlay_present_flag" );  sei.m_languageOverlayPresentFlag[i] = (code == 1);
     1394      sei_read_code( pDecodedMessageOutputStream, 6, code, "overlay_content_layer_id" );    sei.m_overlayContentLayerId[i]      = code;
     1395      sei_read_flag( pDecodedMessageOutputStream, code, "overlay_label_present_flag" );     sei.m_overlayLabelPresentFlag[i]    = (code == 1);
     1396      if( sei.m_overlayLabelPresentFlag[i] )
     1397      {
     1398        sei_read_code( pDecodedMessageOutputStream, 6, code, "overlay_label_layer_id" );     sei.m_overlayLabelLayerId[i]       = code;
     1399      }
     1400      sei_read_flag( pDecodedMessageOutputStream, code, "overlay_alpha_present_flag" );      sei.m_overlayAlphaPresentFlag[i]   = (code == 1);
     1401      if( sei.m_overlayAlphaPresentFlag[i] )
     1402      {
     1403        sei_read_code( pDecodedMessageOutputStream, 6, code, "overlay_alpha_layer_id" );     sei.m_overlayAlphaLayerId[i]       = code;
     1404      }
     1405      if( sei.m_overlayLabelPresentFlag[i] )
     1406      {
     1407        sei_read_uvlc( pDecodedMessageOutputStream, code, "num_overlay_elements_minus1" );   sei.m_numOverlayElementsMinus1[i]  = code;
     1408        sei.m_overlayElementLabelMin[i].resize( sei.m_numOverlayElementsMinus1[i]+1 );
     1409        sei.m_overlayElementLabelMax[i].resize( sei.m_numOverlayElementsMinus1[i]+1 );
     1410        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1[i]; j++ )
     1411        {
     1412          sei_read_code( pDecodedMessageOutputStream, sei.m_overlayElementLabelValueLengthMinus8 + 8, code, "overlay_element_label_min" ); sei.m_overlayElementLabelMin[i][j] = code;
     1413          sei_read_code( pDecodedMessageOutputStream, sei.m_overlayElementLabelValueLengthMinus8 + 8, code, "overlay_element_label_max" ); sei.m_overlayElementLabelMax[i][j] = code;
     1414        }
     1415      }
     1416    }
     1417
     1418    // byte alignment
     1419    while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     1420    {
     1421      sei_read_flag( pDecodedMessageOutputStream, code, "overlay_zero_bit" );
     1422      assert( code==0 );
     1423    }
     1424
     1425    UChar* sval = new UChar[sei.m_numStringBytesMax];
     1426    UInt slen;
     1427    sei.m_overlayLanguage   .resize( sei.m_numOverlaysMinus1 + 1 );
     1428    sei.m_overlayName       .resize( sei.m_numOverlaysMinus1 + 1 );
     1429    sei.m_overlayElementName.resize( sei.m_numOverlaysMinus1 + 1 );
     1430    for( Int i = 0; i  <=  sei.m_numOverlaysMinus1; i++ )
     1431    {
     1432      if( sei.m_languageOverlayPresentFlag[i] )
     1433      {
     1434        sei_read_string(pDecodedMessageOutputStream, sei.m_numStringBytesMax, sval, slen, "overlay_language");
     1435        sei.m_overlayLanguage[i] = std::string((const char*) sval);
     1436      }
     1437      sei_read_string(pDecodedMessageOutputStream, sei.m_numStringBytesMax, sval, slen, "overlay_name");
     1438      sei.m_overlayName[i] = std::string((const char*) sval);
     1439      if( sei.m_overlayLabelPresentFlag[i] )
     1440      {
     1441        sei.m_overlayElementName[i].resize( sei.m_numOverlayElementsMinus1[i]+1 );
     1442        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1[i]; j++ )
     1443        {
     1444          sei_read_string(pDecodedMessageOutputStream, sei.m_numStringBytesMax, sval, slen, "overlay_element_name");
     1445          sei.m_overlayElementName[i][j] = std::string((const char*) sval);
     1446        }
     1447      }
     1448    }
     1449    delete [] sval;
     1450    sei_read_flag( pDecodedMessageOutputStream, code, "overlay_info_persistence_flag" ); sei.m_overlayInfoPersistenceFlag = (code == 1);
     1451  }
     1452};
     1453
     1454Void SEIReader::xParseSEITemporalMvPredictionConstraints(SEITemporalMvPredictionConstraints& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1455{
     1456  UInt code;
     1457  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1458
     1459  sei_read_flag( pDecodedMessageOutputStream, code, "prev_pics_not_used_flag"     ); sei.m_prevPicsNotUsedFlag    = (code == 1);
     1460  sei_read_flag( pDecodedMessageOutputStream, code, "no_intra_layer_col_pic_flag" ); sei.m_noIntraLayerColPicFlag = (code == 1);
     1461};
     1462
     1463#if NH_MV_SEI_TBD
     1464Void SEIReader::xParseSEIFrameFieldInfo(SEIFrameFieldInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1465{
     1466  UInt code;
     1467  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1468
     1469  sei_read_code( pDecodedMessageOutputStream, 4, code, "ffinfo_pic_struct" ); sei.m_ffinfoPicStruct = code;
     1470  sei_read_code( pDecodedMessageOutputStream, 2, code, "ffinfo_source_scan_type" ); sei.m_ffinfoSourceScanType = code;
     1471  sei_read_flag( pDecodedMessageOutputStream, code, "ffinfo_duplicate_flag" ); sei.m_ffinfoDuplicateFlag = (code == 1);
     1472};
     1473#endif
     1474
     1475Void SEIReader::xParseSEIThreeDimensionalReferenceDisplaysInfo(SEIThreeDimensionalReferenceDisplaysInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1476{
     1477  UInt code;
     1478  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1479
     1480  sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_ref_display_width" ); sei.m_precRefDisplayWidth = code;
     1481  sei_read_flag( pDecodedMessageOutputStream, code, "ref_viewing_distance_flag" ); sei.m_refViewingDistanceFlag = (code == 1);
     1482  if( sei.m_refViewingDistanceFlag )
     1483  {
     1484    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_ref_viewing_dist" ); sei.m_precRefViewingDist = code;
     1485  }
     1486  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_ref_displays_minus1" ); sei.m_numRefDisplaysMinus1 = code;
     1487  sei.resizeArrays( );
     1488  for( Int i = 0; i  <=  sei.getNumRefDisplaysMinus1( ); i++ )
     1489  {
     1490    sei_read_uvlc( pDecodedMessageOutputStream, code, "left_view_id" ); sei.m_leftViewId[i] = code;
     1491    sei_read_uvlc( pDecodedMessageOutputStream, code, "right_view_id" ); sei.m_rightViewId[i] = code;
     1492    sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_ref_display_width" ); sei.m_exponentRefDisplayWidth[i] = code;
     1493    sei_read_code( pDecodedMessageOutputStream, sei.getMantissaReferenceDisplayWidthLen(i), code, "mantissa_ref_display_width" ); sei.m_mantissaRefDisplayWidth[i] =  code      ;
     1494    if( sei.m_refViewingDistanceFlag )
     1495    {
     1496      sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_ref_viewing_distance" ); sei.m_exponentRefViewingDistance[i] = code;
     1497      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaReferenceViewingDistanceLen(i), code, "mantissa_ref_viewing_distance" ); sei.m_mantissaRefViewingDistance[i] = code;
     1498    }
     1499    sei_read_flag( pDecodedMessageOutputStream, code, "additional_shift_present_flag" ); sei.m_additionalShiftPresentFlag[i] = (code == 1);
     1500    if( sei.m_additionalShiftPresentFlag[i] )
     1501    {
     1502      sei_read_code( pDecodedMessageOutputStream, 10, code, "num_sample_shift_plus512" ); sei.m_numSampleShiftPlus512[i] = code;
     1503    }
     1504  }
     1505  sei_read_flag( pDecodedMessageOutputStream, code, "three_dimensional_reference_displays_extension_flag" ); sei.m_threeDimensionalReferenceDisplaysExtensionFlag = (code == 1);
     1506};
     1507
     1508#if SEI_DRI_F0169
     1509Void SEIReader::xParseSEIDepthRepInfoElement(double& f,std::ostream *pDecodedMessageOutputStream)
     1510{
     1511    UInt val;
     1512    UInt x_sign,x_mantissa_len,x_mantissa;
     1513    Int x_exp;
     1514
     1515    sei_read_flag(pDecodedMessageOutputStream,     val,"da_sign_flag");  x_sign = val ? 1 : 0 ;
     1516    sei_read_code(pDecodedMessageOutputStream,  7, val, "da_exponent" );         x_exp = val-31;
     1517    sei_read_code(pDecodedMessageOutputStream,  5, val, "da_mantissa_len_minus1" );         x_mantissa_len = val+1;
     1518    sei_read_code(pDecodedMessageOutputStream,  x_mantissa_len, val, "da_mantissa" );         x_mantissa = val;
     1519    if (x_mantissa_len>=16)
     1520    {
     1521        f =1.0 +  (x_mantissa*1.0)/(1u<<(x_mantissa_len-16))/(256.0*256.0 );
     1522    }else
     1523    {
     1524        f =1.0 +  (x_mantissa*1.0)/(1u<<x_mantissa_len);
     1525    }
     1526    double m=1.0;
     1527    int i;
     1528    if (x_exp<0)
     1529    {
     1530        for(i=0;i<-x_exp;i++)
     1531            m = m * 2;
     1532
     1533        f = f/m;
     1534    }
     1535    else
     1536    {
     1537        for(i=0;i<x_exp;i++)
     1538            m = m * 2;
     1539
     1540        f= f * m;
     1541    }
     1542    if (x_sign==1)
     1543    {
     1544        f= -f;
     1545    }
     1546};
     1547
     1548Void SEIReader::xParseSEIDepthRepresentationInfo(SEIDepthRepresentationInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1549{
     1550    UInt code;
     1551    double zNear,zFar,dMin,dMax;
     1552    bool zNearFlag,zFarFlag,dMinFlag,dMaxFlag;
     1553    int depth_representation_type,disparityRefViewId,depthNonlinearRepresentationNumMinus1;
     1554    std::vector<int> DepthNonlinearRepresentationModel;
     1555
     1556    sei.clear();
     1557
     1558    output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1559
     1560    sei_read_flag( pDecodedMessageOutputStream, code, "z_near_flag" );    zNearFlag  = (code == 1);
     1561    sei_read_flag( pDecodedMessageOutputStream, code, "z_far_flag" );     zFarFlag = (code == 1);
     1562    sei_read_flag( pDecodedMessageOutputStream, code, "d_min_flag" );     dMinFlag = (code == 1);
     1563    sei_read_flag( pDecodedMessageOutputStream, code, "d_max_flag" );     dMaxFlag = (code == 1);
     1564    sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_representation_type" ); depth_representation_type = code;
     1565
     1566    sei.m_zNearFlag.push_back(zNearFlag);
     1567    sei.m_zFarFlag.push_back(zFarFlag);
     1568    sei.m_dMinFlag.push_back(dMinFlag);
     1569    sei.m_dMaxFlag.push_back(dMaxFlag);
     1570
     1571    sei.m_depthRepresentationType.push_back(IntAry1d(1,depth_representation_type));
     1572
     1573    if( dMinFlag  ||  dMaxFlag )
     1574    {
     1575        sei_read_uvlc( pDecodedMessageOutputStream, code, "disparity_ref_view_id" ); disparityRefViewId = code;
     1576        sei.m_disparityRefViewId.push_back(IntAry1d(1,disparityRefViewId));
     1577    }
     1578    if( zNearFlag )
     1579    {
     1580        xParseSEIDepthRepInfoElement(zNear , pDecodedMessageOutputStream);
     1581        sei.m_zNear.push_back(std::vector<double>(1,zNear));
     1582    }
     1583    if( zFarFlag )
     1584    {
     1585        xParseSEIDepthRepInfoElement(zFar , pDecodedMessageOutputStream);
     1586        sei.m_zFar.push_back(std::vector<double>(1,zFar));
     1587    }
     1588    if( dMinFlag )
     1589    {
     1590        xParseSEIDepthRepInfoElement(dMin , pDecodedMessageOutputStream);
     1591        sei.m_dMin.push_back(std::vector<double>(1,dMin));
     1592    }
     1593    if( dMaxFlag )
     1594    {
     1595        xParseSEIDepthRepInfoElement(dMax , pDecodedMessageOutputStream);
     1596        sei.m_dMax.push_back(std::vector<double>(1,dMax));
     1597    }
     1598    if( depth_representation_type  ==  3 )
     1599    {
     1600        sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_nonlinear_representation_num_minus1" ); depthNonlinearRepresentationNumMinus1 = code;
     1601        sei.m_depthNonlinearRepresentationNumMinus1.push_back(IntAry1d(1,depthNonlinearRepresentationNumMinus1));
     1602        for( Int i = 1; i  <=  depthNonlinearRepresentationNumMinus1 + 1; i++ )
     1603        {
     1604            sei_read_uvlc(pDecodedMessageOutputStream,code,"DepthNonlinearRepresentationModel" ) ;
     1605            DepthNonlinearRepresentationModel.push_back(code);
     1606        }
     1607
     1608        sei.m_depth_nonlinear_representation_model.push_back(DepthNonlinearRepresentationModel);
     1609    }
     1610}
     1611#endif
     1612Void SEIReader::xParseSEIMultiviewSceneInfo(SEIMultiviewSceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1613{
     1614  UInt  code;
     1615  Int  sCode;
     1616  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1617
     1618  sei_read_svlc( pDecodedMessageOutputStream, sCode, "min_disparity" )      ; sei.m_minDisparity      = sCode;
     1619  sei_read_uvlc( pDecodedMessageOutputStream, code , "max_disparity_range" ); sei.m_maxDisparityRange = code;
     1620};
     1621
     1622Void SEIReader::xParseSEIMultiviewAcquisitionInfo(SEIMultiviewAcquisitionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1623{
     1624  UInt code;
     1625  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1626
     1627  sei.resizeArrays( );
     1628  sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_param_flag" ); sei.m_intrinsicParamFlag = (code == 1);
     1629  sei_read_flag( pDecodedMessageOutputStream, code, "extrinsic_param_flag" ); sei.m_extrinsicParamFlag = (code == 1);
     1630  if( sei.m_intrinsicParamFlag )
     1631  {
     1632    sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_params_equal_flag" ); sei.m_intrinsicParamsEqualFlag = (code == 1);
     1633    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_focal_length"           ); sei.m_precFocalLength          =  code      ;
     1634    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_principal_point"        ); sei.m_precPrincipalPoint       =  code      ;
     1635    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_skew_factor"            ); sei.m_precSkewFactor           =  code      ;
     1636
     1637    for( Int i = 0; i  <=  ( sei.m_intrinsicParamsEqualFlag ? 0 : sei.getNumViewsMinus1() ); i++ )
     1638    {
     1639      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_focal_length_x"        ); sei.m_signFocalLengthX       [i] = (code == 1);
     1640      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_focal_length_x"    ); sei.m_exponentFocalLengthX   [i] =  code      ;
     1641      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaFocalLengthXLen   ( i ), code, "mantissa_focal_length_x"    ); sei.m_mantissaFocalLengthX   [i] =  code      ;
     1642      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_focal_length_y"        ); sei.m_signFocalLengthY       [i] = (code == 1);
     1643      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_focal_length_y"    ); sei.m_exponentFocalLengthY   [i] =  code      ;
     1644      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaFocalLengthYLen   ( i ), code, "mantissa_focal_length_y"    ); sei.m_mantissaFocalLengthY   [i] =  code      ;
     1645      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_principal_point_x"     ); sei.m_signPrincipalPointX    [i] = (code == 1);
     1646      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_principal_point_x" ); sei.m_exponentPrincipalPointX[i] =  code      ;
     1647      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaPrincipalPointXLen( i ), code, "mantissa_principal_point_x" ); sei.m_mantissaPrincipalPointX[i] =  code      ;
     1648      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_principal_point_y"     ); sei.m_signPrincipalPointY    [i] = (code == 1);
     1649      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_principal_point_y" ); sei.m_exponentPrincipalPointY[i] =  code      ;
     1650      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaPrincipalPointYLen( i ), code, "mantissa_principal_point_y" ); sei.m_mantissaPrincipalPointY[i] =  code      ;
     1651      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_skew_factor"           ); sei.m_signSkewFactor         [i] = (code == 1);
     1652      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_skew_factor"       ); sei.m_exponentSkewFactor     [i] =  code      ;
     1653      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaSkewFactorLen     ( i ), code, "mantissa_skew_factor"       ); sei.m_mantissaSkewFactor     [i] =  code      ;
     1654    }
     1655  }
     1656  if( sei.m_extrinsicParamFlag )
     1657  {
     1658    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_rotation_param"    ); sei.m_precRotationParam    = code;
     1659    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_translation_param" ); sei.m_precTranslationParam = code;
     1660
     1661    for( Int i = 0; i  <=  sei.getNumViewsMinus1(); i++ )
     1662    {
     1663      for( Int j = 0; j  <=  2; j++ )  /* row */
     1664      {
     1665        for( Int k = 0; k  <=  2; k++ )  /* column */
     1666        {
     1667          sei_read_flag( pDecodedMessageOutputStream,                                 code, "sign_r"     ); sei.m_signR    [i][j][k] = (code == 1);
     1668          sei_read_code( pDecodedMessageOutputStream, 6,                              code, "exponent_r" ); sei.m_exponentR[i][j][k] =  code      ;
     1669          sei_read_code( pDecodedMessageOutputStream, sei.getMantissaRLen( i, j, k ), code, "mantissa_r" ); sei.m_mantissaR[i][j][k] =  code      ;
     1670        }
     1671        sei_read_flag( pDecodedMessageOutputStream,                              code, "sign_t"     ); sei.m_signT    [i][j] = (code == 1);
     1672        sei_read_code( pDecodedMessageOutputStream, 6,                           code, "exponent_t" ); sei.m_exponentT[i][j] =  code      ;
     1673        sei_read_code( pDecodedMessageOutputStream, sei.getMantissaTLen( i, j ), code, "mantissa_t" ); sei.m_mantissaT[i][j] =  code      ;
     1674      }
     1675    }
     1676  }
     1677};
     1678
     1679
     1680
     1681Void SEIReader::xParseSEIMultiviewViewPosition(SEIMultiviewViewPosition& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1682{
     1683  UInt code;
     1684  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1685
     1686  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_views_minus1" ); sei.m_numViewsMinus1 = code;
     1687  sei.m_viewPosition.resize( sei.m_numViewsMinus1 + 1 );
     1688  for( Int i = 0; i  <=  sei.m_numViewsMinus1; i++ )
     1689  {
     1690    sei_read_uvlc( pDecodedMessageOutputStream, code, "view_position" ); sei.m_viewPosition[i] = code;
     1691  }
     1692};
     1693
     1694#if NH_3D
     1695Void SEIReader::xParseSEIAlternativeDepthInfo(SEIAlternativeDepthInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1696{
     1697  UInt code;
     1698  Int scode;
     1699  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1700
     1701  sei.resizeArrays( );
     1702  sei_read_flag( pDecodedMessageOutputStream, code, "alternative_depth_info_cancel_flag" ); sei.m_alternativeDepthInfoCancelFlag = (code == 1);
     1703  if( sei.m_alternativeDepthInfoCancelFlag  ==  0 )
     1704  {
     1705    sei_read_code( pDecodedMessageOutputStream, 2, code, "depth_type" ); sei.m_depthType = code;
     1706    if( sei.m_depthType  ==  0 )
     1707    {
     1708      sei_read_uvlc( pDecodedMessageOutputStream, code, "num_constituent_views_gvd_minus1" ); sei.m_numConstituentViewsGvdMinus1 = code;
     1709      sei_read_flag( pDecodedMessageOutputStream, code, "depth_present_gvd_flag" ); sei.m_depthPresentGvdFlag = (code == 1);
     1710      sei_read_flag( pDecodedMessageOutputStream, code, "z_gvd_flag" ); sei.m_zGvdFlag = (code == 1);
     1711      sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_param_gvd_flag" ); sei.m_intrinsicParamGvdFlag = (code == 1);
     1712      sei_read_flag( pDecodedMessageOutputStream, code, "rotation_gvd_flag" ); sei.m_rotationGvdFlag = (code == 1);
     1713      sei_read_flag( pDecodedMessageOutputStream, code, "translation_gvd_flag" ); sei.m_translationGvdFlag = (code == 1);
     1714      if( sei.m_zGvdFlag )
     1715      {
     1716        for( Int i = 0, j = 0; j <=  sei.m_numConstituentViewsGvdMinus1 + 1; j++ )
     1717        {
     1718          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_z_near_flag" ); sei.m_signGvdZNearFlag[i][j] = (code == 1);
     1719          sei_read_code( pDecodedMessageOutputStream, 7, code, "exp_gvd_z_near" ); sei.m_expGvdZNear[i][j] = code;
     1720          sei_read_code( pDecodedMessageOutputStream, 5, code, "man_len_gvd_z_near_minus1" ); sei.m_manLenGvdZNearMinus1[i][j] = code;
     1721          sei_read_code( pDecodedMessageOutputStream, sei.m_manLenGvdZNearMinus1[i][j]+1, code, "man_gvd_z_near" ); sei.m_manGvdZNear[i][j] = code;
     1722          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_z_far_flag" ); sei.m_signGvdZFarFlag[i][j] = (code == 1);
     1723          sei_read_code( pDecodedMessageOutputStream, 7, code, "exp_gvd_z_far" ); sei.m_expGvdZFar[i][j] = code;
     1724          sei_read_code( pDecodedMessageOutputStream, 5, code, "man_len_gvd_z_far_minus1" ); sei.m_manLenGvdZFarMinus1[i][j] = code;
     1725          sei_read_code( pDecodedMessageOutputStream, sei.m_manLenGvdZFarMinus1[i][j]+1, code, "man_gvd_z_far" ); sei.m_manGvdZFar[i][j] = code;
     1726        }
     1727      }
     1728      if( sei.m_intrinsicParamGvdFlag )
     1729      {
     1730        sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_focal_length" ); sei.m_precGvdFocalLength = code;
     1731        sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_principal_point" ); sei.m_precGvdPrincipalPoint = code;
     1732      }
     1733      if( sei.m_rotationGvdFlag )
     1734      {
     1735        sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_rotation_param" ); sei.m_precGvdRotationParam = code;
     1736      }
     1737      if( sei.m_translationGvdFlag )
     1738      {
     1739        sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_translation_param" ); sei.m_precGvdTranslationParam = code;
     1740      }
     1741      for( Int i = 0, j = 0; j <= sei.m_numConstituentViewsGvdMinus1 + 1; j++ )
     1742      {
     1743        if( sei.m_intrinsicParamGvdFlag )
     1744        {
     1745          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_focal_length_x" ); sei.m_signGvdFocalLengthX[i][j] = (code == 1);
     1746          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_focal_length_x" ); sei.m_expGvdFocalLengthX[i][j] = code;
     1747          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdFocalLengthXLen(i,j), code, "man_gvd_focal_length_x" ); sei.m_manGvdFocalLengthX[i][j] = code;
     1748          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_focal_length_y" ); sei.m_signGvdFocalLengthY[i][j] = (code == 1);
     1749          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_focal_length_y" ); sei.m_expGvdFocalLengthY[i][j] = code;
     1750          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdFocalLengthYLen(i,j), code, "man_gvd_focal_length_y" ); sei.m_manGvdFocalLengthY[i][j] = code;
     1751          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_principal_point_x" ); sei.m_signGvdPrincipalPointX[i][j] = (code == 1);
     1752          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_principal_point_x" ); sei.m_expGvdPrincipalPointX[i][j] = code;
     1753          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdPrincipalPointXLen(i,j), code, "man_gvd_principal_point_x" ); sei.m_manGvdPrincipalPointX[i][j] = code;
     1754          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_principal_point_y" ); sei.m_signGvdPrincipalPointY[i][j] = (code == 1);
     1755          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_principal_point_y" ); sei.m_expGvdPrincipalPointY[i][j] = code;
     1756          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdPrincipalPointYLen(i,j), code, "man_gvd_principal_point_y" ); sei.m_manGvdPrincipalPointY[i][j] = code;
     1757        }
     1758        if( sei.m_rotationGvdFlag )
     1759        {
     1760          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r00" ); sei.m_signGvdR00[i][j] = (code == 1);
     1761          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r00" ); sei.m_expGvdR00[i][j] = code;
     1762          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r00" ); sei.m_manGvdR00[i][j] = code;
     1763          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r01" ); sei.m_signGvdR01[i][j] = (code == 1);
     1764          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r01" ); sei.m_expGvdR01[i][j] = code;
     1765          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r01" ); sei.m_manGvdR01[i][j] = code;
     1766          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r02" ); sei.m_signGvdR02[i][j] = (code == 1);
     1767          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r02" ); sei.m_expGvdR02[i][j] = code;
     1768          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r02" ); sei.m_manGvdR02[i][j] = code;
     1769          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r10" ); sei.m_signGvdR10[i][j] = (code == 1);
     1770          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r10" ); sei.m_expGvdR10[i][j] = code;
     1771          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r10" ); sei.m_manGvdR10[i][j] = code;
     1772          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r11" ); sei.m_signGvdR11[i][j] = (code == 1);
     1773          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r11" ); sei.m_expGvdR11[i][j] = code;
     1774          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r11" ); sei.m_manGvdR11[i][j] = code;
     1775          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r12" ); sei.m_signGvdR12[i][j] = (code == 1);
     1776          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r12" ); sei.m_expGvdR12[i][j] = code;
     1777          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r12" ); sei.m_manGvdR12[i][j] = code;
     1778          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r20" ); sei.m_signGvdR20[i][j] = (code == 1);
     1779          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r20" ); sei.m_expGvdR20[i][j] = code;
     1780          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r20" ); sei.m_manGvdR20[i][j] = code;
     1781          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r21" ); sei.m_signGvdR21[i][j] = (code == 1);
     1782          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r21" ); sei.m_expGvdR21[i][j] = code;
     1783          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r21" ); sei.m_manGvdR21[i][j] = code;
     1784          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r22" ); sei.m_signGvdR22[i][j] = (code == 1);
     1785          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r22" ); sei.m_expGvdR22[i][j] = code;
     1786          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r22" ); sei.m_manGvdR22[i][j] = code;
     1787          //sei_read_code( pDecodedMessageOutputStream, sei.getManGvdRLen(i,j,k), code, "man_gvd_r" ); sei.m_manGvdR[i][j] = code;
     1788        }
     1789        if( sei.m_translationGvdFlag )
     1790        {
     1791          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_t_x" ); sei.m_signGvdTX[i][j] = (code == 1);
     1792          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_t_x" ); sei.m_expGvdTX[i][j] = code;
     1793          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdTXLen(i,j), code, "man_gvd_t_x" ); sei.m_manGvdTX[i][j] = code;
     1794        }
     1795      }
     1796    }
     1797
     1798    if( sei.m_depthType  ==  1 )
     1799    {
     1800      sei_read_svlc( pDecodedMessageOutputStream, scode, "min_offset_x_int" ); sei.m_minOffsetXInt = scode;
     1801      sei_read_code( pDecodedMessageOutputStream, 8, code, "min_offset_x_frac" ); sei.m_minOffsetXFrac = code;
     1802      sei_read_svlc( pDecodedMessageOutputStream, scode, "max_offset_x_int" ); sei.m_maxOffsetXInt = scode;
     1803      sei_read_code( pDecodedMessageOutputStream, 8, code, "max_offset_x_frac" ); sei.m_maxOffsetXFrac = code;
     1804      sei_read_flag( pDecodedMessageOutputStream, code, "offset_y_present_flag" ); sei.m_offsetYPresentFlag = (code == 1);
     1805      if( sei.m_offsetYPresentFlag )
     1806      {
     1807        sei_read_svlc( pDecodedMessageOutputStream, scode, "min_offset_y_int" ); sei.m_minOffsetYInt = scode;
     1808        sei_read_code( pDecodedMessageOutputStream, 8, code, "min_offset_y_frac" ); sei.m_minOffsetYFrac = code;
     1809        sei_read_svlc( pDecodedMessageOutputStream, scode, "max_offset_y_int" ); sei.m_maxOffsetYInt = scode;
     1810        sei_read_code( pDecodedMessageOutputStream, 8, code, "max_offset_y_frac" ); sei.m_maxOffsetYFrac = code;
     1811      }
     1812      sei_read_flag( pDecodedMessageOutputStream, code, "warp_map_size_present_flag" ); sei.m_warpMapSizePresentFlag = (code == 1);
     1813      if( sei.m_warpMapSizePresentFlag )
     1814      {
     1815        sei_read_uvlc( pDecodedMessageOutputStream, code, "warp_map_width_minus2" ); sei.m_warpMapWidthMinus2 = code;
     1816        sei_read_uvlc( pDecodedMessageOutputStream, code, "warp_map_height_minus2" ); sei.m_warpMapHeightMinus2 = code;
     1817      }
     1818    }
     1819  }
     1820};
     1821#endif
     1822
    11031823//! \}
  • trunk/source/Lib/TLibDecoder/SEIread.h

    r1313 r1356  
    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);
     60#else
    5861  Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     62#endif
     63#if NH_MV_SEI
     64  Void setLayerId                            ( Int   layerId )   { m_layerId  = layerId; };
     65  Void setDecOrder                           ( Int64 decOrder )  { m_decOrder = decOrder; };
     66#endif
    5967protected:
     68#if NH_MV_LAYERS_NOT_PRESENT_SEI
     69  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     70#else
    6071  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     72#endif
    6173  Void xParseSEIuserDataUnregistered          (SEIuserDataUnregistered &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    6274  Void xParseSEIActiveParameterSets           (SEIActiveParameterSets  &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     
    7486  Void xParseSEIToneMappingInfo               (SEIToneMappingInfo& sei,               UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    7587  Void xParseSEISOPDescription                (SEISOPDescription &sei,                UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     88#if NH_MV_LAYERS_NOT_PRESENT_SEI
     89  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     90#else
    7691  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     92#endif
    7793  Void xParseSEITempMotionConstraintsTileSets (SEITempMotionConstrainedTileSets& sei, UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    7894  Void xParseSEITimeCode                      (SEITimeCode& sei,                      UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     
    8197  Void xParseSEIMasteringDisplayColourVolume  (SEIMasteringDisplayColourVolume& sei,  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    8298#if NH_MV
     99#if !NH_MV_SEI
    83100  Void  xParseSEISubBitstreamProperty         (SEISubBitstreamProperty &sei        ,  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    84101  Void  xResizeSubBitstreamPropertySeiArrays  (SEISubBitstreamProperty &sei);
     102#endif
     103#endif
     104#if NH_MV_LAYERS_NOT_PRESENT_SEI
     105  Void xParseSEILayersNotPresent              (SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps ,std::ostream *pDecodedMessageOutputStream);
     106#endif
     107  Void xParseSEIInterLayerConstrainedTileSets (SEIInterLayerConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     108#if NH_MV_SEI_TBD
     109  Void xParseSEIBspNesting                    (SEIBspNesting& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     110  Void xParseSEIBspInitialArrivalTime         (SEIBspInitialArrivalTime& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     111#endif
     112  Void xParseSEISubBitstreamProperty          (SEISubBitstreamProperty& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     113  Void xParseSEIAlphaChannelInfo              (SEIAlphaChannelInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     114  Void xParseSEIOverlayInfo                   (SEIOverlayInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     115  Void xParseSEITemporalMvPredictionConstraints(SEITemporalMvPredictionConstraints& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     116#if NH_MV_SEI_TBD
     117  Void xParseSEIFrameFieldInfo                (SEIFrameFieldInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     118#endif
     119  Void xParseSEIThreeDimensionalReferenceDisplaysInfo (SEIThreeDimensionalReferenceDisplaysInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     120#if SEI_DRI_F0169
     121  Void xParseSEIDepthRepInfoElement           (double &f,std::ostream *pDecodedMessageOutputStream);
     122  Void xParseSEIDepthRepresentationInfo       (SEIDepthRepresentationInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     123#endif
     124  Void xParseSEIMultiviewSceneInfo            (SEIMultiviewSceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     125
     126  Void xParseSEIMultiviewAcquisitionInfo      (SEIMultiviewAcquisitionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     127
     128#if NH_MV_SEI
     129  Void xParseSEIMultiviewViewPosition         (SEIMultiviewViewPosition& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     130#endif
     131#if NH_3D
     132  Void xParseSEIAlternativeDepthInfo          (SEIAlternativeDepthInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    85133#endif
    86134
     
    89137  Void sei_read_svlc(std::ostream *pOS,                Int&  ruiCode, const Char *pSymbolName);
    90138  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
     141  inline Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize);
     142private:
     143  Int   m_layerId;
     144  Int64 m_decOrder;   
     145#endif
    91146};
    92147
  • trunk/source/Lib/TLibDecoder/SyntaxElementParser.cpp

    r1313 r1356  
    152152}
    153153
     154Void  SyntaxElementParser::xReadStringTr        (UInt buSize, UChar *pValue, UInt& rLength, const Char *pSymbolName)
     155{
     156#if RExt__DECODER_DEBUG_BIT_STATISTICS
     157  xReadString (buSize, pValue, rLength, pSymbolName);
     158#else
     159  xReadString(buSize, pValue, rLength);
     160#endif 
     161  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
     162  fprintf( g_hTrace, "%-50s st(v=%d)  : %s\n", pSymbolName, rLength, pValue );
     163  fflush ( g_hTrace );
     164}
     165
    154166Void  xTraceAccessUnitDelimiter ()
    155167{
     
    269281}
    270282
     283#if RExt__DECODER_DEBUG_BIT_STATISTICS
     284Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength, const Char *pSymbolName)
     285#else
     286Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength)
     287#endif
     288{
     289  assert( m_pcBitstream->getNumBitsRead() % 8 == 0 ); //always start reading at a byte-aligned position 
     290  UInt val;
     291  UInt i;
     292  for (i=0 ; i<bufSize ; ++i )
     293  {
     294    m_pcBitstream->readByte( val );
     295    pVal[i] = val;
     296    if ( val == 0)
     297    {
     298      break;
     299    }
     300  }
     301  rLength = i;
     302  assert( pVal[rLength] == 0 ); 
     303}
     304
    271305Void SyntaxElementParser::xReadRbspTrailingBits()
    272306{
  • trunk/source/Lib/TLibDecoder/SyntaxElementParser.h

    r1313 r1356  
    4949#define READ_SVLC(        code, name)     xReadSvlcTr (         code, name )
    5050#define READ_FLAG(        code, name)     xReadFlagTr (         code, name )
     51#define READ_STRING(bufSize, code, length, name)   xReadStringTr ( bufSize, code, length, name )
    5152
    5253#else
     
    5859#define READ_SVLC(        code, name)     xReadSvlc (         code, name )
    5960#define READ_FLAG(        code, name)     xReadFlag (         code, name )
     61#define READ_STRING(bufSize, code, length, name)   xReadString ( bufSize, code, length, name )
    6062
    6163#else
     
    6567#define READ_SVLC(        code, name)     xReadSvlc (         code )
    6668#define READ_FLAG(        code, name)     xReadFlag (         code )
     69#define READ_STRING(bufSize, code, length, name)   xReadString ( bufSize, code, length )
    6770
    6871#endif
     
    9295  Void  xReadSvlc    ( Int&   val, const Char *pSymbolName );
    9396  Void  xReadFlag    ( UInt&  val, const Char *pSymbolName );
     97  Void  xReadString  ( UInt bufSize, UChar *val, UInt& length, const Char *pSymbolName);
    9498#else
    9599  Void  xReadCode    ( UInt   length, UInt& val );
     
    97101  Void  xReadSvlc    ( Int&   val );
    98102  Void  xReadFlag    ( UInt&  val );
     103  Void  xReadString  ( UInt bufSize, UChar *val, UInt& length);
    99104#endif
    100105#if ENC_DEC_TRACE
     
    103108  Void  xReadSvlcTr  (               Int& rValue, const Char *pSymbolName);
    104109  Void  xReadFlagTr  (              UInt& rValue, const Char *pSymbolName);
     110  Void  xReadStringTr(UInt bufSize, UChar *pValue, UInt& rLength, const Char *pSymbolName);
    105111#endif
    106112public:
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r1321 r1356  
    5959  m_iLog2Precision   = LOG2_DISP_PREC_LUT;
    6060  m_uiBitDepthForLUT = 8; // fixed
    61   m_receivedIdc = NULL; 
    62   m_vps         = NULL; 
     61  m_receivedIdc = NULL;
     62  m_vps         = NULL;
    6363}
    6464
     
    7575  xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );
    7676  xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );
    77   xDeleteArray( m_receivedIdc, m_vps->getNumViews() );
     77  if ( m_receivedIdc != NULL )
     78  {
     79    xDeleteArray( m_receivedIdc, m_vps->getNumViews() );
     80  }
    7881}
    7982
     
    8487  assert( !isInitialized() ); // Only one initialization currently supported
    8588  m_bInitialized            = true;
    86   m_vps                     = vps; 
    87   m_bCamParsVaryOverTime    = false;   
    88   m_lastPoc                 = -1;   
    89   m_firstReceivedPoc        = -2; 
     89  m_vps                     = vps;
     90  m_bCamParsVaryOverTime    = false;
     91  m_lastPoc                 = -1;
     92  m_firstReceivedPoc        = -2;
    9093
    9194  for (Int i = 0; i <= vps->getMaxLayersMinus1(); i++)
    9295  {
    93     Int curViewIdxInVps = m_vps->getVoiInVps( m_vps->getViewIndex( m_vps->getLayerIdInNuh( i ) ) ) ; 
    94     m_bCamParsVaryOverTime = m_bCamParsVaryOverTime || vps->getCpInSliceSegmentHeaderFlag( curViewIdxInVps );   
    95   }
    96 
    97   assert( m_receivedIdc == NULL ); 
    98   m_receivedIdc = new Int*[ m_vps->getNumViews() ]; 
     96    Int curViewIdxInVps = m_vps->getVoiInVps( m_vps->getViewIndex( m_vps->getLayerIdInNuh( i ) ) ) ;
     97    m_bCamParsVaryOverTime = m_bCamParsVaryOverTime || vps->getCpInSliceSegmentHeaderFlag( curViewIdxInVps );
     98  }
     99
     100  assert( m_receivedIdc == NULL );
     101  m_receivedIdc = new Int*[ m_vps->getNumViews() ];
    99102  for (Int i = 0; i < m_vps->getNumViews(); i++)
    100103  {
    101     m_receivedIdc[i] = new Int[ m_vps->getNumViews() ]; 
    102   }
    103 
    104   xResetReceivedIdc( true ); 
     104    m_receivedIdc[i] = new Int[ m_vps->getNumViews() ];
     105  }
     106
     107  xResetReceivedIdc( true );
    105108
    106109  for (Int voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )
    107110  {
    108     if( !m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) 
     111    if( !m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) )
    109112    {
    110113      for (Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )
    111       { 
     114      {
    112115        if( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )
    113116        {
    114           m_receivedIdc   [ baseVoiInVps ][ voiInVps ] = -1; 
     117          m_receivedIdc   [ baseVoiInVps ][ voiInVps ] = -1;
    115118          m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] = m_vps->getCodedScale    (voiInVps) [ baseVoiInVps ];
    116119          m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] = m_vps->getCodedOffset   (voiInVps) [ baseVoiInVps ];
    117120
    118           m_receivedIdc   [ voiInVps ][ baseVoiInVps ] = -1; 
     121          m_receivedIdc   [ voiInVps ][ baseVoiInVps ] = -1;
    119122          m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedScale (voiInVps) [ baseVoiInVps ];
    120123          m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedOffset(voiInVps) [ baseVoiInVps ];
     
    131134{
    132135  for (Int i = 0; i < m_vps->getNumViews(); i++)
    133   { 
     136  {
    134137    for (Int j = 0; j < m_vps->getNumViews(); j++)
    135138    {
    136139      if ( overWriteFlag ||  ( m_receivedIdc[i][j] != -1 ) )
    137140      {
    138         m_receivedIdc[i][j] = 0; 
    139       }     
     141        m_receivedIdc[i][j] = 0;
     142      }
    140143    }
    141144  }
     
    171174}
    172175
    173 Void 
     176Void
    174177  CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)
    175178{
     
    234237  if( m_firstReceivedPoc == -2 )
    235238  {
    236     m_firstReceivedPoc = curPoc; 
    237   }
    238 
    239   Bool newPocFlag = ( m_lastPoc != curPoc ); 
     239    m_firstReceivedPoc = curPoc;
     240  }
     241
     242  Bool newPocFlag = ( m_lastPoc != curPoc );
    240243
    241244  if ( newPocFlag )
    242   {   
     245  {
    243246    if( m_lastPoc != -1 )
    244247    {
     
    246249    }
    247250
    248     xResetReceivedIdc( false ); 
     251    xResetReceivedIdc( false );
    249252    m_lastPoc = pcSlice->getPOC();
    250253  }
    251254
    252   UInt voiInVps          = m_vps->getVoiInVps(pcSlice->getViewIndex()); 
     255  UInt voiInVps          = m_vps->getVoiInVps(pcSlice->getViewIndex());
    253256  if( m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) // check consistency of slice parameters here
    254   {   
     257  {
    255258    for( Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )
    256     {       
     259    {
    257260      if ( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )
    258261      {
    259262        if ( m_receivedIdc[ voiInVps ][ baseVoiInVps ] != 0 )
    260         {     
     263        {
    261264          AOF( m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedScale () [ baseVoiInVps ] );
    262265          AOF( m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedOffset() [ baseVoiInVps ] );
    263266        }
    264267        else
    265         {         
    266           m_receivedIdc   [ voiInVps ][ baseVoiInVps ]  = 1; 
     268        {
     269          m_receivedIdc   [ voiInVps ][ baseVoiInVps ]  = 1;
    267270          m_aaiCodedScale [ voiInVps ][ baseVoiInVps ]  = pcSlice->getInvCodedScale () [ baseVoiInVps ];
    268271          m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ]  = pcSlice->getInvCodedOffset() [ baseVoiInVps ];
     
    270273        }
    271274        if ( m_receivedIdc[ baseVoiInVps ][ voiInVps ] != 0 )
    272         {     
     275        {
    273276          AOF( m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedScale    () [ baseVoiInVps ] );
    274277          AOF( m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedOffset   () [ baseVoiInVps ] );
    275278        }
    276279        else
    277         {       
    278           m_receivedIdc   [ baseVoiInVps ][ voiInVps ]  = 1; 
     280        {
     281          m_receivedIdc   [ baseVoiInVps ][ voiInVps ]  = 1;
    279282          m_aaiCodedScale [ baseVoiInVps ][ voiInVps ]  = pcSlice->getCodedScale    () [ baseVoiInVps ];
    280283          m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ]  = pcSlice->getCodedOffset   () [ baseVoiInVps ];
     
    283286      }
    284287    }
    285   } 
     288  }
    286289}
    287290
     
    295298      fprintf( m_pCodedScaleOffsetFile, "#ViewOrderIdx     ViewIdVal\n" );
    296299      fprintf( m_pCodedScaleOffsetFile, "#------------ -------------\n" );
    297      
     300
    298301      for( UInt voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )
    299302      {
     
    315318          {
    316319            if ( m_receivedIdc[baseVoiInVps][voiInVps] != 0 )
    317             {           
     320            {
    318321              fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n",
    319                 iS, iE, m_vps->getViewOIdxList( voiInVps ), m_vps->getViewOIdxList( baseVoiInVps ), 
    320                 m_aaiCodedScale [ baseVoiInVps ][ voiInVps ], 
     322                iS, iE, m_vps->getViewOIdxList( voiInVps ), m_vps->getViewOIdxList( baseVoiInVps ),
     323                m_aaiCodedScale [ baseVoiInVps ][ voiInVps ],
    321324                m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_vps->getCpPrecision() );
    322             }           
     325            }
    323326          }
    324327        }
     
    334337#if !NH_MV
    335338  , m_associatedIRAPType(NAL_UNIT_INVALID)
    336   , m_pocCRA(0) 
     339  , m_pocCRA(0)
    337340  , m_pocRandomAccess(MAX_INT)
    338341  , m_cListPic()
     
    426429    fclose( g_hTrace );
    427430  }
    428 #endif 
     431#endif
    429432#endif
    430433  while (!m_prefixSEINALUs.empty())
     
    465468#endif
    466469#if NH_MV
    467   m_cCavlcDecoder.setDecTop( this ); 
     470  m_cCavlcDecoder.setDecTop( this );
    468471#endif
    469472  m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
     
    653656#if NH_MV
    654657    const TComVPS* vps = m_parameterSetManager.getVPS(sps->getVPSId());
    655     assert (vps != 0); 
    656     // TBD: check the condition on m_firstPicInLayerDecodedFlag 
     658    assert (vps != 0);
     659    // TBD: check the condition on m_firstPicInLayerDecodedFlag
    657660    if (!m_parameterSetManager.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP() || !m_firstPicInLayerDecodedFlag[m_layerId] , m_layerId ) )
    658661#else
     
    671674      {
    672675        //, it is a requirement of bitstream conformance that the value of update_rep_format_flag shall be equal to 0.
    673         assert( sps->getUpdateRepFormatFlag() == false ); 
    674       }
    675       sps->checkRpsMaxNumPics( vps, getLayerId() ); 
    676 
    677       // It is a requirement of bitstream conformance that, when the SPS is referred to by 
    678       // any current picture that belongs to an independent non-base layer, the value of 
     676        assert( sps->getUpdateRepFormatFlag() == false );
     677      }
     678      sps->checkRpsMaxNumPics( vps, getLayerId() );
     679
     680      // It is a requirement of bitstream conformance that, when the SPS is referred to by
     681      // any current picture that belongs to an independent non-base layer, the value of
    679682      // MultiLayerExtSpsFlag derived from the SPS shall be equal to 0.
    680683
    681684      if ( m_layerId > 0 && vps->getNumRefLayers( m_layerId ) == 0 )
    682       { 
    683         assert( sps->getMultiLayerExtSpsFlag() == 0 );
    684       }
    685     }
     685      {
     686        assert( sps->getMultiLayerExtSpsFlag() == 0 );
     687      }
     688    }
     689#if NH_MV_SEI
     690    m_seiReader.setLayerId ( newPic->getLayerId      ( ) );
     691    m_seiReader.setDecOrder( newPic->getDecodingOrder( ) );
     692#endif
    686693#endif
    687694
     
    707714    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    708715#else
    709     m_pcPic = newPic; 
     716    m_pcPic = newPic;
    710717#endif
    711718
     
    723730#if NH_MV
    724731    pSlice->setPic( m_pcPic );
    725     vps=pSlice->getVPS(); 
     732    vps=pSlice->getVPS();
    726733    // The nuh_layer_id value of the NAL unit containing the PPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
    727     assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, pps->getLayerId() ) );   
     734    assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, pps->getLayerId() ) );
    728735    // The nuh_layer_id value of the NAL unit containing the SPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
    729736    assert( sps->getLayerId() == m_layerId || sps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, sps->getLayerId() ) );
     
    775782  {
    776783#if NH_MV
    777     assert( m_pcPic != NULL ); 
    778     assert( newPic  == NULL ); 
     784    assert( m_pcPic != NULL );
     785    assert( newPic  == NULL );
    779786#endif
    780787    // make the slice-pilot a real slice, and set up the slice-pilot for the next slice
     
    832839    InputNALUnit &nalu=*m_prefixSEINALUs.front();
    833840#if NH_MV
     841#if NH_MV_LAYERS_NOT_PRESENT_SEI
     842    m_seiReader.parseSEImessage(&(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(getLayerId()), m_pDecodedSEIOutputStream);
     843#else
    834844    m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
     845#endif
    835846#else
    836847    m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
     
    855866  m_cEntropyDecoder.setBitstream      (&(nalu.getBitstream()));
    856867
    857   assert( nalu.m_nuhLayerId == m_layerId );   
     868  assert( nalu.m_nuhLayerId == m_layerId );
    858869  m_apcSlicePilot->initSlice(); // the slice pilot is an object to prepare for a new slice
    859870  // it is not associated with picture, sps or pps structures.
    860   m_apcSlicePilot->setLayerId( nalu.m_nuhLayerId ); 
    861   m_cEntropyDecoder.decodeFirstSliceSegmentInPicFlag( m_apcSlicePilot );   
     871  m_apcSlicePilot->setLayerId( nalu.m_nuhLayerId );
     872  m_cEntropyDecoder.decodeFirstSliceSegmentInPicFlag( m_apcSlicePilot );
    862873  if ( m_apcSlicePilot->getFirstSliceSegementInPicFlag() )
    863874  {
    864 #endif 
     875#endif
    865876    m_uiSliceIdx = 0;
    866877  }
     
    908919  if (m_apcSlicePilot->getRapPicFlag())
    909920  {
    910       if ((m_apcSlicePilot->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_apcSlicePilot->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) || 
     921      if ((m_apcSlicePilot->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_apcSlicePilot->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) ||
    911922        (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence) ||
    912923        (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsBlaFlag()))
     
    924935    else
    925936    {
    926       m_apcSlicePilot->setNoOutputPriorPicsFlag(false); 
     937      m_apcSlicePilot->setNoOutputPriorPicsFlag(false);
    927938    }
    928939
     
    950961    }
    951962  }
    952  
     963
    953964  if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_craNoRaslOutputFlag) //Reset POC MSB when CRA has NoRaslOutputFlag equal to 1
    954965  {
     
    10441055  {
    10451056    //Check Multiview Main profile constraint in G.11.1.1
    1046     //  When ViewOrderIdx[ i ] derived according to any active VPS is equal to 1 
    1047     //  for the layer with nuh_layer_id equal to i in subBitstream, 
    1048     //  inter_view_mv_vert_constraint_flag shall be equal to 1 
     1057    //  When ViewOrderIdx[ i ] derived according to any active VPS is equal to 1
     1058    //  for the layer with nuh_layer_id equal to i in subBitstream,
     1059    //  inter_view_mv_vert_constraint_flag shall be equal to 1
    10491060    //  in the sps_multilayer_extension( ) syntax structure in each active SPS for that layer.
    10501061    if( pcSlice->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc()==Profile::MULTIVIEWMAIN
    10511062      &&
    1052       pcSlice->getVPS()->getViewOrderIdx(pcSlice->getVPS()->getLayerIdInNuh(getLayerId()))==1 
     1063      pcSlice->getVPS()->getViewOrderIdx(pcSlice->getVPS()->getLayerIdInNuh(getLayerId()))==1
    10531064      )
    10541065    {
     
    10611072    m_pcPic->setViewIndex( getViewIndex() );
    10621073    m_pcPic->setIsDepth  ( getIsDepth  () );
    1063     pcSlice->setIvPicLists( m_dpb );         
    1064 #endif
    1065 #endif
    1066    
     1074    pcSlice->setIvPicLists( m_dpb );
     1075#endif
     1076#endif
     1077
    10671078    // When decoding the slice header, the stored start and end addresses were actually RS addresses, not TS addresses.
    10681079    // Now, having set up the maps, convert them to the correct form.
     
    10971108        else
    10981109        {
    1099           assert( false ); 
     1110          assert( false );
    11001111        }
    11011112      }
     
    11041115#endif
    11051116#if NH_3D_ARP
    1106       pcSlice->setPocsInCurrRPSs(); 
     1117      pcSlice->setPocsInCurrRPSs();
    11071118      pcSlice->setARPStepNum(m_dpb);
    1108 #endif     
     1119#endif
    11091120#endif
    11101121
     
    11911202    if ( decProcAnnexI() )
    11921203    {
    1193       pcSlice->checkInCompPredRefLayers(); 
     1204      pcSlice->checkInCompPredRefLayers();
    11941205    }
    11951206#endif
     
    12301241  TComSPS* sps = new TComSPS();
    12311242#if NH_MV
    1232   sps->setLayerId( getLayerId() ); 
     1243  sps->setLayerId( getLayerId() );
    12331244#endif
    12341245#if O0043_BEST_EFFORT_DECODING
     
    12461257  TComPPS* pps = new TComPPS();
    12471258#if NH_MV
    1248   pps->setLayerId( getLayerId() ); 
     1259  pps->setLayerId( getLayerId() );
    12491260#endif
    12501261#if NH_3D_DLT
     
    13041315      {
    13051316#if NH_MV
    1306         m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
     1317#if NH_MV_LAYERS_NOT_PRESENT_SEI
     1318      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
    13071322#else
    13081323        m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
     
    13321347    case NAL_UNIT_CODED_SLICE_RASL_R:
    13331348#if NH_MV
    1334       assert( false ); 
    1335       return 1; 
     1349      assert( false );
     1350      return 1;
    13361351#else
    13371352      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
     
    15061521{
    15071522  //Output of this process is PicOrderCntVal, the picture order count of the current picture.
    1508   //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and 
     1523  //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and
    15091524  //  motion vector prediction and for decoder conformance checking (see clause F.13.5).
    15101525
     
    15131528  TComSlice* slice = m_apcSlicePilot;
    15141529  const Int nuhLayerId   = slice->getLayerId();
    1515   const TComVPS*   vps   = slice->getVPS(); 
    1516   const TComSPS*   sps   = slice->getSPS(); 
    1517 
    1518   Int pocDecrementedInDpbFlag = m_pocDecrementedInDpbFlag[ nuhLayerId ]; 
     1530  const TComVPS*   vps   = slice->getVPS();
     1531  const TComSPS*   sps   = slice->getSPS();
     1532
     1533  Int pocDecrementedInDpbFlag = m_pocDecrementedInDpbFlag[ nuhLayerId ];
    15191534
    15201535  if ( isFstPicOfAllLayOfPocResetPer )
    15211536  {
    1522     //  When the current picture is the first picture among all layers of a POC resetting period, 
     1537    //  When the current picture is the first picture among all layers of a POC resetting period,
    15231538    //  the variable PocDecrementedInDPBFlag[ i ] is set equal to 0 for each value of i in the range of 0 to 62, inclusive.
    1524     pocDecrementedInDpbFlag = false; 
     1539    pocDecrementedInDpbFlag = false;
    15251540  }
    15261541
    15271542  //  The variable pocResettingFlag is derived as follows:
    1528   Bool pocResettingFlag; 
     1543  Bool pocResettingFlag;
    15291544  if ( isPocResettingPicture )
    15301545  {
    1531     //-  If the current picture is a POC resetting picture, the following applies:   
     1546    //-  If the current picture is a POC resetting picture, the following applies:
    15321547    if( vps->getVpsPocLsbAlignedFlag()  )
    15331548    {
    15341549      //  -  If vps_poc_lsb_aligned_flag is equal to 0, pocResettingFlag is set equal to 1.
    1535       pocResettingFlag = true; 
     1550      pocResettingFlag = true;
    15361551    }
    15371552    else if ( pocDecrementedInDpbFlag )
    15381553    {
    15391554      //  -  Otherwise, if PocDecrementedInDPBFlag[ nuh_layer_id ] is equal to 1, pocResettingFlag is set equal to 0.
    1540       pocResettingFlag = false; 
     1555      pocResettingFlag = false;
    15411556    }
    15421557    else
    15431558    {
    15441559      //  -  Otherwise, pocResettingFlag is set equal to 1.
    1545       pocResettingFlag = true; 
     1560      pocResettingFlag = true;
    15461561    }
    15471562  }
     
    15491564  {
    15501565    //  -  Otherwise, pocResettingFlag is set equal to 0.
    1551     pocResettingFlag = false; 
    1552   }
    1553 
    1554   Int picOrderCntMsb; 
    1555   Int picOrderCntVal; 
     1566    pocResettingFlag = false;
     1567  }
     1568
     1569  Int picOrderCntMsb;
     1570  Int picOrderCntVal;
    15561571
    15571572  //  Depending on pocResettingFlag, the following applies:
     
    15611576    if( slice->getPocResetIdc()  ==  1 )
    15621577    {
    1563       picOrderCntVal = slice->getSlicePicOrderCntLsb(); 
    1564     }
    1565     else if (slice->getPocResetIdc()  ==  2 ) 
    1566     {
    1567       picOrderCntVal = 0; 
     1578      picOrderCntVal = slice->getSlicePicOrderCntLsb();
     1579    }
     1580    else if (slice->getPocResetIdc()  ==  2 )
     1581    {
     1582      picOrderCntVal = 0;
    15681583    }
    15691584    else
    15701585    {
    1571       picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() ); 
    1572       picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 
     1586      picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() );
     1587      picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb();
    15731588    }
    15741589  }
     
    15801595    if( slice->getPocMsbCycleValPresentFlag() )
    15811596    {
    1582       picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb(); 
     1597      picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb();
    15831598    }
    15841599    else if( !firstPicInLayerDecodedFlag  ||
     
    15861601    {
    15871602      picOrderCntMsb = 0; //     (F 62)
    1588     }   
     1603    }
    15891604    else
    15901605    {
    15911606      Int prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 );
    1592       Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb; 
    1593       picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() ); 
    1594     }
    1595     picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 
    1596   } 
     1607      Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb;
     1608      picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() );
     1609    }
     1610    picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb();
     1611  }
    15971612  return picOrderCntVal;
    15981613}
     
    16071622    if ( m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] != MIN_INT )
    16081623    {
    1609       // - If the previous picture picA that has poc_reset_period_id present in the slice segment header is present in the same layer 
    1610       //   of the bitstream as the current picture, the value of poc_reset_period_id is inferred to be equal to the value of the 
     1624      // - If the previous picture picA that has poc_reset_period_id present in the slice segment header is present in the same layer
     1625      //   of the bitstream as the current picture, the value of poc_reset_period_id is inferred to be equal to the value of the
    16111626      //   poc_reset_period_id of picA.
    16121627
    1613       m_apcSlicePilot->setPocResetPeriodId( m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] ); 
     1628      m_apcSlicePilot->setPocResetPeriodId( m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] );
    16141629    }
    16151630    else
    16161631    {
    16171632      //- Otherwise, the value of poc_reset_period_id is inferred to be equal to 0.
    1618       m_apcSlicePilot->setPocResetPeriodId( 0 ); 
     1633      m_apcSlicePilot->setPocResetPeriodId( 0 );
    16191634    }
    16201635  }
    16211636  else
    16221637  {
    1623     m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] = m_apcSlicePilot->getPocResetPeriodId(); 
     1638    m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] = m_apcSlicePilot->getPocResetPeriodId();
    16241639  }
    16251640}
     
    16271642
    16281643Void TDecTop::decodePocAndRps( )
    1629 { 
     1644{
    16301645  assert( m_uiSliceIdx == 0 );
    16311646  Int nuhLayerId = m_pcPic->getLayerId();
     
    16341649    // 8.1.3 Decoding process for a coded picture with nuh_layer_id equal to 0
    16351650
    1636     // Variables and functions relating to picture order count are derived as 
    1637     // specified in clause 8.3.1. This needs to be invoked only for the first slice 
     1651    // Variables and functions relating to picture order count are derived as
     1652    // specified in clause 8.3.1. This needs to be invoked only for the first slice
    16381653    // segment of a picture.
    16391654    x831DecProcForPicOrderCount( );
    16401655
    1641     // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference 
    1642     // pictures may be marked as "unused for reference" or "used for long-term 
    1643     // reference". This needs to be invoked only for the first slice segment of a 
     1656    // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference
     1657    // pictures may be marked as "unused for reference" or "used for long-term
     1658    // reference". This needs to be invoked only for the first slice segment of a
    16441659    // picture.
    16451660    x832DecProcForRefPicSet    (  false );
     
    16541669      // --> Clause 8.1.3 is invoked with replacments of 8.3.1, 8.3.2, and 8.3.3 by F.8.3.1, 8.3.2, and 8.3.3
    16551670
    1656       // Variables and functions relating to picture order count are derived as 
    1657       // specified in clause 8.3.1. This needs to be invoked only for the first slice 
     1671      // Variables and functions relating to picture order count are derived as
     1672      // specified in clause 8.3.1. This needs to be invoked only for the first slice
    16581673      // segment of a picture.
    16591674      xF831DecProcForPicOrderCount( );
    16601675
    1661       // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference 
    1662       // pictures may be marked as "unused for reference" or "used for long-term 
    1663       // reference". This needs to be invoked only for the first slice segment of a 
     1676      // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference
     1677      // pictures may be marked as "unused for reference" or "used for long-term
     1678      // reference". This needs to be invoked only for the first slice segment of a
    16641679      // picture.
    16651680      xF832DecProcForRefPicSet( );
     
    16701685      // nuh_layer_id greater than 0
    16711686
    1672       // Variables and functions relating to picture order count are derived in clause F.8.3.1. 
    1673       // This needs to be invoked only for the first slice segment of a picture. It is a requirement 
    1674       // of bitstream conformance that PicOrderCntVal of each picture in an access unit shall have the 
     1687      // Variables and functions relating to picture order count are derived in clause F.8.3.1.
     1688      // This needs to be invoked only for the first slice segment of a picture. It is a requirement
     1689      // of bitstream conformance that PicOrderCntVal of each picture in an access unit shall have the
    16751690      // same value during and at the end of decoding of the access unit
    16761691      xF831DecProcForPicOrderCount( );
    16771692
    1678       // The decoding process for RPS in clause F.8.3.2 is invoked, wherein only reference pictures with 
    1679       // nuh_layer_id equal to that of CurrPic may be marked as "unused for reference" or "used for 
    1680       // long-term reference" and any picture with a different value of nuh_layer_id is not marked. 
     1693      // The decoding process for RPS in clause F.8.3.2 is invoked, wherein only reference pictures with
     1694      // nuh_layer_id equal to that of CurrPic may be marked as "unused for reference" or "used for
     1695      // long-term reference" and any picture with a different value of nuh_layer_id is not marked.
    16811696      // This needs to be invoked only for the first slice segment of a picture.
    16821697      xF832DecProcForRefPicSet( );
     
    16851700  else
    16861701  {
    1687     assert( false ); 
     1702    assert( false );
    16881703  }
    16891704}
    16901705
    16911706Void TDecTop::genUnavailableRefPics( )
    1692 { 
     1707{
    16931708  assert( m_uiSliceIdx == 0 );
    16941709  Int nuhLayerId = m_pcPic->getLayerId();
     
    16991714    if ( m_pcPic->isBla() || ( m_pcPic->isCra() && m_pcPic->getNoRaslOutputFlag() ) )
    17001715    {
    1701       // When the current picture is a BLA picture or is a CRA picture 
    1702       // with NoRaslOutputFlag equal to 1, the decoding process for generating 
    1703       // unavailable reference pictures specified in clause 8.3.3 is invoked, 
     1716      // When the current picture is a BLA picture or is a CRA picture
     1717      // with NoRaslOutputFlag equal to 1, the decoding process for generating
     1718      // unavailable reference pictures specified in clause 8.3.3 is invoked,
    17041719      // which needs to be invoked only for the first slice segment of a picture.
    1705       x8331GenDecProcForGenUnavilRefPics();       
     1720      x8331GenDecProcForGenUnavilRefPics();
    17061721    }
    17071722  }
     
    17171732      if ( m_pcPic->isBla() || ( m_pcPic->isCra() && m_pcPic->getNoRaslOutputFlag() ) )
    17181733      {
    1719         // When the current picture is a BLA picture or is a CRA picture 
    1720         // with NoRaslOutputFlag equal to 1, the decoding process for generating 
    1721         // unavailable reference pictures specified in clause 8.3.3 is invoked, 
     1734        // When the current picture is a BLA picture or is a CRA picture
     1735        // with NoRaslOutputFlag equal to 1, the decoding process for generating
     1736        // unavailable reference pictures specified in clause 8.3.3 is invoked,
    17221737        // which needs to be invoked only for the first slice segment of a picture.
    1723         xF833DecProcForGenUnavRefPics(); 
     1738        xF833DecProcForGenUnavRefPics();
    17241739      }
    17251740#if NH_MV_FIX_INIT_NUM_ACTIVE_REF_LAYER_PICS
    1726       TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
     1741      TComDecodedRps* decRps = m_pcPic->getDecodedRps();
    17271742      decRps->m_numActiveRefLayerPics0 = 0;
    1728       decRps->m_numActiveRefLayerPics1 = 0;     
     1743      decRps->m_numActiveRefLayerPics1 = 0;
    17291744#endif
    17301745    }
     
    17361751      if ( !m_firstPicInLayerDecodedFlag[ nuhLayerId ] )
    17371752      {
    1738         // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 0, the decoding process for generating 
    1739         // unavailable reference pictures for pictures first in decoding order within a layer specified in 
     1753        // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 0, the decoding process for generating
     1754        // unavailable reference pictures for pictures first in decoding order within a layer specified in
    17401755        // clause F.8.1.7 is invoked, which needs to be invoked only for the first slice segment of a picture.
    17411756        xF817DecProcForGenUnavRefPicForPicsFrstInDecOrderInLay();
     
    17441759      if ( m_firstPicInLayerDecodedFlag[ nuhLayerId ] && ( m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() ) )
    17451760      {
    1746         // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 1 and the current picture is an IRAP 
    1747         // picture with NoRaslOutputFlag equal to 1, the decoding process for generating unavailable reference 
    1748         // pictures specified in clause F.8.3.3 is invoked, which needs to be invoked only for the first slice 
     1761        // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 1 and the current picture is an IRAP
     1762        // picture with NoRaslOutputFlag equal to 1, the decoding process for generating unavailable reference
     1763        // pictures specified in clause F.8.3.3 is invoked, which needs to be invoked only for the first slice
    17491764        // segment of a picture.
    1750         xF833DecProcForGenUnavRefPics(); 
     1765        xF833DecProcForGenUnavRefPics();
    17511766      }
    17521767
     
    17601775  else
    17611776  {
    1762     assert( false ); 
    1763   }
    1764 
    1765   xCheckUnavailableRefPics();     
     1777    assert( false );
     1778  }
     1779
     1780  xCheckUnavailableRefPics();
    17661781}
    17671782Void TDecTop::executeLoopFilters( )
    17681783{
    1769   assert( m_pcPic != NULL ); 
     1784  assert( m_pcPic != NULL );
    17701785  if ( !m_pcPic->getHasGeneratedRefPics() && !m_pcPic->getIsGenerated() )
    17711786  {
     
    17791794  if( m_pcPic->isIrap() )
    17801795  {
    1781     m_prevIrapPoc           = m_pcPic->getPOC(); 
    1782     m_prevIrapDecodingOrder = m_pcPic->getDecodingOrder(); 
     1796    m_prevIrapPoc           = m_pcPic->getPOC();
     1797    m_prevIrapDecodingOrder = m_pcPic->getDecodingOrder();
    17831798  }
    17841799  if( m_pcPic->isStsa() )
     
    17911806
    17921807Void TDecTop::initFromActiveVps( const TComVPS* vps )
    1793 {   
    1794   setViewId   ( vps->getViewId   ( getLayerId() )      ); 
     1808{
     1809  setViewId   ( vps->getViewId   ( getLayerId() )      );
    17951810#if NH_3D
    1796   setViewIndex( vps->getViewIndex( getLayerId() )      ); 
    1797   setIsDepth  ( vps->getDepthId  ( getLayerId() ) == 1 ); 
     1811  setViewIndex( vps->getViewIndex( getLayerId() )      );
     1812  setIsDepth  ( vps->getDepthId  ( getLayerId() ) == 1 );
    17981813#endif
    17991814
    18001815  if ( !vps->getVpsExtensionFlag() )
    18011816  {
    1802     m_decodingProcess = CLAUSE_8; 
     1817    m_decodingProcess = CLAUSE_8;
    18031818    m_isInOwnTargetDecLayerIdList = ( getLayerId() ==  0 );
    18041819  }
    18051820  else
    1806   { 
     1821  {
    18071822    if ( m_targetOlsIdx == -1 )
    18081823    {
    1809       // Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. ) 
    1810       m_targetOlsIdx = vps->getVpsNumLayerSetsMinus1(); 
    1811     }
    1812 
    1813     Int targetDecLayerSetIdx = vps->olsIdxToLsIdx( m_targetOlsIdx ); 
     1824      // Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. )
     1825      m_targetOlsIdx = vps->getVpsNumLayerSetsMinus1();
     1826    }
     1827
     1828    Int targetDecLayerSetIdx = vps->olsIdxToLsIdx( m_targetOlsIdx );
    18141829
    18151830    if ( targetDecLayerSetIdx <= vps->getVpsNumLayerSetsMinus1() && vps->getVpsBaseLayerInternalFlag() )
    18161831    {
    1817       m_smallestLayerId = 0; 
     1832      m_smallestLayerId = 0;
    18181833    }
    18191834    else if ( targetDecLayerSetIdx <= vps->getVpsNumLayerSetsMinus1() && !vps->getVpsBaseLayerInternalFlag() )
    18201835    {
    1821       m_smallestLayerId = 0; 
     1836      m_smallestLayerId = 0;
    18221837    }
    18231838    else if ( targetDecLayerSetIdx > vps->getVpsNumLayerSetsMinus1() && vps->getNumLayersInIdList( targetDecLayerSetIdx) == 1 )
    18241839    {
    1825      
    1826       // m_smallestLayerId = 0;       
    1827       // For now don't do change of layer id here. 
    1828       m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ];   
     1840
     1841      // m_smallestLayerId = 0;
     1842      // For now don't do change of layer id here.
     1843      m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ];
    18291844    }
    18301845    else
    18311846    {
    1832       m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ];   
     1847      m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ];
    18331848    }
    18341849
     
    18361851    // Set profile
    18371852    Int lsIdx = vps->olsIdxToLsIdx( m_targetOlsIdx );
    1838     Int lIdx = -1; 
     1853    Int lIdx = -1;
    18391854    for (Int j = 0; j < vps->getNumLayersInIdList( lsIdx ) ; j++ )
    18401855    {
    18411856      if ( vps->getLayerSetLayerIdList( lsIdx, j ) == getLayerId() )
    1842       {       
    1843         lIdx = j;         
    1844         break; 
    1845       }       
    1846     }
    1847     m_isInOwnTargetDecLayerIdList = (lIdx != -1); 
     1857      {
     1858        lIdx = j;
     1859        break;
     1860      }
     1861    }
     1862    m_isInOwnTargetDecLayerIdList = (lIdx != -1);
    18481863
    18491864    if ( m_isInOwnTargetDecLayerIdList )
    18501865    {
    18511866      Int profileIdc = vps->getPTL( vps->getProfileTierLevelIdx( m_targetOlsIdx, lIdx ) )->getGeneralPTL()->getProfileIdc();
    1852       assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 ); 
     1867      assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 );
    18531868
    18541869      if (  profileIdc == 6 )
     
    18811896
    18821897  //  Output of this process is PicOrderCntVal, the picture order count of the current picture.
    1883   //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and 
     1898  //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and
    18841899  //  motion vector prediction, and for decoder conformance checking (see clause C.5).
    18851900  //  Each coded picture is associated with a picture order count variable, denoted as PicOrderCntVal.
    18861901
    1887   const TComSlice* curSlice = m_pcPic->getSlice(0); 
    1888 
    1889   Int prevPicOrderCntLsb = MIN_INT; 
    1890   Int prevPicOrderCntMsb = MIN_INT; 
    1891   if (!(m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() )  ) 
    1892   {
    1893     //  When the current picture is not an IRAP picture with NoRaslOutputFlag equal to 1, 
     1902  const TComSlice* curSlice = m_pcPic->getSlice(0);
     1903
     1904  Int prevPicOrderCntLsb = MIN_INT;
     1905  Int prevPicOrderCntMsb = MIN_INT;
     1906  if (!(m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() )  )
     1907  {
     1908    //  When the current picture is not an IRAP picture with NoRaslOutputFlag equal to 1,
    18941909    //  the variables prevPicOrderCntLsb and prevPicOrderCntMsb are derived as follows:
    18951910
    1896     //  -  Let prevTid0Pic be the previous picture in decoding order that has TemporalId equal to 0 and that is not a RASL picture, 
     1911    //  -  Let prevTid0Pic be the previous picture in decoding order that has TemporalId equal to 0 and that is not a RASL picture,
    18971912    //     a RADL picture or an SLNR picture.
    18981913
    18991914    //  -  The variable prevPicOrderCntLsb is set equal to slice_pic_order_cnt_lsb of prevTid0Pic.
    1900     prevPicOrderCntLsb = m_prevTid0PicSlicePicOrderCntLsb; 
     1915    prevPicOrderCntLsb = m_prevTid0PicSlicePicOrderCntLsb;
    19011916
    19021917    //  -  The variable prevPicOrderCntMsb is set equal to PicOrderCntMsb of prevTid0Pic.
    1903     prevPicOrderCntMsb = m_prevTid0PicPicOrderCntMsb; 
    1904   }
    1905 
    1906   //  The variable PicOrderCntMsb of the current picture is derived as follows: 
    1907  
     1918    prevPicOrderCntMsb = m_prevTid0PicPicOrderCntMsb;
     1919  }
     1920
     1921  //  The variable PicOrderCntMsb of the current picture is derived as follows:
     1922
    19081923  Int slicePicOrderCntLsb = curSlice->getSlicePicOrderCntLsb();
    19091924
    1910   Int picOrderCntMsb; 
     1925  Int picOrderCntMsb;
    19111926
    19121927  if (m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag()  )
    19131928  {
    19141929    //-  If the current picture is an IRAP picture with NoRaslOutputFlag equal to 1, PicOrderCntMsb is set equal to 0.
    1915     picOrderCntMsb = 0; 
     1930    picOrderCntMsb = 0;
    19161931  }
    19171932  else
    19181933  {
    1919     Int maxPicOrderCntLsb   = curSlice->getSPS()->getMaxPicOrderCntLsb(); 
     1934    Int maxPicOrderCntLsb   = curSlice->getSPS()->getMaxPicOrderCntLsb();
    19201935
    19211936  //  -  Otherwise, PicOrderCntMsb is derived as follows:
     
    19331948    else
    19341949    {
    1935       picOrderCntMsb = prevPicOrderCntMsb; 
    1936     }
    1937   }
    1938  
     1950      picOrderCntMsb = prevPicOrderCntMsb;
     1951    }
     1952  }
     1953
    19391954  //PicOrderCntVal is derived as follows:
    19401955  Int picOrderCntVal = picOrderCntMsb + slicePicOrderCntLsb; //   (8 2)
    19411956
    1942   //  NOTE 1 - All IDR pictures will have PicOrderCntVal equal to 0 since slice_pic_order_cnt_lsb is inferred to be 0 for IDR 
     1957  //  NOTE 1 - All IDR pictures will have PicOrderCntVal equal to 0 since slice_pic_order_cnt_lsb is inferred to be 0 for IDR
    19431958  //  pictures and prevPicOrderCntLsb and prevPicOrderCntMsb are both set equal to 0.
    19441959
    1945   m_pcPic->getSlice(0)->setPOC( picOrderCntVal ); 
     1960  m_pcPic->getSlice(0)->setPOC( picOrderCntVal );
    19461961
    19471962  // Update prevTid0Pic
     
    19491964  if( curSlice->getTemporalId() == 0  && !m_pcPic->isRasl() && !m_pcPic->isRadl() && !m_pcPic->isSlnr() )
    19501965  {
    1951     m_prevTid0PicSlicePicOrderCntLsb = slicePicOrderCntLsb;     
    1952     m_prevTid0PicPicOrderCntMsb      = picOrderCntMsb; 
     1966    m_prevTid0PicSlicePicOrderCntLsb = slicePicOrderCntLsb;
     1967    m_prevTid0PicPicOrderCntMsb      = picOrderCntMsb;
    19531968  }
    19541969}
     
    19571972{
    19581973  //Output of this process is PicOrderCntVal, the picture order count of the current picture.
    1959   //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and 
     1974  //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and
    19601975  //  motion vector prediction and for decoder conformance checking (see clause F.13.5).
    19611976
    19621977  //  Each coded picture is associated with a picture order count variable, denoted as PicOrderCntVal.
    19631978
    1964   const TComSlice* slice = m_pcPic->getSlice(0); 
    1965   const Int nuhLayerId   = m_pcPic->getLayerId(); 
    1966   const TComVPS*   vps   = slice->getVPS(); 
    1967   const TComSPS*   sps   = slice->getSPS(); 
     1979  const TComSlice* slice = m_pcPic->getSlice(0);
     1980  const Int nuhLayerId   = m_pcPic->getLayerId();
     1981  const TComVPS*   vps   = slice->getVPS();
     1982  const TComSPS*   sps   = slice->getSPS();
    19681983  if ( m_pcPic->getIsFstPicOfAllLayOfPocResetPer() )
    19691984  {
    1970     //  When the current picture is the first picture among all layers of a POC resetting period, 
     1985    //  When the current picture is the first picture among all layers of a POC resetting period,
    19711986    //  the variable PocDecrementedInDPBFlag[ i ] is set equal to 0 for each value of i in the range of 0 to 62, inclusive.
    19721987    for (Int i = 0; i <= 62; i++)
    19731988    {
    1974       m_pocDecrementedInDpbFlag[ i ] = 0; 
     1989      m_pocDecrementedInDpbFlag[ i ] = 0;
    19751990    }
    19761991  }
    19771992
    19781993  //  The variable pocResettingFlag is derived as follows:
    1979   Bool pocResettingFlag; 
     1994  Bool pocResettingFlag;
    19801995  if (m_pcPic->getIsPocResettingPic() )
    19811996  {
    1982     //-  If the current picture is a POC resetting picture, the following applies:   
     1997    //-  If the current picture is a POC resetting picture, the following applies:
    19831998    if( vps->getVpsPocLsbAlignedFlag()  )
    19841999    {
    19852000      //  -  If vps_poc_lsb_aligned_flag is equal to 0, pocResettingFlag is set equal to 1.
    1986       pocResettingFlag = true; 
     2001      pocResettingFlag = true;
    19872002    }
    19882003    else if ( m_pocDecrementedInDpbFlag[ nuhLayerId ] )
    19892004    {
    19902005      //  -  Otherwise, if PocDecrementedInDPBFlag[ nuh_layer_id ] is equal to 1, pocResettingFlag is set equal to 0.
    1991       pocResettingFlag = false; 
     2006      pocResettingFlag = false;
    19922007    }
    19932008    else
    19942009    {
    19952010      //  -  Otherwise, pocResettingFlag is set equal to 1.
    1996       pocResettingFlag = true; 
     2011      pocResettingFlag = true;
    19972012    }
    19982013  }
     
    20002015  {
    20012016    //  -  Otherwise, pocResettingFlag is set equal to 0.
    2002     pocResettingFlag = false; 
     2017    pocResettingFlag = false;
    20032018  }
    20042019
    20052020  //  The list affectedLayerList is derived as follows:
    2006   std::vector<Int> affectedLayerList; 
     2021  std::vector<Int> affectedLayerList;
    20072022  if (! vps->getVpsPocLsbAlignedFlag() )
    20082023  {
    20092024    //-  If vps_poc_lsb_aligned_flag is equal to 0, affectedLayerList consists of the nuh_layer_id of the current picture.
    2010     affectedLayerList.push_back( nuhLayerId ); 
     2025    affectedLayerList.push_back( nuhLayerId );
    20112026  }
    20122027  else
    20132028  {
    2014     //  -  Otherwise, affectedLayerList consists of the nuh_layer_id of the current picture and the nuh_layer_id values 
    2015     //     equal to IdPredictedLayer[ currNuhLayerId ][ j ] for all values of j in the range of 0 to NumPredictedLayers[ currNuhLayerId ] - 1, 
     2029    //  -  Otherwise, affectedLayerList consists of the nuh_layer_id of the current picture and the nuh_layer_id values
     2030    //     equal to IdPredictedLayer[ currNuhLayerId ][ j ] for all values of j in the range of 0 to NumPredictedLayers[ currNuhLayerId ] - 1,
    20162031    //     inclusive, where currNuhLayerId is the nuh_layer_id value of the current picture.
    2017     affectedLayerList.push_back( nuhLayerId ); 
    2018     Int currNuhLayerId = nuhLayerId; 
     2032    affectedLayerList.push_back( nuhLayerId );
     2033    Int currNuhLayerId = nuhLayerId;
    20192034    for (Int j = 0; j <= vps->getNumPredictedLayers( currNuhLayerId )-1; j++ )
    20202035    {
     
    20222037    }
    20232038  }
    2024  
    2025   Int picOrderCntMsb; 
    2026   Int picOrderCntVal; 
     2039
     2040  Int picOrderCntMsb;
     2041  Int picOrderCntVal;
    20272042
    20282043  //  Depending on pocResettingFlag, the following applies:
     
    20332048    {
    20342049      //-  The variables pocMsbDelta, pocLsbDelta and DeltaPocVal are derived as follows:
    2035       Int pocMsbDelta; 
    2036       Int pocLsbDelta; 
    2037       Int deltaPocVal;       
    2038 
    2039       {
    2040         Int pocLsbVal; 
    2041         Int prevPicOrderCntLsb; 
    2042         Int prevPicOrderCntMsb; 
     2050      Int pocMsbDelta;
     2051      Int pocLsbDelta;
     2052      Int deltaPocVal;
     2053
     2054      {
     2055        Int pocLsbVal;
     2056        Int prevPicOrderCntLsb;
     2057        Int prevPicOrderCntMsb;
    20432058
    20442059        if( slice->getPocResetIdc() ==  3 )
    20452060        {
    2046           pocLsbVal = slice->getPocLsbVal(); 
    2047         }     
     2061          pocLsbVal = slice->getPocLsbVal();
     2062        }
    20482063        else
    20492064        {
    2050           pocLsbVal = slice->getSlicePicOrderCntLsb(); 
     2065          pocLsbVal = slice->getSlicePicOrderCntLsb();
    20512066        }
    20522067
     
    20542069        {
    20552070          pocMsbDelta = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb();   // (F 60)
    2056         }     
    2057         else
    2058         {
    2059           prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 );
    2060           prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb;
    2061 
    2062           pocMsbDelta = xGetCurrMsb( pocLsbVal, prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() );
    2063         }
    2064 
    2065         if( slice->getPocResetIdc() == 2 ||  ( slice->getPocResetIdc() == 3  &&  slice->getFullPocResetFlag() ) )
    2066         {
    2067           pocLsbDelta = pocLsbVal;
    20682071        }
    20692072        else
    20702073        {
    2071           pocLsbDelta = 0;
     2074          prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 );
     2075          prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb;
     2076
     2077          pocMsbDelta = xGetCurrMsb( pocLsbVal, prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() );
    20722078        }
    2073         deltaPocVal = pocMsbDelta + pocLsbDelta;
    2074       }
    2075 
    2076       //-  The PicOrderCntVal of each picture that has nuh_layer_id value nuhLayerId for which PocDecrementedInDPBFlag[ nuhLayerId ] is equal to 0
     2079
     2080        if( slice->getPocResetIdc() == 2 ||  ( slice->getPocResetIdc() == 3  &&  slice->getFullPocResetFlag() ) )
     2081        {
     2082          pocLsbDelta = pocLsbVal;
     2083        }
     2084        else
     2085        {
     2086          pocLsbDelta = 0;
     2087        }
     2088        deltaPocVal = pocMsbDelta + pocLsbDelta;
     2089      }
     2090
     2091      //-  The PicOrderCntVal of each picture that has nuh_layer_id value nuhLayerId for which PocDecrementedInDPBFlag[ nuhLayerId ] is equal to 0
    20772092      //   and that is equal to any value in affectedLayerList is decremented by DeltaPocVal.
    20782093      for (Int i = 0; i < (Int) affectedLayerList.size(); i++ )
     
    20802095        if ( !m_pocDecrementedInDpbFlag[ affectedLayerList[i] ] )
    20812096        {
    2082           m_dpb->decrementPocsInSubDpb( affectedLayerList[i], deltaPocVal ); 
     2097          m_dpb->decrementPocsInSubDpb( affectedLayerList[i], deltaPocVal );
    20832098        }
    20842099      }
     
    20872102      for (Int i = 0; i < (Int) affectedLayerList.size(); i++ )
    20882103      {
    2089         m_pocDecrementedInDpbFlag[ affectedLayerList[i] ] = true; 
    2090       }
    2091     } 
     2104        m_pocDecrementedInDpbFlag[ affectedLayerList[i] ] = true;
     2105      }
     2106    }
    20922107
    20932108    //-  The PicOrderCntVal of the current picture is derived as follows:
    20942109    if( slice->getPocResetIdc()  ==  1 )
    20952110    {
    2096       picOrderCntVal = slice->getSlicePicOrderCntLsb(); 
    2097     }
    2098     else if (slice->getPocResetIdc()  ==  2 ) 
    2099     {
    2100       picOrderCntVal = 0; 
     2111      picOrderCntVal = slice->getSlicePicOrderCntLsb();
     2112    }
     2113    else if (slice->getPocResetIdc()  ==  2 )
     2114    {
     2115      picOrderCntVal = 0;
    21012116    }
    21022117    else
    21032118    {
    2104        picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() ); 
    2105        picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 
     2119       picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() );
     2120       picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb();
    21062121    }
    21072122  }
     
    21102125    //-  Otherwise (pocResettingFlag is equal to 0), the following applies:
    21112126    //-  The PicOrderCntVal of the current picture is derived as follows:
    2112    
     2127
    21132128    if( slice->getPocMsbCycleValPresentFlag() )
    21142129    {
    2115       picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb(); 
     2130      picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb();
    21162131    }
    21172132    else if( !m_firstPicInLayerDecodedFlag[ nuhLayerId ]  ||
     
    21192134    {
    21202135      picOrderCntMsb = 0; //     (F 62)
    2121     }   
     2136    }
    21222137    else
    21232138    {
    21242139        Int prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 );
    2125         Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb; 
    2126         picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() ); 
    2127     }
    2128     picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 
    2129   }
    2130  
    2131   m_pcPic->getSlice(0)->setPOC( picOrderCntVal ); 
    2132  
     2140        Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb;
     2141        picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() );
     2142    }
     2143    picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb();
     2144  }
     2145
     2146  m_pcPic->getSlice(0)->setPOC( picOrderCntVal );
     2147
    21332148  for (Int lId = 0; lId < (Int) affectedLayerList.size(); lId++ )
    2134   { 
     2149  {
    21352150    //  The value of PrevPicOrderCnt[ lId ] for each of the lId values included in affectedLayerList is derived as follows:
    21362151
    21372152    if (!m_pcPic->isRasl() && !m_pcPic->isRadl() && !m_pcPic->isSlnr() && slice->getTemporalId() == 0 && !slice->getDiscardableFlag() )
    21382153    {
    2139       //-  If the current picture is not a RASL picture, a RADL picture or a sub-layer non-reference picture, and the current picture 
     2154      //-  If the current picture is not a RASL picture, a RADL picture or a sub-layer non-reference picture, and the current picture
    21402155      //   has TemporalId equal to 0 and discardable_flag equal to 0, PrevPicOrderCnt[ lId ] is set equal to PicOrderCntVal.
    2141       m_prevPicOrderCnt = picOrderCntVal; 
     2156      m_prevPicOrderCnt = picOrderCntVal;
    21422157    }
    21432158    else if ( slice->getPocResetIdc() == 3 &&  (
    2144       ( !m_firstPicInLayerDecodedFlag[ nuhLayerId ]) || 
    2145       ( m_firstPicInLayerDecodedFlag[ nuhLayerId ] && m_pcPic->getIsPocResettingPic() ) 
     2159      ( !m_firstPicInLayerDecodedFlag[ nuhLayerId ]) ||
     2160      ( m_firstPicInLayerDecodedFlag[ nuhLayerId ] && m_pcPic->getIsPocResettingPic() )
    21462161      ) )
    21472162    {
     
    21492164      //     -  FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 0.
    21502165      //     -  FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 1 and the current picture is a POC resetting picture.
    2151       m_prevPicOrderCnt = ( slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal() ); 
     2166      m_prevPicOrderCnt = ( slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal() );
    21522167    }
    21532168  }
     
    21562171Int TDecTop::xGetCurrMsb( Int cl, Int pl, Int pm, Int ml )
    21572172{
    2158   Int currMsb; 
     2173  Int currMsb;
    21592174  if ((pl - cl) >= (ml/ 2))
    21602175  {
     
    21632178  else if ( (cl - pl) > (ml / 2))
    21642179  {
    2165     currMsb = pm - ml; 
     2180    currMsb = pm - ml;
    21662181  }
    21672182  else
    21682183  {
    2169     currMsb = pm; 
    2170   }
    2171 
    2172   return currMsb; 
    2173 }   
     2184    currMsb = pm;
     2185  }
     2186
     2187  return currMsb;
     2188}
    21742189
    21752190
     
    21812196  ///////////////////////////////////////////////////////////////////////////////////////
    21822197
    2183   TComSlice* slice = m_pcPic->getSlice( 0 ); 
    2184   const TComSPS* sps = slice->getSPS(); 
    2185   //  This process is invoked once per picture, after decoding of a slice header but prior to the decoding of any coding unit and prior 
    2186   //  to the decoding process for reference picture list construction for the slice as specified in clause 8.3.3. 
    2187   //  This process may result in one or more reference pictures in the DPB being marked as "unused for reference" or 
     2198  TComSlice* slice = m_pcPic->getSlice( 0 );
     2199  const TComSPS* sps = slice->getSPS();
     2200  //  This process is invoked once per picture, after decoding of a slice header but prior to the decoding of any coding unit and prior
     2201  //  to the decoding process for reference picture list construction for the slice as specified in clause 8.3.3.
     2202  //  This process may result in one or more reference pictures in the DPB being marked as "unused for reference" or
    21882203  //  "used for long-term reference".
    21892204
    21902205  // The variable currPicLayerId is set equal to nuh_layer_id of the current picture.
    2191   Int currPicLayerId = m_pcPic->getLayerId(); 
    2192   Int picOrderCntVal = m_pcPic->getPOC(); 
     2206  Int currPicLayerId = m_pcPic->getLayerId();
     2207  Int picOrderCntVal = m_pcPic->getPOC();
    21932208
    21942209  if (m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag()  )
    2195   {     
    2196     // When the current picture is an IRAP picture with NoRaslOutputFlag equal to 1, 
    2197     // all reference pictures with nuh_layer_id equal to currPicLayerId currently in the 
     2210  {
     2211    // When the current picture is an IRAP picture with NoRaslOutputFlag equal to 1,
     2212    // all reference pictures with nuh_layer_id equal to currPicLayerId currently in the
    21982213    // DPB (if any) are marked as "unused for reference".
    2199     m_dpb->markSubDpbAsUnusedForReference( currPicLayerId ); 
    2200   }
    2201   // Short-term reference pictures are identified by their PicOrderCntVal values. Long-term reference pictures are identified either by 
     2214    m_dpb->markSubDpbAsUnusedForReference( currPicLayerId );
     2215  }
     2216  // Short-term reference pictures are identified by their PicOrderCntVal values. Long-term reference pictures are identified either by
    22022217  // their PicOrderCntVal values or their slice_pic_order_cnt_lsb values.
    22032218
    2204   // Five lists of picture order count values are constructed to derive the RPS. These five lists are PocStCurrBefore, 
    2205   // PocStCurrAfter, PocStFoll, PocLtCurr and PocLtFoll, with NumPocStCurrBefore, NumPocStCurrAfter, NumPocStFoll, 
     2219  // Five lists of picture order count values are constructed to derive the RPS. These five lists are PocStCurrBefore,
     2220  // PocStCurrAfter, PocStFoll, PocLtCurr and PocLtFoll, with NumPocStCurrBefore, NumPocStCurrAfter, NumPocStFoll,
    22062221  // NumPocLtCurr and NumPocLtFoll number of elements, respectively. The five lists and the five variables are derived as follows:
    2207  
    2208   TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
     2222
     2223  TComDecodedRps* decRps = m_pcPic->getDecodedRps();
    22092224
    22102225  std::vector<Int>& pocStCurrBefore = decRps->m_pocStCurrBefore;
     
    22142229  std::vector<Int>& pocLtFoll       = decRps->m_pocLtFoll;
    22152230
    2216   Int& numPocStCurrBefore = decRps->m_numPocStCurrBefore; 
     2231  Int& numPocStCurrBefore = decRps->m_numPocStCurrBefore;
    22172232  Int& numPocStCurrAfter  = decRps->m_numPocStCurrAfter;
    22182233  Int& numPocStFoll       = decRps->m_numPocStFoll;
    22192234  Int& numPocLtCurr       = decRps->m_numPocLtCurr;
    2220   Int& numPocLtFoll       = decRps->m_numPocLtFoll;   
    2221 
    2222   std::vector<Int> currDeltaPocMsbPresentFlag, follDeltaPocMsbPresentFlag; 
     2235  Int& numPocLtFoll       = decRps->m_numPocLtFoll;
     2236
     2237  std::vector<Int> currDeltaPocMsbPresentFlag, follDeltaPocMsbPresentFlag;
    22232238
    22242239  if (m_pcPic->isIdr() )
    22252240  {
    2226     // - If the current picture is an IDR picture, PocStCurrBefore, PocStCurrAfter, PocStFoll, 
    2227     //   PocLtCurr and PocLtFoll are all set to be empty, and NumPocStCurrBefore, 
     2241    // - If the current picture is an IDR picture, PocStCurrBefore, PocStCurrAfter, PocStFoll,
     2242    //   PocLtCurr and PocLtFoll are all set to be empty, and NumPocStCurrBefore,
    22282243    //   NumPocStCurrAfter, NumPocStFoll, NumPocLtCurr and NumPocLtFoll are all set equal to 0.
    22292244
     
    22332248    pocLtCurr      .clear();
    22342249    pocLtFoll      .clear();
    2235     numPocStCurrBefore = 0; 
    2236     numPocStCurrAfter  = 0; 
    2237     numPocStFoll       = 0; 
    2238     numPocLtCurr       = 0; 
    2239     numPocLtFoll       = 0; 
     2250    numPocStCurrBefore = 0;
     2251    numPocStCurrAfter  = 0;
     2252    numPocStFoll       = 0;
     2253    numPocLtCurr       = 0;
     2254    numPocLtFoll       = 0;
    22402255  }
    22412256  else
     
    22442259    // -  Otherwise, the following applies:
    22452260
    2246     Int j = 0; 
    2247     Int k = 0; 
     2261    Int j = 0;
     2262    Int k = 0;
    22482263    for( Int i = 0; i < stRps->getNumNegativePicsVar() ; i++ )
    22492264    {
     
    22572272      }
    22582273    }
    2259     numPocStCurrBefore = j;   
    2260 
    2261     j = 0; 
     2274    numPocStCurrBefore = j;
     2275
     2276    j = 0;
    22622277    for (Int i = 0; i < stRps->getNumPositivePicsVar(); i++ )
    22632278    {
    22642279      if (stRps->getUsedByCurrPicS1Var( i ) )
    22652280      {
    2266         pocStCurrAfter.push_back( picOrderCntVal + stRps->getDeltaPocS1Var( i ) ); j++; 
     2281        pocStCurrAfter.push_back( picOrderCntVal + stRps->getDeltaPocS1Var( i ) ); j++;
    22672282      }
    22682283      else
     
    22752290
    22762291
    2277     j = 0; 
    2278     k = 0; 
     2292    j = 0;
     2293    k = 0;
    22792294    for( Int i = 0; i < slice->getNumLongTermSps( ) + slice->getNumLongTermPics(); i++ )
    22802295    {
    2281       Int pocLt = slice->getPocLsbLtVar( i ); 
     2296      Int pocLt = slice->getPocLsbLtVar( i );
    22822297      if( slice->getDeltaPocMsbPresentFlag( i ) )
    22832298      {
     
    22862301      }
    22872302
    2288       if( slice->getUsedByCurrPicLtVar(i)) 
     2303      if( slice->getUsedByCurrPicLtVar(i))
    22892304      {
    22902305        pocLtCurr.push_back( pocLt );
    2291         currDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); j++; 
    2292       } 
     2306        currDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); j++;
     2307      }
    22932308      else
    22942309      {
    22952310        pocLtFoll.push_back( pocLt );
    2296         follDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); k++; 
     2311        follDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); k++;
    22972312      }
    22982313    }
     
    23032318  assert(numPocStCurrAfter  == pocStCurrAfter   .size() );
    23042319  assert(numPocStCurrBefore == pocStCurrBefore  .size() );
    2305   assert(numPocStFoll       == pocStFoll        .size() ); 
    2306   assert(numPocLtCurr       == pocLtCurr        .size() ); 
     2320  assert(numPocStFoll       == pocStFoll        .size() );
     2321  assert(numPocLtCurr       == pocLtCurr        .size() );
    23072322  assert(numPocLtFoll       == pocLtFoll        .size() );
    23082323
    23092324  // where PicOrderCntVal is the picture order count of the current picture as specified in clause 8.3.1.
    23102325
    2311   //   NOTE 2 - A value of CurrRpsIdx in the range of 0 to num_short_term_ref_pic_sets - 1, inclusive, 
    2312   //   indicates that a candidate short-term RPS from the active SPS for the current layer is being used, 
    2313   //   where CurrRpsIdx is the index of the candidate short-term RPS into the list of candidate short-term RPSs signalled 
    2314   //   in the active SPS for the current layer. CurrRpsIdx equal to num_short_term_ref_pic_sets indicates that 
     2326  //   NOTE 2 - A value of CurrRpsIdx in the range of 0 to num_short_term_ref_pic_sets - 1, inclusive,
     2327  //   indicates that a candidate short-term RPS from the active SPS for the current layer is being used,
     2328  //   where CurrRpsIdx is the index of the candidate short-term RPS into the list of candidate short-term RPSs signalled
     2329  //   in the active SPS for the current layer. CurrRpsIdx equal to num_short_term_ref_pic_sets indicates that
    23152330  //   the short-term RPS of the current picture is directly signalled in the slice header.
    23162331
    23172332  for (Int i = 0; i <= numPocLtCurr - 1; i++  )
    23182333  {
    2319       // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 1, 
     2334      // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 1,
    23202335      // it is a requirement of bitstream conformance that the following conditions apply:
    23212336    if ( currDeltaPocMsbPresentFlag[i] )
    23222337    {
    2323       // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 
     2338      // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive,
    23242339      //    for which PocLtCurr[ i ] is equal to PocStCurrBefore[ j ].
    23252340      for (Int j = 0; j <= numPocStCurrBefore - 1; j++ )
     
    23282343      }
    23292344
    2330       // -  There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive, 
    2331       //    for which PocLtCurr[ i ] is equal to PocStCurrAfter[ j ]. 
     2345      // -  There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive,
     2346      //    for which PocLtCurr[ i ] is equal to PocStCurrAfter[ j ].
    23322347      for (Int j = 0; j <= numPocStCurrAfter - 1; j++ )
    23332348      {
     
    23352350      }
    23362351
    2337       // -  There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive, 
     2352      // -  There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive,
    23382353      //    for which PocLtCurr[ i ] is equal to PocStFoll[ j ].
    23392354      for (Int j = 0; j <= numPocStFoll - 1; j++ )
     
    23422357      }
    23432358
    2344       // -  There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive, 
     2359      // -  There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive,
    23452360      //    where j is not equal to i, for which PocLtCurr[ i ] is equal to PocLtCurr[ j ].
    23462361      for (Int j = 0; j <= numPocLtCurr - 1; j++ )
    23472362      {
    23482363        if ( i != j )
    2349         {       
     2364        {
    23502365          assert(!( pocLtCurr[ i ] == pocLtCurr[ j ] ) );
    23512366        }
     
    23562371  for (Int i = 0; i <= numPocLtFoll - 1; i++  )
    23572372  {
    2358     // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 1, 
     2373    // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 1,
    23592374    // it is a requirement of bitstream conformance that the following conditions apply:
    23602375    if ( follDeltaPocMsbPresentFlag[i] )
    23612376    {
    2362       // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 
     2377      // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive,
    23632378      //    for which PocLtFoll[ i ] is equal to PocStCurrBefore[ j ].
    23642379      for (Int j = 0; j <= numPocStCurrBefore - 1; j++ )
     
    23672382      }
    23682383
    2369       // -  There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive, 
     2384      // -  There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive,
    23702385      //    for which PocLtFoll[ i ] is equal to PocStCurrAfter[ j ].
    23712386      for (Int j = 0; j <= numPocStCurrAfter - 1; j++ )
     
    23742389      }
    23752390
    2376       // -  There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive, 
     2391      // -  There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive,
    23772392      //    for which PocLtFoll[ i ] is equal to PocStFoll[ j ].
    23782393      for (Int j = 0; j <= numPocStFoll - 1; j++ )
     
    23812396      }
    23822397
    2383       // -  There shall be no j in the range of 0 to NumPocLtFoll - 1, inclusive, 
     2398      // -  There shall be no j in the range of 0 to NumPocLtFoll - 1, inclusive,
    23842399      //    where j is not equal to i, for which PocLtFoll[ i ] is equal to PocLtFoll[ j ].
    23852400      for (Int j = 0; j <= numPocLtFoll - 1; j++ )
     
    23912406      }
    23922407
    2393       // -  There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive, 
     2408      // -  There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive,
    23942409      //    for which PocLtFoll[ i ] is equal to PocLtCurr[ j ].
    23952410      for (Int j = 0; j <= numPocLtCurr - 1; j++ )
     
    24002415  }
    24012416
    2402   Int maxPicOrderCntLsb = sps->getMaxPicOrderCntLsb(); 
     2417  Int maxPicOrderCntLsb = sps->getMaxPicOrderCntLsb();
    24032418  for (Int i = 0; i <= numPocLtCurr - 1; i++  )
    24042419  {
    2405     // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 0, 
     2420    // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 0,
    24062421    // it is a requirement of bitstream conformance that the following conditions apply:
    24072422    if ( currDeltaPocMsbPresentFlag[ i ] == 0  )
    24082423    {
    2409       // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 
     2424      // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive,
    24102425      //    for which PocLtCurr[ i ] is equal to ( PocStCurrBefore[ j ] & ( MaxPicOrderCntLsb - 1 ) ).
    24112426      for (Int j = 0; j <= numPocStCurrBefore - 1; j++ )
     
    24422457  for (Int i = 0; i <= numPocLtFoll - 1; i++  )
    24432458  {
    2444     // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 0, 
     2459    // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 0,
    24452460    // it is a requirement of bitstream conformance that the following conditions apply:
    24462461    if ( follDeltaPocMsbPresentFlag[ i ] == 0  )
     
    24742489        {
    24752490          assert(!( pocLtFoll[ i ] == ( pocLtFoll[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) );
    2476         }         
     2491        }
    24772492      }
    24782493
     
    24872502
    24882503  if ( !annexFModifications )
    2489   { 
    2490     // The variable NumPicTotalCurr is derived as specified in clause 7.4.7.2. 
     2504  {
     2505    // The variable NumPicTotalCurr is derived as specified in clause 7.4.7.2.
    24912506
    24922507    // It is a requirement of bitstream conformance that the following applies to the value of NumPicTotalCurr:
     
    24942509    {
    24952510      // -  If the current picture is a BLA or CRA picture, the value of NumPicTotalCurr shall be equal to 0.
    2496       assert( slice->getNumPicTotalCurr() == 0 ); 
     2511      assert( slice->getNumPicTotalCurr() == 0 );
    24972512    }
    24982513    else
    24992514    {
    2500       // -  Otherwise, 
     2515      // -  Otherwise,
    25012516      if ( slice->isInterP() || slice->isInterB() )
    25022517      {
    25032518        // when the current picture contains a P or B slice, the value of NumPicTotalCurr shall not be equal to 0.
    2504         assert( slice->getNumPicTotalCurr() != 0 ); 
    2505       }
    2506     }
    2507   }
    2508    
    2509   // The RPS of the current picture consists of five RPS lists; RefPicSetStCurrBefore, RefPicSetStCurrAfter, RefPicSetStFoll, 
    2510   // RefPicSetLtCurr and RefPicSetLtFoll. RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetStFoll are collectively 
     2519        assert( slice->getNumPicTotalCurr() != 0 );
     2520      }
     2521    }
     2522  }
     2523
     2524  // The RPS of the current picture consists of five RPS lists; RefPicSetStCurrBefore, RefPicSetStCurrAfter, RefPicSetStFoll,
     2525  // RefPicSetLtCurr and RefPicSetLtFoll. RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetStFoll are collectively
    25112526  // referred to as the short-term RPS. RefPicSetLtCurr and RefPicSetLtFoll are collectively referred to as the long-term RPS.
    25122527
     
    25162531  std::vector<TComPic*>& refPicSetLtCurr       = decRps->m_refPicSetLtCurr      ;
    25172532  std::vector<TComPic*>& refPicSetLtFoll       = decRps->m_refPicSetLtFoll      ;
    2518  
     2533
    25192534  std::vector<TComPic*>** refPicSetsCurr       = decRps->m_refPicSetsCurr       ;
    25202535  std::vector<TComPic*>** refPicSetsLt         = decRps->m_refPicSetsLt         ;
    25212536  std::vector<TComPic*>** refPicSetsAll        = decRps->m_refPicSetsAll        ;
    2522   //   NOTE 3 - RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetLtCurr contain all reference pictures that may be 
     2537  //   NOTE 3 - RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetLtCurr contain all reference pictures that may be
    25232538  //   used for inter prediction of the current picture and one or more pictures that follow the current picture in decoding order.
    2524   //   RefPicSetStFoll and RefPicSetLtFoll consist of all reference pictures that are not used for inter prediction of the current 
     2539  //   RefPicSetStFoll and RefPicSetLtFoll consist of all reference pictures that are not used for inter prediction of the current
    25252540  //   picture but may be used in inter prediction for one or more pictures that follow the current picture in decoding order.
    25262541
     
    25282543  // 1.  The following applies:
    25292544
    2530   TComSubDpb* dpb = m_dpb->getSubDpb( getLayerId(), false );   
     2545  TComSubDpb* dpb = m_dpb->getSubDpb( getLayerId(), false );
    25312546  assert( refPicSetLtCurr.empty() );
    2532   for( Int i = 0; i < numPocLtCurr; i++ ) 
    2533   {
    2534     if( !currDeltaPocMsbPresentFlag[ i ] ) 
    2535     {   
    2536       refPicSetLtCurr.push_back( dpb->getPicFromLsb( pocLtCurr[ i ], maxPicOrderCntLsb ) );       
     2547  for( Int i = 0; i < numPocLtCurr; i++ )
     2548  {
     2549    if( !currDeltaPocMsbPresentFlag[ i ] )
     2550    {
     2551      refPicSetLtCurr.push_back( dpb->getPicFromLsb( pocLtCurr[ i ], maxPicOrderCntLsb ) );
    25372552    }
    25382553    else
    25392554    {
    2540       refPicSetLtCurr.push_back(dpb->getPic( pocLtCurr[ i ] ));       
    2541     }   
     2555      refPicSetLtCurr.push_back(dpb->getPic( pocLtCurr[ i ] ));
     2556    }
    25422557  }
    25432558
     
    25512566   else
    25522567   {
    2553      refPicSetLtFoll.push_back(dpb->getPic( pocLtFoll[ i ] ));       
     2568     refPicSetLtFoll.push_back(dpb->getPic( pocLtFoll[ i ] ));
    25542569   }
    25552570  }
    2556  
    2557   // 2.  All reference pictures that are included in RefPicSetLtCurr or RefPicSetLtFoll and have nuh_layer_id equal 
     2571
     2572  // 2.  All reference pictures that are included in RefPicSetLtCurr or RefPicSetLtFoll and have nuh_layer_id equal
    25582573  //     to currPicLayerId are marked as "used for long-term reference".
    25592574  for (Int i = 0; i < numPocLtCurr; i++)
     
    25612576    if ( refPicSetLtCurr[i] != NULL )
    25622577    {
    2563       refPicSetLtCurr[i]->markAsUsedForLongTermReference(); 
    2564     }   
     2578      refPicSetLtCurr[i]->markAsUsedForLongTermReference();
     2579    }
    25652580  }
    25662581
     
    25692584    if ( refPicSetLtFoll[i] != NULL )
    25702585    {
    2571       refPicSetLtFoll[i]->markAsUsedForLongTermReference(); 
    2572     }   
     2586      refPicSetLtFoll[i]->markAsUsedForLongTermReference();
     2587    }
    25732588  }
    25742589
     
    25772592  for( Int i = 0; i < numPocStCurrBefore; i++ )
    25782593  {
    2579     refPicSetStCurrBefore.push_back(dpb->getShortTermRefPic( pocStCurrBefore[ i ] )); 
     2594    refPicSetStCurrBefore.push_back(dpb->getShortTermRefPic( pocStCurrBefore[ i ] ));
    25802595  }
    25812596
     
    25832598  for( Int i = 0; i < numPocStCurrAfter; i++ )
    25842599  {
    2585     refPicSetStCurrAfter.push_back(dpb->getShortTermRefPic( pocStCurrAfter[ i ] )); 
     2600    refPicSetStCurrAfter.push_back(dpb->getShortTermRefPic( pocStCurrAfter[ i ] ));
    25862601  }
    25872602
     
    25892604  for( Int i = 0; i < numPocStFoll; i++ )
    25902605  {
    2591     refPicSetStFoll.push_back(dpb->getShortTermRefPic( pocStFoll[ i ] )); 
    2592   }
    2593  
    2594   // 4.  All reference pictures in the DPB that are not included in RefPicSetLtCurr, RefPicSetLtFoll, RefPicSetStCurrBefore, 
     2606    refPicSetStFoll.push_back(dpb->getShortTermRefPic( pocStFoll[ i ] ));
     2607  }
     2608
     2609  // 4.  All reference pictures in the DPB that are not included in RefPicSetLtCurr, RefPicSetLtFoll, RefPicSetStCurrBefore,
    25952610  //     RefPicSetStCurrAfter, or RefPicSetStFoll and have nuh_layer_id equal to currPicLayerId are marked as "unused for reference".
    2596   TComSubDpb picsToMark = (*dpb); 
     2611  TComSubDpb picsToMark = (*dpb);
    25972612  for (Int j = 0; j < 5; j++ )
    25982613  {
    2599     picsToMark.removePics( *refPicSetsAll[j] ); 
    2600   } 
    2601   picsToMark.markAllAsUnusedForReference(); 
    2602  
    2603   //     NOTE 4 - There may be one or more entries in the RPS lists that are equal to "no reference picture" because 
    2604   //     the corresponding pictures are not present in the DPB. Entries in RefPicSetStFoll or RefPicSetLtFoll that are equal 
    2605   //     to "no reference picture" should be ignored. An unintentional picture loss should be inferred for each entry in 
     2614    picsToMark.removePics( *refPicSetsAll[j] );
     2615  }
     2616  picsToMark.markAllAsUnusedForReference();
     2617
     2618  //     NOTE 4 - There may be one or more entries in the RPS lists that are equal to "no reference picture" because
     2619  //     the corresponding pictures are not present in the DPB. Entries in RefPicSetStFoll or RefPicSetLtFoll that are equal
     2620  //     to "no reference picture" should be ignored. An unintentional picture loss should be inferred for each entry in
    26062621  //     RefPicSetStCurrBefore, RefPicSetStCurrAfter, or RefPicSetLtCurr that is equal to "no reference picture".
    26072622
    26082623  //     NOTE 5 - A picture cannot be included in more than one of the five RPS lists.
    26092624
    2610  
     2625
    26112626  // It is a requirement of bitstream conformance that the RPS is restricted as follows:
    26122627
     
    26142629#if NH_MV_FIX_NO_REF_PICS_CHECK
    26152630  if ( !annexFModifications || m_firstPicInLayerDecodedFlag[ m_pcPic->getLayerId() ] )
    2616   { 
     2631  {
    26172632#endif
    26182633    for (Int j = 0; j < 3; j++ )
    26192634    {
    2620       // -  There shall be no entry in RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr 
     2635      // -  There shall be no entry in RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr
    26212636      //    for which one or more of the following are true:
    26222637
    2623       std::vector<TComPic*>* currSet = refPicSetsCurr[j]; 
     2638      std::vector<TComPic*>* currSet = refPicSetsCurr[j];
    26242639      for (Int i = 0; i < currSet->size(); i++)
    26252640      {
    2626         TComPic* pic = (*currSet)[i]; 
     2641        TComPic* pic = (*currSet)[i];
    26272642
    26282643        // -  The entry is equal to "no reference picture".
    2629         assert( ! (pic == NULL ) ); 
     2644        assert( ! (pic == NULL ) );
    26302645
    26312646        // -  The entry is an SLNR picture and has TemporalId equal to that of the current picture.
    2632         assert( !( pic->isSlnr() && pic->getTemporalId() == m_pcPic->getTemporalId() ) ); 
     2647        assert( !( pic->isSlnr() && pic->getTemporalId() == m_pcPic->getTemporalId() ) );
    26332648
    26342649        // -  The entry is a picture that has TemporalId greater than that of the current picture.
    2635         assert( !(  pic->getTemporalId() > m_pcPic->getTemporalId() ) ); 
    2636       }     
     2650        assert( !(  pic->getTemporalId() > m_pcPic->getTemporalId() ) );
     2651      }
    26372652    }
    26382653#if NH_MV_FIX_NO_REF_PICS_CHECK
    26392654  }
    26402655#endif
    2641  
    2642   //  -  There shall be no entry in RefPicSetLtCurr or RefPicSetLtFoll for which the 
    2643   //     difference between the picture order count value of the current picture and the picture order count 
     2656
     2657  //  -  There shall be no entry in RefPicSetLtCurr or RefPicSetLtFoll for which the
     2658  //     difference between the picture order count value of the current picture and the picture order count
    26442659  //     value of the entry is greater than or equal to 2^24.
    26452660  for (Int j = 0; j < 2; j++ )
    2646   {   
    2647     std::vector<TComPic*>* ltSet = refPicSetsLt[j]; 
     2661  {
     2662    std::vector<TComPic*>* ltSet = refPicSetsLt[j];
    26482663    for (Int i = 0; i < ltSet->size(); i++)
    26492664    {
    2650       TComPic* pic = (*ltSet)[i]; 
     2665      TComPic* pic = (*ltSet)[i];
    26512666      if( pic != NULL )
    26522667      {
    2653         assert(!( abs( m_pcPic->getPOC() - pic->getPOC() ) >= (1 << 24) )); 
    2654       }
    2655     }
    2656   }
    2657 
    2658   //   -  When the current picture is a temporal sub-layer access (TSA) picture, there shall be no picture 
     2668        assert(!( abs( m_pcPic->getPOC() - pic->getPOC() ) >= (1 << 24) ));
     2669      }
     2670    }
     2671  }
     2672
     2673  //   -  When the current picture is a temporal sub-layer access (TSA) picture, there shall be no picture
    26592674  //      included in the RPS with TemporalId greater than or equal to the TemporalId of the current picture.
    26602675  if (m_pcPic->isTsa() )
    26612676  {
    26622677    for (Int j = 0; j < 5; j++ )
    2663     {   
    2664       std::vector<TComPic*>* aSet = refPicSetsAll[j]; 
     2678    {
     2679      std::vector<TComPic*>* aSet = refPicSetsAll[j];
    26652680      for (Int i = 0; i < aSet->size(); i++)
    26662681      {
    2667         TComPic* pic = (*aSet)[i]; 
     2682        TComPic* pic = (*aSet)[i];
    26682683        if( pic != NULL )
    26692684        {
    2670           assert( ! (pic->getTemporalId() >= m_pcPic->getTemporalId() ) ); 
     2685          assert( ! (pic->getTemporalId() >= m_pcPic->getTemporalId() ) );
    26712686        }
    26722687      }
     
    26742689  }
    26752690
    2676   //   -  When the current picture is a step-wise temporal sub-layer access (STSA) picture, 
     2691  //   -  When the current picture is a step-wise temporal sub-layer access (STSA) picture,
    26772692  //      there shall be no picture included in RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr that has
    26782693  //      TemporalId equal to that of the current picture.
     
    26802695  {
    26812696    for (Int j = 0; j < 3; j++ )
    2682     {   
    2683       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2697    {
     2698      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    26842699      for (Int i = 0; i < cSet->size(); i++)
    26852700      {
    2686         TComPic* pic = (*cSet)[i]; 
     2701        TComPic* pic = (*cSet)[i];
    26872702        if( pic != NULL )
    26882703        {
    2689           assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() ) ); 
     2704          assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() ) );
    26902705        }
    26912706      }
     
    27002715  {
    27012716    for (Int j = 0; j < 3; j++ )
    2702     {   
    2703       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2717    {
     2718      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    27042719      for (Int i = 0; i < cSet->size(); i++)
    27052720      {
    2706         TComPic* pic = (*cSet)[i]; 
     2721        TComPic* pic = (*cSet)[i];
    27072722        if( pic != NULL )
    27082723        {
    2709           assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() && pic->getDecodingOrder() < m_prevStsaDecOrder  ) ); 
     2724          assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() && pic->getDecodingOrder() < m_prevStsaDecOrder  ) );
    27102725        }
    27112726      }
    27122727    }
    27132728  }
    2714  
     2729
    27152730  //   -  When the current picture is a CRA picture, there shall be no picture included in the RPS that
    27162731  //      precedes, in output order or decoding order, any preceding IRAP picture in decoding order (when present).
     
    27182733  {
    27192734    for (Int j = 0; j < 5; j++ )
    2720     {   
    2721       std::vector<TComPic*>* aSet = refPicSetsAll[j]; 
     2735    {
     2736      std::vector<TComPic*>* aSet = refPicSetsAll[j];
    27222737      for (Int i = 0; i < aSet->size(); i++)
    27232738      {
    27242739        // TBD check whether it sufficient to test only the last IRAP
    2725         TComPic* pic = (*aSet)[i]; 
     2740        TComPic* pic = (*aSet)[i];
    27262741        if( pic != NULL )
    2727         {       
    2728           assert( ! (pic->getPOC()           < m_prevIrapPoc           ) );           
    2729           assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) ); 
     2742        {
     2743          assert( ! (pic->getPOC()           < m_prevIrapPoc           ) );
     2744          assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) );
    27302745        }
    27312746      }
    27322747    }
    27332748  }
    2734  
     2749
    27352750  Bool isTrailingPicture = ( !m_pcPic->isIrap() ) && ( m_pcPic->getPOC() > m_prevIrapPoc );
    27362751  //   -  When the current picture is a trailing picture, there shall be no picture in RefPicSetStCurrBefore,
     
    27402755  {
    27412756    for (Int j = 0; j < 3; j++ )
    2742     {   
    2743       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2757    {
     2758      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    27442759      for (Int i = 0; i < cSet->size(); i++)
    27452760      {
    2746         TComPic* pic = (*cSet)[i]; 
     2761        TComPic* pic = (*cSet)[i];
    27472762        if( pic != NULL )
    27482763        {
    2749           assert( ! (pic->getIsGeneratedCl833() ) ); 
     2764          assert( ! (pic->getIsGeneratedCl833() ) );
    27502765        }
    27512766      }
     
    27582773  {
    27592774    for (Int j = 0; j < 5; j++ )
    2760     {   
    2761       std::vector<TComPic*>* aSet = refPicSetsAll[j]; 
     2775    {
     2776      std::vector<TComPic*>* aSet = refPicSetsAll[j];
    27622777      for (Int i = 0; i < aSet->size(); i++)
    27632778      {
    27642779        // TBD check whether it sufficient to test only the last IRAP
    2765          TComPic* pic = (*aSet)[i]; 
     2780         TComPic* pic = (*aSet)[i];
    27662781        if( pic != NULL )
    2767         {         
    2768           assert( ! (pic->getPOC()           < m_prevIrapPoc           ) ); 
    2769           assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) ); 
     2782        {
     2783          assert( ! (pic->getPOC()           < m_prevIrapPoc           ) );
     2784          assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) );
    27702785        }
    27712786      }
     
    27782793  {
    27792794    for (Int j = 0; j < 3; j++ )
    2780     {   
    2781       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2795    {
     2796      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    27822797      for (Int i = 0; i < cSet->size(); i++)
    2783       {       
    2784         TComPic* pic = (*cSet)[i]; 
     2798      {
     2799        TComPic* pic = (*cSet)[i];
    27852800        if( pic != NULL )
    2786         {       
     2801        {
    27872802          // -  A RASL picture
    2788           assert( ! (pic->isRasl() ) ); 
    2789           // -  A picture that was generated by the decoding process for generating unavailable reference pictures 
     2803          assert( ! (pic->isRasl() ) );
     2804          // -  A picture that was generated by the decoding process for generating unavailable reference pictures
    27902805          //    as specified in clause 8.3.3
    2791           assert( ! (pic->getIsGeneratedCl833() ) ); 
     2806          assert( ! (pic->getIsGeneratedCl833() ) );
    27922807          // -  A picture that precedes the associated IRAP picture in decoding order
    2793           assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) ); 
     2808          assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) );
    27942809        }
    27952810      }
    27962811    }
    27972812  }
    2798  
    2799  
     2813
     2814
    28002815  if ( sps->getTemporalIdNestingFlag() )
    28012816  {
    28022817    // -  When sps_temporal_id_nesting_flag is equal to 1, the following applies:
    28032818    //    -  Let tIdA be the value of TemporalId of the current picture picA.
    2804     TComPic* picA = m_pcPic; 
     2819    TComPic* picA = m_pcPic;
    28052820    Int      tIdA = picA->getTemporalId();
    2806     //   -  Any picture picB with TemporalId equal to tIdB that is less than or equal to tIdA shall not be included in 
    2807     //      RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr of picA when there exists a picture picC that 
     2821    //   -  Any picture picB with TemporalId equal to tIdB that is less than or equal to tIdA shall not be included in
     2822    //      RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr of picA when there exists a picture picC that
    28082823    //      has TemporalId less than tIdB, follows picB in decoding order, and precedes picA in decoding order.
    28092824    for (Int j = 0; j < 3; j++ )
    2810     {   
    2811       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2825    {
     2826      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    28122827      for (Int i = 0; i < cSet->size(); i++)
    28132828      {
    2814         TComPic* picB = (*cSet)[i]; 
     2829        TComPic* picB = (*cSet)[i];
    28152830        if( picB != NULL )
    28162831        {
    2817           Int tIdB = picB->getTemporalId(); 
     2832          Int tIdB = picB->getTemporalId();
    28182833
    28192834          if (tIdB <= tIdA)
     
    28212836            for ( TComSubDpb::iterator itP = dpb->begin(); itP != dpb->end(); itP++ )
    28222837            {
    2823               TComPic* picC = (*itP); 
    2824               assert(! ( picC->getTemporalId() < tIdB && picC->getDecodingOrder() > picB->getDecodingOrder() && picC->getDecodingOrder() < picA->getDecodingOrder()  )  ); 
     2838              TComPic* picC = (*itP);
     2839              assert(! ( picC->getTemporalId() < tIdB && picC->getDecodingOrder() > picB->getDecodingOrder() && picC->getDecodingOrder() < picA->getDecodingOrder()  )  );
    28252840            }
    28262841          }
     
    28282843      }
    28292844    }
    2830   }   
     2845  }
    28312846}
    28322847
     
    28392854
    28402855  // The specifications in clause 8.3.2 apply with the following changes:
    2841   // -  The references to clauses 7.4.7.2, 8.3.1, 8.3.3 and 8.3.4 are replaced with references to 
     2856  // -  The references to clauses 7.4.7.2, 8.3.1, 8.3.3 and 8.3.4 are replaced with references to
    28422857  //    clauses F.7.4.7.2, F.8.3.1, F.8.3.3 and F.8.3.4, respectively.
    28432858
    2844   x832DecProcForRefPicSet( true ); 
     2859  x832DecProcForRefPicSet( true );
    28452860
    28462861  // -  The following specifications are added:
    28472862  if (m_pcPic->isIrap() && m_pcPic->getLayerId() == m_smallestLayerId )
    28482863  {
    2849     // -  When the current picture is an IRAP picture with nuh_layer_id equal to SmallestLayerId, 
    2850     //    all reference pictures with any value of nuh_layer_id currently in the DPB (if any) are marked 
     2864    // -  When the current picture is an IRAP picture with nuh_layer_id equal to SmallestLayerId,
     2865    //    all reference pictures with any value of nuh_layer_id currently in the DPB (if any) are marked
    28512866    //    as "unused for reference" when at least one of the following conditions is true:
    28522867
     
    28602875
    28612876  // -  It is a requirement of bitstream conformance that the RPS is restricted as follows:
    2862   // -  When the current picture is a CRA picture, there shall be no picture in RefPicSetStCurrBefore, RefPicSetStCurrAfter 
     2877  // -  When the current picture is a CRA picture, there shall be no picture in RefPicSetStCurrBefore, RefPicSetStCurrAfter
    28632878  //    or RefPicSetLtCurr.
    28642879
     
    28672882  if ( m_pcPic->isCra() )
    28682883  {
    2869     for (Int j = 0; j < 3; j++ )   
    2870     {   
    2871       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
    2872       assert ( cSet->size() == 0 ); 
     2884    for (Int j = 0; j < 3; j++ )
     2885    {
     2886      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
     2887      assert ( cSet->size() == 0 );
    28732888    }
    28742889  }
     
    28762891  // -  The constraints specified in clause 8.3.2 on the value of NumPicTotalCurr are replaced with the following:
    28772892  //    -  It is a requirement of bitstream conformance that the following applies to the value of NumPicTotalCurr:
    2878   Int numPicTotalCurr = m_pcPic->getSlice(0)->getNumPicTotalCurr(); 
    2879   Int currPicLayerId  = m_pcPic->getLayerId(); 
    2880   const TComVPS* vps  = m_pcPic->getSlice(0)->getVPS(); 
     2893  Int numPicTotalCurr = m_pcPic->getSlice(0)->getNumPicTotalCurr();
     2894  Int currPicLayerId  = m_pcPic->getLayerId();
     2895  const TComVPS* vps  = m_pcPic->getSlice(0)->getVPS();
    28812896
    28822897  if ( ( m_pcPic->isBla() || m_pcPic->isCra() ) && (  (currPicLayerId == 0 ) || ( vps->getNumDirectRefLayers( currPicLayerId ) == 0 ) ) )
    2883   {   
    2884     assert( numPicTotalCurr == 0 ); 
    2885     // -  If the current picture is a BLA or CRA picture and either currPicLayerId is equal to 0 or 
     2898  {
     2899    assert( numPicTotalCurr == 0 );
     2900    // -  If the current picture is a BLA or CRA picture and either currPicLayerId is equal to 0 or
    28862901    //     NumDirectRefLayers[ currPicLayerId ] is equal to 0, the value of NumPicTotalCurr shall be equal to 0.
    28872902  }
     
    28922907    {
    28932908      // -  Otherwise, when the current picture contains a P or B slice, the value of NumPicTotalCurr shall not be equal to 0.
    2894       assert( numPicTotalCurr != 0 ); 
     2909      assert( numPicTotalCurr != 0 );
    28952910    }
    28962911  }
     
    29042919  ////////////////////////////////////////////////////////////////////
    29052920
    2906   // Outputs of this process are updated lists of inter-layer reference pictures RefPicSetInterLayer0 and RefPicSetInterLayer1 
     2921  // Outputs of this process are updated lists of inter-layer reference pictures RefPicSetInterLayer0 and RefPicSetInterLayer1
    29072922  // and the variables NumActiveRefLayerPics0 and NumActiveRefLayerPics1.
    29082923
    2909   TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
    2910   TComSlice* slice       = m_pcPic->getSlice( 0 ); 
    2911   const TComVPS* vps     =  slice->getVPS(); 
     2924  TComDecodedRps* decRps = m_pcPic->getDecodedRps();
     2925  TComSlice* slice       = m_pcPic->getSlice( 0 );
     2926  const TComVPS* vps     =  slice->getVPS();
    29122927
    29132928  Int&                   numActiveRefLayerPics0 = decRps->m_numActiveRefLayerPics0;
     
    29152930
    29162931  std::vector<TComPic*>& refPicSetInterLayer0   = decRps->m_refPicSetInterLayer0;
    2917   std::vector<TComPic*>& refPicSetInterLayer1   = decRps->m_refPicSetInterLayer1; 
     2932  std::vector<TComPic*>& refPicSetInterLayer1   = decRps->m_refPicSetInterLayer1;
    29182933
    29192934  // The variable currLayerId is set equal to nuh_layer_id of the current picture.
    2920   Int currLayerId = getLayerId(); 
    2921 
    2922   // The lists RefPicSetInterLayer0 and RefPicSetInterLayer1 are first emptied, NumActiveRefLayerPics0 and NumActiveRefLayerPics1 
     2935  Int currLayerId = getLayerId();
     2936
     2937  // The lists RefPicSetInterLayer0 and RefPicSetInterLayer1 are first emptied, NumActiveRefLayerPics0 and NumActiveRefLayerPics1
    29232938  // are set equal to 0 and the following applies:
    29242939
    2925   refPicSetInterLayer0.clear(); 
    2926   refPicSetInterLayer1.clear(); 
    2927 
    2928   numActiveRefLayerPics0 = 0; 
    2929   numActiveRefLayerPics1 = 0; 
    2930 
    2931   Int viewIdCurrLayerId  = vps->getViewId( currLayerId ); 
     2940  refPicSetInterLayer0.clear();
     2941  refPicSetInterLayer1.clear();
     2942
     2943  numActiveRefLayerPics0 = 0;
     2944  numActiveRefLayerPics1 = 0;
     2945
     2946  Int viewIdCurrLayerId  = vps->getViewId( currLayerId );
    29322947  Int viewId0            = vps->getViewId( 0   );
    29332948
    2934   for( Int i = 0; i < slice->getNumActiveRefLayerPics(); i++ )   
    2935   {
    2936     Int viewIdRefPicLayerIdi = vps->getViewId( slice->getRefPicLayerId( i ) ); 
     2949  for( Int i = 0; i < slice->getNumActiveRefLayerPics(); i++ )
     2950  {
     2951    Int viewIdRefPicLayerIdi = vps->getViewId( slice->getRefPicLayerId( i ) );
    29372952
    29382953    Bool refPicSet0Flag =
     
    29442959    {
    29452960      // there is a picture picX in the DPB that is in the same access unit as the current picture and has
    2946       // nuh_layer_id equal to RefPicLayerId[ i ] 
     2961      // nuh_layer_id equal to RefPicLayerId[ i ]
    29472962
    29482963      if ( refPicSet0Flag )
     
    29602975      assert( ! picX->getSlice(0)->getDiscardableFlag() );
    29612976
    2962       // If the current picture is a RADL picture, there shall be no entry in RefPicSetInterLayer0 or RefPicSetInterLayer1 
     2977      // If the current picture is a RADL picture, there shall be no entry in RefPicSetInterLayer0 or RefPicSetInterLayer1
    29632978      // that is a RASL picture.
    29642979      if ( m_pcPic->isRadl() )
     
    29923007  ///////////////////////////////////////////////////////////////////////////////////////
    29933008
    2994   // This process is invoked once per coded picture when the current picture is a 
     3009  // This process is invoked once per coded picture when the current picture is a
    29953010  // BLA picture or is a CRA picture with NoRaslOutputFlag equal to 1.
    29963011
    29973012  assert( m_pcPic->isBla() || (m_pcPic->isCra() && m_pcPic->getNoRaslOutputFlag() ) );
    2998   TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
     3013  TComDecodedRps* decRps = m_pcPic->getDecodedRps();
    29993014
    30003015  std::vector<TComPic*>& refPicSetStFoll      = decRps->m_refPicSetStFoll;
    3001   std::vector<TComPic*>& refPicSetLtFoll      = decRps->m_refPicSetLtFoll; 
     3016  std::vector<TComPic*>& refPicSetLtFoll      = decRps->m_refPicSetLtFoll;
    30023017
    30033018  const std::vector<Int>& pocStFoll             = decRps->m_pocStFoll;
     
    30053020
    30063021  const Int               numPocStFoll          = decRps->m_numPocStFoll;
    3007   const Int               numPocLtFoll          = decRps->m_numPocLtFoll;   
     3022  const Int               numPocLtFoll          = decRps->m_numPocLtFoll;
    30083023
    30093024  // When this process is invoked, the following applies:
     
    30123027    if ( refPicSetStFoll[ i ] == NULL )
    30133028    {
    3014       //-  For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal 
     3029      //-  For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal
    30153030      //   to "no reference picture", a picture is generated as specified in clause 8.3.3.2, and the following applies:
    3016       TComPic* genPic = x8332GenOfOneUnavailPic( true ); 
     3031      TComPic* genPic = x8332GenOfOneUnavailPic( true );
    30173032
    30183033      // -  The value of PicOrderCntVal for the generated picture is set equal to PocStFoll[ i ].
    30193034      genPic->getSlice(0)->setPOC( pocStFoll[ i ] );
    30203035
    3021       //-  The value of PicOutputFlag for the generated picture is set equal to 0. 
    3022       genPic->setPicOutputFlag( false ); 
     3036      //-  The value of PicOutputFlag for the generated picture is set equal to 0.
     3037      genPic->setPicOutputFlag( false );
    30233038
    30243039      // -  The generated picture is marked as "used for short-term reference".
     
    30293044
    30303045      // -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id of the current picture.
    3031       genPic->setLayerId( m_pcPic-> getLayerId() ); 
     3046      genPic->setLayerId( m_pcPic-> getLayerId() );
    30323047
    30333048      // Insert to DPB
    3034       m_dpb->addNewPic( genPic ); 
     3049      m_dpb->addNewPic( genPic );
    30353050    }
    30363051  }
     
    30403055    if ( refPicSetLtFoll[ i ] == NULL )
    30413056    {
    3042       //-  For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to 
     3057      //-  For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to
    30433058      //   "no reference picture", a picture is generated as specified in clause 8.3.3.2, and the following applies:
    3044       TComPic* genPic = x8332GenOfOneUnavailPic( true ); 
     3059      TComPic* genPic = x8332GenOfOneUnavailPic( true );
    30453060
    30463061      //-  The value of PicOrderCntVal for the generated picture is set equal to PocLtFoll[ i ].
     
    30483063
    30493064      //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtFoll[ i ] & ( MaxPicOrderCntLsb - 1 ) ).
    3050       genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtFoll[ i ] & ( m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb() - 1 ) ) ); 
    3051 
    3052       //  -  The value of PicOutputFlag for the generated picture is set equal to 0.   
    3053       genPic->setPicOutputFlag( false ); 
     3065      genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtFoll[ i ] & ( m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb() - 1 ) ) );
     3066
     3067      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
     3068      genPic->setPicOutputFlag( false );
    30543069
    30553070      //  -  The generated picture is marked as "used for long-term reference".
     
    30603075
    30613076      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id of the current picture.
    3062       genPic->setLayerId( m_pcPic-> getLayerId() ); 
     3077      genPic->setLayerId( m_pcPic-> getLayerId() );
    30633078
    30643079      // Insert to DPB
    3065       m_dpb->addNewPic( genPic ); 
     3080      m_dpb->addNewPic( genPic );
    30663081    }
    30673082  }
     
    30753090  ///////////////////////////////////////////////////////////////////////////////////////
    30763091
    3077   TComPic* genPic = new TComPic; 
    3078   genPic->create( *m_pcPic->getSlice(0)->getSPS(), *m_pcPic->getSlice(0)->getPPS(), true ); 
    3079   genPic->setIsGenerated( true );     
    3080   genPic->setIsGeneratedCl833( calledFromCl8331 ); 
     3092  TComPic* genPic = new TComPic;
     3093  genPic->create( *m_pcPic->getSlice(0)->getSPS(), *m_pcPic->getSlice(0)->getPPS(), true );
     3094  genPic->setIsGenerated( true );
     3095  genPic->setIsGeneratedCl833( calledFromCl8331 );
    30813096  return genPic;
    30823097}
     
    30863101{
    30873102  ///////////////////////////////////////////////////////////////////////////////////////
    3088   // F.8.1.7 Decoding process for generating unavailable reference pictures for pictures 
     3103  // F.8.1.7 Decoding process for generating unavailable reference pictures for pictures
    30893104  //         first in decoding order within a layer
    30903105  ///////////////////////////////////////////////////////////////////////////////////////
    30913106
    3092   //  This process is invoked for a picture with nuh_layer_id equal to layerId, when FirstPicInLayerDecodedFlag[layerId ] is equal to 0.   
     3107  //  This process is invoked for a picture with nuh_layer_id equal to layerId, when FirstPicInLayerDecodedFlag[layerId ] is equal to 0.
    30933108  assert( !m_firstPicInLayerDecodedFlag[ getLayerId() ] );
    30943109
    30953110
    3096   TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
    3097 
    3098   std::vector<TComPic*>& refPicSetStCurrBefore = decRps->m_refPicSetStCurrBefore; 
     3111  TComDecodedRps* decRps = m_pcPic->getDecodedRps();
     3112
     3113  std::vector<TComPic*>& refPicSetStCurrBefore = decRps->m_refPicSetStCurrBefore;
    30993114  std::vector<TComPic*>& refPicSetStCurrAfter  = decRps->m_refPicSetStCurrAfter;
    31003115  std::vector<TComPic*>& refPicSetStFoll       = decRps->m_refPicSetStFoll;
    3101   std::vector<TComPic*>& refPicSetLtCurr       = decRps->m_refPicSetLtCurr; 
    3102   std::vector<TComPic*>& refPicSetLtFoll       = decRps->m_refPicSetLtFoll; 
     3116  std::vector<TComPic*>& refPicSetLtCurr       = decRps->m_refPicSetLtCurr;
     3117  std::vector<TComPic*>& refPicSetLtFoll       = decRps->m_refPicSetLtFoll;
    31033118
    31043119
     
    31093124  const std::vector<Int>& pocLtFoll            = decRps->m_pocLtFoll;
    31103125
    3111   const Int numPocStCurrBefore                 = decRps->m_numPocStCurrBefore; 
     3126  const Int numPocStCurrBefore                 = decRps->m_numPocStCurrBefore;
    31123127  const Int numPocStCurrAfter                  = decRps->m_numPocStCurrAfter;
    31133128  const Int numPocStFoll                       = decRps->m_numPocStFoll;
    31143129  const Int numPocLtCurr                       = decRps->m_numPocLtCurr;
    3115   const Int numPocLtFoll                       = decRps->m_numPocLtFoll;   
    3116 
    3117   Int nuhLayerId = m_pcPic-> getLayerId(); 
     3130  const Int numPocLtFoll                       = decRps->m_numPocLtFoll;
     3131
     3132  Int nuhLayerId = m_pcPic-> getLayerId();
    31183133  for ( Int i = 0 ; i <= numPocStCurrBefore - 1; i++ )
    31193134  {
    31203135    if ( refPicSetStCurrBefore[ i ] == NULL )
    31213136    {
    3122       //-  For each RefPicSetStCurrBefore[ i ], with i in the range of 0 to NumPocStCurrBefore - 1, inclusive, that is 
     3137      //-  For each RefPicSetStCurrBefore[ i ], with i in the range of 0 to NumPocStCurrBefore - 1, inclusive, that is
    31233138      //  equal to "no reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3124       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3139      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    31253140
    31263141      //-  The value of PicOrderCntVal for the generated picture is set equal to PocStCurrBefore[ i ].
     
    31283143
    31293144      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3130       genPic->setPicOutputFlag( false ); 
     3145      genPic->setPicOutputFlag( false );
    31313146
    31323147      //  -  The generated picture is marked as "used for short-term reference".
     
    31373152
    31383153      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3139       genPic->setLayerId( nuhLayerId ); 
     3154      genPic->setLayerId( nuhLayerId );
    31403155
    31413156      // Insert to DPB
    3142       m_dpb->addNewPic( genPic ); 
     3157      m_dpb->addNewPic( genPic );
    31433158    }
    31443159  }
     
    31483163    if ( refPicSetStCurrAfter[ i ] == NULL )
    31493164    {
    3150       //  -  For each RefPicSetStCurrAfter[ i ], with i in the range of 0 to NumPocStCurrAfter - 1, inclusive, that is equal 
     3165      //  -  For each RefPicSetStCurrAfter[ i ], with i in the range of 0 to NumPocStCurrAfter - 1, inclusive, that is equal
    31513166      //     to "no reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3152       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3167      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    31533168
    31543169      //  -  The value of PicOrderCntVal for the generated picture is set equal to PocStCurrAfter[ i ].
     
    31563171
    31573172      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3158       genPic->setPicOutputFlag( false ); 
     3173      genPic->setPicOutputFlag( false );
    31593174
    31603175      //  -  The generated picture is marked as "used for short-term reference".
     
    31653180
    31663181      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3167       genPic->setLayerId( nuhLayerId ); 
     3182      genPic->setLayerId( nuhLayerId );
    31683183
    31693184      // Insert to DPB
    3170       m_dpb->addNewPic( genPic ); 
     3185      m_dpb->addNewPic( genPic );
    31713186
    31723187    }
     
    31773192    if ( refPicSetStFoll[ i ] == NULL )
    31783193    {
    3179       //  -  For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal to "no 
     3194      //  -  For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal to "no
    31803195      //     reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3181       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3196      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    31823197
    31833198      //  -  The value of PicOrderCntVal for the generated picture is set equal to PocStFoll[ i ].
     
    31853200
    31863201      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3187       genPic->setPicOutputFlag( false ); 
     3202      genPic->setPicOutputFlag( false );
    31883203
    31893204      //  -  The generated picture is marked as "used for short-term reference".
     
    31943209
    31953210      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3196       genPic->setLayerId( nuhLayerId ); 
     3211      genPic->setLayerId( nuhLayerId );
    31973212
    31983213      // Insert to DPB
    3199       m_dpb->addNewPic( genPic ); 
    3200     }
    3201   }
    3202 
    3203   Int maxPicOrderCntLsb = m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb(); 
     3214      m_dpb->addNewPic( genPic );
     3215    }
     3216  }
     3217
     3218  Int maxPicOrderCntLsb = m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb();
    32043219  for ( Int i = 0 ; i <= numPocLtCurr - 1; i++ )
    32053220  {
    32063221    if ( refPicSetLtCurr[ i ] == NULL )
    32073222    {
    3208       //  -  For each RefPicSetLtCurr[ i ], with i in the range of 0 to NumPocLtCurr - 1, inclusive, that is equal to "no 
     3223      //  -  For each RefPicSetLtCurr[ i ], with i in the range of 0 to NumPocLtCurr - 1, inclusive, that is equal to "no
    32093224      //     reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3210       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3225      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    32113226
    32123227      //  -  The value of PicOrderCntVal for the generated picture is set equal to PocLtCurr[ i ].
    32133228      genPic->getSlice(0)->setPOC( pocLtCurr[ i ] );
    32143229
    3215       //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & ( 
     3230      //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & (
    32163231      //     MaxPicOrderCntLsb - 1 ) ).
    3217       genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) ); 
     3232      genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) );
    32183233
    32193234      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3220       genPic->setPicOutputFlag( false ); 
     3235      genPic->setPicOutputFlag( false );
    32213236
    32223237      //  -  The generated picture is marked as "used for long-term reference".
     
    32273242
    32283243      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3229       genPic->setLayerId( nuhLayerId ); 
     3244      genPic->setLayerId( nuhLayerId );
    32303245
    32313246      // Insert to DPB
    3232       m_dpb->addNewPic( genPic ); 
     3247      m_dpb->addNewPic( genPic );
    32333248    }
    32343249  }
     
    32383253    if ( refPicSetLtFoll[ i ] == NULL )
    32393254    {
    3240       //  -  For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to "no 
     3255      //  -  For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to "no
    32413256      //     reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3242       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3257      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    32433258
    32443259      //  -  The value of PicOrderCntVal for the generated picture is set equal to PocLtFoll[ i ].
    32453260      genPic->getSlice(0)->setPOC( pocLtFoll[ i ] );
    32463261
    3247       //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & ( 
     3262      //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & (
    32483263      //     MaxPicOrderCntLsb - 1 ) ).
    3249       genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) ); 
     3264      genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) );
    32503265
    32513266      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3252       genPic->setPicOutputFlag( false ); 
     3267      genPic->setPicOutputFlag( false );
    32533268
    32543269      //  -  The generated picture is marked as "used for long-term reference".
     
    32593274
    32603275      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3261       genPic->setLayerId( nuhLayerId ); 
     3276      genPic->setLayerId( nuhLayerId );
    32623277
    32633278      // Insert to DPB
    3264       m_dpb->addNewPic( genPic ); 
     3279      m_dpb->addNewPic( genPic );
    32653280    }
    32663281  }
     
    32803295  std::vector<TComPic*>** refPicSetsCurr       = m_pcPic->getDecodedRps()->m_refPicSetsCurr;
    32813296
    3282   Bool hasGeneratedRefPic = false; 
    3283   for (Int j = 0; j < 3; j++ )   
    3284   {   
    3285     std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     3297  Bool hasGeneratedRefPic = false;
     3298  for (Int j = 0; j < 3; j++ )
     3299  {
     3300    std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    32863301    for (Int i = 0 ; i < cSet->size();  i++ )
    32873302    {
     
    32893304      if ((*cSet)[i]->getIsGenerated() )
    32903305      {
    3291         hasGeneratedRefPic = true; 
    3292       }
    3293     }
    3294   }
    3295   m_pcPic->setHasGeneratedRefPics( hasGeneratedRefPic ); 
     3306        hasGeneratedRefPic = true;
     3307      }
     3308    }
     3309  }
     3310  m_pcPic->setHasGeneratedRefPics( hasGeneratedRefPic );
    32963311}
    32973312
  • trunk/source/Lib/TLibEncoder/SEIEncoder.cpp

    r1313 r1356  
    465465
    466466#if NH_MV
     467#if !NH_MV_SEI
    467468Void SEIEncoder::initSEISubBitstreamProperty(SEISubBitstreamProperty *seiSubBitstreamProperty, const TComSPS *sps)
    468469{
     
    476477  seiSubBitstreamProperty->m_maxBitRate              = m_pcCfg->getMaxBitRate(); 
    477478}
     479#else
     480Void SEIEncoder::createAnnexFGISeiMessages( SEIMessages& seiMessage, const TComSlice* slice )
     481{
     482  const SEIMessages* seiMessageCfg = m_pcCfg->getSeiMessages();
     483
     484  for( SEIMessages::const_iterator itS = seiMessageCfg->begin(); itS != seiMessageCfg->end(); itS++ )   
     485  {     
     486    const SEI* curSei = (*itS);
     487    SEI* newSei;
     488    if ( curSei->insertSei( slice->getLayerId(), slice->getPOC(), slice->getTemporalId(), slice->getNalUnitType() ) )
     489    {
     490      newSei = curSei->getCopy( ) ;
     491
     492      if ( curSei->m_modifyByEncoder )
     493      {
     494        newSei->setupFromSlice  ( slice );
     495      }
     496
     497      if ( newSei   ->checkCfg( slice ) )
     498      {
     499        std::cout << "--> Omit sending SEI."  <<  std::endl;
     500        delete newSei;
     501      }
     502      else
     503      {
     504        seiMessage.push_back(newSei);
     505      }
     506
     507    }
     508  }
     509}
    478510#endif
     511#endif
    479512
    480513//! \}
  • trunk/source/Lib/TLibEncoder/SEIEncoder.h

    r1313 r1356  
    8686  Void initTemporalLevel0IndexSEI(SEITemporalLevel0Index *sei, TComSlice *slice);
    8787#if NH_MV
     88#if !NH_MV_SEI
    8889  Void initSEISubBitstreamProperty(SEISubBitstreamProperty *seiSubBitstreamProperty, const TComSPS *sps);
     90#else
     91  Void createAnnexFGISeiMessages( SEIMessages& seiMessage, const TComSlice* slice );;
     92#endif
    8993#endif
    9094private:
  • trunk/source/Lib/TLibEncoder/SEIwrite.cpp

    r1313 r1356  
    122122    break;
    123123#if NH_MV
     124#if !NH_MV_SEI
    124125   case SEI::SUB_BITSTREAM_PROPERTY:
    125126   xWriteSEISubBitstreamProperty(*static_cast<const SEISubBitstreamProperty*>(&sei));
    126127   break;
    127128#endif
     129#endif
     130#if NH_MV_SEI
     131#if NH_MV_LAYERS_NOT_PRESENT_SEI
     132   case SEI::LAYERS_NOT_PRESENT:
     133       xWriteSEILayersNotPresent(*static_cast<const SEILayersNotPresent*>(&sei));
     134     break;
     135#endif
     136   case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
     137     xWriteSEIInterLayerConstrainedTileSets(*static_cast<const SEIInterLayerConstrainedTileSets*>(&sei));
     138     break;
     139#if NH_MV_SEI_TBD
     140   case SEI::BSP_NESTING:
     141     xWriteSEIBspNesting(*static_cast<const SEIBspNesting*>(&sei));
     142     break;
     143   case SEI::BSP_INITIAL_ARRIVAL_TIME:
     144     xWriteSEIBspInitialArrivalTime(*static_cast<const SEIBspInitialArrivalTime*>(&sei));
     145     break;
     146#endif
     147   case SEI::SUB_BITSTREAM_PROPERTY:
     148     xWriteSEISubBitstreamProperty(*static_cast<const SEISubBitstreamProperty*>(&sei));
     149     break;
     150   case SEI::ALPHA_CHANNEL_INFO:
     151     xWriteSEIAlphaChannelInfo(*static_cast<const SEIAlphaChannelInfo*>(&sei));
     152     break;
     153   case SEI::OVERLAY_INFO:
     154     xWriteSEIOverlayInfo(*static_cast<const SEIOverlayInfo*>(&sei));
     155     break;
     156   case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS:
     157     xWriteSEITemporalMvPredictionConstraints(*static_cast<const SEITemporalMvPredictionConstraints*>(&sei));
     158     break;
     159#if NH_MV_SEI_TBD
     160   case SEI::FRAME_FIELD_INFO:
     161     xWriteSEIFrameFieldInfo(*static_cast<const SEIFrameFieldInfo*>(&sei));
     162     break;
     163#endif
     164   case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:
     165     xWriteSEIThreeDimensionalReferenceDisplaysInfo(*static_cast<const SEIThreeDimensionalReferenceDisplaysInfo*>(&sei));
     166     break;
     167#if SEI_DRI_F0169
     168   case SEI::DEPTH_REPRESENTATION_INFO:
     169       xWriteSEIDepthRepresentationInfo(*static_cast<const SEIDepthRepresentationInfo*>(&sei));
     170       break;
     171#endif
     172   case SEI::MULTIVIEW_SCENE_INFO:
     173     xWriteSEIMultiviewSceneInfo(*static_cast<const SEIMultiviewSceneInfo*>(&sei));
     174     break;
     175   case SEI::MULTIVIEW_ACQUISITION_INFO:
     176     xWriteSEIMultiviewAcquisitionInfo(*static_cast<const SEIMultiviewAcquisitionInfo*>(&sei));
     177     break;
     178
     179   case SEI::MULTIVIEW_VIEW_POSITION:
     180     xWriteSEIMultiviewViewPosition(*static_cast<const SEIMultiviewViewPosition*>(&sei));
     181     break;
     182#if NH_3D
     183   case SEI::ALTERNATIVE_DEPTH_INFO:
     184     xWriteSEIAlternativeDepthInfo(*static_cast<const SEIAlternativeDepthInfo*>(&sei));
     185     break;
     186#endif
     187#endif
     188
    128189
    129190  default:
     
    246307  for (Int i = 0; i < sei.activeSeqParameterSetId.size(); i++)
    247308  {
    248     WRITE_UVLC(sei.activeSeqParameterSetId[i], "active_seq_parameter_set_id"); 
     309    WRITE_UVLC(sei.activeSeqParameterSetId[i], "active_seq_parameter_set_id");
    249310  }
    250311}
     
    384445{
    385446  WRITE_FLAG( sei.m_arrangementCancelFlag,          "segmented_rect_frame_packing_arrangement_cancel_flag" );
    386   if( sei.m_arrangementCancelFlag == 0 ) 
     447  if( sei.m_arrangementCancelFlag == 0 )
    387448  {
    388449    WRITE_CODE( sei.m_contentInterpretationType, 2, "segmented_rect_content_interpretation_type" );
     
    553614{
    554615  //UInt code;
    555   WRITE_FLAG((sei.m_mc_all_tiles_exact_sample_value_match_flag ? 1 : 0), "mc_all_tiles_exact_sample_value_match_flag"); 
     616  WRITE_FLAG((sei.m_mc_all_tiles_exact_sample_value_match_flag ? 1 : 0), "mc_all_tiles_exact_sample_value_match_flag");
    556617  WRITE_FLAG((sei.m_each_tile_one_tile_set_flag                ? 1 : 0), "each_tile_one_tile_set_flag"               );
    557618
     
    568629
    569630        if(sei.m_limited_tile_set_display_flag)
    570         { 
    571           WRITE_FLAG((sei.tileSetData(i).m_display_tile_set_flag ? 1 : 0), "display_tile_set_flag"); 
    572         }
    573 
    574         WRITE_UVLC((sei.tileSetData(i).getNumberOfTileRects() - 1), "num_tile_rects_in_set_minus1"); 
    575        
     631        {
     632          WRITE_FLAG((sei.tileSetData(i).m_display_tile_set_flag ? 1 : 0), "display_tile_set_flag");
     633        }
     634
     635        WRITE_UVLC((sei.tileSetData(i).getNumberOfTileRects() - 1), "num_tile_rects_in_set_minus1");
     636
    576637        for(Int j = 0; j < sei.tileSetData(i).getNumberOfTileRects(); j++)
    577638        {
    578           WRITE_UVLC(sei.tileSetData(i).topLeftTileIndex    (j), "top_left_tile_index"); 
    579           WRITE_UVLC(sei.tileSetData(i).bottomRightTileIndex(j), "bottom_right_tile_index"); 
     639          WRITE_UVLC(sei.tileSetData(i).topLeftTileIndex    (j), "top_left_tile_index");
     640          WRITE_UVLC(sei.tileSetData(i).bottomRightTileIndex(j), "bottom_right_tile_index");
    580641        }
    581642
    582643        if(!sei.m_mc_all_tiles_exact_sample_value_match_flag)
    583644        {
    584           WRITE_FLAG((sei.tileSetData(i).m_exact_sample_value_match_flag ? 1 : 0), "exact_sample_value_match_flag"); 
     645          WRITE_FLAG((sei.tileSetData(i).m_exact_sample_value_match_flag ? 1 : 0), "exact_sample_value_match_flag");
    585646        }
    586647
     
    590651        {
    591652          WRITE_FLAG((sei.tileSetData(i).m_mcts_tier_flag ? 1 : 0), "mcts_tier_flag");
    592           WRITE_CODE( sei.tileSetData(i).m_mcts_level_idc, 8,       "mcts_level_idc"); 
     653          WRITE_CODE( sei.tileSetData(i).m_mcts_level_idc, 8,       "mcts_level_idc");
    593654        }
    594655      }
     
    601662    if(sei.m_max_mcs_tier_level_idc_present_flag)
    602663    {
    603       WRITE_FLAG((sei.m_max_mcts_tier_flag ? 1 : 0), "max_mcts_tier_flag"); 
    604       WRITE_CODE( sei.m_max_mcts_level_idc, 8,       "max_mcts_level_idc"); 
     664      WRITE_FLAG((sei.m_max_mcts_tier_flag ? 1 : 0), "max_mcts_tier_flag");
     665      WRITE_CODE( sei.m_max_mcts_level_idc, 8,       "max_mcts_level_idc");
    605666    }
    606667  }
     
    702763  userVerticalCoefficients[2][2] = 100;
    703764  userVerticalCoefficients[2][3] = -10;
    704  
     765
    705766  Int const iNumHorizontalFilters = 1;
    706767  Int horizontalTapLength_minus1[iNumHorizontalFilters] = {3};
     
    748809
    749810#if NH_MV
     811#if !NH_MV_SEI
    750812Void SEIWriter::xWriteSEISubBitstreamProperty(const SEISubBitstreamProperty &sei)
    751813{
     
    765827}
    766828#endif
     829#endif
    767830
    768831Void SEIWriter::xWriteSEIKneeFunctionInfo(const SEIKneeFunctionInfo &sei)
    769832{
    770833  WRITE_UVLC( sei.m_kneeId, "knee_function_id" );
    771   WRITE_FLAG( sei.m_kneeCancelFlag, "knee_function_cancel_flag" ); 
     834  WRITE_FLAG( sei.m_kneeCancelFlag, "knee_function_cancel_flag" );
    772835  if ( !sei.m_kneeCancelFlag )
    773836  {
     
    800863  WRITE_CODE( sei.values.whitePoint[0],    16,  "white_point_x" );
    801864  WRITE_CODE( sei.values.whitePoint[1],    16,  "white_point_y" );
    802    
     865
    803866  WRITE_CODE( sei.values.maxLuminance,     32,  "max_display_mastering_luminance" );
    804867  WRITE_CODE( sei.values.minLuminance,     32,  "min_display_mastering_luminance" );
     
    818881}
    819882
     883#if NH_MV_LAYERS_NOT_PRESENT_SEI
     884Void SEIWriter::xWriteSEILayersNotPresent(const SEILayersNotPresent& sei)
     885{
     886  WRITE_CODE( sei.m_lnpSeiActiveVpsId, 4, "lnp_sei_active_vps_id" );
     887  for( Int i = 0; i  <  sei.m_lnpSeiMaxLayers; i++ )
     888  {
     889    WRITE_FLAG( ( sei.m_layerNotPresentFlag[i] ? 1 : 0 ), "layer_not_present_flag" );
     890  }
     891};
     892#endif
     893
     894
     895
     896Void SEIWriter::xWriteSEIInterLayerConstrainedTileSets( const SEIInterLayerConstrainedTileSets& sei)
     897{
     898  WRITE_FLAG( ( sei.m_ilAllTilesExactSampleValueMatchFlag ? 1 : 0 ), "il_all_tiles_exact_sample_value_match_flag" );
     899  WRITE_FLAG( ( sei.m_ilOneTilePerTileSetFlag ? 1 : 0 ),             "il_one_tile_per_tile_set_flag" );
     900  if( !sei.m_ilOneTilePerTileSetFlag )
     901  {
     902    WRITE_UVLC( sei.m_ilNumSetsInMessageMinus1, "il_num_sets_in_message_minus1" );
     903    if( sei.m_ilNumSetsInMessageMinus1 )
     904    {
     905      WRITE_FLAG( ( sei.m_skippedTileSetPresentFlag ? 1 : 0 ), "skipped_tile_set_present_flag" );
     906    }
     907    Int numSignificantSets = sei.m_ilNumSetsInMessageMinus1 - sei.m_skippedTileSetPresentFlag + 1;
     908    for( Int i = 0; i < numSignificantSets; i++ )
     909    {
     910      WRITE_UVLC( sei.m_ilctsId[i],                   "ilcts_id" );
     911      WRITE_UVLC( sei.m_ilNumTileRectsInSetMinus1[i], "il_num_tile_rects_in_set_minus1" );
     912      for( Int j = 0; j  <= sei.m_ilNumTileRectsInSetMinus1[ i ]; j++ )
     913      {
     914        WRITE_UVLC( sei.m_ilTopLeftTileIndex[i][j],     "il_top_left_tile_index" );
     915        WRITE_UVLC( sei.m_ilBottomRightTileIndex[i][j], "il_bottom_right_tile_index" );
     916      }
     917      WRITE_CODE( sei.m_ilcIdc[i], 2, "ilc_idc" );
     918      if ( !sei.m_ilAllTilesExactSampleValueMatchFlag )
     919      {
     920        WRITE_FLAG( ( sei.m_ilExactSampleValueMatchFlag[i] ? 1 : 0 ), "il_exact_sample_value_match_flag" );
     921      }
     922    }
     923  }
     924  else
     925  {
     926    WRITE_CODE( sei.m_allTilesIlcIdc, 2, "all_tiles_ilc_idc" );
     927  }
     928};
     929
     930#if NH_MV_SEI_TBD
     931Void SEIWriter::xWriteSEIBspNesting( const SEIBspNesting& sei)
     932{
     933  WRITE_UVLC( sei.m_seiOlsIdx, "sei_ols_idx" );
     934  WRITE_UVLC( sei.m_seiPartitioningSchemeIdx, "sei_partitioning_scheme_idx" );
     935  WRITE_UVLC( sei.m_bspIdx, "bsp_idx" );
     936  while( !ByteaLigned(() ) );
     937  {
     938    WRITE_CODE( sei.m_bspNestingZeroBit, *equalto0*/u1, "bsp_nesting_zero_bit" );
     939  }
     940  WRITE_UVLC( sei.m_numSeisInBspMinus1, "num_seis_in_bsp_minus1" );
     941  for( Int i = 0; i  <=  NumSeisInBspMinus1( ); i++ )
     942  {
     943    SeiMessage(() );
     944  }
     945};
     946
     947Void SEIWriter::xWriteSEIBspInitialArrivalTime( const SEIBspInitialArrivalTime& sei)
     948{
     949  psIdx = SeiPartitioningSchemeIdx();
     950  if( nalInitialArrivalDelayPresent )
     951  {
     952    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
     953    {
     954      WRITE_CODE( sei.m_nalInitialArrivalDelay[i], getNalInitialArrivalDelayLen ), "nal_initial_arrival_delay" );
     955    }
     956  }
     957  if( vclInitialArrivalDelayPresent )
     958  {
     959    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
     960    {
     961      WRITE_CODE( sei.m_vclInitialArrivalDelay[i], getVclInitialArrivalDelayLen ), "vcl_initial_arrival_delay" );
     962    }
     963  }
     964};
     965#endif
     966Void SEIWriter::xWriteSEISubBitstreamProperty( const SEISubBitstreamProperty& sei)
     967{
     968  WRITE_CODE( sei.m_sbPropertyActiveVpsId, 4,      "sb_property_active_vps_id"         );
     969  WRITE_UVLC( sei.m_numAdditionalSubStreamsMinus1, "num_additional_sub_streams_minus1" );
     970  for( Int i = 0; i  <=  sei.m_numAdditionalSubStreamsMinus1; i++ )
     971  {
     972    WRITE_CODE( sei.m_subBitstreamMode    [i], 2,  "sub_bitstream_mode"       );
     973    WRITE_UVLC( sei.m_olsIdxToVps         [i],     "ols_idx_to_vps"           );
     974    WRITE_CODE( sei.m_highestSublayerId   [i], 3,  "highest_sublayer_id"      );
     975    WRITE_CODE( sei.m_avgSbPropertyBitRate[i], 16, "avg_sb_property_bit_rate" );
     976    WRITE_CODE( sei.m_maxSbPropertyBitRate[i], 16, "max_sb_property_bit_rate" );
     977  }
     978};
     979
     980Void SEIWriter::xWriteSEIAlphaChannelInfo( const SEIAlphaChannelInfo& sei)
     981{
     982  WRITE_FLAG( ( sei.m_alphaChannelCancelFlag ? 1 : 0 ), "alpha_channel_cancel_flag" );
     983  if( !sei.m_alphaChannelCancelFlag )
     984  {
     985    WRITE_CODE( sei.m_alphaChannelUseIdc, 3, "alpha_channel_use_idc" );
     986    WRITE_CODE( sei.m_alphaChannelBitDepthMinus8, 3, "alpha_channel_bit_depth_minus8" );
     987    WRITE_CODE( sei.m_alphaTransparentValue, sei.m_alphaChannelBitDepthMinus8+9, "alpha_transparent_value" );
     988    WRITE_CODE( sei.m_alphaOpaqueValue, sei.m_alphaChannelBitDepthMinus8+9, "alpha_opaque_value" );
     989    WRITE_FLAG( ( sei.m_alphaChannelIncrFlag ? 1 : 0 ), "alpha_channel_incr_flag" );
     990    WRITE_FLAG( ( sei.m_alphaChannelClipFlag ? 1 : 0 ), "alpha_channel_clip_flag" );
     991    if( sei.m_alphaChannelClipFlag )
     992    {
     993      WRITE_FLAG( ( sei.m_alphaChannelClipTypeFlag ? 1 : 0 ), "alpha_channel_clip_type_flag" );
     994    }
     995  }
     996};
     997
     998Void SEIWriter::xWriteSEIOverlayInfo( const SEIOverlayInfo& sei)
     999{
     1000  WRITE_FLAG( ( sei.m_overlayInfoCancelFlag ? 1 : 0 ), "overlay_info_cancel_flag" );
     1001  if( !sei.m_overlayInfoCancelFlag )
     1002  {
     1003    WRITE_UVLC( sei.m_overlayContentAuxIdMinus128, "overlay_content_aux_id_minus128" );
     1004    WRITE_UVLC( sei.m_overlayLabelAuxIdMinus128, "overlay_label_aux_id_minus128" );
     1005    WRITE_UVLC( sei.m_overlayAlphaAuxIdMinus128, "overlay_alpha_aux_id_minus128" );
     1006    WRITE_UVLC( sei.m_overlayElementLabelValueLengthMinus8, "overlay_element_label_value_length_minus8" );
     1007    WRITE_UVLC( sei.m_numOverlaysMinus1, "num_overlays_minus1" );
     1008    for( Int i = 0; i  <=  sei.m_numOverlaysMinus1 ; i++ )
     1009    {
     1010      WRITE_UVLC( sei.m_overlayIdx[i], "overlay_idx" );
     1011      WRITE_FLAG( ( sei.m_languageOverlayPresentFlag[i] ? 1 : 0 ), "language_overlay_present_flag" );
     1012      WRITE_CODE( sei.m_overlayContentLayerId[i], 6, "overlay_content_layer_id" );
     1013      WRITE_FLAG( ( sei.m_overlayLabelPresentFlag[i] ? 1 : 0 ), "overlay_label_present_flag" );
     1014      if( sei.m_overlayLabelPresentFlag[i] )
     1015      {
     1016        WRITE_CODE( sei.m_overlayLabelLayerId[i], 6, "overlay_label_layer_id" );
     1017      }
     1018      WRITE_FLAG( ( sei.m_overlayAlphaPresentFlag[i] ? 1 : 0 ), "overlay_alpha_present_flag" );
     1019      if( sei.m_overlayAlphaPresentFlag[i] )
     1020      {
     1021        WRITE_CODE( sei.m_overlayAlphaLayerId[i], 6, "overlay_alpha_layer_id" );
     1022      }
     1023      if( sei.m_overlayLabelPresentFlag[i] )
     1024      {
     1025        WRITE_UVLC( sei.m_numOverlayElementsMinus1[i], "num_overlay_elements_minus1" );
     1026        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1[i]; j++ )
     1027        {
     1028          WRITE_CODE( sei.m_overlayElementLabelMin[i][j], (sei.m_overlayElementLabelValueLengthMinus8 + 8), "overlay_element_label_min" );
     1029          WRITE_CODE( sei.m_overlayElementLabelMax[i][j], (sei.m_overlayElementLabelValueLengthMinus8 + 8), "overlay_element_label_max" );
     1030        }
     1031      }
     1032    }
     1033
     1034    // byte alignment
     1035    while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
     1036    {
     1037      WRITE_FLAG( 0, "overlay_zero_bit" );
     1038    }
     1039
     1040    UChar* stmp;
     1041    UInt ilength;
     1042    for( Int i = 0; i  <=  sei.m_numOverlaysMinus1; i++ )
     1043    {
     1044      if( sei.m_languageOverlayPresentFlag[i] )
     1045      {
     1046        stmp = (UChar*) strdup( sei.m_overlayLanguage[i].c_str() );
     1047        ilength = (UInt) sei.m_overlayLanguage[i].size();
     1048        WRITE_STRING( stmp, ilength, "overlay_language" );
     1049        free(stmp);
     1050      }
     1051      stmp = (UChar*) strdup( sei.m_overlayName[i].c_str() );
     1052      ilength = (UInt) sei.m_overlayName[i].size();
     1053      WRITE_STRING( stmp, ilength, "overlay_name" );
     1054      free(stmp);
     1055      if( sei.m_overlayLabelPresentFlag[i] )
     1056      {
     1057        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1[i]; j++ )
     1058        {
     1059          stmp = (UChar*) strdup( sei.m_overlayElementName[i][j].c_str() );
     1060          ilength = (UInt) sei.m_overlayElementName[i][j].size();
     1061          WRITE_STRING( stmp, ilength, "overlay_element_name" );
     1062          free(stmp);
     1063        }
     1064      }
     1065    }
     1066    WRITE_FLAG( ( sei.m_overlayInfoPersistenceFlag ? 1 : 0 ), "overlay_info_persistence_flag" );
     1067  }
     1068};
     1069
     1070Void SEIWriter::xWriteSEITemporalMvPredictionConstraints( const SEITemporalMvPredictionConstraints& sei)
     1071{
     1072  WRITE_FLAG( ( sei.m_prevPicsNotUsedFlag    ? 1 : 0 ), "prev_pics_not_used_flag"     );
     1073  WRITE_FLAG( ( sei.m_noIntraLayerColPicFlag ? 1 : 0 ), "no_intra_layer_col_pic_flag" );
     1074};
     1075
     1076#if NH_MV_SEI_TBD
     1077Void SEIWriter::xWriteSEIFrameFieldInfo( const SEIFrameFieldInfo& sei)
     1078{
     1079  WRITE_CODE( sei.m_ffinfoPicStruct, 4, "ffinfo_pic_struct" );
     1080  WRITE_CODE( sei.m_ffinfoSourceScanType, 2, "ffinfo_source_scan_type" );
     1081  WRITE_FLAG( ( sei.m_ffinfoDuplicateFlag ? 1 : 0 ), "ffinfo_duplicate_flag" );
     1082};
     1083#endif
     1084
     1085Void SEIWriter::xWriteSEIThreeDimensionalReferenceDisplaysInfo( const SEIThreeDimensionalReferenceDisplaysInfo& sei)
     1086{
     1087  WRITE_UVLC( sei.m_precRefDisplayWidth, "prec_ref_display_width" );
     1088  WRITE_FLAG( ( sei.m_refViewingDistanceFlag ? 1 : 0 ), "ref_viewing_distance_flag" );
     1089  if( sei.m_refViewingDistanceFlag )
     1090  {
     1091    WRITE_UVLC( sei.m_precRefViewingDist, "prec_ref_viewing_dist" );
     1092  }
     1093  WRITE_UVLC( sei.m_numRefDisplaysMinus1, "num_ref_displays_minus1" );
     1094  for( Int i = 0; i  <=  sei.getNumRefDisplaysMinus1( ); i++ )
     1095  {
     1096    WRITE_UVLC( sei.m_leftViewId[i], "left_view_id" );
     1097    WRITE_UVLC( sei.m_rightViewId[i], "right_view_id" );
     1098    WRITE_CODE( sei.m_exponentRefDisplayWidth[i], 6, "exponent_ref_display_width" );
     1099    WRITE_CODE( sei.m_mantissaRefDisplayWidth[i], sei.getMantissaReferenceDisplayWidthLen(i) , "mantissa_ref_display_width" );
     1100    if( sei.m_refViewingDistanceFlag )
     1101    {
     1102      WRITE_CODE( sei.m_exponentRefViewingDistance[i], 6, "exponent_ref_viewing_distance" );
     1103      WRITE_CODE( sei.m_mantissaRefViewingDistance[i], sei.getMantissaReferenceViewingDistanceLen(i), "mantissa_ref_viewing_distance" );
     1104    }
     1105    WRITE_FLAG( ( sei.m_additionalShiftPresentFlag[i] ? 1 : 0 ), "additional_shift_present_flag" );
     1106    if( sei.m_additionalShiftPresentFlag[i] )
     1107    {
     1108      WRITE_CODE( sei.m_numSampleShiftPlus512[i], 10, "num_sample_shift_plus512" );
     1109    }
     1110  }
     1111  WRITE_FLAG( ( sei.m_threeDimensionalReferenceDisplaysExtensionFlag ? 1 : 0 ), "three_dimensional_reference_displays_extension_flag" );
     1112};
     1113
     1114#if SEI_DRI_F0169
     1115Void SEIWriter::xWriteSEIDepthRepresentationInfo( const SEIDepthRepresentationInfo& sei)
     1116{
     1117
     1118    assert(sei.m_currLayerID>=0);
     1119
     1120    WRITE_FLAG( ( sei.m_zNearFlag[sei.m_currLayerID] ? 1 : 0 ), "z_near_flag" );
     1121    WRITE_FLAG( ( sei.m_zFarFlag[sei.m_currLayerID] ? 1 : 0 ), "z_far_flag" );
     1122    WRITE_FLAG( ( sei.m_dMinFlag[sei.m_currLayerID] ? 1 : 0 ), "d_min_flag" );
     1123    WRITE_FLAG( ( sei.m_dMaxFlag[sei.m_currLayerID] ? 1 : 0 ), "d_max_flag" );
     1124    WRITE_UVLC( sei.m_depthRepresentationType[sei.m_currLayerID][0], "depth_representation_type" );
     1125    if( sei.m_dMinFlag[sei.m_currLayerID]  ||  sei.m_dMaxFlag[sei.m_currLayerID] )
     1126    {
     1127        WRITE_UVLC( sei.m_disparityRefViewId[sei.m_currLayerID][0], "disparity_ref_view_id" );
     1128    }
     1129    if( sei.m_zNearFlag[sei.m_currLayerID] )
     1130    {
     1131        xWriteSEIDepthRepInfoElement(sei.m_zNear[sei.m_currLayerID][0]);
     1132    }
     1133    if( sei.m_zFarFlag[sei.m_currLayerID] )
     1134    {
     1135        xWriteSEIDepthRepInfoElement(sei.m_zFar[sei.m_currLayerID][0]);
     1136    }
     1137    if( sei.m_dMinFlag[sei.m_currLayerID] )
     1138    {
     1139        xWriteSEIDepthRepInfoElement(sei.m_dMin[sei.m_currLayerID][0]);
     1140    }
     1141    if( sei.m_dMaxFlag[sei.m_currLayerID] )
     1142    {
     1143        xWriteSEIDepthRepInfoElement(sei.m_dMax[sei.m_currLayerID][0]);
     1144    }
     1145
     1146    if (sei.m_depthRepresentationType[sei.m_currLayerID][0] == 3)
     1147    {
     1148        WRITE_UVLC( sei.m_depthNonlinearRepresentationNumMinus1[sei.m_currLayerID][0], "depth_nonlinear_representation_num_minus1" );
     1149        for( Int i = 1; i  <=  sei.m_depthNonlinearRepresentationNumMinus1[sei.m_currLayerID][0] + 1; i++ )
     1150        {
     1151            WRITE_UVLC(sei.m_depth_nonlinear_representation_model[sei.m_currLayerID][i-1],"depth_nonlinear_representation_model[ i ]");
     1152        }
     1153    }
     1154}
     1155
     1156Void SEIWriter::xWriteSEIDepthRepInfoElement( double f)
     1157{
     1158    UInt x_sign, x_exp, x_mantissa,x_mantissa_len;
     1159    if (f < 0)
     1160    {
     1161        f = f * (-1);
     1162        x_sign = 1;
     1163    }
     1164    else
     1165    {
     1166        x_sign = 0;
     1167    }
     1168    int exponent=0;
     1169    if(f >= 1)
     1170    {
     1171        while(f>=2)
     1172        {
     1173            exponent++;
     1174            f = f/2;
     1175        }
     1176    }
     1177    else
     1178    {
     1179        while (f<1)
     1180        {
     1181            exponent++;
     1182            f = f*2;
     1183        }
     1184        exponent=-exponent;
     1185    }
     1186
     1187    int i;
     1188    f = f -1;
     1189    double s = 1;
     1190    char s_mantissa[32];
     1191    double thr=1.0/(4.0*(1<<30));
     1192
     1193    if (f>=thr)
     1194    {
     1195        for(i=0;i<32;i++)
     1196        {
     1197            s /= 2;
     1198            if(f>=s)
     1199            {
     1200                f = f-s;
     1201                s_mantissa[i]=1;
     1202
     1203                if (f<thr)
     1204                    break;
     1205            }
     1206            else
     1207            {
     1208                s_mantissa[i]=0;
     1209            }
     1210        }
     1211
     1212        if (i<32)
     1213            x_mantissa_len=i+1;
     1214        else
     1215            x_mantissa_len=32;
     1216
     1217        x_mantissa=0;
     1218
     1219        for(i=0;i<x_mantissa_len;i++)
     1220        {
     1221            if (s_mantissa[i]==1)
     1222                x_mantissa += (1u)<<(x_mantissa_len-1-i) ;
     1223        }
     1224
     1225    }
     1226    else
     1227    {
     1228        x_mantissa=0;
     1229        x_mantissa_len=1;
     1230    }
     1231
     1232    assert(exponent>=-31 && exponent<= (1<<7)-32);
     1233    x_exp=exponent+31;
     1234
     1235    WRITE_FLAG(  x_sign,                         "da_sign_flag" );
     1236    WRITE_CODE(  x_exp, 7 ,                      "da_exponent" );
     1237    WRITE_CODE( x_mantissa_len-1, 5 ,            "da_mantissa_len_minus1" );
     1238    WRITE_CODE( x_mantissa, x_mantissa_len ,     "da_mantissa" );
     1239
     1240};
     1241#endif
     1242Void SEIWriter::xWriteSEIMultiviewSceneInfo( const SEIMultiviewSceneInfo& sei)
     1243{
     1244  WRITE_SVLC( sei.m_minDisparity     , "min_disparity"       );
     1245  WRITE_UVLC( sei.m_maxDisparityRange, "max_disparity_range" );
     1246};
     1247
     1248
     1249Void SEIWriter::xWriteSEIMultiviewAcquisitionInfo( const SEIMultiviewAcquisitionInfo& sei)
     1250{
     1251  WRITE_FLAG( ( sei.m_intrinsicParamFlag ? 1 : 0 ), "intrinsic_param_flag" );
     1252  WRITE_FLAG( ( sei.m_extrinsicParamFlag ? 1 : 0 ), "extrinsic_param_flag" );
     1253  if( sei.m_intrinsicParamFlag )
     1254  {
     1255    WRITE_FLAG( ( sei.m_intrinsicParamsEqualFlag ? 1 : 0 ), "intrinsic_params_equal_flag" );
     1256    WRITE_UVLC(   sei.m_precFocalLength                   , "prec_focal_length"           );
     1257    WRITE_UVLC(   sei.m_precPrincipalPoint                , "prec_principal_point"        );
     1258    WRITE_UVLC(   sei.m_precSkewFactor                    , "prec_skew_factor"            );
     1259
     1260    for( Int i = 0; i  <=  ( sei.m_intrinsicParamsEqualFlag ? 0 : sei.getNumViewsMinus1() ); i++ )
     1261    {
     1262      WRITE_FLAG( ( sei.m_signFocalLengthX       [i] ? 1 : 0 ),                                         "sign_focal_length_x"        );
     1263      WRITE_CODE(   sei.m_exponentFocalLengthX   [i]          , 6                                  ,    "exponent_focal_length_x"    );
     1264      WRITE_CODE(   sei.m_mantissaFocalLengthX   [i]          , sei.getMantissaFocalLengthXLen( i ),    "mantissa_focal_length_x"    );
     1265      WRITE_FLAG( ( sei.m_signFocalLengthY       [i] ? 1 : 0 ),                                         "sign_focal_length_y"        );
     1266      WRITE_CODE(   sei.m_exponentFocalLengthY   [i]          , 6                                  ,    "exponent_focal_length_y"    );
     1267      WRITE_CODE(   sei.m_mantissaFocalLengthY   [i]          , sei.getMantissaFocalLengthYLen( i ),    "mantissa_focal_length_y"    );
     1268      WRITE_FLAG( ( sei.m_signPrincipalPointX    [i] ? 1 : 0 ),                                         "sign_principal_point_x"     );
     1269      WRITE_CODE(   sei.m_exponentPrincipalPointX[i]          , 6,                                      "exponent_principal_point_x" );
     1270      WRITE_CODE(   sei.m_mantissaPrincipalPointX[i]          , sei.getMantissaPrincipalPointXLen( i ), "mantissa_principal_point_x" );
     1271      WRITE_FLAG( ( sei.m_signPrincipalPointY    [i] ? 1 : 0 ),                                         "sign_principal_point_y"     );
     1272      WRITE_CODE(   sei.m_exponentPrincipalPointY[i]          , 6,                                      "exponent_principal_point_y" );
     1273      WRITE_CODE(   sei.m_mantissaPrincipalPointY[i]          , sei.getMantissaPrincipalPointYLen( i ), "mantissa_principal_point_y" );
     1274      WRITE_FLAG( ( sei.m_signSkewFactor         [i] ? 1 : 0 ),                                         "sign_skew_factor"           );
     1275      WRITE_CODE(   sei.m_exponentSkewFactor     [i]          , 6,                                      "exponent_skew_factor"       );
     1276      WRITE_CODE(   sei.m_mantissaSkewFactor     [i]          , sei.getMantissaSkewFactorLen( i )  ,    "mantissa_skew_factor"       );
     1277    }
     1278  }
     1279  if( sei.m_extrinsicParamFlag )
     1280  {
     1281    WRITE_UVLC( sei.m_precRotationParam   , "prec_rotation_param"    );
     1282    WRITE_UVLC( sei.m_precTranslationParam, "prec_translation_param" );
     1283    for( Int i = 0; i  <=  sei.getNumViewsMinus1(); i++ )
     1284    {
     1285      for( Int j = 0; j  <=  2; j++ )  /* row */
     1286      {
     1287        for( Int k = 0; k  <=  2; k++ )  /* column */
     1288        {
     1289          WRITE_FLAG( ( sei.m_signR    [i][j][k] ? 1 : 0 ),                                "sign_r"     );
     1290          WRITE_CODE(   sei.m_exponentR[i][j][k]          , 6,                             "exponent_r" );
     1291          WRITE_CODE(   sei.m_mantissaR[i][j][k]          , sei.getMantissaRLen( i,j,k ) , "mantissa_r" );
     1292        }
     1293        WRITE_FLAG( ( sei.m_signT    [i][j] ? 1 : 0 ),                          "sign_t"     );
     1294        WRITE_CODE(   sei.m_exponentT[i][j]          , 6,                       "exponent_t" );
     1295        WRITE_CODE(   sei.m_mantissaT[i][j]          , sei.getMantissaTLen( i,j ),"mantissa_t" );
     1296      }
     1297    }
     1298  }
     1299};
     1300
     1301
     1302#if NH_MV_SEI
     1303Void SEIWriter::xWriteSEIMultiviewViewPosition( const SEIMultiviewViewPosition& sei)
     1304{
     1305  WRITE_UVLC( sei.m_numViewsMinus1, "num_views_minus1" );
     1306  for( Int i = 0; i  <=  sei.m_numViewsMinus1; i++ )
     1307  {
     1308    WRITE_UVLC( sei.m_viewPosition[i], "view_position" );
     1309  }
     1310};
     1311#endif
     1312
     1313#if NH_3D
     1314Void SEIWriter::xWriteSEIAlternativeDepthInfo( const SEIAlternativeDepthInfo& sei)
     1315{
     1316  WRITE_FLAG( ( sei.m_alternativeDepthInfoCancelFlag ? 1 : 0 ), "alternative_depth_info_cancel_flag" );
     1317  if( sei.m_alternativeDepthInfoCancelFlag  ==  0 )
     1318  {
     1319    WRITE_CODE( sei.m_depthType, 2, "depth_type" );
     1320
     1321    if( sei.m_depthType  ==  0 )
     1322    {
     1323      WRITE_UVLC( sei.m_numConstituentViewsGvdMinus1, "num_constituent_views_gvd_minus1" );
     1324      WRITE_FLAG( ( sei.m_depthPresentGvdFlag ? 1 : 0 ), "depth_present_gvd_flag" );
     1325      WRITE_FLAG( ( sei.m_zGvdFlag ? 1 : 0 ), "z_gvd_flag" );
     1326      WRITE_FLAG( ( sei.m_intrinsicParamGvdFlag ? 1 : 0 ), "intrinsic_param_gvd_flag" );
     1327      WRITE_FLAG( ( sei.m_rotationGvdFlag ? 1 : 0 ), "rotation_gvd_flag" );
     1328      WRITE_FLAG( ( sei.m_translationGvdFlag ? 1 : 0 ), "translation_gvd_flag" );
     1329      if( sei.m_zGvdFlag )
     1330      {
     1331        for( Int i = 0, j = 0; j  <=  sei.m_numConstituentViewsGvdMinus1 + 1; j++ )
     1332        {
     1333          WRITE_FLAG( ( sei.m_signGvdZNearFlag[i][j] ? 1 : 0 ), "sign_gvd_z_near_flag" );
     1334          WRITE_CODE( sei.m_expGvdZNear[i][j], 7, "exp_gvd_z_near" );
     1335          WRITE_CODE( sei.m_manLenGvdZNearMinus1[i][j], 5, "man_len_gvd_z_near_minus1" );
     1336          WRITE_CODE( sei.m_manGvdZNear[i][j], sei.m_manLenGvdZNearMinus1[i][j] + 1, "man_gvd_z_near" );
     1337          WRITE_FLAG( ( sei.m_signGvdZFarFlag[i][j] ? 1 : 0 ), "sign_gvd_z_far_flag" );
     1338          WRITE_CODE( sei.m_expGvdZFar[i][j], 7, "exp_gvd_z_far" );
     1339          WRITE_CODE( sei.m_manLenGvdZFarMinus1[i][j], 5, "man_len_gvd_z_far_minus1" );
     1340          WRITE_CODE( sei.m_manGvdZFar[i][j], sei.m_manLenGvdZFarMinus1[i][j] + 1, "man_gvd_z_far" );
     1341        }
     1342      }
     1343      if( sei.m_intrinsicParamGvdFlag )
     1344      {
     1345        WRITE_UVLC( sei.m_precGvdFocalLength, "prec_gvd_focal_length" );
     1346        WRITE_UVLC( sei.m_precGvdPrincipalPoint, "prec_gvd_principal_point" );
     1347      }
     1348      if( sei.m_rotationGvdFlag )
     1349      {
     1350        WRITE_UVLC( sei.m_precGvdRotationParam, "prec_gvd_rotation_param" );
     1351      }
     1352      if( sei.m_translationGvdFlag )
     1353      {
     1354        WRITE_UVLC( sei.m_precGvdTranslationParam, "prec_gvd_translation_param" );
     1355      }
     1356      for( Int i = 0, j = 0; j  <=  sei.m_numConstituentViewsGvdMinus1 + 1; j++ )
     1357      {
     1358        if( sei.m_intrinsicParamGvdFlag )
     1359        {
     1360          WRITE_FLAG( ( sei.m_signGvdFocalLengthX[i][j] ? 1 : 0 ), "sign_gvd_focal_length_x" );
     1361          WRITE_CODE( sei.m_expGvdFocalLengthX[i][j], 6, "exp_gvd_focal_length_x" );
     1362          WRITE_CODE( sei.m_manGvdFocalLengthX[i][j], sei.getManGvdFocalLengthXLen(i,j), "man_gvd_focal_length_x" );
     1363          WRITE_FLAG( ( sei.m_signGvdFocalLengthY[i][j] ? 1 : 0 ), "sign_gvd_focal_length_y" );
     1364          WRITE_CODE( sei.m_expGvdFocalLengthY[i][j], 6, "exp_gvd_focal_length_y" );
     1365          WRITE_CODE( sei.m_manGvdFocalLengthY[i][j], sei.getManGvdFocalLengthYLen(i,j), "man_gvd_focal_length_y" );
     1366          WRITE_FLAG( ( sei.m_signGvdPrincipalPointX[i][j] ? 1 : 0 ), "sign_gvd_principal_point_x" );
     1367          WRITE_CODE( sei.m_expGvdPrincipalPointX[i][j], 6, "exp_gvd_principal_point_x" );
     1368          WRITE_CODE( sei.m_manGvdPrincipalPointX[i][j], sei.getManGvdPrincipalPointXLen(i,j), "man_gvd_principal_point_x" );
     1369          WRITE_FLAG( ( sei.m_signGvdPrincipalPointY[i][j] ? 1 : 0 ), "sign_gvd_principal_point_y" );
     1370          WRITE_CODE( sei.m_expGvdPrincipalPointY[i][j], 6, "exp_gvd_principal_point_y" );
     1371          WRITE_CODE( sei.m_manGvdPrincipalPointY[i][j], sei.getManGvdPrincipalPointYLen(i,j), "man_gvd_principal_point_y" );
     1372        }
     1373        if( sei.m_rotationGvdFlag )
     1374        {
     1375          WRITE_FLAG( ( sei.m_signGvdR00[i][j] ? 1 : 0 ), "sign_gvd_r00" );
     1376          WRITE_CODE( sei.m_expGvdR00[i][j], 6, "exp_gvd_r00" );
     1377          WRITE_CODE( sei.m_manGvdR00[i][j], sei.m_precGvdRotationParam, "man_gvd_r00" );
     1378          WRITE_FLAG( ( sei.m_signGvdR01[i][j] ? 1 : 0 ), "sign_gvd_r01" );
     1379          WRITE_CODE( sei.m_expGvdR01[i][j], 6, "exp_gvd_r01" );
     1380          WRITE_CODE( sei.m_manGvdR01[i][j], sei.m_precGvdRotationParam, "man_gvd_r01" );
     1381          WRITE_FLAG( ( sei.m_signGvdR02[i][j] ? 1 : 0 ), "sign_gvd_r02" );
     1382          WRITE_CODE( sei.m_expGvdR02[i][j], 6, "exp_gvd_r02" );
     1383          WRITE_CODE( sei.m_manGvdR02[i][j], sei.m_precGvdRotationParam, "man_gvd_r02" );
     1384          WRITE_FLAG( ( sei.m_signGvdR10[i][j] ? 1 : 0 ), "sign_gvd_r10" );
     1385          WRITE_CODE( sei.m_expGvdR10[i][j], 6, "exp_gvd_r10" );
     1386          WRITE_CODE( sei.m_manGvdR10[i][j], sei.m_precGvdRotationParam, "man_gvd_r10" );
     1387          WRITE_FLAG( ( sei.m_signGvdR11[i][j] ? 1 : 0 ), "sign_gvd_r11" );
     1388          WRITE_CODE( sei.m_expGvdR11[i][j], 6, "exp_gvd_r11" );
     1389          WRITE_CODE( sei.m_manGvdR11[i][j], sei.m_precGvdRotationParam, "man_gvd_r11" );
     1390          WRITE_FLAG( ( sei.m_signGvdR12[i][j] ? 1 : 0 ), "sign_gvd_r12" );
     1391          WRITE_CODE( sei.m_expGvdR12[i][j], 6, "exp_gvd_r12" );
     1392          WRITE_CODE( sei.m_manGvdR12[i][j], sei.m_precGvdRotationParam, "man_gvd_r12" );
     1393          WRITE_FLAG( ( sei.m_signGvdR20[i][j] ? 1 : 0 ), "sign_gvd_r20" );
     1394          WRITE_CODE( sei.m_expGvdR20[i][j], 6, "exp_gvd_r20" );
     1395          WRITE_CODE( sei.m_manGvdR20[i][j], sei.m_precGvdRotationParam, "man_gvd_r20" );
     1396          WRITE_FLAG( ( sei.m_signGvdR21[i][j] ? 1 : 0 ), "sign_gvd_r21" );
     1397          WRITE_CODE( sei.m_expGvdR21[i][j], 6, "exp_gvd_r21" );
     1398          WRITE_CODE( sei.m_manGvdR21[i][j], sei.m_precGvdRotationParam, "man_gvd_r21" );
     1399          WRITE_FLAG( ( sei.m_signGvdR22[i][j] ? 1 : 0 ), "sign_gvd_r22" );
     1400          WRITE_CODE( sei.m_expGvdR22[i][j], 6, "exp_gvd_r22" );
     1401          WRITE_CODE( sei.m_manGvdR22[i][j], sei.m_precGvdRotationParam, "man_gvd_r22" );
     1402        }
     1403        if( sei.m_translationGvdFlag )
     1404        {
     1405          WRITE_FLAG( ( sei.m_signGvdTX[i][j] ? 1 : 0 ), "sign_gvd_t_x" );
     1406          WRITE_CODE( sei.m_expGvdTX[i][j], 6, "exp_gvd_t_x" );
     1407          WRITE_CODE( sei.m_manGvdTX[i][j], sei.getManGvdTXLen(i,j), "man_gvd_t_x" );
     1408        }
     1409      }
     1410    }
     1411
     1412    if( sei.m_depthType  ==  1 )
     1413    {
     1414      WRITE_SVLC( sei.m_minOffsetXInt, "min_offset_x_int" );
     1415      WRITE_CODE( sei.m_minOffsetXFrac, 8, "min_offset_x_frac" );
     1416      WRITE_SVLC( sei.m_maxOffsetXInt, "max_offset_x_int" );
     1417      WRITE_CODE( sei.m_maxOffsetXFrac, 8, "max_offset_x_frac" );
     1418      WRITE_FLAG( ( sei.m_offsetYPresentFlag ? 1 : 0 ), "offset_y_present_flag" );
     1419      if( sei.m_offsetYPresentFlag )
     1420      {
     1421        WRITE_SVLC( sei.m_minOffsetYInt, "min_offset_y_int" );
     1422        WRITE_CODE( sei.m_minOffsetYFrac, 8, "min_offset_y_frac" );
     1423        WRITE_SVLC( sei.m_maxOffsetYInt, "max_offset_y_int" );
     1424        WRITE_CODE( sei.m_maxOffsetYFrac, 8, "max_offset_y_frac" );
     1425      }
     1426      WRITE_FLAG( ( sei.m_warpMapSizePresentFlag ? 1 : 0 ), "warp_map_size_present_flag" );
     1427      if( sei.m_warpMapSizePresentFlag )
     1428      {
     1429        WRITE_UVLC( sei.m_warpMapWidthMinus2, "warp_map_width_minus2" );
     1430        WRITE_UVLC( sei.m_warpMapHeightMinus2, "warp_map_height_minus2" );
     1431      }
     1432    }
     1433  }
     1434};
     1435#endif
     1436
     1437
    8201438//! \}
  • trunk/source/Lib/TLibEncoder/SEIwrite.h

    r1313 r1356  
    7272  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, const TComSPS *sps);
    7373#if NH_MV
     74#if !NH_MV_SEI
    7475  Void xWriteSEISubBitstreamProperty(const SEISubBitstreamProperty &sei);
     76#endif
    7577#endif
    7678  Void xWriteSEITempMotionConstrainedTileSets(const SEITempMotionConstrainedTileSets& sei);
     
    8183  Void xWriteSEIMasteringDisplayColourVolume( const SEIMasteringDisplayColourVolume& sei);
    8284
     85#if NH_MV_SEI
     86#if NH_MV_LAYERS_NOT_PRESENT_SEI
     87  Void xWriteSEILayersNotPresent              ( const SEILayersNotPresent& sei);
     88#endif
     89  Void xWriteSEIInterLayerConstrainedTileSets ( const SEIInterLayerConstrainedTileSets& sei);
     90#if NH_MV_SEI_TBD
     91  Void xWriteSEIBspNesting                    ( const SEIBspNesting& sei);
     92  Void xWriteSEIBspInitialArrivalTime         ( const SEIBspInitialArrivalTime& sei);
     93#endif
     94  Void xWriteSEISubBitstreamProperty          ( const SEISubBitstreamProperty& sei);
     95  Void xWriteSEIAlphaChannelInfo              ( const SEIAlphaChannelInfo& sei);
     96  Void xWriteSEIOverlayInfo                   ( const SEIOverlayInfo& sei);
     97  Void xWriteSEITemporalMvPredictionConstraints ( const SEITemporalMvPredictionConstraints& sei);
     98#if NH_MV_SEI_TBD
     99  Void xWriteSEIFrameFieldInfo                ( const SEIFrameFieldInfo& sei);
     100#endif
     101  Void xWriteSEIThreeDimensionalReferenceDisplaysInfo ( const SEIThreeDimensionalReferenceDisplaysInfo& sei);
     102#if SEI_DRI_F0169
     103  Void xWriteSEIDepthRepInfoElement           ( double f);
     104  Void xWriteSEIDepthRepresentationInfo       ( const SEIDepthRepresentationInfo& sei);
     105#endif
     106  Void xWriteSEIMultiviewSceneInfo            ( const SEIMultiviewSceneInfo& sei);
     107  Void xWriteSEIMultiviewAcquisitionInfo      ( const SEIMultiviewAcquisitionInfo& sei);
     108  Void xWriteSEIMultiviewViewPosition         ( const SEIMultiviewViewPosition& sei);
     109#if NH_3D
     110  Void xWriteSEIAlternativeDepthInfo          ( const SEIAlternativeDepthInfo& sei);
     111#endif
    83112  Void xWriteByteAlign();
    84113};
     114#endif
    85115
    86116//! \}
  • trunk/source/Lib/TLibEncoder/SyntaxElementWriter.cpp

    r1313 r1356  
    127127}
    128128
     129Void  SyntaxElementWriter::xWriteStringTr( UChar* value, UInt length, const Char *pSymbolName)
     130{
     131  xWriteString(value, length);
     132  if( g_HLSTraceEnable )
     133  {
     134    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
     135    fprintf( g_hTrace, "%-50s st(v=%d)  : %s\n", pSymbolName, length, value );
     136  }
     137}
     138
    129139#endif
    130140
     
    166176}
    167177
     178Void  SyntaxElementWriter::xWriteString( UChar* sCode, UInt uiLength)
     179{
     180  assert(m_pcBitIf->getNumberOfWrittenBits() % 8 == 0 );
     181  for (Int i=0 ; i<uiLength; i++)
     182  {
     183    m_pcBitIf->write( sCode[i], 8 );
     184  }
     185  m_pcBitIf->write( 0, 8 ); //zero-termination byte
     186}
     187
    168188Void SyntaxElementWriter::xWriteRbspTrailingBits()
    169189{
  • trunk/source/Lib/TLibEncoder/SyntaxElementWriter.h

    r1313 r1356  
    5656#define WRITE_SVLC( value,         name)    xWriteSvlcTr ( value,         name )
    5757#define WRITE_FLAG( value,         name)    xWriteFlagTr ( value,         name )
     58#define WRITE_STRING( value, length, name)   xWriteStringTr( value, length, name )
    5859
    5960#else
     
    6364#define WRITE_SVLC( value,         name)     xWriteSvlc ( value )
    6465#define WRITE_FLAG( value,         name)     xWriteFlag ( value )
     66#define WRITE_STRING( value, length, name)   xWriteString( value, length )
    6567
    6668#endif
     
    8284  Void  xWriteSvlc            ( Int  iCode   );
    8385  Void  xWriteFlag            ( UInt uiCode );
     86  Void  xWriteString          ( UChar* sCode, UInt uiLength);
    8487#if ENC_DEC_TRACE
    8588  Void  xWriteCodeTr          ( UInt value, UInt  length, const Char *pSymbolName);
     
    8790  Void  xWriteSvlcTr          ( Int  value,               const Char *pSymbolName);
    8891  Void  xWriteFlagTr          ( UInt value,               const Char *pSymbolName);
     92  Void  xWriteStringTr        ( UChar* value, UInt length, const Char *pSymbolName);
    8993#endif
    9094  Void xWriteRbspTrailingBits();
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r1313 r1356  
    4949#include "TAppCommon/TAppComCamPara.h"
    5050#include "TLibRenderer/TRenModSetupStrParser.h"
     51#endif
     52
     53#if NH_MV
     54#include "TLibCommon/SEI.h"
    5155#endif
    5256
     
    350354  Int*      m_kneeSEIOutputKneePoint;
    351355  TComSEIMasteringDisplay m_masteringDisplay;
     356#if NH_MV_SEI
     357  SEIMessages* m_seiMessages;
     358#endif
    352359  //====== Weighted Prediction ========
    353360  Bool      m_useWeightedPred;       //< Use of Weighting Prediction (P_SLICE)
     
    432439
    433440#if NH_MV
     441#if !NH_MV_SEI
    434442  Bool              m_subBistreamPropSEIEnabled;
    435443  Int               m_numAdditionalSubStreams;
     
    439447  std::vector<Int>  m_avgBitRate;
    440448  std::vector<Int>  m_maxBitRate;
     449#endif
    441450#endif
    442451
     
    933942  const TComSEIMasteringDisplay &getMasteringDisplaySEI() const      { return m_masteringDisplay; }
    934943#if NH_MV
     944#if NH_MV_SEI
     945  Void setSeiMessages(SEIMessages *p)                                { m_seiMessages = p;    }
     946  const SEIMessages*  getSeiMessages()                               { return m_seiMessages; }
     947#else
    935948  Bool   getSubBitstreamPropSEIEnabled()                             { return m_subBistreamPropSEIEnabled;}
    936949  Void   setSubBitstreamPropSEIEnabled(Bool x)                       { m_subBistreamPropSEIEnabled = x;}
     
    958971  Int   getMaxBitRate(Int idx)                                       { return m_maxBitRate[idx];}
    959972  Void  setMaxBitRate(std::vector<Int> &x)                           { m_maxBitRate = x;}
    960 
     973#endif
    961974#endif
    962975
  • trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r1321 r1356  
    100100  m_layerId      = 0;
    101101  m_viewId       = 0;
    102   m_pocLastCoded = -1; 
     102  m_pocLastCoded = -1;
    103103#if NH_3D
    104   m_viewIndex  =   0; 
     104  m_viewIndex  =   0;
    105105  m_isDepth = false;
    106106#endif
     
    147147
    148148#if NH_MV
    149   m_ivPicLists           = pcTEncTop->getIvPicLists(); 
     149  m_ivPicLists           = pcTEncTop->getIvPicLists();
    150150  m_layerId              = pcTEncTop->getLayerId();
    151151  m_viewId               = pcTEncTop->getViewId();
     
    156156#endif
    157157#if NH_3D_IC
    158   m_aICEnableCandidate   = pcTEncTop->getICEnableCandidate(); 
    159   m_aICEnableNum         = pcTEncTop->getICEnableNum(); 
     158  m_aICEnableCandidate   = pcTEncTop->getICEnableCandidate();
     159  m_aICEnableNum         = pcTEncTop->getICEnableNum();
    160160#endif
    161161#if KWU_FIX_URQ
     
    207207#if NH_MV
    208208  if ( getLayerId() == 0 )
    209   { 
     209  {
    210210    actualTotalBits += xWriteVPS(accessUnit, m_pcEncTop->getVPS());
    211211  }
     
    277277
    278278  while ( (itNalu!=accessUnit.end())&&
    279     ( (*itNalu)->m_nalUnitType==NAL_UNIT_ACCESS_UNIT_DELIMITER 
     279    ( (*itNalu)->m_nalUnitType==NAL_UNIT_ACCESS_UNIT_DELIMITER
    280280    || (*itNalu)->m_nalUnitType==NAL_UNIT_VPS
    281281    || (*itNalu)->m_nalUnitType==NAL_UNIT_SPS
     
    288288  SEIMessages localMessages = seiMessages;
    289289  SEIMessages currentMessages;
    290  
     290
    291291#if ENC_DEC_TRACE
    292292  g_HLSTraceEnable = !testWrite;
     
    299299  xWriteSEI(NAL_UNIT_PREFIX_SEI, currentMessages, accessUnit, itNalu, temporalId, sps);
    300300  xClearSEIs(currentMessages, !testWrite);
    301  
     301
    302302  // Buffering period SEI must always be following active parameter sets
    303303  currentMessages = extractSeisByType(localMessages, SEI::BUFFERING_PERIOD);
     
    328328  xWriteSEISeparately(NAL_UNIT_PREFIX_SEI, currentMessages, accessUnit, itNalu, temporalId, sps);
    329329  xClearSEIs(currentMessages, !testWrite);
     330
     331#if NH_MV_LAYERS_NOT_PRESENT_SEI
     332  // Layers not present SEI message
     333  currentMessages = extractSeisByType(localMessages, SEI::LAYERS_NOT_PRESENT);
     334  xWriteSEISeparately(NAL_UNIT_PREFIX_SEI, currentMessages, accessUnit, itNalu, temporalId, sps);
     335  xClearSEIs(currentMessages, !testWrite);
     336#endif
    330337
    331338  // And finally everything else one by one
     
    412419Void TEncGOP::xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const TComSPS *sps, const TComPPS *pps)
    413420{
    414 #if NH_MV
    415   OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, 0, getLayerId());
    416 #else
    417421  OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    418 #endif
     422
    419423  if(m_pcCfg->getActiveParameterSetsSEIEnabled())
    420424  {
     
    472476    seiMessages.push_back(sei);
    473477  }
    474    
     478
    475479  if(m_pcCfg->getMasteringDisplaySEI().colourVolumeSEIEnabled)
    476480  {
     
    482486
    483487#if NH_MV
     488#if !NH_MV_SEI
    484489  if( m_pcCfg->getSubBitstreamPropSEIEnabled() && ( getLayerId() == 0 ) )
    485490  {
    486491    SEISubBitstreamProperty *sei = new SEISubBitstreamProperty;
    487     m_seiEncoder.initSEISubBitstreamProperty( sei, sps );   
     492    m_seiEncoder.initSEISubBitstreamProperty( sei, sps );
    488493    seiMessages.push_back(sei);
    489494  }
     495#endif
    490496#endif
    491497}
     
    679685      }
    680686    }
    681    
     687
    682688    if( m_pcCfg->getPictureTimingSEIEnabled() )
    683689    {
     
    715721    return;
    716722  }
    717   // fix first 
     723  // fix first
    718724  UInt numNalUnits = (UInt)testAU.size();
    719725  UInt numRBSPBytes = 0;
     
    927933          IRAPGOPid = iGOPid;
    928934          IRAPtoReorder = true;
    929           swapIRAPForward = true; 
     935          swapIRAPForward = true;
    930936          break;
    931937        }
     
    935941          IRAPGOPid = iGOPid;
    936942          IRAPtoReorder = true;
    937           swapIRAPForward = false; 
     943          swapIRAPForward = false;
    938944          break;
    939945        }
     
    10661072#endif
    10671073#if NH_MV
    1068 Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, 
    1069                                 TComList<TComPicYuv*>& rcListPicYuvRecOut,  std::list<AccessUnit>& accessUnitsInGOP, 
     1074Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic,
     1075                                TComList<TComPicYuv*>& rcListPicYuvRecOut,  std::list<AccessUnit>& accessUnitsInGOP,
    10701076                                Bool isField, Bool isTff, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE, Int iGOPid )
    10711077#else
     
    11701176    pcPic->setCurrSliceIdx(0);
    11711177#if NH_MV
    1172     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iGOPid, pcSlice, m_pcEncTop->getVPS(), getLayerId(), isField  );     
     1178    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iGOPid, pcSlice, m_pcEncTop->getVPS(), getLayerId(), isField  );
    11731179#else
    11741180    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iGOPid, pcSlice, isField );
     
    11811187    pcSlice->setSliceIdx(0);
    11821188#if NH_MV
    1183     pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer0, &m_refPicSetInterLayer1 ); 
     1189    pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer0, &m_refPicSetInterLayer1 );
    11841190    pcPic  ->setLayerId     ( getLayerId()   );
    1185     pcPic  ->setViewId      ( getViewId()    );   
     1191    pcPic  ->setViewId      ( getViewId()    );
    11861192#if !NH_3D
    11871193    pcSlice->setLayerId     ( getLayerId() );
    1188     pcSlice->setViewId      ( getViewId()  );   
     1194    pcSlice->setViewId      ( getViewId()  );
    11891195    pcSlice->setVPS         ( m_pcEncTop->getVPS() );
    11901196#else
    1191     pcPic  ->setViewIndex   ( getViewIndex() ); 
     1197    pcPic  ->setViewIndex   ( getViewIndex() );
    11921198    pcPic  ->setIsDepth( getIsDepth() );
    1193     pcSlice->setCamparaSlice( pcPic->getCodedScale(), pcPic->getCodedOffset() );   
    1194 #endif
    1195 #endif 
     1199    pcSlice->setCamparaSlice( pcPic->getCodedScale(), pcPic->getCodedOffset() );
     1200#endif
     1201#endif
    11961202    //set default slice level flag to the same as SPS level flag
    11971203    pcSlice->setLFCrossSliceBoundaryFlag(  pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()  );
     
    12011207    if( pcSlice->getSliceType() == B_SLICE )
    12021208    {
    1203       if( m_pcCfg->getGOPEntry( ( pcSlice->getRapPicFlag() && getLayerId() > 0 ) ? MAX_GOP : iGOPid ).m_sliceType == 'P' ) 
    1204       { 
     1209      if( m_pcCfg->getGOPEntry( ( pcSlice->getRapPicFlag() && getLayerId() > 0 ) ? MAX_GOP : iGOPid ).m_sliceType == 'P' )
     1210      {
    12051211        pcSlice->setSliceType( P_SLICE );
    12061212      }
     
    12101216    if( pcSlice->getSliceType() == B_SLICE )
    12111217    {
    1212       if( m_pcCfg->getGOPEntry( ( pcSlice->getRapPicFlag() && getLayerId() > 0 ) ? MAX_GOP : iGOPid ).m_sliceType == 'I' ) 
    1213       { 
     1218      if( m_pcCfg->getGOPEntry( ( pcSlice->getRapPicFlag() && getLayerId() > 0 ) ? MAX_GOP : iGOPid ).m_sliceType == 'I' )
     1219      {
    12141220        pcSlice->setSliceType( I_SLICE );
    12151221      }
     
    12251231      pcSlice->setSliceType(I_SLICE);
    12261232    }
    1227    
     1233
    12281234    // Set the nal unit type
    12291235    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField));
     
    12791285    pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC);
    12801286    }
    1281     if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false, m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3) != 0) || (pcSlice->isIRAP()) 
     1287    if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false, m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3) != 0) || (pcSlice->isIRAP())
    12821288      || (m_pcCfg->getEfficientFieldIRAPEnabled() && isField && pcSlice->getAssociatedIRAPType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getAssociatedIRAPType() <= NAL_UNIT_CODED_SLICE_CRA && pcSlice->getAssociatedIRAPPOC() == pcSlice->getPOC()+1)
    12831289      )
     
    12881294    pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS());
    12891295
    1290     if(pcSlice->getTLayer() > 0 
     1296    if(pcSlice->getTLayer() > 0
    12911297      &&  !( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N     // Check if not a leading picture
    12921298          || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R
     
    13581364    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
    13591365    {
    1360       // Some more sophisticated algorithm to determine discardable_flag might be added here. 
    1361       pcSlice->setDiscardableFlag           ( false );     
    1362     }   
    1363 
    1364     const TComVPS*           vps = pcSlice->getVPS();     
     1366      // Some more sophisticated algorithm to determine discardable_flag might be added here.
     1367      pcSlice->setDiscardableFlag           ( false );
     1368    }
     1369
     1370    const TComVPS*           vps = pcSlice->getVPS();
    13651371#if NH_3D
    1366     Int numDirectRefLayers = vps    ->getNumRefListLayers( getLayerId() ); 
     1372    Int numDirectRefLayers = vps    ->getNumRefListLayers( getLayerId() );
    13671373#else
    1368     Int numDirectRefLayers = vps    ->getNumDirectRefLayers( getLayerId() ); 
     1374    Int numDirectRefLayers = vps    ->getNumDirectRefLayers( getLayerId() );
    13691375#endif
    13701376#if NH_3D
    1371     pcSlice->setIvPicLists( m_ivPicLists );         
     1377    pcSlice->setIvPicLists( m_ivPicLists );
    13721378
    13731379    Int gopNum = (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid;
    1374     GOPEntry gopEntry      = m_pcCfg->getGOPEntry( gopNum );     
     1380    GOPEntry gopEntry      = m_pcCfg->getGOPEntry( gopNum );
    13751381#else
    1376     GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );     
    1377 #endif
    1378 
    1379 
    1380    
    1381     Bool interLayerPredLayerIdcPresentFlag = false; 
     1382    GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );
     1383#endif
     1384
     1385
     1386
     1387    Bool interLayerPredLayerIdcPresentFlag = false;
    13821388    if ( getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && numDirectRefLayers > 0 )
    1383     {         
    1384       pcSlice->setInterLayerPredEnabledFlag ( gopEntry.m_numActiveRefLayerPics > 0 );     
     1389    {
     1390      pcSlice->setInterLayerPredEnabledFlag ( gopEntry.m_numActiveRefLayerPics > 0 );
    13851391      if ( pcSlice->getInterLayerPredEnabledFlag() && numDirectRefLayers > 1 )
    13861392      {
    13871393        if ( !vps->getMaxOneActiveRefLayerFlag() )
    1388         {   
    1389           pcSlice->setNumInterLayerRefPicsMinus1( gopEntry.m_numActiveRefLayerPics - 1 ); 
     1394        {
     1395          pcSlice->setNumInterLayerRefPicsMinus1( gopEntry.m_numActiveRefLayerPics - 1 );
    13901396        }
    13911397#if NH_3D
     
    13941400        if ( gopEntry.m_numActiveRefLayerPics != vps->getNumDirectRefLayers( getLayerId() ) )
    13951401#endif
    1396         {       
    1397           interLayerPredLayerIdcPresentFlag = true; 
     1402        {
     1403          interLayerPredLayerIdcPresentFlag = true;
    13981404          for (Int i = 0; i < gopEntry.m_numActiveRefLayerPics; i++ )
    13991405          {
    1400             pcSlice->setInterLayerPredLayerIdc( i, gopEntry.m_interLayerPredLayerIdc[ i ] ); 
     1406            pcSlice->setInterLayerPredLayerIdc( i, gopEntry.m_interLayerPredLayerIdc[ i ] );
    14011407          }
    14021408        }
     
    14051411    if ( !interLayerPredLayerIdcPresentFlag )
    14061412    {
    1407       for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ )   
     1413      for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ )
    14081414      {
    14091415        pcSlice->setInterLayerPredLayerIdc(i, pcSlice->getRefLayerPicIdc( i ) );
     
    14121418
    14131419
    1414     assert( pcSlice->getNumActiveRefLayerPics() == gopEntry.m_numActiveRefLayerPics ); 
    1415    
     1420    assert( pcSlice->getNumActiveRefLayerPics() == gopEntry.m_numActiveRefLayerPics );
     1421
    14161422#if NH_3D
    14171423    if ( m_pcEncTop->decProcAnnexI() )
    1418     {   
    1419       pcSlice->deriveInCmpPredAndCpAvailFlag( ); 
     1424    {
     1425      pcSlice->deriveInCmpPredAndCpAvailFlag( );
    14201426      if ( pcSlice->getInCmpPredAvailFlag() )
    1421       {     
    1422         pcSlice->setInCompPredFlag( gopEntry.m_interCompPredFlag ); 
     1427      {
     1428        pcSlice->setInCompPredFlag( gopEntry.m_interCompPredFlag );
    14231429      }
    14241430      else
     
    14341440            printf( "\nError: Frame%d_l%d cannot enable inter-component prediction on slice level. All reference layers need to be available and at least one tool using inter-component prediction must be enabled in the SPS. \n", gopNum, pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) );
    14351441          }
    1436          
     1442
    14371443          exit(EXIT_FAILURE);
    14381444        }
    14391445      }
    1440       pcSlice->init3dToolParameters(); 
    1441       pcSlice->checkInCompPredRefLayers(); 
    1442     }   
     1446      pcSlice->init3dToolParameters();
     1447      pcSlice->checkInCompPredRefLayers();
     1448    }
    14431449#if NH_3D_IV_MERGE
    14441450    // This needs to be done after initialization of 3D tool parameters.
     
    14471453#endif
    14481454
    1449     pcSlice->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 
     1455    pcSlice->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 );
    14501456    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer0.size() + (Int) m_refPicSetInterLayer1.size()) ) );
    14511457    pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer0.size() + (Int) m_refPicSetInterLayer1.size()) ) );
     
    14561462
    14571463    pcSlice->getTempRefPicLists( rcListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true );
    1458    
    1459 
    1460     xSetRefPicListModificationsMv( tempRefPicLists, pcSlice, iGOPid );   
     1464
     1465
     1466    xSetRefPicListModificationsMv( tempRefPicLists, pcSlice, iGOPid );
    14611467#else
    14621468    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures()));
     
    14641470#endif
    14651471    //  Set reference list
    1466 #if NH_MV   
    1467     pcSlice->setRefPicList( tempRefPicLists, usedAsLongTerm, numPocTotalCurr ); 
     1472#if NH_MV
     1473    pcSlice->setRefPicList( tempRefPicLists, usedAsLongTerm, numPocTotalCurr );
    14681474#else
    14691475    pcSlice->setRefPicList ( rcListPic );
     
    14771483#endif
    14781484#if NH_3D_IC
    1479     pcSlice->setICEnableCandidate( m_aICEnableCandidate );         
    1480     pcSlice->setICEnableNum( m_aICEnableNum );         
     1485    pcSlice->setICEnableCandidate( m_aICEnableCandidate );
     1486    pcSlice->setICEnableNum( m_aICEnableNum );
    14811487#endif
    14821488
     
    14851491    if ( pcSlice->getSliceType() == B_SLICE )
    14861492    {
    1487       if( m_pcCfg->getGOPEntry( ( pcSlice->getRapPicFlag() == true && getLayerId() > 0 ) ? MAX_GOP : iGOPid ).m_sliceType == 'P' ) 
    1488       { 
    1489         pcSlice->setSliceType( P_SLICE ); 
     1493      if( m_pcCfg->getGOPEntry( ( pcSlice->getRapPicFlag() == true && getLayerId() > 0 ) ? MAX_GOP : iGOPid ).m_sliceType == 'P' )
     1494      {
     1495        pcSlice->setSliceType( P_SLICE );
    14901496      }
    14911497    }
     
    15661572
    15671573#if NH_3D_VSO
    1568   // Should be moved to TEncTop !!! 
     1574  // Should be moved to TEncTop !!!
    15691575  Bool bUseVSO = m_pcEncTop->getUseVSO();
    1570  
    1571   TComRdCost* pcRdCost = m_pcEncTop->getRdCost();   
     1576
     1577  TComRdCost* pcRdCost = m_pcEncTop->getRdCost();
    15721578
    15731579  pcRdCost->setUseVSO( bUseVSO );
     
    17251731#endif
    17261732#if NH_3D
    1727       pcSlice->setDepthToDisparityLUTs(); 
     1733      pcSlice->setDepthToDisparityLUTs();
    17281734
    17291735#endif
     
    18351841    xCreatePerPictureSEIMessages(iGOPid, leadingSeiMessages, nestedSeiMessages, pcSlice);
    18361842
     1843#if NH_MV_SEI
     1844    m_seiEncoder.createAnnexFGISeiMessages( leadingSeiMessages, pcSlice );
     1845#endif
     1846
    18371847    /* use the main bitstream buffer for storing the marshalled picture */
    18381848    m_pcEntropyCoder->setBitstream(NULL);
     
    19801990    cabac_zero_word_padding(pcSlice, pcPic, binCountsInNalUnits, numBytesInVclNalUnits, accessUnit.back()->m_nalUnitData, m_pcCfg->getCabacZeroWordPaddingEnabled());
    19811991#if NH_3D
    1982       pcPic->compressMotion(2); 
     1992      pcPic->compressMotion(2);
    19831993#else
    19841994    pcPic->compressMotion();
     
    20552065    pcPic->setReconMark   ( true );
    20562066#if NH_MV
    2057       TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 
    2058       std::vector<Int> temp; 
    2059       TComSlice::markCurrPic( pcPic ); 
     2067      TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 );
     2068      std::vector<Int> temp;
     2069      TComSlice::markCurrPic( pcPic );
    20602070#endif
    20612071    m_bFirst = false;
     
    20942104  //-- all
    20952105#if NH_MV
    2096   printf( "\n\nSUMMARY -------------------------------------------- LayerId %2d\n", getLayerId() );   
     2106  printf( "\n\nSUMMARY -------------------------------------------- LayerId %2d\n", getLayerId() );
    20972107#else
    20982108  printf( "\n\nSUMMARY --------------------------------------------------------\n" );
     
    24022412#if H_3D_VSO_SYNTH_DIST_OUT
    24032413}
    2404 #endif 
    2405 #endif 
     2414#endif
     2415#endif
    24062416  /* calculate the size of the access unit, excluding:
    24072417   *  - any AnnexB contributions (start_code_prefix, zero_byte, etc.,)
     
    25262536
    25272537#if  NH_MV
    2528   assert( 0 ); // Field coding and MV need to be aligned. 
     2538  assert( 0 ); // Field coding and MV need to be aligned.
    25292539#else
    25302540
     
    29692979#if NH_MV
    29702980Void TEncGOP::xSetRefPicListModificationsMv( std::vector<TComPic*> tempPicLists[2], TComSlice* pcSlice, UInt iGOPid )
    2971 { 
    2972  
     2981{
     2982
    29732983  if( pcSlice->getSliceType() == I_SLICE || !(pcSlice->getPPS()->getListsModificationPresentFlag()) || pcSlice->getNumActiveRefLayerPics() == 0 )
    29742984  {
    29752985    return;
    29762986  }
    2977  
     2987
    29782988  GOPEntry ge = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && ( pcSlice->getLayerId( ) > 0) ) ? MAX_GOP : iGOPid );
    2979   assert( ge.m_numActiveRefLayerPics == pcSlice->getNumActiveRefLayerPics() ); 
    2980 
    2981   Int numPicsInTempList     = pcSlice->getNumRpsCurrTempList(); 
    2982 
    2983   // GT: check if SliceType should be checked here. 
     2989  assert( ge.m_numActiveRefLayerPics == pcSlice->getNumActiveRefLayerPics() );
     2990
     2991  Int numPicsInTempList     = pcSlice->getNumRpsCurrTempList();
     2992
     2993  // GT: check if SliceType should be checked here.
    29842994  for (Int li = 0; li < 2; li ++) // Loop over lists L0 and L1
    29852995  {
    2986     Int numPicsInFinalRefList = pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 ); 
    2987            
     2996    Int numPicsInFinalRefList = pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 );
     2997
    29882998    Int finalIdxToTempIdxMap[16];
    29892999    for( Int k = 0; k < 16; k++ )
     
    29993009        // get position in temp. list
    30003010        Int refPicLayerId = pcSlice->getRefPicLayerId(k);
    3001         Int idxInTempList = 0; 
     3011        Int idxInTempList = 0;
    30023012        for (; idxInTempList < numPicsInTempList; idxInTempList++)
    30033013        {
    30043014          if ( (tempPicLists[li][idxInTempList])->getLayerId() == refPicLayerId )
    30053015          {
    3006             break; 
     3016            break;
    30073017          }
    30083018        }
    30093019
    30103020        Int idxInFinalList = ge.m_interViewRefPosL[ li ][ k ];
    3011        
    3012         // Add negative from behind 
    3013         idxInFinalList = ( idxInFinalList < 0 )? ( numPicsInTempList + idxInFinalList ) : idxInFinalList; 
    3014        
     3021
     3022        // Add negative from behind
     3023        idxInFinalList = ( idxInFinalList < 0 )? ( numPicsInTempList + idxInFinalList ) : idxInFinalList;
     3024
    30153025        Bool curIsModified = ( idxInFinalList != idxInTempList ) && ( ( idxInTempList < numPicsInFinalRefList ) || ( idxInFinalList < numPicsInFinalRefList ) ) ;
    30163026        if ( curIsModified )
    30173027        {
    3018           isModified = true; 
     3028          isModified = true;
    30193029          assert( finalIdxToTempIdxMap[ idxInFinalList ] == -1 ); // Assert when two inter layer reference pictures are sorted to the same position
    30203030        }
    3021         finalIdxToTempIdxMap[ idxInFinalList ] = idxInTempList;             
     3031        finalIdxToTempIdxMap[ idxInFinalList ] = idxInTempList;
    30223032      }
    30233033    }
    30243034
    30253035    TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
    3026     refPicListModification->setRefPicListModificationFlagL( li, isModified ); 
     3036    refPicListModification->setRefPicListModificationFlagL( li, isModified );
    30273037
    30283038    if( isModified )
    30293039    {
    30303040      Int refIdx = 0;
    3031      
     3041
    30323042      for( Int i = 0; i < numPicsInFinalRefList; i++ )
    30333043      {
    3034         if( finalIdxToTempIdxMap[i] >= 0 ) 
     3044        if( finalIdxToTempIdxMap[i] >= 0 )
    30353045        {
    30363046          refPicListModification->setRefPicSetIdxL( li, i, finalIdxToTempIdxMap[i] );
     
    30423052          while( ( refIdx < numPicsInTempList ) && ( tempPicLists[li][refIdx]->getLayerId() != getLayerId())  )
    30433053          {
    3044             refIdx++; 
     3054            refIdx++;
    30453055          }
    30463056          refPicListModification->setRefPicSetIdxL( li, i, refIdx );
  • trunk/source/Lib/TLibRenderer/TRenModSetupStrParser.h

    r1313 r1356  
    8787                                );
    8888
    89   std::vector<Int>* getSynthViews() { return &m_aiAllSynthViewNums;  }
    90   std::vector<Int>* getBaseViews()  { return &m_aiAllBaseViewIdx;    }
     89  IntAry1d* getSynthViews() { return &m_aiAllSynthViewNums;  }
     90  IntAry1d* getBaseViews()  { return &m_aiAllBaseViewIdx;    }
    9191
    9292  TRenModSetupStrParser();
     
    9595
    9696private:
    97   std::vector< std::vector<Int > > m_aaaiBaseViewsIdx  [2];
    98   std::vector< std::vector<Int > > m_aaaiVideoDistMode [2];
    99   std::vector< std::vector<Int > > m_aaaiDepthDistMode [2];
    100   std::vector< std::vector<Int > > m_aaaiModelNums     [2];
    101   std::vector< std::vector<Int > > m_aaaiSynthViewNums [2];
    102   std::vector< std::vector<Bool> > m_aaabOrgRef        [2];
    103   std::vector< std::vector<Bool> > m_aaabExtrapolate   [2];
    104   std::vector< std::vector<Int > > m_aaaiBlendMode     [2];
     97  IntAry2d                        m_aaaiBaseViewsIdx  [2];
     98  IntAry2d                        m_aaaiVideoDistMode [2];
     99  IntAry2d                        m_aaaiDepthDistMode [2];
     100  IntAry2d                        m_aaaiModelNums     [2];
     101  IntAry2d                        m_aaaiSynthViewNums [2];
     102  BoolAry2d                        m_aaabOrgRef        [2];
     103  BoolAry2d                        m_aaabExtrapolate   [2];
     104  IntAry2d                        m_aaaiBlendMode     [2];
    105105
    106   std::vector<Int>                 m_aiAllBaseViewIdx;
    107   std::vector<Int>                 m_aiAllSynthViewNums;
     106  IntAry1d                         m_aiAllBaseViewIdx;
     107  IntAry1d                         m_aiAllSynthViewNums;
    108108
    109109  Bool                             m_bCurrentViewSet;
Note: See TracChangeset for help on using the changeset viewer.