Coverage Report

Created: 2023-06-07 06:31

/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
18
#include "aom/aom_integer.h"
19
#include "aom_ports/mem.h"
20
21
typedef void filter8_1dfunction(const uint8_t *src_ptr, ptrdiff_t src_pitch,
22
                                uint8_t *output_ptr, ptrdiff_t out_pitch,
23
                                uint32_t output_height, const int16_t *filter);
24
25
#define FUN_CONV_1D(name, step_q4, filter, dir, src_start, avg, opt)         \
26
  void aom_convolve8_##name##_##opt(                                         \
27
      const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,                \
28
      ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,          \
29
0
      const int16_t *filter_y, int y_step_q4, int w, int h) {                \
30
0
    (void)filter_x;                                                          \
31
0
    (void)x_step_q4;                                                         \
32
0
    (void)filter_y;                                                          \
33
0
    (void)y_step_q4;                                                         \
34
0
    assert((-128 <= filter[3]) && (filter[3] <= 127));                       \
35
0
    assert(step_q4 == 16);                                                   \
36
0
    if (((filter[0] | filter[1] | filter[6] | filter[7]) == 0) &&            \
37
0
        (filter[2] | filter[5])) {                                           \
38
0
      while (w >= 16) {                                                      \
39
0
        aom_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
40
0
                                                 dst_stride, h, filter);     \
41
0
        src += 16;                                                           \
42
0
        dst += 16;                                                           \
43
0
        w -= 16;                                                             \
44
0
      }                                                                      \
45
0
      while (w >= 8) {                                                       \
46
0
        aom_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
47
0
                                                dst_stride, h, filter);      \
48
0
        src += 8;                                                            \
49
0
        dst += 8;                                                            \
50
0
        w -= 8;                                                              \
51
0
      }                                                                      \
52
0
      while (w >= 4) {                                                       \
53
0
        aom_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
54
0
                                                dst_stride, h, filter);      \
55
0
        src += 4;                                                            \
56
0
        dst += 4;                                                            \
57
0
        w -= 4;                                                              \
58
0
      }                                                                      \
59
0
    } else if (filter[0] | filter[1] | filter[2]) {                          \
60
0
      while (w >= 16) {                                                      \
61
0
        aom_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
62
0
                                                 dst_stride, h, filter);     \
63
0
        src += 16;                                                           \
64
0
        dst += 16;                                                           \
65
0
        w -= 16;                                                             \
66
0
      }                                                                      \
67
0
      while (w >= 8) {                                                       \
68
0
        aom_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
69
0
                                                dst_stride, h, filter);      \
70
0
        src += 8;                                                            \
71
0
        dst += 8;                                                            \
72
0
        w -= 8;                                                              \
73
0
      }                                                                      \
74
0
      while (w >= 4) {                                                       \
75
0
        aom_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
76
0
                                                dst_stride, h, filter);      \
77
0
        src += 4;                                                            \
78
0
        dst += 4;                                                            \
79
0
        w -= 4;                                                              \
80
0
      }                                                                      \
81
0
    } else {                                                                 \
82
0
      while (w >= 16) {                                                      \
83
0
        aom_filter_block1d16_##dir##2_##avg##opt(src, src_stride, dst,       \
84
0
                                                 dst_stride, h, filter);     \
85
0
        src += 16;                                                           \
86
0
        dst += 16;                                                           \
87
0
        w -= 16;                                                             \
88
0
      }                                                                      \
89
0
      while (w >= 8) {                                                       \
90
0
        aom_filter_block1d8_##dir##2_##avg##opt(src, src_stride, dst,        \
91
0
                                                dst_stride, h, filter);      \
92
0
        src += 8;                                                            \
93
0
        dst += 8;                                                            \
94
0
        w -= 8;                                                              \
95
0
      }                                                                      \
96
0
      while (w >= 4) {                                                       \
97
0
        aom_filter_block1d4_##dir##2_##avg##opt(src, src_stride, dst,        \
98
0
                                                dst_stride, h, filter);      \
99
0
        src += 4;                                                            \
100
0
        dst += 4;                                                            \
101
0
        w -= 4;                                                              \
102
0
      }                                                                      \
103
0
    }                                                                        \
104
0
    if (w) {                                                                 \
105
0
      aom_convolve8_##name##_c(src, src_stride, dst, dst_stride, filter_x,   \
106
0
                               x_step_q4, filter_y, y_step_q4, w, h);        \
107
0
    }                                                                        \
108
0
  }
Unexecuted instantiation: aom_convolve8_horiz_sse2
Unexecuted instantiation: aom_convolve8_vert_sse2
Unexecuted instantiation: aom_convolve8_horiz_ssse3
Unexecuted instantiation: aom_convolve8_vert_ssse3
Unexecuted instantiation: aom_convolve8_horiz_avx2
Unexecuted instantiation: aom_convolve8_vert_avx2
109
110
#if CONFIG_AV1_HIGHBITDEPTH
111
typedef void highbd_filter8_1dfunction(const uint16_t *src_ptr,
112
                                       const ptrdiff_t src_pitch,
113
                                       uint16_t *output_ptr,
114
                                       ptrdiff_t out_pitch,
115
                                       unsigned int output_height,
116
                                       const int16_t *filter, int bd);
