Ignore:
Timestamp:
26 Feb 2015, 00:21:54 (10 years ago)
Author:
seregin
Message:

merge with SHM-upgrade branch

Location:
branches/SHM-dev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev

  • branches/SHM-dev/source

  • branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h

    r969 r1029  
    4040
    4141#include <algorithm>
     42#include <iostream>
     43#include <assert.h>
    4244
    4345#if _MSC_VER > 1000
    4446// disable "signed and unsigned mismatch"
    4547#pragma warning( disable : 4018 )
    46 // disable bool coercion "performance warning"
     48// disable Bool coercion "performance warning"
    4749#pragma warning( disable : 4800 )
    4850#endif // _MSC_VER > 1000
     
    5860#if SVC_EXTENSION
    5961#include <vector>
    60 #define NV_VERSION        "8.0 (HM-15.0)"                 ///< Current software version
    61 #else
    62 #define NV_VERSION        "15.0"                ///< Current software version
     62#define NV_VERSION        "8.1 (HM-16.2)"                 ///< Current software version
     63#else
     64#define NV_VERSION        "16.2"                ///< Current software version
    6365#endif
    6466
     
    98100#endif
    99101
    100 #define NVM_BITS          "[%d bit] ", (sizeof(void*) == 8 ? 64 : 32) ///< used for checking 64-bit O/S
     102#define NVM_BITS          "[%d bit] ", (sizeof(Void*) == 8 ? 64 : 32) ///< used for checking 64-bit O/S
    101103
    102104#ifndef NULL
     
    119121#define MAX_INT                     2147483647  ///< max. value of signed 32-bit integer
    120122#define MAX_INT64                   0x7FFFFFFFFFFFFFFFLL  ///< max. value of signed 64-bit integer
    121 #define MAX_DOUBLE                  1.7e+308    ///< max. value of double-type value
     123#if RExt__HIGH_BIT_DEPTH_SUPPORT
     124#define MAX_INTERMEDIATE_INT        MAX_INT64
     125#else
     126#define MAX_INTERMEDIATE_INT        MAX_INT
     127#endif
     128
     129#define MAX_DOUBLE                  1.7e+308    ///< max. value of Double-type value
    122130
    123131#define MIN_QP                      0
     
    129137// Macro functions
    130138// ====================================================================================================================
    131 extern Int g_bitDepthY;
    132 extern Int g_bitDepthC;
     139
     140extern Int g_bitDepth[MAX_NUM_CHANNEL_TYPE];
     141
    133142#if O0194_DIFFERENT_BITDEPTH_EL_BL
    134 extern Int  g_bitDepthYLayer[MAX_LAYERS];
    135 extern Int  g_bitDepthCLayer[MAX_LAYERS];
    136 
    137 extern UInt g_uiPCMBitDepthLumaDec[MAX_LAYERS];    // PCM bit-depth
    138 extern UInt g_uiPCMBitDepthChromaDec[MAX_LAYERS];    // PCM bit-depth
     143extern Int  g_bitDepthLayer[MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];
    139144#endif
    140145#if O0194_WEIGHTED_PREDICTION_CGS
    141146extern void* g_refWeightACDCParam; //type:wpACDCParam
    142147#endif
    143 /** clip x, such that 0 <= x <= #g_maxLumaVal */
    144 template <typename T> inline T ClipY(T x) { return std::min<T>(T((1 << g_bitDepthY)-1), std::max<T>( T(0), x)); }
    145 template <typename T> inline T ClipC(T x) { return std::min<T>(T((1 << g_bitDepthC)-1), std::max<T>( T(0), x)); }
    146 
    147 /** clip a, such that minVal <= a <= maxVal */
    148 template <typename T> inline T Clip3( T minVal, T maxVal, T a) { return std::min<T> (std::max<T> (minVal, a) , maxVal); }  ///< general min/max clip
     148
     149template <typename T> inline T Clip3 (const T minVal, const T maxVal, const T a) { return std::min<T> (std::max<T> (minVal, a) , maxVal); }  ///< general min/max clip
     150template <typename T> inline T ClipBD(const T x, const Int bitDepth)             { return Clip3(T(0), T((1 << bitDepth)-1), x);           }
     151template <typename T> inline T Clip  (const T x, const ChannelType type)         { return ClipBD(x, g_bitDepth[type]);                    }
     152
     153template <typename T> inline Void Check3( T minVal, T maxVal, T a)
     154{
     155  if ((a > maxVal) || (a < minVal))
     156  {
     157    std::cerr << "ERROR: Range check " << minVal << " >= " << a << " <= " << maxVal << " failed" << std::endl;
     158    assert(false);
     159    exit(1);
     160  }
     161}  ///< general min/max clip
    149162
    150163#define DATA_ALIGN                  1                                                                 ///< use 32-bit aligned malloc/free
     
    163176}
    164177
     178template <typename ValueType> inline ValueType leftShift       (const ValueType value, const Int shift) { return (shift >= 0) ? ( value                                  << shift) : ( value                                   >> -shift); }
     179template <typename ValueType> inline ValueType rightShift      (const ValueType value, const Int shift) { return (shift >= 0) ? ( value                                  >> shift) : ( value                                   << -shift); }
     180template <typename ValueType> inline ValueType leftShift_round (const ValueType value, const Int shift) { return (shift >= 0) ? ( value                                  << shift) : ((value + (ValueType(1) << (-shift - 1))) >> -shift); }
     181template <typename ValueType> inline ValueType rightShift_round(const ValueType value, const Int shift) { return (shift >= 0) ? ((value + (ValueType(1) << (shift - 1))) >> shift) : ( value                                   << -shift); }
     182#if O0043_BEST_EFFORT_DECODING
     183// when shift = 0, returns value
     184// when shift = 1, (value + 0 + value[1]) >> 1
     185// when shift = 2, (value + 1 + value[2]) >> 2
     186// when shift = 3, (value + 3 + value[3]) >> 3
     187template <typename ValueType> inline ValueType rightShiftEvenRounding(const ValueType value, const UInt shift) { return (shift == 0) ? value : ((value + (1<<(shift-1))-1 + ((value>>shift)&1)) >> shift) ; }
     188#endif
    165189
    166190// ====================================================================================================================
     
    255279  NAL_UNIT_PREFIX_SEI,              // 39
    256280  NAL_UNIT_SUFFIX_SEI,              // 40
     281
    257282  NAL_UNIT_RESERVED_NVCL41,
    258283  NAL_UNIT_RESERVED_NVCL42,
     
    286311  Int m_targetLayerId;
    287312  Int m_targetOutputLayerSetIdx;
    288   std::vector<Int> *m_targetDecLayerIdSet; 
     313  std::vector<Int> *m_targetDecLayerIdSet;
    289314  Bool m_valueCheckedFlag;
    290315  Int m_highestTId;
    291316public:
    292   CommonDecoderParams(): 
     317  CommonDecoderParams():
    293318#if FIX_CONF_MODE
    294319    m_targetLayerId(MAX_VPS_LAYER_ID_PLUS1)
Note: See TracChangeset for help on using the changeset viewer.