Fixed rust capi RuntimeParams struct default value. #607
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why do this changes
When I use the C API, the audio noise reduction effect is different from the binary execution effect downloaded from the github release page.
Finding the difference
I carefully compared the implementation of the following two files:
libDF/src/bin/enhance_wav.rs
libDF/src/capi.rs
I found that RuntimeParams did not initialize all parameters in the
capi.rs
file. It only publish two functions,df_set_atten_lim()
anddf_set_post_filter_beta()
, to set the values ofatten_lim_db
andpost_filter_beta
in RuntimeParams.In the
enhance_wav.rs
file, the command parser default_value_t is used to assign initial values to each member variable of struct RuntimeParams.enhance_wav.rs RuntimeParams default value:
Currently(before this pull requests) capi.rs RuntimeParams's default value:
reference link: libDF/src/tract.rs#L176C1-L187C6