-
Notifications
You must be signed in to change notification settings - Fork 11
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
Improve testability and add tests to the way that blocks of coefficients are encoded #69
Conversation
…ble across all platforms
LGTM |
Yeah that’s a dumb name agree
@Melirius commented on this pull request.
In src/structs/lepton_decoder.rs <#69 (comment)> :
@@ -289,30 +289,49 @@ fn parse_token<R: Read, const ALL_PRESENT: bool>(
) -> Result<()> {
debug_assert!(pt.is_all_present() == ALL_PRESENT);
+ let neighbors =
+ context.get_neighbor_data::<ALL_PRESENT>(image_data, context, num_non_zeros, pt);
What about renaming num_non_zeros? It is not the only and not even the main component of NeighborSummary.
|
src/structs/probability_tables.rs
Outdated
@@ -92,17 +91,16 @@ impl ProbabilityTables { | |||
|
|||
pub fn calc_non_zero_counts_context_7x7<const ALL_PRESENT: bool>( |
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.
I think: what if rename this to calc_non_zero_counts_predictor_7x7
or smth like that and return num_non_zeros_above << 1
, num_non_zeros_left << 1
or num_non_zeros_above + num_non_zeros_left
. Then by extending array NON_ZERO_TO_BIN
to 100 bytes we can reduce number of operations per coefficient.
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.
We can even return bin directly from here.
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.
I'll separate this in another change... better to separate refactoring from functional changes
Nice! |
Co-authored-by: Ivan Siutsou <[email protected]> Signed-off-by: Kristof Roomp <[email protected]>
This reverts commit a29377b.
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.
Perfect!
add read_coefficients and write_coefficients that encapsulate the read/write process and can be testing individually without pulling in the world.
This also allows for testing with hardcoded known good values to make it easier to catch any subtle changes that could cause backwards compat issues.