-
Notifications
You must be signed in to change notification settings - Fork 460
[FEAT] Add bitstream
module in lib_ccxr
#1649
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
base: master
Are you sure you want to change the base?
[FEAT] Add bitstream
module in lib_ccxr
#1649
Conversation
src/lib_ccx/cc_bitstream.h
Outdated
@@ -25,6 +24,9 @@ struct bitstream | |||
// increased by the calling function, or not. | |||
unsigned char *_i_pos; | |||
int _i_bpos; | |||
#ifndef DISABLE_RUST | |||
void *rust_bs; // Pointer to Rust's Bitstream struct |
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.
Could we construct / deconstruct the struct when passing to rust instead of storing a different pointer?
There are other files, where you can see the to_ctype()
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.
yaa surely, this should be a better approach rather than having to maintain two structures. I will try to fix it in my next commit
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.
@prateekmedia , I have made changes in the bitstream.rs
file , can you please review it now
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.
will check this.
Migration module changes
Minor Formatting Issue
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 5b327c7...:
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. |
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 407d0f4...:
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. |
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.
Pull Request Overview
This PR adds a new bitstream
module implemented in Rust and connects it to the existing C code via FFI.
- Introduces Rust-side bitstream functions and exposes them through the C wrapper
- Updates C bitstream implementation to delegate to Rust when
DISABLE_RUST
is not defined - Adjusts tests and build configuration to include the new module
Reviewed Changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/rust/wrapper.h | Includes the C header for bitstream to expose FFI |
src/rust/src/libccxr_exports/mod.rs | Registers the bitstream export module |
src/rust/lib_ccxr/src/util/bits.rs | Refactors parity tests to use assert! |
src/rust/lib_ccxr/src/common/mod.rs | Adds bitstream to the common mod exports |
src/rust/build.rs | Links the bitstream library into the build script |
src/lib_ccx/cc_bitstream.c | Wraps the C implementation to call into Rust |
Comments suppressed due to low confidence (3)
src/lib_ccx/cc_bitstream.c:238
- The function signature returns
unsigned char *
but the Rust FFIccxr_next_bytes
exports aconst uint8_t *
. Consider updating this toconst unsigned char *
to preserve theconst
qualifier and avoid discarding it.
bstr->bpos = 8;
src/rust/wrapper.h:14
- wrapper.h includes the C header for bitstream but does not declare the extern
ccxr_*
functions provided by the Rust bitstream module, so consumers won’t see the Rust FFI symbols. Consider adding extern declarations for eachccxr_*
function in this header.
#include "../lib_ccx/cc_bitstream.h"
src/rust/build.rs:30
- The
bitstream
entry may not match the actual C library name produced (likely something likeccx_bitstream
or part of the existingccx
library), which could cause linker errors. Verify that the linked library name matches the compiled archive.
"bitstream",
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
This PR migrates the bitstream functionality from C to Rust while maintaining backward compatibility by creating a new Rust implementation in
lib_ccxr/src/common/bitstream.rs
and connecting it to the existing C code through FFI bindings.