Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/jpeg-xl/lib/jxl/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Quelle  dct_block-inl.h   Sprache: C

 
// 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.

#if defined(LIB_JXL_DCT_BLOCK_INL_H_) == defined(HWY_TARGET_TOGGLE)
#ifdef LIB_JXL_DCT_BLOCK_INL_H_
#undef LIB_JXL_DCT_BLOCK_INL_H_
#else
#define LIB_JXL_DCT_BLOCK_INL_H_
#endif

#include <stddef.h>

#include <hwy/highway.h>

#include "lib/jxl/base/status.h"
HWY_BEFORE_NAMESPACE();
namespace jxl {
namespace HWY_NAMESPACE {
namespace {

// 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(const float* 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));
  }

  HWY_INLINE float Read(const size_t row, const size_t i) const {
    return *Address(row, i);
  }

  constexpr HWY_INLINE const float* Address(const size_t row,
                                            const size_t i) const {
    return data_ + row * stride_ + i;
  }

  size_t Stride() const { return stride_; }

 private:
  size_t stride_;
  const float* JXL_RESTRICT data_;
};

class DCTTo {
 public:
  DCTTo(float* data, size_t stride) : stride_(stride), data_(data) {}

  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));
  }

  HWY_INLINE void Write(float v, const size_t row, const size_t i) const {
    *Address(row, i) = v;
  }

  constexpr HWY_INLINE float* Address(const size_t row, const size_t i) const {
    return data_ + row * stride_ + i;
  }

  size_t Stride() const { return stride_; }

 private:
  size_t stride_;
  float* JXL_RESTRICT data_;
};

}  // namespace
// NOLINTNEXTLINE(google-readability-namespace-comments)
}  // namespace HWY_NAMESPACE
}  // namespace jxl
HWY_AFTER_NAMESPACE();

#endif  // LIB_JXL_DCT_BLOCK_INL_H_

Messung V0.5
C=95 H=94 G=94

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.