Skip to content
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

[FEATURE] Port 708 decoder encoding module to RUST #1607

Conversation

IshanGrover2004
Copy link
Contributor

@IshanGrover2004 IshanGrover2004 commented Apr 19, 2024

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

I have migrated the logic and functions from the lib_ccx/ccx_decoder_708_encoding.c file to Rust, located in decoder/encoding.rs. This conversion maintains the same functionality that was originally written in C, now implemented in Rust.

To know more See ccx_decoder_708_encoding.c and compare with File Changed in PR, they are both same

Background & Testing

  • Current codebase scenerio: Only C code of ccx_decoder_708_encoding.c file is available. So while making & running Rust test cases which requires these functions do not have body because cargo test is just seeing the rust code only.
  • After PR changes: Exact same logic of rust code will be there. And I did also added the conditional compilation so that if user build with -without-rust then only C code will work or else Rust code will build. And Yes I have manually tested that when compiling with rust src files, rust code is being used and giving the same result.

Copy link
Contributor

@thealphadollar thealphadollar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution.

Please wait for review from @cfsmp3

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 2ada36d...:

Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 4/7
DVD 3/3
DVR-MS 2/2
General 24/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 85/86
Teletext 21/21
WTV 13/13
XDS 34/34

All tests passing on the master branch were passed completely.

NOTE: The following tests have been failing on the master branch as well as the PR:

  • ccextractor --autoprogram --out=srt --latin1 85271be4d2..., Last passed: Never
  • ccextractor --stdout --quiet --no-fontcolor 79a51f3500..., Last passed: Never
  • ccextractor --stdout --quiet --no-fontcolor 767b546f96..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 1974a299f0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 132d7df7e9..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 99e5eaafdc..., Last passed: Never
  • ccextractor --capfile /repository/Dictionary/MattS_dictionary.txt c83f765c66..., Last passed: Never

Congratulations: Merging this PR would fix the following tests:


Check the result page for more info.

@prateekmedia prateekmedia requested a review from PunitLodha May 19, 2024 11:27
Copy link
Member

@PunitLodha PunitLodha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the rust extern functions automatically picked up by C because they have the same name? I remember having to define extern fn ... in C and then having to call it like this,

#ifndef DISABLE_RUST
	// Use rust function here
#else
	// Use C function here
#endif

Is that not needed?

src/rust/src/decoder/encoding.rs Outdated Show resolved Hide resolved
@PunitLodha
Copy link
Member

@prateekmedia Any idea why Windows is failing here?

@IshanGrover2004
Copy link
Contributor Author

IshanGrover2004 commented May 26, 2024

@PunitLodha You can go on for merge if you find correct, btw this method of having same name is working, I have checked it

And another thing I have also Enable the default_feature of bindgen bcs this becomes useful while developing in Rust & also used in next PRs as well

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 5748042...:

Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 4/7
DVD 3/3
DVR-MS 2/2
General 24/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 84/86
Teletext 21/21
WTV 9/13
XDS 34/34

All tests passing on the master branch were passed completely.

NOTE: The following tests have been failing on the master branch as well as the PR:

Congratulations: Merging this PR would fix the following tests:


Check the result page for more info.

@PunitLodha PunitLodha merged commit d6ccf1b into CCExtractor:master May 29, 2024
12 of 17 checks passed
IshanGrover2004 added a commit to IshanGrover2004/ccextractor-fork that referenced this pull request May 29, 2024
* feat: Add `decoder/encoding` new module

This `decoder/encoding.rs` file will contain the content of
`lib_ccx/ccx_708_decoder_encoding.c` file

* feat: Add encoding functions

* feat: Add conditional compilation to include Rust functions

* fix: conditional compilation logic

* refactor: Use of match statement instead of if-else

* fix: Calling C function for rust

* feat: Enable `derive_default` feature
IshanGrover2004 added a commit to IshanGrover2004/ccextractor-fork that referenced this pull request May 29, 2024
* feat: Add `decoder/encoding` new module

This `decoder/encoding.rs` file will contain the content of
`lib_ccx/ccx_708_decoder_encoding.c` file

* feat: Add encoding functions

* feat: Add conditional compilation to include Rust functions

* fix: conditional compilation logic

* refactor: Use of match statement instead of if-else

* fix: Calling C function for rust

* feat: Enable `derive_default` feature
@IshanGrover2004 IshanGrover2004 deleted the feature/708-decoder-encoding-module branch May 29, 2024 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants