Coverage Report

Created: 2025-06-13 06:51

/src/libjxl/lib/jxl/simd_util.cc
Line
Count
Source
1
// Copyright (c) the JPEG XL Project Authors. All rights reserved.
2
//
3
// Use of this source code is governed by a BSD-style
4
// license that can be found in the LICENSE file.
5
6
#include "lib/jxl/simd_util.h"
7
8
#include <cstddef>
9
10
#undef HWY_TARGET_INCLUDE
11
#define HWY_TARGET_INCLUDE "lib/jxl/simd_util.cc"
12
#include <hwy/foreach_target.h>
13
#include <hwy/highway.h>
14
15
HWY_BEFORE_NAMESPACE();
16
namespace jxl {
17
namespace HWY_NAMESPACE {
18
19
3.82M
size_t MaxVectorSize() {
20
3.82M
  HWY_FULL(float) df;
21
3.82M
  return Lanes(df) * sizeof(float);
22
3.82M
}
jxl::N_SSE4::MaxVectorSize()
Line
Count
Source
19
1.06M
size_t MaxVectorSize() {
20
1.06M
  HWY_FULL(float) df;
21
1.06M
  return Lanes(df) * sizeof(float);
22
1.06M
}
jxl::N_AVX2::MaxVectorSize()
Line
Count
Source
19
1.61M
size_t MaxVectorSize() {
20
1.61M
  HWY_FULL(float) df;
21
1.61M
  return Lanes(df) * sizeof(float);
22
1.61M
}
jxl::N_SSE2::MaxVectorSize()
Line
Count
Source
19
1.14M
size_t MaxVectorSize() {
20
1.14M
  HWY_FULL(float) df;
21
1.14M
  return Lanes(df) * sizeof(float);
22
1.14M
}
23
24
// NOLINTNEXTLINE(google-readability-namespace-comments)
25
}  // namespace HWY_NAMESPACE
26
}  // namespace jxl
27
HWY_AFTER_NAMESPACE();
28
29
#if HWY_ONCE
30
namespace jxl {
31
32
HWY_EXPORT(MaxVectorSize);
33
34
3.82M
size_t MaxVectorSize() {
35
  // Ideally HWY framework should provide us this value.
36
  // Less than ideal is to check all available targets and choose maximal.
37
  // As for now, we just ask current active target, assuming it won't change.
38
3.82M
  return HWY_DYNAMIC_DISPATCH(MaxVectorSize)();
39
3.82M
}
40
41
}  // namespace jxl
42
#endif