Changeset 1200 in 3DVCSoftware for branches/HTM-14.1-update-dev0/source/App/TAppDecoder
- Timestamp:
- 4 May 2015, 18:38:08 (10 years ago)
- Location:
- branches/HTM-14.1-update-dev0/source/App/TAppDecoder
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-14.1-update-dev0/source/App/TAppDecoder/TAppDecCfg.cpp
r1179 r1200 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC4 * granted under this license. 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 41 41 #include "TAppDecCfg.h" 42 42 #include "TAppCommon/program_options_lite.h" 43 44 #if H_MV 45 #include <cassert> 46 #endif 43 #include "TLibCommon/TComChromaFormat.h" 47 44 #ifdef WIN32 48 45 #define strdup _strdup 46 #endif 47 #if NH_MV 48 #include <cassert> 49 49 #endif 50 50 … … 68 68 string cfg_ReconFile; 69 69 string cfg_TargetDecLayerIdSetFile; 70 #if H_3D70 #if NH_3D 71 71 string cfg_ScaleOffsetFile; 72 72 #endif 73 string outputColourSpaceConvert; 74 Int warnUnknowParameter = 0; 73 75 74 76 po::Options opts; 75 77 opts.addOptions() 76 ("help", do_help, false, "this help text") 77 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream input file name") 78 ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name\n" 79 "YUV writing is skipped if omitted") 80 #if H_3D 81 ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets") 82 #endif 83 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") 84 ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)") 85 ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)") 86 #if H_MV 87 ("TargetOptLayerSetIdx,x", m_targetOptLayerSetIdx, -1, "Target output layer set index. (default: -1, determine automatically to be equal to highest layer set index") // Should actually equal to 0 as default. However, this would cause only the base layer to be decoded. 88 #endif 89 ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers") 90 ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n" 91 "\t1: check hash in SEI messages if available in the bitstream\n" 92 "\t0: ignore SEI message") 93 ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 1, "deprecated alias for SEIDecodedPictureHash") 94 ("TarDecLayerIdSetFile,l", cfg_TargetDecLayerIdSetFile, string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.") 95 ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n") 96 #if H_MV 97 ("OutputVpsInfo,v", m_outputVpsInfo, false, "Output information about the layer dependencies and layer sets") 98 #endif 78 79 80 ("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" 83 "YUV writing is skipped if omitted") 84 #if NH_3D 85 ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets") 86 ("Depth420OutputFlag", m_depth420OutputFlag, true , "Output depth layers in 4:2:0 ") 87 #endif 88 ("WarnUnknowParameter,w", warnUnknowParameter, 0, "warn for unknown configuration parameters instead of failing") 89 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") 90 ("OutputBitDepth,d", m_outputBitDepth[CHANNEL_TYPE_LUMA], 0, "bit depth of YUV output luma component (default: use 0 for native depth)") 91 ("OutputBitDepthC,d", m_outputBitDepth[CHANNEL_TYPE_CHROMA], 0, "bit depth of YUV output chroma component (default: use 0 for native depth)") 92 ("OutputColourSpaceConvert", outputColourSpaceConvert, string(""), "Colour space conversion to apply to input 444 video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(false)) 93 #if NH_MV 94 ("TargetOptLayerSetIdx,x", m_targetOptLayerSetIdx, -1, "Target output layer set index. (default: -1, determine automatically to be equal to highest layer set index") // Should actually equal to 0 as default. However, this would cause only the base layer to be decoded. 95 #endif 96 ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers") 97 ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n" 98 "\t1: check hash in SEI messages if available in the bitstream\n" 99 "\t0: ignore SEI message") 100 ("SEINoDisplay", m_decodedNoDisplaySEIEnabled, true, "Control handling of decoded no display SEI messages") 101 ("TarDecLayerIdSetFile,l", cfg_TargetDecLayerIdSetFile, string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.") 102 ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n") 103 #if NH_MV 104 ("OutputVpsInfo,v", m_outputVpsInfo, false, "Output information about the layer dependencies and layer sets") 105 #endif 106 #if O0043_BEST_EFFORT_DECODING 107 ("ForceDecodeBitDepth", m_forceDecodeBitDepth, 0U, "Force the decoder to operate at a particular bit-depth (best effort decoding)") 108 #endif 109 ("OutputDecodedSEIMessagesFilename", m_outputDecodedSEIMessagesFilename, string(""), "When non empty, output decoded SEI messages to the indicated file. If file is '-', then output to stdout\n") 110 ("ClipOutputVideoToRec709Range", m_bClipOutputVideoToRec709Range, false, "If true then clip output video to the Rec. 709 Range on saving") 99 111 ; 112 100 113 po::setDefaults(opts); 101 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); 114 po::ErrorReporter err; 115 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv, err); 102 116 103 117 for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) … … 109 123 { 110 124 po::doHelp(cout, opts); 125 return false; 126 } 127 128 if (err.is_errored) 129 { 130 if (!warnUnknowParameter) 131 { 132 /* errors have already been reported to stderr */ 133 return false; 134 } 135 } 136 137 m_outputColourSpaceConvert = stringToInputColourSpaceConvert(outputColourSpaceConvert, false); 138 if (m_outputColourSpaceConvert>=NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS) 139 { 140 fprintf(stderr, "Bad output colour space conversion string\n"); 111 141 return false; 112 142 } … … 116 146 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 117 147 118 #if H_3D148 #if NH_3D 119 149 m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str()); 120 150 #endif 151 121 152 if (!m_pchBitstreamFile) 122 153 { 123 fprintf(stderr, "No input file specif ed, aborting\n");154 fprintf(stderr, "No input file specified, aborting\n"); 124 155 return false; 125 156 } … … 127 158 if ( !cfg_TargetDecLayerIdSetFile.empty() ) 128 159 { 129 #if H_MV160 #if NH_MV 130 161 m_targetDecLayerIdSetFileEmpty = false; 131 162 #endif … … 152 183 if ( layerIdParsed < 0 || layerIdParsed >= MAX_NUM_LAYER_IDS ) 153 184 { 154 fprintf(stderr, "Warning! Parsed LayerId %d is not within gallowed range [0,%d]. Ignoring this value.\n", layerIdParsed, MAX_NUM_LAYER_IDS-1 );185 fprintf(stderr, "Warning! Parsed LayerId %d is not within allowed range [0,%d]. Ignoring this value.\n", layerIdParsed, MAX_NUM_LAYER_IDS-1 ); 155 186 } 156 187 else … … 172 203 } 173 204 } 174 #if H_MV 175 m_targetDecLayerIdSet.push_back( 0 ); // Only base layer at startup 176 #endif 177 205 206 #if NH_MV 207 //m_targetDecLayerIdSet.push_back( 0 ); // Only base layer at startup 208 #endif 178 209 return true; 179 210 } 180 211 181 #if H_MV212 #if NH_MV 182 213 Void TAppDecCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName) 183 214 { -
branches/HTM-14.1-update-dev0/source/App/TAppDecoder/TAppDecCfg.h
r1179 r1200 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 45 45 #include "TLibCommon/CommonDef.h" 46 46 #include <vector> 47 47 48 //! \ingroup TAppDecoder 48 49 //! \{ … … 56 57 { 57 58 protected: 58 Char* m_pchBitstreamFile; ///< input bitstream file name59 #if H_MV60 Int m_targetOptLayerSetIdx; ///< target output layer set index61 Int m_maxLayerId; ///< maximum nuh_layer_id decoded62 std::vector<Char*> m_pchReconFiles; ///< array of output reconstruction file name create from output reconstruction file name59 Char* m_pchBitstreamFile; ///< input bitstream file name 60 #if NH_MV 61 Int m_targetOptLayerSetIdx; ///< target output layer set index 62 Int m_maxLayerId; ///< maximum nuh_layer_id decoded 63 std::vector<Char*> m_pchReconFiles; ///< array of output reconstruction file name create from output reconstruction file name 63 64 #endif 64 Char* m_pchReconFile; ///< output reconstruction file name 65 #if H_3D 66 Char* m_pchScaleOffsetFile; ///< output coded scale and offset parameters 65 Char* m_pchReconFile; ///< output reconstruction file name 66 #if NH_3D 67 Char* m_pchScaleOffsetFile; ///< output coded scale and offset parameters 68 Bool m_depth420OutputFlag; ///< output depth layers in 4:2:0 67 69 #endif 68 Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip69 Int m_outputBitDepth Y; ///< bit depth used for writing output (luma)70 In t m_outputBitDepthC; ///< bit depth used for writing output (chroma)t70 Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip 71 Int m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit depth used for writing output 72 InputColourSpaceConversion m_outputColourSpaceConvert; 71 73 72 74 Int m_iMaxTemporalLayer; ///< maximum temporal layer to be decoded 73 75 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 76 Bool m_decodedNoDisplaySEIEnabled; ///< Enable(true)/disable(false) writing only pictures that get displayed based on the no display SEI message 77 std::vector<Int> m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process. 78 #if NH_MV 79 Bool m_targetDecLayerIdSetFileEmpty; ///< indication if target layers are given by file 80 #endif 74 81 75 std::vector<Int> m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process.76 #if H_MV77 Bool m_targetDecLayerIdSetFileEmpty; ///< indication if target layers are given by file82 Int m_respectDefDispWindow; ///< Only output content inside the default display window 83 #if O0043_BEST_EFFORT_DECODING 84 UInt m_forceDecodeBitDepth; ///< if non-zero, force the bit depth at the decoder (best effort decoding) 78 85 #endif 79 Int m_respectDefDispWindow; ///< Only output content inside the default display window80 81 #if H_MV86 std::string m_outputDecodedSEIMessagesFilename; ///< filename to output decoded SEI messages to. If '-', then use stdout. If empty, do not output details. 87 Bool m_bClipOutputVideoToRec709Range; ///< If true, clip the output video to the Rec 709 range on saving. 88 #if NH_MV 82 89 Bool m_outputVpsInfo; ///< Output VPS information 83 90 Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName); ///< create filenames 84 91 #endif 92 85 93 public: 86 94 TAppDecCfg() … … 88 96 , m_pchReconFile(NULL) 89 97 , m_iSkipFrame(0) 90 , m_outputBitDepthY(0) 91 , m_outputBitDepthC(0) 98 , m_outputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED) 92 99 , m_iMaxTemporalLayer(-1) 93 100 , m_decodedPictureHashSEIEnabled(0) 94 #if H_MV 101 , m_decodedNoDisplaySEIEnabled(false) 102 #if NH_MV 95 103 , m_targetDecLayerIdSetFileEmpty(true) 96 104 #endif 97 105 , m_respectDefDispWindow(0) 98 {} 106 #if O0043_BEST_EFFORT_DECODING 107 , m_forceDecodeBitDepth(0) 108 #endif 109 { 110 for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++) 111 { 112 m_outputBitDepth[channelTypeIndex] = 0; 113 } 114 } 115 99 116 virtual ~TAppDecCfg() {} 100 117 101 118 Bool parseCfg ( Int argc, Char* argv[] ); ///< initialize option class from configuration 102 119 }; -
branches/HTM-14.1-update-dev0/source/App/TAppDecoder/TAppDecTop.cpp
r1196 r1200 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 45 45 #include "TLibDecoder/AnnexBread.h" 46 46 #include "TLibDecoder/NALread.h" 47 #if RExt__DECODER_DEBUG_BIT_STATISTICS 48 #include "TLibCommon/TComCodingStatistics.h" 49 #endif 47 50 48 51 //! \ingroup TAppDecoder … … 54 57 55 58 TAppDecTop::TAppDecTop() 56 #if ! H_MV59 #if !NH_MV 57 60 : m_iPOCLastDisplay(-MAX_INT) 58 61 #else … … 60 63 #endif 61 64 { 62 #if H_MV65 #if NH_MV 63 66 for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) 64 67 { … … 67 70 } 68 71 #endif 69 #if H_3D72 #if NH_3D 70 73 m_pScaleOffsetFile = 0; 71 74 #endif 72 75 73 #if H_MV76 #if NH_MV 74 77 m_markedForOutput = false; 75 78 #endif … … 83 86 Void TAppDecTop::destroy() 84 87 { 88 #if NH_MV 89 // destroy internal classes 90 xDestroyDecLib(); 91 #endif 92 85 93 if (m_pchBitstreamFile) 86 94 { … … 88 96 m_pchBitstreamFile = NULL; 89 97 } 90 #if H_MV98 #if NH_MV 91 99 for (Int decIdx = 0; decIdx < m_numDecoders; decIdx++) 92 100 { … … 103 111 m_pchReconFile = NULL; 104 112 } 105 #if H_3D113 #if NH_3D 106 114 if (m_pchScaleOffsetFile) 107 115 { … … 127 135 { 128 136 Int poc; 129 #if H_MV137 #if NH_MV 130 138 poc = -1; 131 139 #endif … … 138 146 exit(EXIT_FAILURE); 139 147 } 140 141 #if H_3D 148 #if NH_3D 142 149 if( m_pchScaleOffsetFile ) 143 150 { … … 146 153 } 147 154 #endif 155 148 156 InputByteStream bytestream(bitstreamFile); 157 158 if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-") 159 { 160 m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out); 161 if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good()) 162 { 163 fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str()); 164 exit(EXIT_FAILURE); 165 } 166 } 149 167 150 168 // create & initialize internal classes 151 169 xCreateDecLib(); 152 170 xInitDecLib (); 153 #if ! H_MV171 #if !NH_MV 154 172 m_iPOCLastDisplay += m_iSkipFrame; // set the last displayed POC correctly for skip forward. 155 173 … … 169 187 Bool firstSlice = true; 170 188 #endif 171 Bool loopFiltered 189 Bool loopFiltered = false; 172 190 173 191 while (!!bitstreamFile) … … 177 195 * requires the TDecTop::decode() method to be called again with the same 178 196 * nal unit. */ 197 #if RExt__DECODER_DEBUG_BIT_STATISTICS 198 TComCodingStatistics::TComCodingStatisticsData backupStats(TComCodingStatistics::GetStatistics()); 199 streampos location = bitstreamFile.tellg() - streampos(bytestream.GetNumBufferedBytes()); 200 #else 179 201 streampos location = bitstreamFile.tellg(); 180 #if H_MV 202 #endif 203 #if NH_MV 181 204 #if ENC_DEC_TRACE 182 205 Int64 symCount = g_nSymbolCounter; … … 184 207 #endif 185 208 AnnexBStats stats = AnnexBStats(); 186 vector<uint8_t> nalUnit; 209 187 210 InputNALUnit nalu; 188 byteStreamNALUnit(bytestream, nal Unit, stats);211 byteStreamNALUnit(bytestream, nalu.getBitstream().getFifo(), stats); 189 212 190 213 // call actual decoding function 191 214 Bool bNewPicture = false; 192 #if H_MV215 #if NH_MV 193 216 Bool newSliceDiffPoc = false; 194 217 Bool newSliceDiffLayer = false; … … 196 219 Bool allLayersDecoded = false; 197 220 #endif 198 if (nal Unit.empty())221 if (nalu.getBitstream().getFifo().empty()) 199 222 { 200 223 /* this can happen if the following occur: … … 207 230 else 208 231 { 209 read(nalu , nalUnit);210 #if H_MV232 read(nalu); 233 #if NH_MV 211 234 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) 212 235 || !isNaluWithinTargetDecLayerIdSet(&nalu) 213 || nalu.m_layerId > MAX_NUM_LAYER_IDS-1 214 || (nalu.m_nalUnitType == NAL_UNIT_VPS && nalu.m_layerId > 0) 215 || (nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_layerId > 0) 216 || (nalu.m_nalUnitType == NAL_UNIT_EOS && nalu.m_layerId > 0) 236 || nalu.m_nuhLayerId > MAX_NUM_LAYER_IDS-1 237 || (nalu.m_nalUnitType == NAL_UNIT_VPS && nalu.m_nuhLayerId > 0) 238 || (nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_nuhLayerId > 0) 217 239 ) 218 240 { … … 225 247 else 226 248 { 227 Int decIdx = xGetDecoderIdx( nalu.m_ layerId , true );228 newSliceDiffLayer = nalu.isSlice() && ( nalu.m_ layerId != layerIdCurrPic ) && !firstSlice;249 Int decIdx = xGetDecoderIdx( nalu.m_nuhLayerId , true ); 250 newSliceDiffLayer = nalu.isSlice() && ( nalu.m_nuhLayerId != layerIdCurrPic ) && !firstSlice; 229 251 newSliceDiffPoc = m_tDecTop[decIdx]->decode(nalu, m_iSkipFrame, m_pocLastDisplay[decIdx], newSliceDiffLayer, sliceSkippedFlag ); 230 252 // decode function only returns true when all of the following conditions are true … … 233 255 // - nalu.isSlice() == true 234 256 235 if ( nalu.m_nalUnitType == NAL_UNIT_VPS ) 236 { 237 m_vps = m_tDecTop[decIdx]->getPrefetchedVPS(); 257 bNewPicture = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag; 258 if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag ) 259 { 260 layerIdCurrPic = nalu.m_nuhLayerId; 261 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc(); 262 decIdxCurrPic = decIdx; 263 firstSlice = false; 264 265 /// Use VPS activated by the first slice to determine OLS 266 m_vps = m_tDecTop[decIdx]->getActiveVPS( ); 238 267 if ( m_targetDecLayerIdSetFileEmpty ) 239 { 240 TComVPS* vps = m_vps; 268 { 241 269 if ( m_targetOptLayerSetIdx == -1 ) 242 270 { 243 // Not normative! Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. ) 244 m_targetOptLayerSetIdx = vps->getVpsNumLayerSetsMinus1(); 271 m_targetOptLayerSetIdx = m_tDecTop[decIdx]->getTargetOlsIdx(); 245 272 } 246 247 for (Int dI = 0; dI < m_numDecoders; dI++ ) 273 else 248 274 { 249 m_tDecTop[decIdx]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx ); 250 #if H_3D 251 m_tDecTop[decIdx]->setProfileIdc( ); 252 #endif 275 assert( m_tDecTop[decIdx]->getTargetOlsIdx() == m_targetOptLayerSetIdx ); 253 276 } 254 277 255 if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= vps->getNumOutputLayerSets() )278 if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= m_vps->getNumOutputLayerSets() ) 256 279 { 257 fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", vps->getNumOutputLayerSets() - 1 );280 fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", m_vps->getNumOutputLayerSets() - 1 ); 258 281 exit(EXIT_FAILURE); 259 282 } 260 m_targetDecLayerIdSet = vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx );283 m_targetDecLayerIdSet = m_vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx ); 261 284 } 285 262 286 if (m_outputVpsInfo ) 263 287 { … … 267 291 m_vps->printPTL(); 268 292 } 269 } 270 #if H_3D 271 if (nalu.m_nalUnitType == NAL_UNIT_VPS ) 272 { 273 m_cCamParsCollector.init( m_pScaleOffsetFile, m_tDecTop[decIdx]->getPrefetchedVPS() ); 274 } 275 #endif 276 bNewPicture = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag; 277 if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag ) 278 { 279 layerIdCurrPic = nalu.m_layerId; 280 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc(); 281 decIdxCurrPic = decIdx; 282 firstSlice = false; 283 } 284 285 if ( bNewPicture || !bitstreamFile ) 293 } 294 295 if ( bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) 286 296 { 287 297 layerIdLastPic = layerIdCurrPic; 288 layerIdCurrPic = nalu.m_ layerId;298 layerIdCurrPic = nalu.m_nuhLayerId; 289 299 pocLastPic = pocCurrPic; 290 300 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc(); 291 301 decIdxLastPic = decIdxCurrPic; 292 302 decIdxCurrPic = decIdx; 293 allLayersDecoded = ( pocCurrPic != pocLastPic ) ;303 allLayersDecoded = ( pocCurrPic != pocLastPic ) && ( nalu.m_nalUnitType != NAL_UNIT_EOS ); 294 304 } 295 305 #else … … 309 319 * [1] except for the first NAL unit in the file 310 320 * (but bNewPicture doesn't happen then) */ 321 #if RExt__DECODER_DEBUG_BIT_STATISTICS 322 bitstreamFile.seekg(location); 323 bytestream.reset(); 324 TComCodingStatistics::SetStatistics(backupStats); 325 #else 311 326 bitstreamFile.seekg(location-streamoff(3)); 312 327 bytestream.reset(); 328 #endif 313 329 #if H_MV_ENC_DEC_TRAC 314 330 #if ENC_DEC_TRACE … … 327 343 } 328 344 } 329 if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) 345 346 if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) && 347 #if NH_MV 348 !m_tDecTop[decIdxLastPic]->getFirstSliceInSequence () ) 349 #else 350 !m_cTDecTop.getFirstSliceInSequence () ) 351 #endif 352 330 353 { 331 354 if (!loopFiltered || bitstreamFile) 332 355 { 333 #if H_MV356 #if NH_MV 334 357 assert( decIdxLastPic != -1 ); 335 358 m_tDecTop[decIdxLastPic]->endPicDecoding(poc, pcListPic, m_targetDecLayerIdSet ); … … 340 363 } 341 364 loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS); 342 } 343 #if !FIX_WRITING_OUTPUT 344 #if SETTING_NO_OUT_PIC_PRIOR 345 if (bNewPicture && m_cTDecTop.getIsNoOutputPriorPics()) 346 { 347 m_cTDecTop.checkNoOutputPriorPics( pcListPic ); 348 } 349 #endif 350 #endif 351 #if H_3D 365 if (nalu.m_nalUnitType == NAL_UNIT_EOS) 366 { 367 #if NH_MV 368 m_tDecTop[decIdxLastPic]->setFirstSliceInSequence(true); 369 #else 370 m_cTDecTop.setFirstSliceInSequence(true); 371 #endif 372 } 373 } 374 else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && 375 #if NH_MV 376 m_tDecTop[decIdxLastPic]->getFirstSliceInSequence () ) 377 #else 378 m_cTDecTop.getFirstSliceInSequence () ) 379 #endif 380 { 381 #if NH_MV 382 m_tDecTop[decIdxLastPic]->setFirstSliceInPicture (true); 383 #else 384 m_cTDecTop.setFirstSliceInPicture (true); 385 #endif 386 } 387 388 #if NH_3D 352 389 if ( allLayersDecoded || !bitstreamFile ) 353 390 { … … 363 400 if( pcListPic ) 364 401 { 365 #if H_MV402 #if NH_MV 366 403 if ( m_pchReconFiles[decIdxLastPic] && !m_reconOpen[decIdxLastPic] ) 367 404 #else 368 if ( m_pchReconFile && !openedReconFile ) 369 #endif 370 { 371 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } 372 if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; } 373 374 #if H_MV 375 m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 405 if ( m_pchReconFile && !openedReconFile ) 406 #endif 407 { 408 const BitDepths &bitDepths=pcListPic->front()->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture. 409 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) 410 { 411 if (m_outputBitDepth[channelType] == 0) 412 { 413 m_outputBitDepth[channelType] = bitDepths.recon[channelType]; 414 } 415 } 416 #if NH_MV 417 m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 376 418 m_reconOpen[decIdxLastPic] = true; 377 419 } 378 #if FIX_WRITING_OUTPUT379 420 // write reconstruction to file 380 421 if( bNewPicture ) … … 388 429 xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId ); 389 430 } 390 #if SETTING_NO_OUT_PIC_PRIOR391 431 if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_tDecTop[decIdxLastPic]->getNoOutputPriorPicsFlag() ) 392 432 { … … 394 434 m_tDecTop[decIdxLastPic]->setNoOutputPriorPicsFlag (false); 395 435 } 396 #endif 397 #endif 436 398 437 if ( bNewPicture && newSliceDiffPoc && 399 438 #else 400 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 401 openedReconFile = true; 402 } 403 #if FIX_WRITING_OUTPUT 439 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 440 openedReconFile = true; 441 } 404 442 // write reconstruction to file 405 443 if( bNewPicture ) … … 407 445 xWriteOutput( pcListPic, nalu.m_temporalId ); 408 446 } 409 #if SETTING_NO_OUT_PIC_PRIOR410 447 if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cTDecTop.getNoOutputPriorPicsFlag() ) 411 448 { … … 413 450 m_cTDecTop.setNoOutputPriorPicsFlag (false); 414 451 } 415 #endif 416 #endif 417 if ( bNewPicture && 452 453 if ( bNewPicture && 418 454 #endif 419 455 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL … … 423 459 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) ) 424 460 { 425 #if H_MV461 #if NH_MV 426 462 xFlushOutput( pcListPic, decIdxLastPic ); 427 463 #else … … 431 467 if (nalu.m_nalUnitType == NAL_UNIT_EOS) 432 468 { 433 #if H_MV 434 #if FIX_OUTPUT_EOS 435 xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId ); 436 #else 437 xFlushOutput( pcListPic, decIdxLastPic ); 438 #endif 439 #else 440 #if FIX_OUTPUT_EOS 469 #if NH_MV 470 xWriteOutput( pcListPic, decIdxCurrPic, nalu.m_temporalId ); 471 #else 441 472 xWriteOutput( pcListPic, nalu.m_temporalId ); 442 #else 443 xFlushOutput( pcListPic ); 444 #endif 445 446 #endif 447 } 448 // write reconstruction to file -- for additional bumping as defined in C.5.2.3 449 #if H_MV 473 #endif 474 #if NH_MV 475 m_tDecTop[decIdxCurrPic]->setFirstSliceInPicture (false); 476 #else 477 m_cTDecTop.setFirstSliceInPicture (false); 478 #endif 479 } 480 // write reconstruction to file -- for additional bumping as defined in C.5.2.3 481 #if NH_MV 450 482 // Above comment seems to be wrong 451 483 #endif 452 #if FIX_WRITING_OUTPUT453 484 if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31) 454 #else 455 if(bNewPicture) 456 #endif 457 { 458 #if H_MV 485 { 486 #if NH_MV 459 487 // Bumping after reference picture set has been applied (here after first vcl nalu. 460 488 #if ENC_DEC_TRACE … … 471 499 } 472 500 } 473 #if H_MV474 #if H_3D501 #if NH_MV 502 #if NH_3D 475 503 if( m_cCamParsCollector.isInitialized() ) 476 504 { … … 486 514 // delete buffers 487 515 m_cTDecTop.deletePicBuffer(); 488 #endif489 490 516 // destroy internal classes 491 517 xDestroyDecLib(); 518 #endif 492 519 } 493 520 … … 498 525 Void TAppDecTop::xCreateDecLib() 499 526 { 500 #if H_MV527 #if NH_MV 501 528 // initialize global variables 502 529 initROM(); … … 512 539 Void TAppDecTop::xDestroyDecLib() 513 540 { 514 #if H_MV541 #if NH_MV 515 542 // destroy ROM 516 543 destroyROM(); … … 538 565 m_cTVideoIOYuvReconFile. close(); 539 566 } 540 567 541 568 // destroy decoder class 542 569 m_cTDecTop.destroy(); 543 570 #endif 544 #if H_3D571 #if NH_3D 545 572 m_cCamParsCollector.uninit(); 546 573 if( m_pScaleOffsetFile ) … … 553 580 Void TAppDecTop::xInitDecLib() 554 581 { 555 #if !H_MV 582 583 #if NH_3D 584 m_cCamParsCollector.setCodeScaleOffsetFile( m_pScaleOffsetFile ); 585 #endif 586 #if !NH_MV 556 587 // initialize decoder class 557 588 m_cTDecTop.init(); 558 589 m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 590 #if O0043_BEST_EFFORT_DECODING 591 m_cTDecTop.setForceDecodeBitDepth(m_forceDecodeBitDepth); 592 #endif 593 if (!m_outputDecodedSEIMessagesFilename.empty()) 594 { 595 std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout; 596 m_cTDecTop.setDecodedSEIMessageOutputStream(&os); 597 } 559 598 #endif 560 599 } 561 600 562 601 /** \param pcListPic list of pictures to be written to file 563 \ todo DYN_REF_FREE should be revised602 \param tId temporal sub-layer ID 564 603 */ 565 #if H_MV604 #if NH_MV 566 605 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int decIdx, Int tId ) 567 606 #else … … 569 608 #endif 570 609 { 571 572 610 if (pcListPic->empty()) 573 611 { … … 578 616 Int numPicsNotYetDisplayed = 0; 579 617 Int dpbFullness = 0; 580 #if H_MV 581 TComSPS* activeSPS = m_tDecTop[ decIdx ]->getActiveSPS(); 582 #else 583 TComSPS* activeSPS = m_cTDecTop.getActiveSPS(); 584 #endif 618 const TComSPS* activeSPS = &(pcListPic->front()->getPicSym()->getSPS()); 619 585 620 UInt numReorderPicsHighestTid; 586 621 UInt maxDecPicBufferingHighestTid; … … 597 632 maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer); 598 633 } 599 634 600 635 while (iterPic != pcListPic->end()) 601 636 { 602 637 TComPic* pcPic = *(iterPic); 603 #if H_MV638 #if NH_MV 604 639 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx]) 605 640 #else … … 607 642 #endif 608 643 { 609 numPicsNotYetDisplayed++;644 numPicsNotYetDisplayed++; 610 645 dpbFullness++; 611 646 } … … 616 651 iterPic++; 617 652 } 618 iterPic = pcListPic->begin(); 653 654 iterPic = pcListPic->begin(); 655 619 656 if (numPicsNotYetDisplayed>2) 620 657 { 621 658 iterPic++; 622 659 } 623 660 624 661 TComPic* pcPic = *(iterPic); 625 662 if (numPicsNotYetDisplayed>2 && pcPic->isField()) //Field Decoding … … 633 670 iterPic++; 634 671 TComPic* pcPicBottom = *(iterPic); 635 636 #if H_MV 637 if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed > pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) 638 && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed > pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx]<0))) 672 673 #if NH_MV 674 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && 675 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) && 676 (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) && 677 (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx] < 0)) 639 678 #else 640 679 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && … … 646 685 // write to file 647 686 numPicsNotYetDisplayed = numPicsNotYetDisplayed-2; 648 #if H_MV687 #if NH_MV 649 688 if ( m_pchReconFiles[decIdx] ) 650 689 #else … … 653 692 { 654 693 const Window &conf = pcPicTop->getConformanceWindow(); 655 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 656 694 const Window defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 657 695 const Bool isTff = pcPicTop->isTopField(); 658 #if H_MV 696 697 Bool display = true; 698 if( m_decodedNoDisplaySEIEnabled ) 699 { 700 SEIMessages noDisplay = getSeisByType(pcPic->getSEIs(), SEI::NO_DISPLAY ); 701 const SEINoDisplay *nd = ( noDisplay.size() > 0 ) ? (SEINoDisplay*) *(noDisplay.begin()) : NULL; 702 if( (nd != NULL) && nd->m_noDisplay ) 703 { 704 display = false; 705 } 706 } 707 708 if (display) 709 { 710 #if NH_MV 659 711 assert( conf .getScaledFlag() ); 660 712 assert( defDisp.getScaledFlag() ); … … 667 719 m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 668 720 #else 669 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 670 #endif 671 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 672 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 673 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 674 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 675 } 676 721 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 722 #endif 723 m_outputColourSpaceConvert, 724 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 725 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 726 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 727 #if NH_3D 728 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), m_depth420OutputFlag && pcPicTop->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, isTff ); 729 #else 730 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 731 #endif 732 } 733 } 734 677 735 // update POC of display order 678 #if H_MV736 #if NH_MV 679 737 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 680 738 #else 681 739 m_iPOCLastDisplay = pcPicBottom->getPOC(); 682 740 #endif 683 741 684 742 // erase non-referenced picture in the reference picture list after display 685 743 if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true ) 686 744 { 687 #if !DYN_REF_FREE688 745 pcPicTop->setReconMark(false); 689 746 690 747 // mark it should be extended later 691 748 pcPicTop->getPicYuvRec()->setBorderExtension( false ); 692 693 #else694 pcPicTop->destroy();695 pcListPic->erase( iterPic );696 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!697 continue;698 #endif699 749 } 700 750 if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true ) 701 751 { 702 #if !DYN_REF_FREE703 752 pcPicBottom->setReconMark(false); 704 753 705 754 // mark it should be extended later 706 755 pcPicBottom->getPicYuvRec()->setBorderExtension( false ); 707 708 #else709 pcPicBottom->destroy();710 pcListPic->erase( iterPic );711 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!712 continue;713 #endif714 756 } 715 757 pcPicTop->setOutputMark(false); … … 721 763 { 722 764 iterPic = pcListPic->begin(); 765 723 766 while (iterPic != pcListPic->end()) 724 767 { 725 768 pcPic = *(iterPic); 726 769 727 #if H_MV770 #if NH_MV 728 771 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx] && 729 772 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid)) … … 734 777 { 735 778 // write to file 736 numPicsNotYetDisplayed--;779 numPicsNotYetDisplayed--; 737 780 if(pcPic->getSlice(0)->isReferenced() == false) 738 781 { 739 782 dpbFullness--; 740 783 } 741 #if H_MV784 #if NH_MV 742 785 if ( m_pchReconFiles[decIdx] ) 743 786 #else … … 745 788 #endif 746 789 { 747 const Window &conf = pcPic->getConformanceWindow();748 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();749 #if H_MV790 const Window &conf = pcPic->getConformanceWindow(); 791 const Window defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 792 #if NH_MV 750 793 assert( conf .getScaledFlag() ); 751 794 assert( defDisp.getScaledFlag() ); … … 760 803 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 761 804 #endif 762 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 763 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 764 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 765 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 766 } 767 805 m_outputColourSpaceConvert, 806 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 807 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 808 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 809 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 810 #if NH_3D 811 m_depth420OutputFlag && pcPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, 812 #else 813 NUM_CHROMA_FORMAT, 814 #endif 815 m_bClipOutputVideoToRec709Range ); 816 } 817 768 818 // update POC of display order 769 #if H_MV819 #if NH_MV 770 820 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 771 821 #else 772 822 m_iPOCLastDisplay = pcPic->getPOC(); 773 823 #endif 774 824 775 825 // erase non-referenced picture in the reference picture list after display 776 826 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 777 827 { 778 #if !DYN_REF_FREE779 828 pcPic->setReconMark(false); 780 829 781 830 // mark it should be extended later 782 831 pcPic->getPicYuvRec()->setBorderExtension( false ); 783 784 #else785 pcPic->destroy();786 pcListPic->erase( iterPic );787 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!788 continue;789 #endif790 832 } 791 833 pcPic->setOutputMark(false); 792 #if H_MV834 #if NH_MV 793 835 pcPic->setPicOutputFlag(false); 794 836 #endif 795 837 } 796 838 797 839 iterPic++; 798 840 } 799 841 } 800 842 } 843 801 844 /** \param pcListPic list of pictures to be written to file 802 \todo DYN_REF_FREE should be revised803 845 */ 804 #if H_MV846 #if NH_MV 805 847 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, Int decIdx ) 806 848 #else … … 813 855 } 814 856 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 815 857 816 858 iterPic = pcListPic->begin(); 817 859 TComPic* pcPic = *(iterPic); 818 860 819 861 if (pcPic->isField()) //Field Decoding 820 862 { … … 827 869 iterPic++; 828 870 pcPicBottom = *(iterPic); 829 871 830 872 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) ) 831 873 { 832 874 // write to file 833 #if H_MV875 #if NH_MV 834 876 if ( m_pchReconFiles[decIdx] ) 835 877 #else … … 838 880 { 839 881 const Window &conf = pcPicTop->getConformanceWindow(); 840 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();882 const Window defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 841 883 const Bool isTff = pcPicTop->isTopField(); 842 #if H_MV884 #if NH_MV 843 885 assert( conf .getScaledFlag() ); 844 886 assert( defDisp.getScaledFlag() ); … … 853 895 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 854 896 #endif 855 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 856 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 857 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 858 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 859 } 860 897 m_outputColourSpaceConvert, 898 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 899 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 900 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 901 #if NH_3D 902 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), m_depth420OutputFlag && pcPicTop->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, isTff ); 903 #else 904 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 905 #endif 906 } 907 861 908 // update POC of display order 862 #if H_MV909 #if NH_MV 863 910 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 864 911 #else 865 m_iPOCLastDisplay = pcPicBottom->getPOC();912 m_iPOCLastDisplay = pcPicBottom->getPOC(); 866 913 #endif 867 914 // erase non-referenced picture in the reference picture list after display 868 915 if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true ) 869 916 { 870 #if !DYN_REF_FREE871 917 pcPicTop->setReconMark(false); 872 918 873 919 // mark it should be extended later 874 920 pcPicTop->getPicYuvRec()->setBorderExtension( false ); 875 876 #else877 pcPicTop->destroy();878 pcListPic->erase( iterPic );879 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!880 continue;881 #endif882 921 } 883 922 if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true ) 884 923 { 885 #if !DYN_REF_FREE886 924 pcPicBottom->setReconMark(false); 887 925 888 926 // mark it should be extended later 889 927 pcPicBottom->getPicYuvRec()->setBorderExtension( false ); 890 891 #else892 pcPicBottom->destroy();893 pcListPic->erase( iterPic );894 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!895 continue;896 #endif897 928 } 898 929 pcPicTop->setOutputMark(false); 899 930 pcPicBottom->setOutputMark(false); 900 901 #if !DYN_REF_FREE 931 902 932 if(pcPicTop) 903 933 { … … 906 936 pcPicTop = NULL; 907 937 } 908 #endif909 938 } 910 939 } … … 921 950 { 922 951 pcPic = *(iterPic); 923 952 924 953 if ( pcPic->getOutputMark() ) 925 954 { 926 955 // write to file 927 #if H_MV956 #if NH_MV 928 957 if ( m_pchReconFiles[decIdx] ) 929 958 #else … … 931 960 #endif 932 961 { 933 const Window &conf = pcPic->getConformanceWindow();934 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();935 #if H_MV962 const Window &conf = pcPic->getConformanceWindow(); 963 const Window defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 964 #if NH_MV 936 965 assert( conf .getScaledFlag() ); 937 966 assert( defDisp.getScaledFlag() ); … … 946 975 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 947 976 #endif 948 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 949 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 950 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 951 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 952 } 953 977 m_outputColourSpaceConvert, 978 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 979 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 980 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 981 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 982 #if NH_3D 983 m_depth420OutputFlag && pcPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT 984 #else 985 NUM_CHROMA_FORMAT 986 #endif 987 , m_bClipOutputVideoToRec709Range); 988 } 989 954 990 // update POC of display order 955 #if H_MV991 #if NH_MV 956 992 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 957 993 #else 958 994 m_iPOCLastDisplay = pcPic->getPOC(); 959 995 #endif 960 996 961 997 // erase non-referenced picture in the reference picture list after display 962 998 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 963 999 { 964 #if !DYN_REF_FREE965 1000 pcPic->setReconMark(false); 966 1001 967 1002 // mark it should be extended later 968 1003 pcPic->getPicYuvRec()->setBorderExtension( false ); 969 970 #else971 pcPic->destroy();972 pcListPic->erase( iterPic );973 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!974 continue;975 #endif976 1004 } 977 1005 pcPic->setOutputMark(false); 978 #if H_MV1006 #if NH_MV 979 1007 pcPic->setPicOutputFlag(false); 980 1008 #endif 981 1009 } 982 #if !H_MV 983 #if !DYN_REF_FREE 984 if(pcPic) 1010 #if !NH_MV 1011 if(pcPic != NULL) 985 1012 { 986 1013 pcPic->destroy(); … … 988 1015 pcPic = NULL; 989 1016 } 990 #endif991 1017 #endif 992 1018 iterPic++; 993 1019 } 994 1020 } 995 #if H_MV1021 #if NH_MV 996 1022 m_pocLastDisplay[decIdx] = -MAX_INT; 997 1023 #else … … 1011 1037 for (std::vector<Int>::iterator it = m_targetDecLayerIdSet.begin(); it != m_targetDecLayerIdSet.end(); it++) 1012 1038 { 1013 #if H_MV1014 if ( nalu->m_ layerId == (*it) )1015 #else 1016 if ( nalu->m_ reservedZero6Bits== (*it) )1039 #if NH_MV 1040 if ( nalu->m_nuhLayerId == (*it) ) 1041 #else 1042 if ( nalu->m_nuhLayerId == (*it) ) 1017 1043 #endif 1018 1044 { … … 1023 1049 } 1024 1050 1025 #if H_MV1051 #if NH_MV 1026 1052 Int TAppDecTop::xGetDecoderIdx( Int layerId, Bool createFlag /*= false */ ) 1027 1053 { … … 1052 1078 m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists ); 1053 1079 m_tDecTop[ decIdx ]->setLayerInitilizedFlags( m_layerInitilizedFlags ); 1054 m_tDecTop[ decIdx ]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx ); 1055 #if H_3D 1056 m_tDecTop[ decIdx ]->setProfileIdc ( ); 1057 #endif 1058 1059 #if H_3D 1080 m_tDecTop[ decIdx ]->setTargetOlsIdx( m_targetOptLayerSetIdx ); 1081 #if O0043_BEST_EFFORT_DECODING 1082 m_cTDecTop[ decIdx ]->setForceDecodeBitDepth(m_forceDecodeBitDepth); 1083 #endif 1084 if (!m_outputDecodedSEIMessagesFilename.empty()) 1085 { 1086 std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout; 1087 m_tDecTop[ decIdx ]->setDecodedSEIMessageOutputStream(&os); 1088 } 1089 #if NH_3D 1060 1090 m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector ); 1061 1091 #endif -
branches/HTM-14.1-update-dev0/source/App/TAppDecoder/TAppDecTop.h
r1179 r1200 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 61 61 private: 62 62 // class interface 63 #if H_MV63 #if NH_MV 64 64 TDecTop* m_tDecTop [ MAX_NUM_LAYERS ]; ///< decoder classes 65 65 TVideoIOYuv* m_tVideoIOYuvReconFile[ MAX_NUM_LAYERS ]; ///< reconstruction YUV class … … 68 68 TComPicLists m_ivPicLists; ///< picture buffers of decoder instances 69 69 Bool m_layerInitilizedFlags[ MAX_NUM_LAYER_IDS ]; ///< for layerwise startup 70 TComVPS*m_vps; ///< active VPS70 const TComVPS* m_vps; ///< active VPS 71 71 #else 72 72 TDecTop m_cTDecTop; ///< decoder class 73 73 TVideoIOYuv m_cTVideoIOYuvReconFile; ///< reconstruction YUV class 74 74 #endif 75 76 #if H_MV75 // for output control 76 #if NH_MV 77 77 Int m_pocLastDisplay [ MAX_NUM_LAYERS ]; ///< last POC in display order 78 78 Bool m_reconOpen [ MAX_NUM_LAYERS ]; ///< reconstruction file opened … … 81 81 Int m_iPOCLastDisplay; ///< last POC in display order 82 82 #endif 83 std::ofstream m_seiMessageFileStream; ///< Used for outputing SEI messages. 83 84 84 #if H_3D85 #if NH_3D 85 86 FILE* m_pScaleOffsetFile; 86 87 CamParsCollector m_cCamParsCollector; … … 89 90 TAppDecTop(); 90 91 virtual ~TAppDecTop() {} 91 92 92 93 Void create (); ///< create internal members 93 94 Void destroy (); ///< destroy internal members 94 95 Void decode (); ///< main decoding function 96 #if NH_MV 97 UInt getNumberOfChecksumErrorsDetected( ) const 98 { 99 UInt numOfChecksumErrors = 0; 100 for (Int i = 0; i < m_numDecoders; i++ ) 101 { 102 numOfChecksumErrors += getNumberOfChecksumErrorsDetected( i ); 103 } 104 return numOfChecksumErrors; 105 } 106 107 UInt getNumberOfChecksumErrorsDetected( Int decIdx ) const { return m_tDecTop[decIdx]->getNumberOfChecksumErrorsDetected(); } 108 109 #else 110 UInt getNumberOfChecksumErrorsDetected() const { return m_cTDecTop.getNumberOfChecksumErrorsDetected(); } 111 #endif 95 112 96 113 protected: … … 99 116 Void xInitDecLib (); ///< initialize decoder class 100 117 101 #if H_MV118 #if NH_MV 102 119 Void xWriteOutput ( TComList<TComPic*>* pcListPic, Int layerId, Int tId ); ///< write YUV to file 103 120 -
branches/HTM-14.1-update-dev0/source/App/TAppDecoder/decmain.cpp
r1179 r1200 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 44 44 //! \{ 45 45 46 bool g_md5_mismatch = false; ///< top level flag that indicates if there has been a decoding mismatch47 48 46 // ==================================================================================================================== 49 47 // Main function … … 52 50 int main(int argc, char* argv[]) 53 51 { 52 Int returnCode = EXIT_SUCCESS; 54 53 TAppDecTop cTAppDecTop; 55 54 56 55 // print information 57 56 fprintf( stdout, "\n" ); 58 #if H_MV57 #if NH_MV 59 58 fprintf( stdout, "3D-HTM Software: Decoder Version [%s] based on HM Version [%s]", NV_VERSION, HM_VERSION ); 60 59 #else 61 fprintf( stdout, "HM software: Decoder Version [%s] ", NV_VERSION );60 fprintf( stdout, "HM software: Decoder Version [%s] (including RExt)", NV_VERSION ); 62 61 #endif 63 62 fprintf( stdout, NVM_ONOS ); … … 73 72 { 74 73 cTAppDecTop.destroy(); 75 return 1; 74 returnCode = EXIT_FAILURE; 75 return returnCode; 76 76 } 77 77 78 78 // starting time 79 double dResult;80 longlBefore = clock();79 Double dResult; 80 clock_t lBefore = clock(); 81 81 82 82 // call decoding function 83 83 cTAppDecTop.decode(); 84 84 85 if ( g_md5_mismatch)85 if (cTAppDecTop.getNumberOfChecksumErrorsDetected() != 0) 86 86 { 87 87 printf("\n\n***ERROR*** A decoding mismatch occured: signalled md5sum does not match\n"); 88 returnCode = EXIT_FAILURE; 88 89 } 89 90 90 91 // ending time 91 dResult = ( double)(clock()-lBefore) / CLOCKS_PER_SEC;92 dResult = (Double)(clock()-lBefore) / CLOCKS_PER_SEC; 92 93 printf("\n Total Time: %12.3f sec.\n", dResult); 93 94 … … 95 96 cTAppDecTop.destroy(); 96 97 97 return g_md5_mismatch ? EXIT_FAILURE : EXIT_SUCCESS;98 return returnCode; 98 99 } 99 100
Note: See TracChangeset for help on using the changeset viewer.