Don't add dependency to the above LCU in wavefront if it's not necessary.

- The top-right LCU already has dependency to the top LCU.
This commit is contained in:
Ari Koivula 2014-05-19 18:31:01 +03:00
parent bdc2d43180
commit de76d0a294

View file

@ -1350,13 +1350,17 @@ static void encoder_state_encode_leaf(encoder_state * const encoder_state) {
encoder_state->tile->wf_jobs[lcu->id] = threadqueue_submit(encoder_state->encoder_control->threadqueue, worker_encoder_state_encode_lcu, (void*)lcu, 1, job_description);
if (encoder_state->tile->wf_jobs[lcu->id]) {
if (lcu->position.x > 0) {
// Wait for the LCU on the left.
threadqueue_job_dep_add(encoder_state->tile->wf_jobs[lcu->id], encoder_state->tile->wf_jobs[lcu->id - 1]);
}
if (lcu->position.y > 0) {
threadqueue_job_dep_add(encoder_state->tile->wf_jobs[lcu->id], encoder_state->tile->wf_jobs[lcu->id - encoder_state->tile->cur_pic->width_in_lcu]);
}
if (lcu->position.y > 0 && lcu->position.x < encoder_state->tile->cur_pic->width_in_lcu - 1) {
threadqueue_job_dep_add(encoder_state->tile->wf_jobs[lcu->id], encoder_state->tile->wf_jobs[lcu->id - encoder_state->tile->cur_pic->width_in_lcu + 1]);
if (lcu->position.x < encoder_state->tile->cur_pic->width_in_lcu - 1) {
// Wait for the LCU to the top-right of this one.
threadqueue_job_dep_add(encoder_state->tile->wf_jobs[lcu->id], encoder_state->tile->wf_jobs[lcu->id - encoder_state->tile->cur_pic->width_in_lcu + 1]);
} else {
// If there is no top-right LCU, wait for the one above.
threadqueue_job_dep_add(encoder_state->tile->wf_jobs[lcu->id], encoder_state->tile->wf_jobs[lcu->id - encoder_state->tile->cur_pic->width_in_lcu]);
}
}
threadqueue_job_unwait_job(encoder_state->encoder_control->threadqueue, encoder_state->tile->wf_jobs[lcu->id]);
}