Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6147 serge 1
/*
2
 * Copyright (c) 2015 Parag Salasakar (Parag.Salasakar@imgtec.com)
3
 * Copyright (c) 2015 Zhou Xiaoyong 
4
 *
5
 * This file is part of FFmpeg.
6
 *
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.
11
 *
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.
16
 *
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
20
 */
21
 
22
#include "h264dsp_mips.h"
23
 
24
#if HAVE_MSA
25
static av_cold void h264dsp_init_msa(H264DSPContext *c,
26
                                     const int bit_depth,
27
                                     const int chroma_format_idc)
28
{
29
    if (8 == bit_depth) {
30
        c->h264_v_loop_filter_luma = ff_h264_v_lpf_luma_inter_msa;
31
        c->h264_h_loop_filter_luma = ff_h264_h_lpf_luma_inter_msa;
32
        c->h264_h_loop_filter_luma_mbaff =
33
            ff_h264_h_loop_filter_luma_mbaff_msa;
34
        c->h264_v_loop_filter_luma_intra = ff_h264_v_lpf_luma_intra_msa;
35
        c->h264_h_loop_filter_luma_intra = ff_h264_h_lpf_luma_intra_msa;
36
        c->h264_h_loop_filter_luma_mbaff_intra =
37
            ff_h264_h_loop_filter_luma_mbaff_intra_msa;
38
        c->h264_v_loop_filter_chroma = ff_h264_v_lpf_chroma_inter_msa;
39
 
40
        if (chroma_format_idc <= 1)
41
            c->h264_h_loop_filter_chroma = ff_h264_h_lpf_chroma_inter_msa;
42
        else
43
            c->h264_h_loop_filter_chroma =
44
                ff_h264_h_loop_filter_chroma422_msa;
45
 
46
        if (chroma_format_idc > 1)
47
            c->h264_h_loop_filter_chroma_mbaff =
48
                ff_h264_h_loop_filter_chroma422_mbaff_msa;
49
 
50
        c->h264_v_loop_filter_chroma_intra =
51
            ff_h264_v_lpf_chroma_intra_msa;
52
 
53
        if (chroma_format_idc <= 1)
54
            c->h264_h_loop_filter_chroma_intra =
55
                ff_h264_h_lpf_chroma_intra_msa;
56
 
57
        /* Weighted MC */
58
        c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels16_8_msa;
59
        c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels8_8_msa;
60
        c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels4_8_msa;
61
 
62
        c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels16_8_msa;
63
        c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels8_8_msa;
64
        c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels4_8_msa;
65
 
66
        c->h264_idct_add = ff_h264_idct_add_msa;
67
        c->h264_idct8_add = ff_h264_idct8_addblk_msa;
68
        c->h264_idct_dc_add = ff_h264_idct4x4_addblk_dc_msa;
69
        c->h264_idct8_dc_add = ff_h264_idct8_dc_addblk_msa;
70
        c->h264_idct_add16 = ff_h264_idct_add16_msa;
71
        c->h264_idct8_add4 = ff_h264_idct8_add4_msa;
72
 
73
        if (chroma_format_idc <= 1)
74
            c->h264_idct_add8 = ff_h264_idct_add8_msa;
75
        else
76
            c->h264_idct_add8 = ff_h264_idct_add8_422_msa;
77
 
78
        c->h264_idct_add16intra = ff_h264_idct_add16_intra_msa;
79
        c->h264_luma_dc_dequant_idct = ff_h264_deq_idct_luma_dc_msa;
80
    }  // if (8 == bit_depth)
81
}
82
#endif  // #if HAVE_MSA
83
 
84
#if HAVE_MMI
85
static av_cold void h264dsp_init_mmi(H264DSPContext * c, const int bit_depth,
86
        const int chroma_format_idc)
87
{
88
    if (bit_depth == 8) {
89
        c->h264_add_pixels4_clear = ff_h264_add_pixels4_8_mmi;
90
        c->h264_idct_add = ff_h264_idct_add_8_mmi;
91
        c->h264_idct8_add = ff_h264_idct8_add_8_mmi;
92
        c->h264_idct_dc_add = ff_h264_idct_dc_add_8_mmi;
93
        c->h264_idct8_dc_add = ff_h264_idct8_dc_add_8_mmi;
94
        c->h264_idct_add16 = ff_h264_idct_add16_8_mmi;
95
        c->h264_idct_add16intra = ff_h264_idct_add16intra_8_mmi;
96
        c->h264_idct8_add4 = ff_h264_idct8_add4_8_mmi;
97
 
98
        if (chroma_format_idc <= 1)
99
            c->h264_idct_add8 = ff_h264_idct_add8_8_mmi;
100
        else
101
            c->h264_idct_add8 = ff_h264_idct_add8_422_8_mmi;
102
 
103
        c->h264_luma_dc_dequant_idct = ff_h264_luma_dc_dequant_idct_8_mmi;
104
 
105
        if (chroma_format_idc <= 1)
106
            c->h264_chroma_dc_dequant_idct =
107
                ff_h264_chroma_dc_dequant_idct_8_mmi;
108
        else
109
            c->h264_chroma_dc_dequant_idct =
110
                ff_h264_chroma422_dc_dequant_idct_8_mmi;
111
 
112
        c->weight_h264_pixels_tab[0] = ff_h264_weight_pixels16_8_mmi;
113
        c->weight_h264_pixels_tab[1] = ff_h264_weight_pixels8_8_mmi;
114
        c->weight_h264_pixels_tab[2] = ff_h264_weight_pixels4_8_mmi;
115
 
116
        c->biweight_h264_pixels_tab[0] = ff_h264_biweight_pixels16_8_mmi;
117
        c->biweight_h264_pixels_tab[1] = ff_h264_biweight_pixels8_8_mmi;
118
        c->biweight_h264_pixels_tab[2] = ff_h264_biweight_pixels4_8_mmi;
119
 
120
        c->h264_v_loop_filter_chroma       = ff_deblock_v_chroma_8_mmi;
121
        c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_8_mmi;
122
 
123
        if (chroma_format_idc <= 1) {
124
            c->h264_h_loop_filter_chroma =
125
                ff_deblock_h_chroma_8_mmi;
126
            c->h264_h_loop_filter_chroma_intra =
127
                ff_deblock_h_chroma_intra_8_mmi;
128
        }
129
 
130
        c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_mmi;
131
        c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_mmi;
132
        c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_mmi;
133
        c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_mmi;
134
    }
135
}
136
#endif /* HAVE_MMI */
137
 
138
av_cold void ff_h264dsp_init_mips(H264DSPContext *c, const int bit_depth,
139
                                  const int chroma_format_idc)
140
{
141
#if HAVE_MSA
142
    h264dsp_init_msa(c, bit_depth, chroma_format_idc);
143
#endif  // #if HAVE_MSA
144
#if HAVE_MMI
145
    h264dsp_init_mmi(c, bit_depth, chroma_format_idc);
146
#endif /* HAVE_MMI */
147
}