rav1e icon indicating copy to clipboard operation
rav1e copied to clipboard

Setting rdo_lookahead_frames to zero causes instantiation to fail

Open yannlandry opened this issue 3 years ago • 2 comments

Describe the bug When using the C API with rav1e 0.5.0, rav1e_context_new(config) returns NULL when config contains rdo_lookahead_frames = 0. If the value is set to -1, then rav1e_config_parse_int(...) returns an error status, but the context object is still created successfully.

To Reproduce

RaConfig* config = rav1e_config_default();
int result = rav1e_config_parse_int(config, "rdo_lookahead_frames", 0); // no error returned
RaContext* = rav1e_context_new(config); // returns NULL

Expected behavior In the above example, rav1e_config_parse_int(...) should return an error status and rav1e_context_new(config) should not return NULL but should ignore the erroneous rdo_lookahead_frames value as if it was absent.

If -1 is passed to rav1e_config_parse_int(...), an error status is returned and rav1e_context_new(config) ignores the value and does not return NULL. The behaviour should be the same when the value is 0.

Required Information

Version:

0.5.0

Operating system:

Linux ubuntu-xenial 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

yannlandry avatar Sep 09 '21 01:09 yannlandry

This is a known but not documented "bug".

If you look into the --still-picture flag, you will notice that it sets rdo_lookahead_frames to 1, but not 0. Setting it to 0 will make it fail.

We could improve the documentation in this regard.

BlueSwordM avatar Sep 09 '21 02:09 BlueSwordM

I do have an old PR that actually allows a setting of 0: https://github.com/xiph/rav1e/pull/2317

It needs more testing, though.

tdaede avatar Sep 09 '21 12:09 tdaede