Skip to content

Commit

Permalink
V1.8.364
Browse files Browse the repository at this point in the history
  • Loading branch information
IMFTool committed Dec 3, 2021
1 parent 914ec91 commit 8808550
Show file tree
Hide file tree
Showing 33 changed files with 349 additions and 195 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Expand Up @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.1.0)

# Name of target executable
set(EXE_NAME "IMF-Tool")
# Helps Eclipse finding include paths:
set(CMAKE_VERBOSE_MAKEFILE ON)
set_property(GLOBAL PROPERTY CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES ON)
project(${EXE_NAME})
# Get the SVN revision number if an svn command line client is
# available. This version will run at build time rather than only
Expand Down Expand Up @@ -59,7 +62,8 @@ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "Default Targets")
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "Generated Files")
set_property(GLOBAL PROPERTY AUTOMOC_TARGETS_FOLDER "Generated Files")
# Helps Eclipse finding include paths:
set(CMAKE_VERBOSE_MAKEFILE ON)
#set(CMAKE_VERBOSE_MAKEFILE ON)
#set_property(GLOBAL PROPERTY CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES ON)
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH OFF)
# when building, don't use the install RPATH already
Expand Down
Binary file added resources/IMF-Tool_Users-Manual.pdf
Binary file not shown.
3 changes: 3 additions & 0 deletions resources/qt_resources.qrc
Expand Up @@ -102,4 +102,7 @@
<file>down_arrow_hover.png</file>
<file>indeterminate.png</file>
</qresource>
<qresource prefix="/manual">
<file>IMF-Tool_Users-Manual.pdf</file>
</qresource>
</RCC>
6 changes: 3 additions & 3 deletions src/ACES_Decoder.cpp
Expand Up @@ -34,7 +34,7 @@ ACES_Decoder::ACES_Decoder(QSharedPointer<DecodedFrames> &rdecoded_shared, QShar
decoded_shared = rdecoded_shared;
request = rRequest;

reader = new AS_02::ACES::MXFReader();
reader = new AS_02::ACES::MXFReader(defaultFactory);

}

Expand All @@ -57,7 +57,7 @@ void ACES_Decoder::run() {
} // else : first reader

// create new reader
reader = new AS_02::ACES::MXFReader();
reader = new AS_02::ACES::MXFReader(defaultFactory);

