write j bits into the bit stream, ignoring frame headers
(final LameInternalFlags gfc, final int val, int j)
| 131 | * write j bits into the bit stream, ignoring frame headers |
| 132 | */ |
| 133 | private void putbits_noheaders(final LameInternalFlags gfc, final int val, |
| 134 | int j) { |
| 135 | assert (j < MAX_LENGTH - 2); |
| 136 | |
| 137 | while (j > 0) { |
| 138 | int k; |
| 139 | if (bufBitIdx == 0) { |
| 140 | bufBitIdx = 8; |
| 141 | bufByteIdx++; |
| 142 | assert (bufByteIdx < Lame.LAME_MAXMP3BUFFER); |
| 143 | buf[bufByteIdx] = 0; |
| 144 | } |
| 145 | |
| 146 | k = Math.min(j, bufBitIdx); |
| 147 | j -= k; |
| 148 | |
| 149 | bufBitIdx -= k; |
| 150 | |
| 151 | assert (j < MAX_LENGTH); /* 32 too large on 32 bit machines */ |
| 152 | assert (bufBitIdx < MAX_LENGTH); |
| 153 | |
| 154 | buf[bufByteIdx] |= ((val >> j) << bufBitIdx); |
| 155 | totbit += k; |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Some combinations of bitrate, Fs, and stereo make it impossible to stuff |