// 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.
// Adapters for DCT input/output: from/to contiguous blocks or image rows.
// These templates are not found via ADL. using hwy::HWY_NAMESPACE::Vec;
// Block: (x, y) <-> (N * y + x) // Lines: (x, y) <-> (stride * y + x) // // I.e. Block is a specialization of Lines with fixed stride. // // FromXXX should implement Read and Load (Read vector). // ToXXX should implement Write and Store (Write vector).
template <size_t N> using BlockDesc = HWY_CAPPED(float, N);
// Here and in the following, the SZ template parameter specifies the number of // values to load/store. Needed because we want to handle 4x4 sub-blocks of // 16x16 blocks. class DCTFrom { public:
DCTFrom(constfloat* data, size_t stride) : stride_(stride), data_(data) {}
template <typename D>
HWY_INLINE Vec<D> LoadPart(D /* tag */, const size_t row, size_t i) const {
JXL_DASSERT(Lanes(D()) <= stride_); // Since these functions are used also for DC, no alignment at all is // guaranteed in the case of floating blocks. // TODO(veluca): consider using a different class for DC-to-LF and // DC-from-LF, or copying DC values to/from a temporary aligned location. return LoadU(D(), Address(row, i));
}
template <typename D>
HWY_INLINE void StorePart(D /* tag */, const Vec<D>& v, const size_t row,
size_t i) const {
JXL_DASSERT(Lanes(D()) <= stride_); // Since these functions are used also for DC, no alignment at all is // guaranteed in the case of floating blocks. // TODO(veluca): consider using a different class for DC-to-LF and // DC-from-LF, or copying DC values to/from a temporary aligned location.
StoreU(v, D(), Address(row, i));
}
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.