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

PDF417: Automated structured append #103

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

uwolfer
Copy link
Contributor

@uwolfer uwolfer commented Feb 17, 2024

Resolves #92

@gredler
Copy link
Collaborator

gredler commented Feb 18, 2024

Thanks, will review this week!

@uwolfer
Copy link
Contributor Author

uwolfer commented Feb 28, 2024

@gredler I have rebased this change and applied slight improvements. Please let me know what you think.

@gredler
Copy link
Collaborator

gredler commented Feb 28, 2024

Will do -- this is high on my to-do list.

@uwolfer
Copy link
Contributor Author

uwolfer commented Feb 28, 2024

FYI, I did now also extensive manual testing. Generated a series of e-tax 27 barcodes with both J4L and Okapi with the same input, and compared the output. All generated barcodes are 100% equal (pixel-by-pixel).

@gredler
Copy link
Collaborator

gredler commented Feb 28, 2024

I'm a little hesitant to coordinate this code review via PR comments, but let's give it a try and see how it goes :-)

One high-level item to start: Can you resolve the conflicts? It looks like I caused a one- or two-line conflict with my recent line ending fix.

@uwolfer uwolfer force-pushed the pdf417-auto-structured-append branch from 6c4e714 to 41b073b Compare February 28, 2024 21:10
@uwolfer
Copy link
Contributor Author

uwolfer commented Feb 28, 2024

Can you resolve the conflicts?

Done.

@uwolfer uwolfer force-pushed the pdf417-auto-structured-append branch from 41b073b to a62060a Compare March 12, 2024 08:18
@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 98.61111% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 87.31%. Comparing base (1a8bfa2) to head (31016ab).

Files Patch % Lines
...apibarcode/backend/Pdf417AutoStructuredAppend.java 98.61% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #103      +/-   ##
============================================
+ Coverage     87.25%   87.31%   +0.05%     
- Complexity     4299     4317      +18     
============================================
  Files            68       69       +1     
  Lines         13934    14006      +72     
  Branches       3254     3264      +10     
============================================
+ Hits          12158    12229      +71     
- Misses         1126     1127       +1     
  Partials        650      650              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@gredler gredler left a comment

Choose a reason for hiding this comment

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

Reviewed original PR last week

@uwolfer uwolfer force-pushed the pdf417-auto-structured-append branch from a62060a to 15dfc47 Compare March 12, 2024 20:10
@uwolfer uwolfer requested a review from gredler March 13, 2024 14:32
@uwolfer uwolfer force-pushed the pdf417-auto-structured-append branch from 15dfc47 to e37ae03 Compare March 13, 2024 20:34
@uwolfer
Copy link
Contributor Author

uwolfer commented Mar 13, 2024

@gredler I have now added more test cases which cover boundary cases, and thus also found & fixes some issues uncovered by these.

@uwolfer uwolfer force-pushed the pdf417-auto-structured-append branch 2 times, most recently from 0d315b4 to 31016ab Compare March 15, 2024 08:40
@uwolfer uwolfer force-pushed the pdf417-auto-structured-append branch from 31016ab to 8242cb9 Compare March 15, 2024 09:01
@gredler
Copy link
Collaborator

gredler commented Mar 15, 2024

I think the PR is looking good! I need to dig into the core of splitData a little more, but I think we're close. In the meantime, can you make a couple of small tweaks?

Let's move the implementation from Pdf417AutoStructuredAppend to Pdf417 itself, at the bottom of the class. I know it's already a long class, but that's the Zint / C code legacy, and we have to tread a fine line between "clean" Java code and not deviating too much from the original code (to make issues easier to diagnose and resolve). The approach (consistent with the original C code) is to have one file / class per symbol, and maintaining that consistency is probably more valuable than making things "cleaner" in one small corner of the code.

The JavaDoc for the byte[] version mentions setContent(byte[]), which is not used. It probably doesn't need to get too specific about how it works under the covers.

I think we can rename plotStructuredAppendSymbols to createStructuredAppendSymbols for consistency with the other methods.

The copyright in the Pdf417AutoStructuredAppendTest file can be changed to your name.

I'll try to check that last little bit in splitData later today!

@uwolfer uwolfer force-pushed the pdf417-auto-structured-append branch from 8242cb9 to 5e139e3 Compare March 15, 2024 15:04
@uwolfer
Copy link
Contributor Author

uwolfer commented Mar 15, 2024

Thanks. Just pushed an update which addresses your comments.

String remainingData = data;
while (!remainingData.isEmpty()) {
int low = 0;
int high = remainingData.length();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gredler Do you think we can limit the high? I.e. is there a way to calculate the maximum ever possible data amount for a specified symbol? That would allow us to optimize performance.

(Adding comment again there in order to make it visible after moving code around.)

@gredler gredler merged commit 44ff244 into woo-j:master Mar 18, 2024
4 checks passed
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.

PDF417: Automated structured append
3 participants