When encoding a a 2D Datamatrix barcode, I want the smallest output size. There are means to encode a compressed a string using some methods like C40. Reference:
Here's a reference: https://en.wikipedia.org/wiki/Data_Matrix#Text_modes
Some sections of the string will compress more efficiently than others depending on the encoding method.
To be clear, I'm not trying to make my own compression scheme.
I want to compute the best combination of existing compression schemes. For example, I can individually use Ascii or C40 to encode an entire string. Each scheme has its unique benefits.
BUT I can also compress specific parts of the string with different schemes. So, switching back and forth between Ascii and C40 can result in a more efficient compression than C40 or Ascii alone.
QUESTION: How do I optimize the selection of compression schemes for section of the input string. I would be comfortable narrowing it down to only combining c40 and ascii.
Are there any algorithms for scanning strings and and optimizing the result?