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

Return the error-counter from the decoding #24

Open
ingfra opened this issue Nov 22, 2018 · 1 comment
Open

Return the error-counter from the decoding #24

ingfra opened this issue Nov 22, 2018 · 1 comment

Comments

@ingfra
Copy link

ingfra commented Nov 22, 2018

@msva
For auto-detecting the best illumination of the barcode-image (by the "business" S/W) it would be nice to return the error-counter from the decoding, eg (and removing the non-used argument "fix"):

  • dmtxreedsol.c
extern DmtxPassFail 
//RsDecode(unsigned char *code, int sizeIdx, int fix)
RsDecode(unsigned char *code, int sizeIdx, int* errorCount )
...
         repairable = RsFindErrorLocatorPoly(&elp, &syn, blockErrorWords, blockMaxCorrectable, errorCount );

-> where:

static DmtxBoolean
RsFindErrorLocatorPoly(DmtxByteList *elpOut, const DmtxByteList *syn, int errorWordCount, int maxCorrectable, int* errors )
...
   // The number of error codewords aded as an output parameter
   *errors = lambda;

   return (lambda <= maxCorrectable) ? DmtxTrue : DmtxFalse;
}
@ingfra
Copy link
Author

ingfra commented Nov 29, 2018

Maybe keeping the API and just "wrap" with a new function, eg:

extern DmtxPassFail 
RsDecode(unsigned char *code, int sizeIdx, int fix)
{
    return RsDecodeX(code, sizeIdx, null);
}
extern DmtxPassFail 
RsDecodeX(unsigned char *code, int sizeIdx, int* errorCount )
{
...
         repairable = RsFindErrorLocatorPoly(&elp, &syn, blockErrorWords, blockMaxCorrectable, errorCount );
:::
static DmtxBoolean
RsFindErrorLocatorPoly(DmtxByteList *elpOut, const DmtxByteList *syn, int errorWordCount, int maxCorrectable, int* errors )
...
   // The number of error codewords aded as an output parameter
  if (errors != null) 
     *errors = lambda;
:::

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

No branches or pull requests

1 participant