| 2783 | } |
| 2784 | |
| 2785 | inline void sendCode(long long sCode, int runCount, long long runCode, |
| 2786 | long long &c, int &lc, char *&out) { |
| 2787 | // |
| 2788 | // Output a run of runCount instances of the symbol sCount. |
| 2789 | // Output the symbols explicitly, or if that is shorter, output |
| 2790 | // the sCode symbol once followed by a runCode symbol and runCount |
| 2791 | // expressed as an 8-bit number. |
| 2792 | // |
| 2793 | |
| 2794 | if (hufLength(sCode) + hufLength(runCode) + 8 < hufLength(sCode) * runCount) { |
| 2795 | outputCode(sCode, c, lc, out); |
| 2796 | outputCode(runCode, c, lc, out); |
| 2797 | outputBits(8, runCount, c, lc, out); |
| 2798 | } else { |
| 2799 | while (runCount-- >= 0) outputCode(sCode, c, lc, out); |
| 2800 | } |
| 2801 | } |
| 2802 | |
| 2803 | // |
| 2804 | // Encode (compress) ni values based on the Huffman encoding table hcode: |
no test coverage detected