From 665b2e2e5dcf2266e636d29bcf4ef281da65117f Mon Sep 17 00:00:00 2001 From: jhurst Date: Thu, 22 Jan 2015 21:05:58 +0000 Subject: [PATCH] phdr --- README | 27 +++++++++++++++++++++++++-- configure.ac | 12 ++++++++++-- src/AS_02_PHDR.cpp | 2 +- src/AS_02_PHDR.h | 32 ++++++++++++++++++++++++++++++++ src/MDD.cpp | 6 +++++- src/MDD.h | 3 ++- src/Makefile.am | 34 ++++++++++++++++++++++++++++++++++ src/Metadata.cpp | 11 ++++++++++- src/Metadata.h | 3 ++- src/PHDR_Sequence_Parser.cpp | 2 +- 10 files changed, 122 insertions(+), 10 deletions(-) diff --git a/README b/README index 567c4c6..2ba249e 100755 --- a/README +++ b/README @@ -129,6 +129,17 @@ blackwave - Write a WAVE file full of zeros, Used to make filler j2c-test - Displays information about JP2K codestreams. +Experimental feature: Prototype for High Dynamic Range is a wrapper +for the IMF application that allows JPEG-2000 codestreams to be paired +with opaque blobs of metadata. AS-02 support must be enabled to +build this feature, so --enable-as-02 must be enabled if +--enable-phdr is to be used. The following executable programs will be +built: + +phdr-wrap - Writes AS-02 PHDR Essence Component files. + +phdr-unwrap - Extracts essence from AS-02 PHDR Essence Component files. + Documentation @@ -139,18 +150,29 @@ command-line utilities all respond to -h. Change History +2015-01-22 - PHDR feature, bug fixes + o Added PHDR wrapping for AS-02. + o Added J2CLayout property to the JPEG2000PictureSubDescriptor. This + support is preliminary: the Raw data type is being used instead of + RGBALayout type, which will be in the next release. + + 2014-10-2 - Bug fixes and enhancements, 2.2.6 o Fixed erroneous 377-4 MCA identifier in AS_DCP_PCM dump routine - o Fixed erroneous byte 13 in WaveAudioDescriptor_ReferenceAudioAlignmentLevel label + o Fixed erroneous byte 13 in + WaveAudioDescriptor_ReferenceAudioAlignmentLevel label o Added missing implementation of -W option to as-02.unwrap o Fixed erroneous use of d-cinema ChannelAssignment label in as-02-wrap + 2014-10-01 - Bug fixes and enhancements, 2.2.5 o Finished AS-02 text wrap/unwrap o Fixed fractional seconds parsing for Timestamp objects - o Updated KLVPacket to use 64-bit length; allows huge packets in AS-02 PCM files + o Updated KLVPacket to use 64-bit length; allows huge packets + in AS-02 PCM files o cleaned up use of atoi() in the library + 2014-07-09 - Additional IMF/AS-02 support, bug fixes and enhancements, 2.1.4 o Added IMF App 2 edit rates in AS_02 namespace: EditRate_29_97, EditRate_59_94. @@ -175,6 +197,7 @@ Change History metadata (Thanks to Mike Radford). o Added new options to as-02-wrap. + 2014-01-06 – Additional IMF/AS-02 support, bug fixes 2.1.1 o Fixed missing-index-partion bugs for AS-02 files. o Moved LocalFilenameResolver into the AS_DCP public API so that it diff --git a/configure.ac b/configure.ac index 03379a8..19b4057 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -# Copyright (c) 2007-2013 John Hurst. All rights reserved. +# Copyright (c) 2007-2015 John Hurst. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -37,7 +37,7 @@ AC_PREREQ([2.59]) # For example, if asdcplib version 1.0.0 were modified to accomodate changes # in file format, and if no changes were made to AS_DCP.h, the new version would be # 1.0.1. If changes were also required in AS_DCP.h, the new version would be 1.1.1. -AC_INIT([asdcplib], [2.2.7], [asdcplib@cinecert.com]) +AC_INIT([asdcplib], [2.3.8], [asdcplib@cinecert.com]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_SRCDIR([src/KM_error.h]) @@ -105,6 +105,14 @@ AC_ARG_ENABLE([as-02], *) AC_MSG_ERROR([bad value ${enableval} for --enable-as-02]) ;; esac],[as_02_use=false]) AM_CONDITIONAL([USE_AS_02], [test x$as_02_use = xtrue]) +AC_ARG_ENABLE([phdr], + [ --enable-phdr enable support for Prototype for High Dyamic Range in AS-02], + [case "${enableval}" in + yes) phdr_use=true ;; + no) phdr_use=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-phdr]) ;; + esac],[phdr_use=false]) + AM_CONDITIONAL([USE_PHDR], [test x$phdr_use = xtrue]) # Checks for libraries. AC_CHECK_LIB([pthread], [pthread_create]) diff --git a/src/AS_02_PHDR.cpp b/src/AS_02_PHDR.cpp index db9228a..dd413f9 100644 --- a/src/AS_02_PHDR.cpp +++ b/src/AS_02_PHDR.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2011-2014, John Hurst +Copyright (c) 2011-2015, John Hurst All rights reserved. diff --git a/src/AS_02_PHDR.h b/src/AS_02_PHDR.h index b3c94e7..1328de1 100644 --- a/src/AS_02_PHDR.h +++ b/src/AS_02_PHDR.h @@ -1,3 +1,35 @@ +/* +Copyright (c) 2011-2015, John Hurst + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. 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. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 AS_02_PHDR.h + \version $Id$ + \brief AS-02 library, JPEG 2000 P-HDR essence reader and writer implementation +*/ #ifndef _AS_02_PHDR_H_ diff --git a/src/MDD.cpp b/src/MDD.cpp index ce03603..cae083d 100644 --- a/src/MDD.cpp +++ b/src/MDD.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2006-2013, John Hurst +Copyright (c) 2006-2015, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -1183,6 +1183,10 @@ static const ASDCP::MDDEntry s_MDD_Table[] = { 0x0e, 0x09, 0x06, 0x07, 0x01, 0x01, 0x01, 0x06 }, {0}, false, "PHDRMetadataTrackSubDescriptor_SimplePayloadSID" }, + { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x0e, // 380 + 0x04, 0x01, 0x06, 0x03, 0x0e, 0x00, 0x00, 0x00 }, + {0}, true, "JPEG2000PictureSubDescriptor_J2CLayout" }, + { {0}, {0}, false, 0 } }; diff --git a/src/MDD.h b/src/MDD.h index b3852fa..f03e51f 100755 --- a/src/MDD.h +++ b/src/MDD.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2006-2013, John Hurst +Copyright (c) 2006-2015, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -415,6 +415,7 @@ namespace ASDCP { MDD_PHDRMetadataTrackSubDescriptor_DataDefinition, // 377 MDD_PHDRMetadataTrackSubDescriptor_SourceTrackID, // 378 MDD_PHDRMetadataTrackSubDescriptor_SimplePayloadSID, // 379 + MDD_JPEG2000PictureSubDescriptor_J2CLayout, // 380 MDD_Max }; // enum MDD_t diff --git a/src/Makefile.am b/src/Makefile.am index a0dca91..a1f28f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -80,6 +80,10 @@ if USE_AS_02 include_HEADERS += AS_02.h endif +if USE_PHDR +include_HEADERS += AS_02_PHDR.h +endif + # list of the libraries to build and install lib_LTLIBRARIES = libkumu.la libasdcp.la @@ -88,6 +92,10 @@ if USE_AS_02 lib_LTLIBRARIES += libas02.la endif +if USE_PHDR +lib_LTLIBRARIES += libphdr.la +endif + # sources for kumu library libkumu_la_SOURCES = KM_error.h KM_fileio.cpp KM_fileio.h KM_log.cpp KM_log.h \ KM_memio.h KM_mutex.h KM_platform.h KM_prng.cpp KM_prng.h KM_util.cpp \ @@ -141,6 +149,19 @@ libas02_la_LIBADD = libasdcp.la libkumu.la libas02_la_CPPFLAGS = -DASDCP_PLATFORM=\"@host@\" endif + +if USE_PHDR +# sources for PHDR library +libphdr_la_SOURCES = \ + AS_02_PHDR.h \ + PHDR_Sequence_Parser.cpp \ + AS_02_PHDR.cpp + +libphdr_la_LDFLAGS = -release @VERSION@ +libphdr_la_LIBADD = libasdcp.la libkumu.la +libphdr_la_CPPFLAGS = -DASDCP_PLATFORM=\"@host@\" +endif + # Python extension if PYTHON_USE lib_LTLIBRARIES += libpyasdcp.la @@ -196,6 +217,11 @@ bin_PROGRAMS += \ as-02-unwrap endif +if USE_PHDR +bin_PROGRAMS += \ + phdr-wrap \ + phdr-unwrap +endif # sources and linkage for CLI utilities asdcp_test_SOURCES = asdcp-test.cpp @@ -245,6 +271,14 @@ as_02_unwrap_SOURCES = as-02-unwrap.cpp as_02_unwrap_LDADD = libas02.la libasdcp.la libkumu.la endif +if USE_PHDR +phdr_wrap_SOURCES = phdr-wrap.cpp +phdr_wrap_LDADD = libphdr.la libas02.la libasdcp.la libkumu.la + +phdr_unwrap_SOURCES = phdr-unwrap.cpp +phdr_unwrap_LDADD = libphdr.la libas02.la libasdcp.la libkumu.la +endif + # list of programs that need to be compiled for use in test suite check_PROGRAMS = asdcp-mem-test path-test \ fips-186-rng-test asdcp-version diff --git a/src/Metadata.cpp b/src/Metadata.cpp index 0d163be..2ab2635 100755 --- a/src/Metadata.cpp +++ b/src/Metadata.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2005-2012, John Hurst +Copyright (c) 2005-2015, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -2048,6 +2048,10 @@ JPEG2000PictureSubDescriptor::InitFromTLVSet(TLVReader& TLVSet) result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(JPEG2000PictureSubDescriptor, QuantizationDefault)); QuantizationDefault.set_has_value( result == RESULT_OK ); } + if ( ASDCP_SUCCESS(result) ) { + result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(JPEG2000PictureSubDescriptor, J2CLayout)); + J2CLayout.set_has_value( result == RESULT_OK ); + } return result; } @@ -2070,6 +2074,7 @@ JPEG2000PictureSubDescriptor::WriteToTLVSet(TLVWriter& TLVSet) if ( ASDCP_SUCCESS(result) && ! PictureComponentSizing.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, PictureComponentSizing)); if ( ASDCP_SUCCESS(result) && ! CodingStyleDefault.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, CodingStyleDefault)); if ( ASDCP_SUCCESS(result) && ! QuantizationDefault.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, QuantizationDefault)); + if ( ASDCP_SUCCESS(result) && ! J2CLayout.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, J2CLayout)); return result; } @@ -2091,6 +2096,7 @@ JPEG2000PictureSubDescriptor::Copy(const JPEG2000PictureSubDescriptor& rhs) PictureComponentSizing = rhs.PictureComponentSizing; CodingStyleDefault = rhs.CodingStyleDefault; QuantizationDefault = rhs.QuantizationDefault; + J2CLayout = rhs.J2CLayout; } // @@ -2123,6 +2129,9 @@ JPEG2000PictureSubDescriptor::Dump(FILE* stream) if ( ! QuantizationDefault.empty() ) { fprintf(stream, " %22s = %s\n", "QuantizationDefault", QuantizationDefault.get().EncodeString(identbuf, IdentBufferLen)); } + if ( ! J2CLayout.empty() ) { + fprintf(stream, " %22s = %s\n", "J2CLayout", J2CLayout.get().EncodeString(identbuf, IdentBufferLen)); + } } // diff --git a/src/Metadata.h b/src/Metadata.h index dc8d921..b8d16dc 100755 --- a/src/Metadata.h +++ b/src/Metadata.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2005-2012, John Hurst +Copyright (c) 2005-2015, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -564,6 +564,7 @@ namespace ASDCP optional_property PictureComponentSizing; optional_property CodingStyleDefault; optional_property QuantizationDefault; + optional_property J2CLayout; JPEG2000PictureSubDescriptor(const Dictionary*& d); JPEG2000PictureSubDescriptor(const JPEG2000PictureSubDescriptor& rhs); diff --git a/src/PHDR_Sequence_Parser.cpp b/src/PHDR_Sequence_Parser.cpp index 47d7fde..d7d8616 100755 --- a/src/PHDR_Sequence_Parser.cpp +++ b/src/PHDR_Sequence_Parser.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2004-2014, John Hurst +Copyright (c) 2004-2015, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without -- 2.30.2