Coverage Report

Created: 2025-08-11 08:01

/src/libjxl/lib/jxl/convolve_symmetric5.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 <algorithm>
7
#include <cstddef>
8
#include <cstdint>
9
#include <cstdio>
10
11
#include "lib/jxl/base/compiler_specific.h"
12
#include "lib/jxl/base/data_parallel.h"
13
#include "lib/jxl/base/status.h"
14
#include "lib/jxl/convolve.h"
15
#include "lib/jxl/image.h"
16
17
#undef HWY_TARGET_INCLUDE
18
#define HWY_TARGET_INCLUDE "lib/jxl/convolve_symmetric5.cc"
19
#include <hwy/foreach_target.h>
20
#include <hwy/highway.h>
21
22
#include "lib/jxl/base/common.h"
23
#include "lib/jxl/base/rect.h"
24
#include "lib/jxl/image_ops.h"
25
26
HWY_BEFORE_NAMESPACE();
27
namespace jxl {
28
namespace HWY_NAMESPACE {
29
30
// These templates are not found via ADL.
31
using hwy::HWY_NAMESPACE::Add;
32
using hwy::HWY_NAMESPACE::Mul;
33
using hwy::HWY_NAMESPACE::Vec;
34
35
// Weighted sum of 1x5 pixels around ix, iy with [wx2 wx1 wx0 wx1 wx2].
36
template <class WrapY>
37
static float WeightedSumBorder(const ImageF& in, const WrapY wrap_y,
38
                               const int64_t ix, const int64_t iy,
39
                               const size_t xsize, const size_t ysize,
40
                               const float wx0, const float wx1,
41
174M
                               const float wx2) {
42
174M
  const WrapMirror wrap_x;
43
174M
  const float* JXL_RESTRICT row = in.ConstRow(wrap_y(iy, ysize));
44
174M
  const float in_m2 = row[wrap_x(ix - 2, xsize)];
45
174M
  const float in_p2 = row[wrap_x(ix + 2, xsize)];
46
174M
  const float in_m1 = row[wrap_x(ix - 1, xsize)];
47
174M
  const float in_p1 = row[wrap_x(ix + 1, xsize)];
48
174M
  const float in_00 = row[ix];
49
174M
  const float sum_2 = wx2 * (in_m2 + in_p2);
50
174M
  const float sum_1 = wx1 * (in_m1 + in_p1);
51
174M
  const float sum_0 = wx0 * in_00;
52
174M
  return sum_2 + (sum_1 + sum_0);
53
174M
}
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_SSE4::WeightedSumBorder<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::WrapMirror, long, long, unsigned long, unsigned long, float, float, float)
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_SSE4::WeightedSumBorder<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::WrapUnchanged, long, long, unsigned long, unsigned long, float, float, float)
convolve_symmetric5.cc:float jxl::N_AVX2::WeightedSumBorder<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::WrapMirror, long, long, unsigned long, unsigned long, float, float, float)
Line
Count
Source
41
2.83M
                               const float wx2) {
42
2.83M
  const WrapMirror wrap_x;
43
2.83M
  const float* JXL_RESTRICT row = in.ConstRow(wrap_y(iy, ysize));
44
2.83M
  const float in_m2 = row[wrap_x(ix - 2, xsize)];
45
2.83M
  const float in_p2 = row[wrap_x(ix + 2, xsize)];
46
2.83M
  const float in_m1 = row[wrap_x(ix - 1, xsize)];
47
2.83M
  const float in_p1 = row[wrap_x(ix + 1, xsize)];
48
2.83M
  const float in_00 = row[ix];
49
2.83M
  const float sum_2 = wx2 * (in_m2 + in_p2);
50
2.83M
  const float sum_1 = wx1 * (in_m1 + in_p1);
51
2.83M
  const float sum_0 = wx0 * in_00;
52
2.83M
  return sum_2 + (sum_1 + sum_0);
53
2.83M
}
convolve_symmetric5.cc:float jxl::N_AVX2::WeightedSumBorder<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::WrapUnchanged, long, long, unsigned long, unsigned long, float, float, float)
Line
Count
Source
41
172M
                               const float wx2) {
42
172M
  const WrapMirror wrap_x;
43
172M
  const float* JXL_RESTRICT row = in.ConstRow(wrap_y(iy, ysize));
44
172M
  const float in_m2 = row[wrap_x(ix - 2, xsize)];
45
172M
  const float in_p2 = row[wrap_x(ix + 2, xsize)];
46
172M
  const float in_m1 = row[wrap_x(ix - 1, xsize)];
47
172M
  const float in_p1 = row[wrap_x(ix + 1, xsize)];
48
172M
  const float in_00 = row[ix];
49
172M
  const float sum_2 = wx2 * (in_m2 + in_p2);
50
172M
  const float sum_1 = wx1 * (in_m1 + in_p1);
51
172M
  const float sum_0 = wx0 * in_00;
52
172M
  return sum_2 + (sum_1 + sum_0);
53
172M
}
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_AVX3::WeightedSumBorder<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::WrapMirror, long, long, unsigned long, unsigned long, float, float, float)
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_AVX3::WeightedSumBorder<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::WrapUnchanged, long, long, unsigned long, unsigned long, float, float, float)
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_AVX3_ZEN4::WeightedSumBorder<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::WrapMirror, long, long, unsigned long, unsigned long, float, float, float)
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_AVX3_ZEN4::WeightedSumBorder<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::WrapUnchanged, long, long, unsigned long, unsigned long, float, float, float)
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_AVX3_SPR::WeightedSumBorder<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::WrapMirror, long, long, unsigned long, unsigned long, float, float, float)
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_AVX3_SPR::WeightedSumBorder<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::WrapUnchanged, long, long, unsigned long, unsigned long, float, float, float)
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_SSE2::WeightedSumBorder<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::WrapMirror, long, long, unsigned long, unsigned long, float, float, float)
Unexecuted instantiation: convolve_symmetric5.cc:float jxl::N_SSE2::WeightedSumBorder<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::WrapUnchanged, long, long, unsigned long, unsigned long, float, float, float)
54
55
template <class WrapY, class V>
56
static V WeightedSum(const ImageF& in, const WrapY wrap_y, const size_t ix,
57
                     const int64_t iy, const size_t ysize, const V wx0,
58
491M
                     const V wx1, const V wx2) {
59
491M
  const HWY_FULL(float) d;
60
491M
  const float* JXL_RESTRICT center = in.ConstRow(wrap_y(iy, ysize)) + ix;
61
491M
  const auto in_m2 = LoadU(d, center - 2);
62
491M
  const auto in_p2 = LoadU(d, center + 2);
63
491M
  const auto in_m1 = LoadU(d, center - 1);
64
491M
  const auto in_p1 = LoadU(d, center + 1);
65
491M
  const auto in_00 = LoadU(d, center);
66
491M
  const auto sum_2 = Mul(wx2, Add(in_m2, in_p2));
67
491M
  const auto sum_1 = Mul(wx1, Add(in_m1, in_p1));
68
491M
  const auto sum_0 = Mul(wx0, in_00);
69
491M
  return Add(sum_2, Add(sum_1, sum_0));
70
491M
}
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_SSE4::Vec128<float, 4ul> jxl::N_SSE4::WeightedSum<jxl::WrapMirror, hwy::N_SSE4::Vec128<float, 4ul> >(jxl::Plane<float> const&, jxl::WrapMirror, unsigned long, long, unsigned long, hwy::N_SSE4::Vec128<float, 4ul>, hwy::N_SSE4::Vec128<float, 4ul>, hwy::N_SSE4::Vec128<float, 4ul>)
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_SSE4::Vec128<float, 4ul> jxl::N_SSE4::WeightedSum<jxl::WrapUnchanged, hwy::N_SSE4::Vec128<float, 4ul> >(jxl::Plane<float> const&, jxl::WrapUnchanged, unsigned long, long, unsigned long, hwy::N_SSE4::Vec128<float, 4ul>, hwy::N_SSE4::Vec128<float, 4ul>, hwy::N_SSE4::Vec128<float, 4ul>)
convolve_symmetric5.cc:hwy::N_AVX2::Vec256<float> jxl::N_AVX2::WeightedSum<jxl::WrapMirror, hwy::N_AVX2::Vec256<float> >(jxl::Plane<float> const&, jxl::WrapMirror, unsigned long, long, unsigned long, hwy::N_AVX2::Vec256<float>, hwy::N_AVX2::Vec256<float>, hwy::N_AVX2::Vec256<float>)
Line
Count
Source
58
5.68M
                     const V wx1, const V wx2) {
59
5.68M
  const HWY_FULL(float) d;
60
5.68M
  const float* JXL_RESTRICT center = in.ConstRow(wrap_y(iy, ysize)) + ix;
61
5.68M
  const auto in_m2 = LoadU(d, center - 2);
62
5.68M
  const auto in_p2 = LoadU(d, center + 2);
63
5.68M
  const auto in_m1 = LoadU(d, center - 1);
64
5.68M
  const auto in_p1 = LoadU(d, center + 1);
65
5.68M
  const auto in_00 = LoadU(d, center);
66
5.68M
  const auto sum_2 = Mul(wx2, Add(in_m2, in_p2));
67
5.68M
  const auto sum_1 = Mul(wx1, Add(in_m1, in_p1));
68
5.68M
  const auto sum_0 = Mul(wx0, in_00);
69
5.68M
  return Add(sum_2, Add(sum_1, sum_0));
70
5.68M
}
convolve_symmetric5.cc:hwy::N_AVX2::Vec256<float> jxl::N_AVX2::WeightedSum<jxl::WrapUnchanged, hwy::N_AVX2::Vec256<float> >(jxl::Plane<float> const&, jxl::WrapUnchanged, unsigned long, long, unsigned long, hwy::N_AVX2::Vec256<float>, hwy::N_AVX2::Vec256<float>, hwy::N_AVX2::Vec256<float>)
Line
Count
Source
58
485M
                     const V wx1, const V wx2) {
59
485M
  const HWY_FULL(float) d;
60
485M
  const float* JXL_RESTRICT center = in.ConstRow(wrap_y(iy, ysize)) + ix;
61
485M
  const auto in_m2 = LoadU(d, center - 2);
62
485M
  const auto in_p2 = LoadU(d, center + 2);
63
485M
  const auto in_m1 = LoadU(d, center - 1);
64
485M
  const auto in_p1 = LoadU(d, center + 1);
65
485M
  const auto in_00 = LoadU(d, center);
66
485M
  const auto sum_2 = Mul(wx2, Add(in_m2, in_p2));
67
485M
  const auto sum_1 = Mul(wx1, Add(in_m1, in_p1));
68
485M
  const auto sum_0 = Mul(wx0, in_00);
69
485M
  return Add(sum_2, Add(sum_1, sum_0));
70
485M
}
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_AVX3::Vec512<float> jxl::N_AVX3::WeightedSum<jxl::WrapMirror, hwy::N_AVX3::Vec512<float> >(jxl::Plane<float> const&, jxl::WrapMirror, unsigned long, long, unsigned long, hwy::N_AVX3::Vec512<float>, hwy::N_AVX3::Vec512<float>, hwy::N_AVX3::Vec512<float>)
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_AVX3::Vec512<float> jxl::N_AVX3::WeightedSum<jxl::WrapUnchanged, hwy::N_AVX3::Vec512<float> >(jxl::Plane<float> const&, jxl::WrapUnchanged, unsigned long, long, unsigned long, hwy::N_AVX3::Vec512<float>, hwy::N_AVX3::Vec512<float>, hwy::N_AVX3::Vec512<float>)
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_AVX3_ZEN4::Vec512<float> jxl::N_AVX3_ZEN4::WeightedSum<jxl::WrapMirror, hwy::N_AVX3_ZEN4::Vec512<float> >(jxl::Plane<float> const&, jxl::WrapMirror, unsigned long, long, unsigned long, hwy::N_AVX3_ZEN4::Vec512<float>, hwy::N_AVX3_ZEN4::Vec512<float>, hwy::N_AVX3_ZEN4::Vec512<float>)
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_AVX3_ZEN4::Vec512<float> jxl::N_AVX3_ZEN4::WeightedSum<jxl::WrapUnchanged, hwy::N_AVX3_ZEN4::Vec512<float> >(jxl::Plane<float> const&, jxl::WrapUnchanged, unsigned long, long, unsigned long, hwy::N_AVX3_ZEN4::Vec512<float>, hwy::N_AVX3_ZEN4::Vec512<float>, hwy::N_AVX3_ZEN4::Vec512<float>)
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_AVX3_SPR::Vec512<float> jxl::N_AVX3_SPR::WeightedSum<jxl::WrapMirror, hwy::N_AVX3_SPR::Vec512<float> >(jxl::Plane<float> const&, jxl::WrapMirror, unsigned long, long, unsigned long, hwy::N_AVX3_SPR::Vec512<float>, hwy::N_AVX3_SPR::Vec512<float>, hwy::N_AVX3_SPR::Vec512<float>)
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_AVX3_SPR::Vec512<float> jxl::N_AVX3_SPR::WeightedSum<jxl::WrapUnchanged, hwy::N_AVX3_SPR::Vec512<float> >(jxl::Plane<float> const&, jxl::WrapUnchanged, unsigned long, long, unsigned long, hwy::N_AVX3_SPR::Vec512<float>, hwy::N_AVX3_SPR::Vec512<float>, hwy::N_AVX3_SPR::Vec512<float>)
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_SSE2::Vec128<float, 4ul> jxl::N_SSE2::WeightedSum<jxl::WrapMirror, hwy::N_SSE2::Vec128<float, 4ul> >(jxl::Plane<float> const&, jxl::WrapMirror, unsigned long, long, unsigned long, hwy::N_SSE2::Vec128<float, 4ul>, hwy::N_SSE2::Vec128<float, 4ul>, hwy::N_SSE2::Vec128<float, 4ul>)
Unexecuted instantiation: convolve_symmetric5.cc:hwy::N_SSE2::Vec128<float, 4ul> jxl::N_SSE2::WeightedSum<jxl::WrapUnchanged, hwy::N_SSE2::Vec128<float, 4ul> >(jxl::Plane<float> const&, jxl::WrapUnchanged, unsigned long, long, unsigned long, hwy::N_SSE2::Vec128<float, 4ul>, hwy::N_SSE2::Vec128<float, 4ul>, hwy::N_SSE2::Vec128<float, 4ul>)
71
72
// Produces result for one pixel
73
template <class WrapY>
74
float Symmetric5Border(const ImageF& in, const int64_t ix, const int64_t iy,
75
34.9M
                       const WeightsSymmetric5& weights) {
76
34.9M
  const float w0 = weights.c[0];
77
34.9M
  const float w1 = weights.r[0];
78
34.9M
  const float w2 = weights.R[0];
79
34.9M
  const float w4 = weights.d[0];
80
34.9M
  const float w5 = weights.L[0];
81
34.9M
  const float w8 = weights.D[0];
82
83
34.9M
  const size_t xsize = in.xsize();
84
34.9M
  const size_t ysize = in.ysize();
85
34.9M
  const WrapY wrap_y;
86
  // Unrolled loop over all 5 rows of the kernel.
87
34.9M
  float sum0 = WeightedSumBorder(in, wrap_y, ix, iy, xsize, ysize, w0, w1, w2);
88
89
34.9M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 2, xsize, ysize, w2, w5, w8);
90
34.9M
  float sum1 =
91
34.9M
      WeightedSumBorder(in, wrap_y, ix, iy + 2, xsize, ysize, w2, w5, w8);
92
93
34.9M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 1, xsize, ysize, w1, w4, w5);
94
34.9M
  sum1 += WeightedSumBorder(in, wrap_y, ix, iy + 1, xsize, ysize, w1, w4, w5);
95
96
34.9M
  return sum0 + sum1;
97
34.9M
}
Unexecuted instantiation: float jxl::N_SSE4::Symmetric5Border<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Unexecuted instantiation: float jxl::N_SSE4::Symmetric5Border<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
float jxl::N_AVX2::Symmetric5Border<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Line
Count
Source
75
566k
                       const WeightsSymmetric5& weights) {
76
566k
  const float w0 = weights.c[0];
77
566k
  const float w1 = weights.r[0];
78
566k
  const float w2 = weights.R[0];
79
566k
  const float w4 = weights.d[0];
80
566k
  const float w5 = weights.L[0];
81
566k
  const float w8 = weights.D[0];
82
83
566k
  const size_t xsize = in.xsize();
84
566k
  const size_t ysize = in.ysize();
85
566k
  const WrapY wrap_y;
86
  // Unrolled loop over all 5 rows of the kernel.
87
566k
  float sum0 = WeightedSumBorder(in, wrap_y, ix, iy, xsize, ysize, w0, w1, w2);
88
89
566k
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 2, xsize, ysize, w2, w5, w8);
90
566k
  float sum1 =
