Coverage Report

Created: 2025-12-31 07:53

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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
375M
                               const float wx2) {
42
375M
  const WrapMirror wrap_x;
43
375M
  const float* JXL_RESTRICT row = in.ConstRow(wrap_y(iy, ysize));
44
375M
  const float in_m2 = row[wrap_x(ix - 2, xsize)];
45
375M
  const float in_p2 = row[wrap_x(ix + 2, xsize)];
46
375M
  const float in_m1 = row[wrap_x(ix - 1, xsize)];
47
375M
  const float in_p1 = row[wrap_x(ix + 1, xsize)];
48
375M
  const float in_00 = row[ix];
49
375M
  const float sum_2 = wx2 * (in_m2 + in_p2);
50
375M
  const float sum_1 = wx1 * (in_m1 + in_p1);
51
375M
  const float sum_0 = wx0 * in_00;
52
375M
  return sum_2 + (sum_1 + sum_0);
53
375M
}
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
5.28M
                               const float wx2) {
42
5.28M
  const WrapMirror wrap_x;
43
5.28M
  const float* JXL_RESTRICT row = in.ConstRow(wrap_y(iy, ysize));
44
5.28M
  const float in_m2 = row[wrap_x(ix - 2, xsize)];
45
5.28M
  const float in_p2 = row[wrap_x(ix + 2, xsize)];
46
5.28M
  const float in_m1 = row[wrap_x(ix - 1, xsize)];
47
5.28M
  const float in_p1 = row[wrap_x(ix + 1, xsize)];
48
5.28M
  const float in_00 = row[ix];
49
5.28M
  const float sum_2 = wx2 * (in_m2 + in_p2);
50
5.28M
  const float sum_1 = wx1 * (in_m1 + in_p1);
51
5.28M
  const float sum_0 = wx0 * in_00;
52
5.28M
  return sum_2 + (sum_1 + sum_0);
53
5.28M
}
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
370M
                               const float wx2) {
42
370M
  const WrapMirror wrap_x;
43
370M
  const float* JXL_RESTRICT row = in.ConstRow(wrap_y(iy, ysize));
44
370M
  const float in_m2 = row[wrap_x(ix - 2, xsize)];
45
370M
  const float in_p2 = row[wrap_x(ix + 2, xsize)];
46
370M
  const float in_m1 = row[wrap_x(ix - 1, xsize)];
47
370M
  const float in_p1 = row[wrap_x(ix + 1, xsize)];
48
370M
  const float in_00 = row[ix];
49
370M
  const float sum_2 = wx2 * (in_m2 + in_p2);
50
370M
  const float sum_1 = wx1 * (in_m1 + in_p1);
51
370M
  const float sum_0 = wx0 * in_00;
52
370M
  return sum_2 + (sum_1 + sum_0);
53
370M
}
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
910M
                     const V wx1, const V wx2) {
59
910M
  const HWY_FULL(float) d;
60
910M
  const float* JXL_RESTRICT center = in.ConstRow(wrap_y(iy, ysize)) + ix;
61
910M
  const auto in_m2 = LoadU(d, center - 2);
62
910M
  const auto in_p2 = LoadU(d, center + 2);
63
910M
  const auto in_m1 = LoadU(d, center - 1);
64
910M
  const auto in_p1 = LoadU(d, center + 1);
65
910M
  const auto in_00 = LoadU(d, center);
66
910M
  const auto sum_2 = Mul(wx2, Add(in_m2, in_p2));
67
910M
  const auto sum_1 = Mul(wx1, Add(in_m1, in_p1));
68
910M
  const auto sum_0 = Mul(wx0, in_00);
69
910M
  return Add(sum_2, Add(sum_1, sum_0));
70
910M
}
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
10.9M
                     const V wx1, const V wx2) {
59
10.9M
  const HWY_FULL(float) d;
60
10.9M
  const float* JXL_RESTRICT center = in.ConstRow(wrap_y(iy, ysize)) + ix;
61
10.9M
  const auto in_m2 = LoadU(d, center - 2);
62
10.9M
  const auto in_p2 = LoadU(d, center + 2);
63
10.9M
  const auto in_m1 = LoadU(d, center - 1);
64
10.9M
  const auto in_p1 = LoadU(d, center + 1);
65
10.9M
  const auto in_00 = LoadU(d, center);
66
10.9M
  const auto sum_2 = Mul(wx2, Add(in_m2, in_p2));
67
10.9M
  const auto sum_1 = Mul(wx1, Add(in_m1, in_p1));
68
10.9M
  const auto sum_0 = Mul(wx0, in_00);
69
10.9M
  return Add(sum_2, Add(sum_1, sum_0));
70
10.9M
}
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
899M
                     const V wx1, const V wx2) {
59
899M
  const HWY_FULL(float) d;
60
899M
  const float* JXL_RESTRICT center = in.ConstRow(wrap_y(iy, ysize)) + ix;
61
899M
  const auto in_m2 = LoadU(d, center - 2);
62
899M
  const auto in_p2 = LoadU(d, center + 2);
63
899M
  const auto in_m1 = LoadU(d, center - 1);
64
899M
  const auto in_p1 = LoadU(d, center + 1);
65
899M
  const auto in_00 = LoadU(d, center);
66
899M
  const auto sum_2 = Mul(wx2, Add(in_m2, in_p2));
67
899M
  const auto sum_1 = Mul(wx1, Add(in_m1, in_p1));
68
899M
  const auto sum_0 = Mul(wx0, in_00);
69
899M
  return Add(sum_2, Add(sum_1, sum_0));
70
899M
}
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
75.0M
                       const WeightsSymmetric5& weights) {
76
75.0M
  const float w0 = weights.c[0];
77
75.0M
  const float w1 = weights.r[0];
78
75.0M
  const float w2 = weights.R[0];
79
75.0M
  const float w4 = weights.d[0];
80
75.0M
  const float w5 = weights.L[0];
81
75.0M
  const float w8 = weights.D[0];
82
83
75.0M
  const size_t xsize = in.xsize();
84
75.0M
  const size_t ysize = in.ysize();
85
75.0M
  const WrapY wrap_y;
86
  // Unrolled loop over all 5 rows of the kernel.
87
75.0M
  float sum0 = WeightedSumBorder(in, wrap_y, ix, iy, xsize, ysize, w0, w1, w2);
88
89
75.0M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 2, xsize, ysize, w2, w5, w8);
90
75.0M
  float sum1 =
