]> git.sesse.net Git - ffmpeg/blob - libavcodec/mips/qpeldsp_init_mips.c
avcodec/avcodec: Move decoder channel count check to ff_decode_preinit
[ffmpeg] / libavcodec / mips / qpeldsp_init_mips.c
1 /*
2  * Copyright (c) 2015 Parag Salasakar (Parag.Salasakar@imgtec.com)
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #include "libavutil/mips/cpu.h"
22 #include "qpeldsp_mips.h"
23
24 void ff_qpeldsp_init_mips(QpelDSPContext *c)
25 {
26     int cpu_flags = av_get_cpu_flags();
27
28     if (have_msa(cpu_flags)) {
29         c->put_qpel_pixels_tab[0][0] = ff_copy_16x16_msa;
30         c->put_qpel_pixels_tab[0][1] = ff_horiz_mc_qpel_aver_src0_16width_msa;
31         c->put_qpel_pixels_tab[0][2] = ff_horiz_mc_qpel_16width_msa;
32         c->put_qpel_pixels_tab[0][3] = ff_horiz_mc_qpel_aver_src1_16width_msa;
33         c->put_qpel_pixels_tab[0][4] = ff_vert_mc_qpel_aver_src0_16x16_msa;
34         c->put_qpel_pixels_tab[0][5] = ff_hv_mc_qpel_aver_hv_src00_16x16_msa;
35         c->put_qpel_pixels_tab[0][6] = ff_hv_mc_qpel_aver_v_src0_16x16_msa;
36         c->put_qpel_pixels_tab[0][7] = ff_hv_mc_qpel_aver_hv_src10_16x16_msa;
37         c->put_qpel_pixels_tab[0][8] = ff_vert_mc_qpel_16x16_msa;
38         c->put_qpel_pixels_tab[0][9] = ff_hv_mc_qpel_aver_h_src0_16x16_msa;
39         c->put_qpel_pixels_tab[0][10] = ff_hv_mc_qpel_16x16_msa;
40         c->put_qpel_pixels_tab[0][11] = ff_hv_mc_qpel_aver_h_src1_16x16_msa;
41         c->put_qpel_pixels_tab[0][12] = ff_vert_mc_qpel_aver_src1_16x16_msa;
42         c->put_qpel_pixels_tab[0][13] = ff_hv_mc_qpel_aver_hv_src01_16x16_msa;
43         c->put_qpel_pixels_tab[0][14] = ff_hv_mc_qpel_aver_v_src1_16x16_msa;
44         c->put_qpel_pixels_tab[0][15] = ff_hv_mc_qpel_aver_hv_src11_16x16_msa;
45
46         c->put_qpel_pixels_tab[1][0] = ff_copy_8x8_msa;
47         c->put_qpel_pixels_tab[1][1] = ff_horiz_mc_qpel_aver_src0_8width_msa;
48         c->put_qpel_pixels_tab[1][2] = ff_horiz_mc_qpel_8width_msa;
49         c->put_qpel_pixels_tab[1][3] = ff_horiz_mc_qpel_aver_src1_8width_msa;
50         c->put_qpel_pixels_tab[1][4] = ff_vert_mc_qpel_aver_src0_8x8_msa;
51         c->put_qpel_pixels_tab[1][5] = ff_hv_mc_qpel_aver_hv_src00_8x8_msa;
52         c->put_qpel_pixels_tab[1][6] = ff_hv_mc_qpel_aver_v_src0_8x8_msa;
53         c->put_qpel_pixels_tab[1][7] = ff_hv_mc_qpel_aver_hv_src10_8x8_msa;
54         c->put_qpel_pixels_tab[1][8] = ff_vert_mc_qpel_8x8_msa;
55         c->put_qpel_pixels_tab[1][9] = ff_hv_mc_qpel_aver_h_src0_8x8_msa;
56         c->put_qpel_pixels_tab[1][10] = ff_hv_mc_qpel_8x8_msa;
57         c->put_qpel_pixels_tab[1][11] = ff_hv_mc_qpel_aver_h_src1_8x8_msa;
58         c->put_qpel_pixels_tab[1][12] = ff_vert_mc_qpel_aver_src1_8x8_msa;
59         c->put_qpel_pixels_tab[1][13] = ff_hv_mc_qpel_aver_hv_src01_8x8_msa;
60         c->put_qpel_pixels_tab[1][14] = ff_hv_mc_qpel_aver_v_src1_8x8_msa;
61         c->put_qpel_pixels_tab[1][15] = ff_hv_mc_qpel_aver_hv_src11_8x8_msa;
62
63         c->put_no_rnd_qpel_pixels_tab[0][0] = ff_copy_16x16_msa;
64         c->put_no_rnd_qpel_pixels_tab[0][1] =
65             ff_horiz_mc_qpel_no_rnd_aver_src0_16width_msa;
66         c->put_no_rnd_qpel_pixels_tab[0][2] = ff_horiz_mc_qpel_no_rnd_16width_msa;
67         c->put_no_rnd_qpel_pixels_tab[0][3] =
68             ff_horiz_mc_qpel_no_rnd_aver_src1_16width_msa;
69         c->put_no_rnd_qpel_pixels_tab[0][4] =
70             ff_vert_mc_qpel_no_rnd_aver_src0_16x16_msa;
71         c->put_no_rnd_qpel_pixels_tab[0][5] =
72             ff_hv_mc_qpel_no_rnd_aver_hv_src00_16x16_msa;
73         c->put_no_rnd_qpel_pixels_tab[0][6] =
74             ff_hv_mc_qpel_no_rnd_aver_v_src0_16x16_msa;
75         c->put_no_rnd_qpel_pixels_tab[0][7] =
76             ff_hv_mc_qpel_no_rnd_aver_hv_src10_16x16_msa;
77         c->put_no_rnd_qpel_pixels_tab[0][8] = ff_vert_mc_qpel_no_rnd_16x16_msa;
78         c->put_no_rnd_qpel_pixels_tab[0][9] =
79             ff_hv_mc_qpel_no_rnd_aver_h_src0_16x16_msa;
80         c->put_no_rnd_qpel_pixels_tab[0][10] = ff_hv_mc_qpel_no_rnd_16x16_msa;
81         c->put_no_rnd_qpel_pixels_tab[0][11] =
82             ff_hv_mc_qpel_no_rnd_aver_h_src1_16x16_msa;
83         c->put_no_rnd_qpel_pixels_tab[0][12] =
84             ff_vert_mc_qpel_no_rnd_aver_src1_16x16_msa;
85         c->put_no_rnd_qpel_pixels_tab[0][13] =
86             ff_hv_mc_qpel_no_rnd_aver_hv_src01_16x16_msa;
87         c->put_no_rnd_qpel_pixels_tab[0][14] =
88             ff_hv_mc_qpel_no_rnd_aver_v_src1_16x16_msa;
89         c->put_no_rnd_qpel_pixels_tab[0][15] =
90             ff_hv_mc_qpel_no_rnd_aver_hv_src11_16x16_msa;
91
92         c->put_no_rnd_qpel_pixels_tab[1][0] = ff_copy_8x8_msa;
93         c->put_no_rnd_qpel_pixels_tab[1][1] =
94             ff_horiz_mc_qpel_no_rnd_aver_src0_8width_msa;
95         c->put_no_rnd_qpel_pixels_tab[1][2] = ff_horiz_mc_qpel_no_rnd_8width_msa;
96         c->put_no_rnd_qpel_pixels_tab[1][3] =
97             ff_horiz_mc_qpel_no_rnd_aver_src1_8width_msa;
98         c->put_no_rnd_qpel_pixels_tab[1][4] =
99             ff_vert_mc_qpel_no_rnd_aver_src0_8x8_msa;
100         c->put_no_rnd_qpel_pixels_tab[1][5] =
101             ff_hv_mc_qpel_no_rnd_aver_hv_src00_8x8_msa;
102         c->put_no_rnd_qpel_pixels_tab[1][6] =
103             ff_hv_mc_qpel_no_rnd_aver_v_src0_8x8_msa;
104         c->put_no_rnd_qpel_pixels_tab[1][7] =
105             ff_hv_mc_qpel_no_rnd_aver_hv_src10_8x8_msa;
106         c->put_no_rnd_qpel_pixels_tab[1][8] = ff_vert_mc_qpel_no_rnd_8x8_msa;
107         c->put_no_rnd_qpel_pixels_tab[1][9] =
108             ff_hv_mc_qpel_no_rnd_aver_h_src0_8x8_msa;
109         c->put_no_rnd_qpel_pixels_tab[1][10] = ff_hv_mc_qpel_no_rnd_8x8_msa;
110         c->put_no_rnd_qpel_pixels_tab[1][11] =
111             ff_hv_mc_qpel_no_rnd_aver_h_src1_8x8_msa;
112         c->put_no_rnd_qpel_pixels_tab[1][12] =
113             ff_vert_mc_qpel_no_rnd_aver_src1_8x8_msa;
114         c->put_no_rnd_qpel_pixels_tab[1][13] =
115             ff_hv_mc_qpel_no_rnd_aver_hv_src01_8x8_msa;
116         c->put_no_rnd_qpel_pixels_tab[1][14] =
117             ff_hv_mc_qpel_no_rnd_aver_v_src1_8x8_msa;
118         c->put_no_rnd_qpel_pixels_tab[1][15] =
119             ff_hv_mc_qpel_no_rnd_aver_hv_src11_8x8_msa;
120
121         c->avg_qpel_pixels_tab[0][0] = ff_avg_width16_msa;
122         c->avg_qpel_pixels_tab[0][1] =
123             ff_horiz_mc_qpel_avg_dst_aver_src0_16width_msa;
124         c->avg_qpel_pixels_tab[0][2] = ff_horiz_mc_qpel_avg_dst_16width_msa;
125         c->avg_qpel_pixels_tab[0][3] =
126             ff_horiz_mc_qpel_avg_dst_aver_src1_16width_msa;
127         c->avg_qpel_pixels_tab[0][4] = ff_vert_mc_qpel_avg_dst_aver_src0_16x16_msa;
128         c->avg_qpel_pixels_tab[0][5] =
129             ff_hv_mc_qpel_avg_dst_aver_hv_src00_16x16_msa;
130         c->avg_qpel_pixels_tab[0][6] = ff_hv_mc_qpel_avg_dst_aver_v_src0_16x16_msa;
131         c->avg_qpel_pixels_tab[0][7] =
132             ff_hv_mc_qpel_avg_dst_aver_hv_src10_16x16_msa;
133         c->avg_qpel_pixels_tab[0][8] = ff_vert_mc_qpel_avg_dst_16x16_msa;
134         c->avg_qpel_pixels_tab[0][9] = ff_hv_mc_qpel_avg_dst_aver_h_src0_16x16_msa;
135         c->avg_qpel_pixels_tab[0][10] = ff_hv_mc_qpel_avg_dst_16x16_msa;
136         c->avg_qpel_pixels_tab[0][11] = ff_hv_mc_qpel_avg_dst_aver_h_src1_16x16_msa;
137         c->avg_qpel_pixels_tab[0][12] = ff_vert_mc_qpel_avg_dst_aver_src1_16x16_msa;
138         c->avg_qpel_pixels_tab[0][13] =
139             ff_hv_mc_qpel_avg_dst_aver_hv_src01_16x16_msa;
140         c->avg_qpel_pixels_tab[0][14] = ff_hv_mc_qpel_avg_dst_aver_v_src1_16x16_msa;
141         c->avg_qpel_pixels_tab[0][15] =
142             ff_hv_mc_qpel_avg_dst_aver_hv_src11_16x16_msa;
143
144         c->avg_qpel_pixels_tab[1][0] = ff_avg_width8_msa;
145         c->avg_qpel_pixels_tab[1][1] =
146             ff_horiz_mc_qpel_avg_dst_aver_src0_8width_msa;
147         c->avg_qpel_pixels_tab[1][2] = ff_horiz_mc_qpel_avg_dst_8width_msa;
148         c->avg_qpel_pixels_tab[1][3] =
149             ff_horiz_mc_qpel_avg_dst_aver_src1_8width_msa;
150         c->avg_qpel_pixels_tab[1][4] = ff_vert_mc_qpel_avg_dst_aver_src0_8x8_msa;
151         c->avg_qpel_pixels_tab[1][5] = ff_hv_mc_qpel_avg_dst_aver_hv_src00_8x8_msa;
152         c->avg_qpel_pixels_tab[1][6] = ff_hv_mc_qpel_avg_dst_aver_v_src0_8x8_msa;
153         c->avg_qpel_pixels_tab[1][7] = ff_hv_mc_qpel_avg_dst_aver_hv_src10_8x8_msa;
154         c->avg_qpel_pixels_tab[1][8] = ff_vert_mc_qpel_avg_dst_8x8_msa;
155         c->avg_qpel_pixels_tab[1][9] = ff_hv_mc_qpel_avg_dst_aver_h_src0_8x8_msa;
156         c->avg_qpel_pixels_tab[1][10] = ff_hv_mc_qpel_avg_dst_8x8_msa;
157         c->avg_qpel_pixels_tab[1][11] = ff_hv_mc_qpel_avg_dst_aver_h_src1_8x8_msa;
158         c->avg_qpel_pixels_tab[1][12] = ff_vert_mc_qpel_avg_dst_aver_src1_8x8_msa;
159         c->avg_qpel_pixels_tab[1][13] = ff_hv_mc_qpel_avg_dst_aver_hv_src01_8x8_msa;
160         c->avg_qpel_pixels_tab[1][14] = ff_hv_mc_qpel_avg_dst_aver_v_src1_8x8_msa;
161         c->avg_qpel_pixels_tab[1][15] = ff_hv_mc_qpel_avg_dst_aver_hv_src11_8x8_msa;
162     }
163 }