Skip to content

Commit

Permalink
Multi-threaded decoding process
Browse files Browse the repository at this point in the history
  • Loading branch information
sincos2854 committed Aug 29, 2023
1 parent 2147290 commit 5f01bb3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extractor.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ int getBMPFromAVIF(const uint8_t *input_data, size_t file_size,
int bit_width, bit_length;
avifRGBImage rgb;
memset(&rgb, 0, sizeof(rgb));
SYSTEM_INFO info;

avifDecoder *decoder = avifDecoderCreate();
GetSystemInfo(&info);
decoder->maxThreads = info.dwNumberOfProcessors;
avifResult result = avifDecoderSetIOMemory(decoder, input_data, file_size);
if (result != AVIF_RESULT_OK)
{
Expand All @@ -57,6 +60,7 @@ int getBMPFromAVIF(const uint8_t *input_data, size_t file_size,
avifRGBImageSetDefaults(&rgb, decoder->image);
rgb.depth = 8;
rgb.format = AVIF_RGB_FORMAT_BGRA;
rgb.maxThreads = info.dwNumberOfProcessors;

*h_bitmap_data = LocalAlloc(LMEM_MOVEABLE, sizeof(uint8_t) * bit_length * height);
if (!*h_bitmap_data)
Expand Down

0 comments on commit 5f01bb3

Please sign in to comment.