91
566k
      WeightedSumBorder(in, wrap_y, ix, iy + 2, xsize, ysize, w2, w5, w8);
92
93
566k
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 1, xsize, ysize, w1, w4, w5);
94
566k
  sum1 += WeightedSumBorder(in, wrap_y, ix, iy + 1, xsize, ysize, w1, w4, w5);
95
96
566k
  return sum0 + sum1;
97
566k
}
float jxl::N_AVX2::Symmetric5Border<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Line
Count
Source
75
34.4M
                       const WeightsSymmetric5& weights) {
76
34.4M
  const float w0 = weights.c[0];
77
34.4M
  const float w1 = weights.r[0];
78
34.4M
  const float w2 = weights.R[0];
79
34.4M
  const float w4 = weights.d[0];
80
34.4M
  const float w5 = weights.L[0];
81
34.4M
  const float w8 = weights.D[0];
82
83
34.4M
  const size_t xsize = in.xsize();
84
34.4M
  const size_t ysize = in.ysize();
85
34.4M
  const WrapY wrap_y;
86
  // Unrolled loop over all 5 rows of the kernel.
87
34.4M
  float sum0 = WeightedSumBorder(in, wrap_y, ix, iy, xsize, ysize, w0, w1, w2);
88
89
34.4M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 2, xsize, ysize, w2, w5, w8);
90
34.4M
  float sum1 =
