// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.
// These templates are not found via ADL. using hwy::HWY_NAMESPACE::And; using hwy::HWY_NAMESPACE::AndNot; using hwy::HWY_NAMESPACE::ApproximateReciprocal; using hwy::HWY_NAMESPACE::Gt; using hwy::HWY_NAMESPACE::IfThenElse; using hwy::HWY_NAMESPACE::IfThenElseZero; using hwy::HWY_NAMESPACE::Lt; using hwy::HWY_NAMESPACE::Rebind; using hwy::HWY_NAMESPACE::Vec; using hwy::HWY_NAMESPACE::Xor;
// If |x| is 1, kZeroBias creates a different bias for each channel. // We're implementing the following: // if (quant == 0) return 0; // if (quant == 1) return biases[c]; // if (quant == -1) return -biases[c]; // return quant - biases[3] / quant;
// Integer comparison is not helpful because Clang incurs bypass penalties // from unnecessarily mixing integer and float. constauto is_01 = Lt(abs_quant, Set(df, 1.125f)); constauto not_0 = Gt(abs_quant, Zero(df));
// Bitwise logic is faster than quant * biases[c]. constauto one_bias = IfThenElseZero(not_0, Xor(Set(df, biases[c]), sign));
// About 2E-5 worse than ReciprocalNR or division. constauto bias =
NegMulAdd(Set(df, biases[3]), ApproximateReciprocal(quant), quant);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.