Coverage Report

Created: 2025-06-13 07:07

/src/aom/aom_dsp/x86/convolve.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3
 *
4
 * This source code is subject to the terms of the BSD 2 Clause License and
5
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6
 * was not distributed with this source code in the LICENSE file, you can
7
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8
 * Media Patent License 1.0 was not distributed with this source code in the
9
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10
 */
11
#ifndef AOM_AOM_DSP_X86_CONVOLVE_H_
12
#define AOM_AOM_DSP_X86_CONVOLVE_H_
13
14
#include <assert.h>
15
16
#include "config/aom_config.h"
17
#include "config/aom_dsp_rtcd.h"
18
19
#include "aom/aom_integer.h"
20
#include "aom_ports/mem.h"
21
22
typedef void filter8_1dfunction(const uint8_t *src_ptr, ptrdiff_t src_pitch,
23
                                uint8_t *output_ptr, ptrdiff_t out_pitch,
24
                                uint32_t output_height, const int16_t *filter);
25
26
#define FUN_CONV_1D(name, step_q4, filter, dir, src_start, avg, opt)         \
27
  void aom_convolve8_##name##_##opt(                                         \
28
      const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,                \
29
      ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,          \
30
0
      const int16_t *filter_y, int y_step_q4, int w, int h) {                \
31
0
    (void)filter_x;                                                          \
32
0
    (void)x_step_q4;                                                         \
33
0
    (void)filter_y;                                                          \
34
0
    (void)y_step_q4;                                                         \
35
0
    assert((-128 <= filter[3]) && (filter[3] <= 127));                       \
36
0
    assert(step_q4 == 16);                                                   \
37
0
    if (((filter[0] | filter[1] | filter[6] | filter[7]) == 0) &&            \
38
0
        (filter[2] | filter[5])) {                                           \
39
0
      while (w >= 16) {                                                      \
40
0
        aom_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
41
0
                                                 dst_stride, h, filter);     \
42
0
        src += 16;                                                           \
43
0
        dst += 16;                                                           \
44
0
        w -= 16;                                                             \
45
0
      }                                                                      \
46
0
      while (w >= 8) {                                                       \
47
0
        aom_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
48
0
                                                dst_stride, h, filter);      \
49
0
        src += 8;                                                            \
50
0
        dst += 8;                                                            \
51
0
        w -= 8;                                                              \
52
0
      }                                                                      \
53
0
      while (w >= 4) {                                                       \
54
0
        aom_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
55
0
                                                dst_stride, h, filter);      \
56
0
        src += 4;                                                            \
57
0
        dst += 4;                                                            \
58
0
        w -= 4;                                                              \
59
0
      }                                                                      \
60
0
    } else if (filter[0] | filter[1] | filter[2]) {                          \
61
0
      while (w >= 16) {                                                      \
62
0
        aom_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
63
0
                                                 dst_stride, h, filter);     \
64
0
        src += 16;                                                           \
65
0
        dst += 16;                                                           \
66
0
        w -= 16;                                                             \
67
0
      }                                                                      \
68
0
      while (w >= 8) {                                                       \
69
0
        aom_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
70
0
                                                dst_stride, h, filter);      \
71
0
        src += 8;                                                            \
72
0
        dst += 8;                                                            \
73
0
        w -= 8;                                                              \
74
0
      }                                                                      \
75
0
      while (w >= 4) {                                                       \
76
0
        aom_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
77
0
                                                dst_stride, h, filter);      \
78
0
        src += 4;                                                            \
79
0
        dst += 4;                                                            \
80
0
        w -= 4;                                                              \
81
0
      }                                                                      \
82
0
    } else {                                                                 \
83
0
      while (w >= 16) {                                                      \
84
0
        aom_filter_block1d16_##dir##2_##avg##opt(src, src_stride, dst,       \
85
0
                                                 dst_stride, h, filter);     \
86
0
        src += 16;                                                           \
87
0
        dst += 16;                                                           \
88
0
        w -= 16;                                                             \
89
0
      }                                                                      \
90
0
      while (w >= 8) {                                                       \
91
0
        aom_filter_block1d8_##dir##2_##avg##opt(src, src_stride, dst,        \
92
0
                                                dst_stride, h, filter);      \
93
0
        src += 8;                                                            \
94
0
        dst += 8;                                                            \
95
0
        w -= 8;                                                              \
96
0
      }                                                                      \
97
0
      while (w >= 4) {                                                       \
98
0
        aom_filter_block1d4_##dir##2_##avg##opt(src, src_stride, dst,        \
99
0
                                                dst_stride, h, filter);      \
100
0
        src += 4;                                                            \
101
0
        dst += 4;                                                            \
102
0
        w -= 4;                                                              \
103
0
      }                                                                      \
104
0
    }                                                                        \
105
0
    if (w) {                                                                 \
106
0
      aom_convolve8_##name##_c(src, src_stride, dst, dst_stride, filter_x,   \
107
0
                               x_step_q4, filter_y, y_step_q4, w, h);        \
108
0
    }                                                                        \
109
0
  }