91
34.4M
      WeightedSumBorder(in, wrap_y, ix, iy + 2, xsize, ysize, w2, w5, w8);
92
93
34.4M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 1, xsize, ysize, w1, w4, w5);
94
34.4M
  sum1 += WeightedSumBorder(in, wrap_y, ix, iy + 1, xsize, ysize, w1, w4, w5);
95
96
34.4M
  return sum0 + sum1;
97
34.4M
}
Unexecuted instantiation: float jxl::N_AVX3::Symmetric5Border<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Unexecuted instantiation: float jxl::N_AVX3::Symmetric5Border<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Unexecuted instantiation: float jxl::N_AVX3_ZEN4::Symmetric5Border<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Unexecuted instantiation: float jxl::N_AVX3_ZEN4::Symmetric5Border<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Unexecuted instantiation: float jxl::N_AVX3_SPR::Symmetric5Border<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Unexecuted instantiation: float jxl::N_AVX3_SPR::Symmetric5Border<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Unexecuted instantiation: float jxl::N_SSE2::Symmetric5Border<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Unexecuted instantiation: float jxl::N_SSE2::Symmetric5Border<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
98
99
// Produces result for one vector's worth of pixels
100
template <class WrapY>
101
static void Symmetric5Interior(const ImageF& in, const int64_t ix,
102
                               const int64_t rix, const int64_t iy,
103
                               const WeightsSymmetric5& weights,
104
98.2M
                               float* JXL_RESTRICT row_out) {
105
98.2M
  const HWY_FULL(float) d;
106
107
98.2M
  const auto w0 = LoadDup128(d, weights.c);
108
98.2M
  const auto w1 = LoadDup128(d, weights.r);
109
98.2M
  const auto w2 = LoadDup128(d, weights.R);
110
98.2M
  const auto w4 = LoadDup128(d, weights.d);
111
98.2M
  const auto w5 = LoadDup128(d, weights.L);
112
98.2M
  const auto w8 = LoadDup128(d, weights.D);
113
114
98.2M
  const size_t ysize = in.ysize();
115
98.2M
  const WrapY wrap_y;
116
  // Unrolled loop over all 5 rows of the kernel.
117
98.2M
  auto sum0 = WeightedSum(in, wrap_y, ix, iy, ysize, w0, w1, w2);
118
119
98.2M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 2, ysize, w2, w5, w8));
120
98.2M
  auto sum1 = WeightedSum(in, wrap_y, ix, iy + 2, ysize, w2, w5, w8);
