Previously the library accepted a max of 255 threads for compression. The limit has now been extended to 9 223 372 036 854 775 807, which should suffice for the next couple of years.

This commit is contained in:
Patrick Vogler 2024-06-28 11:27:58 +02:00
parent 58596bb3e4
commit b3f594771f
Signed by: Patrick Vogler
GPG key ID: 5536B08CE82E8509
2 changed files with 23 additions and 12 deletions

View file

@ -1624,18 +1624,22 @@ forward_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
uint64 rX1, rY1, rZ1; uint64 rX1, rY1, rZ1;
uint64 width, height, depth; uint64 width, height, depth;
uint64 x, y, z; uint64 x, y, z;
uint32 buff_size;
int64 nThreads;
int16 i; int16 i;
uint32 buff_size;
uint16 incr_TS; uint16 incr_TS;
uint16 rTS0; uint16 rTS0;
uint16 rTS1; uint16 rTS1;
uint16 dt; uint16 dt;
uint16 t; uint16 t;
uint8 id; uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ; uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS; uint8 filter_tapsTS;
uint8 level; uint8 level;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -2161,18 +2165,22 @@ inverse_wavelet_transform(bwc_field *const field, bwc_parameter *const parameter
uint64 rX1, rY1, rZ1; uint64 rX1, rY1, rZ1;
uint64 width, height, depth; uint64 width, height, depth;
uint64 x, y, z; uint64 x, y, z;
int64 nThreads;
int64 i;
uint32 buff_size; uint32 buff_size;
int16 i;
uint16 incr_TS; uint16 incr_TS;
uint16 rTS0; uint16 rTS0;
uint16 rTS1; uint16 rTS1;
uint16 dt; uint16 dt;
uint16 t; uint16 t;
uint8 id; uint8 id;
uint8 filter_tapsX, filter_tapsY, filter_tapsZ; uint8 filter_tapsX, filter_tapsY, filter_tapsZ;
uint8 filter_tapsTS; uint8 filter_tapsTS;
uint8 level; uint8 level;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !

View file

@ -2836,12 +2836,14 @@ t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
uint64 c; uint64 c;
uint64 cbSizeX, cbSizeY, cbSizeZ; uint64 cbSizeX, cbSizeY, cbSizeZ;
uint64 width, height, depth; uint64 width, height, depth;
int64 buff_size; int64 buff_size;
int64 j; int64 i, j;
int64 nThreads;
uint16 cbSizeTS; uint16 cbSizeTS;
uint16 slope_max, slope_min; uint16 slope_max, slope_min;
int16 i, z; int16 z;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -2921,7 +2923,7 @@ t1_encode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! threads during a parallel run. For a serial run only one ! ! threads during a parallel run. For a serial run only one !
! working buffer is allocated. ! ! working buffer is allocated. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
for(i = 0; i < nThreads; ++i) for(i = 0; i < (int64)nThreads; ++i)
{ {
memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe)); memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe));
if(!memory[i]) if(!memory[i])
@ -3137,11 +3139,12 @@ t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
uint64 c; uint64 c;
uint64 cbSizeX, cbSizeY, cbSizeZ; uint64 cbSizeX, cbSizeY, cbSizeZ;
uint64 width, height, depth; uint64 width, height, depth;
int64 buff_size; int64 buff_size;
int64 j; int64 i, j;
int64 nThreads;
uint16 cbSizeTS; uint16 cbSizeTS;
int16 i;
uint8 nThreads;
/*-----------------------*\ /*-----------------------*\
! DEFINE STRUCTS: ! ! DEFINE STRUCTS: !
@ -3214,7 +3217,7 @@ t1_decode(bwc_field *const field, bwc_tile *const tile, bwc_parameter *const par
! threads during a parallel run. For a serial run only one ! ! threads during a parallel run. For a serial run only one !
! working buffer is allocated. ! ! working buffer is allocated. !
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
for(i = 0; i < nThreads; ++i) for(i = 0; i < (int64)nThreads; ++i)
{ {
memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe)); memory[i] = calloc(buff_size, sizeof(bwc_coder_stripe));
if(!memory[i]) if(!memory[i])