MCPcopy Create free account
hub / github.com/aff3ct/aff3ct / _process

Method _process

src/Module/Quantizer/Custom/Quantizer_custom.cpp:203–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201
202template<typename R, typename Q>
203void
204Quantizer_custom<R, Q>::_process(const R* Y_N1, Q* Y_N2, const size_t /*frame_id*/)
205{
206 const auto size = (unsigned)(this->N);
207
208 if (delta_inv == (R)0)
209 {
210 std::vector<R> tmp(size);
211 R avg = 0;
212 for (unsigned i = 0; i < size; i++)
213 {
214 tmp[i] = std::abs(Y_N1[i]);
215 avg += tmp[i];
216 }
217 avg /= tmp.size();
218 std::sort(tmp.begin(), tmp.end());
219
220 delta_inv = (R)1.0 / ((R)std::abs(tmp[(tmp.size() / 10) * 8]) / (R)val_max);
221 }
222
223 for (unsigned i = 0; i < size; i++)
224 Y_N2[i] = (Q)spu::tools::saturate(std::round(Y_N1[i] * delta_inv), (R)val_min, (R)val_max);
225}
226
227// ==================================================================================== explicit template instantiation
228#include "Tools/types.h"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected