Commit f55edcb6 authored by Karsten Suehring's avatar Karsten Suehring
Browse files

add missing files of MCTS extractor

parent 7c37c6ee
# the SOURCE definiton lets you move your makefile to another position
CONFIG = CONSOLE
# set directories to your wanted values
SRC_DIR = ../../../../source/App/TAppMCTSExtractor
INC_DIR = ../../../../source/Lib
LIB_DIR = ../../../../lib
BIN_DIR = ../../../../bin
SRC_DIR1 =
SRC_DIR2 =
SRC_DIR3 =
SRC_DIR4 =
USER_INC_DIRS = -I$(SRC_DIR)
USER_LIB_DIRS =
ifeq ($(HIGHBITDEPTH), 1)
HBD=HighBitDepth
else
HBD=
endif
# intermediate directory for object files
OBJ_DIR = ./objects$(HBD)
# set executable name
PRJ_NAME = TAppMCTSExtractor$(HBD)
# defines to set
DEFS = -DMSYS_LINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE
# set objects
OBJS = \
$(OBJ_DIR)/mctsExtmain.o \
$(OBJ_DIR)/TAppMctsExtTop.o \
$(OBJ_DIR)/TAppMctsExtCfg.o \
# set libs to link with
LIBS = -ldl
DEBUG_LIBS =
RELEASE_LIBS =
STAT_LIBS = -lpthread
DYN_LIBS =
DYN_DEBUG_LIBS = -lTLibDecoder$(HBD)d -lTLibEncoder$(HBD)d -lTLibCommon$(HBD)d -lTLibVideoIO$(HBD)d -lTAppCommon$(HBD)d
DYN_DEBUG_PREREQS = $(LIB_DIR)/libTLibDecoder$(HBD)d.a $(LIB_DIR)/libTLibEncoder$(HBD)d.a $(LIB_DIR)/libTLibCommon$(HBD)d.a $(LIB_DIR)/libTLibVideoIO$(HBD)d.a $(LIB_DIR)/libTAppCommon$(HBD)d.a
STAT_DEBUG_LIBS = -lTLibDecoder$(HBD)Staticd -lTLibEncoder$(HBD)Staticd -lTLibCommon$(HBD)Staticd -lTLibVideoIO$(HBD)Staticd -lTAppCommon$(HBD)Staticd
STAT_DEBUG_PREREQS = $(LIB_DIR)/libTLibDecoder$(HBD)Staticd.a $(LIB_DIR)/libTLibEncoder$(HBD)Staticd.a $(LIB_DIR)/libTLibCommon$(HBD)Staticd.a $(LIB_DIR)/libTLibVideoIO$(HBD)Staticd.a $(LIB_DIR)/libTAppCommon$(HBD)Staticd.a
DYN_RELEASE_LIBS = -lTLibDecoder$(HBD) -lTLibEncoder$(HBD) -lTLibCommon$(HBD) -lTLibVideoIO$(HBD) -lTAppCommon$(HBD)
DYN_RELEASE_PREREQS = $(LIB_DIR)/libTLibDecoder$(HBD).a $(LIB_DIR)/libTLibEncoder$(HBD).a $(LIB_DIR)/libTLibCommon$(HBD).a $(LIB_DIR)/libTLibVideoIO$(HBD).a $(LIB_DIR)/libTAppCommon$(HBD).a
STAT_RELEASE_LIBS = -lTLibDecoder$(HBD)Static -lTLibEncoder$(HBD)Static -lTLibCommon$(HBD)Static -lTLibVideoIO$(HBD)Static -lTAppCommon$(HBD)Static
STAT_RELEASE_PREREQS = $(LIB_DIR)/libTLibDecoder$(HBD)Static.a $(LIB_DIR)/libTLibEncoder$(HBD)Static.a $(LIB_DIR)/libTLibCommon$(HBD)Static.a $(LIB_DIR)/libTLibVideoIO$(HBD)Static.a $(LIB_DIR)/libTAppCommon$(HBD)Static.a
# name of the base makefile
MAKE_FILE_NAME = ../../common/makefile.base
# include the base makefile
include $(MAKE_FILE_NAME)
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9BF48911-8901-425A-9329-C843C6FCBAB8}</ProjectGuid>
<RootNamespace>TAppMCTSExtractor</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<ProjectName>TAppMctsExtractor</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)\..\bin\vc2015\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\vc2015\$(Platform)\$(Configuration)\$(RootNamespace)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)\..\bin\vc2015\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\vc2015\$(Platform)\$(Configuration)\$(RootNamespace)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\source\Lib\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\source\Lib\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\source\App\TAppMCTSExtractor\mctsExtmain.cpp" />
<ClCompile Include="..\..\source\App\TAppMCTSExtractor\TAppMctsExtTop.cpp" />
<ClCompile Include="..\..\source\App\TAppMCTSExtractor\TAppMctsExtCfg.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\App\TAppMCTSExtractor\TAppMctsExtTop.h" />
<ClInclude Include="..\..\source\App\TAppMCTSExtractor\TAppMctsExtCfg.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="TAppCommon_vc2015.vcxproj">
<Project>{d1e8a1c2-15db-4c94-80e8-4f70cf0a2dc5}</Project>
</ProjectReference>
<ProjectReference Include="TLibCommon_vc2015.vcxproj">
<Project>{78018d78-f890-47e3-a0b7-09d273f0b11d}</Project>
</ProjectReference>
<ProjectReference Include="TLibDecoder_vc2015.vcxproj">
<Project>{f8b77a48-af6c-4746-a89f-b706aba6ad94}</Project>
</ProjectReference>
<ProjectReference Include="TLibEncoder_vc2015.vcxproj">
<Project>{47e90995-1fc5-4ee4-a94d-ad474169f0e1}</Project>
</ProjectReference>
<ProjectReference Include="TLibVideoIO_vc2015.vcxproj">
<Project>{5280c25a-d316-4be7-ae50-29d72108624f}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\source\App\TAppMCTSExtractor\mctsExtmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\App\TAppMCTSExtractor\TAppMctsExtTop.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\App\TAppMCTSExtractor\TAppMctsExtCfg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\App\TAppMCTSExtractor\TAppMctsExtTop.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\App\TAppMCTSExtractor\TAppMctsExtCfg.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
/* 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-2017, 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 TAppMctsExtCfg.cpp
\brief MCTS Extractor configuration class
*/
#include <cstdio>
#include <cstring>
#include <string>
#include "TAppMctsExtCfg.h"
#include "TAppCommon/program_options_lite.h"
#ifdef WIN32
#define strdup _strdup
#endif
using namespace std;
namespace po = df::program_options_lite;
#if MCTS_EXTRACTION
//! \ingroup TAppMctsExtract
//! \{
// ====================================================================================================================
// Public member functions
// ====================================================================================================================
/** \param argc number of arguments
\param argv array of arguments
*/
Bool TAppMctsExtCfg::parseCfg(Int argc, TChar* argv[])
{
Bool do_help = false;
po::Options opts;
opts.addOptions()
("help", do_help, false, "this help text")
("c", po::parseConfigFile, "configuration file name")
("InputBitstreamFile,i", m_inputBitstreamFileName, string(""), "Input bitstream file name")
("OutputBitstreamFile,b", m_outputBitstreamFileName, string(""), "Output subbitstream file name")
("TargetMCTSIdx,d", m_targetMctsIdx, 0, "Target MCTS idx to be extracted. TargetMCTSIdx = 0 per default.")
;
po::setDefaults(opts);
po::ErrorReporter err;
const list<const TChar*>& argv_unhandled = po::scanArgv(opts, argc, (const TChar**)argv, err);
for (list<const TChar*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
{
fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
}
if (argc == 1 || do_help)
{
po::doHelp(cout, opts);
return false;
}
if (m_inputBitstreamFileName.empty())
{
fprintf(stderr, "No input file specified, aborting\n");
return false;
}
return true;
}
#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-2017, 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 TAppMmctsExtCfg.h
\brief MCTS Extractor configuration class (header)
*/
#ifndef __TAPPMCTSEXTCFG__
#define __TAPPMCTSEXTCFG__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "TLibCommon/CommonDef.h"
#include <vector>
#if MCTS_EXTRACTION
//! \ingroup TAppMctsExt
//! \{
// ====================================================================================================================
// Class definition
// ====================================================================================================================
/// MCTS Extraction configuration class
class TAppMctsExtCfg
{
protected:
std::string m_inputBitstreamFileName; ///< input bitstream file name
std::string m_outputBitstreamFileName; ///< output subbitstream filename
Int m_targetMctsIdx; ///< MCTS Id extracted
public:
TAppMctsExtCfg()
: m_inputBitstreamFileName()
, m_outputBitstreamFileName()
, m_targetMctsIdx(-1)
{
}
virtual ~TAppMctsExtCfg() {}
Bool parseCfg(Int argc, TChar* argv[]); ///< initialize option class from configuration
};
//! \}
#endif
#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-2017, 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 TAppMctsExtTop.cpp
\brief MCTS Extractor application class
*/
#include <list>
#include <vector>
#include <stdio.h>
#include <fcntl.h>
#include <assert.h>
#include <fstream>
#include "TAppMctsExtTop.h"
#include "TLibDecoder/AnnexBread.h"
#include "TLibDecoder/NALread.h"
#include "TLibEncoder/NALwrite.h"
#include "TLibCommon/SEI.h"
#if MCTS_EXTRACTION
//! \ingroup TAppMctsExt
//! \{
// ====================================================================================================================
// Constructor / destructor / initialization / destroy
// ====================================================================================================================
TAppMctsExtTop::TAppMctsExtTop()
{
}
Void TAppMctsExtTop::create()
{
m_mctsExtractionInfoPresent = false;
}
Void TAppMctsExtTop::destroy()
{
m_inputBitstreamFileName.clear();
m_outputBitstreamFileName.clear();
}
// ====================================================================================================================
// Public member functions
// ====================================================================================================================
/**
- create internal class
- initialize internal class
- until the end of the bitstream, call extraction function in TDecMctsExt class
- delete allocated buffers
- destroy internal class
.
*/
Void TAppMctsExtTop::extract()
{
ifstream bitstreamFile(m_inputBitstreamFileName.c_str(), ifstream::in | ifstream::binary);
if (!bitstreamFile)
{
fprintf(stderr, "\nfailed to open input bitstream file `%s' for reading\n", m_inputBitstreamFileName.c_str());
exit(EXIT_FAILURE);
}
InputByteStream bytestream(bitstreamFile);
// create & initialize internal classes
xCreateMctsExtLib();
xInitMctsExtLib();
Int iSkipFrame = 0;
Int iPOCLastDisplay = 0;
fstream bitstreamFileOut(m_outputBitstreamFileName.c_str(), fstream::binary | fstream::out);
if (!bitstreamFileOut)
{
fprintf(stderr, "\nfailed to open output bitstream file `%s' for writing\n", m_outputBitstreamFileName.c_str());
exit(EXIT_FAILURE);
}
AccessUnit outAccessUnit;
while (!!bitstreamFile)
{
streampos location = bitstreamFile.tellg();
AnnexBStats stats = AnnexBStats();
InputNALUnit inNalu;
byteStreamNALUnit(bytestream, inNalu.getBitstream().getFifo(), stats);
Bool bNewPicture = false;
if (inNalu.getBitstream().getFifo().empty())
{
fprintf(stderr, "Warning: Attempt to extract an empty NAL unit\n");
}
else
{
read(inNalu);
m_pcSlice = m_cTDecTop.getApcSlicePilot();
// decode HLS, skipping cabac decoding and reconstruction
bNewPicture = m_cTDecTop.decode(inNalu, iSkipFrame, iPOCLastDisplay, true);
if (bNewPicture)
{
bitstreamFile.clear();
bitstreamFile.seekg(location - streamoff(3));
bytestream.reset();
}
}
if ((bNewPicture || !bitstreamFile || inNalu.m_nalUnitType == NAL_UNIT_EOS) &&
!m_cTDecTop.getFirstSliceInSequence())
{
m_cTDecTop.getPcPic()->setReconMark(true);
if (bitstreamFile || inNalu.m_nalUnitType == NAL_UNIT_EOS)
{
m_cTDecTop.setFirstSliceInPicture(true);
}
}
if ((inNalu.m_nalUnitType == NAL_UNIT_VPS || inNalu.m_nalUnitType == NAL_UNIT_SPS ||
inNalu.m_nalUnitType == NAL_UNIT_PPS))
{
continue;
}
else if (!m_mctsExtractionInfoPresent && inNalu.isSei())
{
// search matching EIS and push parameter sets into AU
m_cTDecTop.xParsePrefixSEImessages();
if (!m_cTDecTop.getSEIs().empty())