-
Notifications
You must be signed in to change notification settings - Fork 539
Port hardsubx imgops #1439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port hardsubx imgops #1439
Conversation
also make preprocessor to not allow compilation of hardsubx_imgops if WITHOUT_RUST is OFF
|
PR updated |
PunitLodha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fix the formatting issues by using rustfmt and clang-format
|
Please check now @PunitLodha Also note that, the code now is mathematically different for the Source: |
The function in Rust behaves slightly differently than its C counterpart
76178df to
dcd6d8a
Compare
…tements because of build rust compiler issues
|
@PunitLodha The result is definitely different from the original C code I believe the new version is leading to slightly less hallucinations when it comes to lines which sort of make sense in the result. I don't have a good metric as of now. Ps: Also it seems the rust compiler does not support deconstruction on left side in assignment statements because it worked on my system but not in the checks, so I just converted and committed |
This is expected. Once we update the preprocessing code, we should be seeing better results than before
This is because the tests use rust 1.56.0, and destructuring was added in 1.59.0 |
PunitLodha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the formatting, https://github.com/CCExtractor/ccextractor/runs/6866810135?check_suite_focus=true
Always make sure that the CI checks are not failing
src/rust/src/lib.rs
Outdated
| #![allow(non_camel_case_types)] | ||
| #![allow(non_snake_case)] | ||
|
|
||
| extern crate palette; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need of extern crate in Rust 2018, https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html#no-more-extern-crate
I wanted to ask about that actually. I ran clang formatter, which one should I use then? |
Co-authored-by: Punit Lodha <48253287+PunitLodha@users.noreply.github.com>
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
On determination that the imgops functions have lowest dependency and need to be used as-is, that is where I have begun porting.
The PR introduces (as of now) a function with an identical signature to
rgb_to_hsvwith rest of the code unchanged. TheDISABLE_RUSTflag is used to decide if the Rust version is compiled or the C version.Edit: hardsubx_imgops is now fully ported
The compilation works and the executable runs properly on the files I have. However, the who suite of tests must be run as soon as the
imgopsmodule is ported.Ps: I discovered that when building using
cmake, Rust compilation is disabled by default and I had to explicitly set theDWITHOUT_RUST=OFFI am unsure if this is the expected behaviour.
Edit: apparently this is because cmake caches options
Cc: @PunitLodha, @cfsmp3
please look this over once to check if I am not doing something obviously dangerous. I will continue after feedback.