Skip to content

Set f->n_tile_data to 0 in dav1d_decode_frame()

Wan-Teh Chang requested to merge wtc/dav1d:reset-n_tile_data into master

Set f->n_tile_data to 0 after the dav1d_decode_frame_exit() call in dav1d_decode_frame(). dav1d_decode_frame_exit() unrefs every element in use in the f->tile array, so it is good to set f->n_tile_data to 0 to indicate that no elements are in use.

We are already doing this after all other dav1d_decode_frame_exit() calls.

NOTE: It is tempting to have dav1d_decode_frame_exit() itself set f->n_tile_data to 0. I did not do that in this merge request, because the following is a common pattern:

dav1d_decode_frame_exit(f, error);
f->n_tile_data = 0;
pthread_cond_signal(&f->task_thread.cond);

corresponding to the waiting code:

while (f->n_tile_data > 0)
    pthread_cond_wait(&f->task_thread.cond,
                      &c->task_thread.lock);

I wonder if f->n_tile_data is set to 0 outside dav1d_decode_frame_exit() to make clear the association of f->n_tile_data with the condition variable f->task_thread.cond.

Merge request reports