Loading libs/ultrahdr/include/ultrahdr/jpegrutils.h +5 −2 Original line number Diff line number Diff line Loading @@ -102,7 +102,9 @@ bool getMetadataFromXMP(uint8_t* xmp_data, size_t xmp_size, ultrahdr_metadata_st * xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> * <rdf:Description * xmlns:Container="http://ns.google.com/photos/1.0/container/" * xmlns:Item="http://ns.google.com/photos/1.0/container/item/"> * xmlns:Item="http://ns.google.com/photos/1.0/container/item/" * xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/" * hdrgm:Version="1"> * <Container:Directory> * <rdf:Seq> * <rdf:li Loading @@ -127,7 +129,8 @@ bool getMetadataFromXMP(uint8_t* xmp_data, size_t xmp_size, ultrahdr_metadata_st * @param secondary_image_length length of secondary image * @return XMP metadata in type of string */ std::string generateXmpForPrimaryImage(int secondary_image_length); std::string generateXmpForPrimaryImage(int secondary_image_length, ultrahdr_metadata_struct& metadata); /* * This method generates XMP metadata for the recovery map image. Loading libs/ultrahdr/include/ultrahdr/ultrahdr.h +2 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ typedef enum { */ struct ultrahdr_metadata_struct { // Ultra HDR library version uint32_t version; const char* version; // Max Content Boost for the map float maxContentBoost; // Min Content Boost for the map Loading libs/ultrahdr/jpegr.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ namespace android::ultrahdr { } // The current JPEGR version that we encode to static const uint32_t kJpegrVersion = 1; static const char* const kJpegrVersion = "1.0"; // Map is quarter res / sixteenth size static const size_t kMapDimensionScaleFactor = 4; Loading Loading @@ -943,7 +943,7 @@ status_t JpegR::appendGainMap(jr_compressed_ptr compressed_jpeg_image, + xmp_secondary_length + compressed_gain_map->length; // primary image const string xmp_primary = generateXmpForPrimaryImage(secondary_image_size); const string xmp_primary = generateXmpForPrimaryImage(secondary_image_size, *metadata); // same as primary const int xmp_primary_length = 2 + nameSpaceLength + xmp_primary.size(); Loading libs/ultrahdr/jpegrutils.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -302,7 +302,7 @@ bool getMetadataFromXMP(uint8_t* xmp_data, size_t xmp_size, ultrahdr_metadata_st return true; } string generateXmpForPrimaryImage(int secondary_image_length) { string generateXmpForPrimaryImage(int secondary_image_length, ultrahdr_metadata_struct& metadata) { const vector<string> kConDirSeq({kConDirectory, string("rdf:Seq")}); const vector<string> kLiItem({string("rdf:li"), kConItem}); Loading @@ -316,6 +316,8 @@ string generateXmpForPrimaryImage(int secondary_image_length) { writer.StartWritingElement("rdf:Description"); writer.WriteXmlns(kContainerPrefix, kContainerUri); writer.WriteXmlns(kItemPrefix, kItemUri); writer.WriteXmlns(kGainMapPrefix, kGainMapUri); writer.WriteAttributeNameAndValue(kMapVersion, metadata.version); writer.StartWritingElements(kConDirSeq); Loading libs/ultrahdr/tests/jpegr_test.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ TEST_F(JpegRTest, build) { TEST_F(JpegRTest, writeXmpThenRead) { ultrahdr_metadata_struct metadata_expected; metadata_expected.version = "1.0"; metadata_expected.maxContentBoost = 1.25; metadata_expected.minContentBoost = 0.75; const std::string nameSpace = "http://ns.adobe.com/xap/1.0/\0"; Loading Loading @@ -538,7 +539,7 @@ TEST_F(JpegRTest, ProfileGainMapFuncs) { JpegRBenchmark benchmark; ultrahdr_metadata_struct metadata = { .version = 1, ultrahdr_metadata_struct metadata = { .version = "1.0", .maxContentBoost = 8.0f, .minContentBoost = 1.0f / 8.0f }; Loading Loading
libs/ultrahdr/include/ultrahdr/jpegrutils.h +5 −2 Original line number Diff line number Diff line Loading @@ -102,7 +102,9 @@ bool getMetadataFromXMP(uint8_t* xmp_data, size_t xmp_size, ultrahdr_metadata_st * xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> * <rdf:Description * xmlns:Container="http://ns.google.com/photos/1.0/container/" * xmlns:Item="http://ns.google.com/photos/1.0/container/item/"> * xmlns:Item="http://ns.google.com/photos/1.0/container/item/" * xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/" * hdrgm:Version="1"> * <Container:Directory> * <rdf:Seq> * <rdf:li Loading @@ -127,7 +129,8 @@ bool getMetadataFromXMP(uint8_t* xmp_data, size_t xmp_size, ultrahdr_metadata_st * @param secondary_image_length length of secondary image * @return XMP metadata in type of string */ std::string generateXmpForPrimaryImage(int secondary_image_length); std::string generateXmpForPrimaryImage(int secondary_image_length, ultrahdr_metadata_struct& metadata); /* * This method generates XMP metadata for the recovery map image. Loading
libs/ultrahdr/include/ultrahdr/ultrahdr.h +2 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ typedef enum { */ struct ultrahdr_metadata_struct { // Ultra HDR library version uint32_t version; const char* version; // Max Content Boost for the map float maxContentBoost; // Min Content Boost for the map Loading
libs/ultrahdr/jpegr.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ namespace android::ultrahdr { } // The current JPEGR version that we encode to static const uint32_t kJpegrVersion = 1; static const char* const kJpegrVersion = "1.0"; // Map is quarter res / sixteenth size static const size_t kMapDimensionScaleFactor = 4; Loading Loading @@ -943,7 +943,7 @@ status_t JpegR::appendGainMap(jr_compressed_ptr compressed_jpeg_image, + xmp_secondary_length + compressed_gain_map->length; // primary image const string xmp_primary = generateXmpForPrimaryImage(secondary_image_size); const string xmp_primary = generateXmpForPrimaryImage(secondary_image_size, *metadata); // same as primary const int xmp_primary_length = 2 + nameSpaceLength + xmp_primary.size(); Loading
libs/ultrahdr/jpegrutils.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -302,7 +302,7 @@ bool getMetadataFromXMP(uint8_t* xmp_data, size_t xmp_size, ultrahdr_metadata_st return true; } string generateXmpForPrimaryImage(int secondary_image_length) { string generateXmpForPrimaryImage(int secondary_image_length, ultrahdr_metadata_struct& metadata) { const vector<string> kConDirSeq({kConDirectory, string("rdf:Seq")}); const vector<string> kLiItem({string("rdf:li"), kConItem}); Loading @@ -316,6 +316,8 @@ string generateXmpForPrimaryImage(int secondary_image_length) { writer.StartWritingElement("rdf:Description"); writer.WriteXmlns(kContainerPrefix, kContainerUri); writer.WriteXmlns(kItemPrefix, kItemUri); writer.WriteXmlns(kGainMapPrefix, kGainMapUri); writer.WriteAttributeNameAndValue(kMapVersion, metadata.version); writer.StartWritingElements(kConDirSeq); Loading
libs/ultrahdr/tests/jpegr_test.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ TEST_F(JpegRTest, build) { TEST_F(JpegRTest, writeXmpThenRead) { ultrahdr_metadata_struct metadata_expected; metadata_expected.version = "1.0"; metadata_expected.maxContentBoost = 1.25; metadata_expected.minContentBoost = 0.75; const std::string nameSpace = "http://ns.adobe.com/xap/1.0/\0"; Loading Loading @@ -538,7 +539,7 @@ TEST_F(JpegRTest, ProfileGainMapFuncs) { JpegRBenchmark benchmark; ultrahdr_metadata_struct metadata = { .version = 1, ultrahdr_metadata_struct metadata = { .version = "1.0", .maxContentBoost = 8.0f, .minContentBoost = 1.0f / 8.0f }; Loading