Changeset 1029 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h
- Timestamp:
- 26 Feb 2015, 00:21:54 (10 years ago)
- Location:
- branches/SHM-dev
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev
- Property svn:mergeinfo changed
-
branches/SHM-dev/source
- Property svn:mergeinfo changed
-
branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h
r969 r1029 40 40 41 41 #include <algorithm> 42 #include <iostream> 43 #include <assert.h> 42 44 43 45 #if _MSC_VER > 1000 44 46 // disable "signed and unsigned mismatch" 45 47 #pragma warning( disable : 4018 ) 46 // disable bool coercion "performance warning"48 // disable Bool coercion "performance warning" 47 49 #pragma warning( disable : 4800 ) 48 50 #endif // _MSC_VER > 1000 … … 58 60 #if SVC_EXTENSION 59 61 #include <vector> 60 #define NV_VERSION "8. 0 (HM-15.0)" ///< Current software version61 #else 62 #define NV_VERSION "1 5.0" ///< Current software version62 #define NV_VERSION "8.1 (HM-16.2)" ///< Current software version 63 #else 64 #define NV_VERSION "16.2" ///< Current software version 63 65 #endif 64 66 … … 98 100 #endif 99 101 100 #define NVM_BITS "[%d bit] ", (sizeof( void*) == 8 ? 64 : 32) ///< used for checking 64-bit O/S102 #define NVM_BITS "[%d bit] ", (sizeof(Void*) == 8 ? 64 : 32) ///< used for checking 64-bit O/S 101 103 102 104 #ifndef NULL … … 119 121 #define MAX_INT 2147483647 ///< max. value of signed 32-bit integer 120 122 #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 122 130 123 131 #define MIN_QP 0 … … 129 137 // Macro functions 130 138 // ==================================================================================================================== 131 extern Int g_bitDepthY; 132 extern Int g_bitDepthC; 139 140 extern Int g_bitDepth[MAX_NUM_CHANNEL_TYPE]; 141 133 142 #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 143 extern Int g_bitDepthLayer[MAX_NUM_CHANNEL_TYPE][MAX_LAYERS]; 139 144 #endif 140 145 #if O0194_WEIGHTED_PREDICTION_CGS 141 146 extern void* g_refWeightACDCParam; //type:wpACDCParam 142 147 #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 149 template <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 150 template <typename T> inline T ClipBD(const T x, const Int bitDepth) { return Clip3(T(0), T((1 << bitDepth)-1), x); } 151 template <typename T> inline T Clip (const T x, const ChannelType type) { return ClipBD(x, g_bitDepth[type]); } 152 153 template <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 149 162 150 163 #define DATA_ALIGN 1 ///< use 32-bit aligned malloc/free … … 163 176 } 164 177 178 template <typename ValueType> inline ValueType leftShift (const ValueType value, const Int shift) { return (shift >= 0) ? ( value << shift) : ( value >> -shift); } 179 template <typename ValueType> inline ValueType rightShift (const ValueType value, const Int shift) { return (shift >= 0) ? ( value >> shift) : ( value << -shift); } 180 template <typename ValueType> inline ValueType leftShift_round (const ValueType value, const Int shift) { return (shift >= 0) ? ( value << shift) : ((value + (ValueType(1) << (-shift - 1))) >> -shift); } 181 template <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 187 template <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 165 189 166 190 // ==================================================================================================================== … … 255 279 NAL_UNIT_PREFIX_SEI, // 39 256 280 NAL_UNIT_SUFFIX_SEI, // 40 281 257 282 NAL_UNIT_RESERVED_NVCL41, 258 283 NAL_UNIT_RESERVED_NVCL42, … … 286 311 Int m_targetLayerId; 287 312 Int m_targetOutputLayerSetIdx; 288 std::vector<Int> *m_targetDecLayerIdSet; 313 std::vector<Int> *m_targetDecLayerIdSet; 289 314 Bool m_valueCheckedFlag; 290 315 Int m_highestTId; 291 316 public: 292 CommonDecoderParams(): 317 CommonDecoderParams(): 293 318 #if FIX_CONF_MODE 294 319 m_targetLayerId(MAX_VPS_LAYER_ID_PLUS1)
Note: See TracChangeset for help on using the changeset viewer.