121
122
98.2M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 1, ysize, w1, w4, w5));
123
98.2M
  sum1 = Add(sum1, WeightedSum(in, wrap_y, ix, iy + 1, ysize, w1, w4, w5));
124
125
98.2M
  StoreU(Add(sum0, sum1), d, row_out + rix);
126
98.2M
}
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_SSE4::Symmetric5Interior<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_SSE4::Symmetric5Interior<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
convolve_symmetric5.cc:void jxl::N_AVX2::Symmetric5Interior<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Line
Count
Source
104
1.13M
                               float* JXL_RESTRICT row_out) {
105
1.13M
  const HWY_FULL(float) d;
106
107
1.13M
  const auto w0 = LoadDup128(d, weights.c);
108
1.13M
  const auto w1 = LoadDup128(d, weights.r);
109
1.13M
  const auto w2 = LoadDup128(d, weights.R);
110
1.13M
  const auto w4 = LoadDup128(d, weights.d);
111
1.13M
  const auto w5 = LoadDup128(d, weights.L);
112
1.13M
  const auto w8 = LoadDup128(d, weights.D);
113
114
1.13M
  const size_t ysize = in.ysize();
115
1.13M
  const WrapY wrap_y;
116
  // Unrolled loop over all 5 rows of the kernel.
117
1.13M
  auto sum0 = WeightedSum(in, wrap_y, ix, iy, ysize, w0, w1, w2);
118
119
1.13M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 2, ysize, w2, w5, w8));
120
1.13M
  auto sum1 = WeightedSum(in, wrap_y, ix, iy + 2, ysize, w2, w5, w8);