91
75.0M
      WeightedSumBorder(in, wrap_y, ix, iy + 2, xsize, ysize, w2, w5, w8);
92
93
75.0M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 1, xsize, ysize, w1, w4, w5);
94
75.0M
  sum1 += WeightedSumBorder(in, wrap_y, ix, iy + 1, xsize, ysize, w1, w4, w5);
95
96
75.0M
  return sum0 + sum1;
97
75.0M
}
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
1.05M
                       const WeightsSymmetric5& weights) {
76
1.05M
  const float w0 = weights.c[0];
77
1.05M
  const float w1 = weights.r[0];
78
1.05M
  const float w2 = weights.R[0];
79
1.05M
  const float w4 = weights.d[0];
80
1.05M
  const float w5 = weights.L[0];
81
1.05M
  const float w8 = weights.D[0];
82
83
1.05M
  const size_t xsize = in.xsize();
84
1.05M
  const size_t ysize = in.ysize();
85
1.05M
  const WrapY wrap_y;
86
  // Unrolled loop over all 5 rows of the kernel.
87
1.05M
  float sum0 = WeightedSumBorder(in, wrap_y, ix, iy, xsize, ysize, w0, w1, w2);
88
89
1.05M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 2, xsize, ysize, w2, w5, w8);
90
1.05M
  float sum1 =
91
1.05M
      WeightedSumBorder(in, wrap_y, ix, iy + 2, xsize, ysize, w2, w5, w8);
92
93
1.05M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 1, xsize, ysize, w1, w4, w5);
94
1.05M
  sum1 += WeightedSumBorder(in, wrap_y, ix, iy + 1, xsize, ysize, w1, w4, w5);
95
96
1.05M
  return sum0 + sum1;