Unexecuted instantiation: aom_convolve8_horiz_ssse3
Unexecuted instantiation: aom_convolve8_vert_ssse3
Unexecuted instantiation: aom_convolve8_horiz_avx2
Unexecuted instantiation: aom_convolve8_vert_avx2
110
111
#if CONFIG_AV1_HIGHBITDEPTH
112
typedef void highbd_filter8_1dfunction(const uint16_t *src_ptr,
113
                                       const ptrdiff_t src_pitch,
114
                                       uint16_t *output_ptr,
115
                                       ptrdiff_t out_pitch,
116
                                       unsigned int output_height,
117
                                       const int16_t *filter, int bd);
118
119
#define HIGH_FUN_CONV_1D(name, step_q4, filter, dir, src_start, avg, opt)  \
120
  void aom_highbd_convolve8_##name##_##opt(                                \
121
      const uint8_t *src8, ptrdiff_t src_stride, uint8_t *dst8,            \
122
      ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,        \
123
0
      const int16_t *filter_y, int y_step_q4, int w, int h, int bd) {      \
124
0
    uint16_t *src = CONVERT_TO_SHORTPTR(src8);                             \
125
0
    uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);                             \
126
0
    if (step_q4 == 16 && filter[3] != 128) {                               \
127
0
      if (((filter[0] | filter[1] | filter[6] | filter[7]) == 0) &&        \
128
0
          (filter[2] | filter[5])) {                                       \
129
0
        while (w >= 16) {                                                  \
130
0
          aom_highbd_filter_block1d16_##dir##4_##avg##opt(                 \
131
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
132
0
          src += 16;                                                       \
133
0
          dst += 16;                                                       \
134
0
          w -= 16;                                                         \
135
0
        }                                                                  \
136
0
        while (w >= 8) {                                                   \
137
0
          aom_highbd_filter_block1d8_##dir##4_##avg##opt(                  \
138
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
139
0
          src += 8;                                                        \
140
0
          dst += 8;                                                        \
141
0
          w -= 8;                                                          \
142
0
        }                                                                  \
143
0
        while (w >= 4) {                                                   \
144
0
          aom_highbd_filter_block1d4_##dir##4_##avg##opt(                  \
145
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
146
0
          src += 4;                                                        \
147
0
          dst += 4;                                                        \
148
0
          w -= 4;                                                          \
149
0
        }                                                                  \
150
0
      } else if (filter[0] | filter[1] | filter[2]) {                      \
151
0
        while (w >= 16) {                                                  \
152
0
          aom_highbd_filter_block1d16_##dir##8_##avg##opt(                 \
153
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
154
0
          src += 16;                                                       \
155
0
          dst += 16;                                                       \
156
0
          w -= 16;                                                         \
157
0
        }                                                                  \
158
0
        while (w >= 8) {                                                   \
159
0
          aom_highbd_filter_block1d8_##dir##8_##avg##opt(                  \
160
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
161
0
          src += 8;                                                        \
162
0
          dst += 8;                                                        \
163
0
          w -= 8;                                                          \
164
0
        }                                                                  \
165
0
        while (w >= 4) {                                                   \
166
0
          aom_highbd_filter_block1d4_##dir##8_##avg##opt(                  \
167
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
168
0
          src += 4;                                                        \
169
0
          dst += 4;                                                        \
170
0
          w -= 4;                                                          \
171
0
        }                                                                  \
172
0
      } else {                                                             \
173
0
        while (w >= 16) {                                                  \
174
0
          aom_highbd_filter_block1d16_##dir##2_##avg##opt(                 \
175
0
              src, src_stride, dst, dst_stride, h, filter, bd);            \
176
0
          src += 16;                                                       \
177
0
          dst += 16;                                                       \
178
0
          w -= 16;                                                         \
179
0
        }                                                                  \
180
0
        while (w >= 8) {                                                   \
181
0
          aom_highbd_filter_block1d8_##dir##2_##avg##opt(                  \
182
0
              src, src_stride, dst, dst_stride, h, filter, bd);            \
183
0
          src += 8;                                                        \
184
0
          dst += 8;                                                        \
185
0
          w -= 8;                                                          \
186
0
        }                                                                  \
187
0
        while (w >= 4) {                                                   \
188
0
          aom_highbd_filter_block1d4_##dir##2_##avg##opt(                  \
189
0
              src, src_stride, dst, dst_stride, h, filter, bd);            \
190
0
          src += 4;                                                        \
191
0
          dst += 4;                                                        \
192
0
          w -= 4;                                                          \
193
0
        }                                                                  \
194
0
      }                                                                    \
195
0
    }                                                                      \
196
0
    if (w) {                                                               \
197
0
      aom_highbd_convolve8_##name##_c(                                     \
198
0
          CONVERT_TO_BYTEPTR(src), src_stride, CONVERT_TO_BYTEPTR(dst),    \
199
0
          dst_stride, filter_x, x_step_q4, filter_y, y_step_q4, w, h, bd); \
200
0
    }                                                                      \
201
0
  }
Unexecuted instantiation: aom_highbd_convolve8_horiz_sse2
Unexecuted instantiation: aom_highbd_convolve8_vert_sse2
Unexecuted instantiation: aom_highbd_convolve8_horiz_avx2
Unexecuted instantiation: aom_highbd_convolve8_vert_avx2
202
#endif  // CONFIG_AV1_HIGHBITDEPTH
203
204
#endif  // AOM_AOM_DSP_X86_CONVOLVE_H_