Result_t result_o = reader->OpenRead(request->asset->GetPath().absoluteFilePath().toStdString()); // open file for reading
if (!ASDCP_SUCCESS(result_o)) {
Expand Down Expand Up @@ -107,5 +107,5 @@ void ACES_Decoder::run() {
decoded_shared->pending_requests--;

// clean up
buff->~FrameBuffer();
delete buff;
}
4 changes: 2 additions & 2 deletions src/ACES_Preview.cpp
Expand Up @@ -110,7 +110,7 @@ void ACES_Preview::setAsset() {

mMxf_path = asset->GetPath().absoluteFilePath(); // get new path

reader = new AS_02::ACES::MXFReader(); // create new reader
reader = new AS_02::ACES::MXFReader(defaultFactory); // create new reader

Result_t result_o = reader->OpenRead(mMxf_path.toStdString()); // open file for reading
if (!ASDCP_SUCCESS(result_o)) {
Expand Down Expand Up @@ -211,7 +211,7 @@ bool ACES_Preview::extractFrame(qint64 frameNr) {
mMsg = "Error reading frame!"; // ERROR
err = true;
}
buff->~FrameBuffer();
delete buff;

return retValue;
}
Expand Down
33 changes: 0 additions & 33 deletions src/CMakeLists.txt
@@ -1,7 +1,5 @@
# Force decision if App#5 ACES support should be built
set(BUILD_APP5_SUPPORT true CACHE BOOL "Build App#5 ACES support? Run Generate again, if this option is being changed")
# Force decision if App#4 DCDM support should be built
set(BUILD_APP4DCDM_SUPPORT true CACHE BOOL "Build App#4 DCDM support? Run Generate again, if this option is being changed")

find_file(asdcplib_Targets_PATH NAMES asdcplibtargets.cmake PATHS "$ENV{CMAKE_HINT}/asdcplib" ENV CMAKE_HINT PATH_SUFFIXES "targets")
#find_file(OpenJPEG_Targets_PATH NAMES OpenJPEGTargets.cmake ENV CMAKE_HINT PATH_SUFFIXES "targets")
Expand Down Expand Up @@ -43,14 +41,6 @@ unset(IlmBaseLib_Half_Debug_PATH CACHE)
unset(IlmBaseLib_include_DIR CACHE)
endif(BUILD_APP5_SUPPORT)

if(BUILD_APP4DCDM_SUPPORT)
find_library(OpenJPH_lib_PATH NAMES openjph PATHS ENV CMAKE_HINT PATH_SUFFIXES "lib")
find_path(OpenJPH_include_DIR NAMES openjph/ojph_base.h PATHS ENV CMAKE_HINT PATH_SUFFIXES "include")
else(BUILD_APP4DCDM_SUPPORT)
unset(OpenJPH_lib_PATH CACHE)
unset(OpenJPH_include_DIR CACHE)
endif(BUILD_APP4DCDM_SUPPORT)

include("${asdcplib_Targets_PATH}") # Import asdcplib targets.
#include("${OpenJPEG_Targets_PATH}") # Import OpenJPEG targets

Expand Down Expand Up @@ -88,11 +78,6 @@ if(BUILD_APP5_SUPPORT)
set(tool_src ${tool_src} As02AcesIStream.cpp ACES_Preview.cpp ACES_Decoder.cpp
)
endif(BUILD_APP5_SUPPORT)
if(BUILD_APP4DCDM_SUPPORT)
set(tool_src ${tool_src} HTJ2K_Decoder.cpp HTJ2K_Preview.cpp
)
endif(BUILD_APP4DCDM_SUPPORT)


# header
set(tool_src ${tool_src} global.h MainWindow.h KMQtLogSink.h QtWaitingSpinner.h
Expand All @@ -110,10 +95,6 @@ if(BUILD_APP5_SUPPORT)
set(tool_src ${tool_src} As02AcesIStream.h ACES_Preview.h ACES_Decoder.h
)
endif(BUILD_APP5_SUPPORT)
if(BUILD_APP4DCDM_SUPPORT)
set(tool_src ${tool_src} HTJ2K_Decoder.h HTJ2K_Preview.h
)
endif(BUILD_APP4DCDM_SUPPORT)

set(synthesis_src synthesis/st0433-dcmlTypes.cpp synthesis/SMPTE-429-8-2006-PKL.cpp synthesis/SMPTE-429-9-2007-AM.cpp synthesis/SMPTE-2067-2-2013-Core.cpp
synthesis/SMPTE-2067-3-2013-CPL.cpp synthesis/SMPTE-2067-100a-2014-OPL.cpp synthesis/xml.cpp synthesis/xmldsig-core-schema.cpp
Expand All @@ -131,11 +112,6 @@ if(BUILD_APP5_SUPPORT)
include_directories("${OpenEXRLib_include_DIR}/OpenEXR")
endif(BUILD_APP5_SUPPORT)

if(BUILD_APP4DCDM_SUPPORT)
include_directories("${OpenJPH_include_DIR}/openjph")
endif(BUILD_APP4DCDM_SUPPORT)


if(WIN32)
add_definitions(/D_CRT_SECURE_NO_WARNINGS /DUNICODE /DKM_WIN32 /DASDCP_PLATFORM=\"win32\" /DNOMINMAX /DOPENEXR_DLL)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
Expand All @@ -147,10 +123,6 @@ if(BUILD_APP5_SUPPORT)
add_definitions(/DAPP5_ACES)
endif(BUILD_APP5_SUPPORT)

if(BUILD_APP4DCDM_SUPPORT)
add_definitions(/DAPP4_DCDM /DCODEC_HTJ2K)
endif(BUILD_APP4DCDM_SUPPORT)

add_executable(${EXE_NAME} WIN32 ${tool_src} ${resSources} ${win_resources} ${synthesis_src})
target_link_libraries(${EXE_NAME} general Qt5::Widgets
general libas02 debug "${XercescppLib_Debug_PATH}" optimized "${XercescppLib_PATH}" debug "${OpenJPEGLib_Debug_Path}" optimized "${OpenJPEGLib_Path}"
Expand All @@ -162,11 +134,6 @@ target_link_libraries(${EXE_NAME}
debug "${IlmBaseLib_Imath_Debug_PATH}" optimized "${IlmBaseLib_Imath_PATH}" debug "${OpenEXRLib_IlmImf_Debug_PATH}" optimized "${OpenEXRLib_IlmImf_PATH}"
)
endif(BUILD_APP5_SUPPORT)
if(BUILD_APP4DCDM_SUPPORT)
target_link_libraries(${EXE_NAME}
general "${OpenJPH_lib_PATH}"
)
endif(BUILD_APP4DCDM_SUPPORT)

# add the install target
install(TARGETS ${EXE_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib)
13 changes: 8 additions & 5 deletions src/GraphicsWidgetResources.cpp
Expand Up @@ -758,7 +758,11 @@ void GraphicsWidgetVideoResource::restartThread(QSharedPointer<AssetMxfTrack> rA
if (!rAsset.isNull()) {
switch (mAssset->GetEssenceType()) {
case Metadata::Jpeg2000:
if (mAssset->GetMetadata().colorPrimaries == SMPTE::ColorPrimaries_CinemaMezzanine) mImfApplication = ::App4DCDM;
if (mAssset->GetMetadata().colorPrimaries == SMPTE::ColorPrimaries_CinemaMezzanine) {
if ( (mAssset->GetMetadata().transferCharcteristics == SMPTE::TransferCharacteristic_CinemaMezzanineDCDM) ||
(mAssset->GetMetadata().transferCharcteristics == SMPTE::TransferCharacteristic_CinemaMezzanineDCDM_Wrong)) mImfApplication = ::App4DCDM;
else mImfApplication = ::App4;
}
else mImfApplication = ::App2e;
break;

Expand All @@ -780,9 +784,7 @@ void GraphicsWidgetVideoResource::restartThread(QSharedPointer<AssetMxfTrack> rA

}
if ((mImfApplication == ::App2) || (mImfApplication == ::App2e)
#ifdef APP4_DCDM
|| (mImfApplication == ::App4) || (mImfApplication == ::App4DCDM)
#endif
) {
mpJP2K = new JP2K_Preview(); // (k)
mpJP2K->asset = rAsset; // (k)
Expand Down Expand Up @@ -1026,7 +1028,7 @@ void GraphicsWidgetVideoResource::rEntryPointChanged() {
void GraphicsWidgetVideoResource::RefreshProxy() {
if (decodeProxyThread->isRunning()) decodeProxyThread->quit();

if ((mImfApplication == ::App2) || (mImfApplication == ::App2e) || (mImfApplication == ::App4)) {
if ((mImfApplication == ::App2) || (mImfApplication == ::App2e) || (mImfApplication == ::App4) || (mImfApplication == ::App4DCDM)) {
// first proxy
Timecode first_frame = GetFirstVisibleFrame();
mpJP2K->mFirst_proxy = first_frame.GetTargetFrame(); // set frame number
Expand Down Expand Up @@ -1709,7 +1711,8 @@ void GraphicsWidgetMarkerResource::MoveMarker(GraphicsWidgetMarker *pMarker, qin

//WR
// We don't allow to change the intrinsic duration of marker segments
if(local_pos.x() > boundingRect().right()) local_pos.setX(boundingRect().right());
// Max. position is (source duration - 1 )
if(local_pos.x() >= boundingRect().right()) local_pos.setX(boundingRect().right() - 1.0);
//WR
qint64 max_offset = local_pos.x();
QList<QGraphicsItem*> items = childItems();
Expand Down
4 changes: 2 additions & 2 deletions src/HTJ2K_Decoder.cpp
Expand Up @@ -26,7 +26,7 @@ HTJ2K_Decoder::HTJ2K_Decoder(QSharedPointer<DecodedFrames> &rdecoded_shared, QSh

decoded_shared = rdecoded_shared;
request = rRequest;
reader = new AS_02::JP2K::MXFReader();
reader = new AS_02::JP2K::MXFReader(defaultFactory);

}

Expand All @@ -39,7 +39,7 @@ void HTJ2K_Decoder::run() {
reader->~MXFReader();
} // else : first reader
// create new reader
reader = new AS_02::JP2K::MXFReader();
reader = new AS_02::JP2K::MXFReader(defaultFactory);

Result_t result_o = reader->OpenRead(request->asset->GetPath().absoluteFilePath().toStdString()); // open file for reading
if (!ASDCP_SUCCESS(result_o)) {
Expand Down
4 changes: 2 additions & 2 deletions src/HTJ2K_Preview.cpp
Expand Up @@ -129,7 +129,7 @@ void HTJ2K_Preview::setAsset() {

mMxf_path = asset->GetPath().absoluteFilePath(); // get new path

reader = new AS_02::JP2K::MXFReader(); // create new reader
reader = new AS_02::JP2K::MXFReader(defaultFactory); // create new reader

Result_t result_o = reader->OpenRead(mMxf_path.toStdString()); // open file for reading
if (!ASDCP_SUCCESS(result_o)) {
Expand Down Expand Up @@ -345,7 +345,7 @@ bool HTJ2K::decodeImage() {
mpMemBuf->close();
mpCodestream->close();
mpCodestream->~codestream();
buff->~FrameBuffer();
delete buff;


return true;
Expand Down
2 changes: 1 addition & 1 deletion src/HTJ2K_Preview.h
Expand Up @@ -40,7 +40,7 @@ class HTJ2K: public PreviewCommon {
AS_02::JP2K::MXFReader *reader;
ASDCP::MXF::IndexTableSegment::IndexEntry IndexF1; // current frame offset
ASDCP::MXF::IndexTableSegment::IndexEntry IndexF2; // next frame offset
int default_buffer_size = 30000000; // byte
int default_buffer_size = 40000000; // byte

ojph::codestream* mpCodestream;
ojph::mem_infile* mpMemBuf = NULL;
Expand Down
7 changes: 4 additions & 3 deletions src/ImfCommon.h
Expand Up @@ -402,9 +402,10 @@ typedef struct {
int RepeatCount;
} TTMLtimelineResource;

typedef struct {
int decoded_total = 0;
int pending_requests = 0;
typedef struct DecodedFrames{
DecodedFrames() : decoded_total(0), pending_requests(0) {}
int decoded_total;
int pending_requests;
} DecodedFrames;

typedef struct {
Expand Down
8 changes: 4 additions & 4 deletions src/JP2K_Decoder.cpp
Expand Up @@ -31,7 +31,7 @@ JP2K_Decoder::JP2K_Decoder(QSharedPointer<DecodedFrames> &rdecoded_shared, QShar
decoded_shared = rdecoded_shared;
request = rRequest;

reader = new AS_02::JP2K::MXFReader();
reader = new AS_02::JP2K::MXFReader(defaultFactory);

pDecompressor = OPENJPEG_H::opj_create_decompress(OPJ_CODEC_J2K); // create new decompresser

Expand Down Expand Up @@ -60,7 +60,7 @@ void JP2K_Decoder::run() {
} // else : first reader

// create new reader
reader = new AS_02::JP2K::MXFReader();
reader = new AS_02::JP2K::MXFReader(defaultFactory);

Result_t result_o = reader->OpenRead(request->asset->GetPath().absoluteFilePath().toStdString()); // open file for reading
if (!ASDCP_SUCCESS(result_o)) {
Expand Down Expand Up @@ -134,7 +134,7 @@ void JP2K_Decoder::run() {
request->errorMsg = "Failed to decode JPX image";
request->error = true; // an error occured processing the frame

buff->~FrameBuffer();
delete buff;
OPENJPEG_H::opj_destroy_codec(pDecompressor);
OPENJPEG_H::opj_stream_destroy(pStream);
OPENJPEG_H::opj_image_destroy(psImage);
Expand All @@ -149,7 +149,7 @@ void JP2K_Decoder::run() {
decoded_shared->pending_requests--;

// clean up
buff->~FrameBuffer();
delete buff;
OPENJPEG_H::opj_stream_destroy(pStream);
OPENJPEG_H::opj_destroy_codec(pDecompressor);
OPENJPEG_H::opj_image_destroy(psImage); // free allocated memory
Expand Down
1 change: 0 additions & 1 deletion src/JP2K_Decoder.h
Expand Up @@ -21,7 +21,6 @@
#include "JP2K_Preview.h"

class FrameRequest;
class JP2Ktest;

class JP2K_Decoder : public QObject, public QRunnable, public JP2 {

Expand Down
6 changes: 3 additions & 3 deletions src/JP2K_Preview.cpp
Expand Up @@ -135,7 +135,7 @@ void JP2K_Preview::setAsset() {

mMxf_path = asset->GetPath().absoluteFilePath(); // get new path

reader = new AS_02::JP2K::MXFReader(); // create new reader
reader = new AS_02::JP2K::MXFReader(defaultFactory); // create new reader

Result_t result_o = reader->OpenRead(mMxf_path.toStdString()); // open file for reading
if (!ASDCP_SUCCESS(result_o)) {
Expand Down Expand Up @@ -260,7 +260,7 @@ bool JP2K_Preview::decodeImage() {
OPENJPEG_H::opj_stream_destroy(pStream);
OPENJPEG_H::opj_destroy_codec(pDecompressor);
OPENJPEG_H::opj_image_destroy(psImage);
buff->~FrameBuffer();
delete buff;

psImage = NULL; // reset decoded output stream
pDecompressor = OPENJPEG_H::opj_create_decompress(OPJ_CODEC_J2K); // create new decompresser
Expand All @@ -269,7 +269,7 @@ bool JP2K_Preview::decodeImage() {
return false;
}
else {
buff->~FrameBuffer();
delete buff;
return true;
}
}
Expand Down
12 changes: 11 additions & 1 deletion src/Jobs.cpp
Expand Up @@ -151,6 +151,15 @@ Error JobWrapWav::Execute() {
if (!mMCATitleVersion.isEmpty()) current_soundfield->MCATitleVersion = mMCATitleVersion.toStdString();
if (!mMCAAudioContentKind.isEmpty()) current_soundfield->MCAAudioContentKind = mMCAAudioContentKind.toStdString();
if (!mMCAAudioElementKind.isEmpty()) current_soundfield->MCAAudioElementKind = mMCAAudioElementKind.toStdString();
if (mLanguageTag.isEmpty()) current_soundfield->RFC5646SpokenLanguage.set_has_value(false); // Workaround: Required because mca_config.DecodeString sets a non-empty string if mLanguageTag.isEmpty()
//current_soundfield->Dump();
}
}
else if ( (*i)->GetUL() == ASDCP::UL(dict->ul(MDD_AudioChannelLabelSubDescriptor))) {
ASDCP::MXF::AudioChannelLabelSubDescriptor *current_channel;
current_channel = reinterpret_cast<ASDCP::MXF::AudioChannelLabelSubDescriptor*>(*i);
if (current_channel) {
if (mLanguageTag.isEmpty()) current_channel->RFC5646SpokenLanguage.set_has_value(false); // Workaround: Required because mca_config.DecodeString sets a non-empty string if mLanguageTag.isEmpty()
//current_soundfield->Dump();
}
}
Expand Down Expand Up @@ -538,7 +547,8 @@ Error JobExtractTargetFrames::Execute() {
//TODO Figure out size of ancillary resource from RIP
AS_02::ACES::FrameBuffer FrameBuffer(1000000000);
AS_02::ACES::ResourceList_t resource_list_t;
AS_02::ACES::MXFReader Reader;
Kumu::FileReaderFactory defaultFactory;
AS_02::ACES::MXFReader Reader(defaultFactory);
Result_t result = Reader.OpenRead(mAssetMxf->GetPath().absoluteFilePath().toStdString()); // open file for reading
if (ASDCP_SUCCESS(result)) {
result = Reader.FillAncillaryResourceList(resource_list_t);
Expand Down

0 comments on commit 8808550

Please sign in to comment.