2 * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com)
3 * Copyright (c) 2016 Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 * VP8 compatible video decoder
28 #include "libavutil/attributes.h"
29 #include "libavcodec/vp8dsp.h"
30 #include "vp8dsp_mips.h"
32 #define VP8_MC_MIPS_FUNC(IDX, SIZE) \
33 dsp->put_vp8_epel_pixels_tab[IDX][0][1] = \
34 ff_put_vp8_epel##SIZE##_h4_msa; \
35 dsp->put_vp8_epel_pixels_tab[IDX][0][2] = \
36 ff_put_vp8_epel##SIZE##_h6_msa; \
37 dsp->put_vp8_epel_pixels_tab[IDX][1][0] = \
38 ff_put_vp8_epel##SIZE##_v4_msa; \
39 dsp->put_vp8_epel_pixels_tab[IDX][1][1] = \
40 ff_put_vp8_epel##SIZE##_h4v4_msa; \
41 dsp->put_vp8_epel_pixels_tab[IDX][1][2] = \
42 ff_put_vp8_epel##SIZE##_h6v4_msa; \
43 dsp->put_vp8_epel_pixels_tab[IDX][2][0] = \
44 ff_put_vp8_epel##SIZE##_v6_msa; \
45 dsp->put_vp8_epel_pixels_tab[IDX][2][1] = \
46 ff_put_vp8_epel##SIZE##_h4v6_msa; \
47 dsp->put_vp8_epel_pixels_tab[IDX][2][2] = \
48 ff_put_vp8_epel##SIZE##_h6v6_msa
50 #define VP8_BILINEAR_MC_MIPS_FUNC(IDX, SIZE) \
51 dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = \
52 ff_put_vp8_bilinear##SIZE##_h_msa; \
53 dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = \
54 ff_put_vp8_bilinear##SIZE##_h_msa; \
55 dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] = \
56 ff_put_vp8_bilinear##SIZE##_v_msa; \
57 dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] = \
58 ff_put_vp8_bilinear##SIZE##_hv_msa; \
59 dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] = \
60 ff_put_vp8_bilinear##SIZE##_hv_msa; \
61 dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] = \
62 ff_put_vp8_bilinear##SIZE##_v_msa; \
63 dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] = \
64 ff_put_vp8_bilinear##SIZE##_hv_msa; \
65 dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = \
66 ff_put_vp8_bilinear##SIZE##_hv_msa
68 #define VP8_MC_MIPS_COPY(IDX, SIZE) \
69 dsp->put_vp8_epel_pixels_tab[IDX][0][0] = \
70 ff_put_vp8_pixels##SIZE##_msa; \
71 dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = \
72 ff_put_vp8_pixels##SIZE##_msa;
75 static av_cold void vp8dsp_init_msa(VP8DSPContext *dsp)
77 dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_msa;
78 dsp->vp8_idct_add = ff_vp8_idct_add_msa;
79 dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_msa;
80 dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_msa;
81 dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_msa;
83 VP8_MC_MIPS_FUNC(0, 16);
84 VP8_MC_MIPS_FUNC(1, 8);
85 VP8_MC_MIPS_FUNC(2, 4);
87 VP8_BILINEAR_MC_MIPS_FUNC(0, 16);
88 VP8_BILINEAR_MC_MIPS_FUNC(1, 8);
89 VP8_BILINEAR_MC_MIPS_FUNC(2, 4);
91 VP8_MC_MIPS_COPY(0, 16);
92 VP8_MC_MIPS_COPY(1, 8);
94 dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_msa;
95 dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_msa;
96 dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_msa;
97 dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_msa;
99 dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_msa;
100 dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_msa;
101 dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_msa;
102 dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_msa;
104 dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_msa;
105 dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_msa;
107 #endif // #if HAVE_MSA
110 static av_cold void vp8dsp_init_mmi(VP8DSPContext *dsp)
112 dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_mmi;
113 dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_mmi;
114 dsp->vp8_idct_add = ff_vp8_idct_add_mmi;
115 dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmi;
116 dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmi;
117 dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmi;
119 dsp->put_vp8_epel_pixels_tab[0][0][1] = ff_put_vp8_epel16_h4_mmi;
120 dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_mmi;
121 dsp->put_vp8_epel_pixels_tab[0][1][0] = ff_put_vp8_epel16_v4_mmi;
122 dsp->put_vp8_epel_pixels_tab[0][1][1] = ff_put_vp8_epel16_h4v4_mmi;
123 dsp->put_vp8_epel_pixels_tab[0][1][2] = ff_put_vp8_epel16_h6v4_mmi;
124 dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_mmi;
125 dsp->put_vp8_epel_pixels_tab[0][2][1] = ff_put_vp8_epel16_h4v6_mmi;
126 dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_mmi;
128 dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_mmi;
129 dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_mmi;
130 dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_mmi;
131 dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_mmi;
132 dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_mmi;
133 dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_mmi;
134 dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_mmi;
135 dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_mmi;
137 dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_mmi;
138 dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_mmi;
139 dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_mmi;
140 dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_mmi;
141 dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_mmi;
142 dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_mmi;
143 dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_mmi;
144 dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_mmi;
146 dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilinear16_h_mmi;
147 dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilinear16_h_mmi;
148 dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilinear16_v_mmi;
149 dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilinear16_hv_mmi;
150 dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilinear16_hv_mmi;
151 dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilinear16_v_mmi;
152 dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilinear16_hv_mmi;
153 dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilinear16_hv_mmi;
155 dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilinear8_h_mmi;
156 dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilinear8_h_mmi;
157 dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilinear8_v_mmi;
158 dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilinear8_hv_mmi;
159 dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilinear8_hv_mmi;
160 dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilinear8_v_mmi;
161 dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilinear8_hv_mmi;
162 dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilinear8_hv_mmi;
164 dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilinear4_h_mmi;
165 dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilinear4_h_mmi;
166 dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilinear4_v_mmi;
167 dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilinear4_hv_mmi;
168 dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilinear4_hv_mmi;
169 dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilinear4_v_mmi;
170 dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilinear4_hv_mmi;
171 dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilinear4_hv_mmi;
173 dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmi;
174 dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmi;
176 dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmi;
177 dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmi;
179 dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_mmi;
180 dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_mmi;
181 dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mmi;
182 dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mmi;
184 dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_mmi;
185 dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_mmi;
186 dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmi;
187 dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmi;
189 dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmi;
190 dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmi;
192 #endif /* HAVE_MMI */
194 av_cold void ff_vp8dsp_init_mips(VP8DSPContext *dsp)
197 vp8dsp_init_msa(dsp);
198 #endif // #if HAVE_MSA
200 vp8dsp_init_mmi(dsp);
201 #endif /* HAVE_MMI */