97
1.05M
}
float jxl::N_AVX2::Symmetric5Border<jxl::WrapUnchanged>(jxl::Plane<float> const&, long, long, jxl::WeightsSymmetric5 const&)
Line
Count
Source
75
74.0M
                       const WeightsSymmetric5& weights) {
76
74.0M
  const float w0 = weights.c[0];
77
74.0M
  const float w1 = weights.r[0];
78
74.0M
  const float w2 = weights.R[0];
79
74.0M
  const float w4 = weights.d[0];
80
74.0M
  const float w5 = weights.L[0];
81
74.0M
  const float w8 = weights.D[0];
82
83
74.0M
  const size_t xsize = in.xsize();
84
74.0M
  const size_t ysize = in.ysize();
85
74.0M
  const WrapY wrap_y;
86
  // Unrolled loop over all 5 rows of the kernel.
87
74.0M
  float sum0 = WeightedSumBorder(in, wrap_y, ix, iy, xsize, ysize, w0, w1, w2);
88
89
74.0M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 2, xsize, ysize, w2, w5, w8);
90
74.0M
  float sum1 =
91
74.0M
      WeightedSumBorder(in, wrap_y, ix, iy + 2, xsize, ysize, w2, w5, w8);
92
93
74.0M
  sum0 += WeightedSumBorder(in, wrap_y, ix, iy - 1, xsize, ysize, w1, w4, w5);
94
74.0M
  sum1 += WeightedSumBorder(in, wrap_y, ix, iy + 1, xsize, ysize, w1, w4, w5);
95
96
74.0M
  return sum0 + sum1;
97
74.0M
}
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
182M
                               float* JXL_RESTRICT row_out) {
105
182M
  const HWY_FULL(float) d;
106
107
182M
  const auto w0 = LoadDup128(d, weights.c);
108
182M
  const auto w1 = LoadDup128(d, weights.r);
109
182M
  const auto w2 = LoadDup128(d, weights.R);
110
182M
  const auto w4 = LoadDup128(d, weights.d);
111
182M
  const auto w5 = LoadDup128(d, weights.L);
112
182M
  const auto w8 = LoadDup128(d, weights.D);
113
114
182M
  const size_t ysize = in.ysize();
115
182M
  const WrapY wrap_y;
116
  // Unrolled loop over all 5 rows of the kernel.
117
182M
  auto sum0 = WeightedSum(in, wrap_y, ix, iy, ysize, w0, w1, w2);
118
119
182M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 2, ysize, w2, w5, w8));
120
182M
  auto sum1 = WeightedSum(in, wrap_y, ix, iy + 2, ysize, w2, w5, w8);
121
122
182M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 1, ysize, w1, w4, w5));
123
182M
  sum1 = Add(sum1, WeightedSum(in, wrap_y, ix, iy + 1, ysize, w1, w4, w5));
124
125
182M
  StoreU(Add(sum0, sum1), d, row_out + rix);
126
182M
}
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
2.18M
                               float* JXL_RESTRICT row_out) {
105
2.18M
  const HWY_FULL(float) d;
106
107
2.18M
  const auto w0 = LoadDup128(d, weights.c);
108
2.18M
  const auto w1 = LoadDup128(d, weights.r);
109
2.18M
  const auto w2 = LoadDup128(d, weights.R);
110
2.18M
  const auto w4 = LoadDup128(d, weights.d);
111
2.18M
  const auto w5 = LoadDup128(d, weights.L);
112
2.18M
  const auto w8 = LoadDup128(d, weights.D);
113
114
2.18M
  const size_t ysize = in.ysize();
115
2.18M
  const WrapY wrap_y;
116
  // Unrolled loop over all 5 rows of the kernel.
117
2.18M
  auto sum0 = WeightedSum(in, wrap_y, ix, iy, ysize, w0, w1, w2);
118
119
2.18M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 2, ysize, w2, w5, w8));
120
2.18M
  auto sum1 = WeightedSum(in, wrap_y, ix, iy + 2, ysize, w2, w5, w8);
121
122
2.18M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 1, ysize, w1, w4, w5));
123
2.18M
  sum1 = Add(sum1, WeightedSum(in, wrap_y, ix, iy + 1, ysize, w1, w4, w5));
124
125
2.18M
  StoreU(Add(sum0, sum1), d, row_out + rix);
126
2.18M
}
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
179M
                               float* JXL_RESTRICT row_out) {
105
179M
  const HWY_FULL(float) d;
106
107
179M
  const auto w0 = LoadDup128(d, weights.c);
108
179M
  const auto w1 = LoadDup128(d, weights.r);
109
179M
  const auto w2 = LoadDup128(d, weights.R);
110
179M
  const auto w4 = LoadDup128(d, weights.d);
111
179M
  const auto w5 = LoadDup128(d, weights.L);
112
179M
  const auto w8 = LoadDup128(d, weights.D);
113
114
179M
  const size_t ysize = in.ysize();
115
179M
  const WrapY wrap_y;
116
  // Unrolled loop over all 5 rows of the kernel.
117
179M
  auto sum0 = WeightedSum(in, wrap_y, ix, iy, ysize, w0, w1, w2);
118
119
179M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 2, ysize, w2, w5, w8));
120
179M
  auto sum1 = WeightedSum(in, wrap_y, ix, iy + 2, ysize, w2, w5, w8);
121
122
179M
  sum0 = Add(sum0, WeightedSum(in, wrap_y, ix, iy - 1, ysize, w1, w4, w5));
123
179M
  sum1 = Add(sum1, WeightedSum(in, wrap_y, ix, iy + 1, ysize, w1, w4, w5));
124
125
179M
  StoreU(Add(sum0, sum1), d, row_out + rix);
126
179M
}
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
4.74M
                          float* JXL_RESTRICT row_out) {
132
4.74M
  const int64_t kRadius = 2;
133
4.74M
  const size_t xend = rect.x1();
134
135
4.74M
  size_t rix = 0;
136
4.74M
  size_t ix = rect.x0();
137
4.74M
  const HWY_FULL(float) d;
138
4.74M
  const size_t N = Lanes(d);
139
4.74M
  const size_t aligned_x = RoundUpTo(kRadius, N);
140
42.6M
  for (; ix < std::min(aligned_x, xend); ++ix, ++rix) {
141
37.9M
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
142
37.9M
  }
143
186M
  for (; ix + N + kRadius <= xend; ix += N, rix += N) {
144
182M
    Symmetric5Interior<WrapY>(in, ix, rix, iy, weights, row_out);
145
182M
  }
146
41.8M
  for (; ix < xend; ++ix, ++rix) {
147
37.1M
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
148
37.1M
  }
149
4.74M
}
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
67.6k
                          float* JXL_RESTRICT row_out) {
132
67.6k
  const int64_t kRadius = 2;
133
67.6k
  const size_t xend = rect.x1();
134
135
67.6k
  size_t rix = 0;
136
67.6k
  size_t ix = rect.x0();
137
67.6k
  const HWY_FULL(float) d;
138
67.6k
  const size_t N = Lanes(d);
139
67.6k
  const size_t aligned_x = RoundUpTo(kRadius, N);
140
609k
  for (; ix < std::min(aligned_x, xend); ++ix, ++rix) {
141
541k
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
142
541k
  }
143
2.24M
  for (; ix + N + kRadius <= xend; ix += N, rix += N) {
144
2.18M
    Symmetric5Interior<WrapY>(in, ix, rix, iy, weights, row_out);
145
2.18M
  }
146
583k
  for (; ix < xend; ++ix, ++rix) {
147
515k
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
148
515k
  }
149
67.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
4.67M
                          float* JXL_RESTRICT row_out) {
132
4.67M
  const int64_t kRadius = 2;
133
4.67M
  const size_t xend = rect.x1();
134
135
4.67M
  size_t rix = 0;
136
4.67M
  size_t ix = rect.x0();
137
4.67M
  const HWY_FULL(float) d;
138
4.67M
  const size_t N = Lanes(d);
139
4.67M
  const size_t aligned_x = RoundUpTo(kRadius, N);
140
42.0M
  for (; ix < std::min(aligned_x, xend); ++ix, ++rix) {
141
37.3M
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
142
37.3M
  }
143
184M
  for (; ix + N + kRadius <= xend; ix += N, rix += N) {
144
179M
    Symmetric5Interior<WrapY>(in, ix, rix, iy, weights, row_out);
145
179M
  }
146
41.3M
  for (; ix < xend; ++ix, ++rix) {
147
36.6M
    row_out[rix] = Symmetric5Border<WrapY>(in, ix, iy, weights);
148
36.6M
  }
149
4.67M
}
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
16.9k
                  ImageF* JXL_RESTRICT out, const Rect& out_rect) {
156
16.9k
  JXL_ENSURE(in_rect.xsize() == out_rect.xsize());
157
16.9k
  JXL_ENSURE(in_rect.ysize() == out_rect.ysize());
158
16.9k
  const size_t ysize = in_rect.ysize();
159
16.9k
  const auto process_row = [&](const uint32_t task,
160
4.74M
                               size_t /*thread*/) -> Status {
161
4.74M
    const int64_t riy = task;
162
4.74M
    const int64_t iy = in_rect.y0() + riy;
163
164
4.74M
    if (iy < 2 || iy >= static_cast<ptrdiff_t>(in.ysize()) - 2) {
165
67.6k
      Symmetric5Row<WrapMirror>(in, in_rect, iy, weights,
166
67.6k
                                out_rect.Row(out, riy));
167
4.67M
    } else {
168
4.67M
      Symmetric5Row<WrapUnchanged>(in, in_rect, iy, weights,
169
4.67M
                                   out_rect.Row(out, riy));
170
4.67M
    }
171
4.74M
    return true;
172
4.74M
  };
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
4.74M
                               size_t /*thread*/) -> Status {
161
4.74M
    const int64_t riy = task;
162
4.74M
    const int64_t iy = in_rect.y0() + riy;
163
164
4.74M
    if (iy < 2 || iy >= static_cast<ptrdiff_t>(in.ysize()) - 2) {
165
67.6k
      Symmetric5Row<WrapMirror>(in, in_rect, iy, weights,
166
67.6k
                                out_rect.Row(out, riy));
167
4.67M
    } else {
168
4.67M
      Symmetric5Row<WrapUnchanged>(in, in_rect, iy, weights,
169
4.67M
                                   out_rect.Row(out, riy));
170
4.67M
    }
171
4.74M
    return true;
172
4.74M
  };
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
16.9k
  JXL_RETURN_IF_ERROR(RunOnPool(pool, 0, static_cast<uint32_t>(ysize),
174
16.9k
                                ThreadPool::NoInit, process_row,
175
16.9k
                                "Symmetric5x5Convolution"));