121
122
1.13M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 1, ysize, w1, w4, w5));
123
1.13M
  sum1 = Add(sum1, WeightedSum(in, wrap_y, ix, iy + 1, ysize, w1, w4, w5));
124
125
1.13M
  StoreU(Add(sum0, sum1), d, row_out + rix);
126
1.13M
}
convolve_symmetric5.cc:void jxl::N_AVX2::Symmetric5Interior<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Line
Count
Source
104
97.1M
                               float* JXL_RESTRICT row_out) {
105
97.1M
  const HWY_FULL(float) d;
106
107
97.1M
  const auto w0 = LoadDup128(d, weights.c);
108
97.1M
  const auto w1 = LoadDup128(d, weights.r);
109
97.1M
  const auto w2 = LoadDup128(d, weights.R);
110
97.1M
  const auto w4 = LoadDup128(d, weights.d);
111
97.1M
  const auto w5 = LoadDup128(d, weights.L);
112
97.1M
  const auto w8 = LoadDup128(d, weights.D);
113
114
97.1M
  const size_t ysize = in.ysize();
115
97.1M
  const WrapY wrap_y;
116
  // Unrolled loop over all 5 rows of the kernel.
117
97.1M
  auto sum0 = WeightedSum(in, wrap_y, ix, iy, ysize, w0, w1, w2);
118
119
97.1M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 2, ysize, w2, w5, w8));
120
97.1M
  auto sum1 = WeightedSum(in, wrap_y, ix, iy + 2, ysize, w2, w5, w8);
121
122
97.1M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 1, ysize, w1, w4, w5));
123
97.1M
  sum1 = Add(sum1, WeightedSum(in, wrap_y, ix, iy + 1, ysize, w1, w4, w5));
124
125
97.1M
  StoreU(Add(sum0, sum1), d, row_out + rix);