117
118
#define HIGH_FUN_CONV_1D(name, step_q4, filter, dir, src_start, avg, opt)  \
119
  void aom_highbd_convolve8_##name##_##opt(                                \
120
      const uint8_t *src8, ptrdiff_t src_stride, uint8_t *dst8,            \
121
      ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,        \
122
0
      const int16_t *filter_y, int y_step_q4, int w, int h, int bd) {      \
123
0
    uint16_t *src = CONVERT_TO_SHORTPTR(src8);                             \
124
0
    uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);                             \
125
0
    if (step_q4 == 16 && filter[3] != 128) {                               \
126
0
      if (((filter[0] | filter[1] | filter[6] | filter[7]) == 0) &&        \
127
0
          (filter[2] | filter[5])) {                                       \
128
0
        while (w >= 16) {                                                  \
129
0
          aom_highbd_filter_block1d16_##dir##4_##avg##opt(                 \
130
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
131
0
          src += 16;                                                       \
132
0
          dst += 16;                                                       \
133
0
          w -= 16;                                                         \
134
0
        }                                                                  \
135
0
        while (w >= 8) {                                                   \
136
0
          aom_highbd_filter_block1d8_##dir##4_##avg##opt(                  \
137
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
138
0
          src += 8;                                                        \
139
0
          dst += 8;                                                        \
140
0
          w -= 8;                                                          \
141
0
        }                                                                  \
142
0
        while (w >= 4) {                                                   \
143
0
          aom_highbd_filter_block1d4_##dir##4_##avg##opt(                  \
144
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
145
0
          src += 4;                                                        \
146
0
          dst += 4;                                                        \
147
0
          w -= 4;                                                          \
148
0
        }                                                                  \
149
0
      } else if (filter[0] | filter[1] | filter[2]) {                      \
150
0
        while (w >= 16) {                                                  \
151
0
          aom_highbd_filter_block1d16_##dir##8_##avg##opt(                 \
152
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
153
0
          src += 16;                                                       \
154
0
          dst += 16;                                                       \
155
0
          w -= 16;                                                         \
156
0
        }                                                                  \
157
0
        while (w >= 8) {                                                   \
158
0
          aom_highbd_filter_block1d8_##dir##8_##avg##opt(                  \
159
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
160
0
          src += 8;                                                        \
161
0
          dst += 8;                                                        \
162
0
          w -= 8;                                                          \
163
0
        }                                                                  \
164
0
        while (w >= 4) {                                                   \
165
0
          aom_highbd_filter_block1d4_##dir##8_##avg##opt(                  \
166
0
              src_start, src_stride, dst, dst_stride, h, filter, bd);      \
167
0
          src += 4;                                                        \
168
0
          dst += 4;                                                        \
169
0
          w -= 4;                                                          \
170
0
        }                                                                  \
171
0
      } else {                                                             \
172
0
        while (w >= 16) {                                                  \
173
0
          aom_highbd_filter_block1d16_##dir##2_##avg##opt(                 \
174
0
              src, src_stride, dst, dst_stride, h, filter, bd);            \
175
0
          src += 16;                                                       \
176
0
          dst += 16;                                                       \
177
0
          w -= 16;                                                         \
178
0
        }                                                                  \
179
0
        while (w >= 8) {                                                   \
180
0
          aom_highbd_filter_block1d8_##dir##2_##avg##opt(                  \
181
0
              src, src_stride, dst, dst_stride, h, filter, bd);            \
182
0
          src += 8;                                                        \
183
0
          dst += 8;                                                        \
184
0
          w -= 8;                                                          \
185
0
        }                                                                  \
186
0
        while (w >= 4) {                                                   \
187
0
          aom_highbd_filter_block1d4_##dir##2_##avg##opt(                  \
188
0
              src, src_stride, dst, dst_stride, h, filter, bd);            \
189
0
          src += 4;                                                        \
190
0
          dst += 4;                                                        \
191
0
          w -= 4;                                                          \
192
0
        }                                                                  \
193
0
      }                                                                    \
194
0
    }                                                                      \
195
0
    if (w) {                                                               \
196
0
      aom_highbd_convolve8_##name##_c(                                     \
197
0
          CONVERT_TO_BYTEPTR(src), src_stride, CONVERT_TO_BYTEPTR(dst),    \
198
0
          dst_stride, filter_x, x_step_q4, filter_y, y_step_q4, w, h, bd); \
199
0
    }                                                                      \
200
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
201
#endif  // CONFIG_AV1_HIGHBITDEPTH
202
203
#endif  // AOM_AOM_DSP_X86_CONVOLVE_H_