452 |
#ifndef HAVE_PTHREAD |
#ifndef HAVE_PTHREAD |
453 |
int t = MAX(1, create->num_threads); |
int t = MAX(1, create->num_threads); |
454 |
#else |
#else |
455 |
int t = MIN(create->num_threads, (int) (pEnc->mbParam.mb_height>>1)); /* at least two rows per thread */ |
int t = MAX(1, MIN(create->num_threads, (int) (pEnc->mbParam.mb_height>>1))); /* at least two rows per thread */ |
456 |
#endif |
#endif |
457 |
int threads_per_slice = MAX(1, (t / pEnc->num_slices)); |
int threads_per_slice = MAX(1, (t / pEnc->num_slices)); |
458 |
int rows_per_thread = (pEnc->mbParam.mb_height + threads_per_slice - 1) / threads_per_slice; |
int rows_per_thread = (pEnc->mbParam.mb_height + threads_per_slice - 1) / threads_per_slice; |