| 2713 | } |
| 2714 | |
| 2715 | inline void sendCode(long long sCode, int runCount, long long runCode, |
| 2716 | long long &c, int &lc, char *&out) { |
| 2717 | // |
| 2718 | // Output a run of runCount instances of the symbol sCount. |
| 2719 | // Output the symbols explicitly, or if that is shorter, output |
| 2720 | // the sCode symbol once followed by a runCode symbol and runCount |
| 2721 | // expressed as an 8-bit number. |
| 2722 | // |
| 2723 | |
| 2724 | if (hufLength(sCode) + hufLength(runCode) + 8 < hufLength(sCode) * runCount) { |
| 2725 | outputCode(sCode, c, lc, out); |
| 2726 | outputCode(runCode, c, lc, out); |
| 2727 | outputBits(8, runCount, c, lc, out); |
| 2728 | } else { |
| 2729 | while (runCount-- >= 0) outputCode(sCode, c, lc, out); |
| 2730 | } |
| 2731 | } |
| 2732 | |
| 2733 | // |
| 2734 | // Encode (compress) ni values based on the Huffman encoding table hcode: |
no test coverage detected