1/**
2 * This file is part of Libav.
3 *
4 * Libav is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * Libav is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with Libav; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include <stdint.h>
20#include "libavcodec/vp8dsp.h"
21
22void ff_vp8_luma_dc_wht_neon(DCTELEM block[4][4][16], DCTELEM dc[16]);
23void ff_vp8_luma_dc_wht_dc_neon(DCTELEM block[4][4][16], DCTELEM dc[16]);
24
25void ff_vp8_idct_add_neon(uint8_t *dst, DCTELEM block[16], int stride);
26void ff_vp8_idct_dc_add_neon(uint8_t *dst, DCTELEM block[16], int stride);
27void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, DCTELEM block[4][16], int stride);
28void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, DCTELEM block[4][16], int stride);
29
30void ff_vp8_v_loop_filter16_neon(uint8_t *dst, int stride,
31                                 int flim_E, int flim_I, int hev_thresh);
32void ff_vp8_h_loop_filter16_neon(uint8_t *dst, int stride,
33                                 int flim_E, int flim_I, int hev_thresh);
34void ff_vp8_v_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride,
35                                  int flim_E, int flim_I, int hev_thresh);
36void ff_vp8_h_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride,
37                                  int flim_E, int flim_I, int hev_thresh);
38
39void ff_vp8_v_loop_filter16_inner_neon(uint8_t *dst, int stride,
40                                       int flim_E, int flim_I, int hev_thresh);
41void ff_vp8_h_loop_filter16_inner_neon(uint8_t *dst, int stride,
42                                       int flim_E, int flim_I, int hev_thresh);
43void ff_vp8_v_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV,
44                                        int stride, int flim_E, int flim_I,
45                                        int hev_thresh);
46void ff_vp8_h_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV,
47                                        int stride, int flim_E, int flim_I,
48                                        int hev_thresh);
49
50void ff_vp8_v_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim);
51void ff_vp8_h_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim);
52
53
54#define VP8_MC(n)                                                       \
55    void ff_put_vp8_##n##_neon(uint8_t *dst, int dststride,             \
56                               uint8_t *src, int srcstride,             \
57                               int h, int x, int y)
58
59#define VP8_EPEL(w)                             \
60    VP8_MC(pixels ## w);                        \
61    VP8_MC(epel ## w ## _h4);                   \
62    VP8_MC(epel ## w ## _h6);                   \
63    VP8_MC(epel ## w ## _v4);                   \
64    VP8_MC(epel ## w ## _h4v4);                 \
65    VP8_MC(epel ## w ## _h6v4);                 \
66    VP8_MC(epel ## w ## _v6);                   \
67    VP8_MC(epel ## w ## _h4v6);                 \
68    VP8_MC(epel ## w ## _h6v6)
69
70VP8_EPEL(16);
71VP8_EPEL(8);
72VP8_EPEL(4);
73
74VP8_MC(bilin16_h);
75VP8_MC(bilin16_v);
76VP8_MC(bilin16_hv);
77VP8_MC(bilin8_h);
78VP8_MC(bilin8_v);
79VP8_MC(bilin8_hv);
80VP8_MC(bilin4_h);
81VP8_MC(bilin4_v);
82VP8_MC(bilin4_hv);
83
84av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp)
85{
86    if (HAVE_NEON) {
87        dsp->vp8_luma_dc_wht    = ff_vp8_luma_dc_wht_neon;
88        dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_neon;
89
90        dsp->vp8_idct_add       = ff_vp8_idct_add_neon;
91        dsp->vp8_idct_dc_add    = ff_vp8_idct_dc_add_neon;
92        dsp->vp8_idct_dc_add4y  = ff_vp8_idct_dc_add4y_neon;
93        dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon;
94
95        dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon;
96        dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon;
97        dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon;
98        dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon;
99
100        dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon;
101        dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon;
102        dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon;
103        dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon;
104
105        dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon;
106        dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon;
107
108        dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;
109        dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon;
110        dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon;
111        dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon;
112
113        dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;
114        dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon;
115        dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon;
116        dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon;
117        dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon;
118        dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon;
119        dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon;
120        dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon;
121        dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon;
122
123        dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon;
124        dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon;
125        dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon;
126        dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon;
127        dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon;
128        dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon;
129        dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon;
130        dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon;
131        dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon;
132
133        dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;
134        dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon;
135        dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon;
136        dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon;
137        dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon;
138        dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon;
139        dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon;
140        dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon;
141        dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon;
142
143        dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;
144        dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon;
145        dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon;
146        dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon;
147        dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon;
148        dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon;
149        dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon;
150        dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon;
151        dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon;
152
153        dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon;
154        dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon;
155        dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon;
156        dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon;
157        dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon;
158        dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon;
159        dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon;
160        dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon;
161        dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon;
162    }
163}
164