126
97.1M
}
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3::Symmetric5Interior<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3::Symmetric5Interior<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3_ZEN4::Symmetric5Interior<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3_ZEN4::Symmetric5Interior<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3_SPR::Symmetric5Interior<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3_SPR::Symmetric5Interior<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_SSE2::Symmetric5Interior<jxl::WrapMirror>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_SSE2::Symmetric5Interior<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, long, jxl::WeightsSymmetric5 const&, float*)
127
128
template <class WrapY>
129
static void Symmetric5Row(const ImageF& in, const Rect& rect, const int64_t iy,
130
                          const WeightsSymmetric5& weights,
131
2.23M
                          float* JXL_RESTRICT row_out) {
132
2.23M
  const int64_t kRadius = 2;
133
2.23M
  const size_t xend = rect.x1();
134
135
2.23M
  size_t rix = 0;
136
2.23M
  size_t ix = rect.x0();
137
2.23M
  const HWY_FULL(float) d;
138
2.23M
  const size_t N = Lanes(d);
139
2.23M
  const size_t aligned_x = RoundUpTo(kRadius, N);
140
20.0M
  for (; ix < std::min(aligned_x, xend); ++ix, ++rix) {
141
17.8M
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
142
17.8M
  }
143
100M
  for (; ix + N + kRadius <= xend; ix += N, rix += N) {
144
98.2M
    Symmetric5Interior<WrapY>(in, ix, rix, iy, weights, row_out);
145
98.2M
  }
146
19.3M
  for (; ix < xend; ++ix, ++rix) {
147
17.1M
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
148
17.1M
  }
149
2.23M
}
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_SSE4::Symmetric5Row<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_SSE4::Symmetric5Row<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
convolve_symmetric5.cc:void jxl::N_AVX2::Symmetric5Row<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Line
Count
Source
131
36.6k
                          float* JXL_RESTRICT row_out) {
132
36.6k
  const int64_t kRadius = 2;
133
36.6k
  const size_t xend = rect.x1();
134
135
36.6k
  size_t rix = 0;
136
36.6k
  size_t ix = rect.x0();
137
36.6k
  const HWY_FULL(float) d;
138
36.6k
  const size_t N = Lanes(d);
139
36.6k
  const size_t aligned_x = RoundUpTo(kRadius, N);
140
330k
  for (; ix < std::min(aligned_x, xend); ++ix, ++rix) {
141
293k
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
142
293k
  }
143
1.17M
  for (; ix + N + kRadius <= xend; ix += N, rix += N) {
144
1.13M
    Symmetric5Interior<WrapY>(in, ix, rix, iy, weights, row_out);
145
1.13M
  }
146
309k
  for (; ix < xend; ++ix, ++rix) {
147
272k
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
148
272k
  }
149
36.6k
}
convolve_symmetric5.cc:void jxl::N_AVX2::Symmetric5Row<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Line
Count
Source
131
2.19M
                          float* JXL_RESTRICT row_out) {
132
2.19M
  const int64_t kRadius = 2;
133
2.19M
  const size_t xend = rect.x1();
134
135
2.19M
  size_t rix = 0;
136
2.19M
  size_t ix = rect.x0();
137
2.19M
  const HWY_FULL(float) d;
138
2.19M
  const size_t N = Lanes(d);
139
2.19M
  const size_t aligned_x = RoundUpTo(kRadius, N);
140
19.7M
  for (; ix < std::min(aligned_x, xend); ++ix, ++rix) {
141
17.5M
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
142
17.5M
  }
143
99.3M
  for (; ix + N + kRadius <= xend; ix += N, rix += N) {
144
97.1M
    Symmetric5Interior<WrapY>(in, ix, rix, iy, weights, row_out);
145
97.1M
  }
146
19.0M
  for (; ix < xend; ++ix, ++rix) {
147
16.8M
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
148
16.8M
  }
149
2.19M
}
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3::Symmetric5Row<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3::Symmetric5Row<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3_ZEN4::Symmetric5Row<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3_ZEN4::Symmetric5Row<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3_SPR::Symmetric5Row<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_AVX3_SPR::Symmetric5Row<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_SSE2::Symmetric5Row<jxl::WrapMirror>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
Unexecuted instantiation: convolve_symmetric5.cc:void jxl::N_SSE2::Symmetric5Row<jxl::WrapUnchanged>(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, long, jxl::WeightsSymmetric5 const&, float*)
150
151
// Semi-vectorized (interior pixels Fonly); called directly like slow::, unlike
152
// the fully vectorized strategies below.
153
Status Symmetric5(const ImageF& in, const Rect& in_rect,
154
                  const WeightsSymmetric5& weights, ThreadPool* pool,
155
9.16k
                  ImageF* JXL_RESTRICT out, const Rect& out_rect) {
156
9.16k
  JXL_ENSURE(in_rect.xsize() == out_rect.xsize());
157
9.16k
  JXL_ENSURE(in_rect.ysize() == out_rect.ysize());
158
9.16k
  const size_t ysize = in_rect.ysize();
159
9.16k
  const auto process_row = [&](const uint32_t task,
160
2.23M
                               size_t /*thread*/) -> Status {
161
2.23M
    const int64_t riy = task;
162
2.23M
    const int64_t iy = in_rect.y0() + riy;
163
164
2.23M
    if (iy < 2 || iy >= static_cast<ssize_t>(in.ysize()) - 2) {
165
36.6k
      Symmetric5Row<WrapMirror>(in, in_rect, iy, weights,
166
36.6k
                                out_rect.Row(out, riy));
167
2.19M
    } else {
168
2.19M
      Symmetric5Row<WrapUnchanged>(in, in_rect, iy, weights,
169
2.19M
                                   out_rect.Row(out, riy));
170
2.19M
    }
171
2.23M
    return true;
172
2.23M
  };
Unexecuted instantiation: convolve_symmetric5.cc:jxl::N_SSE4::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)::$_0::operator()(unsigned int, unsigned long) const
convolve_symmetric5.cc:jxl::N_AVX2::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)::$_0::operator()(unsigned int, unsigned long) const
Line
Count
Source
160
2.23M
                               size_t /*thread*/) -> Status {
161
2.23M
    const int64_t riy = task;
162
2.23M
    const int64_t iy = in_rect.y0() + riy;
163
164
2.23M
    if (iy < 2 || iy >= static_cast<ssize_t>(in.ysize()) - 2) {
165
36.6k
      Symmetric5Row<WrapMirror>(in, in_rect, iy, weights,
166
36.6k
                                out_rect.Row(out, riy));
167
2.19M
    } else {
168
2.19M
      Symmetric5Row<WrapUnchanged>(in, in_rect, iy, weights,
169
2.19M
                                   out_rect.Row(out, riy));
170
2.19M
    }
171
2.23M
    return true;
172
2.23M
  };
