Skip to content

Commit

Permalink
Set number of jobs to rh.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eharve14 committed Jan 15, 2022
1 parent 3a71edf commit 26a5626
Showing 1 changed file with 12 additions and 29 deletions.
41 changes: 12 additions & 29 deletions src/lib/openjp2/dwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1797,12 +1797,9 @@ static INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_thread_pool_t* tp,
rw - j);
}
} else {
OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
OPJ_UINT32 num_jobs;
OPJ_UINT32 step_j;

if (rw < num_jobs) {
num_jobs = rw;
}
num_jobs = rw;
step_j = ((rw / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;

for (j = 0; j < num_jobs; j++) {
Expand Down Expand Up @@ -1846,12 +1843,10 @@ static INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_thread_pool_t* tp,
cas_row == 0 ? OPJ_TRUE : OPJ_FALSE);
}
} else {
OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
OPJ_UINT32 num_jobs;
OPJ_UINT32 step_j;

if (rh < num_jobs) {
num_jobs = rh;
}
num_jobs = rh;
step_j = (rh / num_jobs);

for (j = 0; j < num_jobs; j++) {
Expand Down Expand Up @@ -2123,12 +2118,9 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp,
opj_idwt53_h(&h, &tiledp[(OPJ_SIZE_T)j * w]);
}
} else {
OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads * 2;
OPJ_UINT32 num_jobs;
OPJ_UINT32 step_j;

if (rh < num_jobs) {
num_jobs = rh;
}
num_jobs = rh;
step_j = (rh / num_jobs);

for (j = 0; j < num_jobs; j++) {
Expand Down Expand Up @@ -2178,12 +2170,9 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp,
opj_idwt53_v(&v, &tiledp[j], (OPJ_SIZE_T)w, (OPJ_INT32)(rw - j));
}
} else {
OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
OPJ_UINT32 num_jobs;
OPJ_UINT32 step_j;

if (rw < num_jobs) {
num_jobs = rw;
}
num_jobs = rw;
step_j = (rw / num_jobs);

for (j = 0; j < num_jobs; j++) {
Expand Down Expand Up @@ -3380,12 +3369,9 @@ OPJ_BOOL opj_dwt_decode_tile_97(opj_thread_pool_t* tp,
aj += w * NB_ELTS_V8;
}
} else {
OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
OPJ_UINT32 num_jobs;
OPJ_UINT32 step_j;

if ((rh / NB_ELTS_V8) < num_jobs) {
num_jobs = rh / NB_ELTS_V8;
}
num_jobs = rh / NB_ELTS_V8;
step_j = ((rh / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
for (j = 0; j < num_jobs; j++) {
opj_dwt97_decode_h_job_t* job;
Expand Down Expand Up @@ -3459,12 +3445,9 @@ OPJ_BOOL opj_dwt_decode_tile_97(opj_thread_pool_t* tp,
transfer being the limiting factor. So limit the number of
threads.
*/
OPJ_UINT32 num_jobs = opj_uint_max((OPJ_UINT32)num_threads / 2, 2U);
OPJ_UINT32 num_jobs;
OPJ_UINT32 step_j;

if ((rw / NB_ELTS_V8) < num_jobs) {
num_jobs = rw / NB_ELTS_V8;
}
num_jobs = rw / NB_ELTS_V8;
step_j = ((rw / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
for (j = 0; j < num_jobs; j++) {
opj_dwt97_decode_v_job_t* job;
Expand Down

0 comments on commit 26a5626

Please sign in to comment.