Changeset 1360 in 3DVCSoftware
- Timestamp:
- 28 Oct 2015, 17:46:00 (10 years ago)
- Location:
- branches/HTM-15.2-dev
- Files:
-
- 45 added
- 4 deleted
- 88 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.2-dev/source/App/TAppDecoder/TAppDecCfg.cpp
r1356 r1360 62 62 \param argv array of arguments 63 63 */ 64 Bool TAppDecCfg::parseCfg( Int argc, Char* argv[] )64 Bool TAppDecCfg::parseCfg( Int argc, TChar* argv[] ) 65 65 { 66 66 Bool do_help = false; 67 string cfg_BitstreamFile;68 string cfg_ReconFile;69 67 string cfg_TargetDecLayerIdSetFile; 70 68 #if NH_3D … … 79 77 80 78 ("help", do_help, false, "this help text") 81 ("BitstreamFile,b", cfg_BitstreamFile,string(""), "bitstream input file name")82 ("ReconFile,o", cfg_ReconFile,string(""), "reconstructed YUV output file name\n"79 ("BitstreamFile,b", m_bitstreamFileName, string(""), "bitstream input file name") 80 ("ReconFile,o", m_reconFileName, string(""), "reconstructed YUV output file name\n" 83 81 "YUV writing is skipped if omitted") 84 82 #if NH_3D … … 106 104 ("PrintNalus,n", m_printReceivedNalus, false, "Print information on received NAL units") 107 105 #endif 106 ("SEIColourRemappingInfoFilename", m_colourRemapSEIFileName, string(""), "Colour Remapping YUV output file name. If empty, no remapping is applied (ignore SEI message)\n") 107 108 108 #if O0043_BEST_EFFORT_DECODING 109 109 ("ForceDecodeBitDepth", m_forceDecodeBitDepth, 0U, "Force the decoder to operate at a particular bit-depth (best effort decoding)") … … 119 119 po::setDefaults(opts); 120 120 po::ErrorReporter err; 121 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (constChar**) argv, err);122 123 for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)121 const list<const TChar*>& argv_unhandled = po::scanArgv(opts, argc, (const TChar**) argv, err); 122 123 for (list<const TChar*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) 124 124 { 125 125 fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); … … 148 148 } 149 149 150 /* convert std::string to c string for compatability */ 151 m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 152 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 153 154 #if NH_3D 155 m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str()); 156 #endif 157 158 if (!m_pchBitstreamFile) 150 if (m_bitstreamFileName.empty()) 159 151 { 160 152 fprintf(stderr, "No input file specified, aborting\n"); … … 217 209 218 210 #if NH_MV 219 Void TAppDecCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend,Char*& rpchOutputFileName)211 Void TAppDecCfg::xAppendToFileNameEnd( const TChar* pchInputFileName, const TChar* pchStringToAppend, TChar*& rpchOutputFileName) 220 212 { 221 213 size_t iInLength = strlen(pchInputFileName); 222 214 size_t iAppendLength = strlen(pchStringToAppend); 223 215 224 rpchOutputFileName = ( Char*) malloc(iInLength+iAppendLength+1);225 Char* pCDot = strrchr(pchInputFileName,'.');216 rpchOutputFileName = (TChar*) malloc(iInLength+iAppendLength+1); 217 const TChar* pCDot = strrchr(pchInputFileName,'.'); 226 218 pCDot = pCDot ? pCDot : pchInputFileName + iInLength; 227 219 size_t iCharsToDot = pCDot - pchInputFileName ; -
branches/HTM-15.2-dev/source/App/TAppDecoder/TAppDecCfg.h
r1356 r1360 60 60 { 61 61 protected: 62 Char* m_pchBitstreamFile;///< input bitstream file name63 Char* m_pchReconFile;///< output reconstruction file name62 std::string m_bitstreamFileName; ///< input bitstream file name 63 std::string m_reconFileName; ///< output reconstruction file name 64 64 Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip 65 65 Int m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit depth used for writing output … … 69 69 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 70 70 Bool m_decodedNoDisplaySEIEnabled; ///< Enable(true)/disable(false) writing only pictures that get displayed based on the no display SEI message 71 std::string m_colourRemapSEIFileName; ///< output Colour Remapping file name 71 72 std::vector<Int> m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process. 72 73 … … 78 79 Bool m_bClipOutputVideoToRec709Range; ///< If true, clip the output video to the Rec 709 range on saving. 79 80 #if NH_MV 80 std::vector< Char*> m_pchReconFiles;///< array of output reconstruction file name create from output reconstruction file name81 std::vector<TChar*> m_pchReconFiles; ///< array of output reconstruction file name create from output reconstruction file name 81 82 82 Int m_targetOptLayerSetIdx; 83 Int m_targetOptLayerSetIdx; ///< target output layer set index 83 84 Int m_targetDecLayerSetIdx; 84 85 Int m_baseLayerOutputFlag; 85 86 Int m_baseLayerPicOutputFlag; 86 87 Int m_auOutputFlag; 87 Int m_maxLayerId; 88 Int m_maxLayerId; ///< maximum nuh_layer_id decoded 88 89 std::ifstream m_bitstreamFile; 89 90 Int m_highestTid; 90 91 Bool m_targetDecLayerIdSetFileEmpty; ///< indication if target layers are given by file 91 92 92 Bool m_printVpsInfo; ///< Output VPS information93 Bool m_printVpsInfo; ///< Output VPS information 93 94 Bool m_printPicOutput; ///< Print information on picture output 94 95 Bool m_printReceivedNalus; ///< Print information on received NAL units 95 96 #if NH_3D 96 Char*m_pchScaleOffsetFile; ///< output coded scale and offset parameters97 TChar* m_pchScaleOffsetFile; ///< output coded scale and offset parameters 97 98 Bool m_depth420OutputFlag; ///< output depth layers in 4:2:0 98 99 #endif 99 100 100 Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend,Char*& rpchOutputFileName); ///< create filenames101 Void xAppendToFileNameEnd( const TChar* pchInputFileName, const TChar* pchStringToAppend, TChar*& rpchOutputFileName); ///< create filenames 101 102 #endif 102 103 103 104 public: 104 105 TAppDecCfg() 105 : m_ pchBitstreamFile(NULL)106 , m_ pchReconFile(NULL)106 : m_bitstreamFileName() 107 , m_reconFileName() 107 108 , m_iSkipFrame(0) 109 // m_outputBitDepth array initialised below 108 110 , m_outputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED) 109 111 , m_iMaxTemporalLayer(-1) 110 112 , m_decodedPictureHashSEIEnabled(0) 111 113 , m_decodedNoDisplaySEIEnabled(false) 114 , m_colourRemapSEIFileName() 115 , m_targetDecLayerIdSet() 112 116 , m_respectDefDispWindow(0) 113 117 #if O0043_BEST_EFFORT_DECODING 114 118 , m_forceDecodeBitDepth(0) 115 119 #endif 120 , m_outputDecodedSEIMessagesFilename() 121 , m_bClipOutputVideoToRec709Range(false) 116 122 #if NH_MV 117 123 , m_highestTid(-1) … … 131 137 virtual ~TAppDecCfg() {} 132 138 133 Bool parseCfg ( Int argc, Char* argv[] ); ///< initialize option class from configuration139 Bool parseCfg ( Int argc, TChar* argv[] ); ///< initialize option class from configuration 134 140 }; 135 141 -
branches/HTM-15.2-dev/source/App/TAppDecoder/TAppDecTop.cpp
r1321 r1360 62 62 : m_numDecoders( 0 ) 63 63 #endif 64 ,m_pcSeiColourRemappingInfoPrevious(NULL) 64 65 { 65 66 #if NH_MV … … 118 119 xDestroyDecLib(); 119 120 #endif 120 121 if (m_pchBitstreamFile) 122 { 123 free (m_pchBitstreamFile); 124 m_pchBitstreamFile = NULL; 125 } 121 m_bitstreamFileName.clear(); 126 122 #if NH_MV 127 123 for (Int decIdx = 0; decIdx < m_numDecoders; decIdx++) … … 134 130 } 135 131 #endif 136 if (m_pchReconFile) 137 { 138 free (m_pchReconFile); 139 m_pchReconFile = NULL; 140 } 132 m_reconFileName.clear(); 141 133 #if NH_3D 142 134 if (m_pchScaleOffsetFile) … … 226 218 TComList<TComPic*>* pcListPic = NULL; 227 219 228 ifstream bitstreamFile(m_ pchBitstreamFile, ifstream::in | ifstream::binary);220 ifstream bitstreamFile(m_bitstreamFileName.c_str(), ifstream::in | ifstream::binary); 229 221 if (!bitstreamFile) 230 222 { 231 fprintf(stderr, "\nfailed to open bitstream file `%s' for reading\n", m_ pchBitstreamFile);223 fprintf(stderr, "\nfailed to open bitstream file `%s' for reading\n", m_bitstreamFileName.c_str()); 232 224 exit(EXIT_FAILURE); 233 225 } … … 250 242 251 243 m_iPOCLastDisplay += m_iSkipFrame; // set the last displayed POC correctly for skip forward. 244 245 // clear contents of colour-remap-information-SEI output file 246 if (!m_colourRemapSEIFileName.empty()) 247 { 248 std::ofstream ofile(m_colourRemapSEIFileName.c_str()); 249 if (!ofile.good() || !ofile.is_open()) 250 { 251 fprintf(stderr, "\nUnable to open file '%s' for writing colour-remap-information-SEI video\n", m_colourRemapSEIFileName.c_str()); 252 exit(EXIT_FAILURE); 253 } 254 } 252 255 253 256 // main decoder loop … … 336 339 if( pcListPic ) 337 340 { 338 if ( m_pchReconFile && !openedReconFile)341 if ( (!m_reconFileName.empty()) && (!openedReconFile) ) 339 342 { 340 343 const BitDepths &bitDepths=pcListPic->front()->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture. … … 346 349 } 347 350 } 348 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 351 352 m_cTVideoIOYuvReconFile.open( m_reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 349 353 openedReconFile = true; 350 354 } … … 436 440 } 437 441 #else 438 if ( m_pchReconFile)442 if ( !m_reconFileName.empty() ) 439 443 { 440 444 m_cTVideoIOYuvReconFile. close(); … … 444 448 m_cTDecTop.destroy(); 445 449 #endif 450 if (m_pcSeiColourRemappingInfoPrevious != NULL) 451 { 452 delete m_pcSeiColourRemappingInfoPrevious; 453 m_pcSeiColourRemappingInfoPrevious = NULL; 454 } 446 455 #if NH_3D 447 456 m_cCamParsCollector.uninit(); … … 474 483 } 475 484 #endif 485 if (m_pcSeiColourRemappingInfoPrevious != NULL) 486 { 487 delete m_pcSeiColourRemappingInfoPrevious; 488 m_pcSeiColourRemappingInfoPrevious = NULL; 489 } 476 490 } 477 491 … … 549 563 // write to file 550 564 numPicsNotYetDisplayed = numPicsNotYetDisplayed-2; 551 if ( m_pchReconFile)565 if ( !m_reconFileName.empty() ) 552 566 { 553 567 const Window &conf = pcPicTop->getConformanceWindow(); … … 617 631 dpbFullness--; 618 632 } 619 if ( m_pchReconFile)633 if ( !m_reconFileName.empty() ) 620 634 { 621 635 const Window &conf = pcPic->getConformanceWindow(); … … 631 645 } 632 646 647 if (!m_colourRemapSEIFileName.empty()) 648 { 649 xOutputColourRemapPic(pcPic); 650 } 651 633 652 // update POC of display order 634 653 m_iPOCLastDisplay = pcPic->getPOC(); … … 678 697 // write to file 679 698 680 if ( m_pchReconFile)699 if ( !m_reconFileName.empty() ) 681 700 { 682 701 const Window &conf = pcPicTop->getConformanceWindow(); … … 736 755 { 737 756 // write to file 738 if ( m_pchReconFile)757 if ( !m_reconFileName.empty() ) 739 758 { 740 759 const Window &conf = pcPic->getConformanceWindow(); … … 747 766 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 748 767 NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); 768 } 769 770 if (!m_colourRemapSEIFileName.empty()) 771 { 772 xOutputColourRemapPic(pcPic); 749 773 } 750 774 … … 2671 2695 2672 2696 // create recon file related stuff 2673 Char* pchTempFilename = NULL;2674 if ( m_pchReconFile)2675 { 2676 Char buffer[4];2697 TChar* pchTempFilename = NULL; 2698 if ( !m_reconFileName.empty() ) 2699 { 2700 TChar buffer[4]; 2677 2701 sprintf(buffer,"_%i", layerId ); 2678 assert ( m_pchReconFile);2679 xAppendToFileNameEnd( m_ pchReconFile, buffer, pchTempFilename );2702 assert ( !m_reconFileName.empty() ); 2703 xAppendToFileNameEnd( m_reconFileName.c_str() , buffer, pchTempFilename ); 2680 2704 assert( m_pchReconFiles.size() == m_numDecoders ); 2681 2705 } … … 2870 2894 Void TAppDecTop::xInitFileIO() 2871 2895 { 2872 m_bitstreamFile.open(m_ pchBitstreamFile, ifstream::in | ifstream::binary);2896 m_bitstreamFile.open(m_bitstreamFileName.c_str(), ifstream::in | ifstream::binary); 2873 2897 2874 2898 if ( !m_bitstreamFile) 2875 2899 { 2876 fprintf(stderr, "\nUnable to open bitstream file `%s' for reading\n", m_ pchBitstreamFile);2900 fprintf(stderr, "\nUnable to open bitstream file `%s' for reading\n", m_bitstreamFileName.c_str()); 2877 2901 exit(EXIT_FAILURE); 2878 2902 } … … 2905 2929 Int decIdx = xGetDecoderIdx( curPic->getLayerId() ); 2906 2930 2907 if ( m_pchReconFile&& !m_reconOpen[decIdx] )2931 if ( !m_reconFileName.empty() && !m_reconOpen[decIdx] ) 2908 2932 { 2909 2933 const BitDepths &bitDepths= curPic->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture. … … 3007 3031 3008 3032 #endif 3033 3034 Void TAppDecTop::xOutputColourRemapPic(TComPic* pcPic) 3035 { 3036 const TComSPS &sps=pcPic->getPicSym()->getSPS(); 3037 SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO ); 3038 SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL; 3039 3040 if (colourRemappingInfo.size() > 1) 3041 { 3042 printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first."); 3043 } 3044 if (seiColourRemappingInfo) 3045 { 3046 applyColourRemapping(*pcPic->getPicYuvRec(), *seiColourRemappingInfo, sps); 3047 3048 // save the last CRI SEI received 3049 if (m_pcSeiColourRemappingInfoPrevious == NULL) 3050 { 3051 m_pcSeiColourRemappingInfoPrevious = new SEIColourRemappingInfo(); 3052 } 3053 m_pcSeiColourRemappingInfoPrevious->copyFrom(*seiColourRemappingInfo); 3054 } 3055 else // using the last CRI SEI received 3056 { 3057 // TODO: prevent persistence of CRI SEI across C(L)VS. 3058 if (m_pcSeiColourRemappingInfoPrevious != NULL) 3059 { 3060 if (m_pcSeiColourRemappingInfoPrevious->m_colourRemapPersistenceFlag == false) 3061 { 3062 printf("Warning No SEI-CRI message is present for the current picture, persistence of the CRI is not managed\n"); 3063 } 3064 applyColourRemapping(*pcPic->getPicYuvRec(), *m_pcSeiColourRemappingInfoPrevious, sps); 3065 } 3066 } 3067 } 3068 3069 // compute lut from SEI 3070 // use at lutPoints points aligned on a power of 2 value 3071 // SEI Lut must be in ascending values of coded Values 3072 static std::vector<Int> 3073 initColourRemappingInfoLut(const Int bitDepth_in, // bit-depth of the input values of the LUT 3074 const Int nbDecimalValues, // Position of the fixed point 3075 const std::vector<SEIColourRemappingInfo::CRIlut> &lut, 3076 const Int maxValue, // maximum output value 3077 const Int lutOffset) 3078 { 3079 const Int lutPoints = (1 << bitDepth_in) + 1 ; 3080 std::vector<Int> retLut(lutPoints); 3081 3082 // missing values: need to define default values before first definition (check codedValue[0] == 0) 3083 Int iTargetPrev = (lut.size() && lut[0].codedValue == 0) ? lut[0].targetValue: 0; 3084 Int startPivot = (lut.size())? ((lut[0].codedValue == 0)? 1: 0): 1; 3085 Int iCodedPrev = 0; 3086 // set max value with the coded bit-depth 3087 // + ((1 << nbDecimalValues) - 1) is for the added bits 3088 const Int maxValueFixedPoint = (maxValue << nbDecimalValues) + ((1 << nbDecimalValues) - 1); 3089 3090 Int iValue = 0; 3091 3092 for ( Int iPivot=startPivot ; iPivot < (Int)lut.size(); iPivot++ ) 3093 { 3094 Int iCodedNext = lut[iPivot].codedValue; 3095 Int iTargetNext = lut[iPivot].targetValue; 3096 3097 // ensure correct bit depth and avoid overflow in lut address 3098 Int iCodedNext_bitDepth = std::min(iCodedNext, (1 << bitDepth_in)); 3099 3100 const Int divValue = (iCodedNext - iCodedPrev > 0)? (iCodedNext - iCodedPrev): 1; 3101 const Int lutValInit = (lutOffset + iTargetPrev) << nbDecimalValues; 3102 const Int roundValue = divValue / 2; 3103 for ( ; iValue<iCodedNext_bitDepth; iValue++ ) 3104 { 3105 Int value = iValue; 3106 Int interpol = ((((value-iCodedPrev) * (iTargetNext - iTargetPrev)) << nbDecimalValues) + roundValue) / divValue; 3107 retLut[iValue] = std::min(lutValInit + interpol , maxValueFixedPoint); 3108 } 3109 iCodedPrev = iCodedNext; 3110 iTargetPrev = iTargetNext; 3111 } 3112 // fill missing values if necessary 3113 if(iCodedPrev < (1 << bitDepth_in)+1) 3114 { 3115 Int iCodedNext = (1 << bitDepth_in); 3116 Int iTargetNext = (1 << bitDepth_in) - 1; 3117 3118 const Int divValue = (iCodedNext - iCodedPrev > 0)? (iCodedNext - iCodedPrev): 1; 3119 const Int lutValInit = (lutOffset + iTargetPrev) << nbDecimalValues; 3120 const Int roundValue = divValue / 2; 3121 3122 for ( ; iValue<=iCodedNext; iValue++ ) 3123 { 3124 Int value = iValue; 3125 Int interpol = ((((value-iCodedPrev) * (iTargetNext - iTargetPrev)) << nbDecimalValues) + roundValue) / divValue; 3126 retLut[iValue] = std::min(lutValInit + interpol , maxValueFixedPoint); 3127 } 3128 } 3129 return retLut; 3130 } 3131 3132 static Void 3133 initColourRemappingInfoLuts(std::vector<Int> (&preLut)[3], 3134 std::vector<Int> (&postLut)[3], 3135 SEIColourRemappingInfo &pCriSEI, 3136 const Int maxBitDepth) 3137 { 3138 Int internalBitDepth = pCriSEI.m_colourRemapBitDepth; 3139 for ( Int c=0 ; c<3 ; c++ ) 3140 { 3141 std::sort(pCriSEI.m_preLut[c].begin(), pCriSEI.m_preLut[c].end()); // ensure preLut is ordered in ascending values of codedValues 3142 preLut[c] = initColourRemappingInfoLut(pCriSEI.m_colourRemapInputBitDepth, maxBitDepth - pCriSEI.m_colourRemapInputBitDepth, pCriSEI.m_preLut[c], ((1 << internalBitDepth) - 1), 0); //Fill preLut 3143 3144 std::sort(pCriSEI.m_postLut[c].begin(), pCriSEI.m_postLut[c].end()); // ensure postLut is ordered in ascending values of codedValues 3145 postLut[c] = initColourRemappingInfoLut(pCriSEI.m_colourRemapBitDepth, maxBitDepth - pCriSEI.m_colourRemapBitDepth, pCriSEI.m_postLut[c], (1 << internalBitDepth) - 1, 0); //Fill postLut 3146 } 3147 } 3148 3149 // apply lut. 3150 // Input lut values are aligned on power of 2 boundaries 3151 static Int 3152 applyColourRemappingInfoLut1D(Int inVal, const std::vector<Int> &lut, const Int inValPrecisionBits) 3153 { 3154 const Int roundValue = (inValPrecisionBits)? 1 << (inValPrecisionBits - 1): 0; 3155 inVal = std::min(std::max(0, inVal), (Int)(((lut.size()-1) << inValPrecisionBits))); 3156 Int index = (Int) std::min((inVal >> inValPrecisionBits), (Int)(lut.size()-2)); 3157 Int outVal = (( inVal - (index<<inValPrecisionBits) ) * (lut[index+1] - lut[index]) + roundValue) >> inValPrecisionBits; 3158 outVal += lut[index] ; 3159 3160 return outVal; 3161 } 3162 3163 static Int 3164 applyColourRemappingInfoMatrix(const Int (&colourRemapCoeffs)[3], const Int postOffsetShift, const Int p0, const Int p1, const Int p2, const Int offset) 3165 { 3166 Int YUVMat = (colourRemapCoeffs[0]* p0 + colourRemapCoeffs[1]* p1 + colourRemapCoeffs[2]* p2 + offset) >> postOffsetShift; 3167 return YUVMat; 3168 } 3169 3170 static Void 3171 setColourRemappingInfoMatrixOffset(Int (&matrixOffset)[3], Int offset0, Int offset1, Int offset2) 3172 { 3173 matrixOffset[0] = offset0; 3174 matrixOffset[1] = offset1; 3175 matrixOffset[2] = offset2; 3176 } 3177 3178 static Void 3179 setColourRemappingInfoMatrixOffsets( Int (&matrixInputOffset)[3], 3180 Int (&matrixOutputOffset)[3], 3181 const Int bitDepth, 3182 const Bool crInputFullRangeFlag, 3183 const Int crInputMatrixCoefficients, 3184 const Bool crFullRangeFlag, 3185 const Int crMatrixCoefficients) 3186 { 3187 // set static matrix offsets 3188 Int crInputOffsetLuma = (crInputFullRangeFlag)? 0:-(16 << (bitDepth-8)); 3189 Int crOffsetLuma = (crFullRangeFlag)? 0:(16 << (bitDepth-8)); 3190 Int crInputOffsetChroma = 0; 3191 Int crOffsetChroma = 0; 3192 3193 switch(crInputMatrixCoefficients) 3194 { 3195 case MATRIX_COEFFICIENTS_RGB: 3196 crInputOffsetChroma = 0; 3197 if(!crInputFullRangeFlag) 3198 { 3199 fprintf(stderr, "WARNING: crInputMatrixCoefficients set to MATRIX_COEFFICIENTS_RGB and crInputFullRangeFlag not set\n"); 3200 crInputOffsetLuma = 0; 3201 } 3202 break; 3203 case MATRIX_COEFFICIENTS_UNSPECIFIED: 3204 case MATRIX_COEFFICIENTS_BT709: 3205 case MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE: 3206 crInputOffsetChroma = -(1 << (bitDepth-1)); 3207 break; 3208 default: 3209 fprintf(stderr, "WARNING: crInputMatrixCoefficients set to undefined value: %d\n", crInputMatrixCoefficients); 3210 } 3211 3212 switch(crMatrixCoefficients) 3213 { 3214 case MATRIX_COEFFICIENTS_RGB: 3215 crOffsetChroma = 0; 3216 if(!crFullRangeFlag) 3217 { 3218 fprintf(stderr, "WARNING: crMatrixCoefficients set to MATRIX_COEFFICIENTS_RGB and crInputFullRangeFlag not set\n"); 3219 crOffsetLuma = 0; 3220 } 3221 break; 3222 case MATRIX_COEFFICIENTS_UNSPECIFIED: 3223 case MATRIX_COEFFICIENTS_BT709: 3224 case MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE: 3225 crOffsetChroma = (1 << (bitDepth-1)); 3226 break; 3227 default: 3228 fprintf(stderr, "WARNING: crMatrixCoefficients set to undefined value: %d\n", crMatrixCoefficients); 3229 } 3230 3231 setColourRemappingInfoMatrixOffset(matrixInputOffset, crInputOffsetLuma, crInputOffsetChroma, crInputOffsetChroma); 3232 setColourRemappingInfoMatrixOffset(matrixOutputOffset, crOffsetLuma, crOffsetChroma, crOffsetChroma); 3233 } 3234 3235 Void TAppDecTop::applyColourRemapping(const TComPicYuv& pic, SEIColourRemappingInfo& criSEI, const TComSPS &activeSPS) 3236 { 3237 const Int maxBitDepth = 16; 3238 3239 // create colour remapped picture 3240 if( !criSEI.m_colourRemapCancelFlag && pic.getChromaFormat()!=CHROMA_400) // 4:0:0 not supported. 3241 { 3242 const Int iHeight = pic.getHeight(COMPONENT_Y); 3243 const Int iWidth = pic.getWidth(COMPONENT_Y); 3244 const ChromaFormat chromaFormatIDC = pic.getChromaFormat(); 3245 3246 TComPicYuv picYuvColourRemapped; 3247 picYuvColourRemapped.createWithoutCUInfo( iWidth, iHeight, chromaFormatIDC ); 3248 3249 const Int iStrideIn = pic.getStride(COMPONENT_Y); 3250 const Int iCStrideIn = pic.getStride(COMPONENT_Cb); 3251 const Int iStrideOut = picYuvColourRemapped.getStride(COMPONENT_Y); 3252 const Int iCStrideOut = picYuvColourRemapped.getStride(COMPONENT_Cb); 3253 const Bool b444 = ( pic.getChromaFormat() == CHROMA_444 ); 3254 const Bool b422 = ( pic.getChromaFormat() == CHROMA_422 ); 3255 const Bool b420 = ( pic.getChromaFormat() == CHROMA_420 ); 3256 3257 std::vector<Int> preLut[3]; 3258 std::vector<Int> postLut[3]; 3259 Int matrixInputOffset[3]; 3260 Int matrixOutputOffset[3]; 3261 const Pel *YUVIn[MAX_NUM_COMPONENT]; 3262 Pel *YUVOut[MAX_NUM_COMPONENT]; 3263 YUVIn[COMPONENT_Y] = pic.getAddr(COMPONENT_Y); 3264 YUVIn[COMPONENT_Cb] = pic.getAddr(COMPONENT_Cb); 3265 YUVIn[COMPONENT_Cr] = pic.getAddr(COMPONENT_Cr); 3266 YUVOut[COMPONENT_Y] = picYuvColourRemapped.getAddr(COMPONENT_Y); 3267 YUVOut[COMPONENT_Cb] = picYuvColourRemapped.getAddr(COMPONENT_Cb); 3268 YUVOut[COMPONENT_Cr] = picYuvColourRemapped.getAddr(COMPONENT_Cr); 3269 3270 const Int bitDepth = criSEI.m_colourRemapBitDepth; 3271 BitDepths bitDepthsCriFile; 3272 bitDepthsCriFile.recon[CHANNEL_TYPE_LUMA] = bitDepth; 3273 bitDepthsCriFile.recon[CHANNEL_TYPE_CHROMA] = bitDepth; // Different bitdepth is not implemented 3274 3275 const Int postOffsetShift = criSEI.m_log2MatrixDenom; 3276 const Int matrixRound = 1 << (postOffsetShift - 1); 3277 const Int postLutInputPrecision = (maxBitDepth - criSEI.m_colourRemapBitDepth); 3278 3279 if ( ! criSEI.m_colourRemapVideoSignalInfoPresentFlag ) // setting default 3280 { 3281 setColourRemappingInfoMatrixOffsets(matrixInputOffset, matrixOutputOffset, maxBitDepth, 3282 activeSPS.getVuiParameters()->getVideoFullRangeFlag(), activeSPS.getVuiParameters()->getMatrixCoefficients(), 3283 activeSPS.getVuiParameters()->getVideoFullRangeFlag(), activeSPS.getVuiParameters()->getMatrixCoefficients()); 3284 } 3285 else 3286 { 3287 setColourRemappingInfoMatrixOffsets(matrixInputOffset, matrixOutputOffset, maxBitDepth, 3288 activeSPS.getVuiParameters()->getVideoFullRangeFlag(), activeSPS.getVuiParameters()->getMatrixCoefficients(), 3289 criSEI.m_colourRemapFullRangeFlag, criSEI.m_colourRemapMatrixCoefficients); 3290 } 3291 3292 // add matrix rounding to output matrix offsets 3293 matrixOutputOffset[0] = (matrixOutputOffset[0] << postOffsetShift) + matrixRound; 3294 matrixOutputOffset[1] = (matrixOutputOffset[1] << postOffsetShift) + matrixRound; 3295 matrixOutputOffset[2] = (matrixOutputOffset[2] << postOffsetShift) + matrixRound; 3296 3297 // Merge matrixInputOffset and matrixOutputOffset to matrixOutputOffset 3298 matrixOutputOffset[0] += applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[0], 0, matrixInputOffset[0], matrixInputOffset[1], matrixInputOffset[2], 0); 3299 matrixOutputOffset[1] += applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[1], 0, matrixInputOffset[0], matrixInputOffset[1], matrixInputOffset[2], 0); 3300 matrixOutputOffset[2] += applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[2], 0, matrixInputOffset[0], matrixInputOffset[1], matrixInputOffset[2], 0); 3301 3302 // rescaling output: include CRI/output frame difference 3303 const Int scaleShiftOut_neg = abs(bitDepth - maxBitDepth); 3304 const Int scaleOut_round = 1 << (scaleShiftOut_neg-1); 3305 3306 initColourRemappingInfoLuts(preLut, postLut, criSEI, maxBitDepth); 3307 3308 assert(pic.getChromaFormat() != CHROMA_400); 3309 const Int hs = pic.getComponentScaleX(ComponentID(COMPONENT_Cb)); 3310 const Int maxOutputValue = (1 << bitDepth) - 1; 3311 3312 for( Int y = 0; y < iHeight; y++ ) 3313 { 3314 for( Int x = 0; x < iWidth; x++ ) 3315 { 3316 const Int xc = (x>>hs); 3317 Bool computeChroma = b444 || ((b422 || !(y&1)) && !(x&1)); 3318 3319 Int YUVPre_0 = applyColourRemappingInfoLut1D(YUVIn[COMPONENT_Y][x], preLut[0], 0); 3320 Int YUVPre_1 = applyColourRemappingInfoLut1D(YUVIn[COMPONENT_Cb][xc], preLut[1], 0); 3321 Int YUVPre_2 = applyColourRemappingInfoLut1D(YUVIn[COMPONENT_Cr][xc], preLut[2], 0); 3322 3323 Int YUVMat_0 = applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[0], postOffsetShift, YUVPre_0, YUVPre_1, YUVPre_2, matrixOutputOffset[0]); 3324 Int YUVLutB_0 = applyColourRemappingInfoLut1D(YUVMat_0, postLut[0], postLutInputPrecision); 3325 YUVOut[COMPONENT_Y][x] = std::min(maxOutputValue, (YUVLutB_0 + scaleOut_round) >> scaleShiftOut_neg); 3326 3327 if( computeChroma ) 3328 { 3329 Int YUVMat_1 = applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[1], postOffsetShift, YUVPre_0, YUVPre_1, YUVPre_2, matrixOutputOffset[1]); 3330 Int YUVLutB_1 = applyColourRemappingInfoLut1D(YUVMat_1, postLut[1], postLutInputPrecision); 3331 YUVOut[COMPONENT_Cb][xc] = std::min(maxOutputValue, (YUVLutB_1 + scaleOut_round) >> scaleShiftOut_neg); 3332 3333 Int YUVMat_2 = applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[2], postOffsetShift, YUVPre_0, YUVPre_1, YUVPre_2, matrixOutputOffset[2]); 3334 Int YUVLutB_2 = applyColourRemappingInfoLut1D(YUVMat_2, postLut[2], postLutInputPrecision); 3335 YUVOut[COMPONENT_Cr][xc] = std::min(maxOutputValue, (YUVLutB_2 + scaleOut_round) >> scaleShiftOut_neg); 3336 } 3337 } 3338 3339 YUVIn[COMPONENT_Y] += iStrideIn; 3340 YUVOut[COMPONENT_Y] += iStrideOut; 3341 if( !(b420 && !(y&1)) ) 3342 { 3343 YUVIn[COMPONENT_Cb] += iCStrideIn; 3344 YUVIn[COMPONENT_Cr] += iCStrideIn; 3345 YUVOut[COMPONENT_Cb] += iCStrideOut; 3346 YUVOut[COMPONENT_Cr] += iCStrideOut; 3347 } 3348 } 3349 //Write remapped picture in display order 3350 picYuvColourRemapped.dump( m_colourRemapSEIFileName, bitDepthsCriFile, true ); 3351 picYuvColourRemapped.destroy(); 3352 } 3353 } 3009 3354 //! \} -
branches/HTM-15.2-dev/source/App/TAppDecoder/TAppDecTop.h
r1321 r1360 128 128 #endif 129 129 std::ofstream m_seiMessageFileStream; ///< Used for outputing SEI messages. 130 131 SEIColourRemappingInfo* m_pcSeiColourRemappingInfoPrevious; 132 130 133 public: 131 134 TAppDecTop(); … … 206 209 Void xCropAndOutput ( TComPic* curPic ); 207 210 #endif 211 212 private: 213 Void applyColourRemapping(const TComPicYuv& pic, SEIColourRemappingInfo& pCriSEI, const TComSPS &activeSPS); 214 Void xOutputColourRemapPic(TComPic* pcPic); 208 215 }; 209 216 -
branches/HTM-15.2-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r1356 r1360 109 109 110 110 TAppEncCfg::TAppEncCfg() 111 #if NH_MV 112 : m_pchBitstreamFile() 113 #else 114 : m_pchInputFile() 115 , m_pchBitstreamFile() 116 , m_pchReconFile() 117 #endif 118 , m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED) 111 : m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED) 119 112 , m_snrInternalColourSpace(false) 120 113 , m_outputInternalColourSpace(false) 121 , m_pchdQPFile()122 , m_scalingListFile()123 114 { 124 115 #if !NH_MV … … 171 162 m_targetPivotValue = NULL; 172 163 } 173 #if !NH_MV174 free(m_pchInputFile);175 #endif176 free(m_pchBitstreamFile);177 164 #if NH_MV 178 165 for(Int i = 0; i< m_pchReconFileList.size(); i++ ) … … 181 168 free (m_pchReconFileList[i]); 182 169 } 183 #else 184 free(m_pchReconFile); 185 #endif 186 free(m_pchdQPFile); 187 free(m_scalingListFile); 188 #if NH_MV 170 189 171 for( Int i = 0; i < m_GOPListMvc.size(); i++ ) 190 172 { … … 196 178 } 197 179 #endif 180 198 181 #if NH_3D 199 182 #if NH_3D_VSO … … 302 285 } 303 286 304 Bool confirmPara(Bool bflag, const Char* message);287 Bool confirmPara(Bool bflag, const TChar* message); 305 288 306 289 static inline ChromaFormat numberToChromaFormat(const Int val) … … 318 301 static const struct MapStrToProfile 319 302 { 320 const Char* str;303 const TChar* str; 321 304 Profile::Name value; 322 305 } … … 340 323 static const struct MapStrToExtendedProfile 341 324 { 342 const Char* str;325 const TChar* str; 343 326 ExtendedProfileName value; 344 327 } … … 405 388 static const struct MapStrToTier 406 389 { 407 const Char* str;390 const TChar* str; 408 391 Level::Tier value; 409 392 } … … 416 399 static const struct MapStrToLevel 417 400 { 418 const Char* str;401 const TChar* str; 419 402 Level::Name value; 420 403 } … … 438 421 }; 439 422 423 #if U0132_TARGET_BITS_SATURATION 424 UInt g_uiMaxCpbSize[2][21] = 425 { 426 // LEVEL1, LEVEL2,LEVEL2_1, LEVEL3, LEVEL3_1, LEVEL4, LEVEL4_1, LEVEL5, LEVEL5_1, LEVEL5_2, LEVEL6, LEVEL6_1, LEVEL6_2 427 { 0, 0, 0, 350000, 0, 0, 1500000, 3000000, 0, 6000000, 10000000, 0, 12000000, 20000000, 0, 25000000, 40000000, 60000000, 60000000, 120000000, 240000000 }, 428 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30000000, 50000000, 0, 100000000, 160000000, 240000000, 240000000, 480000000, 800000000 } 429 }; 430 #endif 431 440 432 static const struct MapStrToCostMode 441 433 { 442 const Char* str;434 const TChar* str; 443 435 CostMode value; 444 436 } … … 453 445 static const struct MapStrToScalingListMode 454 446 { 455 const Char* str;447 const TChar* str; 456 448 ScalingListMode value; 457 449 } … … 533 525 { 534 526 const T minValIncl; 535 const T maxValIncl; // Use 0 for unlimited527 const T maxValIncl; 536 528 const std::size_t minNumValuesIncl; 537 529 const std::size_t maxNumValuesIncl; // Use 0 for unlimited … … 545 537 SMultiValueInput<T> &operator=(const std::vector<T> &userValues) { values=userValues; return *this; } 546 538 SMultiValueInput<T> &operator=(const SMultiValueInput<T> &userValues) { values=userValues.values; return *this; } 539 540 T readValue(const TChar *&pStr, Bool &bSuccess); 541 542 istream& readValues(std::istream &in); 547 543 }; 548 544 549 static inline istream& operator >> (istream &in, SMultiValueInput<UInt> &values) 545 template <class T> 546 static inline istream& operator >> (std::istream &in, SMultiValueInput<T> &values) 550 547 { 551 values.values.clear(); 548 return values.readValues(in); 549 } 550 551 template<> 552 UInt SMultiValueInput<UInt>::readValue(const TChar *&pStr, Bool &bSuccess) 553 { 554 TChar *eptr; 555 UInt val=strtoul(pStr, &eptr, 0); 556 pStr=eptr; 557 bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<minValIncl || val>maxValIncl); 558 return val; 559 } 560 561 template<> 562 Int SMultiValueInput<Int>::readValue(const TChar *&pStr, Bool &bSuccess) 563 { 564 TChar *eptr; 565 Int val=strtol(pStr, &eptr, 0); 566 pStr=eptr; 567 bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<minValIncl || val>maxValIncl); 568 return val; 569 } 570 571 template<> 572 Double SMultiValueInput<Double>::readValue(const TChar *&pStr, Bool &bSuccess) 573 { 574 TChar *eptr; 575 Double val=strtod(pStr, &eptr); 576 pStr=eptr; 577 bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<minValIncl || val>maxValIncl); 578 return val; 579 } 580 581 template<> 582 Bool SMultiValueInput<Bool>::readValue(const TChar *&pStr, Bool &bSuccess) 583 { 584 TChar *eptr; 585 Int val=strtol(pStr, &eptr, 0); 586 pStr=eptr; 587 bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<Int(minValIncl) || val>Int(maxValIncl)); 588 return val!=0; 589 } 590 591 template <class T> 592 istream& SMultiValueInput<T>::readValues(std::istream &in) 593 { 594 values.clear(); 552 595 string str; 553 596 while (!in.eof()) … … 557 600 if (!str.empty()) 558 601 { 559 const Char *pStr=str.c_str();602 const TChar *pStr=str.c_str(); 560 603 // soak up any whitespace 561 604 for(;isspace(*pStr);pStr++); … … 563 606 while (*pStr != 0) 564 607 { 565 Char *eptr;566 UInt val=strtoul(pStr, &eptr, 0);567 if ( *eptr!=0 && !isspace(*eptr) && *eptr!=',')608 Bool bSuccess=true; 609 T val=readValue(pStr, bSuccess); 610 if (!bSuccess) 568 611 { 569 612 in.setstate(ios::failbit); 570 613 break; 571 614 } 572 if (val<values.minValIncl || val>values.maxValIncl) 615 616 if (maxNumValuesIncl != 0 && values.size() >= maxNumValuesIncl) 573 617 { 574 618 in.setstate(ios::failbit); 575 619 break; 576 620 } 577 578 if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl) 579 { 580 in.setstate(ios::failbit); 581 break; 582 } 583 values.values.push_back(val); 621 values.push_back(val); 584 622 // soak up any whitespace and up to 1 comma. 585 pStr=eptr;586 623 for(;isspace(*pStr);pStr++); 587 624 if (*pStr == ',') … … 592 629 } 593 630 } 594 if (values.values.size() < values.minNumValuesIncl) 595 { 596 in.setstate(ios::failbit); 597 } 598 return in; 599 } 600 601 static inline istream& operator >> (istream &in, SMultiValueInput<Int> &values) 602 { 603 values.values.clear(); 604 string str; 605 while (!in.eof()) 606 { 607 string tmp; in >> tmp; str+=" " + tmp; 608 } 609 if (!str.empty()) 610 { 611 const Char *pStr=str.c_str(); 612 // soak up any whitespace 613 for(;isspace(*pStr);pStr++); 614 615 while (*pStr != 0) 616 { 617 Char *eptr; 618 Int val=strtol(pStr, &eptr, 0); 619 if (*eptr!=0 && !isspace(*eptr) && *eptr!=',') 620 { 621 in.setstate(ios::failbit); 622 break; 623 } 624 if (val<values.minValIncl || val>values.maxValIncl) 625 { 626 in.setstate(ios::failbit); 627 break; 628 } 629 630 if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl) 631 { 632 in.setstate(ios::failbit); 633 break; 634 } 635 values.values.push_back(val); 636 // soak up any whitespace and up to 1 comma. 637 pStr=eptr; 638 for(;isspace(*pStr);pStr++); 639 if (*pStr == ',') 640 { 641 pStr++; 642 } 643 for(;isspace(*pStr);pStr++); 644 } 645 } 646 if (values.values.size() < values.minNumValuesIncl) 647 { 648 in.setstate(ios::failbit); 649 } 650 return in; 651 } 652 653 static inline istream& operator >> (istream &in, SMultiValueInput<Bool> &values) 654 { 655 values.values.clear(); 656 string str; 657 while (!in.eof()) 658 { 659 string tmp; in >> tmp; str+=" " + tmp; 660 } 661 if (!str.empty()) 662 { 663 const Char *pStr=str.c_str(); 664 // soak up any whitespace 665 for(;isspace(*pStr);pStr++); 666 667 while (*pStr != 0) 668 { 669 Char *eptr; 670 Int val=strtol(pStr, &eptr, 0); 671 if (*eptr!=0 && !isspace(*eptr) && *eptr!=',') 672 { 673 in.setstate(ios::failbit); 674 break; 675 } 676 if (val<Int(values.minValIncl) || val>Int(values.maxValIncl)) 677 { 678 in.setstate(ios::failbit); 679 break; 680 } 681 682 if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl) 683 { 684 in.setstate(ios::failbit); 685 break; 686 } 687 values.values.push_back(val!=0); 688 // soak up any whitespace and up to 1 comma. 689 pStr=eptr; 690 for(;isspace(*pStr);pStr++); 691 if (*pStr == ',') 692 { 693 pStr++; 694 } 695 for(;isspace(*pStr);pStr++); 696 } 697 } 698 if (values.values.size() < values.minNumValuesIncl) 631 if (values.size() < minNumValuesIncl) 699 632 { 700 633 in.setstate(ios::failbit); … … 786 719 \retval true when success 787 720 */ 788 Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] )721 Bool TAppEncCfg::parseCfg( Int argc, TChar* argv[] ) 789 722 { 790 723 Bool do_help = false; … … 815 748 Int tmpInputChromaFormat; 816 749 Int tmpConstraintChromaFormat; 750 Int tmpWeightedPredictionMethod; 751 Int tmpFastInterSearchMode; 752 Int tmpMotionEstimationSearchMethod; 753 Int tmpSliceMode; 754 Int tmpSliceSegmentMode; 755 Int tmpDecodedPictureHashSEIMappedType; 817 756 string inputColourSpaceConvert; 818 757 #if NH_MV … … 829 768 SMultiValueInput<Int> cfg_codedPivotValue (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16); 830 769 SMultiValueInput<Int> cfg_targetPivotValue (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16); 770 771 SMultiValueInput<Double> cfg_adIntraLambdaModifier (0, std::numeric_limits<Double>::max(), 0, MAX_TLAYER); ///< Lambda modifier for Intra pictures, one for each temporal layer. If size>temporalLayer, then use [temporalLayer], else if size>0, use [size()-1], else use m_adLambdaModifier. 772 831 773 832 774 const UInt defaultInputKneeCodes[3] = { 600, 800, 900 }; … … 866 808 ("InputFile_%d,i_%d", m_pchInputFileList, (char *) 0 , MAX_NUM_LAYER_IDS , "original Yuv input file name %d") 867 809 #else 868 ("InputFile,i", cfg_InputFile,string(""), "Original YUV input file name")869 #endif 870 ("BitstreamFile,b", cfg_BitstreamFile,string(""), "Bitstream output file name")810 ("InputFile,i", m_inputFileName, string(""), "Original YUV input file name") 811 #endif 812 ("BitstreamFile,b", m_bitstreamFileName, string(""), "Bitstream output file name") 871 813 #if NH_MV 872 814 ("ReconFile_%d,o_%d", m_pchReconFileList, (char *) 0 , MAX_NUM_LAYER_IDS , "reconstructed Yuv output file name %d") 873 815 #else 874 ("ReconFile,o", cfg_ReconFile,string(""), "Reconstructed YUV output file name")816 ("ReconFile,o", m_reconFileName, string(""), "Reconstructed YUV output file name") 875 817 #endif 876 818 #if NH_MV … … 941 883 ("ConfWinTop", m_confWinTop, 0, "Top offset for window conformance mode 3") 942 884 ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3") 885 ("AccessUnitDelimiter", m_AccessUnitDelimiter, false, "Enable Access Unit Delimiter NALUs") 943 886 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 944 887 ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") … … 1003 946 // motion search options 1004 947 ("DisableIntraInInter", m_bDisableIntraPUsInInterSlices, false, "Flag to disable intra PUs in inter slices") 1005 ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST")948 ("FastSearch", tmpMotionEstimationSearchMethod, Int(MESEARCH_DIAMOND), "0:Full search 1:Diamond 2:Selective 3:Enhanced Diamond") 1006 949 ("SearchRange,-sr", m_iSearchRange, 96, "Motion search range") 1007 950 #if NH_MV … … 1010 953 #endif 1011 954 ("BipredSearchRange", m_bipredSearchRange, 4, "Motion search range for bipred refinement") 955 ("MinSearchWindow", m_minSearchWindow, 8, "Minimum motion search window size for the adaptive window ME") 956 ("RestrictMESampling", m_bRestrictMESampling, false, "Restrict ME Sampling for selective inter motion search") 1012 957 ("ClipForBiPredMEEnabled", m_bClipForBiPredMeEnabled, false, "Enables clipping in the Bi-Pred ME. It is disabled to reduce encoder run-time") 1013 958 ("FastMEAssumingSmootherMVEnabled", m_bFastMEAssumingSmootherMVEnabled, true, "Enables fast ME assuming a smoother MV.") … … 1017 962 1018 963 // Mode decision parameters 1019 ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0") 1020 ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1") 1021 ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2") 1022 ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3") 1023 ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4") 1024 ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5") 1025 ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6") 964 ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0. If LambdaModifierI is used, this will not affect intra pictures") 965 ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1. If LambdaModifierI is used, this will not affect intra pictures") 966 ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2. If LambdaModifierI is used, this will not affect intra pictures") 967 ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3. If LambdaModifierI is used, this will not affect intra pictures") 968 ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4. If LambdaModifierI is used, this will not affect intra pictures") 969 ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5. If LambdaModifierI is used, this will not affect intra pictures") 970 ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6. If LambdaModifierI is used, this will not affect intra pictures") 971 ("LambdaModifierI,-LMI", cfg_adIntraLambdaModifier, cfg_adIntraLambdaModifier, "Lambda modifiers for Intra pictures, comma separated, up to one the number of temporal layer. If entry for temporalLayer exists, then use it, else if some are specified, use the last, else use the standard LambdaModifiers.") 972 ("IQPFactor,-IQF", m_dIntraQpFactor, -1.0, "Intra QP Factor for Lambda Computation. If negative, use the default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? (GopSize-1)/2 : GopSize-1) ))") 1026 973 1027 974 /* Quantization parameters */ … … 1046 993 ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") 1047 994 ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") 1048 ("dQPFile,m", cfg_dQPFile,string(""), "dQP file name")995 ("dQPFile,m", m_dQPFileName, string(""), "dQP file name") 1049 996 ("RDOQ", m_useRDOQ, true) 1050 997 ("RDOQTS", m_useRDOQTS, true) … … 1090 1037 ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") 1091 1038 ("SAOLcuBoundary", m_saoCtuBoundary, false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") 1092 ("SliceMode", m_sliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")1039 ("SliceMode", tmpSliceMode, Int(NO_SLICES), "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice") 1093 1040 ("SliceArgument", m_sliceArgument, 0, "Depending on SliceMode being:" 1094 1041 "\t1: max number of CTUs per slice" 1095 1042 "\t2: max number of bytes per slice" 1096 1043 "\t3: max number of tiles per slice") 1097 ("SliceSegmentMode", m_sliceSegmentMode, 0, "0: Disable all slice segment limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")1044 ("SliceSegmentMode", tmpSliceSegmentMode, Int(NO_SLICES), "0: Disable all slice segment limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice") 1098 1045 ("SliceSegmentArgument", m_sliceSegmentArgument, 0, "Depending on SliceSegmentMode being:" 1099 1046 "\t1: max number of CTUs per slice segment" … … 1112 1059 ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) 1113 1060 ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) 1114 ("IntraReferenceSmoothing", m_enableIntraReferenceSmoothing, true, "0: Disable use of intra reference smoothing . 1: Enable use of intra reference smoothing (not valid in V1 profiles)")1061 ("IntraReferenceSmoothing", m_enableIntraReferenceSmoothing, true, "0: Disable use of intra reference smoothing (not valid in V1 profiles). 1: Enable use of intra reference smoothing (same as V1)") 1115 1062 ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") 1116 1063 ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") 1064 ("WeightedPredMethod,-wpM", tmpWeightedPredictionMethod, Int(WP_PER_PICTURE_WITH_SIMPLE_DC_COMBINED_COMPONENT), "Weighted prediction method") 1117 1065 ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") 1118 1066 //deprecated copies of renamed tile parameters … … 1127 1075 ("TileRowHeightArray", cfg_RowHeight, cfg_RowHeight, "Array containing tile row height values in units of CTU") 1128 1076 ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") 1129 ("WaveFrontSynchro", m_ iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with top-right-right")1077 ("WaveFrontSynchro", m_entropyCodingSyncEnabledFlag, false, "0: entropy coding sync disabled; 1 entropy coding sync enabled") 1130 1078 ("ScalingList", m_useScalingListId, SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile") 1131 ("ScalingListFile", cfg_ScalingListFile,string(""), "Scaling list file name. Use an empty string to produce help.")1079 ("ScalingListFile", m_scalingListFileName, string(""), "Scaling list file name. Use an empty string to produce help.") 1132 1080 ("SignHideFlag,-SBH", m_signHideFlag, true) 1133 1081 ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") 1134 1082 /* Misc. */ 1135 ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled,0, "Control generation of decode picture hash SEI messages\n"1083 ("SEIDecodedPictureHash", tmpDecodedPictureHashSEIMappedType, 0, "Control generation of decode picture hash SEI messages\n" 1136 1084 "\t3: checksum\n" 1137 1085 "\t2: CRC\n" … … 1139 1087 "\t0: disable") 1140 1088 ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only") 1141 ("FEN", m_bUseFastEnc, false, "fast encoder setting")1089 ("FEN", tmpFastInterSearchMode, Int(FASTINTERSEARCH_DISABLED), "fast encoder setting") 1142 1090 ("ECU", m_bUseEarlyCU, false, "Early CU setting") 1143 1091 ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") … … 1151 1099 ( "InitialQP", m_RCInitialQP, 0, "Rate control: initial QP" ) 1152 1100 ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) 1101 1102 #if U0132_TARGET_BITS_SATURATION 1103 ( "RCCpbSaturation", m_RCCpbSaturationEnabled, false, "Rate control: enable target bits saturation to avoid CPB overflow and underflow" ) 1104 ( "RCCpbSize", m_RCCpbSize, 0u, "Rate control: CPB size" ) 1105 ( "RCInitialCpbFullness", m_RCInitialCpbFullness, 0.9, "Rate control: initial CPB fullness" ) 1106 #endif 1153 1107 1154 1108 #if KWU_RC_VIEWRC_E0227 … … 1227 1181 ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units") 1228 1182 ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units") 1229 ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, 0, "Control generation of recovery point SEI messages") 1230 ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") 1231 ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") 1183 ("SEIColourRemappingInfoFileRoot,-cri", m_colourRemapSEIFileRoot, string(""), "Colour Remapping Information SEI parameters root file name (wo num ext)") 1184 ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, false, "Control generation of recovery point SEI messages") 1185 ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, false, "Control generation of buffering period SEI messages") 1186 ("SEIPictureTiming", m_pictureTimingSEIEnabled, false, "Control generation of picture timing SEI messages") 1232 1187 ("SEIToneMappingInfo", m_toneMappingInfoSEIEnabled, false, "Control generation of Tone Mapping SEI messages") 1233 1188 ("SEIToneMapId", m_toneMapId, 0, "Specifies Id of Tone Mapping SEI message for a given session") … … 1262 1217 ("SEIToneMapNominalWhiteLevelLumaCodeValue", m_nominalWhiteLevelLumaCodeValue, 235, "Specifies luma sample value of the nominal white level assigned decoded pictures") 1263 1218 ("SEIToneMapExtendedWhiteLevelLumaCodeValue", m_extendedWhiteLevelLumaCodeValue, 300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures") 1264 ("SEIChroma SamplingFilterHint", m_chromaSamplingFilterSEIenabled,false, "Control generation of the chroma sampling filter hint SEI message")1265 ("SEIChroma SamplingHorizontalFilterType", m_chromaSamplingHorFilterIdc,2, "Defines the Index of the chroma sampling horizontal filter\n"1219 ("SEIChromaResamplingFilterHint", m_chromaResamplingFilterSEIenabled, false, "Control generation of the chroma sampling filter hint SEI message") 1220 ("SEIChromaResamplingHorizontalFilterType", m_chromaResamplingHorFilterIdc, 2, "Defines the Index of the chroma sampling horizontal filter\n" 1266 1221 "\t0: unspecified - Chroma filter is unknown or is determined by the application" 1267 1222 "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message" 1268 1223 "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter") 1269 ("SEIChroma SamplingVerticalFilterType", m_chromaSamplingVerFilterIdc, 2, "Defines the Index of the chroma sampling vertical filter\n"1224 ("SEIChromaResamplingVerticalFilterType", m_chromaResamplingVerFilterIdc, 2, "Defines the Index of the chroma sampling vertical filter\n" 1270 1225 "\t0: unspecified - Chroma filter is unknown or is determined by the application" 1271 1226 "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message" 1272 1227 "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter") 1273 ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages")1228 ("SEIFramePacking", m_framePackingSEIEnabled, false, "Control generation of frame packing SEI messages") 1274 1229 ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" 1275 1230 "\t3: side by side - frames are displayed horizontally\n" … … 1282 1237 "\t1: stereo pair, frame0 represents left view\n" 1283 1238 "\t2: stereo pair, frame0 represents right view") 1284 ("SEISegmentedRectFramePacking", m_segmentedRectFramePackingSEIEnabled, 0, "Controls generation of segmented rectangular frame packing SEI messages")1239 ("SEISegmentedRectFramePacking", m_segmentedRectFramePackingSEIEnabled, false, "Controls generation of segmented rectangular frame packing SEI messages") 1285 1240 ("SEISegmentedRectFramePackingCancel", m_segmentedRectFramePackingSEICancel, false, "If equal to 1, cancels the persistence of any previous SRFPA SEI message") 1286 1241 ("SEISegmentedRectFramePackingType", m_segmentedRectFramePackingSEIType, 0, "Specifies the arrangement of the frames in the reconstructed picture") … … 1289 1244 "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n" 1290 1245 "\t0: disable") 1291 ("SEITemporalLevel0Index", m_temporalLevel0IndexSEIEnabled, 0, "Control generation of temporal level 0 index SEI messages")1292 ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message")1246 ("SEITemporalLevel0Index", m_temporalLevel0IndexSEIEnabled, false, "Control generation of temporal level 0 index SEI messages") 1247 ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, false, "Control generation of gradual decoding refresh information SEI message") 1293 1248 ("SEINoDisplay", m_noDisplaySEITLayer, 0, "Control generation of no display SEI message\n" 1294 1249 "\tN: 0 < N enable no display SEI message for temporal layer N or higher\n" 1295 1250 "\t0: disable") 1296 ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, 0, "Control generation of decoding unit information SEI message.")1297 ("SEISOPDescription", m_SOPDescriptionSEIEnabled, 0, "Control generation of SOP description SEI messages")1298 ("SEIScalableNesting", m_scalableNestingSEIEnabled, 0, "Control generation of scalable nesting SEI messages")1251 ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, false, "Control generation of decoding unit information SEI message.") 1252 ("SEISOPDescription", m_SOPDescriptionSEIEnabled, false, "Control generation of SOP description SEI messages") 1253 ("SEIScalableNesting", m_scalableNestingSEIEnabled, false, "Control generation of scalable nesting SEI messages") 1299 1254 ("SEITempMotionConstrainedTileSets", m_tmctsSEIEnabled, false, "Control generation of temporal motion constrained tile sets SEI message") 1300 1255 ("SEITimeCodeEnabled", m_timeCodeSEIEnabled, false, "Control generation of time code information SEI message") … … 1341 1296 ("SEISubBitstreamMaxBitRate", m_sbPropMaxBitRate, IntAry1d (1,0) ,"Specifies maximum bit rate of the i-th sub-bitstream") 1342 1297 #else 1343 ("SeiCfgFileName_%d", m_seiCfgFileNames, ( Char *) 0 ,MAX_NUM_SEIS , "SEI cfg file name %d")1298 ("SeiCfgFileName_%d", m_seiCfgFileNames, (TChar *) 0 ,MAX_NUM_SEIS , "SEI cfg file name %d") 1344 1299 #endif 1345 1300 ("OutputVpsInfo", m_outputVpsInfo, false ,"Output information about the layer dependencies and layer sets") … … 1348 1303 /* Camera parameters */ 1349 1304 ("Depth420OutputFlag", m_depth420OutputFlag, true , "Output depth layers in 4:2:0 ") 1350 ("CameraParameterFile,cpf", m_pchCameraParameterFile, ( Char *) 0,"Camera Parameter File Name")1351 ("BaseViewCameraNumbers", m_pchBaseViewCameraNumbers, ( Char *) 0,"Numbers of base views")1305 ("CameraParameterFile,cpf", m_pchCameraParameterFile, (TChar *) 0 , "Camera Parameter File Name") 1306 ("BaseViewCameraNumbers", m_pchBaseViewCameraNumbers, (TChar *) 0 , "Numbers of base views") 1352 1307 ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" ) 1353 1308 1354 1309 #if NH_3D_VSO 1355 1310 /* View Synthesis Optimization */ 1356 ("VSOConfig", m_pchVSOConfig , ( Char *) 0,"VSO configuration")1311 ("VSOConfig", m_pchVSOConfig , (TChar *) 0 ,"VSO configuration") 1357 1312 ("VSO", m_bUseVSO , false ,"Use VSO" ) 1358 1313 ("VSOMode", m_uiVSOMode , (UInt) 4 ,"VSO Mode") … … 1447 1402 po::setDefaults(opts); 1448 1403 po::ErrorReporter err; 1449 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (constChar**) argv, err);1450 1451 for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)1404 const list<const TChar*>& argv_unhandled = po::scanArgv(opts, argc, (const TChar**) argv, err); 1405 1406 for (list<const TChar*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) 1452 1407 { 1453 1408 fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); … … 1473 1428 * Set any derived parameters 1474 1429 */ 1475 /* convert std::string to c string for compatability */ 1476 #if !NH_MV 1477 m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str()); 1478 #endif 1479 m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 1480 #if !NH_MV 1481 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 1482 #endif 1483 m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); 1484 1430 m_adIntraLambdaModifier = cfg_adIntraLambdaModifier.values; 1485 1431 if(m_isField) 1486 1432 { … … 1545 1491 } 1546 1492 1547 m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());1548 1549 1493 /* rules for input, output and internal bitdepths as per help text */ 1550 1494 if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] == 0) … … 1579 1523 m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat); 1580 1524 m_chromaFormatIDC = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat))); 1525 1526 1527 assert(tmpWeightedPredictionMethod>=0 && tmpWeightedPredictionMethod<=WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION); 1528 if (!(tmpWeightedPredictionMethod>=0 && tmpWeightedPredictionMethod<=WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION)) 1529 { 1530 exit(EXIT_FAILURE); 1531 } 1532 m_weightedPredictionMethod = WeightedPredictionMethod(tmpWeightedPredictionMethod); 1533 1534 assert(tmpFastInterSearchMode>=0 && tmpFastInterSearchMode<=FASTINTERSEARCH_MODE3); 1535 if (tmpFastInterSearchMode<0 || tmpFastInterSearchMode>FASTINTERSEARCH_MODE3) 1536 { 1537 exit(EXIT_FAILURE); 1538 } 1539 m_fastInterSearchMode = FastInterSearchMode(tmpFastInterSearchMode); 1540 1541 assert(tmpMotionEstimationSearchMethod>=0 && tmpMotionEstimationSearchMethod<MESEARCH_NUMBER_OF_METHODS); 1542 if (tmpMotionEstimationSearchMethod<0 || tmpMotionEstimationSearchMethod>=MESEARCH_NUMBER_OF_METHODS) 1543 { 1544 exit(EXIT_FAILURE); 1545 } 1546 m_motionEstimationSearchMethod=MESearchMethod(tmpMotionEstimationSearchMethod); 1581 1547 1582 1548 #if NH_MV … … 1802 1768 } 1803 1769 1770 if (tmpSliceMode<0 || tmpSliceMode>=Int(NUMBER_OF_SLICE_CONSTRAINT_MODES)) 1771 { 1772 fprintf(stderr, "Error: bad slice mode\n"); 1773 exit(EXIT_FAILURE); 1774 } 1775 m_sliceMode = SliceConstraint(tmpSliceMode); 1776 if (tmpSliceSegmentMode<0 || tmpSliceSegmentMode>=Int(NUMBER_OF_SLICE_CONSTRAINT_MODES)) 1777 { 1778 fprintf(stderr, "Error: bad slice segment mode\n"); 1779 exit(EXIT_FAILURE); 1780 } 1781 m_sliceSegmentMode = SliceConstraint(tmpSliceSegmentMode); 1782 1783 if (tmpDecodedPictureHashSEIMappedType<0 || tmpDecodedPictureHashSEIMappedType>=Int(NUMBER_OF_HASHTYPES)) 1784 { 1785 fprintf(stderr, "Error: bad checksum mode\n"); 1786 exit(EXIT_FAILURE); 1787 } 1788 // Need to map values to match those of the SEI message: 1789 if (tmpDecodedPictureHashSEIMappedType==0) 1790 { 1791 m_decodedPictureHashSEIType=HASHTYPE_NONE; 1792 } 1793 else 1794 { 1795 m_decodedPictureHashSEIType=HashType(tmpDecodedPictureHashSEIMappedType-1); 1796 } 1797 1804 1798 // allocate slice-based dQP values 1805 1799 #if NH_MV … … 1923 1917 1924 1918 // reading external dQP description from file 1925 if ( m_pchdQPFile)1926 { 1927 FILE* fpt=fopen( m_ pchdQPFile, "r" );1919 if ( !m_dQPFileName.empty() ) 1920 { 1921 FILE* fpt=fopen( m_dQPFileName.c_str(), "r" ); 1928 1922 if ( fpt ) 1929 1923 { … … 2145 2139 Void TAppEncCfg::xCheckParameter() 2146 2140 { 2147 if ( !m_decodedPictureHashSEIEnabled)2141 if (m_decodedPictureHashSEIType==HASHTYPE_NONE) 2148 2142 { 2149 2143 fprintf(stderr, "******************************************************************\n"); … … 2173 2167 #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) 2174 2168 2175 xConfirmPara(m_ pchBitstreamFile==NULL, "A bitstream file name must be specified (BitstreamFile)");2169 xConfirmPara(m_bitstreamFileName.empty(), "A bitstream file name must be specified (BitstreamFile)"); 2176 2170 const UInt maxBitDepth=(m_chromaFormatIDC==CHROMA_400) ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]); 2177 2171 xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value"); … … 2544 2538 xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6, "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)"); 2545 2539 xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6, "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)"); 2546 xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" );2547 2540 xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); 2548 xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); 2541 xConfirmPara( m_bipredSearchRange < 0 , "Bi-prediction refinement search range must be more than 0" ); 2542 xConfirmPara( m_minSearchWindow < 0, "Minimum motion search window size for the adaptive window ME must be greater than or equal to 0" ); 2549 2543 #if NH_MV 2550 2544 xConfirmPara( m_iVerticalDisparitySearchRange <= 0 , "Vertical Disparity Search Range must be more than 0" ); … … 2624 2618 } 2625 2619 2626 xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); 2627 if (m_sliceMode!=0) 2620 if (m_sliceMode!=NO_SLICES) 2628 2621 { 2629 2622 xConfirmPara( m_sliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); 2630 2623 } 2631 xConfirmPara( m_sliceSegmentMode < 0 || m_sliceSegmentMode > 3, "SliceSegmentMode exceeds supported range (0 to 3)" ); 2632 if (m_sliceSegmentMode!=0) 2624 if (m_sliceSegmentMode!=NO_SLICES) 2633 2625 { 2634 2626 xConfirmPara( m_sliceSegmentArgument < 1 , "SliceSegmentArgument should be larger than or equal to 1" ); … … 2638 2630 if (m_profile!=Profile::HIGHTHROUGHPUTREXT) 2639 2631 { 2640 xConfirmPara( tileFlag && m_ iWaveFrontSynchro, "Tile and Wavefrontcan not be applied together, except in the High Throughput Intra 4:4:4 16 profile");2632 xConfirmPara( tileFlag && m_entropyCodingSyncEnabledFlag, "Tiles and entropy-coding-sync (Wavefronts) can not be applied together, except in the High Throughput Intra 4:4:4 16 profile"); 2641 2633 } 2642 2634 … … 3237 3229 m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4; 3238 3230 } 3239 else if(m_ iWaveFrontSynchro)3231 else if(m_entropyCodingSyncEnabledFlag) 3240 3232 { 3241 3233 m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4; … … 3250 3242 } 3251 3243 } 3252 3253 xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" );3254 3255 xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n");3256 3244 3257 3245 if (m_toneMappingInfoSEIEnabled) … … 3282 3270 } 3283 3271 3272 if (m_chromaResamplingFilterSEIenabled) 3273 { 3274 xConfirmPara( (m_chromaFormatIDC == CHROMA_400 ), "chromaResamplingFilterSEI is not allowed to be present when ChromaFormatIDC is equal to zero (4:0:0)" ); 3275 xConfirmPara(m_vuiParametersPresentFlag && m_chromaLocInfoPresentFlag && (m_chromaSampleLocTypeTopField != m_chromaSampleLocTypeBottomField ), "When chromaResamplingFilterSEI is enabled, ChromaSampleLocTypeTopField has to be equal to ChromaSampleLocTypeBottomField" ); 3276 } 3277 3284 3278 if ( m_RCEnableRateControl ) 3285 3279 { … … 3293 3287 } 3294 3288 xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); 3295 } 3289 #if U0132_TARGET_BITS_SATURATION 3290 #if NH_MV 3291 if ((m_RCCpbSaturationEnabled) && (m_level[0]!=Level::NONE) && (m_profile!=Profile::NONE)) 3292 { 3293 UInt uiLevelIdx = (m_level[0] / 10) + (UInt)((m_level[0] % 10) / 3); // (m_level / 30)*3 + ((m_level % 10) / 3); 3294 xConfirmPara(m_RCCpbSize > g_uiMaxCpbSize[m_levelTier[0]][uiLevelIdx], "RCCpbSize should be smaller than or equal to Max CPB size according to tier and level"); 3295 xConfirmPara(m_RCInitialCpbFullness > 1, "RCInitialCpbFullness should be smaller than or equal to 1"); 3296 } 3297 #else 3298 if ((m_RCCpbSaturationEnabled) && (m_level!=Level::NONE) && (m_profile!=Profile::NONE)) 3299 { 3300 UInt uiLevelIdx = (m_level / 10) + (UInt)((m_level % 10) / 3); // (m_level / 30)*3 + ((m_level % 10) / 3); 3301 xConfirmPara(m_RCCpbSize > g_uiMaxCpbSize[m_levelTier][uiLevelIdx], "RCCpbSize should be smaller than or equal to Max CPB size according to tier and level"); 3302 xConfirmPara(m_RCInitialCpbFullness > 1, "RCInitialCpbFullness should be smaller than or equal to 1"); 3303 } 3304 #endif 3305 #endif 3306 } 3307 #if U0132_TARGET_BITS_SATURATION 3308 else 3309 { 3310 xConfirmPara( m_RCCpbSaturationEnabled != 0, "Target bits saturation cannot be processed without Rate control" ); 3311 } 3312 #endif 3313 3296 3314 #if NH_MV 3297 3315 // VPS VUI … … 3351 3369 if (m_segmentedRectFramePackingSEIEnabled) 3352 3370 { 3353 xConfirmPara(m_framePackingSEIEnabled > 0, "SEISegmentedRectFramePacking must be 0 when SEIFramePacking is 1");3371 xConfirmPara(m_framePackingSEIEnabled , "SEISegmentedRectFramePacking must be 0 when SEIFramePacking is 1"); 3354 3372 } 3355 3373 … … 3372 3390 } 3373 3391 3374 const Char *profileToString(const Profile::Name profile)3392 const TChar *profileToString(const Profile::Name profile) 3375 3393 { 3376 3394 static const UInt numberOfProfiles = sizeof(strToProfile)/sizeof(*strToProfile); … … 3400 3418 } 3401 3419 #else 3402 printf("Input File : %s\n", m_pchInputFile);3403 #endif 3404 printf("Bitstream File : %s\n", m_pchBitstreamFile);3420 printf("Input File : %s\n", m_inputFileName.c_str() ); 3421 #endif 3422 printf("Bitstream File : %s\n", m_bitstreamFileName.c_str() ); 3405 3423 #if NH_MV 3406 3424 for( Int layer = 0; layer < m_numberOfLayers; layer++) … … 3409 3427 } 3410 3428 #else 3411 printf("Reconstruction File : %s\n", m_pchReconFile);3429 printf("Reconstruction File : %s\n", m_reconFileName.c_str() ); 3412 3430 #endif 3413 3431 #if NH_MV … … 3581 3599 3582 3600 printf("RateControl : %d\n", m_RCEnableRateControl ); 3601 printf("WPMethod : %d\n", Int(m_weightedPredictionMethod)); 3583 3602 3584 3603 if(m_RCEnableRateControl) … … 3590 3609 printf("InitialQP : %d\n", m_RCInitialQP ); 3591 3610 printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); 3611 3612 #if U0132_TARGET_BITS_SATURATION 3613 printf("CpbSaturation : %d\n", m_RCCpbSaturationEnabled ); 3614 if (m_RCCpbSaturationEnabled) 3615 { 3616 printf("CpbSize : %d\n", m_RCCpbSize); 3617 printf("InitalCpbFullness : %.2f\n", m_RCInitialCpbFullness); 3618 } 3619 #endif 3592 3620 3593 3621 #if KWU_RC_MADPRED_E0227 … … 3648 3676 printf("SQP:%d ", m_uiDeltaQpRD ); 3649 3677 printf("ASR:%d ", m_bUseASR ); 3650 printf("FEN:%d ", m_bUseFastEnc ); 3678 printf("MinSearchWindow:%d ", m_minSearchWindow ); 3679 printf("RestrictMESampling:%d ", m_bRestrictMESampling ); 3680 printf("FEN:%d ", Int(m_fastInterSearchMode) ); 3651 3681 printf("ECU:%d ", m_bUseEarlyCU ); 3652 3682 printf("FDM:%d ", m_useFastDecisionForMerge ); … … 3657 3687 printf("TransformSkipFast:%d ", m_useTransformSkipFast ); 3658 3688 printf("TransformSkipLog2MaxSize:%d ", m_log2MaxTransformSkipBlockSize); 3659 printf("Slice: M=%d ", m_sliceMode);3689 printf("Slice: M=%d ", Int(m_sliceMode)); 3660 3690 if (m_sliceMode!=NO_SLICES) 3661 3691 { … … 3685 3715 printf("WPB:%d ", (Int)m_useWeightedBiPred); 3686 3716 printf("PME:%d ", m_log2ParallelMergeLevel); 3687 const Int iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; 3688 printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", 3689 m_iWaveFrontSynchro, iWaveFrontSubstreams); 3717 const Int iWaveFrontSubstreams = m_entropyCodingSyncEnabledFlag ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; 3718 printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_entropyCodingSyncEnabledFlag?1:0, iWaveFrontSubstreams); 3690 3719 printf(" ScalingList:%d ", m_useScalingListId ); 3691 3720 printf("TMVPMode:%d ", m_TMVPModeId ); … … 3730 3759 } 3731 3760 3732 Bool confirmPara(Bool bflag, const Char* message)3761 Bool confirmPara(Bool bflag, const TChar* message) 3733 3762 { 3734 3763 if (!bflag) -
branches/HTM-15.2-dev/source/App/TAppEncoder/TAppEncCfg.h
r1356 r1360 62 62 // file I/O 63 63 #if NH_MV 64 std::vector< char*> m_pchInputFileList; ///< source file names65 #else 66 Char* m_pchInputFile;///< source file name67 #endif 68 Char* m_pchBitstreamFile;///< output bitstream file64 std::vector<TChar*> m_pchInputFileList; ///< source file names 65 #else 66 std::string m_inputFileName; ///< source file name 67 #endif 68 std::string m_bitstreamFileName; ///< output bitstream file 69 69 #if NH_MV 70 70 std::vector<char*> m_pchReconFileList; ///< output reconstruction file names … … 72 72 Int m_iNumberOfViews; ///< number of Layers that are views 73 73 #else 74 Char* m_pchReconFile;///< output reconstruction file74 std::string m_reconFileName; ///< output reconstruction file 75 75 #endif 76 76 #if NH_MV … … 112 112 Bool m_bitRatePresentVpsFlag; 113 113 Bool m_picRatePresentVpsFlag; 114 BoolAry2d m_bitRatePresentFlag; 115 BoolAry2d m_picRatePresentFlag; 116 IntAry2d m_avgBitRate; 117 IntAry2d m_maxBitRate; 118 IntAry2d m_constantPicRateIdc; 119 IntAry2d m_avgPicRate; 120 Bool m_tilesNotInUseFlag; 121 BoolAry1d m_tilesInUseFlag; 122 BoolAry1d m_loopFilterNotAcrossTilesFlag; 123 Bool m_wppNotInUseFlag; 124 BoolAry1d m_wppInUseFlag; 125 126 BoolAry2d m_tileBoundariesAlignedFlag; 127 Bool m_ilpRestrictedRefLayersFlag; 128 IntAry2d m_minSpatialSegmentOffsetPlus1; 129 BoolAry2d m_ctuBasedOffsetEnabledFlag; 130 IntAry2d m_minHorizontalCtuOffsetPlus1; 131 Bool m_singleLayerForNonIrapFlag; 132 Bool m_higherLayerIrapSkipFlag; 133 134 114 BoolAry2d m_bitRatePresentFlag; 115 BoolAry2d m_picRatePresentFlag; 116 IntAry2d m_avgBitRate; 117 IntAry2d m_maxBitRate; 118 IntAry2d m_constantPicRateIdc; 119 IntAry2d m_avgPicRate; 120 Bool m_tilesNotInUseFlag; 121 BoolAry1d m_tilesInUseFlag; 122 BoolAry1d m_loopFilterNotAcrossTilesFlag; 123 Bool m_wppNotInUseFlag; 124 BoolAry1d m_wppInUseFlag; 125 126 BoolAry2d m_tileBoundariesAlignedFlag; 127 Bool m_ilpRestrictedRefLayersFlag; 128 IntAry2d m_minSpatialSegmentOffsetPlus1; 129 BoolAry2d m_ctuBasedOffsetEnabledFlag; 130 IntAry2d m_minHorizontalCtuOffsetPlus1; 131 Bool m_singleLayerForNonIrapFlag; 132 Bool m_higherLayerIrapSkipFlag; 135 133 #if NH_3D 136 134 Bool m_abUseIC; 137 135 Bool m_bUseLowLatencyICEnc; 138 136 #endif 139 140 137 #endif 141 138 Double m_adLambdaModifier[ MAX_TLAYER ]; ///< Lambda modifier array for each temporal layer 139 std::vector<Double> m_adIntraLambdaModifier; ///< Lambda modifier for Intra pictures, one for each temporal layer. If size>temporalLayer, then use [temporalLayer], else if size>0, use [size()-1], else use m_adLambdaModifier. 140 Double m_dIntraQpFactor; ///< Intra Q Factor. If negative, use a default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? (GopSize-1)/2 : GopSize-1) )) 141 142 142 // source specification 143 143 Int m_iFrameRate; ///< source frame-rates (Hz) … … 160 160 Int m_framesToBeEncoded; ///< number of encoded frames 161 161 Int m_aiPad[2]; ///< number of padded pixels for width and height 162 Bool m_AccessUnitDelimiter; ///< add Access Unit Delimiter NAL units 162 163 InputColourSpaceConversion m_inputColourSpaceConvert; ///< colour space conversion to apply to input video 163 164 Bool m_snrInternalColourSpace; ///< if true, then no colour space conversion is applied for snr calculation, otherwise inverse of input is applied. … … 237 238 Int m_iQP; ///< QP value of key-picture (integer) 238 239 #endif 239 Char* m_pchdQPFile;///< QP offset for each slice (initialized from external file)240 std::string m_dQPFileName; ///< QP offset for each slice (initialized from external file) 240 241 #if NH_MV 241 242 std::vector<Int*> m_aidQP; ///< array of slice QP values for each layer … … 338 339 Int m_rdPenalty; ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty) 339 340 Bool m_bDisableIntraPUsInInterSlices; ///< Flag for disabling intra predicted PUs in inter slices. 340 Int m_iFastSearch; ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST 341 MESearchMethod m_motionEstimationSearchMethod; 342 Bool m_bRestrictMESampling; ///< Restrict sampling for the Selective ME 341 343 Int m_iSearchRange; ///< ME search range 342 344 Int m_bipredSearchRange; ///< ME search range for bipred refinement 345 Int m_minSearchWindow; ///< ME minimum search window size for the Adaptive Window ME 343 346 Bool m_bClipForBiPredMeEnabled; ///< Enables clipping for Bi-Pred ME. 344 347 Bool m_bFastMEAssumingSmootherMVEnabled; ///< Enables fast ME assuming a smoother MV. … … 347 350 Int m_iVerticalDisparitySearchRange; ///< ME vertical search range for inter-view prediction 348 351 #endif 349 Bool m_bUseFastEnc; ///< flag for using fast encoder setting352 FastInterSearchMode m_fastInterSearchMode; ///< Parameter that controls fast encoder settings 350 353 Bool m_bUseEarlyCU; ///< flag for using Early CU setting 351 354 Bool m_useFastDecisionForMerge; ///< flag for using Fast Decision Merge RD-Cost 352 355 Bool m_bUseCbfFastMode; ///< flag for using Cbf Fast PU Mode Decision 353 356 Bool m_useEarlySkipDetection; ///< flag for using Early SKIP Detection 354 Int m_sliceMode; ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice, 355 ///< 3: max number of tiles per slice 357 SliceConstraint m_sliceMode; 356 358 Int m_sliceArgument; ///< argument according to selected slice mode 357 Int m_sliceSegmentMode; ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment, 358 ///< 3: max number of tiles per slice segment 359 SliceConstraint m_sliceSegmentMode; 359 360 Int m_sliceSegmentArgument; ///< argument according to selected slice segment mode 360 361 … … 366 367 std::vector<Int> m_tileColumnWidth; 367 368 std::vector<Int> m_tileRowHeight; 368 Int m_iWaveFrontSynchro; //< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current. 369 Int m_iWaveFrontFlush; //< enable(1)/disable(0) the CABAC flush at the end of each line of LCUs. 369 Bool m_entropyCodingSyncEnabledFlag; 370 370 371 371 Bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction … … 374 374 Bool m_bUseBLambdaForNonKeyLowDelayPictures; 375 375 376 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting ondecoded picture hash SEI message377 Intm_recoveryPointSEIEnabled;378 Intm_bufferingPeriodSEIEnabled;379 Intm_pictureTimingSEIEnabled;376 HashType m_decodedPictureHashSEIType; ///< Checksum mode for decoded picture hash SEI message 377 Bool m_recoveryPointSEIEnabled; 378 Bool m_bufferingPeriodSEIEnabled; 379 Bool m_pictureTimingSEIEnabled; 380 380 Bool m_toneMappingInfoSEIEnabled; 381 Bool m_chroma SamplingFilterSEIenabled;382 Int m_chroma SamplingHorFilterIdc;383 Int m_chroma SamplingVerFilterIdc;381 Bool m_chromaResamplingFilterSEIenabled; 382 Int m_chromaResamplingHorFilterIdc; 383 Int m_chromaResamplingVerFilterIdc; 384 384 Int m_toneMapId; 385 385 Bool m_toneMapCancelFlag; … … 408 408 Int* m_codedPivotValue; 409 409 Int* m_targetPivotValue; 410 Intm_framePackingSEIEnabled;410 Bool m_framePackingSEIEnabled; 411 411 Int m_framePackingSEIType; 412 412 Int m_framePackingSEIId; 413 413 Int m_framePackingSEIQuincunx; 414 414 Int m_framePackingSEIInterpretation; 415 Intm_segmentedRectFramePackingSEIEnabled;415 Bool m_segmentedRectFramePackingSEIEnabled; 416 416 Bool m_segmentedRectFramePackingSEICancel; 417 417 Int m_segmentedRectFramePackingSEIType; 418 418 Bool m_segmentedRectFramePackingSEIPersistence; 419 419 Int m_displayOrientationSEIAngle; 420 Intm_temporalLevel0IndexSEIEnabled;421 Intm_gradualDecodingRefreshInfoEnabled;420 Bool m_temporalLevel0IndexSEIEnabled; 421 Bool m_gradualDecodingRefreshInfoEnabled; 422 422 Int m_noDisplaySEITLayer; 423 Intm_decodingUnitInfoSEIEnabled;424 Intm_SOPDescriptionSEIEnabled;425 Intm_scalableNestingSEIEnabled;423 Bool m_decodingUnitInfoSEIEnabled; 424 Bool m_SOPDescriptionSEIEnabled; 425 Bool m_scalableNestingSEIEnabled; 426 426 Bool m_tmctsSEIEnabled; 427 427 Bool m_timeCodeSEIEnabled; … … 442 442 Bool m_useWeightedPred; ///< Use of weighted prediction in P slices 443 443 Bool m_useWeightedBiPred; ///< Use of bi-directional weighted prediction in B slices 444 WeightedPredictionMethod m_weightedPredictionMethod; 444 445 445 446 UInt m_log2ParallelMergeLevel; ///< Parallel merge estimation region … … 455 456 Int m_RCInitialQP; ///< inital QP for rate control 456 457 Bool m_RCForceIntraQP; ///< force all intra picture to use initial QP or not 457 458 459 #if U0132_TARGET_BITS_SATURATION 460 Bool m_RCCpbSaturationEnabled; ///< enable target bits saturation to avoid CPB overflow and underflow 461 UInt m_RCCpbSize; ///< CPB size 462 Double m_RCInitialCpbFullness; ///< initial CPB fullness 463 #endif 464 458 465 #if KWU_RC_VIEWRC_E0227 459 466 vector<Int> m_viewTargetBits; … … 464 471 #endif 465 472 466 ScalingListMode m_useScalingListId; ///< using quantization matrix467 Char* m_scalingListFile;///< quantization matrix file name473 ScalingListMode m_useScalingListId; ///< using quantization matrix 474 std::string m_scalingListFileName; ///< quantization matrix file name 468 475 469 476 Bool m_TransquantBypassEnableFlag; ///< transquant_bypass_enable_flag setting in PPS. … … 509 516 Int m_log2MaxMvLengthHorizontal; ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units 510 517 Int m_log2MaxMvLengthVertical; ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units 518 std::string m_colourRemapSEIFileRoot; 519 511 520 std::string m_summaryOutFilename; ///< filename to use for producing summary output file. 512 521 std::string m_summaryPicFilenameBase; ///< Base filename to use for producing summary picture output files. The actual filenames used will have I.txt, P.txt and B.txt appended. … … 528 537 Bool m_depth420OutputFlag; ///< Output depth layers in 4:2:0 format 529 538 // Camera parameters 530 Char*m_pchCameraParameterFile; ///< camera parameter file531 Char*m_pchBaseViewCameraNumbers;539 TChar* m_pchCameraParameterFile; ///< camera parameter file 540 TChar* m_pchBaseViewCameraNumbers; 532 541 TAppComCamPara m_cCameraData; 533 542 Int m_iCodedCamParPrecision; ///< precision for coding of camera parameters 534 543 #if NH_3D_VSO 535 Char*m_pchVSOConfig;544 TChar* m_pchVSOConfig; 536 545 Bool m_bUseVSO; ///< flag for using View Synthesis Optimization 537 546 Bool m_bVSOLSTable; ///< Depth QP dependent Lagrange parameter optimization (m23714) … … 674 683 Void create (); ///< create option handling class 675 684 Void destroy (); ///< destroy option handling class 676 Bool parseCfg ( Int argc, Char* argv[] );///< parse configuration file to fill member variables685 Bool parseCfg ( Int argc, TChar* argv[] ); ///< parse configuration file to fill member variables 677 686 678 687 };// END CLASS DEFINITION TAppEncCfg -
branches/HTM-15.2-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1356 r1360 378 378 m_cTEncTop.setLambdaModifier ( uiLoop, m_adLambdaModifier[ uiLoop ] ); 379 379 } 380 m_cTEncTop.setIntraLambdaModifier ( m_adIntraLambdaModifier ); 381 m_cTEncTop.setIntraQpFactor ( m_dIntraQpFactor ); 382 380 383 #if NH_MV 381 384 m_cTEncTop.setQP ( m_iQP[layerIdInVps] ); … … 385 388 386 389 m_cTEncTop.setPad ( m_aiPad ); 387 390 m_cTEncTop.setAccessUnitDelimiter ( m_AccessUnitDelimiter ); 388 391 #if NH_MV 389 392 m_cTEncTop.setMaxTempLayer ( m_maxTempLayerMvc[layerIdInVps] ); … … 408 411 //====== Motion search ======== 409 412 m_cTEncTop.setDisableIntraPUsInInterSlices ( m_bDisableIntraPUsInInterSlices ); 410 m_cTEncTop.set FastSearch ( m_iFastSearch);413 m_cTEncTop.setMotionEstimationSearchMethod ( m_motionEstimationSearchMethod ); 411 414 m_cTEncTop.setSearchRange ( m_iSearchRange ); 412 415 m_cTEncTop.setBipredSearchRange ( m_bipredSearchRange ); 413 416 m_cTEncTop.setClipForBiPredMeEnabled ( m_bClipForBiPredMeEnabled ); 414 417 m_cTEncTop.setFastMEAssumingSmootherMVEnabled ( m_bFastMEAssumingSmootherMVEnabled ); 418 m_cTEncTop.setMinSearchWindow ( m_minSearchWindow ); 419 m_cTEncTop.setRestrictMESampling ( m_bRestrictMESampling ); 415 420 416 421 #if NH_MV … … 439 444 m_cTEncTop.setExtendedPrecisionProcessingFlag ( m_extendedPrecisionProcessingFlag ); 440 445 m_cTEncTop.setHighPrecisionOffsetsEnabledFlag ( m_highPrecisionOffsetsEnabledFlag ); 446 447 m_cTEncTop.setWeightedPredictionMethod( m_weightedPredictionMethod ); 448 441 449 //====== Tool list ======== 442 450 m_cTEncTop.setDeltaQpRD ( m_uiDeltaQpRD ); … … 463 471 m_cTEncTop.setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); 464 472 m_cTEncTop.setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); 465 m_cTEncTop.set UseFastEnc ( m_bUseFastEnc);473 m_cTEncTop.setFastInterSearchMode ( m_fastInterSearchMode ); 466 474 m_cTEncTop.setUseEarlyCU ( m_bUseEarlyCU ); 467 475 m_cTEncTop.setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); … … 513 521 514 522 //====== Slice ======== 515 m_cTEncTop.setSliceMode ( (SliceConstraint)m_sliceMode );523 m_cTEncTop.setSliceMode ( m_sliceMode ); 516 524 m_cTEncTop.setSliceArgument ( m_sliceArgument ); 517 525 518 526 //====== Dependent Slice ======== 519 m_cTEncTop.setSliceSegmentMode ( (SliceConstraint)m_sliceSegmentMode );527 m_cTEncTop.setSliceSegmentMode ( m_sliceSegmentMode ); 520 528 m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument ); 521 529 … … 540 548 541 549 m_cTEncTop.setIntraSmoothingDisabledFlag (!m_enableIntraReferenceSmoothing ); 542 m_cTEncTop.setDecodedPictureHashSEI Enabled ( m_decodedPictureHashSEIEnabled);550 m_cTEncTop.setDecodedPictureHashSEIType ( m_decodedPictureHashSEIType ); 543 551 m_cTEncTop.setRecoveryPointSEIEnabled ( m_recoveryPointSEIEnabled ); 544 552 m_cTEncTop.setBufferingPeriodSEIEnabled ( m_bufferingPeriodSEIEnabled ); … … 571 579 m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); 572 580 m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); 573 m_cTEncTop.setChroma SamplingFilterHintEnabled ( m_chromaSamplingFilterSEIenabled );574 m_cTEncTop.setChroma SamplingHorFilterIdc ( m_chromaSamplingHorFilterIdc );575 m_cTEncTop.setChroma SamplingVerFilterIdc ( m_chromaSamplingVerFilterIdc );581 m_cTEncTop.setChromaResamplingFilterHintEnabled ( m_chromaResamplingFilterSEIenabled ); 582 m_cTEncTop.setChromaResamplingHorFilterIdc ( m_chromaResamplingHorFilterIdc ); 583 m_cTEncTop.setChromaResamplingVerFilterIdc ( m_chromaResamplingVerFilterIdc ); 576 584 m_cTEncTop.setFramePackingArrangementSEIEnabled ( m_framePackingSEIEnabled ); 577 585 m_cTEncTop.setFramePackingArrangementSEIType ( m_framePackingSEIType ); … … 623 631 m_cTEncTop.setKneeSEIInputKneePoint ( m_kneeSEIInputKneePoint ); 624 632 m_cTEncTop.setKneeSEIOutputKneePoint ( m_kneeSEIOutputKneePoint ); 633 m_cTEncTop.setColourRemapInfoSEIFileRoot ( m_colourRemapSEIFileRoot ); 625 634 m_cTEncTop.setMasteringDisplaySEI ( m_masteringDisplay ); 626 635 … … 644 653 } 645 654 m_cTEncTop.setLFCrossTileBoundaryFlag ( m_bLFCrossTileBoundaryFlag ); 646 m_cTEncTop.set WaveFrontSynchro ( m_iWaveFrontSynchro);655 m_cTEncTop.setEntropyCodingSyncEnabledFlag ( m_entropyCodingSyncEnabledFlag ); 647 656 m_cTEncTop.setTMVPModeId ( m_TMVPModeId ); 648 657 m_cTEncTop.setUseScalingListId ( m_useScalingListId ); 649 m_cTEncTop.setScalingListFile ( m_scalingListFile);658 m_cTEncTop.setScalingListFileName ( m_scalingListFileName ); 650 659 m_cTEncTop.setSignHideFlag ( m_signHideFlag); 651 660 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227 … … 669 678 m_cTEncTop.setInitialQP ( m_RCInitialQP ); 670 679 m_cTEncTop.setForceIntraQP ( m_RCForceIntraQP ); 680 #if U0132_TARGET_BITS_SATURATION 681 m_cTEncTop.setCpbSaturationEnabled ( m_RCCpbSaturationEnabled ); 682 m_cTEncTop.setCpbSize ( m_RCCpbSize ); 683 m_cTEncTop.setInitialCpbFullness ( m_RCInitialCpbFullness ); 684 #endif 685 671 686 #if KWU_RC_MADPRED_E0227 672 687 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth()) … … 843 858 #else 844 859 // Video I/O 845 m_cTVideoIOYuvInputFile.open( m_ pchInputFile, false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth ); // read mode860 m_cTVideoIOYuvInputFile.open( m_inputFileName, false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth ); // read mode 846 861 m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC); 847 862 848 if ( m_pchReconFile)849 { 850 m_cTVideoIOYuvReconFile.open(m_ pchReconFile, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth); // write mode863 if (!m_reconFileName.empty()) 864 { 865 m_cTVideoIOYuvReconFile.open(m_reconFileName, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth); // write mode 851 866 } 852 867 … … 917 932 Void TAppEncTop::encode() 918 933 { 919 fstream bitstreamFile(m_ pchBitstreamFile, fstream::binary | fstream::out);934 fstream bitstreamFile(m_bitstreamFileName.c_str(), fstream::binary | fstream::out); 920 935 if (!bitstreamFile) 921 936 { 922 fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_ pchBitstreamFile);937 fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_bitstreamFileName.c_str()); 923 938 exit(EXIT_FAILURE); 924 939 } … … 1295 1310 } 1296 1311 #else 1297 if ( m_pchReconFile)1312 if (!m_reconFileName.empty()) 1298 1313 { 1299 1314 m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst ); … … 1352 1367 } 1353 1368 #else 1354 if ( m_pchReconFile)1369 if (!m_reconFileName.empty()) 1355 1370 { 1356 1371 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, -
branches/HTM-15.2-dev/source/App/TAppExtractor/TAppExtrCfg.cpp
r1179 r1360 58 58 \param argv array of arguments 59 59 */ 60 Bool TAppExtrCfg::parseCfg( Int argc, Char* argv[] )60 Bool TAppExtrCfg::parseCfg( Int argc, TChar* argv[] ) 61 61 { 62 62 bool do_help = false; -
branches/HTM-15.2-dev/source/App/TAppExtractor/TAppExtrCfg.h
r1179 r1360 65 65 virtual ~TAppExtrCfg() {} 66 66 67 Bool parseCfg ( Int argc, Char* argv[] ); ///< initialize option class from configuration67 Bool parseCfg ( Int argc, TChar* argv[] ); ///< initialize option class from configuration 68 68 69 69 protected: -
branches/HTM-15.2-dev/source/App/TAppRenderer/TAppRendererCfg.cpp
r1313 r1360 111 111 \retval true when success 112 112 */ 113 Bool TAppRendererCfg::parseCfg( Int argc, Char* argv[] )113 Bool TAppRendererCfg::parseCfg( Int argc, TChar* argv[] ) 114 114 { 115 115 bool do_help = false; … … 121 121 122 122 /* File I/O */ 123 ("VideoInputFileBaseName,v", m_pchVideoInputFileBaseName, ( Char*) 0, "Basename to generate video input file names")124 ("DepthInputFileBaseName,d", m_pchDepthInputFileBaseName, ( Char*) 0, "Basename to generate depth input file names")125 ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, ( Char*) 0, "Basename to generate synthesized output file names")123 ("VideoInputFileBaseName,v", m_pchVideoInputFileBaseName, (TChar*) 0, "Basename to generate video input file names") 124 ("DepthInputFileBaseName,d", m_pchDepthInputFileBaseName, (TChar*) 0, "Basename to generate depth input file names") 125 ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (TChar*) 0, "Basename to generate synthesized output file names") 126 126 ("ContOutputFileNumbering", m_bContOutputFileNumbering , false , "Continuous Output File Numbering") 127 127 ("Sweep" , m_bSweep , false , "Store all views in first Output File") 128 128 129 ("VideoInputFile_%d,v_%d", m_pchVideoInputFileList , ( Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")130 ("DepthInputFile_%d,d_%d", m_pchDepthInputFileList , ( Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")131 ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList, ( Char *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")129 ("VideoInputFile_%d,v_%d", m_pchVideoInputFileList , (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d") 130 ("DepthInputFile_%d,d_%d", m_pchDepthInputFileList , (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d") 131 ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList, (TChar *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d") 132 132 133 133 ("InputBitDepth", m_inputBitDepth[0], 8, "Bit-depth of input file") … … 146 146 147 147 /* Camera Specification */ 148 ("CameraParameterFile,-cpf", m_pchCameraParameterFile, (Char *) 0, "Camera Parameter File Name")149 ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, ( Char *) 0, "Numbers of base views")150 ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers, ( Char *) 0, "Numbers of views to synthesis")151 ("ViewConfig" , m_pchViewConfig, ( Char *) 0, "View Configuration" )148 ("CameraParameterFile,-cpf", m_pchCameraParameterFile, (TChar *) 0, "Camera Parameter File Name") 149 ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (TChar *) 0, "Numbers of base views") 150 ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers, (TChar *) 0, "Numbers of views to synthesis") 151 ("ViewConfig" , m_pchViewConfig, (TChar *) 0, "View Configuration" ) 152 152 153 153 /* Renderer Modes */ … … 458 458 } 459 459 460 Void TAppRendererCfg::xAddNumberToFileName( Char* pchSourceFileName,Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter )460 Void TAppRendererCfg::xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter ) 461 461 { 462 462 … … 468 468 } 469 469 470 Char pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];471 Char pchPrintBuffer[10];470 TChar pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2]; 471 TChar pchPrintBuffer[10]; 472 472 473 473 Double dNumberToAdd = ( (Double) iNumberToAdd ) / VIEW_NUM_PREC; … … 488 488 size_t iAddLength = strlen(pchNumberBuffer); 489 489 490 rpchTargetFileName = ( Char*) malloc(iInLength+iAddLength+1);491 492 Char* pchPlaceHolder = strrchr(pchSourceFileName,'$');490 rpchTargetFileName = (TChar*) malloc(iInLength+iAddLength+1); 491 492 TChar* pchPlaceHolder = strrchr(pchSourceFileName,'$'); 493 493 assert( pchPlaceHolder ); 494 494 -
branches/HTM-15.2-dev/source/App/TAppRenderer/TAppRendererCfg.h
r1313 r1360 59 59 60 60 //// file I/O //// 61 Char*m_pchVideoInputFileBaseName; ///< input video file base name, placeholder for numbering $$62 Char*m_pchDepthInputFileBaseName; ///< input depth file base name, placeholder for numbering $$63 Char*m_pchSynthOutputFileBaseName; ///< output synth file base name, placeholder for numbering $$61 TChar* m_pchVideoInputFileBaseName; ///< input video file base name, placeholder for numbering $$ 62 TChar* m_pchDepthInputFileBaseName; ///< input depth file base name, placeholder for numbering $$ 63 TChar* m_pchSynthOutputFileBaseName; ///< output synth file base name, placeholder for numbering $$ 64 64 Bool m_bContOutputFileNumbering; ///< use continous numbering instead of view numbering 65 65 Bool m_bSweep; ///< 1: Store view range in file … … 73 73 74 74 // derived 75 std::vector< Char*> m_pchVideoInputFileList;///< source file names76 std::vector< Char*> m_pchDepthInputFileList;///< source depth file names77 std::vector< Char*> m_pchSynthOutputFileList;///< output reconstruction file names75 std::vector<TChar*> m_pchVideoInputFileList; ///< source file names 76 std::vector<TChar*> m_pchDepthInputFileList; ///< source depth file names 77 std::vector<TChar*> m_pchSynthOutputFileList; ///< output reconstruction file names 78 78 79 79 //// source specification //// … … 84 84 85 85 ////camera specification //// 86 Char*m_pchCameraParameterFile; ///< camera parameter file87 Char*m_pchSynthViewCameraNumbers; ///< numbers of views to synthesize88 Char*m_pchViewConfig; ///< String to setup renderer89 Char*m_pchBaseViewCameraNumbers; ///< numbers of base views86 TChar* m_pchCameraParameterFile; ///< camera parameter file 87 TChar* m_pchSynthViewCameraNumbers; ///< numbers of views to synthesize 88 TChar* m_pchViewConfig; ///< String to setup renderer 89 TChar* m_pchBaseViewCameraNumbers; ///< numbers of base views 90 90 91 91 // derived … … 123 123 Void xCreateFileNames(); 124 124 Void xGetMaxPrecision( IntAry1d adIn, Int& iPrecBefore, Int& iPrecAfter ); 125 Void xAddNumberToFileName( Char* pchSourceFileName,Char*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter );125 Void xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter ); 126 126 public: 127 127 TAppRendererCfg(); … … 131 131 Void create (); ///< create option handling class 132 132 Void destroy (); ///< destroy option handling class 133 Bool parseCfg ( Int argc, Char* argv[] ); ///< parse configuration file to fill member variables134 Bool xConfirmParameter(Bool bflag, const Char* message);133 Bool parseCfg ( Int argc, TChar* argv[] ); ///< parse configuration file to fill member variables 134 Bool xConfirmParameter(Bool bflag, const TChar* message); 135 135 136 136 -
branches/HTM-15.2-dev/source/App/utils/convert_NtoMbit_YCbCr.cpp
r1313 r1360 105 105 106 106 TComPicYuv frame; 107 frame.create ( width, height, chromaFormatIDC, width, height, 0, false);107 frame.createWithoutCUInfo( width, height, chromaFormatIDC); 108 108 109 109 Int pad[2] = {0, 0}; 110 110 111 111 TComPicYuv cPicYuvTrueOrg; 112 cPicYuvTrueOrg.create ( width, height, chromaFormatIDC, width, height, 0, false);112 cPicYuvTrueOrg.createWithoutCUInfo( width, height, chromaFormatIDC ); 113 113 114 114 UInt num_frames_processed = 0; -
branches/HTM-15.2-dev/source/Lib/TAppCommon/TAppComCamPara.cpp
r1313 r1360 115 115 116 116 Void 117 TAppComCamPara::convertNumberString( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec )117 TAppComCamPara::convertNumberString( TChar* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec ) 118 118 { 119 119 Bool bStringIsRange = false; … … 131 131 } 132 132 133 Char* pcNextStart = pchViewNumberString;134 Char* pcEnd = pcNextStart + iIdx;135 Char* pcOldStart = 0;133 TChar* pcNextStart = pchViewNumberString; 134 TChar* pcEnd = pcNextStart + iIdx; 135 TChar* pcOldStart = 0; 136 136 137 137 while( pcNextStart < pcEnd ) … … 192 192 193 193 Void 194 TAppComCamPara::xReadCameraParameterFile( Char* pchCfgFileName )194 TAppComCamPara::xReadCameraParameterFile( TChar* pchCfgFileName ) 195 195 { 196 196 std::ifstream cCfgStream( pchCfgFileName, std::ifstream::in ); … … 220 220 } 221 221 222 Char* pcNextStart = (Char*) cLine.data();223 Char* pcEnd = pcNextStart + cLine.length();222 TChar* pcNextStart = (TChar*) cLine.data(); 223 TChar* pcEnd = pcNextStart + cLine.length(); 224 224 225 225 std::vector<Double> caNewLine; 226 226 caNewLine.clear(); 227 227 228 Char* pcOldStart = 0;228 TChar* pcOldStart = 0; 229 229 while( pcNextStart < pcEnd ) 230 230 { … … 1094 1094 } 1095 1095 1096 Void TAppComCamPara::xSetupBaseViews( Char* pchBaseViewNumbers, UInt uiNumBaseViews )1096 Void TAppComCamPara::xSetupBaseViews( TChar* pchBaseViewNumbers, UInt uiNumBaseViews ) 1097 1097 { 1098 1098 // init list … … 1142 1142 UInt uiStartFrameId, 1143 1143 UInt uiNumFrames, 1144 Char*pchCfgFileName,1145 Char*pchBaseViewNumbers,1146 Char*pchSynthViewNumbers,1144 TChar* pchCfgFileName, 1145 TChar* pchBaseViewNumbers, 1146 TChar* pchSynthViewNumbers, 1147 1147 std::vector<Int>* paiSynthViewNumbers, 1148 1148 Int iLog2Precision ) -
branches/HTM-15.2-dev/source/Lib/TAppCommon/TAppComCamPara.h
r1313 r1360 113 113 114 114 // functions for reading, initialization, sorting, getting data, etc. 115 Void xReadCameraParameterFile ( Char* pchCfgFileName );115 Void xReadCameraParameterFile ( TChar* pchCfgFileName ); 116 116 Bool xGetCameraDataRow ( Int iView, UInt uiFrame, UInt& ruiFoundLine ); 117 117 … … 129 129 #endif 130 130 Void xSetupBaseViewsFromCoded (); 131 Void xSetupBaseViews ( Char* pchBaseViewNumbers, UInt uiNumBaseViews );131 Void xSetupBaseViews ( TChar* pchBaseViewNumbers, UInt uiNumBaseViews ); 132 132 Bool xIsIn ( std::vector<Int>& rVec, Int iNumber); 133 133 … … 156 156 UInt uiStartFrameId, 157 157 UInt uiNumFrames, 158 Char* pchCfgFileName,159 Char* pchBaseViewNumbers,160 Char* pchSynthViewNumbers,158 TChar* pchCfgFileName, 159 TChar* pchBaseViewNumbers, 160 TChar* pchSynthViewNumbers, 161 161 std::vector<Int>* paiSynthViewNumbers, 162 162 Int iLog2Precision ); … … 165 165 UInt uiStartFrameId, 166 166 UInt uiNumFrames, 167 Char* pchCfgFileName,168 Char* pchSynthViewNumbers,167 TChar* pchCfgFileName, 168 TChar* pchSynthViewNumbers, 169 169 std::vector<Int>* paiSynthViewNumbers, 170 170 Int iLog2Precision … … 183 183 Int getRelDistLeft ( Int iSynthViewIdx, Int iLeftViewIdx, Int iRightViewIdx ); 184 184 UInt getCurFrameId () { return m_iCurrentFrameId; } 185 static Void convertNumberString ( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec );185 static Void convertNumberString ( TChar* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec ); 186 186 #if H_3D_REN_MAX_DEV_OUT 187 187 Double getMaxShiftDeviation () { return m_dMaxShiftDeviation; }; -
branches/HTM-15.2-dev/source/Lib/TLibCommon/CommonDef.h
r1357 r1360 42 42 #include <iostream> 43 43 #include <assert.h> 44 #include <limits> 44 45 45 46 #if _MSC_VER > 1000 … … 75 76 #define HM_VERSION "16.6" ///< 76 77 #else 77 #define NV_VERSION "16. 6" ///< Current software version78 #define NV_VERSION "16.7" ///< Current software version 78 79 #endif 79 80 // ==================================================================================================================== … … 141 142 142 143 static const Int AMVP_MAX_NUM_CANDS = 2; ///< AMVP: advanced motion vector prediction - max number of final candidates 143 static const Int AMVP_MAX_NUM_CANDS_MEM = 3; ///< AMVP: advanced motion vector prediction - max number of candidates144 144 static const Int AMVP_DECIMATION_FACTOR = 4; 145 145 static const Int MRG_MAX_NUM_CANDS = 5; ///< MERGE -
branches/HTM-15.2-dev/source/Lib/TLibCommon/Debug.cpp
r1321 r1360 49 49 #if DEBUG_STRING 50 50 // these strings are used to reorder the debug output so that the encoder and decoder match. 51 const Char *debug_reorder_data_inter_token[MAX_NUM_COMPONENT+1]51 const TChar *debug_reorder_data_inter_token[MAX_NUM_COMPONENT+1] 52 52 = {"Start of channel 0 inter debug\n", "Start of channel 1 inter debug\n", "Start of channel 2 inter debug\n", "End of inter residual debug\n"} ; 53 const Char *partSizeToString[NUMBER_OF_PART_SIZES]={"2Nx2N(0)", "2NxN(1)", "Nx2N(2)", "NxN(3)", "2Nx(N/2+3N/2)(4)", "2Nx(3N/2+N/2)(5)", "(N/2+3N/2)x2N(6)", "(3N/2+N/2)x2N(7)"};53 const TChar *partSizeToString[NUMBER_OF_PART_SIZES]={"2Nx2N(0)", "2NxN(1)", "Nx2N(2)", "NxN(3)", "2Nx(N/2+3N/2)(4)", "2Nx(3N/2+N/2)(5)", "(N/2+3N/2)x2N(6)", "(3N/2+N/2)x2N(7)"}; 54 54 #endif 55 55 … … 179 179 PRINT_CONSTANT(O0043_BEST_EFFORT_DECODING, settingNameWidth, settingValueWidth); 180 180 181 PRINT_CONSTANT(ME_ENABLE_ROUNDING_OF_MVS, settingNameWidth, settingValueWidth); 182 PRINT_CONSTANT(U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING, settingNameWidth, settingValueWidth); 183 181 184 //------------------------------------------------ 182 185 … … 418 421 419 422 420 Void printBlockToStream( std::ostream &ss, const Char *pLinePrefix, TComYuv &src, const UInt numSubBlocksAcross, const UInt numSubBlocksUp, const UInt defWidth )423 Void printBlockToStream( std::ostream &ss, const TChar *pLinePrefix, TComYuv &src, const UInt numSubBlocksAcross, const UInt numSubBlocksUp, const UInt defWidth ) 421 424 { 422 425 const UInt numValidComp=src.getNumberValidComponents(); -
branches/HTM-15.2-dev/source/Lib/TLibCommon/Debug.h
r1313 r1360 47 47 #include <TLibCommon/CommonDef.h> 48 48 #if DEBUG_STRING 49 extern const Char *debug_reorder_data_inter_token[MAX_NUM_COMPONENT+1];50 extern const Char *partSizeToString[NUMBER_OF_PART_SIZES];49 extern const TChar *debug_reorder_data_inter_token[MAX_NUM_COMPONENT+1]; 50 extern const TChar *partSizeToString[NUMBER_OF_PART_SIZES]; 51 51 #endif 52 52 … … 149 149 UInt getZScanIndex(const UInt x, const UInt y); 150 150 151 //template specialisation for Char types to get it to render as a number151 //template specialisation for SChar/UChar types to get it to render as a number 152 152 template <typename ValueType> inline Void writeValueToStream (const ValueType &value, std::ostream &stream, const UInt outputWidth) { stream << std::setw(outputWidth) << value; } 153 template <> inline Void writeValueToStream< Char >(const Char&value, std::ostream &stream, const UInt outputWidth) { stream << std::setw(outputWidth) << Int(value); }153 template <> inline Void writeValueToStream<SChar>(const SChar &value, std::ostream &stream, const UInt outputWidth) { stream << std::setw(outputWidth) << Int(value); } 154 154 template <> inline Void writeValueToStream<UChar>(const UChar &value, std::ostream &stream, const UInt outputWidth) { stream << std::setw(outputWidth) << UInt(value); } 155 155 … … 231 231 232 232 template <typename T> 233 Void printBlockToStream( std::ostream &ss, const Char *pLinePrefix, const T * blkSrc, const UInt width, const UInt height, const UInt stride, const UInt subBlockWidth=0, const UInt subBlockHeight=0, const UInt defWidth=3 )233 Void printBlockToStream( std::ostream &ss, const TChar *pLinePrefix, const T * blkSrc, const UInt width, const UInt height, const UInt stride, const UInt subBlockWidth=0, const UInt subBlockHeight=0, const UInt defWidth=3 ) 234 234 { 235 235 for (UInt y=0; y<height; y++) … … 255 255 256 256 class TComYuv; 257 Void printBlockToStream( std::ostream &ss, const Char *pLinePrefix, TComYuv &src, const UInt numSubBlocksAcross=1, const UInt numSubBlocksUp=1, const UInt defWidth=3 );257 Void printBlockToStream( std::ostream &ss, const TChar *pLinePrefix, TComYuv &src, const UInt numSubBlocksAcross=1, const UInt numSubBlocksUp=1, const UInt defWidth=3 ); 258 258 259 259 // ---------------------------------------------------------------------------------------------- // -
branches/HTM-15.2-dev/source/Lib/TLibCommon/SEI.cpp
r1356 r1360 118 118 119 119 // Static member 120 const Char *SEI::getSEIMessageString(SEI::PayloadType payloadType)120 const TChar *SEI::getSEIMessageString(SEI::PayloadType payloadType) 121 121 { 122 122 switch (payloadType) … … 151 151 case SEI::SEGM_RECT_FRAME_PACKING: return "Segmented rectangular frame packing arrangement"; 152 152 case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS: return "Temporal motion constrained tile sets"; 153 case SEI::CHROMA_SAMPLING_FILTER_HINT: return "Chroma sampling filter hint"; 153 case SEI::CHROMA_RESAMPLING_FILTER_HINT: return "Chroma sampling filter hint"; 154 case SEI::COLOUR_REMAPPING_INFO: return "Colour remapping info"; 155 154 156 #if NH_MV 155 case SEI::COLOUR_REMAPPING_INFO: return "Colour remapping information";156 157 case SEI::DEINTERLACED_FIELD_IDENTIFICATION: return "Deinterlaced field identification"; 157 158 case SEI::LAYERS_NOT_PRESENT: return "Layers not present"; … … 266 267 } 267 268 268 Void SEI::setupFromCfgFile( const Char* cfgFile )269 Void SEI::setupFromCfgFile( const TChar* cfgFile ) 269 270 { 270 271 assert( false ); … … 304 305 } 305 306 306 Void SEI::xCheckCfgRange( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const Char* seName )307 Void SEI::xCheckCfgRange( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const TChar* seName ) 307 308 { 308 309 if ( val < minVal || val > maxVal ) … … 329 330 } 330 331 331 Void SEI::xCheckCfg( Bool& wrongConfig, Bool cond, const Char* errStr )332 Void SEI::xCheckCfg( Bool& wrongConfig, Bool cond, const TChar* errStr ) 332 333 { 333 334 if ( !cond ) … … 341 342 342 343 #if NH_MV_LAYERS_NOT_PRESENT_SEI 343 Void SEILayersNotPresent::setupFromCfgFile(const Char* cfgFile)344 Void SEILayersNotPresent::setupFromCfgFile(const TChar* cfgFile) 344 345 { 345 346 // Set default values … … 401 402 402 403 403 Void SEIInterLayerConstrainedTileSets::setupFromCfgFile(const Char* cfgFile)404 Void SEIInterLayerConstrainedTileSets::setupFromCfgFile(const TChar* cfgFile) 404 405 { 405 406 // Set default values … … 483 484 }; 484 485 485 Void SEIBspNesting::setupFromCfgFile(const Char* cfgFile)486 Void SEIBspNesting::setupFromCfgFile(const TChar* cfgFile) 486 487 { 487 488 // Set default values … … 556 557 }; 557 558 558 Void SEIBspInitialArrivalTime::setupFromCfgFile(const Char* cfgFile)559 Void SEIBspInitialArrivalTime::setupFromCfgFile(const TChar* cfgFile) 559 560 { 560 561 // Set default values … … 605 606 #endif 606 607 607 Void SEISubBitstreamProperty::setupFromCfgFile(const Char* cfgFile)608 Void SEISubBitstreamProperty::setupFromCfgFile(const TChar* cfgFile) 608 609 { 609 610 // Set default values … … 681 682 } 682 683 683 Void SEIAlphaChannelInfo::setupFromCfgFile(const Char* cfgFile)684 Void SEIAlphaChannelInfo::setupFromCfgFile(const TChar* cfgFile) 684 685 { 685 686 // Set default values … … 744 745 { }; 745 746 746 Void SEIOverlayInfo::setupFromCfgFile(const Char* cfgFile)747 Void SEIOverlayInfo::setupFromCfgFile(const TChar* cfgFile) 747 748 { 748 749 // Set default values … … 828 829 829 830 830 Void SEITemporalMvPredictionConstraints::setupFromCfgFile(const Char* cfgFile)831 Void SEITemporalMvPredictionConstraints::setupFromCfgFile(const TChar* cfgFile) 831 832 { 832 833 // Set default values … … 870 871 871 872 #if NH_MV_SEI_TBD 872 Void SEIFrameFieldInfo::setupFromCfgFile(const Char* cfgFile)873 Void SEIFrameFieldInfo::setupFromCfgFile(const TChar* cfgFile) 873 874 { 874 875 // Set default values … … 922 923 #endif 923 924 924 Void SEIThreeDimensionalReferenceDisplaysInfo::setupFromCfgFile(const Char* cfgFile)925 Void SEIThreeDimensionalReferenceDisplaysInfo::setupFromCfgFile(const TChar* cfgFile) 925 926 { 926 927 // Set default values … … 1025 1026 }; 1026 1027 1027 Void SEIDepthRepresentationInfo::setupFromCfgFile(const Char* cfgFile)1028 Void SEIDepthRepresentationInfo::setupFromCfgFile(const TChar* cfgFile) 1028 1029 { 1029 1030 // Set default values … … 1197 1198 #endif 1198 1199 1199 Void SEIMultiviewSceneInfo::setupFromCfgFile(const Char* cfgFile)1200 Void SEIMultiviewSceneInfo::setupFromCfgFile(const TChar* cfgFile) 1200 1201 { 1201 1202 // Set default values … … 1243 1244 }; 1244 1245 1245 Void SEIMultiviewAcquisitionInfo::setupFromCfgFile(const Char* cfgFile)1246 Void SEIMultiviewAcquisitionInfo::setupFromCfgFile(const TChar* cfgFile) 1246 1247 { 1247 1248 // Set default values … … 1405 1406 } 1406 1407 1407 Void SEIMultiviewViewPosition::setupFromCfgFile(const Char* cfgFile)1408 Void SEIMultiviewViewPosition::setupFromCfgFile(const TChar* cfgFile) 1408 1409 { 1409 1410 // Set default values … … 1456 1457 1457 1458 #if NH_3D 1458 Void SEIAlternativeDepthInfo::setupFromCfgFile(const Char* cfgFile)1459 Void SEIAlternativeDepthInfo::setupFromCfgFile(const TChar* cfgFile) 1459 1460 { 1460 1461 // Set default values -
branches/HTM-15.2-dev/source/Lib/TLibCommon/SEI.h
r1356 r1360 94 94 SEGM_RECT_FRAME_PACKING = 138, 95 95 TEMP_MOTION_CONSTRAINED_TILE_SETS = 139, 96 CHROMA_SAMPLING_FILTER_HINT = 140, 97 KNEE_FUNCTION_INFO = 141 96 CHROMA_RESAMPLING_FILTER_HINT = 140, 97 KNEE_FUNCTION_INFO = 141, 98 COLOUR_REMAPPING_INFO = 142, 98 99 #if NH_MV_SEI 99 ,COLOUR_REMAPPING_INFO = 142,100 100 DEINTERLACED_FIELD_IDENTIFICATION = 143, 101 101 LAYERS_NOT_PRESENT = 160, … … 120 120 }; 121 121 122 #if NH_MV 122 123 SEI(); 124 #else 125 SEI() {} 126 #endif 127 123 128 124 129 virtual ~SEI() {} 130 131 static const TChar *getSEIMessageString(SEI::PayloadType payloadType); 132 133 virtual PayloadType payloadType() const = 0; 134 135 #if NH_MV_SEI 125 136 virtual SEI* getCopy( ) const; 126 static const Char *getSEIMessageString(SEI::PayloadType payloadType );127 virtual PayloadType payloadType() const = 0;128 129 #if NH_MV_SEI130 137 static SEI* getNewSEIMessage ( SEI::PayloadType payloadType ); 131 138 Bool insertSei ( Int curLayerId, Int curPoc, Int curTid, Int curNaluType ) const; … … 133 140 134 141 virtual Void setupFromSlice ( const TComSlice* slice ); 135 virtual Void setupFromCfgFile ( const Char*cfgFile );142 virtual Void setupFromCfgFile ( const TChar* cfgFile ); 136 143 virtual Bool checkCfg ( const TComSlice* slice ); 137 144 138 145 Void xPrintCfgErrorIntro(); 139 Void xCheckCfgRange ( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const Char* seName );140 Void xCheckCfg ( Bool& wrongConfig, Bool cond, const Char* errStr );146 Void xCheckCfgRange ( Bool& wrongConfig, Int val, Int minVal, Int maxVal, const TChar* seName ); 147 Void xCheckCfg ( Bool& wrongConfig, Bool cond, const TChar* errStr ); 141 148 Void xAddGeneralOpts ( po::Options &opts, IntAry1d defAppLayerIds, IntAry1d defAppPocs, IntAry1d defAppTids, IntAry1d defAppVclNaluTypes, 142 149 Int defSeiNaluId, Int defPositionInSeiNalu, Bool defModifyByEncoder ); … … 186 193 virtual ~SEIDecodedPictureHash() {} 187 194 188 enum Method 189 { 190 MD5, 191 CRC, 192 CHECKSUM, 193 RESERVED, 194 } method; 195 HashType method; 195 196 196 197 TComPictureHash m_pictureHash; … … 482 483 }; 483 484 484 class SEIChromaSamplingFilterHint : public SEI 485 { 486 public: 487 PayloadType payloadType() const {return CHROMA_SAMPLING_FILTER_HINT;} 488 SEIChromaSamplingFilterHint() {} 489 virtual ~SEIChromaSamplingFilterHint() { 490 if(m_verChromaFilterIdc == 1) 485 class SEIColourRemappingInfo : public SEI 486 { 487 public: 488 489 struct CRIlut 490 { 491 Int codedValue; 492 Int targetValue; 493 bool operator < (const CRIlut& a) const 491 494 { 492 for(Int i = 0; i < m_numVerticalFilters; i ++) 495 return codedValue < a.codedValue; 496 } 497 }; 498 499 PayloadType payloadType() const { return COLOUR_REMAPPING_INFO; } 500 SEIColourRemappingInfo() {} 501 ~SEIColourRemappingInfo() {} 502 503 Void copyFrom( const SEIColourRemappingInfo &seiCriInput) 493 504 { 494 free(m_verFilterCoeff[i]); 495 } 496 free(m_verFilterCoeff); 497 free(m_verTapLengthMinus1); 498 } 499 if(m_horChromaFilterIdc == 1) 500 { 501 for(Int i = 0; i < m_numHorizontalFilters; i ++) 502 { 503 free(m_horFilterCoeff[i]); 504 } 505 free(m_horFilterCoeff); 506 free(m_horTapLengthMinus1); 507 } 505 (*this) = seiCriInput; 508 506 } 507 508 UInt m_colourRemapId; 509 Bool m_colourRemapCancelFlag; 510 Bool m_colourRemapPersistenceFlag; 511 Bool m_colourRemapVideoSignalInfoPresentFlag; 512 Bool m_colourRemapFullRangeFlag; 513 Int m_colourRemapPrimaries; 514 Int m_colourRemapTransferFunction; 515 Int m_colourRemapMatrixCoefficients; 516 Int m_colourRemapInputBitDepth; 517 Int m_colourRemapBitDepth; 518 Int m_preLutNumValMinus1[3]; 519 std::vector<CRIlut> m_preLut[3]; 520 Bool m_colourRemapMatrixPresentFlag; 521 Int m_log2MatrixDenom; 522 Int m_colourRemapCoeffs[3][3]; 523 Int m_postLutNumValMinus1[3]; 524 std::vector<CRIlut> m_postLut[3]; 525 }; 526 527 class SEIChromaResamplingFilterHint : public SEI 528 { 529 public: 530 PayloadType payloadType() const {return CHROMA_RESAMPLING_FILTER_HINT;} 531 SEIChromaResamplingFilterHint() {} 532 virtual ~SEIChromaResamplingFilterHint() {} 509 533 510 534 Int m_verChromaFilterIdc; 511 535 Int m_horChromaFilterIdc; 512 Bool m_verFilteringProcessFlag;536 Bool m_verFilteringFieldProcessingFlag; 513 537 Int m_targetFormatIdc; 514 538 Bool m_perfectReconstructionFlag; 515 Int m_numVerticalFilters; 516 Int* m_verTapLengthMinus1; 517 Int** m_verFilterCoeff; 518 Int m_numHorizontalFilters; 519 Int* m_horTapLengthMinus1; 520 Int** m_horFilterCoeff; 539 std::vector<std::vector<Int> > m_verFilterCoeff; 540 std::vector<std::vector<Int> > m_horFilterCoeff; 521 541 }; 522 542 … … 669 689 SEI* getCopy( ) const { return new SEILayersNotPresent(*this); }; 670 690 671 Void setupFromCfgFile( const Char*cfgFile );691 Void setupFromCfgFile( const TChar* cfgFile ); 672 692 Bool checkCfg ( const TComSlice* slice ); 673 693 … … 691 711 SEI* getCopy( ) const { return new SEIInterLayerConstrainedTileSets(*this); }; 692 712 693 Void setupFromCfgFile( const Char*cfgFile );713 Void setupFromCfgFile( const TChar* cfgFile ); 694 714 Bool checkCfg ( const TComSlice* slice ); 695 715 … … 733 753 SEI* getCopy( ) const { return new SEIBspNesting(*this); }; 734 754 735 Void setupFromCfgFile( const Char* cfgFile );755 Void setupFromCfgFile( const TChar* cfgFile ); 736 756 Void setupFromSlice ( const TComSlice* slice ); 737 757 Bool checkCfg ( const TComSlice* slice ); … … 752 772 SEI* getCopy( ) const { return new SEIBspInitialArrivalTime(*this); }; 753 773 754 Void setupFromCfgFile( const Char* cfgFile );774 Void setupFromCfgFile( const TChar* cfgFile ); 755 775 Void setupFromSlice ( const TComSlice* slice ); 756 776 Bool checkCfg ( const TComSlice* slice ); … … 769 789 SEI* getCopy( ) const { return new SEISubBitstreamProperty(*this); }; 770 790 771 Void setupFromCfgFile( const Char*cfgFile );791 Void setupFromCfgFile( const TChar* cfgFile ); 772 792 Bool checkCfg ( const TComSlice* slice ); 773 793 Void resizeArrays ( ); … … 790 810 SEI* getCopy( ) const { return new SEIAlphaChannelInfo(*this); }; 791 811 792 Void setupFromCfgFile( const Char*cfgFile );812 Void setupFromCfgFile( const TChar* cfgFile ); 793 813 Bool checkCfg ( const TComSlice* slice ); 794 814 … … 811 831 SEI* getCopy( ) const { return new SEIOverlayInfo(*this); }; 812 832 813 Void setupFromCfgFile( const Char*cfgFile );833 Void setupFromCfgFile( const TChar* cfgFile ); 814 834 Bool checkCfg ( const TComSlice* slice ); 815 835 … … 848 868 SEI* getCopy( ) const { return new SEITemporalMvPredictionConstraints(*this); }; 849 869 850 Void setupFromCfgFile( const Char*cfgFile );870 Void setupFromCfgFile( const TChar* cfgFile ); 851 871 Bool checkCfg ( const TComSlice* slice ); 852 872 … … 864 884 SEI* getCopy( ) const { return new SEIFrameFieldInfo(*this); }; 865 885 866 Void setupFromCfgFile( const Char*cfgFile );886 Void setupFromCfgFile( const TChar* cfgFile ); 867 887 Void setupFromSlice ( const TComSlice* slice ); 868 888 Bool checkCfg ( const TComSlice* slice ); … … 882 902 SEI* getCopy( ) const { return new SEIThreeDimensionalReferenceDisplaysInfo(*this); }; 883 903 884 Void setupFromCfgFile( const Char*cfgFile );904 Void setupFromCfgFile( const TChar* cfgFile ); 885 905 Bool checkCfg ( const TComSlice* slice ); 886 906 … … 936 956 SEI* getCopy( ) const { return new SEIDepthRepresentationInfo(*this); }; 937 957 938 Void setupFromCfgFile( const Char*cfgFile );958 Void setupFromCfgFile( const TChar* cfgFile ); 939 959 Void setupFromSlice ( const TComSlice* slice ); 940 960 Bool checkCfg ( const TComSlice* slice ); … … 1003 1023 SEI* getCopy( ) const { return new SEIMultiviewSceneInfo(*this); }; 1004 1024 1005 Void setupFromCfgFile( const Char*cfgFile );1025 Void setupFromCfgFile( const TChar* cfgFile ); 1006 1026 Bool checkCfg ( const TComSlice* slice ); 1007 1027 … … 1019 1039 SEI* getCopy( ) const { return new SEIMultiviewAcquisitionInfo(*this); }; 1020 1040 1021 Void setupFromCfgFile( const Char*cfgFile );1041 Void setupFromCfgFile( const TChar* cfgFile ); 1022 1042 Bool checkCfg ( const TComSlice* slice ); 1023 1043 … … 1131 1151 SEI* getCopy( ) const { return new SEIMultiviewViewPosition(*this); }; 1132 1152 1133 Void setupFromCfgFile( const Char*cfgFile );1153 Void setupFromCfgFile( const TChar* cfgFile ); 1134 1154 Void setupFromSlice ( const TComSlice* slice ); 1135 1155 Bool checkCfg ( const TComSlice* slice ); … … 1148 1168 SEI* getCopy( ) const { return new SEIAlternativeDepthInfo(*this); }; 1149 1169 1150 Void setupFromCfgFile( const Char*cfgFile );1170 Void setupFromCfgFile( const TChar* cfgFile ); 1151 1171 Bool checkCfg ( const TComSlice* slice ); 1152 1172 -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComBitStream.cpp
r1321 r1360 93 93 } 94 94 95 Char* TComOutputBitstream::getByteStream() const96 { 97 return ( Char*) &m_fifo.front();95 UChar* TComOutputBitstream::getByteStream() const 96 { 97 return (UChar*) &m_fifo.front(); 98 98 } 99 99 -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComBitStream.h
r1313 r1360 115 115 * bytestream are stored in ascending addresses. 116 116 */ 117 Char* getByteStream() const;117 UChar* getByteStream() const; 118 118 119 119 /** -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComCodingStatistics.h
r1321 r1360 120 120 }; 121 121 122 static inline const Char* getName(TComCodingStatisticsType name)122 static inline const TChar* getName(TComCodingStatisticsType name) 123 123 { 124 static const Char *statNames[]=124 static const TChar *statNames[]= 125 125 { 126 126 "NAL_UNIT_TOTAL_BODY", // This is a special case and is not included in the total sums. … … 189 189 #endif 190 190 }; 191 assert(STATS__NUM_STATS == sizeof(statNames)/sizeof( Char *) && name < STATS__NUM_STATS);191 assert(STATS__NUM_STATS == sizeof(statNames)/sizeof(TChar *) && name < STATS__NUM_STATS); 192 192 return statNames[name]; 193 193 } … … 229 229 } 230 230 231 static const Char *GetSubClassString(const UInt subClass)231 static const TChar *GetSubClassString(const UInt subClass) 232 232 { 233 233 assert (subClass<CODING_STATS_NUM_SUBCLASSES); 234 static const Char *strings[1+MAX_NUM_COMPONENT+MAX_NUM_CHANNEL_TYPE]={"-", "Y", "Cb", "Cr", "Luma", "Chroma"};234 static const TChar *strings[1+MAX_NUM_COMPONENT+MAX_NUM_CHANNEL_TYPE]={"-", "Y", "Cb", "Cr", "Luma", "Chroma"}; 235 235 return strings[subClass/CODING_STATS_NUM_WIDTHS]; 236 236 } … … 289 289 { } 290 290 291 static Void OutputLine(const Char *pName, const Char sep, UInt width, constChar *pSubClassStr, const SStat &sCABAC, const SStat &sEP)291 static Void OutputLine(const TChar *pName, const TChar sep, UInt width, const TChar *pSubClassStr, const SStat &sCABAC, const SStat &sEP) 292 292 { 293 293 if (width==0) … … 302 302 } 303 303 } 304 static Void OutputLine(const Char *pName, const Char sep, const Char *pWidthString, constChar *pSubClassStr, const SStat &sCABAC, const SStat &sEP)304 static Void OutputLine(const TChar *pName, const TChar sep, const TChar *pWidthString, const TChar *pSubClassStr, const SStat &sCABAC, const SStat &sEP) 305 305 { 306 306 printf("%c%-45s%c %6s %6s %12lld %12lld %12lld %12lld %12lld %12lld %12lld (%12lld)%c\n", … … 308 308 sCABAC.count, sCABAC.sum, sCABAC.bits, sEP.count, sEP.sum, sEP.bits, sCABAC.bits+sEP.bits, (sCABAC.bits+sEP.bits)/8, sep=='~'?']':' '); 309 309 } 310 static Void OutputLine(const Char *pName, const Char sep, const Char *pWidthString, constChar *pSubClassStr, const SStat &sEP)310 static Void OutputLine(const TChar *pName, const TChar sep, const TChar *pWidthString, const TChar *pSubClassStr, const SStat &sEP) 311 311 { 312 312 printf("%c%-45s%c %6s %6s %12s %12s %12s %12lld %12lld %12lld %12lld (%12lld)%c\n", … … 315 315 } 316 316 317 static Void OutputDashedLine(const Char *pText)317 static Void OutputDashedLine(const TChar *pText) 318 318 { 319 319 printf("--%s",pText); … … 360 360 SStat cabacSubTotal, epSubTotal; 361 361 Bool bHadClassifiedEntry=false; 362 const Char *pName=getName(TComCodingStatisticsType(i));362 const TChar *pName=getName(TComCodingStatisticsType(i)); 363 363 364 364 for(UInt c=0; c<CODING_STATS_NUM_SUBCLASSES; c++) … … 488 488 static SStat &GetStatisticEP(const std::string &str) { return GetSingletonInstance().data.mappings_ep[str]; } 489 489 490 static SStat &GetStatisticEP(const Char *pKey) {return GetStatisticEP(std::string(pKey)); }490 static SStat &GetStatisticEP(const TChar *pKey) {return GetStatisticEP(std::string(pKey)); } 491 491 492 492 static Void IncrementStatisticEP(const TComCodingStatisticsClassType &stat, const Int numBits, const Int value) … … 506 506 } 507 507 508 static Void IncrementStatisticEP(const Char *pKey, const Int numBits, const Int value)508 static Void IncrementStatisticEP(const TChar *pKey, const Int numBits, const Int value) 509 509 { 510 510 SStat &s=GetStatisticEP(pKey); -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComDataCU.cpp
r1356 r1360 160 160 if ( !bDecSubCu ) 161 161 { 162 m_phQP = ( Char* )xMalloc(Char,uiNumPartition);162 m_phQP = (SChar* )xMalloc(SChar, uiNumPartition); 163 163 m_puhDepth = (UChar* )xMalloc(UChar, uiNumPartition); 164 164 m_puhWidth = (UChar* )xMalloc(UChar, uiNumPartition); … … 171 171 m_ucDISType = (UChar*)xMalloc(UChar, uiNumPartition); 172 172 #endif 173 m_pePartSize = new Char[ uiNumPartition ];173 m_pePartSize = new SChar[ uiNumPartition ]; 174 174 memset( m_pePartSize, NUMBER_OF_PART_SIZES,uiNumPartition * sizeof( *m_pePartSize ) ); 175 m_pePredMode = new Char[ uiNumPartition ];175 m_pePredMode = new SChar[ uiNumPartition ]; 176 176 m_CUTransquantBypass = new Bool[ uiNumPartition ]; 177 177 … … 179 179 m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); 180 180 #if NH_3D_VSP 181 m_piVSPFlag = ( Char* )xMalloc(Char,uiNumPartition);181 m_piVSPFlag = (SChar* )xMalloc(SChar, uiNumPartition); 182 182 #endif 183 183 #if NH_3D_SPIVMP … … 196 196 { 197 197 const RefPicList rpl=RefPicList(i); 198 m_apiMVPIdx[rpl] = new Char[ uiNumPartition ];199 m_apiMVPNum[rpl] = new Char[ uiNumPartition ];200 memset( m_apiMVPIdx[rpl], -1,uiNumPartition * sizeof( Char ) );198 m_apiMVPIdx[rpl] = new SChar[ uiNumPartition ]; 199 m_apiMVPNum[rpl] = new SChar[ uiNumPartition ]; 200 memset( m_apiMVPIdx[rpl], -1,uiNumPartition * sizeof( SChar ) ); 201 201 } 202 202 … … 212 212 const UInt totalSize = (uiWidth * uiHeight) >> chromaShift; 213 213 214 m_crossComponentPredictionAlpha[compID] = ( Char* )xMalloc(Char,uiNumPartition);214 m_crossComponentPredictionAlpha[compID] = (SChar* )xMalloc(SChar, uiNumPartition); 215 215 m_puhTransformSkip[compID] = (UChar* )xMalloc(UChar, uiNumPartition); 216 216 m_explicitRdpcmMode[compID] = (UChar* )xMalloc(UChar, uiNumPartition); … … 524 524 } 525 525 526 Bool TComDataCU::isLastSubCUOfCtu(const UInt absPartIdx) 526 Bool TComDataCU::isLastSubCUOfCtu(const UInt absPartIdx) const 527 527 { 528 528 const TComSPS &sps=*(getSlice()->getSPS()); … … 844 844 Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; 845 845 Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; 846 Int sizeInChar = sizeof( Char ) * m_uiNumPartition;846 Int sizeInChar = sizeof( SChar ) * m_uiNumPartition; 847 847 848 848 memset( m_phQP, qp, sizeInChar ); … … 850 850 memset( m_puhMergeIndex, 0, iSizeInUchar ); 851 851 #if NH_3D_VSP 852 memset( m_piVSPFlag, 0, sizeof( Char) * m_uiNumPartition );852 memset( m_piVSPFlag, 0, sizeof( SChar ) * m_uiNumPartition ); 853 853 #endif 854 854 #if NH_3D_SPIVMP … … 1219 1219 Int iSizeInBool = sizeof( Bool ) * uiNumPartition; 1220 1220 1221 Int sizeInChar = sizeof( Char ) * uiNumPartition;1221 Int sizeInChar = sizeof( SChar ) * uiNumPartition; 1222 1222 memcpy( m_skipFlag + uiOffset, pcCU->getSkipFlag(), sizeof( *m_skipFlag ) * uiNumPartition ); 1223 1223 #if NH_3D_DIS … … 1233 1233 memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); 1234 1234 #if NH_3D_VSP 1235 memcpy( m_piVSPFlag + uiOffset, pcCU->getVSPFlag(), sizeof( Char ) * uiNumPartition );1235 memcpy( m_piVSPFlag + uiOffset, pcCU->getVSPFlag(), sizeof( SChar ) * uiNumPartition ); 1236 1236 memcpy( m_pDvInfo + uiOffset, pcCU->getDvInfo(), sizeof( *m_pDvInfo ) * uiNumPartition ); 1237 1237 #endif … … 1335 1335 Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; 1336 1336 Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; 1337 Int sizeInChar = sizeof( Char ) * m_uiNumPartition;1337 Int sizeInChar = sizeof( SChar ) * m_uiNumPartition; 1338 1338 1339 1339 memcpy( pCtu->getSkipFlag() + m_absZIdxInCtu, m_skipFlag, sizeof( *m_skipFlag ) * m_uiNumPartition ); … … 1355 1355 memcpy( pCtu->getMergeIndex() + m_absZIdxInCtu, m_puhMergeIndex, iSizeInUchar ); 1356 1356 #if NH_3D_VSP 1357 memcpy( pCtu->getVSPFlag() + m_absZIdxInCtu, m_piVSPFlag, sizeof( Char ) * m_uiNumPartition );1357 memcpy( pCtu->getVSPFlag() + m_absZIdxInCtu, m_piVSPFlag, sizeof( SChar ) * m_uiNumPartition ); 1358 1358 #endif 1359 1359 #if NH_3D_DBBP … … 1447 1447 // -------------------------------------------------------------------------------------------------------------------- 1448 1448 1449 TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx,1449 const TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx, 1450 1450 UInt uiCurrPartUnitIdx, 1451 1451 Bool bEnforceSliceRestriction, 1452 Bool bEnforceTileRestriction )1452 Bool bEnforceTileRestriction ) const 1453 1453 { 1454 1454 UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1479 1479 1480 1480 1481 TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx,1481 const TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx, 1482 1482 UInt uiCurrPartUnitIdx, 1483 1483 Bool bEnforceSliceRestriction, 1484 1484 Bool planarAtCtuBoundary, 1485 Bool bEnforceTileRestriction )1485 Bool bEnforceTileRestriction ) const 1486 1486 { 1487 1487 UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1517 1517 } 1518 1518 1519 TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) 1519 const TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction ) const 1520 1520 { 1521 1521 UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1564 1564 } 1565 1565 1566 TComDataCU* TComDataCU::getPUBelowLeft(UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) 1566 const TComDataCU* TComDataCU::getPUBelowLeft(UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) const 1567 1567 { 1568 1568 UInt uiAbsPartIdxLB = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1608 1608 } 1609 1609 1610 TComDataCU* TComDataCU::getPUAboveRight(UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) 1610 const TComDataCU* TComDataCU::getPUAboveRight(UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction) const 1611 1611 { 1612 1612 UInt uiAbsPartIdxRT = g_auiZscanToRaster[uiCurrPartUnitIdx]; … … 1668 1668 *\returns TComDataCU* point of TComDataCU of left QpMinCu 1669 1669 */ 1670 TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) 1670 const TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const 1671 1671 { 1672 1672 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); … … 1695 1695 *\returns TComDataCU* point of TComDataCU of above QpMinCu 1696 1696 */ 1697 TComDataCU* TComDataCU::getQpMinCuAbove( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) 1697 const TComDataCU* TComDataCU::getQpMinCuAbove( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const 1698 1698 { 1699 1699 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); … … 1721 1721 /** Get reference QP from left QpMinCu or latest coded QP 1722 1722 *\param uiCurrAbsIdxInCtu 1723 *\returns Char reference QP value1723 *\returns SChar reference QP value 1724 1724 */ 1725 Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInCtu ) 1725 SChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInCtu ) const 1726 1726 { 1727 1727 UInt lPartIdx = MAX_UINT; 1728 1728 UInt aPartIdx = MAX_UINT; 1729 TComDataCU* cULeft = getQpMinCuLeft ( lPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );1730 TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu );1729 const TComDataCU* cULeft = getQpMinCuLeft ( lPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu ); 1730 const TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_absZIdxInCtu + uiCurrAbsIdxInCtu ); 1731 1731 return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInCtu )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInCtu )) + 1) >> 1); 1732 1732 } 1733 1733 1734 Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) 1734 Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) const 1735 1735 { 1736 1736 Int iLastValidPartIdx = iAbsPartIdx-1; … … 1744 1744 } 1745 1745 1746 Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) 1746 SChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) const 1747 1747 { 1748 1748 UInt uiQUPartIdxMask = ~((1<<((getSlice()->getSPS()->getMaxTotalCUDepth() - getSlice()->getPPS()->getMaxCuDQPDepth())<<1))-1); … … 1784 1784 * \returns true if the CU is coded in lossless coding mode; false if otherwise 1785 1785 */ 1786 Bool TComDataCU::isLosslessCoded(UInt absPartIdx) 1786 Bool TComDataCU::isLosslessCoded(UInt absPartIdx) const 1787 1787 { 1788 1788 return (getSlice()->getPPS()->getTransquantBypassEnableFlag() && getCUTransquantBypass (absPartIdx)); … … 1796 1796 *\param [out] uiModeList pointer to chroma intra modes array 1797 1797 */ 1798 Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt uiModeList[NUM_CHROMA_MODE] ) 1798 Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt uiModeList[NUM_CHROMA_MODE] ) const 1799 1799 { 1800 1800 uiModeList[0] = PLANAR_IDX; … … 1824 1824 *\returns Number of MPM 1825 1825 */ 1826 Void TComDataCU::getIntraDirPredictor( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode ) 1827 { 1828 TComDataCU* pcCULeft, *pcCUAbove; 1826 Void TComDataCU::getIntraDirPredictor( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode ) const 1827 { 1829 1828 UInt LeftPartIdx = MAX_UINT; 1830 1829 UInt AbovePartIdx = MAX_UINT; … … 1836 1835 const ChromaFormat chForm = getPic()->getChromaFormat(); 1837 1836 // Get intra direction of left PU 1838 pcCULeft = getPULeft( LeftPartIdx, m_absZIdxInCtu + uiAbsPartIdx );1837 const TComDataCU *pcCULeft = getPULeft( LeftPartIdx, m_absZIdxInCtu + uiAbsPartIdx ); 1839 1838 1840 1839 if (isChroma(compID)) … … 1848 1847 1849 1848 // Get intra direction of above PU 1850 pcCUAbove = getPUAbove( AbovePartIdx, m_absZIdxInCtu + uiAbsPartIdx, true, true );1849 const TComDataCU *pcCUAbove = getPUAbove( AbovePartIdx, m_absZIdxInCtu + uiAbsPartIdx, true, true ); 1851 1850 1852 1851 if (isChroma(compID)) … … 1917 1916 } 1918 1917 1919 UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) 1920 { 1921 TComDataCU* pcTempCU;1918 UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) const 1919 { 1920 const TComDataCU* pcTempCU; 1922 1921 UInt uiTempPartIdx; 1923 1922 UInt uiCtx; … … 1933 1932 } 1934 1933 1935 UInt TComDataCU::getCtxQtCbf( TComTU &rTu, const ChannelType chType ) 1934 UInt TComDataCU::getCtxQtCbf( TComTU &rTu, const ChannelType chType ) const 1936 1935 { 1937 1936 const UInt transformDepth = rTu.GetTransformDepthRel(); … … 1948 1947 } 1949 1948 1950 UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) 1949 UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) const 1951 1950 { 1952 1951 UInt log2CbSize = g_aucConvertToBit[getWidth( absPartIdx )] + 2; … … 1975 1974 } 1976 1975 1977 UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) 1978 { 1979 TComDataCU* pcTempCU;1976 UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) const 1977 { 1978 const TComDataCU* pcTempCU; 1980 1979 UInt uiTempPartIdx; 1981 1980 UInt uiCtx = 0; … … 1994 1993 UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx ) 1995 1994 { 1996 TComDataCU* pcTempCU;1995 const TComDataCU* pcTempCU; 1997 1996 UInt uiTempPartIdx; 1998 1997 UInt uiCtx = 0; 1999 1998 2000 1999 pcTempCU = getPULeft( uiTempPartIdx, m_absZIdxInCtu + uiAbsPartIdx ); 2001 2000 uiCtx = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0; 2002 2001 return uiCtx; 2003 2002 } 2004 2003 #endif … … 2086 2085 2087 2086 2088 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) 2087 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) const 2089 2088 { 2090 2089 return getDepth( uiAbsPartIdx ); … … 2092 2091 2093 2092 2094 UChar TComDataCU::getQtRootCbf( UInt uiIdx ) 2093 UChar TComDataCU::getQtRootCbf( UInt uiIdx ) const 2095 2094 { 2096 2095 const UInt numberValidComponents = getPic()->getNumberValidComponents(); … … 2148 2147 } 2149 2148 2150 Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) 2149 Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) const 2151 2150 { 2152 2151 UInt uiPartNumb = m_pcPic->getNumPartitionsInCtu() >> (uiDepth << 1); … … 2376 2375 2377 2376 #if NH_3D_VSP 2378 Void TComDataCU::setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )2379 { 2380 setSubPart< Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );2377 Void TComDataCU::setVSPFlagSubParts( SChar iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2378 { 2379 setSubPart<SChar>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2381 2380 } 2382 2381 template<typename T> … … 2523 2522 Void TComDataCU::setMVPIdxSubParts( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2524 2523 { 2525 setSubPart< Char>( iMVPIdx, m_apiMVPIdx[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx );2524 setSubPart<SChar>( iMVPIdx, m_apiMVPIdx[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); 2526 2525 } 2527 2526 2528 2527 Void TComDataCU::setMVPNumSubParts( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2529 2528 { 2530 setSubPart< Char>( iMVPNum, m_apiMVPNum[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx );2529 setSubPart<SChar>( iMVPNum, m_apiMVPNum[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); 2531 2530 } 2532 2531 … … 2561 2560 } 2562 2561 2563 Void TComDataCU::setCrossComponentPredictionAlphaPartRange( Char alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes )2564 { 2565 memset((m_crossComponentPredictionAlpha[compID] + uiAbsPartIdx), alphaValue, (sizeof( Char) * uiCoveredPartIdxes));2562 Void TComDataCU::setCrossComponentPredictionAlphaPartRange( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ) 2563 { 2564 memset((m_crossComponentPredictionAlpha[compID] + uiAbsPartIdx), alphaValue, (sizeof(SChar) * uiCoveredPartIdxes)); 2566 2565 } 2567 2566 … … 2579 2578 } 2580 2579 2581 UChar TComDataCU::getNumPartitions(const UInt uiAbsPartIdx) 2580 UChar TComDataCU::getNumPartitions(const UInt uiAbsPartIdx) const 2582 2581 { 2583 2582 UChar iNumPart = 0; … … 2601 2600 // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx 2602 2601 #if NH_3D_IC || NH_3D_VSP 2603 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) 2602 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) const 2604 2603 { 2605 2604 UInt uiNumPartition = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition; … … 2645 2644 #else 2646 2645 2647 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) 2646 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const 2648 2647 { 2649 2648 switch ( m_pePartSize[0] ) … … 2686 2685 #endif 2687 2686 2688 2689 Void TComDataCU::getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField )2687 // static member function 2688 Void TComDataCU::getMvField ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ) 2690 2689 { 2691 2690 if ( pcCU == NULL ) // OUT OF BOUNDARY … … 2696 2695 } 2697 2696 2698 TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList );2697 const TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList ); 2699 2698 rcMvField.setMvField( pcCUMvField->getMv( uiAbsPartIdx ), pcCUMvField->getRefIdx( uiAbsPartIdx ) ); 2700 2699 } 2701 2700 2702 Void TComDataCU::deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) 2701 Void TComDataCU::deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const 2703 2702 { 2704 2703 ruiPartIdxLT = m_absZIdxInCtu + uiAbsPartIdx; … … 2749 2748 } 2750 2749 2751 Void TComDataCU::deriveLeftBottomIdxGeneral( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) 2750 Void TComDataCU::deriveLeftBottomIdxGeneral( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const 2752 2751 { 2753 2752 UInt uiPUHeight = 0; … … 2796 2795 } 2797 2796 2798 Void TComDataCU::deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) 2797 Void TComDataCU::deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const 2799 2798 { 2800 2799 ruiPartIdxLT = m_absZIdxInCtu; … … 2836 2835 } 2837 2836 2838 Void TComDataCU::deriveLeftBottomIdx( UInt uiPartIdx, UInt& ruiPartIdxLB ) 2837 Void TComDataCU::deriveLeftBottomIdx( UInt uiPartIdx, UInt& ruiPartIdxLB ) const 2839 2838 { 2840 2839 ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_absZIdxInCtu ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInCtuWidth()]; … … 2876 2875 * \param [out] ruiPartIdxRB partition index of neighbouring bottom right block 2877 2876 */ 2878 Void TComDataCU::deriveRightBottomIdx( UInt uiPartIdx, UInt &ruiPartIdxRB ) 2877 Void TComDataCU::deriveRightBottomIdx( UInt uiPartIdx, UInt &ruiPartIdxRB ) const 2879 2878 { 2880 2879 ruiPartIdxRB = g_auiRasterToZscan [g_auiZscanToRaster[ m_absZIdxInCtu ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInCtuWidth() + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1]; … … 2912 2911 } 2913 2912 2914 Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx )2913 Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const 2915 2914 { 2916 2915 if ( getInterDir( uiAbsPartIdx ) != pcCandCU->getInterDir( uiCandAbsPartIdx ) ) … … 3306 3305 //left 3307 3306 UInt uiLeftPartIdx = 0; 3308 TComDataCU* pcCULeft = 0;3307 const TComDataCU* pcCULeft = 0; 3309 3308 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3310 3309 … … 3783 3782 3784 3783 //! Construct a list of merging candidates 3784 #if NH_3D 3785 3785 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) 3786 #else 3787 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) const 3788 #endif 3786 3789 { 3787 3790 UInt uiAbsPartAddr = m_absZIdxInCtu + uiAbsPartIdx; … … 3811 3814 //left 3812 3815 UInt uiLeftPartIdx = 0; 3813 TComDataCU* pcCULeft = 0; 3814 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3816 const TComDataCU *pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3815 3817 3816 3818 Bool isAvailableA1 = pcCULeft && … … 3828 3830 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 3829 3831 // get Mv from Left 3830 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3832 TComDataCU::getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3831 3833 if ( getSlice()->isInterB() ) 3832 3834 { 3833 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3835 TComDataCU::getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3834 3836 } 3835 3837 if ( mrgCandIdx == iCount ) … … 3847 3849 // above 3848 3850 UInt uiAbovePartIdx = 0; 3849 TComDataCU* pcCUAbove = 0; 3850 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 3851 const TComDataCU *pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 3851 3852 3852 3853 Bool isAvailableB1 = pcCUAbove && … … 3864 3865 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 3865 3866 // get Mv from Left 3866 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3867 TComDataCU::getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3867 3868 if ( getSlice()->isInterB() ) 3868 3869 { 3869 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3870 TComDataCU::getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3870 3871 } 3871 3872 if ( mrgCandIdx == iCount ) … … 3883 3884 // above right 3884 3885 UInt uiAboveRightPartIdx = 0; 3885 TComDataCU* pcCUAboveRight = 0; 3886 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 3886 const TComDataCU *pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 3887 3887 3888 3888 Bool isAvailableB0 = pcCUAboveRight && … … 3899 3899 puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); 3900 3900 // get Mv from Left 3901 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3901 TComDataCU::getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3902 3902 if ( getSlice()->isInterB() ) 3903 3903 { 3904 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3904 TComDataCU::getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3905 3905 } 3906 3906 if ( mrgCandIdx == iCount ) … … 3918 3918 //left bottom 3919 3919 UInt uiLeftBottomPartIdx = 0; 3920 TComDataCU* pcCULeftBottom = 0; 3921 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 3920 const TComDataCU *pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 3922 3921 3923 3922 Bool isAvailableA0 = pcCULeftBottom && … … 3934 3933 puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); 3935 3934 // get Mv from Left 3936 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3935 TComDataCU::getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3937 3936 if ( getSlice()->isInterB() ) 3938 3937 { 3939 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3938 TComDataCU::getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3940 3939 } 3941 3940 if ( mrgCandIdx == iCount ) … … 3955 3954 { 3956 3955 UInt uiAboveLeftPartIdx = 0; 3957 TComDataCU* pcCUAboveLeft = 0; 3958 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 3956 const TComDataCU *pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 3959 3957 3960 3958 Bool isAvailableB2 = pcCUAboveLeft && … … 3972 3970 puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); 3973 3971 // get Mv from Left 3974 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3972 TComDataCU::getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3975 3973 if ( getSlice()->isInterB() ) 3976 3974 { 3977 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3975 TComDataCU::getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3978 3976 } 3979 3977 if ( mrgCandIdx == iCount ) … … 4166 4164 * \param xP, yP location of the upper-left corner pixel of the current PU 4167 4165 */ 4168 Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) 4166 Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) const 4169 4167 { 4170 4168 … … 4186 4184 * \param nPSW, nPSH size of the current PU 4187 4185 */ 4188 Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) 4186 Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) const 4189 4187 { 4190 4188 UInt col = m_uiCUPelX; … … 4247 4245 } 4248 4246 4249 /** Constructs a list of candidates for AMVP 4247 /** Constructs a list of candidates for AMVP (See specification, section "Derivation process for motion vector predictor candidates") 4250 4248 * \param uiPartIdx 4251 4249 * \param uiPartAddr … … 4254 4252 * \param pInfo 4255 4253 */ 4256 Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ) 4257 { 4258 TComMv cMvPred; 4259 Bool bAddedSmvp = false; 4260 4254 Void TComDataCU::fillMvpCand ( const UInt partIdx, const UInt partAddr, const RefPicList eRefPicList, const Int refIdx, AMVPInfo* pInfo ) const 4255 { 4261 4256 pInfo->iN = 0; 4262 if ( iRefIdx < 0)4257 if (refIdx < 0) 4263 4258 { 4264 4259 return; … … 4266 4261 4267 4262 //-- Get Spatial MV 4268 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 4269 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); 4270 const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight(); 4271 Bool bAdded = false; 4272 4273 deriveLeftRightTopIdx( uiPartIdx, uiPartIdxLT, uiPartIdxRT ); 4274 deriveLeftBottomIdx( uiPartIdx, uiPartIdxLB ); 4275 4276 TComDataCU* tmpCU = NULL; 4277 UInt idx; 4278 tmpCU = getPUBelowLeft(idx, uiPartIdxLB); 4279 bAddedSmvp = (tmpCU != NULL) && (tmpCU->isInter(idx)); 4280 4281 if (!bAddedSmvp) 4282 { 4283 tmpCU = getPULeft(idx, uiPartIdxLB); 4284 bAddedSmvp = (tmpCU != NULL) && (tmpCU->isInter(idx)); 4263 UInt partIdxLT, partIdxRT, partIdxLB; 4264 deriveLeftRightTopIdx( partIdx, partIdxLT, partIdxRT ); 4265 deriveLeftBottomIdx( partIdx, partIdxLB ); 4266 4267 Bool isScaledFlagLX = false; /// variable name from specification; true when the PUs below left or left are available (availableA0 || availableA1). 4268 { 4269 UInt idx; 4270 const TComDataCU* tmpCU = getPUBelowLeft(idx, partIdxLB); 4271 isScaledFlagLX = (tmpCU != NULL) && (tmpCU->isInter(idx)); 4272 if (!isScaledFlagLX) 4273 { 4274 tmpCU = getPULeft(idx, partIdxLB); 4275 isScaledFlagLX = (tmpCU != NULL) && (tmpCU->isInter(idx)); 4276 } 4285 4277 } 4286 4278 4287 4279 // Left predictor search 4288 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); 4289 if (!bAdded) 4290 { 4291 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); 4292 } 4293 4294 if(!bAdded) 4295 { 4296 bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); 4280 if (isScaledFlagLX) 4281 { 4282 Bool bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLB, MD_BELOW_LEFT); 4297 4283 if (!bAdded) 4298 4284 { 4299 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); 4285 bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLB, MD_LEFT ); 4286 if(!bAdded) 4287 { 4288 bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLB, MD_BELOW_LEFT); 4289 if (!bAdded) 4290 { 4291 xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLB, MD_LEFT ); 4292 } 4293 } 4300 4294 } 4301 4295 } 4302 4296 4303 4297 // Above predictor search 4304 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); 4305 4306 if (!bAdded) 4307 { 4308 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); 4309 } 4310 4311 if(!bAdded) 4312 { 4313 xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 4314 } 4315 4316 if(!bAddedSmvp) 4317 { 4318 bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); 4298 { 4299 Bool bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE_RIGHT); 4319 4300 if (!bAdded) 4320 4301 { 4321 bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); 4322 } 4323 4324 if(!bAdded) 4325 { 4326 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 4302 bAdded = xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE); 4303 if(!bAdded) 4304 { 4305 xAddMVPCandUnscaled( *pInfo, eRefPicList, refIdx, partIdxLT, MD_ABOVE_LEFT); 4306 } 4307 } 4308 } 4309 4310 if(!isScaledFlagLX) 4311 { 4312 Bool bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE_RIGHT); 4313 if (!bAdded) 4314 { 4315 bAdded = xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxRT, MD_ABOVE); 4316 if(!bAdded) 4317 { 4318 xAddMVPCandWithScaling( *pInfo, eRefPicList, refIdx, partIdxLT, MD_ABOVE_LEFT); 4319 } 4327 4320 } 4328 4321 } … … 4336 4329 } 4337 4330 4338 if ( getSlice()->getEnableTMVPFlag() )4331 if (pInfo->iN < AMVP_MAX_NUM_CANDS && getSlice()->getEnableTMVPFlag() ) 4339 4332 { 4340 4333 // Get Temporal Motion Predictor 4341 Int iRefIdx_Col = iRefIdx; 4334 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); 4335 const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight(); 4336 #if NH_3D_TMVP 4337 Int refIdx_Col = refIdx; 4338 #else 4339 const Int refIdx_Col = refIdx; 4340 #endif 4342 4341 TComMv cColMv; 4343 UInt uiPartIdxRB; 4344 UInt uiAbsPartIdx; 4345 UInt uiAbsPartAddr; 4346 4347 deriveRightBottomIdx( uiPartIdx, uiPartIdxRB ); 4348 uiAbsPartAddr = m_absZIdxInCtu + uiPartAddr; 4342 UInt partIdxRB; 4343 UInt absPartIdx; 4344 4345 deriveRightBottomIdx( partIdx, partIdxRB ); 4346 UInt absPartAddr = m_absZIdxInCtu + partAddr; 4349 4347 4350 4348 //---- co-located RightBottom Temporal Predictor (H) ---// 4351 uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB];4349 absPartIdx = g_auiZscanToRaster[partIdxRB]; 4352 4350 Int ctuRsAddr = -1; 4353 if ( ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[ uiAbsPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () ) // image boundary check4354 && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )4355 { 4356 if ( ( uiAbsPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) && // is not at the last column of CTU4357 ( uiAbsPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) ) // is not at the last row of CTU4358 { 4359 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + numPartInCtuWidth + 1 ];4351 if ( ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[absPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () ) // image boundary check 4352 && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[absPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 4353 { 4354 if ( ( absPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) && // is not at the last column of CTU 4355 ( absPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) ) // is not at the last row of CTU 4356 { 4357 absPartAddr = g_auiRasterToZscan[ absPartIdx + numPartInCtuWidth + 1 ]; 4360 4358 ctuRsAddr = getCtuRsAddr(); 4361 4359 } 4362 else if ( uiAbsPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) // is not at the last column of CTU But is last row of CTU4363 { 4364 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ];4365 } 4366 else if ( uiAbsPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) // is not at the last row of CTU But is last column of CTU4367 { 4368 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + 1 ];4360 else if ( absPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) // is not at the last column of CTU But is last row of CTU 4361 { 4362 absPartAddr = g_auiRasterToZscan[ (absPartIdx + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ]; 4363 } 4364 else if ( absPartIdx / numPartInCtuWidth < numPartInCtuHeight - 1 ) // is not at the last row of CTU But is last column of CTU 4365 { 4366 absPartAddr = g_auiRasterToZscan[ absPartIdx + 1 ]; 4369 4367 ctuRsAddr = getCtuRsAddr() + 1; 4370 4368 } 4371 4369 else //is the right bottom corner of CTU 4372 4370 { 4373 uiAbsPartAddr = 0;4374 } 4375 } 4376 if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx_Col4371 absPartAddr = 0; 4372 } 4373 } 4374 if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, absPartAddr, cColMv, refIdx_Col 4377 4375 #if NH_3D_TMVP 4378 4379 #endif 4380 ) )4376 , 0 4377 #endif 4378 ) ) 4381 4379 { 4382 4380 pInfo->m_acMvCand[pInfo->iN++] = cColMv; … … 4385 4383 { 4386 4384 UInt uiPartIdxCenter; 4387 xDeriveCenterIdx( uiPartIdx, uiPartIdxCenter );4388 if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter, cColMv, iRefIdx_Col4385 xDeriveCenterIdx( partIdx, uiPartIdxCenter ); 4386 if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter, cColMv, refIdx_Col 4389 4387 #if NH_3D_TMVP 4390 4391 #endif 4392 ))4388 , 0 4389 #endif 4390 )) 4393 4391 { 4394 4392 pInfo->m_acMvCand[pInfo->iN++] = cColMv; … … 4396 4394 } 4397 4395 //---- co-located RightBottom Temporal Predictor ---// 4398 }4399 4400 if (pInfo->iN > AMVP_MAX_NUM_CANDS)4401 {4402 pInfo->iN = AMVP_MAX_NUM_CANDS;4403 4396 } 4404 4397 … … 4412 4405 4413 4406 4414 Bool TComDataCU::isBipredRestriction(UInt puIdx) 4407 Bool TComDataCU::isBipredRestriction(UInt puIdx) const 4415 4408 { 4416 4409 Int width = 0; … … 4434 4427 4435 4428 4436 Void TComDataCU::clipMv (TComMv& rcMv) 4429 Void TComDataCU::clipMv (TComMv& rcMv) const 4437 4430 { 4438 4431 const TComSPS &sps=*(m_pcSlice->getSPS()); … … 4470 4463 #endif 4471 4464 4472 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) 4465 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) const 4473 4466 { 4474 4467 UInt uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); … … 4507 4500 * \returns true if the current the block is skipped 4508 4501 */ 4509 Bool TComDataCU::isSkipped( UInt uiPartIdx ) 4502 Bool TComDataCU::isSkipped( UInt uiPartIdx ) const 4510 4503 { 4511 4504 return ( getSkipFlag( uiPartIdx ) ); … … 4516 4509 // ==================================================================================================================== 4517 4510 4518 Bool TComDataCU::xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir )4519 { 4520 TComDataCU* pcTmpCU = NULL;4521 UInt uiIdx;4511 Bool TComDataCU::xAddMVPCandUnscaled( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const 4512 { 4513 const TComDataCU* neibCU = NULL; 4514 UInt neibPUPartIdx; 4522 4515 switch( eDir ) 4523 4516 { 4524 4517 case MD_LEFT: 4525 4518 { 4526 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);4519 neibCU = getPULeft(neibPUPartIdx, uiPartUnitIdx); 4527 4520 break; 4528 4521 } 4529 4522 case MD_ABOVE: 4530 4523 { 4531 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx);4524 neibCU = getPUAbove(neibPUPartIdx, uiPartUnitIdx); 4532 4525 break; 4533 4526 } 4534 4527 case MD_ABOVE_RIGHT: 4535 4528 { 4536 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx);4529 neibCU = getPUAboveRight(neibPUPartIdx, uiPartUnitIdx); 4537 4530 break; 4538 4531 } 4539 4532 case MD_BELOW_LEFT: 4540 4533 { 4541 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);4534 neibCU = getPUBelowLeft(neibPUPartIdx, uiPartUnitIdx); 4542 4535 break; 4543 4536 } 4544 4537 case MD_ABOVE_LEFT: 4545 4538 { 4546 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx);4539 neibCU = getPUAboveLeft(neibPUPartIdx, uiPartUnitIdx); 4547 4540 break; 4548 4541 } … … 4553 4546 } 4554 4547 4555 if ( pcTmpCU == NULL )4548 if ( neibCU == NULL ) 4556 4549 { 4557 4550 return false; 4558 4551 } 4559 4552 4560 if ( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC() == pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) )) 4561 { 4562 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 4563 4564 pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; 4565 return true; 4566 } 4567 4568 RefPicList eRefPicList2nd = REF_PIC_LIST_0; 4569 if( eRefPicList == REF_PIC_LIST_0 ) 4570 { 4571 eRefPicList2nd = REF_PIC_LIST_1; 4572 } 4573 else if ( eRefPicList == REF_PIC_LIST_1) 4574 { 4575 eRefPicList2nd = REF_PIC_LIST_0; 4576 } 4577 4578 4579 Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 4580 Int iNeibRefPOC; 4581 4582 4583 if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0 ) 4584 { 4585 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); 4586 if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List// 4587 { 4588 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); 4589 pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; 4553 const Int currRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 4554 const RefPicList eRefPicList2nd = (eRefPicList == REF_PIC_LIST_0) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 4555 4556 for(Int predictorSource=0; predictorSource<2; predictorSource++) // examine the indicated reference picture list, then if not available, examine the other list. 4557 { 4558 const RefPicList eRefPicListIndex = (predictorSource==0) ? eRefPicList : eRefPicList2nd; 4559 const Int neibRefIdx = neibCU->getCUMvField(eRefPicListIndex)->getRefIdx(neibPUPartIdx); 4560 4561 if ( neibRefIdx >= 0 && currRefPOC == neibCU->getSlice()->getRefPOC( eRefPicListIndex, neibRefIdx )) 4562 { 4563 info.m_acMvCand[info.iN++] = neibCU->getCUMvField(eRefPicListIndex)->getMv(neibPUPartIdx); 4590 4564 return true; 4591 4565 } … … 4602 4576 * \returns Bool 4603 4577 */ 4604 Bool TComDataCU::xAddMVPCand Order( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir )4605 { 4606 TComDataCU* pcTmpCU = NULL;4607 UInt uiIdx;4578 Bool TComDataCU::xAddMVPCandWithScaling( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const 4579 { 4580 const TComDataCU* neibCU = NULL; 4581 UInt neibPUPartIdx; 4608 4582 switch( eDir ) 4609 4583 { 4610 4584 case MD_LEFT: 4611 4585 { 4612 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);4586 neibCU = getPULeft(neibPUPartIdx, uiPartUnitIdx); 4613 4587 break; 4614 4588 } 4615 4589 case MD_ABOVE: 4616 4590 { 4617 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx);4591 neibCU = getPUAbove(neibPUPartIdx, uiPartUnitIdx); 4618 4592 break; 4619 4593 } 4620 4594 case MD_ABOVE_RIGHT: 4621 4595 { 4622 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx);4596 neibCU = getPUAboveRight(neibPUPartIdx, uiPartUnitIdx); 4623 4597 break; 4624 4598 } 4625 4599 case MD_BELOW_LEFT: 4626 4600 { 4627 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);4601 neibCU = getPUBelowLeft(neibPUPartIdx, uiPartUnitIdx); 4628 4602 break; 4629 4603 } 4630 4604 case MD_ABOVE_LEFT: 4631 4605 { 4632 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx);4606 neibCU = getPUAboveLeft(neibPUPartIdx, uiPartUnitIdx); 4633 4607 break; 4634 4608 } … … 4639 4613 } 4640 4614 4641 if ( pcTmpCU == NULL )4615 if ( neibCU == NULL ) 4642 4616 { 4643 4617 return false; 4644 4618 } 4645 4619 4646 RefPicList eRefPicList2nd = REF_PIC_LIST_0; 4647 if( eRefPicList == REF_PIC_LIST_0 ) 4648 { 4649 eRefPicList2nd = REF_PIC_LIST_1; 4650 } 4651 else if ( eRefPicList == REF_PIC_LIST_1) 4652 { 4653 eRefPicList2nd = REF_PIC_LIST_0; 4654 } 4655 4656 Int iCurrPOC = m_pcSlice->getPOC(); 4657 Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 4658 Int iNeibPOC = iCurrPOC; 4659 Int iNeibRefPOC; 4660 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm(); 4661 Bool bIsNeibRefLongTerm = false; 4662 4663 //--------------- V1 (END) ------------------// 4664 if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0) 4665 { 4666 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ); 4667 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 4668 TComMv rcMv; 4669 4670 bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) )->getIsLongTerm(); 4671 if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm ) 4672 { 4673 if ( bIsCurrRefLongTerm || bIsNeibRefLongTerm ) 4674 { 4675 rcMv = cMvPred; 4676 } 4677 else 4678 { 4679 Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 4680 if ( iScale == 4096 ) 4620 const RefPicList eRefPicList2nd = (eRefPicList == REF_PIC_LIST_0) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 4621 4622 const Int currPOC = m_pcSlice->getPOC(); 4623 const Int currRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); 4624 const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm(); 4625 const Int neibPOC = currPOC; 4626 4627 for(Int predictorSource=0; predictorSource<2; predictorSource++) // examine the indicated reference picture list, then if not available, examine the other list. 4628 { 4629 const RefPicList eRefPicListIndex = (predictorSource==0) ? eRefPicList : eRefPicList2nd; 4630 const Int neibRefIdx = neibCU->getCUMvField(eRefPicListIndex)->getRefIdx(neibPUPartIdx); 4631 if( neibRefIdx >= 0) 4632 { 4633 const Bool bIsNeibRefLongTerm = neibCU->getSlice()->getRefPic( eRefPicListIndex, neibRefIdx )->getIsLongTerm(); 4634 4635 if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm ) 4636 { 4637 const TComMv &cMvPred = neibCU->getCUMvField(eRefPicListIndex)->getMv(neibPUPartIdx); 4638 TComMv rcMv; 4639 if ( bIsCurrRefLongTerm /* || bIsNeibRefLongTerm*/ ) 4681 4640 { 4682 4641 rcMv = cMvPred; … … 4684 4643 else 4685 4644 { 4686 rcMv = cMvPred.scaleMv( iScale ); 4645 const Int neibRefPOC = neibCU->getSlice()->getRefPOC( eRefPicListIndex, neibRefIdx ); 4646 const Int scale = xGetDistScaleFactor( currPOC, currRefPOC, neibPOC, neibRefPOC ); 4647 if ( scale == 4096 ) 4648 { 4649 rcMv = cMvPred; 4650 } 4651 else 4652 { 4653 rcMv = cMvPred.scaleMv( scale ); 4654 } 4687 4655 } 4688 } 4689 4690 pInfo->m_acMvCand[ pInfo->iN++] = rcMv; 4691 return true; 4692 } 4693 } 4694 //---------------------- V2(END) --------------------// 4695 if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0) 4696 { 4697 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); 4698 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); 4699 TComMv rcMv; 4700 4701 bIsNeibRefLongTerm = pcTmpCU->getSlice()->getRefPic( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) )->getIsLongTerm(); 4702 if ( bIsCurrRefLongTerm == bIsNeibRefLongTerm ) 4703 { 4704 if ( bIsCurrRefLongTerm || bIsNeibRefLongTerm ) 4705 { 4706 rcMv = cMvPred; 4707 } 4708 else 4709 { 4710 Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 4711 if ( iScale == 4096 ) 4712 { 4713 rcMv = cMvPred; 4714 } 4715 else 4716 { 4717 rcMv = cMvPred.scaleMv( iScale ); 4718 } 4719 } 4720 4721 pInfo->m_acMvCand[ pInfo->iN++] = rcMv; 4722 return true; 4723 } 4724 } 4725 //---------------------- V3(END) --------------------// 4656 4657 info.m_acMvCand[info.iN++] = rcMv; 4658 return true; 4659 } 4660 } 4661 } 4726 4662 return false; 4727 4663 } 4728 4664 4729 Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx4730 4665 #if NH_3D_TMVP 4731 , Bool bMRG 4732 #endif 4733 ) 4734 { 4735 UInt uiAbsPartAddr = uiPartUnitIdx; 4736 4737 RefPicList eColRefPicList; 4738 Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale; 4739 TComMv cColMv; 4666 Bool TComDataCU::xGetColMVP( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG ) const 4667 #else 4668 Bool TComDataCU::xGetColMVP( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const 4669 #endif 4670 { 4671 const UInt absPartAddr = partUnitIdx; 4740 4672 4741 4673 // use coldir. 4742 TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());4743 TComDataCU *pColCtu = pColPic->getCtu( ctuRsAddr );4744 if(pColCtu->getPic()==0 ||pColCtu->getPartitionSize(uiPartUnitIdx)==NUMBER_OF_PART_SIZES)4674 const TComPic * const pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx()); 4675 const TComDataCU * const pColCtu = pColPic->getCtu( ctuRsAddr ); 4676 if(pColCtu->getPic()==0 || pColCtu->getPartitionSize(partUnitIdx)==NUMBER_OF_PART_SIZES) 4745 4677 { 4746 4678 return false; 4747 4679 } 4748 iCurrPOC = m_pcSlice->getPOC(); 4749 iColPOC = pColCtu->getSlice()->getPOC(); 4750 4751 if (!pColCtu->isInter(uiAbsPartAddr)) 4680 4681 if (!pColCtu->isInter(absPartAddr)) 4752 4682 { 4753 4683 return false; 4754 4684 } 4755 4685 4756 eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag()); 4757 4758 Int iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); 4686 RefPicList eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag()); 4687 Int iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr); 4759 4688 4760 4689 if (iColRefIdx < 0 ) 4761 4690 { 4762 4691 eColRefPicList = RefPicList(1 - eColRefPicList); 4763 iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx( uiAbsPartAddr);4692 iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr); 4764 4693 4765 4694 if (iColRefIdx < 0 ) … … 4769 4698 } 4770 4699 4771 // Scale the vector. 4772 iColRefPOC = pColCtu->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); 4773 cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr); 4774 4775 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); 4776 4777 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm(); 4778 Bool bIsColRefLongTerm = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx); 4700 #if NH_3D_TMVP 4701 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm(); 4702 #else 4703 const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm(); 4704 #endif 4705 const Bool bIsColRefLongTerm = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx); 4779 4706 4780 4707 if ( bIsCurrRefLongTerm != bIsColRefLongTerm ) … … 4784 4711 if(bMRG && iAlterRefIdx > 0) 4785 4712 { 4786 riRefIdx = iAlterRefIdx; 4787 bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm(); 4788 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); 4713 refIdx = iAlterRefIdx; 4714 bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm(); 4789 4715 assert(bIsCurrRefLongTerm == bIsColRefLongTerm); 4790 4716 } … … 4792 4718 { 4793 4719 #endif 4794 return false;4720 return false; 4795 4721 #if NH_3D_TMVP 4796 4722 } 4797 4723 #endif 4798 4724 } 4799 4725 // Scale the vector. 4726 const TComMv &cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(absPartAddr); 4727 4728 #if NH_3D_TMVP 4800 4729 if ( bIsCurrRefLongTerm || bIsColRefLongTerm ) 4730 #else 4731 if ( bIsCurrRefLongTerm /*|| bIsColRefLongTerm*/ ) 4732 #endif 4801 4733 { 4802 4734 #if NH_3D_TMVP 4803 Int iCurrViewId = m_pcSlice->getViewId ();4804 Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId ();4805 Int iColViewId = pColCtu->getSlice()->getViewId();4806 Int iColRefViewId = pColCtu->getSlice()->getRefPic( eColRefPicList, pColCtu->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewId();4807 iScale = 4096;4735 const Int iCurrViewId = m_pcSlice->getViewId (); 4736 const Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, refIdx)->getViewId (); 4737 const Int iColViewId = pColCtu->getSlice()->getViewId(); 4738 const Int iColRefViewId = pColCtu->getSlice()->getRefPic( eColRefPicList, pColCtu->getCUMvField(eColRefPicList)->getRefIdx(absPartAddr))->getViewId(); 4739 Int scale = 4096; 4808 4740 if ( iCurrRefViewId != iCurrViewId && iColViewId != iColRefViewId ) 4809 4741 { 4810 iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );4811 } 4812 if ( bMRG && iScale != 4096 && m_pcSlice->getIvMvScalingFlag( ) )4813 { 4814 rcMv = cColMv.scaleMv( iScale );4742 scale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId ); 4743 } 4744 if ( bMRG && scale != 4096 && m_pcSlice->getIvMvScalingFlag( ) ) 4745 { 4746 rcMv = cColMv.scaleMv( scale ); 4815 4747 } 4816 4748 else 4817 4749 { 4818 4750 #endif 4819 rcMv = cColMv;4751 rcMv = cColMv; 4820 4752 #if NH_3D_TMVP 4821 4753 } … … 4824 4756 else 4825 4757 { 4826 iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); 4827 if ( iScale == 4096 ) 4758 const Int currPOC = m_pcSlice->getPOC(); 4759 const Int colPOC = pColCtu->getSlice()->getPOC(); 4760 const Int colRefPOC = pColCtu->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); 4761 const Int currRefPOC = m_pcSlice->getRefPic(eRefPicList, refIdx)->getPOC(); 4762 const Int scale = xGetDistScaleFactor(currPOC, currRefPOC, colPOC, colRefPOC); 4763 if ( scale == 4096 ) 4828 4764 { 4829 4765 rcMv = cColMv; … … 4831 4767 else 4832 4768 { 4833 rcMv = cColMv.scaleMv( iScale );4769 rcMv = cColMv.scaleMv( scale ); 4834 4770 } 4835 4771 } … … 4838 4774 } 4839 4775 4776 // Static member 4840 4777 Int TComDataCU::xGetDistScaleFactor(Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC) 4841 4778 { … … 4857 4794 } 4858 4795 4859 Void TComDataCU::xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ) 4796 Void TComDataCU::xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const 4860 4797 { 4861 4798 UInt uiPartAddr; … … 5001 4938 5002 4939 UInt uiMidPart, uiPartNeighbor; 5003 TComDataCU* pcCUNeighbor;4940 const TComDataCU* pcCUNeighbor; 5004 4941 Bool bDepAvail = false; 5005 4942 Pel *pDepth = this->getPic()->getPicYuvRec()->getAddr(COMPONENT_Y); … … 5161 5098 UInt uiIdx = 0; 5162 5099 Bool bCheckMcpDv = false; 5163 TComDataCU* pcTmpCU = NULL;5100 const TComDataCU* pcTmpCU = NULL; 5164 5101 5165 5102 //// ******* Get disparity from left block ******* ///// … … 5307 5244 5308 5245 5309 Bool TComDataCU::xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paIDVInfo, UInt uiMvpDvPos5246 Bool TComDataCU::xCheckSpatialNBDV( const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paIDVInfo, UInt uiMvpDvPos 5310 5247 #if NH_3D_NBDV_REF 5311 5248 , Bool bDepthRefine -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComDataCU.h
r1321 r1360 112 112 UChar* m_ucDISType; 113 113 #endif 114 Char* m_pePartSize; ///< array of partition sizes115 Char* m_pePredMode;///< array of prediction modes116 Char*m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values114 SChar* m_pePartSize; ///< array of partition sizes 115 SChar* m_pePredMode; ///< array of prediction modes 116 SChar* m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values 117 117 Bool* m_CUTransquantBypass; ///< array of cu_transquant_bypass flags 118 Char* m_phQP;///< array of QP values118 SChar* m_phQP; ///< array of QP values 119 119 UChar* m_ChromaQpAdj; ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 120 120 UInt m_codedChromaQpAdj; … … 125 125 TCoeff* m_pcTrCoeff[MAX_NUM_COMPONENT]; ///< array of transform coefficient buffers (0->Y, 1->Cb, 2->Cr) 126 126 #if ADAPTIVE_QP_SELECTION 127 TCoeff* m_pcArlCoeff[MAX_NUM_COMPONENT]; //ARL coefficient buffer (0->Y, 1->Cb, 2->Cr)127 TCoeff* m_pcArlCoeff[MAX_NUM_COMPONENT]; ///< ARL coefficient buffer (0->Y, 1->Cb, 2->Cr) 128 128 Bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d 129 129 #endif … … 154 154 Bool m_bIsMergeAMP; 155 155 #endif 156 UChar* m_puhIntraDir[MAX_NUM_CHANNEL_TYPE]; // 0-> Luma, 1-> Chroma156 UChar* m_puhIntraDir[MAX_NUM_CHANNEL_TYPE]; 157 157 UChar* m_puhInterDir; ///< array of inter directions 158 Char*m_apiMVPIdx[NUM_REF_PIC_LIST_01]; ///< array of motion vector predictor candidates159 Char*m_apiMVPNum[NUM_REF_PIC_LIST_01]; ///< array of number of possible motion vectors predictors158 SChar* m_apiMVPIdx[NUM_REF_PIC_LIST_01]; ///< array of motion vector predictor candidates 159 SChar* m_apiMVPNum[NUM_REF_PIC_LIST_01]; ///< array of number of possible motion vectors predictors 160 160 Bool* m_pbIPCMFlag; ///< array of intra_pcm flags 161 161 #if NH_3D_NBDV … … 163 163 #endif 164 164 #if NH_3D_VSP 165 Char*m_piVSPFlag; ///< array of VSP flags to indicate whehter a block uses VSP or not ///< 0: non-VSP; 1: VSP165 SChar* m_piVSPFlag; ///< array of VSP flags to indicate whehter a block uses VSP or not ///< 0: non-VSP; 1: VSP 166 166 #endif 167 167 #if NH_3D_SPIVMP … … 208 208 UInt m_uiTotalBits; ///< sum of partition bits 209 209 UInt m_uiTotalBins; ///< sum of partition bins 210 Charm_codedQP;210 SChar m_codedQP; 211 211 #if NH_3D_MLC 212 212 DisInfo m_cDefaultDisInfo; ///< Default disparity information for initializing … … 219 219 protected: 220 220 221 /// add possible motion vector predictor candidates 222 Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); 223 Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); 221 /// adds a single possible motion vector predictor candidate 222 Bool xAddMVPCandUnscaled ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; 223 Bool xAddMVPCandWithScaling ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; 224 224 225 #if NH_3D_VSP 225 226 Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount); … … 229 230 #endif 230 231 231 Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB );232 Bool xGetColMVP( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx 232 Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ) const; 233 233 234 #if NH_3D_TMVP 234 , Bool bMRG = true235 #e ndif236 );237 235 Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG = true ) const; 236 #else 237 Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const; 238 #endif 238 239 239 240 /// compute scaling factor from POC difference 241 240 242 #if !NH_3D_ARP 241 Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); 242 #endif 243 244 Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ); 243 static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); 244 #endif 245 Void xDeriveCenterIdx ( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const; 245 246 246 247 #if NH_3D_VSP … … 249 250 250 251 public: 252 253 #if NH_3D_ARP 254 static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); 255 #endif 256 251 257 TComDataCU(); 252 258 virtual ~TComDataCU(); … … 255 261 // create / destroy / initialize / copy 256 262 // ------------------------------------------------------------------------------------------------------------------- 257 #if NH_3D_ARP258 /// compute scaling factor from POC difference259 Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );260 #endif261 263 Void create ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize 262 264 #if ADAPTIVE_QP_SELECTION … … 315 317 // ------------------------------------------------------------------------------------------------------------------- 316 318 317 Char* getPartitionSize () { return m_pePartSize;}318 PartSize getPartitionSize ( UInt uiIdx ){ return static_cast<PartSize>( m_pePartSize[uiIdx] ); }319 SChar* getPartitionSize ( ) { return m_pePartSize; } 320 PartSize getPartitionSize ( UInt uiIdx ) const { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } 319 321 Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } 320 322 Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); … … 326 328 327 329 Bool* getSkipFlag () { return m_skipFlag; } 328 Bool getSkipFlag (UInt idx) { return m_skipFlag[idx];}330 Bool getSkipFlag ( UInt idx ) const { return m_skipFlag[idx]; } 329 331 Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } 330 332 Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); … … 340 342 Void setDISTypeSubParts ( UChar ucDISType, UInt uiAbsPartIdx, UInt uiDepth ); 341 343 #endif 342 Char* getPredictionMode () { return m_pePredMode;}343 PredMode getPredictionMode ( UInt uiIdx ){ return static_cast<PredMode>( m_pePredMode[uiIdx] ); }344 SChar* getPredictionMode ( ) { return m_pePredMode; } 345 PredMode getPredictionMode ( UInt uiIdx ) const { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } 344 346 Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } 345 347 Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); 346 348 347 349 #if NH_3D_DBBP 348 Bool* getDBBPFlag () { return m_pbDBBPFlag; }349 Bool getDBBPFlag ( UInt uiIdx ) { return m_pbDBBPFlag[uiIdx]; }350 Bool* getDBBPFlag () const { return m_pbDBBPFlag; } 351 Bool getDBBPFlag ( UInt uiIdx ) const { return m_pbDBBPFlag[uiIdx]; } 350 352 Void setDBBPFlag ( UInt uiIdx, Bool b ) { m_pbDBBPFlag[uiIdx] = b; } 351 353 Void setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); … … 353 355 #endif 354 356 355 Char* getCrossComponentPredictionAlpha( ComponentID compID ) { return m_crossComponentPredictionAlpha[compID];}356 Char getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID ) { return m_crossComponentPredictionAlpha[compID][uiIdx];}357 SChar* getCrossComponentPredictionAlpha( ComponentID compID ) { return m_crossComponentPredictionAlpha[compID]; } 358 SChar getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID ) { return m_crossComponentPredictionAlpha[compID][uiIdx]; } 357 359 358 360 Bool* getCUTransquantBypass () { return m_CUTransquantBypass; } 359 Bool getCUTransquantBypass ( UInt uiIdx ) { return m_CUTransquantBypass[uiIdx];}361 Bool getCUTransquantBypass ( UInt uiIdx ) const { return m_CUTransquantBypass[uiIdx]; } 360 362 361 363 UChar* getWidth () { return m_puhWidth; } 362 UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx];}364 UChar getWidth ( UInt uiIdx ) const { return m_puhWidth[uiIdx]; } 363 365 Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } 364 366 365 367 UChar* getHeight () { return m_puhHeight; } 366 UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx];}368 UChar getHeight ( UInt uiIdx ) const { return m_puhHeight[uiIdx]; } 367 369 Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } 368 370 369 371 Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); 370 372 371 Char* getQP () { return m_phQP;}372 Char getQP ( UInt uiIdx ) const { return m_phQP[uiIdx];}373 Void setQP ( UInt uiIdx, Char value ){ m_phQP[uiIdx] = value;}373 SChar* getQP ( ) { return m_phQP; } 374 SChar getQP ( UInt uiIdx ) const { return m_phQP[uiIdx]; } 375 Void setQP ( UInt uiIdx, SChar value ) { m_phQP[uiIdx] = value; } 374 376 Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); 375 Int getLastValidPartIdx ( Int iAbsPartIdx );376 Char getLastCodedQP ( UInt uiAbsPartIdx );377 Int getLastValidPartIdx ( Int iAbsPartIdx ) const; 378 SChar getLastCodedQP ( UInt uiAbsPartIdx ) const; 377 379 Void setQPSubCUs ( Int qp, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); 378 Void setCodedQP ( Char qp ) { m_codedQP = qp;}379 Char getCodedQP () { return m_codedQP;}380 Void setCodedQP ( SChar qp ) { m_codedQP = qp; } 381 SChar getCodedQP ( ) const { return m_codedQP; } 380 382 381 383 UChar* getChromaQpAdj () { return m_ChromaQpAdj; } ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 … … 383 385 Void setChromaQpAdj (Int idx, UChar val) { m_ChromaQpAdj[idx] = val; } ///< When val = 0, cu_chroma_qp_offset_flag=0; when val>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=val-1 384 386 Void setChromaQpAdjSubParts( UChar val, Int absPartIdx, Int depth ); 385 Void setCodedChromaQpAdj ( Char qp ) { m_codedChromaQpAdj = qp;}386 Char getCodedChromaQpAdj () { return m_codedChromaQpAdj;}387 388 Bool isLosslessCoded ( UInt absPartIdx );387 Void setCodedChromaQpAdj ( SChar qp ) { m_codedChromaQpAdj = qp; } 388 SChar getCodedChromaQpAdj ( ) const { return m_codedChromaQpAdj; } 389 390 Bool isLosslessCoded ( UInt absPartIdx ) const; 389 391 390 392 UChar* getTransformIdx () { return m_puhTrIdx; } 391 UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx];}393 UChar getTransformIdx ( UInt uiIdx ) const { return m_puhTrIdx[uiIdx]; } 392 394 Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); 393 395 394 396 UChar* getTransformSkip ( ComponentID compID ) { return m_puhTransformSkip[compID];} 395 UChar getTransformSkip ( UInt uiIdx, ComponentID compID) { return m_puhTransformSkip[compID][uiIdx];}397 UChar getTransformSkip ( UInt uiIdx, ComponentID compID ) const { return m_puhTransformSkip[compID][uiIdx]; } 396 398 Void setTransformSkipSubParts ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth); 397 399 Void setTransformSkipSubParts ( const UInt useTransformSkip[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); 398 400 399 401 UChar* getExplicitRdpcmMode ( ComponentID component ) { return m_explicitRdpcmMode[component]; } 400 UChar getExplicitRdpcmMode ( ComponentID component, UInt partIdx ) {return m_explicitRdpcmMode[component][partIdx]; }402 UChar getExplicitRdpcmMode ( ComponentID component, UInt partIdx ) const { return m_explicitRdpcmMode[component][partIdx]; } 401 403 Void setExplicitRdpcmModePartRange ( UInt rdpcmMode, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 402 404 403 Bool isRDPCMEnabled ( UInt uiAbsPartIdx ){ return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); }404 405 Void setCrossComponentPredictionAlphaPartRange (Char alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes );405 Bool isRDPCMEnabled ( UInt uiAbsPartIdx ) const { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); } 406 407 Void setCrossComponentPredictionAlphaPartRange ( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 406 408 Void setTransformSkipPartRange ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); 407 409 408 UInt getQuadtreeTULog2MinSizeInCU ( UInt uiIdx );410 UInt getQuadtreeTULog2MinSizeInCU ( UInt uiIdx ) const; 409 411 410 412 TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } 413 const TComCUMvField* getCUMvField ( RefPicList e ) const { return &m_acCUMvField[e]; } 411 414 412 415 TCoeff* getCoeff (ComponentID component) { return m_pcTrCoeff[component]; } … … 417 420 Pel* getPCMSample ( ComponentID component ) { return m_pcIPCMSample[component]; } 418 421 419 UChar getCbf ( UInt uiIdx, ComponentID eType ) { return m_puhCbf[eType][uiIdx];}422 UChar getCbf ( UInt uiIdx, ComponentID eType ) const { return m_puhCbf[eType][uiIdx]; } 420 423 UChar* getCbf ( ComponentID eType ) { return m_puhCbf[eType]; } 421 UChar getCbf ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ){ return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); }424 UChar getCbf ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ) const { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } 422 425 Void setCbf ( UInt uiIdx, ComponentID eType, UChar uh ) { m_puhCbf[eType][uiIdx] = uh; } 423 426 Void clearCbf ( UInt uiIdx, ComponentID eType, UInt uiNumParts ); 424 UChar getQtRootCbf ( UInt uiIdx );427 UChar getQtRootCbf ( UInt uiIdx ) const; 425 428 426 429 Void setCbfSubParts ( const UInt uiCbf[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); … … 436 439 437 440 Bool* getMergeFlag () { return m_pbMergeFlag; } 438 Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx];}441 Bool getMergeFlag ( UInt uiIdx ) const { return m_pbMergeFlag[uiIdx]; } 439 442 Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } 440 443 Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 441 444 442 445 UChar* getMergeIndex () { return m_puhMergeIndex; } 443 UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx];}446 UChar getMergeIndex ( UInt uiIdx ) const { return m_puhMergeIndex[uiIdx]; } 444 447 Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } 445 448 Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); … … 453 456 #if AMP_MRG 454 457 Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } 455 Bool getMergeAMP ( ) { return m_bIsMergeAMP;}458 Bool getMergeAMP ( ) const { return m_bIsMergeAMP; } 456 459 #endif 457 460 … … 465 468 466 469 UChar* getInterDir () { return m_puhInterDir; } 467 UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx];}470 UChar getInterDir ( UInt uiIdx ) const { return m_puhInterDir[uiIdx]; } 468 471 Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } 469 472 Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 470 473 Bool* getIPCMFlag () { return m_pbIPCMFlag; } 471 Bool getIPCMFlag (UInt uiIdx ) { return m_pbIPCMFlag[uiIdx];}474 Bool getIPCMFlag ( UInt uiIdx ) const { return m_pbIPCMFlag[uiIdx]; } 472 475 Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } 473 476 Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); … … 482 485 #if NH_3D_NBDV 483 486 Void xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb ); 484 Bool xCheckSpatialNBDV ( TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,487 Bool xCheckSpatialNBDV (const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo, 485 488 UInt uiMvpDvPos 486 489 #if NH_3D_NBDV_REF … … 525 528 #endif 526 529 #if NH_3D_ARP 527 UChar* getARPW () { return m_puhARPW; }528 UChar getARPW ( UInt uiIdx ) { return m_puhARPW[uiIdx]; }530 UChar* getARPW () const { return m_puhARPW; } 531 UChar getARPW ( UInt uiIdx ) const { return m_puhARPW[uiIdx]; } 529 532 Void setARPW ( UInt uiIdx, UChar w ) { m_puhARPW[uiIdx] = w; } 530 533 Void setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ); … … 536 539 Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 537 540 Bool isICFlagRequired ( UInt uiAbsPartIdx ); 538 Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) ;541 Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const; 539 542 #elif NH_3D_VSP 540 Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) ;543 Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const; 541 544 #else 542 545 // ------------------------------------------------------------------------------------------------------------------- … … 544 547 // ------------------------------------------------------------------------------------------------------------------- 545 548 546 Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx547 #endif 548 UChar getNumPartitions ( const UInt uiAbsPartIdx = 0 );549 Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth);549 Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const; // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx 550 #endif 551 UChar getNumPartitions ( const UInt uiAbsPartIdx = 0 ) const; 552 Bool isFirstAbsZorderIdxInDepth ( UInt uiAbsPartIdx, UInt uiDepth ) const; 550 553 551 554 #if NH_3D_DMM … … 575 578 // ------------------------------------------------------------------------------------------------------------------- 576 579 577 Void getMvField (TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );578 579 Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );580 Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP);581 Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);580 static Void getMvField ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); 581 582 Void fillMvpCand ( const UInt uiPartIdx, const UInt uiPartAddr, const RefPicList eRefPicList, const Int iRefIdx, AMVPInfo* pInfo ) const; 583 Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP ) const; 584 Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH ) const; 582 585 583 586 Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } 584 Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx];}585 Char* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList];}587 Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) const { return m_apiMVPIdx[eRefPicList][uiIdx]; } 588 SChar* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } 586 589 587 590 Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } 588 Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx];}589 Char* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList];}591 Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) const { return m_apiMVPNum[eRefPicList][uiIdx]; } 592 SChar* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } 590 593 591 594 Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 592 595 Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 593 596 594 Void clipMv ( TComMv& rcMv ); 597 Void clipMv ( TComMv& rcMv ) const; 598 595 599 #if NH_MV 596 600 Void checkMvVertRest (TComMv& rcMv, RefPicList eRefPicList, int iRefIdx ); 597 601 #endif 598 Void getMvPredLeft ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldA.getMv();}599 Void getMvPredAbove ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldB.getMv();}600 Void getMvPredAboveRight ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldC.getMv();}602 Void getMvPredLeft ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldA.getMv(); } 603 Void getMvPredAbove ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldB.getMv(); } 604 Void getMvPredAboveRight ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldC.getMv(); } 601 605 #if NH_3D 602 606 Void compressMV ( Int scale ); … … 618 622 Bool CUIsFromSameSliceAndTile ( const TComDataCU *pCU /* Can be NULL */) const; 619 623 Bool CUIsFromSameSliceTileAndWavefrontRow( const TComDataCU *pCU /* Can be NULL */) const; 620 Bool isLastSubCUOfCtu (const UInt absPartIdx);621 622 623 TComDataCU* getPULeft ( UInt&uiLPartUnitIdx,624 Bool isLastSubCUOfCtu ( const UInt absPartIdx ) const; 625 626 627 const TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, 624 628 UInt uiCurrPartUnitIdx, 625 629 Bool bEnforceSliceRestriction=true, 626 Bool bEnforceTileRestriction=true ); 627 TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, 630 Bool bEnforceTileRestriction=true ) const; 631 632 const TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, 628 633 UInt uiCurrPartUnitIdx, 629 634 Bool bEnforceSliceRestriction=true, 630 635 Bool planarAtCTUBoundary = false, 631 Bool bEnforceTileRestriction=true );632 TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); 633 634 TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInCtu ); 635 TComDataCU* getQpMinCuAbove ( UInt& uiAPartUnitIdx , UInt uiCurrAbsIdxInCtu );636 Char getRefQP ( UInt uiCurrAbsIdxInCtu );636 Bool bEnforceTileRestriction=true ) const; 637 638 const TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ) const; 639 640 const TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; 641 const TComDataCU* getQpMinCuAbove ( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; 637 642 638 643 /// returns CU and part index of the PU above the top row of the current uiCurrPartUnitIdx of the CU, at a horizontal offset (to the right) of uiPartUnitOffset (in parts) 639 TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true );644 const TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; 640 645 /// returns CU and part index of the PU left of the lefthand column of the current uiCurrPartUnitIdx of the CU, at a vertical offset (below) of uiPartUnitOffset (in parts) 641 TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); 642 643 Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); 644 Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ); 645 646 Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); 646 const TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; 647 648 SChar getRefQP ( UInt uiCurrAbsIdxInCtu ) const; 649 650 Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; 651 Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ) const; 652 647 653 #if NH_3D 648 654 Bool hasEqualMotion ( Int dirA, const TComMvField* mvFieldA, Int dirB, const TComMvField* mvFieldB ); 649 655 #endif 656 Bool hasEqualMotion ( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const; 657 650 658 #if NH_3D_MLC 651 659 Bool getAvailableFlagA1() { return m_bAvailableFlagA1; } … … 670 678 , Int& numValidMergeCand, Int mrgCandIdx = -1 ); 671 679 #endif 680 #if NH_3D 672 681 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ); 682 #else 683 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ) const; 684 #endif 673 685 674 686 #if NH_3D_VSP 675 687 #if NH_3D_SPIVMP 676 Bool* getSPIVMPFlag () { return m_pbSPIVMPFlag; }677 Bool getSPIVMPFlag ( UInt uiIdx ) { return m_pbSPIVMPFlag[uiIdx]; }688 Bool* getSPIVMPFlag () const { return m_pbSPIVMPFlag; } 689 Bool getSPIVMPFlag ( UInt uiIdx ) const { return m_pbSPIVMPFlag[uiIdx]; } 678 690 Void setSPIVMPFlag ( UInt uiIdx, Bool n ) { m_pbSPIVMPFlag[uiIdx] = n; } 679 691 Void setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 680 692 #endif 681 693 682 Char* getVSPFlag (){ return m_piVSPFlag; }683 Char getVSPFlag ( UInt uiIdx ){ return m_piVSPFlag[uiIdx]; }694 SChar* getVSPFlag () const { return m_piVSPFlag; } 695 SChar getVSPFlag ( UInt uiIdx ) const { return m_piVSPFlag[uiIdx]; } 684 696 Void setVSPFlag ( UInt uiIdx, Int n ) { m_piVSPFlag[uiIdx] = n; } 685 Void setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );697 Void setVSPFlagSubParts( SChar iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 686 698 Void setMvFieldPUForVSP ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize ); 687 699 #endif 688 Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); 689 Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); 690 700 Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; 701 Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const; 691 702 // ------------------------------------------------------------------------------------------------------------------- 692 703 // member functions for modes … … 695 706 Bool isIntra ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } 696 707 Bool isInter ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTER; } 697 Bool isSkipped ( UInt uiPartIdx );///< returns true, if the partiton is skipped698 Bool isBipredRestriction ( UInt puIdx );708 Bool isSkipped ( UInt uiPartIdx ) const; ///< returns true, if the partiton is skipped 709 Bool isBipredRestriction ( UInt puIdx ) const; 699 710 700 711 // ------------------------------------------------------------------------------------------------------------------- … … 702 713 // ------------------------------------------------------------------------------------------------------------------- 703 714 704 UInt getIntraSizeIdx ( UInt uiAbsPartIdx );705 706 Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList );707 Void getIntraDirPredictor ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL );715 UInt getIntraSizeIdx ( UInt uiAbsPartIdx ) const; 716 717 Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ) const; 718 Void getIntraDirPredictor ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL ) const; 708 719 709 720 // ------------------------------------------------------------------------------------------------------------------- … … 711 722 // ------------------------------------------------------------------------------------------------------------------- 712 723 713 UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth );714 UInt getCtxQtCbf ( TComTU &rTu, const ChannelType chType );715 716 UInt getCtxSkipFlag ( UInt uiAbsPartIdx );717 UInt getCtxInterDir ( UInt uiAbsPartIdx );724 UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ) const; 725 UInt getCtxQtCbf ( TComTU &rTu, const ChannelType chType ) const; 726 727 UInt getCtxSkipFlag ( UInt uiAbsPartIdx ) const; 728 UInt getCtxInterDir ( UInt uiAbsPartIdx ) const; 718 729 #if NH_3D_ARP 719 730 UInt getCTXARPWFlag ( UInt uiAbsPartIdx ); -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComLoopFilter.cpp
r1313 r1360 365 365 UInt uiY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsZorderIdx ] ]; 366 366 367 TComDataCU* pcTempCU;368 367 UInt uiTempPartIdx; 369 368 … … 380 379 if ( m_stLFCUParam.bLeftEdge ) 381 380 { 382 pcTempCU = pcCU->getPULeft( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);381 const TComDataCU* pcTempCU = pcCU->getPULeft( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary); 383 382 384 383 if ( pcTempCU != NULL ) … … 402 401 if ( m_stLFCUParam.bTopEdge ) 403 402 { 404 pcTempCU = pcCU->getPUAbove( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);403 const TComDataCU* pcTempCU = pcCU->getPUAbove( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary); 405 404 406 405 if ( pcTempCU != NULL ) … … 425 424 426 425 UInt uiPartP; 427 TComDataCU* pcCUP;426 const TComDataCU* pcCUP; 428 427 UInt uiBs = 0; 429 428 … … 459 458 { 460 459 Int iRefIdx; 461 TComPic *piRefP0, *piRefP1, *piRefQ0, *piRefQ1;462 460 iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartP); 463 piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);461 const TComPic *piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx); 464 462 iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartP); 465 piRefP1 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_1, iRefIdx);463 const TComPic *piRefP1 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_1, iRefIdx); 466 464 iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartQ); 467 piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);465 const TComPic *piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx); 468 466 iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartQ); 469 piRefQ1 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx);467 const TComPic *piRefQ1 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx); 470 468 471 469 TComMv pcMvP0 = pcCUP->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartP); … … 530 528 { 531 529 Int iRefIdx; 532 TComPic *piRefP0, *piRefQ0;533 530 iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartP); 534 piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);531 const TComPic *piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx); 535 532 iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartQ); 536 piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);533 const TComPic *piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx); 537 534 TComMv pcMvP0 = pcCUP->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartP); 538 535 TComMv pcMvQ0 = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartQ); … … 583 580 UInt uiPartPIdx = 0; 584 581 UInt uiPartQIdx = 0; 585 TComDataCU* pcCUP = pcCU;582 const TComDataCU* pcCUP = pcCU; 586 583 TComDataCU* pcCUQ = pcCU; 587 584 Int betaOffsetDiv2 = pcCUQ->getSlice()->getDeblockingFilterBetaOffsetDiv2(); … … 758 755 UInt uiPartQIdx = uiBsAbsIdx; 759 756 // Derive neighboring PU index 760 TComDataCU* pcCUP;757 const TComDataCU* pcCUP; 761 758 UInt uiPartPIdx; 762 759 -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComMotionInfo.cpp
r1321 r1360 66 66 m_pcMv = new TComMv[ uiNumPartition ]; 67 67 m_pcMvd = new TComMv[ uiNumPartition ]; 68 m_piRefIdx = new Char[ uiNumPartition ];68 m_piRefIdx = new SChar [ uiNumPartition ]; 69 69 70 70 m_uiNumPartition = uiNumPartition; … … 321 321 Void TComCUMvField::setAllRefIdx ( Int iRefIdx, PartSize eCUMode, Int iPartAddr, UInt uiDepth, Int iPartIdx ) 322 322 { 323 setAll(m_piRefIdx, static_cast< Char>(iRefIdx), eCUMode, iPartAddr, uiDepth, iPartIdx);323 setAll(m_piRefIdx, static_cast<SChar>(iRefIdx), eCUMode, iPartAddr, uiDepth, iPartIdx); 324 324 } 325 325 … … 358 358 * \param scale Factor by which to subsample motion information 359 359 */ 360 Void TComCUMvField::compress( Char* pePredMode, Int scale)360 Void TComCUMvField::compress(SChar* pePredMode, Int scale) 361 361 { 362 362 Int N = scale * scale; … … 381 381 382 382 #if NH_MV 383 Void TComCUMvField::print( Char* pePredMode)383 Void TComCUMvField::print(SChar* pePredMode) 384 384 { 385 385 for ( Int uiPartIdx = 0; uiPartIdx < m_uiNumPartition; uiPartIdx += 1 ) -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComMotionInfo.h
r1321 r1360 57 57 typedef struct _AMVPInfo 58 58 { 59 TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS _MEM]; ///< array of motion vector predictor candidates59 TComMv m_acMvCand[ AMVP_MAX_NUM_CANDS ]; ///< array of motion vector predictor candidates 60 60 Int iN; ///< number of motion vector predictor candidates 61 61 } AMVPInfo; … … 122 122 TComMv* m_pcMv; 123 123 TComMv* m_pcMvd; 124 Char*m_piRefIdx;124 SChar* m_piRefIdx; 125 125 UInt m_uiNumPartition; 126 126 AMVPInfo m_cAMVPInfo; … … 188 188 } 189 189 190 Void compress( Char* pePredMode, Int scale);190 Void compress(SChar* pePredMode, Int scale); 191 191 #if NH_MV 192 Void print ( Char* pePredMode);192 Void print (SChar* pePredMode); 193 193 #endif 194 194 }; -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComMv.h
r1313 r1360 145 145 } 146 146 147 #if NH_3D || !ME_ENABLE_ROUNDING_OF_MVS 147 148 const TComMv& operator>>= (const Int i) 148 149 { … … 151 152 return *this; 152 153 } 154 #endif 155 156 #if ME_ENABLE_ROUNDING_OF_MVS 157 //! shift right with rounding 158 Void divideByPowerOf2 (const Int i) 159 { 160 Int offset = (i == 0) ? 0 : 1 << (i - 1); 161 m_iHor += offset; 162 m_iVer += offset; 163 164 m_iHor >>= i; 165 m_iVer >>= i; 166 } 167 #endif 153 168 154 169 const TComMv& operator<<= (const Int i) -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComPattern.cpp
r1313 r1360 66 66 67 67 /// constrained intra prediction 68 Bool isAboveLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT );69 Int isAboveAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags );70 Int isLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags );71 Int isAboveRightAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags );72 Int isBelowLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags );68 Bool isAboveLeftAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT ); 69 Int isAboveAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); 70 Int isLeftAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); 71 Int isAboveRightAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); 72 Int isBelowLeftAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); 73 73 74 74 … … 566 566 } 567 567 568 Bool isAboveLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT )568 Bool isAboveLeftAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT ) 569 569 { 570 570 Bool bAboveLeftFlag; 571 571 UInt uiPartAboveLeft; 572 TComDataCU* pcCUAboveLeft = pcCU->getPUAboveLeft( uiPartAboveLeft, uiPartIdxLT );572 const TComDataCU* pcCUAboveLeft = pcCU->getPUAboveLeft( uiPartAboveLeft, uiPartIdxLT ); 573 573 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 574 574 { … … 582 582 } 583 583 584 Int isAboveAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )584 Int isAboveAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags ) 585 585 { 586 586 const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT]; … … 593 593 { 594 594 UInt uiPartAbove; 595 TComDataCU* pcCUAbove = pcCU->getPUAbove( uiPartAbove, g_auiRasterToZscan[uiRasterPart] );595 const TComDataCU* pcCUAbove = pcCU->getPUAbove( uiPartAbove, g_auiRasterToZscan[uiRasterPart] ); 596 596 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 597 597 { … … 623 623 } 624 624 625 Int isLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )625 Int isLeftAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags ) 626 626 { 627 627 const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT]; … … 634 634 { 635 635 UInt uiPartLeft; 636 TComDataCU* pcCULeft = pcCU->getPULeft( uiPartLeft, g_auiRasterToZscan[uiRasterPart] );636 const TComDataCU* pcCULeft = pcCU->getPULeft( uiPartLeft, g_auiRasterToZscan[uiRasterPart] ); 637 637 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 638 638 { … … 665 665 } 666 666 667 Int isAboveRightAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags )667 Int isAboveRightAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags ) 668 668 { 669 669 const UInt uiNumUnitsInPU = g_auiZscanToRaster[uiPartIdxRT] - g_auiZscanToRaster[uiPartIdxLT] + 1; … … 674 674 { 675 675 UInt uiPartAboveRight; 676 TComDataCU* pcCUAboveRight = pcCU->getPUAboveRight( uiPartAboveRight, uiPartIdxRT, uiOffset );676 const TComDataCU* pcCUAboveRight = pcCU->getPUAboveRight( uiPartAboveRight, uiPartIdxRT, uiOffset ); 677 677 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 678 678 { … … 705 705 } 706 706 707 Int isBelowLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags )707 Int isBelowLeftAvailable( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags ) 708 708 { 709 709 const UInt uiNumUnitsInPU = (g_auiZscanToRaster[uiPartIdxLB] - g_auiZscanToRaster[uiPartIdxLT]) / pcCU->getPic()->getNumPartInCtuWidth() + 1; … … 714 714 { 715 715 UInt uiPartBelowLeft; 716 TComDataCU* pcCUBelowLeft = pcCU->getPUBelowLeft( uiPartBelowLeft, uiPartIdxLB, uiOffset );716 const TComDataCU* pcCUBelowLeft = pcCU->getPUBelowLeft( uiPartBelowLeft, uiPartIdxLB, uiOffset ); 717 717 if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) 718 718 { -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComPattern.h
r1313 r1360 69 69 return m_piROIOrigin; 70 70 } 71 __inline const Pel* getROIOrigin() const 72 { 73 return m_piROIOrigin; 74 } 71 75 72 76 /// set parameters from Pel buffer for accessing neighbouring pixels … … 93 97 // ROI & pattern information, (ROI = &pattern[AboveOffset][LeftOffset]) 94 98 Pel* getROIY() { return m_cPatternY.getROIOrigin(); } 95 Int getROIYWidth() { return m_cPatternY.m_iROIWidth; } 96 Int getROIYHeight() { return m_cPatternY.m_iROIHeight; } 97 Int getPatternLStride() { return m_cPatternY.m_iPatternStride; } 98 Int getBitDepthY() { return m_cPatternY.m_bitDepth; } 99 const Pel* getROIY() const { return m_cPatternY.getROIOrigin(); } 100 Int getROIYWidth() const { return m_cPatternY.m_iROIWidth; } 101 Int getROIYHeight() const { return m_cPatternY.m_iROIHeight; } 102 Int getPatternLStride() const { return m_cPatternY.m_iPatternStride; } 103 Int getBitDepthY() const { return m_cPatternY.m_bitDepth; } 99 104 100 105 #if NH_3D_IC 101 Bool getICFlag() { return m_bICFlag; }106 Bool getICFlag() const { return m_bICFlag; } 102 107 Void setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; } 103 108 #endif 104 109 #if NH_3D_SDC_INTER 105 Bool getSDCMRSADFlag() { return m_bSDCMRSADFlag; }110 Bool getSDCMRSADFlag() const { return m_bSDCMRSADFlag; } 106 111 Void setSDCMRSADFlag( Bool bSDCMRSADFlag ) { m_bSDCMRSADFlag = bSDCMRSADFlag; } 107 112 #endif -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComPic.h
r1321 r1360 189 189 190 190 TComPicSym* getPicSym() { return &m_picSym; } 191 const TComPicSym* getPicSym() const { return &m_picSym; } 191 192 TComSlice* getSlice(Int i) { return m_picSym.getSlice(i); } 192 193 Int getPOC() const { return m_picSym.getSlice(m_uiCurrSliceIdx)->getPOC(); } … … 247 248 #if NH_MV 248 249 Void setLayerId ( Int layerId ) { m_layerId = layerId; } 249 Int getLayerId () 250 Int getLayerId () const { return m_layerId; } 250 251 251 252 Void setViewId ( Int viewId ) { m_viewId = viewId; } 252 Int getViewId () 253 Int getViewId () const { return m_viewId; } 253 254 254 255 Void setPicOutputFlag(Bool b) { m_bPicOutputFlag = b; } 255 Bool getPicOutputFlag() 256 Bool getPicOutputFlag() const { return m_bPicOutputFlag ; } 256 257 257 258 Bool getPocResetPeriodId(); … … 312 313 #if NH_3D 313 314 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 314 Int getViewIndex () 315 Int getViewIndex () const { return m_viewIndex; } 315 316 316 317 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComPicSym.cpp
r1313 r1360 140 140 clearSliceBuffer(); 141 141 142 if (m_pictureCtuArray) 143 { 142 144 for (Int i = 0; i < m_numCtusInFrame; i++) 143 145 { 146 if (m_pictureCtuArray[i]) 147 { 144 148 m_pictureCtuArray[i]->destroy(); 145 149 delete m_pictureCtuArray[i]; 146 150 m_pictureCtuArray[i] = NULL; 147 151 } 152 } 148 153 delete [] m_pictureCtuArray; 149 154 m_pictureCtuArray = NULL; 155 } 150 156 151 157 delete [] m_ctuTsToRsAddrMap; -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComPicYuv.cpp
r1313 r1360 79 79 80 80 81 Void TComPicYuv::create ( const Int iPicWidth, ///< picture width 82 const Int iPicHeight, ///< picture height 81 Void TComPicYuv::createWithoutCUInfo ( const Int picWidth, ///< picture width 82 const Int picHeight, ///< picture height 83 const ChromaFormat chromaFormatIDC, ///< chroma format 84 const Bool bUseMargin, ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 85 const UInt maxCUWidth, ///< used for margin only 86 const UInt maxCUHeight) ///< used for margin only 87 88 { 89 m_picWidth = picWidth; 90 m_picHeight = picHeight; 91 92 #if NH_3D_IV_MERGE 93 // Check if m_iBaseUnitWidth and m_iBaseUnitHeight need to be derived here 94 #endif 95 96 m_chromaFormatIDC = chromaFormatIDC; 97 m_marginX = (bUseMargin?maxCUWidth:0) + 16; // for 16-byte alignment 98 m_marginY = (bUseMargin?maxCUHeight:0) + 16; // margin for 8-tap filter and infinite padding 99 m_bIsBorderExtended = false; 100 101 // assign the picture arrays and set up the ptr to the top left of the original picture 102 for(UInt comp=0; comp<getNumberValidComponents(); comp++) 103 { 104 const ComponentID ch=ComponentID(comp); 105 m_apiPicBuf[comp] = (Pel*)xMalloc( Pel, getStride(ch) * getTotalHeight(ch)); 106 m_piPicOrg[comp] = m_apiPicBuf[comp] + (m_marginY >> getComponentScaleY(ch)) * getStride(ch) + (m_marginX >> getComponentScaleX(ch)); 107 } 108 // initialize pointers for unused components to NULL 109 for(UInt comp=getNumberValidComponents();comp<MAX_NUM_COMPONENT; comp++) 110 { 111 } 112 113 for(Int chan=0; chan<MAX_NUM_CHANNEL_TYPE; chan++) 114 { 115 m_ctuOffsetInBuffer[chan] = NULL; 116 m_subCuOffsetInBuffer[chan] = NULL; 117 } 118 } 119 120 121 122 Void TComPicYuv::create ( const Int picWidth, ///< picture width 123 const Int picHeight, ///< picture height 83 124 const ChromaFormat chromaFormatIDC, ///< chroma format 84 const UInt uiMaxCUWidth, ///< used for generating offsets to CUs. Can use iPicWidth if no offsets are required85 const UInt uiMaxCUHeight, ///< used for generating offsets to CUs. Can use iPicHeight if no offsets are required86 const UInt uiMaxCUDepth, ///< used for generating offsets to CUs. Can use 0 if no offsets are required125 const UInt maxCUWidth, ///< used for generating offsets to CUs. 126 const UInt maxCUHeight, ///< used for generating offsets to CUs. 127 const UInt maxCUDepth, ///< used for generating offsets to CUs. 87 128 const Bool bUseMargin) ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 88 129 89 130 { 90 m_iPicWidth = iPicWidth; 91 m_iPicHeight = iPicHeight; 131 createWithoutCUInfo(picWidth, picHeight, chromaFormatIDC, bUseMargin, maxCUWidth, maxCUHeight); 92 132 93 133 #if NH_3D_IV_MERGE 94 m_iCuWidth = uiMaxCUWidth; 95 m_iCuHeight = uiMaxCUHeight; 96 97 m_iNumCuInWidth = m_iPicWidth / m_iCuWidth; 98 m_iNumCuInWidth += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0; 99 100 m_iBaseUnitWidth = uiMaxCUWidth >> uiMaxCUDepth; 101 m_iBaseUnitHeight = uiMaxCUHeight >> uiMaxCUDepth; 102 #endif 103 104 m_chromaFormatIDC = chromaFormatIDC; 105 m_iMarginX = (bUseMargin?uiMaxCUWidth:0) + 16; // for 16-byte alignment 106 m_iMarginY = (bUseMargin?uiMaxCUHeight:0) + 16; // margin for 8-tap filter and infinite padding 107 m_bIsBorderExtended = false; 108 109 // assign the picture arrays and set up the ptr to the top left of the original picture 110 { 111 Int chan=0; 112 for(; chan<getNumberValidComponents(); chan++) 113 { 114 const ComponentID ch=ComponentID(chan); 115 m_apiPicBuf[chan] = (Pel*)xMalloc( Pel, getStride(ch) * getTotalHeight(ch)); 116 m_piPicOrg[chan] = m_apiPicBuf[chan] + (m_iMarginY >> getComponentScaleY(ch)) * getStride(ch) + (m_iMarginX >> getComponentScaleX(ch)); 117 } 118 for(;chan<MAX_NUM_COMPONENT; chan++) 119 { 120 m_apiPicBuf[chan] = NULL; 121 m_piPicOrg[chan] = NULL; 122 } 123 } 124 125 126 const Int numCuInWidth = m_iPicWidth / uiMaxCUWidth + (m_iPicWidth % uiMaxCUWidth != 0); 127 const Int numCuInHeight = m_iPicHeight / uiMaxCUHeight + (m_iPicHeight % uiMaxCUHeight != 0); 128 for(Int chan=0; chan<2; chan++) 129 { 130 const ComponentID ch=ComponentID(chan); 131 const Int ctuHeight=uiMaxCUHeight>>getComponentScaleY(ch); 132 const Int ctuWidth=uiMaxCUWidth>>getComponentScaleX(ch); 134 m_iBaseUnitWidth = maxCUWidth >> maxCUDepth; 135 m_iBaseUnitHeight = maxCUHeight >> maxCUDepth; 136 #endif 137 138 139 const Int numCuInWidth = m_picWidth / maxCUWidth + (m_picWidth % maxCUWidth != 0); 140 const Int numCuInHeight = m_picHeight / maxCUHeight + (m_picHeight % maxCUHeight != 0); 141 for(Int chan=0; chan<MAX_NUM_CHANNEL_TYPE; chan++) 142 { 143 const ChannelType ch= ChannelType(chan); 144 const Int ctuHeight = maxCUHeight>>getChannelTypeScaleY(ch); 145 const Int ctuWidth = maxCUWidth>>getChannelTypeScaleX(ch); 133 146 const Int stride = getStride(ch); 134 147 … … 143 156 } 144 157 145 m_subCuOffsetInBuffer[chan] = new Int[(size_t)1 << (2 * uiMaxCUDepth)];146 147 const Int numSubBlockPartitions=(1<< uiMaxCUDepth);148 const Int minSubBlockHeight =(ctuHeight >> uiMaxCUDepth);149 const Int minSubBlockWidth =(ctuWidth >> uiMaxCUDepth);158 m_subCuOffsetInBuffer[chan] = new Int[(size_t)1 << (2 * maxCUDepth)]; 159 160 const Int numSubBlockPartitions=(1<<maxCUDepth); 161 const Int minSubBlockHeight =(ctuHeight >> maxCUDepth); 162 const Int minSubBlockWidth =(ctuWidth >> maxCUDepth); 150 163 151 164 for (Int buRow = 0; buRow < numSubBlockPartitions; buRow++) … … 153 166 for (Int buCol = 0; buCol < numSubBlockPartitions; buCol++) 154 167 { 155 m_subCuOffsetInBuffer[chan][(buRow << uiMaxCUDepth) + buCol] = stride * buRow * minSubBlockHeight + buCol * minSubBlockWidth; 156 } 157 } 158 } 159 return; 168 m_subCuOffsetInBuffer[chan][(buRow << maxCUDepth) + buCol] = stride * buRow * minSubBlockHeight + buCol * minSubBlockWidth; 169 } 170 } 171 } 160 172 } 161 173 … … 164 176 Void TComPicYuv::destroy() 165 177 { 166 for(Int c han=0; chan<MAX_NUM_COMPONENT; chan++)167 { 168 m_piPicOrg[c han] = NULL;169 170 if( m_apiPicBuf[c han] )171 { 172 xFree( m_apiPicBuf[c han] );173 m_apiPicBuf[c han] = NULL;178 for(Int comp=0; comp<MAX_NUM_COMPONENT; comp++) 179 { 180 m_piPicOrg[comp] = NULL; 181 182 if( m_apiPicBuf[comp] ) 183 { 184 xFree( m_apiPicBuf[comp] ); 185 m_apiPicBuf[comp] = NULL; 174 186 } 175 187 } … … 194 206 Void TComPicYuv::copyToPic (TComPicYuv* pcPicYuvDst) const 195 207 { 196 assert( m_iPicWidth == pcPicYuvDst->getWidth(COMPONENT_Y) );197 assert( m_iPicHeight == pcPicYuvDst->getHeight(COMPONENT_Y) );198 208 assert( m_chromaFormatIDC == pcPicYuvDst->getChromaFormat() ); 199 209 200 for(Int chan=0; chan<getNumberValidComponents(); chan++) 201 { 202 const ComponentID ch=ComponentID(chan); 203 ::memcpy ( pcPicYuvDst->getBuf(ch), m_apiPicBuf[ch], sizeof (Pel) * getStride(ch) * getTotalHeight(ch)); 204 } 205 return; 210 for(Int comp=0; comp<getNumberValidComponents(); comp++) 211 { 212 const ComponentID compId=ComponentID(comp); 213 const Int width = getWidth(compId); 214 const Int height = getHeight(compId); 215 const Int strideSrc = getStride(compId); 216 assert(pcPicYuvDst->getWidth(compId) == width); 217 assert(pcPicYuvDst->getHeight(compId) == height); 218 if (strideSrc==pcPicYuvDst->getStride(compId)) 219 { 220 ::memcpy ( pcPicYuvDst->getBuf(compId), getBuf(compId), sizeof(Pel)*strideSrc*getTotalHeight(compId)); 221 } 222 else 223 { 224 const Pel *pSrc = getAddr(compId); 225 Pel *pDest = pcPicYuvDst->getAddr(compId); 226 const UInt strideDest = pcPicYuvDst->getStride(compId); 227 228 for(Int y=0; y<height; y++, pSrc+=strideSrc, pDest+=strideDest) 229 { 230 ::memcpy(pDest, pSrc, width*sizeof(Pel)); 231 } 232 } 233 } 206 234 } 207 235 … … 214 242 } 215 243 216 for(Int c han=0; chan<getNumberValidComponents(); chan++)217 { 218 const ComponentID c h=ComponentID(chan);219 Pel *piTxt=getAddr(c h); // piTxt = point to (0,0) of image within bigger picture.220 const Int iStride=getStride(ch);221 const Int iWidth=getWidth(ch);222 const Int iHeight=getHeight(ch);223 const Int iMarginX=getMarginX(ch);224 const Int iMarginY=getMarginY(ch);244 for(Int comp=0; comp<getNumberValidComponents(); comp++) 245 { 246 const ComponentID compId=ComponentID(comp); 247 Pel *piTxt=getAddr(compId); // piTxt = point to (0,0) of image within bigger picture. 248 const Int stride=getStride(compId); 249 const Int width=getWidth(compId); 250 const Int height=getHeight(compId); 251 const Int marginX=getMarginX(compId); 252 const Int marginY=getMarginY(compId); 225 253 226 254 Pel* pi = piTxt; 227 255 // do left and right margins 228 for (Int y = 0; y < iHeight; y++)229 { 230 for (Int x = 0; x < iMarginX; x++ )231 { 232 pi[ - iMarginX + x ] = pi[0];233 pi[ iWidth + x ] = pi[iWidth-1];234 } 235 pi += iStride;256 for (Int y = 0; y < height; y++) 257 { 258 for (Int x = 0; x < marginX; x++ ) 259 { 260 pi[ -marginX + x ] = pi[0]; 261 pi[ width + x ] = pi[width-1]; 262 } 263 pi += stride; 236 264 } 237 265 238 266 // pi is now the (0,height) (bottom left of image within bigger picture 239 pi -= ( iStride + iMarginX);267 pi -= (stride + marginX); 240 268 // pi is now the (-marginX, height-1) 241 for (Int y = 0; y < iMarginY; y++ )242 { 243 ::memcpy( pi + (y+1)* iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );269 for (Int y = 0; y < marginY; y++ ) 270 { 271 ::memcpy( pi + (y+1)*stride, pi, sizeof(Pel)*(width + (marginX<<1)) ); 244 272 } 245 273 246 274 // pi is still (-marginX, height-1) 247 pi -= (( iHeight-1) * iStride);275 pi -= ((height-1) * stride); 248 276 // pi is now (-marginX, 0) 249 for (Int y = 0; y < iMarginY; y++ )250 { 251 ::memcpy( pi - (y+1)* iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );277 for (Int y = 0; y < marginY; y++ ) 278 { 279 ::memcpy( pi - (y+1)*stride, pi, sizeof(Pel)*(width + (marginX<<1)) ); 252 280 } 253 281 } … … 259 287 260 288 // NOTE: This function is never called, but may be useful for developers. 261 Void TComPicYuv::dump (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd) const262 { 263 FILE * pFile;264 if (!bAdd) 265 {266 pFile = fopen (pFileName, "wb");267 }268 else269 { 270 pFile = fopen (pFileName, "ab");271 }272 273 274 for(Int c han = 0; chan < getNumberValidComponents(); chan++)275 { 276 const ComponentID c h = ComponentID(chan);277 const Int shift = bitDepths.recon[toChannelType(ch)] - 8;278 const Int offset = (shift>0)?(1<<(shift-1)):0;279 const Pel *pi = getAddr(ch);280 const Int stride = getStride(ch);281 const Int height = getHeight(ch); 282 const Int width = getWidth(ch);283 289 Void TComPicYuv::dump (const std::string &fileName, const BitDepths &bitDepths, const Bool bAppend, const Bool bForceTo8Bit) const 290 { 291 FILE *pFile = fopen (fileName.c_str(), bAppend?"ab":"wb"); 292 293 Bool is16bit=false; 294 for(Int comp = 0; comp < getNumberValidComponents() && !bForceTo8Bit; comp++) 295 { 296 if (bitDepths.recon[toChannelType(ComponentID(comp))]>8) 297 { 298 is16bit=true; 299 } 300 } 301 302 for(Int comp = 0; comp < getNumberValidComponents(); comp++) 303 { 304 const ComponentID compId = ComponentID(comp); 305 const Pel *pi = getAddr(compId); 306 const Int stride = getStride(compId); 307 const Int height = getHeight(compId); 308 const Int width = getWidth(compId); 309 310 if (is16bit) 311 { 284 312 for (Int y = 0; y < height; y++ ) 285 313 { 286 314 for (Int x = 0; x < width; x++ ) 287 315 { 288 UChar uc = (UChar)Clip3<Pel>(0, 255, (pi[x]+offset)>>shift);316 UChar uc = (UChar)((pi[x]>>0) & 0xff); 289 317 fwrite( &uc, sizeof(UChar), 1, pFile ); 318 uc = (UChar)((pi[x]>>8) & 0xff); 319 fwrite( &uc, sizeof(UChar), 1, pFile ); 290 320 } 291 321 pi += stride; 322 } 323 } 324 else 325 { 326 const Int shift = bitDepths.recon[toChannelType(compId)] - 8; 327 const Int offset = (shift>0)?(1<<(shift-1)):0; 328 for (Int y = 0; y < height; y++ ) 329 { 330 for (Int x = 0; x < width; x++ ) 331 { 332 UChar uc = (UChar)Clip3<Pel>(0, 255, (pi[x]+offset)>>shift); 333 fwrite( &uc, sizeof(UChar), 1, pFile ); 334 } 335 pi += stride; 336 } 292 337 } 293 338 } -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComPicYuv.h
r1321 r1360 69 69 // ------------------------------------------------------------------------------------------------ 70 70 71 Int m_ iPicWidth;///< Width of picture in pixels72 Int m_ iPicHeight;///< Height of picture in pixels71 Int m_picWidth; ///< Width of picture in pixels 72 Int m_picHeight; ///< Height of picture in pixels 73 73 ChromaFormat m_chromaFormatIDC; ///< Chroma Format 74 74 … … 76 76 Int* m_subCuOffsetInBuffer[MAX_NUM_CHANNEL_TYPE];///< Gives an offset in the buffer for a given sub-CU (and channel), relative to start of CTU 77 77 78 Int m_ iMarginX;///< margin of Luma channel (chroma's may be smaller, depending on ratio)79 Int m_ iMarginY;///< margin of Luma channel (chroma's may be smaller, depending on ratio)78 Int m_marginX; ///< margin of Luma channel (chroma's may be smaller, depending on ratio) 79 Int m_marginY; ///< margin of Luma channel (chroma's may be smaller, depending on ratio) 80 80 81 81 Bool m_bIsBorderExtended; … … 100 100 // ------------------------------------------------------------------------------------------------ 101 101 102 Void create (const Int iPicWidth,103 const Int iPicHeight,102 Void create (const Int picWidth, 103 const Int picHeight, 104 104 const ChromaFormat chromaFormatIDC, 105 const UInt uiMaxCUWidth, ///< used for generating offsets to CUs. Can use iPicWidth if no offsets are required106 const UInt uiMaxCUHeight, ///< used for generating offsets to CUs. Can use iPicHeight if no offsets are required107 const UInt uiMaxCUDepth, ///< used for generating offsets to CUs. Can use 0 if no offsets are required105 const UInt maxCUWidth, ///< used for generating offsets to CUs. 106 const UInt maxCUHeight, ///< used for generating offsets to CUs. 107 const UInt maxCUDepth, ///< used for generating offsets to CUs. 108 108 const Bool bUseMargin); ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 109 110 Void createWithoutCUInfo(const Int picWidth, 111 const Int picHeight, 112 const ChromaFormat chromaFormatIDC, 113 const Bool bUseMargin=false, ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 114 const UInt maxCUWidth=0, ///< used for margin only 115 const UInt maxCUHeight=0); ///< used for margin only 109 116 110 117 Void destroy (); … … 118 125 // ------------------------------------------------------------------------------------------------ 119 126 120 Int getWidth (const ComponentID id) const { return m_ iPicWidth >> getComponentScaleX(id); }121 Int getHeight (const ComponentID id) const { return m_ iPicHeight >> getComponentScaleY(id); }127 Int getWidth (const ComponentID id) const { return m_picWidth >> getComponentScaleX(id); } 128 Int getHeight (const ComponentID id) const { return m_picHeight >> getComponentScaleY(id); } 122 129 ChromaFormat getChromaFormat () const { return m_chromaFormatIDC; } 123 130 UInt getNumberValidComponents() const { return ::getNumberValidComponents(m_chromaFormatIDC); } 124 131 125 Int getStride (const ComponentID id) const { return ((m_iPicWidth ) + (m_iMarginX <<1)) >> getComponentScaleX(id); } 126 Int getTotalHeight (const ComponentID id) const { return ((m_iPicHeight ) + (m_iMarginY <<1)) >> getComponentScaleY(id); } 127 128 Int getMarginX (const ComponentID id) const { return m_iMarginX >> getComponentScaleX(id); } 129 Int getMarginY (const ComponentID id) const { return m_iMarginY >> getComponentScaleY(id); } 132 Int getStride (const ComponentID id) const { return ((m_picWidth ) + (m_marginX <<1)) >> getComponentScaleX(id); } 133 private: 134 Int getStride (const ChannelType id) const { return ((m_picWidth ) + (m_marginX <<1)) >> getChannelTypeScaleX(id); } 135 public: 136 Int getTotalHeight (const ComponentID id) const { return ((m_picHeight ) + (m_marginY <<1)) >> getComponentScaleY(id); } 137 138 Int getMarginX (const ComponentID id) const { return m_marginX >> getComponentScaleX(id); } 139 Int getMarginY (const ComponentID id) const { return m_marginY >> getComponentScaleY(id); } 130 140 131 141 // ------------------------------------------------------------------------------------------------ … … 135 145 // Access starting position of picture buffer with margin 136 146 Pel* getBuf (const ComponentID ch) { return m_apiPicBuf[ch]; } 147 const Pel* getBuf (const ComponentID ch) const { return m_apiPicBuf[ch]; } 137 148 138 149 // Access starting position of original picture … … 151 162 UInt getComponentScaleY(const ComponentID id) const { return ::getComponentScaleY(id, m_chromaFormatIDC); } 152 163 164 UInt getChannelTypeScaleX(const ChannelType id) const { return ::getChannelTypeScaleX(id, m_chromaFormatIDC); } 165 UInt getChannelTypeScaleY(const ChannelType id) const { return ::getChannelTypeScaleY(id, m_chromaFormatIDC); } 166 153 167 // ------------------------------------------------------------------------------------------------ 154 168 // Miscellaneous … … 162 176 163 177 // Dump picture 164 Void dump (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd =false) const ;178 Void dump (const std::string &fileName, const BitDepths &bitDepths, const Bool bAppend=false, const Bool bForceTo8Bit=false) const ; 165 179 166 180 // Set border extension flag -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComPicYuvMD5.cpp
r1313 r1360 209 209 std::string hashToString(const TComPictureHash &digest, Int numChar) 210 210 { 211 static const Char* hex = "0123456789abcdef";211 static const TChar* hex = "0123456789abcdef"; 212 212 std::string result; 213 213 -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComPrediction.cpp
r1321 r1360 1139 1139 Int iHeight; 1140 1140 UInt uiPartAddr; 1141 const TComSlice *pSlice = pcCU->getSlice(); 1142 const SliceType sliceType = pSlice->getSliceType(); 1143 const TComPPS &pps = *(pSlice->getPPS()); 1141 1144 1142 1145 if ( iPartIdx >= 0 ) … … 1147 1150 { 1148 1151 #endif 1149 if ( eRefPicList != REF_PIC_LIST_X ) 1150 { 1151 if( pcCU->getSlice()->getPPS()->getUseWP()) 1152 { 1153 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); 1154 } 1155 else 1156 { 1157 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1158 } 1159 if ( pcCU->getSlice()->getPPS()->getUseWP() ) 1160 { 1161 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1162 } 1152 if ( eRefPicList != REF_PIC_LIST_X ) 1153 { 1154 if( (sliceType == P_SLICE && pps.getUseWP()) || (sliceType == B_SLICE && pps.getWPBiPred())) 1155 { 1156 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); 1157 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1163 1158 } 1164 1159 else 1165 1160 { 1161 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1162 } 1163 } 1164 else 1165 { 1166 1166 #if NH_3D_SPIVMP 1167 1167 if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0) … … 1235 1235 if ( eRefPicList != REF_PIC_LIST_X ) 1236 1236 { 1237 if( pcCU->getSlice()->getPPS()->getUseWP())1237 if( (sliceType == P_SLICE && pps.getUseWP()) || (sliceType == B_SLICE && pps.getWPBiPred())) 1238 1238 { 1239 1239 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); 1240 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1240 1241 } 1241 1242 else 1242 1243 { 1243 1244 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1244 }1245 if ( pcCU->getSlice()->getPPS()->getUseWP() )1246 {1247 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );1248 1245 } 1249 1246 } … … 1449 1446 Int iCurrPOC = pcCU->getSlice()->getPOC(); 1450 1447 Int iColRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx ); 1451 Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, arpRefIdx );1452 Int iScale = pcCU->xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC);1448 Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, arpRefIdx ); 1449 Int iScale = pcCU->xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC); 1453 1450 if ( iScale != 4096 ) 1454 1451 { 1455 1452 cMv = cMv.scaleMv( iScale ); 1456 1453 } 1457 iRefIdx = arpRefIdx;1458 }1454 iRefIdx = arpRefIdx; 1455 } 1459 1456 1460 1457 pcCU->clipMv(cMv); -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComRdCost.cpp
r1321 r1360 64 64 // Calculate RD functions 65 65 #if NH_3D_VSO 66 Double TComRdCost::calcRdCost( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc ) 66 Double TComRdCost::calcRdCost( Double numBits, Dist intDistortion, DFunc eDFunc ) 67 { 68 Double distortion = (Double) intDistortion; 67 69 #else 68 Double TComRdCost::calcRdCost( UInt uiBits, Distortion uiDistortion, Bool bFlag, DFunc eDFunc )69 #endif 70 { 71 Double dRdCost = 0.0;72 Double dLambda = 0.0;70 Double TComRdCost::calcRdCost( Double numBits, Double distortion, DFunc eDFunc ) 71 { 72 #endif 73 74 Double lambda = 1.0; 73 75 74 76 switch ( eDFunc ) … … 78 80 break; 79 81 case DF_SAD: 80 #if RExt__HIGH_BIT_DEPTH_SUPPORT 82 lambda = m_dLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate. 83 break; 84 case DF_DEFAULT: 85 lambda = m_dLambda; 86 break; 87 case DF_SSE_FRAME: 88 lambda = m_dFrameLambda; 89 break; 90 default: 91 assert (0); 92 break; 93 } 94 95 #if NH_MV 96 // D_PRINT_INDENT( g_traceRDCost, "Dist: " + n2s(distortion) + " Bits: " + n2s(numBits) + " RD Cost: " + n2s(dRdCost)); 97 D_PRINT_INDENT( g_traceRDCost, "Dist: " + n2s(distortion) + " Bits: " + n2s(numBits) ); 98 #endif 99 100 if (eDFunc == DF_SAD) 101 { 102 if (m_costMode != COST_STANDARD_LOSSY) 103 { 104 return ((distortion * 65536.0) / lambda) + numBits; // all lossless costs would have uiDistortion=0, and therefore this cost function can be used. 105 } 106 else 107 { 108 return distortion + (((numBits * lambda) ) / 65536.0); 109 } 110 } 111 else 112 { 113 if (m_costMode != COST_STANDARD_LOSSY) 114 { 115 return (distortion / lambda) + numBits; // all lossless costs would have uiDistortion=0, and therefore this cost function can be used. 116 } 117 else 118 { 119 return distortion + (numBits * lambda); 120 } 121 } 122 } 123 124 #if NH_3D_VSO 125 Double TComRdCost::calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag, DFunc eDFunc ) 126 #else 127 Double TComRdCost::calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag, DFunc eDFunc ) 128 #endif 129 { 130 Double dRdCost = 0.0; 131 Double dLambda = 0.0; 132 133 switch ( eDFunc ) 134 { 135 case DF_SSE: 136 assert(0); 137 break; 138 case DF_SAD: 81 139 dLambda = m_dLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate. 82 #else83 dLambda = (Double)m_uiLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate.84 #endif85 140 break; 86 141 case DF_DEFAULT: … … 104 159 else 105 160 { 106 dRdCost = (((Double) uiDistortion) + ((Double)uiBits * dLambda));161 dRdCost = (((Double)(Int64)uiDistortion) + ((Double)(Int64)uiBits * dLambda)); 107 162 } 108 163 } … … 133 188 } 134 189 135 #if NH_MV136 D_PRINT_INDENT( g_traceRDCost, "Dist: " + n2s(uiDistortion) + " Bits: " + n2s(uiBits) + " RD Cost: " + n2s(dRdCost));137 #endif138 return dRdCost;139 }140 141 #if NH_3D_VSO142 Double TComRdCost::calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag, DFunc eDFunc )143 #else144 Double TComRdCost::calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag, DFunc eDFunc )145 #endif146 {147 Double dRdCost = 0.0;148 Double dLambda = 0.0;149 150 switch ( eDFunc )151 {152 case DF_SSE:153 assert(0);154 break;155 case DF_SAD:156 #if RExt__HIGH_BIT_DEPTH_SUPPORT157 dLambda = m_dLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate.158 #else159 dLambda = (Double)m_uiLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate.160 #endif161 break;162 case DF_DEFAULT:163 dLambda = m_dLambda;164 break;165 case DF_SSE_FRAME:166 dLambda = m_dFrameLambda;167 break;168 default:169 assert (0);170 break;171 }172 173 if (bFlag) //NOTE: this "bFlag" is never true174 {175 // Intra8x8, Intra4x4 Block only...176 if (m_costMode != COST_STANDARD_LOSSY)177 {178 dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.179 }180 else181 {182 dRdCost = (((Double)(Int64)uiDistortion) + ((Double)(Int64)uiBits * dLambda));183 }184 }185 else186 {187 if (eDFunc == DF_SAD)188 {189 if (m_costMode != COST_STANDARD_LOSSY)190 {191 dRdCost = ((Double(uiDistortion) * 65536) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.192 }193 else194 {195 dRdCost = floor(Double(uiDistortion) + (floor((Double(uiBits) * dLambda) + 0.5) / 65536.0));196 }197 }198 else199 {200 if (m_costMode != COST_STANDARD_LOSSY)201 {202 dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used.203 }204 else205 {206 dRdCost = floor(Double(uiDistortion) + (Double(uiBits) * dLambda) + 0.5);207 }208 }209 }210 211 190 return dRdCost; 212 191 } … … 216 195 m_dLambda = dLambda; 217 196 m_sqrtLambda = sqrt(m_dLambda); 218 #if RExt__HIGH_BIT_DEPTH_SUPPORT219 197 m_dLambdaMotionSAD[0] = 65536.0 * m_sqrtLambda; 220 198 m_dLambdaMotionSSE[0] = 65536.0 * m_dLambda; … … 226 204 m_dLambdaMotionSAD[1] = 65536.0 * sqrt(dLambda); 227 205 m_dLambdaMotionSSE[1] = 65536.0 * dLambda; 228 #else229 m_uiLambdaMotionSAD[0] = (UInt)floor(65536.0 * m_sqrtLambda);230 m_uiLambdaMotionSSE[0] = (UInt)floor(65536.0 * m_dLambda );231 #if FULL_NBIT232 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12) / 3.0));233 #else234 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (bitDepths.recon[CHANNEL_TYPE_LUMA] - 8)) / 3.0));235 #endif236 m_uiLambdaMotionSAD[1] = (UInt)floor(65536.0 * sqrt(dLambda));237 m_uiLambdaMotionSSE[1] = (UInt)floor(65536.0 * dLambda );238 #endif239 206 } 240 207 … … 298 265 m_costMode = COST_STANDARD_LOSSY; 299 266 300 #if RExt__HIGH_BIT_DEPTH_SUPPORT 301 m_dCost = 0; 302 #else 303 m_uiCost = 0; 304 #endif 267 m_motionLambda = 0; 305 268 m_iCostScale = 0; 306 269 … … 370 333 // initialize 371 334 rcDistParam.iSubShift = 0; 335 rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); 372 336 } 373 337 374 338 // Setting the Distortion Parameter for Inter (ME) 375 Void TComRdCost::setDistParam( TComPattern* pcPatternKey,Pel* piRefY, Int iRefStride, DistParam& rcDistParam )339 Void TComRdCost::setDistParam( const TComPattern* const pcPatternKey, const Pel* piRefY, Int iRefStride, DistParam& rcDistParam ) 376 340 { 377 341 // set Original & Curr Pointer / Stride … … 386 350 rcDistParam.iRows = pcPatternKey->getROIYHeight(); 387 351 rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; 352 rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); 388 353 389 354 if (rcDistParam.iCols == 12) … … 411 376 412 377 // Setting the Distortion Parameter for Inter (subpel ME with step) 413 Void TComRdCost::setDistParam( TComPattern* pcPatternKey,Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME )378 Void TComRdCost::setDistParam( const TComPattern* const pcPatternKey, const Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME ) 414 379 { 415 380 // set Original & Curr Pointer / Stride … … 427 392 rcDistParam.iRows = pcPatternKey->getROIYHeight(); 428 393 394 rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); 395 429 396 // set distortion function 430 397 if ( !bHADME ) … … 459 426 } 460 427 461 Void TComRdCost::setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1,Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard )428 Void TComRdCost::setDistParam( DistParam& rcDP, Int bitDepth, const Pel* p1, Int iStride1, const Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard ) 462 429 { 463 430 rcDP.pOrg = p1; … … 471 438 rcDP.bitDepth = bitDepth; 472 439 rcDP.DistFunc = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ]; 440 rcDP.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); 473 441 #if NH_3D_DBBP 474 442 if( m_bUseMask ) … … 479 447 } 480 448 481 Distortion TComRdCost::calcHAD( Int bitDepth, Pel* pi0, Int iStride0,Pel* pi1, Int iStride1, Int iWidth, Int iHeight )449 Distortion TComRdCost::calcHAD( Int bitDepth, const Pel* pi0, Int iStride0, const Pel* pi1, Int iStride1, Int iWidth, Int iHeight ) 482 450 { 483 451 Distortion uiSum = 0; … … 550 518 551 519 552 Distortion TComRdCost::getDistPart( Int bitDepth, Pel* piCur, Int iCurStride,Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc )520 Distortion TComRdCost::getDistPart( Int bitDepth, const Pel* piCur, Int iCurStride, const Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc ) 553 521 { 554 522 DistParam cDtParam; … … 663 631 UInt TComRdCost::xGetMaskedSSE( DistParam* pcDtParam ) 664 632 { 665 Pel* piOrg = pcDtParam->pOrg;666 Pel* piCur = pcDtParam->pCur;633 const Pel* piOrg = pcDtParam->pOrg; 634 const Pel* piCur = pcDtParam->pCur; 667 635 Int iRows = pcDtParam->iRows; 668 636 Int iCols = pcDtParam->iCols; … … 701 669 #endif 702 670 703 Pel* piOrg = pcDtParam->pOrg;704 Pel* piCur = pcDtParam->pCur;671 const Pel* piOrg = pcDtParam->pOrg; 672 const Pel* piCur = pcDtParam->pCur; 705 673 Int iRows = pcDtParam->iRows; 706 674 Int iCols = pcDtParam->iCols; … … 729 697 UInt TComRdCost::xGetMaskedVSD( DistParam* pcDtParam ) 730 698 { 731 Pel* piOrg = pcDtParam->pOrg;732 Pel* piCur = pcDtParam->pCur;733 Pel* piVirRec = pcDtParam->pVirRec;734 Pel* piVirOrg = pcDtParam->pVirOrg;699 const Pel* piOrg = pcDtParam->pOrg; 700 const Pel* piCur = pcDtParam->pCur; 701 const Pel* piVirRec = pcDtParam->pVirRec; 702 const Pel* piVirOrg = pcDtParam->pVirOrg; 735 703 Int iRows = pcDtParam->iRows; 736 704 Int iCols = pcDtParam->iCols; … … 786 754 const Pel* piOrg = pcDtParam->pOrg; 787 755 const Pel* piCur = pcDtParam->pCur; 788 Int iRows = pcDtParam->iRows;789 Int iCols = pcDtParam->iCols;790 Int iStrideCur = pcDtParam->iStrideCur;791 Int iStrideOrg = pcDtParam->iStrideOrg;756 const Int iCols = pcDtParam->iCols; 757 const Int iStrideCur = pcDtParam->iStrideCur; 758 const Int iStrideOrg = pcDtParam->iStrideOrg; 759 const UInt distortionShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8); 792 760 793 761 Distortion uiSum = 0; 794 762 795 for( ; iRows != 0; iRows-- )763 for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- ) 796 764 { 797 765 for (Int n = 0; n < iCols; n++ ) … … 799 767 uiSum += abs( piOrg[n] - piCur[n] ); 800 768 } 801 piOrg += iStrideOrg; 802 piCur += iStrideCur; 803 } 804 805 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 769 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift )) 770 { 771 return ( uiSum >> distortionShift ); 772 } 773 piOrg += iStrideOrg; 774 piCur += iStrideCur; 775 } 776 777 return ( uiSum >> distortionShift ); 806 778 } 807 779 … … 1403 1375 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 1404 1376 } 1405 Pel* piOrg = pcDtParam->pOrg;1406 Pel* piCur = pcDtParam->pCur;1377 const Pel* piOrg = pcDtParam->pOrg; 1378 const Pel* piCur = pcDtParam->pCur; 1407 1379 Int iRows = pcDtParam->iRows; 1408 1380 Int iCols = pcDtParam->iCols; … … 1451 1423 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 1452 1424 } 1453 Pel* piOrg = pcDtParam->pOrg;1454 Pel* piCur = pcDtParam->pCur;1425 const Pel* piOrg = pcDtParam->pOrg; 1426 const Pel* piCur = pcDtParam->pCur; 1455 1427 Int iRows = pcDtParam->iRows; 1456 1428 Int iSubShift = pcDtParam->iSubShift; … … 1508 1480 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 1509 1481 } 1510 Pel* piOrg = pcDtParam->pOrg;1511 Pel* piCur = pcDtParam->pCur;1482 const Pel* piOrg = pcDtParam->pOrg; 1483 const Pel* piCur = pcDtParam->pCur; 1512 1484 Int iRows = pcDtParam->iRows; 1513 1485 Int iSubShift = pcDtParam->iSubShift; … … 1577 1549 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 1578 1550 } 1579 Pel* piOrg = pcDtParam->pOrg;1580 Pel* piCur = pcDtParam->pCur;1551 const Pel* piOrg = pcDtParam->pOrg; 1552 const Pel* piCur = pcDtParam->pCur; 1581 1553 Int iRows = pcDtParam->iRows; 1582 1554 Int iSubShift = pcDtParam->iSubShift; … … 1670 1642 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 1671 1643 } 1672 Pel* piOrg = pcDtParam->pOrg;1673 Pel* piCur = pcDtParam->pCur;1644 const Pel* piOrg = pcDtParam->pOrg; 1645 const Pel* piCur = pcDtParam->pCur; 1674 1646 Int iRows = pcDtParam->iRows; 1675 1647 Int iSubShift = pcDtParam->iSubShift; … … 1748 1720 UInt TComRdCost::xGetSAD16Nic( DistParam* pcDtParam ) 1749 1721 { 1750 Pel* piOrg = pcDtParam->pOrg;1751 Pel* piCur = pcDtParam->pCur;1722 const Pel* piOrg = pcDtParam->pOrg; 1723 const Pel* piCur = pcDtParam->pCur; 1752 1724 Int iRows = pcDtParam->iRows; 1753 1725 Int iCols = pcDtParam->iCols; … … 1845 1817 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 1846 1818 } 1847 Pel* piOrg = pcDtParam->pOrg;1848 Pel* piCur = pcDtParam->pCur;1819 const Pel* piOrg = pcDtParam->pOrg; 1820 const Pel* piCur = pcDtParam->pCur; 1849 1821 Int iRows = pcDtParam->iRows; 1850 1822 Int iSubShift = pcDtParam->iSubShift; … … 1987 1959 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 1988 1960 } 1989 Pel* piOrg = pcDtParam->pOrg;1990 Pel* piCur = pcDtParam->pCur;1961 const Pel* piOrg = pcDtParam->pOrg; 1962 const Pel* piCur = pcDtParam->pCur; 1991 1963 Int iRows = pcDtParam->iRows; 1992 1964 Int iSubShift = pcDtParam->iSubShift; … … 2104 2076 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 2105 2077 } 2106 Pel* piOrg = pcDtParam->pOrg;2107 Pel* piCur = pcDtParam->pCur;2078 const Pel* piOrg = pcDtParam->pOrg; 2079 const Pel* piCur = pcDtParam->pCur; 2108 2080 Int iRows = pcDtParam->iRows; 2109 2081 Int iSubShift = pcDtParam->iSubShift; … … 2343 2315 } 2344 2316 2345 Pel* piOrg = pcDtParam->pOrg;2346 Pel* piCur = pcDtParam->pCur;2317 const Pel* piOrg = pcDtParam->pOrg; 2318 const Pel* piCur = pcDtParam->pCur; 2347 2319 Int iRows = pcDtParam->iRows; 2348 2320 Int iSubShift = pcDtParam->iSubShift; … … 2879 2851 #if NH_3D_VSO 2880 2852 //SAIT_VSO_EST_A0033 2881 UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec,Pel* pVirOrg, Int iVirStride, Int x, Int y )2853 UInt TComRdCost::getVSDEstimate( Int dDM, const Pel* pOrg, Int iOrgStride, const Pel* pVirRec, const Pel* pVirOrg, Int iVirStride, Int x, Int y ) 2882 2854 { 2883 2855 // change to use bit depth from DistParam struct … … 2894 2866 UInt TComRdCost::xGetVSD( DistParam* pcDtParam ) 2895 2867 { 2896 Pel* piOrg = pcDtParam->pOrg;2897 Pel* piCur = pcDtParam->pCur;2898 Pel* piVirRec = pcDtParam->pVirRec;2899 Pel* piVirOrg = pcDtParam->pVirOrg;2868 const Pel* piOrg = pcDtParam->pOrg; 2869 const Pel* piCur = pcDtParam->pCur; 2870 const Pel* piVirRec = pcDtParam->pVirRec; 2871 const Pel* piVirOrg = pcDtParam->pVirOrg; 2900 2872 Int iRows = pcDtParam->iRows; 2901 2873 Int iCols = pcDtParam->iCols; … … 2925 2897 UInt TComRdCost::xGetVSD4( DistParam* pcDtParam ) 2926 2898 { 2927 Pel* piOrg = pcDtParam->pOrg;2928 Pel* piCur = pcDtParam->pCur;2929 Pel* piVirRec = pcDtParam->pVirRec;2930 Pel* piVirOrg = pcDtParam->pVirOrg;2899 const Pel* piOrg = pcDtParam->pOrg; 2900 const Pel* piCur = pcDtParam->pCur; 2901 const Pel* piVirRec = pcDtParam->pVirRec; 2902 const Pel* piVirOrg = pcDtParam->pVirOrg; 2931 2903 Int iRows = pcDtParam->iRows; 2932 2904 Int iStrideOrg = pcDtParam->iStrideOrg; … … 2955 2927 UInt TComRdCost::xGetVSD8( DistParam* pcDtParam ) 2956 2928 { 2957 Pel* piOrg = pcDtParam->pOrg;2958 Pel* piCur = pcDtParam->pCur;2959 Pel* piVirRec = pcDtParam->pVirRec;2960 Pel* piVirOrg = pcDtParam->pVirOrg;2929 const Pel* piOrg = pcDtParam->pOrg; 2930 const Pel* piCur = pcDtParam->pCur; 2931 const Pel* piVirRec = pcDtParam->pVirRec; 2932 const Pel* piVirOrg = pcDtParam->pVirOrg; 2961 2933 Int iRows = pcDtParam->iRows; 2962 2934 Int iStrideOrg = pcDtParam->iStrideOrg; … … 2985 2957 UInt TComRdCost::xGetVSD16( DistParam* pcDtParam ) 2986 2958 { 2987 Pel* piOrg = pcDtParam->pOrg;2988 Pel* piCur = pcDtParam->pCur;2989 Pel* piVirRec = pcDtParam->pVirRec;2990 Pel* piVirOrg = pcDtParam->pVirOrg;2959 const Pel* piOrg = pcDtParam->pOrg; 2960 const Pel* piCur = pcDtParam->pCur; 2961 const Pel* piVirRec = pcDtParam->pVirRec; 2962 const Pel* piVirOrg = pcDtParam->pVirOrg; 2991 2963 Int iRows = pcDtParam->iRows; 2992 2964 Int iStrideOrg = pcDtParam->iStrideOrg; … … 3015 2987 UInt TComRdCost::xGetVSD16N( DistParam* pcDtParam ) 3016 2988 { 3017 Pel* piOrg = pcDtParam->pOrg;3018 Pel* piCur = pcDtParam->pCur;3019 Pel* piVirRec = pcDtParam->pVirRec;3020 Pel* piVirOrg = pcDtParam->pVirOrg;2989 const Pel* piOrg = pcDtParam->pOrg; 2990 const Pel* piCur = pcDtParam->pCur; 2991 const Pel* piVirRec = pcDtParam->pVirRec; 2992 const Pel* piVirOrg = pcDtParam->pVirOrg; 3021 2993 Int iRows = pcDtParam->iRows; 3022 2994 Int iCols = pcDtParam->iCols; … … 3049 3021 UInt TComRdCost::xGetVSD32( DistParam* pcDtParam ) 3050 3022 { 3051 Pel* piOrg = pcDtParam->pOrg;3052 Pel* piCur = pcDtParam->pCur;3053 Pel* piVirRec = pcDtParam->pVirRec;3054 Pel* piVirOrg = pcDtParam->pVirOrg;3023 const Pel* piOrg = pcDtParam->pOrg; 3024 const Pel* piCur = pcDtParam->pCur; 3025 const Pel* piVirRec = pcDtParam->pVirRec; 3026 const Pel* piVirOrg = pcDtParam->pVirOrg; 3055 3027 Int iRows = pcDtParam->iRows; 3056 3028 Int iStrideOrg = pcDtParam->iStrideOrg; … … 3079 3051 UInt TComRdCost::xGetVSD64( DistParam* pcDtParam ) 3080 3052 { 3081 Pel* piOrg = pcDtParam->pOrg;3082 Pel* piCur = pcDtParam->pCur;3083 Pel* piVirRec = pcDtParam->pVirRec;3084 Pel* piVirOrg = pcDtParam->pVirOrg;3053 const Pel* piOrg = pcDtParam->pOrg; 3054 const Pel* piCur = pcDtParam->pCur; 3055 const Pel* piVirRec = pcDtParam->pVirRec; 3056 const Pel* piVirOrg = pcDtParam->pVirOrg; 3085 3057 Int iRows = pcDtParam->iRows; 3086 3058 Int iStrideOrg = pcDtParam->iStrideOrg; … … 3113 3085 // -------------------------------------------------------------------------------------------------------------------- 3114 3086 3115 Distortion TComRdCost::xCalcHADs2x2( Pel *piOrg,Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep )3087 Distortion TComRdCost::xCalcHADs2x2( const Pel *piOrg, const Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 3116 3088 { 3117 3089 Distortion satd = 0; … … 3135 3107 } 3136 3108 3137 Distortion TComRdCost::xCalcHADs4x4( Pel *piOrg,Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep )3109 Distortion TComRdCost::xCalcHADs4x4( const Pel *piOrg, const Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 3138 3110 { 3139 3111 Int k; … … 3231 3203 } 3232 3204 3233 Distortion TComRdCost::xCalcHADs8x8( Pel *piOrg,Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep )3205 Distortion TComRdCost::xCalcHADs8x8( const Pel *piOrg, const Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 3234 3206 { 3235 3207 Int k, i, j, jj; … … 3348 3320 #endif 3349 3321 3350 Pel* piOrg= pcDtParam->pOrg;3351 Pel* piCur= pcDtParam->pCur;3352 Int iRows= pcDtParam->iRows;3353 Int iCols= pcDtParam->iCols;3354 Int iStrideCur = pcDtParam->iStrideCur;3355 Int iStrideOrg = pcDtParam->iStrideOrg;3356 Int iStep= pcDtParam->iStep;3322 const Pel* piOrg = pcDtParam->pOrg; 3323 const Pel* piCur = pcDtParam->pCur; 3324 const Int iRows = pcDtParam->iRows; 3325 const Int iCols = pcDtParam->iCols; 3326 const Int iStrideCur = pcDtParam->iStrideCur; 3327 const Int iStrideOrg = pcDtParam->iStrideOrg; 3328 const Int iStep = pcDtParam->iStep; 3357 3329 3358 3330 Int x, y; … … 3418 3390 return TComRdCostWeightPrediction::xGetHADsw( pcDtParam ); 3419 3391 } 3420 Pel* piOrg = pcDtParam->pOrg; 3421 Pel* piCur = pcDtParam->pCur; 3392 const Pel* piOrg = pcDtParam->pOrg; 3393 const Pel* piCur = pcDtParam->pCur; 3394 3422 3395 Int iRows = pcDtParam->iRows; 3423 3396 Int iCols = pcDtParam->iCols; … … 3449 3422 iDeltaC = (iOrigAvg - iCurAvg)/iRows/iCols; 3450 3423 3424 const Int orgMaxSize = MAX_CU_SIZE*MAX_CU_SIZE; 3425 assert( iRows * iCols <= orgMaxSize ); 3426 3427 Pel orgMinusDeltaDc[ orgMaxSize ]; 3428 Pel* tempOrgMinusDeltaDc = orgMinusDeltaDc; 3429 3451 3430 for ( y=0; y<iRows; y++ ) 3452 3431 { 3453 3432 for ( x=0; x<iCols; x++ ) 3454 3433 { 3455 piOrg[x] -= iDeltaC; 3456 } 3457 piOrg += iStrideOrg; 3458 } 3434 tempOrgMinusDeltaDc[x] = (piOrg[x] - iDeltaC); 3435 } 3436 piOrg += iStrideOrg; 3437 tempOrgMinusDeltaDc += iStrideOrg; 3438 } 3439 3440 tempOrgMinusDeltaDc = orgMinusDeltaDc; 3459 3441 3460 3442 piOrg = pcDtParam->pOrg; … … 3472 3454 for ( x=0; x<iCols; x+= 8 ) 3473 3455 { 3474 uiSum += xCalcHADs8x8( & piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3456 uiSum += xCalcHADs8x8( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3475 3457 } 3476 piOrg+= iOffsetOrg;3477 piCur += iOffsetCur;3458 tempOrgMinusDeltaDc += iOffsetOrg; 3459 piCur += iOffsetCur; 3478 3460 } 3479 3461 } … … 3487 3469 for ( x=0; x<iCols; x+= 16 ) 3488 3470 { 3489 uiSum += xCalcHADs16x4( & piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3471 uiSum += xCalcHADs16x4( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3490 3472 } 3491 piOrg+= iOffsetOrg;3492 piCur += iOffsetCur;3473 tempOrgMinusDeltaDc += iOffsetOrg; 3474 piCur += iOffsetCur; 3493 3475 } 3494 3476 } … … 3501 3483 for ( x=0; x<iCols; x+= 4 ) 3502 3484 { 3503 uiSum += xCalcHADs4x16( & piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3485 uiSum += xCalcHADs4x16( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3504 3486 } 3505 piOrg+= iOffsetOrg;3506 piCur += iOffsetCur;3487 tempOrgMinusDeltaDc += iOffsetOrg; 3488 piCur += iOffsetCur; 3507 3489 } 3508 3490 } … … 3517 3499 for ( x=0; x<iCols; x+= 4 ) 3518 3500 { 3519 uiSum += xCalcHADs4x4( & piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3501 uiSum += xCalcHADs4x4( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3520 3502 } 3521 piOrg+= iOffsetOrg;3522 piCur += iOffsetCur;3503 tempOrgMinusDeltaDc += iOffsetOrg; 3504 piCur += iOffsetCur; 3523 3505 } 3524 3506 } … … 3531 3513 for ( x=0; x<iCols; x+=2 ) 3532 3514 { 3533 uiSum += xCalcHADs2x2( & piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3515 uiSum += xCalcHADs2x2( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 3534 3516 } 3535 piOrg+= iOffsetOrg;3536 piCur += iOffsetCur;3517 tempOrgMinusDeltaDc += iOffsetOrg; 3518 piCur += iOffsetCur; 3537 3519 } 3538 3520 } … … 3540 3522 { 3541 3523 assert(false); 3542 }3543 3544 piOrg = pcDtParam->pOrg;3545 3546 for ( y=0; y<iRows; y++ )3547 {3548 for ( x=0; x<iCols; x++ )3549 {3550 piOrg[x] += iDeltaC;3551 }3552 piOrg += iStrideOrg;3553 3524 } 3554 3525 -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComRdCost.h
r1313 r1360 81 81 { 82 82 public: 83 Pel*pOrg;84 Pel*pCur;83 const Pel* pOrg; 84 const Pel* pCur; 85 85 Int iStrideOrg; 86 86 Int iStrideCur; … … 104 104 105 105 Bool bApplyWeight; // whether weighted prediction is used or not 106 WPScalingParam *wpCur; // weighted prediction scaling parameters for current ref 106 Bool bIsBiPred; 107 108 const WPScalingParam *wpCur; // weighted prediction scaling parameters for current ref 107 109 ComponentID compIdx; 110 Distortion m_maximumDistortionForEarlyExit; /// During cost calculations, if distortion exceeds this value, cost calculations may early-terminate. 108 111 109 112 // (vertical) subsampling shift (for reducing complexity) … … 112 115 113 116 DistParam() 114 { 115 pOrg = NULL; 116 pCur = NULL; 117 iStrideOrg = 0; 118 iStrideCur = 0; 119 iRows = 0; 120 iCols = 0; 121 iStep = 1; 122 DistFunc = NULL; 123 iSubShift = 0; 124 bitDepth = 0; 125 #if NH_3D_VSO 126 // SAIT_VSO_EST_A0033 127 pVirRec = NULL; 128 pVirOrg = NULL; 129 iStrideVir = 0; 130 #endif 131 #if NH_3D_SDC_INTER 132 bUseSDCMRSAD = false; 133 #endif 134 } 117 : pOrg(NULL), 118 pCur(NULL), 119 iStrideOrg(0), 120 iStrideCur(0), 121 iRows(0), 122 iCols(0), 123 iStep(1), 124 DistFunc(NULL), 125 bitDepth(0), 126 bApplyWeight(false), 127 bIsBiPred(false), 128 wpCur(NULL), 129 compIdx(MAX_NUM_COMPONENT), 130 m_maximumDistortionForEarlyExit(std::numeric_limits<Distortion>::max()), 131 iSubShift(0) 132 { } 135 133 }; 136 134 … … 146 144 Double m_dLambda; 147 145 Double m_sqrtLambda; 148 #if RExt__HIGH_BIT_DEPTH_SUPPORT149 146 Double m_dLambdaMotionSAD[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/]; 150 147 Double m_dLambdaMotionSSE[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/]; 151 #else152 UInt m_uiLambdaMotionSAD[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/];153 UInt m_uiLambdaMotionSSE[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/];154 #endif155 148 Double m_dFrameLambda; 156 149 #if NH_3D_VSO … … 161 154 // for motion cost 162 155 TComMv m_mvPredictor; 163 #if RExt__HIGH_BIT_DEPTH_SUPPORT 164 Double m_dCost; 165 #else 166 UInt m_uiCost; 167 #endif 156 Double m_motionLambda; 168 157 Int m_iCostScale; 169 158 #if NH_3D_DBBP … … 175 164 virtual ~TComRdCost(); 176 165 #if NH_3D_VSO 177 Double calcRdCost ( UInt uiBits, DistuiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );178 Double calcRdCost 64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag = false, DFunc eDFunc= DF_DEFAULT );166 Double calcRdCost64( UInt64 uiBits , Dist64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 167 Double calcRdCost( Double numBits, Dist intDistortion, DFunc eDFunc = DF_DEFAULT ); 179 168 #else 180 Double calcRdCost ( UInt uiBits, Distortion uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );181 Double calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 182 #endif 169 Double calcRdCost( Double numBits, Double distortion, DFunc eDFunc = DF_DEFAULT ); 170 #endif 171 183 172 184 173 Void setDistortionWeight ( const ComponentID compID, const Double distortionWeight ) { m_distortionWeight[compID] = distortionWeight; } … … 202 191 203 192 Void setDistParam( UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc, DistParam& rcDistParam ); 204 Void setDistParam( TComPattern* pcPatternKey,Pel* piRefY, Int iRefStride, DistParam& rcDistParam );205 Void setDistParam( TComPattern* pcPatternKey,Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false );206 Void setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1,Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false );193 Void setDistParam( const TComPattern* const pcPatternKey, const Pel* piRefY, Int iRefStride, DistParam& rcDistParam ); 194 Void setDistParam( const TComPattern* const pcPatternKey, const Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false ); 195 Void setDistParam( DistParam& rcDP, Int bitDepth, const Pel* p1, Int iStride1, const Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false ); 207 196 208 197 #if NH_3D_DBBP … … 210 199 #endif 211 200 212 Distortion calcHAD(Int bitDepth, Pel* pi0, Int iStride0,Pel* pi1, Int iStride1, Int iWidth, Int iHeight );201 Distortion calcHAD(Int bitDepth, const Pel* pi0, Int iStride0, const Pel* pi1, Int iStride1, Int iWidth, Int iHeight ); 213 202 214 203 #if NH_3D_ENC_DEPTH … … 218 207 // for motion cost 219 208 static UInt xGetExpGolombNumberOfBits( Int iVal ); 220 #if RExt__HIGH_BIT_DEPTH_SUPPORT 221 Void getMotionCost( Bool bSad, Int iAdd, Bool bIsTransquantBypass ) { m_dCost = (bSad ? m_dLambdaMotionSAD[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING) ?1:0] + iAdd : m_dLambdaMotionSSE[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING)?1:0] + iAdd); } 222 #else 223 Void getMotionCost( Bool bSad, Int iAdd, Bool bIsTransquantBypass ) { m_uiCost = (bSad ? m_uiLambdaMotionSAD[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING) ?1:0] + iAdd : m_uiLambdaMotionSSE[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING)?1:0] + iAdd); } 224 #endif 209 Void selectMotionLambda( Bool bSad, Int iAdd, Bool bIsTransquantBypass ) { m_motionLambda = (bSad ? m_dLambdaMotionSAD[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING) ?1:0] + iAdd : m_dLambdaMotionSSE[(bIsTransquantBypass && m_costMode==COST_MIXED_LOSSLESS_LOSSY_CODING)?1:0] + iAdd); } 225 210 Void setPredictor( TComMv& rcMv ) 226 211 { … … 228 213 } 229 214 Void setCostScale( Int iCostScale ) { m_iCostScale = iCostScale; } 230 __inline Distortion getCost( Int x, Int y ) 215 Distortion getCost( UInt b ) { return Distortion(( m_motionLambda * b ) / 65536.0); } 216 Distortion getCostOfVectorWithPredictor( const Int x, const Int y ) 231 217 { 232 #if RExt__HIGH_BIT_DEPTH_SUPPORT 233 return Distortion((m_dCost * getBits(x, y)) / 65536.0); 234 #else 235 return m_uiCost * getBits(x, y) >> 16; 236 #endif 218 return Distortion((m_motionLambda * getBitsOfVectorWithPredictor(x, y)) / 65536.0); 237 219 } 238 #if RExt__HIGH_BIT_DEPTH_SUPPORT 239 Distortion getCost( UInt b ) { return Distortion(( m_dCost * b ) / 65536.0); } 240 #else 241 Distortion getCost( UInt b ) { return ( m_uiCost * b ) >> 16; } 242 #endif 243 UInt getBits( Int x, Int y ) 220 UInt getBitsOfVectorWithPredictor( const Int x, const Int y ) 244 221 { 245 222 return xGetExpGolombNumberOfBits((x << m_iCostScale) - m_mvPredictor.getHor()) … … 299 276 300 277 static Distortion xGetHADs ( DistParam* pcDtParam ); 301 static Distortion xCalcHADs2x2 ( Pel *piOrg,Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );302 static Distortion xCalcHADs4x4 ( Pel *piOrg,Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );303 static Distortion xCalcHADs8x8 ( Pel *piOrg,Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );278 static Distortion xCalcHADs2x2 ( const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 279 static Distortion xCalcHADs4x4 ( const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 280 static Distortion xCalcHADs8x8 ( const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 304 281 #if NH_3D_DBBP 305 282 static UInt xGetMaskedSSE ( DistParam* pcDtParam ); … … 311 288 public: 312 289 313 Distortion getDistPart(Int bitDepth, Pel* piCur, Int iCurStride,Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc = DF_SSE );290 Distortion getDistPart(Int bitDepth, const Pel* piCur, Int iCurStride, const Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc = DF_SSE ); 314 291 315 292 #if KWU_RC_MADPRED_E0227 … … 320 297 // SAIT_VSO_EST_A0033 321 298 UInt getDistPartVSD( TComDataCU* pcCu, UInt uiPartOffset, Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHad, DFunc eDFunc = DF_VSD); 322 static UInt getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec,Pel* pVirOrg, Int iVirStride, Int x, Int y );299 static UInt getVSDEstimate( Int dDM, const Pel* pOrg, Int iOrgStride, const Pel* pVirRec, const Pel* pVirOrg, Int iVirStride, Int x, Int y ); 323 300 324 301 private: -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp
r1313 r1360 70 70 const Int shift = wpCur.shift; 71 71 const Int round = wpCur.round; 72 const Int distortionShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 72 73 73 74 Distortion uiSum = 0; 74 75 76 #if !U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING 75 77 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 76 78 { … … 80 82 81 83 uiSum += abs( piOrg[n] - pred ); 84 } 85 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 86 { 87 return uiSum >> distortionShift; 82 88 } 83 89 piOrg += iStrideOrg; … … 86 92 87 93 pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 88 89 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 94 #else 95 // Default weight 96 if (w0 == 1 << shift) 97 { 98 // no offset 99 if (offset == 0) 100 { 101 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 102 { 103 for (Int n = 0; n < iCols; n++ ) 104 { 105 uiSum += abs( piOrg[n] - piCur[n] ); 106 } 107 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 108 { 109 return uiSum >> distortionShift; 110 } 111 piOrg += iStrideOrg; 112 piCur += iStrideCur; 113 } 114 } 115 else 116 { 117 // Lets not clip for the bipredictive case since clipping should be done after 118 // combining both elements. Unfortunately the code uses the suboptimal "subtraction" 119 // method, which is faster but introduces the clipping issue (therefore Bipred is suboptimal). 120 if (pcDtParam->bIsBiPred) 121 { 122 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 123 { 124 for (Int n = 0; n < iCols; n++ ) 125 { 126 uiSum += abs( piOrg[n] - (piCur[n] + offset) ); 127 } 128 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 129 { 130 return uiSum >> distortionShift; 131 } 132 133 piOrg += iStrideOrg; 134 piCur += iStrideCur; 135 } 136 } 137 else 138 { 139 const Pel iMaxValue = (Pel) ((1 << pcDtParam->bitDepth) - 1); 140 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 141 { 142 for (Int n = 0; n < iCols; n++ ) 143 { 144 const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (piCur[n] + offset)) ; 145 146 uiSum += abs( piOrg[n] - pred ); 147 } 148 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 149 { 150 return uiSum >> distortionShift; 151 } 152 piOrg += iStrideOrg; 153 piCur += iStrideCur; 154 } 155 } 156 } 157 } 158 else 159 { 160 // Lets not clip for the bipredictive case since clipping should be done after 161 // combining both elements. Unfortunately the code uses the suboptimal "subtraction" 162 // method, which is faster but introduces the clipping issue (therefore Bipred is suboptimal). 163 if (pcDtParam->bIsBiPred) 164 { 165 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 166 { 167 for (Int n = 0; n < iCols; n++ ) 168 { 169 const Pel pred = ( (w0*piCur[n] + round) >> shift ) + offset ; 170 uiSum += abs( piOrg[n] - pred ); 171 } 172 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 173 { 174 return uiSum >> distortionShift; 175 } 176 177 piOrg += iStrideOrg; 178 piCur += iStrideCur; 179 } 180 } 181 else 182 { 183 const Pel iMaxValue = (Pel) ((1 << pcDtParam->bitDepth) - 1); 184 185 if (offset == 0) 186 { 187 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 188 { 189 for (Int n = 0; n < iCols; n++ ) 190 { 191 const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (( (w0*piCur[n] + round) >> shift ))) ; 192 193 uiSum += abs( piOrg[n] - pred ); 194 } 195 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 196 { 197 return uiSum >> distortionShift; 198 } 199 piOrg += iStrideOrg; 200 piCur += iStrideCur; 201 } 202 } 203 else 204 { 205 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 206 { 207 for (Int n = 0; n < iCols; n++ ) 208 { 209 const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (( (w0*piCur[n] + round) >> shift ) + offset)) ; 210 211 uiSum += abs( piOrg[n] - pred ); 212 } 213 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 214 { 215 return uiSum >> distortionShift; 216 } 217 piOrg += iStrideOrg; 218 piCur += iStrideCur; 219 } 220 } 221 } 222 } 223 //pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 224 #endif 225 226 return uiSum >> distortionShift; 90 227 } 91 228 … … 119 256 Distortion sum = 0; 120 257 258 #if !U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING 121 259 for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- ) 122 260 { … … 132 270 133 271 pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 272 #else 273 if (pcDtParam->bIsBiPred) 274 { 275 for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- ) 276 { 277 for (Int n = 0; n < iCols; n++ ) 278 { 279 const Pel pred = ( (w0*piCur[n] + round) >> shift ) + offset ; 280 const Pel residual = piOrg[n] - pred; 281 sum += ( Distortion(residual) * Distortion(residual) ) >> distortionShift; 282 } 283 piOrg += iStrideOrg; 284 piCur += iStrideCur; 285 } 286 } 287 else 288 { 289 const Pel iMaxValue = (Pel) ((1 << pcDtParam->bitDepth) - 1); 290 291 for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- ) 292 { 293 for (Int n = 0; n < iCols; n++ ) 294 { 295 const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (( (w0*piCur[n] + round) >> shift ) + offset)) ; 296 const Pel residual = piOrg[n] - pred; 297 sum += ( Distortion(residual) * Distortion(residual) ) >> distortionShift; 298 } 299 piOrg += iStrideOrg; 300 piCur += iStrideCur; 301 } 302 } 303 304 //pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 305 #endif 134 306 135 307 return sum; … … 416 588 const ComponentID compIdx = pcDtParam->compIdx; 417 589 assert(compIdx<MAX_NUM_COMPONENT); 418 const WPScalingParam wpCur= pcDtParam->wpCur[compIdx];590 const WPScalingParam &wpCur = pcDtParam->wpCur[compIdx]; 419 591 420 592 Distortion uiSum = 0; -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComRom.cpp
r1321 r1360 47 47 //! \ingroup TLibCommon 48 48 //! \{ 49 const Char* nalUnitTypeToString(NalUnitType type)49 const TChar* nalUnitTypeToString(NalUnitType type) 50 50 { 51 51 switch (type) … … 532 532 // Misc. 533 533 // ==================================================================================================================== 534 Char g_aucConvertToBit [ MAX_CU_SIZE+1 ];534 SChar g_aucConvertToBit [ MAX_CU_SIZE+1 ]; 535 535 #if ENC_DEC_TRACE 536 536 FILE* g_hTrace = NULL; // Set to NULL to open up a file. Set to stdout to use the current output 537 537 const Bool g_bEncDecTraceEnable = true; 538 538 const Bool g_bEncDecTraceDisable = false; 539 Bool g_HLSTraceEnable = false;539 Bool g_HLSTraceEnable = true; 540 540 Bool g_bJustDoIt = false; 541 541 UInt64 g_nSymbolCounter = 0; … … 582 582 const UInt g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ] = {0,1,2,3,4,6,8,12,16,24}; 583 583 const UInt g_uiGroupIdx[ MAX_TU_SIZE ] = {0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9}; 584 const Char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] =584 const TChar *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = 585 585 { 586 586 { … … 617 617 }, 618 618 }; 619 const Char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] =619 const TChar *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = 620 620 { 621 621 { … … 673 673 #if H_MV_ENC_DEC_TRAC 674 674 #if ENC_DEC_TRACE 675 Void tracePSHeader( const Char* psName, Int layerId )675 Void tracePSHeader( const TChar* psName, Int layerId ) 676 676 { 677 677 if ( !g_disableHLSTrace ) … … 727 727 } 728 728 } 729 Void writeToTraceFile( const Char* symbolName, Int val, Bool doIt )729 Void writeToTraceFile( const TChar* symbolName, Int val, Bool doIt ) 730 730 { 731 731 if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt ) … … 749 749 return g_nSymbolCounter; 750 750 } 751 Void writeToTraceFile( const Char* symbolName, Bool doIt )751 Void writeToTraceFile( const TChar* symbolName, Bool doIt ) 752 752 { 753 753 if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt ) -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComRom.h
r1321 r1360 149 149 // Misc. 150 150 // ==================================================================================================================== 151 extern Char g_aucConvertToBit [ MAX_CU_SIZE+1 ]; // from width to log2(width)-2151 extern SChar g_aucConvertToBit [ MAX_CU_SIZE+1 ]; // from width to log2(width)-2 152 152 #if NH_MV 153 153 // Change later … … 206 206 #define D_PRINT_INC_INDENT( b, str ) prinStrIncIndent( b, str ); 207 207 #define D_PRINT_INDENT( b, str ) printStrIndent ( b, str); 208 Void tracePSHeader ( const Char* psName, Int layerId );209 Void writeToTraceFile( const Char* symbolName, Int val, Bool doIt );210 Void writeToTraceFile( const Char* symbolName, Bool doIt );208 Void tracePSHeader ( const TChar* psName, Int layerId ); 209 Void writeToTraceFile( const TChar* symbolName, Int val, Bool doIt ); 210 Void writeToTraceFile( const TChar* symbolName, Bool doIt ); 211 211 UInt64 incSymbolCounter(); 212 212 Void stopAtPos ( Int poc, Int layerId, Int cuPelX, Int cuPelY, Int cuWidth, Int cuHeight ); … … 243 243 #endif 244 244 #endif 245 const Char* nalUnitTypeToString(NalUnitType type); 246 extern const Char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; 247 extern const Char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; 245 const TChar* nalUnitTypeToString(NalUnitType type); 246 247 extern const TChar *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; 248 extern const TChar *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; 248 249 extern const Int g_quantTSDefault4x4[4*4]; 249 250 extern const Int g_quantIntraDefault8x8[8*8]; -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
r1313 r1360 324 324 m_signLineBuf1 = NULL; 325 325 } 326 m_signLineBuf1 = new Char[m_lineBufWidth+1];326 m_signLineBuf1 = new SChar[m_lineBufWidth+1]; 327 327 328 328 if (m_signLineBuf2) … … 331 331 m_signLineBuf2 = NULL; 332 332 } 333 m_signLineBuf2 = new Char[m_lineBufWidth+1];333 m_signLineBuf2 = new SChar[m_lineBufWidth+1]; 334 334 } 335 335 … … 338 338 Int x,y, startX, startY, endX, endY, edgeType; 339 339 Int firstLineStartX, firstLineEndX, lastLineStartX, lastLineEndX; 340 Char signLeft, signRight, signDown;340 SChar signLeft, signRight, signDown; 341 341 342 342 Pel* srcLine = srcBlk; … … 352 352 for (y=0; y< height; y++) 353 353 { 354 signLeft = ( Char)sgn(srcLine[startX] - srcLine[startX-1]);354 signLeft = (SChar)sgn(srcLine[startX] - srcLine[startX-1]); 355 355 for (x=startX; x< endX; x++) 356 356 { 357 signRight = ( Char)sgn(srcLine[x] - srcLine[x+1]);357 signRight = (SChar)sgn(srcLine[x] - srcLine[x+1]); 358 358 edgeType = signRight + signLeft; 359 359 signLeft = -signRight; … … 370 370 { 371 371 offset += 2; 372 Char *signUpLine = m_signLineBuf1;372 SChar *signUpLine = m_signLineBuf1; 373 373 374 374 startY = isAboveAvail ? 0 : 1; … … 383 383 for (x=0; x< width; x++) 384 384 { 385 signUpLine[x] = ( Char)sgn(srcLine[x] - srcLineAbove[x]);385 signUpLine[x] = (SChar)sgn(srcLine[x] - srcLineAbove[x]); 386 386 } 387 387 … … 393 393 for (x=0; x< width; x++) 394 394 { 395 signDown = ( Char)sgn(srcLine[x] - srcLineBelow[x]);395 signDown = (SChar)sgn(srcLine[x] - srcLineBelow[x]); 396 396 edgeType = signDown + signUpLine[x]; 397 397 signUpLine[x]= -signDown; … … 408 408 { 409 409 offset += 2; 410 Char *signUpLine, *signDownLine, *signTmpLine;410 SChar *signUpLine, *signDownLine, *signTmpLine; 411 411 412 412 signUpLine = m_signLineBuf1; … … 420 420 for (x=startX; x< endX+1; x++) 421 421 { 422 signUpLine[x] = ( Char)sgn(srcLineBelow[x] - srcLine[x- 1]);422 signUpLine[x] = (SChar)sgn(srcLineBelow[x] - srcLine[x- 1]); 423 423 } 424 424 … … 444 444 for (x=startX; x<endX; x++) 445 445 { 446 signDown = ( Char)sgn(srcLine[x] - srcLineBelow[x+ 1]);446 signDown = (SChar)sgn(srcLine[x] - srcLineBelow[x+ 1]); 447 447 edgeType = signDown + signUpLine[x]; 448 448 resLine[x] = Clip3<Int>(0, maxSampleValueIncl, srcLine[x] + offset[edgeType]); … … 450 450 signDownLine[x+1] = -signDown; 451 451 } 452 signDownLine[startX] = ( Char)sgn(srcLineBelow[startX] - srcLine[startX-1]);452 signDownLine[startX] = (SChar)sgn(srcLineBelow[startX] - srcLine[startX-1]); 453 453 454 454 signTmpLine = signUpLine; … … 475 475 { 476 476 offset += 2; 477 Char *signUpLine = m_signLineBuf1+1;477 SChar *signUpLine = m_signLineBuf1+1; 478 478 479 479 startX = isLeftAvail ? 0 : 1; … … 484 484 for (x=startX-1; x< endX; x++) 485 485 { 486 signUpLine[x] = ( Char)sgn(srcLineBelow[x] - srcLine[x+1]);486 signUpLine[x] = (SChar)sgn(srcLineBelow[x] - srcLine[x+1]); 487 487 } 488 488 … … 507 507 for(x= startX; x< endX; x++) 508 508 { 509 signDown = ( Char)sgn(srcLine[x] - srcLineBelow[x-1]);509 signDown = (SChar)sgn(srcLine[x] - srcLineBelow[x-1]); 510 510 edgeType = signDown + signUpLine[x]; 511 511 resLine[x] = Clip3<Int>(0, maxSampleValueIncl, srcLine[x] + offset[edgeType]); 512 512 signUpLine[x-1] = -signDown; 513 513 } 514 signUpLine[endX-1] = ( Char)sgn(srcLineBelow[endX-1] - srcLine[endX]);514 signUpLine[endX-1] = (SChar)sgn(srcLineBelow[endX-1] - srcLine[endX]); 515 515 srcLine += srcStride; 516 516 resLine += resStride; -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h
r1313 r1360 96 96 97 97 Int m_lineBufWidth; 98 Char* m_signLineBuf1;99 Char* m_signLineBuf2;98 SChar* m_signLineBuf1; 99 SChar* m_signLineBuf2; 100 100 ChromaFormat m_chromaFormatIDC; 101 101 private: -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComSlice.cpp
r1321 r1360 452 452 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr ) 453 453 { 454 if (!checkNumPocTotalCurr)455 {456 454 if (m_eSliceType == I_SLICE) 457 455 { … … 459 457 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 460 458 459 if (!checkNumPocTotalCurr) 460 { 461 461 return; 462 462 } 463 464 m_aiNumRefIdx[REF_PIC_LIST_0] = getNumRefIdx(REF_PIC_LIST_0);465 m_aiNumRefIdx[REF_PIC_LIST_1] = getNumRefIdx(REF_PIC_LIST_1);466 463 } 467 464 … … 536 533 if (m_eSliceType == I_SLICE) 537 534 { 538 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));539 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx ));540 541 535 return; 542 536 } … … 545 539 // general tier and level limit: 546 540 assert(numPicTotalCurr <= 8); 547 548 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);549 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);550 541 } 551 542 … … 2767 2758 m_uiSpsMaxLatencyIncreasePlus1[i] = 0; 2768 2759 #else 2769 m_uiMaxLatencyIncrease [i] = 0;2760 m_uiMaxLatencyIncreasePlus1[i] = 0; 2770 2761 #endif 2771 2762 m_uiMaxDecPicBuffering[i] = 1; … … 4545 4536 } 4546 4537 4547 Bool TComScalingList::xParseScalingList( Char* pchFile)4538 Bool TComScalingList::xParseScalingList(const std::string &fileName) 4548 4539 { 4549 4540 static const Int LINE_SIZE=1024; 4550 4541 FILE *fp = NULL; 4551 Char line[LINE_SIZE];4552 4553 if ( pchFile == NULL)4542 TChar line[LINE_SIZE]; 4543 4544 if (fileName.empty()) 4554 4545 { 4555 4546 fprintf(stderr, "Error: no scaling list file specified. Help on scaling lists being output\n"); … … 4560 4551 return true; 4561 4552 } 4562 else if ((fp = fopen( pchFile,"r")) == (FILE*)NULL)4563 { 4564 fprintf(stderr, "Error: cannot open scaling list file %s for reading\n", pchFile);4553 else if ((fp = fopen(fileName.c_str(),"r")) == (FILE*)NULL) 4554 { 4555 fprintf(stderr, "Error: cannot open scaling list file %s for reading\n", fileName.c_str()); 4565 4556 return true; 4566 4557 } … … 4590 4581 while ((!feof(fp)) && (!bFound)) 4591 4582 { 4592 Char *ret = fgets(line, LINE_SIZE, fp);4593 Char *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType[sizeIdc][listIdc]);4583 TChar *ret = fgets(line, LINE_SIZE, fp); 4584 TChar *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType[sizeIdc][listIdc]); 4594 4585 // This could be a match against the DC string as well, so verify it isn't 4595 4586 if (findNamePosition!= NULL && (MatrixType_DC[sizeIdc][listIdc]==NULL || strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL)) … … 4600 4591 if (!bFound) 4601 4592 { 4602 fprintf(stderr, "Error: cannot find Matrix %s from scaling list file %s\n", MatrixType[sizeIdc][listIdc], pchFile);4593 fprintf(stderr, "Error: cannot find Matrix %s from scaling list file %s\n", MatrixType[sizeIdc][listIdc], fileName.c_str()); 4603 4594 return true; 4604 4595 } … … 4609 4600 if (fscanf(fp, "%d,", &data)!=1) 4610 4601 { 4611 fprintf(stderr, "Error: cannot read value #%d for Matrix %s from scaling list file %s at file position %ld\n", i, MatrixType[sizeIdc][listIdc], pchFile, ftell(fp));4602 fprintf(stderr, "Error: cannot read value #%d for Matrix %s from scaling list file %s at file position %ld\n", i, MatrixType[sizeIdc][listIdc], fileName.c_str(), ftell(fp)); 4612 4603 return true; 4613 4604 } 4614 4605 if (data<0 || data>255) 4615 4606 { 4616 fprintf(stderr, "Error: QMatrix entry #%d of value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", i, data, MatrixType[sizeIdc][listIdc], pchFile, ftell(fp));4607 fprintf(stderr, "Error: QMatrix entry #%d of value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", i, data, MatrixType[sizeIdc][listIdc], fileName.c_str(), ftell(fp)); 4617 4608 return true; 4618 4609 } … … 4630 4621 while ((!feof(fp)) && (!bFound)) 4631 4622 { 4632 Char *ret = fgets(line, LINE_SIZE, fp);4633 Char *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType_DC[sizeIdc][listIdc]);4623 TChar *ret = fgets(line, LINE_SIZE, fp); 4624 TChar *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType_DC[sizeIdc][listIdc]); 4634 4625 if (findNamePosition!= NULL) 4635 4626 { … … 4640 4631 if (!bFound) 4641 4632 { 4642 fprintf(stderr, "Error: cannot find DC Matrix %s from scaling list file %s\n", MatrixType_DC[sizeIdc][listIdc], pchFile);4633 fprintf(stderr, "Error: cannot find DC Matrix %s from scaling list file %s\n", MatrixType_DC[sizeIdc][listIdc], fileName.c_str()); 4643 4634 return true; 4644 4635 } … … 4647 4638 if (fscanf(fp, "%d,", &data)!=1) 4648 4639 { 4649 fprintf(stderr, "Error: cannot read DC %s from scaling list file %s at file position %ld\n", MatrixType_DC[sizeIdc][listIdc], pchFile, ftell(fp));4640 fprintf(stderr, "Error: cannot read DC %s from scaling list file %s at file position %ld\n", MatrixType_DC[sizeIdc][listIdc], fileName.c_str(), ftell(fp)); 4650 4641 return true; 4651 4642 } 4652 4643 if (data<0 || data>255) 4653 4644 { 4654 fprintf(stderr, "Error: DC value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", data, MatrixType[sizeIdc][listIdc], pchFile, ftell(fp));4645 fprintf(stderr, "Error: DC value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", data, MatrixType[sizeIdc][listIdc], fileName.c_str(), ftell(fp)); 4655 4646 return true; 4656 4647 } -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComSlice.h
r1321 r1360 292 292 Void checkDcOfMatrix(); 293 293 Void processRefMatrix(UInt sizeId, UInt listId , UInt refListId ); 294 Bool xParseScalingList( Char* pchFile);294 Bool xParseScalingList(const std::string &fileName); 295 295 #if NH_MV 296 296 Void inferFrom ( const TComScalingList& srcScLi ); … … 1426 1426 #endif 1427 1427 1428 template <typename T, typename S, typename U> Void xPrintArray( const Char* name, Int numElemDim1, U idx, S numElemDim2, T vec, Bool printNumber, Bool printIdx = true ) const1428 template <typename T, typename S, typename U> Void xPrintArray( const TChar* name, Int numElemDim1, U idx, S numElemDim2, T vec, Bool printNumber, Bool printIdx = true ) const 1429 1429 { 1430 1430 std::cout << std::endl; … … 1955 1955 #if NH_MV 1956 1956 UInt m_uiSpsMaxLatencyIncreasePlus1[MAX_TLAYER]; 1957 // Calling a member m_uiMaxLatencyIncrease although it is m_uiMaxLatencyIncreasePlus1 is really bad style.1958 1957 #else 1959 UInt m_uiMaxLatencyIncrease [MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit)1958 UInt m_uiMaxLatencyIncreasePlus1[MAX_TLAYER]; 1960 1959 #endif 1961 1960 … … 2135 2134 Bool getScalingListPresentFlag() const { return m_scalingListPresentFlag; } 2136 2135 Void setScalingListPresentFlag( Bool b ) { m_scalingListPresentFlag = b; } 2137 Void setScalingList( TComScalingList *scalingList);2138 2136 TComScalingList& getScalingList() { return m_scalingList; } 2139 2137 const TComScalingList& getScalingList() const { return m_scalingList; } … … 2146 2144 Int getSpsMaxLatencyPictures( Int i ) const { return ( getSpsMaxNumReorderPics(i) + getSpsMaxLatencyIncreasePlus1(i)-1); } 2147 2145 #else 2148 UInt getMaxLatencyIncrease (UInt tlayer) const { return m_uiMaxLatencyIncrease[tlayer];}2149 Void setMaxLatencyIncrease ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;}2146 UInt getMaxLatencyIncreasePlus1(UInt tlayer) const { return m_uiMaxLatencyIncreasePlus1[tlayer]; } 2147 Void setMaxLatencyIncreasePlus1( UInt ui , UInt tlayer) { m_uiMaxLatencyIncreasePlus1[tlayer] = ui; } 2150 2148 #endif 2151 2149 … … 2166 2164 const TComSPSRExt& getSpsRangeExtension() const { return m_spsRangeExtension; } 2167 2165 TComSPSRExt& getSpsRangeExtension() { return m_spsRangeExtension; } 2168 2169 // Sequence parameter set range extension syntax2170 // WAS: getUseResidualRotation and setUseResidualRotation2171 // Now getSpsRangeExtension().getTransformSkipRotationEnabledFlag and getSpsRangeExtension().setTransformSkipRotationEnabledFlag2172 2173 // WAS: getUseSingleSignificanceMapContext and setUseSingleSignificanceMapContext2174 // Now: getSpsRangeExtension().getTransformSkipContextEnabledFlag and getSpsRangeExtension().setTransformSkipContextEnabledFlag2175 2176 // WAS: getUseResidualDPCM and setUseResidualDPCM2177 // Now: getSpsRangeExtension().getRdpcmEnabledFlag and getSpsRangeExtension().setRdpcmEnabledFlag and2178 2179 // WAS: getUseExtendedPrecision and setUseExtendedPrecision2180 // Now: getSpsRangeExtension().getExtendedPrecisionProcessingFlag and getSpsRangeExtension().setExtendedPrecisionProcessingFlag2181 2182 // WAS: getDisableIntraReferenceSmoothing and setDisableIntraReferenceSmoothing2183 // Now: getSpsRangeExtension().getIntraSmoothingDisabledFlag and getSpsRangeExtension().setIntraSmoothingDisabledFlag2184 2185 // WAS: getUseHighPrecisionPredictionWeighting and setUseHighPrecisionPredictionWeighting2186 // Now: getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag and getSpsRangeExtension().setHighPrecisionOffsetsEnabledFlag2187 2188 // WAS: getUseGolombRiceParameterAdaptation and setUseGolombRiceParameterAdaptation2189 // Now: getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag and getSpsRangeExtension().setPersistentRiceAdaptationEnabledFlag2190 2191 // WAS: getAlignCABACBeforeBypass and setAlignCABACBeforeBypass2192 // Now: getSpsRangeExtension().getCabacBypassAlignmentEnabledFlag and getSpsRangeExtension().setCabacBypassAlignmentEnabledFlag2193 2194 2166 2195 2167 #if NH_MV … … 2299 2271 Void setListEntryL0( Int i, Int val ) { m_RefPicSetIdxL0[i] = val; } 2300 2272 Void setListEntryL1( Int i, Int val ) { m_RefPicSetIdxL1[i] = val; } 2301 2302 2303 #endif 2273 #endif 2274 2304 2275 }; 2276 2305 2277 2306 2278 /// PPS RExt class … … 2557 2529 TComPPSRExt& getPpsRangeExtension() { return m_ppsRangeExtension; } 2558 2530 2559 // WAS: getTransformSkipLog2MaxSize and setTransformSkipLog2MaxSize2560 // Now: getPpsRangeExtension().getLog2MaxTransformSkipBlockSize and getPpsRangeExtension().setLog2MaxTransformSkipBlockSize2561 2562 // WAS: getUseCrossComponentPrediction and setUseCrossComponentPrediction2563 // Now: getPpsRangeExtension().getCrossComponentPredictionEnabledFlag and getPpsRangeExtension().setCrossComponentPredictionEnabledFlag2564 2565 // WAS: clearChromaQpAdjTable2566 // Now: getPpsRangeExtension().clearChromaQpOffsetList2567 2568 // WAS: getMaxCuChromaQpAdjDepth and setMaxCuChromaQpAdjDepth2569 // Now: getPpsRangeExtension().getDiffCuChromaQpOffsetDepth and getPpsRangeExtension().setDiffCuChromaQpOffsetDepth2570 2571 // WAS: getChromaQpAdjTableSize2572 // Now: getPpsRangeExtension().getChromaQpOffsetListLen2573 2574 // WAS: getChromaQpAdjTableAt and setChromaQpAdjTableAt2575 // Now: getPpsRangeExtension().getChromaQpOffsetListEntry and getPpsRangeExtension().setChromaQpOffsetListEntry2576 2577 // WAS: getSaoOffsetBitShift and setSaoOffsetBitShift2578 // Now: getPpsRangeExtension().getLog2SaoOffsetScale and getPpsRangeExtension().setLog2SaoOffsetScale2579 2580 2531 #if NH_MV 2581 2532 Void setLayerId( Int val ) { m_layerId = val; } … … 2876 2827 Int getPOC() const { return m_iPOC; } 2877 2828 Int getSliceQp() const { return m_iSliceQp; } 2829 Bool getUseWeightedPrediction() const { return( (m_eSliceType==P_SLICE && testWeightPred()) || (m_eSliceType==B_SLICE && testWeightBiPred()) ); } 2878 2830 Bool getDependentSliceSegmentFlag() const { return m_dependentSliceSegmentFlag; } 2879 2831 Void setDependentSliceSegmentFlag(Bool val) { m_dependentSliceSegmentFlag = val; } … … 2892 2844 TComPic* getPic() { return m_pcPic; } 2893 2845 TComPic* getRefPic( RefPicList e, Int iRefIdx) { return m_apcRefPicList[e][iRefIdx]; } 2894 Int getRefPOC( RefPicList e, Int iRefIdx) { return m_aiRefPOCList[e][iRefIdx]; } 2846 const TComPic* getRefPic( RefPicList e, Int iRefIdx) const { return m_apcRefPicList[e][iRefIdx]; } 2847 Int getRefPOC( RefPicList e, Int iRefIdx) const { return m_aiRefPOCList[e][iRefIdx]; } 2895 2848 #if NH_3D 2896 2849 Bool getInCmpPredAvailFlag( ) const { return m_inCmpPredAvailFlag; } … … 3180 3133 3181 3134 Void setEnableTMVPFlag( Bool b ) { m_enableTMVPFlag = b; } 3182 Bool getEnableTMVPFlag() 3135 Bool getEnableTMVPFlag() const { return m_enableTMVPFlag; } 3183 3136 3184 3137 Void setEncCABACTableIdx( SliceType idx ) { m_encCABACTableIdx = idx; } -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp
r1313 r1360 55 55 } 56 56 57 static inline Pel noWeightUnidir( Pel P0, Int round, Int shift, Int offset, Int clipBD) 58 { 59 return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ) + offset, clipBD ); 60 } 61 62 static inline Pel noWeightOffsetUnidir( Pel P0, Int round, Int shift, Int clipBD) 63 { 64 return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ), clipBD ); 65 } 66 67 57 68 // ==================================================================================================================== 58 69 // Class definition … … 154 165 const Int shiftNum = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD)); 155 166 const Int shift = wp0[compID].shift + shiftNum; 156 const Int round = (shift > 0) ? (1<<(shift-1)) : 0;157 167 const UInt iSrc0Stride = pcYuvSrc0->getStride(compID); 158 168 const UInt iDstStride = pcYuvDst->getStride(compID); … … 162 172 const Int iWidth = uiWidth>>csx; 163 173 174 if (w0 != 1 << wp0[compID].shift) 175 { 176 const Int round = (shift > 0) ? (1<<(shift-1)) : 0; 164 177 for (Int y = iHeight-1; y >= 0; y-- ) 165 178 { … … 178 191 pSrc0 += iSrc0Stride; 179 192 pDst += iDstStride; 193 } 194 } 195 else 196 { 197 const Int round = (shiftNum > 0) ? (1<<(shiftNum-1)) : 0; 198 if (offset == 0) 199 { 200 for (Int y = iHeight-1; y >= 0; y-- ) 201 { 202 Int x = iWidth-1; 203 for ( ; x >= 3; ) 204 { 205 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--; 206 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--; 207 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--; 208 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--; 209 } 210 for( ; x >= 0; x--) 211 { 212 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); 213 } 214 pSrc0 += iSrc0Stride; 215 pDst += iDstStride; 216 } 217 } 218 else 219 { 220 for (Int y = iHeight-1; y >= 0; y-- ) 221 { 222 Int x = iWidth-1; 223 for ( ; x >= 3; ) 224 { 225 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--; 226 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--; 227 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--; 228 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--; 229 } 230 for( ; x >= 0; x--) 231 { 232 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); 233 } 234 pSrc0 += iSrc0Stride; 235 pDst += iDstStride; 236 } 237 } 180 238 } 181 239 } … … 197 255 TComSlice *const pcSlice = pcCU->getSlice(); 198 256 const Bool wpBiPred = pcCU->getSlice()->getPPS()->getWPBiPred(); 199 const Bool bBi Dir= (iRefIdx0>=0 && iRefIdx1>=0);200 const Bool bUni Dir = !bBiDir;201 202 if ( bUni Dir|| wpBiPred )257 const Bool bBiPred = (iRefIdx0>=0 && iRefIdx1>=0); 258 const Bool bUniPred = !bBiPred; 259 260 if ( bUniPred || wpBiPred ) 203 261 { // explicit -------------------- 204 262 if ( iRefIdx0 >= 0 ) … … 228 286 const Bool bUseHighPrecisionPredictionWeighting = pcSlice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag(); 229 287 230 if ( bBi Dir)231 { // Bi- Dircase288 if ( bBiPred ) 289 { // Bi-predictive case 232 290 for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ ) 233 291 { … … 248 306 } 249 307 else 250 { // Uni dir308 { // UniPred 251 309 WPScalingParam *const pwp = (iRefIdx0>=0) ? wp0 : wp1 ; 252 310 -
branches/HTM-15.2-dev/source/Lib/TLibCommon/TypeDef.h
r1356 r1360 32 32 */ 33 33 /** \file TypeDef.h 34 \brief Define basic types, new types and enumerations34 \brief Define macros, basic types, new types and enumerations 35 35 */ 36 36 #ifndef __TYPEDEF__ … … 373 373 #define DECODER_CHECK_SUBSTREAM_AND_SLICE_TRAILING_BYTES 1 ///< TODO: integrate this macro into a broader conformance checking system. 374 374 #define T0196_SELECTIVE_RDOQ 1 ///< selective RDOQ 375 #define U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING 1 376 375 377 // ==================================================================================================================== 376 378 // Tool Switches … … 389 391 #define MATRIX_MULT 0 ///< Brute force matrix multiplication instead of partial butterfly 390 392 #define O0043_BEST_EFFORT_DECODING 0 ///< 0 (default) = disable code related to best effort decoding, 1 = enable code relating to best effort decoding [ decode-side only ]. 393 394 #define ME_ENABLE_ROUNDING_OF_MVS 1 ///< 0 (default) = disables rounding of motion vectors when right shifted, 1 = enables rounding 395 391 396 #define RDOQ_CHROMA_LAMBDA 1 ///< F386: weighting of chroma for RDOQ 392 397 // This can be enabled by the makefile … … 394 399 #define RExt__HIGH_BIT_DEPTH_SUPPORT 0 ///< 0 (default) use data type definitions for 8-10 bit video, 1 = use larger data types to allow for up to 16-bit video (originally developed as part of N0188) 395 400 #endif 401 402 #define U0132_TARGET_BITS_SATURATION 1 ///< Rate control with target bits saturation method 403 396 404 // ==================================================================================================================== 397 405 // Derived macros … … 443 451 typedef void Void; 444 452 typedef bool Bool; 445 #ifdef __arm__ 446 typedef signed char Char; 447 #else 448 typedef char Char; 449 #endif 450 typedef unsigned char UChar; 453 454 typedef char TChar; // Used for text/characters 455 typedef signed char SChar; // Signed 8-bit values 456 typedef unsigned char UChar; // Unsigned 8-bit values 451 457 typedef short Short; 452 458 typedef unsigned short UShort; … … 577 583 NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS = 4 578 584 }; 585 586 enum MATRIX_COEFFICIENTS // Table E.5 (Matrix coefficients) 587 { 588 MATRIX_COEFFICIENTS_RGB = 0, 589 MATRIX_COEFFICIENTS_BT709 = 1, 590 MATRIX_COEFFICIENTS_UNSPECIFIED = 2, 591 MATRIX_COEFFICIENTS_RESERVED_BY_ITUISOIEC = 3, 592 MATRIX_COEFFICIENTS_USFCCT47 = 4, 593 MATRIX_COEFFICIENTS_BT601_625 = 5, 594 MATRIX_COEFFICIENTS_BT601_525 = 6, 595 MATRIX_COEFFICIENTS_SMPTE240 = 7, 596 MATRIX_COEFFICIENTS_YCGCO = 8, 597 MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE = 9, 598 MATRIX_COEFFICIENTS_BT2020_CONSTANT_LUMINANCE = 10, 599 }; 600 579 601 enum DeblockEdgeDir 580 602 { … … 713 735 enum MESearchMethod 714 736 { 715 FULL_SEARCH = 0, ///< Full search 716 DIAMOND = 1, ///< Fast search 717 SELECTIVE = 2 ///< Selective search 737 MESEARCH_FULL = 0, 738 MESEARCH_DIAMOND = 1, 739 MESEARCH_SELECTIVE = 2, 740 MESEARCH_DIAMOND_ENHANCED = 3, 741 MESEARCH_NUMBER_OF_METHODS = 4 718 742 }; 719 743 /// coefficient scanning type used in ACS … … 760 784 FIXED_NUMBER_OF_BYTES = 2, ///< Limit maximum number of bytes in a slice / slice segment 761 785 FIXED_NUMBER_OF_TILES = 3, ///< slices / slice segments span an integer number of tiles 762 }; 786 NUMBER_OF_SLICE_CONSTRAINT_MODES = 4 787 }; 788 789 // For use with decoded picture hash SEI messages, generated by encoder. 790 enum HashType 791 { 792 HASHTYPE_MD5 = 0, 793 HASHTYPE_CRC = 1, 794 HASHTYPE_CHECKSUM = 2, 795 HASHTYPE_NONE = 3, 796 NUMBER_OF_HASHTYPES = 4 797 }; 798 763 799 enum SAOMode //mode 764 800 { … … 861 897 COST_MIXED_LOSSLESS_LOSSY_CODING = 3 862 898 }; 899 900 enum WeightedPredictionMethod 901 { 902 WP_PER_PICTURE_WITH_SIMPLE_DC_COMBINED_COMPONENT =0, 903 WP_PER_PICTURE_WITH_SIMPLE_DC_PER_COMPONENT =1, 904 WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT =2, 905 WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING =3, 906 WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION=4 907 }; 908 909 enum FastInterSearchMode 910 { 911 FASTINTERSEARCH_DISABLED = 0, 912 FASTINTERSEARCH_MODE1 = 1, // TODO: assign better names to these. 913 FASTINTERSEARCH_MODE2 = 2, 914 FASTINTERSEARCH_MODE3 = 3 915 }; 916 863 917 enum SPSExtensionFlagIndex 864 918 { -
branches/HTM-15.2-dev/source/Lib/TLibDecoder/SEIread.cpp
r1356 r1360 63 63 #endif 64 64 65 Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const Char *pSymbolName)65 Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName) 66 66 { 67 67 READ_CODE(uiLength, ruiCode, pSymbolName); … … 72 72 } 73 73 74 Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName)74 Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName) 75 75 { 76 76 READ_UVLC(ruiCode, pSymbolName); … … 81 81 } 82 82 83 Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const Char *pSymbolName)83 Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const TChar *pSymbolName) 84 84 { 85 85 READ_SVLC(ruiCode, pSymbolName); … … 90 90 } 91 91 92 Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName)92 Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName) 93 93 { 94 94 READ_FLAG(ruiCode, pSymbolName); … … 99 99 } 100 100 101 Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const Char *pSymbolName) 101 #if NH_MV_SEI 102 Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const TChar *pSymbolName) 102 103 { 103 104 READ_STRING(uiBufSize, pucCode, ruiLength, pSymbolName); … … 107 108 } 108 109 } 109 110 #if NH_MV_SEI111 110 inline Void SEIReader::output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize) 112 111 #else … … 295 294 xParseSEITimeCode((SEITimeCode&) *sei, payloadSize, pDecodedMessageOutputStream); 296 295 break; 297 case SEI::CHROMA_ SAMPLING_FILTER_HINT:298 sei = new SEIChroma SamplingFilterHint;299 xParseSEIChroma SamplingFilterHint((SEIChromaSamplingFilterHint&) *sei, payloadSize/*, sps*/, pDecodedMessageOutputStream);296 case SEI::CHROMA_RESAMPLING_FILTER_HINT: 297 sei = new SEIChromaResamplingFilterHint; 298 xParseSEIChromaResamplingFilterHint((SEIChromaResamplingFilterHint&) *sei, payloadSize, pDecodedMessageOutputStream); 300 299 //} 301 300 break; … … 303 302 sei = new SEIKneeFunctionInfo; 304 303 xParseSEIKneeFunctionInfo((SEIKneeFunctionInfo&) *sei, payloadSize, pDecodedMessageOutputStream); 304 break; 305 case SEI::COLOUR_REMAPPING_INFO: 306 sei = new SEIColourRemappingInfo; 307 xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream); 305 308 break; 306 309 case SEI::MASTERING_DISPLAY_COLOUR_VOLUME: … … 531 534 UInt val; 532 535 sei_read_code( pDecodedMessageOutputStream, 8, val, "hash_type"); 533 sei.method = static_cast< SEIDecodedPictureHash::Method>(val); bytesRead++;534 535 const Char *traceString="\0";536 sei.method = static_cast<HashType>(val); bytesRead++; 537 538 const TChar *traceString="\0"; 536 539 switch (sei.method) 537 540 { 538 case SEIDecodedPictureHash::MD5: traceString="picture_md5"; break;539 case SEIDecodedPictureHash::CRC: traceString="picture_crc"; break;540 case SEIDecodedPictureHash::CHECKSUM: traceString="picture_checksum"; break;541 case HASHTYPE_MD5: traceString="picture_md5"; break; 542 case HASHTYPE_CRC: traceString="picture_crc"; break; 543 case HASHTYPE_CHECKSUM: traceString="picture_checksum"; break; 541 544 default: assert(false); break; 542 545 } … … 1123 1126 } 1124 1127 1125 Void SEIReader::xParseSEIChroma SamplingFilterHint(SEIChromaSamplingFilterHint& sei, UInt payloadSize/*, TComSPS* sps*/, std::ostream *pDecodedMessageOutputStream)1128 Void SEIReader::xParseSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) 1126 1129 { 1127 1130 UInt uiCode; … … 1130 1133 sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "ver_chroma_filter_idc"); sei.m_verChromaFilterIdc = uiCode; 1131 1134 sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "hor_chroma_filter_idc"); sei.m_horChromaFilterIdc = uiCode; 1132 sei_read_flag( pDecodedMessageOutputStream, uiCode, "ver_filtering_ process_flag"); sei.m_verFilteringProcessFlag = uiCode;1135 sei_read_flag( pDecodedMessageOutputStream, uiCode, "ver_filtering_field_processing_flag"); sei.m_verFilteringFieldProcessingFlag = uiCode; 1133 1136 if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1) 1134 1137 { … … 1136 1139 if(sei.m_verChromaFilterIdc == 1) 1137 1140 { 1138 sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_vertical_filters"); sei.m_numVerticalFilters = uiCode; 1139 if(sei.m_numVerticalFilters > 0) 1140 { 1141 sei.m_verTapLengthMinus1 = (Int*)malloc(sei.m_numVerticalFilters * sizeof(Int)); 1142 sei.m_verFilterCoeff = (Int**)malloc(sei.m_numVerticalFilters * sizeof(Int*)); 1143 for(Int i = 0; i < sei.m_numVerticalFilters; i ++) 1144 { 1145 sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "ver_tap_length_minus_1"); sei.m_verTapLengthMinus1[i] = uiCode; 1146 sei.m_verFilterCoeff[i] = (Int*)malloc(sei.m_verTapLengthMinus1[i] * sizeof(Int)); 1147 for(Int j = 0; j < sei.m_verTapLengthMinus1[i]; j ++) 1141 UInt numVerticalFilters; 1142 sei_read_uvlc( pDecodedMessageOutputStream, numVerticalFilters, "num_vertical_filters"); sei.m_verFilterCoeff.resize(numVerticalFilters); 1143 if(numVerticalFilters > 0) 1144 { 1145 for(Int i = 0; i < numVerticalFilters; i++) 1146 { 1147 UInt verTapLengthMinus1; 1148 sei_read_uvlc( pDecodedMessageOutputStream, verTapLengthMinus1, "ver_tap_length_minus_1"); sei.m_verFilterCoeff[i].resize(verTapLengthMinus1+1); 1149 for(Int j = 0; j < (verTapLengthMinus1 + 1); j++) 1148 1150 { 1149 1151 sei_read_svlc( pDecodedMessageOutputStream, sei.m_verFilterCoeff[i][j], "ver_filter_coeff"); … … 1154 1156 if(sei.m_horChromaFilterIdc == 1) 1155 1157 { 1156 sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_horizontal_filters"); sei.m_numHorizontalFilters = uiCode; 1157 if(sei.m_numHorizontalFilters > 0) 1158 { 1159 sei.m_horTapLengthMinus1 = (Int*)malloc(sei.m_numHorizontalFilters * sizeof(Int)); 1160 sei.m_horFilterCoeff = (Int**)malloc(sei.m_numHorizontalFilters * sizeof(Int*)); 1161 for(Int i = 0; i < sei.m_numHorizontalFilters; i ++) 1162 { 1163 sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "hor_tap_length_minus_1"); sei.m_horTapLengthMinus1[i] = uiCode; 1164 sei.m_horFilterCoeff[i] = (Int*)malloc(sei.m_horTapLengthMinus1[i] * sizeof(Int)); 1165 for(Int j = 0; j < sei.m_horTapLengthMinus1[i]; j ++) 1158 UInt numHorizontalFilters; 1159 sei_read_uvlc( pDecodedMessageOutputStream, numHorizontalFilters, "num_horizontal_filters"); sei.m_horFilterCoeff.resize(numHorizontalFilters); 1160 if(numHorizontalFilters > 0) 1161 { 1162 for(Int i = 0; i < numHorizontalFilters; i++) 1163 { 1164 UInt horTapLengthMinus1; 1165 sei_read_uvlc( pDecodedMessageOutputStream, horTapLengthMinus1, "hor_tap_length_minus_1"); sei.m_horFilterCoeff[i].resize(horTapLengthMinus1+1); 1166 for(Int j = 0; j < (horTapLengthMinus1 + 1); j++) 1166 1167 { 1167 1168 sei_read_svlc( pDecodedMessageOutputStream, sei.m_horFilterCoeff[i][j], "hor_filter_coeff"); … … 1199 1200 } 1200 1201 } 1202 1203 Void SEIReader::xParseSEIColourRemappingInfo(SEIColourRemappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) 1204 { 1205 UInt uiVal; 1206 Int iVal; 1207 output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); 1208 1209 sei_read_uvlc( pDecodedMessageOutputStream, uiVal, "colour_remap_id" ); sei.m_colourRemapId = uiVal; 1210 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_cancel_flag" ); sei.m_colourRemapCancelFlag = uiVal; 1211 if( !sei.m_colourRemapCancelFlag ) 1212 { 1213 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_persistence_flag" ); sei.m_colourRemapPersistenceFlag = uiVal; 1214 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_video_signal_info_present_flag" ); sei.m_colourRemapVideoSignalInfoPresentFlag = uiVal; 1215 if ( sei.m_colourRemapVideoSignalInfoPresentFlag ) 1216 { 1217 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_full_range_flag" ); sei.m_colourRemapFullRangeFlag = uiVal; 1218 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_primaries" ); sei.m_colourRemapPrimaries = uiVal; 1219 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_transfer_function" ); sei.m_colourRemapTransferFunction = uiVal; 1220 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_matrix_coefficients" ); sei.m_colourRemapMatrixCoefficients = uiVal; 1221 } 1222 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_input_bit_depth" ); sei.m_colourRemapInputBitDepth = uiVal; 1223 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_bit_depth" ); sei.m_colourRemapBitDepth = uiVal; 1224 1225 for( Int c=0 ; c<3 ; c++ ) 1226 { 1227 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "pre_lut_num_val_minus1[c]" ); sei.m_preLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 1228 sei.m_preLut[c].resize(sei.m_preLutNumValMinus1[c]+1); 1229 if( uiVal> 0 ) 1230 { 1231 for ( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ ) 1232 { 1233 sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapInputBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_coded_value[c][i]" ); sei.m_preLut[c][i].codedValue = uiVal; 1234 sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_target_value[c][i]" ); sei.m_preLut[c][i].targetValue = uiVal; 1235 } 1236 } 1237 else // pre_lut_num_val_minus1[c] == 0 1238 { 1239 sei.m_preLut[c][0].codedValue = 0; 1240 sei.m_preLut[c][0].targetValue = 0; 1241 sei.m_preLut[c][1].codedValue = (1 << sei.m_colourRemapInputBitDepth) - 1 ; 1242 sei.m_preLut[c][1].targetValue = (1 << sei.m_colourRemapBitDepth) - 1 ; 1243 } 1244 } 1245 1246 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_matrix_present_flag" ); sei.m_colourRemapMatrixPresentFlag = uiVal; 1247 if( sei.m_colourRemapMatrixPresentFlag ) 1248 { 1249 sei_read_code( pDecodedMessageOutputStream, 4, uiVal, "log2_matrix_denom" ); sei.m_log2MatrixDenom = uiVal; 1250 for ( Int c=0 ; c<3 ; c++ ) 1251 { 1252 for ( Int i=0 ; i<3 ; i++ ) 1253 { 1254 sei_read_svlc( pDecodedMessageOutputStream, iVal, "colour_remap_coeffs[c][i]" ); sei.m_colourRemapCoeffs[c][i] = iVal; 1255 } 1256 } 1257 } 1258 else // setting default matrix (I3) 1259 { 1260 sei.m_log2MatrixDenom = 10; 1261 for ( Int c=0 ; c<3 ; c++ ) 1262 { 1263 for ( Int i=0 ; i<3 ; i++ ) 1264 { 1265 sei.m_colourRemapCoeffs[c][i] = (c==i) << sei.m_log2MatrixDenom; 1266 } 1267 } 1268 } 1269 for( Int c=0 ; c<3 ; c++ ) 1270 { 1271 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "post_lut_num_val_minus1[c]" ); sei.m_postLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 1272 sei.m_postLut[c].resize(sei.m_postLutNumValMinus1[c]+1); 1273 if( uiVal > 0 ) 1274 { 1275 for ( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ ) 1276 { 1277 sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_coded_value[c][i]" ); sei.m_postLut[c][i].codedValue = uiVal; 1278 sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_target_value[c][i]" ); sei.m_postLut[c][i].targetValue = uiVal; 1279 } 1280 } 1281 else 1282 { 1283 sei.m_postLut[c][0].codedValue = 0; 1284 sei.m_postLut[c][0].targetValue = 0; 1285 sei.m_postLut[c][1].targetValue = (1 << sei.m_colourRemapBitDepth) - 1; 1286 sei.m_postLut[c][1].codedValue = (1 << sei.m_colourRemapBitDepth) - 1; 1287 } 1288 } 1289 } 1290 } 1291 1201 1292 1202 1293 Void SEIReader::xParseSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) -
branches/HTM-15.2-dev/source/Lib/TLibDecoder/SEIread.h
r1356 r1360 93 93 Void xParseSEITempMotionConstraintsTileSets (SEITempMotionConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 94 94 Void xParseSEITimeCode (SEITimeCode& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 95 Void xParseSEIChroma SamplingFilterHint (SEIChromaSamplingFilterHint& sei, UInt payloadSize/*,TComSPS* */,std::ostream *pDecodedMessageOutputStream);95 Void xParseSEIChromaResamplingFilterHint (SEIChromaResamplingFilterHint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 96 96 Void xParseSEIKneeFunctionInfo (SEIKneeFunctionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 97 97 Void xParseSEIMasteringDisplayColourVolume (SEIMasteringDisplayColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 98 Void xParseSEIColourRemappingInfo (SEIColourRemappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 98 99 #if NH_MV 99 100 #if !NH_MV_SEI … … 133 134 #endif 134 135 135 Void sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const Char *pSymbolName);136 Void sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName);137 Void sei_read_svlc(std::ostream *pOS, Int& ruiCode, const Char *pSymbolName);138 Void sei_read_flag(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName);139 Void sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const Char *pSymbolName);136 Void sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName); 137 Void sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName); 138 Void sei_read_svlc(std::ostream *pOS, Int& ruiCode, const TChar *pSymbolName); 139 Void sei_read_flag(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName); 140 Void sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const TChar *pSymbolName); 140 141 #if NH_MV_SEI 141 142 inline Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize); -
branches/HTM-15.2-dev/source/Lib/TLibDecoder/SyntaxElementParser.cpp
r1356 r1360 49 49 #if ENC_DEC_TRACE 50 50 51 Void SyntaxElementParser::xReadCodeTr (UInt length, UInt& rValue, const Char *pSymbolName)51 Void SyntaxElementParser::xReadCodeTr (UInt length, UInt& rValue, const TChar *pSymbolName) 52 52 { 53 53 #if RExt__DECODER_DEBUG_BIT_STATISTICS … … 80 80 } 81 81 82 Void SyntaxElementParser::xReadUvlcTr (UInt& rValue, const Char *pSymbolName)82 Void SyntaxElementParser::xReadUvlcTr (UInt& rValue, const TChar *pSymbolName) 83 83 { 84 84 #if RExt__DECODER_DEBUG_BIT_STATISTICS … … 104 104 } 105 105 106 Void SyntaxElementParser::xReadSvlcTr (Int& rValue, const Char *pSymbolName)106 Void SyntaxElementParser::xReadSvlcTr (Int& rValue, const TChar *pSymbolName) 107 107 { 108 108 #if RExt__DECODER_DEBUG_BIT_STATISTICS … … 128 128 } 129 129 130 Void SyntaxElementParser::xReadFlagTr (UInt& rValue, const Char *pSymbolName)130 Void SyntaxElementParser::xReadFlagTr (UInt& rValue, const TChar *pSymbolName) 131 131 { 132 132 #if RExt__DECODER_DEBUG_BIT_STATISTICS … … 152 152 } 153 153 154 Void SyntaxElementParser::xReadStringTr (UInt buSize, UChar *pValue, UInt& rLength, const Char *pSymbolName) 154 #if NH_MV 155 Void SyntaxElementParser::xReadStringTr (UInt buSize, UChar *pValue, UInt& rLength, const TChar *pSymbolName) 155 156 { 156 157 #if RExt__DECODER_DEBUG_BIT_STATISTICS … … 163 164 fflush ( g_hTrace ); 164 165 } 165 166 #endif 166 167 Void xTraceAccessUnitDelimiter () 167 168 { … … 181 182 // ==================================================================================================================== 182 183 #if RExt__DECODER_DEBUG_BIT_STATISTICS 183 Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& ruiCode, const Char *pSymbolName)184 Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& ruiCode, const TChar *pSymbolName) 184 185 #else 185 186 Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& ruiCode) … … 194 195 195 196 #if RExt__DECODER_DEBUG_BIT_STATISTICS 196 Void SyntaxElementParser::xReadUvlc( UInt& ruiVal, const Char *pSymbolName)197 Void SyntaxElementParser::xReadUvlc( UInt& ruiVal, const TChar *pSymbolName) 197 198 #else 198 199 Void SyntaxElementParser::xReadUvlc( UInt& ruiVal) … … 232 233 233 234 #if RExt__DECODER_DEBUG_BIT_STATISTICS 234 Void SyntaxElementParser::xReadSvlc( Int& riVal, const Char *pSymbolName)235 Void SyntaxElementParser::xReadSvlc( Int& riVal, const TChar *pSymbolName) 235 236 #else 236 237 Void SyntaxElementParser::xReadSvlc( Int& riVal) … … 270 271 271 272 #if RExt__DECODER_DEBUG_BIT_STATISTICS 272 Void SyntaxElementParser::xReadFlag (UInt& ruiCode, const Char *pSymbolName)273 Void SyntaxElementParser::xReadFlag (UInt& ruiCode, const TChar *pSymbolName) 273 274 #else 274 275 Void SyntaxElementParser::xReadFlag (UInt& ruiCode) … … 281 282 } 282 283 283 #if RExt__DECODER_DEBUG_BIT_STATISTICS 284 Void SyntaxElementParser::xReadString (UInt bufSize, UChar *pVal, UInt& rLength, const Char *pSymbolName) 284 #if NH_MV 285 #if RExt__DECODER_DEBUG_BIT_STATISTICS 286 Void SyntaxElementParser::xReadString (UInt bufSize, UChar *pVal, UInt& rLength, const TChar *pSymbolName) 285 287 #else 286 288 Void SyntaxElementParser::xReadString (UInt bufSize, UChar *pVal, UInt& rLength) … … 302 304 assert( pVal[rLength] == 0 ); 303 305 } 306 #endif 304 307 305 308 Void SyntaxElementParser::xReadRbspTrailingBits() -
branches/HTM-15.2-dev/source/Lib/TLibDecoder/SyntaxElementParser.h
r1356 r1360 91 91 92 92 #if RExt__DECODER_DEBUG_BIT_STATISTICS 93 Void xReadCode ( UInt length, UInt& val, const Char *pSymbolName ); 94 Void xReadUvlc ( UInt& val, const Char *pSymbolName ); 95 Void xReadSvlc ( Int& val, const Char *pSymbolName ); 96 Void xReadFlag ( UInt& val, const Char *pSymbolName ); 97 Void xReadString ( UInt bufSize, UChar *val, UInt& length, const Char *pSymbolName); 93 Void xReadCode ( UInt length, UInt& val, const TChar *pSymbolName ); 94 Void xReadUvlc ( UInt& val, const TChar *pSymbolName ); 95 Void xReadSvlc ( Int& val, const TChar *pSymbolName ); 96 Void xReadFlag ( UInt& val, const TChar *pSymbolName ); 97 #if NH_MV 98 Void xReadString ( UInt bufSize, UChar *val, UInt& length, const TChar *pSymbolName); 99 #endif 98 100 #else 99 101 Void xReadCode ( UInt length, UInt& val ); … … 101 103 Void xReadSvlc ( Int& val ); 102 104 Void xReadFlag ( UInt& val ); 105 #if NH_MV 103 106 Void xReadString ( UInt bufSize, UChar *val, UInt& length); 104 107 #endif 108 #endif 105 109 #if ENC_DEC_TRACE 106 Void xReadCodeTr (UInt length, UInt& rValue, const Char *pSymbolName); 107 Void xReadUvlcTr ( UInt& rValue, const Char *pSymbolName); 108 Void xReadSvlcTr ( Int& rValue, const Char *pSymbolName); 109 Void xReadFlagTr ( UInt& rValue, const Char *pSymbolName); 110 Void xReadStringTr(UInt bufSize, UChar *pValue, UInt& rLength, const Char *pSymbolName); 110 Void xReadCodeTr (UInt length, UInt& rValue, const TChar *pSymbolName); 111 Void xReadUvlcTr ( UInt& rValue, const TChar *pSymbolName); 112 Void xReadSvlcTr ( Int& rValue, const TChar *pSymbolName); 113 Void xReadFlagTr ( UInt& rValue, const TChar *pSymbolName); 114 #if NH_MV 115 Void xReadStringTr(UInt bufSize, UChar *pValue, UInt& rLength, const TChar *pSymbolName); 116 #endif 111 117 #endif 112 118 public: -
branches/HTM-15.2-dev/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp
r1313 r1360 169 169 if (g_debugCounter >= debugCabacBinTargetLine) 170 170 { 171 Char breakPointThis;171 UChar breakPointThis; 172 172 breakPointThis = 7; 173 173 } -
branches/HTM-15.2-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1321 r1360 454 454 #else 455 455 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS 456 static const char *syntaxStrings[]={ "pps_range_extension_flag",456 static const TChar *syntaxStrings[]={ "pps_range_extension_flag", 457 457 "pps_multilayer_extension_flag", 458 458 "pps_extension_6bits[0]", … … 1017 1017 pcSPS->setSpsMaxLatencyIncreasePlus1( uiCode, i ); 1018 1018 #else 1019 pcSPS->setMaxLatencyIncrease ( uiCode, i );1019 pcSPS->setMaxLatencyIncreasePlus1( uiCode, i ); 1020 1020 #endif 1021 1021 … … 1029 1029 pcSPS->setSpsMaxLatencyIncreasePlus1(pcSPS->getSpsMaxLatencyIncreasePlus1(0), i); 1030 1030 #else 1031 pcSPS->setMaxLatencyIncrease (pcSPS->getMaxLatencyIncrease(0), i);1031 pcSPS->setMaxLatencyIncreasePlus1(pcSPS->getMaxLatencyIncreasePlus1(0), i); 1032 1032 #endif 1033 1033 } … … 1206 1206 1207 1207 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS 1208 static const char *syntaxStrings[]={ "sps_range_extension_flag",1208 static const TChar *syntaxStrings[]={ "sps_range_extension_flag", 1209 1209 "sps_multilayer_extension_flag", 1210 1210 "sps_extension_6bits[0]", -
branches/HTM-15.2-dev/source/Lib/TLibDecoder/TDecEntropy.cpp
r1321 r1360 505 505 #endif 506 506 507 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);507 const UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 508 508 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 509 509 { … … 547 547 else 548 548 { 549 uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);550 549 551 550 #if NH_3D_MLC -
branches/HTM-15.2-dev/source/Lib/TLibDecoder/TDecGop.cpp
r1313 r1360 177 177 pcPic->compressMotion(); 178 178 #endif 179 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');179 TChar c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 180 180 if (!pcSlice->isReferenced()) 181 181 { … … 255 255 TComPictureHash recon_digest; 256 256 Int numChar=0; 257 const Char* hashType = "\0";257 const TChar* hashType = "\0"; 258 258 259 259 if (pictureHashSEI) … … 261 261 switch (pictureHashSEI->method) 262 262 { 263 case SEIDecodedPictureHash::MD5:263 case HASHTYPE_MD5: 264 264 { 265 265 hashType = "MD5"; … … 267 267 break; 268 268 } 269 case SEIDecodedPictureHash::CRC:269 case HASHTYPE_CRC: 270 270 { 271 271 hashType = "CRC"; … … 273 273 break; 274 274 } 275 case SEIDecodedPictureHash::CHECKSUM:275 case HASHTYPE_CHECKSUM: 276 276 { 277 277 hashType = "Checksum"; … … 288 288 289 289 /* compare digest against received version */ 290 const Char* ok = "(unk)";290 const TChar* ok = "(unk)"; 291 291 Bool mismatch = false; 292 292 -
branches/HTM-15.2-dev/source/Lib/TLibDecoder/TDecSbac.cpp
r1313 r1360 1194 1194 if (!pcCU->isIntra(uiAbsPartIdx) || (pcCU->getIntraDir( CHANNEL_TYPE_CHROMA, uiAbsPartIdx ) == DM_CHROMA_IDX)) 1195 1195 { 1196 Char alpha= 0;1196 SChar alpha = 0; 1197 1197 UInt symbol = 0; 1198 1198 -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/AnnexBwrite.h
r1313 r1360 60 60 UInt size = 0; /* size of annexB unit in bytes */ 61 61 62 static const Char start_code_prefix[] = {0,0,0,1};62 static const UChar start_code_prefix[] = {0,0,0,1}; 63 63 if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS) 64 64 { … … 71 71 * 7.4.1.2.3. 72 72 */ 73 out.write( start_code_prefix, 4);73 out.write(reinterpret_cast<const TChar*>(start_code_prefix), 4); 74 74 size += 4; 75 75 } 76 76 else 77 77 { 78 out.write( start_code_prefix+1, 3);78 out.write(reinterpret_cast<const TChar*>(start_code_prefix+1), 3); 79 79 size += 3; 80 80 } -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/NALwrite.cpp
r1313 r1360 45 45 //! \{ 46 46 47 static const Char emulation_prevention_three_byte[] = {3};47 static const UChar emulation_prevention_three_byte[] = {3}; 48 48 49 49 Void writeNalUnitHeader(ostream& out, OutputNALUnit& nalu) // nal_unit_header() … … 60 60 bsNALUHeader.write(nalu.m_temporalId+1, 3); // nuh_temporal_id_plus1 61 61 62 out.write( bsNALUHeader.getByteStream(), bsNALUHeader.getByteStreamLength());62 out.write(reinterpret_cast<const TChar*>(bsNALUHeader.getByteStream()), bsNALUHeader.getByteStreamLength()); 63 63 } 64 64 /** … … 124 124 outputBuffer[outputAmount++]=emulation_prevention_three_byte[0]; 125 125 } 126 out.write( (Char*)&(*outputBuffer.begin()), outputAmount);126 out.write(reinterpret_cast<const TChar*>(&(*outputBuffer.begin())), outputAmount); 127 127 } 128 128 -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/SEIEncoder.cpp
r1356 r1360 294 294 assert (pcPic!=NULL); 295 295 296 if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 1) 297 { 298 decodedPictureHashSEI->method = SEIDecodedPictureHash::MD5; 296 decodedPictureHashSEI->method = m_pcCfg->getDecodedPictureHashSEIType(); 297 switch (m_pcCfg->getDecodedPictureHashSEIType()) 298 { 299 case HASHTYPE_MD5: 300 { 299 301 UInt numChar=calcMD5(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths); 300 302 rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar); 301 303 } 302 else if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 2)303 {304 decodedPictureHashSEI->method = SEIDecodedPictureHash::CRC;304 break; 305 case HASHTYPE_CRC: 306 { 305 307 UInt numChar=calcCRC(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths); 306 308 rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar); 307 309 } 308 else if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 3) 309 { 310 decodedPictureHashSEI->method = SEIDecodedPictureHash::CHECKSUM; 310 break; 311 case HASHTYPE_CHECKSUM: 312 default: 313 { 311 314 UInt numChar=calcChecksum(*pcPic->getPicYuvRec(), decodedPictureHashSEI->m_pictureHash, bitDepths); 312 315 rHashString = hashToString(decodedPictureHashSEI->m_pictureHash, numChar); 316 } 317 break; 313 318 } 314 319 } … … 397 402 } 398 403 } 399 400 Void SEIEncoder::initSEIChromaSamplingFilterHint(SEIChromaSamplingFilterHint *seiChromaSamplingFilterHint, Int iHorFilterIndex, Int iVerFilterIndex) 401 { 402 assert (m_isInitialized); 403 assert (seiChromaSamplingFilterHint!=NULL); 404 405 seiChromaSamplingFilterHint->m_verChromaFilterIdc = iVerFilterIndex; 406 seiChromaSamplingFilterHint->m_horChromaFilterIdc = iHorFilterIndex; 407 seiChromaSamplingFilterHint->m_verFilteringProcessFlag = 1; 408 seiChromaSamplingFilterHint->m_targetFormatIdc = 3; 409 seiChromaSamplingFilterHint->m_perfectReconstructionFlag = false; 410 if(seiChromaSamplingFilterHint->m_verChromaFilterIdc == 1) 411 { 412 seiChromaSamplingFilterHint->m_numVerticalFilters = 1; 413 seiChromaSamplingFilterHint->m_verTapLengthMinus1 = (Int*)malloc(seiChromaSamplingFilterHint->m_numVerticalFilters * sizeof(Int)); 414 seiChromaSamplingFilterHint->m_verFilterCoeff = (Int**)malloc(seiChromaSamplingFilterHint->m_numVerticalFilters * sizeof(Int*)); 415 for(Int i = 0; i < seiChromaSamplingFilterHint->m_numVerticalFilters; i ++) 416 { 417 seiChromaSamplingFilterHint->m_verTapLengthMinus1[i] = 0; 418 seiChromaSamplingFilterHint->m_verFilterCoeff[i] = (Int*)malloc(seiChromaSamplingFilterHint->m_verTapLengthMinus1[i] * sizeof(Int)); 419 for(Int j = 0; j < seiChromaSamplingFilterHint->m_verTapLengthMinus1[i]; j ++) 420 { 421 seiChromaSamplingFilterHint->m_verFilterCoeff[i][j] = 0; 422 } 423 } 404 template <typename T> 405 static Void readTokenValue(T &returnedValue, /// value returned 406 Bool &failed, /// used and updated 407 std::istream &is, /// stream to read token from 408 const TChar *pToken) /// token string 409 { 410 returnedValue=T(); 411 if (failed) 412 { 413 return; 414 } 415 416 Int c; 417 // Ignore any whitespace 418 while ((c=is.get())!=EOF && isspace(c)); 419 // test for comment mark 420 while (c=='#') 421 { 422 // Ignore to the end of the line 423 while ((c=is.get())!=EOF && (c!=10 && c!=13)); 424 // Ignore any white space at the start of the next line 425 while ((c=is.get())!=EOF && isspace(c)); 426 } 427 // test first character of token 428 failed=(c!=pToken[0]); 429 // test remaining characters of token 430 Int pos; 431 for(pos=1;!failed && pToken[pos]!=0 && is.get()==pToken[pos]; pos++); 432 failed|=(pToken[pos]!=0); 433 // Ignore any whitespace before the ':' 434 while (!failed && (c=is.get())!=EOF && isspace(c)); 435 failed|=(c!=':'); 436 // Now read the value associated with the token: 437 if (!failed) 438 { 439 is >> returnedValue; 440 failed=!is.good(); 441 if (!failed) 442 { 443 c=is.get(); 444 failed=(c!=EOF && !isspace(c)); 445 } 446 } 447 if (failed) 448 { 449 std::cerr << "Unable to read token '" << pToken << "'\n"; 450 } 451 } 452 453 template <typename T> 454 static Void readTokenValueAndValidate(T &returnedValue, /// value returned 455 Bool &failed, /// used and updated 456 std::istream &is, /// stream to read token from 457 const TChar *pToken, /// token string 458 const T &minInclusive, /// minimum value allowed, inclusive 459 const T &maxInclusive) /// maximum value allowed, inclusive 460 { 461 readTokenValue(returnedValue, failed, is, pToken); 462 if (!failed) 463 { 464 if (returnedValue<minInclusive || returnedValue>maxInclusive) 465 { 466 failed=true; 467 std::cerr << "Value for token " << pToken << " must be in the range " << minInclusive << " to " << maxInclusive << " (inclusive); value read: " << returnedValue << std::endl; 468 } 469 } 470 } 471 472 // Bool version does not have maximum and minimum values. 473 static Void readTokenValueAndValidate(Bool &returnedValue, /// value returned 474 Bool &failed, /// used and updated 475 std::istream &is, /// stream to read token from 476 const TChar *pToken) /// token string 477 { 478 readTokenValue(returnedValue, failed, is, pToken); 479 } 480 481 Bool SEIEncoder::initSEIColourRemappingInfo(SEIColourRemappingInfo* seiColourRemappingInfo, Int currPOC) // returns true on success, false on failure. 482 { 483 assert (m_isInitialized); 484 assert (seiColourRemappingInfo!=NULL); 485 486 // reading external Colour Remapping Information SEI message parameters from file 487 if( !m_pcCfg->getColourRemapInfoSEIFileRoot().empty()) 488 { 489 Bool failed=false; 490 491 // building the CRI file name with poc num in prefix "_poc.txt" 492 std::string colourRemapSEIFileWithPoc(m_pcCfg->getColourRemapInfoSEIFileRoot()); 493 { 494 std::stringstream suffix; 495 suffix << "_" << currPOC << ".txt"; 496 colourRemapSEIFileWithPoc+=suffix.str(); 497 } 498 499 std::ifstream fic(colourRemapSEIFileWithPoc.c_str()); 500 if (!fic.good() || !fic.is_open()) 501 { 502 std::cerr << "No Colour Remapping Information SEI parameters file " << colourRemapSEIFileWithPoc << " for POC " << currPOC << std::endl; 503 return false; 504 } 505 506 // TODO: identify and remove duplication with decoder parsing through abstraction. 507 508 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapId, failed, fic, "colour_remap_id", UInt(0), UInt(0x7fffffff) ); 509 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapCancelFlag, failed, fic, "colour_remap_cancel_flag" ); 510 if( !seiColourRemappingInfo->m_colourRemapCancelFlag ) 511 { 512 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapPersistenceFlag, failed, fic, "colour_remap_persistence_flag" ); 513 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapVideoSignalInfoPresentFlag, failed, fic, "colour_remap_video_signal_info_present_flag"); 514 if( seiColourRemappingInfo->m_colourRemapVideoSignalInfoPresentFlag ) 515 { 516 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapFullRangeFlag, failed, fic, "colour_remap_full_range_flag" ); 517 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapPrimaries, failed, fic, "colour_remap_primaries", Int(0), Int(255) ); 518 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapTransferFunction, failed, fic, "colour_remap_transfer_function", Int(0), Int(255) ); 519 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapMatrixCoefficients, failed, fic, "colour_remap_matrix_coefficients", Int(0), Int(255) ); 520 } 521 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapInputBitDepth, failed, fic, "colour_remap_input_bit_depth", Int(8), Int(16) ); 522 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapBitDepth, failed, fic, "colour_remap_bit_depth", Int(8), Int(16) ); 523 524 const Int maximumInputValue = (1 << (((seiColourRemappingInfo->m_colourRemapInputBitDepth + 7) >> 3) << 3)) - 1; 525 const Int maximumRemappedValue = (1 << (((seiColourRemappingInfo->m_colourRemapBitDepth + 7) >> 3) << 3)) - 1; 526 527 for( Int c=0 ; c<3 ; c++ ) 528 { 529 readTokenValueAndValidate(seiColourRemappingInfo->m_preLutNumValMinus1[c], failed, fic, "pre_lut_num_val_minus1[c]", Int(0), Int(32) ); 530 if( seiColourRemappingInfo->m_preLutNumValMinus1[c]>0 ) 531 { 532 seiColourRemappingInfo->m_preLut[c].resize(seiColourRemappingInfo->m_preLutNumValMinus1[c]+1); 533 for( Int i=0 ; i<=seiColourRemappingInfo->m_preLutNumValMinus1[c] ; i++ ) 534 { 535 readTokenValueAndValidate(seiColourRemappingInfo->m_preLut[c][i].codedValue, failed, fic, "pre_lut_coded_value[c][i]", Int(0), maximumInputValue ); 536 readTokenValueAndValidate(seiColourRemappingInfo->m_preLut[c][i].targetValue, failed, fic, "pre_lut_target_value[c][i]", Int(0), maximumRemappedValue ); 537 } 538 } 539 } 540 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapMatrixPresentFlag, failed, fic, "colour_remap_matrix_present_flag" ); 541 if( seiColourRemappingInfo->m_colourRemapMatrixPresentFlag ) 542 { 543 readTokenValueAndValidate(seiColourRemappingInfo->m_log2MatrixDenom, failed, fic, "log2_matrix_denom", Int(0), Int(15) ); 544 for( Int c=0 ; c<3 ; c++ ) 545 { 546 for( Int i=0 ; i<3 ; i++ ) 547 { 548 readTokenValueAndValidate(seiColourRemappingInfo->m_colourRemapCoeffs[c][i], failed, fic, "colour_remap_coeffs[c][i]", -32768, 32767 ); 549 } 550 } 551 } 552 for( Int c=0 ; c<3 ; c++ ) 553 { 554 readTokenValueAndValidate(seiColourRemappingInfo->m_postLutNumValMinus1[c], failed, fic, "post_lut_num_val_minus1[c]", Int(0), Int(32) ); 555 if( seiColourRemappingInfo->m_postLutNumValMinus1[c]>0 ) 556 { 557 seiColourRemappingInfo->m_postLut[c].resize(seiColourRemappingInfo->m_postLutNumValMinus1[c]+1); 558 for( Int i=0 ; i<=seiColourRemappingInfo->m_postLutNumValMinus1[c] ; i++ ) 559 { 560 readTokenValueAndValidate(seiColourRemappingInfo->m_postLut[c][i].codedValue, failed, fic, "post_lut_coded_value[c][i]", Int(0), maximumRemappedValue ); 561 readTokenValueAndValidate(seiColourRemappingInfo->m_postLut[c][i].targetValue, failed, fic, "post_lut_target_value[c][i]", Int(0), maximumRemappedValue ); 562 } 563 } 564 } 565 } 566 567 if( failed ) 568 { 569 std::cerr << "Error while reading Colour Remapping Information SEI parameters file '" << colourRemapSEIFileWithPoc << "'" << std::endl; 570 exit(EXIT_FAILURE); 571 } 572 } 573 return true; 574 } 575 576 577 Void SEIEncoder::initSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint *seiChromaResamplingFilterHint, Int iHorFilterIndex, Int iVerFilterIndex) 578 { 579 assert (m_isInitialized); 580 assert (seiChromaResamplingFilterHint!=NULL); 581 582 seiChromaResamplingFilterHint->m_verChromaFilterIdc = iVerFilterIndex; 583 seiChromaResamplingFilterHint->m_horChromaFilterIdc = iHorFilterIndex; 584 seiChromaResamplingFilterHint->m_verFilteringFieldProcessingFlag = 1; 585 seiChromaResamplingFilterHint->m_targetFormatIdc = 3; 586 seiChromaResamplingFilterHint->m_perfectReconstructionFlag = false; 587 588 // this creates some example filter values, if explicit filter definition is selected 589 if (seiChromaResamplingFilterHint->m_verChromaFilterIdc == 1) 590 { 591 const Int numVerticalFilters = 3; 592 const Int verTapLengthMinus1[] = {5,3,3}; 593 594 seiChromaResamplingFilterHint->m_verFilterCoeff.resize(numVerticalFilters); 595 for(Int i = 0; i < numVerticalFilters; i ++) 596 { 597 seiChromaResamplingFilterHint->m_verFilterCoeff[i].resize(verTapLengthMinus1[i]+1); 598 } 599 // Note: C++11 -> seiChromaResamplingFilterHint->m_verFilterCoeff[0] = {-3,13,31,23,3,-3}; 600 seiChromaResamplingFilterHint->m_verFilterCoeff[0][0] = -3; 601 seiChromaResamplingFilterHint->m_verFilterCoeff[0][1] = 13; 602 seiChromaResamplingFilterHint->m_verFilterCoeff[0][2] = 31; 603 seiChromaResamplingFilterHint->m_verFilterCoeff[0][3] = 23; 604 seiChromaResamplingFilterHint->m_verFilterCoeff[0][4] = 3; 605 seiChromaResamplingFilterHint->m_verFilterCoeff[0][5] = -3; 606 607 seiChromaResamplingFilterHint->m_verFilterCoeff[1][0] = -1; 608 seiChromaResamplingFilterHint->m_verFilterCoeff[1][1] = 25; 609 seiChromaResamplingFilterHint->m_verFilterCoeff[1][2] = 247; 610 seiChromaResamplingFilterHint->m_verFilterCoeff[1][3] = -15; 611 612 seiChromaResamplingFilterHint->m_verFilterCoeff[2][0] = -20; 613 seiChromaResamplingFilterHint->m_verFilterCoeff[2][1] = 186; 614 seiChromaResamplingFilterHint->m_verFilterCoeff[2][2] = 100; 615 seiChromaResamplingFilterHint->m_verFilterCoeff[2][3] = -10; 424 616 } 425 617 else 426 618 { 427 seiChromaSamplingFilterHint->m_numVerticalFilters = 0; 428 seiChromaSamplingFilterHint->m_verTapLengthMinus1 = NULL; 429 seiChromaSamplingFilterHint->m_verFilterCoeff = NULL; 430 } 431 if(seiChromaSamplingFilterHint->m_horChromaFilterIdc == 1) 432 { 433 seiChromaSamplingFilterHint->m_numHorizontalFilters = 1; 434 seiChromaSamplingFilterHint->m_horTapLengthMinus1 = (Int*)malloc(seiChromaSamplingFilterHint->m_numHorizontalFilters * sizeof(Int)); 435 seiChromaSamplingFilterHint->m_horFilterCoeff = (Int**)malloc(seiChromaSamplingFilterHint->m_numHorizontalFilters * sizeof(Int*)); 436 for(Int i = 0; i < seiChromaSamplingFilterHint->m_numHorizontalFilters; i ++) 437 { 438 seiChromaSamplingFilterHint->m_horTapLengthMinus1[i] = 0; 439 seiChromaSamplingFilterHint->m_horFilterCoeff[i] = (Int*)malloc(seiChromaSamplingFilterHint->m_horTapLengthMinus1[i] * sizeof(Int)); 440 for(Int j = 0; j < seiChromaSamplingFilterHint->m_horTapLengthMinus1[i]; j ++) 441 { 442 seiChromaSamplingFilterHint->m_horFilterCoeff[i][j] = 0; 443 } 444 } 619 seiChromaResamplingFilterHint->m_verFilterCoeff.resize(0); 620 } 621 622 if (seiChromaResamplingFilterHint->m_horChromaFilterIdc == 1) 623 { 624 Int const numHorizontalFilters = 1; 625 const Int horTapLengthMinus1[] = {3}; 626 627 seiChromaResamplingFilterHint->m_horFilterCoeff.resize(numHorizontalFilters); 628 for(Int i = 0; i < numHorizontalFilters; i ++) 629 { 630 seiChromaResamplingFilterHint->m_horFilterCoeff[i].resize(horTapLengthMinus1[i]+1); 631 } 632 seiChromaResamplingFilterHint->m_horFilterCoeff[0][0] = 1; 633 seiChromaResamplingFilterHint->m_horFilterCoeff[0][1] = 6; 634 seiChromaResamplingFilterHint->m_horFilterCoeff[0][2] = 1; 445 635 } 446 636 else 447 637 { 448 seiChromaSamplingFilterHint->m_numHorizontalFilters = 0; 449 seiChromaSamplingFilterHint->m_horTapLengthMinus1 = NULL; 450 seiChromaSamplingFilterHint->m_horFilterCoeff = NULL; 638 seiChromaResamplingFilterHint->m_horFilterCoeff.resize(0); 451 639 } 452 640 } -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/SEIEncoder.h
r1356 r1360 79 79 Void initSEITempMotionConstrainedTileSets (SEITempMotionConstrainedTileSets *sei, const TComPPS *pps); 80 80 Void initSEIKneeFunctionInfo(SEIKneeFunctionInfo *sei); 81 Void initSEIChroma SamplingFilterHint(SEIChromaSamplingFilterHint *sei, Int iHorFilterIndex, Int iVerFilterIndex);81 Void initSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint *sei, Int iHorFilterIndex, Int iVerFilterIndex); 82 82 Void initSEITimeCode(SEITimeCode *sei); 83 Bool initSEIColourRemappingInfo(SEIColourRemappingInfo *sei, Int currPOC); // returns true on success, false on failure. 83 84 84 85 // trailing SEIs -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r1356 r1360 106 106 xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps); 107 107 break; 108 case SEI::CHROMA_ SAMPLING_FILTER_HINT:109 xWriteSEIChroma SamplingFilterHint(*static_cast<const SEIChromaSamplingFilterHint*>(&sei)/*, sps*/);108 case SEI::CHROMA_RESAMPLING_FILTER_HINT: 109 xWriteSEIChromaResamplingFilterHint(*static_cast<const SEIChromaResamplingFilterHint*>(&sei)); 110 110 break; 111 111 case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS: … … 117 117 case SEI::KNEE_FUNCTION_INFO: 118 118 xWriteSEIKneeFunctionInfo(*static_cast<const SEIKneeFunctionInfo*>(&sei)); 119 break; 120 case SEI::COLOUR_REMAPPING_INFO: 121 xWriteSEIColourRemappingInfo(*static_cast<const SEIColourRemappingInfo*>(&sei)); 119 122 break; 120 123 case SEI::MASTERING_DISPLAY_COLOUR_VOLUME: … … 189 192 190 193 default: 191 assert(!" Unhandled SEI message");194 assert(!"Trying to write unhandled SEI message"); 192 195 break; 193 196 } … … 277 280 Void SEIWriter::xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei) 278 281 { 279 const Char *traceString="\0";282 const TChar *traceString="\0"; 280 283 switch (sei.method) 281 284 { 282 case SEIDecodedPictureHash::MD5: traceString="picture_md5"; break;283 case SEIDecodedPictureHash::CRC: traceString="picture_crc"; break;284 case SEIDecodedPictureHash::CHECKSUM: traceString="picture_checksum"; break;285 case HASHTYPE_MD5: traceString="picture_md5"; break; 286 case HASHTYPE_CRC: traceString="picture_crc"; break; 287 case HASHTYPE_CHECKSUM: traceString="picture_checksum"; break; 285 288 default: assert(false); break; 286 289 } … … 726 729 } 727 730 728 Void SEIWriter::xWriteSEIChroma SamplingFilterHint(const SEIChromaSamplingFilterHint &sei/*, TComSPS* sps*/)731 Void SEIWriter::xWriteSEIChromaResamplingFilterHint(const SEIChromaResamplingFilterHint &sei) 729 732 { 730 733 WRITE_CODE(sei.m_verChromaFilterIdc, 8, "ver_chroma_filter_idc"); 731 734 WRITE_CODE(sei.m_horChromaFilterIdc, 8, "hor_chroma_filter_idc"); 732 WRITE_FLAG(sei.m_verFiltering ProcessFlag, "ver_filtering_process_flag");735 WRITE_FLAG(sei.m_verFilteringFieldProcessingFlag, "ver_filtering_field_processing_flag"); 733 736 if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1) 734 737 { 735 writeUserDefinedCoefficients(sei); 736 } 737 } 738 739 // write hardcoded chroma filter coefficients in the SEI messages 740 Void SEIWriter::writeUserDefinedCoefficients(const SEIChromaSamplingFilterHint &sei) 741 { 742 Int const iNumVerticalFilters = 3; 743 Int verticalTapLength_minus1[iNumVerticalFilters] = {5,3,3}; 744 Int* userVerticalCoefficients[iNumVerticalFilters]; 745 for(Int i = 0; i < iNumVerticalFilters; i ++) 746 { 747 userVerticalCoefficients[i] = (Int*)malloc( (verticalTapLength_minus1[i]+1) * sizeof(Int)); 748 } 749 userVerticalCoefficients[0][0] = -3; 750 userVerticalCoefficients[0][1] = 13; 751 userVerticalCoefficients[0][2] = 31; 752 userVerticalCoefficients[0][3] = 23; 753 userVerticalCoefficients[0][4] = 3; 754 userVerticalCoefficients[0][5] = -3; 755 756 userVerticalCoefficients[1][0] = -1; 757 userVerticalCoefficients[1][1] = 25; 758 userVerticalCoefficients[1][2] = 247; 759 userVerticalCoefficients[1][3] = -15; 760 761 userVerticalCoefficients[2][0] = -20; 762 userVerticalCoefficients[2][1] = 186; 763 userVerticalCoefficients[2][2] = 100; 764 userVerticalCoefficients[2][3] = -10; 765 766 Int const iNumHorizontalFilters = 1; 767 Int horizontalTapLength_minus1[iNumHorizontalFilters] = {3}; 768 Int* userHorizontalCoefficients[iNumHorizontalFilters]; 769 for(Int i = 0; i < iNumHorizontalFilters; i ++) 770 { 771 userHorizontalCoefficients[i] = (Int*)malloc( (horizontalTapLength_minus1[i]+1) * sizeof(Int)); 772 } 773 userHorizontalCoefficients[0][0] = 1; 774 userHorizontalCoefficients[0][1] = 6; 775 userHorizontalCoefficients[0][2] = 1; 776 777 WRITE_UVLC(3, "target_format_idc"); 778 if(sei.m_verChromaFilterIdc == 1) 779 { 780 WRITE_UVLC(iNumVerticalFilters, "num_vertical_filters"); 781 if(iNumVerticalFilters > 0) 782 { 783 for(Int i = 0; i < iNumVerticalFilters; i ++) 784 { 785 WRITE_UVLC(verticalTapLength_minus1[i], "ver_tap_length_minus_1"); 786 for(Int j = 0; j < verticalTapLength_minus1[i]; j ++) 787 { 788 WRITE_SVLC(userVerticalCoefficients[i][j], "ver_filter_coeff"); 789 } 790 } 791 } 792 } 793 if(sei.m_horChromaFilterIdc == 1) 794 { 795 WRITE_UVLC(iNumHorizontalFilters, "num_horizontal_filters"); 796 if(iNumHorizontalFilters > 0) 797 { 798 for(Int i = 0; i < iNumHorizontalFilters; i ++) 799 { 800 WRITE_UVLC(horizontalTapLength_minus1[i], "hor_tap_length_minus_1"); 801 for(Int j = 0; j < horizontalTapLength_minus1[i]; j ++) 802 { 803 WRITE_SVLC(userHorizontalCoefficients[i][j], "hor_filter_coeff"); 804 } 805 } 806 } 807 } 808 } 809 738 WRITE_UVLC(sei.m_targetFormatIdc, "target_format_idc"); 739 if(sei.m_verChromaFilterIdc == 1) 740 { 741 const Int numVerticalFilter = (Int)sei.m_verFilterCoeff.size(); 742 WRITE_UVLC(numVerticalFilter, "num_vertical_filters"); 743 if(numVerticalFilter > 0) 744 { 745 for(Int i = 0; i < numVerticalFilter; i ++) 746 { 747 const Int verTapLengthMinus1 = (Int) sei.m_verFilterCoeff[i].size() - 1; 748 WRITE_UVLC(verTapLengthMinus1, "ver_tap_length_minus_1"); 749 for(Int j = 0; j < (verTapLengthMinus1 + 1); j ++) 750 { 751 WRITE_SVLC(sei.m_verFilterCoeff[i][j], "ver_filter_coeff"); 752 } 753 } 754 } 755 } 756 if(sei.m_horChromaFilterIdc == 1) 757 { 758 const Int numHorizontalFilter = (Int) sei.m_horFilterCoeff.size(); 759 WRITE_UVLC(numHorizontalFilter, "num_horizontal_filters"); 760 if(numHorizontalFilter > 0) 761 { 762 for(Int i = 0; i < numHorizontalFilter; i ++) 763 { 764 const Int horTapLengthMinus1 = (Int) sei.m_horFilterCoeff[i].size() - 1; 765 WRITE_UVLC(horTapLengthMinus1, "hor_tap_length_minus_1"); 766 for(Int j = 0; j < (horTapLengthMinus1 + 1); j ++) 767 { 768 WRITE_SVLC(sei.m_horFilterCoeff[i][j], "hor_filter_coeff"); 769 } 770 } 771 } 772 } 773 } 774 } 810 775 #if NH_MV 811 776 #if !NH_MV_SEI … … 849 814 } 850 815 816 Void SEIWriter::xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei) 817 { 818 WRITE_UVLC( sei.m_colourRemapId, "colour_remap_id" ); 819 WRITE_FLAG( sei.m_colourRemapCancelFlag, "colour_remap_cancel_flag" ); 820 if( !sei.m_colourRemapCancelFlag ) 821 { 822 WRITE_FLAG( sei.m_colourRemapPersistenceFlag, "colour_remap_persistence_flag" ); 823 WRITE_FLAG( sei.m_colourRemapVideoSignalInfoPresentFlag, "colour_remap_video_signal_info_present_flag" ); 824 if ( sei.m_colourRemapVideoSignalInfoPresentFlag ) 825 { 826 WRITE_FLAG( sei.m_colourRemapFullRangeFlag, "colour_remap_full_range_flag" ); 827 WRITE_CODE( sei.m_colourRemapPrimaries, 8, "colour_remap_primaries" ); 828 WRITE_CODE( sei.m_colourRemapTransferFunction, 8, "colour_remap_transfer_function" ); 829 WRITE_CODE( sei.m_colourRemapMatrixCoefficients, 8, "colour_remap_matrix_coefficients" ); 830 } 831 WRITE_CODE( sei.m_colourRemapInputBitDepth, 8, "colour_remap_input_bit_depth" ); 832 WRITE_CODE( sei.m_colourRemapBitDepth, 8, "colour_remap_bit_depth" ); 833 for( Int c=0 ; c<3 ; c++ ) 834 { 835 WRITE_CODE( sei.m_preLutNumValMinus1[c], 8, "pre_lut_num_val_minus1[c]" ); 836 if( sei.m_preLutNumValMinus1[c]>0 ) 837 { 838 for( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ ) 839 { 840 WRITE_CODE( sei.m_preLut[c][i].codedValue, (( sei.m_colourRemapInputBitDepth + 7 ) >> 3 ) << 3, "pre_lut_coded_value[c][i]" ); 841 WRITE_CODE( sei.m_preLut[c][i].targetValue, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "pre_lut_target_value[c][i]" ); 842 } 843 } 844 } 845 WRITE_FLAG( sei.m_colourRemapMatrixPresentFlag, "colour_remap_matrix_present_flag" ); 846 if( sei.m_colourRemapMatrixPresentFlag ) 847 { 848 WRITE_CODE( sei.m_log2MatrixDenom, 4, "log2_matrix_denom" ); 849 for( Int c=0 ; c<3 ; c++ ) 850 { 851 for( Int i=0 ; i<3 ; i++ ) 852 { 853 WRITE_SVLC( sei.m_colourRemapCoeffs[c][i], "colour_remap_coeffs[c][i]" ); 854 } 855 } 856 } 857 858 for( Int c=0 ; c<3 ; c++ ) 859 { 860 WRITE_CODE( sei.m_postLutNumValMinus1[c], 8, "m_postLutNumValMinus1[c]" ); 861 if( sei.m_postLutNumValMinus1[c]>0 ) 862 { 863 for( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ ) 864 { 865 WRITE_CODE( sei.m_postLut[c][i].codedValue, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "post_lut_coded_value[c][i]" ); 866 WRITE_CODE( sei.m_postLut[c][i].targetValue, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "post_lut_target_value[c][i]" ); 867 } 868 } 869 } 870 } 871 } 851 872 852 873 Void SEIWriter::xWriteSEIMasteringDisplayColourVolume(const SEIMasteringDisplayColourVolume& sei) … … 863 884 WRITE_CODE( sei.values.whitePoint[0], 16, "white_point_x" ); 864 885 WRITE_CODE( sei.values.whitePoint[1], 16, "white_point_y" ); 865 886 866 887 WRITE_CODE( sei.values.maxLuminance, 32, "max_display_mastering_luminance" ); 867 888 WRITE_CODE( sei.values.minLuminance, 32, "min_display_mastering_luminance" ); … … 881 902 } 882 903 904 883 905 #if NH_MV_LAYERS_NOT_PRESENT_SEI 884 906 Void SEIWriter::xWriteSEILayersNotPresent(const SEILayersNotPresent& sei) … … 892 914 #endif 893 915 894 895 916 #if NH_MV 896 917 Void SEIWriter::xWriteSEIInterLayerConstrainedTileSets( const SEIInterLayerConstrainedTileSets& sei) 897 918 { … … 927 948 } 928 949 }; 950 #endif 929 951 930 952 #if NH_MV_SEI_TBD … … 1067 1089 } 1068 1090 }; 1091 1069 1092 1070 1093 Void SEIWriter::xWriteSEITemporalMvPredictionConstraints( const SEITemporalMvPredictionConstraints& sei) -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/SEIwrite.h
r1356 r1360 53 53 54 54 protected: 55 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComSPS *sps);56 55 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 57 56 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); … … 60 59 Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const TComSPS *sps); 61 60 Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, const TComSPS *sps); 62 TComSPS *m_pSPS;63 61 Void xWriteSEIRecoveryPoint(const SEIRecoveryPoint& sei); 64 62 Void xWriteSEIFramePacking(const SEIFramePacking& sei); … … 78 76 Void xWriteSEITempMotionConstrainedTileSets(const SEITempMotionConstrainedTileSets& sei); 79 77 Void xWriteSEITimeCode(const SEITimeCode& sei); 80 Void xWriteSEIChromaSamplingFilterHint(const SEIChromaSamplingFilterHint& sei/*, TComSPS *sps*/); 81 Void writeUserDefinedCoefficients(const SEIChromaSamplingFilterHint& sei); 78 Void xWriteSEIChromaResamplingFilterHint(const SEIChromaResamplingFilterHint& sei); 82 79 Void xWriteSEIKneeFunctionInfo(const SEIKneeFunctionInfo &sei); 80 Void xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei); 83 81 Void xWriteSEIMasteringDisplayColourVolume( const SEIMasteringDisplayColourVolume& sei); 84 82 … … 110 108 Void xWriteSEIAlternativeDepthInfo ( const SEIAlternativeDepthInfo& sei); 111 109 #endif 110 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComSPS *sps); 112 111 Void xWriteByteAlign(); 113 112 }; -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/SyntaxElementWriter.cpp
r1356 r1360 44 44 #if ENC_DEC_TRACE 45 45 46 Void SyntaxElementWriter::xWriteCodeTr (UInt value, UInt length, const Char *pSymbolName)46 Void SyntaxElementWriter::xWriteCodeTr (UInt value, UInt length, const TChar *pSymbolName) 47 47 { 48 48 xWriteCode (value,length); … … 70 70 } 71 71 72 Void SyntaxElementWriter::xWriteUvlcTr (UInt value, const Char *pSymbolName)72 Void SyntaxElementWriter::xWriteUvlcTr (UInt value, const TChar *pSymbolName) 73 73 { 74 74 xWriteUvlc (value); … … 89 89 } 90 90 91 Void SyntaxElementWriter::xWriteSvlcTr (Int value, const Char *pSymbolName)91 Void SyntaxElementWriter::xWriteSvlcTr (Int value, const TChar *pSymbolName) 92 92 { 93 93 xWriteSvlc(value); … … 108 108 } 109 109 110 Void SyntaxElementWriter::xWriteFlagTr(UInt value, const Char *pSymbolName)110 Void SyntaxElementWriter::xWriteFlagTr(UInt value, const TChar *pSymbolName) 111 111 { 112 112 xWriteFlag(value); … … 127 127 } 128 128 129 #if H_MV_ENC_DEC_TRAC 129 130 Void SyntaxElementWriter::xWriteStringTr( UChar* value, UInt length, const Char *pSymbolName) 130 131 { … … 136 137 } 137 138 } 138 139 #endif 139 140 #endif 140 141 … … 176 177 } 177 178 179 #if H_MV_ENC_DEC_TRAC 178 180 Void SyntaxElementWriter::xWriteString( UChar* sCode, UInt uiLength) 179 181 { … … 185 187 m_pcBitIf->write( 0, 8 ); //zero-termination byte 186 188 } 187 189 #endif 188 190 Void SyntaxElementWriter::xWriteRbspTrailingBits() 189 191 { -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/SyntaxElementWriter.h
r1356 r1360 56 56 #define WRITE_SVLC( value, name) xWriteSvlcTr ( value, name ) 57 57 #define WRITE_FLAG( value, name) xWriteFlagTr ( value, name ) 58 #if NH_MV 58 59 #define WRITE_STRING( value, length, name) xWriteStringTr( value, length, name ) 60 #endif 59 61 60 62 #else … … 64 66 #define WRITE_SVLC( value, name) xWriteSvlc ( value ) 65 67 #define WRITE_FLAG( value, name) xWriteFlag ( value ) 68 #if NH_MV 66 69 #define WRITE_STRING( value, length, name) xWriteString( value, length ) 67 70 #endif 68 71 #endif 69 72 … … 84 87 Void xWriteSvlc ( Int iCode ); 85 88 Void xWriteFlag ( UInt uiCode ); 89 #if NH_MV 86 90 Void xWriteString ( UChar* sCode, UInt uiLength); 91 #endif 87 92 #if ENC_DEC_TRACE 88 Void xWriteCodeTr ( UInt value, UInt length, const Char *pSymbolName); 89 Void xWriteUvlcTr ( UInt value, const Char *pSymbolName); 90 Void xWriteSvlcTr ( Int value, const Char *pSymbolName); 91 Void xWriteFlagTr ( UInt value, const Char *pSymbolName); 93 Void xWriteCodeTr ( UInt value, UInt length, const TChar *pSymbolName); 94 Void xWriteUvlcTr ( UInt value, const TChar *pSymbolName); 95 Void xWriteSvlcTr ( Int value, const TChar *pSymbolName); 96 Void xWriteFlagTr ( UInt value, const TChar *pSymbolName); 97 #if NH_MV 92 98 Void xWriteStringTr ( UChar* value, UInt length, const Char *pSymbolName); 99 #endif 93 100 #endif 94 101 Void xWriteRbspTrailingBits(); -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncAnalyze.h
r1313 r1360 137 137 138 138 139 Void printOut ( Char cDelim, const ChromaFormat chFmt, const Bool printMSEBasedSNR, const Bool printSequenceMSE, const BitDepths &bitDepths )139 Void printOut ( TChar cDelim, const ChromaFormat chFmt, const Bool printMSEBasedSNR, const Bool printSequenceMSE, const BitDepths &bitDepths ) 140 140 { 141 141 Double dFps = m_dFrmRate; //--CFG_KDY -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
r1321 r1360 246 246 if (g_debugCounter >= debugCabacBinTargetLine) 247 247 { 248 Char breakPointThis;248 UChar breakPointThis; 249 249 breakPointThis = 7; 250 250 } -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp
r1321 r1360 97 97 if (g_debugCounter >= debugEncoderSearchBinTargetLine) 98 98 { 99 Char breakPointThis;99 UChar breakPointThis; 100 100 breakPointThis = 7; 101 101 } -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r1321 r1360 69 69 fprintf( g_hTrace, "=========== Slice ===========\n"); 70 70 } 71 #endif 72 #endif 71 72 Void xTraceAccessUnitDelimiter () 73 { 74 fprintf( g_hTrace, "=========== Access Unit Delimiter ===========\n"); 75 } 76 77 #endif 78 #endif 79 80 Void AUDWriter::codeAUD(TComBitIf& bs, const Int pictureType) 81 { 82 #if ENC_DEC_TRACE 83 xTraceAccessUnitDelimiter(); 84 #endif 85 86 assert (pictureType < 3); 87 setBitstream(&bs); 88 WRITE_CODE(pictureType, 3, "pic_type"); 89 xWriteRbspTrailingBits(); 90 } 91 73 92 // ==================================================================================================================== 74 93 // Constructor / destructor / create / destroy … … 266 285 { 267 286 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS 268 static const char *syntaxStrings[]={ "pps_range_extension_flag",287 static const TChar *syntaxStrings[]={ "pps_range_extension_flag", 269 288 "pps_multilayer_extension_flag", 270 289 "pps_extension_6bits[0]", … … 748 767 WRITE_UVLC( pcSPS->getSpsMaxLatencyIncreasePlus1(i), "sps_max_latency_increase_plus1[i]" ); 749 768 #else 750 WRITE_UVLC( pcSPS->getMaxLatencyIncrease (i),"sps_max_latency_increase_plus1[i]" );769 WRITE_UVLC( pcSPS->getMaxLatencyIncreasePlus1(i), "sps_max_latency_increase_plus1[i]" ); 751 770 #endif 752 771 if (!subLayerOrderingInfoPresentFlag) … … 858 877 { 859 878 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS 860 static const char *syntaxStrings[]={ "sps_range_extension_flag",879 static const TChar *syntaxStrings[]={ "sps_range_extension_flag", 861 880 "sps_multilayer_extension_flag", 862 881 "sps_extension_6bits[0]", -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncCavlc.h
r1321 r1360 58 58 // ==================================================================================================================== 59 59 60 class AUDWriter : public SyntaxElementWriter 61 { 62 public: 63 AUDWriter() {}; 64 virtual ~AUDWriter() {}; 65 66 Void codeAUD(TComBitIf& bs, const Int pictureType); 67 }; 68 60 69 /// CAVLC encoder class 61 70 class TEncCavlc : public SyntaxElementWriter, public TEncEntropyIf -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncCfg.h
r1356 r1360 65 65 Bool m_refPic; 66 66 Int m_numRefPicsActive; 67 Char m_sliceType;67 SChar m_sliceType; 68 68 Int m_numRefPics; 69 69 Int m_referencePics[MAX_NUM_REF_PICS]; … … 137 137 Int m_framesToBeEncoded; 138 138 Double m_adLambdaModifier[ MAX_TLAYER ]; 139 std::vector<Double> m_adIntraLambdaModifier; 140 Double m_dIntraQpFactor; ///< Intra Q Factor. If negative, use a default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? (GopSize-1)/2 : GopSize-1) )) 139 141 140 142 Bool m_printMSEBasedSequencePSNR; … … 174 176 Int m_aiPad[2]; 175 177 178 Bool m_AccessUnitDelimiter; ///< add Access Unit Delimiter NAL units 176 179 177 180 Int m_iMaxRefPicNum; ///< this is used to mimic the sliding mechanism used by the decoder … … 206 209 //====== Motion search ======== 207 210 Bool m_bDisableIntraPUsInInterSlices; 208 Int m_iFastSearch; // 0:Full search 1:Diamond 2:PMVFAST211 MESearchMethod m_motionEstimationSearchMethod; 209 212 Int m_iSearchRange; // 0:Full frame 210 213 Int m_bipredSearchRange; 211 214 Bool m_bClipForBiPredMeEnabled; 212 215 Bool m_bFastMEAssumingSmootherMVEnabled; 216 Int m_minSearchWindow; 217 Bool m_bRestrictMESampling; 213 218 214 219 #if NH_MV … … 243 248 #endif 244 249 UInt m_rdPenalty; 245 Bool m_bUseFastEnc;250 FastInterSearchMode m_fastInterSearchMode; 246 251 Bool m_bUseEarlyCU; 247 252 Bool m_useFastDecisionForMerge; … … 289 294 std::vector<Int> m_tileRowHeight; 290 295 291 Int m_iWaveFrontSynchro;292 293 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message294 Intm_bufferingPeriodSEIEnabled;295 Intm_pictureTimingSEIEnabled;296 Intm_recoveryPointSEIEnabled;296 Bool m_entropyCodingSyncEnabledFlag; 297 298 HashType m_decodedPictureHashSEIType; 299 Bool m_bufferingPeriodSEIEnabled; 300 Bool m_pictureTimingSEIEnabled; 301 Bool m_recoveryPointSEIEnabled; 297 302 Bool m_toneMappingInfoSEIEnabled; 298 303 Int m_toneMapId; … … 322 327 Int* m_codedPivotValue; 323 328 Int* m_targetPivotValue; 324 Intm_framePackingSEIEnabled;329 Bool m_framePackingSEIEnabled; 325 330 Int m_framePackingSEIType; 326 331 Int m_framePackingSEIId; 327 332 Int m_framePackingSEIQuincunx; 328 333 Int m_framePackingSEIInterpretation; 329 Intm_segmentedRectFramePackingSEIEnabled;334 Bool m_segmentedRectFramePackingSEIEnabled; 330 335 Bool m_segmentedRectFramePackingSEICancel; 331 336 Int m_segmentedRectFramePackingSEIType; 332 337 Bool m_segmentedRectFramePackingSEIPersistence; 333 338 Int m_displayOrientationSEIAngle; 334 Intm_temporalLevel0IndexSEIEnabled;335 Intm_gradualDecodingRefreshInfoEnabled;339 Bool m_temporalLevel0IndexSEIEnabled; 340 Bool m_gradualDecodingRefreshInfoEnabled; 336 341 Int m_noDisplaySEITLayer; 337 Intm_decodingUnitInfoSEIEnabled;338 Intm_SOPDescriptionSEIEnabled;339 Intm_scalableNestingSEIEnabled;342 Bool m_decodingUnitInfoSEIEnabled; 343 Bool m_SOPDescriptionSEIEnabled; 344 Bool m_scalableNestingSEIEnabled; 340 345 Bool m_tmctsSEIEnabled; 341 346 Bool m_timeCodeSEIEnabled; … … 353 358 Int* m_kneeSEIInputKneePoint; 354 359 Int* m_kneeSEIOutputKneePoint; 360 std::string m_colourRemapSEIFileRoot; ///< SEI Colour Remapping File (initialized from external file) 355 361 TComSEIMasteringDisplay m_masteringDisplay; 356 362 #if NH_MV_SEI … … 360 366 Bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) 361 367 Bool m_useWeightedBiPred; //< Use of Bi-directional Weighting Prediction (B_SLICE) 368 WeightedPredictionMethod m_weightedPredictionMethod; 362 369 UInt m_log2ParallelMergeLevelMinus2; ///< Parallel merge estimation region 363 370 UInt m_maxNumMergeCand; ///< Maximum number of merge candidates 364 371 ScalingListMode m_useScalingListId; ///< Using quantization matrix i.e. 0=off, 1=default, 2=file. 365 Char* m_scalingListFile;///< quantization matrix file name372 std::string m_scalingListFileName; ///< quantization matrix file name 366 373 Int m_TMVPModeId; 367 374 Bool m_signHideFlag; … … 373 380 Int m_RCInitialQP; 374 381 Bool m_RCForceIntraQP; 382 #if U0132_TARGET_BITS_SATURATION 383 Bool m_RCCpbSaturationEnabled; 384 UInt m_RCCpbSize; 385 Double m_RCInitialCpbFullness; 386 #endif 375 387 376 388 #if KWU_RC_MADPRED_E0227 … … 398 410 Bool m_vuiParametersPresentFlag; ///< enable generation of VUI parameters 399 411 Bool m_aspectRatioInfoPresentFlag; ///< Signals whether aspect_ratio_idc is present 400 Bool m_chroma SamplingFilterHintEnabled;///< Signals whether chroma sampling filter hint data is present401 Int m_chroma SamplingHorFilterIdc;///< Specifies the Index of filter to use402 Int m_chroma SamplingVerFilterIdc;///< Specifies the Index of filter to use412 Bool m_chromaResamplingFilterHintEnabled; ///< Signals whether chroma sampling filter hint data is present 413 Int m_chromaResamplingHorFilterIdc; ///< Specifies the Index of filter to use 414 Int m_chromaResamplingVerFilterIdc; ///< Specifies the Index of filter to use 403 415 Int m_aspectRatioIdc; ///< aspect_ratio_idc 404 416 Int m_sarWidth; ///< horizontal size of the sample aspect ratio … … 606 618 //====== Motion search ======== 607 619 Void setDisableIntraPUsInInterSlices ( Bool b ) { m_bDisableIntraPUsInInterSlices = b; } 608 Void set FastSearch ( Int i ) { m_iFastSearch = i; }620 Void setMotionEstimationSearchMethod ( MESearchMethod e ) { m_motionEstimationSearchMethod = e; } 609 621 Void setSearchRange ( Int i ) { m_iSearchRange = i; } 610 622 Void setBipredSearchRange ( Int i ) { m_bipredSearchRange = i; } 611 623 Void setClipForBiPredMeEnabled ( Bool b ) { m_bClipForBiPredMeEnabled = b; } 612 624 Void setFastMEAssumingSmootherMVEnabled ( Bool b ) { m_bFastMEAssumingSmootherMVEnabled = b; } 625 Void setMinSearchWindow ( Int i ) { m_minSearchWindow = i; } 626 Void setRestrictMESampling ( Bool b ) { m_bRestrictMESampling = b; } 627 613 628 #if NH_MV 614 629 Void setUseDisparitySearchRangeRestriction ( Bool b ) { m_bUseDisparitySearchRangeRestriction = b; } … … 649 664 Int getSourceHeight () { return m_iSourceHeight; } 650 665 Int getFramesToBeEncoded () { return m_framesToBeEncoded; } 666 667 //====== Lambda Modifiers ======== 651 668 Void setLambdaModifier ( UInt uiIndex, Double dValue ) { m_adLambdaModifier[ uiIndex ] = dValue; } 652 669 Double getLambdaModifier ( UInt uiIndex ) const { return m_adLambdaModifier[ uiIndex ]; } 670 Void setIntraLambdaModifier ( const std::vector<Double> &dValue ) { m_adIntraLambdaModifier = dValue; } 671 const std::vector<Double>& getIntraLambdaModifier() const { return m_adIntraLambdaModifier; } 672 Void setIntraQpFactor ( Double dValue ) { m_dIntraQpFactor = dValue; } 673 Double getIntraQpFactor () const { return m_dIntraQpFactor; } 653 674 654 675 //==== Coding Structure ======== … … 662 683 Int getPad ( Int i ) { assert (i < 2 ); return m_aiPad[i]; } 663 684 685 Bool getAccessUnitDelimiter() const { return m_AccessUnitDelimiter; } 686 Void setAccessUnitDelimiter(Bool val){ m_AccessUnitDelimiter = val; } 687 664 688 //======== Transform ============= 665 689 UInt getQuadtreeTULog2MaxSize () const { return m_uiQuadtreeTULog2MaxSize; } … … 677 701 //==== Motion search ======== 678 702 Bool getDisableIntraPUsInInterSlices () const { return m_bDisableIntraPUsInInterSlices; } 679 Int getFastSearch () const { return m_iFastSearch; }703 MESearchMethod getMotionEstimationSearchMethod ( ) const { return m_motionEstimationSearchMethod; } 680 704 Int getSearchRange () const { return m_iSearchRange; } 681 705 Bool getClipForBiPredMeEnabled () const { return m_bClipForBiPredMeEnabled; } 682 706 Bool getFastMEAssumingSmootherMVEnabled ( ) const { return m_bFastMEAssumingSmootherMVEnabled; } 707 Int getMinSearchWindow () const { return m_minSearchWindow; } 708 Bool getRestrictMESampling () const { return m_bRestrictMESampling; } 709 683 710 #if NH_MV 684 711 Bool getUseDisparitySearchRangeRestriction () { return m_bUseDisparitySearchRangeRestriction; } … … 701 728 Void setUseSelectiveRDOQ ( Bool b ) { m_useSelectiveRDOQ = b; } 702 729 #endif 703 Void setRDpenalty ( UInt b ) { m_rdPenalty = b; }704 Void set UseFastEnc ( Bool b ) { m_bUseFastEnc = b; }730 Void setRDpenalty ( UInt u ) { m_rdPenalty = u; } 731 Void setFastInterSearchMode ( FastInterSearchMode m ) { m_fastInterSearchMode = m; } 705 732 Void setUseEarlyCU ( Bool b ) { m_bUseEarlyCU = b; } 706 733 Void setUseFastDecisionForMerge ( Bool b ) { m_useFastDecisionForMerge = b; } … … 729 756 #endif 730 757 Int getRDpenalty () { return m_rdPenalty; } 731 Bool getUseFastEnc () { return m_bUseFastEnc;}758 FastInterSearchMode getFastInterSearchMode() const{ return m_fastInterSearchMode; } 732 759 Bool getUseEarlyCU () { return m_bUseEarlyCU; } 733 760 Bool getUseFastDecisionForMerge () { return m_useFastDecisionForMerge; } … … 812 839 UInt getRowHeight ( UInt rowIdx ) { return m_tileRowHeight[rowIdx]; } 813 840 Void xCheckGSParameters(); 814 Void set WaveFrontSynchro(Int iWaveFrontSynchro) { m_iWaveFrontSynchro = iWaveFrontSynchro; }815 Int getWaveFrontsynchro() { return m_iWaveFrontSynchro; }816 Void setDecodedPictureHashSEI Enabled(Int b) { m_decodedPictureHashSEIEnabled = b; }817 Int getDecodedPictureHashSEIEnabled() { return m_decodedPictureHashSEIEnabled; }818 Void setBufferingPeriodSEIEnabled( Int b){ m_bufferingPeriodSEIEnabled = b; }819 Int getBufferingPeriodSEIEnabled(){ return m_bufferingPeriodSEIEnabled; }820 Void setPictureTimingSEIEnabled( Int b){ m_pictureTimingSEIEnabled = b; }821 Int getPictureTimingSEIEnabled(){ return m_pictureTimingSEIEnabled; }822 Void setRecoveryPointSEIEnabled( Int b){ m_recoveryPointSEIEnabled = b; }823 Int getRecoveryPointSEIEnabled(){ return m_recoveryPointSEIEnabled; }841 Void setEntropyCodingSyncEnabledFlag(Bool b) { m_entropyCodingSyncEnabledFlag = b; } 842 Bool getEntropyCodingSyncEnabledFlag() const { return m_entropyCodingSyncEnabledFlag; } 843 Void setDecodedPictureHashSEIType(HashType m) { m_decodedPictureHashSEIType = m; } 844 HashType getDecodedPictureHashSEIType() const { return m_decodedPictureHashSEIType; } 845 Void setBufferingPeriodSEIEnabled(Bool b) { m_bufferingPeriodSEIEnabled = b; } 846 Bool getBufferingPeriodSEIEnabled() const { return m_bufferingPeriodSEIEnabled; } 847 Void setPictureTimingSEIEnabled(Bool b) { m_pictureTimingSEIEnabled = b; } 848 Bool getPictureTimingSEIEnabled() const { return m_pictureTimingSEIEnabled; } 849 Void setRecoveryPointSEIEnabled(Bool b) { m_recoveryPointSEIEnabled = b; } 850 Bool getRecoveryPointSEIEnabled() const { return m_recoveryPointSEIEnabled; } 824 851 Void setToneMappingInfoSEIEnabled(Bool b) { m_toneMappingInfoSEIEnabled = b; } 825 852 Bool getToneMappingInfoSEIEnabled() { return m_toneMappingInfoSEIEnabled; } … … 876 903 Void setTMISEIExtendedWhiteLevelLumaCodeValue(Int b) { m_extendedWhiteLevelLumaCodeValue =b; } 877 904 Int getTMISEIExtendedWhiteLevelLumaCodeValue() { return m_extendedWhiteLevelLumaCodeValue; } 878 Void setFramePackingArrangementSEIEnabled( Int b){ m_framePackingSEIEnabled = b; }879 Int getFramePackingArrangementSEIEnabled(){ return m_framePackingSEIEnabled; }905 Void setFramePackingArrangementSEIEnabled(Bool b) { m_framePackingSEIEnabled = b; } 906 Bool getFramePackingArrangementSEIEnabled() const { return m_framePackingSEIEnabled; } 880 907 Void setFramePackingArrangementSEIType(Int b) { m_framePackingSEIType = b; } 881 908 Int getFramePackingArrangementSEIType() { return m_framePackingSEIType; } … … 886 913 Void setFramePackingArrangementSEIInterpretation(Int b) { m_framePackingSEIInterpretation = b; } 887 914 Int getFramePackingArrangementSEIInterpretation() { return m_framePackingSEIInterpretation; } 888 Void setSegmentedRectFramePackingArrangementSEIEnabled( Int b){ m_segmentedRectFramePackingSEIEnabled = b; }889 Int getSegmentedRectFramePackingArrangementSEIEnabled(){ return m_segmentedRectFramePackingSEIEnabled; }915 Void setSegmentedRectFramePackingArrangementSEIEnabled(Bool b) { m_segmentedRectFramePackingSEIEnabled = b; } 916 Bool getSegmentedRectFramePackingArrangementSEIEnabled() const { return m_segmentedRectFramePackingSEIEnabled; } 890 917 Void setSegmentedRectFramePackingArrangementSEICancel(Int b) { m_segmentedRectFramePackingSEICancel = b; } 891 918 Int getSegmentedRectFramePackingArrangementSEICancel() { return m_segmentedRectFramePackingSEICancel; } … … 896 923 Void setDisplayOrientationSEIAngle(Int b) { m_displayOrientationSEIAngle = b; } 897 924 Int getDisplayOrientationSEIAngle() { return m_displayOrientationSEIAngle; } 898 Void setTemporalLevel0IndexSEIEnabled( Int b){ m_temporalLevel0IndexSEIEnabled = b; }899 Int getTemporalLevel0IndexSEIEnabled(){ return m_temporalLevel0IndexSEIEnabled; }900 Void setGradualDecodingRefreshInfoEnabled( Int b){ m_gradualDecodingRefreshInfoEnabled = b; }901 Int getGradualDecodingRefreshInfoEnabled(){ return m_gradualDecodingRefreshInfoEnabled; }925 Void setTemporalLevel0IndexSEIEnabled(Bool b) { m_temporalLevel0IndexSEIEnabled = b; } 926 Bool getTemporalLevel0IndexSEIEnabled() const { return m_temporalLevel0IndexSEIEnabled; } 927 Void setGradualDecodingRefreshInfoEnabled(Bool b) { m_gradualDecodingRefreshInfoEnabled = b; } 928 Bool getGradualDecodingRefreshInfoEnabled() const { return m_gradualDecodingRefreshInfoEnabled; } 902 929 Void setNoDisplaySEITLayer(Int b) { m_noDisplaySEITLayer = b; } 903 930 Int getNoDisplaySEITLayer() { return m_noDisplaySEITLayer; } 904 Void setDecodingUnitInfoSEIEnabled( Int b){ m_decodingUnitInfoSEIEnabled = b; }905 Int getDecodingUnitInfoSEIEnabled(){ return m_decodingUnitInfoSEIEnabled; }906 Void setSOPDescriptionSEIEnabled( Int b){ m_SOPDescriptionSEIEnabled = b; }907 Int getSOPDescriptionSEIEnabled(){ return m_SOPDescriptionSEIEnabled; }908 Void setScalableNestingSEIEnabled( Int b){ m_scalableNestingSEIEnabled = b; }909 Int getScalableNestingSEIEnabled(){ return m_scalableNestingSEIEnabled; }931 Void setDecodingUnitInfoSEIEnabled(Bool b) { m_decodingUnitInfoSEIEnabled = b; } 932 Bool getDecodingUnitInfoSEIEnabled() const { return m_decodingUnitInfoSEIEnabled; } 933 Void setSOPDescriptionSEIEnabled(Bool b) { m_SOPDescriptionSEIEnabled = b; } 934 Bool getSOPDescriptionSEIEnabled() const { return m_SOPDescriptionSEIEnabled; } 935 Void setScalableNestingSEIEnabled(Bool b) { m_scalableNestingSEIEnabled = b; } 936 Bool getScalableNestingSEIEnabled() const { return m_scalableNestingSEIEnabled; } 910 937 Void setTMCTSSEIEnabled(Bool b) { m_tmctsSEIEnabled = b; } 911 938 Bool getTMCTSSEIEnabled() { return m_tmctsSEIEnabled; } … … 939 966 Void setKneeSEIOutputKneePoint(Int *p) { m_kneeSEIOutputKneePoint = p; } 940 967 Int* getKneeSEIOutputKneePoint() { return m_kneeSEIOutputKneePoint; } 968 Void setColourRemapInfoSEIFileRoot( const std::string &s ) { m_colourRemapSEIFileRoot = s; } 969 const std::string &getColourRemapInfoSEIFileRoot() const { return m_colourRemapSEIFileRoot; } 970 941 971 Void setMasteringDisplaySEI(const TComSEIMasteringDisplay &src) { m_masteringDisplay = src; } 942 972 const TComSEIMasteringDisplay &getMasteringDisplaySEI() const { return m_masteringDisplay; } … … 984 1014 Void setUseScalingListId ( ScalingListMode u ) { m_useScalingListId = u; } 985 1015 ScalingListMode getUseScalingListId () { return m_useScalingListId; } 986 Void setScalingListFile ( Char* pch ) { m_scalingListFile = pch;}987 Char* getScalingListFile () { return m_scalingListFile;}1016 Void setScalingListFileName ( const std::string &s ) { m_scalingListFileName = s; } 1017 const std::string& getScalingListFileName () const { return m_scalingListFileName; } 988 1018 Void setTMVPModeId ( Int u ) { m_TMVPModeId = u; } 989 1019 Int getTMVPModeId () { return m_TMVPModeId; } 1020 WeightedPredictionMethod getWeightedPredictionMethod() const { return m_weightedPredictionMethod; } 1021 Void setWeightedPredictionMethod( WeightedPredictionMethod m ) { m_weightedPredictionMethod = m; } 990 1022 Void setSignHideFlag( Bool signHideFlag ) { m_signHideFlag = signHideFlag; } 991 1023 Bool getSignHideFlag() { return m_signHideFlag; } … … 1004 1036 Bool getForceIntraQP () { return m_RCForceIntraQP; } 1005 1037 Void setForceIntraQP ( Bool b ) { m_RCForceIntraQP = b; } 1038 1039 #if U0132_TARGET_BITS_SATURATION 1040 Bool getCpbSaturationEnabled() { return m_RCCpbSaturationEnabled;} 1041 Void setCpbSaturationEnabled( Bool b ) { m_RCCpbSaturationEnabled = b; } 1042 UInt getCpbSize () { return m_RCCpbSize;} 1043 Void setCpbSize ( UInt ui ) { m_RCCpbSize = ui; } 1044 Double getInitialCpbFullness () { return m_RCInitialCpbFullness; } 1045 Void setInitialCpbFullness (Double f) { m_RCInitialCpbFullness = f; } 1046 #endif 1006 1047 1007 1048 #if KWU_RC_MADPRED_E0227 … … 1132 1173 Bool getLowerBitRateConstraintFlag() const { return m_lowerBitRateConstraintFlag; } 1133 1174 Void setLowerBitRateConstraintFlag(Bool b) { m_lowerBitRateConstraintFlag=b; } 1134 Bool getChromaSamplingFilterHintEnabled() { return m_chromaSamplingFilterHintEnabled;}1135 Void setChromaSamplingFilterHintEnabled(Bool i) { m_chromaSamplingFilterHintEnabled = i;}1136 Int getChromaSamplingHorFilterIdc() { return m_chromaSamplingHorFilterIdc;}1137 Void setChromaSamplingHorFilterIdc(Int i) { m_chromaSamplingHorFilterIdc = i;}1138 Int getChromaSamplingVerFilterIdc() { return m_chromaSamplingVerFilterIdc;}1139 Void setChromaSamplingVerFilterIdc(Int i) { m_chromaSamplingVerFilterIdc = i;}1175 Bool getChromaResamplingFilterHintEnabled() { return m_chromaResamplingFilterHintEnabled;} 1176 Void setChromaResamplingFilterHintEnabled(Bool i) { m_chromaResamplingFilterHintEnabled = i;} 1177 Int getChromaResamplingHorFilterIdc() { return m_chromaResamplingHorFilterIdc;} 1178 Void setChromaResamplingHorFilterIdc(Int i) { m_chromaResamplingHorFilterIdc = i;} 1179 Int getChromaResamplingVerFilterIdc() { return m_chromaResamplingVerFilterIdc;} 1180 Void setChromaResamplingVerFilterIdc(Int i) { m_chromaResamplingVerFilterIdc = i;} 1140 1181 1141 1182 Void setSummaryOutFilename(const std::string &s) { m_summaryOutFilename = s; } -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncCu.cpp
r1321 r1360 2216 2216 *earlyDetectionSkipMode = true; 2217 2217 } 2218 else if(m_pcEncCfg->get FastSearch() !=SELECTIVE)2218 else if(m_pcEncCfg->getMotionEstimationSearchMethod() != MESEARCH_SELECTIVE) 2219 2219 { 2220 2220 Int absoulte_MV=0; -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1356 r1360 219 219 } 220 220 221 Void TEncGOP::xWriteAccessUnitDelimiter (AccessUnit &accessUnit, TComSlice *slice) 222 { 223 AUDWriter audWriter; 224 OutputNALUnit nalu(NAL_UNIT_ACCESS_UNIT_DELIMITER); 225 226 Int picType = slice->isIntra() ? 0 : (slice->isInterP() ? 1 : 2); 227 228 audWriter.codeAUD(nalu.m_Bitstream, picType); 229 accessUnit.push_front(new NALUnitEBSP(nalu)); 230 } 231 221 232 // write SEI list into one NAL unit and add it to the Access unit at auPos 222 233 Void TEncGOP::xWriteSEI (NalUnitType naluType, SEIMessages& seiMessages, AccessUnit &accessUnit, AccessUnit::iterator &auPos, Int temporalId, const TComSPS *sps) … … 485 496 } 486 497 498 if(m_pcCfg->getChromaResamplingFilterHintEnabled()) 499 { 500 SEIChromaResamplingFilterHint *seiChromaResamplingFilterHint = new SEIChromaResamplingFilterHint; 501 m_seiEncoder.initSEIChromaResamplingFilterHint(seiChromaResamplingFilterHint, m_pcCfg->getChromaResamplingHorFilterIdc(), m_pcCfg->getChromaResamplingVerFilterIdc()); 502 seiMessages.push_back(seiChromaResamplingFilterHint); 503 } 504 505 487 506 #if NH_MV 488 507 #if !NH_MV_SEI … … 545 564 } 546 565 547 if(slice->getSPS()->getVuiParametersPresentFlag() && m_pcCfg->getChromaSamplingFilterHintEnabled() && ( slice->getSliceType() == I_SLICE ))548 {549 SEIChromaSamplingFilterHint *seiChromaSamplingFilterHint = new SEIChromaSamplingFilterHint;550 m_seiEncoder.initSEIChromaSamplingFilterHint(seiChromaSamplingFilterHint, m_pcCfg->getChromaSamplingHorFilterIdc(), m_pcCfg->getChromaSamplingVerFilterIdc());551 seiMessages.push_back(seiChromaSamplingFilterHint);552 }553 554 566 if( m_pcEncTop->getNoDisplaySEITLayer() && ( slice->getTLayer() >= m_pcEncTop->getNoDisplaySEITLayer() ) ) 555 567 { … … 557 569 seiNoDisplay->m_noDisplay = true; 558 570 seiMessages.push_back(seiNoDisplay); 571 } 572 573 // insert one Colour Remapping Info SEI for the picture (if the file exists) 574 if (!m_pcCfg->getColourRemapInfoSEIFileRoot().empty()) 575 { 576 SEIColourRemappingInfo *seiColourRemappingInfo = new SEIColourRemappingInfo(); 577 const Bool success = m_seiEncoder.initSEIColourRemappingInfo(seiColourRemappingInfo, slice->getPOC() ); 578 579 if(success) 580 { 581 seiMessages.push_back(seiColourRemappingInfo); 582 } 583 else 584 { 585 delete seiColourRemappingInfo; 586 } 559 587 } 560 588 } … … 577 605 Void TEncGOP::xCreatePictureTimingSEI (Int IRAPGOPid, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, SEIMessages& duInfoSeiMessages, TComSlice *slice, Bool isField, std::deque<DUData> &duData) 578 606 { 579 Int picSptDpbOutputDuDelay = 0;580 607 #if !NH_MV 581 608 SEIPictureTiming *pictureTimingSEI = new SEIPictureTiming(); … … 590 617 ( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) ) 591 618 { 592 #if NH_MV 593 // Preliminary fix to avoid memory leak. 619 Int picSptDpbOutputDuDelay = 0; 594 620 SEIPictureTiming *pictureTimingSEI = new SEIPictureTiming(); 595 #endif596 621 597 622 // DU parameters … … 712 737 } 713 738 } 739 740 if( !m_pcCfg->getPictureTimingSEIEnabled() && pictureTimingSEI ) 741 { 742 delete pictureTimingSEI; 743 } 714 744 } 715 745 } … … 745 775 746 776 // The last DU may have a trailing SEI 747 if (m_pcCfg->getDecodedPictureHashSEI Enabled())777 if (m_pcCfg->getDecodedPictureHashSEIType()!=HASHTYPE_NONE) 748 778 { 749 779 duData.back().accumBitsDU += ( 20 << 3 ); // probably around 20 bytes - should be further adjusted, e.g. by type … … 867 897 if (cabacZeroWordPaddingEnabled) 868 898 { 869 std::vector< Char> zeroBytesPadding(numberOfAdditionalCabacZeroBytes,Char(0));899 std::vector<UChar> zeroBytesPadding(numberOfAdditionalCabacZeroBytes, UChar(0)); 870 900 for(std::size_t i=0; i<numberOfAdditionalCabacZeroWords; i++) 871 901 { 872 902 zeroBytesPadding[i*3+2]=3; // 00 00 03 873 903 } 874 nalUnitData.write( &(zeroBytesPadding[0]), numberOfAdditionalCabacZeroBytes);904 nalUnitData.write(reinterpret_cast<const TChar*>(&(zeroBytesPadding[0])), numberOfAdditionalCabacZeroBytes); 875 905 printf("Adding %d bytes of padding\n", UInt(numberOfAdditionalCabacZeroWords*3)); 876 906 } … … 1058 1088 { 1059 1089 return 1; 1090 } 1091 } 1092 1093 1094 static Void 1095 printHash(const HashType hashType, const std::string &digestStr) 1096 { 1097 const TChar *decodedPictureHashModeName; 1098 switch (hashType) 1099 { 1100 case HASHTYPE_MD5: 1101 decodedPictureHashModeName = "MD5"; 1102 break; 1103 case HASHTYPE_CRC: 1104 decodedPictureHashModeName = "CRC"; 1105 break; 1106 case HASHTYPE_CHECKSUM: 1107 decodedPictureHashModeName = "Checksum"; 1108 break; 1109 default: 1110 decodedPictureHashModeName = NULL; 1111 break; 1112 } 1113 if (decodedPictureHashModeName != NULL) 1114 { 1115 if (digestStr.empty()) 1116 { 1117 printf(" [%s:%s]", decodedPictureHashModeName, "?"); 1118 } 1119 else 1120 { 1121 printf(" [%s:%s]", decodedPictureHashModeName, digestStr.c_str()); 1122 } 1060 1123 } 1061 1124 } … … 1606 1669 #endif 1607 1670 1608 /////////////////////////////////////////////////////////////////////////////////////////////////// Compress a slice 1609 // Slice compression 1610 if (m_pcCfg->getUseASR()) 1671 if (m_pcCfg->getUseASR() && pcSlice->getSliceType()!=I_SLICE) 1611 1672 { 1612 1673 m_pcSliceEncoder->setSearchRange(pcSlice); … … 1654 1715 } 1655 1716 m_pcRateCtrl->initRCPic( frameLevel ); 1717 estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits(); 1656 1718 1657 1719 #if KWU_RC_MADPRED_E0227 … … 1662 1724 #endif 1663 1725 1664 estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits(); 1726 #if U0132_TARGET_BITS_SATURATION 1727 if (m_pcRateCtrl->getCpbSaturationEnabled() && frameLevel != 0) 1728 { 1729 Int estimatedCpbFullness = m_pcRateCtrl->getCpbState() + m_pcRateCtrl->getBufferingRate(); 1730 1731 // prevent overflow 1732 if (estimatedCpbFullness - estimatedBits > (Int)(m_pcRateCtrl->getCpbSize()*0.9f)) 1733 { 1734 estimatedBits = estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.9f); 1735 } 1736 1737 estimatedCpbFullness -= m_pcRateCtrl->getBufferingRate(); 1738 // prevent underflow 1739 if (estimatedCpbFullness - estimatedBits < (Int)(m_pcRateCtrl->getCpbSize()*0.1f)) 1740 { 1741 estimatedBits = max(200, estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.1f)); 1742 } 1743 1744 m_pcRateCtrl->getRCPic()->setTargetBits(estimatedBits); 1745 } 1746 #endif 1665 1747 1666 1748 Int sliceQP = m_pcCfg->getInitialQP(); … … 1683 1765 Int bits = m_pcRateCtrl->getRCSeq()->getLeftAverageBits(); 1684 1766 bits = m_pcRateCtrl->getRCPic()->getRefineBitsForIntra( bits ); 1767 1768 #if U0132_TARGET_BITS_SATURATION 1769 if (m_pcRateCtrl->getCpbSaturationEnabled() ) 1770 { 1771 Int estimatedCpbFullness = m_pcRateCtrl->getCpbState() + m_pcRateCtrl->getBufferingRate(); 1772 1773 // prevent overflow 1774 if (estimatedCpbFullness - bits > (Int)(m_pcRateCtrl->getCpbSize()*0.9f)) 1775 { 1776 bits = estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.9f); 1777 } 1778 1779 estimatedCpbFullness -= m_pcRateCtrl->getBufferingRate(); 1780 // prevent underflow 1781 if (estimatedCpbFullness - bits < (Int)(m_pcRateCtrl->getCpbSize()*0.1f)) 1782 { 1783 bits = estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.1f); 1784 } 1785 } 1786 #endif 1787 1685 1788 if ( bits < 200 ) 1686 1789 { … … 1835 1938 m_bSeqFirst = false; 1836 1939 } 1940 if (m_pcCfg->getAccessUnitDelimiter()) 1941 { 1942 xWriteAccessUnitDelimiter(accessUnit, pcSlice); 1943 } 1837 1944 1838 1945 // reset presence of BP SEI indication … … 2002 2109 2003 2110 std::string digestStr; 2004 if (m_pcCfg->getDecodedPictureHashSEI Enabled())2111 if (m_pcCfg->getDecodedPictureHashSEIType()!=HASHTYPE_NONE) 2005 2112 { 2006 2113 SEIDecodedPictureHash *decodedPictureHashSei = new SEIDecodedPictureHash(); … … 2014 2121 xCalculateAddPSNRs( isField, isTff, iGOPid, pcPic, accessUnit, rcListPic, dEncTime, snr_conversion, printFrameMSE ); 2015 2122 2016 if (!digestStr.empty()) 2017 { 2018 if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 1) 2019 { 2020 printf(" [MD5:%s]", digestStr.c_str()); 2021 } 2022 else if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 2) 2023 { 2024 printf(" [CRC:%s]", digestStr.c_str()); 2025 } 2026 else if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 3) 2027 { 2028 printf(" [Checksum:%s]", digestStr.c_str()); 2029 } 2030 } 2123 printHash(m_pcCfg->getDecodedPictureHashSEIType(), digestStr); 2031 2124 2032 2125 if ( m_pcCfg->getUseRateCtrl() ) … … 2051 2144 m_pcRateCtrl->getRCGOP()->updateAfterPicture( estimatedBits ); 2052 2145 } 2146 #if U0132_TARGET_BITS_SATURATION 2147 if (m_pcRateCtrl->getCpbSaturationEnabled()) 2148 { 2149 m_pcRateCtrl->updateCpbState(actualTotalBits); 2150 printf(" [CPB %6d bits]", m_pcRateCtrl->getCpbState()); 2151 } 2152 #endif 2053 2153 } 2054 2154 … … 2352 2452 if (conversion!=IPCOLOURSPACE_UNCHANGED) 2353 2453 { 2354 cscd.create (pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), pcPicD->getChromaFormat(), pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), 0, false);2454 cscd.createWithoutCUInfo(pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), pcPicD->getChromaFormat() ); 2355 2455 TVideoIOYuv::ColourSpaceConvert(*pcPicD, cscd, conversion, false); 2356 2456 } … … 2452 2552 } 2453 2553 2454 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');2554 TChar c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 2455 2555 if (!pcSlice->isReferenced()) 2456 2556 { … … 2506 2606 printf(" [ET %5.0f ]", dEncTime ); 2507 2607 2608 // printf(" [WP %d]", pcSlice->getUseWeightedPrediction()); 2609 2508 2610 for (Int iRefList = 0; iRefList < 2; iRefList++) 2509 2611 { … … 2555 2657 { 2556 2658 TComPicYuv &reconField=*(apcPicRecFields[fieldNum]); 2557 cscd[fieldNum].create (reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), reconField.getChromaFormat(), reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), 0, false);2659 cscd[fieldNum].createWithoutCUInfo(reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), reconField.getChromaFormat() ); 2558 2660 TVideoIOYuv::ColourSpaceConvert(reconField, cscd[fieldNum], conversion, false); 2559 2661 apcPicRecFields[fieldNum]=cscd+fieldNum; -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncGOP.h
r1313 r1360 220 220 Double xCalculateRVM(); 221 221 222 Void xWriteAccessUnitDelimiter (AccessUnit &accessUnit, TComSlice *slice); 223 222 224 Void xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const TComSPS *sps, const TComPPS *pps); 223 225 Void xCreatePerPictureSEIMessages (Int picInGOP, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, TComSlice *slice); -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncPreanalyzer.cpp
r1313 r1360 87 87 UInt64 uiSum[4] = {0, 0, 0, 0}; 88 88 UInt64 uiSumSq[4] = {0, 0, 0, 0}; 89 UInt uiNumPixInAQPart = 0;90 89 UInt by = 0; 91 90 for ( ; by < uiCurrAQPartHeight>>1; by++ ) 92 91 { 93 92 UInt bx = 0; 94 for ( ; bx < uiCurrAQPartWidth>>1; bx++ , uiNumPixInAQPart++)93 for ( ; bx < uiCurrAQPartWidth>>1; bx++ ) 95 94 { 96 95 uiSum [0] += pBlkY[bx]; 97 96 uiSumSq[0] += pBlkY[bx] * pBlkY[bx]; 98 97 } 99 for ( ; bx < uiCurrAQPartWidth; bx++ , uiNumPixInAQPart++)98 for ( ; bx < uiCurrAQPartWidth; bx++ ) 100 99 { 101 100 uiSum [1] += pBlkY[bx]; … … 107 106 { 108 107 UInt bx = 0; 109 for ( ; bx < uiCurrAQPartWidth>>1; bx++ , uiNumPixInAQPart++)108 for ( ; bx < uiCurrAQPartWidth>>1; bx++ ) 110 109 { 111 110 uiSum [2] += pBlkY[bx]; 112 111 uiSumSq[2] += pBlkY[bx] * pBlkY[bx]; 113 112 } 114 for ( ; bx < uiCurrAQPartWidth; bx++ , uiNumPixInAQPart++)113 for ( ; bx < uiCurrAQPartWidth; bx++ ) 115 114 { 116 115 uiSum [3] += pBlkY[bx]; … … 120 119 } 121 120 121 assert ((uiCurrAQPartWidth&1)==0); 122 assert ((uiCurrAQPartHeight&1)==0); 123 const UInt pixelWidthOfQuadrants = uiCurrAQPartWidth >>1; 124 const UInt pixelHeightOfQuadrants = uiCurrAQPartHeight>>1; 125 const UInt numPixInAQPart = pixelWidthOfQuadrants * pixelHeightOfQuadrants; 126 122 127 Double dMinVar = DBL_MAX; 128 if (numPixInAQPart!=0) 129 { 123 130 for ( Int i=0; i<4; i++) 124 131 { 125 const Double dAverage = Double(uiSum[i]) / uiNumPixInAQPart;126 const Double dVariance = Double(uiSumSq[i]) / uiNumPixInAQPart - dAverage * dAverage;132 const Double dAverage = Double(uiSum[i]) / numPixInAQPart; 133 const Double dVariance = Double(uiSumSq[i]) / numPixInAQPart - dAverage * dAverage; 127 134 dMinVar = min(dMinVar, dVariance); 135 } 136 } 137 else 138 { 139 dMinVar = 0.0; 128 140 } 129 141 const Double dActivity = 1.0 + dMinVar; -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncRateCtrl.cpp
r1313 r1360 1639 1639 m_encRCSeq->initLCUPara(); 1640 1640 } 1641 #if U0132_TARGET_BITS_SATURATION 1642 m_CpbSaturationEnabled = false; 1643 m_cpbSize = targetBitrate; 1644 m_cpbState = (UInt)(m_cpbSize*0.5f); 1645 m_bufferingRate = (Int)(targetBitrate / frameRate); 1646 #endif 1641 1647 1642 1648 #if KWU_RC_MADPRED_E0227 … … 1664 1670 } 1665 1671 1672 #if U0132_TARGET_BITS_SATURATION 1673 Int TEncRateCtrl::updateCpbState(Int actualBits) 1674 { 1675 Int cpbState = 1; 1676 1677 m_cpbState -= actualBits; 1678 if (m_cpbState < 0) 1679 { 1680 cpbState = -1; 1681 } 1682 1683 m_cpbState += m_bufferingRate; 1684 if (m_cpbState > m_cpbSize) 1685 { 1686 cpbState = 0; 1687 } 1688 1689 return cpbState; 1690 } 1691 1692 Void TEncRateCtrl::initHrdParam(const TComHRD* pcHrd, Int iFrameRate, Double fInitialCpbFullness) 1693 { 1694 m_CpbSaturationEnabled = true; 1695 m_cpbSize = (pcHrd->getCpbSizeValueMinus1(0, 0, 0) + 1) << (4 + pcHrd->getCpbSizeScale()); 1696 m_cpbState = (UInt)(m_cpbSize*fInitialCpbFullness); 1697 m_bufferingRate = (UInt)(((pcHrd->getBitRateValueMinus1(0, 0, 0) + 1) << (6 + pcHrd->getBitRateScale())) / iFrameRate); 1698 printf("\nHRD - [Initial CPB state %6d] [CPB Size %6d] [Buffering Rate %6d]\n", m_cpbState, m_cpbSize, m_bufferingRate); 1699 } 1700 #endif 1701 1666 1702 Void TEncRateCtrl::destroyRCGOP() 1667 1703 { -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncRateCtrl.h
r1313 r1360 285 285 TRCLCU& getLCU( Int LCUIdx ) { return m_LCUs[LCUIdx]; } 286 286 Int getPicActualHeaderBits() { return m_picActualHeaderBits; } 287 #if U0132_TARGET_BITS_SATURATION 288 Void setBitLeft(Int bits) { m_bitsLeft = bits; } 289 #endif 287 290 Void setTargetBits( Int bits ) { m_targetBits = bits; m_bitsLeft = bits;} 288 291 Void setTotalIntraCost(Double cost) { m_totalCostIntra = cost; } … … 369 372 Void setLayerID(Int layerid) { m_LayerID = layerid; } 370 373 #endif 374 #if U0132_TARGET_BITS_SATURATION 375 Bool getCpbSaturationEnabled() { return m_CpbSaturationEnabled; } 376 UInt getCpbState() { return m_cpbState; } 377 UInt getCpbSize() { return m_cpbSize; } 378 UInt getBufferingRate() { return m_bufferingRate; } 379 Int updateCpbState(Int actualBits); 380 Void initHrdParam(const TComHRD* pcHrd, Int iFrameRate, Double fInitialCpbFullness); 381 #endif 382 371 383 private: 372 384 TEncRCSeq* m_encRCSeq; … … 375 387 list<TEncRCPic*> m_listRCPictures; 376 388 Int m_RCQP; 389 #if U0132_TARGET_BITS_SATURATION 390 Bool m_CpbSaturationEnabled; // Enable target bits saturation to avoid CPB overflow and underflow 391 Int m_cpbState; // CPB State 392 UInt m_cpbSize; // CPB size 393 UInt m_bufferingRate; // Buffering rate 394 #endif 395 377 396 #if KWU_RC_MADPRED_E0227 378 397 Int m_LayerID; -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r1321 r1360 908 908 m_signLineBuf1 = NULL; 909 909 } 910 m_signLineBuf1 = new Char[m_lineBufWidth+1];910 m_signLineBuf1 = new SChar[m_lineBufWidth+1]; 911 911 912 912 if (m_signLineBuf2) … … 915 915 m_signLineBuf2 = NULL; 916 916 } 917 m_signLineBuf2 = new Char[m_lineBufWidth+1];917 m_signLineBuf2 = new SChar[m_lineBufWidth+1]; 918 918 } 919 919 920 920 Int x,y, startX, startY, endX, endY, edgeType, firstLineStartX, firstLineEndX; 921 Char signLeft, signRight, signDown;921 SChar signLeft, signRight, signDown; 922 922 Int64 *diff, *count; 923 923 Pel *srcLine, *orgLine; … … 949 949 for (y=0; y<endY; y++) 950 950 { 951 signLeft = ( Char)sgn(srcLine[startX] - srcLine[startX-1]);951 signLeft = (SChar)sgn(srcLine[startX] - srcLine[startX-1]); 952 952 for (x=startX; x<endX; x++) 953 953 { 954 signRight = ( Char)sgn(srcLine[x] - srcLine[x+1]);954 signRight = (SChar)sgn(srcLine[x] - srcLine[x+1]); 955 955 edgeType = signRight + signLeft; 956 956 signLeft = -signRight; … … 971 971 for(y=0; y<skipLinesB[typeIdx]; y++) 972 972 { 973 signLeft = ( Char)sgn(srcLine[startX] - srcLine[startX-1]);973 signLeft = (SChar)sgn(srcLine[startX] - srcLine[startX-1]); 974 974 for (x=startX; x<endX; x++) 975 975 { 976 signRight = ( Char)sgn(srcLine[x] - srcLine[x+1]);976 signRight = (SChar)sgn(srcLine[x] - srcLine[x+1]); 977 977 edgeType = signRight + signLeft; 978 978 signLeft = -signRight; … … 992 992 diff +=2; 993 993 count+=2; 994 Char *signUpLine = m_signLineBuf1;994 SChar *signUpLine = m_signLineBuf1; 995 995 996 996 startX = (!isCalculatePreDeblockSamples) ? 0 … … 1011 1011 for (x=startX; x<endX; x++) 1012 1012 { 1013 signUpLine[x] = ( Char)sgn(srcLine[x] - srcLineAbove[x]);1013 signUpLine[x] = (SChar)sgn(srcLine[x] - srcLineAbove[x]); 1014 1014 } 1015 1015 … … 1021 1021 for (x=startX; x<endX; x++) 1022 1022 { 1023 signDown = ( Char)sgn(srcLine[x] - srcLineBelow[x]);1023 signDown = (SChar)sgn(srcLine[x] - srcLineBelow[x]); 1024 1024 edgeType = signDown + signUpLine[x]; 1025 1025 signUpLine[x]= -signDown; … … 1061 1061 diff +=2; 1062 1062 count+=2; 1063 Char *signUpLine, *signDownLine, *signTmpLine;1063 SChar *signUpLine, *signDownLine, *signTmpLine; 1064 1064 1065 1065 signUpLine = m_signLineBuf1; … … 1079 1079 for (x=startX; x<endX+1; x++) 1080 1080 { 1081 signUpLine[x] = ( Char)sgn(srcLineBelow[x] - srcLine[x-1]);1081 signUpLine[x] = (SChar)sgn(srcLineBelow[x] - srcLine[x-1]); 1082 1082 } 1083 1083 … … 1103 1103 for (x=startX; x<endX; x++) 1104 1104 { 1105 signDown = ( Char)sgn(srcLine[x] - srcLineBelow[x+1]);1105 signDown = (SChar)sgn(srcLine[x] - srcLineBelow[x+1]); 1106 1106 edgeType = signDown + signUpLine[x]; 1107 1107 diff [edgeType] += (orgLine[x] - srcLine[x]); … … 1110 1110 signDownLine[x+1] = -signDown; 1111 1111 } 1112 signDownLine[startX] = ( Char)sgn(srcLineBelow[startX] - srcLine[startX-1]);1112 signDownLine[startX] = (SChar)sgn(srcLineBelow[startX] - srcLine[startX-1]); 1113 1113 1114 1114 signTmpLine = signUpLine; … … 1148 1148 diff +=2; 1149 1149 count+=2; 1150 Char *signUpLine = m_signLineBuf1+1;1150 SChar *signUpLine = m_signLineBuf1+1; 1151 1151 1152 1152 startX = (!isCalculatePreDeblockSamples) ? (isLeftAvail ? 0 : 1) … … 1162 1162 for (x=startX-1; x<endX; x++) 1163 1163 { 1164 signUpLine[x] = ( Char)sgn(srcLineBelow[x] - srcLine[x+1]);1164 signUpLine[x] = (SChar)sgn(srcLineBelow[x] - srcLine[x+1]); 1165 1165 } 1166 1166 … … 1191 1191 for(x=startX; x<endX; x++) 1192 1192 { 1193 signDown = ( Char)sgn(srcLine[x] - srcLineBelow[x-1]);1193 signDown = (SChar)sgn(srcLine[x] - srcLineBelow[x-1]); 1194 1194 edgeType = signDown + signUpLine[x]; 1195 1195 … … 1199 1199 signUpLine[x-1] = -signDown; 1200 1200 } 1201 signUpLine[endX-1] = ( Char)sgn(srcLineBelow[endX-1] - srcLine[endX]);1201 signUpLine[endX-1] = (SChar)sgn(srcLineBelow[endX-1] - srcLine[endX]); 1202 1202 srcLine += srcStride; 1203 1203 orgLine += orgStride; -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1321 r1360 74 74 }; 75 75 76 static const UInt s_auiDFilter[9] =77 {78 0, 1, 0,79 2, 3, 2,80 0, 1, 081 };82 83 76 static Void offsetSubTUCBFs(TComTU &rTu, const ComponentID compID) 84 77 { … … 120 113 , m_iSearchRange (0) 121 114 , m_bipredSearchRange (0) 122 , m_iFastSearch (0)123 115 , m_pppcRDSbacCoder (NULL) 124 116 , m_pcRDGoOnSbacCoder (NULL) 125 117 , m_pTempPel (NULL) 126 , m_puiDFilter (NULL)127 118 , m_isInitialized (false) 128 119 { … … 130 121 { 131 122 m_ppcQTTempCoeff[ch] = NULL; 132 m_pcQTTempCoeff[ch] = NULL;133 123 #if ADAPTIVE_QP_SELECTION 134 124 m_ppcQTTempArlCoeff[ch] = NULL; 135 m_pcQTTempArlCoeff[ch] = NULL;136 125 #endif 137 126 m_puhQTTempCbf[ch] = NULL; … … 181 170 } 182 171 delete[] m_ppcQTTempCoeff[ch]; 183 delete[] m_pcQTTempCoeff[ch];184 172 delete[] m_puhQTTempCbf[ch]; 185 173 #if ADAPTIVE_QP_SELECTION 186 174 delete[] m_ppcQTTempArlCoeff[ch]; 187 delete[] m_pcQTTempArlCoeff[ch];188 175 #endif 189 176 } … … 229 216 Int iSearchRange, 230 217 Int bipredSearchRange, 231 Int iFastSearch,218 MESearchMethod motionEstimationSearchMethod, 232 219 const UInt maxCUWidth, 233 220 const UInt maxCUHeight, … … 244 231 m_iSearchRange = iSearchRange; 245 232 m_bipredSearchRange = bipredSearchRange; 246 m_ iFastSearch = iFastSearch;233 m_motionEstimationSearchMethod = motionEstimationSearchMethod; 247 234 m_pcEntropyCoder = pcEntropyCoder; 248 235 m_pcRdCost = pcRdCost; … … 258 245 } 259 246 } 260 261 m_puiDFilter = s_auiDFilter + 4;262 247 263 248 // initialize motion cost … … 289 274 const UInt csy=::getComponentScaleY(ComponentID(ch), cform); 290 275 m_ppcQTTempCoeff[ch] = new TCoeff* [uiNumLayersToAllocate]; 291 m_pcQTTempCoeff[ch] = new TCoeff [(maxCUWidth*maxCUHeight)>>(csx+csy) ];292 276 #if ADAPTIVE_QP_SELECTION 293 277 m_ppcQTTempArlCoeff[ch] = new TCoeff*[uiNumLayersToAllocate]; 294 m_pcQTTempArlCoeff[ch] = new TCoeff [(maxCUWidth*maxCUHeight)>>(csx+csy) ];295 278 #endif 296 279 m_puhQTTempCbf[ch] = new UChar [uiNumPartitions]; … … 304 287 } 305 288 306 m_phQTTempCrossComponentPredictionAlpha[ch] = new Char [uiNumPartitions];289 m_phQTTempCrossComponentPredictionAlpha[ch] = new SChar [uiNumPartitions]; 307 290 m_pSharedPredTransformSkip[ch] = new Pel [MAX_CU_SIZE*MAX_CU_SIZE]; 308 291 m_pcQTTempTUCoeff[ch] = new TCoeff[MAX_CU_SIZE*MAX_CU_SIZE]; … … 323 306 } 324 307 325 #define TZ_SEARCH_CONFIGURATION \ 326 const Int iRaster = 5; /* TZ soll von aussen ?ergeben werden */ \ 327 const Bool bTestOtherPredictedMV = 0; \ 328 const Bool bTestZeroVector = 1; \ 329 const Bool bTestZeroVectorStart = 0; \ 330 const Bool bTestZeroVectorStop = 0; \ 331 const Bool bFirstSearchDiamond = 1; /* 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch */ \ 332 const Bool bFirstSearchStop = m_pcEncCfg->getFastMEAssumingSmootherMVEnabled(); \ 333 const UInt uiFirstSearchRounds = 3; /* first search stop X rounds after best match (must be >=1) */ \ 334 const Bool bEnableRasterSearch = 1; \ 335 const Bool bAlwaysRasterSearch = 0; /* ===== 1: BETTER but factor 2 slower ===== */ \ 336 const Bool bRasterRefinementEnable = 0; /* enable either raster refinement or star refinement */ \ 337 const Bool bRasterRefinementDiamond = 0; /* 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch */ \ 338 const Bool bStarRefinementEnable = 1; /* enable either star refinement or raster refinement */ \ 339 const Bool bStarRefinementDiamond = 1; /* 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch */ \ 340 const Bool bStarRefinementStop = 0; \ 341 const UInt uiStarRefinementRounds = 2; /* star refinement stop X rounds after best match (must be >=1) */ \ 342 343 344 #define SEL_SEARCH_CONFIGURATION \ 345 const Bool bTestOtherPredictedMV = 1; \ 346 const Bool bTestZeroVector = 1; \ 347 const Bool bEnableRasterSearch = 1; \ 348 const Bool bAlwaysRasterSearch = 0; /* ===== 1: BETTER but factor 15x slower ===== */ \ 349 const Bool bStarRefinementEnable = 1; /* enable either star refinement or raster refinement */ \ 350 const Bool bStarRefinementDiamond = 1; /* 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch */ \ 351 const Bool bStarRefinementStop = 0; \ 352 const UInt uiStarRefinementRounds = 2; /* star refinement stop X rounds after best match (must be >=1) */ \ 353 const UInt uiSearchRange = m_iSearchRange; \ 354 const Int uiSearchRangeInitial = m_iSearchRange >> 2; \ 355 const Int uiSearchStep = 4; \ 356 const Int iMVDistThresh = 8; \ 357 358 359 360 __inline Void TEncSearch::xTZSearchHelp( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ) 308 309 310 311 __inline Void TEncSearch::xTZSearchHelp( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ) 361 312 { 362 313 Distortion uiSad = 0; 363 314 364 Pel* piRefSrch; 365 366 piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX; 315 const Pel* const piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX; 316 367 317 #if NH_3D_IC 368 318 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); … … 374 324 m_pcRdCost->setDistParam( pcPatternKey, piRefSrch, rcStruct.iYStride, m_cDistParam ); 375 325 376 if(m_pcEncCfg->getFastSearch() != SELECTIVE)377 {378 // fast encoder decision: use subsampled SAD when rows > 8 for integer ME379 if ( m_pcEncCfg->getUseFastEnc() )380 {381 if ( m_cDistParam.iRows > 8 )382 {383 m_cDistParam.iSubShift = 1;384 }385 }386 }387 388 326 setDistParamComp(COMPONENT_Y); 389 327 390 328 // distortion 391 329 m_cDistParam.bitDepth = pcPatternKey->getBitDepthY(); 392 if(m_pcEncCfg->getFastSearch() == SELECTIVE) 330 m_cDistParam.m_maximumDistortionForEarlyExit = rcStruct.uiBestSad; 331 332 if((m_pcEncCfg->getRestrictMESampling() == false) && m_pcEncCfg->getMotionEstimationSearchMethod() == MESEARCH_SELECTIVE) 393 333 { 394 334 Int isubShift = 0; 395 335 // motion cost 396 Distortion uiBitCost = m_pcRdCost->getCost( iSearchX, iSearchY ); 397 336 Distortion uiBitCost = m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY ); 337 338 // Skip search if bit cost is already larger than best SAD 339 if (uiBitCost < rcStruct.uiBestSad) 340 { 398 341 if ( m_cDistParam.iRows > 32 ) 399 342 { … … 443 386 rcStruct.uiBestRound = 0; 444 387 rcStruct.ucPointNr = ucPointNr; 388 m_cDistParam.m_maximumDistortionForEarlyExit = uiSad; 389 } 445 390 } 446 391 } … … 449 394 else 450 395 { 396 // fast encoder decision: use subsampled SAD when rows > 8 for integer ME 397 if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE3 ) 398 { 399 if ( m_cDistParam.iRows > 8 ) 400 { 401 m_cDistParam.iSubShift = 1; 402 } 403 } 404 451 405 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); 452 406 407 // only add motion cost if uiSad is smaller than best. Otherwise pointless 408 // to add motion cost. 409 if( uiSad < rcStruct.uiBestSad ) 410 { 453 411 // motion cost 454 uiSad += m_pcRdCost->getCost( iSearchX, iSearchY );412 uiSad += m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY ); 455 413 456 414 if( uiSad < rcStruct.uiBestSad ) … … 462 420 rcStruct.uiBestRound = 0; 463 421 rcStruct.ucPointNr = ucPointNr; 422 m_cDistParam.m_maximumDistortionForEarlyExit = uiSad; 423 } 464 424 } 465 425 } … … 469 429 470 430 471 __inline Void TEncSearch::xTZ2PointSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, TComMv* pcMvSrchRngLT, TComMv*pcMvSrchRngRB )431 __inline Void TEncSearch::xTZ2PointSearch( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB ) 472 432 { 473 433 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); … … 602 562 603 563 604 __inline Void TEncSearch::xTZ8PointSquareSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, TComMv* pcMvSrchRngLT, TComMv*pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist )564 __inline Void TEncSearch::xTZ8PointSquareSearch( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ) 605 565 { 606 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor();607 Int iSrchRngHorRight = pcMvSrchRngRB->getHor();608 Int iSrchRngVerTop = pcMvSrchRngLT->getVer();609 Int iSrchRngVerBottom = pcMvSrchRngRB->getVer();566 const Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); 567 const Int iSrchRngHorRight = pcMvSrchRngRB->getHor(); 568 const Int iSrchRngVerTop = pcMvSrchRngLT->getVer(); 569 const Int iSrchRngVerBottom = pcMvSrchRngRB->getVer(); 610 570 611 571 // 8 point search, // 1 2 3 … … 660 620 661 621 662 __inline Void TEncSearch::xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ) 622 __inline Void TEncSearch::xTZ8PointDiamondSearch( const TComPattern*const pcPatternKey, 623 IntTZSearchStruct& rcStruct, 624 const TComMv*const pcMvSrchRngLT, 625 const TComMv*const pcMvSrchRngRB, 626 const Int iStartX, 627 const Int iStartY, 628 const Int iDist, 629 const Bool bCheckCornersAtDist1 ) 663 630 { 664 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor();665 Int iSrchRngHorRight = pcMvSrchRngRB->getHor();666 Int iSrchRngVerTop = pcMvSrchRngLT->getVer();667 Int iSrchRngVerBottom = pcMvSrchRngRB->getVer();631 const Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); 632 const Int iSrchRngHorRight = pcMvSrchRngRB->getHor(); 633 const Int iSrchRngVerTop = pcMvSrchRngLT->getVer(); 634 const Int iSrchRngVerBottom = pcMvSrchRngRB->getVer(); 668 635 669 636 // 8 point search, // 1 2 3 … … 677 644 rcStruct.uiBestRound += 1; 678 645 679 if ( iDist == 1 ) // iDist == 1646 if ( iDist == 1 ) 680 647 { 681 648 if ( iTop >= iSrchRngVerTop ) // check top 682 649 { 650 if (bCheckCornersAtDist1) 651 { 652 if ( iLeft >= iSrchRngHorLeft) // check top-left 653 { 654 xTZSearchHelp( pcPatternKey, rcStruct, iLeft, iTop, 1, iDist ); 655 } 656 xTZSearchHelp( pcPatternKey, rcStruct, iStartX, iTop, 2, iDist ); 657 if ( iRight <= iSrchRngHorRight ) // check middle right 658 { 659 xTZSearchHelp( pcPatternKey, rcStruct, iRight, iTop, 3, iDist ); 660 } 661 } 662 else 663 { 683 664 xTZSearchHelp( pcPatternKey, rcStruct, iStartX, iTop, 2, iDist ); 684 665 } 666 } 685 667 if ( iLeft >= iSrchRngHorLeft ) // check middle left 686 668 { … … 693 675 if ( iBottom <= iSrchRngVerBottom ) // check bottom 694 676 { 677 if (bCheckCornersAtDist1) 678 { 679 if ( iLeft >= iSrchRngHorLeft) // check top-left 680 { 681 xTZSearchHelp( pcPatternKey, rcStruct, iLeft, iBottom, 6, iDist ); 682 } 683 xTZSearchHelp( pcPatternKey, rcStruct, iStartX, iBottom, 7, iDist ); 684 if ( iRight <= iSrchRngHorRight ) // check middle right 685 { 686 xTZSearchHelp( pcPatternKey, rcStruct, iRight, iBottom, 8, iDist ); 687 } 688 } 689 else 690 { 695 691 xTZSearchHelp( pcPatternKey, rcStruct, iStartX, iBottom, 7, iDist ); 696 692 } 697 693 } 698 else // if (iDist != 1) 694 } 695 else 699 696 { 700 697 if ( iDist <= 8 ) … … 770 767 for ( Int index = 1; index < 4; index++ ) 771 768 { 772 Int iPosYT = iTop + ((iDist>>2) * index);773 Int iPosYB = iBottom - ((iDist>>2) * index);774 Int iPosXL = iStartX - ((iDist>>2) * index);775 Int iPosXR = iStartX + ((iDist>>2) * index);769 const Int iPosYT = iTop + ((iDist>>2) * index); 770 const Int iPosYB = iBottom - ((iDist>>2) * index); 771 const Int iPosXL = iStartX - ((iDist>>2) * index); 772 const Int iPosXR = iStartX + ((iDist>>2) * index); 776 773 xTZSearchHelp( pcPatternKey, rcStruct, iPosXL, iPosYT, 0, iDist ); 777 774 xTZSearchHelp( pcPatternKey, rcStruct, iPosXR, iPosYT, 0, iDist ); … … 800 797 for ( Int index = 1; index < 4; index++ ) 801 798 { 802 Int iPosYT = iTop + ((iDist>>2) * index);803 Int iPosYB = iBottom - ((iDist>>2) * index);804 Int iPosXL = iStartX - ((iDist>>2) * index);805 Int iPosXR = iStartX + ((iDist>>2) * index);799 const Int iPosYT = iTop + ((iDist>>2) * index); 800 const Int iPosYB = iBottom - ((iDist>>2) * index); 801 const Int iPosXL = iStartX - ((iDist>>2) * index); 802 const Int iPosXR = iStartX + ((iDist>>2) * index); 806 803 807 804 if ( iPosYT >= iSrchRngVerTop ) // check top … … 833 830 } 834 831 835 836 837 838 839 //<--840 841 832 Distortion TEncSearch::xPatternRefinement( TComPattern* pcPatternKey, 842 833 TComMv baseRefMv, … … 886 877 m_cDistParam.bitDepth = pcPatternKey->getBitDepthY(); 887 878 uiDist = m_cDistParam.DistFunc( &m_cDistParam ); 888 uiDist += m_pcRdCost->getCost ( cMvTest.getHor(), cMvTest.getVer() );879 uiDist += m_pcRdCost->getCostOfVectorWithPredictor( cMvTest.getHor(), cMvTest.getVer() ); 889 880 890 881 if ( uiDist < uiDistBest ) … … 892 883 uiDistBest = uiDist; 893 884 uiDirecBest = i; 885 m_cDistParam.m_maximumDistortionForEarlyExit = uiDist; 894 886 } 895 887 } … … 2410 2402 } 2411 2403 2412 Char2404 SChar 2413 2405 TEncSearch::xCalcCrossComponentPredictionAlpha( TComTU &rTu, 2414 2406 const ComponentID compID, … … 2427 2419 const Int diffBitDepth = pCU->getSlice()->getSPS()->getDifferentialLumaChromaBitDepth(); 2428 2420 2429 Char alpha = 0;2421 SChar alpha = 0; 2430 2422 Int SSxy = 0; 2431 2423 Int SSxx = 0; … … 2447 2439 { 2448 2440 Double dAlpha = SSxy / Double( SSxx ); 2449 alpha = Char(Clip3<Int>(-16, 16, (Int)(dAlpha * 16)));2450 2451 static const Char alphaQuant[17] = {0, 1, 1, 2, 2, 2, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8};2441 alpha = SChar(Clip3<Int>(-16, 16, (Int)(dAlpha * 16))); 2442 2443 static const SChar alphaQuant[17] = {0, 1, 1, 2, 2, 2, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8}; 2452 2444 2453 2445 alpha = (alpha < 0) ? -alphaQuant[Int(-alpha)] : alphaQuant[Int(alpha)]; … … 2540 2532 Double singleCostTmp = 0; 2541 2533 UInt singleCbfCTmp = 0; 2542 CharbestCrossCPredictionAlpha = 0;2534 SChar bestCrossCPredictionAlpha = 0; 2543 2535 Int bestTransformSkipMode = 0; 2544 2536 … … 3689 3681 ::memcpy( m_puhQTTempCbf[compID], pcCU->getCbf( compID )+uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3690 3682 ::memcpy( m_puhQTTempTransformSkipFlag[compID], pcCU->getTransformSkip( compID )+uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3691 ::memcpy( m_phQTTempCrossComponentPredictionAlpha[compID], pcCU->getCrossComponentPredictionAlpha(compID)+uiPartOffset, uiQPartNum * sizeof( Char ) );3683 ::memcpy( m_phQTTempCrossComponentPredictionAlpha[compID], pcCU->getCrossComponentPredictionAlpha(compID)+uiPartOffset, uiQPartNum * sizeof( SChar ) ); 3692 3684 } 3693 3685 } … … 3702 3694 ::memcpy( pcCU->getCbf( compID )+uiPartOffset, m_puhQTTempCbf[compID], uiQPartNum * sizeof( UChar ) ); 3703 3695 ::memcpy( pcCU->getTransformSkip( compID )+uiPartOffset, m_puhQTTempTransformSkipFlag[compID], uiQPartNum * sizeof( UChar ) ); 3704 ::memcpy( pcCU->getCrossComponentPredictionAlpha(compID)+uiPartOffset, m_phQTTempCrossComponentPredictionAlpha[compID], uiQPartNum * sizeof( Char ) );3696 ::memcpy( pcCU->getCrossComponentPredictionAlpha(compID)+uiPartOffset, m_phQTTempCrossComponentPredictionAlpha[compID], uiQPartNum * sizeof( SChar ) ); 3705 3697 } 3706 3698 } … … 3812 3804 { 3813 3805 UInt uiDepth = pcCU->getDepth(0); 3814 const UIntuiDistortion = 0;3806 const Distortion uiDistortion = 0; 3815 3807 UInt uiBits; 3816 3808 … … 4325 4317 /*correct the bit-rate part of the current ref*/ 4326 4318 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 4327 uiBitsTemp += m_pcRdCost->getBits ( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );4319 uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 4328 4320 /*calculate the correct cost*/ 4329 4321 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); … … 4374 4366 } 4375 4367 4376 // Bi- directional prediction4368 // Bi-predictive Motion estimation 4377 4369 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 4378 4370 { … … 4429 4421 4430 4422 // fast encoder setting: only one iteration 4431 if ( m_pcEncCfg->get UseFastEnc() || pcCU->getSlice()->getMvdL1ZeroFlag())4423 if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE2 || pcCU->getSlice()->getMvdL1ZeroFlag() ) 4432 4424 { 4433 4425 iNumIter = 1; … … 4438 4430 Int iRefList = iIter % 2; 4439 4431 4440 if ( m_pcEncCfg->get UseFastEnc())4432 if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE2 ) 4441 4433 { 4442 4434 if( uiCost[0] <= uiCost[1] ) … … 4629 4621 TComMvField cMEMvField[2]; 4630 4622 4631 m_pcRdCost-> getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );4623 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) ); 4632 4624 4633 4625 #if AMP_MRG … … 4652 4644 // save ME result. 4653 4645 uiMEInterDir = pcCU->getInterDir( uiPartAddr ); 4654 pcCU->getMvField( pcCU, uiPartAddr, REF_PIC_LIST_0, cMEMvField[0] );4655 pcCU->getMvField( pcCU, uiPartAddr, REF_PIC_LIST_1, cMEMvField[1] );4646 TComDataCU::getMvField( pcCU, uiPartAddr, REF_PIC_LIST_0, cMEMvField[0] ); 4647 TComDataCU::getMvField( pcCU, uiPartAddr, REF_PIC_LIST_1, cMEMvField[1] ); 4656 4648 4657 4649 // find Merge result … … 5040 5032 } 5041 5033 5042 m_pcRdCost-> getMotionCost( true, 0, pcCU->getCUTransquantBypass(0) );5034 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(0) ); 5043 5035 m_pcRdCost->setCostScale ( 0 ); 5044 5036 … … 5046 5038 5047 5039 m_pcRdCost->setPredictor( rcMvPred ); 5048 Int iOrgMvBits = m_pcRdCost->getBits (cMv.getHor(), cMv.getVer());5040 Int iOrgMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer()); 5049 5041 iOrgMvBits += m_auiMVPIdxCost[riMVPIdx][AMVP_MAX_NUM_CANDS]; 5050 5042 Int iBestMvBits = iOrgMvBits; … … 5059 5051 m_pcRdCost->setPredictor( pcAMVPInfo->m_acMvCand[iMVPIdx] ); 5060 5052 5061 Int iMvBits = m_pcRdCost->getBits (cMv.getHor(), cMv.getVer());5053 Int iMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer()); 5062 5054 iMvBits += m_auiMVPIdxCost[iMVPIdx][AMVP_MAX_NUM_CANDS]; 5063 5055 … … 5134 5126 5135 5127 uiCost = m_pcRdCost->getDistPart( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), pcTemplateCand->getAddr(COMPONENT_Y, uiPartAddr), pcTemplateCand->getStride(COMPONENT_Y), pcOrgYuv->getAddr(COMPONENT_Y, uiPartAddr), pcOrgYuv->getStride(COMPONENT_Y), iSizeX, iSizeY, COMPONENT_Y, DF_SAD ); 5136 uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, false,DF_SAD );5128 uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, DF_SAD ); 5137 5129 return uiCost; 5138 5130 } … … 5176 5168 #endif 5177 5169 5178 if ( bBi ) 5170 if ( bBi ) // Bipredictive ME 5179 5171 { 5180 5172 TComYuv* pcYuvOther = &m_acYuvPred[1-(Int)eRefPicList]; … … 5187 5179 fWeight = 0.5; 5188 5180 } 5181 m_cDistParam.bIsBiPred = bBi; 5189 5182 5190 5183 // Search key pattern initialization … … 5212 5205 } 5213 5206 5214 m_pcRdCost-> getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );5207 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) ); 5215 5208 5216 5209 m_pcRdCost->setPredictor ( *pcMvPred ); … … 5231 5224 setWpScalingDistParam( pcCU, iRefIdxPred, eRefPicList ); 5232 5225 // Do integer search 5233 if ( !m_iFastSearch|| bBi )5226 if ( (m_motionEstimationSearchMethod==MESEARCH_FULL) || bBi ) 5234 5227 { 5235 5228 xPatternSearch ( pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost ); … … 5250 5243 } 5251 5244 5252 m_pcRdCost-> getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );5245 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) ); 5253 5246 #if NH_3D_INTEGER_MV_DEPTH 5254 5247 if( ! pcCU->getSlice()->getIsDepth() ) … … 5268 5261 #endif 5269 5262 5270 UInt uiMvBits = m_pcRdCost->getBits ( rcMv.getHor(), rcMv.getVer() );5263 UInt uiMvBits = m_pcRdCost->getBitsOfVectorWithPredictor( rcMv.getHor(), rcMv.getVer() ); 5271 5264 #if NH_3D_INTEGER_MV_DEPTH 5272 5265 if( pcCU->getSlice()->getIsDepth() ) … … 5285 5278 5286 5279 5287 Void TEncSearch::xSetSearchRange ( TComDataCU* pcCU, TComMv& cMvPred, Int iSrchRng, TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB ) 5280 Void TEncSearch::xSetSearchRange ( const TComDataCU* const pcCU, const TComMv& cMvPred, const Int iSrchRng, 5281 TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB ) 5288 5282 { 5289 5283 Int iMvShift = 2; … … 5317 5311 pcCU->clipMv ( rcMvSrchRngRB ); 5318 5312 5313 #if ME_ENABLE_ROUNDING_OF_MVS 5314 rcMvSrchRngLT.divideByPowerOf2(iMvShift); 5315 rcMvSrchRngRB.divideByPowerOf2(iMvShift); 5316 #else 5319 5317 rcMvSrchRngLT >>= iMvShift; 5320 5318 rcMvSrchRngRB >>= iMvShift; 5319 #endif 5321 5320 } 5322 5321 5323 5322 5324 5325 5326 Void TEncSearch::xPatternSearch( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, TComMv& rcMv, Distortion& ruiSAD ) 5323 Void TEncSearch::xPatternSearch( const TComPattern* const pcPatternKey, 5324 const Pel* piRefY, 5325 const Int iRefStride, 5326 const TComMv* const pcMvSrchRngLT, 5327 const TComMv* const pcMvSrchRngRB, 5328 TComMv& rcMv, 5329 Distortion& ruiSAD ) 5327 5330 { 5328 5331 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); … … 5336 5339 Int iBestY = 0; 5337 5340 5338 Pel* piRefSrch;5339 5340 5341 //-- jclee for using the SAD function pointer 5341 5342 m_pcRdCost->setDistParam( pcPatternKey, piRefY, iRefStride, m_cDistParam ); 5342 5343 5343 5344 // fast encoder decision: use subsampled SAD for integer ME 5344 if ( m_pcEncCfg->get UseFastEnc())5345 if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE3 ) 5345 5346 { 5346 5347 if ( m_cDistParam.iRows > 8 ) … … 5356 5357 { 5357 5358 // find min. distortion position 5358 piRefSrch = piRefY + x; 5359 m_cDistParam.pCur = piRefSrch; 5359 m_cDistParam.pCur = piRefY + x; 5360 5360 5361 5361 setDistParamComp(COMPONENT_Y); … … 5373 5373 5374 5374 // motion cost 5375 uiSad += m_pcRdCost->getCost ( x, y );5375 uiSad += m_pcRdCost->getCostOfVectorWithPredictor( x, y ); 5376 5376 5377 5377 if ( uiSad < uiSadBest ) … … 5380 5380 iBestX = x; 5381 5381 iBestY = y; 5382 m_cDistParam.m_maximumDistortionForEarlyExit = uiSad; 5382 5383 } 5383 5384 } … … 5387 5388 rcMv.set( iBestX, iBestY ); 5388 5389 5389 ruiSAD = uiSadBest - m_pcRdCost->getCost ( iBestX, iBestY );5390 ruiSAD = uiSadBest - m_pcRdCost->getCostOfVectorWithPredictor( iBestX, iBestY ); 5390 5391 return; 5391 5392 } … … 5393 5394 5394 5395 5395 Void TEncSearch::xPatternSearchFast( TComDataCU*pcCU,5396 TComPattern*pcPatternKey,5397 Pel*piRefY,5398 IntiRefStride,5399 TComMv*pcMvSrchRngLT,5400 TComMv*pcMvSrchRngRB,5396 Void TEncSearch::xPatternSearchFast( const TComDataCU* const pcCU, 5397 const TComPattern* const pcPatternKey, 5398 const Pel* const piRefY, 5399 const Int iRefStride, 5400 const TComMv* const pcMvSrchRngLT, 5401 const TComMv* const pcMvSrchRngRB, 5401 5402 TComMv &rcMv, 5402 5403 Distortion &ruiSAD, 5403 const TComMv* pIntegerMv2Nx2NPred )5404 const TComMv* const pIntegerMv2Nx2NPred ) 5404 5405 { 5405 5406 assert (MD_LEFT < NUM_MV_PREDICTORS); … … 5410 5411 pcCU->getMvPredAboveRight ( m_acMvPredictors[MD_ABOVE_RIGHT] ); 5411 5412 5412 switch ( m_ iFastSearch)5413 { 5414 case 1:5415 xTZSearch( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred );5413 switch ( m_motionEstimationSearchMethod ) 5414 { 5415 case MESEARCH_DIAMOND: 5416 xTZSearch( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred, false ); 5416 5417 break; 5417 5418 5418 case 2:5419 case MESEARCH_SELECTIVE: 5419 5420 xTZSearchSelective( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred ); 5420 5421 break; 5422 5423 case MESEARCH_DIAMOND_ENHANCED: 5424 xTZSearch( pcCU, pcPatternKey, piRefY, iRefStride, pcMvSrchRngLT, pcMvSrchRngRB, rcMv, ruiSAD, pIntegerMv2Nx2NPred, true ); 5425 break; 5426 5427 case MESEARCH_FULL: // shouldn't get here. 5421 5428 default: 5422 5429 break; … … 5427 5434 5428 5435 5429 Void TEncSearch::xTZSearch( TComDataCU*pcCU,5430 TComPattern*pcPatternKey,5431 Pel*piRefY,5432 IntiRefStride,5433 TComMv*pcMvSrchRngLT,5434 TComMv*pcMvSrchRngRB,5436 Void TEncSearch::xTZSearch( const TComDataCU* const pcCU, 5437 const TComPattern* const pcPatternKey, 5438 const Pel* const piRefY, 5439 const Int iRefStride, 5440 const TComMv* const pcMvSrchRngLT, 5441 const TComMv* const pcMvSrchRngRB, 5435 5442 TComMv &rcMv, 5436 5443 Distortion &ruiSAD, 5437 const TComMv* pIntegerMv2Nx2NPred ) 5444 const TComMv* const pIntegerMv2Nx2NPred, 5445 const Bool bExtendedSettings) 5438 5446 { 5439 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); 5440 Int iSrchRngHorRight = pcMvSrchRngRB->getHor(); 5441 Int iSrchRngVerTop = pcMvSrchRngLT->getVer(); 5442 Int iSrchRngVerBottom = pcMvSrchRngRB->getVer(); 5443 5444 TZ_SEARCH_CONFIGURATION 5447 const Bool bUseAdaptiveRaster = bExtendedSettings; 5448 const Int iRaster = 5; 5449 const Bool bTestOtherPredictedMV = bExtendedSettings; 5450 const Bool bTestZeroVector = true; 5451 const Bool bTestZeroVectorStart = bExtendedSettings; 5452 const Bool bTestZeroVectorStop = false; 5453 const Bool bFirstSearchDiamond = true; // 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch 5454 const Bool bFirstCornersForDiamondDist1 = bExtendedSettings; 5455 const Bool bFirstSearchStop = m_pcEncCfg->getFastMEAssumingSmootherMVEnabled(); 5456 const UInt uiFirstSearchRounds = 3; // first search stop X rounds after best match (must be >=1) 5457 const Bool bEnableRasterSearch = true; 5458 const Bool bAlwaysRasterSearch = bExtendedSettings; // true: BETTER but factor 2 slower 5459 const Bool bRasterRefinementEnable = false; // enable either raster refinement or star refinement 5460 const Bool bRasterRefinementDiamond = false; // 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch 5461 const Bool bRasterRefinementCornersForDiamondDist1 = bExtendedSettings; 5462 const Bool bStarRefinementEnable = true; // enable either star refinement or raster refinement 5463 const Bool bStarRefinementDiamond = true; // 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch 5464 const Bool bStarRefinementCornersForDiamondDist1 = bExtendedSettings; 5465 const Bool bStarRefinementStop = false; 5466 const UInt uiStarRefinementRounds = 2; // star refinement stop X rounds after best match (must be >=1) 5467 const Bool bNewZeroNeighbourhoodTest = bExtendedSettings; 5445 5468 5446 5469 UInt uiSearchRange = m_iSearchRange; … … 5449 5472 if( ! pcCU->getSlice()->getIsDepth() ) 5450 5473 #endif 5474 #if ME_ENABLE_ROUNDING_OF_MVS 5475 rcMv.divideByPowerOf2(2); 5476 #else 5451 5477 rcMv >>= 2; 5478 #endif 5479 5452 5480 // init TZSearchStruct 5453 5481 IntTZSearchStruct cStruct; … … 5470 5498 { 5471 5499 #endif 5472 cMv >>= 2; 5500 #if ME_ENABLE_ROUNDING_OF_MVS 5501 cMv.divideByPowerOf2(2); 5502 #else 5503 cMv >>= 2; 5504 #endif 5505 5473 5506 #if NH_3D_INTEGER_MV_DEPTH 5474 5507 } 5475 5508 #endif 5476 5509 if (cMv != rcMv && (cMv.getHor() != cStruct.iBestX && cMv.getVer() != cStruct.iBestY)) 5510 { 5511 // only test cMV if not obviously previously tested. 5477 5512 xTZSearchHelp( pcPatternKey, cStruct, cMv.getHor(), cMv.getVer(), 0, 0 ); 5478 5513 } 5514 } 5479 5515 } 5480 5516 … … 5482 5518 if ( bTestZeroVector ) 5483 5519 { 5520 if ((rcMv.getHor() != 0 || rcMv.getVer() != 0) && 5521 (0 != cStruct.iBestX || 0 != cStruct.iBestY)) 5522 { 5523 // only test 0-vector if not obviously previously tested. 5484 5524 xTZSearchHelp( pcPatternKey, cStruct, 0, 0, 0, 0 ); 5485 5525 } 5526 } 5527 5528 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); 5529 Int iSrchRngHorRight = pcMvSrchRngRB->getHor(); 5530 Int iSrchRngVerTop = pcMvSrchRngLT->getVer(); 5531 Int iSrchRngVerBottom = pcMvSrchRngRB->getVer(); 5486 5532 5487 5533 if (pIntegerMv2Nx2NPred != 0) … … 5490 5536 integerMv2Nx2NPred <<= 2; 5491 5537 pcCU->clipMv( integerMv2Nx2NPred ); 5538 #if ME_ENABLE_ROUNDING_OF_MVS 5539 integerMv2Nx2NPred.divideByPowerOf2(2); 5540 #else 5492 5541 integerMv2Nx2NPred >>= 2; 5542 #endif 5543 if ((rcMv != integerMv2Nx2NPred) && 5544 (integerMv2Nx2NPred.getHor() != cStruct.iBestX || integerMv2Nx2NPred.getVer() != cStruct.iBestY)) 5545 { 5546 // only test integerMv2Nx2NPred if not obviously previously tested. 5493 5547 xTZSearchHelp(pcPatternKey, cStruct, integerMv2Nx2NPred.getHor(), integerMv2Nx2NPred.getVer(), 0, 0); 5548 } 5494 5549 5495 5550 // reset search range … … 5511 5566 Int iStartY = cStruct.iBestY; 5512 5567 5513 // first search 5568 const Bool bBestCandidateZero = (cStruct.iBestX == 0) && (cStruct.iBestY == 0); 5569 5570 // first search around best position up to now. 5571 // The following works as a "subsampled/log" window search around the best candidate 5514 5572 for ( iDist = 1; iDist <= (Int)uiSearchRange; iDist*=2 ) 5515 5573 { 5516 5574 if ( bFirstSearchDiamond == 1 ) 5517 5575 { 5518 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist );5576 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist, bFirstCornersForDiamondDist1 ); 5519 5577 } 5520 5578 else … … 5529 5587 } 5530 5588 5589 if (!bNewZeroNeighbourhoodTest) 5590 { 5531 5591 // test whether zero Mv is a better start point than Median predictor 5532 5592 if ( bTestZeroVectorStart && ((cStruct.iBestX != 0) || (cStruct.iBestY != 0)) ) … … 5538 5598 for ( iDist = 1; iDist <= (Int)uiSearchRange; iDist*=2 ) 5539 5599 { 5540 xTZ8PointDiamondSearch( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, 0, 0, iDist);5600 xTZ8PointDiamondSearch( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, 0, 0, iDist, false ); 5541 5601 if ( bTestZeroVectorStop && (cStruct.uiBestRound > 0) ) // stop criterion 5602 { 5603 break; 5604 } 5605 } 5606 } 5607 } 5608 } 5609 else 5610 { 5611 // Test also zero neighbourhood but with half the range 5612 // It was reported that the original (above) search scheme using bTestZeroVectorStart did not 5613 // make sense since one would have already checked the zero candidate earlier 5614 // and thus the conditions for that test would have not been satisfied 5615 if (bTestZeroVectorStart == true && bBestCandidateZero != true) 5616 { 5617 for ( iDist = 1; iDist <= ((Int)uiSearchRange >> 1); iDist*=2 ) 5618 { 5619 xTZ8PointDiamondSearch( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, 0, 0, iDist, false ); 5620 if ( bTestZeroVectorStop && (cStruct.uiBestRound > 2) ) // stop criterion 5542 5621 { 5543 5622 break; … … 5555 5634 5556 5635 // raster search if distance is too big 5636 if (bUseAdaptiveRaster) 5637 { 5638 int iWindowSize = iRaster; 5639 Int iSrchRngRasterLeft = iSrchRngHorLeft; 5640 Int iSrchRngRasterRight = iSrchRngHorRight; 5641 Int iSrchRngRasterTop = iSrchRngVerTop; 5642 Int iSrchRngRasterBottom = iSrchRngVerBottom; 5643 5644 if (!(bEnableRasterSearch && ( ((Int)(cStruct.uiBestDistance) > iRaster)))) 5645 { 5646 iWindowSize ++; 5647 iSrchRngRasterLeft /= 2; 5648 iSrchRngRasterRight /= 2; 5649 iSrchRngRasterTop /= 2; 5650 iSrchRngRasterBottom /= 2; 5651 } 5652 cStruct.uiBestDistance = iWindowSize; 5653 for ( iStartY = iSrchRngRasterTop; iStartY <= iSrchRngRasterBottom; iStartY += iWindowSize ) 5654 { 5655 for ( iStartX = iSrchRngRasterLeft; iStartX <= iSrchRngRasterRight; iStartX += iWindowSize ) 5656 { 5657 xTZSearchHelp( pcPatternKey, cStruct, iStartX, iStartY, 0, iWindowSize ); 5658 } 5659 } 5660 } 5661 else 5662 { 5557 5663 if ( bEnableRasterSearch && ( ((Int)(cStruct.uiBestDistance) > iRaster) || bAlwaysRasterSearch ) ) 5558 5664 { … … 5565 5671 } 5566 5672 } 5673 } 5567 5674 } 5568 5675 … … 5579 5686 if ( bRasterRefinementDiamond == 1 ) 5580 5687 { 5581 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist );5688 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist, bRasterRefinementCornersForDiamondDist1 ); 5582 5689 } 5583 5690 else … … 5599 5706 } 5600 5707 5601 // star trefinement5708 // star refinement 5602 5709 if ( bStarRefinementEnable && cStruct.uiBestDistance > 0 ) 5603 5710 { … … 5612 5719 if ( bStarRefinementDiamond == 1 ) 5613 5720 { 5614 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist );5721 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist, bStarRefinementCornersForDiamondDist1 ); 5615 5722 } 5616 5723 else … … 5638 5745 // write out best match 5639 5746 rcMv.set( cStruct.iBestX, cStruct.iBestY ); 5640 ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCost ( cStruct.iBestX, cStruct.iBestY );5747 ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY ); 5641 5748 } 5642 5749 5643 5750 5644 Void TEncSearch::xTZSearchSelective( TComDataCU*pcCU,5645 TComPattern*pcPatternKey,5646 Pel*piRefY,5647 IntiRefStride,5648 TComMv*pcMvSrchRngLT,5649 TComMv*pcMvSrchRngRB,5751 Void TEncSearch::xTZSearchSelective( const TComDataCU* const pcCU, 5752 const TComPattern* const pcPatternKey, 5753 const Pel* const piRefY, 5754 const Int iRefStride, 5755 const TComMv* const pcMvSrchRngLT, 5756 const TComMv* const pcMvSrchRngRB, 5650 5757 TComMv &rcMv, 5651 5758 Distortion &ruiSAD, 5652 const TComMv* pIntegerMv2Nx2NPred )5759 const TComMv* const pIntegerMv2Nx2NPred ) 5653 5760 { 5654 SEL_SEARCH_CONFIGURATION 5761 const Bool bTestOtherPredictedMV = true; 5762 const Bool bTestZeroVector = true; 5763 const Bool bEnableRasterSearch = true; 5764 const Bool bAlwaysRasterSearch = false; // 1: BETTER but factor 15x slower 5765 const Bool bStarRefinementEnable = true; // enable either star refinement or raster refinement 5766 const Bool bStarRefinementDiamond = true; // 1 = xTZ8PointDiamondSearch 0 = xTZ8PointSquareSearch 5767 const Bool bStarRefinementStop = false; 5768 const UInt uiStarRefinementRounds = 2; // star refinement stop X rounds after best match (must be >=1) 5769 const UInt uiSearchRange = m_iSearchRange; 5770 const Int uiSearchRangeInitial = m_iSearchRange >> 2; 5771 const Int uiSearchStep = 4; 5772 const Int iMVDistThresh = 8; 5655 5773 5656 5774 Int iSrchRngHorLeft = pcMvSrchRngLT->getHor(); … … 5669 5787 5670 5788 pcCU->clipMv( rcMv ); 5789 #if ME_ENABLE_ROUNDING_OF_MVS 5790 rcMv.divideByPowerOf2(2); 5791 #else 5671 5792 rcMv >>= 2; 5793 #endif 5672 5794 // init TZSearchStruct 5673 5795 IntTZSearchStruct cStruct; … … 5689 5811 TComMv cMv = m_acMvPredictors[index]; 5690 5812 pcCU->clipMv( cMv ); 5813 #if ME_ENABLE_ROUNDING_OF_MVS 5814 cMv.divideByPowerOf2(2); 5815 #else 5691 5816 cMv >>= 2; 5817 #endif 5692 5818 xTZSearchHelp( pcPatternKey, cStruct, cMv.getHor(), cMv.getVer(), 0, 0 ); 5693 5819 } … … 5705 5831 integerMv2Nx2NPred <<= 2; 5706 5832 pcCU->clipMv( integerMv2Nx2NPred ); 5833 #if ME_ENABLE_ROUNDING_OF_MVS 5834 integerMv2Nx2NPred.divideByPowerOf2(2); 5835 #else 5707 5836 integerMv2Nx2NPred >>= 2; 5837 #endif 5708 5838 xTZSearchHelp(pcPatternKey, cStruct, integerMv2Nx2NPred.getHor(), integerMv2Nx2NPred.getVer(), 0, 0); 5709 5839 … … 5734 5864 { 5735 5865 xTZSearchHelp( pcPatternKey, cStruct, iStartX, iStartY, 0, 0 ); 5736 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, 1 );5737 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, 2 );5866 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, 1, false ); 5867 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, 2, false ); 5738 5868 } 5739 5869 } … … 5766 5896 if ( bStarRefinementDiamond == 1 ) 5767 5897 { 5768 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist );5898 xTZ8PointDiamondSearch ( pcPatternKey, cStruct, pcMvSrchRngLT, pcMvSrchRngRB, iStartX, iStartY, iDist, false ); 5769 5899 } 5770 5900 else … … 5792 5922 // write out best match 5793 5923 rcMv.set( cStruct.iBestX, cStruct.iBestY ); 5794 ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCost ( cStruct.iBestX, cStruct.iBestY );5924 ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY ); 5795 5925 5796 5926 } … … 6027 6157 const ComponentID component = ComponentID(comp); 6028 6158 ::memset( pcCU->getCbf( component ) , 0, uiQPartNum * sizeof(UChar) ); 6029 ::memset( pcCU->getCrossComponentPredictionAlpha(component), 0, ( uiQPartNum * sizeof( Char) ) );6159 ::memset( pcCU->getCrossComponentPredictionAlpha(component), 0, ( uiQPartNum * sizeof(SChar) ) ); 6030 6160 } 6031 6161 static const UInt useTS[MAX_NUM_COMPONENT]={0,0,0}; … … 6315 6445 // Stores the best explicit RDPCM mode for a TU encoded without split 6316 6446 UInt bestExplicitRdpcmModeUnSplit[MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{3,3}, {3,3}, {3,3}}; 6317 CharbestCrossCPredictionAlpha [MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{0,0},{0,0},{0,0}};6447 SChar bestCrossCPredictionAlpha [MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{0,0},{0,0},{0,0}}; 6318 6448 6319 6449 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); … … 6386 6516 && (pcCU->getCbf(subTUAbsPartIdx, COMPONENT_Y, uiTrMode) != 0); 6387 6517 6388 Char preCalcAlpha = 0;6518 SChar preCalcAlpha = 0; 6389 6519 const Pel *pLumaResi = m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( COMPONENT_Y, rTu.getRect( COMPONENT_Y ).x0, rTu.getRect( COMPONENT_Y ).y0 ); 6390 6520 -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncSearch.h
r1321 r1360 68 68 private: 69 69 TCoeff** m_ppcQTTempCoeff[MAX_NUM_COMPONENT /* 0->Y, 1->Cb, 2->Cr*/]; 70 TCoeff* m_pcQTTempCoeff[MAX_NUM_COMPONENT];71 70 #if ADAPTIVE_QP_SELECTION 72 71 TCoeff** m_ppcQTTempArlCoeff[MAX_NUM_COMPONENT]; 73 TCoeff* m_pcQTTempArlCoeff[MAX_NUM_COMPONENT];74 72 #endif 75 73 UChar* m_puhQTTempTrIdx; … … 79 77 TComYuv m_tmpYuvPred; // To be used in xGetInterPredictionError() to avoid constant memory allocation/deallocation 80 78 81 Char*m_phQTTempCrossComponentPredictionAlpha[MAX_NUM_COMPONENT];79 SChar* m_phQTTempCrossComponentPredictionAlpha[MAX_NUM_COMPONENT]; 82 80 Pel* m_pSharedPredTransformSkip[MAX_NUM_COMPONENT]; 83 81 TCoeff* m_pcQTTempTUCoeff[MAX_NUM_COMPONENT]; … … 100 98 Int m_iSearchRange; 101 99 Int m_bipredSearchRange; // Search range for bi-prediction 102 Int m_iFastSearch;100 MESearchMethod m_motionEstimationSearchMethod; 103 101 #if NH_MV 104 102 Bool m_vertRestriction; 105 103 #endif 106 104 Int m_aaiAdaptSR[MAX_NUM_REF_LIST_ADAPT_SR][MAX_IDX_ADAPT_SR]; 107 TComMv m_cSrchRngLT;108 TComMv m_cSrchRngRB;109 105 TComMv m_acMvPredictors[NUM_MV_PREDICTORS]; // Left, Above, AboveRight. enum MVP_DIR first NUM_MV_PREDICTORS entries are suitable for accessing. 110 106 … … 116 112 // Misc. 117 113 Pel* m_pTempPel; 118 const UInt* m_puiDFilter;119 114 120 115 #if NH_3D_VSO // M17 … … 136 131 Int iSearchRange, 137 132 Int bipredSearchRange, 138 Int iFastSearch,133 MESearchMethod motionEstimationSearchMethod, 139 134 const UInt maxCUWidth, 140 135 const UInt maxCUHeight, … … 157 152 typedef struct 158 153 { 159 Pel*piRefY;154 const Pel* piRefY; 160 155 Int iYStride; 161 156 Int iBestX; … … 168 163 169 164 // sub-functions for ME 170 __inline Void xTZSearchHelp ( TComPattern*pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance );171 __inline Void xTZ2PointSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv*pcMvSrchRngRB );172 __inline Void xTZ8PointSquareSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv*pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist );173 __inline Void xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist);165 __inline Void xTZSearchHelp ( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance ); 166 __inline Void xTZ2PointSearch ( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB ); 167 __inline Void xTZ8PointSquareSearch ( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist ); 168 __inline Void xTZ8PointDiamondSearch( const TComPattern* const pcPatternKey, IntTZSearchStruct& rcStruct, const TComMv* const pcMvSrchRngLT, const TComMv* const pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist, const Bool bCheckCornersAtDist1 ); 174 169 175 170 Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, Distortion& ruiSAD, Bool Hadamard ); … … 322 317 const Int strideBest ); 323 318 324 Char xCalcCrossComponentPredictionAlpha( TComTU &rTu,319 SChar xCalcCrossComponentPredictionAlpha ( TComTU &rTu, 325 320 const ComponentID compID, 326 321 const Pel* piResiL, … … 446 441 Bool bBi = false ); 447 442 448 Void xTZSearch ( TComDataCU*pcCU,449 TComPattern*pcPatternKey,450 Pel*piRefY,451 IntiRefStride,452 TComMv*pcMvSrchRngLT,453 TComMv*pcMvSrchRngRB,443 Void xTZSearch ( const TComDataCU* const pcCU, 444 const TComPattern* const pcPatternKey, 445 const Pel* const piRefY, 446 const Int iRefStride, 447 const TComMv* const pcMvSrchRngLT, 448 const TComMv* const pcMvSrchRngRB, 454 449 TComMv& rcMv, 455 450 Distortion& ruiSAD, 456 const TComMv *pIntegerMv2Nx2NPred 451 const TComMv* const pIntegerMv2Nx2NPred, 452 const Bool bExtendedSettings 457 453 ); 458 454 459 Void xTZSearchSelective ( TComDataCU*pcCU,460 TComPattern*pcPatternKey,461 Pel*piRefY,462 IntiRefStride,463 TComMv*pcMvSrchRngLT,464 TComMv*pcMvSrchRngRB,455 Void xTZSearchSelective ( const TComDataCU* const pcCU, 456 const TComPattern* const pcPatternKey, 457 const Pel* const piRefY, 458 const Int iRefStride, 459 const TComMv* const pcMvSrchRngLT, 460 const TComMv* const pcMvSrchRngRB, 465 461 TComMv& rcMv, 466 462 Distortion& ruiSAD, 467 const TComMv *pIntegerMv2Nx2NPred463 const TComMv* const pIntegerMv2Nx2NPred 468 464 ); 469 465 470 Void xSetSearchRange ( TComDataCU*pcCU,471 TComMv& cMvPred,472 Int iSrchRng,466 Void xSetSearchRange ( const TComDataCU* const pcCU, 467 const TComMv& cMvPred, 468 const Int iSrchRng, 473 469 TComMv& rcMvSrchRngLT, 474 470 TComMv& rcMvSrchRngRB ); 475 471 476 Void xPatternSearchFast ( TComDataCU*pcCU,477 TComPattern*pcPatternKey,478 Pel*piRefY,479 IntiRefStride,480 TComMv*pcMvSrchRngLT,481 TComMv*pcMvSrchRngRB,472 Void xPatternSearchFast ( const TComDataCU* const pcCU, 473 const TComPattern* const pcPatternKey, 474 const Pel* const piRefY, 475 const Int iRefStride, 476 const TComMv* const pcMvSrchRngLT, 477 const TComMv* const pcMvSrchRngRB, 482 478 TComMv& rcMv, 483 479 Distortion& ruiSAD, 484 const TComMv* pIntegerMv2Nx2NPred480 const TComMv* const pIntegerMv2Nx2NPred 485 481 ); 486 482 487 Void xPatternSearch ( TComPattern*pcPatternKey,488 Pel*piRefY,489 IntiRefStride,490 TComMv*pcMvSrchRngLT,491 TComMv*pcMvSrchRngRB,483 Void xPatternSearch ( const TComPattern* const pcPatternKey, 484 const Pel* piRefY, 485 const Int iRefStride, 486 const TComMv* const pcMvSrchRngLT, 487 const TComMv* const pcMvSrchRngRB, 492 488 TComMv& rcMv, 493 489 Distortion& ruiSAD ); -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r1313 r1360 203 203 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, Int layerId, bool isField ) 204 204 #else 205 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iGOPid, TComSlice*& rpcSlice,Bool isField )205 Void TEncSlice::initEncSlice( TComPic* pcPic, const Int pocLast, const Int pocCurr, const Int iGOPid, TComSlice*& rpcSlice, const Bool isField ) 206 206 #endif 207 207 { … … 397 397 #endif 398 398 { 399 dQPFactor=0.57*dLambda_scale; 399 if (m_pcCfg->getIntraQpFactor()>=0.0 && m_pcCfg->getGOPEntry(iGOPid).m_sliceType != I_SLICE) 400 { 401 dQPFactor=m_pcCfg->getIntraQpFactor(); 402 } 403 else 404 { 405 Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? NumberBFrames/2 : NumberBFrames) ); 406 407 dQPFactor=0.57*dLambda_scale; 408 } 400 409 } 401 410 dLambda = dQPFactor*pow( 2.0, qp_temp/3.0 ); … … 428 437 iQP = m_piRdPicQp [0]; 429 438 430 if( rpcSlice->getSliceType( ) != I_SLICE ) 431 { 439 432 440 #if NH_MV 433 dLambda *= m_pcCfg->getLambdaModifier( m_pcCfg->getGOPEntry((eSliceTypeBaseView == I_SLICE) ? MAX_GOP : iGOPid).m_temporalId ); 434 #else 435 dLambda *= m_pcCfg->getLambdaModifier( m_pcCfg->getGOPEntry(iGOPid).m_temporalId ); 436 #endif 437 } 438 441 const Int temporalId=m_pcCfg->getGOPEntry((eSliceTypeBaseView == I_SLICE) ? MAX_GOP : iGOPid).m_temporalId; 442 #else 443 const Int temporalId=m_pcCfg->getGOPEntry(iGOPid).m_temporalId; 444 #endif 445 const std::vector<Double> &intraLambdaModifiers=m_pcCfg->getIntraLambdaModifier(); 446 447 Double lambdaModifier; 448 if( rpcSlice->getSliceType( ) != I_SLICE || intraLambdaModifiers.empty()) 449 { 450 lambdaModifier = m_pcCfg->getLambdaModifier( temporalId ); 451 } 452 else 453 { 454 lambdaModifier = intraLambdaModifiers[ (temporalId < intraLambdaModifiers.size()) ? temporalId : (intraLambdaModifiers.size()-1) ]; 455 } 456 457 dLambda *= lambdaModifier; 439 458 setUpLambda(rpcSlice, dLambda, iQP); 440 459 … … 547 566 rpcSlice->setDepth ( depth ); 548 567 549 #if NH_MV 550 pcPic->setTLayer( m_pcCfg->getGOPEntry( (eSliceTypeBaseView == I_SLICE) ? MAX_GOP : iGOPid ).m_temporalId ); 551 #else 552 pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId ); 553 #endif 568 pcPic->setTLayer( temporalId ); 554 569 if(eSliceType==I_SLICE) 555 570 { … … 589 604 // ==================================================================================================================== 590 605 606 //! set adaptive search range based on poc difference 591 607 Void TEncSlice::setSearchRange( TComSlice* pcSlice ) 592 608 { … … 598 614 Int iNumPredDir = pcSlice->isInterP() ? 1 : 2; 599 615 600 for (Int iDir = 0; iDir <= iNumPredDir; iDir++) 601 { 602 //RefPicList e = (RefPicList)iDir; 616 for (Int iDir = 0; iDir < iNumPredDir; iDir++) 617 { 603 618 RefPicList e = ( iDir ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 604 619 for (Int iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(e); iRefIdx++) 605 620 { 606 621 iRefPOC = pcSlice->getRefPic(e, iRefIdx)->getPOC(); 607 Int iNewSR = Clip3(8, iMaxSR, (iMaxSR*ADAPT_SR_SCALE*abs(iCurrPOC - iRefPOC)+iOffset)/iGOPSize);608 m_pcPredSearch->setAdaptiveSearchRange(iDir, iRefIdx, iNewSR);622 Int newSearchRange = Clip3(m_pcCfg->getMinSearchWindow(), iMaxSR, (iMaxSR*ADAPT_SR_SCALE*abs(iCurrPOC - iRefPOC)+iOffset)/iGOPSize); 623 m_pcPredSearch->setAdaptiveSearchRange(iDir, iRefIdx, newSearchRange); 609 624 } 610 625 } … … 696 711 697 712 // compute RD cost and choose the best 698 Double dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits, uiPicDist, true, DF_SSE_FRAME); // NOTE: Is the 'true' parameter really necessary? 713 #if NH_3D 714 Double dPicRdCost = m_pcRdCost->calcRdCost( (Double)m_uiPicTotalBits, uiPicDist, DF_SSE_FRAME); 715 #else 716 Double dPicRdCost = m_pcRdCost->calcRdCost( (Double)m_uiPicTotalBits, (Double)uiPicDist, DF_SSE_FRAME); 717 #endif 699 718 #if H_3D 700 719 // Above calculation need to be fixed for VSO, including frameLambda value. … … 805 824 } 806 825 807 xEstimateWPParamSlice( pcSlice );826 xEstimateWPParamSlice( pcSlice, m_pcCfg->getWeightedPredictionMethod() ); 808 827 pcSlice->initWpScaling(pcSlice->getSPS()); 809 828 … … 849 868 { 850 869 // This will only occur if dependent slice-segments (m_entropyCodingSyncContextState=true) are being used. 851 if( pCurrentTile->getTileWidthInCtus() >= 2 || !m_pcCfg->get WaveFrontsynchro() )870 if( pCurrentTile->getTileWidthInCtus() >= 2 || !m_pcCfg->getEntropyCodingSyncEnabledFlag() ) 852 871 { 853 872 m_pppcRDSbacCoder[0][CI_CURR_BEST]->loadContexts( &m_lastSliceSegmentEndContextState ); … … 892 911 m_pppcRDSbacCoder[0][CI_CURR_BEST]->resetEntropy(pcSlice); 893 912 } 894 else if ( ctuXPosInCtus == tileXPosInCtus && m_pcCfg->get WaveFrontsynchro())913 else if ( ctuXPosInCtus == tileXPosInCtus && m_pcCfg->getEntropyCodingSyncEnabledFlag()) 895 914 { 896 915 // reset and then update contexts to the state at the end of the top-right CTU (if within current slice and tile). … … 1031 1050 1032 1051 // Store probabilities of second CTU in line into buffer - used only if wavefront-parallel-processing is enabled. 1033 if ( ctuXPosInCtus == tileXPosInCtus+1 && m_pcCfg->get WaveFrontsynchro())1052 if ( ctuXPosInCtus == tileXPosInCtus+1 && m_pcCfg->getEntropyCodingSyncEnabledFlag()) 1034 1053 { 1035 1054 m_entropyCodingSyncContextState.loadContexts(m_pppcRDSbacCoder[0][CI_CURR_BEST]); -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncSlice.h
r1313 r1360 120 120 Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, Int layerId, bool isField ); 121 121 #else 122 Void initEncSlice ( TComPic* pcPic, Int pocLast, Int pocCurr,123 Int iGOPid, TComSlice*& rpcSlice,Bool isField );122 Void initEncSlice ( TComPic* pcPic, const Int pocLast, const Int pocCurr, 123 const Int iGOPid, TComSlice*& rpcSlice, const Bool isField ); 124 124 #endif 125 125 Void resetQP ( TComPic* pic, Int sliceQP, Double lambda ); -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/TEncTop.cpp
r1321 r1360 44 44 #endif 45 45 #if NH_MV 46 #include "../../App/TAppEncoder/TAppEncTop.h"46 //#include "../../App/TAppEncoder/TAppEncTop.h" 47 47 #endif 48 48 … … 216 216 xInitVPS(); 217 217 218 #if U0132_TARGET_BITS_SATURATION 219 if (m_RCCpbSaturationEnabled) 220 { 221 m_cRateCtrl.initHrdParam(m_cSPS.getVuiParameters()->getHrdParameters(), m_iFrameRate, m_RCInitialCpbFullness); 222 } 223 #endif 218 224 m_cRdCost.setCostMode(m_costMode); 219 225 … … 264 270 265 271 // initialize encoder search class 266 m_cSearch.init( this, &m_cTrQuant, m_iSearchRange, m_bipredSearchRange, m_ iFastSearch, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, &m_cEntropyCoder, &m_cRdCost, getRDSbacCoder(), getRDGoOnSbacCoder() );272 m_cSearch.init( this, &m_cTrQuant, m_iSearchRange, m_bipredSearchRange, m_motionEstimationSearchMethod, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, &m_cEntropyCoder, &m_cRdCost, getRDSbacCoder(), getRDGoOnSbacCoder() ); 267 273 268 274 m_iMaxRefPicNum = 0; … … 299 305 { 300 306 m_cSPS.getScalingList().setDefaultScalingList (); 301 if(m_cSPS.getScalingList().xParseScalingList(getScalingListFile ()))307 if(m_cSPS.getScalingList().xParseScalingList(getScalingListFileName())) 302 308 { 303 309 Bool bParsedScalingList=false; // Use of boolean so that assertion outputs useful string … … 842 848 m_cSPS.setUsedByCurrPicLtSPSFlag(k, 0); 843 849 } 850 851 #if U0132_TARGET_BITS_SATURATION 852 if( getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() || getCpbSaturationEnabled() ) 853 #else 844 854 if( getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() ) 855 #endif 845 856 { 846 857 xInitHrdParameters(); … … 866 877 m_cSPS.setSpsRangeExtensionsFlag( m_cSPS.getSpsRangeExtension().settingsDifferFromDefaults() ); 867 878 #endif 868 869 } 870 879 } 880 #if U0132_TARGET_BITS_SATURATION 881 // calculate scale value of bitrate and initial delay 882 Int calcScale(Int x) 883 { 884 UInt iMask = 0xffffffff; 885 Int ScaleValue = 32; 886 887 while ((x&iMask) != 0) 888 { 889 ScaleValue--; 890 iMask = (iMask >> 1); 891 } 892 893 return ScaleValue; 894 } 895 #endif 871 896 Void TEncTop::xInitHrdParameters() 872 897 { … … 874 899 Int bitRate = getTargetBitrate(); 875 900 Bool isRandomAccess = getIntraPeriod() > 0; 876 901 # if U0132_TARGET_BITS_SATURATION 902 Int cpbSize = getCpbSize(); 903 904 if( !getVuiParametersPresentFlag() && !getCpbSaturationEnabled() ) 905 #else 877 906 if( !getVuiParametersPresentFlag() ) 907 #endif 878 908 { 879 909 return; … … 925 955 } 926 956 957 #if U0132_TARGET_BITS_SATURATION 958 if (calcScale(bitRate) <= 6) 959 { 960 hrd->setBitRateScale(0); 961 } 962 else 963 { 964 hrd->setBitRateScale(calcScale(bitRate) - 6); 965 } 966 967 if (calcScale(cpbSize) <= 4) 968 { 969 hrd->setCpbSizeScale(0); 970 } 971 else 972 { 973 hrd->setCpbSizeScale(calcScale(cpbSize) - 4); 974 } 975 #else 927 976 hrd->setBitRateScale( 4 ); // in units of 2^( 6 + 4 ) = 1,024 bps 928 977 hrd->setCpbSizeScale( 6 ); // in units of 2^( 4 + 6 ) = 1,024 bit 978 #endif 979 929 980 hrd->setDuCpbSizeScale( 6 ); // in units of 2^( 4 + 6 ) = 1,024 bit 930 981 … … 958 1009 bitrateValue = bitRate / (1 << (6 + hrd->getBitRateScale()) ); // bitRate is in bits, so it needs to be scaled down 959 1010 // CpbSize[ i ] = ( cpb_size_value_minus1[ i ] + 1 ) * 2^( 4 + cpb_size_scale ) 1011 #if U0132_TARGET_BITS_SATURATION 1012 cpbSizeValue = cpbSize / (1 << (4 + hrd->getCpbSizeScale()) ); // using bitRate results in 1 second CPB size 1013 #else 960 1014 cpbSizeValue = bitRate / (1 << (4 + hrd->getCpbSizeScale()) ); // using bitRate results in 1 second CPB size 1015 #endif 1016 961 1017 962 1018 // DU CPB size could be smaller (i.e. bitrateValue / number of DUs), but we don't know … … 1066 1122 m_cPPS.setQpOffset(COMPONENT_Cr, m_chromaCrQpOffset ); 1067 1123 1068 m_cPPS.setEntropyCodingSyncEnabledFlag( m_ iWaveFrontSynchro > 0);1124 m_cPPS.setEntropyCodingSyncEnabledFlag( m_entropyCodingSyncEnabledFlag ); 1069 1125 m_cPPS.setTilesEnabledFlag( (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0) ); 1070 1126 m_cPPS.setUseWP( m_useWeightedPred ); -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r1313 r1360 41 41 #include "../TLibCommon/TComPicYuv.h" 42 42 #include "WeightPredAnalysis.h" 43 44 #define ABS(a) ((a) < 0 ? - (a) : (a)) 45 #define DTHRESH (0.99) 43 #include <limits> 44 45 static const Double WEIGHT_PRED_SAD_RELATIVE_TO_NON_WEIGHT_PRED_SAD=0.99; // NOTE: U0040 used 0.95 46 47 //! calculate SAD values for both WP version and non-WP version. 48 static 49 Int64 xCalcSADvalueWP(const Int bitDepth, 50 const Pel *pOrgPel, 51 const Pel *pRefPel, 52 const Int width, 53 const Int height, 54 const Int orgStride, 55 const Int refStride, 56 const Int log2Denom, 57 const Int weight, 58 const Int offset, 59 const Bool useHighPrecision); 60 61 //! calculate SAD values for both WP version and non-WP version. 62 static 63 Int64 xCalcSADvalueWPOptionalClip(const Int bitDepth, 64 const Pel *pOrgPel, 65 const Pel *pRefPel, 66 const Int width, 67 const Int height, 68 const Int orgStride, 69 const Int refStride, 70 const Int log2Denom, 71 const Int weight, 72 const Int offset, 73 const Bool useHighPrecision, 74 const Bool clipped); 75 76 // ----------------------------------------------------------------------------- 77 // Helper functions 78 79 80 //! calculate Histogram for array of pixels 81 static 82 Void xCalcHistogram(const Pel *pPel, 83 std::vector<Int> &histogram, 84 const Int width, 85 const Int height, 86 const Int stride, 87 const Int maxPel) 88 { 89 histogram.clear(); 90 histogram.resize(maxPel); 91 for( Int y = 0; y < height; y++ ) 92 { 93 for( Int x = 0; x < width; x++ ) 94 { 95 const Pel v=pPel[x]; 96 histogram[v<0?0:(v>=maxPel)?maxPel-1:v]++; 97 } 98 pPel += stride; 99 } 100 } 101 102 static 103 Distortion xCalcHistDistortion (const std::vector<Int> &histogram0, 104 const std::vector<Int> &histogram1) 105 { 106 Distortion distortion = 0; 107 assert(histogram0.size()==histogram1.size()); 108 const Int numElements=Int(histogram0.size()); 109 110 // Scan histograms to compute histogram distortion 111 for (Int i = 0; i <= numElements; i++) 112 { 113 distortion += (Distortion)(abs(histogram0[i] - histogram1[i])); 114 } 115 116 return distortion; 117 } 118 119 static 120 void xScaleHistogram(const std::vector<Int> &histogramInput, 121 std::vector<Int> &histogramOutput, // cannot be the same as the input 122 const Int bitDepth, 123 const Int log2Denom, 124 const Int weight, 125 const Int offset, 126 const Bool bHighPrecision) 127 { 128 assert(&histogramInput != &histogramOutput); 129 const Int numElements=Int(histogramInput.size()); 130 histogramOutput.clear(); 131 histogramOutput.resize(numElements); 132 133 const Int64 iRealLog2Denom = bHighPrecision ? 0 : (bitDepth - 8); 134 const Int64 iRealOffset = ((Int64)offset)<<iRealLog2Denom; 135 136 const Int divOffset = log2Denom == 0 ? 0 : 1 << (log2Denom - 1); 137 // Scan histogram and apply illumination parameters appropriately 138 // Then compute updated histogram. 139 // Note that this technique only works with single list weights/offsets. 140 141 for (Int i = 0; i < numElements; i++) 142 { 143 const Int j = Clip3(0, numElements - 1, (Int)(((weight * i + divOffset) >> log2Denom) + iRealOffset)); 144 histogramOutput[j] += histogramInput[i]; 145 } 146 } 147 148 static 149 Distortion xSearchHistogram(const std::vector<Int> &histogramSource, 150 const std::vector<Int> &histogramRef, 151 std::vector<Int> &outputHistogram, 152 const Int bitDepth, 153 const Int log2Denom, 154 Int &weightToUpdate, 155 Int &offsetToUpdate, 156 const Bool bHighPrecision, 157 const ComponentID compID) 158 { 159 const Int initialWeight = weightToUpdate; 160 const Int initialOffset = offsetToUpdate; 161 const Int weightRange = 10; 162 const Int offsetRange = 10; 163 const Int maxOffset = 1 << ((bHighPrecision == true) ? (bitDepth - 1) : 7); 164 const Int range = bHighPrecision ? (1<<bitDepth) / 2 : 128; 165 const Int defaultWeight = (1<<log2Denom); 166 const Int minSearchWeight = std::max<Int>(initialWeight - weightRange, defaultWeight - range); 167 const Int maxSearchWeight = std::min<Int>(initialWeight + weightRange+1, defaultWeight + range); 168 169 Distortion minDistortion = std::numeric_limits<Distortion>::max(); 170 Int bestWeight = initialWeight; 171 Int bestOffset = initialOffset; 172 173 for (Int searchWeight = minSearchWeight; searchWeight < maxSearchWeight; searchWeight++) 174 { 175 if (compID == COMPONENT_Y) 176 { 177 for (Int searchOffset = std::max<Int>(initialOffset - offsetRange, -maxOffset); 178 searchOffset <= initialOffset + offsetRange && searchOffset<=(maxOffset-1); 179 searchOffset++) 180 { 181 xScaleHistogram(histogramRef, outputHistogram, bitDepth, log2Denom, searchWeight, searchOffset, bHighPrecision); 182 const Distortion distortion = xCalcHistDistortion(histogramSource, outputHistogram); 183 184 if (distortion < minDistortion) 185 { 186 minDistortion = distortion; 187 bestWeight = searchWeight; 188 bestOffset = searchOffset; 189 } 190 } 191 } 192 else 193 { 194 const Int pred = ( maxOffset - ( ( maxOffset*searchWeight)>>(log2Denom) ) ); 195 196 for (Int searchOffset = initialOffset - offsetRange; searchOffset <= initialOffset + offsetRange; searchOffset++) 197 { 198 const Int deltaOffset = Clip3( -4*maxOffset, 4*maxOffset-1, (searchOffset - pred) ); // signed 10bit (if !bHighPrecision) 199 const Int clippedOffset = Clip3( -1*maxOffset, 1*maxOffset-1, (deltaOffset + pred) ); // signed 8bit (if !bHighPrecision) 200 xScaleHistogram(histogramRef, outputHistogram, bitDepth, log2Denom, searchWeight, clippedOffset, bHighPrecision); 201 const Distortion distortion = xCalcHistDistortion(histogramSource, outputHistogram); 202 203 if (distortion < minDistortion) 204 { 205 minDistortion = distortion; 206 bestWeight = searchWeight; 207 bestOffset = clippedOffset; 208 } 209 } 210 } 211 } 212 213 weightToUpdate = bestWeight; 214 offsetToUpdate = bestOffset; 215 216 // regenerate best histogram 217 xScaleHistogram(histogramRef, outputHistogram, bitDepth, log2Denom, bestWeight, bestOffset, bHighPrecision); 218 219 return minDistortion; 220 } 221 222 223 // ----------------------------------------------------------------------------- 224 // Member functions 46 225 47 226 WeightPredAnalysis::WeightPredAnalysis() … … 49 228 for ( UInt lst =0 ; lst<NUM_REF_PIC_LIST_01 ; lst++ ) 50 229 { 51 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )230 for ( Int refIdx=0 ; refIdx<MAX_NUM_REF ; refIdx++ ) 52 231 { 53 232 for ( Int comp=0 ; comp<MAX_NUM_COMPONENT ;comp++ ) 54 233 { 55 WPScalingParam *pwp = &(m_wp[lst][ iRefIdx][comp]);234 WPScalingParam *pwp = &(m_wp[lst][refIdx][comp]); 56 235 pwp->bPresentFlag = false; 57 236 pwp->uiLog2WeightDenom = 0; … … 78 257 // calculate DC/AC value for channel 79 258 80 const Int iStride = pPic->getStride(compID);81 const Int iWidth = pPic->getWidth(compID);82 const Int iHeight = pPic->getHeight(compID);83 84 const Int iSample = iWidth*iHeight;85 86 Int64 iOrgDC = 0;259 const Int stride = pPic->getStride(compID); 260 const Int width = pPic->getWidth(compID); 261 const Int height = pPic->getHeight(compID); 262 263 const Int sample = width*height; 264 265 Int64 orgDC = 0; 87 266 { 88 267 const Pel *pPel = pPic->getAddr(compID); 89 268 90 for(Int y = 0; y < iHeight; y++, pPel+=iStride )91 { 92 for(Int x = 0; x < iWidth; x++ )93 { 94 iOrgDC += (Int)( pPel[x] );95 } 96 } 97 } 98 99 const Int64 iOrgNormDC = ((iOrgDC+(iSample>>1)) / iSample);100 101 Int64 iOrgAC = 0;269 for(Int y = 0; y < height; y++, pPel+=stride ) 270 { 271 for(Int x = 0; x < width; x++ ) 272 { 273 orgDC += (Int)( pPel[x] ); 274 } 275 } 276 } 277 278 const Int64 orgNormDC = ((orgDC+(sample>>1)) / sample); 279 280 Int64 orgAC = 0; 102 281 { 103 282 const Pel *pPel = pPic->getAddr(compID); 104 283 105 for(Int y = 0; y < iHeight; y++, pPel += iStride )106 { 107 for(Int x = 0; x < iWidth; x++ )108 { 109 iOrgAC += abs( (Int)pPel[x] - (Int)iOrgNormDC );284 for(Int y = 0; y < height; y++, pPel += stride ) 285 { 286 for(Int x = 0; x < width; x++ ) 287 { 288 orgAC += abs( (Int)pPel[x] - (Int)orgNormDC ); 110 289 } 111 290 } … … 113 292 114 293 const Int fixedBitShift = (slice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag())?RExt__PREDICTION_WEIGHTING_ANALYSIS_DC_PRECISION:0; 115 weightACDCParam[compID].iDC = ((( iOrgDC<<fixedBitShift)+(iSample>>1)) / iSample);116 weightACDCParam[compID].iAC = iOrgAC;294 weightACDCParam[compID].iDC = (((orgDC<<fixedBitShift)+(sample>>1)) / sample); 295 weightACDCParam[compID].iAC = orgAC; 117 296 } 118 297 … … 126 305 const TComPicYuv *pPic = slice->getPic()->getPicYuvOrg(); 127 306 128 Int iPresentCnt = 0;307 Int presentCnt = 0; 129 308 for ( UInt lst=0 ; lst<NUM_REF_PIC_LIST_01 ; lst++ ) 130 309 { 131 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )310 for ( Int refIdx=0 ; refIdx<MAX_NUM_REF ; refIdx++ ) 132 311 { 133 312 for(Int componentIndex = 0; componentIndex < pPic->getNumberValidComponents(); componentIndex++) 134 313 { 135 WPScalingParam *pwp = &(m_wp[lst][ iRefIdx][componentIndex]);136 iPresentCnt += (Int)pwp->bPresentFlag;137 } 138 } 139 } 140 141 if( iPresentCnt==0)314 WPScalingParam *pwp = &(m_wp[lst][refIdx][componentIndex]); 315 presentCnt += (Int)pwp->bPresentFlag; 316 } 317 } 318 } 319 320 if(presentCnt==0) 142 321 { 143 322 slice->setTestWeightPred(false); … … 146 325 for ( UInt lst=0 ; lst<NUM_REF_PIC_LIST_01 ; lst++ ) 147 326 { 148 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )327 for ( Int refIdx=0 ; refIdx<MAX_NUM_REF ; refIdx++ ) 149 328 { 150 329 for(Int componentIndex = 0; componentIndex < pPic->getNumberValidComponents(); componentIndex++) 151 330 { 152 WPScalingParam *pwp = &(m_wp[lst][ iRefIdx][componentIndex]);331 WPScalingParam *pwp = &(m_wp[lst][refIdx][componentIndex]); 153 332 154 333 pwp->bPresentFlag = false; … … 163 342 else 164 343 { 165 slice->setTestWeightPred (slice->getPPS()->getUseWP());344 slice->setTestWeightPred (slice->getPPS()->getUseWP()); 166 345 slice->setTestWeightBiPred(slice->getPPS()->getWPBiPred()); 167 346 } … … 170 349 171 350 //! estimate wp tables for explicit wp 172 Void WeightPredAnalysis::xEstimateWPParamSlice(TComSlice *const slice )351 Void WeightPredAnalysis::xEstimateWPParamSlice(TComSlice *const slice, const WeightedPredictionMethod method) 173 352 { 174 353 Int iDenom = 6; … … 191 370 // selecting whether WP is used, or not (fast search) 192 371 // NOTE: This is not operating on a slice, but the entire picture. 193 xSelectWP(slice, iDenom); 372 switch (method) 373 { 374 case WP_PER_PICTURE_WITH_SIMPLE_DC_COMBINED_COMPONENT: 375 xSelectWP(slice, iDenom); 376 break; 377 case WP_PER_PICTURE_WITH_SIMPLE_DC_PER_COMPONENT: 378 xSelectWPHistExtClip(slice, iDenom, false, false, false); 379 break; 380 case WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT: 381 xSelectWPHistExtClip(slice, iDenom, false, false, true); 382 break; 383 case WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING: 384 xSelectWPHistExtClip(slice, iDenom, false, true, true); 385 break; 386 case WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION: 387 xSelectWPHistExtClip(slice, iDenom, true, true, true); 388 break; 389 default: 390 assert(0); 391 exit(1); 392 } 194 393 195 394 slice->setWpScaling( m_wp ); … … 251 450 // Weighting factor limitation 252 451 const Int defaultWeight = (1<<log2Denom); 253 const Int deltaWeight = ( defaultWeight - weight);452 const Int deltaWeight = (weight - defaultWeight); 254 453 255 454 if(deltaWeight >= range || deltaWeight < -range) … … 269 468 270 469 470 /** select whether weighted pred enables or not. 471 * \param TComSlice *slice 472 * \param log2Denom 473 * \returns Bool 474 */ 475 Bool WeightPredAnalysis::xSelectWPHistExtClip(TComSlice *const slice, const Int log2Denom, const Bool bDoEnhancement, const Bool bClipInitialSADWP, const Bool bUseHistogram) 476 { 477 const TComPicYuv *const pPic = slice->getPic()->getPicYuvOrg(); 478 const Int defaultWeight = 1<<log2Denom; 479 const Int numPredDir = slice->isInterP() ? 1 : 2; 480 const Bool useHighPrecision = slice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag(); 481 482 assert (numPredDir <= Int(NUM_REF_PIC_LIST_01)); 483 484 for ( Int refList = 0; refList < numPredDir; refList++ ) 485 { 486 const RefPicList eRefPicList = ( refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 487 488 for ( Int refIdxTemp = 0; refIdxTemp < slice->getNumRefIdx(eRefPicList); refIdxTemp++ ) 489 { 490 Bool useChromaWeight = false; 491 492 for(Int comp=0; comp<pPic->getNumberValidComponents(); comp++) 493 { 494 const ComponentID compID = ComponentID(comp); 495 const Pel *pOrg = pPic->getAddr(compID); 496 const Pel *pRef = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getAddr(compID); 497 const Int orgStride = pPic->getStride(compID); 498 const Int refStride = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getStride(compID); 499 const Int width = pPic->getWidth(compID); 500 const Int height = pPic->getHeight(compID); 501 const Int bitDepth = slice->getSPS()->getBitDepth(toChannelType(compID)); 502 WPScalingParam &wp = m_wp[refList][refIdxTemp][compID]; 503 Int weight = wp.iWeight; 504 Int offset = wp.iOffset; 505 Int weightDef = defaultWeight; 506 Int offsetDef = 0; 507 508 // calculate SAD costs with/without wp for luma 509 const Int64 SADnoWP = xCalcSADvalueWPOptionalClip(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, defaultWeight, 0, useHighPrecision, bClipInitialSADWP); 510 if (SADnoWP > 0) 511 { 512 const Int64 SADWP = xCalcSADvalueWPOptionalClip(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weight, offset, useHighPrecision, bClipInitialSADWP); 513 const Double dRatioSAD = (Double)SADWP / (Double)SADnoWP; 514 Double dRatioSr0SAD = std::numeric_limits<Double>::max(); 515 Double dRatioSrSAD = std::numeric_limits<Double>::max(); 516 517 if (bUseHistogram) 518 { 519 std::vector<Int> histogramOrg;// = pPic->getHistogram(compID); 520 std::vector<Int> histogramRef;// = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getHistogram(compID); 521 std::vector<Int> searchedHistogram; 522 523 // Compute histograms 524 xCalcHistogram(pOrg, histogramOrg, width, height, orgStride, 1 << bitDepth); 525 xCalcHistogram(pRef, histogramRef, width, height, refStride, 1 << bitDepth); 526 527 // Do a histogram search around DC WP parameters; resulting distortion and 'searchedHistogram' is discarded 528 xSearchHistogram(histogramOrg, histogramRef, searchedHistogram, bitDepth, log2Denom, weight, offset, useHighPrecision, compID); 529 // calculate updated WP SAD 530 const Int64 SADSrWP = xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weight, offset, useHighPrecision); 531 dRatioSrSAD = (Double)SADSrWP / (Double)SADnoWP; 532 533 if (bDoEnhancement) 534 { 535 // Do the same around the default ones; resulting distortion and 'searchedHistogram' is discarded 536 xSearchHistogram(histogramOrg, histogramRef, searchedHistogram, bitDepth, log2Denom, weightDef, offsetDef, useHighPrecision, compID); 537 // calculate updated WP SAD 538 const Int64 SADSr0WP = xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, weightDef, offsetDef, useHighPrecision); 539 dRatioSr0SAD = (Double)SADSr0WP / (Double)SADnoWP; 540 } 541 } 542 543 if(min(dRatioSr0SAD, min(dRatioSAD, dRatioSrSAD)) >= WEIGHT_PRED_SAD_RELATIVE_TO_NON_WEIGHT_PRED_SAD) 544 { 545 wp.bPresentFlag = false; 546 wp.iOffset = 0; 547 wp.iWeight = defaultWeight; 548 wp.uiLog2WeightDenom = log2Denom; 549 } 550 else 551 { 552 if (compID != COMPONENT_Y) 553 { 554 useChromaWeight = true; 555 } 556 557 if (dRatioSr0SAD < dRatioSrSAD && dRatioSr0SAD < dRatioSAD) 558 { 559 wp.bPresentFlag = true; 560 wp.iOffset = offsetDef; 561 wp.iWeight = weightDef; 562 wp.uiLog2WeightDenom = log2Denom; 563 } 564 else if (dRatioSrSAD < dRatioSAD) 565 { 566 wp.bPresentFlag = true; 567 wp.iOffset = offset; 568 wp.iWeight = weight; 569 wp.uiLog2WeightDenom = log2Denom; 570 } 571 } 572 } 573 else // (SADnoWP <= 0) 574 { 575 wp.bPresentFlag = false; 576 wp.iOffset = 0; 577 wp.iWeight = defaultWeight; 578 wp.uiLog2WeightDenom = log2Denom; 579 } 580 } 581 582 for(Int comp=1; comp<pPic->getNumberValidComponents(); comp++) 583 { 584 m_wp[refList][refIdxTemp][comp].bPresentFlag = useChromaWeight; 585 } 586 } 587 } 588 589 return true; 590 } 591 271 592 //! select whether weighted pred enables or not. 272 593 Bool WeightPredAnalysis::xSelectWP(TComSlice *const slice, const Int log2Denom) 273 594 { 274 595 TComPicYuv *const pPic = slice->getPic()->getPicYuvOrg(); 275 const Int iDefaultWeight = ((Int)1<<log2Denom);276 const Int iNumPredDir= slice->isInterP() ? 1 : 2;596 const Int defaultWeight = 1<<log2Denom; 597 const Int numPredDir = slice->isInterP() ? 1 : 2; 277 598 const Bool useHighPrecisionPredictionWeighting = slice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag(); 278 599 279 assert ( iNumPredDir <= Int(NUM_REF_PIC_LIST_01));280 281 for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ )282 { 283 const RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );284 285 for ( Int iRefIdxTemp = 0; iRefIdxTemp < slice->getNumRefIdx(eRefPicList); iRefIdxTemp++ )286 { 287 Int64 iSADWP = 0, iSADnoWP = 0;600 assert (numPredDir <= Int(NUM_REF_PIC_LIST_01)); 601 602 for ( Int refList = 0; refList < numPredDir; refList++ ) 603 { 604 const RefPicList eRefPicList = ( refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 605 606 for ( Int refIdxTemp = 0; refIdxTemp < slice->getNumRefIdx(eRefPicList); refIdxTemp++ ) 607 { 608 Int64 SADWP = 0, SADnoWP = 0; 288 609 289 610 for(Int comp=0; comp<pPic->getNumberValidComponents(); comp++) … … 291 612 const ComponentID compID = ComponentID(comp); 292 613 Pel *pOrg = pPic->getAddr(compID); 293 Pel *pRef = slice->getRefPic(eRefPicList, iRefIdxTemp)->getPicYuvRec()->getAddr(compID);294 const Int iOrgStride = pPic->getStride(compID);295 const Int iRefStride = slice->getRefPic(eRefPicList, iRefIdxTemp)->getPicYuvRec()->getStride(compID);296 const Int iWidth = pPic->getWidth(compID);297 const Int iHeight = pPic->getHeight(compID);614 Pel *pRef = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getAddr(compID); 615 const Int orgStride = pPic->getStride(compID); 616 const Int refStride = slice->getRefPic(eRefPicList, refIdxTemp)->getPicYuvRec()->getStride(compID); 617 const Int width = pPic->getWidth(compID); 618 const Int height = pPic->getHeight(compID); 298 619 const Int bitDepth = slice->getSPS()->getBitDepth(toChannelType(compID)); 299 620 300 621 // calculate SAD costs with/without wp for luma 301 iSADWP += xCalcSADvalueWP(bitDepth, pOrg, pRef, iWidth, iHeight, iOrgStride, iRefStride, log2Denom, m_wp[iRefList][iRefIdxTemp][compID].iWeight, m_wp[iRefList][iRefIdxTemp][compID].iOffset, useHighPrecisionPredictionWeighting);302 iSADnoWP += xCalcSADvalueWP(bitDepth, pOrg, pRef, iWidth, iHeight, iOrgStride, iRefStride, log2Denom, iDefaultWeight, 0, useHighPrecisionPredictionWeighting);303 } 304 305 const Double dRatio = ((Double)iSADWP / (Double)iSADnoWP);306 if(dRatio >= (Double)DTHRESH)622 SADWP += xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, m_wp[refList][refIdxTemp][compID].iWeight, m_wp[refList][refIdxTemp][compID].iOffset, useHighPrecisionPredictionWeighting); 623 SADnoWP += xCalcSADvalueWP(bitDepth, pOrg, pRef, width, height, orgStride, refStride, log2Denom, defaultWeight, 0, useHighPrecisionPredictionWeighting); 624 } 625 626 const Double dRatio = SADnoWP > 0 ? (((Double)SADWP / (Double)SADnoWP)) : std::numeric_limits<Double>::max(); 627 if(dRatio >= WEIGHT_PRED_SAD_RELATIVE_TO_NON_WEIGHT_PRED_SAD) 307 628 { 308 629 for(Int comp=0; comp<pPic->getNumberValidComponents(); comp++) 309 630 { 310 m_wp[iRefList][iRefIdxTemp][comp].bPresentFlag = false; 311 m_wp[iRefList][iRefIdxTemp][comp].iOffset = 0; 312 m_wp[iRefList][iRefIdxTemp][comp].iWeight = iDefaultWeight; 313 m_wp[iRefList][iRefIdxTemp][comp].uiLog2WeightDenom = log2Denom; 631 WPScalingParam &wp=m_wp[refList][refIdxTemp][comp]; 632 wp.bPresentFlag = false; 633 wp.iOffset = 0; 634 wp.iWeight = defaultWeight; 635 wp.uiLog2WeightDenom = log2Denom; 314 636 } 315 637 } … … 320 642 } 321 643 322 323 //! calculate SAD values for both WP version and non-WP version. 324 Int64 WeightPredAnalysis::xCalcSADvalueWP(const Int bitDepth, 325 const Pel *pOrgPel, 326 const Pel *pRefPel, 327 const Int iWidth, 328 const Int iHeight, 329 const Int iOrgStride, 330 const Int iRefStride, 331 const Int iLog2Denom, 332 const Int iWeight, 333 const Int iOffset, 334 const Bool useHighPrecisionPredictionWeighting) 335 { 336 const Int64 iSize = iWidth*iHeight; 337 const Int64 iRealLog2Denom = useHighPrecisionPredictionWeighting ? iLog2Denom : (iLog2Denom + (bitDepth - 8)); 338 339 Int64 iSAD = 0; 340 for( Int y = 0; y < iHeight; y++ ) 341 { 342 for( Int x = 0; x < iWidth; x++ ) 343 { 344 iSAD += ABS(( ((Int64)pOrgPel[x]<<(Int64)iLog2Denom) - ( (Int64)pRefPel[x] * (Int64)iWeight + ((Int64)iOffset<<iRealLog2Denom) ) ) ); 345 } 346 pOrgPel += iOrgStride; 347 pRefPel += iRefStride; 348 } 349 350 return (iSAD/iSize); 351 } 644 // Alternatively, a SSE-based measure could be used instead. 645 // The respective function has been removed as it currently redundant. 646 static 647 Int64 xCalcSADvalueWP(const Int bitDepth, 648 const Pel *pOrgPel, 649 const Pel *pRefPel, 650 const Int width, 651 const Int height, 652 const Int orgStride, 653 const Int refStride, 654 const Int log2Denom, 655 const Int weight, 656 const Int offset, 657 const Bool useHighPrecision) 658 { 659 //const Int64 iSize = iWidth*iHeight; 660 const Int64 realLog2Denom = useHighPrecision ? log2Denom : (log2Denom + (bitDepth - 8)); 661 const Int64 realOffset = ((Int64)offset)<<realLog2Denom; 662 663 Int64 SAD = 0; 664 for( Int y = 0; y < height; y++ ) 665 { 666 for( Int x = 0; x < width; x++ ) 667 { 668 SAD += abs(( ((Int64)pOrgPel[x] << (Int64) log2Denom) - ( (Int64) pRefPel[x] * (Int64) weight + (realOffset) ) ) ); 669 } 670 pOrgPel += orgStride; 671 pRefPel += refStride; 672 } 673 674 //return (iSAD/iSize); 675 return SAD; 676 } 677 678 static 679 Int64 xCalcSADvalueWPOptionalClip(const Int bitDepth, 680 const Pel *pOrgPel, 681 const Pel *pRefPel, 682 const Int width, 683 const Int height, 684 const Int orgStride, 685 const Int refStride, 686 const Int log2Denom, 687 const Int weight, 688 const Int offset, 689 const Bool useHighPrecision, 690 const Bool clipped) 691 { 692 Int64 SAD = 0; 693 if (clipped) 694 { 695 const Int64 realLog2Denom = useHighPrecision ? 0 : (bitDepth - 8); 696 const Int64 realOffset = (Int64)offset<<realLog2Denom; 697 const Int64 roundOffset = (log2Denom == 0) ? 0 : 1 << (log2Denom - 1); 698 const Int64 minValue = 0; 699 const Int64 maxValue = (1 << bitDepth) - 1; 700 701 for( Int y = 0; y < height; y++ ) 702 { 703 for( Int x = 0; x < width; x++ ) 704 { 705 Int64 scaledValue = Clip3(minValue, maxValue, ((((Int64) pRefPel[x] * (Int64) weight + roundOffset) ) >> (Int64) log2Denom) + realOffset); 706 SAD += abs((Int64)pOrgPel[x] - scaledValue); 707 } 708 pOrgPel += orgStride; 709 pRefPel += refStride; 710 } 711 } 712 else 713 { 714 //const Int64 iSize = iWidth*iHeight; 715 const Int64 realLog2Denom = useHighPrecision ? log2Denom : (log2Denom + (bitDepth - 8)); 716 const Int64 realOffset = ((Int64)offset)<<realLog2Denom; 717 718 for( Int y = 0; y < height; y++ ) 719 { 720 for( Int x = 0; x < width; x++ ) 721 { 722 SAD += abs(( ((Int64)pOrgPel[x] << (Int64) log2Denom) - ( (Int64) pRefPel[x] * (Int64) weight + (realOffset) ) ) ); 723 } 724 pOrgPel += orgStride; 725 pRefPel += refStride; 726 } 727 } 728 return SAD; 729 } -
branches/HTM-15.2-dev/source/Lib/TLibEncoder/WeightPredAnalysis.h
r1313 r1360 52 52 53 53 Bool xSelectWP (TComSlice *const slice, const Int log2Denom); 54 Bool xSelectWPHistExtClip (TComSlice *const slice, const Int log2Denom, const Bool bDoEnhancement, const Bool bClipInitialSADWP, const Bool bUseHistogram); 54 55 Bool xUpdatingWPParameters(TComSlice *const slice, const Int log2Denom); 55 56 Int64 xCalcSADvalueWP (const Int bitDepth,57 const Pel *pOrgPel,58 const Pel *pRefPel,59 const Int iWidth,60 const Int iHeight,61 const Int iOrgStride,62 const Int iRefStride,63 const Int iLog2Denom,64 const Int iWeight,65 const Int iOffset,66 const Bool useHighPrecisionPredictionWeighting);67 56 68 57 public: … … 72 61 // WP analysis : 73 62 Void xCalcACDCParamSlice (TComSlice *const slice); 74 Void xEstimateWPParamSlice(TComSlice *const slice );63 Void xEstimateWPParamSlice(TComSlice *const slice, const WeightedPredictionMethod method); 75 64 Void xCheckWPEnable (TComSlice *const slice); 76 65 }; -
branches/HTM-15.2-dev/source/Lib/TLibRenderer/TRenModSetupStrParser.cpp
r1313 r1360 153 153 154 154 Void 155 TRenModSetupStrParser::setString( Int iNumOfBaseViews, Char* pchSetStr )155 TRenModSetupStrParser::setString( Int iNumOfBaseViews, TChar* pchSetStr ) 156 156 { 157 157 for (Int iContent = 0; iContent < 2; iContent++) … … 178 178 TRenModSetupStrParser::xParseString() 179 179 { 180 Char cChar;180 TChar cChar; 181 181 xGetNextChar(cChar); 182 182 while( cChar != '\0' ) … … 220 220 m_bCurrentViewSet = false; 221 221 222 Char cChar;222 TChar cChar; 223 223 xGetNextCharGoOn( cChar ); 224 224 xError( cChar != '[' ); … … 249 249 250 250 Void 251 TRenModSetupStrParser::xReadViews( Char cType )252 { 253 Char cChar;251 TRenModSetupStrParser::xReadViews( TChar cType ) 252 { 253 TChar cChar; 254 254 xGetNextCharGoOn( cChar ); 255 255 xError( cChar != '(' ); … … 272 272 273 273 Void 274 TRenModSetupStrParser::xReadViewInfo( Char cType )274 TRenModSetupStrParser::xReadViewInfo( TChar cType ) 275 275 { 276 276 std::vector<Int> aiViewNums; … … 280 280 { 281 281 case 'B': 282 Char cVideoType;283 Char cDepthType;282 TChar cVideoType; 283 TChar cDepthType; 284 284 285 285 xGetNextCharGoOn ( cVideoType ); … … 317 317 case 'L': 318 318 case 'R': 319 Char cRefType;319 TChar cRefType; 320 320 xGetNextCharGoOn ( cRefType ); 321 321 xGetViewNumberRange( aiViewNums ); … … 328 328 329 329 Void 330 TRenModSetupStrParser::xAddBaseView( Int iViewIdx, Char cVideoType,Char cDepthType )330 TRenModSetupStrParser::xAddBaseView( Int iViewIdx, TChar cVideoType, TChar cDepthType ) 331 331 { 332 332 AOF( m_bCurrentViewSet ); … … 334 334 if ( cDepthType == 'x' ) cDepthType = 'o'; 335 335 if ( cVideoType == 'x' ) cVideoType = 'o'; 336 337 338 336 339 337 xError( cDepthType != 'o' && cDepthType != 'c' && cVideoType != 'r' ); 340 338 xError( cVideoType != 'o' && cVideoType != 'c' && cVideoType != 'r' ); … … 346 344 347 345 Void 348 TRenModSetupStrParser::xAddSynthView( Int iViewNum, Char cType,Char cRefType )346 TRenModSetupStrParser::xAddSynthView( Int iViewNum, TChar cType, TChar cRefType ) 349 347 { 350 348 AOF( m_bCurrentViewSet ); … … 399 397 size_t iStartPos; 400 398 size_t iEndPos; 401 Char cChar;399 TChar cChar; 402 400 xGetNextCharGoOn(cChar ); 403 401 if (cChar == '{') … … 424 422 425 423 size_t iNumElem = iEndPos - iStartPos + 1; 426 Char* pcTempBuffer = newChar[ iNumElem + 1];424 TChar* pcTempBuffer = new TChar[ iNumElem + 1]; 427 425 strncpy( pcTempBuffer, m_pchSetStr + iStartPos, iNumElem ); 428 426 pcTempBuffer[iNumElem] = '\0'; … … 433 431 434 432 Void 435 TRenModSetupStrParser::xGetNextCharGoOn( Char& rcNextChar )433 TRenModSetupStrParser::xGetNextCharGoOn( TChar& rcNextChar ) 436 434 { 437 435 while ( m_pchSetStr[m_iPosInStr] == ' ' || m_pchSetStr[m_iPosInStr] == ',' ) … … 445 443 446 444 Void 447 TRenModSetupStrParser::xGetNextChar( Char& rcNextChar )445 TRenModSetupStrParser::xGetNextChar( TChar& rcNextChar ) 448 446 { 449 447 size_t iPos = m_iPosInStr; -
branches/HTM-15.2-dev/source/Lib/TLibRenderer/TRenModSetupStrParser.h
r1356 r1360 92 92 TRenModSetupStrParser(); 93 93 94 Void setString( Int iNumOfBaseViews, Char* pchSetStr );94 Void setString( Int iNumOfBaseViews, TChar* pchSetStr ); 95 95 96 96 private: … … 112 112 Int m_iNumberOfModels; 113 113 114 Char* m_pchSetStr;114 TChar* m_pchSetStr; 115 115 size_t m_iPosInStr; 116 116 … … 118 118 Void xParseString(); 119 119 Void xParseSourceView(); 120 Void xReadViews ( Char cType );121 Void xReadViewInfo ( Char cType );122 Void xAddBaseView ( Int iViewIdx, Char cVideoType,Char cDepthType );123 Void xAddSynthView ( Int iViewNum, Char cType,Char cRefType );120 Void xReadViews ( TChar cType ); 121 Void xReadViewInfo ( TChar cType ); 122 Void xAddBaseView ( Int iViewIdx, TChar cVideoType, TChar cDepthType ); 123 Void xAddSynthView ( Int iViewNum, TChar cType, TChar cRefType ); 124 124 Void xError ( Bool bIsError ); 125 125 Void xGetViewNumberRange( std::vector<Int>& raiViewNumbers ); 126 Void xGetNextCharGoOn ( Char& rcNextChar );127 Void xGetNextChar ( Char& rcNextChar );126 Void xGetNextCharGoOn ( TChar& rcNextChar ); 127 Void xGetNextChar ( TChar& rcNextChar ); 128 128 }; 129 129 -
branches/HTM-15.2-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp
r1313 r1360 95 95 } 96 96 97 static Void 98 copyPlane(const TComPicYuv &src, const ComponentID srcPlane, TComPicYuv &dest, const ComponentID destPlane); 97 99 98 100 // ==================================================================================================================== … … 116 118 * \param internalBitDepth bit-depth array to scale image data to/from when reading/writing. 117 119 */ 118 Void TVideoIOYuv::open( Char* pchFile, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] )120 Void TVideoIOYuv::open( const std::string &fileName, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ) 119 121 { 120 122 //NOTE: files cannot have bit depth greater than 16 … … 141 143 if ( bWriteMode ) 142 144 { 143 m_cHandle.open( pchFile, ios::binary | ios::out );145 m_cHandle.open( fileName.c_str(), ios::binary | ios::out ); 144 146 145 147 if( m_cHandle.fail() ) … … 151 153 else 152 154 { 153 m_cHandle.open( pchFile, ios::binary | ios::in );155 m_cHandle.open( fileName.c_str(), ios::binary | ios::in ); 154 156 155 157 if( m_cHandle.fail() ) … … 217 219 218 220 /* fall back to consuming the input */ 219 Char buf[512];221 TChar buf[512]; 220 222 const streamoff offset_mod_bufsize = offset % sizeof(buf); 221 223 for (streamoff i = 0; i < offset - offset_mod_bufsize; i += sizeof(buf)) … … 274 276 const UInt stride_file = (width444 * (is16bit ? 2 : 1)) >> csx_file; 275 277 276 UChar *buf = new UChar[stride_file]; 278 std::vector<UChar> bufVec(stride_file); 279 UChar *buf=&(bufVec[0]); 277 280 278 281 if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || destFormat==CHROMA_400)) … … 297 300 if (fd.eof() || fd.fail() ) 298 301 { 299 delete[] buf;300 302 return false; 301 303 } … … 311 313 { 312 314 // read a new line 313 fd.read(reinterpret_cast< Char*>(buf), stride_file);315 fd.read(reinterpret_cast<TChar*>(buf), stride_file); 314 316 if (fd.eof() || fd.fail() ) 315 317 { 316 delete[] buf;317 318 return false; 318 319 } … … 381 382 } 382 383 } 383 delete[] buf;384 384 return true; 385 385 } … … 419 419 const UInt height_file = height444>>csy_file; 420 420 421 UChar *buf = new UChar[stride_file]; 421 std::vector<UChar> bufVec(stride_file); 422 UChar *buf=&(bufVec[0]); 422 423 423 424 if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || srcFormat==CHROMA_400)) … … 447 448 } 448 449 449 fd.write(reinterpret_cast< Char*>(buf), stride_file);450 fd.write(reinterpret_cast<const TChar*>(buf), stride_file); 450 451 if (fd.eof() || fd.fail() ) 451 452 { 452 delete[] buf;453 453 return false; 454 454 } … … 506 506 } 507 507 508 fd.write(reinterpret_cast< Char*>(buf), stride_file);508 fd.write(reinterpret_cast<const TChar*>(buf), stride_file); 509 509 if (fd.eof() || fd.fail() ) 510 510 { 511 delete[] buf;512 511 return false; 513 512 } … … 521 520 } 522 521 } 523 delete[] buf;524 522 return true; 525 523 } … … 544 542 const UInt height_file = height444>>csy_file; 545 543 546 UChar *buf = new UChar[stride_file * 2]; 544 std::vector<UChar> bufVec(stride_file * 2); 545 UChar *buf=&(bufVec[0]); 547 546 548 547 if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || srcFormat==CHROMA_400)) … … 577 576 } 578 577 579 fd.write(reinterpret_cast< Char*>(buf), (stride_file * 2));578 fd.write(reinterpret_cast<const TChar*>(buf), (stride_file * 2)); 580 579 if (fd.eof() || fd.fail() ) 581 580 { 582 delete[] buf;583 581 return false; 584 582 } … … 642 640 } 643 641 644 fd.write(reinterpret_cast< Char*>(buf), (stride_file * 2));642 fd.write(reinterpret_cast<const TChar*>(buf), (stride_file * 2)); 645 643 if (fd.eof() || fd.fail() ) 646 644 { 647 delete[] buf;648 645 return false; 649 646 } … … 658 655 } 659 656 } 660 delete[] buf;661 657 return true; 662 658 } … … 760 756 if (ipCSC!=IPCOLOURSPACE_UNCHANGED) 761 757 { 762 cPicYuvCSCd.create (pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), pPicYuvUser->getChromaFormat(), pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), 0, false);758 cPicYuvCSCd.createWithoutCUInfo(pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), pPicYuvUser->getChromaFormat() ); 763 759 ColourSpaceConvert(*pPicYuvUser, cPicYuvCSCd, ipCSC, false); 764 760 } … … 766 762 767 763 // compute actual YUV frame size excluding padding size 768 const Int iStride444 = pPicYuv->getStride(COMPONENT_Y);769 const UInt width444 = pPicYuv->getWidth(COMPONENT_Y) - confLeft - confRight;770 const UInt height444 = pPicYuv->getHeight(COMPONENT_Y) - confTop - confBottom;771 764 Bool is16bit = false; 772 765 Bool nonZeroBitDepthShift=false; 773 774 if ((width444 == 0) || (height444 == 0))775 {776 printf ("\nWarning: writing %d x %d luma sample output picture!", width444, height444);777 }778 766 779 767 for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) … … 799 787 { 800 788 dstPicYuv = new TComPicYuv; 801 dstPicYuv->create( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat(), pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), 0, false ); 802 pPicYuv->copyToPic(dstPicYuv); 789 dstPicYuv->createWithoutCUInfo( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat() ); 803 790 804 791 for(UInt comp=0; comp<dstPicYuv->getNumberValidComponents(); comp++) … … 810 797 const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1; 811 798 799 copyPlane(*pPicYuv, compID, *dstPicYuv, compID); 812 800 scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval); 813 801 } … … 817 805 dstPicYuv = pPicYuv; 818 806 } 819 #if NH_3D 820 for(UInt comp=0; retval && comp< ::getNumberValidComponents(format); comp++) 821 #else 807 808 const Int stride444 = dstPicYuv->getStride(COMPONENT_Y); 809 const UInt width444 = dstPicYuv->getWidth(COMPONENT_Y) - confLeft - confRight; 810 const UInt height444 = dstPicYuv->getHeight(COMPONENT_Y) - confTop - confBottom; 811 812 if ((width444 == 0) || (height444 == 0)) 813 { 814 printf ("\nWarning: writing %d x %d luma sample output picture!", width444, height444); 815 } 816 822 817 for(UInt comp=0; retval && comp<dstPicYuv->getNumberValidComponents(); comp++) 823 #endif824 818 { 825 819 const ComponentID compID = ComponentID(comp); 826 820 const ChannelType ch=toChannelType(compID); 827 const UInt csx = pPicYuv->getComponentScaleX(compID);828 const UInt csy = pPicYuv->getComponentScaleY(compID);829 const Int planeOffset = (confLeft>>csx) + (confTop>>csy) * pPicYuv->getStride(compID);830 if (! writePlane(m_cHandle, dstPicYuv->getAddr(compID) + planeOffset, is16bit, iStride444, width444, height444, compID, dstPicYuv->getChromaFormat(), format, m_fileBitdepth[ch]))821 const UInt csx = dstPicYuv->getComponentScaleX(compID); 822 const UInt csy = dstPicYuv->getComponentScaleY(compID); 823 const Int planeOffset = (confLeft>>csx) + (confTop>>csy) * dstPicYuv->getStride(compID); 824 if (! writePlane(m_cHandle, dstPicYuv->getAddr(compID) + planeOffset, is16bit, stride444, width444, height444, compID, dstPicYuv->getChromaFormat(), format, m_fileBitdepth[ch])) 831 825 { 832 826 retval=false; … … 852 846 if (ipCSC!=IPCOLOURSPACE_UNCHANGED) 853 847 { 854 cPicYuvTopCSCd .create (pPicYuvUserTop ->getWidth(COMPONENT_Y), pPicYuvUserTop ->getHeight(COMPONENT_Y), pPicYuvUserTop ->getChromaFormat(), pPicYuvUserTop ->getWidth(COMPONENT_Y), pPicYuvUserTop ->getHeight(COMPONENT_Y), 0, false);855 cPicYuvBottomCSCd.create (pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), pPicYuvUserBottom->getChromaFormat(), pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), 0, false);848 cPicYuvTopCSCd .createWithoutCUInfo(pPicYuvUserTop ->getWidth(COMPONENT_Y), pPicYuvUserTop ->getHeight(COMPONENT_Y), pPicYuvUserTop ->getChromaFormat() ); 849 cPicYuvBottomCSCd.createWithoutCUInfo(pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), pPicYuvUserBottom->getChromaFormat() ); 856 850 ColourSpaceConvert(*pPicYuvUserTop, cPicYuvTopCSCd, ipCSC, false); 857 851 ColourSpaceConvert(*pPicYuvUserBottom, cPicYuvBottomCSCd, ipCSC, false); … … 892 886 { 893 887 dstPicYuv = new TComPicYuv; 894 dstPicYuv->create( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat(), pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), 0, false ); 895 pPicYuv->copyToPic(dstPicYuv); 888 dstPicYuv->createWithoutCUInfo( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat() ); 896 889 897 890 for(UInt comp=0; comp<dstPicYuv->getNumberValidComponents(); comp++) … … 903 896 const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1; 904 897 898 copyPlane(*pPicYuv, compID, *dstPicYuv, compID); 905 899 scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval); 906 900 } … … 916 910 assert(dstPicYuvTop->getNumberValidComponents() == dstPicYuvBottom->getNumberValidComponents()); 917 911 assert(dstPicYuvTop->getChromaFormat() == dstPicYuvBottom->getChromaFormat() ); 918 assert(dstPicYuvTop->getWidth(COMPONENT_Y) == dstPicYuvBottom->getWidth(COMPONENT_Y) );919 assert(dstPicYuvTop->getHeight(COMPONENT_Y) == dstPicYuvBottom->getHeight(COMPONENT_Y) );920 assert(dstPicYuvTop->getStride(COMPONENT_Y) == dstPicYuvBottom->getStride(COMPONENT_Y) );921 912 922 913 for(UInt comp=0; retval && comp<dstPicYuvTop->getNumberValidComponents(); comp++) … … 925 916 const ChannelType ch=toChannelType(compID); 926 917 918 assert(dstPicYuvTop->getWidth (compID) == dstPicYuvBottom->getWidth (compID)); 919 assert(dstPicYuvTop->getHeight (compID) == dstPicYuvBottom->getHeight (compID)); 927 920 assert(dstPicYuvTop->getComponentScaleX(compID) == dstPicYuvBottom->getComponentScaleX(compID)); 928 921 assert(dstPicYuvTop->getComponentScaleY(compID) == dstPicYuvBottom->getComponentScaleY(compID)); -
branches/HTM-15.2-dev/source/Lib/TLibVideoIO/TVideoIOYuv.h
r1313 r1360 64 64 virtual ~TVideoIOYuv() {} 65 65 66 Void open ( Char* pchFile, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ); ///< open or create file66 Void open ( const std::string &fileName, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ); ///< open or create file 67 67 Void close (); ///< close file 68 68
Note: See TracChangeset for help on using the changeset viewer.