• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016 Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
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 "libavutil/attributes.h"
23 #include "libavcodec/vc1dsp.h"
24 #include "vc1dsp_mips.h"
25 #include "config.h"
26 
27 #define FN_ASSIGN(OP, X, Y, INSN) \
28     dsp->OP##vc1_mspel_pixels_tab[1][X+4*Y] = ff_##OP##vc1_mspel_mc##X##Y##INSN; \
29     dsp->OP##vc1_mspel_pixels_tab[0][X+4*Y] = ff_##OP##vc1_mspel_mc##X##Y##_16##INSN
30 
ff_vc1dsp_init_mips(VC1DSPContext * dsp)31 av_cold void ff_vc1dsp_init_mips(VC1DSPContext *dsp)
32 {
33     int cpu_flags = av_get_cpu_flags();
34 
35     if (have_mmi(cpu_flags)) {
36  #if _MIPS_SIM != _ABIO32
37         dsp->vc1_inv_trans_8x8    = ff_vc1_inv_trans_8x8_mmi;
38         dsp->vc1_inv_trans_4x8    = ff_vc1_inv_trans_4x8_mmi;
39         dsp->vc1_inv_trans_8x4    = ff_vc1_inv_trans_8x4_mmi;
40 #endif
41         dsp->vc1_inv_trans_4x4    = ff_vc1_inv_trans_4x4_mmi;
42         dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_mmi;
43         dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_mmi;
44         dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_mmi;
45         dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_mmi;
46 
47         dsp->vc1_h_overlap        = ff_vc1_h_overlap_mmi;
48         dsp->vc1_v_overlap        = ff_vc1_v_overlap_mmi;
49         dsp->vc1_h_s_overlap      = ff_vc1_h_s_overlap_mmi;
50         dsp->vc1_v_s_overlap      = ff_vc1_v_s_overlap_mmi;
51 
52         dsp->vc1_v_loop_filter4  = ff_vc1_v_loop_filter4_mmi;
53         dsp->vc1_h_loop_filter4  = ff_vc1_h_loop_filter4_mmi;
54         dsp->vc1_v_loop_filter8  = ff_vc1_v_loop_filter8_mmi;
55         dsp->vc1_h_loop_filter8  = ff_vc1_h_loop_filter8_mmi;
56         dsp->vc1_v_loop_filter16 = ff_vc1_v_loop_filter16_mmi;
57         dsp->vc1_h_loop_filter16 = ff_vc1_h_loop_filter16_mmi;
58 
59         FN_ASSIGN(put_, 0, 0, _mmi);
60         FN_ASSIGN(put_, 0, 1, _mmi);
61         FN_ASSIGN(put_, 0, 2, _mmi);
62         FN_ASSIGN(put_, 0, 3, _mmi);
63 
64         FN_ASSIGN(put_, 1, 0, _mmi);
65         //FN_ASSIGN(put_, 1, 1, _mmi);//FIXME
66         //FN_ASSIGN(put_, 1, 2, _mmi);//FIXME
67         //FN_ASSIGN(put_, 1, 3, _mmi);//FIXME
68 
69         FN_ASSIGN(put_, 2, 0, _mmi);
70         //FN_ASSIGN(put_, 2, 1, _mmi);//FIXME
71         //FN_ASSIGN(put_, 2, 2, _mmi);//FIXME
72         //FN_ASSIGN(put_, 2, 3, _mmi);//FIXME
73 
74         FN_ASSIGN(put_, 3, 0, _mmi);
75         //FN_ASSIGN(put_, 3, 1, _mmi);//FIXME
76         //FN_ASSIGN(put_, 3, 2, _mmi);//FIXME
77         //FN_ASSIGN(put_, 3, 3, _mmi);//FIXME
78 
79         FN_ASSIGN(avg_, 0, 0, _mmi);
80         FN_ASSIGN(avg_, 0, 1, _mmi);
81         FN_ASSIGN(avg_, 0, 2, _mmi);
82         FN_ASSIGN(avg_, 0, 3, _mmi);
83 
84         FN_ASSIGN(avg_, 1, 0, _mmi);
85         //FN_ASSIGN(avg_, 1, 1, _mmi);//FIXME
86         //FN_ASSIGN(avg_, 1, 2, _mmi);//FIXME
87         //FN_ASSIGN(avg_, 1, 3, _mmi);//FIXME
88 
89         FN_ASSIGN(avg_, 2, 0, _mmi);
90         //FN_ASSIGN(avg_, 2, 1, _mmi);//FIXME
91         //FN_ASSIGN(avg_, 2, 2, _mmi);//FIXME
92         //FN_ASSIGN(avg_, 2, 3, _mmi);//FIXME
93 
94         FN_ASSIGN(avg_, 3, 0, _mmi);
95         //FN_ASSIGN(avg_, 3, 1, _mmi);//FIXME
96         //FN_ASSIGN(avg_, 3, 2, _mmi);//FIXME
97         //FN_ASSIGN(avg_, 3, 3, _mmi);//FIXME
98 
99         dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_no_rnd_vc1_chroma_mc8_mmi;
100         dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_no_rnd_vc1_chroma_mc8_mmi;
101         dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = ff_put_no_rnd_vc1_chroma_mc4_mmi;
102         dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = ff_avg_no_rnd_vc1_chroma_mc4_mmi;
103     }
104 
105     if (have_msa(cpu_flags)) {
106         dsp->vc1_inv_trans_8x8 = ff_vc1_inv_trans_8x8_msa;
107         dsp->vc1_inv_trans_4x8 = ff_vc1_inv_trans_4x8_msa;
108         dsp->vc1_inv_trans_8x4 = ff_vc1_inv_trans_8x4_msa;
109 
110         FN_ASSIGN(put_, 1, 1, _msa);
111         FN_ASSIGN(put_, 1, 2, _msa);
112         FN_ASSIGN(put_, 1, 3, _msa);
113         FN_ASSIGN(put_, 2, 1, _msa);
114         FN_ASSIGN(put_, 2, 2, _msa);
115         FN_ASSIGN(put_, 2, 3, _msa);
116         FN_ASSIGN(put_, 3, 1, _msa);
117         FN_ASSIGN(put_, 3, 2, _msa);
118         FN_ASSIGN(put_, 3, 3, _msa);
119     }
120 }
121