Skip to content

Commit

Permalink
SAIL: Added SAIL_OPENMP_SCHEDULE build option with the default value …
Browse files Browse the repository at this point in the history
…of 'dynamic'
  • Loading branch information
HappySeaFox committed Nov 16, 2023
1 parent 94b2260 commit aa07ebd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ vcpkg install sail
- `SAIL_THIRD_PARTY_CODECS_PATH=ON|OFF` - Enable loading custom codecs from the ';'-separated paths specified in the `SAIL_THIRD_PARTY_CODECS_PATH` environment variable. Default: `ON`
- `SAIL_THREAD_SAFE=ON|OFF` - Enable working in multi-threaded environments by locking the internal context with a mutex. Default: `ON`
- `SAIL_ONLY_CODECS="a;b;c"` - Forcefully enable only the codecs specified in this ';'-separated list and disable the rest. If an enabled codec fails to find its dependencies, the configuration process fails. One can also specify not just individual codecs but codec groups by their priority like that: highest-priority;xbm. Default: empty list
- `SAIL_OPENMP_SCHEDULE="dynamic"` - OpenMP scheduling algorithm. Default: dynamic

### Windows

Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ option(SAIL_INSTALL_PDB "Install PDB files along with libraries." ON)
set(SAIL_ONLY_CODECS "" CACHE STRING "Forcefully enable only the codecs specified in this ';'-separated list and disable the rest. \
If an enabled codec fails to find its dependencies, the configuration process fails. \
One can also specify not just individual codecs but codec groups by their priority like that: highest-priority;xbm.")
set(SAIL_OPENMP_SCHEDULE "dynamic" CACHE STRING "OpenMP scheduling algorithm.")
option(BUILD_SHARED_LIBS "Build shared libs. When disabled, sets SAIL_COMBINE_CODECS to ON automatically." ON)
cmake_dependent_option(SAIL_COMBINE_CODECS "Combine all codecs into a single library. When disabled, all codecs are implemented as \
dynamically loaded plugins." OFF "BUILD_SHARED_LIBS" ON)
Expand Down
3 changes: 3 additions & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@
/* Enabled built-in codecs. */
@SAIL_HAVE_CODEC_DEFINES@

/* OpenMP scheduling algorithm. */
#cmakedefine SAIL_OPENMP_SCHEDULE @SAIL_OPENMP_SCHEDULE@

#endif
32 changes: 16 additions & 16 deletions src/sail-manip/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static sail_status_t convert_from_indexed(const struct sail_image *image,
sail_status_t status = SAIL_OK;
unsigned row;

#pragma omp parallel for shared(status)
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE) shared(status)
for (row = 0; row < image->height; row++) {
#pragma omp flush(status)
if (status == SAIL_OK) {
Expand Down Expand Up @@ -264,7 +264,7 @@ static sail_status_t convert_from_grayscale_up_to_bpp8(const struct sail_image *

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint8_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand Down Expand Up @@ -324,7 +324,7 @@ static sail_status_t convert_from_bpp16_grayscale(const struct sail_image *image

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint16_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -344,7 +344,7 @@ static sail_status_t convert_from_bpp16_grayscale_alpha(const struct sail_image

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint8_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -366,7 +366,7 @@ static sail_status_t convert_from_bpp32_grayscale_alpha(const struct sail_image

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint16_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -388,7 +388,7 @@ static sail_status_t convert_from_bpp16_rgb555(const struct sail_image *image, p

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint16_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -409,7 +409,7 @@ static sail_status_t convert_from_bpp16_bgr555(const struct sail_image *image, p

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint16_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -430,7 +430,7 @@ static sail_status_t convert_from_bpp16_rgb565(const struct sail_image *image, p

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint16_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -451,7 +451,7 @@ static sail_status_t convert_from_bpp16_bgr565(const struct sail_image *image, p

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint16_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -472,7 +472,7 @@ static sail_status_t convert_from_bpp24_rgb_kind(const struct sail_image *image,

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint8_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -493,7 +493,7 @@ static sail_status_t convert_from_bpp48_rgb_kind(const struct sail_image *image,

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint16_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -514,7 +514,7 @@ static sail_status_t convert_from_bpp32_rgba_kind(const struct sail_image *image

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint8_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -535,7 +535,7 @@ static sail_status_t convert_from_bpp64_rgba_kind(const struct sail_image *image

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint16_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -556,7 +556,7 @@ static sail_status_t convert_from_bpp32_cmyk(const struct sail_image *image, pix

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint8_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -578,7 +578,7 @@ static sail_status_t convert_from_bpp24_ycbcr(const struct sail_image *image, pi

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint8_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand All @@ -600,7 +600,7 @@ static sail_status_t convert_from_bpp32_ycck(const struct sail_image *image, pix

unsigned row;

#pragma omp parallel for
#pragma omp parallel for schedule(SAIL_OPENMP_SCHEDULE)
for (row = 0; row < image->height; row++) {
const uint8_t *scan_input = sail_scan_line(image, row);
uint8_t *scan_output8 = sail_scan_line(output_context->image, row);
Expand Down

0 comments on commit aa07ebd

Please sign in to comment.