Skip to content

Commit

Permalink
Windows fix: export flow_profile_is_srgb for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith committed Sep 15, 2017
1 parent 123e8dc commit 6ce63ef
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion c_components/imageflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct flow_decoder_info {
int32_t image_height;
flow_pixel_format frame_decodes_into;
// const char * format_subtype;
// bool is_srgb;
// bool flow_profile_is_srgb;
};

PUB bool flow_bitmap_bgra_write_png(flow_c * c, struct flow_bitmap_bgra * frame, struct flow_io * io);
Expand Down
2 changes: 1 addition & 1 deletion c_components/lib/codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static unsigned long hash_profile_bytes(unsigned char * profile, size_t profile_

// We save an allocation in png decoding by ignoring an sRGB profile (we assume sRGB anyway).
// We don't save this allocation yet in jpeg decoding, as the profile is segmented.
bool is_srgb(unsigned char * profile, size_t profile_len){
bool flow_profile_is_srgb(unsigned char * profile, size_t profile_len){

//unsigned long srgbHash = hash_close_profile(cmsCreate_sRGBProfile());
// fprintf(stdout,"sRGB hash is %lx\n", srgbHash);
Expand Down
2 changes: 1 addition & 1 deletion c_components/lib/codecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bool flow_codec_decoder_get_frame_info(flow_c * c, void * codec_state, int64_t c

bool flow_codec_decoder_read_frame(flow_c * c, void * codec_state, int64_t codec_id, struct flow_bitmap_bgra * canvas, struct flow_decoder_color_info * color_info);

bool is_srgb(unsigned char * profile, size_t profile_len);


typedef struct jpeg_compress_struct * j_compress_ptr;
typedef struct jpeg_decompress_struct * j_decompress_ptr;
Expand Down
2 changes: 1 addition & 1 deletion c_components/lib/codecs_jpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ static bool flow_codecs_jpg_decoder_interpret_metadata(flow_c * c, struct flow_c

if (state->color.source == flow_codec_color_profile_source_null) {
if (read_icc_profile(c, state->cinfo, &icc_buffer, &icc_buffer_len)) {
if (!is_srgb(icc_buffer, icc_buffer_len)) {
if (!flow_profile_is_srgb(icc_buffer, icc_buffer_len)) {
state->color.profile_buf = icc_buffer;
state->color.buf_length = icc_buffer_len;
state->color.source = flow_codec_color_profile_source_ICCP;
Expand Down
2 changes: 1 addition & 1 deletion c_components/lib/codecs_png.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static bool png_decoder_load_color_profile(flow_c * c, struct flow_codecs_png_de
int is_color_png = state->color_type & PNG_COLOR_MASK_COLOR;

if (png_get_iCCP(state->png_ptr, state->info_ptr, &(png_charp){ 0 }, &(int){ 0 }, &profile_buf, &profile_length)) {
if (!is_srgb(profile_buf, profile_length)) {
if (!flow_profile_is_srgb(profile_buf, profile_length)) {

state->color.profile_buf = (uint8_t *) FLOW_malloc(c, profile_length);
if (state->color.profile_buf == NULL) {
Expand Down
1 change: 1 addition & 0 deletions c_components/lib/imageflow_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ PUB void flow_scale_spatial_1x1(uint8_t input[64], uint8_t ** output_rows, uint3
// https://github.com/imazen/freeimage/blob/master/Source/FreeImage/FreeImageIO.cpp
// https://github.com/imazen/freeimage/blob/master/Source/FreeImage/PluginJPEG.cpp

PUB bool flow_profile_is_srgb(unsigned char * profile, size_t profile_len);
// shutdown
// nature - memory, FILE *,

Expand Down
2 changes: 1 addition & 1 deletion c_components/tests/test_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TEST_CASE("Test isSrgb", "")
{
void * buf = malloc(5000);

REQUIRE(is_srgb((unsigned char *)buf, 5000) == false);
REQUIRE(flow_profile_is_srgb((unsigned char *)buf, 5000) == false);

}

Expand Down

0 comments on commit 6ce63ef

Please sign in to comment.