Skip to content

Commit

Permalink
Merge pull request #9 from sincos2854/master
Browse files Browse the repository at this point in the history
Multi-threaded decoding process
  • Loading branch information
uyjulian authored Aug 29, 2023
2 parents 846ceec + 5f01bb3 commit 7d960a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ DEPENDENCY_SOURCE_DIRECTORY_LIBAVIF := $(DEPENDENCY_SOURCE_DIRECTORY)/libavif
DEPENDENCY_SOURCE_FILE_DAV1D := $(DEPENDENCY_SOURCE_DIRECTORY)/dav1d.tar.bz2
DEPENDENCY_SOURCE_FILE_LIBAVIF := $(DEPENDENCY_SOURCE_DIRECTORY)/libavif.tar.gz

DEPENDENCY_SOURCE_URL_DAV1D := https://code.videolan.org/videolan/dav1d/-/archive/1.0.0/dav1d-1.0.0.tar.bz2
DEPENDENCY_SOURCE_URL_LIBAVIF := https://github.com/AOMediaCodec/libavif/archive/refs/tags/v0.11.1.tar.gz
DEPENDENCY_SOURCE_URL_DAV1D := https://code.videolan.org/videolan/dav1d/-/archive/1.2.1/dav1d-1.2.1.tar.bz2
DEPENDENCY_SOURCE_URL_LIBAVIF := https://github.com/AOMediaCodec/libavif/archive/refs/tags/v1.0.0.tar.gz

$(DEPENDENCY_SOURCE_FILE_DAV1D): | $(DEPENDENCY_SOURCE_DIRECTORY)
curl --location --output $@ $(DEPENDENCY_SOURCE_URL_DAV1D)
Expand Down
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 7d960a3

Please sign in to comment.