From 91b553a7eba3e8f164385fe796532ff18a8ebcd9 Mon Sep 17 00:00:00 2001 From: Ruven Date: Tue, 24 Sep 2024 10:32:46 +0200 Subject: [PATCH] Added TIFF codec version reporting in logfile and updated return signature for getCodecVersion() function. Also code cleanups for OpenJPEGImage and KakaduImage classes. --- ChangeLog | 5 +++++ src/IIPImage.h | 2 +- src/JTL.cc | 2 +- src/KakaduImage.cc | 4 ++-- src/KakaduImage.h | 4 ++-- src/Main.cc | 1 + src/OpenJPEGImage.cc | 20 ++++++++++---------- src/OpenJPEGImage.h | 2 +- src/TPTImage.h | 20 ++++++++++++++++++++ 9 files changed, 43 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef47168..8b2bbe0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +24/09/2024: + - Added TIFF codec version reporting in logfile and updated return signature for getCodecVersion() function. + Also code cleanups for OpenJPEGImage and KakaduImage classes. + + 13/09/2024: - Updated XYZ to sRGB conversion matrix to use that in the official IEC 61966-2-1 specification diff --git a/src/IIPImage.h b/src/IIPImage.h index e3f09e8..6dac93b 100644 --- a/src/IIPImage.h +++ b/src/IIPImage.h @@ -468,7 +468,7 @@ class IIPImage { /// Get codec version /** @return codec version */ - static const char* getCodecVersion(){ return "0.0.0"; }; + static std::string getCodecVersion(){ return "0.0.0"; }; /// Comparison equality operator diff --git a/src/JTL.cc b/src/JTL.cc index 2887cb8..fed2137 100644 --- a/src/JTL.cc +++ b/src/JTL.cc @@ -83,7 +83,7 @@ void JTL::send( Session* session, int resolution, int tile ){ #ifdef HAVE_WEBP else if( session->view->output_format == ImageEncoding::WEBP ) compressor = session->webp; #endif - #ifdef HAVE_AVIF +#ifdef HAVE_AVIF else if( session->view->output_format == ImageEncoding::AVIF ) compressor = session->avif; #endif else compressor = session->jpeg; diff --git a/src/KakaduImage.cc b/src/KakaduImage.cc index 6a4266d..9c4c123 100644 --- a/src/KakaduImage.cc +++ b/src/KakaduImage.cc @@ -250,9 +250,9 @@ void KakaduImage::loadImageInfo( int seq, int ang ) logfile << "Kakadu :: Capture Resolution : " << dpi_x << "x" << dpi_y << " pixels/cm" << endl; #endif - // Loop through each resolution and calculate the image dimensions - + // Loop through each resolution and calculate the image dimensions - // We calculate ourselves rather than relying on get_dims() to force a similar - // behaviour to TIFF with resolutions at floor(x/2) rather than Kakadu's default ceil(x/2) + // behaviour to TIFF with resolutions at floor(x/2) rather than Kakadu's default ceil(x/2) for( unsigned int c=1; c 8 ) obpc = 16; else if( bpc <= 8 ) obpc = 8; - + #ifdef OPENJPEG_DEBUG Timer timer; timer.start(); @@ -410,7 +410,7 @@ void OpenJPEGImage::process( unsigned int res, int layers, int xoffset, int yoff else if( bpc <= 8 ) obpc = 8; unsigned int factor = 1; // Downsampling factor - set it to default value - int vipsres = (numResolutions - 1) - res; // Reverse resolution number + int vipsres = getNativeResolution( res ); // Reverse resolution number // Calculate number of extra resolutions needed that have not been encoded in the image if( res < virtual_levels ){ @@ -488,10 +488,10 @@ void OpenJPEGImage::process( unsigned int res, int layers, int xoffset, int yoff // Copy our decoded data by looping over all pixels size_t n = 0; - for( unsigned int j=0; j < th; j += factor ){ - for( unsigned int i = 0; i < tw; i += factor ){ + for( unsigned int j=0; j