176
16.9k
  return true;
177
16.9k
}
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
16.9k
                  ImageF* JXL_RESTRICT out, const Rect& out_rect) {
156
16.9k
  JXL_ENSURE(in_rect.xsize() == out_rect.xsize());
157
16.9k
  JXL_ENSURE(in_rect.ysize() == out_rect.ysize());
158
16.9k
  const size_t ysize = in_rect.ysize();
159
16.9k
  const auto process_row = [&](const uint32_t task,
160
16.9k
                               size_t /*thread*/) -> Status {
161
16.9k
    const int64_t riy = task;
162
16.9k
    const int64_t iy = in_rect.y0() + riy;
163
164
16.9k
    if (iy < 2 || iy >= static_cast<ptrdiff_t>(in.ysize()) - 2) {
165
16.9k
      Symmetric5Row<WrapMirror>(in, in_rect, iy, weights,
166
16.9k
                                out_rect.Row(out, riy));
167
16.9k
    } else {
168
16.9k
      Symmetric5Row<WrapUnchanged>(in, in_rect, iy, weights,
169
16.9k
                                   out_rect.Row(out, riy));
170
16.9k
    }
171
16.9k
    return true;
172
16.9k
  };
173
16.9k
  JXL_RETURN_IF_ERROR(RunOnPool(pool, 0, static_cast<uint32_t>(ysize),
174
16.9k
                                ThreadPool::NoInit, process_row,
175
16.9k
                                "Symmetric5x5Convolution"));
176
16.9k
  return true;
177
16.9k
}
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
16.9k
                  ImageF* JXL_RESTRICT out, const Rect& out_rect) {
191
16.9k
  return HWY_DYNAMIC_DISPATCH(Symmetric5)(in, in_rect, weights, pool, out,
192
16.9k
                                          out_rect);
193
16.9k
}
194
195
}  // namespace jxl
196
#endif  // HWY_ONCE