Commit 23bfaf12 authored by Alberto Gonzalez's avatar Alberto Gonzalez

Initial commit

parents
This diff is collapsed.
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2023, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __BITSTREAMEXTRACTORAPP__
#define __BITSTREAMEXTRACTORAPP__
#pragma once
#include <stdio.h>
#include <fstream>
#include <iostream>
#include "CommonLib/CommonDef.h"
#include "BitstreamExtractorAppCfg.h"
#include "CommonLib/ParameterSetManager.h"
#include "DecoderLib/NALread.h"
#include "VLCReader.h"
#include "VLCWriter.h"
#include "SEIread.h"
#include "SEIwrite.h"
class BitstreamExtractorApp : public BitstreamExtractorAppCfg
{
public:
BitstreamExtractorApp();
virtual ~BitstreamExtractorApp () {}
uint32_t decode (); ///< main decoding function
protected:
void xPrintVPSInfo (VPS *vps);
void xPrintSubPicInfo (PPS *pps);
void xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, SubPic &subPic);
void xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, const SPS &sourceSPS, SubPic &subPic);
bool xCheckSEIFiller(SEIMessages SEIs, int targetSubPicId, bool &rmAllFillerInSubpicExt, bool lastSliceWritten);
Slice xParseSliceHeader(InputNALUnit &nalu);
bool xCheckSliceSubpicture(Slice &slice, int subPicId);
void xReadPicHeader(InputNALUnit &nalu);
bool xIsTargetOlsIncludeAllVclLayers();
bool xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit& nalu, std::ostream& out, int subpicId, VPS *vps);
void xSetSPSUpdated(int spsId) { return m_updatedSPSList.push_back(spsId); }
bool xIsSPSUpdate(int spsId) { return (std::find(m_updatedSPSList.begin(),m_updatedSPSList.end(), spsId) != m_updatedSPSList.end()); }
void xClearSPSUpdated(int spsId) { m_updatedSPSList.erase(std::remove(m_updatedSPSList.begin(), m_updatedSPSList.end(), spsId)); };
bool xCheckNumSubLayers(InputNALUnit &nalu, VPS *vps);
void xWriteVPS(VPS *vps, std::ostream& out, int layerId, int temporalId);
void xWriteSPS(SPS *sps, std::ostream& out, int layerId, int temporalId);
void xWritePPS(PPS *pps, std::ostream& out, int layerId, int temporalId);
ParameterSetManager m_parameterSetManager;
HLSyntaxReader m_hlSynaxReader;
HLSWriter m_hlSyntaxWriter;
SEIReader m_seiReader;
SEIWriter m_seiWriter;
HRD m_hrd;
int m_vpsId;
bool m_removeTimingSEI;
PicHeader m_picHeader;
int m_prevTid0Poc;
int m_prevPicPOC;
std::vector<int> m_updatedVPSList;
std::vector<int> m_updatedSPSList;
std::vector<int> m_updatedPPSList;
};
#endif // __BITSTREAMEXTRACTORAPP__
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2023, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cstdio>
#include <cstring>
#include <string>
#include "CommonLib/CommonDef.h"
#include "BitstreamExtractorApp.h"
#include "Utilities/program_options_lite.h"
#if ENABLE_TRACING
#include "CommonLib/dtrace_next.h"
#endif
namespace po = df::program_options_lite;
// ====================================================================================================================
// Public member functions
// ====================================================================================================================
// argc number of arguments
// argv array of arguments
bool BitstreamExtractorAppCfg::parseCfg( int argc, char* argv[] )
{
#if ENABLE_TRACING
bool printTracingChannelsList;
std::string tracingFile;
std::string tracingRule;
#endif
bool printHelp = false;
bool warnUnknownParameter = false;
int verbosity;
po::Options opts;
// clang-format off
opts.addOptions()
("help", printHelp, false, "This help text")
("BitstreamFileIn,b", m_bitstreamFileNameIn, std::string(""), "Bitstream input file name")
("BitstreamFileOut,o", m_bitstreamFileNameOut, std::string(""), "bitstream output file name")
("MaxTemporalLayer,t", m_maxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers")
("TargetOutputLayerSet,p", m_targetOlsIdx, -1, "Target output layer set index")
("SubPicIdx,s", m_subPicIdx, -1, "Target subpic index for target output layers that containing multiple subpictures. -1 to decode all subpictures")
#if ENABLE_TRACING
("TraceChannelsList", printTracingChannelsList, false, "List all available tracing channels" )
("TraceRule", tracingRule, std::string( "" ), "Tracing rule (ex: \"D_CABAC:poc==8\" or \"D_REC_CB_LUMA:poc==8\")" )
("TraceFile", tracingFile, std::string( "" ), "Tracing file" )
#endif
("Verbosity,v", verbosity, (int)VERBOSE, "Specifies the level of the verboseness")
("WarnUnknowParameter,w", warnUnknownParameter, false, "Warn for unknown configuration parameters instead of failing")
;
// clang-format on
po::setDefaults(opts);
po::ErrorReporter err;
const std::list<const char *> &argv_unhandled = po::scanArgv(opts, argc, (const char **) argv, err);
for (std::list<const char *>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
{
std::cerr << "Unhandled argument ignored: "<< *it << std::endl;
}
if (argc == 1 || printHelp)
{
po::doHelp(std::cout, opts);
return false;
}
#if ENABLE_TRACING
g_trace_ctx = tracing_init( tracingFile, tracingRule );
if( printTracingChannelsList && g_trace_ctx )
{
std::string channelsList;
g_trace_ctx->getChannelsList( channelsList );
msg( INFO, "\nAvailable tracing channels:\n\n%s\n", channelsList.c_str() );
}
DTRACE_UPDATE( g_trace_ctx, std::make_pair( "final", 1 ) );
#endif
g_verbosity = MsgLevel( verbosity );
if (err.is_errored)
{
if (!warnUnknownParameter)
{
/* errors have already been reported to stderr */
return false;
}
}
if (m_bitstreamFileNameIn.empty())
{
std::cerr << "No input file specified, aborting" << std::endl;
return false;
}
if (m_bitstreamFileNameOut.empty())
{
std::cerr << "No output file specified, aborting" << std::endl;
return false;
}
return true;
}
BitstreamExtractorAppCfg::BitstreamExtractorAppCfg()
: m_bitstreamFileNameIn()
, m_bitstreamFileNameOut()
, m_maxTemporalLayer( 0 )
, m_targetOlsIdx( 0 )
, m_subPicIdx( -1 )
{
}
BitstreamExtractorAppCfg::~BitstreamExtractorAppCfg()
{
#if ENABLE_TRACING
tracing_uninit( g_trace_ctx );
#endif
}
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2023, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __BITSTREAMEXTRACTORAPPCFG__
#define __BITSTREAMEXTRACTORAPPCFG__
#pragma once
#include "CommonLib/CommonDef.h"
#include <vector>
// Bitstream Extractor configuration class
class BitstreamExtractorAppCfg
{
protected:
std::string m_bitstreamFileNameIn; // output bitstream file name
std::string m_bitstreamFileNameOut; // input bitstream file name
int m_maxTemporalLayer;
int m_targetOlsIdx;
int m_subPicIdx;
public:
BitstreamExtractorAppCfg();
virtual ~BitstreamExtractorAppCfg();
bool parseCfg ( int argc, char* argv[] ); // initialize option class from configuration
};
#endif // __BITSTREAMEXTRACTORAPPCFG__
# executable
set( EXE_NAME BitstreamExtractorApp )
# get source files
file( GLOB SRC_FILES "*.cpp" )
# get include files
file( GLOB INC_FILES "*.h" )
# get additional libs for gcc on Ubuntu systems
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
if( USE_ADDRESS_SANITIZER )
set( ADDITIONAL_LIBS asan )
endif()
endif()
endif()
# NATVIS files for Visual Studio
if( MSVC )
file( GLOB NATVIS_FILES "../../VisualStudio/*.natvis" )
endif()
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if( DEFINED ENABLE_TRACING )
if( ENABLE_TRACING )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=0 )
endif()
endif()
if( DEFINED ENABLE_HIGH_BITDEPTH )
if( ENABLE_HIGH_BITDEPTH )
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__HIGH_BIT_DEPTH_SUPPORT=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__HIGH_BIT_DEPTH_SUPPORT=0 )
endif()
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
endif()
target_link_libraries( ${EXE_NAME} CommonLib EncoderLib DecoderLib Utilities ${ADDITIONAL_LIBS} )
# lldb custom data formatters
if( XCODE )
add_dependencies( ${EXE_NAME} Install${PROJECT_NAME}LldbFiles )
endif()
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
add_custom_command( TARGET ${EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/BitstreamExtractorApp>
$<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/BitstreamExtractorApp>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}/BitstreamExtractorApp>
$<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}/BitstreamExtractorApp>
$<$<CONFIG:Debug>:${CMAKE_SOURCE_DIR}/bin/BitstreamExtractorAppStaticd>
$<$<CONFIG:Release>:${CMAKE_SOURCE_DIR}/bin/BitstreamExtractorAppStatic>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_SOURCE_DIR}/bin/BitstreamExtractorAppStaticp>
$<$<CONFIG:MinSizeRel>:${CMAKE_SOURCE_DIR}/bin/BitstreamExtractorAppStaticm> )
endif()
# example: place header files in different folders
source_group( "Natvis Files" FILES ${NATVIS_FILES} )
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2023, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "CommonLib/CommonDef.h"
#include "BitstreamExtractorApp.h"
#include "program_options_lite.h"
// ====================================================================================================================
// Main function
// ====================================================================================================================
int main(int argc, char* argv[])
{
int returnCode = EXIT_SUCCESS;
// print information
fprintf( stdout, "\n" );
fprintf( stdout, "VVCSoftware: VTM Bitstream Extractor Version %s ", VTM_VERSION );
fprintf( stdout, NVM_ONOS );
fprintf( stdout, NVM_COMPILEDBY );
fprintf( stdout, NVM_BITS );
#if ENABLE_SIMD_OPT
std::string SIMD;
df::program_options_lite::Options optsSimd;
optsSimd.addOptions()( "SIMD", SIMD, std::string( "" ), "" );
df::program_options_lite::SilentReporter err;
df::program_options_lite::scanArgv( optsSimd, argc, ( const char** ) argv, err );
fprintf( stdout, "[SIMD=%s] ", read_x86_extension( SIMD ) );
#endif
#if ENABLE_TRACING
fprintf( stdout, "[ENABLE_TRACING] " );
#endif
fprintf( stdout, "\n" );
BitstreamExtractorApp *extractorApp = new BitstreamExtractorApp;
// parse configuration
if(!extractorApp->parseCfg( argc, argv ))
{
returnCode = EXIT_FAILURE;
return returnCode;
}
// starting time
double timeDifference;
clock_t startTime = clock();
// call decoding function
#ifndef _DEBUG
try
{
#endif // !_DEBUG
if( 0 != extractorApp->decode() )
{
printf( "\n\n***ERROR*** A decoding mismatch occured: signalled md5sum does not match\n" );
returnCode = EXIT_FAILURE;
}
#ifndef _DEBUG
}
catch( Exception &e )
{
std::cerr << e.what() << std::endl;
returnCode = EXIT_FAILURE;
}
catch( ... )
{
std::cerr << "Unspecified error occurred" << std::endl;
returnCode = EXIT_FAILURE;
}
#endif
// ending time
timeDifference = (double)(clock()-startTime) / CLOCKS_PER_SEC;
printf("\n Total Time: %12.3f sec.\n", timeDifference);
delete extractorApp;
return returnCode;
}
# executable
set( EXE_NAME DecoderAnalyserApp )
# get source files
file( GLOB SRC_FILES "../DecoderApp/*.cpp" )
# get include files
file( GLOB INC_FILES "../DecoderApp/*.h" )
# get additional libs for gcc on Ubuntu systems
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
if( USE_ADDRESS_SANITIZER )
set( ADDITIONAL_LIBS asan )
endif()
endif()
endif()
# NATVIS files for Visual Studio
if( MSVC )
file( GLOB NATVIS_FILES "../../VisualStudio/*.natvis" )
endif()
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__DECODER_DEBUG_BIT_STATISTICS=1 )
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__DECODER_DEBUG_TOOL_STATISTICS=1 )
if( DEFINED ENABLE_TRACING )
if( ENABLE_TRACING )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=0 )
endif()
endif()
if( DEFINED ENABLE_HIGH_BITDEPTH )
if( ENABLE_HIGH_BITDEPTH )
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__HIGH_BIT_DEPTH_SUPPORT=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__HIGH_BIT_DEPTH_SUPPORT=0 )
endif()
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
endif()
target_link_libraries( ${EXE_NAME} CommonAnalyserLib DecoderAnalyserLib Utilities ${ADDITIONAL_LIBS} )
# lldb custom data formatters
if( XCODE )
add_dependencies( ${EXE_NAME} Install${PROJECT_NAME}LldbFiles )
endif()
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
add_custom_command( TARGET ${EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/DecoderAnalyserApp>
$<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/DecoderAnalyserApp>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}/DecoderAnalyserApp>
$<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}/DecoderAnalyserApp>
$<$<CONFIG:Debug>:${CMAKE_SOURCE_DIR}/bin/DecoderAnalyserAppStaticd>
$<$<CONFIG:Release>:${CMAKE_SOURCE_DIR}/bin/DecoderAnalyserAppStatic>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_SOURCE_DIR}/bin/DecoderAnalyserAppStaticp>
$<$<CONFIG:MinSizeRel>:${CMAKE_SOURCE_DIR}/bin/DecoderAnalyserAppStaticm> )
endif()
# example: place header files in different folders
source_group( "Natvis Files" FILES ${NATVIS_FILES} )
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
# executable
set( EXE_NAME DecoderApp )
# get source files
file( GLOB SRC_FILES "*.cpp" )
# get include files
file( GLOB INC_FILES "*.h" )
# get additional libs for gcc on Ubuntu systems
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
if( USE_ADDRESS_SANITIZER )
set( ADDITIONAL_LIBS asan )
endif()
endif()
endif()
# NATVIS files for Visual Studio
if( MSVC )
file( GLOB NATVIS_FILES "../../VisualStudio/*.natvis" )
endif()
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if( DEFINED ENABLE_TRACING )
if( ENABLE_TRACING )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=0 )
endif()
endif()
if( DEFINED ENABLE_HIGH_BITDEPTH )
if( ENABLE_HIGH_BITDEPTH )
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__HIGH_BIT_DEPTH_SUPPORT=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__HIGH_BIT_DEPTH_SUPPORT=0 )
endif()
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
endif()
target_link_libraries( ${EXE_NAME} CommonLib DecoderLib Utilities ${ADDITIONAL_LIBS} )
# lldb custom data formatters
if( XCODE )
add_dependencies( ${EXE_NAME} Install${PROJECT_NAME}LldbFiles )
endif()
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
add_custom_command( TARGET ${EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/DecoderApp>
$<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/DecoderApp>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}/DecoderApp>
$<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}/DecoderApp>
$<$<CONFIG:Debug>:${CMAKE_SOURCE_DIR}/bin/DecoderAppStaticd>
$<$<CONFIG:Release>:${CMAKE_SOURCE_DIR}/bin/DecoderAppStatic>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_SOURCE_DIR}/bin/DecoderAppStaticp>
$<$<CONFIG:MinSizeRel>:${CMAKE_SOURCE_DIR}/bin/DecoderAppStaticm> )
endif()
# example: place header files in different folders
source_group( "Natvis Files" FILES ${NATVIS_FILES} )
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
This diff is collapsed.
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2023, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file TAppDecLib.h
\brief Decoder application class (header)
*/
#ifndef __DECAPP__
#define __DECAPP__
#pragma once
#include "Utilities/VideoIOYuv.h"
#include "CommonLib/Picture.h"
#include "DecoderLib/DecLib.h"
#include "DecAppCfg.h"
//! \ingroup DecoderApp
//! \{
// ====================================================================================================================
// Class definition
// ====================================================================================================================
/// decoder application class
class DecApp : public DecAppCfg
{
private:
// class interface
DecLib m_cDecLib; ///< decoder class
std::unordered_map<int, VideoIOYuv> m_cVideoIOYuvReconFile; ///< reconstruction YUV class
std::unordered_map<int, VideoIOYuv> m_videoIOYuvSEIFGSFile; ///< reconstruction YUV with FGS class
std::unordered_map<int, VideoIOYuv> m_cVideoIOYuvSEICTIFile; ///< reconstruction YUV with CTI class
#if JVET_Z0120_SII_SEI_PROCESSING
bool m_ShutterFilterEnable; ///< enable Post-processing with Shutter Interval SEI
VideoIOYuv m_cTVideoIOYuvSIIPostFile; ///< post-filtered YUV class
int m_SII_BlendingRatio;
struct IdrSiiInfo
{
SEIShutterIntervalInfo m_siiInfo;
uint32_t m_picPoc;
bool m_isValidSii;
};
std::map<uint32_t, IdrSiiInfo> m_activeSiiInfo;
#endif
// for output control
int m_iPOCLastDisplay; ///< last POC in display order
std::ofstream m_seiMessageFileStream; ///< Used for outputing SEI messages.
std::ofstream m_oplFileStream; ///< Used to output log file for confomance testing
bool m_newCLVS[MAX_NUM_LAYER_IDS]; ///< used to record a new CLVSS
SEIAnnotatedRegions::AnnotatedRegionHeader m_arHeader; ///< AR header
std::map<uint32_t, SEIAnnotatedRegions::AnnotatedRegionObject> m_arObjects; ///< AR object pool
std::map<uint32_t, std::string> m_arLabels; ///< AR label pool
private:
bool xIsNaluWithinTargetDecLayerIdSet( const InputNALUnit* nalu ) const; ///< check whether given Nalu is within targetDecLayerIdSet
bool xIsNaluWithinTargetOutputLayerIdSet( const InputNALUnit* nalu ) const; ///< check whether given Nalu is within targetOutputLayerIdSet
public:
DecApp();
virtual ~DecApp () {}
uint32_t decode (); ///< main decoding function
#if JVET_Z0120_SII_SEI_PROCESSING
bool getShutterFilterFlag() const { return m_ShutterFilterEnable; }
void setShutterFilterFlag(bool value) { m_ShutterFilterEnable = value; }
int getBlendingRatio() const { return m_SII_BlendingRatio; }
void setBlendingRatio(int value) { m_SII_BlendingRatio = value; }
#endif
private:
void xCreateDecLib (); ///< create internal classes
void xDestroyDecLib (); ///< destroy internal classes
void xWriteOutput ( PicList* pcListPic , uint32_t tId); ///< write YUV to file
void xFlushOutput( PicList* pcListPic, const int layerId = NOT_VALID ); ///< flush all remaining decoded pictures to file
// check if next NAL unit will be the first NAL unit from a new picture
bool isNewPicture(std::ifstream *bitstreamFile, class InputByteStream *bytestream);
// check if next NAL unit will be the first NAL unit from a new access unit
bool isNewAccessUnit(bool newPicture, std::ifstream *bitstreamFile, class InputByteStream *bytestream);
void writeLineToOutputLog(Picture * pcPic);
void xOutputAnnotatedRegions(PicList* pcListPic);
};
//! \}
#endif // __DECAPP__
This diff is collapsed.
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2023, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file DecAppCfg.h
\brief Decoder configuration class (header)
*/
#ifndef __DECAPPCFG__
#define __DECAPPCFG__
#pragma once
#include "CommonLib/CommonDef.h"
#include <vector>
//! \ingroup DecoderApp
//! \{
// ====================================================================================================================
// Class definition
// ====================================================================================================================
/// Decoder configuration class
class DecAppCfg
{
protected:
std::string m_bitstreamFileName; ///< input bitstream file name
std::string m_reconFileName; ///< output reconstruction file name
std::string m_oplFilename; ///< filename to output conformance log.
int m_iSkipFrame; ///< counter for frames prior to the random access point to skip
BitDepths m_outputBitDepth; // bit depth used for writing output
InputColourSpaceConversion m_outputColourSpaceConvert;
int m_targetOlsIdx; ///< target output layer set
std::vector<int> m_targetOutputLayerIdSet; ///< set of LayerIds to be outputted
int m_iMaxTemporalLayer; ///< maximum temporal layer to be decoded
bool m_mTidExternalSet; ///< maximum temporal layer set externally
bool m_tOlsIdxTidExternalSet; ///< target output layer set index externally set
int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
bool m_decodedNoDisplaySEIEnabled; ///< Enable(true)/disable(false) writing only pictures that get displayed based on the no display SEI message
std::string m_colourRemapSEIFileName; ///< output Colour Remapping file name
std::string m_SEICTIFileName; ///< output Recon with CTI file name
std::string m_SEIFGSFileName; ///< output file name for reconstructed sequence with film grain
std::string m_annotatedRegionsSEIFileName; ///< annotated regions file name
std::vector<int> m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process.
std::string m_outputDecodedSEIMessagesFilename; ///< filename to output decoded SEI messages to. If '-', then use stdout. If empty, do not output details.
#if JVET_S0257_DUMP_360SEI_MESSAGE
std::string m_outputDecoded360SEIMessagesFilename; ///< filename to output decoded 360 SEI messages to.
#endif
#if JVET_Z0120_SII_SEI_PROCESSING
std::string m_shutterIntervalPostFileName; ///< output Post Filtering file name
#endif
bool m_clipOutputVideoToRec709Range; ///< If true, clip the output video to the Rec 709 range on saving.
bool m_packedYUVMode; ///< If true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data
std::string m_cacheCfgFile; ///< Config file of cache model
int m_statMode; ///< Config statistic mode (0 - bit stat, 1 - tool stat, 3 - both)
bool m_mctsCheck;
#if GREEN_METADATA_SEI_ENABLED
bool m_GMFA;
std::string m_GMFAFile;
bool m_GMFAFramewise;
#endif
int m_upscaledOutput; ////< Output upscaled (2), decoded but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR.
int m_upscaleFilterForDisplay;
int m_targetSubPicIdx; ///< Specify which subpicture shall be write to output, using subpicture index
#if GDR_LEAK_TEST
int m_gdrPocRandomAccess; ///<
#endif // GDR_LEAK_TEST
public:
DecAppCfg();
virtual ~DecAppCfg();
bool parseCfg ( int argc, char* argv[] ); ///< initialize option class from configuration
};
//! \}
#endif // __DECAPPCFG__
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2023, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file decmain.cpp
\brief Decoder application main
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "DecApp.h"
#include "program_options_lite.h"
//! \ingroup DecoderApp
//! \{
// ====================================================================================================================
// Main function
// ====================================================================================================================
int main(int argc, char* argv[])
{
int returnCode = EXIT_SUCCESS;
// print information
fprintf( stdout, "\n" );
fprintf( stdout, "VVCSoftware: VTM Decoder Version %s ", VTM_VERSION );
fprintf( stdout, NVM_ONOS );
fprintf( stdout, NVM_COMPILEDBY );
fprintf( stdout, NVM_BITS );
#if ENABLE_SIMD_OPT
std::string SIMD;
df::program_options_lite::Options optsSimd;
optsSimd.addOptions()("SIMD", SIMD, std::string(""), "");
df::program_options_lite::SilentReporter err;
df::program_options_lite::scanArgv( optsSimd, argc, ( const char** ) argv, err );
fprintf( stdout, "[SIMD=%s] ", read_x86_extension( SIMD ) );
#endif
#if ENABLE_TRACING
fprintf( stdout, "[ENABLE_TRACING] " );
#endif
fprintf( stdout, "\n" );
DecApp *pcDecApp = new DecApp;
// parse configuration
if(!pcDecApp->parseCfg( argc, argv ))
{
returnCode = EXIT_FAILURE;
delete pcDecApp;
return returnCode;
}
// starting time
double dResult;
clock_t lBefore = clock();
// call decoding function
#ifndef _DEBUG
try
{
#endif // !_DEBUG
if( 0 != pcDecApp->decode() )
{
printf( "\n\n***ERROR*** A decoding mismatch occured: signalled md5sum does not match\n" );
returnCode = EXIT_FAILURE;
}
#ifndef _DEBUG
}
catch( Exception &e )
{
std::cerr << e.what() << std::endl;
returnCode = EXIT_FAILURE;
}
catch (const std::bad_alloc &e)
{
std::cout << "Memory allocation failed: " << e.what() << std::endl;
returnCode = EXIT_FAILURE;
}
#endif
// ending time
dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
printf("\n Total Time: %12.3f sec.\n", dResult);
delete pcDecApp;
return returnCode;
}
//! \}
# executable
set( EXE_NAME EncoderApp )
# get source files
file( GLOB SRC_FILES "*.cpp" )
# get include files
file( GLOB INC_FILES "*.h" )
# get additional libs for gcc on Ubuntu systems
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
if( USE_ADDRESS_SANITIZER )
set( ADDITIONAL_LIBS asan )
endif()
endif()
endif()
# NATVIS files for Visual Studio
if( MSVC )
file( GLOB NATVIS_FILES "../../VisualStudio/*.natvis" )
# extend the stack size on windows to 2MB
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:0x200000" )
endif()
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if( DEFINED ENABLE_TRACING )
if( ENABLE_TRACING )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=0 )
endif()
endif()
if( DEFINED ENABLE_HIGH_BITDEPTH )
if( ENABLE_HIGH_BITDEPTH )
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__HIGH_BIT_DEPTH_SUPPORT=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC RExt__HIGH_BIT_DEPTH_SUPPORT=0 )
endif()
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
endif()
target_link_libraries( ${EXE_NAME} CommonLib EncoderLib DecoderLib Utilities ${ADDITIONAL_LIBS} )
if( EXTENSION_360_VIDEO )
target_link_libraries( ${EXE_NAME} Lib360 AppEncHelper360 )
endif()
if( EXTENSION_HDRTOOLS )
target_link_libraries( ${EXE_NAME} HDRLib )
endif()
# lldb custom data formatters
if( XCODE )
add_dependencies( ${EXE_NAME} Install${PROJECT_NAME}LldbFiles )
endif()
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
add_custom_command( TARGET ${EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/EncoderApp>
$<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/EncoderApp>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}/EncoderApp>
$<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}/EncoderApp>
$<$<CONFIG:Debug>:${CMAKE_SOURCE_DIR}/bin/EncoderAppStaticd>
$<$<CONFIG:Release>:${CMAKE_SOURCE_DIR}/bin/EncoderAppStatic>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_SOURCE_DIR}/bin/EncoderAppStaticp>
$<$<CONFIG:MinSizeRel>:${CMAKE_SOURCE_DIR}/bin/EncoderAppStaticm> )
endif()
# example: place header files in different folders
source_group( "Natvis Files" FILES ${NATVIS_FILES} )
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
This diff is collapsed.
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2023, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file EncApp.h
\brief Encoder application class (header)
*/
#ifndef __ENCAPP__
#define __ENCAPP__
#include <list>
#include <ostream>
#include "EncoderLib/EncLib.h"
#include "Utilities/VideoIOYuv.h"
#include "CommonLib/NAL.h"
#include "EncAppCfg.h"
#if EXTENSION_360_VIDEO
#include "AppEncHelper360/TExt360AppEncTop.h"
#endif
#include "EncoderLib/EncTemporalFilter.h"
#if JVET_O0756_CALCULATE_HDRMETRICS
#include <chrono>
#endif
class EncAppCommon;
//! \ingroup EncoderApp
//! \{
// ====================================================================================================================
// Class definition
// ====================================================================================================================
/// encoder application class
class EncApp : public EncAppCfg, public AUWriterIf
{
private:
// class interface
EncLib m_cEncLib; ///< encoder class
VideoIOYuv m_cVideoIOYuvInputFile; ///< input YUV file
VideoIOYuv m_cVideoIOYuvReconFile; ///< output reconstruction file
#if JVET_Z0120_SII_SEI_PROCESSING
VideoIOYuv m_cTVideoIOYuvSIIPreFile; ///< output pre-filtered file
#endif
int m_frameRcvd; ///< number of received frames
uint32_t m_essentialBytes;
uint32_t m_totalBytes;
std::fstream &m_bitstream;
#if JVET_O0756_CALCULATE_HDRMETRICS
std::chrono::duration<long long, std::ratio<1, 1000000000>> m_metricTime;
#endif
private:
// initialization
void xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId ); ///< create files & encoder class
void xInitLibCfg ( int layerIdx ); ///< initialize internal variables
void xInitLib(); ///< initialize encoder class
void xDestroyLib (); ///< destroy encoder class
// file I/O
void xWriteOutput(int numEncoded, std::list<PelUnitBuf *> &recBufList); ///< write bitstream to file
void rateStatsAccum ( const AccessUnit& au, const std::vector<uint32_t>& stats);
void printRateSummary ();
void printChromaFormat();
std::list<PelUnitBuf*> m_recBufList;
int m_numEncoded;
PelStorage* m_trueOrgPic;
PelStorage* m_orgPic;
PelStorage* m_trueOrgPicBeforeScale;
PelStorage* m_orgPicBeforeScale;
PelStorage* m_filteredOrgPic;
PelStorage* m_rprPic[2];
#if EXTENSION_360_VIDEO
TExt360AppEncTop* m_ext360;
#endif
EncTemporalFilter m_temporalFilter;
PelStorage* m_filteredOrgPicForFG;
EncTemporalFilter m_temporalFilterForFG;
bool m_flush;
#if GREEN_METADATA_SEI_ENABLED
FeatureCounterStruct m_featureCounter;
#endif
public:
EncApp(std::fstream &bitStream, EncLibCommon *encLibCommon);
virtual ~EncApp();
int getMaxLayers() const { return m_maxLayers; }
void createLib( const int layerIdx );
void destroyLib();
bool encodePrep( bool& eos );
bool encode(); ///< main encoding function
void outputAU( const AccessUnit& au );
#if JVET_O0756_CALCULATE_HDRMETRICS
std::chrono::duration<long long, std::ratio<1, 1000000000>> getMetricTime() const { return m_metricTime; };
#endif
VPS * getVPS() { return m_cEncLib.getVPS(); }
int getChromaFormatIDC() const { return m_cEncLib.getChromaFormatIdc(); }
int getBitDepth() const { return m_cEncLib.getBitDepth(ChannelType::LUMA); }
bool getALFEnabled() { return m_cEncLib.getUseALF(); }
int getMaxNumALFAPS() { return m_cEncLib.getMaxNumALFAPS(); }
int getALFAPSIDShift() { return m_cEncLib.getALFAPSIDShift(); }
void forceMaxNumALFAPS(int n) { m_cEncLib.setMaxNumALFAPS(n); }
void forceALFAPSIDShift(int n) { m_cEncLib.setALFAPSIDShift(n); }
#if GREEN_METADATA_SEI_ENABLED
uint32_t getTotalNumberOfBytes() {return m_totalBytes;}
FeatureCounterStruct getFeatureCounter(){return m_cEncLib.getFeatureCounter();}
void featureToFile(std::ofstream& featureFile,int feature[MAX_CU_DEPTH+1][MAX_CU_DEPTH+1], std::string featureName);
#endif
};// END CLASS DEFINITION EncApp
//! \}
#endif // __ENCAPP__
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# executable
set( EXE_NAME parcat )
# get source files
file( GLOB SRC_FILES "*.cpp" )
# get include files
file( GLOB INC_FILES "*.h" )
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} )
target_link_libraries( ${EXE_NAME} CommonLib DecoderLib Utilities ${ADDITIONAL_LIBS} )
# include the output directory, where the svnrevision.h file is generated
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/source/Lib)
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
add_custom_command( TARGET ${EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/parcat>
$<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/parcat>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}/parcat>
$<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}/parcat>
$<$<CONFIG:Debug>:${CMAKE_SOURCE_DIR}/bin/parcatStaticd>
$<$<CONFIG:Release>:${CMAKE_SOURCE_DIR}/bin/parcatStatic>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_SOURCE_DIR}/bin/parcatStaticp>
$<$<CONFIG:MinSizeRel>:${CMAKE_SOURCE_DIR}/bin/parcatStaticm> )
endif()
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
This diff is collapsed.
parcat - Concatenation tool for parallel simulations
====================================================
This tool allows to cat segments from parallel simulation according to JVET-B0036 into bitstream bitexact with corresponding output of sequential simulation.
What it does
------------
This tool
- removes any duplicated and unnesessary information from segments like SPS, PPS, VPS, IDR-frames, SEI from all segmetns but first.
- adjust POC value to provide continious numbering and correct referencing (actual POC modification occurs only for second and folowing segments)
- cat filtered segments into single file
Output of this tool is decodable JEM bitstream.
Usage
-----
```
parcat <segment1> [<segment2> ... <segmentN>] <outfile>
```
where `<segment_i>` is result of parallel simulation according to JVET-B0036.
Building
--------
The tool is quite simple and is stored in one C++ file. You can build it using any decent C++98 compiler using command line.
Alternatevily cmake build system scripts are provided to maintain cross platform experience and simplify generation of IDE-s projects like Visual Studio.
To use it
- install cmake from [cmake.org](http://cmake.org)
- create build folder inside project root folder (where CMakeLists.txt is located)
- cd to this folder
- configure project using following command line `cmake ..`
- build project using your platform's default build system, say Visual Studio on Windows and make on UNIX
Restrictions
------------
parcat currently supports only JEM-2.0 and JEM-3.0 bitstreams. Support for HM 16.9 bitstreams is scheduled.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# width height x y bitstream
512 384 0 0 str1.bin
512 384 512 0 str2.bin
512 384 0 384 str3.bin
512 384 512 384 str4.bin
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment