Skip to content

Commit

Permalink
* Added fix for API change in get_colour_mapping() function in Kakadu…
Browse files Browse the repository at this point in the history
… version 7.8

* Type change of counter in filter_contrast to long to avoid overflows with large image exports
  • Loading branch information
ruven committed Jun 7, 2016
1 parent 0452653 commit a0849aa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
07/06/2016:
- Added fix for API change in get_colour_mapping() function in Kakadu version 7.8


02/06/2016:
- Type change of counter in filter_contrast to long to avoid overflows with large
image exports.


22/03/2016: Version 1.0 Released


Expand Down
8 changes: 7 additions & 1 deletion src/KakaduImage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,14 @@ void KakaduImage::loadImageInfo( int seq, int ang ) throw(file_error)


// Check for a palette and LUT - only used for bilevel images for now
int cmp, plt, stream_id;
int cmp, plt, stream_id,format=0;
#if defined(KDU_MAJOR_VERSION) && (KDU_MAJOR_VERSION >= 7) && (KDU_MINOR_VERSION >= 8)
// API change for get_colour_mapping in Kakadu 7.8
j2k_channels.get_colour_mapping(0,cmp,plt,stream_id,format);
#else
j2k_channels.get_colour_mapping(0,cmp,plt,stream_id);
#endif

j2k_palette = jpx_stream.access_palette();

if( j2k_palette.exists() && j2k_palette.get_num_luts()>0 ){
Expand Down
4 changes: 2 additions & 2 deletions src/Transforms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ void filter_interpolate_bilinear( RawTile& in, unsigned int resampled_width, uns
// Function to apply a contrast adjustment and clip to 8 bit
void filter_contrast( RawTile& in, float c ){

unsigned int np = in.dataLength * 8 / in.bpc;
unsigned long np = in.width * in.height;
unsigned char* buffer = new unsigned char[np];
float* infptr = (float*)in.data;

Expand All @@ -590,7 +590,7 @@ void filter_contrast( RawTile& in, float c ){
#elif defined(_OPENMP)
#pragma omp parallel for
#endif
for( unsigned int n=0; n<np; n++ ){
for( unsigned long n=0; n<np; n++ ){
float v = infptr[n] * 255.0 * c;
buffer[n] = (unsigned char)( (v<255.0) ? (v<0.0? 0.0 : v) : 255.0 );
}
Expand Down

0 comments on commit a0849aa

Please sign in to comment.