Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
aous72 committed Jan 3, 2022
2 parents cab81db + c98bb90 commit fe401cb
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 40 deletions.
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
############################################################
if( OJPH_ENABLE_TIFF_SUPPORT )

if( WIN32 )

set(TIFF_INCLUDE_DIR "C:\\Program Files\\tiff\\include" CACHE PATH "the directory containing the TIFF headers")
set(TIFF_LIBRARY_DEBUG "C:\\Program Files\\tiff\\lib\\tiffd.lib" CACHE FILEPATH "the path to the TIFF library for debug configurations")
set(TIFF_LIBRARY_RELEASE "C:\\Program Files\\tiff\\lib\\tiff.lib" CACHE FILEPATH "the path to the TIFF library for release configurations")
set(TIFFXX_LIBRARY_DEBUG "C:\\Program Files\\tiff\\lib\\tiffxxd.lib" CACHE FILEPATH "the path to the TIFFXX library for debug configurations")
set(TIFFXX_LIBRARY_RELEASE "C:\\Program Files\\tiff\\lib\\tiffxx.lib" CACHE FILEPATH "the path to the TIFFXX library for release configurations")

MESSAGE( STATUS "WIN32 detected: Setting CMakeCache TIFF values as follows, use CMake-gui Advanced to modify them" )
MESSAGE( STATUS " TIFF_INCLUDE_DIR : \"${TIFF_INCLUDE_DIR}\" " )
MESSAGE( STATUS " TIFF_LIBRARY_DEBUG : \"${TIFF_LIBRARY_DEBUG}\" " )
MESSAGE( STATUS " TIFF_LIBRARY_RELEASE : \"${TIFF_LIBRARY_RELEASE}\" " )
MESSAGE( STATUS " TIFFXX_LIBRARY_DEBUG : \"${TIFFXX_LIBRARY_DEBUG}\" " )
MESSAGE( STATUS " TIFFXX_LIBRARY_RELEASE : \"${TIFFXX_LIBRARY_RELEASE}\" " )

endif( WIN32 )

FIND_PACKAGE( TIFF )

if( TIFF_FOUND )
Expand Down
19 changes: 11 additions & 8 deletions src/apps/common/ojph_img_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ namespace ojph {
//
//
////////////////////////////////////////////////////////////////////////////
#ifdef OJPH_ENABLE_TIFF_SUPPORT
#ifdef OJPH_ENABLE_TIFF_SUPPORT
class tif_in : public image_in_base
{
public:
Expand Down Expand Up @@ -196,6 +196,7 @@ namespace ojph {

size get_size() { assert(tiff_handle); return size(width, height); }
ui32 get_num_components() { assert(tiff_handle); return num_comps; }
void set_bit_depth(ui32 num_bit_depths, ui32* bit_depth);
ui32 get_bit_depth(ui32 comp_num)
{
assert(tiff_handle && comp_num < num_comps); return bit_depth[comp_num];
Expand Down Expand Up @@ -226,7 +227,7 @@ namespace ojph {
bool is_signed[4];
point subsampling[4];
};
#endif /* OJPH_ENABLE_TIFF_SUPPORT */
#endif /* OJPH_ENABLE_TIFF_SUPPORT */

////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -350,14 +351,14 @@ namespace ojph {
ui32 cur_line, samples_per_line, bytes_per_line;
};

////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////
#ifdef OJPH_ENABLE_TIFF_SUPPORT
#ifdef OJPH_ENABLE_TIFF_SUPPORT
class tif_out : public image_out_base
{
public:
Expand All @@ -367,7 +368,8 @@ namespace ojph {
fname = NULL;
buffer = NULL;
width = height = num_components = 0;
bit_depth = bytes_per_sample = 0;
bytes_per_sample = 0;
bit_depth_of_data[0] = bit_depth_of_data[1] = bit_depth_of_data[2] = bit_depth_of_data[3] = 0;
buffer_size = 0;
cur_line = samples_per_line = 0;
bytes_per_line = 0;
Expand All @@ -383,7 +385,7 @@ namespace ojph {

void open(char* filename);
void configure(ui32 width, ui32 height, ui32 num_components,
ui32 bit_depth);
ui32 *bit_depth);
virtual ui32 write(const line_buf* line, ui32 comp_num);
virtual void close() {
if (tiff_handle) {
Expand All @@ -400,12 +402,13 @@ namespace ojph {

const char* fname;
ui32 width, height, num_components;
ui32 bit_depth, bytes_per_sample;
ui32 bit_depth_of_data[4];
ui32 bytes_per_sample;
ui8* buffer;
ui32 buffer_size;
ui32 cur_line, samples_per_line;
};
#endif /* OJPH_ENABLE_TIFF_SUPPORT */
#endif /* OJPH_ENABLE_TIFF_SUPPORT */


////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 2 additions & 3 deletions src/apps/ojph_compress/ojph_compress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ int main(int argc, char * argv[]) {
image_offset.y + tif.get_size().h));
ojph::ui32 num_comps = tif.get_num_components();
siz.set_num_components(num_comps);
if(num_bit_depths > 0 )
tif.set_bit_depth(num_bit_depths, bit_depth);
for (ojph::ui32 c = 0; c < num_comps; ++c)
siz.set_component(c, tif.get_comp_subsampling(c),
tif.get_bit_depth(c), tif.get_is_signed(c));
Expand Down Expand Up @@ -698,9 +700,6 @@ int main(int argc, char * argv[]) {
if (is_signed[0] != -1)
OJPH_WARN(0x01000063,
"-signed is not needed and was not used\n");
if (bit_depth[0] != 0)
OJPH_WARN(0x01000064,
"-bit_depth is not needed and was not used\n");
if (comp_downsampling[0].x != 0 || comp_downsampling[0].y != 0)
OJPH_WARN(0x01000065,
"-downsamp is not needed and was not used\n");
Expand Down
7 changes: 6 additions & 1 deletion src/apps/ojph_expand/ojph_expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,13 @@ int main(int argc, char *argv[]) {
OJPH_ERROR(0x020000008,
"To save an image to tif(f), all the components must have the "
"downsampling ratio\n");
ojph::ui32 bit_depths[4] = { 0, 0, 0, 0 };
for (ojph::ui32 c = 0; c < siz.get_num_components(); c++)
{
bit_depths[c] = siz.get_bit_depth(c);
}
tif.configure(siz.get_recon_width(0), siz.get_recon_height(0),
siz.get_num_components(), siz.get_bit_depth(0));
siz.get_num_components(), bit_depths);
tif.open(output_filename);
base = &tif;
}
Expand Down
Loading

0 comments on commit fe401cb

Please sign in to comment.