Unexecuted instantiation: convolve_symmetric5.cc:jxl::N_AVX3::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)::$_0::operator()(unsigned int, unsigned long) const
Unexecuted instantiation: convolve_symmetric5.cc:jxl::N_AVX3_ZEN4::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)::$_0::operator()(unsigned int, unsigned long) const
Unexecuted instantiation: convolve_symmetric5.cc:jxl::N_AVX3_SPR::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)::$_0::operator()(unsigned int, unsigned long) const
Unexecuted instantiation: convolve_symmetric5.cc:jxl::N_SSE2::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)::$_0::operator()(unsigned int, unsigned long) const
173
9.16k
  JXL_RETURN_IF_ERROR(RunOnPool(pool, 0, static_cast<uint32_t>(ysize),
174
9.16k
                                ThreadPool::NoInit, process_row,
175
9.16k
                                "Symmetric5x5Convolution"));
176
9.16k
  return true;
177
9.16k
}
Unexecuted instantiation: jxl::N_SSE4::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)
jxl::N_AVX2::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)
Line
Count
Source
155
9.16k
                  ImageF* JXL_RESTRICT out, const Rect& out_rect) {
156
9.16k
  JXL_ENSURE(in_rect.xsize() == out_rect.xsize());
157
9.16k
  JXL_ENSURE(in_rect.ysize() == out_rect.ysize());
158
9.16k
  const size_t ysize = in_rect.ysize();
159
9.16k
  const auto process_row = [&](const uint32_t task,
160
9.16k
                               size_t /*thread*/) -> Status {
161
9.16k
    const int64_t riy = task;
162
9.16k
    const int64_t iy = in_rect.y0() + riy;
163
164
9.16k
    if (iy < 2 || iy >= static_cast<ssize_t>(in.ysize()) - 2) {
165
9.16k
      Symmetric5Row<WrapMirror>(in, in_rect, iy, weights,
166
9.16k
                                out_rect.Row(out, riy));
167
9.16k
    } else {
168
9.16k
      Symmetric5Row<WrapUnchanged>(in, in_rect, iy, weights,
169
9.16k
                                   out_rect.Row(out, riy));
170
9.16k
    }
171
9.16k
    return true;
172
9.16k
  };
173
9.16k
  JXL_RETURN_IF_ERROR(RunOnPool(pool, 0, static_cast<uint32_t>(ysize),
174
9.16k
                                ThreadPool::NoInit, process_row,
175
9.16k
                                "Symmetric5x5Convolution"));
176
9.16k
  return true;
177
9.16k
}
Unexecuted instantiation: jxl::N_AVX3::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)
Unexecuted instantiation: jxl::N_AVX3_ZEN4::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)
Unexecuted instantiation: jxl::N_AVX3_SPR::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)
Unexecuted instantiation: jxl::N_SSE2::Symmetric5(jxl::Plane<float> const&, jxl::RectT<unsigned long> const&, jxl::WeightsSymmetric5 const&, jxl::ThreadPool*, jxl::Plane<float>*, jxl::RectT<unsigned long> const&)
178
179
// NOLINTNEXTLINE(google-readability-namespace-comments)
180
}  // namespace HWY_NAMESPACE
181
}  // namespace jxl
182
HWY_AFTER_NAMESPACE();
183
184
#if HWY_ONCE
185
namespace jxl {
186
187
HWY_EXPORT(Symmetric5);
188
Status Symmetric5(const ImageF& in, const Rect& in_rect,
189
                  const WeightsSymmetric5& weights, ThreadPool* pool,
190
9.16k
                  ImageF* JXL_RESTRICT out, const Rect& out_rect) {
191
9.16k
  return HWY_DYNAMIC_DISPATCH(Symmetric5)(in, in_rect, weights, pool, out,
192
9.16k
                                          out_rect);
193
9.16k
}
194
195
}  // namespace jxl
196
#endif  // HWY_ONCE