Skip to content

Commit

Permalink
Merge pull request #6 from sincos2854/main
Browse files Browse the repository at this point in the history
Update libjxl version to 0.8.2 and fix memory allocation
  • Loading branch information
uyjulian authored Jul 6, 2023
2 parents 7b1fa23 + e761a60 commit e956aef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ DEPENDENCY_SOURCE_DIRECTORY_LIBJXL := $(DEPENDENCY_SOURCE_DIRECTORY)/libjxl
DEPENDENCY_SOURCE_URL_LIBJXL := https://github.com/libjxl/libjxl.git

$(DEPENDENCY_SOURCE_DIRECTORY_LIBJXL): | $(DEPENDENCY_SOURCE_DIRECTORY)
git clone --depth 1 --branch v0.8.1 --recursive --shallow-submodules $(DEPENDENCY_SOURCE_URL_LIBJXL) $@
git clone --depth 1 --branch v0.8.2 --recursive --shallow-submodules $(DEPENDENCY_SOURCE_URL_LIBJXL) $@

$(DEPENDENCY_OUTPUT_DIRECTORY)/lib/libjxl_threads.a: $(DEPENDENCY_OUTPUT_DIRECTORY)/lib/libjxl.a
$(DEPENDENCY_OUTPUT_DIRECTORY)/lib/libhwy.a: $(DEPENDENCY_OUTPUT_DIRECTORY)/lib/libjxl.a
Expand Down
22 changes: 11 additions & 11 deletions extractor.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,19 @@ int getBMPFromJXL(const uint8_t* input_data, size_t file_size,HANDLE* h_bitmap_i
int j;
for (j = 0; j < height / 2; j++)
{
DWORD* cur_1 = (DWORD*)bitmap_data + j * width;
DWORD* cur_2 = (DWORD*)bitmap_data + (height - (1 + j)) * width;
DWORD* curbit_1 = (DWORD*)bitmap_data + j * width;
DWORD* curbit_2 = (DWORD*)bitmap_data + (height - (1 + j)) * width;
for (int i = 0; i < width; i++)
{
DWORD tmp =
((cur_1[i] << 16) & 0x00ff0000) |
((cur_1[i] >> 16) & 0x000000ff) |
((cur_1[i]) & 0xff00ff00);
cur_1[i] =
((cur_2[i] << 16) & 0x00ff0000) |
((cur_2[i] >> 16) & 0x000000ff) |
((cur_2[i]) & 0xff00ff00);
cur_2[i] = tmp;
((curbit_1[i] << 16) & 0x00ff0000) |
((curbit_1[i] >> 16) & 0x000000ff) |
((curbit_1[i]) & 0xff00ff00);
curbit_1[i] =
((curbit_2[i] << 16) & 0x00ff0000) |
((curbit_2[i] >> 16) & 0x000000ff) |
((curbit_2[i]) & 0xff00ff00);
curbit_2[i] = tmp;
}
}
if (height % 2)
Expand All @@ -203,7 +203,7 @@ int getBMPFromJXL(const uint8_t* input_data, size_t file_size,HANDLE* h_bitmap_i
}

// Fill in the bitmap information and file header.
*h_bitmap_info = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, sizeof(BITMAPINFOHEADER));
*h_bitmap_info = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, sizeof(BITMAPINFO));
if (NULL == *h_bitmap_info)
{
DBGFPRINTF(stderr, "Memory error\n");
Expand Down

0 comments on commit e956aef

Please sign in to comment.