ultravideo / uvg266

An open-source VVC encoder based on Kvazaar
BSD 3-Clause "New" or "Revised" License
217 stars 16 forks source link

Stats file do not get written even when prefix is set #14

Closed randomze closed 8 months ago

randomze commented 8 months ago

When using the encoder option --stats-file-prefix, the stats files get created but not created.

From looking at the code in src/rate_control.c, where all the file manipulation seems to happen from what I could understand, it seems the files get created when the uvg_get_rc_data functions get called and they get written when the function uvg_update_after_picture gets called.

However, the function uvg_update_after_picture never seems to get called, leading to the files never being written. I've confirmed that the function doesn't get called by placing a dummy print inside and it never prints anything out. I've also grepped the src directory and seems this function is just never invoked anywhere.

To add this functionality where would it make the most sense to call the update function so that we get the stats printed to the file?

Thanks for the help in advance :)!

Jovasa commented 8 months ago

The call is located here in kvazaar https://github.com/ultravideo/kvazaar/blob/master/src/encoder_state-bitstream.c#L1111 and thus probably should be here in uvg266 https://github.com/ultravideo/kvazaar/blob/master/src/encoder_state-bitstream.c#L1111. Seems like it was lost in uvg266 at some point.

Nevertheless, the stats are mostly meant for debugging the rate control performance, so I'm wondering what are you hoping to learn from the data?

randomze commented 8 months ago

Thanks, I'll look into patching it and if it works accordingly I will submit a PR :)!

I was planning on using the stats to extract things like QP-map/distortion-map to try some things with some downstream components that want to be compression aware and this seems like the easiest way to get those maps.