rust-av / ssimulacra2_bin

Binary interface for the ssimulacra2 Rust port
BSD 2-Clause "Simplified" License
40 stars 10 forks source link

Add threading support for the `video` command #7

Closed FreezyLemon closed 1 year ago

FreezyLemon commented 1 year ago

The basic idea is that we hide the two decoders behind a Mutex, and let the worker threads decode two frames (one per decoder) to calculate the SSIMU2 score. It's written so that the Mutex lock is dropped as quickly as possible after decoding the frames, so another worker thread can start decoding ASAP. The resulting score value is sent via result_tx to result_rx, which is used in the main thread to accumulate the scores and handle the terminal output.

Some notes:

FreezyLemon commented 1 year ago

Rebased & addressed the feedback. The Mutex now also guards a usize that is incremented every time both decoders successfully decode and return a frame to the score calculation. This frame index is used to guarantee scores in frame decode order (graphing is reliable again). And the verbose println exists again