| 2639 | } |
| 2640 | |
| 2641 | inline void sendCode(long long sCode, int runCount, long long runCode, |
| 2642 | long long &c, int &lc, char *&out) { |
| 2643 | // |
| 2644 | // Output a run of runCount instances of the symbol sCount. |
| 2645 | // Output the symbols explicitly, or if that is shorter, output |
| 2646 | // the sCode symbol once followed by a runCode symbol and runCount |
| 2647 | // expressed as an 8-bit number. |
| 2648 | // |
| 2649 | |
| 2650 | if (hufLength(sCode) + hufLength(runCode) + 8 < hufLength(sCode) * runCount) { |
| 2651 | outputCode(sCode, c, lc, out); |
| 2652 | outputCode(runCode, c, lc, out); |
| 2653 | outputBits(8, runCount, c, lc, out); |
| 2654 | } else { |
| 2655 | while (runCount-- >= 0) outputCode(sCode, c, lc, out); |
| 2656 | } |
| 2657 | } |
| 2658 | |
| 2659 | // |
| 2660 | // Encode (compress) ni values based on the Huffman encoding table hcode: |
no test coverage detected