Reverting TIFF support
This commit is contained in:
parent
26c42306b2
commit
74cdf0f0e1
|
@ -7,8 +7,8 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
|
||||||
# The version number.
|
# The version number.
|
||||||
set(VERSION_MAJOR 0)
|
set(VERSION_MAJOR 0)
|
||||||
set(VERSION_MINOR 2)
|
set(VERSION_MINOR 3)
|
||||||
set(VERSION_PATCH 0)
|
set(VERSION_PATCH 1)
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"caesium/config.h.in"
|
"caesium/config.h.in"
|
||||||
|
|
|
@ -4,8 +4,8 @@ find_library(zoflipng zopflipng /usr/local/lib)
|
||||||
find_library(jpeg /opt/mozjpeg/lib)
|
find_library(jpeg /opt/mozjpeg/lib)
|
||||||
find_library(turbojpeg turbojpeg /opt/mozjpeg/lib)
|
find_library(turbojpeg turbojpeg /opt/mozjpeg/lib)
|
||||||
|
|
||||||
add_library(caesium SHARED caesium.c error.c utils.c png.c lodepng.c jpeg.c tiff.c)
|
add_library(caesium SHARED caesium.c error.c utils.c png.c lodepng.c jpeg.c)
|
||||||
add_library(caesium_static STATIC caesium.c error.c utils.c png.c lodepng.c jpeg.c tiff.c)
|
add_library(caesium_static STATIC caesium.c error.c utils.c png.c lodepng.c jpeg.c)
|
||||||
|
|
||||||
set_target_properties(caesium_static PROPERTIES OUTPUT_NAME caesium)
|
set_target_properties(caesium_static PROPERTIES OUTPUT_NAME caesium)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ if (APPLE)
|
||||||
install(FILES caesium.h DESTINATION /usr/local/include)
|
install(FILES caesium.h DESTINATION /usr/local/include)
|
||||||
install(TARGETS LIBRARY DESTINATION /usr/local/lib)
|
install(TARGETS LIBRARY DESTINATION /usr/local/lib)
|
||||||
install(TARGETS ARCHIVE DESTINATION /usr/local/lib)
|
install(TARGETS ARCHIVE DESTINATION /usr/local/lib)
|
||||||
elseif (UNIX AND NOT APPLE)
|
elseif (UNIX)
|
||||||
install(FILES caesium.h DESTINATION /usr/include)
|
install(FILES caesium.h DESTINATION /usr/include)
|
||||||
install(TARGETS LIBRARY DESTINATION /usr/lib)
|
install(TARGETS LIBRARY DESTINATION /usr/lib)
|
||||||
install(TARGETS ARCHIVE DESTINATION /usr/lib)
|
install(TARGETS ARCHIVE DESTINATION /usr/lib)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
#include "jpeg.h"
|
#include "jpeg.h"
|
||||||
#include "tiff.h"
|
|
||||||
|
|
||||||
bool cs_compress(const char *input_path, const char *output_path, cs_image_pars *options)
|
bool cs_compress(const char *input_path, const char *output_path, cs_image_pars *options)
|
||||||
{
|
{
|
||||||
|
@ -34,8 +33,6 @@ bool cs_compress(const char *input_path, const char *output_path, cs_image_pars
|
||||||
}
|
}
|
||||||
} else if (type == CS_PNG) {
|
} else if (type == CS_PNG) {
|
||||||
result = cs_png_optimize(input_path, output_path, &options->png);
|
result = cs_png_optimize(input_path, output_path, &options->png);
|
||||||
} else if (type == CS_TIFF) {
|
|
||||||
result = cs_tiff_optimize(input_path, output_path, &options->tiff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -58,18 +55,12 @@ void initialize_png_parameters(cs_image_pars *par)
|
||||||
par->png.auto_filter_strategy = 1;
|
par->png.auto_filter_strategy = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize_tiff_parameters(cs_image_pars *par)
|
|
||||||
{
|
|
||||||
par->tiff.compression = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cs_image_pars initialize_parameters()
|
cs_image_pars initialize_parameters()
|
||||||
{
|
{
|
||||||
cs_image_pars options;
|
cs_image_pars options;
|
||||||
|
|
||||||
initialize_jpeg_parameters(&options);
|
initialize_jpeg_parameters(&options);
|
||||||
initialize_png_parameters(&options);
|
initialize_png_parameters(&options);
|
||||||
initialize_tiff_parameters(&options);
|
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
|
@ -32,23 +32,16 @@ typedef struct cs_png_pars
|
||||||
int auto_filter_strategy;
|
int auto_filter_strategy;
|
||||||
} cs_png_pars;
|
} cs_png_pars;
|
||||||
|
|
||||||
typedef struct cs_tiff_pars
|
|
||||||
{
|
|
||||||
int compression;
|
|
||||||
} cs_tiff_pars;
|
|
||||||
|
|
||||||
typedef struct cs_image_pars
|
typedef struct cs_image_pars
|
||||||
{
|
{
|
||||||
cs_jpeg_pars jpeg;
|
cs_jpeg_pars jpeg;
|
||||||
cs_png_pars png;
|
cs_png_pars png;
|
||||||
cs_tiff_pars tiff;
|
|
||||||
} cs_image_pars;
|
} cs_image_pars;
|
||||||
|
|
||||||
typedef enum image_type
|
typedef enum image_type
|
||||||
{
|
{
|
||||||
CS_JPEG,
|
CS_JPEG,
|
||||||
CS_PNG,
|
CS_PNG,
|
||||||
CS_TIFF,
|
|
||||||
UNKN,
|
UNKN,
|
||||||
} image_type;
|
} image_type;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
#include "tiff.h"
|
|
||||||
|
|
||||||
|
|
||||||
bool cs_tiff_optimize(const char *input, const char *output, cs_tiff_pars* options)
|
|
||||||
{
|
|
||||||
TIFF* in;
|
|
||||||
TIFF* out;
|
|
||||||
|
|
||||||
in = TIFFOpen(input, "rb");
|
|
||||||
|
|
||||||
TIFFClose(in);
|
|
||||||
TIFFClose(out);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#ifndef LIBCAESIUM_TIFF_H
|
|
||||||
#define LIBCAESIUM_TIFF_H
|
|
||||||
|
|
||||||
#include <tiffio.h>
|
|
||||||
#include "caesium.h"
|
|
||||||
|
|
||||||
bool cs_tiff_optimize(const char *input, const char *output, cs_tiff_pars* options);
|
|
||||||
|
|
||||||
#endif //LIBCAESIUM_TIFF_H
|
|
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
image_type detect_image_type(FILE *pFile)
|
image_type detect_image_type(FILE *pFile)
|
||||||
{
|
{
|
||||||
unsigned char buffer[4];
|
unsigned char buffer[2];
|
||||||
|
|
||||||
if (pFile == NULL) {
|
if (pFile == NULL) {
|
||||||
display_error(WARNING, 101);
|
display_error(WARNING, 101);
|
||||||
return UNKN;
|
return UNKN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fread(buffer, 1, 4, pFile) < 4) {
|
if (fread(buffer, 1, 2, pFile) < 2) {
|
||||||
return UNKN;
|
return UNKN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,6 @@ image_type detect_image_type(FILE *pFile)
|
||||||
return CS_JPEG;
|
return CS_JPEG;
|
||||||
} else if (buffer[0] == 0x89 && buffer[1] == 0x50) {
|
} else if (buffer[0] == 0x89 && buffer[1] == 0x50) {
|
||||||
return CS_PNG;
|
return CS_PNG;
|
||||||
} else if ((buffer[0] == 0x49 && buffer[1] == 0x49 && buffer[2] == 0x2A && buffer[3] == 0x00)
|
|
||||||
|| (buffer[0] == 0x4D && buffer[1] == 0x4D && buffer[2] == 0x00 && buffer[3] == 0x2A)) {
|
|
||||||
return CS_TIFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return UNKN;
|
return UNKN;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
add_executable(caesiumd main.c)
|
add_executable(caesiumd main.c)
|
||||||
|
|
||||||
target_link_libraries(caesiumd LINK_PUBLIC caesium)
|
target_link_libraries(caesiumd LINK_PUBLIC caesium)
|
||||||
|
|
||||||
install(TARGETS caesiumd DESTINATION bin)
|
|
Loading…
Reference in New Issue