| 150 | void WriteBand_Fmt0(Encoder &enc, int32_t colIndex, uint32_t formatId) {} |
| 151 | |
| 152 | void WriteBand_Fmt3_16(Encoder &enc, int32_t colIndex, uint32_t formatId) { |
| 153 | const float currBlockValue = float(enc.m_currBlockBitValue); |
| 154 | const float halfCurrBlockValue = currBlockValue * 0.5f; |
| 155 | const int32_t minValue = (int32_t)ceilf(-32767.0f / currBlockValue); |
| 156 | const int32_t maxValue = (int32_t)floorf(32767.0f / currBlockValue); |
| 157 | |
| 158 | float *pColumnData = &enc.m_levelSlots[enc.m_levels][colIndex]; |
| 159 | for (int32_t i = 0; i < enc.m_samples_per_subband; ++i) { |
| 160 | int32_t val = (int32_t)floorf((*pColumnData + halfCurrBlockValue) / currBlockValue); |
| 161 | if (minValue > val) { |
| 162 | val = minValue; |
| 163 | } else if (val > maxValue) { |
| 164 | val = maxValue; |
| 165 | } |
| 166 | |
| 167 | pColumnData += enc.m_numColumns; |
| 168 | enc.m_bits.WriteBits(val + (1 << (formatId - 1)), formatId); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | void WriteBand_Fmt17(Encoder &enc, int32_t colIndex, uint32_t formatId) { |
| 173 | const float currBitValue = static_cast<float>(enc.m_currBlockBitValue); |