Changeset 446 in 3DVCSoftware for branches/HTM-DEV-0.2-dev/source/Lib
- Timestamp:
- 26 May 2013, 16:22:23 (12 years ago)
- Location:
- branches/HTM-DEV-0.2-dev/source/Lib
- Files:
-
- 81 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.2-dev/source/Lib/TAppCommon/TAppComCamPara.cpp
r438 r446 49 49 #include <functional> 50 50 #include <string> 51 51 #if H_3D 52 52 53 53 … … 58 58 AOF( radShiftParams == NULL && raiShiftParams == NULL && radLUT == NULL && raiLUT == NULL ); 59 59 60 uiNumberSourceViews = max(1, uiNumberSourceViews );61 uiNumberTargetViews = Max(1, uiNumberTargetViews );60 uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews ); 61 uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews ); 62 62 63 63 radShiftParams = new Double** [ uiNumberSourceViews ]; … … 892 892 893 893 // maximum deviation 894 dMaxDispDev = Max( dMaxDispDev, fabs( Double( (Int) iTestScale ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );895 dMaxRndDispDvL = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) );896 dMaxRndDispDvC = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );894 dMaxDispDev = std::max( dMaxDispDev, fabs( Double( (Int) iTestScale ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) ); 895 dMaxRndDispDvL = std::max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) ); 896 dMaxRndDispDvC = std::max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) ); 897 897 } 898 898 … … 980 980 AOF( iMinAbsVOIId != 0 && iMinAbsVOI != 0 ); 981 981 xGetCameraShifts( 0, iMinAbsVOIId, m_uiFirstFrameId, dCamPosShift, dPicPosShift ); 982 #if H_3D_PDM_CAM_PARAS 982 983 Double dCamPosShiftVOI01 = dCamPosShift / Double( iMinVOI ); 984 #endif 983 985 984 986 //--- determine maximum absolute camera position shift, precision, and base scale --- … … 993 995 } 994 996 } 997 998 #if H_3D_PDM_CAM_PARAS 995 999 Int iPrecision = 0; 996 1000 #if 0 // enabling this lines might be reasonable, but produces different results for the 2 view and 3 view test cases … … 1027 1031 } 1028 1032 } 1033 #endif 1029 1034 } 1030 1035 … … 1050 1055 m_aaiScaleAndOffsetSet = 0; 1051 1056 1057 #if H_3D_PDM_CAM_PARAS 1052 1058 m_iPdmPrecision = 0; 1053 1059 m_aaiPdmScaleNomDelta = 0; 1054 1060 m_aaiPdmOffset = 0; 1061 #endif 1055 1062 1056 1063 m_adBaseViewShiftParameter = 0; … … 1078 1085 xDeleteArray( m_aiBaseViewShiftLUT, m_iNumberOfBaseViews, m_iNumberOfBaseViews, 2 ); 1079 1086 1080 xDeleteArray( m_adSynthViewShiftParameter, m_iNumberOfBaseViews, Max(1,m_iNumberOfSynthViews));1081 xDeleteArray( m_aiSynthViewShiftParameter, m_iNumberOfBaseViews, Max(1,m_iNumberOfSynthViews));1082 xDeleteArray( m_adSynthViewShiftLUT, m_iNumberOfBaseViews, Max(1,m_iNumberOfSynthViews), 2 );1083 xDeleteArray( m_aiSynthViewShiftLUT, m_iNumberOfBaseViews, Max(1,m_iNumberOfSynthViews), 2 );1087 xDeleteArray( m_adSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews)); 1088 xDeleteArray( m_aiSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews)); 1089 xDeleteArray( m_adSynthViewShiftLUT, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews), 2 ); 1090 xDeleteArray( m_aiSynthViewShiftLUT, m_iNumberOfBaseViews, std::max( (Int)1 ,m_iNumberOfSynthViews), 2 ); 1084 1091 1085 1092 xDeleteArray( m_aaiCodedScale, m_iNumberOfBaseViews ); … … 1087 1094 xDeleteArray( m_aaiScaleAndOffsetSet, m_iNumberOfBaseViews ); 1088 1095 1096 #if H_3D_PDM_CAM_PARAS 1089 1097 xDeleteArray( m_aaiPdmScaleNomDelta, m_iNumberOfBaseViews ); 1090 1098 xDeleteArray( m_aaiPdmOffset, m_iNumberOfBaseViews ); 1099 #endif 1091 1100 } 1092 1101 … … 1106 1115 1107 1116 Int iViewOrderIdx = (Int)( m_aadCameraParameters[ uiRow ][ 1 ] ); 1108 iMinViewOrderIdx = Min( iViewOrderIdx, iMinViewOrderIdx );1117 iMinViewOrderIdx = std::min( iViewOrderIdx, iMinViewOrderIdx ); 1109 1118 1110 1119 aiViewOrderIdx .push_back( iViewOrderIdx ); … … 1121 1130 m_aiBaseId2SortedId.push_back( iCurBaseView ); 1122 1131 m_aiBaseSortedId2Id.push_back( iCurBaseView ); 1123 1124 1132 } 1125 1133 … … 1332 1340 xInit2dArray ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet, 0 ); 1333 1341 1342 #if H_3D_PDM_CAM_PARAS 1334 1343 xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiPdmScaleNomDelta ); 1335 1344 xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiPdmOffset ); … … 1337 1346 //===== init disparity to virtual depth conversion parameters ===== 1338 1347 xSetPdmConversionParams(); 1348 #endif 1339 1349 1340 1350 //===== init arrays for first frame ===== … … 1385 1395 } 1386 1396 1397 Bool bInterpolateFirst = true; 1398 Bool bAnyInterpolated = false; 1387 1399 for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ ) 1388 1400 { … … 1394 1406 bInterpolated |= bInterpolatedCur; 1395 1407 } 1408 1396 1409 if( bInterpolated ) 1397 1410 { 1398 std::cout << "Interpolating Camera Parameters for View " << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << std::endl; 1399 } 1400 } 1411 bAnyInterpolated = true; 1412 if ( bInterpolateFirst ) 1413 { 1414 std::cout << "Interpolating Camera Parameters for View(s) " ; 1415 bInterpolateFirst = false; 1416 } 1417 std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ; 1418 } 1419 } 1420 if ( bAnyInterpolated ) 1421 std::cout << std::endl; 1401 1422 } 1402 1423 … … 1433 1454 } 1434 1455 1435 #if SAIT_VSO_EST_A00331436 Void 1437 TAppComCamPara:: xSetDispCoeff( UInt uiFrameId, Int iViewIdx )1456 #if H_3D_VSO 1457 Void 1458 TAppComCamPara::setDispCoeff( UInt uiFrameId, Int iViewIdx ) 1438 1459 { 1439 1460 UInt uiFrame = m_uiFirstFrameId + uiFrameId; … … 1453 1474 xGetZNearZFar ( iSourceViewNum, uiFrame, dZN1, dZF1 ); 1454 1475 1455 dBaseLine = ( Max( dPos[0], Max( dPos[1], dPos[2] ) ) - Min( dPos[0], Min( dPos[1], dPos[2] ) ) ) / 2.0;1476 dBaseLine = ( std::max( dPos[0], std::max( dPos[1], dPos[2] ) ) - std::min( dPos[0], std::min( dPos[1], dPos[2] ) ) ) / 2.0; 1456 1477 } 1457 1478 else if( m_iNumberOfBaseViews == 2 ) … … 1465 1486 dBaseLine = dPos[0] - dPos[1]; 1466 1487 } 1467 1468 1488 1469 1489 m_dDispCoeff = fabs( dFL1 * ( dBaseLine / 2.0 ) / 255.0 * ( 1.0/dZN1 - 1.0/dZF1 ) ); … … 1510 1530 return xGetViewId(m_aiRelSynthViewsNum, iRelNum ); 1511 1531 } 1532 #endif -
branches/HTM-DEV-0.2-dev/source/Lib/TAppCommon/TAppComCamPara.h
r438 r446 66 66 Bool m_bSetupFromCoded; ///< setup from coded parameter file 67 67 Bool m_bCamParsCodedPrecSet; ///< Coded Cam Para precision set for current frame; 68 69 #ifSAIT_VSO_EST_A003368 69 //SAIT_VSO_EST_A0033 70 70 Double m_dDispCoeff; 71 #endif72 71 73 72 // view lists … … 90 89 Int** m_aaiScaleAndOffsetSet; ///< array indicating whether scale and offset have been set 91 90 91 #if H_3D_PDM_CAM_PARAS 92 92 // parameters for virtual depth map generation 93 93 Int m_iPdmPrecision; ///< additional precision for disparity - virtual depth conversion 94 94 Int** m_aaiPdmScaleNomDelta; ///< [TargetView][RefView] delta for nominator of scale factor 95 95 Int** m_aaiPdmOffset; ///< [TargetView][RefView] offset parameter 96 #endif 96 97 97 98 // scale and offset parameters … … 182 183 183 184 Int synthRelNum2Idx ( Int iRelNum ); 184 Bool getLeftRightBaseView( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView );185 Bool getLeftRightBaseView ( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView ); 185 186 Int getRelDistLeft ( Int iSynthViewIdx, Int iLeftViewIdx, Int iRightViewIdx ); 186 187 UInt getCurFrameId () { return m_iCurrentFrameId; } 187 188 static Void convertNumberString ( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec ); 188 189 189 #if SAIT_VSO_EST_A0033 190 Void xSetDispCoeff( UInt uiStartFrameId, Int iViewIdx ); 191 Double getDispCoeff() { return m_dDispCoeff; } 190 #if H_3D_VSO 191 // SAIT_VSO_EST_A033 192 Void setDispCoeff ( UInt uiStartFrameId, Int iViewIdx ); 193 Double getDispCoeff () { return m_dDispCoeff; } 192 194 #endif 193 195 … … 216 218 Int** getCodedOffset () { return m_aaiCodedOffset; } 217 219 220 #if H_3D_PDM_CAM_PARAS 218 221 // parameters for virtual depth map generation 219 222 Int getPdmPrecision () { return m_iPdmPrecision; } 220 223 Int** getPdmScaleNomDelta () { return m_aaiPdmScaleNomDelta; } 221 224 Int** getPdmOffset () { return m_aaiPdmOffset; } 225 #endif 222 226 }; 223 227 -
branches/HTM-DEV-0.2-dev/source/Lib/TAppCommon/program_options_lite.h
r438 r446 46 46 #endif 47 47 #endif 48 49 48 //! \ingroup TAppCommon 50 49 //! \{ … … 283 282 } 284 283 #endif 285 286 284 /** Option class for argument handling using a user provided function */ 287 285 struct OptionFunc : public OptionBase … … 382 380 } 383 381 #endif 384 385 382 /** 386 383 * Add option described by name to the parent Options list, -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/CommonDef.h
r439 r446 57 57 58 58 #if H_MV 59 #define NV_VERSION "0. 3" ///< Current software version59 #define NV_VERSION "0.1" ///< Current software version 60 60 #define HM_VERSION "10.1" ///< 61 61 #else 62 #define NV_VERSION "10. 0" ///< Current software version62 #define NV_VERSION "10.1" ///< Current software version 63 63 #endif 64 64 … … 115 115 #define MAX_NUM_REF_PICS 16 ///< max. number of pictures used for reference 116 116 #define MAX_NUM_REF 16 ///< max. number of entries in picture reference list 117 #if !L0034_COMBINED_LIST_CLEANUP 117 118 #define MAX_NUM_REF_LC MAX_NUM_REF_PICS // TODO: remove this macro definition (leftover from combined list concept) 119 #endif 118 120 119 121 #define MAX_UINT 0xFFFFFFFFU ///< max. value of unsigned 32-bit integer 120 122 #define MAX_INT 2147483647 ///< max. value of signed 32-bit integer 123 #if H_3D 124 #define MIN_INT (-2147483647-1) // < min. value of signed 32-bit integer 125 #endif 121 126 #define MAX_INT64 0x7FFFFFFFFFFFFFFFLL ///< max. value of signed 64-bit integer 122 127 #define MAX_DOUBLE 1.7e+308 ///< max. value of double-type value … … 136 141 template <typename T> inline T ClipY(T x) { return std::min<T>(T((1 << g_bitDepthY)-1), std::max<T>( T(0), x)); } 137 142 template <typename T> inline T ClipC(T x) { return std::min<T>(T((1 << g_bitDepthC)-1), std::max<T>( T(0), x)); } 138 139 template <typename T> inline T Clip(T x) { return std::min<T>(T((1 << g_bitDepthY)-1), std::max<T>( T(0), x)); }140 143 141 144 /** clip a, such that minVal <= a <= maxVal */ … … 167 170 } 168 171 169 #endif 170 172 #define AOT( exp ) \ 173 { \ 174 if( ( exp ) ) \ 175 { \ 176 assert( 0 ); \ 177 } \ 178 } 179 180 template <typename T> 181 __inline T gSign(const T& t) 182 { 183 if( t == 0 ) 184 return T(0); 185 else 186 return (t < 0) ? T(-1) : T(1); 187 } 188 189 #define RemoveBitIncrement( exp ) ( exp >> ( g_bitDepthY - 8 ) ) 190 191 #endif 171 192 172 193 // ==================================================================================================================== … … 216 237 217 238 NAL_UNIT_CODED_SLICE_TSA_N, // 2 218 NAL_UNIT_CODED_SLICE_TLA , // 3 // Current name in the spec: TSA_R239 NAL_UNIT_CODED_SLICE_TLA_R, // 3 219 240 220 241 NAL_UNIT_CODED_SLICE_STSA_N, // 4 … … 222 243 223 244 NAL_UNIT_CODED_SLICE_RADL_N, // 6 224 NAL_UNIT_CODED_SLICE_ DLP, // 7 // Current name in the spec: RADL_R245 NAL_UNIT_CODED_SLICE_RADL_R, // 7 225 246 226 247 NAL_UNIT_CODED_SLICE_RASL_N, // 8 227 NAL_UNIT_CODED_SLICE_ TFD, // 9 // Current name in the spec: RASL_R228 229 NAL_UNIT_RESERVED_ 10,230 NAL_UNIT_RESERVED_ 11,231 NAL_UNIT_RESERVED_ 12,232 NAL_UNIT_RESERVED_ 13,233 NAL_UNIT_RESERVED_ 14,234 NAL_UNIT_RESERVED_ 15,235 236 NAL_UNIT_CODED_SLICE_BLA , // 16 // Current name in the spec: BLA_W_LP237 NAL_UNIT_CODED_SLICE_BLA NT, // 17 // Current name in the spec: BLA_W_DLP248 NAL_UNIT_CODED_SLICE_RASL_R, // 9 249 250 NAL_UNIT_RESERVED_VCL_N10, 251 NAL_UNIT_RESERVED_VCL_R11, 252 NAL_UNIT_RESERVED_VCL_N12, 253 NAL_UNIT_RESERVED_VCL_R13, 254 NAL_UNIT_RESERVED_VCL_N14, 255 NAL_UNIT_RESERVED_VCL_R15, 256 257 NAL_UNIT_CODED_SLICE_BLA_W_LP, // 16 258 NAL_UNIT_CODED_SLICE_BLA_W_RADL, // 17 238 259 NAL_UNIT_CODED_SLICE_BLA_N_LP, // 18 239 NAL_UNIT_CODED_SLICE_IDR , // 19 // Current name in the spec: IDR_W_DLP260 NAL_UNIT_CODED_SLICE_IDR_W_RADL, // 19 240 261 NAL_UNIT_CODED_SLICE_IDR_N_LP, // 20 241 262 NAL_UNIT_CODED_SLICE_CRA, // 21 242 NAL_UNIT_RESERVED_ 22,243 NAL_UNIT_RESERVED_ 23,244 245 NAL_UNIT_RESERVED_ 24,246 NAL_UNIT_RESERVED_ 25,247 NAL_UNIT_RESERVED_ 26,248 NAL_UNIT_RESERVED_ 27,249 NAL_UNIT_RESERVED_ 28,250 NAL_UNIT_RESERVED_ 29,251 NAL_UNIT_RESERVED_ 30,252 NAL_UNIT_RESERVED_ 31,263 NAL_UNIT_RESERVED_IRAP_VCL22, 264 NAL_UNIT_RESERVED_IRAP_VCL23, 265 266 NAL_UNIT_RESERVED_VCL24, 267 NAL_UNIT_RESERVED_VCL25, 268 NAL_UNIT_RESERVED_VCL26, 269 NAL_UNIT_RESERVED_VCL27, 270 NAL_UNIT_RESERVED_VCL28, 271 NAL_UNIT_RESERVED_VCL29, 272 NAL_UNIT_RESERVED_VCL30, 273 NAL_UNIT_RESERVED_VCL31, 253 274 254 275 NAL_UNIT_VPS, // 32 … … 259 280 NAL_UNIT_EOB, // 37 260 281 NAL_UNIT_FILLER_DATA, // 38 261 NAL_UNIT_ SEI, // 39 Prefix SEI262 NAL_UNIT_S EI_SUFFIX, // 40 Suffix SEI263 NAL_UNIT_RESERVED_ 41,264 NAL_UNIT_RESERVED_ 42,265 NAL_UNIT_RESERVED_ 43,266 NAL_UNIT_RESERVED_ 44,267 NAL_UNIT_RESERVED_ 45,268 NAL_UNIT_RESERVED_ 46,269 NAL_UNIT_RESERVED_ 47,282 NAL_UNIT_PREFIX_SEI, // 39 283 NAL_UNIT_SUFFIX_SEI, // 40 284 NAL_UNIT_RESERVED_NVCL41, 285 NAL_UNIT_RESERVED_NVCL42, 286 NAL_UNIT_RESERVED_NVCL43, 287 NAL_UNIT_RESERVED_NVCL44, 288 NAL_UNIT_RESERVED_NVCL45, 289 NAL_UNIT_RESERVED_NVCL46, 290 NAL_UNIT_RESERVED_NVCL47, 270 291 NAL_UNIT_UNSPECIFIED_48, 271 292 NAL_UNIT_UNSPECIFIED_49, … … 287 308 }; 288 309 310 #if H_3D 311 //PICYUV 312 #define PICYUV_PAD 16 313 314 //RENDERER 315 #define REN_LUMA_MARGIN ( g_uiMaxCUWidth + PICYUV_PAD ) 316 #define REN_VDWEIGHT_PREC 8 317 #define REN_IS_FILLED ( 1 << REN_VDWEIGHT_PREC ) 318 #define REN_USED_PEL ( (1 << g_bitDepthY) - 1 ) 319 #define REN_UNUSED_PEL 0 320 #define REN_IS_HOLE 0 321 322 323 // CAMERA PARAMETERS 324 #define LOG2_DISP_PREC_LUT 2 ///< log2 of disparity precision used in integer disparity LUTs 325 #define STD_CAM_PARAMETERS_PRECISION 5 ///< quarter luma sample accuarcy for derived disparities (as default) 326 327 #endif // end of H_3D 289 328 //! \} 290 329 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/NAL.h
r438 r446 47 47 NalUnitType m_nalUnitType; ///< nal_unit_type 48 48 UInt m_temporalId; ///< temporal_id 49 50 49 #if H_MV 51 50 Int m_layerId; ///< layer id … … 80 79 return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R 81 80 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N 82 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA 81 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA_R 83 82 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N 84 83 || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R 85 84 || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N 86 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA 87 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA NT85 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP 86 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL 88 87 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP 89 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR 88 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 90 89 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 91 90 || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA 92 91 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N 93 || m_nalUnitType == NAL_UNIT_CODED_SLICE_ DLP92 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R 94 93 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N 95 || m_nalUnitType == NAL_UNIT_CODED_SLICE_ TFD;94 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R; 96 95 } 97 96 #if L0045_NON_NESTED_SEI_RESTRICTIONS 98 97 Bool isSei() 99 98 { 100 return m_nalUnitType == NAL_UNIT_ SEI101 || m_nalUnitType == NAL_UNIT_S EI_SUFFIX;99 return m_nalUnitType == NAL_UNIT_PREFIX_SEI 100 || m_nalUnitType == NAL_UNIT_SUFFIX_SEI; 102 101 } 103 102 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/SEI.cpp
r438 r446 38 38 #include "CommonDef.h" 39 39 #include "SEI.h" 40 41 #if J0149_TONE_MAPPING_SEI 42 //Table D-7 Meaning of camera iso sensitivity indicator and exposure index rating indicator 43 Int Table_exp_indicator[32] = {0, 10, 12, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200, 4000, 5000, 6400, 8000, -1}; 44 #endif 40 45 41 46 SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/SEI.h
r438 r446 355 355 }; 356 356 357 #if L0208_SOP_DESCRIPTION_SEI 358 class SEISOPDescription : public SEI 359 { 360 public: 361 PayloadType payloadType() const { return SOP_DESCRIPTION; } 362 363 SEISOPDescription() {} 364 virtual ~SEISOPDescription() {} 365 366 UInt m_sopSeqParameterSetId; 367 UInt m_numPicsInSopMinus1; 368 369 UInt m_sopDescVclNaluType[MAX_NUM_PICS_IN_SOP]; 370 UInt m_sopDescTemporalId[MAX_NUM_PICS_IN_SOP]; 371 UInt m_sopDescStRpsIdx[MAX_NUM_PICS_IN_SOP]; 372 Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP]; 373 }; 374 #endif 375 376 #if J0149_TONE_MAPPING_SEI 377 class SEIToneMappingInfo : public SEI 378 { 379 public: 380 PayloadType payloadType() const { return TONE_MAPPING_INFO; } 381 SEIToneMappingInfo() {} 382 virtual ~SEIToneMappingInfo() {} 383 384 Int m_toneMapId; 385 Bool m_toneMapCancelFlag; 386 Bool m_toneMapPersistenceFlag; 387 Int m_codedDataBitDepth; 388 Int m_targetBitDepth; 389 Int m_modelId; 390 Int m_minValue; 391 Int m_maxValue; 392 Int m_sigmoidMidpoint; 393 Int m_sigmoidWidth; 394 std::vector<Int> m_startOfCodedInterval; 395 Int m_numPivots; 396 std::vector<Int> m_codedPivotValue; 397 std::vector<Int> m_targetPivotValue; 398 Int m_cameraIsoSpeedIdc; 399 Int m_cameraIsoSpeedValue; 400 Int m_exposureCompensationValueSignFlag; 401 Int m_exposureCompensationValueNumerator; 402 Int m_exposureCompensationValueDenomIdc; 403 Int m_refScreenLuminanceWhite; 404 Int m_extendedRangeWhiteLevel; 405 Int m_nominalBlackLevelLumaCodeValue; 406 Int m_nominalWhiteLevelLumaCodeValue; 407 Int m_extendedWhiteLevelLumaCodeValue; 408 }; 409 #endif 410 357 411 typedef std::list<SEI*> SEIMessages; 358 412 … … 366 420 Void deleteSEIs (SEIMessages &seiList); 367 421 422 #if K0180_SCALABLE_NESTING_SEI 423 class SEIScalableNesting : public SEI 424 { 425 public: 426 PayloadType payloadType() const { return SCALABLE_NESTING; } 427 428 SEIScalableNesting() {} 429 virtual ~SEIScalableNesting() 430 { 431 if (!m_callerOwnsSEIs) 432 { 433 deleteSEIs(m_nestedSEIs); 434 } 435 } 436 437 Bool m_bitStreamSubsetFlag; 438 Bool m_nestingOpFlag; 439 Bool m_defaultOpFlag; //value valid if m_nestingOpFlag != 0 440 UInt m_nestingNumOpsMinus1; // -"- 441 UInt m_nestingMaxTemporalIdPlus1[MAX_TLAYER]; // -"- 442 UInt m_nestingOpIdx[MAX_NESTING_NUM_OPS]; // -"- 443 444 Bool m_allLayersFlag; //value valid if m_nestingOpFlag == 0 445 UInt m_nestingNoOpMaxTemporalIdPlus1; //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0 446 UInt m_nestingNumLayersMinus1; //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0 447 UChar m_nestingLayerId[MAX_NESTING_NUM_LAYER]; //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0. This can e.g. be a static array of 64 unsigned char values 448 449 Bool m_callerOwnsSEIs; 450 SEIMessages m_nestedSEIs; 451 }; 452 #endif 453 368 454 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComBitStream.cpp
r438 r446 177 177 } 178 178 } 179 179 180 Void TComOutputBitstream::writeByteAlignment() 180 181 { … … 182 183 writeAlignZero(); 183 184 } 185 186 Int TComOutputBitstream::countStartCodeEmulations() 187 { 188 UInt cnt = 0; 189 vector<uint8_t>& rbsp = getFIFO(); 190 for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();) 191 { 192 vector<uint8_t>::iterator found = it; 193 do 194 { 195 // find the next emulated 00 00 {00,01,02,03} 196 // NB, end()-1, prevents finding a trailing two byte sequence 197 found = search_n(found, rbsp.end()-1, 2, 0); 198 found++; 199 // if not found, found == end, otherwise found = second zero byte 200 if (found == rbsp.end()) 201 { 202 break; 203 } 204 if (*(++found) <= 3) 205 { 206 break; 207 } 208 } while (true); 209 it = found; 210 if (found != rbsp.end()) 211 { 212 cnt++; 213 } 214 } 215 return cnt; 216 } 217 184 218 /** 185 219 * read #uiNumberOfBits# from bitstream without updating the bitstream -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComBitStream.h
r438 r446 154 154 Void addSubstream ( TComOutputBitstream* pcSubstream ); 155 155 Void writeByteAlignment(); 156 157 //! returns the number of start code emulations contained in the current buffer 158 Int countStartCodeEmulations(); 156 159 }; 157 160 … … 163 166 { 164 167 std::vector<uint8_t> *m_fifo; /// FIFO for storage of complete bytes 168 std::vector<UInt> m_emulationPreventionByteLocation; 165 169 166 170 protected: … … 206 210 UInt getNumBitsRead() { return m_numBitsRead; } 207 211 Void readByteAlignment(); 212 213 Void pushEmulationPreventionByteLocation ( UInt pos ) { m_emulationPreventionByteLocation.push_back( pos ); } 214 UInt numEmulationPreventionBytesRead () { return (UInt) m_emulationPreventionByteLocation.size(); } 215 std::vector<UInt> getEmulationPreventionByteLocation () { return m_emulationPreventionByteLocation; } 216 UInt getEmulationPreventionByteLocation ( UInt idx ) { return m_emulationPreventionByteLocation[ idx ]; } 217 Void clearEmulationPreventionByteLocation() { m_emulationPreventionByteLocation.clear(); } 218 Void setEmulationPreventionByteLocation ( std::vector<UInt> vec ) { m_emulationPreventionByteLocation = vec; } 208 219 }; 209 220 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComDataCU.cpp
r438 r446 3200 3200 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm(); 3201 3201 Bool bIsNeibRefLongTerm = false; 3202 3203 3202 //--------------- V1 (END) ------------------// 3204 3203 if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0) … … 3840 3839 } 3841 3840 3841 #if H_3D 3842 Void TComDataCU::getPosInPic( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) 3843 { 3844 riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX(); 3845 riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 3846 } 3847 #endif 3842 3848 3843 3849 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComDataCU.h
r324 r446 194 194 Bool m_bDecSubCu; ///< indicates decoder-mode 195 195 Double m_dTotalCost; ///< sum of partition RD costs 196 #if H_3D_VSO 197 Dist m_uiTotalDistortion; ///< sum of partition distortion 198 #else 196 199 UInt m_uiTotalDistortion; ///< sum of partition distortion 200 #endif 197 201 UInt m_uiTotalBits; ///< sum of partition bits 198 202 UInt m_uiTotalBins; ///< sum of partition bins … … 263 267 264 268 Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); 269 #if H_3D 270 Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ); 271 #endif 265 272 266 273 // ------------------------------------------------------------------------------------------------------------------- … … 512 519 513 520 Double& getTotalCost() { return m_dTotalCost; } 521 #if H_3D_VSO 522 Dist& getTotalDistortion() { return m_uiTotalDistortion; } 523 #else 514 524 UInt& getTotalDistortion() { return m_uiTotalDistortion; } 525 #endif 515 526 UInt& getTotalBits() { return m_uiTotalBits; } 516 527 UInt& getTotalNumPart() { return m_uiNumPartition; } -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComLoopFilter.cpp
r438 r446 57 57 // ==================================================================================================================== 58 58 59 const UChar tctable_8x8[54] =59 const UChar TComLoopFilter::sm_tcTable[54] = 60 60 { 61 61 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,8,9,10,11,13,14,16,18,20,22,24 62 62 }; 63 63 64 const UChar betatable_8x8[52] =64 const UChar TComLoopFilter::sm_betaTable[52] = 65 65 { 66 66 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64 … … 585 585 Int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1)); 586 586 587 Int iTc = tctable_8x8[iIndexTC]*iBitdepthScale;588 Int iBeta = betatable_8x8[iIndexB]*iBitdepthScale;587 Int iTc = sm_tcTable[iIndexTC]*iBitdepthScale; 588 Int iBeta = sm_betaTable[iIndexB]*iBitdepthScale; 589 589 Int iSideThreshold = (iBeta+(iBeta>>1))>>3; 590 590 Int iThrCut = iTc*10; … … 735 735 736 736 Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET*(ucBs - 1) + (tcOffsetDiv2 << 1)); 737 Int iTc = tctable_8x8[iIndexTC]*iBitdepthScale;737 Int iTc = sm_tcTable[iIndexTC]*iBitdepthScale; 738 738 739 739 for ( UInt uiStep = 0; uiStep < uiPelsInPartChroma; uiStep++ ) -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComLoopFilter.h
r438 r446 99 99 __inline Int xCalcDQ( Pel* piSrc, Int iOffset); 100 100 101 static const UChar sm_tcTable[54]; 102 static const UChar sm_betaTable[52]; 103 101 104 public: 102 105 TComLoopFilter(); … … 111 114 /// picture-level deblocking filter 112 115 Void loopFilterPic( TComPic* pcPic ); 116 117 static Int getBeta( Int qp ) 118 { 119 Int indexB = Clip3( 0, MAX_QP, qp ); 120 return sm_betaTable[ indexB ]; 121 } 113 122 }; 114 123 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPic.cpp
r438 r446 68 68 , m_viewId (0) 69 69 #if H_3D 70 , m_viewIndex (0) 70 71 , m_isDepth (false) 72 , m_aaiCodedScale (0) 73 , m_aaiCodedOffset (0) 71 74 #endif 72 75 #endif … … 479 482 std::cout << getLayerId() << "\t" << getPOC()<< "\t" << getReconMark() << "\t" << getSlice(0)->isReferenced() << "\t" << getIsLongTerm() << std::endl; 480 483 } 481 #endif 482 484 485 TComPic* TComPicLists::getPic( Int layerIdInNuh, Int poc ) 486 { 487 TComPic* pcPic = NULL; 488 for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() && pcPic == NULL ); itL++) 489 { 490 for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() && pcPic == NULL ); itP++) 491 { 492 TComPic* currPic = (*itP); 493 if ( ( currPic->getPOC() == poc ) && ( currPic->getLayerId() == layerIdInNuh ) ) 494 { 495 pcPic = currPic ; 496 } 497 } 498 } 499 return pcPic; 500 } 501 502 #if H_3D 503 TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int poc ) 504 { 505 return getPic ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc ); 506 } 507 508 Void TComPicLists::print() 509 { 510 Bool first = true; 511 for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() ); itL++) 512 { 513 for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() ); itP++) 514 { 515 if ( first ) 516 { 517 (*itP)->print( true ); 518 first = false; 519 } 520 (*itP)->print( false ); 521 } 522 } 523 } 524 525 TComPicYuv* TComPicLists::getPicYuv( Int layerIdInNuh, Int poc, Bool reconFlag ) 526 { 527 TComPic* pcPic = getPic( layerIdInNuh, poc ); 528 TComPicYuv* pcPicYuv = NULL; 529 530 if (pcPic != NULL) 531 { 532 if( reconFlag ) 533 { 534 if ( pcPic->getReconMark() ) 535 { 536 pcPicYuv = pcPic->getPicYuvRec(); 537 } 538 } 539 else 540 { 541 pcPicYuv = pcPic->getPicYuvOrg(); 542 } 543 }; 544 545 return pcPicYuv; 546 } 547 548 TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon ) 549 { 550 Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag ); 551 return getPicYuv( layerIdInNuh, poc, recon ); 552 } 553 #endif // H_3D 554 #endif // H_MV 483 555 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPic.h
r438 r446 90 90 Int m_viewId; 91 91 #if H_3D 92 Int m_viewIndex; 92 93 Bool m_isDepth; 93 #endif 94 #endif 95 94 Int** m_aaiCodedScale; 95 Int** m_aaiCodedOffset; 96 #endif 97 #endif 96 98 public: 97 99 TComPic(); … … 112 114 Int getViewId () { return m_viewId; } 113 115 #if H_3D 116 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 117 Int getViewIndex () { return m_viewIndex; } 118 114 119 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 115 120 Bool getIsDepth () { return m_isDepth; } 116 #endif 117 #endif 118 121 122 Void setScaleOffset( Int** pS, Int** pO ) { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; } 123 Int** getCodedScale () { return m_aaiCodedScale; } 124 Int** getCodedOffset() { return m_aaiCodedOffset; } 125 #endif 126 #endif 119 127 Bool getUsedByCurr() { return m_bUsedByCurr; } 120 128 Void setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; } … … 186 194 Void print( Bool legend ); 187 195 #endif 188 189 190 191 196 /** transfer ownership of seis to this picture */ 192 197 void setSEIs(SEIMessages& seis) { m_SEIs = seis; } … … 209 214 private: 210 215 TComList<TComList<TComPic*>*> m_lists; 216 #if H_3D 217 TComVPS* m_vps; 218 #endif 211 219 public: 212 213 Void push_back( TComList<TComPic*>* list ) { m_lists.push_back( list ); } 214 Int size () { return (Int) m_lists.size (); } 215 216 TComPic* getPic( Int layerIdInNuh, Int poc ) 217 { 218 TComPic* pcPic = NULL; 219 for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() && pcPic == NULL ); itL++) 220 { 221 for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() && pcPic == NULL ); itP++) 222 { 223 if ( ( (*itP)->getPOC() == poc ) && ( (*itP)->getLayerId() == layerIdInNuh ) ) 224 { 225 pcPic = *itP ; 226 } 227 } 228 } 229 return pcPic; 230 } 231 232 Void print( ) 233 { 234 Bool first = true; 235 for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() ); itL++) 236 { 237 for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() ); itP++) 238 { 239 if ( first ) 240 { 241 (*itP)->print( true ); 242 first = false; 243 } 244 (*itP)->print( false ); 245 } 246 } 247 } 248 220 Void push_back( TComList<TComPic*>* list ) { m_lists.push_back( list ); } 221 Int size () { return (Int) m_lists.size(); } 222 TComPic* getPic ( Int layerIdInNuh, Int poc ); 223 TComPicYuv* getPicYuv( Int layerIdInNuh, Int poc, Bool recon ); 224 #if H_3D 225 Void setVPS ( TComVPS* vps ) { m_vps = vps; }; 226 TComPic* getPic ( Int viewIndex, Bool depthFlag, Int poc ); 227 TComPicYuv* getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon ); 228 #endif 229 230 Void print( ); 249 231 250 232 }; // END CLASS DEFINITION TComPicLists -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPicYuv.cpp
r324 r446 324 324 } 325 325 326 #if H_3D 327 Void TComPicYuv::setLumaTo( Pel pVal ) 328 { 329 xSetPels( getLumaAddr(), getStride(), getWidth(), getHeight(), pVal ); 330 } 331 332 Void TComPicYuv::setChromaTo( Pel pVal ) 333 { 334 xSetPels( getCbAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, pVal ); 335 xSetPels( getCrAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, pVal ); 336 } 337 338 Void TComPicYuv::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal ) 339 { 340 for (Int iYPos = 0; iYPos < iHeight; iYPos++) 341 { 342 for (Int iXPos = 0; iXPos < iWidth; iXPos++) 343 { 344 piPelSource[iXPos] = iVal; 345 } 346 piPelSource += iSourceStride; 347 } 348 } 349 #endif 326 350 327 351 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPicYuv.h
r324 r446 90 90 protected: 91 91 Void xExtendPicCompBorder (Pel* piTxt, Int iStride, Int iWidth, Int iHeight, Int iMarginX, Int iMarginY); 92 #if H_3D 93 Void xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal ); 94 #endif 92 95 93 96 public: … … 158 161 // Set border extension flag 159 162 Void setBorderExtension(Bool b) { m_bIsBorderExtended = b; } 163 #if H_3D 164 // Set Function 165 Void setLumaTo ( Pel pVal ); 166 Void setChromaTo ( Pel pVal ); 167 #endif 160 168 };// END CLASS DEFINITION TComPicYuv 161 169 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPrediction.cpp
r438 r446 83 83 if( m_piYuvExt == NULL ) 84 84 { 85 Int extWidth = g_uiMaxCUWidth+ 16;86 Int extHeight = g_uiMaxCUHeight+ 1;85 Int extWidth = MAX_CU_SIZE + 16; 86 Int extHeight = MAX_CU_SIZE + 1; 87 87 Int i, j; 88 88 for (i = 0; i < 4; i++) … … 94 94 } 95 95 } 96 m_iYuvExtHeight = (( g_uiMaxCUHeight+ 2) << 4);97 m_iYuvExtStride = (( g_uiMaxCUWidth+ 8) << 4);96 m_iYuvExtHeight = ((MAX_CU_SIZE + 2) << 4); 97 m_iYuvExtStride = ((MAX_CU_SIZE + 8) << 4); 98 98 m_piYuvExt = new Int[ m_iYuvExtStride * m_iYuvExtHeight ]; 99 99 100 100 // new structure 101 m_acYuvPred[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight);102 m_acYuvPred[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight);103 104 m_cYuvPredTemp.create( g_uiMaxCUWidth, g_uiMaxCUHeight);105 } 106 107 if (m_iLumaRecStride != ( g_uiMaxCUWidth>>1) + 1)108 { 109 m_iLumaRecStride = ( g_uiMaxCUWidth>>1) + 1;101 m_acYuvPred[0] .create( MAX_CU_SIZE, MAX_CU_SIZE ); 102 m_acYuvPred[1] .create( MAX_CU_SIZE, MAX_CU_SIZE ); 103 104 m_cYuvPredTemp.create( MAX_CU_SIZE, MAX_CU_SIZE ); 105 } 106 107 if (m_iLumaRecStride != (MAX_CU_SIZE>>1) + 1) 108 { 109 m_iLumaRecStride = (MAX_CU_SIZE>>1) + 1; 110 110 if (!m_pLumaRecBuffer) 111 111 { -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComRdCost.cpp
r324 r446 40 40 #include "TComRom.h" 41 41 #include "TComRdCost.h" 42 #if H_3D 43 #include "TComDataCU.h" 44 #endif 42 45 43 46 //! \ingroup TLibCommon 44 47 //! \{ 45 48 49 #if H_3D_VSO 50 // SAIT_VSO_EST_A0033 51 Double TComRdCost::m_dDisparityCoeff = 1.0; 52 #endif 53 46 54 TComRdCost::TComRdCost() 47 55 { … … 57 65 58 66 // Calculate RD functions 67 #if H_3D_VSO 68 Double TComRdCost::calcRdCost( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc ) 69 #else 59 70 Double TComRdCost::calcRdCost( UInt uiBits, UInt uiDistortion, Bool bFlag, DFunc eDFunc ) 71 #endif 60 72 { 61 73 Double dRdCost = 0.0; … … 111 123 } 112 124 125 #if H_3D_VSO 126 Double TComRdCost::calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag, DFunc eDFunc ) 127 #else 113 128 Double TComRdCost::calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag, DFunc eDFunc ) 129 #endif 114 130 { 115 131 Double dRdCost = 0.0; … … 219 235 m_afpDistortFunc[27] = TComRdCost::xGetHADs; 220 236 m_afpDistortFunc[28] = TComRdCost::xGetHADs; 221 237 238 #if H_3D_VSO 239 // SAIT_VSO_EST_A0033 240 m_afpDistortFunc[29] = TComRdCost::xGetVSD; 241 m_afpDistortFunc[30] = TComRdCost::xGetVSD4; 242 m_afpDistortFunc[31] = TComRdCost::xGetVSD8; 243 m_afpDistortFunc[32] = TComRdCost::xGetVSD16; 244 m_afpDistortFunc[33] = TComRdCost::xGetVSD32; 245 m_afpDistortFunc[34] = TComRdCost::xGetVSD64; 246 m_afpDistortFunc[35] = TComRdCost::xGetVSD16N; 247 #endif 222 248 #if !FIX203 223 249 m_puiComponentCostOriginP = NULL; … … 230 256 #if !FIX203 231 257 m_iSearchLimit = 0xdeaddead; 258 #endif 259 #if H_3D_VSO 260 m_bUseVSO = false; 261 m_uiVSOMode = 0; 262 m_fpDistortFuncVSO = NULL; 263 m_pcRenModel = NULL; 264 265 // SAIT_VSO_EST_A0033 266 m_bUseEstimatedVSD = false; 232 267 #endif 233 268 } … … 484 519 #endif 485 520 } 521 #if H_3D_VSO 522 // SAIT_VSO_EST_A0033 523 UInt TComRdCost::getDistPartVSD( TComDataCU* pcCU, UInt uiPartOffset, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHAD, DFunc eDFunc ) 524 { 525 AOT( ( m_dDisparityCoeff <= 0 ) || ( m_dDisparityCoeff > 10 ) ); 526 527 Pel* piVirRec = m_pcVideoRecPicYuv->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiPartOffset); 528 Pel* piVirOrg = m_pcDepthPicYuv ->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiPartOffset); 529 Int iVirStride = m_pcVideoRecPicYuv->getStride(); 530 531 DistParam cDtParam; 532 setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam ); 533 cDtParam.pOrg = piOrg; 534 cDtParam.pCur = piCur; 535 cDtParam.pVirRec = piVirRec; 536 cDtParam.pVirOrg = piVirOrg; 537 cDtParam.iStrideVir = iVirStride; 538 cDtParam.iStrideOrg = iOrgStride; 539 cDtParam.iStrideCur = iCurStride; 540 cDtParam.iStep = 1; 541 542 cDtParam.bApplyWeight = false; 543 cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. 544 545 Dist dist = cDtParam.DistFunc( &cDtParam ); 546 547 if ( m_bUseWVSO ) 548 { 549 Int iDWeight = m_iDWeight * m_iDWeight; 550 Int iVSOWeight = m_iVSDWeight * m_iVSDWeight; 551 Dist distDepth; 552 553 if ( !bHAD ) 554 { 555 distDepth = (Dist) getDistPart( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 556 } 557 else 558 { 559 distDepth = (Dist) calcHAD( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 560 } 561 562 dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight); 563 } 564 return dist; 565 566 } 567 #endif 486 568 487 569 #if RATE_CONTROL_LAMBDA_DOMAIN … … 1359 1441 return ( uiSum ); 1360 1442 } 1443 #if H_3D_VSO 1444 //SAIT_VSO_EST_A0033 1445 UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y ) 1446 { 1447 Double dD; 1448 Int iTemp; 1449 1450 dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) ) ) * m_dDisparityCoeff; 1451 1452 Double dTemp = ( 0.5 * fabs(dD) * ( abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x-1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x+1+y*iVirStride ] ) ) ); 1453 iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5)); 1454 1455 return (UInt) ( (iTemp*iTemp)>>1 ); 1456 } 1457 1458 UInt TComRdCost::xGetVSD( DistParam* pcDtParam ) 1459 { 1460 Pel* piOrg = pcDtParam->pOrg; 1461 Pel* piCur = pcDtParam->pCur; 1462 Pel* piVirRec = pcDtParam->pVirRec; 1463 Pel* piVirOrg = pcDtParam->pVirOrg; 1464 Int iRows = pcDtParam->iRows; 1465 Int iCols = pcDtParam->iCols; 1466 Int iStrideOrg = pcDtParam->iStrideOrg; 1467 Int iStrideCur = pcDtParam->iStrideCur; 1468 Int iStrideVir = pcDtParam->iStrideVir; 1469 1470 UInt uiSum = 0; 1471 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1; 1472 1473 Int dDM; 1474 1475 for ( Int y = 0 ; y < iRows ; y++ ) 1476 { 1477 for (Int x = 0; x < iCols; x++ ) 1478 { 1479 dDM = (Int) ( piOrg[x ] - piCur[x ] ); 1480 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; 1481 } 1482 piOrg += iStrideOrg; 1483 piCur += iStrideCur; 1484 } 1485 1486 return ( uiSum ); 1487 } 1488 1489 UInt TComRdCost::xGetVSD4( DistParam* pcDtParam ) 1490 { 1491 Pel* piOrg = pcDtParam->pOrg; 1492 Pel* piCur = pcDtParam->pCur; 1493 Pel* piVirRec = pcDtParam->pVirRec; 1494 Pel* piVirOrg = pcDtParam->pVirOrg; 1495 Int iRows = pcDtParam->iRows; 1496 Int iStrideOrg = pcDtParam->iStrideOrg; 1497 Int iStrideCur = pcDtParam->iStrideCur; 1498 Int iStrideVir = pcDtParam->iStrideVir; 1499 1500 UInt uiSum = 0; 1501 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1; 1502 1503 Int dDM; 1504 1505 for ( Int y = 0 ; y < iRows ; y++ ) 1506 { 1507 dDM = (Int) ( piOrg[0] - piCur[0] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 0, y ) ) >> uiShift; 1508 dDM = (Int) ( piOrg[1] - piCur[1] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 1, y ) ) >> uiShift; 1509 dDM = (Int) ( piOrg[2] - piCur[2] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 2, y ) ) >> uiShift; 1510 dDM = (Int) ( piOrg[3] - piCur[3] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 3, y ) ) >> uiShift; 1511 1512 piOrg += iStrideOrg; 1513 piCur += iStrideCur; 1514 } 1515 1516 return ( uiSum ); 1517 } 1518 1519 UInt TComRdCost::xGetVSD8( DistParam* pcDtParam ) 1520 { 1521 Pel* piOrg = pcDtParam->pOrg; 1522 Pel* piCur = pcDtParam->pCur; 1523 Pel* piVirRec = pcDtParam->pVirRec; 1524 Pel* piVirOrg = pcDtParam->pVirOrg; 1525 Int iRows = pcDtParam->iRows; 1526 Int iStrideOrg = pcDtParam->iStrideOrg; 1527 Int iStrideCur = pcDtParam->iStrideCur; 1528 Int iStrideVir = pcDtParam->iStrideVir; 1529 1530 UInt uiSum = 0; 1531 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1; 1532 1533 Int dDM; 1534 1535 for ( Int y = 0 ; y < iRows ; y++ ) 1536 { 1537 for (Int x = 0; x < 8; x++ ) 1538 { 1539 dDM = (Int) ( piOrg[x] - piCur[x] ); 1540 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; 1541 } 1542 piOrg += iStrideOrg; 1543 piCur += iStrideCur; 1544 } 1545 1546 return ( uiSum ); 1547 } 1548 1549 UInt TComRdCost::xGetVSD16( DistParam* pcDtParam ) 1550 { 1551 Pel* piOrg = pcDtParam->pOrg; 1552 Pel* piCur = pcDtParam->pCur; 1553 Pel* piVirRec = pcDtParam->pVirRec; 1554 Pel* piVirOrg = pcDtParam->pVirOrg; 1555 Int iRows = pcDtParam->iRows; 1556 Int iStrideOrg = pcDtParam->iStrideOrg; 1557 Int iStrideCur = pcDtParam->iStrideCur; 1558 Int iStrideVir = pcDtParam->iStrideVir; 1559 1560 UInt uiSum = 0; 1561 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1; 1562 1563 Int dDM; 1564 1565 for ( Int y = 0 ; y < iRows ; y++ ) 1566 { 1567 for (Int x = 0; x < 16; x++ ) 1568 { 1569 dDM = (Int) ( piOrg[x] - piCur[x] ); 1570 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; 1571 } 1572 piOrg += iStrideOrg; 1573 piCur += iStrideCur; 1574 } 1575 1576 return ( uiSum ); 1577 } 1578 1579 UInt TComRdCost::xGetVSD16N( DistParam* pcDtParam ) 1580 { 1581 Pel* piOrg = pcDtParam->pOrg; 1582 Pel* piCur = pcDtParam->pCur; 1583 Pel* piVirRec = pcDtParam->pVirRec; 1584 Pel* piVirOrg = pcDtParam->pVirOrg; 1585 Int iRows = pcDtParam->iRows; 1586 Int iCols = pcDtParam->iCols; 1587 Int iStrideOrg = pcDtParam->iStrideOrg; 1588 Int iStrideCur = pcDtParam->iStrideCur; 1589 Int iStrideVir = pcDtParam->iStrideVir; 1590 1591 UInt uiSum = 0; 1592 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1; 1593 1594 Int dDM; 1595 1596 for ( Int y = 0 ; y < iRows ; y++ ) 1597 { 1598 for (Int x = 0; x < iCols; x+=16 ) 1599 { 1600 for ( Int k = 0 ; k < 16 ; k++ ) 1601 { 1602 dDM = (Int) ( piOrg[x+k] - piCur[x+k] ); 1603 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x+k, y ) >> uiShift; 1604 } 1605 } 1606 piOrg += iStrideOrg; 1607 piCur += iStrideCur; 1608 } 1609 1610 return ( uiSum ); 1611 } 1612 1613 UInt TComRdCost::xGetVSD32( DistParam* pcDtParam ) 1614 { 1615 Pel* piOrg = pcDtParam->pOrg; 1616 Pel* piCur = pcDtParam->pCur; 1617 Pel* piVirRec = pcDtParam->pVirRec; 1618 Pel* piVirOrg = pcDtParam->pVirOrg; 1619 Int iRows = pcDtParam->iRows; 1620 Int iStrideOrg = pcDtParam->iStrideOrg; 1621 Int iStrideCur = pcDtParam->iStrideCur; 1622 Int iStrideVir = pcDtParam->iStrideVir; 1623 1624 UInt uiSum = 0; 1625 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1; 1626 1627 Int dDM; 1628 1629 for ( Int y = 0 ; y < iRows ; y++ ) 1630 { 1631 for (Int x = 0; x < 32 ; x++ ) 1632 { 1633 dDM = (Int) ( piOrg[x] - piCur[x] ); 1634 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; 1635 } 1636 piOrg += iStrideOrg; 1637 piCur += iStrideCur; 1638 } 1639 1640 return ( uiSum ); 1641 } 1642 1643 UInt TComRdCost::xGetVSD64( DistParam* pcDtParam ) 1644 { 1645 Pel* piOrg = pcDtParam->pOrg; 1646 Pel* piCur = pcDtParam->pCur; 1647 Pel* piVirRec = pcDtParam->pVirRec; 1648 Pel* piVirOrg = pcDtParam->pVirOrg; 1649 Int iRows = pcDtParam->iRows; 1650 Int iStrideOrg = pcDtParam->iStrideOrg; 1651 Int iStrideCur = pcDtParam->iStrideCur; 1652 Int iStrideVir = pcDtParam->iStrideVir; 1653 1654 UInt uiSum = 0; 1655 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1; 1656 1657 Int dDM; 1658 1659 for ( Int y = 0 ; y < iRows ; y++ ) 1660 { 1661 for (Int x = 0; x < 64; x++ ) 1662 { 1663 dDM = (Int) ( piOrg[x] - piCur[x] ); 1664 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; 1665 } 1666 piOrg += iStrideOrg; 1667 piCur += iStrideCur; 1668 } 1669 1670 return ( uiSum ); 1671 } 1672 1673 #endif 1361 1674 1362 1675 // -------------------------------------------------------------------------------------------------------------------- … … 1989 2302 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 1990 2303 } 2304 #if H_3D_VSO 2305 Void TComRdCost::setLambdaVSO( Double dLambdaVSO ) 2306 { 2307 m_dLambdaVSO = dLambdaVSO; 2308 m_dSqrtLambdaVSO = sqrt(m_dLambdaVSO); 2309 m_uiLambdaMotionSADVSO = (UInt)floor(65536.0 * m_dSqrtLambdaVSO); 2310 m_uiLambdaMotionSSEVSO = (UInt)floor(65536.0 * m_dLambdaVSO ); 2311 } 2312 2313 Dist TComRdCost::xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ) 2314 { 2315 AOT(bSAD); 2316 #if H_3D_VSO_EARLY_SKIP 2317 RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur, piOrg, iOrgStride); 2318 #else 2319 RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur ); 2320 #endif 2321 2322 RMDist iDistMin = (RMDist) RDO_DIST_MIN; 2323 iDistMin = m_bAllowNegDist ? RDO_DIST_MIN : 0; 2324 2325 iDist = std::min( iDist, (RMDist) RDO_DIST_MAX); 2326 iDist = std::max( iDist, iDistMin); 2327 return (Dist) iDist; 2328 } 2329 2330 2331 Dist TComRdCost::getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHAD ) 2332 { 2333 assert( m_bUseVSO ); 2334 assert( this->m_fpDistortFuncVSO != 0 ); 2335 2336 Int iPosX; 2337 Int iPosY; 2338 2339 pcCU->getPosInPic( uiAbsPartIndex, iPosX, iPosY ); 2340 2341 Dist dist = (this->*m_fpDistortFuncVSO) ( iPosX, iPosY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, bHAD ); 2342 2343 if ( m_bUseWVSO ) 2344 { 2345 Int iDWeight = m_iDWeight * m_iDWeight; 2346 Int iVSOWeight = m_iVSOWeight * m_iVSOWeight; 2347 Dist distDepth; 2348 2349 if ( !bHAD ) 2350 { 2351 distDepth = (Dist) getDistPart( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 2352 } 2353 else 2354 { 2355 distDepth = (Dist) calcHAD( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 2356 } 2357 2358 dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight); 2359 } 2360 return dist; 2361 }; 2362 2363 2364 Void TComRdCost::setVSOMode( UInt uiIn ) 2365 { 2366 m_uiVSOMode = uiIn; 2367 switch (m_uiVSOMode ) 2368 { 2369 case 4: 2370 m_fpDistortFuncVSO = &TComRdCost::xGetDistVSOMode4; 2371 break; 2372 default: 2373 assert(0); 2374 break; 2375 } 2376 } 2377 2378 2379 Double TComRdCost::calcRdCostVSO( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc ) 2380 { 2381 assert( m_bUseLambdaScaleVSO ); 2382 2383 Double dRdCost = 0.0; 2384 Double dLambda = 0.0; 2385 2386 switch ( eDFunc ) 2387 { 2388 case DF_SSE: 2389 assert(0); 2390 break; 2391 case DF_SAD: 2392 dLambda = (Double)m_uiLambdaMotionSADVSO; 2393 break; 2394 case DF_DEFAULT: 2395 dLambda = m_dLambdaVSO; 2396 break; 2397 case DF_SSE_FRAME: 2398 dLambda = m_dFrameLambdaVSO; 2399 break; 2400 default: 2401 assert (0); 2402 break; 2403 } 2404 2405 if (bFlag) 2406 { 2407 // Intra8x8, Intra4x4 Block only... 2408 #if SEQUENCE_LEVEL_LOSSLESS 2409 dRdCost = (Double)(uiBits); 2410 #else 2411 dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda)); 2412 #endif 2413 } 2414 else 2415 { 2416 if (eDFunc == DF_SAD) 2417 { 2418 dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)>>16)); 2419 dRdCost = (Double)(Dist)floor(dRdCost); 2420 } 2421 else 2422 { 2423 #if SEQUENCE_LEVEL_LOSSLESS 2424 dRdCost = (Double)(uiBits); 2425 #else 2426 dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5))); 2427 dRdCost = (Double)(Dist)floor(dRdCost); 2428 #endif 2429 } 2430 } 2431 2432 return dRdCost; 2433 } 2434 2435 Void TComRdCost::setRenModelData( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight ) 2436 { 2437 UInt iBlkX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]]; 2438 UInt iBlkY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]]; 2439 2440 Int iStartPosX = iBlkX + pcCU->getCUPelX(); 2441 Int iStartPosY = iBlkY + pcCU->getCUPelY(); 2442 2443 m_pcRenModel->setData( iStartPosX, iStartPosY, iBlkWidth, iBlkHeight, iStride, piData ); 2444 } 2445 2446 Void TComRdCost::setAllowNegDist( Bool bAllowNegDist ) 2447 { 2448 m_bAllowNegDist = bAllowNegDist; 2449 } 2450 #endif 1991 2451 1992 2452 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComRdCost.h
r324 r446 46 46 #include "TComSlice.h" 47 47 #include "TComRdCostWeightPrediction.h" 48 #if H_3D 49 #include "../TLibRenderer/TRenModel.h" 50 #endif 48 51 49 52 //! \ingroup TLibCommon … … 54 57 class DistParam; 55 58 class TComPattern; 59 #if H_3D 60 class TComRdCost; 61 #endif 56 62 57 63 // ==================================================================================================================== … … 62 68 typedef UInt (*FpDistFunc) (DistParam*); 63 69 70 #if H_3D 71 #if H_3D_VSO 72 typedef Dist (TComRdCost::*FpDistFuncVSO) ( Int, Int, Pel*, Int, Pel*, Int, UInt, UInt, Bool ); 73 #endif 74 #endif 64 75 // ==================================================================================================================== 65 76 // Class definition … … 74 85 Int iStrideOrg; 75 86 Int iStrideCur; 87 #if H_3D_VSO 88 // SAIT_VSO_EST_A0033 89 Pel* pVirRec; 90 Pel* pVirOrg; 91 Int iStrideVir; 92 #endif 76 93 Int iRows; 77 94 Int iCols; … … 107 124 bUseNSHAD = false; 108 125 #endif 126 #if H_3D_VSO 127 // SAIT_VSO_EST_A0033 128 pVirRec = NULL; 129 pVirOrg = NULL; 130 iStrideVir = 0; 131 #endif 109 132 } 110 133 }; … … 134 157 UInt m_uiLambdaMotionSSE; 135 158 Double m_dFrameLambda; 159 #if H_3D_VSO 160 // SAIT_VSO_EST_A0033 161 static Double m_dDisparityCoeff; 162 #endif 136 163 137 164 // for motion cost … … 153 180 TComRdCost(); 154 181 virtual ~TComRdCost(); 155 182 183 #if H_3D_VSO 184 Double calcRdCost ( UInt uiBits, Dist uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 185 Double calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 186 #else 156 187 Double calcRdCost ( UInt uiBits, UInt uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 157 188 Double calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 189 #endif 190 158 191 159 192 #if WEIGHTED_CHROMA_DISTORTION … … 165 198 166 199 Double getSqrtLambda () { return m_sqrtLambda; } 200 #if H_3D_VSO 201 // SAIT_VSO_EST_A0033 202 Void setDisparityCoeff( Double dDisparityCoeff ) { m_dDisparityCoeff = dDisparityCoeff; } 203 Double getDisparityCoeff() { return m_dDisparityCoeff; } 204 #endif 167 205 168 206 #if RATE_CONTROL_LAMBDA_DOMAIN … … 239 277 static UInt xGetSAD16N ( DistParam* pcDtParam ); 240 278 279 #if H_3D_VSO 280 static UInt xGetVSD ( DistParam* pcDtParam ); 281 static UInt xGetVSD4 ( DistParam* pcDtParam ); 282 static UInt xGetVSD8 ( DistParam* pcDtParam ); 283 static UInt xGetVSD16 ( DistParam* pcDtParam ); 284 static UInt xGetVSD32 ( DistParam* pcDtParam ); 285 static UInt xGetVSD64 ( DistParam* pcDtParam ); 286 static UInt xGetVSD16N ( DistParam* pcDtParam ); 287 #endif 288 241 289 #if AMP_SAD 242 290 static UInt xGetSAD12 ( DistParam* pcDtParam ); … … 267 315 UInt getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ); 268 316 #endif 317 318 #if H_3D_VSO 319 // SAIT_VSO_EST_A0033 320 UInt getDistPartVSD( TComDataCU* pcCu, UInt uiPartOffset, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHad, DFunc eDFunc = DF_VSD); 321 static UInt getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y ); 322 323 private: 324 Double m_dLambdaVSO; 325 Double m_dSqrtLambdaVSO; 326 UInt m_uiLambdaMotionSADVSO; 327 UInt m_uiLambdaMotionSSEVSO; 328 Double m_dFrameLambdaVSO; 329 Bool m_bAllowNegDist; 330 Bool m_bUseVSO; 331 Bool m_bUseLambdaScaleVSO; 332 UInt m_uiVSOMode; 333 334 FpDistFuncVSO m_fpDistortFuncVSO; 335 TRenModel* m_pcRenModel; 336 337 338 // SAIT_VSO_EST_A0033 339 TComPicYuv * m_pcVideoRecPicYuv; 340 TComPicYuv * m_pcDepthPicYuv; 341 Bool m_bUseEstimatedVSD; 342 343 // LGE_WVSO_A0119 344 Int m_iDWeight; 345 Int m_iVSOWeight; 346 Int m_iVSDWeight; 347 Bool m_bUseWVSO; 348 349 public: 350 351 Void setRenModel ( TRenModel* pcRenModel ) { m_pcRenModel = pcRenModel; } 352 TRenModel* getRenModel ( ) { return m_pcRenModel; } 353 Void setRenModelData ( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight ); 354 Void setLambdaVSO ( Double dLambda ); 355 Void setFrameLambdaVSO ( Double dLambda ) { m_dFrameLambdaVSO = dLambda; }; 356 357 358 Void setUseVSO ( Bool bIn ) { m_bUseVSO = bIn; }; 359 Bool getUseVSO ( ) { return m_bUseVSO;}; 360 361 Bool getUseRenModel ( ) { return (m_bUseVSO && m_uiVSOMode == 4); }; 362 Void setUseLambdaScaleVSO(Bool bIn) { m_bUseLambdaScaleVSO = bIn; }; 363 Bool getUseLambdaScaleVSO( ) { return m_bUseLambdaScaleVSO; }; 364 365 Void setVSOMode( UInt uiIn); 366 UInt getVSOMode( ) { return m_uiVSOMode; } 367 Void setAllowNegDist ( Bool bAllowNegDist ); 368 369 Double getSqrtLambdaVSO () { return m_dSqrtLambdaVSO; } 370 Double getLambdaVSO () { return m_dLambdaVSO; } 371 372 Dist getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ); 373 Double calcRdCostVSO ( UInt uiBits, Dist uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 374 375 // SAIT_VSO_EST_A0033 376 Bool getUseEstimatedVSD( ) { return m_bUseEstimatedVSD; }; 377 Void setUseEstimatedVSD( Bool bIn ) { m_bUseEstimatedVSD = bIn; }; 378 379 TComPicYuv* getVideoRecPicYuv () { return m_pcVideoRecPicYuv; }; 380 Void setVideoRecPicYuv ( TComPicYuv* pcVideoRecPicYuv ) { m_pcVideoRecPicYuv = pcVideoRecPicYuv; }; 381 TComPicYuv* getDepthPicYuv () { return m_pcDepthPicYuv; }; 382 Void setDepthPicYuv ( TComPicYuv* pcDepthPicYuv ) { m_pcDepthPicYuv = pcDepthPicYuv; }; 383 384 // LGE_WVSO_A0119 385 Void setUseWVSO ( Bool bIn ) { m_bUseWVSO = bIn; }; 386 Bool getUseWVSO ( ) { return m_bUseWVSO;}; 387 Void setDWeight ( Int iDWeight ) { m_iDWeight = iDWeight; }; 388 Int getDWeight () { return m_iDWeight; }; 389 Void setVSOWeight ( Int iVSOWeight ) { m_iVSOWeight = iVSOWeight; }; 390 Int getVSOWeight () { return m_iVSOWeight; }; 391 Void setVSDWeight ( Int iVSDWeight ) { m_iVSDWeight = iVSDWeight; }; 392 Int getVSDWeight () { return m_iVSDWeight; }; 393 394 private: 395 Dist xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ); 396 397 #endif // H_3D_VSO 398 269 399 };// END CLASS DEFINITION TComRdCost 270 400 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComRom.cpp
r438 r446 62 62 g_aucConvertToBit[ i ] = c; 63 63 64 // g_auiFrameScanXY[ g_aucConvertToBit[ transformSize ] ]: zigzag scan array for transformSize65 64 c=2; 66 65 for ( i=0; i<MAX_CU_DEPTH; i++ ) … … 77 76 Void destroyROM() 78 77 { 79 Int i; 80 81 for ( i=0; i<MAX_CU_DEPTH; i++ ) 78 for (Int i=0; i<MAX_CU_DEPTH; i++ ) 82 79 { 83 80 delete[] g_auiSigLastScan[0][i]; -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComSlice.cpp
r438 r446 49 49 , m_iPOC ( 0 ) 50 50 , m_iLastIDR ( 0 ) 51 , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR )51 , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) 52 52 , m_eSliceType ( I_SLICE ) 53 53 , m_iSliceQp ( 0 ) … … 60 60 , m_deblockingFilterBetaOffsetDiv2 ( 0 ) 61 61 , m_deblockingFilterTcOffsetDiv2 ( 0 ) 62 #if !L0034_COMBINED_LIST_CLEANUP 62 63 , m_bRefPicListModificationFlagLC ( false ) 63 64 , m_bRefPicListCombinationFlag ( false ) 65 #endif 64 66 , m_bCheckLDC ( false ) 65 67 , m_iSliceQpDelta ( 0 ) … … 79 81 , m_dLambda ( 0.0 ) 80 82 #endif 83 #if !L0034_COMBINED_LIST_CLEANUP 81 84 , m_bNoBackPredFlag ( false ) 85 #endif 82 86 , m_uiTLayer ( 0 ) 83 87 , m_bTLayerSwitchingFlag ( false ) … … 107 111 , m_viewId (0) 108 112 #if H_3D 113 , m_viewIndex (0) 109 114 , m_isDepth (false) 110 115 #endif 111 116 #endif 112 117 { 118 #if L0034_COMBINED_LIST_CLEANUP 119 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0; 120 #else 113 121 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; 122 #endif 114 123 115 124 initEqualRef(); 116 125 126 #if L0034_COMBINED_LIST_CLEANUP 127 for ( Int idx = 0; idx < MAX_NUM_REF; idx++ ) 128 { 129 m_list1IdxToList0Idx[idx] = -1; 130 } 131 #else 117 132 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++) 118 133 { … … 124 139 m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1; 125 140 } 141 #endif 126 142 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) 127 143 { … … 135 151 #endif 136 152 } 137 resetWpScaling( m_weightPredTable);153 resetWpScaling(); 138 154 initWpAcDcParam(); 139 155 m_saoEnabledFlag = false; … … 156 172 m_colRefIdx = 0; 157 173 initEqualRef(); 174 #if !L0034_COMBINED_LIST_CLEANUP 158 175 m_bNoBackPredFlag = false; 159 176 m_bRefPicListCombinationFlag = false; 160 177 m_bRefPicListModificationFlagLC = false; 178 #endif 161 179 m_bCheckLDC = false; 162 180 m_iSliceQpDeltaCb = 0; 163 181 m_iSliceQpDeltaCr = 0; 164 182 183 #if !L0034_COMBINED_LIST_CLEANUP 165 184 m_aiNumRefIdx[REF_PIC_LIST_C] = 0; 185 #endif 166 186 167 187 m_maxNumMergeCand = MRG_MAX_NUM_CANDS; … … 177 197 Bool TComSlice::getRapPicFlag() 178 198 { 179 return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR 199 return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 180 200 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP 181 201 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 182 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT183 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 202 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 203 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 184 204 || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA; 185 205 } … … 251 271 252 272 253 TComPic* TComSlice::xGetLongTermRefPic (TComList<TComPic*>& rcListPic, 254 Int poc) 273 TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb) 255 274 { 256 275 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 257 276 TComPic* pcPic = *(iterPic); 258 277 TComPic* pcStPic = pcPic; 278 279 Int pocCycle = 1 << getSPS()->getBitsForPOC(); 280 if (!pocHasMsb) 281 { 282 poc = poc % pocCycle; 283 } 284 259 285 while ( iterPic != rcListPic.end() ) 260 286 { 261 287 pcPic = *(iterPic); 262 if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (poc%(1<<getSPS()->getBitsForPOC()))) 288 if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced()) 289 { 290 Int picPoc = pcPic->getPOC(); 291 if (!pocHasMsb) 292 { 293 picPoc = picPoc % pocCycle; 294 } 295 296 if (poc == picPoc) 263 297 { 264 298 if(pcPic->getIsLongTerm()) … … 272 306 break; 273 307 } 308 } 274 309 275 310 iterPic++; 276 311 } 312 277 313 return pcStPic; 278 314 } … … 293 329 } 294 330 331 #if L0034_COMBINED_LIST_CLEANUP 332 Void TComSlice::setList1IdxToList0Idx() 333 { 334 Int idxL0, idxL1; 335 for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ ) 336 { 337 m_list1IdxToList0Idx[idxL1] = -1; 338 for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ ) 339 { 340 if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() ) 341 { 342 m_list1IdxToList0Idx[idxL1] = idxL0; 343 break; 344 } 345 } 346 } 347 } 348 #else 295 349 Void TComSlice::generateCombinedList() 296 350 { … … 365 419 } 366 420 } 421 #endif 367 422 368 423 #if H_MV 369 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer ) 424 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer , Bool checkNumPocTotalCurr) 425 #else 426 #if FIX1071 427 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr ) 370 428 #else 371 429 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic ) 372 430 #endif 373 { 374 if (m_eSliceType == I_SLICE) 375 { 376 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 377 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 431 #endif 432 { 433 #if FIX1071 434 if (!checkNumPocTotalCurr) 435 #endif 436 { 437 if (m_eSliceType == I_SLICE) 438 { 439 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 440 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 441 442 return; 443 } 378 444 379 return;380 }381 382 445 #if !H_MV 383 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); 384 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); 385 #endif 446 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); 447 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); 448 #endif 449 } 386 450 387 451 TComPic* pcRefPic= NULL; … … 397 461 #endif 398 462 Int i; 399 400 463 for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) 401 464 { … … 410 473 } 411 474 } 475 412 476 for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) 413 477 { … … 422 486 } 423 487 } 488 424 489 for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) 425 490 { 426 491 if(m_pcRPS->getUsed(i)) 427 492 { 428 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i) );493 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 429 494 pcRefPic->setIsLongTerm(1); 430 495 pcRefPic->getPicYuvRec()->extendPicBorder(); … … 434 499 if(pcRefPic==NULL) 435 500 { 436 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i) );501 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 437 502 } 438 503 pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); … … 448 513 Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; 449 514 #endif 450 451 { 452 Int cIdx = 0; 453 for ( i=0; i<NumPocStCurr0; i++, cIdx++) 454 { 455 rpsCurrList0[cIdx] = RefPicSetStCurr0[i]; 456 } 457 for ( i=0; i<NumPocStCurr1; i++, cIdx++) 458 { 459 rpsCurrList0[cIdx] = RefPicSetStCurr1[i]; 460 } 461 for ( i=0; i<NumPocLtCurr; i++, cIdx++) 462 { 463 rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; 464 } 515 #if FIX1071 516 if (checkNumPocTotalCurr) 517 { 518 // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr: 465 519 #if H_MV 466 for ( i=0; i<numDirectRefLayers; i++, cIdx++) 467 { 468 if( cIdx <= MAX_NUM_REF ) 469 { 470 rpsCurrList0[cIdx] = refPicSetInterLayer[i]; 471 } 472 } 473 #endif 474 } 520 // – If nuh_layer_id is equal to 0 and the current picture is a BLA picture or a CRA picture, the value of NumPocTotalCurr shall be equal to 0. 521 // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. 522 if ( getRapPicFlag() && m_layerId == 0 ) 523 #else 524 // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. 525 // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. 526 if (getRapPicFlag()) 527 #endif 528 { 529 assert(numPocTotalCurr == 0); 530 } 531 532 if (m_eSliceType == I_SLICE) 533 { 534 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 535 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 536 537 return; 538 } 539 540 assert(numPocTotalCurr != 0); 541 542 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); 543 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); 544 } 545 #endif 546 547 Int cIdx = 0; 548 for ( i=0; i<NumPocStCurr0; i++, cIdx++) 549 { 550 rpsCurrList0[cIdx] = RefPicSetStCurr0[i]; 551 } 552 for ( i=0; i<NumPocStCurr1; i++, cIdx++) 553 { 554 rpsCurrList0[cIdx] = RefPicSetStCurr1[i]; 555 } 556 for ( i=0; i<NumPocLtCurr; i++, cIdx++) 557 { 558 rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; 559 } 560 #if H_MV 561 for ( i=0; i<numDirectRefLayers; i++, cIdx++) 562 { 563 if( cIdx <= MAX_NUM_REF ) 564 { 565 rpsCurrList0[cIdx] = refPicSetInterLayer[i]; 566 } 567 } 568 #endif 475 569 476 570 if (m_eSliceType==B_SLICE) 477 571 { 478 IntcIdx = 0;572 cIdx = 0; 479 573 for ( i=0; i<NumPocStCurr1; i++, cIdx++) 480 574 { … … 524 618 } 525 619 620 #if H_MV 621 // Temporary fix for FIX1071 should be removed later 622 Int TComSlice::getNumRpsCurrTempList( TComReferencePictureSet* rps /* = 0 */) 623 #else 526 624 Int TComSlice::getNumRpsCurrTempList() 527 { 625 #endif 626 { 627 528 628 Int numRpsCurrTempList = 0; 529 629 … … 532 632 return 0; 533 633 } 634 #if H_MV 635 // Temporary fix for FIX1071 should be removed later 636 if (rps == NULL) 637 { 638 rps = m_pcRPS; 639 } 640 641 for(UInt i=0; i < rps->getNumberOfNegativePictures()+ rps->getNumberOfPositivePictures() + rps->getNumberOfLongtermPictures(); i++) 642 { 643 if(rps->getUsed(i)) 644 #else 534 645 for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++) 535 646 { 536 647 if(m_pcRPS->getUsed(i)) 648 #endif 537 649 { 538 650 numRpsCurrTempList++; … … 558 670 } 559 671 } 672 #if H_3D 673 Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset ) 674 { 675 if( m_pcSPS->hasCamParInSliceHeader() ) 676 { 677 for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < m_viewIndex; uiBaseViewIndex++ ) 678 { 679 m_aaiCodedScale [ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][ m_viewIndex ]; 680 m_aaiCodedScale [ 1 ][ uiBaseViewIndex ] = aaiScale [ m_viewIndex ][ uiBaseViewIndex ]; 681 m_aaiCodedOffset[ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][ m_viewIndex ]; 682 m_aaiCodedOffset[ 1 ][ uiBaseViewIndex ] = aaiOffset[ m_viewIndex ][ uiBaseViewIndex ]; 683 } 684 } 685 } 686 #endif 560 687 561 688 Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) … … 585 712 } 586 713 587 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA )714 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic) 588 715 { 589 716 for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) … … 598 725 if(pocCRA < MAX_UINT && getPOC() > pocCRA) 599 726 { 727 if (!pReferencePictureSet->getCheckLTMSBPresent(i)) 728 { 729 assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA); 730 } 731 else 732 { 600 733 assert(pReferencePictureSet->getPOC(i) >= pocCRA); 601 734 } 602 735 } 603 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found 736 } 737 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found 604 738 { 605 739 pocCRA = getPOC(); … … 611 745 prevRAPisBLA = false; 612 746 } 613 else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 614 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT747 else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 748 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 615 749 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found 616 750 { … … 643 777 Int pocCurr = getPOC(); 644 778 645 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 646 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT779 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 780 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 647 781 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 648 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR 782 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 649 783 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR or BLA picture 650 784 { … … 658 792 iterPic++; 659 793 } 660 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 661 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT794 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 795 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 662 796 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 663 797 { … … 673 807 { 674 808 rpcPic = *(iterPic); 675 if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false); 809 if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) 810 { 811 rpcPic->getSlice(0)->setReferenced(false); 812 } 676 813 iterPic++; 677 814 } … … 707 844 m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; 708 845 846 #if L0034_COMBINED_LIST_CLEANUP 847 for (i = 0; i < 2; i++) 848 #else 709 849 for (i = 0; i < 3; i++) 850 #endif 710 851 { 711 852 m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; 712 853 } 713 854 855 #if L0034_COMBINED_LIST_CLEANUP 856 for (i = 0; i < MAX_NUM_REF; i++) 857 { 858 m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i]; 859 } 860 #else 714 861 for (i = 0; i < 2; i++) 715 862 { … … 728 875 m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC; 729 876 m_bRefPicListCombinationFlag = pSrc->m_bRefPicListCombinationFlag; 877 #endif 730 878 m_bCheckLDC = pSrc->m_bCheckLDC; 731 879 m_iSliceQpDelta = pSrc->m_iSliceQpDelta; … … 785 933 } 786 934 935 #if !L0034_COMBINED_LIST_CLEANUP 787 936 m_bNoBackPredFlag = pSrc->m_bNoBackPredFlag; 937 #endif 788 938 m_uiTLayer = pSrc->m_uiTLayer; 789 939 m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; … … 819 969 820 970 Int TComSlice::m_prevPOC = 0; 971 821 972 /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. 822 973 * \param uiTLayer Temporal layer ID of the current slice … … 879 1030 Int i, isReference; 880 1031 881 Int j = 0;882 1032 // loop through all pictures in the reference picture buffer 883 1033 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 884 1034 while ( iterPic != rcListPic.end()) 885 1035 { 886 j++;887 1036 rpcPic = *(iterPic++); 1037 1038 if(!rpcPic->getSlice( 0 )->isReferenced()) 1039 { 1040 continue; 1041 } 888 1042 889 1043 isReference = 0; … … 924 1078 { 925 1079 rpcPic->getSlice( 0 )->setReferenced( false ); 1080 rpcPic->setUsedByCurr(0); 926 1081 rpcPic->setIsLongTerm(0); 927 1082 } … … 929 1084 assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer()); 930 1085 //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture 931 if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N)1086 if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) 932 1087 { 933 1088 assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer()); 934 1089 } 935 936 1090 //check that pictures marked as temporal layer non-reference pictures are not used for reference 937 1091 if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer()==this->getTLayer()) … … 947 1101 { 948 1102 TComPic* rpcPic; 949 Int i, isAvailable , j;1103 Int i, isAvailable; 950 1104 Int atLeastOneLost = 0; 951 1105 Int atLeastOneRemoved = 0; … … 956 1110 for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) 957 1111 { 958 j = 0;959 1112 isAvailable = 0; 960 1113 // loop through all pictures in the reference picture buffer … … 962 1115 while ( iterPic != rcListPic.end()) 963 1116 { 964 j++;965 1117 rpcPic = *(iterPic++); 966 1118 if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) … … 985 1137 while ( iterPic != rcListPic.end()) 986 1138 { 987 j++;988 1139 rpcPic = *(iterPic++); 989 1140 990 if((rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == (this->getPOC() + pReferencePictureSet->getDeltaPOC(i))%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced()) 1141 Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); 1142 Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC(); 1143 Int refPoc = pReferencePictureSet->getPOC(i); 1144 if (!pReferencePictureSet->getCheckLTMSBPresent(i)) 1145 { 1146 curPoc = curPoc % pocCycle; 1147 refPoc = refPoc % pocCycle; 1148 } 1149 1150 if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc) 991 1151 { 992 1152 isAvailable = 1; … … 1026 1186 for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) 1027 1187 { 1028 j = 0;1029 1188 isAvailable = 0; 1030 1189 // loop through all pictures in the reference picture buffer … … 1032 1191 while ( iterPic != rcListPic.end()) 1033 1192 { 1034 j++;1035 1193 rpcPic = *(iterPic++); 1036 1194 … … 1049 1207 { 1050 1208 if(printErrors) 1209 { 1051 1210 printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 1211 } 1052 1212 atLeastOneRemoved = 1; 1053 1213 } … … 1055 1215 { 1056 1216 if(printErrors) 1217 { 1057 1218 printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 1219 } 1058 1220 atLeastOneLost = 1; 1059 1221 iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); … … 1201 1363 * \returns Void 1202 1364 */ 1203 Void TComSlice::resetWpScaling( wpScalingParam wp[2][MAX_NUM_REF][3])1365 Void TComSlice::resetWpScaling() 1204 1366 { 1205 1367 for ( Int e=0 ; e<2 ; e++ ) … … 1209 1371 for ( Int yuv=0 ; yuv<3 ; yuv++ ) 1210 1372 { 1211 wpScalingParam *pwp = &( wp[e][i][yuv]);1373 wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); 1212 1374 pwp->bPresentFlag = false; 1213 1375 pwp->uiLog2WeightDenom = 0; … … 1225 1387 Void TComSlice::initWpScaling() 1226 1388 { 1227 initWpScaling(m_weightPredTable);1228 }1229 1230 /** set WP tables1231 * \param wpScalingParam1232 * \returns Void1233 */1234 Void TComSlice::initWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3])1235 {1236 1389 for ( Int e=0 ; e<2 ; e++ ) 1237 1390 { … … 1240 1393 for ( Int yuv=0 ; yuv<3 ; yuv++ ) 1241 1394 { 1242 wpScalingParam *pwp = &(wp[e][i][yuv]); 1243 if ( !pwp->bPresentFlag ) { 1395 wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); 1396 if ( !pwp->bPresentFlag ) 1397 { 1244 1398 // Inferring values not present : 1245 1399 pwp->iWeight = (1 << pwp->uiLog2WeightDenom); … … 1275 1429 , m_cprmsPresentFlag (NULL) 1276 1430 { 1277 1278 1431 for( Int i = 0; i < MAX_TLAYER; i++) 1279 1432 { 1280 1433 m_numReorderPics[i] = 0; 1434 #if L0323_DPB 1435 m_uiMaxDecPicBuffering[i] = 1; 1436 #else 1281 1437 m_uiMaxDecPicBuffering[i] = 0; 1438 #endif 1282 1439 m_uiMaxLatencyIncrease[i] = 0; 1283 1440 } … … 1315 1472 m_layerIdInNuh [i] = ( i == 0 ) ? 0 : -1; 1316 1473 m_numDirectRefLayers[i] = 0; 1474 #if H_3D 1475 m_viewIndex [i] = -1; 1476 #endif 1317 1477 1318 1478 for( Int j = 0; j < MAX_NUM_LAYERS; j++ ) … … 1326 1486 m_dimensionId[i][j] = 0; 1327 1487 } 1328 1329 1488 } 1330 1489 #endif … … 1333 1492 TComVPS::~TComVPS() 1334 1493 { 1335 if( m_hrdParameters != NULL ) deletem_hrdParameters;1336 if( m_hrdOpSetIdx != NULL ) delete m_hrdOpSetIdx;1337 if( m_cprmsPresentFlag != NULL ) delete m_cprmsPresentFlag;1494 if( m_hrdParameters != NULL ) delete[] m_hrdParameters; 1495 if( m_hrdOpSetIdx != NULL ) delete[] m_hrdOpSetIdx; 1496 if( m_cprmsPresentFlag != NULL ) delete[] m_cprmsPresentFlag; 1338 1497 } 1339 1498 … … 1398 1557 { 1399 1558 for ( Int scalType = 0; scalType < MAX_NUM_SCALABILITY_TYPES; scalType++ ) 1400 setScalabilityMask( scalType, ( val & (1 << scalType ) ) == 1);1559 setScalabilityMask( scalType, ( val & (1 << scalType ) ) != 0 ); 1401 1560 } 1402 1561 … … 1422 1581 Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType ) 1423 1582 { 1424 return ( ( layerIdInVps != 0 )&& getScalabilityMask( scalType ) ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0; 1425 } 1426 #endif 1583 return getScalabilityMask( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0; 1584 } 1585 1586 #if H_3D 1587 Void TComVPS::initViewIndex() 1588 { 1589 Int viewIdList [ MAX_NUM_LAYERS ]; // ed. should be changed to MAX_VIEW_ID 1590 Int viewIndexList[ MAX_NUM_LAYERS ]; 1591 Int numViewIds = 0; 1592 1593 for ( Int i = 0 ; i < m_uiMaxLayers; i++ ) 1594 { 1595 Int currViewId = getViewId( i ); 1596 1597 Bool viewIdInListFlag = false; 1598 for ( Int j = 0; j < numViewIds; j ++ ) 1599 { 1600 viewIdInListFlag = viewIdInListFlag || ( currViewId == viewIdList[ j ] ); 1601 } 1602 1603 if ( !viewIdInListFlag ) 1604 { 1605 viewIdList [ numViewIds ] = currViewId; 1606 viewIndexList[ currViewId ] = numViewIds; 1607 1608 numViewIds++; 1609 } 1610 1611 m_viewIndex[ i ] = viewIndexList[ currViewId ]; 1612 } 1613 } 1614 1615 Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag ) 1616 { 1617 Int foundlayerId = -1; 1618 1619 for (Int layer = 0 ; layer < m_uiMaxLayers; layer++ ) 1620 { 1621 if( ( getViewIndex( layer ) == viewIndex ) && ( getDepthId( layer ) == ( depthFlag ? 1 : 0 ) ) ) 1622 { 1623 foundlayerId = layer; 1624 break; 1625 } 1626 } 1627 assert( foundlayerId != -1 ); 1628 1629 return getLayerIdInNuh( foundlayerId ); 1630 } 1631 #endif // H_3D 1632 #endif // H_MV 1427 1633 1428 1634 // ------------------------------------------------------------------------------------------------ … … 1438 1644 , m_picWidthInLumaSamples (352) 1439 1645 , m_picHeightInLumaSamples (288) 1646 , m_log2MinCodingBlockSize ( 0) 1647 , m_log2DiffMaxMinCodingBlockSize (0) 1440 1648 , m_uiMaxCUWidth ( 32) 1441 1649 , m_uiMaxCUHeight ( 32) 1442 1650 , m_uiMaxCUDepth ( 3) 1443 , m_uiMinTrDepth ( 0)1444 , m_uiMaxTrDepth ( 1)1445 1651 , m_bLongTermRefsPresent (false) 1446 1652 , m_uiQuadtreeTULog2MaxSize ( 0) … … 1452 1658 , m_pcmLog2MaxSize ( 5) 1453 1659 , m_uiPCMLog2MinSize ( 7) 1660 #if !L0034_COMBINED_LIST_CLEANUP 1454 1661 , m_bUseLComb (false) 1662 #endif 1455 1663 , m_bitDepthY ( 8) 1456 1664 , m_bitDepthC ( 8) … … 1470 1678 , m_vuiParametersPresentFlag (false) 1471 1679 , m_vuiParameters () 1680 #if H_MV 1681 , m_interViewMvVertConstraintFlag (false) 1682 #endif 1683 #if H_3D 1684 , m_bCamParInSliceHeader (false) 1685 #endif 1472 1686 { 1473 1687 for ( Int i = 0; i < MAX_TLAYER; i++ ) 1474 1688 { 1475 1689 m_uiMaxLatencyIncrease[i] = 0; 1690 #if L0323_DPB 1691 m_uiMaxDecPicBuffering[i] = 1; 1692 #else 1476 1693 m_uiMaxDecPicBuffering[i] = 0; 1694 #endif 1477 1695 m_numReorderPics[i] = 0; 1478 1696 } … … 1493 1711 m_RPSList.create(numRPS); 1494 1712 } 1713 1495 1714 Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess ) 1496 1715 { … … 1683 1902 } 1684 1903 1904 #if H_3D 1905 Void 1906 TComSPS::initCamParaSPS( UInt uiViewIndex, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset ) 1907 { 1908 AOT( uiViewIndex != 0 && !bCamParSlice && ( aaiScale == 0 || aaiOffset == 0 ) ); 1909 1910 m_uiCamParPrecision = ( uiViewIndex ? uiCamParPrecision : 0 ); 1911 m_bCamParInSliceHeader = ( uiViewIndex ? bCamParSlice : false ); 1912 ::memset( m_aaiCodedScale, 0x00, sizeof( m_aaiCodedScale ) ); 1913 ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); 1914 1915 if( !m_bCamParInSliceHeader ) 1916 { 1917 for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ ) 1918 { 1919 m_aaiCodedScale [ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][ uiViewIndex ]; 1920 m_aaiCodedScale [ 1 ][ uiBaseViewIndex ] = aaiScale [ uiViewIndex ][ uiBaseViewIndex ]; 1921 m_aaiCodedOffset[ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][ uiViewIndex ]; 1922 m_aaiCodedOffset[ 1 ][ uiBaseViewIndex ] = aaiOffset[ uiViewIndex ][ uiBaseViewIndex ]; 1923 } 1924 } 1925 } 1926 #endif 1927 1685 1928 TComReferencePictureSet::TComReferencePictureSet() 1686 1929 : m_numberOfPictures (0) … … 1737 1980 return m_POC[bufferNum]; 1738 1981 } 1982 1739 1983 Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) 1740 1984 { 1741 1985 m_POC[bufferNum] = POC; 1742 1986 } 1987 1743 1988 Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum) 1744 1989 { 1745 1990 return m_bCheckLTMSB[bufferNum]; 1746 1991 } 1992 1747 1993 Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b) 1748 1994 { … … 2012 2258 } 2013 2259 #endif 2014 2015 2260 /** get scaling matrix from RefMatrixID 2016 2261 * \param sizeId size index … … 2022 2267 ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 2023 2268 } 2269 2024 2270 /** parse syntax infomation 2025 2271 * \param pchFile syntax infomation … … 2114 2360 m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 2115 2361 } 2362 2116 2363 /** destroy quantization matrix array 2117 2364 */ … … 2126 2373 } 2127 2374 } 2375 2128 2376 /** get default address of quantization matrix 2129 2377 * \param sizeId size index … … 2155 2403 return src; 2156 2404 } 2405 2157 2406 /** process of default matrix 2158 2407 * \param sizeId size index … … 2164 2413 setScalingListDC(sizeId,listId,SCALING_LIST_DC); 2165 2414 } 2415 2166 2416 /** check DC value of matrix for default matrix signaling 2167 2417 */ … … 2224 2474 //! activate a PPS and depending on isIDR parameter also SPS and VPS 2225 2475 //! \returns true, if activation is successful 2226 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isI DR)2476 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP) 2227 2477 { 2228 2478 TComPPS *pps = m_ppsMap.getPS(ppsId); … … 2233 2483 // active parameter sets per layer should be used here 2234 2484 #else 2235 if (!isI DR&& (spsId != m_activeSPSId))2236 { 2237 printf("Warning: tried to activate PPS referring to a inactive SPS at non-I DR.");2485 if (!isIRAP && (spsId != m_activeSPSId)) 2486 { 2487 printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP."); 2238 2488 return false; 2239 2489 } … … 2243 2493 { 2244 2494 Int vpsId = sps->getVPSId(); 2245 if (!isI DR&& (vpsId != m_activeVPSId))2246 { 2247 printf("Warning: tried to activate PPS referring to a inactive VPS at non-I DR.");2495 if (!isIRAP && (vpsId != m_activeVPSId)) 2496 { 2497 printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP."); 2248 2498 return false; 2249 2499 } … … 2304 2554 } 2305 2555 #endif 2306 2307 2556 #if SIGNAL_BITRATE_PICRATE_IN_VPS 2308 2557 TComBitRatePicRateInfo::TComBitRatePicRateInfo() -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComSlice.h
r438 r446 248 248 ProfileTierLevel* getGeneralPTL() { return &m_generalPTL; } 249 249 ProfileTierLevel* getSubLayerPTL(Int i) { return &m_subLayerPTL[i]; } 250 251 250 #if H_MV 252 251 Void copyLevelFrom( TComPTL* source ); … … 523 522 Int m_layerIdInVps [MAX_NUM_LAYERS ]; 524 523 Int m_dimensionId [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES]; 524 #if H_3D 525 Int m_viewIndex [MAX_NUM_LAYERS ]; 526 #endif 525 527 526 528 … … 536 538 537 539 #endif 538 539 540 public: 540 541 TComVPS(); … … 596 597 TComPTL* getPTL() { return &m_pcPTL; } 597 598 #endif 598 599 599 #if SIGNAL_BITRATE_PICRATE_IN_VPS 600 600 TComBitRatePicRateInfo *getBitratePicrateInfo() { return &m_bitRatePicRateInfo; } … … 603 603 TimingInfo* getTimingInfo() { return &m_timingInfo; } 604 604 #endif 605 606 605 #if H_MV 607 606 Void setAvcBaseLayerFlag( Bool val ) { m_avcBaseLayerFlag = val; } … … 639 638 Int getViewId ( Int layerIdInVps ) { return getScalabilityId( layerIdInVps, VIEW_ID ); } 640 639 #if H_3D 641 Int getDepthId ( Int layerIdInVps ) { return getScalabilityId( layerIdInVps, DEPTH_ID ); } 640 Void initViewIndex(); 641 Int getViewIndex ( Int layerIdInVps ) { return m_viewIndex[ layerIdInVps ]; } 642 Int getDepthId ( Int layerIdInVps ) { return getScalabilityId( layerIdInVps, DEPTH_ID ); } 643 Int getLayerIdInNuh( Int viewIndex, Bool depthFlag ); 642 644 #endif 643 645 … … 905 907 UInt m_picHeightInLumaSamples; 906 908 907 Window m_conformanceWindow;908 909 Int m_log2MinCodingBlockSize; 910 Int m_log2DiffMaxMinCodingBlockSize; 909 911 UInt m_uiMaxCUWidth; 910 912 UInt m_uiMaxCUHeight; 911 913 UInt m_uiMaxCUDepth; 912 UInt m_uiMinTrDepth; 913 UInt m_uiMaxTrDepth; 914 915 Window m_conformanceWindow; 916 914 917 TComRPSList m_RPSList; 915 918 Bool m_bLongTermRefsPresent; … … 927 930 Bool m_useAMP; 928 931 932 #if !L0034_COMBINED_LIST_CLEANUP 929 933 Bool m_bUseLComb; 934 #endif 930 935 931 936 // Parameter … … 968 973 static const Int m_winUnitY[MAX_CHROMA_FORMAT_IDC+1]; 969 974 TComPTL m_pcPTL; 975 #if H_MV 976 Bool m_interViewMvVertConstraintFlag; 977 #endif 978 #if H_3D 979 UInt m_uiCamParPrecision; 980 Bool m_bCamParInSliceHeader; 981 Int m_aaiCodedScale [2][MAX_NUM_LAYERS]; 982 Int m_aaiCodedOffset[2][MAX_NUM_LAYERS]; 983 #endif 970 984 public: 971 985 TComSPS(); … … 999 1013 Bool getUsedByCurrPicLtSPSFlag(Int i) {return m_usedByCurrPicLtSPSFlag[i];} 1000 1014 Void setUsedByCurrPicLtSPSFlag(Int i, Bool x) { m_usedByCurrPicLtSPSFlag[i] = x;} 1015 1016 Int getLog2MinCodingBlockSize() const { return m_log2MinCodingBlockSize; } 1017 Void setLog2MinCodingBlockSize(Int val) { m_log2MinCodingBlockSize = val; } 1018 Int getLog2DiffMaxMinCodingBlockSize() const { return m_log2DiffMaxMinCodingBlockSize; } 1019 Void setLog2DiffMaxMinCodingBlockSize(Int val) { m_log2DiffMaxMinCodingBlockSize = val; } 1020 1001 1021 Void setMaxCUWidth ( UInt u ) { m_uiMaxCUWidth = u; } 1002 1022 UInt getMaxCUWidth () { return m_uiMaxCUWidth; } … … 1015 1035 Bool getUseAMP() { return m_useAMP; } 1016 1036 Void setUseAMP( Bool b ) { m_useAMP = b; } 1017 Void setMinTrDepth ( UInt u ) { m_uiMinTrDepth = u; }1018 UInt getMinTrDepth () { return m_uiMinTrDepth; }1019 Void setMaxTrDepth ( UInt u ) { m_uiMaxTrDepth = u; }1020 UInt getMaxTrDepth () { return m_uiMaxTrDepth; }1021 1037 Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u; } 1022 1038 UInt getQuadtreeTULog2MaxSize() { return m_uiQuadtreeTULog2MaxSize; } … … 1040 1056 1041 1057 // Tool list 1058 #if !L0034_COMBINED_LIST_CLEANUP 1042 1059 Void setUseLComb (Bool b) { m_bUseLComb = b; } 1043 1060 Bool getUseLComb () { return m_bUseLComb; } 1061 #endif 1044 1062 1045 1063 Bool getUseLossless () { return m_useLossless; } … … 1094 1112 1095 1113 TComPTL* getPTL() { return &m_pcPTL; } 1114 #if H_MV 1115 Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; } 1116 Bool getInterViewMvVertConstraintFlag() { return m_interViewMvVertConstraintFlag;} 1117 #endif 1118 #if H_3D 1119 Void initCamParaSPS ( UInt uiViewIndex, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 ); 1120 UInt getCamParPrecision () { return m_uiCamParPrecision; } 1121 Bool hasCamParInSliceHeader() { return m_bCamParInSliceHeader; } 1122 Int* getCodedScale () { return m_aaiCodedScale [0]; } 1123 Int* getCodedOffset () { return m_aaiCodedOffset[0]; } 1124 Int* getInvCodedScale () { return m_aaiCodedScale [1]; } 1125 Int* getInvCodedOffset () { return m_aaiCodedOffset[1]; } 1126 #endif 1096 1127 }; 1097 1128 … … 1120 1151 Void setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; } 1121 1152 UInt getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; } 1122 1123 1153 #if H_MV 1124 1154 // Why not an listIdx for all members, would avoid code duplication?? … … 1357 1387 Int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter 1358 1388 Int m_deblockingFilterTcOffsetDiv2; //< tc offset for deblocking filter 1359 1389 #if L0034_COMBINED_LIST_CLEANUP 1390 Int m_list1IdxToList0Idx[MAX_NUM_REF]; 1391 Int m_aiNumRefIdx [2]; // for multiple reference of current slice 1392 #else 1360 1393 Int m_aiNumRefIdx [3]; // for multiple reference of current slice 1361 1394 … … 1367 1400 Bool m_bRefPicListModificationFlagLC; 1368 1401 Bool m_bRefPicListCombinationFlag; 1402 #endif 1369 1403 1370 1404 Bool m_bCheckLDC; … … 1407 1441 1408 1442 Bool m_abEqualRef [2][MAX_NUM_REF][MAX_NUM_REF]; 1409 1443 #if !L0034_COMBINED_LIST_CLEANUP 1410 1444 Bool m_bNoBackPredFlag; 1445 #endif 1411 1446 UInt m_uiTLayer; 1412 1447 Bool m_bTLayerSwitchingFlag; … … 1443 1478 1444 1479 Bool m_enableTMVPFlag; 1445 1446 1480 #if H_MV 1447 1481 Int m_layerId; 1448 1482 Int m_viewId; 1449 1483 #if H_3D 1484 Int m_viewIndex; 1450 1485 Bool m_isDepth; 1451 #endif 1452 #endif 1453 1486 Int m_aaiCodedScale [2][MAX_NUM_LAYERS]; 1487 Int m_aaiCodedOffset[2][MAX_NUM_LAYERS]; 1488 #endif 1489 #endif 1454 1490 public: 1455 1491 TComSlice(); … … 1515 1551 Bool getCheckLDC () { return m_bCheckLDC; } 1516 1552 Bool getMvdL1ZeroFlag () { return m_bLMvdL1Zero; } 1553 #if H_MV // This is a temporary fix of the temporary fix L0177 1554 Int getNumRpsCurrTempList( TComReferencePictureSet* rps = NULL ); 1555 #else 1517 1556 Int getNumRpsCurrTempList(); 1557 #endif 1558 #if L0034_COMBINED_LIST_CLEANUP 1559 Int getList1IdxToList0Idx ( Int list1Idx ) { return m_list1IdxToList0Idx[list1Idx]; } 1560 #else 1518 1561 Int getRefIdxOfLC (RefPicList e, Int iRefIdx) { return m_iRefIdxOfLC[e][iRefIdx]; } 1519 1562 Int getListIdFromIdxOfLC(Int iRefIdx) { return m_eListIdFromIdxOfLC[iRefIdx]; } … … 1525 1568 Bool getRefPicListCombinationFlag() {return m_bRefPicListCombinationFlag;} 1526 1569 Void setRefPicListCombinationFlag(Bool bflag) {m_bRefPicListCombinationFlag=bflag;} 1570 #endif 1527 1571 Void setReferenced(Bool b) { m_bRefenced = b; } 1528 1572 Bool isReferenced() { return m_bRefenced; } 1529 1573 Void setPOC ( Int i ) { m_iPOC = i; if(getTLayer()==0) m_prevPOC=i; } 1530 1574 Void setNalUnitType ( NalUnitType e ) { m_eNalUnitType = e; } 1531 NalUnitType getNalUnitType () 1575 NalUnitType getNalUnitType () const { return m_eNalUnitType; } 1532 1576 Bool getRapPicFlag (); 1533 Bool getIdrPicFlag () { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; } 1534 Void checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA); 1577 Bool getIdrPicFlag () { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; } 1578 Bool isIRAP () const { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 1579 Void checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic); 1535 1580 Void decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic); 1536 1581 Void setSliceType ( SliceType e ) { m_eSliceType = e; } … … 1558 1603 #endif 1559 1604 #if H_MV 1560 Void setRefPicList ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& interLayerRefPicSet ); 1605 Void setRefPicList ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& interLayerRefPicSet , Bool checkNumPocTotalCurr = false ); 1606 #else 1607 #if FIX1071 1608 Void setRefPicList ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false ); 1561 1609 #else 1562 1610 Void setRefPicList ( TComList<TComPic*>& rcListPic ); 1611 #endif 1563 1612 #endif 1564 1613 Void setRefPOCList (); … … 1594 1643 1595 1644 static Void sortPicList ( TComList<TComPic*>& rcListPic ); 1596 1645 #if L0034_COMBINED_LIST_CLEANUP 1646 Void setList1IdxToList0Idx(); 1647 #else 1597 1648 Bool getNoBackPredFlag() { return m_bNoBackPredFlag; } 1598 1649 Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; } 1599 1650 Void generateCombinedList (); 1651 #endif 1600 1652 1601 1653 UInt getTLayer () { return m_uiTLayer; } … … 1605 1657 Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 1606 1658 Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList); 1607 1608 1659 #if H_MV 1609 1660 Void createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer ); … … 1614 1665 Void xPrintRefPicList(); 1615 1666 #endif 1616 1617 1667 Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic ); 1618 1668 Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic ); … … 1655 1705 Void getWpScaling ( RefPicList e, Int iRefIdx, wpScalingParam *&wp); 1656 1706 1657 Void resetWpScaling (wpScalingParam wp[2][MAX_NUM_REF][3]); 1658 Void initWpScaling (wpScalingParam wp[2][MAX_NUM_REF][3]); 1707 Void resetWpScaling (); 1659 1708 Void initWpScaling (); 1660 1709 inline Bool applyWP () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); } … … 1698 1747 Int getViewId () { return m_viewId; } 1699 1748 #if H_3D 1749 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 1750 Int getViewIndex () { return m_viewIndex; } 1700 1751 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 1701 1752 Bool getIsDepth () { return m_isDepth; } 1702 #endif 1703 #endif 1704 1753 Void setCamparaSlice ( Int** aaiScale = 0, Int** aaiOffset = 0 ); 1754 Int* getCodedScale () { return m_aaiCodedScale [0]; } 1755 Int* getCodedOffset () { return m_aaiCodedOffset[0]; } 1756 Int* getInvCodedScale () { return m_aaiCodedScale [1]; } 1757 Int* getInvCodedOffset () { return m_aaiCodedOffset[1]; } 1758 #endif 1759 #endif 1705 1760 protected: 1706 1761 TComPic* xGetRefPic (TComList<TComPic*>& rcListPic, 1707 1762 Int poc); 1708 TComPic* xGetLongTermRefPic (TComList<TComPic*>& rcListPic, 1709 Int poc); 1763 TComPic* xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb); 1710 1764 #if H_MV 1711 1765 TComPic* xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId ); … … 1794 1848 //! activate a PPS and depending on isIDR parameter also SPS and VPS 1795 1849 //! \returns true, if activation is successful 1796 Bool activatePPS(Int ppsId, Bool isI DR);1850 Bool activatePPS(Int ppsId, Bool isIRAP); 1797 1851 1798 1852 TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); }; -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComTrQuant.cpp
r438 r446 1986 1986 } 1987 1987 1988 if(pi QCoef[minPos] == 32767 || piQCoef[minPos] == -32768)1988 if(piDstCoeff[minPos] == 32767 || piDstCoeff[minPos] == -32768) 1989 1989 { 1990 1990 finalChange = -1; -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComYuv.cpp
r324 r446 637 637 } 638 638 } 639 640 #if H_3D 641 Void TComYuv::addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 642 { 643 Int x, y; 644 645 Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiTrUnitIdx); 646 Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiTrUnitIdx); 647 Pel* pDst = getLumaAddr( uiTrUnitIdx); 648 649 UInt iSrc0Stride = pcYuvSrc0->getStride(); 650 UInt iSrc1Stride = pcYuvSrc1->getStride(); 651 UInt iDstStride = getStride(); 652 for ( y = uiPartSize-1; y >= 0; y-- ) 653 { 654 for ( x = uiPartSize-1; x >= 0; x-- ) 655 { 656 pDst[x] = ClipY( pSrc0[x] + pSrc1[x] ); 657 } 658 pSrc0 += iSrc0Stride; 659 pSrc1 += iSrc1Stride; 660 pDst += iDstStride; 661 } 662 } 663 #endif 639 664 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComYuv.h
r324 r446 180 180 UInt getCHeight () { return m_iCHeight; } 181 181 UInt getCWidth () { return m_iCWidth; } 182 #if H_3D 183 Void addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); 184 #endif 185 182 186 };// END CLASS DEFINITION TComYuv 183 187 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TypeDef.h
r438 r446 42 42 //! \{ 43 43 44 #define H_MV 1 45 46 47 #if H_MV 48 #define H_3D 0 49 #endif 50 51 ///// ***** HM 10.0 ********* 52 44 45 ///////////////////////////////////////////////////////////////////////////////////////// 46 ///////////////////////////////// EXTENSION SELECTION /////////////////////////////////// 47 ///////////////////////////////////////////////////////////////////////////////////////// 48 49 /* HEVC_EXT might be defined by compiler/makefile options. 50 51 Linux makefiles support the following settings: 52 make -> HEVC_EXT not defined 53 make HEVC_EXT=0 -> H_MV=0 H_3D=0 --> plain HM 54 make HEVC_EXT=1 -> H_MV=1 H_3D=0 --> MV only 55 make HEVC_EXT=2 -> H_MV=1 H_3D=1 --> full 3D 56 */ 57 58 #ifndef HEVC_EXT 59 #define HEVC_EXT 2 60 #endif 61 62 #if ( HEVC_EXT < 0 )||( HEVC_EXT > 2 ) 63 #error HEVC_EXT must be in the range of 0 to 2, inclusive. 64 #endif 65 66 #define H_MV ( HEVC_EXT != 0) 67 #define H_3D ( HEVC_EXT == 2) 68 69 ///////////////////////////////////////////////////////////////////////////////////////// 70 /////////////////////////////////// MAJOR DEFINES /////////////////////////////////// 71 ///////////////////////////////////////////////////////////////////////////////////////// 72 73 #if H_3D 74 #define H_3D_PDM_CAM_PARAS 0 ///< PDM related parts of camera parameters, should be removed if not used anymore. 75 #define H_3D_VSO 1 // VSO, View synthesis optimization, includes: 76 // HHI_VSO 77 // HHI_VSO_LS_TABLE_M23714 enable table base Lagrange multiplier optimization 78 // SAIT_VSO_EST_A0033, JCT3V-A0033 modification 3 79 // LGE_WVSO_A0119 80 #endif 81 82 ///////////////////////////////////////////////////////////////////////////////////////// 83 /////////////////////////////////// DERIVED DEFINES /////////////////////////////////// 84 ///////////////////////////////////////////////////////////////////////////////////////// 85 86 ///// ***** VIEW SYNTHESIS OPTIMIZAION ********* 87 #if H_3D_VSO 88 #define H_3D_VSO_DIST_INT 1 // Allow negative synthesized view distortion change 89 #define H_3D_VSO_COLOR_PLANES 1 // Compute VSO distortion on color planes 90 #define H_3D_VSO_EARLY_SKIP 1 // LGE_VSO_EARLY_SKIP_A0093, A0093 modification 4 91 #define H_3D_VSO_RM_ASSERTIONS 0 // Output VSO assertions 92 #define H_3D_VSO_SYNTH_DIST_OUT 0 // Output of synthesized view distortion instead of depth distortion in encoder output 93 #endif 94 95 ///////////////////////////////////////////////////////////////////////////////////////// 96 /////////////////////////////////// HM RELATED DEFINES //////////////////////////////// 97 ///////////////////////////////////////////////////////////////////////////////////////// 98 99 #define FIX1071 1 ///< Temporary fix for issue #1071 100 101 #define L0208_SOP_DESCRIPTION_SEI 1 ///< L0208: add SOP descrioption SEI 102 #define MAX_NUM_PICS_IN_SOP 1024 103 104 #define K0180_SCALABLE_NESTING_SEI 1 ///JCTVC-K0180 scalable nesting sei message 105 #define MAX_NESTING_NUM_OPS 1024 106 #define MAX_NESTING_NUM_LAYER 64 107 108 #define J0149_TONE_MAPPING_SEI 1 ///< J0149: Tone mapping information SEI 53 109 #define L0363_DU_BIT_RATE 1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters 54 110 #define L0328_SPLICING 1 ///< L0328: splicing support in HRD … … 75 131 #define SIGNAL_BITRATE_PICRATE_IN_VPS 0 ///< K0125: Signal bit_rate and pic_rate in VPS 76 132 #define L0232_RD_PENALTY 1 ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices 133 #define L0386_DB_METRIC 1 ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream) 134 #define L0323_DPB 1 ///< L0323: Specification of active reference indices and decoded picture buffer 135 136 #define L0034_COMBINED_LIST_CLEANUP 1 77 137 78 138 #define MAX_VPS_NUM_HRD_PARAMETERS 1 79 139 #define MAX_VPS_OP_SETS_PLUS1 1024 80 81 140 #if H_MV 82 141 #define MAX_VPS_NUH_LAYER_ID_PLUS1 64 … … 92 151 #define MAX_CPB_CNT 32 ///< Upper bound of (cpb_cnt_minus1 + 1) 93 152 #define MAX_NUM_LAYER_IDS 64 153 #if H_MV 94 154 #define MAX_NUM_LAYERS 64 155 #endif 95 156 96 157 #define COEF_REMAIN_BIN_REDUCTION 3 ///< indicates the level at which the VLC … … 261 322 typedef Int TCoeff; ///< transform coefficient 262 323 324 #if H_3D_VSO 325 // ==================================================================================================================== 326 // Define Distortion Types 327 // ==================================================================================================================== 328 typedef Int64 RMDist; ///< renderer model distortion 329 330 #if H_3D_VSO_DIST_INT 331 typedef Int Dist; ///< RDO distortion 332 typedef Int64 Dist64; 333 #define RDO_DIST_MIN MIN_INT 334 #define RDO_DIST_MAX MAX_INT 335 #else 336 typedef UInt Dist; ///< RDO distortion 337 typedef UInt64 Dist; 338 #define RDO_DIST_MIN 0 339 #define RDO_DIST_MAX MAX_UINT 340 #endif 341 #endif 263 342 /// parameters for adaptive loop filter 264 343 class TComPicSym; … … 412 491 REF_PIC_LIST_0 = 0, ///< reference list 0 413 492 REF_PIC_LIST_1 = 1, ///< reference list 1 493 #if !L0034_COMBINED_LIST_CLEANUP 414 494 REF_PIC_LIST_C = 2, ///< combined reference list for uni-prediction in B-Slices 495 #endif 415 496 REF_PIC_LIST_X = 100 ///< special mark 416 497 }; … … 451 532 DF_HADS64 = 27, ///< 64xM HAD with step 452 533 DF_HADS16N = 28, ///< 16NxM HAD with step 453 534 #if H_3D_VSO 535 DF_VSD = 29, ///< general size VSD 536 DF_VSD4 = 30, ///< 4xM VSD 537 DF_VSD8 = 31, ///< 8xM VSD 538 DF_VSD16 = 32, ///< 16xM VSD 539 DF_VSD32 = 33, ///< 32xM VSD 540 DF_VSD64 = 34, ///< 64xM VSD 541 DF_VSD16N = 35, ///< 16NxM VSD 542 #endif 543 454 544 #if AMP_SAD 455 545 DF_SAD12 = 43, … … 549 639 VIEW_ID = 0, 550 640 #if H_3D 551 DEPTH_ID = 1, 641 DEPTH_ID = 1, 552 642 #endif 553 643 }; 554 644 #endif 555 #endif 556 645 #if H_3D 646 // Renderer 647 enum BlenMod 648 { 649 BLEND_NONE = -1, 650 BLEND_AVRG = 0, 651 BLEND_LEFT = 1, 652 BLEND_RIGHT = 2, 653 BLEND_GEN = 3 654 }; 655 656 657 enum 658 { 659 VIEWPOS_INVALID = -1, 660 VIEWPOS_LEFT = 0, 661 VIEWPOS_RIGHT = 1, 662 VIEWPOS_MERGED = 2 663 }; 664 665 666 #endif 667 #endif -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/AnnexBread.h
r324 r446 43 43 #include <vector> 44 44 45 #include " TLibCommon/TypeDef.h"45 #include "../TLibCommon/TypeDef.h" 46 46 47 47 //! \ingroup TLibDecoder -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/NALread.cpp
r438 r446 50 50 //! \ingroup TLibDecoder 51 51 //! \{ 52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, Bool isVclNalUnit)52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, TComInputBitstream *bitstream, Bool isVclNalUnit) 53 53 { 54 54 UInt zeroCount = 0; 55 55 vector<uint8_t>::iterator it_read, it_write; 56 56 57 for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++) 57 UInt pos = 0; 58 bitstream->clearEmulationPreventionByteLocation(); 59 for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++, pos++) 58 60 { 59 61 assert(zeroCount < 2 || *it_read >= 0x03); 60 62 if (zeroCount == 2 && *it_read == 0x03) 61 63 { 64 bitstream->pushEmulationPreventionByteLocation( pos ); 65 pos++; 62 66 it_read++; 63 67 zeroCount = 0; … … 109 113 if ( nalu.m_temporalId ) 110 114 { 111 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA 112 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA NT115 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP 116 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL 113 117 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP 114 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR 118 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL 115 119 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP 116 120 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA … … 122 126 else 123 127 { 124 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA 128 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R 125 129 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N 126 130 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R … … 136 140 /* perform anti-emulation prevention */ 137 141 TComInputBitstream *pcBitstream = new TComInputBitstream(NULL); 138 convertPayloadToRBSP(nalUnitBuf, (nalUnitBuf[0] & 64) == 0);142 convertPayloadToRBSP(nalUnitBuf, pcBitstream, (nalUnitBuf[0] & 64) == 0); 139 143 140 144 nalu.m_Bitstream = new TComInputBitstream(&nalUnitBuf); 145 nalu.m_Bitstream->setEmulationPreventionByteLocation(pcBitstream->getEmulationPreventionByteLocation()); 141 146 delete pcBitstream; 142 147 readNalUnitHeader(nalu); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/NALread.h
r324 r446 39 39 #pragma once 40 40 41 #include " TLibCommon/TypeDef.h"42 #include " TLibCommon/TComBitStream.h"43 #include " TLibCommon/NAL.h"41 #include "../TLibCommon/TypeDef.h" 42 #include "../TLibCommon/TComBitStream.h" 43 #include "../TLibCommon/NAL.h" 44 44 45 45 //! \ingroup TLibDecoder -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/SEIread.cpp
r438 r446 90 90 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 91 91 break; 92 #if J0149_TONE_MAPPING_SEI 93 case SEI::TONE_MAPPING_INFO: 94 fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n"); 95 break; 96 #endif 97 #if L0208_SOP_DESCRIPTION_SEI 98 case SEI::SOP_DESCRIPTION: 99 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 100 break; 101 #endif 102 #if K0180_SCALABLE_NESTING_SEI 103 case SEI::SCALABLE_NESTING: 104 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 105 break; 106 #endif 92 107 default: 93 108 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 154 169 SEI *sei = NULL; 155 170 156 if(nalUnitType == NAL_UNIT_ SEI)171 if(nalUnitType == NAL_UNIT_PREFIX_SEI) 157 172 { 158 173 switch (payloadType) … … 219 234 xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize); 220 235 break; 236 #if J0149_TONE_MAPPING_SEI 237 case SEI::TONE_MAPPING_INFO: 238 sei = new SEIToneMappingInfo; 239 xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize); 240 break; 241 #endif 242 #if L0208_SOP_DESCRIPTION_SEI 243 case SEI::SOP_DESCRIPTION: 244 sei = new SEISOPDescription; 245 xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize); 246 break; 247 #endif 248 #if K0180_SCALABLE_NESTING_SEI 249 case SEI::SCALABLE_NESTING: 250 sei = new SEIScalableNesting; 251 xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps); 252 break; 253 #endif 221 254 default: 222 255 for (UInt i = 0; i < payloadSize; i++) … … 284 317 { 285 318 UInt reservedPayloadExtensionData; 286 READ_ CODE (1,reservedPayloadExtensionData, "reserved_payload_extension_data");319 READ_FLAG (reservedPayloadExtensionData, "reserved_payload_extension_data"); 287 320 } 288 321 289 322 UInt dummy; 290 READ_CODE (1, dummy, "payload_bit_equal_to_one"); 291 READ_CODE (payloadBitsRemaining-1, dummy, "payload_bit_equal_to_zero"); 323 READ_FLAG (dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--; 324 while (payloadBitsRemaining) 325 { 326 READ_FLAG (dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--; 327 } 292 328 } 293 329 … … 632 668 } 633 669 670 #if J0149_TONE_MAPPING_SEI 671 Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/) 672 { 673 Int i; 674 UInt val; 675 READ_UVLC( val, "tone_map_id" ); sei.m_toneMapId = val; 676 READ_FLAG( val, "tone_map_cancel_flag" ); sei.m_toneMapCancelFlag = val; 677 678 if ( !sei.m_toneMapCancelFlag ) 679 { 680 READ_FLAG( val, "tone_map_persistence_flag" ); sei.m_toneMapPersistenceFlag = val; 681 READ_CODE( 8, val, "coded_data_bit_depth" ); sei.m_codedDataBitDepth = val; 682 READ_CODE( 8, val, "target_bit_depth" ); sei.m_targetBitDepth = val; 683 READ_UVLC( val, "model_id" ); sei.m_modelId = val; 684 switch(sei.m_modelId) 685 { 686 case 0: 687 { 688 READ_CODE( 32, val, "min_value" ); sei.m_minValue = val; 689 READ_CODE( 32, val, "max_value" ); sei.m_maxValue = val; 690 break; 691 } 692 case 1: 693 { 694 READ_CODE( 32, val, "sigmoid_midpoint" ); sei.m_sigmoidMidpoint = val; 695 READ_CODE( 32, val, "sigmoid_width" ); sei.m_sigmoidWidth = val; 696 break; 697 } 698 case 2: 699 { 700 UInt num = 1u << sei.m_targetBitDepth; 701 sei.m_startOfCodedInterval.resize(num+1); 702 for(i = 0; i < num; i++) 703 { 704 READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval" ); 705 sei.m_startOfCodedInterval[i] = val; 706 } 707 sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth; 708 break; 709 } 710 case 3: 711 { 712 READ_CODE( 16, val, "num_pivots" ); sei.m_numPivots = val; 713 sei.m_codedPivotValue.resize(sei.m_numPivots); 714 sei.m_targetPivotValue.resize(sei.m_numPivots); 715 for(i = 0; i < sei.m_numPivots; i++ ) 716 { 717 READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value" ); 718 sei.m_codedPivotValue[i] = val; 719 READ_CODE( ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3), val, "target_pivot_value" ); 720 sei.m_targetPivotValue[i] = val; 721 } 722 break; 723 } 724 case 4: 725 { 726 READ_CODE( 8, val, "camera_iso_speed_idc" ); sei.m_cameraIsoSpeedValue = val; 727 if( sei.m_cameraIsoSpeedValue == 255) //Extended_ISO 728 { 729 READ_CODE( 32, val, "camera_iso_speed_value" ); sei.m_cameraIsoSpeedValue = val; 730 } 731 READ_FLAG( val, "exposure_compensation_value_sign_flag" ); sei.m_exposureCompensationValueSignFlag = val; 732 READ_CODE( 16, val, "exposure_compensation_value_numerator" ); sei.m_exposureCompensationValueNumerator = val; 733 READ_CODE( 16, val, "exposure_compensation_value_denom_idc" ); sei.m_exposureCompensationValueDenomIdc = val; 734 READ_CODE( 32, val, "ref_screen_luminance_white" ); sei.m_refScreenLuminanceWhite = val; 735 READ_CODE( 32, val, "extended_range_white_level" ); sei.m_extendedRangeWhiteLevel = val; 736 READ_CODE( 16, val, "nominal_black_level_luma_code_value" ); sei.m_nominalBlackLevelLumaCodeValue = val; 737 READ_CODE( 16, val, "nominal_white_level_luma_code_value" ); sei.m_nominalWhiteLevelLumaCodeValue= val; 738 READ_CODE( 16, val, "extended_white_level_luma_code_value" ); sei.m_extendedWhiteLevelLumaCodeValue = val; 739 break; 740 } 741 default: 742 { 743 assert(!"Undefined SEIToneMapModelId"); 744 break; 745 } 746 }//switch model id 747 }// if(!sei.m_toneMapCancelFlag) 748 749 xParseByteAlign(); 750 } 751 #endif 752 753 #if L0208_SOP_DESCRIPTION_SEI 754 Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize) 755 { 756 Int iCode; 757 UInt uiCode; 758 759 READ_UVLC( uiCode, "sop_seq_parameter_set_id" ); sei.m_sopSeqParameterSetId = uiCode; 760 READ_UVLC( uiCode, "num_pics_in_sop_minus1" ); sei.m_numPicsInSopMinus1 = uiCode; 761 for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++) 762 { 763 READ_CODE( 6, uiCode, "sop_desc_vcl_nalu_type" ); sei.m_sopDescVclNaluType[i] = uiCode; 764 READ_CODE( 3, sei.m_sopDescTemporalId[i], "sop_desc_temporal_id" ); sei.m_sopDescTemporalId[i] = uiCode; 765 if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP) 766 { 767 READ_UVLC( sei.m_sopDescStRpsIdx[i], "sop_desc_st_rps_idx" ); sei.m_sopDescStRpsIdx[i] = uiCode; 768 } 769 if (i > 0) 770 { 771 READ_SVLC( iCode, "sop_desc_poc_delta" ); sei.m_sopDescPocDelta[i] = iCode; 772 } 773 } 774 775 xParseByteAlign(); 776 } 777 #endif 778 779 #if K0180_SCALABLE_NESTING_SEI 780 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps) 781 { 782 UInt uiCode; 783 SEIMessages seis; 784 785 READ_FLAG( uiCode, "bitstream_subset_flag" ); sei.m_bitStreamSubsetFlag = uiCode; 786 READ_FLAG( uiCode, "nesting_op_flag" ); sei.m_nestingOpFlag = uiCode; 787 if (sei.m_nestingOpFlag) 788 { 789 READ_FLAG( uiCode, "default_op_flag" ); sei.m_defaultOpFlag = uiCode; 790 READ_UVLC( uiCode, "nesting_num_ops_minus1" ); sei.m_nestingNumOpsMinus1 = uiCode; 791 for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++) 792 { 793 READ_CODE( 3, uiCode, "nesting_max_temporal_id_plus1" ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode; 794 READ_UVLC( uiCode, "nesting_op_idx" ); sei.m_nestingOpIdx[i] = uiCode; 795 } 796 } 797 else 798 { 799 READ_FLAG( uiCode, "all_layers_flag" ); sei.m_allLayersFlag = uiCode; 800 if (!sei.m_allLayersFlag) 801 { 802 READ_CODE( 3, uiCode, "nesting_no_op_max_temporal_id_plus1" ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode; 803 READ_UVLC( uiCode, "nesting_num_layers_minus1" ); sei.m_nestingNumLayersMinus1 = uiCode; 804 for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) 805 { 806 READ_CODE( 6, uiCode, "nesting_layer_id" ); sei.m_nestingLayerId[i] = uiCode; 807 } 808 } 809 } 810 811 // byte alignment 812 while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) 813 { 814 UInt code; 815 READ_FLAG( code, "nesting_zero_bit" ); 816 } 817 818 sei.m_callerOwnsSEIs = false; 819 820 // read nested SEI messages 821 do { 822 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps); 823 } while (m_pcBitstream->getNumBitsLeft() > 8); 824 825 } 826 #endif 827 634 828 Void SEIReader::xParseByteAlign() 635 829 { -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/SEIread.h
r438 r446 70 70 Void xParseSEITemporalLevel0Index (SEITemporalLevel0Index &sei, UInt payloadSize); 71 71 Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize); 72 #if J0149_TONE_MAPPING_SEI 73 Void xParseSEIToneMappingInfo (SEIToneMappingInfo& sei, UInt payloadSize); 74 #endif 75 #if L0208_SOP_DESCRIPTION_SEI 76 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); 77 #endif 78 #if K0180_SCALABLE_NESTING_SEI 79 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps); 80 #endif 72 81 Void xParseByteAlign(); 73 82 }; -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/SyntaxElementParser.h
r324 r446 43 43 #endif // _MSC_VER > 1000 44 44 45 #include " TLibCommon/TComRom.h"45 #include "../TLibCommon/TComRom.h" 46 46 47 47 #if ENC_DEC_TRACE -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r438 r446 68 68 TDecCavlc::TDecCavlc() 69 69 { 70 #if H_3D 71 m_aaiTempScale = new Int* [ MAX_NUM_LAYERS ]; 72 m_aaiTempOffset = new Int* [ MAX_NUM_LAYERS ]; 73 for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ ) 74 { 75 m_aaiTempScale [ uiVId ] = new Int [ MAX_NUM_LAYERS ]; 76 m_aaiTempOffset [ uiVId ] = new Int [ MAX_NUM_LAYERS ]; 77 } 78 #endif 70 79 } 71 80 72 81 TDecCavlc::~TDecCavlc() 73 82 { 74 83 #if H_3D 84 for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ ) 85 { 86 delete [] m_aaiTempScale [ uiVId ]; 87 delete [] m_aaiTempOffset [ uiVId ]; 88 } 89 delete [] m_aaiTempScale; 90 delete [] m_aaiTempOffset; 91 #endif 75 92 } 76 93 … … 173 190 rps->printDeltaPOC(); 174 191 #endif 175 }176 177 /** copy SAO parameter178 * \param dst179 * \param src180 */181 inline Void copySaoOneLcuParam(SaoLcuParam* dst, SaoLcuParam* src)182 {183 Int i;184 dst->partIdx = src->partIdx;185 dst->typeIdx = src->typeIdx;186 if (dst->typeIdx != -1)187 {188 dst->subTypeIdx = src->subTypeIdx ;189 dst->length = src->length;190 for (i=0;i<dst->length;i++)191 {192 dst->offset[i] = src->offset[i];193 }194 }195 else196 {197 dst->length = 0;198 for (i=0;i<SAO_BO_LEN;i++)199 {200 dst->offset[i] = 0;201 }202 }203 192 } 204 193 … … 400 389 401 390 READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); 402 assert(pcVUI->getFieldSeqFlag() == false); // not supported yet403 391 404 392 READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); … … 554 542 } 555 543 544 #if H_3D 545 Void TDecCavlc::parseSPS(TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) 546 #else 556 547 Void TDecCavlc::parseSPS(TComSPS* pcSPS) 548 #endif 557 549 { 558 550 #if ENC_DEC_TRACE … … 593 585 594 586 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 595 g_bitDepthY = 8 + uiCode; 596 pcSPS->setBitDepthY(g_bitDepthY); 587 pcSPS->setBitDepthY( uiCode + 8 ); 597 588 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 598 589 599 590 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 600 g_bitDepthC = 8 + uiCode; 601 pcSPS->setBitDepthC(g_bitDepthC); 591 pcSPS->setBitDepthC( uiCode + 8 ); 602 592 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 603 593 … … 608 598 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 609 599 { 600 #if L0323_DPB 601 #if H_MV 602 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); 603 #else 604 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); 605 #endif 606 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 607 #else 610 608 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering"); 611 609 pcSPS->setMaxDecPicBuffering( uiCode, i); 610 #endif 611 #if H_MV 612 READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" ); 613 #else 612 614 READ_UVLC ( uiCode, "sps_num_reorder_pics" ); 615 #endif 613 616 pcSPS->setNumReorderPics(uiCode, i); 617 #if H_MV 618 READ_UVLC ( uiCode, "sps_max_latency_increase[i]"); 619 #else 614 620 READ_UVLC ( uiCode, "sps_max_latency_increase"); 621 #endif 615 622 pcSPS->setMaxLatencyIncrease( uiCode, i ); 616 623 … … 628 635 629 636 READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); 630 UInt log2MinCUSize = uiCode + 3; 637 Int log2MinCUSize = uiCode + 3; 638 pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); 631 639 READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); 632 UInt uiMaxCUDepthCorrect = uiCode; 633 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUWidth = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 634 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUHeight = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 640 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 641 Int maxCUDepthDelta = uiCode; 642 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 643 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 635 644 READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 636 645 … … 640 649 READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); 641 650 READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); 642 g_uiAddCUDepth = 0; 643 while( ( pcSPS->getMaxCUWidth() >> uiMaxCUDepthCorrect ) > ( 1 << ( pcSPS->getQuadtreeTULog2MinSize() + g_uiAddCUDepth ) ) ) 644 { 645 g_uiAddCUDepth++; 646 } 647 pcSPS->setMaxCUDepth( uiMaxCUDepthCorrect+g_uiAddCUDepth ); 648 g_uiMaxCUDepth = uiMaxCUDepthCorrect+g_uiAddCUDepth; 649 // BB: these parameters may be removed completly and replaced by the fixed values 650 pcSPS->setMinTrDepth( 0 ); 651 pcSPS->setMaxTrDepth( 1 ); 651 652 Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 653 pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); 654 652 655 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); 653 656 if(pcSPS->getScalingListFlag()) … … 710 713 if (uiCode) 711 714 { 715 #if !H_MV 712 716 while ( xMoreRbspData() ) 713 717 { 714 718 READ_FLAG( uiCode, "sps_extension_data_flag"); 715 719 } 720 #else 721 READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false); 722 READ_FLAG( uiCode, "sps_extension2_flag"); 723 if ( uiCode ) 724 { 725 #if !H_3D 726 while ( xMoreRbspData() ) 727 { 728 READ_FLAG( uiCode, "sps_extension_data_flag"); 729 } 730 #else 731 UInt uiCamParPrecision = 0; 732 Bool bCamParSlice = false; 733 if ( !depthFlag ) 734 { 735 READ_UVLC( uiCamParPrecision, "cp_precision" ); 736 READ_FLAG( uiCode, "cp_in_slice_header_flag" ); bCamParSlice = ( uiCode == 1 ); 737 if( !bCamParSlice ) 738 { 739 for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ ) 740 { 741 Int iCode; 742 READ_SVLC( iCode, "cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ viewIndex ] = iCode; 743 READ_SVLC( iCode, "cp_off" ); m_aaiTempOffset [ uiBaseIndex ][ viewIndex ] = iCode; 744 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ]; 745 READ_SVLC( iCode, "cp_inv_off_plus_off" ); m_aaiTempOffset [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ]; 746 } 747 } 748 } 749 pcSPS->initCamParaSPS( viewIndex, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset ); 750 READ_FLAG( uiCode, "sps_extension3_flag"); 751 if ( uiCode ) 752 { 753 while ( xMoreRbspData() ) 754 { 755 READ_FLAG( uiCode, "sps_extension_data_flag"); 756 } 757 } 758 #endif // !H_3D 759 } 760 #endif // !H_MV 716 761 } 717 762 } … … 744 789 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 745 790 { 791 #if L0323_DPB 792 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 793 #else 746 794 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i ); 795 #endif 747 796 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 748 797 READ_UVLC( uiCode, "vps_max_latency_increase[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); … … 839 888 840 889 // parse layer_id_in_nuh[i] and derive LayerIdInVps 841 pcVPS->setLayerIdInNuh( 0, 0 ); pcVPS->setLayerIdInVps( 0, 0 ); 842 843 for( Int layer = 1; layer <= pcVPS->getMaxLayers() - 1; layer++ ) 890 // already updated to JCT3V-D0220 891 for( Int layer = 0; layer <= pcVPS->getMaxLayers() - 1; layer++ ) 844 892 { 845 893 UInt layerIdInNuh; 846 if ( pcVPS->getVpsNuhLayerIdPresentFlag() )894 if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( layer != 0 ) ) 847 895 { 848 896 READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" ); layerIdInNuh = uiCode; … … 922 970 #endif 923 971 } 924 972 973 #if H_3D 974 pcVPS->initViewIndex(); 975 #endif 976 925 977 return; 926 978 } … … 956 1008 vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); 957 1009 assert(vps!=0); 958 rpcSlice->setVPS(vps); 1010 rpcSlice->setVPS(vps); 1011 rpcSlice->setViewId ( vps->getViewId ( rpcSlice->getLayerIdInVps() ) ); 1012 #if H_3D 1013 rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerIdInVps() ) ); 1014 rpcSlice->setIsDepth ( vps->getDepthId ( rpcSlice->getLayerIdInVps() ) == 1 ); 1015 #endif 959 1016 #endif 960 1017 rpcSlice->setSPS(sps); … … 1052 1109 iPOCmsb = iPrevPOCmsb; 1053 1110 } 1054 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1055 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1111 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1112 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1056 1113 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1057 1114 { … … 1062 1119 1063 1120 TComReferencePictureSet* rps; 1121 rps = rpcSlice->getLocalRPS(); 1122 rpcSlice->setRPS(rps); 1064 1123 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 1065 1124 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 1066 1125 { 1067 rps = rpcSlice->getLocalRPS();1068 1126 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 1069 rpcSlice->setRPS(rps);1070 1127 } 1071 1128 else // use reference to short-term reference picture set in PPS … … 1084 1141 uiCode = 0; 1085 1142 } 1086 rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode)); 1087 1088 rps = rpcSlice->getRPS(); 1143 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet)); 1089 1144 } 1090 1145 if(sps->getLongTermRefsPresent()) … … 1109 1164 rps->setNumberOfLongtermPictures(numOfLtrp); 1110 1165 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 1111 Int prev LSB = 0, prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;1166 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 1112 1167 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 1113 1168 { … … 1136 1191 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 1137 1192 Bool deltaFlag = false; 1138 // First LTRP || First LTRP from SH || curr LSB != prev LSB1139 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) || (pocLsbLt != prevLSB))1193 // First LTRP || First LTRP from SH 1194 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 1140 1195 { 1141 1196 deltaFlag = true; … … 1162 1217 rps->setCheckLTMSBPresent(j,false); 1163 1218 } 1164 prevLSB = pocLsbLt;1165 1219 prevDeltaMSB = deltaPocMSBCycleLT; 1166 1220 } … … 1168 1222 rps->setNumberOfPictures(offset); 1169 1223 } 1170 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1171 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1224 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1225 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1172 1226 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1173 1227 { … … 1243 1297 1244 1298 if(refPicListModification->getRefPicListModificationFlagL0()) 1245 { 1299 { 1246 1300 uiCode = 0; 1247 1301 Int i = 0; … … 1401 1455 if(!rpcSlice->getDeblockingFilterDisable()) 1402 1456 { 1403 READ_SVLC( iCode, "beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1404 READ_SVLC( iCode, "tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1457 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1458 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 1459 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 1460 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1461 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 1462 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 1405 1463 } 1406 1464 } … … 1434 1492 } 1435 1493 1436 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )1437 {1438 1494 UInt *entryPointOffset = NULL; 1439 1495 UInt numEntryPointOffsets, offsetLenMinus1; 1440 1496 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1497 { 1441 1498 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 1442 1499 if (numEntryPointOffsets>0) … … 1455 1512 #endif 1456 1513 } 1514 } 1515 else 1516 { 1517 rpcSlice->setNumEntryPointOffsets ( 0 ); 1518 } 1519 1520 if(pps->getSliceHeaderExtensionPresentFlag()) 1521 { 1522 READ_UVLC(uiCode,"slice_header_extension_length"); 1523 #if H_3D 1524 if( rpcSlice->getSPS()->hasCamParInSliceHeader() ) 1525 { 1526 UInt uiViewIndex = rpcSlice->getViewIndex(); 1527 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) 1528 { 1529 READ_SVLC( iCode, "cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ] = iCode; 1530 READ_SVLC( iCode, "cp_off" ); m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ] = iCode; 1531 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ]; 1532 READ_SVLC( iCode, "cp_inv_off_plus_off" ); m_aaiTempOffset[ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ]; 1533 } 1534 rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset ); 1535 } 1536 1537 READ_FLAG(uiCode,"slice_segment_header_extension2_flag"); 1538 if ( uiCode ) 1539 { 1540 READ_UVLC(uiCode,"slice_header_extension2_length"); 1541 for(Int i=0; i<uiCode; i++) 1542 { 1543 UInt ignore; 1544 READ_CODE(8,ignore,"slice_header_extension2_data_byte"); 1545 } 1546 } 1547 } 1548 #else 1549 for(Int i=0; i<uiCode; i++) 1550 { 1551 UInt ignore; 1552 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1553 } 1554 } 1555 #endif 1556 m_pcBitstream->readByteAlignment(); 1557 1558 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1559 { 1560 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1561 Int curEntryPointOffset = 0; 1562 Int prevEntryPointOffset = 0; 1563 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1564 { 1565 curEntryPointOffset += entryPointOffset[ idx ]; 1566 1567 Int emulationPreventionByteCount = 0; 1568 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1569 { 1570 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 1571 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 1572 { 1573 emulationPreventionByteCount++; 1574 } 1575 } 1576 1577 entryPointOffset[ idx ] -= emulationPreventionByteCount; 1578 prevEntryPointOffset = curEntryPointOffset; 1579 } 1457 1580 1458 1581 if ( pps->getTilesEnabledFlag() ) … … 1490 1613 } 1491 1614 } 1492 else 1493 { 1494 rpcSlice->setNumEntryPointOffsets ( 0 ); 1495 } 1496 1497 if(pps->getSliceHeaderExtensionPresentFlag()) 1498 { 1499 READ_UVLC(uiCode,"slice_header_extension_length"); 1500 for(Int i=0; i<uiCode; i++) 1501 { 1502 UInt ignore; 1503 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1504 } 1505 } 1506 m_pcBitstream->readByteAlignment(); 1615 1507 1616 return; 1508 1617 } … … 1755 1864 // ==================================================================================================================== 1756 1865 1757 1758 /** Parse PCM alignment zero bits.1759 * \returns Void1760 */1761 Void TDecCavlc::xReadPCMAlignZero( )1762 {1763 UInt uiNumberOfBits = m_pcBitstream->getNumBitsUntilByteAligned();1764 1765 if(uiNumberOfBits)1766 {1767 UInt uiBits;1768 UInt uiSymbol;1769 1770 for(uiBits = 0; uiBits < uiNumberOfBits; uiBits++)1771 {1772 xReadFlag( uiSymbol );1773 assert( uiSymbol == 0 );1774 }1775 }1776 }1777 1778 Void TDecCavlc::xReadUnaryMaxSymbol( UInt& ruiSymbol, UInt uiMaxSymbol )1779 {1780 if (uiMaxSymbol == 0)1781 {1782 ruiSymbol = 0;1783 return;1784 }1785 1786 xReadFlag( ruiSymbol );1787 1788 if (ruiSymbol == 0 || uiMaxSymbol == 1)1789 {1790 return;1791 }1792 1793 UInt uiSymbol = 0;1794 UInt uiCont;1795 1796 do1797 {1798 xReadFlag( uiCont );1799 uiSymbol++;1800 }1801 while( uiCont && (uiSymbol < uiMaxSymbol-1) );1802 1803 if( uiCont && (uiSymbol == uiMaxSymbol-1) )1804 {1805 uiSymbol++;1806 }1807 1808 ruiSymbol = uiSymbol;1809 }1810 1811 Void TDecCavlc::xReadExGolombLevel( UInt& ruiSymbol )1812 {1813 UInt uiSymbol ;1814 UInt uiCount = 0;1815 do1816 {1817 xReadFlag( uiSymbol );1818 uiCount++;1819 }1820 while( uiSymbol && (uiCount != 13));1821 1822 ruiSymbol = uiCount-1;1823 1824 if( uiSymbol )1825 {1826 xReadEpExGolomb( uiSymbol, 0 );1827 ruiSymbol += uiSymbol+1;1828 }1829 1830 return;1831 }1832 1833 Void TDecCavlc::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount )1834 {1835 UInt uiSymbol = 0;1836 UInt uiBit = 1;1837 1838 1839 while( uiBit )1840 {1841 xReadFlag( uiBit );1842 uiSymbol += uiBit << uiCount++;1843 }1844 1845 uiCount--;1846 while( uiCount-- )1847 {1848 xReadFlag( uiBit );1849 uiSymbol += uiBit << uiCount;1850 }1851 1852 ruiSymbol = uiSymbol;1853 1854 return;1855 }1856 1857 UInt TDecCavlc::xGetBit()1858 {1859 UInt ruiCode;1860 m_pcBitstream->read( 1, ruiCode );1861 return ruiCode;1862 }1863 1864 1865 1866 /** parse explicit wp tables 1866 1867 * \param TComSlice* pcSlice … … 1879 1880 // decode delta_luma_log2_weight_denom : 1880 1881 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 1882 assert( uiLog2WeightDenomLuma <= 7 ); 1881 1883 if( bChroma ) 1882 1884 { 1883 1885 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom 1884 1886 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 1887 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); 1885 1888 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 1886 1889 } … … 1921 1924 Int iDeltaWeight; 1922 1925 READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] 1926 assert( iDeltaWeight >= -128 ); 1927 assert( iDeltaWeight <= 127 ); 1923 1928 wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); 1924 1929 READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] 1930 assert( wp[0].iOffset >= -128 ); 1931 assert( wp[0].iOffset <= 127 ); 1925 1932 } 1926 1933 else … … 1937 1944 Int iDeltaWeight; 1938 1945 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] 1946 assert( iDeltaWeight >= -128 ); 1947 assert( iDeltaWeight <= 127 ); 1939 1948 wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); 1940 1949 1941 1950 Int iDeltaChroma; 1942 1951 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] 1952 assert( iDeltaChroma >= -512 ); 1953 assert( iDeltaChroma <= 511 ); 1943 1954 Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); 1944 1955 wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) ); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecCAVLC.h
r438 r446 61 61 62 62 protected: 63 Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount ); 64 Void xReadExGolombLevel ( UInt& ruiSymbol ); 65 Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, UInt uiMaxSymbol ); 63 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 66 64 67 Void xReadPCMAlignZero (); 68 69 UInt xGetBit (); 70 71 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 72 private: 73 65 #if H_3D 66 Int** m_aaiTempScale; 67 Int** m_aaiTempOffset; 68 #endif 74 69 public: 75 70 … … 81 76 Void parseQtRootCbf ( UInt uiAbsPartIdx, UInt& uiQtRootCbf ); 82 77 Void parseVPS ( TComVPS* pcVPS ); 78 #if H_3D 79 Void parseSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ); 80 #else 83 81 Void parseSPS ( TComSPS* pcSPS ); 82 #endif 84 83 Void parsePPS ( TComPPS* pcPPS); 85 84 Void parseVUI ( TComVUI* pcVUI, TComSPS* pcSPS ); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecEntropy.h
r324 r446 39 39 #define __TDECENTROPY__ 40 40 41 #include " TLibCommon/CommonDef.h"42 #include " TLibCommon/TComBitStream.h"43 #include " TLibCommon/TComSlice.h"44 #include " TLibCommon/TComPic.h"45 #include " TLibCommon/TComPrediction.h"46 #include " TLibCommon/TComSampleAdaptiveOffset.h"41 #include "../TLibCommon/CommonDef.h" 42 #include "../TLibCommon/TComBitStream.h" 43 #include "../TLibCommon/TComSlice.h" 44 #include "../TLibCommon/TComPic.h" 45 #include "../TLibCommon/TComPrediction.h" 46 #include "../TLibCommon/TComSampleAdaptiveOffset.h" 47 47 48 48 class TDecSbac; … … 66 66 67 67 virtual Void parseVPS ( TComVPS* pcVPS ) = 0; 68 #if H_3D 69 virtual Void parseSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) = 0; 70 #else 68 71 virtual Void parseSPS ( TComSPS* pcSPS ) = 0; 72 #endif 69 73 virtual Void parsePPS ( TComPPS* pcPPS ) = 0; 70 74 … … 129 133 Void resetEntropy ( TComSlice* p) { m_pcEntropyDecoderIf->resetEntropy(p); } 130 134 Void decodeVPS ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); } 135 #if H_3D 136 Void decodeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) { m_pcEntropyDecoderIf->parseSPS(pcSPS, viewIndex, depthFlag ); } 137 #else 131 138 Void decodeSPS ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); } 139 #endif 132 140 Void decodePPS ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); } 133 141 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager); } -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecGop.cpp
r438 r446 208 208 rpcPic->compressMotion(); 209 209 #endif 210 211 210 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 212 211 if (!pcSlice->isReferenced()) c += 32; 213 212 214 213 //-- For time output for each slice 215 216 214 #if H_MV 217 215 printf("\nLayer %2d POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getLayerId(), -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecSbac.h
r324 r446 76 76 Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); } 77 77 Void parseVPS ( TComVPS* /*pcVPS*/ ) {} 78 #if H_3D 79 Void parseSPS ( TComSPS* /*pcSPS*/ , Int /*viewIndex*/, Bool /*depthFlag*/ ) {} 80 #else 78 81 Void parseSPS ( TComSPS* /*pcSPS*/ ) {} 82 #endif 79 83 Void parsePPS ( TComPPS* /*pcPPS*/ ) {} 80 84 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecSlice.h
r438 r446 84 84 Void initCtxMem( UInt i ); 85 85 Void setCtxMem( TDecSbac* sb, Int b ) { CTXMem[b] = sb; } 86 Int getCtxMemSize( ) { return (Int)CTXMem.size(); } 86 87 }; 87 88 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.cpp
r438 r446 42 42 ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder; 43 43 #endif 44 45 44 //! \ingroup TLibDecoder 46 45 //! \{ 47 46 47 #if H_3D 48 CamParsCollector::CamParsCollector() 49 : m_bInitialized( false ) 50 { 51 m_aaiCodedOffset = new Int* [ MAX_NUM_LAYERS ]; 52 m_aaiCodedScale = new Int* [ MAX_NUM_LAYERS ]; 53 m_aiViewId = new Int [ MAX_NUM_LAYERS ]; 54 m_aiLayerIdx = new Int [ MAX_NUM_LAYERS ]; 55 56 m_bViewReceived = new Bool [ MAX_NUM_LAYERS ]; 57 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ ) 58 { 59 m_aaiCodedOffset [ uiId ] = new Int [ MAX_NUM_LAYERS ]; 60 m_aaiCodedScale [ uiId ] = new Int [ MAX_NUM_LAYERS ]; 61 } 62 63 xCreateLUTs( (UInt)MAX_NUM_LAYERS, (UInt)MAX_NUM_LAYERS, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 64 m_iLog2Precision = LOG2_DISP_PREC_LUT; 65 m_uiBitDepthForLUT = 8; // fixed 66 } 67 68 CamParsCollector::~CamParsCollector() 69 { 70 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ ) 71 { 72 delete [] m_aaiCodedOffset [ uiId ]; 73 delete [] m_aaiCodedScale [ uiId ]; 74 } 75 delete [] m_aaiCodedOffset; 76 delete [] m_aaiCodedScale; 77 delete [] m_aiViewId; 78 delete [] m_bViewReceived; 79 80 xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 ); 81 xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 ); 82 } 83 84 Void 85 CamParsCollector::init( FILE* pCodedScaleOffsetFile ) 86 { 87 m_bInitialized = true; 88 m_pCodedScaleOffsetFile = pCodedScaleOffsetFile; 89 m_uiCamParsCodedPrecision = 0; 90 m_bCamParsVaryOverTime = false; 91 m_iLastViewIndex = -1; 92 m_iLastPOC = -1; 93 m_uiMaxViewIndex = 0; 94 } 95 96 Void 97 CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT) 98 { 99 100 uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews ); 101 uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews ); 102 103 radLUT = new Double***[ uiNumberSourceViews ]; 104 raiLUT = new Int ***[ uiNumberSourceViews ]; 105 106 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ ) 107 { 108 radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ]; 109 raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ]; 110 111 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ ) 112 { 113 radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ]; 114 radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ]; 115 radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ]; 116 117 raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ]; 118 raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ]; 119 raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ]; 120 } 121 } 122 } 123 124 Void 125 CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT) 126 { 127 Int iLog2DivLuma = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 ); 128 Int iLog2DivChroma = iLog2DivLuma + 1; 129 130 iOffset <<= m_uiBitDepthForLUT; 131 132 Double dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma )); 133 Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma )); 134 135 // offsets including rounding offsets 136 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 ); 137 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 ); 138 139 140 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ ) 141 { 142 143 // real-valued look-up tables 144 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision ); 145 Double dShiftChroma = dShiftLuma / 2; 146 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma; 147 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma; 148 149 // integer-valued look-up tables 150 Int64 iTempScale = (Int64)uiDepthValue * iScale; 151 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma; 152 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma; 153 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma; 154 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma; 155 } 156 157 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 158 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 159 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 160 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 161 } 162 163 Void 164 CamParsCollector::uninit() 165 { 166 m_bInitialized = false; 167 } 168 169 Void 170 CamParsCollector::setSlice( TComSlice* pcSlice ) 171 { 172 173 if( pcSlice == 0 ) 174 { 175 AOF( xIsComplete() ); 176 if( m_bCamParsVaryOverTime || m_iLastPOC == 0 ) 177 { 178 xOutput( m_iLastPOC ); 179 } 180 return; 181 } 182 183 if ( pcSlice->getIsDepth()) 184 { 185 return; 186 } 187 188 Bool bFirstAU = ( pcSlice->getPOC() == 0 ); 189 Bool bFirstSliceInAU = ( pcSlice->getPOC() != Int ( m_iLastPOC ) ); 190 Bool bFirstSliceInView = ( pcSlice->getViewIndex() != UInt( m_iLastViewIndex ) || bFirstSliceInAU ); 191 192 AOT( bFirstSliceInAU && pcSlice->getViewIndex() != 0 ); 193 AOT( !bFirstSliceInAU && pcSlice->getViewIndex() < UInt( m_iLastViewIndex ) ); 194 195 AOT( !bFirstSliceInAU && pcSlice->getViewIndex() > UInt( m_iLastViewIndex + 1 ) ); 196 197 AOT( !bFirstAU && pcSlice->getViewIndex() > m_uiMaxViewIndex ); 198 199 if ( !bFirstSliceInView ) 200 { 201 if( m_bCamParsVaryOverTime ) // check consistency of slice parameters here 202 { 203 UInt uiViewIndex = pcSlice->getViewIndex(); 204 for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ ) 205 { 206 AOF( m_aaiCodedScale [ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedScale () [ uiBaseViewIndex ] ); 207 AOF( m_aaiCodedOffset[ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedOffset () [ uiBaseViewIndex ] ); 208 AOF( m_aaiCodedScale [ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedScale () [ uiBaseViewIndex ] ); 209 AOF( m_aaiCodedOffset[ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedOffset() [ uiBaseViewIndex ] ); 210 } 211 } 212 return; 213 } 214 215 if( bFirstSliceInAU ) 216 { 217 if( !bFirstAU ) 218 { 219 AOF( xIsComplete() ); 220 xOutput( m_iLastPOC ); 221 } 222 ::memset( m_bViewReceived, false, MAX_NUM_LAYERS * sizeof( Bool ) ); 223 } 224 225 UInt uiViewIndex = pcSlice->getViewIndex(); 226 m_bViewReceived[ uiViewIndex ] = true; 227 if( bFirstAU ) 228 { 229 m_uiMaxViewIndex = std::max( m_uiMaxViewIndex, uiViewIndex ); 230 m_aiViewId[ uiViewIndex ] = pcSlice->getViewId(); 231 if( uiViewIndex == 1 ) 232 { 233 m_uiCamParsCodedPrecision = pcSlice->getSPS()->getCamParPrecision (); 234 m_bCamParsVaryOverTime = pcSlice->getSPS()->hasCamParInSliceHeader (); 235 } 236 else if( uiViewIndex > 1 ) 237 { 238 AOF( m_uiCamParsCodedPrecision == pcSlice->getSPS()->getCamParPrecision () ); 239 AOF( m_bCamParsVaryOverTime == pcSlice->getSPS()->hasCamParInSliceHeader () ); 240 } 241 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) 242 { 243 if( m_bCamParsVaryOverTime ) 244 { 245 m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedScale () [ uiBaseIndex ]; 246 m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedOffset () [ uiBaseIndex ]; 247 m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedScale () [ uiBaseIndex ]; 248 m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedOffset() [ uiBaseIndex ]; 249 xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 250 xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 251 } 252 else 253 { 254 m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getSPS()->getCodedScale () [ uiBaseIndex ]; 255 m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getSPS()->getCodedOffset () [ uiBaseIndex ]; 256 m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getSPS()->getInvCodedScale () [ uiBaseIndex ]; 257 m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseIndex ]; 258 xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 259 xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 260 } 261 } 262 } 263 else 264 { 265 AOF( m_aiViewId[ uiViewIndex ] == pcSlice->getViewId() ); 266 if( m_bCamParsVaryOverTime ) 267 { 268 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) 269 { 270 m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedScale () [ uiBaseIndex ]; 271 m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedOffset () [ uiBaseIndex ]; 272 m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedScale () [ uiBaseIndex ]; 273 m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedOffset() [ uiBaseIndex ]; 274 275 xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 276 xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 277 } 278 } 279 } 280 281 m_iLastViewIndex = (Int)pcSlice->getViewIndex(); 282 m_iLastPOC = (Int)pcSlice->getPOC(); 283 } 284 285 Bool 286 CamParsCollector::xIsComplete() 287 { 288 for( UInt uiView = 0; uiView <= m_uiMaxViewIndex; uiView++ ) 289 { 290 if( m_bViewReceived[ uiView ] == 0 ) 291 { 292 return false; 293 } 294 } 295 return true; 296 } 297 298 Void 299 CamParsCollector::xOutput( Int iPOC ) 300 { 301 if( m_pCodedScaleOffsetFile ) 302 { 303 if( iPOC == 0 ) 304 { 305 fprintf( m_pCodedScaleOffsetFile, "# ViewIndex ViewId\n" ); 306 fprintf( m_pCodedScaleOffsetFile, "#----------- ------------\n" ); 307 for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ ) 308 { 309 fprintf( m_pCodedScaleOffsetFile, "%12d %12d\n", uiViewIndex, m_aiViewId[ uiViewIndex ] ); 310 } 311 fprintf( m_pCodedScaleOffsetFile, "\n\n"); 312 fprintf( m_pCodedScaleOffsetFile, "# StartFrame EndFrame TargetView BaseView CodedScale CodedOffset Precision\n" ); 313 fprintf( m_pCodedScaleOffsetFile, "#----------- ------------ ------------ ------------ ------------ ------------ ------------\n" ); 314 } 315 if( iPOC == 0 || m_bCamParsVaryOverTime ) 316 { 317 Int iS = iPOC; 318 Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) ); 319 for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ ) 320 { 321 for( UInt uiBaseIndex = 0; uiBaseIndex <= m_uiMaxViewIndex; uiBaseIndex++ ) 322 { 323 if( uiViewIndex != uiBaseIndex ) 324 { 325 fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n", 326 iS, iE, uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_uiCamParsCodedPrecision ); 327 } 328 } 329 } 330 } 331 } 332 } 333 #endif 48 334 TDecTop::TDecTop() 49 335 { … … 51 337 m_iMaxRefPicNum = 0; 52 338 #if ENC_DEC_TRACE 339 #if H_MV 340 if ( g_hTrace == NULL ) 341 { 342 #endif 53 343 g_hTrace = fopen( "TraceDec.txt", "wb" ); 54 344 g_bJustDoIt = g_bEncDecTraceDisable; 55 345 g_nSymbolCounter = 0; 346 #if H_MV 347 } 348 #endif 56 349 #endif 57 350 m_pocCRA = 0; … … 65 358 m_viewId = 0; 66 359 #if H_3D 360 m_viewIndex = 0; 67 361 m_isDepth = false; 362 m_pcCamParsCollector = 0; 68 363 #endif 69 364 #endif … … 94 389 } 95 390 96 97 391 Void TDecTop::init() 98 392 { … … 101 395 initROM(); 102 396 #endif 103 104 397 m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO); 105 398 m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder ); … … 149 442 } 150 443 444 #if L0323_DPB 445 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 446 #else 151 447 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 448 #endif 152 449 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 153 450 { … … 219 516 rpcListPic = &m_cListPic; 220 517 m_cCuDecoder.destroy(); 221 222 518 #if H_MV 223 519 TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 224 520 TComSlice::markIvRefPicsAsUnused ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc ); 225 521 #endif 226 227 522 m_bFirstSliceInPicture = true; 228 523 … … 290 585 assert (sps != 0); 291 586 292 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot-> getIdrPicFlag()))587 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) 293 588 { 294 589 printf ("Parameter set activation failed!"); … … 296 591 } 297 592 593 if( pps->getDependentSliceSegmentsEnabledFlag() ) 594 { 595 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; 596 597 if (m_cSliceDecoder.getCtxMemSize() != NumCtx) 598 { 599 m_cSliceDecoder.initCtxMem(NumCtx); 600 for ( UInt st = 0; st < NumCtx; st++ ) 601 { 602 TDecSbac* ctx = NULL; 603 ctx = new TDecSbac; 604 ctx->init( &m_cBinCABAC ); 605 m_cSliceDecoder.setCtxMem( ctx, st ); 606 } 607 } 608 } 609 298 610 m_apcSlicePilot->setPPS(pps); 299 611 m_apcSlicePilot->setSPS(sps); 300 301 612 #if H_MV 302 613 m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() ); 303 614 #endif 304 305 615 pps->setSPS(sps); 306 616 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); 307 617 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 308 618 309 for (Int i = 0; i < sps->getMaxCUDepth() - g_uiAddCUDepth; i++) 619 g_bitDepthY = sps->getBitDepthY(); 620 g_bitDepthC = sps->getBitDepthC(); 621 g_uiMaxCUWidth = sps->getMaxCUWidth(); 622 g_uiMaxCUHeight = sps->getMaxCUHeight(); 623 g_uiMaxCUDepth = sps->getMaxCUDepth(); 624 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 625 626 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) 310 627 { 311 628 sps->setAMPAcc( i, sps->getUseAMP() ); 312 629 } 313 630 314 for (Int i = sps->get MaxCUDepth() - g_uiAddCUDepth; i < sps->getMaxCUDepth(); i++)631 for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++) 315 632 { 316 633 sps->setAMPAcc( i, 0 ); … … 318 635 319 636 m_cSAO.destroy(); 320 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight);321 m_cLoopFilter. create( g_uiMaxCUDepth);637 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() ); 638 m_cLoopFilter.create( sps->getMaxCUDepth() ); 322 639 } 323 640 … … 345 662 346 663 m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); 347 if((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N) || 348 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) || 349 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N)) 350 { 351 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(true); 352 } 664 Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 665 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 666 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 667 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 668 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); 669 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); 670 353 671 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 354 672 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); … … 357 675 m_apcSlicePilot->setLayerId( nalu.m_layerId ); 358 676 #endif 359 360 677 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); 361 678 362 679 #if H_MV 363 680 TComVPS* vps = m_apcSlicePilot->getVPS(); 364 Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId ); 365 366 setViewId( vps->getViewId( layerIdInVps ) ); 367 m_apcSlicePilot->setViewId( getViewId() ); 681 Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId ); 682 setViewId ( vps->getViewId ( layerIdInVps ) ); 368 683 #if H_3D 369 setIsDepth( vps->getDepthId( layerIdInVps ) == 1 ); 370 m_apcSlicePilot->setIsDepth( getIsDepth() ); 371 #endif 372 #endif 373 374 if (m_apcSlicePilot->isNextSlice()) 375 { 684 setViewIndex( vps->getViewIndex( layerIdInVps ) ); 685 setIsDepth ( vps->getDepthId ( layerIdInVps ) == 1 ); 686 m_ivPicLists->setVPS( vps ); 687 #endif 688 #endif 376 689 // Skip pictures due to random access 377 690 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) … … 384 697 return false; 385 698 } 386 } 387 699 700 //we should only get a different poc for a new picture (with CTU address==0) 701 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0)) 702 { 703 printf ("Warning, the first slice of a picture might have been lost!\n"); 704 } 388 705 // exit when a new picture is found 389 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence)706 if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence ) 390 707 { 391 708 if (m_prevPOC >= m_pocRandomAccess) … … 396 713 m_prevPOC = m_apcSlicePilot->getPOC(); 397 714 } 398 399 715 #if H_MV 400 716 if ( newLayerFlag ) … … 403 719 } 404 720 #endif 405 406 407 721 // actual decoding starts here 408 722 xActivateParameterSets(); … … 419 733 xCreateLostPicture(lostPoc-1); 420 734 } 421 422 735 if (m_bFirstSliceInPicture) 423 736 { … … 425 738 m_cPrediction.initTempBuff(); 426 739 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 427 428 740 #if H_MV 429 741 m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer ); 430 742 #endif 431 432 433 743 // Get a new picture buffer 434 744 xGetNewPicBuffer (m_apcSlicePilot, pcPic); … … 566 876 pcPic->setViewId ( getViewId() ); 567 877 #if H_3D 568 pcPic->set IsDepth( getIsDepth() );569 #endif 570 #endif 571 878 pcPic->setViewIndex( getViewIndex() ); 879 pcPic->setIsDepth ( getIsDepth () ); 880 #endif 881 #endif 572 882 if (bNextSlice) 573 883 { 574 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA );884 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic ); 575 885 // Set reference list 576 577 886 #if H_MV 578 pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer ); 887 pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true ); 888 #else 889 #if FIX1071 890 pcSlice->setRefPicList( m_cListPic, true ); 579 891 #else 580 892 pcSlice->setRefPicList( m_cListPic ); 581 893 #endif 582 894 895 #endif 583 896 // For generalized B 584 897 // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) … … 622 935 //--------------- 623 936 pcSlice->setRefPOCList(); 937 #if !L0034_COMBINED_LIST_CLEANUP 624 938 pcSlice->setNoBackPredFlag( false ); 625 939 if ( pcSlice->getSliceType() == B_SLICE ) … … 638 952 } 639 953 } 954 #endif 640 955 } 641 956 … … 664 979 // Decode a picture 665 980 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); 666 981 #if H_3D 982 if( m_pcCamParsCollector ) 983 { 984 m_pcCamParsCollector->setSlice( pcSlice ); 985 } 986 #endif 667 987 m_bFirstSliceInPicture = false; 668 988 m_uiSliceIdx++; … … 682 1002 { 683 1003 TComSPS* sps = new TComSPS(); 1004 #if H_3D 1005 // Preliminary fix. assuming that all sps refer to the same SPS. 1006 // Parsing dependency should be resolved! 1007 TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); 1008 assert( vps != 0 ); 1009 Int layerIdInVPS = vps->getLayerIdInVps( m_layerId ); 1010 m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( layerIdInVPS ), ( vps->getDepthId( layerIdInVPS ) == 1 ) ); 1011 #else 684 1012 m_cEntropyDecoder.decodeSPS( sps ); 1013 #endif 685 1014 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 686 1015 } … … 691 1020 m_cEntropyDecoder.decodePPS( pps ); 692 1021 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 693 694 if( pps->getDependentSliceSegmentsEnabledFlag() )695 {696 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1;697 m_cSliceDecoder.initCtxMem(NumCtx);698 for ( UInt st = 0; st < NumCtx; st++ )699 {700 TDecSbac* ctx = NULL;701 ctx = new TDecSbac;702 ctx->init( &m_cBinCABAC );703 m_cSliceDecoder.setCtxMem( ctx, st );704 }705 }706 1022 } 707 1023 708 1024 Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) 709 1025 { 710 if(nalUnitType == NAL_UNIT_S EI_SUFFIX)1026 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 711 1027 { 712 1028 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); … … 753 1069 return false; 754 1070 755 case NAL_UNIT_ SEI:756 case NAL_UNIT_S EI_SUFFIX:1071 case NAL_UNIT_PREFIX_SEI: 1072 case NAL_UNIT_SUFFIX_SEI: 757 1073 xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); 758 1074 return false; … … 760 1076 case NAL_UNIT_CODED_SLICE_TRAIL_R: 761 1077 case NAL_UNIT_CODED_SLICE_TRAIL_N: 762 case NAL_UNIT_CODED_SLICE_TLA :1078 case NAL_UNIT_CODED_SLICE_TLA_R: 763 1079 case NAL_UNIT_CODED_SLICE_TSA_N: 764 1080 case NAL_UNIT_CODED_SLICE_STSA_R: 765 1081 case NAL_UNIT_CODED_SLICE_STSA_N: 766 case NAL_UNIT_CODED_SLICE_BLA :767 case NAL_UNIT_CODED_SLICE_BLA NT:1082 case NAL_UNIT_CODED_SLICE_BLA_W_LP: 1083 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: 768 1084 case NAL_UNIT_CODED_SLICE_BLA_N_LP: 769 case NAL_UNIT_CODED_SLICE_IDR :1085 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: 770 1086 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 771 1087 case NAL_UNIT_CODED_SLICE_CRA: 772 1088 case NAL_UNIT_CODED_SLICE_RADL_N: 773 case NAL_UNIT_CODED_SLICE_ DLP:1089 case NAL_UNIT_CODED_SLICE_RADL_R: 774 1090 case NAL_UNIT_CODED_SLICE_RASL_N: 775 case NAL_UNIT_CODED_SLICE_ TFD:1091 case NAL_UNIT_CODED_SLICE_RASL_R: 776 1092 #if H_MV 777 1093 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag); … … 795 1111 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 796 1112 { 797 if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_ TFD|| m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))1113 if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 798 1114 { 799 1115 iPOCLastDisplay++; … … 826 1142 { 827 1143 if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA 828 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1144 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 829 1145 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 830 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT)1146 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) 831 1147 { 832 1148 // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. 833 1149 m_pocRandomAccess = m_apcSlicePilot->getPOC(); 834 1150 } 835 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )1151 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 836 1152 { 837 1153 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. … … 849 1165 } 850 1166 // skip the reordered pictures, if necessary 851 else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_ TFD|| m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))1167 else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 852 1168 { 853 1169 iPOCLastDisplay++; … … 881 1197 882 1198 #endif 883 884 1199 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.h
r438 r446 64 64 class TAppDecTop; 65 65 #endif 66 66 #if H_3D 67 class CamParsCollector 68 { 69 public: 70 CamParsCollector (); 71 ~CamParsCollector (); 72 73 Void init ( FILE* pCodedScaleOffsetFile ); 74 Void uninit (); 75 Void setSlice ( TComSlice* pcSlice ); 76 77 Bool isInitialized() const { return m_bInitialized; } 78 Int**** getBaseViewShiftLUTI() { return m_aiBaseViewShiftLUT; } 79 80 private: 81 Bool xIsComplete (); 82 Void xOutput ( Int iPOC ); 83 84 private: 85 Bool m_bInitialized; 86 FILE* m_pCodedScaleOffsetFile; 87 88 Int** m_aaiCodedOffset; 89 Int** m_aaiCodedScale; 90 Int* m_aiViewId; 91 Int* m_aiLayerIdx; 92 93 Bool* m_bViewReceived; 94 UInt m_uiCamParsCodedPrecision; 95 Bool m_bCamParsVaryOverTime; 96 Int m_iLastViewIndex; 97 Int m_iLastPOC; 98 UInt m_uiMaxViewIndex; 99 100 101 UInt m_uiBitDepthForLUT; 102 UInt m_iLog2Precision; 103 UInt m_uiInputBitDepth; 104 105 // look-up tables 106 Double**** m_adBaseViewShiftLUT; ///< Disparity LUT 107 Int**** m_aiBaseViewShiftLUT; ///< Disparity LUT 108 Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT); 109 Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT); 110 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 ); 111 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2 ); 112 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize ); 113 114 }; 115 116 template <class T> 117 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 ) 118 { 119 if( rpt ) 120 { 121 for( UInt uiK = 0; uiK < uiSize1; uiK++ ) 122 { 123 for( UInt uiL = 0; uiL < uiSize2; uiL++ ) 124 { 125 for( UInt uiM = 0; uiM < uiSize3; uiM++ ) 126 { 127 delete[] rpt[ uiK ][ uiL ][ uiM ]; 128 } 129 delete[] rpt[ uiK ][ uiL ]; 130 } 131 delete[] rpt[ uiK ]; 132 } 133 delete[] rpt; 134 } 135 rpt = NULL; 136 }; 137 138 139 template <class T> 140 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 ) 141 { 142 if( rpt ) 143 { 144 for( UInt uiK = 0; uiK < uiSize1; uiK++ ) 145 { 146 for( UInt uiL = 0; uiL < uiSize2; uiL++ ) 147 { 148 delete[] rpt[ uiK ][ uiL ]; 149 } 150 delete[] rpt[ uiK ]; 151 } 152 delete[] rpt; 153 } 154 rpt = NULL; 155 }; 156 157 158 template <class T> 159 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize ) 160 { 161 if( rpt ) 162 { 163 for( UInt uiK = 0; uiK < uiSize; uiK++ ) 164 { 165 delete[] rpt[ uiK ]; 166 } 167 delete[] rpt; 168 } 169 rpt = NULL; 170 }; 171 172 #endif //H_3D 67 173 /// decoder class 68 174 class TDecTop … … 81 187 ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets 82 188 #endif 83 84 189 TComSlice* m_apcSlicePilot; 85 190 … … 114 219 std::vector<TComPic*> m_refPicSetInterLayer; 115 220 #if H_3D 221 Int m_viewIndex; 116 222 Bool m_isDepth; 223 CamParsCollector* m_pcCamParsCollector; 117 224 #endif 118 225 #endif … … 142 249 #endif 143 250 144 145 251 #if H_MV 146 252 TComPic* getPic ( Int poc ); … … 154 260 Int getViewId () { return m_viewId; } 155 261 #if H_3D 262 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 263 Int getViewIndex () { return m_viewIndex; } 156 264 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 157 265 Bool getIsDepth () { return m_isDepth; } 158 #endif 159 #endif 160 266 Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; } 267 #endif 268 #endif 161 269 protected: 162 270 Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r438 r446 84 84 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 85 85 break; 86 #if J0149_TONE_MAPPING_SEI 87 case SEI::TONE_MAPPING_INFO: 88 fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n"); 89 break; 90 #endif 91 #if L0208_SOP_DESCRIPTION_SEI 92 case SEI::SOP_DESCRIPTION: 93 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 94 break; 95 #endif 96 #if K0180_SCALABLE_NESTING_SEI 97 case SEI::SCALABLE_NESTING: 98 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 99 break; 100 #endif 86 101 default: 87 102 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 91 106 #endif 92 107 108 #if K0180_SCALABLE_NESTING_SEI 109 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) 110 #else 93 111 void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps) 112 #endif 94 113 { 95 114 switch (sei.payloadType()) … … 128 147 xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei)); 129 148 break; 149 #if J0149_TONE_MAPPING_SEI 150 case SEI::TONE_MAPPING_INFO: 151 xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei)); 152 break; 153 #endif 154 #if L0208_SOP_DESCRIPTION_SEI 155 case SEI::SOP_DESCRIPTION: 156 xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei)); 157 break; 158 #endif 159 #if K0180_SCALABLE_NESTING_SEI 160 case SEI::SCALABLE_NESTING: 161 xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps); 162 break; 163 #endif 130 164 default: 131 165 assert(!"Unhandled SEI message"); … … 145 179 setBitstream(&bs_count); 146 180 181 182 #if K0180_SCALABLE_NESTING_SEI 183 184 #if ENC_DEC_TRACE 185 Bool traceEnable = g_HLSTraceEnable; 186 g_HLSTraceEnable = false; 187 #endif 188 xWriteSEIpayloadData(bs_count, sei, sps); 189 #if ENC_DEC_TRACE 190 g_HLSTraceEnable = traceEnable; 191 #endif 192 193 #else 194 147 195 #if ENC_DEC_TRACE 148 196 g_HLSTraceEnable = false; … … 152 200 g_HLSTraceEnable = true; 153 201 #endif 202 203 #endif 204 154 205 UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits(); 155 206 assert(0 == payload_data_num_bits % 8); … … 158 209 159 210 #if ENC_DEC_TRACE 211 #if K0180_SCALABLE_NESTING_SEI 212 if (g_HLSTraceEnable) 213 #endif 160 214 xTraceSEIHeader(); 161 215 #endif … … 177 231 /* payloadData */ 178 232 #if ENC_DEC_TRACE 233 #if K0180_SCALABLE_NESTING_SEI 234 if (g_HLSTraceEnable) 235 #endif 179 236 xTraceSEIMessageType(sei.payloadType()); 180 237 #endif 181 238 239 #if K0180_SCALABLE_NESTING_SEI 240 xWriteSEIpayloadData(bs, sei, sps); 241 #else 182 242 xWriteSEIpayloadData(sei, sps); 243 #endif 183 244 } 184 245 … … 421 482 xWriteByteAlign(); 422 483 } 484 485 #if J0149_TONE_MAPPING_SEI 486 Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei) 487 { 488 Int i; 489 WRITE_UVLC( sei.m_toneMapId, "tone_map_id" ); 490 WRITE_FLAG( sei.m_toneMapCancelFlag, "tone_map_cancel_flag" ); 491 if( !sei.m_toneMapCancelFlag ) 492 { 493 WRITE_FLAG( sei.m_toneMapPersistenceFlag, "tone_map_persistence_flag" ); 494 WRITE_CODE( sei.m_codedDataBitDepth, 8, "coded_data_bit_depth" ); 495 WRITE_CODE( sei.m_targetBitDepth, 8, "target_bit_depth" ); 496 WRITE_UVLC( sei.m_modelId, "model_id" ); 497 switch(sei.m_modelId) 498 { 499 case 0: 500 { 501 WRITE_CODE( sei.m_minValue, 32, "min_value" ); 502 WRITE_CODE( sei.m_maxValue, 32, "max_value" ); 503 break; 504 } 505 case 1: 506 { 507 WRITE_CODE( sei.m_sigmoidMidpoint, 32, "sigmoid_midpoint" ); 508 WRITE_CODE( sei.m_sigmoidWidth, 32, "sigmoid_width" ); 509 break; 510 } 511 case 2: 512 { 513 UInt num = 1u << sei.m_targetBitDepth; 514 for(i = 0; i < num; i++) 515 { 516 WRITE_CODE( sei.m_startOfCodedInterval[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3, "start_of_coded_interval" ); 517 } 518 break; 519 } 520 case 3: 521 { 522 WRITE_CODE( sei.m_numPivots, 16, "num_pivots" ); 523 for(i = 0; i < sei.m_numPivots; i++ ) 524 { 525 WRITE_CODE( sei.m_codedPivotValue[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3, "coded_pivot_value" ); 526 WRITE_CODE( sei.m_targetPivotValue[i], (( sei.m_targetBitDepth + 7 ) >> 3 ) << 3, "target_pivot_value"); 527 } 528 break; 529 } 530 case 4: 531 { 532 WRITE_CODE( sei.m_cameraIsoSpeedIdc, 8, "camera_iso_speed_idc" ); 533 if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO 534 { 535 WRITE_CODE( sei.m_cameraIsoSpeedValue, 32, "camera_iso_speed_value" ); 536 } 537 WRITE_FLAG( sei.m_exposureCompensationValueSignFlag, "exposure_compensation_value_sign_flag" ); 538 WRITE_CODE( sei.m_exposureCompensationValueNumerator, 16, "exposure_compensation_value_numerator" ); 539 WRITE_CODE( sei.m_exposureCompensationValueDenomIdc, 16, "exposure_compensation_value_denom_idc" ); 540 WRITE_CODE( sei.m_refScreenLuminanceWhite, 32, "ref_screen_luminance_white" ); 541 WRITE_CODE( sei.m_extendedRangeWhiteLevel, 32, "extended_range_white_level" ); 542 WRITE_CODE( sei.m_nominalBlackLevelLumaCodeValue, 16, "nominal_black_level_luma_code_value" ); 543 WRITE_CODE( sei.m_nominalWhiteLevelLumaCodeValue, 16, "nominal_white_level_luma_code_value" ); 544 WRITE_CODE( sei.m_extendedWhiteLevelLumaCodeValue, 16, "extended_white_level_luma_code_value" ); 545 break; 546 } 547 default: 548 { 549 assert(!"Undefined SEIToneMapModelId"); 550 break; 551 } 552 }//switch m_modelId 553 }//if(!sei.m_toneMapCancelFlag) 554 555 xWriteByteAlign(); 556 } 557 #endif 558 423 559 Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei) 424 560 { … … 455 591 } 456 592 593 #if L0208_SOP_DESCRIPTION_SEI 594 Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei) 595 { 596 WRITE_UVLC( sei.m_sopSeqParameterSetId, "sop_seq_parameter_set_id" ); 597 WRITE_UVLC( sei.m_numPicsInSopMinus1, "num_pics_in_sop_minus1" ); 598 for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++) 599 { 600 WRITE_CODE( sei.m_sopDescVclNaluType[i], 6, "sop_desc_vcl_nalu_type" ); 601 WRITE_CODE( sei.m_sopDescTemporalId[i], 3, "sop_desc_temporal_id" ); 602 if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP) 603 { 604 WRITE_UVLC( sei.m_sopDescStRpsIdx[i], "sop_desc_st_rps_idx" ); 605 } 606 if (i > 0) 607 { 608 WRITE_SVLC( sei.m_sopDescPocDelta[i], "sop_desc_poc_delta" ); 609 } 610 } 611 612 xWriteByteAlign(); 613 } 614 #endif 615 616 #if K0180_SCALABLE_NESTING_SEI 617 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps) 618 { 619 WRITE_FLAG( sei.m_bitStreamSubsetFlag, "bitstream_subset_flag" ); 620 WRITE_FLAG( sei.m_nestingOpFlag, "nesting_op_flag " ); 621 if (sei.m_nestingOpFlag) 622 { 623 WRITE_FLAG( sei.m_defaultOpFlag, "default_op_flag" ); 624 WRITE_UVLC( sei.m_nestingNumOpsMinus1, "nesting_num_ops" ); 625 for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++) 626 { 627 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 628 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id" ); 629 WRITE_UVLC( sei.m_nestingOpIdx[i], "nesting_op_idx" ); 630 } 631 } 632 else 633 { 634 WRITE_FLAG( sei.m_allLayersFlag, "all_layers_flag" ); 635 if (!sei.m_allLayersFlag) 636 { 637 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 638 WRITE_UVLC( sei.m_nestingNumLayersMinus1, "nesting_num_layers" ); 639 for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) 640 { 641 WRITE_CODE( sei.m_nestingLayerId[i], 6, "nesting_layer_id" ); 642 } 643 } 644 } 645 646 // byte alignment 647 while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 ) 648 { 649 WRITE_FLAG( 0, "nesting_zero_bit" ); 650 } 651 652 // write nested SEI messages 653 for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++) 654 { 655 writeSEImessage(bs, *(*it), sps); 656 } 657 } 658 #endif 659 457 660 Void SEIWriter::xWriteByteAlign() 458 661 { -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/SEIwrite.h
r438 r446 50 50 51 51 protected: 52 #if K0180_SCALABLE_NESTING_SEI 53 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); 54 #else 52 55 Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps); 56 #endif 53 57 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 54 58 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); … … 63 67 Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei); 64 68 Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei); 69 #if J0149_TONE_MAPPING_SEI 70 Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei); 71 #endif 72 #if L0208_SOP_DESCRIPTION_SEI 73 Void xWriteSEISOPDescription(const SEISOPDescription& sei); 74 #endif 75 #if K0180_SCALABLE_NESTING_SEI 76 Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps); 77 #endif 65 78 Void xWriteByteAlign(); 66 79 }; -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
r438 r446 185 185 { 186 186 { 187 #if !H_MV 187 188 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 188 189 DTRACE_CABAC_T( "\tstate=" ) … … 191 192 DTRACE_CABAC_V( binValue ) 192 193 DTRACE_CABAC_T( "\n" ) 194 #endif 193 195 } 194 196 m_uiBinsCoded += m_binCountIncrement; … … 231 233 { 232 234 { 235 #if !H_MV 233 236 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 234 237 DTRACE_CABAC_T( "\tEPsymbol=" ) 235 238 DTRACE_CABAC_V( binValue ) 236 239 DTRACE_CABAC_T( "\n" ) 240 #endif 237 241 } 238 242 m_uiBinsCoded += m_binCountIncrement; … … 259 263 for ( Int i = 0; i < numBins; i++ ) 260 264 { 265 #if !H_MV 261 266 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 262 267 DTRACE_CABAC_T( "\tEPsymbol=" ) 263 268 DTRACE_CABAC_V( ( binValues >> ( numBins - 1 - i ) ) & 1 ) 264 269 DTRACE_CABAC_T( "\n" ) 270 #endif 265 271 } 266 272 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r438 r446 285 285 WRITE_FLAG(pcVUI->getNeutralChromaIndicationFlag(), "neutral_chroma_indication_flag"); 286 286 WRITE_FLAG(pcVUI->getFieldSeqFlag(), "field_seq_flag"); 287 assert(pcVUI->getFieldSeqFlag() == 0); // not currently supported288 287 WRITE_FLAG(pcVUI->getFrameFieldInfoPresentFlag(), "frame_field_info_present_flag"); 289 288 … … 434 433 } 435 434 435 #if H_3D 436 Void TEncCavlc::codeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) 437 #else 436 438 Void TEncCavlc::codeSPS( TComSPS* pcSPS ) 439 #endif 437 440 { 438 441 #if ENC_DEC_TRACE … … 474 477 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 475 478 { 479 #if L0323_DPB 480 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); 481 #else 476 482 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i), "sps_max_dec_pic_buffering[i]" ); 483 #endif 477 484 WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_num_reorder_pics[i]" ); 478 485 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase[i]" ); … … 484 491 assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() ); 485 492 486 UInt MinCUSize = pcSPS->getMaxCUWidth() >> ( pcSPS->getMaxCUDepth()-g_uiAddCUDepth ); 487 UInt log2MinCUSize = 0; 488 while(MinCUSize > 1) 489 { 490 MinCUSize >>= 1; 491 log2MinCUSize++; 492 } 493 494 WRITE_UVLC( log2MinCUSize - 3, "log2_min_coding_block_size_minus3" ); 495 WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth, "log2_diff_max_min_coding_block_size" ); 493 WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3, "log2_min_coding_block_size_minus3" ); 494 WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(), "log2_diff_max_min_coding_block_size" ); 496 495 WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2, "log2_min_transform_block_size_minus2" ); 497 496 WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size" ); … … 554 553 } 555 554 555 #if H_MV 556 WRITE_FLAG( 1, "sps_extension_flag" ); 557 WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" ); 558 #if !H_3D 559 WRITE_FLAG( 0, "sps_extension2_flag" ); 560 #else 561 WRITE_FLAG( 1, "sps_extension2_flag" ); 562 if (!depthFlag ) 563 { 564 WRITE_UVLC( pcSPS->getCamParPrecision(), "cp_precision" ); 565 WRITE_FLAG( pcSPS->hasCamParInSliceHeader() ? 1 : 0, "cp_in_slice_header_flag" ); 566 if( !pcSPS->hasCamParInSliceHeader() ) 567 { 568 for( UInt uiIndex = 0; uiIndex < viewIndex; uiIndex++ ) 569 { 570 WRITE_SVLC( pcSPS->getCodedScale ()[ uiIndex ], "cp_scale" ); 571 WRITE_SVLC( pcSPS->getCodedOffset ()[ uiIndex ], "cp_off" ); 572 WRITE_SVLC( pcSPS->getInvCodedScale ()[ uiIndex ] + pcSPS->getCodedScale ()[ uiIndex ], "cp_inv_scale_plus_scale" ); 573 WRITE_SVLC( pcSPS->getInvCodedOffset()[ uiIndex ] + pcSPS->getCodedOffset()[ uiIndex ], "cp_inv_off_plus_off" ); 574 } 575 } 576 } 577 578 WRITE_FLAG( 0, "sps_extension3_flag" ); 579 #endif 580 #else 556 581 WRITE_FLAG( 0, "sps_extension_flag" ); 582 #endif 557 583 } 558 584 … … 569 595 WRITE_FLAG( pcVPS->getTemporalNestingFlag(), "vps_temporal_id_nesting_flag" ); 570 596 assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); 597 #if H_MV 571 598 WRITE_CODE( 0xffff, 16, "vps_extension_offset" ); 599 #else 600 WRITE_CODE( 0xffff, 16, "vps_reserved_ffff_16bits" ); 601 #endif 572 602 codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 ); 573 603 #if SIGNAL_BITRATE_PICRATE_IN_VPS … … 578 608 for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) 579 609 { 610 #if L0323_DPB 611 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]" ); 612 #else 580 613 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i), "vps_max_dec_pic_buffering[i]" ); 614 #endif 581 615 WRITE_UVLC( pcVPS->getNumReorderPics(i), "vps_num_reorder_pics[i]" ); 582 616 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase[i]" ); … … 645 679 } 646 680 #endif 647 648 681 #if H_MV 649 682 WRITE_FLAG( 1, "vps_extension_flag" ); … … 666 699 WRITE_FLAG( pcVPS->getVpsNuhLayerIdPresentFlag() ? 1 : 0, "vps_nuh_layer_id_present_flag"); 667 700 668 for( Int layer = 1; layer <= pcVPS->getMaxLayers() - 1; layer++ ) 669 { 670 if (pcVPS->getVpsNuhLayerIdPresentFlag() ) 701 // already updated to JCT3V-D0220 702 for( Int layer = 0; layer <= pcVPS->getMaxLayers() - 1; layer++ ) 703 { 704 if ( ( layer != 0 ) && pcVPS->getVpsNuhLayerIdPresentFlag() ) 671 705 WRITE_CODE( pcVPS->getLayerIdInNuh( layer ), 6, "layer_id_in_nuh[i]"); 672 706 for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes() ; sIdx++ ) … … 779 813 // colour_plane_id u(2) 780 814 815 #if H_MV 816 // Temporary fix for FIX1071 should be removed later 817 TComReferencePictureSet* rps = pcSlice->getRPS(); 818 #endif 781 819 if( !pcSlice->getIdrPicFlag() ) 782 820 { 783 821 Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC()); 784 822 WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); 823 #if !H_MV 824 // Temporary fix for FIX1071 should be removed later 785 825 TComReferencePictureSet* rps = pcSlice->getRPS(); 826 #endif 827 #if FIX1071 828 // Deal with bitstream restriction stating that: 829 // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. 830 // Ideally this process should not be repeated for each slice in a picture 831 TComReferencePictureSet altRps; 832 Bool useAltRps = false; 833 if (pcSlice->getRapPicFlag()) 834 { 835 for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++) 836 { 837 useAltRps = rps->getUsed(picIdx); 838 } 839 if (useAltRps) 840 { 841 memcpy(&altRps, rps, sizeof(TComReferencePictureSet)); 842 rps = &altRps; 843 for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++) 844 { 845 rps->setUsed(picIdx, false); 846 } 847 } 848 } 849 850 if(pcSlice->getRPSidx() < 0 || useAltRps) 851 #else 786 852 if(pcSlice->getRPSidx() < 0) 853 #endif 787 854 { 788 855 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); … … 917 984 pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 918 985 } 919 986 #if H_MV 987 // Temporary fix for FIX1071 should be removed later 988 if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList( rps ) > 1) 989 #else 920 990 if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList() > 1) 991 #endif 921 992 { 922 993 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); … … 1041 1112 if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag()) 1042 1113 { 1114 #if !H_3D 1043 1115 WRITE_UVLC(0,"slice_header_extension_length"); 1116 #else 1117 WRITE_UVLC(0,"slice_header_extension_length"); //<- this element needs to be set to the correct value!! 1118 1119 if( pcSlice->getSPS()->hasCamParInSliceHeader() ) 1120 { 1121 for( UInt uiId = 0; uiId < pcSlice->getViewIndex(); uiId++ ) 1122 { 1123 WRITE_SVLC( pcSlice->getCodedScale ()[ uiId ], "cp_scale" ); 1124 WRITE_SVLC( pcSlice->getCodedOffset ()[ uiId ], "cp_off" ); 1125 WRITE_SVLC( pcSlice->getInvCodedScale ()[ uiId ] + pcSlice->getCodedScale ()[ uiId ], "cp_inv_scale_plus_scale" ); 1126 WRITE_SVLC( pcSlice->getInvCodedOffset()[ uiId ] + pcSlice->getCodedOffset()[ uiId ], "cp_inv_off_plus_off" ); 1127 } 1128 } 1129 1130 Bool sliceSegmentHeaderExtension2Flag = false; 1131 WRITE_FLAG( sliceSegmentHeaderExtension2Flag ? 1 : 0 , "slice_segment_header_extension2_flag" ); 1132 if ( sliceSegmentHeaderExtension2Flag ) 1133 { 1134 WRITE_UVLC(0,"slice_header_extension2_length"); 1135 } 1136 #endif 1044 1137 } 1045 1138 } … … 1367 1460 // ==================================================================================================================== 1368 1461 1369 1370 /** Write PCM alignment bits.1371 * \returns Void1372 */1373 Void TEncCavlc::xWritePCMAlignZero ()1374 {1375 m_pcBitIf->writeAlignZero();1376 }1377 1378 Void TEncCavlc::xWriteUnaryMaxSymbol( UInt uiSymbol, UInt uiMaxSymbol )1379 {1380 if (uiMaxSymbol == 0)1381 {1382 return;1383 }1384 xWriteFlag( uiSymbol ? 1 : 0 );1385 if ( uiSymbol == 0 )1386 {1387 return;1388 }1389 1390 Bool bCodeLast = ( uiMaxSymbol > uiSymbol );1391 1392 while( --uiSymbol )1393 {1394 xWriteFlag( 1 );1395 }1396 if( bCodeLast )1397 {1398 xWriteFlag( 0 );1399 }1400 return;1401 }1402 1403 Void TEncCavlc::xWriteExGolombLevel( UInt uiSymbol )1404 {1405 if( uiSymbol )1406 {1407 xWriteFlag( 1 );1408 UInt uiCount = 0;1409 Bool bNoExGo = (uiSymbol < 13);1410 1411 while( --uiSymbol && ++uiCount < 13 )1412 {1413 xWriteFlag( 1 );1414 }1415 if( bNoExGo )1416 {1417 xWriteFlag( 0 );1418 }1419 else1420 {1421 xWriteEpExGolomb( uiSymbol, 0 );1422 }1423 }1424 else1425 {1426 xWriteFlag( 0 );1427 }1428 return;1429 }1430 1431 Void TEncCavlc::xWriteEpExGolomb( UInt uiSymbol, UInt uiCount )1432 {1433 while( uiSymbol >= (UInt)(1<<uiCount) )1434 {1435 xWriteFlag( 1 );1436 uiSymbol -= 1<<uiCount;1437 uiCount ++;1438 }1439 xWriteFlag( 0 );1440 while( uiCount-- )1441 {1442 xWriteFlag( (uiSymbol>>uiCount) & 1 );1443 }1444 return;1445 }1446 1447 1462 /** code explicit wp tables 1448 1463 * \param TComSlice* pcSlice -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCavlc.h
r438 r446 69 69 UInt m_uiCoeffCost; 70 70 71 Void xWritePCMAlignZero ();72 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount );73 Void xWriteExGolombLevel ( UInt uiSymbol );74 Void xWriteUnaryMaxSymbol ( UInt uiSymbol, UInt uiMaxSymbol );75 76 71 Void codeShortTermRefPicSet ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx ); 77 72 Bool findMatchingLTRP ( TComSlice* pcSlice, UInt *ltrpsIndex, Int ltrpPOC, Bool usedFlag ); … … 90 85 Void codeVPS ( TComVPS* pcVPS ); 91 86 Void codeVUI ( TComVUI *pcVUI, TComSPS* pcSPS ); 87 #if H_3D 88 Void codeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ); 89 #else 92 90 Void codeSPS ( TComSPS* pcSPS ); 91 #endif 93 92 Void codePPS ( TComPPS* pcPPS ); 94 93 Void codeSliceHeader ( TComSlice* pcSlice ); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCfg.h
r438 r446 46 46 #include "TLibCommon/TComSlice.h" 47 47 #include <assert.h> 48 #if H_3D 49 #include "TAppCommon/TAppComCamPara.h" 50 #include "TLibRenderer/TRenModSetupStrParser.h" 51 #endif 48 52 49 53 struct GOPEntry … … 74 78 Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 75 79 #endif 76 77 80 GOPEntry() 78 81 : m_POC(-1) … … 172 175 Int m_loopFilterTcOffsetDiv2; 173 176 Bool m_DeblockingFilterControlPresent; 177 #if L0386_DB_METRIC 178 Bool m_DeblockingFilterMetric; 179 #endif 174 180 Bool m_bUseSAO; 175 181 Int m_maxNumOffsetsPerPic; … … 202 208 Bool m_bUseASR; 203 209 Bool m_bUseHADME; 210 #if !L0034_COMBINED_LIST_CLEANUP 204 211 Bool m_bUseLComb; 212 #endif 205 213 Bool m_useRDOQ; 206 214 Bool m_useRDOQTS; … … 248 256 Int m_pictureTimingSEIEnabled; 249 257 Int m_recoveryPointSEIEnabled; 258 #if J0149_TONE_MAPPING_SEI 259 Bool m_toneMappingInfoSEIEnabled; 260 Int m_toneMapId; 261 Bool m_toneMapCancelFlag; 262 Bool m_toneMapPersistenceFlag; 263 Int m_codedDataBitDepth; 264 Int m_targetBitDepth; 265 Int m_modelId; 266 Int m_minValue; 267 Int m_maxValue; 268 Int m_sigmoidMidpoint; 269 Int m_sigmoidWidth; 270 Int m_numPivots; 271 Int m_cameraIsoSpeedIdc; 272 Int m_cameraIsoSpeedValue; 273 Int m_exposureCompensationValueSignFlag; 274 Int m_exposureCompensationValueNumerator; 275 Int m_exposureCompensationValueDenomIdc; 276 Int m_refScreenLuminanceWhite; 277 Int m_extendedRangeWhiteLevel; 278 Int m_nominalBlackLevelLumaCodeValue; 279 Int m_nominalWhiteLevelLumaCodeValue; 280 Int m_extendedWhiteLevelLumaCodeValue; 281 Int* m_startOfCodedInterval; 282 Int* m_codedPivotValue; 283 Int* m_targetPivotValue; 284 #endif 250 285 Int m_framePackingSEIEnabled; 251 286 Int m_framePackingSEIType; … … 257 292 Int m_gradualDecodingRefreshInfoEnabled; 258 293 Int m_decodingUnitInfoSEIEnabled; 294 #if L0208_SOP_DESCRIPTION_SEI 295 Int m_SOPDescriptionSEIEnabled; 296 #endif 297 #if K0180_SCALABLE_NESTING_SEI 298 Int m_scalableNestingSEIEnabled; 299 #endif 259 300 //====== Weighted Prediction ======== 260 301 Bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) … … 321 362 Int m_layerIdInVps; 322 363 Int m_viewId; 364 #endif 365 323 366 #if H_3D 367 Int m_viewIndex; 324 368 Bool m_isDepth; 325 #endif 369 370 //====== Camera Parameters ====== 371 UInt m_uiCamParPrecision; 372 Bool m_bCamParInSliceHeader; 373 Int** m_aaiCodedScale; 374 Int** m_aaiCodedOffset; 375 TAppComCamPara* m_cameraParameters; 376 377 #if H_3D_VSO 378 //====== View Synthesis Optimization ====== 379 TRenModSetupStrParser* m_renderModelParameters; 380 Bool m_bUseVSO; 381 Bool m_bForceLambdaScale; 382 Bool m_bAllowNegDist; 383 Double m_dLambdaScaleVSO; 384 UInt m_uiVSOMode; 385 386 // LGE_WVSO_A0119 387 Bool m_bUseWVSO; 388 Int m_iVSOWeight; 389 Int m_iVSDWeight; 390 Int m_iDWeight; 391 #endif 392 393 // SAIT_VSO_EST_A0033 394 Bool m_bUseEstimatedVSD; 395 Double m_dDispCoeff; 326 396 #endif 327 397 … … 335 405 , m_viewId(-1) 336 406 #if H_3D 407 , m_viewIndex(-1) 337 408 , m_isDepth(false) 338 409 #endif … … 367 438 Int getViewId () { return m_viewId; } 368 439 #if H_3D 440 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 441 Int getViewIndex () { return m_viewIndex; } 369 442 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 370 443 Bool getIsDepth () { return m_isDepth; } 371 444 #endif 372 445 #endif 373 374 446 //====== Coding Structure ======== 375 447 Void setIntraPeriod ( Int i ) { m_uiIntraPeriod = (UInt)i; } … … 409 481 Void setLoopFilterTcOffset ( Int i ) { m_loopFilterTcOffsetDiv2 = i; } 410 482 Void setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; } 483 #if L0386_DB_METRIC 484 Void setDeblockingFilterMetric ( Bool b ) { m_DeblockingFilterMetric = b; } 485 #endif 411 486 412 487 //====== Motion search ======== … … 463 538 Int getLoopFilterTcOffset () { return m_loopFilterTcOffsetDiv2; } 464 539 Bool getDeblockingFilterControlPresent() { return m_DeblockingFilterControlPresent; } 540 #if L0386_DB_METRIC 541 Bool getDeblockingFilterMetric () { return m_DeblockingFilterMetric; } 542 #endif 465 543 466 544 //==== Motion search ======== … … 480 558 Void setUseASR ( Bool b ) { m_bUseASR = b; } 481 559 Void setUseHADME ( Bool b ) { m_bUseHADME = b; } 560 #if !L0034_COMBINED_LIST_CLEANUP 482 561 Void setUseLComb ( Bool b ) { m_bUseLComb = b; } 562 #endif 483 563 Void setUseRDOQ ( Bool b ) { m_useRDOQ = b; } 484 564 Void setUseRDOQTS ( Bool b ) { m_useRDOQTS = b; } … … 502 582 Bool getUseASR () { return m_bUseASR; } 503 583 Bool getUseHADME () { return m_bUseHADME; } 584 #if !L0034_COMBINED_LIST_CLEANUP 504 585 Bool getUseLComb () { return m_bUseLComb; } 586 #endif 505 587 Bool getUseRDOQ () { return m_useRDOQ; } 506 588 Bool getUseRDOQTS () { return m_useRDOQTS; } … … 599 681 Void setRecoveryPointSEIEnabled(Int b) { m_recoveryPointSEIEnabled = b; } 600 682 Int getRecoveryPointSEIEnabled() { return m_recoveryPointSEIEnabled; } 683 #if J0149_TONE_MAPPING_SEI 684 Void setToneMappingInfoSEIEnabled(Bool b) { m_toneMappingInfoSEIEnabled = b; } 685 Bool getToneMappingInfoSEIEnabled() { return m_toneMappingInfoSEIEnabled; } 686 Void setTMISEIToneMapId(Int b) { m_toneMapId = b; } 687 Int getTMISEIToneMapId() { return m_toneMapId; } 688 Void setTMISEIToneMapCancelFlag(Bool b) { m_toneMapCancelFlag=b; } 689 Bool getTMISEIToneMapCancelFlag() { return m_toneMapCancelFlag; } 690 Void setTMISEIToneMapPersistenceFlag(Bool b) { m_toneMapPersistenceFlag = b; } 691 Bool getTMISEIToneMapPersistenceFlag() { return m_toneMapPersistenceFlag; } 692 Void setTMISEICodedDataBitDepth(Int b) { m_codedDataBitDepth = b; } 693 Int getTMISEICodedDataBitDepth() { return m_codedDataBitDepth; } 694 Void setTMISEITargetBitDepth(Int b) { m_targetBitDepth = b; } 695 Int getTMISEITargetBitDepth() { return m_targetBitDepth; } 696 Void setTMISEIModelID(Int b) { m_modelId = b; } 697 Int getTMISEIModelID() { return m_modelId; } 698 Void setTMISEIMinValue(Int b) { m_minValue = b; } 699 Int getTMISEIMinValue() { return m_minValue; } 700 Void setTMISEIMaxValue(Int b) { m_maxValue = b; } 701 Int getTMISEIMaxValue() { return m_maxValue; } 702 Void setTMISEISigmoidMidpoint(Int b) { m_sigmoidMidpoint = b; } 703 Int getTMISEISigmoidMidpoint() { return m_sigmoidMidpoint; } 704 Void setTMISEISigmoidWidth(Int b) { m_sigmoidWidth = b; } 705 Int getTMISEISigmoidWidth() { return m_sigmoidWidth; } 706 Void setTMISEIStartOfCodedInterva( Int* p ) { m_startOfCodedInterval = p; } 707 Int* getTMISEIStartOfCodedInterva() { return m_startOfCodedInterval; } 708 Void setTMISEINumPivots(Int b) { m_numPivots = b; } 709 Int getTMISEINumPivots() { return m_numPivots; } 710 Void setTMISEICodedPivotValue( Int* p ) { m_codedPivotValue = p; } 711 Int* getTMISEICodedPivotValue() { return m_codedPivotValue; } 712 Void setTMISEITargetPivotValue( Int* p ) { m_targetPivotValue = p; } 713 Int* getTMISEITargetPivotValue() { return m_targetPivotValue; } 714 Void setTMISEICameraIsoSpeedIdc(Int b) { m_cameraIsoSpeedIdc = b; } 715 Int getTMISEICameraIsoSpeedIdc() { return m_cameraIsoSpeedIdc; } 716 Void setTMISEICameraIsoSpeedValue(Int b) { m_cameraIsoSpeedValue = b; } 717 Int getTMISEICameraIsoSpeedValue() { return m_cameraIsoSpeedValue; } 718 Void setTMISEIExposureCompensationValueSignFlag(Int b) { m_exposureCompensationValueSignFlag = b; } 719 Int getTMISEIExposureCompensationValueSignFlag() { return m_exposureCompensationValueSignFlag; } 720 Void setTMISEIExposureCompensationValueNumerator(Int b) { m_exposureCompensationValueNumerator = b; } 721 Int getTMISEIExposureCompensationValueNumerator() { return m_exposureCompensationValueNumerator; } 722 Void setTMISEIExposureCompensationValueDenomIdc(Int b) { m_exposureCompensationValueDenomIdc =b; } 723 Int getTMISEIExposureCompensationValueDenomIdc() { return m_exposureCompensationValueDenomIdc; } 724 Void setTMISEIRefScreenLuminanceWhite(Int b) { m_refScreenLuminanceWhite = b; } 725 Int getTMISEIRefScreenLuminanceWhite() { return m_refScreenLuminanceWhite; } 726 Void setTMISEIExtendedRangeWhiteLevel(Int b) { m_extendedRangeWhiteLevel = b; } 727 Int getTMISEIExtendedRangeWhiteLevel() { return m_extendedRangeWhiteLevel; } 728 Void setTMISEINominalBlackLevelLumaCodeValue(Int b) { m_nominalBlackLevelLumaCodeValue = b; } 729 Int getTMISEINominalBlackLevelLumaCodeValue() { return m_nominalBlackLevelLumaCodeValue; } 730 Void setTMISEINominalWhiteLevelLumaCodeValue(Int b) { m_nominalWhiteLevelLumaCodeValue = b; } 731 Int getTMISEINominalWhiteLevelLumaCodeValue() { return m_nominalWhiteLevelLumaCodeValue; } 732 Void setTMISEIExtendedWhiteLevelLumaCodeValue(Int b) { m_extendedWhiteLevelLumaCodeValue =b; } 733 Int getTMISEIExtendedWhiteLevelLumaCodeValue() { return m_extendedWhiteLevelLumaCodeValue; } 734 #endif 601 735 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } 602 736 Int getFramePackingArrangementSEIEnabled() { return m_framePackingSEIEnabled; } … … 617 751 Void setDecodingUnitInfoSEIEnabled(Int b) { m_decodingUnitInfoSEIEnabled = b; } 618 752 Int getDecodingUnitInfoSEIEnabled() { return m_decodingUnitInfoSEIEnabled; } 753 #if L0208_SOP_DESCRIPTION_SEI 754 Void setSOPDescriptionSEIEnabled(Int b) { m_SOPDescriptionSEIEnabled = b; } 755 Int getSOPDescriptionSEIEnabled() { return m_SOPDescriptionSEIEnabled; } 756 #endif 757 #if K0180_SCALABLE_NESTING_SEI 758 Void setScalableNestingSEIEnabled(Int b) { m_scalableNestingSEIEnabled = b; } 759 Int getScalableNestingSEIEnabled() { return m_scalableNestingSEIEnabled; } 760 #endif 619 761 Void setUseWP ( Bool b ) { m_useWeightedPred = b; } 620 762 Void setWPBiPred ( Bool b ) { m_useWeightedBiPred = b; } … … 744 886 Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; } 745 887 #endif 888 #if H_3D 889 /// 3D Tools 890 891 //==== CAMERA PARAMETERS ========== 892 Void setCamParPrecision ( UInt u ) { m_uiCamParPrecision = u; } 893 Void setCamParInSliceHeader ( Bool b ) { m_bCamParInSliceHeader = b; } 894 Void setCodedScale ( Int** p ) { m_aaiCodedScale = p; } 895 Void setCodedOffset ( Int** p ) { m_aaiCodedOffset = p; } 896 Void setCameraParameters ( TAppComCamPara* c) { m_cameraParameters = c; } 897 898 #if H_3D_VSO 899 //==== VSO ========== 900 Void setRenderModelParameters ( TRenModSetupStrParser* c ) { m_renderModelParameters = c; } 901 Bool getUseVSO () { return m_bUseVSO; } 902 Void setUseVSO ( Bool b ) { m_bUseVSO = b; } 903 UInt getVSOMode () { return m_uiVSOMode; } 904 Void setVSOMode ( UInt ui ) { m_uiVSOMode = ui; } 905 Bool getForceLambdaScaleVSO () { return m_bForceLambdaScale; } 906 Void setForceLambdaScaleVSO ( Bool b ) { m_bForceLambdaScale = b; }; 907 Double getLambdaScaleVSO () { return m_dLambdaScaleVSO; } 908 Void setLambdaScaleVSO ( Double d ) { m_dLambdaScaleVSO = d; }; 909 Bool getAllowNegDist () { return m_bAllowNegDist; } 910 Void setAllowNegDist ( Bool b ) { m_bAllowNegDist = b; }; 911 912 // LGE_WVSO_A0119 913 Bool getUseWVSO () { return m_bUseWVSO; } 914 Void setUseWVSO ( Bool b ) { m_bUseWVSO = b; } 915 Int getVSOWeight () { return m_iVSOWeight; } 916 Void setVSOWeight ( Int i ) { m_iVSOWeight = i; } 917 Int getVSDWeight () { return m_iVSDWeight; } 918 Void setVSDWeight ( Int i ) { m_iVSDWeight = i; } 919 Int getDWeight () { return m_iDWeight; } 920 Void setDWeight ( Int i ) { m_iDWeight = i; } 921 922 // SAIT_VSO_EST_A0033 923 Bool getUseEstimatedVSD () { return m_bUseEstimatedVSD; } 924 Void setUseEstimatedVSD ( Bool b ) { m_bUseEstimatedVSD = b; } 925 Double getDispCoeff () { return m_dDispCoeff; } 926 Void setDispCoeff ( Double d ) { m_dDispCoeff = d; } 927 #endif // H_3D_VSO 928 #endif // H_3D 746 929 }; 747 930 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCu.cpp
r324 r446 710 710 UInt uiRawBits = (2 * g_bitDepthY + g_bitDepthC) * rpcBestCU->getWidth(0) * rpcBestCU->getHeight(0) / 2; 711 711 UInt uiBestBits = rpcBestCU->getTotalBits(); 712 #if H_3D_VSO // M7 713 Double dRDCostTemp = m_pcRdCost->getUseVSO() ? m_pcRdCost->calcRdCostVSO(uiRawBits, 0) : m_pcRdCost->calcRdCost(uiRawBits, 0); 714 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > dRDCostTemp )) 715 #else 712 716 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0))) 717 #endif 713 718 { 714 719 xCheckIntraPCM (rpcBestCU, rpcTempCU); … … 730 735 rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 731 736 } 737 738 #if H_3D_VSO // M8 739 if ( m_pcRdCost->getUseVSO() ) 740 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 741 else 742 #endif 732 743 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 733 744 … … 822 833 if( bSubBranch && bTrySplitDQP && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) 823 834 { 835 #if H_3D_VSO // M9 836 // reset Model 837 if( m_pcRdCost->getUseRenModel() ) 838 { 839 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ( ); 840 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight( ); 841 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getLumaAddr( 0 ); 842 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride(); 843 m_pcRdCost->setRenModelData( m_ppcBestCU[uiDepth], 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 844 } 845 #endif 846 824 847 UChar uhNextDepth = uiDepth+1; 825 848 TComDataCU* pcSubBestPartCU = m_ppcBestCU[uhNextDepth]; … … 880 903 } 881 904 } 905 906 #if H_3D_VSO // M10 907 if ( m_pcRdCost->getUseVSO() ) 908 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 909 else 910 #endif 882 911 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 883 912 … … 914 943 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 915 944 } 945 #if H_3D_VSO // M11 946 if ( m_pcRdCost->getUseLambdaScaleVSO()) 947 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 948 else 949 #endif 916 950 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 917 951 #endif … … 946 980 } 947 981 } 982 983 984 #if H_3D_VSO // M12 985 if( m_pcRdCost->getUseRenModel() ) 986 { 987 UInt uiWidth = m_ppcRecoYuvBest[uiDepth]->getWidth ( ); 988 UInt uiHeight = m_ppcRecoYuvBest[uiDepth]->getHeight ( ); 989 Pel* piSrc = m_ppcRecoYuvBest[uiDepth]->getLumaAddr( 0 ); 990 UInt uiSrcStride = m_ppcRecoYuvBest[uiDepth]->getStride ( ); 991 m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 992 } 993 #endif 948 994 949 995 rpcBestCU->copyToPic(uiDepth); // Copy Best data to Picture for next partition prediction. … … 1195 1241 } 1196 1242 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1243 1244 #if H_3D_VSO // M1 //nececcary here? 1245 if( m_pcRdCost->getUseRenModel() ) 1246 { 1247 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( ); 1248 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( ); 1249 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr( ); 1250 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride(); 1251 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1252 } 1253 #endif 1254 1197 1255 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1198 1256 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth ); … … 1240 1298 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1241 1299 // estimate residual and encode everything 1300 1301 #if H_3D_VSO //M2 1302 if( m_pcRdCost->getUseRenModel() ) 1303 { //Reset 1304 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth (); 1305 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight (); 1306 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr (); 1307 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride (); 1308 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1309 } 1310 #endif 1311 1242 1312 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 1243 1313 m_ppcOrigYuv [uhDepth], … … 1314 1384 { 1315 1385 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1316 1386 #if H_3D_VSO // M3 1387 if( m_pcRdCost->getUseRenModel() ) 1388 { 1389 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( ); 1390 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( ); 1391 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr( ); 1392 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride(); 1393 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1394 } 1395 #endif 1396 1317 1397 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 1318 1398 … … 1348 1428 1349 1429 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false ); 1430 1431 1432 #if H_3D_VSO // M4 1433 if( m_pcRdCost->getUseLambdaScaleVSO() ) 1434 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1435 else 1436 #endif 1350 1437 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1351 1438 … … 1358 1445 UInt uiDepth = rpcTempCU->getDepth( 0 ); 1359 1446 1447 #if H_3D_VSO // M5 1448 if( m_pcRdCost->getUseRenModel() ) 1449 { 1450 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth (); 1451 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight (); 1452 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getLumaAddr(); 1453 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride (); 1454 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1455 } 1456 #endif 1457 1360 1458 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 1361 1459 … … 1399 1497 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1400 1498 } 1499 1500 #if H_3D_VSO // M6 1501 if( m_pcRdCost->getUseLambdaScaleVSO()) 1502 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1503 else 1504 #endif 1401 1505 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1402 1506 … … 1446 1550 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1447 1551 } 1552 #if H_3D_VSO // M44 1553 if ( m_pcRdCost->getUseVSO() ) 1554 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1555 else 1556 #endif 1448 1557 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1449 1558 … … 1501 1610 pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1502 1611 } 1612 #if H_3D_VSO // M45 1613 if ( m_pcRdCost->getUseVSO() ) 1614 pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( pcCU->getTotalBits(), pcCU->getTotalDistortion() ); 1615 else 1616 #endif 1503 1617 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( pcCU->getTotalBits(), pcCU->getTotalDistortion() ); 1504 1618 #endif -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncEntropy.cpp
r438 r446 87 87 } 88 88 89 #if H_3D 90 Void TEncEntropy::encodeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) 91 { 92 m_pcEntropyCoderIf->codeSPS( pcSPS, viewIndex, depthFlag ); 93 return; 94 } 95 #else 89 96 Void TEncEntropy::encodeSPS( TComSPS* pcSPS ) 90 97 { … … 92 99 return; 93 100 } 101 #endif 94 102 95 103 Void TEncEntropy::encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) … … 587 595 if( pcCU->isIntra(uiAbsPartIdx) ) 588 596 { 597 #if !H_MV 589 598 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 590 599 DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" ) 591 600 DTRACE_CABAC_V( uiDepth ) 592 601 DTRACE_CABAC_T( "\n" ) 602 #endif 593 603 } 594 604 else -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncEntropy.h
r324 r446 69 69 70 70 virtual Void codeVPS ( TComVPS* pcVPS ) = 0; 71 #if !H_3D 71 72 virtual Void codeSPS ( TComSPS* pcSPS ) = 0; 73 #else 74 virtual Void codeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) = 0; 75 #endif 72 76 virtual Void codePPS ( TComPPS* pcPPS ) = 0; 73 77 virtual Void codeSliceHeader ( TComSlice* pcSlice ) = 0; … … 149 153 Void encodeVPS ( TComVPS* pcVPS); 150 154 // SPS 155 #if H_3D 156 Void encodeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ); 157 #else 151 158 Void encodeSPS ( TComSPS* pcSPS ); 159 #endif 152 160 Void encodePPS ( TComPPS* pcPPS ); 153 161 Void encodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r438 r446 96 96 #if L0045_NON_NESTED_SEI_RESTRICTIONS 97 97 xResetNonNestedSEIPresentFlags(); 98 #endif 99 98 #if K0180_SCALABLE_NESTING_SEI 99 xResetNestedSEIPresentFlags(); 100 #endif 101 #endif 100 102 #if H_MV 101 103 m_layerId = 0; … … 103 105 m_pocLastCoded = -1; 104 106 #if H_3D 107 m_viewIndex = 0; 105 108 m_isDepth = false; 106 109 #endif 107 110 #endif 108 109 111 return; 110 112 } … … 151 153 m_viewId = pcTEncTop->getViewId(); 152 154 #if H_3D 155 m_viewIndex = pcTEncTop->getViewIndex(); 153 156 m_isDepth = pcTEncTop->getIsDepth(); 154 157 #endif … … 211 214 } 212 215 216 #if J0149_TONE_MAPPING_SEI 217 SEIToneMappingInfo* TEncGOP::xCreateSEIToneMappingInfo() 218 { 219 SEIToneMappingInfo *seiToneMappingInfo = new SEIToneMappingInfo(); 220 seiToneMappingInfo->m_toneMapId = m_pcCfg->getTMISEIToneMapId(); 221 seiToneMappingInfo->m_toneMapCancelFlag = m_pcCfg->getTMISEIToneMapCancelFlag(); 222 seiToneMappingInfo->m_toneMapPersistenceFlag = m_pcCfg->getTMISEIToneMapPersistenceFlag(); 223 224 seiToneMappingInfo->m_codedDataBitDepth = m_pcCfg->getTMISEICodedDataBitDepth(); 225 assert(seiToneMappingInfo->m_codedDataBitDepth >= 8 && seiToneMappingInfo->m_codedDataBitDepth <= 14); 226 seiToneMappingInfo->m_targetBitDepth = m_pcCfg->getTMISEITargetBitDepth(); 227 assert( (seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17) || (seiToneMappingInfo->m_targetBitDepth == 255) ); 228 seiToneMappingInfo->m_modelId = m_pcCfg->getTMISEIModelID(); 229 assert(seiToneMappingInfo->m_modelId >=0 &&seiToneMappingInfo->m_modelId<=4); 230 231 switch( seiToneMappingInfo->m_modelId) 232 { 233 case 0: 234 { 235 seiToneMappingInfo->m_minValue = m_pcCfg->getTMISEIMinValue(); 236 seiToneMappingInfo->m_maxValue = m_pcCfg->getTMISEIMaxValue(); 237 break; 238 } 239 case 1: 240 { 241 seiToneMappingInfo->m_sigmoidMidpoint = m_pcCfg->getTMISEISigmoidMidpoint(); 242 seiToneMappingInfo->m_sigmoidWidth = m_pcCfg->getTMISEISigmoidWidth(); 243 break; 244 } 245 case 2: 246 { 247 UInt num = 1u<<(seiToneMappingInfo->m_targetBitDepth); 248 seiToneMappingInfo->m_startOfCodedInterval.resize(num); 249 Int* ptmp = m_pcCfg->getTMISEIStartOfCodedInterva(); 250 if(ptmp) 251 { 252 for(int i=0; i<num;i++) 253 { 254 seiToneMappingInfo->m_startOfCodedInterval[i] = ptmp[i]; 255 } 256 } 257 break; 258 } 259 case 3: 260 { 261 seiToneMappingInfo->m_numPivots = m_pcCfg->getTMISEINumPivots(); 262 seiToneMappingInfo->m_codedPivotValue.resize(seiToneMappingInfo->m_numPivots); 263 seiToneMappingInfo->m_targetPivotValue.resize(seiToneMappingInfo->m_numPivots); 264 Int* ptmpcoded = m_pcCfg->getTMISEICodedPivotValue(); 265 Int* ptmptarget = m_pcCfg->getTMISEITargetPivotValue(); 266 if(ptmpcoded&&ptmptarget) 267 { 268 for(int i=0; i<(seiToneMappingInfo->m_numPivots);i++) 269 { 270 seiToneMappingInfo->m_codedPivotValue[i]=ptmpcoded[i]; 271 seiToneMappingInfo->m_targetPivotValue[i]=ptmptarget[i]; 272 } 273 } 274 break; 275 } 276 case 4: 277 { 278 seiToneMappingInfo->m_cameraIsoSpeedIdc = m_pcCfg->getTMISEICameraIsoSpeedIdc(); 279 seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue(); 280 assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 ); 281 seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag(); 282 seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator(); 283 seiToneMappingInfo->m_exposureCompensationValueDenomIdc = m_pcCfg->getTMISEIExposureCompensationValueDenomIdc(); 284 seiToneMappingInfo->m_refScreenLuminanceWhite = m_pcCfg->getTMISEIRefScreenLuminanceWhite(); 285 seiToneMappingInfo->m_extendedRangeWhiteLevel = m_pcCfg->getTMISEIExtendedRangeWhiteLevel(); 286 assert( seiToneMappingInfo->m_extendedRangeWhiteLevel >= 100 ); 287 seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue = m_pcCfg->getTMISEINominalBlackLevelLumaCodeValue(); 288 seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue = m_pcCfg->getTMISEINominalWhiteLevelLumaCodeValue(); 289 assert( seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue > seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue ); 290 seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue = m_pcCfg->getTMISEIExtendedWhiteLevelLumaCodeValue(); 291 assert( seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue >= seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue ); 292 break; 293 } 294 default: 295 { 296 assert(!"Undefined SEIToneMapModelId"); 297 break; 298 } 299 } 300 return seiToneMappingInfo; 301 } 302 #endif 213 303 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 214 304 { 215 OutputNALUnit nalu(NAL_UNIT_ SEI);305 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 216 306 217 307 if(m_pcCfg->getActiveParameterSetsSEIEnabled()) … … 234 324 SEIFramePacking *sei = xCreateSEIFramePacking (); 235 325 236 nalu = NALUnit(NAL_UNIT_ SEI);326 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 237 327 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 238 328 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 245 335 SEIDisplayOrientation *sei = xCreateSEIDisplayOrientation(); 246 336 247 nalu = NALUnit(NAL_UNIT_ SEI);337 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 248 338 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 249 339 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 252 342 delete sei; 253 343 } 344 #if J0149_TONE_MAPPING_SEI 345 if(m_pcCfg->getToneMappingInfoSEIEnabled()) 346 { 347 SEIToneMappingInfo *sei = xCreateSEIToneMappingInfo (); 348 349 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 350 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 351 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 352 writeRBSPTrailingBits(nalu.m_Bitstream); 353 accessUnit.push_back(new NALUnitEBSP(nalu)); 354 delete sei; 355 } 356 #endif 254 357 } 255 358 … … 257 360 // Public member functions 258 361 // ==================================================================================================================== 259 260 362 #if H_MV 261 363 Void TEncGOP::initGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP) … … 265 367 } 266 368 #endif 267 268 369 #if H_MV 269 370 Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid) … … 275 376 TComPicYuv* pcPicYuvRecOut; 276 377 TComSlice* pcSlice; 277 TComOutputBitstream* pcBitstreamRedirect = new TComOutputBitstream; 378 TComOutputBitstream *pcBitstreamRedirect; 379 pcBitstreamRedirect = new TComOutputBitstream; 278 380 AccessUnit::iterator itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted 279 381 UInt uiOneBitstreamPerSliceLength = 0; … … 286 388 m_iNumPicCoded = 0; 287 389 #endif 288 289 390 SEIPictureTiming pictureTimingSEI; 391 #if L0208_SOP_DESCRIPTION_SEI 392 Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled(); 393 #endif 394 #if K0180_SCALABLE_NESTING_SEI 395 // Initialize Scalable Nesting SEI with single layer values 396 SEIScalableNesting scalableNestingSEI; 397 scalableNestingSEI.m_bitStreamSubsetFlag = 1; // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1 398 scalableNestingSEI.m_nestingOpFlag = 0; 399 scalableNestingSEI.m_nestingNumOpsMinus1 = 0; //nesting_num_ops_minus1 400 scalableNestingSEI.m_allLayersFlag = 0; 401 scalableNestingSEI.m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1; //nesting_no_op_max_temporal_id_plus1 402 scalableNestingSEI.m_nestingNumLayersMinus1 = 1 - 1; //nesting_num_layers_minus1 403 scalableNestingSEI.m_nestingLayerId[0] = 0; 404 scalableNestingSEI.m_callerOwnsSEIs = true; 405 #endif 290 406 #if L0044_DU_DPB_OUTPUT_DELAY_HRD 291 407 Int picSptDpbOutputDuDelay = 0; … … 294 410 UInt *accumNalsDU = NULL; 295 411 SEIDecodingUnitInfo decodingUnitInfoSEI; 296 297 412 #if !H_MV 298 413 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 299 414 #endif 300 301 415 { 302 416 UInt uiColDir = 1; … … 357 471 if(pocCurr>=m_pcCfg->getFramesToBeEncoded()) 358 472 { 359 360 473 #if H_MV 361 474 delete pcBitstreamRedirect; … … 364 477 continue; 365 478 #endif 366 367 } 368 369 if( getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 479 } 480 481 if( getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 370 482 { 371 483 m_iLastIDR = pocCurr; … … 385 497 pcSlice->setLastIDR(m_iLastIDR); 386 498 pcSlice->setSliceIdx(0); 387 388 499 #if H_MV 389 pcPic ->setLayerId ( getLayerId() );390 pcPic ->setViewId ( getViewId() );500 pcPic ->setLayerId ( getLayerId() ); 501 pcPic ->setViewId ( getViewId() ); 391 502 pcSlice->setLayerId ( getLayerId() ); 392 pcSlice->setViewId ( getViewId() ); 503 pcSlice->setViewId ( getViewId() ); 393 504 pcSlice->setVPS ( m_pcEncTop->getVPS() ); 394 505 #if H_3D 506 pcPic ->setViewIndex ( getViewIndex() ); 395 507 pcPic ->setIsDepth( getIsDepth() ); 396 pcSlice->setIsDepth( getIsDepth() ); 397 #endif 398 #endif 399 508 pcSlice->setViewIndex ( getViewIndex() ); 509 pcSlice->setIsDepth( getIsDepth() ); 510 pcSlice->setCamparaSlice( pcPic->getCodedScale(), pcPic->getCodedOffset() ); 511 #endif 512 #endif 400 513 //set default slice level flag to the same as SPS level flag 401 514 pcSlice->setLFCrossSliceBoundaryFlag( pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() ); … … 437 550 #if H_MV 438 551 // Set the nal unit type 439 pcSlice->setNalUnitType(getNalUnitType(pocCurr ));552 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR)); 440 553 if( pcSlice->getSliceType() == B_SLICE ) 441 554 { … … 451 564 } 452 565 // Set the nal unit type 453 pcSlice->setNalUnitType(getNalUnitType(pocCurr ));454 #endif 455 if(pcSlice->get NalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)456 { 457 if(pcSlice->get TemporalLayerNonReferenceFlag())566 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR)); 567 #endif 568 if(pcSlice->getTemporalLayerNonReferenceFlag()) 569 { 570 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R) 458 571 { 459 572 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TRAIL_N); 573 } 574 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RADL_R) 575 { 576 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RADL_N); 577 } 578 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R) 579 { 580 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RASL_N); 460 581 } 461 582 } … … 482 603 else 483 604 { 484 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA );605 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R); 485 606 } 486 607 } … … 568 689 } 569 690 #endif 570 691 #if !L0034_COMBINED_LIST_CLEANUP 571 692 if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb()) 572 693 { … … 580 701 pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0)); 581 702 } 703 #endif 582 704 583 705 if (pcSlice->getSliceType() == B_SLICE) … … 605 727 pcSlice->setCheckLDC(bLowDelay); 606 728 } 729 else 730 { 731 pcSlice->setCheckLDC(true); 732 } 607 733 608 734 uiColDir = 1-uiColDir; … … 611 737 pcSlice->setRefPOCList(); 612 738 739 #if L0034_COMBINED_LIST_CLEANUP 740 pcSlice->setList1IdxToList0Idx(); 741 #else 613 742 pcSlice->setNoBackPredFlag( false ); 614 743 if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag()) … … 634 763 } 635 764 pcSlice->generateCombinedList(); 765 #endif 636 766 637 767 if (m_pcEncTop->getTMVPModeId() == 2) … … 658 788 pcSlice->setEnableTMVPFlag(0); 659 789 } 790 791 #if H_3D_VSO 792 // Should be moved to TEncTop !!! 793 Bool bUseVSO = m_pcEncTop->getUseVSO(); 794 795 TComRdCost* pcRdCost = m_pcEncTop->getRdCost(); 796 797 pcRdCost->setUseVSO( bUseVSO ); 798 799 // SAIT_VSO_EST_A0033 800 pcRdCost->setUseEstimatedVSD( m_pcEncTop->getUseEstimatedVSD() ); 801 802 if ( bUseVSO ) 803 { 804 Int iVSOMode = m_pcEncTop->getVSOMode(); 805 pcRdCost->setVSOMode( iVSOMode ); 806 pcRdCost->setAllowNegDist( m_pcEncTop->getAllowNegDist() ); 807 808 // SAIT_VSO_EST_A0033 809 pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false , pcSlice->getPOC(), true ) ); 810 pcRdCost->setDepthPicYuv ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), true , pcSlice->getPOC(), false ) ); 811 812 // LGE_WVSO_A0119 813 Bool bUseWVSO = m_pcEncTop->getUseWVSO(); 814 pcRdCost->setUseWVSO( bUseWVSO ); 815 816 } 817 #endif 660 818 /////////////////////////////////////////////////////////////////////////////////////////////////// Compress a slice 661 819 // Slice compression … … 939 1097 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 940 1098 m_pcLoopFilter->setCfg(bLFCrossTileBoundary); 1099 #if L0386_DB_METRIC 1100 if ( m_pcCfg->getDeblockingFilterMetric() ) 1101 { 1102 dblMetric(pcPic, uiNumSlices); 1103 } 1104 #endif 941 1105 m_pcLoopFilter->loopFilterPic( pcPic ); 942 1106 … … 1012 1176 pcSlice->getSPS()->getVuiParameters()->setHrdParametersPresentFlag( true ); 1013 1177 } 1178 #if !H_3D 1014 1179 m_pcEntropyCoder->encodeSPS(pcSlice->getSPS()); 1180 #else 1181 m_pcEntropyCoder->encodeSPS(pcSlice->getSPS(), pcSlice->getViewIndex(), pcSlice->getIsDepth() ); 1182 #endif 1015 1183 writeRBSPTrailingBits(nalu.m_Bitstream); 1016 1184 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 1037 1205 } 1038 1206 1207 #if L0208_SOP_DESCRIPTION_SEI 1208 if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP 1209 { 1210 Int SOPcurrPOC = pocCurr; 1211 1212 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1213 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1214 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 1215 1216 SEISOPDescription SOPDescriptionSEI; 1217 SOPDescriptionSEI.m_sopSeqParameterSetId = pcSlice->getSPS()->getSPSId(); 1218 1219 UInt i = 0; 1220 UInt prevEntryId = iGOPid; 1221 for (j = iGOPid; j < m_iGopSize; j++) 1222 { 1223 Int deltaPOC = m_pcCfg->getGOPEntry(j).m_POC - m_pcCfg->getGOPEntry(prevEntryId).m_POC; 1224 if ((SOPcurrPOC + deltaPOC) < m_pcCfg->getFramesToBeEncoded()) 1225 { 1226 SOPcurrPOC += deltaPOC; 1227 SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR); 1228 SOPDescriptionSEI.m_sopDescTemporalId[i] = m_pcCfg->getGOPEntry(j).m_temporalId; 1229 SOPDescriptionSEI.m_sopDescStRpsIdx[i] = m_pcEncTop->getReferencePictureSetIdxForSOP(pcSlice, SOPcurrPOC, j); 1230 SOPDescriptionSEI.m_sopDescPocDelta[i] = deltaPOC; 1231 1232 prevEntryId = j; 1233 i++; 1234 } 1235 } 1236 1237 SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1; 1238 1239 m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS()); 1240 writeRBSPTrailingBits(nalu.m_Bitstream); 1241 accessUnit.push_back(new NALUnitEBSP(nalu)); 1242 1243 writeSOP = false; 1244 } 1245 #endif 1246 1039 1247 if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && 1040 1248 ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) && … … 1082 1290 || ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) ) 1083 1291 { 1084 OutputNALUnit nalu(NAL_UNIT_ SEI);1292 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1085 1293 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1086 1294 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1123 1331 writeRBSPTrailingBits(nalu.m_Bitstream); 1124 1332 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1333 { 1125 1334 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1126 1335 UInt offsetPosition = m_activeParameterSetSEIPresentInAU; // Insert BP SEI after APS SEI … … 1132 1341 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1133 1342 m_bufferingPeriodSEIPresentInAU = true; 1343 } 1134 1344 #else 1135 1345 accessUnit.push_back(new NALUnitEBSP(nalu)); 1346 #endif 1347 1348 #if K0180_SCALABLE_NESTING_SEI 1349 if (m_pcCfg->getScalableNestingSEIEnabled()) 1350 { 1351 OutputNALUnit naluTmp(NAL_UNIT_PREFIX_SEI); 1352 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1353 m_pcEntropyCoder->setBitstream(&naluTmp.m_Bitstream); 1354 scalableNestingSEI.m_nestedSEIs.clear(); 1355 scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period); 1356 m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 1357 writeRBSPTrailingBits(naluTmp.m_Bitstream); 1358 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1359 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1360 UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU; // Insert BP SEI after non-nested APS, BP and PT SEIs 1361 AccessUnit::iterator it; 1362 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 1363 { 1364 it++; 1365 } 1366 accessUnit.insert(it, new NALUnitEBSP(naluTmp)); 1367 m_nestedBufferingPeriodSEIPresentInAU = true; 1368 #else 1369 accessUnit.push_back(new NALUnitEBSP(naluTmp)); 1370 #endif 1371 } 1136 1372 #endif 1137 1373 … … 1145 1381 { 1146 1382 // Gradual decoding refresh SEI 1147 OutputNALUnit nalu(NAL_UNIT_ SEI);1383 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1148 1384 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1149 1385 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1157 1393 } 1158 1394 // Recovery point SEI 1159 OutputNALUnit nalu(NAL_UNIT_ SEI);1395 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1160 1396 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1161 1397 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1348 1584 1349 1585 pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength ); 1350 if (!sliceSegment)1351 {1352 1586 pcSlice->setTileLocationCount ( 0 ); 1353 m_pcSliceEncoder->encodeSlice(pcPic, pcBitstreamRedirect, pcSubstreamsOut); // redirect is only used for CAVLC tile position info. 1354 } 1355 else 1356 { 1357 m_pcSliceEncoder->encodeSlice(pcPic, &nalu.m_Bitstream, pcSubstreamsOut); // nalu.m_Bitstream is only used for CAVLC tile position info. 1358 } 1587 m_pcSliceEncoder->encodeSlice(pcPic, pcSubstreamsOut); 1359 1588 1360 1589 { … … 1388 1617 if (ui+1 < pcSlice->getPPS()->getNumSubstreams()) 1389 1618 { 1390 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() ;1619 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3); 1391 1620 } 1392 1621 } … … 1420 1649 // If current NALU is the last NALU of slice and a NALU was buffered, then (a) Write current NALU (b) Update an write buffered NALU at approproate location in NALU list. 1421 1650 Bool bNALUAlignedWrittenToList = false; // used to ensure current NALU is not written more than once to the NALU list. 1422 x WriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice);1651 xAttachSliceDataToNalUnit(nalu, pcBitstreamRedirect); 1423 1652 accessUnit.push_back(new NALUnitEBSP(nalu)); 1424 1653 #if RATE_CONTROL_LAMBDA_DOMAIN … … 1448 1677 { 1449 1678 UInt numRBSPBytes_nal = UInt((*it)->m_nalUnitData.str().size()); 1450 if ((*it)->m_nalUnitType != NAL_UNIT_ SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)1679 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 1451 1680 { 1452 1681 numRBSPBytes += numRBSPBytes_nal; … … 1518 1747 pcPic->compressMotion(); 1519 1748 #endif 1520 1521 1749 #if H_MV 1522 1750 m_pocLastCoded = pcPic->getPOC(); … … 1549 1777 digestStr = digestToString(sei_recon_picture_digest.digest, 4); 1550 1778 } 1551 OutputNALUnit nalu(NAL_UNIT_S EI_SUFFIX, pcSlice->getTLayer());1779 OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer()); 1552 1780 1553 1781 /* write the SEI messages */ … … 1573 1801 sei_temporal_level0_index.rapIdx = m_rapIdx; 1574 1802 1575 OutputNALUnit nalu(NAL_UNIT_ SEI);1803 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1576 1804 1577 1805 /* write the SEI messages */ … … 1713 1941 if( m_pcCfg->getPictureTimingSEIEnabled() ) 1714 1942 { 1715 OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer()); 1943 { 1944 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1716 1945 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1717 1946 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS()); … … 1733 1962 #endif 1734 1963 } 1964 #if K0180_SCALABLE_NESTING_SEI 1965 if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI 1966 { 1967 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1968 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1969 scalableNestingSEI.m_nestedSEIs.clear(); 1970 scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI); 1971 m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 1972 writeRBSPTrailingBits(nalu.m_Bitstream); 1973 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1974 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1975 UInt offsetPosition = m_activeParameterSetSEIPresentInAU 1976 + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU + m_nestedBufferingPeriodSEIPresentInAU; // Insert PT SEI after APS and BP SEI 1977 AccessUnit::iterator it; 1978 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 1979 { 1980 it++; 1981 } 1982 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1983 m_nestedPictureTimingSEIPresentInAU = true; 1984 #else 1985 AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice)); 1986 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1987 #endif 1988 } 1989 #endif 1990 1991 } 1735 1992 if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() ) 1736 1993 { … … 1738 1995 for( Int i = 0; i < ( pictureTimingSEI.m_numDecodingUnitsMinus1 + 1 ); i ++ ) 1739 1996 { 1740 OutputNALUnit nalu(NAL_UNIT_ SEI, pcSlice->getTLayer());1997 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1741 1998 1742 1999 SEIDecodingUnitInfo tempSEI; … … 1786 2043 break; 1787 2044 } 1788 if ((*it)->m_nalUnitType != NAL_UNIT_ SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)2045 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 1789 2046 { 1790 2047 ctr++; … … 1797 2054 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1798 2055 xResetNonNestedSEIPresentFlags(); 2056 #if K0180_SCALABLE_NESTING_SEI 2057 xResetNestedSEIPresentFlags(); 2058 #endif 1799 2059 #endif 1800 2060 pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut); … … 1829 2089 assert ( m_iNumPicCoded == iNumPicRcvd ); 1830 2090 #endif 1831 1832 2091 } 1833 2092 … … 1869 2128 } 1870 2129 #endif 1871 2130 #if H_3D_VSO 2131 Void TEncGOP::preLoopFilterPicAll( TComPic* pcPic, Dist64& ruiDist, UInt64& ruiBits ) 2132 #else 1872 2133 Void TEncGOP::preLoopFilterPicAll( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ) 2134 #endif 1873 2135 { 1874 2136 TComSlice* pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); … … 1958 2220 } 1959 2221 2222 #if H_3D_VSO 2223 Dist64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1) 2224 #else 1960 2225 UInt64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1) 2226 #endif 1961 2227 { 1962 2228 Int x, y; … … 1970 2236 Int iHeight = pcPic0->getHeight(); 1971 2237 2238 #if H_3D_VSO 2239 Dist64 uiTotalDiff = 0; 2240 #else 1972 2241 UInt64 uiTotalDiff = 0; 2242 #endif 1973 2243 1974 2244 for( y = 0; y < iHeight; y++ ) … … 2023 2293 case NAL_UNIT_CODED_SLICE_TRAIL_R: return "TRAIL_R"; 2024 2294 case NAL_UNIT_CODED_SLICE_TRAIL_N: return "TRAIL_N"; 2025 case NAL_UNIT_CODED_SLICE_TLA : return "TLA";2295 case NAL_UNIT_CODED_SLICE_TLA_R: return "TLA_R"; 2026 2296 case NAL_UNIT_CODED_SLICE_TSA_N: return "TSA_N"; 2027 2297 case NAL_UNIT_CODED_SLICE_STSA_R: return "STSA_R"; 2028 2298 case NAL_UNIT_CODED_SLICE_STSA_N: return "STSA_N"; 2029 case NAL_UNIT_CODED_SLICE_BLA : return "BLA";2030 case NAL_UNIT_CODED_SLICE_BLA NT: return "BLANT";2299 case NAL_UNIT_CODED_SLICE_BLA_W_LP: return "BLA_W_LP"; 2300 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: return "BLA_W_RADL"; 2031 2301 case NAL_UNIT_CODED_SLICE_BLA_N_LP: return "BLA_N_LP"; 2032 case NAL_UNIT_CODED_SLICE_IDR : return "IDR";2302 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: return "IDR_W_RADL"; 2033 2303 case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP"; 2034 2304 case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; 2035 case NAL_UNIT_CODED_SLICE_ DLP: return "DLP";2036 case NAL_UNIT_CODED_SLICE_ TFD: return "TFD";2305 case NAL_UNIT_CODED_SLICE_RADL_R: return "RADL_R"; 2306 case NAL_UNIT_CODED_SLICE_RASL_R: return "RASL_R"; 2037 2307 case NAL_UNIT_VPS: return "VPS"; 2038 2308 case NAL_UNIT_SPS: return "SPS"; … … 2042 2312 case NAL_UNIT_EOB: return "EOB"; 2043 2313 case NAL_UNIT_FILLER_DATA: return "FILLER"; 2044 case NAL_UNIT_SEI: return "SEI"; 2314 case NAL_UNIT_PREFIX_SEI: return "SEI"; 2315 case NAL_UNIT_SUFFIX_SEI: return "SEI"; 2045 2316 default: return "UNK"; 2046 2317 } … … 2083 2354 } 2084 2355 2085 iHeight >>= 1; 2356 #if H_3D_VSO 2357 #if H_3D_VSO_SYNTH_DIST_OUT 2358 if ( m_pcRdCost->getUseRenModel() ) 2359 { 2360 unsigned int maxval = 255 * (1<<(g_uiBitDepth + g_uiBitIncrement -8)); 2361 Double fRefValueY = (double) maxval * maxval * iSize; 2362 Double fRefValueC = fRefValueY / 4.0; 2363 TRenModel* pcRenModel = m_pcEncTop->getEncTop()->getRenModel(); 2364 Int64 iDistVSOY, iDistVSOU, iDistVSOV; 2365 pcRenModel->getTotalSSE( iDistVSOY, iDistVSOU, iDistVSOV ); 2366 dYPSNR = ( iDistVSOY ? 10.0 * log10( fRefValueY / (Double) iDistVSOY ) : 99.99 ); 2367 dUPSNR = ( iDistVSOU ? 10.0 * log10( fRefValueC / (Double) iDistVSOU ) : 99.99 ); 2368 dVPSNR = ( iDistVSOV ? 10.0 * log10( fRefValueC / (Double) iDistVSOV ) : 99.99 ); 2369 } 2370 else 2371 { 2372 #endif 2373 #endif 2374 iHeight >>= 1; 2086 2375 iWidth >>= 1; 2087 2376 iStride >>= 1; … … 2121 2410 dUPSNR = ( uiSSDU ? 10.0 * log10( fRefValueC / (Double)uiSSDU ) : 99.99 ); 2122 2411 dVPSNR = ( uiSSDV ? 10.0 * log10( fRefValueC / (Double)uiSSDV ) : 99.99 ); 2123 2412 #if H_3D_VSO 2413 #if H_3D_VSO_SYNTH_DIST_OUT 2414 } 2415 #endif 2416 #endif 2124 2417 /* calculate the size of the access unit, excluding: 2125 2418 * - any AnnexB contributions (start_code_prefix, zero_byte, etc.,) … … 2133 2426 printf("*** %6s numBytesInNALunit: %u\n", nalUnitTypeToString((*it)->m_nalUnitType), numRBSPBytes_nal); 2134 2427 #endif 2135 if ((*it)->m_nalUnitType != NAL_UNIT_ SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)2428 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 2136 2429 { 2137 2430 numRBSPBytes += numRBSPBytes_nal; … … 2143 2436 2144 2437 //===== add PSNR ===== 2145 2146 2438 #if H_MV 2147 2439 m_pcEncTop->getAnalyzeAll()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2149 2441 m_gcAnalyzeAll.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2150 2442 #endif 2151 2152 2443 TComSlice* pcSlice = pcPic->getSlice(0); 2153 2444 if (pcSlice->isIntra()) 2154 2445 { 2155 2156 2446 #if H_MV 2157 2447 m_pcEncTop->getAnalyzeI()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2159 2449 m_gcAnalyzeI.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2160 2450 #endif 2161 2162 2451 } 2163 2452 if (pcSlice->isInterP()) 2164 2453 { 2165 2166 2454 #if H_MV 2167 2455 m_pcEncTop->getAnalyzeP()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2169 2457 m_gcAnalyzeP.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2170 2458 #endif 2171 2172 2459 } 2173 2460 if (pcSlice->isInterB()) 2174 2461 { 2175 2176 2462 #if H_MV 2177 2463 m_pcEncTop->getAnalyzeB()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2179 2465 m_gcAnalyzeB.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2180 2466 #endif 2181 2182 2467 } 2183 2468 … … 2186 2471 2187 2472 #if ADAPTIVE_QP_SELECTION 2188 2189 2473 #if H_MV 2190 2474 printf("Layer %3d POC %4d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits", … … 2205 2489 uibits ); 2206 2490 #endif 2207 2208 #else 2209 2491 #else 2210 2492 #if H_MV 2211 2493 printf("Layer %3d POC %4d TId: %1d ( %c-SLICE, QP %d ) %10d bits", … … 2224 2506 uibits ); 2225 2507 #endif 2226 2227 2508 #endif 2228 2509 … … 2257 2538 * This function checks the configuration and returns the appropriate nal_unit_type for the picture. 2258 2539 */ 2259 NalUnitType TEncGOP::getNalUnitType(Int pocCurr )2540 NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR) 2260 2541 { 2261 2542 if (pocCurr == 0) 2262 2543 { 2263 return NAL_UNIT_CODED_SLICE_IDR ;2544 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 2264 2545 } 2265 2546 if (pocCurr % m_pcCfg->getIntraPeriod() == 0) … … 2271 2552 else if (m_pcCfg->getDecodingRefreshType() == 2) 2272 2553 { 2273 return NAL_UNIT_CODED_SLICE_IDR ;2554 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 2274 2555 } 2275 2556 } … … 2283 2564 // controlling the reference pictures used for encoding that leading picture. Such a leading 2284 2565 // picture need not be marked as a TFD picture. 2285 return NAL_UNIT_CODED_SLICE_TFD; 2566 return NAL_UNIT_CODED_SLICE_RASL_R; 2567 } 2568 } 2569 if (lastIDR>0) 2570 { 2571 if (pocCurr < lastIDR) 2572 { 2573 return NAL_UNIT_CODED_SLICE_RADL_R; 2286 2574 } 2287 2575 } … … 2334 2622 } 2335 2623 2336 /** Determine the difference between consecutive tile sizes (in bytes) and writes it to bistream rNalu [slice header] 2337 * \param rpcBitstreamRedirect contains the bitstream to be concatenated to rNalu. rpcBitstreamRedirect contains slice payload. rpcSlice contains tile location information. 2338 * \returns Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call. 2624 /** Attaches the input bitstream to the stream in the output NAL unit 2625 Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call. 2626 * \param codedSliceData contains the coded slice data (bitstream) to be concatenated to rNalu 2627 * \param rNalu target NAL unit 2339 2628 */ 2340 Void TEncGOP::x WriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice)2629 Void TEncGOP::xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& codedSliceData) 2341 2630 { 2342 2631 // Byte-align … … 2344 2633 2345 2634 // Perform bitstream concatenation 2346 if (rpcBitstreamRedirect->getNumberOfWrittenBits() > 0) 2347 { 2348 UInt uiBitCount = rpcBitstreamRedirect->getNumberOfWrittenBits(); 2349 if (rpcBitstreamRedirect->getByteStreamLength()>0) 2350 { 2351 UChar *pucStart = reinterpret_cast<UChar*>(rpcBitstreamRedirect->getByteStream()); 2352 UInt uiWriteByteCount = 0; 2353 while (uiWriteByteCount < (uiBitCount >> 3) ) 2354 { 2355 UInt uiBits = (*pucStart); 2356 rNalu.m_Bitstream.write(uiBits, 8); 2357 pucStart++; 2358 uiWriteByteCount++; 2359 } 2360 } 2361 UInt uiBitsHeld = (uiBitCount & 0x07); 2362 for (UInt uiIdx=0; uiIdx < uiBitsHeld; uiIdx++) 2363 { 2364 rNalu.m_Bitstream.write((rpcBitstreamRedirect->getHeldBits() & (1 << (7-uiIdx))) >> (7-uiIdx), 1); 2365 } 2635 if (codedSliceData->getNumberOfWrittenBits() > 0) 2636 { 2637 rNalu.m_Bitstream.addSubstream(codedSliceData); 2366 2638 } 2367 2639 2368 2640 m_pcEntropyCoder->setBitstream(&rNalu.m_Bitstream); 2369 2641 2370 delete rpcBitstreamRedirect; 2371 rpcBitstreamRedirect = new TComOutputBitstream; 2642 codedSliceData->clear(); 2372 2643 } 2373 2644 … … 2494 2765 } 2495 2766 } 2496 assert(it != accessUnit.end()); 2767 // assert(it != accessUnit.end()); // Triggers with some legit configurations 2497 2768 return seiStartPos; 2498 2769 } 2499 2770 #endif 2500 2771 2772 #if L0386_DB_METRIC 2773 Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices ) 2774 { 2775 TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec(); 2776 Pel* Rec = pcPicYuvRec->getLumaAddr( 0 ); 2777 Pel* tempRec = Rec; 2778 Int stride = pcPicYuvRec->getStride(); 2779 UInt log2maxTB = pcPic->getSlice(0)->getSPS()->getQuadtreeTULog2MaxSize(); 2780 UInt maxTBsize = (1<<log2maxTB); 2781 const UInt minBlockArtSize = 8; 2782 const UInt picWidth = pcPicYuvRec->getWidth(); 2783 const UInt picHeight = pcPicYuvRec->getHeight(); 2784 const UInt noCol = (picWidth>>log2maxTB); 2785 const UInt noRows = (picHeight>>log2maxTB); 2786 UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64)); 2787 UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64)); 2788 UInt colIdx = 0; 2789 UInt rowIdx = 0; 2790 Pel p0, p1, p2, q0, q1, q2; 2791 2792 Int qp = pcPic->getSlice(0)->getSliceQp(); 2793 Int bitdepthScale = 1 << (g_bitDepthY-8); 2794 Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale; 2795 const Int thr2 = (beta>>2); 2796 const Int thr1 = 2*bitdepthScale; 2797 UInt a = 0; 2798 2799 memset(colSAD, 0, noCol*sizeof(UInt64)); 2800 memset(rowSAD, 0, noRows*sizeof(UInt64)); 2801 2802 if (maxTBsize > minBlockArtSize) 2803 { 2804 // Analyze vertical artifact edges 2805 for(Int c = maxTBsize; c < picWidth; c += maxTBsize) 2806 { 2807 for(Int r = 0; r < picHeight; r++) 2808 { 2809 p2 = Rec[c-3]; 2810 p1 = Rec[c-2]; 2811 p0 = Rec[c-1]; 2812 q0 = Rec[c]; 2813 q1 = Rec[c+1]; 2814 q2 = Rec[c+2]; 2815 a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1); 2816 if ( thr1 < a && a < thr2) 2817 { 2818 colSAD[colIdx] += abs(p0 - q0); 2819 } 2820 Rec += stride; 2821 } 2822 colIdx++; 2823 Rec = tempRec; 2824 } 2825 2826 // Analyze horizontal artifact edges 2827 for(Int r = maxTBsize; r < picHeight; r += maxTBsize) 2828 { 2829 for(Int c = 0; c < picWidth; c++) 2830 { 2831 p2 = Rec[c + (r-3)*stride]; 2832 p1 = Rec[c + (r-2)*stride]; 2833 p0 = Rec[c + (r-1)*stride]; 2834 q0 = Rec[c + r*stride]; 2835 q1 = Rec[c + (r+1)*stride]; 2836 q2 = Rec[c + (r+2)*stride]; 2837 a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1); 2838 if (thr1 < a && a < thr2) 2839 { 2840 rowSAD[rowIdx] += abs(p0 - q0); 2841 } 2842 } 2843 rowIdx++; 2844 } 2845 } 2846 2847 UInt64 colSADsum = 0; 2848 UInt64 rowSADsum = 0; 2849 for(Int c = 0; c < noCol-1; c++) 2850 { 2851 colSADsum += colSAD[c]; 2852 } 2853 for(Int r = 0; r < noRows-1; r++) 2854 { 2855 rowSADsum += rowSAD[r]; 2856 } 2857 2858 colSADsum <<= 10; 2859 rowSADsum <<= 10; 2860 colSADsum /= (noCol-1); 2861 colSADsum /= picHeight; 2862 rowSADsum /= (noRows-1); 2863 rowSADsum /= picWidth; 2864 2865 UInt64 avgSAD = ((colSADsum + rowSADsum)>>1); 2866 avgSAD >>= (g_bitDepthY-8); 2867 2868 if ( avgSAD > 2048 ) 2869 { 2870 avgSAD >>= 9; 2871 Int offset = Clip3(2,6,(Int)avgSAD); 2872 for (Int i=0; i<uiNumSlices; i++) 2873 { 2874 pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true); 2875 pcPic->getSlice(i)->setDeblockingFilterDisable(false); 2876 pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( offset ); 2877 pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( offset ); 2878 } 2879 } 2880 else 2881 { 2882 for (Int i=0; i<uiNumSlices; i++) 2883 { 2884 pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(false); 2885 pcPic->getSlice(i)->setDeblockingFilterDisable( pcPic->getSlice(i)->getPPS()->getPicDisableDeblockingFilterFlag() ); 2886 pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); 2887 pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterTcOffsetDiv2() ); 2888 } 2889 } 2890 2891 free(colSAD); 2892 free(rowSAD); 2893 } 2894 #endif 2501 2895 #if H_MV 2502 2896 Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid ) … … 2529 2923 2530 2924 // set inter-view modifications 2531 if( (maxRefListSize > 1) && (numModifications > 0) ) 2532 { 2533 refPicListModification->setRefPicListModificationFlagL( li, true ); 2925 Bool isModified = false; 2534 2926 Int tempList[16]; 2535 2927 for( Int k = 0; k < 16; k++ ) { tempList[k] = -1; } 2536 2928 2537 Bool isModified = false; 2929 if( (maxRefListSize > 1) && (numModifications > 0) ) 2930 { 2538 2931 for( Int k = 0; k < ge.m_numInterViewRefPics; k++ ) 2539 2932 { … … 2554 2947 } 2555 2948 } 2949 } 2950 2951 refPicListModification->setRefPicListModificationFlagL( li, isModified ); 2952 2556 2953 if( isModified ) 2557 2954 { … … 2570 2967 } 2571 2968 } 2572 else2573 {2574 refPicListModification->setRefPicListModificationFlagL( li, false );2575 }2576 }2577 2969 } 2578 2970 } 2579 2971 #endif 2580 2581 2972 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncGOP.h
r438 r446 105 105 Int m_viewId; 106 106 #if H_3D 107 Int m_viewIndex; 107 108 Bool m_isDepth; 108 109 #endif 109 110 #endif 110 111 111 //--Adaptive Loop filter 112 112 TEncSampleAdaptiveOffset* m_pcSAO; … … 132 132 Bool m_bufferingPeriodSEIPresentInAU; 133 133 Bool m_pictureTimingSEIPresentInAU; 134 #if K0180_SCALABLE_NESTING_SEI 135 Bool m_nestedBufferingPeriodSEIPresentInAU; 136 Bool m_nestedPictureTimingSEIPresentInAU; 137 #endif 134 138 #endif 135 139 public: … … 141 145 142 146 Void init ( TEncTop* pcTEncTop ); 143 144 147 #if H_MV 145 148 Void initGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP); … … 148 151 Void compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP ); 149 152 #endif 150 151 Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice); 153 Void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect); 152 154 153 155 #if H_MV … … 156 158 Int getViewId () { return m_viewId; } 157 159 #if H_3D 160 Int getViewIndex () { return m_viewIndex; } 158 161 Bool getIsDepth () { return m_isDepth; } 159 162 #endif … … 167 170 Void printOutSummary ( UInt uiNumAllPicCoded ); 168 171 #endif 169 172 #if H_3D_VSO 173 Void preLoopFilterPicAll ( TComPic* pcPic, Dist64& ruiDist, UInt64& ruiBits ); 174 #else 170 175 Void preLoopFilterPicAll ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ); 176 #endif 171 177 172 178 TEncSlice* getSliceEncoder() { return m_pcSliceEncoder; } 173 NalUnitType getNalUnitType( Int pocCurr );179 NalUnitType getNalUnitType( Int pocCurr, Int lastIdr ); 174 180 Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& ); 175 181 protected: … … 181 187 182 188 Void xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime ); 183 189 #if H_3D_VSO 190 Dist64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1); 191 #else 184 192 UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1); 193 #endif 185 194 186 195 Double xCalculateRVM(); … … 189 198 SEIFramePacking* xCreateSEIFramePacking(); 190 199 SEIDisplayOrientation* xCreateSEIDisplayOrientation(); 200 201 #if J0149_TONE_MAPPING_SEI 202 SEIToneMappingInfo* xCreateSEIToneMappingInfo(); 203 #endif 191 204 192 205 Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps); … … 199 212 m_pictureTimingSEIPresentInAU = false; 200 213 } 201 #endif 202 214 #if K0180_SCALABLE_NESTING_SEI 215 Void xResetNestedSEIPresentFlags() 216 { 217 m_nestedBufferingPeriodSEIPresentInAU = false; 218 m_nestedPictureTimingSEIPresentInAU = false; 219 } 220 #endif 221 #endif 203 222 #if H_MV 204 223 Void xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid ); 205 224 #endif 206 225 #if L0386_DB_METRIC 226 Void dblMetric( TComPic* pcPic, UInt uiNumSlices ); 227 #endif 207 228 };// END CLASS DEFINITION TEncGOP 208 229 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r438 r446 1677 1677 #endif 1678 1678 { 1679 #if SAO_CHROMA_LAMBDA1680 m_dLambdaLuma = dLambdaLuma;1681 m_dLambdaChroma = dLambdaChroma;1682 #else1683 m_dLambdaLuma = dLambda;1684 m_dLambdaChroma = dLambda;1685 #endif1686 1687 1679 if(m_bUseNIF) 1688 1680 { -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r438 r446 57 57 { 58 58 private: 59 Double m_dLambdaLuma;60 Double m_dLambdaChroma;61 62 59 TEncEntropy* m_pcEntropyCoder; 63 60 TEncSbac*** m_pppcRDSbacCoder; ///< for CABAC -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSbac.cpp
r324 r446 246 246 } 247 247 248 #if H_3D 249 Void TEncSbac::codeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) 250 #else 248 251 Void TEncSbac::codeSPS( TComSPS* pcSPS ) 252 #endif 249 253 { 250 254 assert (0); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSbac.h
r438 r446 91 91 92 92 Void codeVPS ( TComVPS* pcVPS ); 93 #if !H_3D 93 94 Void codeSPS ( TComSPS* pcSPS ); 95 #else 96 Void codeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ); 97 #endif 94 98 Void codePPS ( TComPPS* pcPPS ); 95 99 Void codeSliceHeader ( TComSlice* pcSlice ); … … 109 113 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount ); 110 114 Void xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam ); 111 Void xWriteTerminatingBit ( UInt uiBit );112 115 113 116 Void xCopyFrom ( TEncSbac* pSrc ); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r438 r446 1008 1008 TComYuv* pcPredYuv, 1009 1009 TComYuv* pcResiYuv, 1010 #if H_3D_VSO 1011 Dist& ruiDist, 1012 #else 1010 1013 UInt& ruiDist, 1014 #endif 1011 1015 Int default0Save1Load2 ) 1012 1016 { … … 1159 1163 1160 1164 //===== update distortion ===== 1165 #if H_3D_VSO // M39 1166 if ( m_pcRdCost->getUseVSO() ) 1167 ruiDist += m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false ); 1168 else 1169 #endif 1161 1170 ruiDist += m_pcRdCost->getDistPart(g_bitDepthY, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 1162 1171 } … … 1371 1380 TComYuv* pcPredYuv, 1372 1381 TComYuv* pcResiYuv, 1382 #if H_3D_VSO 1383 Dist& ruiDistY, 1384 #else 1373 1385 UInt& ruiDistY, 1386 #endif 1374 1387 UInt& ruiDistC, 1375 1388 #if HHI_RQT_INTRA_SPEEDUP … … 1419 1432 #endif 1420 1433 Double dSingleCost = MAX_DOUBLE; 1434 #if H_3D_VSO 1435 Dist uiSingleDistY = 0; 1436 #else 1421 1437 UInt uiSingleDistY = 0; 1438 #endif 1422 1439 UInt uiSingleDistC = 0; 1423 1440 UInt uiSingleCbfY = 0; … … 1445 1462 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] ); 1446 1463 } 1464 #if H_3D_VSO 1465 Dist singleDistYTmp = 0; 1466 #else 1447 1467 UInt singleDistYTmp = 0; 1468 #endif 1448 1469 UInt singleDistCTmp = 0; 1449 1470 UInt singleCbfYTmp = 0; … … 1495 1516 { 1496 1517 UInt uiSingleBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false ); 1518 #if H_3D_VSO // M NEW 1519 if ( m_pcRdCost->getUseRenModel() ) 1520 singleCostTmp = m_pcRdCost->calcRdCostVSO( uiSingleBits, singleDistYTmp + singleDistCTmp ); 1521 else 1522 #endif 1497 1523 singleCostTmp = m_pcRdCost->calcRdCost( uiSingleBits, singleDistYTmp + singleDistCTmp ); 1498 1524 } … … 1597 1623 } 1598 1624 #endif 1625 #if H_3D_VSO // M40 1626 if ( m_pcRdCost->getUseLambdaScaleVSO()) 1627 dSingleCost = m_pcRdCost->calcRdCostVSO( uiSingleBits, uiSingleDistY + uiSingleDistC ); 1628 else 1629 #endif 1599 1630 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistY + uiSingleDistC ); 1600 1631 } … … 1618 1649 //----- code splitted block ----- 1619 1650 Double dSplitCost = 0.0; 1651 #if H_3D_VSO 1652 Dist uiSplitDistY = 0; 1653 #else 1620 1654 UInt uiSplitDistY = 0; 1655 #endif 1621 1656 UInt uiSplitDistC = 0; 1622 1657 UInt uiQPartsDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); … … 1662 1697 //----- determine rate and r-d cost ----- 1663 1698 UInt uiSplitBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false ); 1699 #if H_3D_VSO // M41 1700 if( m_pcRdCost->getUseLambdaScaleVSO() ) 1701 dSplitCost = m_pcRdCost->calcRdCostVSO( uiSplitBits, uiSplitDistY + uiSplitDistC ); 1702 else 1703 #endif 1664 1704 dSplitCost = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDistY + uiSplitDistC ); 1665 1705 … … 1733 1773 } 1734 1774 } 1775 1776 #if H_3D_VSO // M42 1777 if ( m_pcRdCost->getUseRenModel() && bCheckFull ) 1778 { 1779 UInt uiWidth = pcCU->getWidth ( 0 ) >> uiTrDepth; 1780 UInt uiHeight = pcCU->getHeight( 0 ) >> uiTrDepth; 1781 UInt uiQTLayer = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize; 1782 Pel* piSrc = m_pcQTTempTComYuv[ uiQTLayer ].getLumaAddr( uiAbsPartIdx ); 1783 UInt uiSrcStride = m_pcQTTempTComYuv[ uiQTLayer ].getStride (); 1784 1785 m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight ); 1786 } 1787 #endif 1788 1735 1789 ruiDistY += uiSingleDistY; 1736 1790 ruiDistC += uiSingleDistC; … … 2443 2497 UInt uiQNumParts = pcCU->getTotalNumPart() >> 2; 2444 2498 UInt uiWidthBit = pcCU->getIntraSizeIdx(0); 2499 #if H_3D_VSO 2500 Dist uiOverallDistY = 0; 2501 #else 2445 2502 UInt uiOverallDistY = 0; 2503 #endif 2446 2504 UInt uiOverallDistC = 0; 2447 2505 UInt CandNum; … … 2492 2550 2493 2551 predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 2494 2552 #if H_3D_VSO // M34 2553 Dist uiSad; 2554 if ( m_pcRdCost->getUseVSO() ) 2555 { 2556 if ( m_pcRdCost->getUseEstimatedVSD() ) 2557 { 2558 uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) ); 2559 } 2560 else 2561 { 2562 uiSad = m_pcRdCost->getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ); 2563 } 2564 } 2565 else 2566 { 2567 uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 2568 } 2569 #else 2495 2570 // use hadamard transform here 2496 2571 UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 2572 #endif 2497 2573 2498 2574 UInt iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth ); 2575 2576 2577 #if H_3D_VSO // M35 2578 Double dLambda; 2579 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 2580 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO(); 2581 else 2582 dLambda = m_pcRdCost->getSqrtLambda(); 2583 2499 2584 Double cost = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda(); 2585 #else 2586 Double cost = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda(); 2587 #endif 2500 2588 2501 2589 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList ); … … 2543 2631 2544 2632 UInt uiBestPUMode = 0; 2633 #if H_3D_VSO 2634 Dist uiBestPUDistY = 0; 2635 #else 2545 2636 UInt uiBestPUDistY = 0; 2637 #endif 2546 2638 UInt uiBestPUDistC = 0; 2547 2639 Double dBestPUCost = MAX_DOUBLE; … … 2560 2652 2561 2653 // determine residual for partition 2654 #if H_3D_VSO 2655 Dist uiPUDistY = 0; 2656 #else 2562 2657 UInt uiPUDistY = 0; 2658 #endif 2563 2659 UInt uiPUDistC = 0; 2564 2660 Double dPUCost = 0.0; 2661 #if H_3D_VSO // M36 2662 if( m_pcRdCost->getUseRenModel() ) 2663 { 2664 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ); 2665 } 2666 #endif 2565 2667 #if HHI_RQT_INTRA_SPEEDUP 2566 2668 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost ); … … 2625 2727 2626 2728 // determine residual for partition 2729 #if H_3D_VSO 2730 Dist uiPUDistY = 0; 2731 #else 2627 2732 UInt uiPUDistY = 0; 2733 #endif 2628 2734 UInt uiPUDistC = 0; 2629 2735 Double dPUCost = 0.0; 2736 2737 #if H_3D_VSO // M37 2738 // reset Model 2739 if( m_pcRdCost->getUseRenModel() ) 2740 { 2741 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ); 2742 } 2743 #endif 2630 2744 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost ); 2631 2745 … … 2692 2806 } 2693 2807 } 2808 #if H_3D_VSO // M38 2809 // set model 2810 if( m_pcRdCost->getUseRenModel() ) 2811 { 2812 piSrc = pcRecoYuv->getLumaAddr( uiPartOffset ); 2813 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piSrc, uiSrcStride, uiCompWidth, uiCompHeight); 2814 } 2815 #endif 2694 2816 if( !bLumaOnly && !bSkipChroma ) 2695 2817 { … … 2982 3104 uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 2983 3105 3106 #if H_3D_VSO // M43 3107 if( m_pcRdCost->getUseLambdaScaleVSO() ) 3108 dCost = m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion ); 3109 else 3110 #endif 2984 3111 dCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); 2985 3112 … … 3209 3336 UInt uiBitsTempL0[MAX_NUM_REF]; 3210 3337 3338 #if L0034_COMBINED_LIST_CLEANUP 3339 TComMv mvValidList1; 3340 Int refIdxValidList1 = 0; 3341 UInt bitsValidList1 = MAX_UINT; 3342 UInt costValidList1 = MAX_UINT; 3343 #endif 3344 3211 3345 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 3212 3346 … … 3255 3389 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 3256 3390 #if ZERO_MVD_EST 3391 #if L0034_COMBINED_LIST_CLEANUP 3392 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3393 #else 3257 3394 if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) && 3258 3395 (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0)) 3396 #endif 3259 3397 { 3260 3398 uiZeroMvdBitsTemp = uiBitsTemp; … … 3276 3414 3277 3415 #if GPB_SIMPLE_UNI 3416 #if L0034_COMBINED_LIST_CLEANUP 3417 if ( iRefList == 1 ) // list 1 3418 { 3419 if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 ) 3420 { 3421 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 3422 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 3423 /*first subtract the bit-rate part of the cost of the other list*/ 3424 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] ); 3425 /*correct the bit-rate part of the current ref*/ 3426 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 3427 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 3428 /*calculate the correct cost*/ 3429 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); 3430 } 3431 else 3432 { 3433 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3434 } 3435 } 3436 else 3437 { 3438 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3439 } 3440 #else 3278 3441 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) 3279 3442 { … … 3317 3480 } 3318 3481 } 3482 #endif 3319 3483 #else 3320 3484 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); … … 3323 3487 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 3324 3488 3489 #if L0034_COMBINED_LIST_CLEANUP 3490 if ( iRefList == 0 ) 3491 { 3492 uiCostTempL0[iRefIdxTemp] = uiCostTemp; 3493 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; 3494 } 3495 if ( uiCostTemp < uiCost[iRefList] ) 3496 { 3497 uiCost[iRefList] = uiCostTemp; 3498 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction 3499 3500 // set motion 3501 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 3502 iRefIdx[iRefList] = iRefIdxTemp; 3503 } 3504 3505 if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3506 { 3507 costValidList1 = uiCostTemp; 3508 bitsValidList1 = uiBitsTemp; 3509 3510 // set motion 3511 mvValidList1 = cMvTemp[iRefList][iRefIdxTemp]; 3512 refIdxValidList1 = iRefIdxTemp; 3513 } 3514 #else 3325 3515 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag()) 3326 3516 { … … 3372 3562 } 3373 3563 } 3564 #endif 3374 3565 } 3375 3566 } … … 3435 3626 3436 3627 Int iRefList = iIter % 2; 3628 #if L0034_COMBINED_LIST_CLEANUP 3629 if ( m_pcEncCfg->getUseFastEnc() ) 3630 { 3631 if( uiCost[0] <= uiCost[1] ) 3632 { 3633 iRefList = 1; 3634 } 3635 else 3636 { 3637 iRefList = 0; 3638 } 3639 } 3640 else if ( iIter == 0 ) 3641 { 3642 iRefList = 0; 3643 } 3644 if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag()) 3645 { 3646 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 3647 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 3648 TComYuv* pcYuvPred = &m_acYuvPred[1-iRefList]; 3649 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 3650 } 3651 #else 3437 3652 if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) ) 3438 3653 { 3439 3654 iRefList = 1; 3440 3655 } 3656 #endif 3441 3657 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3442 3658 … … 3573 3789 UInt uiMEBits = 0; 3574 3790 // Set Motion Field_ 3791 #if L0034_COMBINED_LIST_CLEANUP 3792 cMv[1] = mvValidList1; 3793 iRefIdx[1] = refIdxValidList1; 3794 uiBits[1] = bitsValidList1; 3795 uiCost[1] = costValidList1; 3796 #else 3575 3797 if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) ) 3576 3798 { 3577 3799 uiCost[1] = MAX_UINT; 3578 3800 } 3801 #endif 3579 3802 #if AMP_MRG 3580 3803 if (bTestNormalMC) … … 4464 4687 Bool bHighPass = pcCU->getSlice()->getDepth() ? true : false; 4465 4688 UInt uiBits = 0, uiBitsBest = 0; 4689 #if H_3D_VSO 4690 Dist uiDistortion = 0, uiDistortionBest = 0; 4691 #else 4466 4692 UInt uiDistortion = 0, uiDistortionBest = 0; 4693 #endif 4467 4694 4468 4695 UInt uiWidth = pcCU->getWidth ( 0 ); … … 4477 4704 4478 4705 pcYuvPred->copyToPartYuv( rpcYuvRec, 0 ); 4479 4706 4707 #if H_3D_VSO // M13 4708 if ( m_pcRdCost->getUseVSO() ) 4709 { 4710 uiDistortion = m_pcRdCost->getDistPartVSO( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight , false ); 4711 } 4712 else 4713 { 4714 #endif 4480 4715 #if WEIGHTED_CHROMA_DISTORTION 4481 4716 uiDistortion = m_pcRdCost->getDistPart(g_bitDepthY, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight ) … … 4488 4723 #endif 4489 4724 4725 #if H_3D_VSO // MIgnore 4726 } 4727 #endif 4728 4490 4729 if( m_bUseSBACRD ) 4491 4730 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST]); … … 4502 4741 pcCU->getTotalBits() = uiBits; 4503 4742 pcCU->getTotalDistortion() = uiDistortion; 4504 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); 4505 4743 #if H_3D_VSO //M 14 4744 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 4745 pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion ); 4746 else 4747 #endif 4748 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); 4749 4506 4750 if( m_bUseSBACRD ) 4507 4751 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_TEMP_BEST]); … … 4509 4753 pcCU->setCbfSubParts( 0, 0, 0, 0, pcCU->getDepth( 0 ) ); 4510 4754 pcCU->setTrIdxSubParts( 0, 0, pcCU->getDepth(0) ); 4511 4755 4756 #if H_3D_VSO // necessary? // M15 4757 // set Model 4758 if( !m_pcRdCost->getUseEstimatedVSD()&& m_pcRdCost->getUseRenModel() ) 4759 { 4760 Pel* piSrc = rpcYuvRec->getLumaAddr(); 4761 UInt uiSrcStride = rpcYuvRec->getStride(); 4762 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 4763 } 4764 #endif 4765 4512 4766 return; 4513 4767 } … … 4522 4776 while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++; 4523 4777 } 4524 UInt uiMaxTrMode = pcCU->getSlice()->getSPS()->getMaxTrDepth()+ uiTrLevel;4778 UInt uiMaxTrMode = 1 + uiTrLevel; 4525 4779 4526 4780 while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--; … … 4539 4793 { 4540 4794 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_CURR_BEST ] ); 4541 } 4542 4795 } 4796 4797 #if H_3D_VSO // M16 // M18 4798 Dist uiZeroDistortion = 0; 4799 if ( m_pcRdCost->getUseVSO() ) // This creating and destroying need to be fixed. 4800 { 4801 m_cYuvRecTemp.create( pcYuvPred->getWidth(), pcYuvPred->getHeight() ); 4802 } 4803 4804 xEstimateResidualQT( pcCU, 0, 0, 0, pcYuvOrg, pcYuvPred, rpcYuvResi, pcCU->getDepth(0), dCost, uiBits, uiDistortion, &uiZeroDistortion ); 4805 4806 if ( m_pcRdCost->getUseVSO() ) 4807 { 4808 m_cYuvRecTemp.destroy(); 4809 } 4810 #else 4543 4811 UInt uiZeroDistortion = 0; 4544 4812 xEstimateResidualQT( pcCU, 0, 0, 0, rpcYuvResi, pcCU->getDepth(0), dCost, uiBits, uiDistortion, &uiZeroDistortion ); 4813 #endif 4545 4814 4546 4815 m_pcEntropyCoder->resetBits(); 4547 4816 m_pcEntropyCoder->encodeQtRootCbfZero( pcCU ); 4548 4817 UInt zeroResiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 4818 4819 #if H_3D_VSO // M19 4820 Double dZeroCost; 4821 if( m_pcRdCost->getUseLambdaScaleVSO() ) 4822 dZeroCost = m_pcRdCost->calcRdCostVSO( 0, uiZeroDistortion ); 4823 else 4824 dZeroCost = m_pcRdCost->calcRdCost( zeroResiBits, uiZeroDistortion ); 4825 #else 4549 4826 Double dZeroCost = m_pcRdCost->calcRdCost( zeroResiBits, uiZeroDistortion ); 4827 #endif 4550 4828 if(pcCU->isLosslessCoded( 0 )) 4551 4829 { … … 4596 4874 } 4597 4875 4598 4876 #if H_3D_VSO // M20 4877 Double dExactCost; 4878 if( m_pcRdCost->getUseLambdaScaleVSO() ) 4879 dExactCost = m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion ); 4880 else 4881 dExactCost = m_pcRdCost->calcRdCost ( uiBits, uiDistortion ); 4882 #else 4599 4883 Double dExactCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); 4884 #endif 4600 4885 dCost = dExactCost; 4601 4886 … … 4639 4924 } 4640 4925 } 4926 #if H_3D_VSO // M21 4927 if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() ) 4928 { 4929 Pel* piSrc = pcYuvOrg->getLumaAddr(); 4930 UInt uiSrcStride = pcYuvOrg->getStride(); 4931 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 4932 } 4933 #endif 4641 4934 } 4642 4935 … … 4669 4962 } 4670 4963 rpcYuvRec->addClip ( pcYuvPred, rpcYuvResiBest, 0, uiWidth ); 4671 4964 4965 #if H_3D_VSO // M22 // GT: might be removed since VSO already provided clipped distortion 4966 if ( m_pcRdCost->getUseVSO() ) 4967 { 4968 uiDistortionBest = m_pcRdCost->getDistPartVSO ( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight, false ); 4969 } 4970 else 4971 { 4972 #endif 4672 4973 // update with clipped distortion and cost (qp estimation loop uses unclipped values) 4673 4974 #if WEIGHTED_CHROMA_DISTORTION … … 4680 4981 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 ); 4681 4982 #endif 4983 #if H_3D_VSO // M23 4984 } 4985 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 4986 dCostBest = m_pcRdCost->calcRdCostVSO( uiBitsBest, uiDistortionBest ); 4987 else 4988 #endif 4682 4989 dCostBest = m_pcRdCost->calcRdCost( uiBitsBest, uiDistortionBest ); 4683 4990 … … 4692 4999 4693 5000 pcCU->setQPSubParts( qpBest, 0, pcCU->getDepth(0) ); 5001 5002 #if H_3D_VSO // M24 // necessary?? 5003 if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() ) 5004 { 5005 Pel* piSrc = rpcYuvRec->getLumaAddr(); 5006 UInt uiSrcStride = rpcYuvRec->getStride(); 5007 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 5008 } 5009 #endif 4694 5010 } 4695 5011 5012 #if H_3D_VSO // M25 5013 Void TEncSearch::xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist ) 5014 #else 4696 5015 Void TEncSearch::xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist ) 5016 #endif 4697 5017 { 4698 5018 const UInt uiTrMode = uiDepth - pcCU->getDepth( 0 ); … … 4727 5047 Double dSingleCost = MAX_DOUBLE; 4728 5048 UInt uiSingleBits = 0; 5049 #if H_3D_VSO 5050 Dist uiSingleDist = 0; 5051 #else 4729 5052 UInt uiSingleDist = 0; 5053 #endif 4730 5054 UInt uiAbsSumY = 0, uiAbsSumU = 0, uiAbsSumV = 0; 4731 5055 UInt uiBestTransformMode[3] = {0}; … … 4852 5176 ::memset( m_pTempPel, 0, sizeof( Pel ) * uiNumSamplesLuma ); // not necessary needed for inside of recursion (only at the beginning) 4853 5177 5178 #if H_3D_VSO // M27 5179 Dist uiDistY; 5180 if ( m_pcRdCost->getUseVSO() ) 5181 { 5182 if( m_pcRdCost->getUseEstimatedVSD() ) 5183 { 5184 uiDistY = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, m_pTempPel, 1<< uiLog2TrSize, pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false ); 5185 } 5186 else 5187 { 5188 uiDistY = m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, pcPred->getLumaAddr( uiAbsPartIdx ), pcPred->getStride(), pcOrg->getLumaAddr( uiAbsPartIdx), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false ); // initialized with zero residual distortion 5189 } 5190 } 5191 else 5192 { 5193 uiDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pTempPel, trWidth, pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight ); // initialized with zero residual destortion 5194 } 5195 #else 4854 5196 UInt uiDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pTempPel, trWidth, pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight ); // initialized with zero residual destortion 5197 #endif 4855 5198 4856 5199 if ( puiZeroDist ) … … 4867 5210 assert(scalingListType < 6); 4868 5211 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType );//this is for inter mode only 4869 4870 const UInt uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), 4871 pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight ); 5212 5213 #if H_3D_VSO // M28 5214 Dist uiNonzeroDistY; 5215 if ( m_pcRdCost->getUseVSO() ) 5216 { 5217 if ( m_pcRdCost->getUseEstimatedVSD() ) 5218 { 5219 uiNonzeroDistY = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false ); 5220 } 5221 else 5222 { 5223 m_cYuvRecTemp.addClipPartLuma( &m_pcQTTempTComYuv[uiQTTempAccessLayer], pcPred, uiAbsPartIdx, 1<< uiLog2TrSize ); 5224 uiNonzeroDistY = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(), 5225 pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false ); 5226 } 5227 } 5228 else 5229 { 5230 uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight ); 5231 } 5232 #else 5233 const UInt uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight ); 5234 #endif 4872 5235 if (pcCU->isLosslessCoded(0)) 4873 5236 { … … 4876 5239 else 4877 5240 { 5241 #if H_3D_VSO // M29 5242 Double singleCostY; 5243 if ( m_pcRdCost->getUseLambdaScaleVSO()) 5244 singleCostY = m_pcRdCost->calcRdCostVSO( uiSingleBitsY, uiNonzeroDistY ); 5245 else 5246 singleCostY = m_pcRdCost->calcRdCost( uiSingleBitsY, uiNonzeroDistY ); 5247 #else 4878 5248 const Double singleCostY = m_pcRdCost->calcRdCost( uiSingleBitsY, uiNonzeroDistY ); 5249 #endif 4879 5250 m_pcEntropyCoder->resetBits(); 4880 5251 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_LUMA, uiTrMode ); 4881 5252 const UInt uiNullBitsY = m_pcEntropyCoder->getNumberOfWrittenBits(); 5253 #if H_3D_VSO // M29 5254 Double nullCostY; 5255 if ( m_pcRdCost->getUseLambdaScaleVSO()) 5256 nullCostY = m_pcRdCost->calcRdCostVSO( uiNullBitsY, uiDistY ); 5257 else 5258 nullCostY = m_pcRdCost->calcRdCost ( uiNullBitsY, uiDistY ); 5259 #else 4882 5260 const Double nullCostY = m_pcRdCost->calcRdCost( uiNullBitsY, uiDistY ); 5261 #endif 4883 5262 if( nullCostY < singleCostY ) 4884 5263 { … … 4905 5284 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_LUMA, uiTrMode ); 4906 5285 const UInt uiNullBitsY = m_pcEntropyCoder->getNumberOfWrittenBits(); 5286 #if H_3D_VSO // M NEW01 5287 if ( m_pcRdCost->getUseRenModel() ) 5288 minCostY = m_pcRdCost->calcRdCostVSO( uiNullBitsY, uiDistY ); 5289 else 5290 #endif 4907 5291 minCostY = m_pcRdCost->calcRdCost( uiNullBitsY, uiDistY ); 4908 5292 } … … 5080 5464 if( checkTransformSkipY ) 5081 5465 { 5466 #if H_3D_VSO 5467 Dist uiNonzeroDistY; 5468 UInt uiAbsSumTransformSkipY; 5469 #else 5082 5470 UInt uiNonzeroDistY, uiAbsSumTransformSkipY; 5471 #endif 5083 5472 Double dSingleCostY; 5084 5473 … … 5138 5527 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType, true ); 5139 5528 5140 uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), 5529 #if H_3D_VSO // M NEW 5530 if ( m_pcRdCost->getUseVSO() ) 5531 { 5532 if ( m_pcRdCost->getUseEstimatedVSD() ) 5533 { 5534 uiNonzeroDistY = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false ); 5535 } 5536 else 5537 { 5538 m_cYuvRecTemp.addClipPartLuma( &m_pcQTTempTComYuv[uiQTTempAccessLayer], pcPred, uiAbsPartIdx, 1<< uiLog2TrSize ); 5539 uiNonzeroDistY = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(), 5540 pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false ); 5541 } 5542 } 5543 else 5544 #endif 5545 uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), 5141 5546 pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight ); 5142 5547 5548 #if H_3D_VSO 5549 if ( m_pcRdCost->getUseRenModel() ) 5550 dSingleCostY = m_pcRdCost->calcRdCostVSO( uiTsSingleBitsY, uiNonzeroDistY ); 5551 else 5552 #endif 5143 5553 dSingleCostY = m_pcRdCost->calcRdCost( uiTsSingleBitsY, uiNonzeroDistY ); 5144 5554 } … … 5359 5769 5360 5770 uiSingleDist = uiDistY + uiDistU + uiDistV; 5771 #if H_3D_VSO // M30 5772 if ( m_pcRdCost->getUseLambdaScaleVSO()) 5773 dSingleCost = m_pcRdCost->calcRdCostVSO( uiSingleBits, uiSingleDist ); 5774 else 5775 #endif 5361 5776 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDist ); 5362 5777 } … … 5370 5785 m_pcRDGoOnSbacCoder->load ( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 5371 5786 } 5787 #if H_3D_VSO 5788 Dist uiSubdivDist = 0; 5789 #else 5372 5790 UInt uiSubdivDist = 0; 5791 #endif 5373 5792 UInt uiSubdivBits = 0; 5374 5793 Double dSubdivCost = 0.0; … … 5378 5797 { 5379 5798 UInt nsAddr = uiAbsPartIdx + ui * uiQPartNumSubdiv; 5799 #if H_3D_VSO // M31 5800 xEstimateResidualQT( pcCU, ui, uiAbsPartIdx + ui * uiQPartNumSubdiv, nsAddr, pcOrg, pcPred, pcResi, uiDepth + 1, dSubdivCost, uiSubdivBits, uiSubdivDist, bCheckFull ? NULL : puiZeroDist ); 5801 #else 5380 5802 xEstimateResidualQT( pcCU, ui, uiAbsPartIdx + ui * uiQPartNumSubdiv, nsAddr, pcResi, uiDepth + 1, dSubdivCost, uiSubdivBits, uiSubdivDist, bCheckFull ? NULL : puiZeroDist ); 5803 #endif 5381 5804 } 5382 5805 … … 5411 5834 5412 5835 uiSubdivBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 5836 #if H_3D_VSO // M32 5837 if ( m_pcRdCost->getUseLambdaScaleVSO()) 5838 dSubdivCost = m_pcRdCost->calcRdCostVSO( uiSubdivBits, uiSubdivDist ); 5839 else 5840 #endif 5413 5841 dSubdivCost = m_pcRdCost->calcRdCost( uiSubdivBits, uiSubdivDist ); 5414 5842 … … 5435 5863 } 5436 5864 } 5865 5866 #if H_3D_VSO // M33 5867 if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() ) 5868 { 5869 UInt uiWidth = 1<< uiLog2TrSize; 5870 UInt uiHeight = 1<< uiLog2TrSize; 5871 5872 Pel* piSrc; 5873 UInt uiSrcStride; 5874 5875 if ( uiAbsSumY ) 5876 { 5877 UInt uiQTLayer = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize; 5878 m_cYuvRecTemp.addClipPartLuma( &m_pcQTTempTComYuv[uiQTLayer], pcPred, uiAbsPartIdx, 1<< uiLog2TrSize ); 5879 piSrc = m_cYuvRecTemp.getLumaAddr( uiAbsPartIdx ); 5880 uiSrcStride = m_cYuvRecTemp.getStride (); 5881 } 5882 else 5883 { 5884 piSrc = pcPred->getLumaAddr( uiAbsPartIdx ); 5885 uiSrcStride = pcPred->getStride (); 5886 } 5887 5888 m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight ); 5889 } 5890 #endif 5891 5437 5892 rdCost += dSingleCost; 5438 5893 ruiBits += uiSingleBits; -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSearch.h
r324 r446 121 121 const UInt* m_puiDFilter; 122 122 Int m_iMaxDeltaQP; 123 123 124 #if H_3D_VSO // M17 125 TComYuv m_cYuvRecTemp; 126 #endif 124 127 // AMVP cost computation 125 128 // UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS]; … … 253 256 TComYuv* pcPredYuv, 254 257 TComYuv* pcResiYuv, 258 #if H_3D_VSO 259 Dist& ruiDist, 260 #else 255 261 UInt& ruiDist, 262 #endif 256 263 Int default0Save1Load2 = 0); 257 264 Void xIntraCodingChromaBlk ( TComDataCU* pcCU, … … 272 279 TComYuv* pcPredYuv, 273 280 TComYuv* pcResiYuv, 281 #if H_3D_VSO 282 Dist& ruiDistY, 283 #else 274 284 UInt& ruiDistY, 285 #endif 275 286 UInt& ruiDistC, 276 287 #if HHI_RQT_INTRA_SPEEDUP … … 445 456 446 457 Void xEncodeResidualQT( TComDataCU* pcCU, UInt uiAbsPartIdx, const UInt uiDepth, Bool bSubdivAndCbf, TextType eType ); 458 #if H_3D_VSO // M26 459 Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist ); 460 #else 447 461 Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist ); 462 #endif 448 463 Void xSetResidualQTData( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx,UInt absTUPartIdx, TComYuv* pcResi, UInt uiDepth, Bool bSpatial ); 449 464 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r438 r446 371 371 // store lambda 372 372 m_pcRdCost ->setLambda( dLambda ); 373 374 #if H_3D_VSO 375 m_pcRdCost->setUseLambdaScaleVSO ( (m_pcCfg->getUseVSO() || m_pcCfg->getForceLambdaScaleVSO()) && m_pcCfg->getIsDepth() ); 376 m_pcRdCost->setLambdaVSO ( dLambda * m_pcCfg->getLambdaScaleVSO() ); 377 378 // Should be moved to TEncTop 379 380 // SAIT_VSO_EST_A0033 381 m_pcRdCost->setDisparityCoeff( m_pcCfg->getDispCoeff() ); 382 383 // LGE_WVSO_A0119 384 if( m_pcCfg->getUseWVSO() && m_pcCfg->getIsDepth() ) 385 { 386 m_pcRdCost->setDWeight ( m_pcCfg->getDWeight() ); 387 m_pcRdCost->setVSOWeight( m_pcCfg->getVSOWeight() ); 388 m_pcRdCost->setVSDWeight( m_pcCfg->getVSDWeight() ); 389 } 390 391 #endif 392 373 393 #if WEIGHTED_CHROMA_DISTORTION 374 394 // for RDO … … 414 434 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 415 435 #endif 436 416 437 rpcSlice->setSliceType ( eSliceType ); 417 438 #endif … … 438 459 #endif 439 460 461 #if L0386_DB_METRIC 462 if ( m_pcCfg->getDeblockingFilterMetric() ) 463 { 464 rpcSlice->setDeblockingFilterOverrideFlag(true); 465 rpcSlice->setDeblockingFilterDisable(false); 466 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 467 rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 ); 468 } else 469 #endif 440 470 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 441 471 { … … 764 794 765 795 Double dPicRdCost; 796 #if H_3D_VSO 797 Dist64 uiPicDist = m_uiPicDist; 798 #else 766 799 UInt64 uiPicDist = m_uiPicDist; 800 #endif 767 801 UInt64 uiALFBits = 0; 768 802 … … 771 805 // compute RD cost and choose the best 772 806 dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME); 807 #if H_3D 808 // Above calculation need to be fixed for VSO, including frameLambda value. 809 #endif 773 810 774 811 if ( dPicRdCost < dPicRdCostBest ) … … 977 1014 } 978 1015 // for every CU in slice 1016 #if H_3D 1017 Int iLastPosY = -1; 1018 #endif 979 1019 UInt uiEncCUOrder; 980 1020 for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU(); … … 985 1025 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 986 1026 pcCU->initCU( rpcPic, uiCUAddr ); 987 1027 #if H_3D_VSO 1028 if ( m_pcRdCost->getUseRenModel() ) 1029 { 1030 // updated renderer model if necessary 1031 Int iCurPosX; 1032 Int iCurPosY; 1033 pcCU->getPosInPic(0, iCurPosX, iCurPosY ); 1034 if ( iCurPosY != iLastPosY ) 1035 { 1036 iLastPosY = iCurPosY; 1037 pcEncTop->setupRenModel( pcSlice->getPOC() , pcSlice->getViewIndex(), pcSlice->getIsDepth() ? 1 : 0, iCurPosY ); 1038 } 1039 } 1040 #endif 988 1041 #if !RATE_CONTROL_LAMBDA_DOMAIN 989 1042 if(m_pcCfg->getUseRateCtrl()) … … 1223 1276 \retval rpcBitstream bitstream class 1224 1277 */ 1225 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pc Bitstream, TComOutputBitstream* pcSubstreams )1278 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ) 1226 1279 { 1227 1280 UInt uiCUAddr; … … 1403 1456 } 1404 1457 { 1405 UInt uiCounter = 0; 1406 vector<uint8_t>& rbsp = pcSubstreams[uiSubStrm].getFIFO(); 1407 for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();) 1408 { 1409 /* 1) find the next emulated 00 00 {00,01,02,03} 1410 * 2a) if not found, write all remaining bytes out, stop. 1411 * 2b) otherwise, write all non-emulated bytes out 1412 * 3) insert emulation_prevention_three_byte 1413 */ 1414 vector<uint8_t>::iterator found = it; 1415 do 1416 { 1417 /* NB, end()-1, prevents finding a trailing two byte sequence */ 1418 found = search_n(found, rbsp.end()-1, 2, 0); 1419 found++; 1420 /* if not found, found == end, otherwise found = second zero byte */ 1421 if (found == rbsp.end()) 1422 { 1423 break; 1424 } 1425 if (*(++found) <= 3) 1426 { 1427 break; 1428 } 1429 } while (true); 1430 it = found; 1431 if (found != rbsp.end()) 1432 { 1433 it++; 1434 uiCounter++; 1435 } 1436 } 1437 1458 UInt numStartCodeEmulations = pcSubstreams[uiSubStrm].countStartCodeEmulations(); 1438 1459 UInt uiAccumulatedSubstreamLength = 0; 1439 1460 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) … … 1443 1464 // add bits coded in previous dependent slices + bits coded so far 1444 1465 // add number of emulation prevention byte count in the tile 1445 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + uiCounter);1466 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + numStartCodeEmulations ); 1446 1467 } 1447 1468 } -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSlice.h
r438 r446 91 91 TEncSbac* m_pcRDGoOnSbacCoder; ///< go-on SBAC encoder 92 92 UInt64 m_uiPicTotalBits; ///< total bits for the picture 93 #if H_3D_VSO 94 Dist64 m_uiPicDist; ///< total distortion for the picture 95 #else 93 96 UInt64 m_uiPicDist; ///< total distortion for the picture 97 #endif 94 98 Double m_dPicRdCost; ///< picture-level RD cost 95 99 Double* m_pdRdPicLambda; ///< array of lambda candidates … … 122 126 Void precompressSlice ( TComPic*& rpcPic ); ///< precompress slice for multi-loop opt. 123 127 Void compressSlice ( TComPic*& rpcPic ); ///< analysis stage of slice 124 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* rpcBitstream, TComOutputBitstream*pcSubstreams );128 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ); 125 129 126 130 // misc. functions -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncTop.cpp
r438 r446 81 81 m_pcBitCounters = NULL; 82 82 m_pcRdCosts = NULL; 83 84 83 #if H_MV 85 84 m_ivPicLists = NULL; … … 96 95 Void TEncTop::create () 97 96 { 98 99 97 #if !H_MV 100 98 // initialize global variables … … 288 286 Void TEncTop::init() 289 287 { 290 291 288 // initialize SPS 292 289 xInitSPS(); … … 346 343 m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcPicCurr ) ); 347 344 } 348 } 349 #endif 350 345 #if H_MV 346 pcPicCurr->setLayerId( getLayerId()); 347 #endif 348 #if H_3D 349 pcPicCurr->setScaleOffset( m_aaiCodedScale, m_aaiCodedOffset ); 350 #endif 351 } 352 #endif 351 353 Void TEncTop::deletePicBuffer() 352 354 { … … 375 377 \retval iNumEncoded number of encoded pictures 376 378 */ 377 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded378 379 #if H_MV 379 , Int gopId 380 #endif 381 ) 382 { 383 380 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId ) 381 { 382 #else 383 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ) 384 { 385 #endif 384 386 #if H_3D 385 387 TComPic* picLastCoded = getPic( getGOPEncoder()->getPocLastCoded() ); … … 389 391 } 390 392 #endif 391 392 393 #if H_MV 393 394 if( gopId == 0) … … 443 444 m_iNumPicRcvd = 0; 444 445 m_uiNumAllPicCoded += iNumEncoded; 445 446 446 #if H_MV 447 447 } 448 448 #endif 449 450 449 } 451 450 … … 547 546 m_cSPS.setMaxCUHeight ( g_uiMaxCUHeight ); 548 547 m_cSPS.setMaxCUDepth ( g_uiMaxCUDepth ); 549 m_cSPS.setMinTrDepth ( 0 ); 550 m_cSPS.setMaxTrDepth ( 1 ); 548 549 Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth ); 550 Int log2MinCUSize = 0; 551 while(minCUSize > 1) 552 { 553 minCUSize >>= 1; 554 log2MinCUSize++; 555 } 556 557 m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize); 558 m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_cSPS.getMaxCUDepth()-g_uiAddCUDepth); 551 559 552 560 m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize); … … 563 571 564 572 m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); 565 573 #if !L0034_COMBINED_LIST_CLEANUP 566 574 m_cSPS.setUseLComb ( m_bUseLComb ); 575 #endif 567 576 568 577 Int i; … … 645 654 pcVUI->setLog2MaxMvLengthVertical(getLog2MaxMvLengthVertical()); 646 655 } 656 #if H_3D 657 if ( !m_isDepth ) 658 { 659 m_cSPS.initCamParaSPS ( m_viewIndex, m_uiCamParPrecision, m_bCamParInSliceHeader, m_aaiCodedScale, m_aaiCodedOffset ); 660 } 661 #endif 647 662 } 648 663 … … 716 731 m_cPPS.setOutputFlagPresentFlag( false ); 717 732 m_cPPS.setSignHideFlag(getSignHideFlag()); 733 #if L0386_DB_METRIC 734 if ( getDeblockingFilterMetric() ) 735 { 736 m_cPPS.setDeblockingFilterControlPresentFlag (true); 737 m_cPPS.setDeblockingFilterOverrideEnabledFlag(true); 738 m_cPPS.setPicDisableDeblockingFilterFlag(false); 739 m_cPPS.setDeblockingFilterBetaOffsetDiv2(0); 740 m_cPPS.setDeblockingFilterTcOffsetDiv2(0); 741 } 742 else 743 { 718 744 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 745 } 746 #else 747 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 748 #endif 719 749 m_cPPS.setLog2ParallelMergeLevelMinus2 (m_log2ParallelMergeLevelMinus2 ); 720 750 m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG); … … 763 793 } 764 794 } 795 #if H_3D 796 if( m_cSPS.hasCamParInSliceHeader() ) 797 { 798 m_cPPS.setSliceHeaderExtensionPresentFlag( true ); 799 } 800 #endif 765 801 } 766 802 … … 988 1024 } 989 1025 #endif 990 } 1026 1027 } 1028 1029 #if L0208_SOP_DESCRIPTION_SEI 1030 Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ) 1031 { 1032 int rpsIdx = GOPid; 1033 1034 for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++) 1035 { 1036 if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0) 1037 { 1038 Int POCIndex = POCCurr%m_uiIntraPeriod; 1039 if(POCIndex == 0) 1040 { 1041 POCIndex = m_uiIntraPeriod; 1042 } 1043 if(POCIndex == m_GOPList[extraNum].m_POC) 1044 { 1045 rpsIdx = extraNum; 1046 } 1047 } 1048 else 1049 { 1050 if(POCCurr==m_GOPList[extraNum].m_POC) 1051 { 1052 rpsIdx = extraNum; 1053 } 1054 } 1055 } 1056 1057 return rpsIdx; 1058 } 1059 #endif 991 1060 992 1061 Void TEncTop::xInitPPSforTiles() … … 1069 1138 } 1070 1139 } 1071 1072 1140 #if H_MV 1073 1141 Void TEncTop::printSummary( Int numAllPicCoded ) … … 1133 1201 #endif 1134 1202 1203 #if H_3D_VSO 1204 Void TEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset ) 1205 { 1206 TRenModel* rendererModel = m_cRdCost.getRenModel(); 1207 rendererModel->setupPart( iHorOffset, std::min( (Int) g_uiMaxCUHeight, (Int) ( m_iSourceHeight - iHorOffset ) )) ; 1208 1209 Int iEncViewSIdx = m_cameraParameters->getBaseId2SortedId()[ iEncViewIdx ]; 1210 1211 // setup base views 1212 Int iNumOfBV = m_renderModelParameters->getNumOfBaseViewsForView( iEncViewSIdx, iEncContent ); 1213 1214 for (Int iCurView = 0; iCurView < iNumOfBV; iCurView++ ) 1215 { 1216 Int iBaseViewSIdx; 1217 Int iVideoDistMode; 1218 Int iDepthDistMode; 1219 1220 m_renderModelParameters->getBaseViewData( iEncViewSIdx, iEncContent, iCurView, iBaseViewSIdx, iVideoDistMode, iDepthDistMode ); 1221 1222 AOT( iVideoDistMode < 0 || iVideoDistMode > 2 ); 1223 1224 Int iBaseViewIdx = m_cameraParameters->getBaseSortedId2Id()[ iBaseViewSIdx ]; 1225 1226 TComPicYuv* pcPicYuvVideoRec = m_ivPicLists->getPicYuv( iBaseViewIdx, false, iPoc, true ); 1227 TComPicYuv* pcPicYuvDepthRec = m_ivPicLists->getPicYuv( iBaseViewIdx, true , iPoc, true ); 1228 TComPicYuv* pcPicYuvVideoOrg = m_ivPicLists->getPicYuv( iBaseViewIdx, false, iPoc, false ); 1229 TComPicYuv* pcPicYuvDepthOrg = m_ivPicLists->getPicYuv( iBaseViewIdx, true , iPoc, false ); 1230 1231 TComPicYuv* pcPicYuvVideoRef = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg : NULL; 1232 TComPicYuv* pcPicYuvDepthRef = ( iDepthDistMode == 2 ) ? pcPicYuvDepthOrg : NULL; 1233 1234 TComPicYuv* pcPicYuvVideoTest = ( iVideoDistMode == 0 ) ? pcPicYuvVideoOrg : pcPicYuvVideoRec; 1235 TComPicYuv* pcPicYuvDepthTest = ( iDepthDistMode == 0 ) ? pcPicYuvDepthOrg : pcPicYuvDepthRec; 1236 1237 AOT( (iVideoDistMode == 2) != (pcPicYuvVideoRef != NULL) ); 1238 AOT( (iDepthDistMode == 2) != (pcPicYuvDepthRef != NULL) ); 1239 AOT( pcPicYuvDepthTest == NULL ); 1240 AOT( pcPicYuvVideoTest == NULL ); 1241 1242 rendererModel->setBaseView( iBaseViewSIdx, pcPicYuvVideoTest, pcPicYuvDepthTest, pcPicYuvVideoRef, pcPicYuvDepthRef ); 1243 } 1244 1245 rendererModel->setErrorMode( iEncViewSIdx, iEncContent, 0 ); 1246 // setup virtual views 1247 Int iNumOfSV = m_renderModelParameters->getNumOfModelsForView( iEncViewSIdx, iEncContent ); 1248 for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ ) 1249 { 1250 Int iOrgRefBaseViewSIdx; 1251 Int iLeftBaseViewSIdx; 1252 Int iRightBaseViewSIdx; 1253 Int iSynthViewRelNum; 1254 Int iModelNum; 1255 Int iBlendMode; 1256 m_renderModelParameters->getSingleModelData(iEncViewSIdx, iEncContent, iCurView, iModelNum, iBlendMode,iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum ); 1257 1258 Int iLeftBaseViewIdx = -1; 1259 Int iRightBaseViewIdx = -1; 1260 1261 TComPicYuv* pcPicYuvOrgRef = NULL; 1262 Int** ppiShiftLUTLeft = NULL; 1263 Int** ppiShiftLUTRight = NULL; 1264 Int** ppiBaseShiftLUTLeft = NULL; 1265 Int** ppiBaseShiftLUTRight = NULL; 1266 1267 1268 Int iDistToLeft = -1; 1269 1270 Int iSynthViewIdx = m_cameraParameters->synthRelNum2Idx( iSynthViewRelNum ); 1271 1272 if ( iLeftBaseViewSIdx != -1 ) 1273 { 1274 iLeftBaseViewIdx = m_cameraParameters->getBaseSortedId2Id() [ iLeftBaseViewSIdx ]; 1275 ppiShiftLUTLeft = m_cameraParameters->getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ]; 1276 } 1277 1278 if ( iRightBaseViewSIdx != -1 ) 1279 { 1280 iRightBaseViewIdx = m_cameraParameters->getBaseSortedId2Id() [iRightBaseViewSIdx ]; 1281 ppiShiftLUTRight = m_cameraParameters->getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ]; 1282 } 1283 1284 if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 ) 1285 { 1286 iDistToLeft = m_cameraParameters->getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx); 1287 ppiBaseShiftLUTLeft = m_cameraParameters->getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ]; 1288 ppiBaseShiftLUTRight = m_cameraParameters->getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ]; 1289 1290 } 1291 1292 if ( iOrgRefBaseViewSIdx != -1 ) 1293 { 1294 pcPicYuvOrgRef = m_ivPicLists->getPicYuv( m_cameraParameters->getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , false, iPoc, false ); 1295 AOF ( pcPicYuvOrgRef ); 1296 } 1297 1298 rendererModel->setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef ); 1299 } 1300 } 1301 #endif 1135 1302 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncTop.h
r438 r446 63 63 // Class definition 64 64 // ==================================================================================================================== 65 66 67 65 68 66 /// encoder class … … 133 131 TEncAnalyze m_cAnalyzeB; 134 132 #endif 135 136 133 protected: 137 134 Void xGetNewPicBuffer ( TComPic*& rpcPic ); ///< get picture buffer which will be processed … … 148 145 Void create (); 149 146 Void destroy (); 150 151 147 Void init (); 152 153 148 #if H_MV 154 149 TComPicLists* getIvPicLists() { return m_ivPicLists; } 155 150 #endif 156 157 151 Void deletePicBuffer (); 158 152 … … 162 156 Void initNewPic(TComPicYuv* pcPicYuvOrg); 163 157 #endif 164 165 158 // ------------------------------------------------------------------------------------------------------------------- 166 159 // member access functions … … 195 188 TComPPS* getPPS () { return &m_cPPS; } 196 189 Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid ); 190 #if L0208_SOP_DESCRIPTION_SEI 191 Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ); 192 #endif 197 193 TComScalingList* getScalingList () { return &m_scalingList; } 198 199 194 #if H_MV 200 195 TEncAnalyze* getAnalyzeAll () { return &m_cAnalyzeAll; } … … 210 205 Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } 211 206 #endif 212 213 214 207 // ------------------------------------------------------------------------------------------------------------------- 215 208 // encoder function … … 217 210 218 211 /// encode several number of pictures until end-of-sequence 212 #if H_MV 213 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId ); 214 #else 219 215 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 220 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded 221 #if H_MV 222 , Int gopId 223 #endif 224 ); 225 226 #if H_MV 227 void printSummary ( Int numAllPicCoded ); 216 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 217 #endif 218 219 #if H_MV 220 Void printSummary ( Int numAllPicCoded ); 228 221 #else 229 void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); } 230 #endif 231 222 void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); } 223 #endif 224 225 #if H_3D 226 Void setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset ); 227 #endif 232 228 }; 233 229 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r438 r446 235 235 Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom ); 236 236 237 // Chroma offset range limi nation237 // Chroma offset range limitation 238 238 if(comp) 239 239 { 240 Int shift = 1 << (g_bitDepthC - 1); 241 Int pred = ( shift - ( ( shift*weight)>>(log2Denom) ) ); 240 Int pred = ( 128 - ( ( 128*weight)>>(log2Denom) ) ); 242 241 Int deltaOffset = Clip3( -512, 511, (offset - pred) ); // signed 10bit 243 242 offset = Clip3( -128, 127, (deltaOffset + pred) ); // signed 8bit 243 } 244 // Luma offset range limitation 245 else 246 { 247 offset = Clip3( -128, 127, offset); 244 248 } 245 249 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibExtractor/TExtrTop.cpp
r438 r446 37 37 38 38 #include "TExtrTop.h" 39 39 #if H_MV 40 40 TExtrTop::TExtrTop() 41 41 { … … 55 55 Bool TExtrTop::extract( InputNALUnit& nalu, std::set<UInt>& rsuiExtractLayerIds ) 56 56 { 57 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B004658 57 //extraction now has to be done using layer_id 59 UInt uiLayerId = nalu.m_layerId; 60 #else 61 UInt uiLayerId = xGetLayerId( nalu.m_viewId, nalu.m_isDepth ); 62 #endif 58 UInt uiLayerId = nalu.m_layerId; 59 60 63 61 // Initialize entropy decoder 64 62 m_cEntropyDecoder.setEntropyDecoder( &m_cCavlcDecoder ); 65 63 m_cEntropyDecoder.setBitstream ( nalu.m_Bitstream ); 66 64 67 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B004668 65 if ( nalu.m_nalUnitType == NAL_UNIT_VPS ) 69 66 { 70 67 // a hack for now assuming there's only one VPS in the bitstream 71 m_cEntropyDecoder.decodeVPS( &m_cVPS ); 72 68 m_cEntropyDecoder.decodeVPS( &m_cVPS ); 73 69 } 74 #endif75 70 76 71 if ( nalu.m_nalUnitType == NAL_UNIT_SPS ) 77 72 { 78 TComSPS cSPS; 79 TComRPSList cRPS; 80 cSPS.setRPSList( &cRPS ); 81 #if HHI_MPI || H3D_QTL 82 #if VIDYO_VPS_INTEGRATION 83 m_cEntropyDecoder.decodeSPS( &cSPS, m_cVPS.getDepthFlag(uiLayerId) ); 73 TComSPS cSPS; 74 #if H_3D 75 Int layerIdInVPS = m_cVPS.getLayerIdInVps( uiLayerId ); 76 m_cEntropyDecoder .decodeSPS( &cSPS, m_cVPS.getViewIndex( layerIdInVPS ), ( m_cVPS.getDepthId( layerIdInVPS ) == 1 ) ); 84 77 #else 85 m_cEntropyDecoder .decodeSPS( &cSPS, nalu.m_isDepth);78 m_cEntropyDecoder .decodeSPS( &cSPS ); 86 79 #endif 87 #else 88 m_cEntropyDecoder.decodeSPS( &cSPS ); 89 #endif 90 91 m_acSPSBuffer.push_back( cSPS ); 80 m_acSPSBuffer .push_back( cSPS ); 92 81 } 93 82 … … 97 86 98 87 Void TExtrTop::dumpSpsInfo( std::ostream& rcSpsInfoHandle ) 99 { 88 { 100 89 rcSpsInfoHandle << "NumSPS = " << m_acSPSBuffer.size() << std::endl; 90 91 std::list<Int>::iterator iterSPSLayerId = m_aiSPSLayerIdBuffer.begin(); 101 92 102 for( std::list<TComSPS>::iterator iterSPS = m_acSPSBuffer.begin(); iterSPS != m_acSPSBuffer.end(); iterSPS++ ) 103 { 104 rcSpsInfoHandle << std::endl; 105 rcSpsInfoHandle << "layer_id = " << xGetLayerId( iterSPS->getViewId(), iterSPS->isDepth() ) << std::endl; 93 for( std::list<TComSPS>::iterator iterSPS = m_acSPSBuffer.begin(); iterSPS != m_acSPSBuffer.end(); iterSPS++, iterSPSLayerId++ ) 94 { 95 rcSpsInfoHandle << "layer_id = " << *iterSPSLayerId << std::endl; 106 96 rcSpsInfoHandle << "seq_parameter_set_id = " << iterSPS->getSPSId() << std::endl; 107 rcSpsInfoHandle << "view_id = " << iterSPS->getViewId() << std::endl;108 rcSpsInfoHandle << "view_order_idx = " << iterSPS->getViewOrderIdx() << std::endl;109 rcSpsInfoHandle << "is_depth = " << iterSPS->isDepth() << std::endl;110 97 } 111 98 } 99 100 Void TExtrTop::dumpVpsInfo( std::ostream& rcVpsInfoHandle ) 101 { 102 rcVpsInfoHandle << "MaxLayers = " << m_cVPS.getMaxLayers() << std::endl; 103 rcVpsInfoHandle << "MaxNuhLayerId = " << m_cVPS.getMaxNuhLayerId() << std::endl; 104 105 for ( Int layerIdxInVps = 0; layerIdxInVps < m_cVPS.getMaxLayers(); layerIdxInVps++ ) 106 { 107 rcVpsInfoHandle << "LayerIdxInVps = " << layerIdxInVps << std::endl; 108 rcVpsInfoHandle << "LayerIdInNuh = " << m_cVPS.getLayerIdInNuh( layerIdxInVps ) << std::endl; 109 rcVpsInfoHandle << "ViewId = " << m_cVPS.getViewId ( layerIdxInVps ) << std::endl; 110 #if H_3D 111 rcVpsInfoHandle << "DepthFlag = " << m_cVPS.getViewIndex ( layerIdxInVps ) << std::endl; 112 rcVpsInfoHandle << "DepthFlag = " << m_cVPS.getDepthId ( layerIdxInVps ) << std::endl; 113 #endif 114 } 115 } 116 #endif -
branches/HTM-DEV-0.2-dev/source/Lib/TLibExtractor/TExtrTop.h
r438 r446 46 46 #include <set> 47 47 48 #if H_MV 48 49 // ==================================================================================================================== 49 50 // Class definition … … 54 55 { 55 56 private: 56 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 57 57 58 TComVPS m_cVPS; 58 #endif 59 std::list<TComSPS> m_acSPSBuffer;59 std::list<TComSPS> m_acSPSBuffer; 60 std::list<Int > m_aiSPSLayerIdBuffer; 60 61 61 62 // functional classes … … 72 73 Bool extract( InputNALUnit& nalu, std::set<UInt>& rsuiExtractLayerIds ); 73 74 Void dumpSpsInfo( std::ostream& rcSpsInfoHandle ); 75 Void dumpVpsInfo( std::ostream& rcVpsInfoHandle ); 74 76 75 77 TComSPS *getFirstSPS() { return m_acSPSBuffer.empty() ? 0 : &(m_acSPSBuffer.front()); } 76 78 77 79 protected: 78 UInt xGetLayerId( UInt uiViewId, Bool bIsDepth ) { return ( ( uiViewId << 1 ) + ( bIsDepth ? 1 : 0 ) ); } 80 79 81 };// END CLASS DEFINITION TExtrTop 80 82 81 83 82 84 #endif // __TEXTRTOP__ 83 85 #endif -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenFilter.cpp
r438 r446 36 36 #include "TRenFilter.h" 37 37 #include "TRenInterpFilter.h" 38 38 #if H_3D 39 39 40 40 ///// COMMON ///// … … 72 72 } 73 73 // Set Threshold 74 riBlendZThres = ( Max( abs(piInvZLUTLeft[0]- piInvZLUTLeft[255]), abs(piInvZLUTRight[0]- piInvZLUTRight[255]) ) * iBlendZThresPerc + 50) / 100;74 riBlendZThres = ( std::max( abs(piInvZLUTLeft[0]- piInvZLUTLeft[255]), abs(piInvZLUTRight[0]- piInvZLUTRight[255]) ) * iBlendZThresPerc + 50) / 100; 75 75 } 76 76 … … 194 194 195 195 /////////// Comparison /////////// 196 Int64 TRenFilter::SSE (PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2 196 Int64 TRenFilter::SSE (PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2, Bool bLuma ) 197 197 { 198 198 UInt uiWidth = pcInputPlane1->getWidth(); … … 205 205 Pel* pucImData2 = pcInputPlane2->getPlaneData(); 206 206 207 return SSE( pucImData1, (Int) uiStride1, (Int) uiWidth, (Int) uiHeight, pucImData2, (Int) uiStride2 );208 } 209 210 Int64 TRenFilter::SSE( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight, Pel* piSrc2, Int iSrcStride2 )207 return SSE( pucImData1, (Int) uiStride1, (Int) uiWidth, (Int) uiHeight, pucImData2, (Int) uiStride2, bLuma ); 208 } 209 210 Int64 TRenFilter::SSE( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight, Pel* piSrc2, Int iSrcStride2, Bool bLuma ) 211 211 { 212 212 Int64 iSSE = 0; 213 213 214 Int iShift = g_uiBitIncrement << 1; 214 215 Int iShift = DISTORTION_PRECISION_ADJUSTMENT( ( bLuma ? g_bitDepthY : g_bitDepthC ) - 8 ) << 1 ; 215 216 for(Int iPosY = 0; iPosY < iHeight; iPosY++) 216 217 { … … 266 267 267 268 inline Void TRenFilter::sampleUp2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage) 268 {// UpSampling from JSVM Software (DownConvertStatic) ??? 269 { // UpSampling from JSVM Software (DownConvertStatic) ??? 270 271 AOF( g_bitDepthC == g_bitDepthY ); 269 272 UInt uiNumPlanes = pcInputImage->getNumberOfPlanes(); 270 273 … … 397 400 { 398 401 // Scale and copy to image buffer. 399 pcOutputPlaneData[iOffset+i] = max(min((Pel) ((piDst[i] + iAddH) / iDivH), g_uiBASE_MAX ),0);402 pcOutputPlaneData[iOffset+i] = ClipY((Pel) ((piDst[i] + iAddH) / iDivH)); 400 403 } 401 404 } … … 421 424 Void TRenFilter::sampleDown2Tap13( Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ) 422 425 { // DownSampling from JSVM Software (DownConvertStatic) ?? 426 427 AOF( g_bitDepthC == g_bitDepthY ); 428 423 429 Int iOffset, iPosX, iPosY, k; 424 430 Int* piDataHorDown = new Int[(Int)(iWidth * iHeight / 2)]; … … 543 549 { 544 550 // Scale and copy back to image buffer. 545 pcOutputPlaneData[iOutputStride*iPosY+iPosX] = max(min( ( Pel) ( (piDst[iPosY] + iAddV) / iDivV), g_uiBASE_MAX ),0);551 pcOutputPlaneData[iOutputStride*iPosY+iPosX] = ClipY( ( Pel) ( (piDst[iPosY] + iAddV) / iDivV)); 546 552 } 547 553 } … … 569 575 570 576 Void TRenFilter::sampleVerDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad) 571 { // DownSampling from JSVM Software (DownConvertStatic) ?? 577 { 578 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 579 // DownSampling from JSVM Software (DownConvertStatic) ?? 572 580 Int iWidth = pcInputPlane->getWidth(); 573 581 Int iHeight = pcInputPlane->getHeight(); … … 614 622 615 623 Int iSum = iTmp4 + iTmp3 - iTmp2 + ((iTmp0 + iTmp4 + iTmp5 - iTmp2) << 1) + ( ( iTmp3 - iTmp1) << 2) + ( iTmp5 << 3 ) + (( iTmp4 + iTmp5 ) << 4); 616 pcOutputPlaneData[ iXPos ] = (Pel) Clip ((iSum + 32) >> 6);624 pcOutputPlaneData[ iXPos ] = (Pel) ClipY((iSum + 32) >> 6); 617 625 pcTmpIn++; 618 626 } … … 623 631 624 632 Void TRenFilter::sampleHorDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad ) 625 { // DownSampling from JSVM Software (DownConvertStatic) ?? 633 { 634 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 635 // DownSampling from JSVM Software (DownConvertStatic) ?? 626 636 Int iWidth = pcInputPlane->getWidth(); 627 637 Int iHeight = pcInputPlane->getHeight(); … … 653 663 654 664 Int iSum = iTmp4 + iTmp3 - iTmp2 + ((iTmp0 + iTmp4 + iTmp5 - iTmp2) << 1) + ( ( iTmp3 - iTmp1) << 2) + ( iTmp5 << 3 ) + (( iTmp4 + iTmp5 ) << 4); 655 pcOutputPlaneData[ iXPos ] = (Pel) Clip ((iSum + 32) >> 6);665 pcOutputPlaneData[ iXPos ] = (Pel) ClipY((iSum + 32) >> 6); 656 666 pcTmpIn += 2; 657 667 } … … 726 736 727 737 UInt uiPlane; 728 for (uiPlane = 0; uiPlane < pcInputImage->getNumberOf FullPlanes(); uiPlane ++)738 for (uiPlane = 0; uiPlane < pcInputImage->getNumberOfPlanes(); uiPlane ++) 729 739 { 730 740 binominal( pcInputImage->getPlane(uiPlane), pcOutputImage->getPlane(uiPlane), uiSize ); … … 810 820 Pel TRenFilter::xFiltBinom3( Pel* pcInputData, Int iStride ) 811 821 { 822 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 823 812 824 Int iSum = pcInputData[-1 * iStride ] + pcInputData[ 0 ] + (pcInputData[iStride ] << 1 ); 813 return Clip ( (iSum + 2) >> 2 );825 return ClipY( (iSum + 2) >> 2 ); 814 826 } 815 827 816 828 Pel TRenFilter::xFiltBinom5( Pel* pcInputData, Int iStride ) 817 829 { 830 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 818 831 // { 1,4,6,4,1 } 819 832 Int iStride0 = 0; … … 828 841 829 842 Int iSum = iTmp0 + (iTmp2 << 1) + ((iTmp1 + iTmp2) << 2); 830 return Clip ( (iSum + 8) >> 4 );843 return ClipY( (iSum + 8) >> 4 ); 831 844 } 832 845 833 846 Pel TRenFilter::xFiltBinom7( Pel* pcInputData, Int iStride ) 834 847 { 848 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 835 849 // { 1,6,15,20,15,6,1 } 836 850 Int iStride0 = 0; … … 849 863 Int iSum = iTmp0 - iTmp2 + ( iTmp1 << 1) + ( (iTmp1 + iTmp3) << 2) + ((iTmp2 + iTmp3) << 4); 850 864 851 return Clip ( (iSum + 32) >> 6 );865 return ClipY( (iSum + 32) >> 6 ); 852 866 } 853 867 854 868 Pel TRenFilter::xFiltBinom9( Pel* pcInputData, Int iStride ) 855 869 { 870 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 856 871 // { 1 8 28 56 70 56 28 8 1 } 857 872 Int iStride0 = 0; … … 873 888 Int iSum = iTmp0 + ((iTmp4 ) << 1) + ( ( iTmp4 - iTmp2 ) << 2) + ( (iTmp1 - iTmp3) << 3 ) + ((iTmp2 ) << 5) + ((iTmp3+ iTmp4 ) << 6); 874 889 875 return Clip ( (iSum + 128) >> 8 );890 return ClipY( (iSum + 128) >> 8 ); 876 891 } 877 892 … … 911 926 Void TRenFilter::diffHorSym(PelImagePlane* pcInputPlane, IntImagePlane* pcOutputPlane) 912 927 { 913 UInt uiInputStride 928 UInt uiInputStride = pcInputPlane ->getStride(); 914 929 UInt uiOutputStride = pcOutputPlane->getStride(); 915 930 UInt uiWidth = pcInputPlane ->getWidth(); 916 931 UInt uiHeight = pcInputPlane ->getHeight(); 917 932 918 Pel* pcInputData = pcInputPlane ->getPlaneData();919 Int* piOutputData = pcOutputPlane->getPlaneData();933 Pel* pcInputData = pcInputPlane ->getPlaneData(); 934 Int* piOutputData = pcOutputPlane->getPlaneData(); 920 935 921 936 for (UInt uiPosY = 0; uiPosY < uiHeight; uiPosY++) … … 927 942 }; 928 943 929 piOutputData[0] 944 piOutputData[0] = piOutputData[1]; 930 945 piOutputData[uiWidth-1] = piOutputData[uiWidth-2]; 931 pcInputData += uiInputStride; 932 piOutputData += uiOutputStride; 946 pcInputData += uiInputStride; 947 piOutputData += uiOutputStride; 948 933 949 }; 934 950 } … … 1225 1241 Void TRenFilter::xInterpHorChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter ) 1226 1242 { 1243 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1227 1244 Int iSum; 1228 1245 Pel* piSrcTmp; … … 1235 1252 { 1236 1253 iSum = (cFilter.*fpFilter)( piSrcTmp, iSrcStepX ); 1237 piDst[x * iDstStepX ] = Clip ((iSum + 32) >> 6 );1254 piDst[x * iDstStepX ] = ClipC ((iSum + 32) >> 6 ); 1238 1255 piSrcTmp+= iSrcStepX; 1239 1256 } … … 1245 1262 Void TRenFilter::xInterpVerChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter ) 1246 1263 { 1264 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1247 1265 Int iSum; 1248 1266 Pel* piSrcTmp; … … 1255 1273 { 1256 1274 iSum = (cFilter.*fpFilter)( piSrcTmp, iSrcStepY * iSrcStride ); 1257 piDst[x * iDstStepX ] = Clip ((iSum + 32) >> 6 );1275 piDst[x * iDstStepX ] = ClipC ((iSum + 32) >> 6 ); 1258 1276 piSrcTmp += iSrcStepX; 1259 1277 } … … 1266 1284 Void TRenFilter::xSampleDownHor2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ) 1267 1285 { 1286 1287 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1288 1268 1289 Int iSum; 1269 1290 Pel* piSrcTmp; … … 1277 1298 // { 1,2,1 } 1278 1299 iSum = piSrcTmp[0] + piSrcTmp[2] + (piSrcTmp[1] << 1); 1279 piDst[x] = Clip ( (iSum + 2) >> 2 );1300 piDst[x] = ClipY( (iSum + 2) >> 2 ); 1280 1301 piSrcTmp += 2; 1281 1302 } … … 1287 1308 Void TRenFilter::xSampleDownVer2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iSrcHeight, Pel* piDst, Int iDstStride ) 1288 1309 { 1310 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1311 1289 1312 Int iSum; 1290 1313 Pel* piSrcTmp; … … 1297 1320 // { 1,2,1 } 1298 1321 iSum = piSrcTmp[0] + piSrcTmp[ iSrcStride << 1] + (piSrcTmp[ iSrcStride ] << 1); 1299 piDst[x] = Clip ( (iSum + 2) >> 2 );1322 piDst[x] = ClipY( (iSum + 2) >> 2 ); 1300 1323 piSrcTmp += 1; 1301 1324 } … … 1307 1330 Void TRenFilter::xSampleDownHor4( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ) 1308 1331 { 1332 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1333 1309 1334 Int iSum; 1310 1335 Pel* piSrcTmp; … … 1323 1348 1324 1349 iSum = iTmp0 + (iTmp2 << 1) + ((iTmp1 + iTmp2) << 2); 1325 piDst[x] = Clip ( (iSum + 8) >> 4 );1350 piDst[x] = ClipY( (iSum + 8) >> 4 ); 1326 1351 piSrcTmp += 4; 1327 1352 } … … 1333 1358 Void TRenFilter::xSampleDownHor8( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ) 1334 1359 { 1360 assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth 1361 1335 1362 Int iSum; 1336 1363 Pel* piSrcTmp; … … 1350 1377 1351 1378 iSum = iTmp0 - iTmp2 + ( iTmp1 << 1) + ( (iTmp1 + iTmp3) << 2) + ((iTmp2 + iTmp3) << 4); 1352 piDst[x] = Clip ( (iSum + 32) >> 6 );1379 piDst[x] = ClipY( (iSum + 32) >> 6 ); 1353 1380 piSrcTmp += 8; 1354 1381 } … … 1432 1459 template Void TRenFilter::mirrorHor( TRenImage<Int> *pcImage ); 1433 1460 template Void TRenFilter::mirrorHor( TRenImagePlane<Pel> *pcImagePlane ); 1461 1462 #endif 1463 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenFilter.h
r438 r446 33 33 34 34 35 36 35 #ifndef __TRENFILTER__ 37 36 #define __TRENFILTER__ … … 40 39 #include "TRenImage.h" 41 40 #include "TRenInterpFilter.h" 41 #if H_3D 42 42 43 43 typedef Int (TRenInterpFilter::*FpChromaIntFilt) ( Pel*, Int ); … … 62 62 /////////// Comparison /////////// 63 63 64 static Int64 SSE ( PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2 );65 static Int64 SSE ( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight, Pel* piSrc2, Int iSrcStride2 );64 static Int64 SSE ( PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2, Bool bLuma ); 65 static Int64 SSE ( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight, Pel* piSrc2, Int iSrcStride2, Bool bLuma ); 66 66 67 67 template <typename T> static Bool compare (TRenImage<T> *pcInputImage1 , TRenImage<T> *pcInputImage2); … … 138 138 }; 139 139 140 140 #endif 141 141 #endif //__TRENFILTER__ -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenImage.cpp
r438 r446 37 37 #include "TRenFilter.h" 38 38 #include "assert.h" 39 #if H_3D 40 39 41 40 42 template<typename T> … … 66 68 m_uiNumberOfQuaterPlanes = 0; 67 69 m_apcPlanes = new TRenImagePlane<Pel>*[ m_uiNumberOfPlanes ]; 68 m_apcPlanes[0] = new TRenImagePlane<Pel>( pcPicYuv->getBufY(), pcPicYuv->getWidth() + (REN_LUMA_MARGIN << 1), pcPicYuv->getHeight()+ (REN_LUMA_MARGIN << 1), pcPicYuv->getStride (), REN_LUMA_MARGIN , g_uiPCMBitDepthLuma);70 m_apcPlanes[0] = new TRenImagePlane<Pel>( pcPicYuv->getBufY(), pcPicYuv->getWidth() + (REN_LUMA_MARGIN << 1), pcPicYuv->getHeight()+ (REN_LUMA_MARGIN << 1), pcPicYuv->getStride (), REN_LUMA_MARGIN ); 69 71 } 70 72 else //420 … … 75 77 76 78 m_apcPlanes = new TRenImagePlane<Pel>*[ m_uiNumberOfPlanes ]; 77 m_apcPlanes[0] = new TRenImagePlane<Pel>( pcPicYuv->getBufY(), pcPicYuv->getWidth() + (REN_LUMA_MARGIN << 1), pcPicYuv->getHeight() + (REN_LUMA_MARGIN << 1), pcPicYuv->getStride (), REN_LUMA_MARGIN , g_uiPCMBitDepthLuma);78 m_apcPlanes[1] = new TRenImagePlane<Pel>( pcPicYuv->getBufU(), (pcPicYuv->getWidth()>>1)+ REN_LUMA_MARGIN , (pcPicYuv->getHeight()>>1) + REN_LUMA_MARGIN , pcPicYuv->getCStride(), REN_LUMA_MARGIN >> 1 , g_uiPCMBitDepthChroma);79 m_apcPlanes[2] = new TRenImagePlane<Pel>( pcPicYuv->getBufV(), (pcPicYuv->getWidth()>>1)+ REN_LUMA_MARGIN , (pcPicYuv->getHeight()>>1) + REN_LUMA_MARGIN , pcPicYuv->getCStride(), REN_LUMA_MARGIN >> 1 , g_uiPCMBitDepthChroma);79 m_apcPlanes[0] = new TRenImagePlane<Pel>( pcPicYuv->getBufY(), pcPicYuv->getWidth() + (REN_LUMA_MARGIN << 1), pcPicYuv->getHeight() + (REN_LUMA_MARGIN << 1), pcPicYuv->getStride (), REN_LUMA_MARGIN ); 80 m_apcPlanes[1] = new TRenImagePlane<Pel>( pcPicYuv->getBufU(), (pcPicYuv->getWidth()>>1)+ REN_LUMA_MARGIN , (pcPicYuv->getHeight()>>1) + REN_LUMA_MARGIN , pcPicYuv->getCStride(), REN_LUMA_MARGIN >> 1 ); 81 m_apcPlanes[2] = new TRenImagePlane<Pel>( pcPicYuv->getBufV(), (pcPicYuv->getWidth()>>1)+ REN_LUMA_MARGIN , (pcPicYuv->getHeight()>>1) + REN_LUMA_MARGIN , pcPicYuv->getCStride(), REN_LUMA_MARGIN >> 1 ); 80 82 } 81 83 } … … 132 134 assert( uiNumberOfFullPlanes + uiNumberOfQuaterPlanes); 133 135 134 UInt uiHalfWidth = uiWidth >> 1;135 UInt uiHalfHeight = uiHeight >> 1;136 UInt uiHalfWidth = uiWidth / 2; 137 UInt uiHalfHeight = uiHeight / 2; 136 138 137 139 uiHalfWidth = (uiHalfWidth == 0) ? 1 : uiHalfWidth ; … … 146 148 for (UInt uiCurPlane = 0; uiCurPlane < uiNumberOfFullPlanes; uiCurPlane++) 147 149 { 148 this->m_apcPlanes[uiCurPlane] = new TRenImagePlane<T>(uiWidth, uiHeight, REN_LUMA_MARGIN , g_uiPCMBitDepthLuma);150 this->m_apcPlanes[uiCurPlane] = new TRenImagePlane<T>(uiWidth, uiHeight, REN_LUMA_MARGIN); 149 151 }; 150 152 151 153 for (UInt uiCurPlane = 0; uiCurPlane < uiNumberOfQuaterPlanes; uiCurPlane++) 152 154 { 153 this->m_apcPlanes[uiCurPlane+uiNumberOfFullPlanes] = new TRenImagePlane<T>(uiHalfWidth, uiHalfHeight, REN_LUMA_MARGIN >> 1 , g_uiPCMBitDepthChroma);155 this->m_apcPlanes[uiCurPlane+uiNumberOfFullPlanes] = new TRenImagePlane<T>(uiHalfWidth, uiHalfHeight, REN_LUMA_MARGIN >> 1); 154 156 }; 155 157 } … … 231 233 for (UInt uiCurPlane = 1; uiCurPlane < m_uiNumberOfPlanes; uiCurPlane++) 232 234 { 233 m_apcPlanes[uiCurPlane]->assign( (Pel) ( (g_uiIBDI_MAX+1) >> 1) );235 m_apcPlanes[uiCurPlane]->assign( (Pel) ( 1 << ( g_bitDepthC - 1 ) ) ); 234 236 } 235 237 } … … 270 272 template Void TRenImage<Pel>::assign<Pel> (TRenImage<Pel>* ); 271 273 274 #endif // H_3D -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenImage.h
r438 r446 39 39 #include "../TLibCommon/TComPicYuv.h" 40 40 #include "TRenImagePlane.h" 41 #if H_3D 41 42 42 43 … … 99 100 }; 100 101 102 #endif // H_3D 101 103 #endif // __TRENIMAGE__ 102 104 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenImagePlane.cpp
r438 r446 36 36 #include "TRenFilter.h" 37 37 #include <string.h> 38 #if H_3D 39 38 40 /////// TRenImagePlane /////// 39 41 … … 42 44 43 45 template<class T> 44 TRenImagePlane<T>::TRenImagePlane(UInt uiWidth, UInt uiHeight, UInt uiPad, UInt uiBitDepth ) 45 : m_uiWidth (uiWidth), 46 m_uiHeight (uiHeight), 47 m_uiStride (uiWidth+2*uiPad), 48 m_uiWidthOrg (uiWidth+2*uiPad), 49 m_uiHeightOrg(uiHeight+2*uiPad), 50 m_uiPad (uiPad), 51 m_uiBitDepth (uiBitDepth) 46 TRenImagePlane<T>::TRenImagePlane(UInt uiWidth, UInt uiHeight, UInt uiPad) 47 : m_uiWidth(uiWidth), m_uiHeight(uiHeight), m_uiStride(uiWidth+2*uiPad), m_uiWidthOrg(uiWidth+2*uiPad), m_uiHeightOrg(uiHeight+2*uiPad), m_uiPad(uiPad) 52 48 { 53 49 m_pcDataOrg = new T[ m_uiWidthOrg * m_uiHeightOrg ]; … … 58 54 template<class T> 59 55 TRenImagePlane<T>::TRenImagePlane(TRenImagePlane* pcPlane) 60 : m_uiWidth 61 , m_uiHeight 62 , m_uiStride 63 , m_uiWidthOrg 56 : m_uiWidth (pcPlane->getWidth ()) 57 , m_uiHeight (pcPlane->getHeight ()) 58 , m_uiStride (pcPlane->getStride ()) 59 , m_uiWidthOrg(pcPlane->getWidthOrg()) 64 60 , m_uiHeightOrg(pcPlane->getHeightOrg()) 65 , m_uiPad (pcPlane->getPad ()) 66 , m_uiBitDepth (pcPlane->getBitDepth()) 61 , m_uiPad (pcPlane->getPad ()) 67 62 { 68 63 m_pcData = new T[m_uiWidthOrg*m_uiHeightOrg]; … … 72 67 73 68 template<typename T> 74 TRenImagePlane<T>::TRenImagePlane( T* pcDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad , UInt uiBitDepth)69 TRenImagePlane<T>::TRenImagePlane( T* pcDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad ) 75 70 : m_pcData (pcDataOrg + uiStride * uiPad + uiPad ) 76 71 , m_uiWidth (uiWidthOrg - 2* uiPad ) … … 82 77 , m_uiPad (uiPad ) 83 78 , m_bClean (false ) 84 , m_uiBitDepth (uiBitDepth )85 79 { 86 80 … … 519 513 template<typename T> 520 514 TRenImagePlanePart<T>::TRenImagePlanePart( TRenImagePlane<T>* pPlane, UInt uHorOff, UInt uVerOff, UInt uWidth, UInt uHeight ) 521 : TRenImagePlane<T>( pPlane->getPlaneData() + uHorOff + uVerOff * pPlane->getStride(), uWidth, uHeight, pPlane->getStride(),0 , pPlane->getBitDepth())515 : TRenImagePlane<T>( pPlane->getPlaneData() + uHorOff + uVerOff * pPlane->getStride(), uWidth, uHeight, pPlane->getStride(),0) 522 516 { 523 517 … … 534 528 template class TRenImagePlanePart<Bool>; 535 529 template class TRenImagePlanePart<Int>; 530 #endif // H_3D -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenImagePlane.h
r438 r446 39 39 #include "../TLibCommon/TComPicYuv.h" 40 40 41 #if H_3D 41 42 #define PelImagePlane TRenImagePlane<Pel> 42 43 #define DoubleImagePlane TRenImagePlane<Double> … … 49 50 // Construction 50 51 TRenImagePlane(); 51 TRenImagePlane( UInt uiWidth, UInt uiHeight, UInt uiPad , UInt uiBitDepth);52 TRenImagePlane( UInt uiWidth, UInt uiHeight, UInt uiPad); 52 53 TRenImagePlane( TRenImagePlane* pcInputPlane ); 53 TRenImagePlane( T* pcDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad , UInt uiBitDepth);54 TRenImagePlane( T* pcDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad ); 54 55 55 56 ~TRenImagePlane(); … … 64 65 UInt getHeightOrg() { return m_uiHeightOrg; }; 65 66 UInt getPad () { return m_uiPad; }; 66 UInt getBitDepth () { return m_uiBitDepth; };67 67 UInt getStride () { return m_uiStride; }; 68 68 … … 106 106 UInt m_uiHeightOrg; 107 107 UInt m_uiPad; 108 UInt m_uiBitDepth;109 108 109 Double m_dRatio; 110 110 Bool m_bClean; 111 111 … … 122 122 }; 123 123 124 #endif // H_3D 124 125 #endif // __TRENIMAGEPLANE__ -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenInterpFilter.cpp
r438 r446 39 39 40 40 #include "TRenInterpFilter.h" 41 #if H_3D 41 42 42 43 // ==================================================================================================================== … … 49 50 } 50 51 52 #endif // H_3D -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenInterpFilter.h
r438 r446 44 44 #include "TLibCommon/CommonDef.h" 45 45 #include "assert.h" 46 #if H_3D 47 46 48 // ==================================================================================================================== 47 49 // Constants … … 103 105 __inline Int xCTI_Filter_VI04_C_OCT3( Int* pSrc, Int iStride ); 104 106 105 #if HIGH_ACCURACY_BI106 __inline Void xCTI_FilterHalfHor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //107 __inline Void xCTI_FilterHalfHor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst);//108 109 110 __inline Void xCTI_FilterQuarter0Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //111 __inline Void xCTI_FilterQuarter0Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //112 113 __inline Void xCTI_FilterQuarter1Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //114 __inline Void xCTI_FilterQuarter1Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //115 116 __inline Void xCTI_FilterHalfVer_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); //117 118 __inline Void xCTI_FilterQuarter0Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst );119 __inline Void xCTI_FilterQuarter1Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst );120 121 __inline Void xCTI_Filter1DHorC_ha (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV);122 __inline Void xCTI_Filter1DVerC_ha (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV);123 __inline Void xCTI_Filter2DHorC_ha (Int* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV);124 125 #endif126 107 }; 127 108 128 #if HIGH_ACCURACY_BI 129 __inline Void TRenInterpFilter::xCTI_FilterHalfHor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 130 { 109 110 // ------------------------------------------------------------------------------------------------ 111 // DCTIF filters 112 // ------------------------------------------------------------------------------------------------ 113 114 __inline Void TRenInterpFilter::xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 115 { 116 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 117 131 118 Pel* piDst = rpiDst; 132 119 Int iSum; 133 120 Pel* piSrcTmp; 134 135 121 Int iSrcStep2 = iSrcStep*2; 136 122 Int iSrcStep3 = iSrcStep*3; … … 141 127 142 128 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; 143 Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; 144 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; 129 145 130 for ( Int y = iHeight; y != 0; y-- ) 146 131 { … … 160 145 + ( iTmpA << 1 ) 161 146 - iTmp0 - iTmp2; 162 #if REMOVE_INTERMEDIATE_CLIPPING 163 piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; 164 #else 165 piDst [x * iDstStep] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); 166 #endif 167 147 148 piDst [x * iDstStep] = ClipY( (iSum + 32) >> 6 ); 168 149 piSrcTmp += iSrcStep; 169 150 } … … 172 153 } 173 154 return; 174 175 } 176 177 __inline Void TRenInterpFilter::xCTI_FilterHalfHor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 178 { 155 } 156 157 __inline Void TRenInterpFilter::xCTI_FilterHalfHor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 158 { 159 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 160 179 161 Pel* piDst = rpiDst; 180 162 Int iSum; 181 163 Int* piSrcTmp; 182 183 164 Int iSrcStep2 = iSrcStep*2; 184 165 Int iSrcStep3 = iSrcStep*3; … … 189 170 190 171 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; 191 Int shiftNum = 6 + g_uiBitIncrement + g_uiBitDepth - 8; 192 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; 172 193 173 for ( Int y = iHeight; y != 0; y-- ) 194 174 { … … 209 189 - iTmp0 - iTmp2; 210 190 211 #if REMOVE_INTERMEDIATE_CLIPPING 212 piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; 213 #else 214 piDst [x * iDstStep] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); 215 #endif 216 191 piDst [x * iDstStep] = ClipY( (iSum + 2048) >> 12 ); 217 192 piSrcTmp += iSrcStep; 218 193 } … … 221 196 } 222 197 return; 223 224 } 225 226 227 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 228 { 198 } 199 200 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 201 { 202 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 229 203 Pel* piDst = rpiDst; 230 204 Int iSum; 231 205 Pel* piSrcTmp; 232 233 206 Int iSrcStep2 = iSrcStep*2; 234 207 Int iSrcStep3 = iSrcStep*3; … … 239 212 240 213 Int iTmp1, iTmp2; 241 Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; 242 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; 214 243 215 for ( Int y = iHeight; y != 0; y-- ) 244 216 { … … 252 224 253 225 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] 254 - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 ) 255 + ( piSrcTmp[iSrcStep] << 2 ) 256 - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 ) 257 + ( piSrcTmp[iSrcStep4] << 4 ) 258 + ( piSrcTmp[iSrcStep3] << 6); 259 260 #if REMOVE_INTERMEDIATE_CLIPPING 261 piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; 262 #else 263 piDst [x * iDstStep] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); 264 #endif 226 - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 ) 227 + ( piSrcTmp[iSrcStep] << 2 ) 228 - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 ) 229 + ( piSrcTmp[iSrcStep4] << 4 ); 230 231 piDst [x * iDstStep] = ClipY(( (iSum + 32) >> 6 )+ piSrcTmp[iSrcStep3]); 265 232 piSrcTmp += iSrcStep; 266 233 } … … 271 238 } 272 239 273 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 274 { 240 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 241 { 242 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 243 275 244 Pel* piDst = rpiDst; 276 245 Int iSum; 277 246 Int* piSrcTmp; 278 279 247 Int iSrcStep2 = iSrcStep*2; 280 248 Int iSrcStep3 = iSrcStep*3; … … 283 251 Int iSrcStep6 = iSrcStep*6; 284 252 Int iSrcStep7 = iSrcStep*7; 285 Int shiftNum = 6 + g_uiBitIncrement + g_uiBitDepth - 8; 286 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; 253 287 254 Int iTmp1, iTmp2; 288 255 … … 304 271 + ( piSrcTmp[iSrcStep3] << 6 ); 305 272 306 #if REMOVE_INTERMEDIATE_CLIPPING 307 piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; 308 #else 309 piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); 310 #endif 273 piDst [x * iDstStep] = ClipY( (iSum + 2048) >> 12 ); 311 274 piSrcTmp += iSrcStep; 312 275 } … … 315 278 } 316 279 return; 317 318 } 319 320 321 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 322 { 280 } 281 282 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 283 { 284 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 323 285 Pel* piDst = rpiDst; 324 286 Int iSum; 325 287 Pel* piSrcTmp; 326 327 288 Int iSrcStep2 = iSrcStep*2; 328 289 Int iSrcStep3 = iSrcStep*3; … … 331 292 Int iSrcStep6 = iSrcStep*6; 332 293 Int iSrcStep7 = iSrcStep*7; 333 Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; 334 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; 294 295 Int iTmp1, iTmp2; 296 for ( Int y = iHeight; y != 0; y-- ) 297 { 298 piSrcTmp = &piSrc[ -3*iSrcStep ]; 299 for ( Int x = 0; x < iWidth; x++ ) 300 { 301 // {-1, 3, -7, 19, 57, -10, 4, -1 }, 302 303 iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2]; 304 iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3]; 305 306 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] 307 - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 ) 308 + ( piSrcTmp[iSrcStep6] << 2 ) 309 - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 ) 310 + ( piSrcTmp[iSrcStep3] << 4 ); 311 312 piDst [x * iDstStep] = ClipY( ((iSum + 32) >> 6) + piSrcTmp[iSrcStep4] ); 313 piSrcTmp += iSrcStep; 314 } 315 piSrc += iSrcStride; 316 piDst += iDstStride; 317 } 318 return; 319 } 320 321 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 322 { 323 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 324 325 Pel* piDst = rpiDst; 326 Int iSum; 327 Int* piSrcTmp; 328 Int iSrcStep2 = iSrcStep*2; 329 Int iSrcStep3 = iSrcStep*3; 330 Int iSrcStep4 = iSrcStep*4; 331 Int iSrcStep5 = iSrcStep*5; 332 Int iSrcStep6 = iSrcStep*6; 333 Int iSrcStep7 = iSrcStep*7; 335 334 336 335 Int iTmp1, iTmp2; … … 351 350 + ( piSrcTmp[iSrcStep3] << 4 ) 352 351 + ( piSrcTmp[iSrcStep4] << 6 ); 353 354 #if REMOVE_INTERMEDIATE_CLIPPING 355 piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; 356 #else 357 piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); 358 #endif 352 353 piDst [x * iDstStep] = ClipY( (iSum + 2048) >> 12 ); 359 354 piSrcTmp += iSrcStep; 360 355 } … … 363 358 } 364 359 return; 365 366 367 } 368 369 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 370 { 371 Pel* piDst = rpiDst; 372 Int iSum; 373 Int* piSrcTmp; 374 375 Int iSrcStep2 = iSrcStep*2; 376 Int iSrcStep3 = iSrcStep*3; 377 Int iSrcStep4 = iSrcStep*4; 378 Int iSrcStep5 = iSrcStep*5; 379 Int iSrcStep6 = iSrcStep*6; 380 Int iSrcStep7 = iSrcStep*7; 381 Int shiftNum = 6+g_uiBitIncrement + g_uiBitDepth - 8; 382 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; 383 Int iTmp1, iTmp2; 360 } 361 362 __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel ) 363 { 364 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 365 Int* piDst = rpiDst; 366 Pel* piDstPel = rpiDstPel; 367 Int iSum; 368 Pel* piSrcTmp; 369 Int iSrcStride2 = iSrcStride*2; 370 Int iSrcStride3 = iSrcStride*3; 371 Int iSrcStride4 = iSrcStride*4; 372 Int iSrcStride5 = iSrcStride*5; 373 Int iSrcStride6 = iSrcStride*6; 374 Int iSrcStride7 = iSrcStride*7; 375 376 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; 384 377 for ( Int y = iHeight; y != 0; y-- ) 385 378 { 386 piSrcTmp = &piSrc[ -3*iSrcSt ep];379 piSrcTmp = &piSrc[ -3*iSrcStride ]; 387 380 for ( Int x = 0; x < iWidth; x++ ) 388 381 { 389 // {-1, 3, -7, 19, 57, -10, 4, -1 }, 390 391 iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2]; 392 iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3]; 393 394 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] 395 - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 ) 396 + ( piSrcTmp[iSrcStep6] << 2 ) 397 - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 ) 398 + ( piSrcTmp[iSrcStep3] << 4 ) 399 + ( piSrcTmp[iSrcStep4] << 6 ); 400 401 #if REMOVE_INTERMEDIATE_CLIPPING 402 piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; 403 #else 404 piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); 405 #endif 382 // { -1,4,-11,40,40,-11,4,-1 } 383 iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; 384 iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; 385 iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; 386 iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; 387 388 iTmpA = (iTmp3 << 2) - iTmp2; 389 390 iSum = ( iTmp1 << 2 ) 391 + ( iTmpA << 3 ) 392 + ( iTmpA << 1 ) 393 - iTmp0 - iTmp2; 394 395 piDst[x * iDstStep] = iSum; 396 piDstPel[x * iDstStep] = ClipY( (iSum + 32) >> 6 ); 406 397 piSrcTmp += iSrcStep; 407 398 } 408 399 piSrc += iSrcStride; 409 400 piDst += iDstStride; 410 } 411 return; 412 413 } 414 415 416 417 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 418 { 401 piDstPel += iDstStridePel; 402 } 403 return; 404 } 405 406 __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst) 407 { 408 Int* piDst = rpiDst; 409 Int iSum; 410 Pel* piSrcTmp; 411 Int iSrcStride2 = iSrcStride*2; 412 Int iSrcStride3 = iSrcStride*3; 413 Int iSrcStride4 = iSrcStride*4; 414 Int iSrcStride5 = iSrcStride*5; 415 Int iSrcStride6 = iSrcStride*6; 416 Int iSrcStride7 = iSrcStride*7; 417 418 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; 419 for ( Int y = iHeight; y != 0; y-- ) 420 { 421 piSrcTmp = &piSrc[ -3*iSrcStride ]; 422 for ( Int x = 0; x < iWidth; x++ ) 423 { 424 // { -1,4,-11,40,40,-11,4,-1 } 425 iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; 426 iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; 427 iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; 428 iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; 429 430 iTmpA = (iTmp3 << 2) - iTmp2; 431 432 iSum = ( iTmp1 << 2 ) 433 + ( iTmpA << 3 ) 434 + ( iTmpA << 1 ) 435 - iTmp0 - iTmp2; 436 437 piDst[x * iDstStep] = iSum; 438 piSrcTmp += iSrcStep; 439 } 440 piSrc += iSrcStride; 441 piDst += iDstStride; 442 } 443 return; 444 } 445 446 __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 447 { 448 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 419 449 Pel* piDst = rpiDst; 420 450 Int iSum; … … 427 457 Int iSrcStride6 = iSrcStride*6; 428 458 Int iSrcStride7 = iSrcStride*7; 429 Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; 430 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; 431 Int iTmp1, iTmp2; 459 460 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; 432 461 for ( Int y = iHeight; y != 0; y-- ) 433 462 { … … 435 464 for ( Int x = 0; x < iWidth; x++ ) 436 465 { 437 // {-1, 4, -10, 57, 19, -7, 3, -1 }, 438 439 iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5]; 440 iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4]; 441 442 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] 443 - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 ) 444 + ( piSrcTmp[iSrcStride] << 2 ) 445 - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 ) 446 + ( piSrcTmp[iSrcStride4] << 4 ) 447 + ( piSrcTmp[iSrcStride3] << 6); 448 449 #if REMOVE_INTERMEDIATE_CLIPPING 450 piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; 451 #else 452 piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); 453 #endif 466 // { -1,4,-11,40,40,-11,4,-1 } 467 iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; 468 iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; 469 iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; 470 iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; 471 472 iTmpA = (iTmp3 << 2) - iTmp2; 473 474 iSum = ( iTmp1 << 2 ) 475 + ( iTmpA << 3 ) 476 + ( iTmpA << 1 ) 477 - iTmp0 - iTmp2; 478 479 piDst[x * iDstStep] = ClipY( (iSum + 32) >> 6 ); 454 480 piSrcTmp += iSrcStep; 455 481 } … … 458 484 } 459 485 return; 460 461 } 462 463 464 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 465 { 466 Pel* piDst = rpiDst; 486 } 487 488 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst) 489 { 490 Int* piDst = rpiDst; 467 491 Int iSum; 468 492 Pel* piSrcTmp; 469 470 493 Int iSrcStride2 = iSrcStride*2; 471 494 Int iSrcStride3 = iSrcStride*3; … … 474 497 Int iSrcStride6 = iSrcStride*6; 475 498 Int iSrcStride7 = iSrcStride*7; 476 Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; 477 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; 499 478 500 Int iTmp1, iTmp2; 479 480 501 for ( Int y = iHeight; y != 0; y-- ) 481 502 { … … 483 504 for ( Int x = 0; x < iWidth; x++ ) 484 505 { 485 /// {-1, 3, -7, 19, 57, -10, 4, -1 }, 486 iTmp1 = piSrcTmp[iSrcStride4] + piSrcTmp[iSrcStride2]; 487 iTmp2 = piSrcTmp[iSrcStride ] + piSrcTmp[iSrcStride3]; 506 // {-1, 4, -10, 57, 19, -7, 3, -1 }, 507 508 iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5]; 509 iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4]; 488 510 489 511 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] 490 - ( ( piSrcTmp[iSrcStride5] - iTmp2 ) << 1 ) 491 + ( piSrcTmp[iSrcStride6] << 2 ) 492 - ( ( piSrcTmp[iSrcStride5] + iTmp1 ) << 3 ) 493 + ( piSrcTmp[iSrcStride3] << 4 ) 494 + ( piSrcTmp[iSrcStride4] << 6 ); 495 496 #if REMOVE_INTERMEDIATE_CLIPPING 497 piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; 498 #else 499 piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); 500 #endif 512 - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 ) 513 + ( piSrcTmp[iSrcStride] << 2 ) 514 - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 ) 515 + ( piSrcTmp[iSrcStride4] << 4 ) 516 + ( piSrcTmp[iSrcStride3] << 6 ); 517 518 piDst[x * iDstStep] = iSum; 501 519 piSrcTmp += iSrcStep; 502 520 } … … 505 523 } 506 524 return; 507 508 } 509 510 __inline Void TRenInterpFilter::xCTI_FilterHalfVer_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 511 { 525 } 526 527 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 528 { 529 assert( g_bitDepthC == g_bitDepthY ); // ToDo: Update renderer to work with different luma/chroma bit depth 512 530 Pel* piDst = rpiDst; 513 531 Int iSum; … … 520 538 Int iSrcStride6 = iSrcStride*6; 521 539 Int iSrcStride7 = iSrcStride*7; 522 Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8;523 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;524 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;525 for ( Int y = iHeight; y != 0; y-- )526 {527 piSrcTmp = &piSrc[ -3*iSrcStride ];528 for ( Int x = 0; x < iWidth; x++ )529 {530 // { -1,4,-11,40,40,-11,4,-1 }531 iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7];532 iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];533 iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];534 iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];535 536 iTmpA = (iTmp3 << 2) - iTmp2;537 538 iSum = ( iTmp1 << 2 )539 + ( iTmpA << 3 )540 + ( iTmpA << 1 )541 - iTmp0 - iTmp2;542 543 #if REMOVE_INTERMEDIATE_CLIPPING544 piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum;545 #else546 piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum );547 #endif548 piSrcTmp += iSrcStep;549 }550 piSrc += iSrcStride;551 piDst += iDstStride;552 }553 return;554 555 }556 557 558 #endif559 560 // ------------------------------------------------------------------------------------------------561 // DCTIF filters562 // ------------------------------------------------------------------------------------------------563 564 __inline Void TRenInterpFilter::xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)565 {566 Pel* piDst = rpiDst;567 Int iSum;568 Pel* piSrcTmp;569 Int iSrcStep2 = iSrcStep*2;570 Int iSrcStep3 = iSrcStep*3;571 Int iSrcStep4 = iSrcStep*4;572 Int iSrcStep5 = iSrcStep*5;573 Int iSrcStep6 = iSrcStep*6;574 Int iSrcStep7 = iSrcStep*7;575 576 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;577 578 for ( Int y = iHeight; y != 0; y-- )579 {580 piSrcTmp = &piSrc[ -3*iSrcStep ];581 for ( Int x = 0; x < iWidth; x++ )582 {583 // { -1,4,-11,40,40,-11,4,-1 }584 iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStep7];585 iTmp1 = piSrcTmp[iSrcStep]+piSrcTmp[iSrcStep6];586 iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5];587 iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4];588 589 iTmpA = (iTmp3 << 2) - iTmp2;590 591 iSum = ( iTmp1 << 2 )592 + ( iTmpA << 3 )593 + ( iTmpA << 1 )594 - iTmp0 - iTmp2;595 596 piDst [x * iDstStep] = ClipY( (iSum + 32) >> 6 );597 piSrcTmp += iSrcStep;598 }599 piSrc += iSrcStride;600 piDst += iDstStride;601 }602 return;603 }604 605 __inline Void TRenInterpFilter::xCTI_FilterHalfHor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)606 {607 Pel* piDst = rpiDst;608 Int iSum;609 Int* piSrcTmp;610 Int iSrcStep2 = iSrcStep*2;611 Int iSrcStep3 = iSrcStep*3;612 Int iSrcStep4 = iSrcStep*4;613 Int iSrcStep5 = iSrcStep*5;614 Int iSrcStep6 = iSrcStep*6;615 Int iSrcStep7 = iSrcStep*7;616 617 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;618 619 for ( Int y = iHeight; y != 0; y-- )620 {621 piSrcTmp = &piSrc[ -3*iSrcStep ];622 for ( Int x = 0; x < iWidth; x++ )623 {624 // { -1,4,-11,40,40,-11,4,-1 }625 iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStep7];626 iTmp1 = piSrcTmp[iSrcStep ]+piSrcTmp[iSrcStep6];627 iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5];628 iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4];629 630 iTmpA = (iTmp3 << 2) - iTmp2;631 632 iSum = ( iTmp1 << 2 )633 + ( iTmpA << 3 )634 + ( iTmpA << 1 )635 - iTmp0 - iTmp2;636 637 piDst [x * iDstStep] = ClipY( (iSum + 2048) >> 12 );638 piSrcTmp += iSrcStep;639 }640 piSrc += iSrcStride;641 piDst += iDstStride;642 }643 return;644 }645 646 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)647 {648 Pel* piDst = rpiDst;649 Int iSum;650 Pel* piSrcTmp;651 Int iSrcStep2 = iSrcStep*2;652 Int iSrcStep3 = iSrcStep*3;653 Int iSrcStep4 = iSrcStep*4;654 Int iSrcStep5 = iSrcStep*5;655 Int iSrcStep6 = iSrcStep*6;656 Int iSrcStep7 = iSrcStep*7;657 658 Int iTmp1, iTmp2;659 660 for ( Int y = iHeight; y != 0; y-- )661 {662 piSrcTmp = &piSrc[ -3*iSrcStep ];663 for ( Int x = 0; x < iWidth; x++ )664 {665 // {-1, 4, -10, 57, 19, -7, 3, -1 },666 667 iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5];668 iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4];669 670 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]671 - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 )672 + ( piSrcTmp[iSrcStep] << 2 )673 - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 )674 + ( piSrcTmp[iSrcStep4] << 4 );675 676 piDst [x * iDstStep] = ClipY(( (iSum + 32) >> 6 )+ piSrcTmp[iSrcStep3]);677 piSrcTmp += iSrcStep;678 }679 piSrc += iSrcStride;680 piDst += iDstStride;681 }682 return;683 }684 685 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)686 {687 Pel* piDst = rpiDst;688 Int iSum;689 Int* piSrcTmp;690 Int iSrcStep2 = iSrcStep*2;691 Int iSrcStep3 = iSrcStep*3;692 Int iSrcStep4 = iSrcStep*4;693 Int iSrcStep5 = iSrcStep*5;694 Int iSrcStep6 = iSrcStep*6;695 Int iSrcStep7 = iSrcStep*7;696 697 Int iTmp1, iTmp2;698 699 for ( Int y = iHeight; y != 0; y-- )700 {701 piSrcTmp = &piSrc[ -3*iSrcStep ];702 for ( Int x = 0; x < iWidth; x++ )703 {704 // {-1, 4, -10, 57, 19, -7, 3, -1 },705 706 iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5];707 iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4];708 709 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]710 - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 )711 + ( piSrcTmp[iSrcStep] << 2 )712 - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 )713 + ( piSrcTmp[iSrcStep4] << 4 )714 + ( piSrcTmp[iSrcStep3] << 6 );715 716 piDst [x * iDstStep] = ClipY( (iSum + 2048) >> 12 );717 piSrcTmp += iSrcStep;718 }719 piSrc += iSrcStride;720 piDst += iDstStride;721 }722 return;723 }724 725 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)726 {727 Pel* piDst = rpiDst;728 Int iSum;729 Pel* piSrcTmp;730 Int iSrcStep2 = iSrcStep*2;731 Int iSrcStep3 = iSrcStep*3;732 Int iSrcStep4 = iSrcStep*4;733 Int iSrcStep5 = iSrcStep*5;734 Int iSrcStep6 = iSrcStep*6;735 Int iSrcStep7 = iSrcStep*7;736 737 Int iTmp1, iTmp2;738 for ( Int y = iHeight; y != 0; y-- )739 {740 piSrcTmp = &piSrc[ -3*iSrcStep ];741 for ( Int x = 0; x < iWidth; x++ )742 {743 // {-1, 3, -7, 19, 57, -10, 4, -1 },744 745 iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2];746 iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3];747 748 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]749 - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 )750 + ( piSrcTmp[iSrcStep6] << 2 )751 - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 )752 + ( piSrcTmp[iSrcStep3] << 4 );753 754 piDst [x * iDstStep] = Clip( ((iSum + 32) >> 6) + piSrcTmp[iSrcStep4] );755 piSrcTmp += iSrcStep;756 }757 piSrc += iSrcStride;758 piDst += iDstStride;759 }760 return;761 }762 763 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)764 {765 Pel* piDst = rpiDst;766 Int iSum;767 Int* piSrcTmp;768 Int iSrcStep2 = iSrcStep*2;769 Int iSrcStep3 = iSrcStep*3;770 Int iSrcStep4 = iSrcStep*4;771 Int iSrcStep5 = iSrcStep*5;772 Int iSrcStep6 = iSrcStep*6;773 Int iSrcStep7 = iSrcStep*7;774 775 Int iTmp1, iTmp2;776 for ( Int y = iHeight; y != 0; y-- )777 {778 piSrcTmp = &piSrc[ -3*iSrcStep ];779 for ( Int x = 0; x < iWidth; x++ )780 {781 // {-1, 3, -7, 19, 57, -10, 4, -1 },782 783 iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2];784 iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3];785 786 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]787 - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 )788 + ( piSrcTmp[iSrcStep6] << 2 )789 - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 )790 + ( piSrcTmp[iSrcStep3] << 4 )791 + ( piSrcTmp[iSrcStep4] << 6 );792 793 piDst [x * iDstStep] = Clip( (iSum + 2048) >> 12 );794 piSrcTmp += iSrcStep;795 }796 piSrc += iSrcStride;797 piDst += iDstStride;798 }799 return;800 }801 802 __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel )803 {804 Int* piDst = rpiDst;805 Pel* piDstPel = rpiDstPel;806 Int iSum;807 Pel* piSrcTmp;808 Int iSrcStride2 = iSrcStride*2;809 Int iSrcStride3 = iSrcStride*3;810 Int iSrcStride4 = iSrcStride*4;811 Int iSrcStride5 = iSrcStride*5;812 Int iSrcStride6 = iSrcStride*6;813 Int iSrcStride7 = iSrcStride*7;814 815 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;816 for ( Int y = iHeight; y != 0; y-- )817 {818 piSrcTmp = &piSrc[ -3*iSrcStride ];819 for ( Int x = 0; x < iWidth; x++ )820 {821 // { -1,4,-11,40,40,-11,4,-1 }822 iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7];823 iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];824 iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];825 iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];826 827 iTmpA = (iTmp3 << 2) - iTmp2;828 829 iSum = ( iTmp1 << 2 )830 + ( iTmpA << 3 )831 + ( iTmpA << 1 )832 - iTmp0 - iTmp2;833 834 piDst[x * iDstStep] = iSum;835 piDstPel[x * iDstStep] = Clip( (iSum + 32) >> 6 );836 piSrcTmp += iSrcStep;837 }838 piSrc += iSrcStride;839 piDst += iDstStride;840 piDstPel += iDstStridePel;841 }842 return;843 }844 845 __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst)846 {847 Int* piDst = rpiDst;848 Int iSum;849 Pel* piSrcTmp;850 Int iSrcStride2 = iSrcStride*2;851 Int iSrcStride3 = iSrcStride*3;852 Int iSrcStride4 = iSrcStride*4;853 Int iSrcStride5 = iSrcStride*5;854 Int iSrcStride6 = iSrcStride*6;855 Int iSrcStride7 = iSrcStride*7;856 857 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;858 for ( Int y = iHeight; y != 0; y-- )859 {860 piSrcTmp = &piSrc[ -3*iSrcStride ];861 for ( Int x = 0; x < iWidth; x++ )862 {863 // { -1,4,-11,40,40,-11,4,-1 }864 iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7];865 iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];866 iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];867 iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];868 869 iTmpA = (iTmp3 << 2) - iTmp2;870 871 iSum = ( iTmp1 << 2 )872 + ( iTmpA << 3 )873 + ( iTmpA << 1 )874 - iTmp0 - iTmp2;875 876 piDst[x * iDstStep] = iSum;877 piSrcTmp += iSrcStep;878 }879 piSrc += iSrcStride;880 piDst += iDstStride;881 }882 return;883 }884 885 __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)886 {887 Pel* piDst = rpiDst;888 Int iSum;889 Pel* piSrcTmp;890 891 Int iSrcStride2 = iSrcStride*2;892 Int iSrcStride3 = iSrcStride*3;893 Int iSrcStride4 = iSrcStride*4;894 Int iSrcStride5 = iSrcStride*5;895 Int iSrcStride6 = iSrcStride*6;896 Int iSrcStride7 = iSrcStride*7;897 898 Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;899 for ( Int y = iHeight; y != 0; y-- )900 {901 piSrcTmp = &piSrc[ -3*iSrcStride ];902 for ( Int x = 0; x < iWidth; x++ )903 {904 // { -1,4,-11,40,40,-11,4,-1 }905 iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7];906 iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];907 iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];908 iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];909 910 iTmpA = (iTmp3 << 2) - iTmp2;911 912 iSum = ( iTmp1 << 2 )913 + ( iTmpA << 3 )914 + ( iTmpA << 1 )915 - iTmp0 - iTmp2;916 917 piDst[x * iDstStep] = Clip( (iSum + 32) >> 6 );918 piSrcTmp += iSrcStep;919 }920 piSrc += iSrcStride;921 piDst += iDstStride;922 }923 return;924 }925 926 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst)927 {928 Int* piDst = rpiDst;929 Int iSum;930 Pel* piSrcTmp;931 Int iSrcStride2 = iSrcStride*2;932 Int iSrcStride3 = iSrcStride*3;933 Int iSrcStride4 = iSrcStride*4;934 Int iSrcStride5 = iSrcStride*5;935 Int iSrcStride6 = iSrcStride*6;936 Int iSrcStride7 = iSrcStride*7;937 938 Int iTmp1, iTmp2;939 for ( Int y = iHeight; y != 0; y-- )940 {941 piSrcTmp = &piSrc[ -3*iSrcStride ];942 for ( Int x = 0; x < iWidth; x++ )943 {944 // {-1, 4, -10, 57, 19, -7, 3, -1 },945 946 iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5];947 iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4];948 949 iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7]950 - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 )951 + ( piSrcTmp[iSrcStride] << 2 )952 - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 )953 + ( piSrcTmp[iSrcStride4] << 4 )954 + ( piSrcTmp[iSrcStride3] << 6 );955 956 piDst[x * iDstStep] = iSum;957 piSrcTmp += iSrcStep;958 }959 piSrc += iSrcStride;960 piDst += iDstStride;961 }962 return;963 }964 965 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)966 {967 Pel* piDst = rpiDst;968 Int iSum;969 Pel* piSrcTmp;970 971 Int iSrcStride2 = iSrcStride*2;972 Int iSrcStride3 = iSrcStride*3;973 Int iSrcStride4 = iSrcStride*4;974 Int iSrcStride5 = iSrcStride*5;975 Int iSrcStride6 = iSrcStride*6;976 Int iSrcStride7 = iSrcStride*7;977 540 978 541 Int iTmp1, iTmp2; … … 993 556 + ( piSrcTmp[iSrcStride4] << 4 ); 994 557 995 piDst[x * iDstStep] = Clip ( ((iSum + 32) >> 6) + piSrcTmp[iSrcStride3] );558 piDst[x * iDstStep] = ClipY( ((iSum + 32) >> 6) + piSrcTmp[iSrcStride3] ); 996 559 piSrcTmp += iSrcStep; 997 560 } … … 1043 606 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) 1044 607 { 608 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 609 1045 610 Pel* piDst = rpiDst; 1046 611 Int iSum; … … 1070 635 + ( piSrcTmp[iSrcStride3] << 4 ); 1071 636 1072 piDst[x * iDstStep] = Clip ( ((iSum + 32) >> 6) + piSrcTmp[iSrcStride4] );637 piDst[x * iDstStep] = ClipY( ((iSum + 32) >> 6) + piSrcTmp[iSrcStride4] ); 1073 638 piSrcTmp += iSrcStep; 1074 639 } … … 1211 776 __inline Void TRenInterpFilter::xCTI_Filter2DHorC(Int* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) 1212 777 { 778 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 1213 779 Pel* piDst = rpiDst; 1214 780 Int iSum; … … 1225 791 { 1226 792 iSum = xCTI_Filter_VI04_C_OCT0( piSrcTmp, 1 ); 1227 piDst [x ] = Clip ((iSum + 2048) >> 12 );793 piDst [x ] = ClipC ((iSum + 2048) >> 12 ); 1228 794 piSrcTmp++; 1229 795 } … … 1241 807 { 1242 808 iSum = xCTI_Filter_VI04_C_QUA0( piSrcTmp, 1 ); 1243 piDst [x ] = Clip ((iSum + 2048) >> 12 );809 piDst [x ] = ClipC ((iSum + 2048) >> 12 ); 1244 810 piSrcTmp++; 1245 811 } … … 1257 823 { 1258 824 iSum = xCTI_Filter_VI04_C_QUA1( piSrcTmp, 1 ); 1259 piDst [x ] = Clip ((iSum + 2048) >> 12 );825 piDst [x ] = ClipC ((iSum + 2048) >> 12 ); 1260 826 piSrcTmp++; 1261 827 } … … 1273 839 { 1274 840 iSum = xCTI_Filter_VI04_C_OCT1( piSrcTmp, 1 ); 1275 piDst [x ] = Clip ((iSum + 2048) >> 12 );841 piDst [x ] = ClipC ((iSum + 2048) >> 12 ); 1276 842 piSrcTmp++; 1277 843 } … … 1289 855 { 1290 856 iSum = xCTI_Filter_VI04_C_OCT2( piSrcTmp, 1 ); 1291 piDst [x ] = Clip ((iSum + 2048) >> 12 );857 piDst [x ] = ClipC ((iSum + 2048) >> 12 ); 1292 858 piSrcTmp++; 1293 859 } … … 1305 871 { 1306 872 iSum = xCTI_Filter_VI04_C_OCT3( piSrcTmp, 1 ); 1307 piDst [x ] = Clip ((iSum + 2048) >> 12 );873 piDst [x ] = ClipC ((iSum + 2048) >> 12 ); 1308 874 piSrcTmp++; 1309 875 } … … 1321 887 { 1322 888 iSum = xCTI_Filter_VIS04_C_HAL( piSrcTmp, 1 ); 1323 piDst [x ] = Clip ((iSum + 2048) >> 12 );889 piDst [x ] = ClipC ((iSum + 2048) >> 12 ); 1324 890 piSrcTmp++; 1325 891 } … … 1338 904 __inline Void TRenInterpFilter::xCTI_Filter1DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) 1339 905 { 906 assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth 907 1340 908 Pel* piDst = rpiDst; 1341 909 Int iSum; … … 1352 920 { 1353 921 iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, iSrcStride ); 1354 piDst[x ] = Clip ((iSum + 32) >> 6 );922 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1355 923 piSrcTmp++; 1356 924 } … … 1368 936 { 1369 937 iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, iSrcStride ); 1370 piDst[x ] = Clip ((iSum + 32) >> 6 );938 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1371 939 piSrcTmp++; 1372 940 } … … 1384 952 { 1385 953 iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, iSrcStride ); 1386 piDst[x ] = Clip ((iSum + 32) >> 6 );954 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1387 955 piSrcTmp++; 1388 956 } … … 1400 968 { 1401 969 iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, iSrcStride ); 1402 piDst[x ] = Clip ((iSum + 32) >> 6 );970 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1403 971 piSrcTmp++; 1404 972 } … … 1416 984 { 1417 985 iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, iSrcStride ); 1418 piDst[x ] = Clip ((iSum + 32) >> 6 );986 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1419 987 piSrcTmp++; 1420 988 } … … 1432 1000 { 1433 1001 iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, iSrcStride ); 1434 piDst[x ] = Clip ((iSum + 32) >> 6 );1002 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1435 1003 piSrcTmp++; 1436 1004 } … … 1448 1016 { 1449 1017 iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, iSrcStride ); 1450 piDst[x ] = Clip ((iSum + 32) >> 6 );1018 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1451 1019 piSrcTmp++; 1452 1020 } … … 1478 1046 { 1479 1047 iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, 1 ); 1480 piDst[x ] = Clip ((iSum + 32) >> 6 );1048 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1481 1049 piSrcTmp++; 1482 1050 } … … 1494 1062 { 1495 1063 iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, 1 ); 1496 piDst[x ] = Clip ((iSum + 32) >> 6 );1064 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1497 1065 piSrcTmp++; 1498 1066 } … … 1510 1078 { 1511 1079 iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, 1 ); 1512 piDst[x ] = Clip ((iSum + 32) >> 6 );1080 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1513 1081 piSrcTmp++; 1514 1082 } … … 1526 1094 { 1527 1095 iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, 1 ); 1528 piDst[x ] = Clip ((iSum + 32) >> 6 );1096 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1529 1097 piSrcTmp++; 1530 1098 } … … 1542 1110 { 1543 1111 iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, 1 ); 1544 piDst[x ] = Clip ((iSum + 32) >> 6 );1112 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1545 1113 piSrcTmp++; 1546 1114 } … … 1558 1126 { 1559 1127 iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, 1 ); 1560 piDst[x ] = Clip ((iSum + 32) >> 6 );1128 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1561 1129 piSrcTmp++; 1562 1130 } … … 1574 1142 { 1575 1143 iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, 1 ); 1576 piDst[x ] = Clip ((iSum + 32) >> 6 );1144 piDst[x ] = ClipC ((iSum + 32) >> 6 ); 1577 1145 piSrcTmp++; 1578 1146 } … … 1587 1155 return; 1588 1156 } 1589 1590 #if HIGH_ACCURACY_BI1591 __inline Void TRenInterpFilter::xCTI_Filter2DHorC_ha(Int* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV)1592 {1593 Pel* piDst = rpiDst;1594 Int iSum;1595 Int* piSrcTmp;1596 Int shiftNum = 6 + g_uiBitIncrement + g_uiBitDepth - 8;1597 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;1598 1599 switch (iMV)1600 {1601 case 1:1602 {1603 for ( Int y = iHeight; y != 0; y-- )1604 {1605 piSrcTmp = &piSrc[ -1 ];1606 for ( Int x = 0; x < iWidth; x++ )1607 {1608 iSum = xCTI_Filter_VI04_C_OCT0( piSrcTmp, 1 );1609 #if REMOVE_INTERMEDIATE_CLIPPING1610 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1611 #else1612 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1613 #endif1614 piSrcTmp++;1615 }1616 piSrc += iSrcStride;1617 piDst += iDstStride;1618 }1619 }1620 break;1621 case 2:1622 {1623 for ( Int y = iHeight; y != 0; y-- )1624 {1625 piSrcTmp = &piSrc[ -1 ];1626 for ( Int x = 0; x < iWidth; x++ )1627 {1628 iSum = xCTI_Filter_VI04_C_QUA0( piSrcTmp, 1 );1629 #if REMOVE_INTERMEDIATE_CLIPPING1630 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1631 #else1632 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1633 #endif1634 piSrcTmp++;1635 }1636 piSrc += iSrcStride;1637 piDst += iDstStride;1638 }1639 }1640 break;1641 case 6:1642 {1643 for ( Int y = iHeight; y != 0; y-- )1644 {1645 piSrcTmp = &piSrc[ -1 ];1646 for ( Int x = 0; x < iWidth; x++ )1647 {1648 iSum = xCTI_Filter_VI04_C_QUA1( piSrcTmp, 1 );1649 #if REMOVE_INTERMEDIATE_CLIPPING1650 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1651 #else1652 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1653 #endif1654 piSrcTmp++;1655 }1656 piSrc += iSrcStride;1657 piDst += iDstStride;1658 }1659 }1660 break;1661 case 3:1662 {1663 for ( Int y = iHeight; y != 0; y-- )1664 {1665 piSrcTmp = &piSrc[ -1 ];1666 for ( Int x = 0; x < iWidth; x++ )1667 {1668 iSum = xCTI_Filter_VI04_C_OCT1( piSrcTmp, 1 );1669 #if REMOVE_INTERMEDIATE_CLIPPING1670 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1671 #else1672 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1673 #endif1674 piSrcTmp++;1675 }1676 piSrc += iSrcStride;1677 piDst += iDstStride;1678 }1679 }1680 break;1681 case 5:1682 {1683 for ( Int y = iHeight; y != 0; y-- )1684 {1685 piSrcTmp = &piSrc[ -1 ];1686 for ( Int x = 0; x < iWidth; x++ )1687 {1688 iSum = xCTI_Filter_VI04_C_OCT2( piSrcTmp, 1 );1689 #if REMOVE_INTERMEDIATE_CLIPPING1690 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1691 #else1692 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1693 #endif1694 piSrcTmp++;1695 }1696 piSrc += iSrcStride;1697 piDst += iDstStride;1698 }1699 }1700 break;1701 case 7:1702 {1703 for ( Int y = iHeight; y != 0; y-- )1704 {1705 piSrcTmp = &piSrc[ -1 ];1706 for ( Int x = 0; x < iWidth; x++ )1707 {1708 iSum = xCTI_Filter_VI04_C_OCT3( piSrcTmp, 1 );1709 #if REMOVE_INTERMEDIATE_CLIPPING1710 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1711 #else1712 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1713 #endif1714 piSrcTmp++;1715 }1716 piSrc += iSrcStride;1717 piDst += iDstStride;1718 }1719 }1720 break;1721 case 4:1722 {1723 for ( Int y = iHeight; y != 0; y-- )1724 {1725 piSrcTmp = &piSrc[ -1 ];1726 for ( Int x = 0; x < iWidth; x++ )1727 {1728 iSum = xCTI_Filter_VIS04_C_HAL( piSrcTmp, 1 );1729 #if REMOVE_INTERMEDIATE_CLIPPING1730 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1731 #else1732 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1733 #endif1734 piSrcTmp++;1735 }1736 piSrc += iSrcStride;1737 piDst += iDstStride;1738 }1739 }1740 break;1741 default:1742 assert( 0 );1743 }1744 1745 return;1746 }1747 1748 __inline Void TRenInterpFilter::xCTI_Filter1DVerC_ha (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV)1749 {1750 Pel* piDst = rpiDst;1751 Int iSum;1752 Pel* piSrcTmp;1753 Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8;1754 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;1755 1756 switch (iMV)1757 {1758 case 1:1759 {1760 for ( Int y = iHeight; y != 0; y-- )1761 {1762 piSrcTmp = &piSrc[ -iSrcStride ];1763 for ( Int x = 0; x < iWidth; x++ )1764 {1765 iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, iSrcStride );1766 #if REMOVE_INTERMEDIATE_CLIPPING1767 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1768 #else1769 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1770 #endif1771 piSrcTmp++;1772 }1773 piSrc += iSrcStride;1774 piDst += iDstStride;1775 }1776 }1777 break;1778 case 2:1779 {1780 for ( Int y = iHeight; y != 0; y-- )1781 {1782 piSrcTmp = &piSrc[ -iSrcStride ];1783 for ( Int x = 0; x < iWidth; x++ )1784 {1785 iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, iSrcStride );1786 #if REMOVE_INTERMEDIATE_CLIPPING1787 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1788 #else1789 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1790 #endif1791 piSrcTmp++;1792 }1793 piSrc += iSrcStride;1794 piDst += iDstStride;1795 }1796 }1797 break;1798 case 6:1799 {1800 for ( Int y = iHeight; y != 0; y-- )1801 {1802 piSrcTmp = &piSrc[ -iSrcStride ];1803 for ( Int x = 0; x < iWidth; x++ )1804 {1805 iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, iSrcStride );1806 #if REMOVE_INTERMEDIATE_CLIPPING1807 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1808 #else1809 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1810 #endif1811 piSrcTmp++;1812 }1813 piSrc += iSrcStride;1814 piDst += iDstStride;1815 }1816 }1817 break;1818 case 3:1819 {1820 for ( Int y = iHeight; y != 0; y-- )1821 {1822 piSrcTmp = &piSrc[ -iSrcStride ];1823 for ( Int x = 0; x < iWidth; x++ )1824 {1825 iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, iSrcStride );1826 #if REMOVE_INTERMEDIATE_CLIPPING1827 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1828 #else1829 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1830 #endif1831 piSrcTmp++;1832 }1833 piSrc += iSrcStride;1834 piDst += iDstStride;1835 }1836 }1837 break;1838 case 5:1839 {1840 for ( Int y = iHeight; y != 0; y-- )1841 {1842 piSrcTmp = &piSrc[ -iSrcStride ];1843 for ( Int x = 0; x < iWidth; x++ )1844 {1845 iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, iSrcStride );1846 #if REMOVE_INTERMEDIATE_CLIPPING1847 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1848 #else1849 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1850 #endif1851 piSrcTmp++;1852 }1853 piSrc += iSrcStride;1854 piDst += iDstStride;1855 }1856 }1857 break;1858 case 7:1859 {1860 for ( Int y = iHeight; y != 0; y-- )1861 {1862 piSrcTmp = &piSrc[ -iSrcStride ];1863 for ( Int x = 0; x < iWidth; x++ )1864 {1865 iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, iSrcStride );1866 #if REMOVE_INTERMEDIATE_CLIPPING1867 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1868 #else1869 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1870 #endif1871 piSrcTmp++;1872 }1873 piSrc += iSrcStride;1874 piDst += iDstStride;1875 }1876 }1877 break;1878 case 4:1879 {1880 for ( Int y = iHeight; y != 0; y-- )1881 {1882 piSrcTmp = &piSrc[-iSrcStride ];1883 for ( Int x = 0; x < iWidth; x++ )1884 {1885 iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, iSrcStride );1886 #if REMOVE_INTERMEDIATE_CLIPPING1887 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1888 #else1889 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1890 #endif1891 piSrcTmp++;1892 }1893 piSrc += iSrcStride;1894 piDst += iDstStride;1895 }1896 }1897 break;1898 default:1899 assert( 0 );1900 }1901 return;1902 }1903 1904 __inline Void TRenInterpFilter::xCTI_Filter1DHorC_ha(Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV)1905 {1906 Pel* piDst = rpiDst;1907 Int iSum;1908 Pel* piSrcTmp;1909 Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8;1910 Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;1911 1912 switch (iMV)1913 {1914 case 1:1915 {1916 for ( Int y = iHeight; y != 0; y-- )1917 {1918 piSrcTmp = &piSrc[ -1 ];1919 for ( Int x = 0; x < iWidth; x++ )1920 {1921 iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, 1 );1922 #if REMOVE_INTERMEDIATE_CLIPPING1923 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1924 #else1925 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1926 #endif1927 piSrcTmp++;1928 }1929 piSrc += iSrcStride;1930 piDst += iDstStride;1931 }1932 }1933 break;1934 case 2:1935 {1936 for ( Int y = iHeight; y != 0; y-- )1937 {1938 piSrcTmp = &piSrc[ -1 ];1939 for ( Int x = 0; x < iWidth; x++ )1940 {1941 iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, 1 );1942 #if REMOVE_INTERMEDIATE_CLIPPING1943 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1944 #else1945 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1946 #endif1947 piSrcTmp++;1948 }1949 piSrc += iSrcStride;1950 piDst += iDstStride;1951 }1952 }1953 break;1954 case 6:1955 {1956 for ( Int y = iHeight; y != 0; y-- )1957 {1958 piSrcTmp = &piSrc[ -1 ];1959 for ( Int x = 0; x < iWidth; x++ )1960 {1961 iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, 1 );1962 #if REMOVE_INTERMEDIATE_CLIPPING1963 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1964 #else1965 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1966 #endif1967 piSrcTmp++;1968 }1969 piSrc += iSrcStride;1970 piDst += iDstStride;1971 }1972 }1973 break;1974 case 3:1975 {1976 for ( Int y = iHeight; y != 0; y-- )1977 {1978 piSrcTmp = &piSrc[ -1 ];1979 for ( Int x = 0; x < iWidth; x++ )1980 {1981 iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, 1 );1982 #if REMOVE_INTERMEDIATE_CLIPPING1983 piDst[x ] = (iSum + shiftOffset) >> shiftNum;1984 #else1985 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );1986 #endif1987 piSrcTmp++;1988 }1989 piSrc += iSrcStride;1990 piDst += iDstStride;1991 }1992 }1993 break;1994 case 5:1995 {1996 for ( Int y = iHeight; y != 0; y-- )1997 {1998 piSrcTmp = &piSrc[ -1 ];1999 for ( Int x = 0; x < iWidth; x++ )2000 {2001 iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, 1 );2002 #if REMOVE_INTERMEDIATE_CLIPPING2003 piDst[x ] = (iSum + shiftOffset) >> shiftNum;2004 #else2005 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );2006 #endif2007 piSrcTmp++;2008 }2009 piSrc += iSrcStride;2010 piDst += iDstStride;2011 }2012 }2013 break;2014 case 7:2015 {2016 for ( Int y = iHeight; y != 0; y-- )2017 {2018 piSrcTmp = &piSrc[ -1 ];2019 for ( Int x = 0; x < iWidth; x++ )2020 {2021 iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, 1 );2022 #if REMOVE_INTERMEDIATE_CLIPPING2023 piDst[x ] = (iSum + shiftOffset) >> shiftNum;2024 #else2025 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );2026 #endif2027 piSrcTmp++;2028 }2029 piSrc += iSrcStride;2030 piDst += iDstStride;2031 }2032 }2033 break;2034 case 4:2035 {2036 for ( Int y = iHeight; y != 0; y-- )2037 {2038 piSrcTmp = &piSrc[ -1 ];2039 for ( Int x = 0; x < iWidth; x++ )2040 {2041 iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, 1 );2042 #if REMOVE_INTERMEDIATE_CLIPPING2043 piDst[x ] = (iSum + shiftOffset) >> shiftNum;2044 #else2045 piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );2046 #endif2047 piSrcTmp++;2048 }2049 piSrc += iSrcStride;2050 piDst += iDstStride;2051 }2052 }2053 break;2054 default:2055 assert( 0 );2056 2057 }2058 return;2059 }2060 #endif2061 2062 1157 2063 1158 __inline Int TRenInterpFilter::xCTI_Filter_VP04_C_OCT0( Pel* pSrc, Int iStride ) … … 2231 1326 return iSum; 2232 1327 } 2233 1328 #endif // H_3D 2234 1329 #endif // __TRENINTERP__ -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenModSetupStrParser.cpp
r438 r446 36 36 #include "TRenFilter.h" 37 37 #include "TRenModSetupStrParser.h" 38 #if !QC_MVHEVC_B0046 38 39 #if H_3D 39 40 Int 40 41 TRenModSetupStrParser::getNumOfModels() … … 450 451 rcNextChar = m_pchSetStr[iPos]; 451 452 } 452 #endif 453 453 #endif // H_3D 454 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenModSetupStrParser.h
r438 r446 31 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 32 */ 33 #if !QC_MVHEVC_B0046 33 34 34 #ifndef __TRENMODSETUPSTRPARSER__ 35 35 #define __TRENMODSETUPSTRPARSER__ … … 39 39 #include "../TLibCommon/TypeDef.h" 40 40 #include "../TAppCommon/TAppComCamPara.h" 41 #if H_3D 42 41 43 42 44 … … 126 128 }; 127 129 130 #endif // H_3D 128 131 #endif //__TRENMODEL__ 129 #endif130 132 133 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenModel.cpp
r438 r446 35 35 #include "TRenFilter.h" 36 36 #include "TRenModel.h" 37 #if !QC_MVHEVC_B0046 37 38 #if H_3D_VSO 38 39 /////////// TRENMODEL ////////////////////// 39 40 TRenModel::TRenModel() … … 48 49 m_iHoleMargin = 1; 49 50 m_uiHorOff = -1; 50 #if LGE_VSO_EARLY_SKIP_A009351 #if H_3D_VSO_EARLY_SKIP 51 52 m_bEarlySkip = false; 52 53 #endif … … 214 215 215 216 Void 216 #if LGE_VSO_EARLY_SKIP_A0093217 #if H_3D_VSO_EARLY_SKIP 217 218 TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip ) 218 219 #else … … 226 227 m_iShiftPrec = iShiftPrec; 227 228 m_iHoleMargin = iHoleMargin; 228 #if LGE_VSO_EARLY_SKIP_A0093229 #if H_3D_VSO_EARLY_SKIP 229 230 m_bEarlySkip = bEarlySkip; 230 231 #endif … … 357 358 AOT( iContent < -1 || iContent > 1 ); 358 359 AOT( iBlendMode < -1 || iBlendMode > 2 ); 359 360 Bool bBitInc = (g_uiBitIncrement != 0); 360 AOT( g_bitDepthY != g_bitDepthC ); 361 362 Bool bBitInc = ( DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) != 0); 361 363 362 364 AOT( m_apcRenModels[iModelNum] ); … … 414 416 415 417 416 #if LGE_VSO_EARLY_SKIP_A0093418 #if H_3D_VSO_EARLY_SKIP 417 419 m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin, bUseOrgRef, iBlendMode, m_bEarlySkip ); 418 420 #else … … 550 552 } 551 553 552 #if LGE_VSO_EARLY_SKIP_A0093554 #if H_3D_VSO_EARLY_SKIP 553 555 RMDist 554 556 TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride) … … 574 576 if (m_iCurrentContent == 1) 575 577 { 576 #if LGE_VSO_EARLY_SKIP_A0093578 #if H_3D_VSO_EARLY_SKIP 577 579 iDist += m_apcCurRenModels[iModelNum]->getDistDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData , piOrgData, iOrgStride); 578 580 #else … … 606 608 if (m_iCurrentContent == 1) 607 609 { 608 #if def LGE_VSO_EARLY_SKIP_A0093610 #if H_3D_VSO_EARLY_SKIP 609 611 Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ]; 610 612 m_apcCurRenModels[iModelNum]->setDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX ,iTargetStride ); … … 619 621 } 620 622 621 #if def LGE_VSO_EARLY_SKIP_A0093623 #if H_3D_VSO_EARLY_SKIP 622 624 if (m_iCurrentContent == 1) 623 625 { … … 658 660 m_apcCurRenModels[iCurModel]->getRefVideo ( m_aiCurPosInModels[iCurModel], &cPicYuvTempRef ); 659 661 660 iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(), m_iWidth, m_iUsedHeight , cPicYuvTempRef.getLumaAddr(), cPicYuvTempRef.getStride() );661 iSSEU += TRenFilter::SSE( cPicYuvSynth.getCbAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCbAddr() , cPicYuvTempRef.getCStride() );662 iSSEV += TRenFilter::SSE( cPicYuvSynth.getCrAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCrAddr() , cPicYuvTempRef.getCStride() );662 iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(), m_iWidth, m_iUsedHeight , cPicYuvTempRef.getLumaAddr(), cPicYuvTempRef.getStride() , true ); 663 iSSEU += TRenFilter::SSE( cPicYuvSynth.getCbAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCbAddr() , cPicYuvTempRef.getCStride(), false ); 664 iSSEV += TRenFilter::SSE( cPicYuvSynth.getCrAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCrAddr() , cPicYuvTempRef.getCStride(), false ); 663 665 } 664 666 … … 697 699 } 698 700 } 699 #endif 700 701 #endif // H_3D -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenModel.h
r438 r446 32 32 */ 33 33 34 #if !QC_MVHEVC_B0046 34 35 35 #ifndef __TRENMODEL__ 36 36 #define __TRENMODEL__ … … 42 42 #include "../TLibCommon/TypeDef.h" 43 43 44 #if H_3D_VSO 45 44 46 class TRenModel 45 47 { … … 50 52 51 53 // Creation 52 #if LGE_VSO_EARLY_SKIP_A009354 #if H_3D_VSO_EARLY_SKIP 53 55 Void create ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip ); 54 56 #else … … 68 70 69 71 // Get Distortion, set Data 70 #if def LGE_VSO_EARLY_SKIP_A009372 #if H_3D_VSO_EARLY_SKIP 71 73 Int64 getDist ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride); 72 74 #else … … 91 93 Int** m_aaaiSubPelShiftLut[2]; 92 94 Int m_iHoleMargin; 93 #if LGE_VSO_EARLY_SKIP_A009395 #if H_3D_VSO_EARLY_SKIP 94 96 Bool m_bEarlySkip; 95 97 #endif … … 155 157 }; 156 158 159 #endif // H_3D 157 160 #endif //__TRENMODEL__ 158 #endif159 161 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenSingleModel.cpp
r438 r446 36 36 #include "TRenSingleModel.h" 37 37 38 #if !QC_MVHEVC_B0046 38 #if H_3D_VSO 39 39 40 ////////////// TRENSINGLE MODEL /////////////// 40 41 template <BlenMod iBM, Bool bBitInc> 41 42 TRenSingleModelC<iBM,bBitInc>::TRenSingleModelC() 42 : m_iDistShift ( g_uiBitIncrement<< 1 )43 : m_iDistShift ( ( g_bitDepthY - 8) << 1 ) 43 44 { 44 45 m_iWidth = -1; … … 84 85 } 85 86 86 #if def LGE_VSO_EARLY_SKIP_A009387 #if H_3D_VSO_EARLY_SKIP 87 88 m_pbHorSkip = NULL; 88 89 #endif … … 92 93 TRenSingleModelC<iBM,bBitInc>::~TRenSingleModelC() 93 94 { 94 #if def LGE_VSO_EARLY_SKIP_A009395 #if H_3D_VSO_EARLY_SKIP 95 96 if ( m_pbHorSkip ) 96 97 { … … 114 115 115 116 template <BlenMod iBM, Bool bBitInc> Void 116 #if LGE_VSO_EARLY_SKIP_A0093117 #if H_3D_VSO_EARLY_SKIP 117 118 TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ) 118 119 #else … … 121 122 122 123 { 123 #if LGE_VSO_EARLY_SKIP_A0093124 #if H_3D_VSO_EARLY_SKIP 124 125 m_pbHorSkip = new Bool [MAX_CU_SIZE]; 125 126 m_bEarlySkip = bEarlySkip; … … 182 183 Pel* piDRow = piCurDepthPel; 183 184 Pel* piYRow = apiCurVideoPel[0]; 184 #if H HI_VSO_COLOR_PLANES185 #if H_3D_VSO_COLOR_PLANES 185 186 Pel* piURow = apiCurVideoPel[1]; 186 187 Pel* piVRow = apiCurVideoPel[2]; … … 196 197 Int iSubPosX = (1 << m_iShiftPrec); 197 198 pcCurInputSampleRow[0].aiY[iSubPosX] = piYRow[0]; 198 #if H HI_VSO_COLOR_PLANES199 #if H_3D_VSO_COLOR_PLANES 199 200 pcCurInputSampleRow[0].aiU[iSubPosX] = piURow[0]; 200 201 pcCurInputSampleRow[0].aiV[iSubPosX] = piVRow[0]; … … 210 211 Int iShift = (iPosX << m_iShiftPrec) + iSubPosX; 211 212 pcCurInputSampleRow[iPosX+iOffsetX].aiY[iSubPosX] = piYRow[iShift]; 212 #if H HI_VSO_COLOR_PLANES213 #if H_3D_VSO_COLOR_PLANES 213 214 pcCurInputSampleRow[iPosX+iOffsetX].aiU[iSubPosX] = piURow[iShift]; 214 215 pcCurInputSampleRow[iPosX+iOffsetX].aiV[iSubPosX] = piVRow[iShift]; … … 221 222 piDRow += iCurDepthStride; 222 223 piYRow += aiCurVideoStride[0]; 223 #if H HI_VSO_COLOR_PLANES224 #if H_3D_VSO_COLOR_PLANES 224 225 piURow += aiCurVideoStride[1]; 225 226 piVRow += aiCurVideoStride[2]; … … 270 271 { 271 272 case 0: 272 #if LGE_VSO_EARLY_SKIP_A0093273 #if H_3D_VSO_EARLY_SKIP 273 274 xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false ); 274 275 #else … … 277 278 break; 278 279 case 1: 279 #if def LGE_VSO_EARLY_SKIP_A0093280 #if H_3D_VSO_EARLY_SKIP 280 281 xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false); 281 282 #else … … 285 286 case 2: 286 287 TRenFilter::setupZLUT( true, 30, iDistToLeft, ppiBaseShiftLutLeft, ppiBaseShiftLutRight, m_iBlendZThres, m_iBlendDistWeight, m_piInvZLUTLeft, m_piInvZLUTRight ); 287 #if def LGE_VSO_EARLY_SKIP_A0093288 #if H_3D_VSO_EARLY_SKIP 288 289 xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false); 289 290 xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false); … … 306 307 307 308 template <BlenMod iBM, Bool bBitInc> Void 308 #if H HI_VSO_COLOR_PLANES309 #if H_3D_VSO_COLOR_PLANES 309 310 TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV ) 310 311 #else … … 316 317 case 0: 317 318 rpiSrcY = &RenModelOutPels::iYLeft; 318 #if H HI_VSO_COLOR_PLANES319 #if H_3D_VSO_COLOR_PLANES 319 320 rpiSrcU = &RenModelOutPels::iULeft; 320 321 rpiSrcV = &RenModelOutPels::iVLeft; … … 323 324 case 1: 324 325 rpiSrcY = &RenModelOutPels::iYRight; 325 #if H HI_VSO_COLOR_PLANES326 #if H_3D_VSO_COLOR_PLANES 326 327 rpiSrcU = &RenModelOutPels::iURight; 327 328 rpiSrcV = &RenModelOutPels::iVRight; … … 330 331 case 2: 331 332 rpiSrcY = &RenModelOutPels::iYBlended; 332 #if H HI_VSO_COLOR_PLANES333 #if H_3D_VSO_COLOR_PLANES 333 334 rpiSrcU = &RenModelOutPels::iUBlended; 334 335 rpiSrcV = &RenModelOutPels::iVBlended; … … 353 354 354 355 Pel* piYRow = m_aapiRefVideoPel[0]; 355 #if H HI_VSO_COLOR_PLANES356 #if H_3D_VSO_COLOR_PLANES 356 357 Pel* piURow = m_aapiRefVideoPel[1]; 357 358 Pel* piVRow = m_aapiRefVideoPel[2]; … … 363 364 { 364 365 pcCurOutSampleRow[iPosX].iYRef = piYRow[iPosX]; 365 #if H HI_VSO_COLOR_PLANES366 #if H_3D_VSO_COLOR_PLANES 366 367 pcCurOutSampleRow[iPosX].iURef = piURow[iPosX]; 367 368 pcCurOutSampleRow[iPosX].iVRef = piVRow[iPosX]; … … 372 373 373 374 piYRow += m_aiRefVideoStrides[0]; 374 #if H HI_VSO_COLOR_PLANES375 #if H_3D_VSO_COLOR_PLANES 375 376 piURow += m_aiRefVideoStrides[1]; 376 377 piVRow += m_aiRefVideoStrides[2]; … … 403 404 Pel RenModelOutPels::* piSrcY = NULL; 404 405 405 #if H HI_VSO_COLOR_PLANES406 #if H_3D_VSO_COLOR_PLANES 406 407 Pel RenModelOutPels::* piSrcU = NULL; 407 408 Pel RenModelOutPels::* piSrcV = NULL; … … 416 417 { 417 418 pcCurOutSampleRow[iPosX].iYRef = pcCurOutSampleRow[iPosX].*piSrcY; 418 #if H HI_VSO_COLOR_PLANES419 #if H_3D_VSO_COLOR_PLANES 419 420 pcCurOutSampleRow[iPosX].iURef = pcCurOutSampleRow[iPosX].*piSrcU; 420 421 pcCurOutSampleRow[iPosX].iVRef = pcCurOutSampleRow[iPosX].*piSrcV; … … 449 450 pcOutSampleRow[iPosX].iYRight = 0; 450 451 pcOutSampleRow[iPosX].iYBlended = 0; 451 #if H HI_VSO_COLOR_PLANES452 #if H_3D_VSO_COLOR_PLANES 452 453 // U Planes 453 pcOutSampleRow[iPosX].iULeft = 1 28 << g_uiBitIncrement;454 pcOutSampleRow[iPosX].iURight = 1 28 << g_uiBitIncrement;455 pcOutSampleRow[iPosX].iUBlended = 1 28 << g_uiBitIncrement;454 pcOutSampleRow[iPosX].iULeft = 1 << (g_bitDepthC - 1); 455 pcOutSampleRow[iPosX].iURight = 1 << (g_bitDepthC - 1); 456 pcOutSampleRow[iPosX].iUBlended = 1 << (g_bitDepthC - 1); 456 457 457 458 // V Planes 458 pcOutSampleRow[iPosX].iVLeft = 1 28 << g_uiBitIncrement;459 pcOutSampleRow[iPosX].iVRight = 1 28 << g_uiBitIncrement;460 pcOutSampleRow[iPosX].iVBlended = 1 28 << g_uiBitIncrement;459 pcOutSampleRow[iPosX].iVLeft = 1 << (g_bitDepthC - 1); 460 pcOutSampleRow[iPosX].iVRight = 1 << (g_bitDepthC - 1); 461 pcOutSampleRow[iPosX].iVBlended = 1 << (g_bitDepthC - 1); 461 462 #endif 462 463 //// Input Samples … … 472 473 473 474 474 #if def LGE_VSO_EARLY_SKIP_A0093475 #if H_3D_VSO_EARLY_SKIP 475 476 template <BlenMod iBM, Bool bBitInc> RMDist 476 477 TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Pel * piOrgData, Int iOrgStride ) … … 481 482 { 482 483 RMDist iSSE = 0; 483 #if def LGE_VSO_EARLY_SKIP_A0093484 #if H_3D_VSO_EARLY_SKIP 484 485 Bool bEarlySkip; 485 486 #endif … … 487 488 { 488 489 case 0: 489 #if def LGE_VSO_EARLY_SKIP_A0093490 #if H_3D_VSO_EARLY_SKIP 490 491 bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData, iOrgStride) : false; 491 492 if( !bEarlySkip ) … … 498 499 break; 499 500 case 1: 500 #if def LGE_VSO_EARLY_SKIP_A0093501 #if H_3D_VSO_EARLY_SKIP 501 502 bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData, iOrgStride) : false; 502 503 if( !bEarlySkip ) … … 514 515 return iSSE; 515 516 } 516 #if def LGE_VSO_EARLY_SKIP_A0093517 #if H_3D_VSO_EARLY_SKIP 517 518 template <BlenMod iBM, Bool bBitInc> Void 518 519 TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride ) … … 522 523 #endif 523 524 { 524 #ifdef LGE_VSO_EARLY_SKIP_A0093525 #ifdef H_3D_VSO_EARLY_SKIP 525 526 Bool bEarlySkip; 526 527 #endif … … 528 529 { 529 530 case 0: 530 #if def LGE_VSO_EARLY_SKIP_A0093531 #if H_3D_VSO_EARLY_SKIP 531 532 bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData,iOrgStride) : false; 532 533 if( !bEarlySkip ) … … 539 540 break; 540 541 case 1: 541 #if def LGE_VSO_EARLY_SKIP_A0093542 #if H_3D_VSO_EARLY_SKIP 542 543 bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData,iOrgStride) : false; 543 544 if( !bEarlySkip ) … … 560 561 AOT( pcPicYuv->getHeight() < m_iUsedHeight + m_iHorOffset ); 561 562 562 #if H HI_VSO_COLOR_PLANES563 #if H_3D_VSO_COLOR_PLANES 563 564 Pel RenModelOutPels::* piText[3] = { NULL, NULL, NULL }; 564 565 xGetSampleStrTextPtrs(iViewPos, piText[0], piText[1], piText[2]); … … 581 582 xGetSampleStrTextPtrs(iViewPos, piY); 582 583 xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piY, pcPicYuv->getLumaAddr() + m_iHorOffset * pcPicYuv->getStride(), pcPicYuv->getStride(), m_iWidth, m_iUsedHeight ); 583 pcPicYuv->setChromaTo( 1 28 << g_uiBitIncrement);584 pcPicYuv->setChromaTo( 1 << (g_bitDepthC - 1) ); 584 585 #endif 585 586 } … … 595 596 xGetSampleStrDepthPtrs(iViewPos, piD); 596 597 xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piD, pcPicYuv->getLumaAddr() + pcPicYuv->getStride() * m_iHorOffset, pcPicYuv->getStride(), m_iWidth, m_iUsedHeight ); 597 pcPicYuv->setChromaTo( 1 28 << g_uiBitIncrement);598 pcPicYuv->setChromaTo( 1 << (g_bitDepthC - 1) ); 598 599 } 599 600 … … 605 606 AOT( pcPicYuv->getHeight() < m_iUsedHeight + m_iHorOffset); 606 607 607 #if H HI_VSO_COLOR_PLANES608 #if H_3D_VSO_COLOR_PLANES 608 609 Pel RenModelOutPels::* piText[3]; 609 610 piText[0] = &RenModelOutPels::iYRef; … … 627 628 #else 628 629 xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, &RenModelOutPels::iYRef, pcPicYuv->getLumaAddr() * pcPicYuv->getStride() + m_iHorOffset, pcPicYuv->getStride(), m_iWidth, m_iUsedHeight ); 629 pcPicYuv->setChromaTo( 1 28 << g_uiBitIncrement);630 pcPicYuv->setChromaTo( 1 << ( g_bitDepthC - 1 ) ); 630 631 #endif 631 632 } … … 662 663 m_pcOutputSamplesRow += m_iOutputSamplesStride; 663 664 } 664 #if LGE_VSO_EARLY_SKIP_A0093665 #if H_3D_VSO_EARLY_SKIP 665 666 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist 666 667 TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast) … … 695 696 for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ ) 696 697 { 697 #if def LGE_VSO_EARLY_SKIP_A0093698 #if H_3D_VSO_EARLY_SKIP 698 699 if( m_bEarlySkip && bFast ) 699 700 { … … 721 722 xExtrapolateMarginL<bSet> ( iCurSPos, iEndChangePos, iError ); 722 723 723 iMinChangedSPos = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);724 iMinChangedSPos = std::min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]); 724 725 iLastSPos = iCurSPos; 725 726 m_iLastDepth = m_iCurDepth; … … 746 747 // Get minimal changed sample position 747 748 748 iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);749 iMinChangedSPos = std::min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]); 749 750 Int iCurSPos = xShiftNewData(iCurPosX,iPosXinNewData); 750 751 m_iCurDepth = m_piNewDepthData[iPosXinNewData]; … … 786 787 } 787 788 788 #ifdef LGE_VSO_EARLY_SKIP_A0093789 #ifdef H_3D_VSO_EARLY_SKIP 789 790 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist 790 791 TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Bool bFast) … … 820 821 for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ ) 821 822 { 822 #if def LGE_VSO_EARLY_SKIP_A0093823 #if H_3D_VSO_EARLY_SKIP 823 824 if( m_bEarlySkip && bFast ) 824 825 { … … 846 847 xExtrapolateMarginR<bSet> ( iCurSPos, iStartChangePos, iError ); 847 848 848 iMaxChangedSPos = Max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);849 iMaxChangedSPos = std::max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]); 849 850 iLastSPos = iCurSPos; 850 851 m_iLastDepth = m_iCurDepth; … … 872 873 // Get minimal changed sample position 873 874 874 iMaxChangedSPos = Max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);875 iMaxChangedSPos = std::max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]); 875 876 Int iCurSPos = xShiftNewData(iCurPosX,iPosXinNewData); 876 877 m_iCurDepth = m_piNewDepthData[iPosXinNewData]; … … 1002 1003 1003 1004 m_iThisDepth = m_iCurDepth; 1004 for (Int iFillSPos = Max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ )1005 for (Int iFillSPos = std::max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ ) 1005 1006 { 1006 1007 Int iDeltaCurSPos = (iFillSPos << m_iShiftPrec) - iCurSPos; … … 1189 1190 1190 1191 m_iThisDepth = m_iLastDepth; 1191 for (Int iFillSPos = Max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ )1192 for (Int iFillSPos = std::max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ ) 1192 1193 { 1193 1194 xSetShiftedPelL<bSet>( iLastPos, 0, iFillSPos, REN_IS_HOLE, riError ); … … 1233 1234 // return; 1234 1235 1235 Int iSPosFullPel = Max(0,xRangeLeftL(iCurSPos));1236 Int iSPosFullPel = std::max(0,xRangeLeftL(iCurSPos)); 1236 1237 1237 1238 m_iThisDepth = m_iCurDepth; … … 1253 1254 // return; 1254 1255 1255 Int iSPosFullPel = Min(m_iWidth-1,xRangeRightR(iCurSPos));1256 Int iSPosFullPel = std::min(m_iWidth-1,xRangeRightR(iCurSPos)); 1256 1257 1257 1258 m_iThisDepth = m_iCurDepth; … … 1413 1414 // Yuv 1414 1415 pcOutSample->iYLeft = pcInSample->aiY[iSubSourcePos]; 1415 #if H HI_VSO_COLOR_PLANES1416 #if H_3D_VSO_COLOR_PLANES 1416 1417 pcOutSample->iULeft = pcInSample->aiU[iSubSourcePos]; 1417 1418 pcOutSample->iVLeft = pcInSample->aiV[iSubSourcePos]; … … 1428 1429 else 1429 1430 { 1430 #if H HI_VSO_COLOR_PLANES1431 #if H_3D_VSO_COLOR_PLANES 1431 1432 riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef, 1432 1433 pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef, … … 1445 1446 { 1446 1447 Pel piBlendedValueY; 1447 #if H HI_VSO_COLOR_PLANES1448 #if H_3D_VSO_COLOR_PLANES 1448 1449 Pel piBlendedValueU; 1449 1450 Pel piBlendedValueV; … … 1453 1454 pcInSample ->aiY[iSubSourcePos], 1454 1455 pcOutSample->iYRight, 1455 #if H HI_VSO_COLOR_PLANES1456 #if H_3D_VSO_COLOR_PLANES 1456 1457 pcInSample ->aiU[iSubSourcePos], 1457 1458 pcOutSample->iURight, … … 1464 1465 pcOutSample->iFilledRight , 1465 1466 piBlendedValueY 1466 #if H HI_VSO_COLOR_PLANES1467 #if H_3D_VSO_COLOR_PLANES 1467 1468 , piBlendedValueU, 1468 1469 piBlendedValueV … … 1476 1477 pcOutSample->iYLeft = pcInSample ->aiY[iSubSourcePos]; 1477 1478 pcOutSample->iYBlended = piBlendedValueY; 1478 #if H HI_VSO_COLOR_PLANES1479 #if H_3D_VSO_COLOR_PLANES 1479 1480 pcOutSample->iULeft = pcInSample ->aiU[iSubSourcePos]; 1480 1481 pcOutSample->iUBlended = piBlendedValueU; … … 1486 1487 // Get Error 1487 1488 Int iDiffY = pcOutSample->iYRef - piBlendedValueY; 1488 #if H HI_VSO_COLOR_PLANES1489 #if H_3D_VSO_COLOR_PLANES 1489 1490 Int iDiffU = pcOutSample->iURef - piBlendedValueU; 1490 1491 Int iDiffV = pcOutSample->iVRef - piBlendedValueV; … … 1497 1498 { 1498 1499 Int iDiffY = pcOutSample->iYRef - piBlendedValueY; 1499 #if H HI_VSO_COLOR_PLANES1500 #if H_3D_VSO_COLOR_PLANES 1500 1501 Int iDiffU = pcOutSample->iURef - piBlendedValueU; 1501 1502 Int iDiffV = pcOutSample->iVRef - piBlendedValueV; … … 1543 1544 // Yuv 1544 1545 pcOutSample->iYRight = pcInSample->aiY[iSubSourcePos]; 1545 #if H HI_VSO_COLOR_PLANES1546 #if H_3D_VSO_COLOR_PLANES 1546 1547 pcOutSample->iURight = pcInSample->aiU[iSubSourcePos]; 1547 1548 pcOutSample->iVRight = pcInSample->aiV[iSubSourcePos]; … … 1559 1560 else 1560 1561 { 1561 #if H HI_VSO_COLOR_PLANES1562 #if H_3D_VSO_COLOR_PLANES 1562 1563 riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef, 1563 1564 pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef, … … 1576 1577 { 1577 1578 Pel piBlendedValueY; 1578 #if H HI_VSO_COLOR_PLANES1579 #if H_3D_VSO_COLOR_PLANES 1579 1580 Pel piBlendedValueU; 1580 1581 Pel piBlendedValueV; … … 1584 1585 pcOutSample->iYLeft, 1585 1586 pcInSample ->aiY[iSubSourcePos], 1586 #if H HI_VSO_COLOR_PLANES1587 #if H_3D_VSO_COLOR_PLANES 1587 1588 pcOutSample->iULeft, 1588 1589 pcInSample ->aiU[iSubSourcePos], … … 1595 1596 iFilled, 1596 1597 piBlendedValueY 1597 #if H HI_VSO_COLOR_PLANES1598 #if H_3D_VSO_COLOR_PLANES 1598 1599 , piBlendedValueU, 1599 1600 piBlendedValueV … … 1607 1608 pcOutSample->iYRight = pcInSample ->aiY[iSubSourcePos]; 1608 1609 pcOutSample->iYBlended = piBlendedValueY; 1609 #if H HI_VSO_COLOR_PLANES1610 #if H_3D_VSO_COLOR_PLANES 1610 1611 pcOutSample->iURight = pcInSample ->aiU[iSubSourcePos]; 1611 1612 pcOutSample->iUBlended = piBlendedValueU; … … 1617 1618 // Get Error 1618 1619 Int iDiffY = pcOutSample->iYRef - piBlendedValueY; 1619 #if H HI_VSO_COLOR_PLANES1620 #if H_3D_VSO_COLOR_PLANES 1620 1621 Int iDiffU = pcOutSample->iURef - piBlendedValueU; 1621 1622 Int iDiffV = pcOutSample->iVRef - piBlendedValueV; … … 1628 1629 { 1629 1630 Int iDiffY = pcOutSample->iYRef - piBlendedValueY; 1630 #if H HI_VSO_COLOR_PLANES1631 #if H_3D_VSO_COLOR_PLANES 1631 1632 Int iDiffU = pcOutSample->iURef - piBlendedValueU; 1632 1633 Int iDiffV = pcOutSample->iVRef - piBlendedValueV; … … 1680 1681 1681 1682 1682 #if H HI_VSO_COLOR_PLANES1683 #if H_3D_VSO_COLOR_PLANES 1683 1684 template <BlenMod iBM, Bool bBitInc> __inline Void 1684 1685 TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ) … … 1695 1696 if (iBM == BLEND_LEFT ) 1696 1697 { 1697 #if H HI_VSO_COLOR_PLANES1698 #if H_3D_VSO_COLOR_PLANES 1698 1699 xGetBlendedValueBM1( iYL, iYR, iUL, iUR, iVL, iVR, iDepthL, iDepthR, iFilledL, iFilledR, riY, riU, riV ); 1699 1700 #else … … 1703 1704 else 1704 1705 { 1705 #if H HI_VSO_COLOR_PLANES1706 #if H_3D_VSO_COLOR_PLANES 1706 1707 xGetBlendedValueBM2( iYL, iYR, iUL, iUR, iVL, iVR, iDepthL, iDepthR, iFilledL, iFilledR, riY, riU, riV ); 1707 1708 #else … … 1721 1722 { 1722 1723 riY = xBlend( iYL, iYR, iFilledR >> 1 ); 1723 #if H HI_VSO_COLOR_PLANES1724 #if H_3D_VSO_COLOR_PLANES 1724 1725 riU = xBlend( iUL, iUR, iFilledR >> 1 ); 1725 1726 riV = xBlend( iVL, iVR, iFilledR >> 1 ); … … 1730 1731 { 1731 1732 riY = xBlend( iYR, iYL, (iFilledL >> 1) ); 1732 #if H HI_VSO_COLOR_PLANES1733 #if H_3D_VSO_COLOR_PLANES 1733 1734 riU = xBlend( iUR, iUL, (iFilledL >> 1) ); 1734 1735 riV = xBlend( iVR, iVL, (iFilledL >> 1) ); … … 1738 1739 { 1739 1740 riY = xBlend( iYL, iYR, m_iBlendDistWeight ); 1740 #if H HI_VSO_COLOR_PLANES1741 #if H_3D_VSO_COLOR_PLANES 1741 1742 riU = xBlend( iUL, iUR, m_iBlendDistWeight ); 1742 1743 riV = xBlend( iVL, iVR, m_iBlendDistWeight ); … … 1747 1748 { 1748 1749 riY = iYL; 1749 #if H HI_VSO_COLOR_PLANES1750 #if H_3D_VSO_COLOR_PLANES 1750 1751 riU = iUL; 1751 1752 riV = iVL; … … 1755 1756 { 1756 1757 riY = iYR; 1757 #if H HI_VSO_COLOR_PLANES1758 #if H_3D_VSO_COLOR_PLANES 1758 1759 riU = iUR; 1759 1760 riV = iVR; … … 1766 1767 { 1767 1768 riY = iYR; 1768 #if H HI_VSO_COLOR_PLANES1769 #if H_3D_VSO_COLOR_PLANES 1769 1770 riU = iUR; 1770 1771 riV = iVR; … … 1774 1775 { 1775 1776 riY = iYL; 1776 #if H HI_VSO_COLOR_PLANES1777 #if H_3D_VSO_COLOR_PLANES 1777 1778 riU = iUL; 1778 1779 riV = iVL; … … 1785 1786 { 1786 1787 riY = iYL; 1787 #if H HI_VSO_COLOR_PLANES1788 #if H_3D_VSO_COLOR_PLANES 1788 1789 riU = iUL; 1789 1790 riV = iVL; … … 1793 1794 { 1794 1795 riY = iYR; 1795 #if H HI_VSO_COLOR_PLANES1796 #if H_3D_VSO_COLOR_PLANES 1796 1797 riU = iUR; 1797 1798 riV = iVR; … … 1802 1803 1803 1804 template <BlenMod iBM, Bool bBitInc> __inline Void 1804 #if H HI_VSO_COLOR_PLANES1805 #if H_3D_VSO_COLOR_PLANES 1805 1806 TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ) 1806 1807 #else … … 1811 1812 { 1812 1813 riY = iYL; 1813 #if H HI_VSO_COLOR_PLANES1814 #if H_3D_VSO_COLOR_PLANES 1814 1815 riU = iUL; 1815 1816 riV = iVL; … … 1819 1820 { 1820 1821 riY = iYR; 1821 #if H HI_VSO_COLOR_PLANES1822 #if H_3D_VSO_COLOR_PLANES 1822 1823 riU = iUR; 1823 1824 riV = iVR; … … 1827 1828 { 1828 1829 riY = xBlend( iYR, iYL, iFilledL ); 1829 #if H HI_VSO_COLOR_PLANES1830 #if H_3D_VSO_COLOR_PLANES 1830 1831 riU = xBlend( iUR, iUL, iFilledL ); 1831 1832 riV = xBlend( iVR, iUL, iFilledL ); … … 1835 1836 1836 1837 template <BlenMod iBM, Bool bBitInc> __inline Void 1837 #if H HI_VSO_COLOR_PLANES1838 #if H_3D_VSO_COLOR_PLANES 1838 1839 TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ) 1839 1840 #else … … 1844 1845 { 1845 1846 riY = iYR; 1846 #if H HI_VSO_COLOR_PLANES1847 #if H_3D_VSO_COLOR_PLANES 1847 1848 riU = iUR; 1848 1849 riV = iVR; … … 1852 1853 { 1853 1854 riY = iYL; 1854 #if H HI_VSO_COLOR_PLANES1855 #if H_3D_VSO_COLOR_PLANES 1855 1856 riU = iUL; 1856 1857 riV = iVL; … … 1860 1861 { 1861 1862 riY = xBlend( iYL, iYR, iFilledR ); 1862 #if H HI_VSO_COLOR_PLANES1863 #if H_3D_VSO_COLOR_PLANES 1863 1864 riU = xBlend( iUL, iUR, iFilledR ); 1864 1865 riV = xBlend( iVL, iUR, iFilledR ); … … 1891 1892 template class TRenSingleModelC<BLEND_RIGHT,false>; 1892 1893 1893 #if def LGE_VSO_EARLY_SKIP_A00931894 #if H_3D_VSO_EARLY_SKIP 1894 1895 template <BlenMod iBM, Bool bBitInc> 1895 1896 __inline Bool … … 1957 1958 } 1958 1959 #endif 1959 #endif 1960 1960 #endif // H_3D 1961 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenSingleModel.h
r438 r446 32 32 */ 33 33 34 #if !QC_MVHEVC_B0046 34 35 35 #ifndef __TRENSINGLEMODEL__ 36 36 #define __TRENSINGLEMODEL__ … … 51 51 #include <cstring> 52 52 53 53 #if H_3D_VSO 54 54 using namespace std; 55 55 56 57 #if HHI_VSO_RM_ASSERTIONS 56 #if H_3D_VSO_RM_ASSERTIONS 58 57 #define RM_AOT( exp ) AOT ( exp ) 59 58 #define RM_AOF( exp ) AOF ( exp ) … … 70 69 71 70 virtual ~TRenSingleModel() { } 72 #if LGE_VSO_EARLY_SKIP_A009371 #if H_3D_VSO_EARLY_SKIP 73 72 virtual Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ) = 0; 74 73 #else … … 82 81 83 82 // Set Data 84 #if def LGE_VSO_EARLY_SKIP_A009383 #if H_3D_VSO_EARLY_SKIP 85 84 virtual Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride ) = 0; 86 85 #else … … 90 89 91 90 // Get Distortion 92 #if def LGE_VSO_EARLY_SKIP_A009391 #if H_3D_VSO_EARLY_SKIP 93 92 virtual RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride)=0; 94 93 #else … … 109 108 // video 110 109 Pel aiY[5] ; // y-value 111 #if H HI_VSO_COLOR_PLANES110 #if H_3D_VSO_COLOR_PLANES 112 111 Pel aiU[5] ; // u-value 113 112 Pel aiV[5] ; // v-value … … 126 125 Pel iYRight ; 127 126 Pel iYBlended ; 128 #if H HI_VSO_COLOR_PLANES127 #if H_3D_VSO_COLOR_PLANES 129 128 Pel iULeft ; 130 129 Pel iURight ; … … 148 147 // reference 149 148 Pel iYRef ; 150 #if H HI_VSO_COLOR_PLANES149 #if H_3D_VSO_COLOR_PLANES 151 150 Pel iURef ; 152 151 Pel iVRef ; … … 161 160 162 161 // Create Model 163 #if LGE_VSO_EARLY_SKIP_A0093162 #if H_3D_VSO_EARLY_SKIP 164 163 Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ); 165 164 #else … … 172 171 Void setup ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bKeepReference ); 173 172 174 #if LGE_VSO_EARLY_SKIP_A0093173 #if H_3D_VSO_EARLY_SKIP 175 174 Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride ); 176 175 #else … … 180 179 181 180 // Get Distortion 182 #if def LGE_VSO_EARLY_SKIP_A0093181 #if H_3D_VSO_EARLY_SKIP 183 182 RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride); 184 183 #else … … 198 197 ///// Rendering ///// 199 198 // Left to Right 200 #if LGE_VSO_EARLY_SKIP_A0093199 #if H_3D_VSO_EARLY_SKIP 201 200 __inline Bool xDetectEarlySkipL ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride ); 202 201 __inline Bool xDetectEarlySkipR ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride ); … … 229 228 template<Bool bSet> __inline Void xSetShiftedPelBlend ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError ); 230 229 231 #if H HI_VSO_COLOR_PLANES230 #if H_3D_VSO_COLOR_PLANES 232 231 __inline Void xGetBlendedValue ( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ); 233 232 __inline Void xGetBlendedValueBM1 ( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ); … … 260 259 __inline Void xSetInts ( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal ); 261 260 262 #if H HI_VSO_COLOR_PLANES261 #if H_3D_VSO_COLOR_PLANES 263 262 Void xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV ); 264 263 #else … … 367 366 Int m_iShiftPrec; 368 367 Int m_iHoleMargin; 369 #if def LGE_VSO_EARLY_SKIP_A0093368 #if H_3D_VSO_EARLY_SKIP 370 369 Bool m_bEarlySkip; 371 370 #endif … … 385 384 386 385 //// Early Skip 387 #if def LGE_VSO_EARLY_SKIP_A0093386 #if H_3D_VSO_EARLY_SKIP 388 387 Bool* m_pbHorSkip; 389 388 #endif 390 389 }; 391 390 391 #endif // H_3D 392 392 #endif //__TRENSINGLEMODEL__ 393 #endif 394 393 394 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenTop.cpp
r438 r446 32 32 */ 33 33 34 34 35 #include "TRenImage.h" 35 36 #include "TRenTop.h" … … 39 40 #include <math.h> 40 41 #include "../TLibCommon/CommonDef.h" 42 #if H_3D 43 41 44 42 45 Void TRenTop::xGetDataPointers( PelImage*& rpcInputImage, PelImage*& rpcOutputImage, PelImage*& rpcInputDepth, PelImage*& rpcOutputDepth, PelImage*& rpcFilled, Bool bRenderDepth ) … … 1588 1591 Void TRenTop::xEnhSimilarityPlane ( PelImagePlane** apcLeftPlane, PelImagePlane** apcRightPlane, PelImagePlane* pcFilledLeftPlane, PelImagePlane* pcFilledRightPlane, UInt uiNumberOfPlanes ) 1589 1592 { 1593 AOF( g_bitDepthC == g_bitDepthY ); 1590 1594 AOT( m_iSimEnhBaseView != 1 && m_iSimEnhBaseView != 2 ); 1591 1595 Int iWidth = (*apcRightPlane)->getWidth (); 1592 1596 Int iHeight = (*apcRightPlane)->getHeight(); 1593 1597 1594 Int* aiHistLeft = new Int[ g_uiIBDI_MAX + 1];1595 Int* aiHistRight = new Int[ g_uiIBDI_MAX + 1];1596 Pel* aiConvLUT = new Pel[ g_uiIBDI_MAX + 1];1598 Int* aiHistLeft = new Int[ ((Int64)1 ) << g_bitDepthY ]; 1599 Int* aiHistRight = new Int[ ((Int64)1 ) << g_bitDepthY ]; 1600 Pel* aiConvLUT = new Pel[ ((Int64)1 ) << g_bitDepthY ]; 1597 1601 1598 1602 for (UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++ ) 1599 1603 { 1600 for (Int iCurVal = 0 ; iCurVal < = g_uiIBDI_MAX; iCurVal++)1604 for (Int iCurVal = 0 ; iCurVal < ( 1 << g_bitDepthY ); iCurVal++) 1601 1605 { 1602 1606 aiHistLeft [iCurVal] = 0; … … 1645 1649 Int iCheckSumRight = 0; 1646 1650 1647 for (Int iCurVal = 0 ; iCurVal < = g_uiIBDI_MAX; iCurVal++)1651 for (Int iCurVal = 0 ; iCurVal < ( 1 << g_bitDepthY ); iCurVal++) 1648 1652 { 1649 1653 iCheckSumLeft += aiHistLeft [iCurVal]; … … 1652 1656 1653 1657 1654 while( iCurChangeVal < = g_uiIBDI_MAX)1658 while( iCurChangeVal < ( 1 << g_bitDepthY ) ) 1655 1659 { 1656 1660 if ( iCumSumBase == iCumSumChange ) 1657 1661 { 1658 aiConvLUT[iCurChangeVal] = Min(iCurBaseVal, g_uiIBDI_MAX);1662 aiConvLUT[iCurChangeVal] = std::min( iCurBaseVal, ( 1 << g_bitDepthY ) - 1 ); 1659 1663 iCurBaseVal ++; 1660 1664 iCurChangeVal++; 1661 1665 iCumSumChange += aiHistChange[iCurChangeVal]; 1662 if (iCurBaseVal < = g_uiIBDI_MAX)1666 if (iCurBaseVal < ( 1 << g_bitDepthY ) ) 1663 1667 { 1664 1668 iCumSumBase += aiHistBase [iCurBaseVal] ; … … 1668 1672 { 1669 1673 iCurBaseVal++; 1670 if (iCurBaseVal < = g_uiIBDI_MAX)1674 if (iCurBaseVal < ( 1 << g_bitDepthY ) ) 1671 1675 { 1672 1676 iCumSumBase += aiHistBase [iCurBaseVal] ; … … 1675 1679 else if ( iCumSumBase > iCumSumChange) 1676 1680 { 1677 aiConvLUT[iCurChangeVal] = Min(iCurBaseVal, g_uiIBDI_MAX);1681 aiConvLUT[iCurChangeVal] = std::min(iCurBaseVal, ( 1 << g_bitDepthY )-1); 1678 1682 iCurChangeVal++; 1679 1683 iCumSumChange += aiHistChange [iCurChangeVal] ; … … 1884 1888 Void TRenTop::temporalFilterVSRS( TComPicYuv* pcPicYuvVideoCur, TComPicYuv* pcPicYuvDepthCur, TComPicYuv* pcPicYuvVideoLast, TComPicYuv* pcPicYuvDepthLast, Bool bFirstFrame ) 1885 1889 { 1890 AOF( g_bitDepthY == g_bitDepthC ); 1886 1891 Int iSADThres = 100 ; //threshold of sad in 4*4 block motion detection 1887 1892 … … 1950 1955 { //Weight: 0.75 1951 1956 Int iFilt = (( (pcDepthLastDataBlk[iCurPosX] << 1 ) + pcDepthLastDataBlk[iCurPosX] + pcDepthCurDataBlk[iCurPosX] + 2 ) >> 2 ); 1952 assert( (iFilt >= 0) && (iFilt < = g_uiIBDI_MAX) );1957 assert( (iFilt >= 0) && (iFilt < ( 1 << g_bitDepthY ) ) ); 1953 1958 pcDepthCurDataBlk[iCurPosX] = pcDepthLastDataBlk[iCurPosX]; 1954 1959 pcDepthCurDataBlk[iCurPosX] = iFilt; … … 2221 2226 if(m_aiBlkMoving != NULL ) delete[] m_aiBlkMoving; 2222 2227 } 2228 #endif // H_3D -
branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenTop.h
r438 r446 38 38 #include "../TLibCommon/CommonDef.h" 39 39 #include "../TLibCommon/TComPicYuv.h" 40 41 #if H_3D 40 42 #include <list> 41 43 #include <vector> … … 268 270 }; 269 271 272 #endif // H_3D 270 273 #endif //__TRENTOP__
Note: See TracChangeset for help on using the changeset viewer.