]> git.sesse.net Git - ffmpeg/blob - libavcodec/mips/h264dsp_init_mips.c
8d3d76085f6a9d4fa262800d9e658178bf9b917f
[ffmpeg] / libavcodec / mips / h264dsp_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 "h264dsp_mips.h"
22
23 #if HAVE_MSA
24 static av_cold void h264dsp_init_msa(H264DSPContext *c,
25                                      const int bit_depth,
26                                      const int chroma_format_idc)
27 {
28     if (8 == bit_depth) {
29         c->h264_v_loop_filter_luma = ff_h264_v_lpf_luma_inter_msa;
30         c->h264_h_loop_filter_luma = ff_h264_h_lpf_luma_inter_msa;
31         c->h264_h_loop_filter_luma_mbaff =
32             ff_h264_h_loop_filter_luma_mbaff_msa;
33         c->h264_v_loop_filter_luma_intra = ff_h264_v_lpf_luma_intra_msa;
34         c->h264_h_loop_filter_luma_intra = ff_h264_h_lpf_luma_intra_msa;
35         c->h264_h_loop_filter_luma_mbaff_intra =
36             ff_h264_h_loop_filter_luma_mbaff_intra_msa;
37         c->h264_v_loop_filter_chroma = ff_h264_v_lpf_chroma_inter_msa;
38
39         if (chroma_format_idc <= 1)
40             c->h264_h_loop_filter_chroma = ff_h264_h_lpf_chroma_inter_msa;
41         else
42             c->h264_h_loop_filter_chroma =
43                 ff_h264_h_loop_filter_chroma422_msa;
44
45         if (chroma_format_idc > 1)
46             c->h264_h_loop_filter_chroma_mbaff =
47                 ff_h264_h_loop_filter_chroma422_mbaff_msa;
48
49         c->h264_v_loop_filter_chroma_intra =
50             ff_h264_v_lpf_chroma_intra_msa;
51
52         if (chroma_format_idc <= 1)
53             c->h264_h_loop_filter_chroma_intra =
54                 ff_h264_h_lpf_chroma_intra_msa;
55
56         /* Weighted MC */
57         c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels16_8_msa;
58         c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels8_8_msa;
59         c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels4_8_msa;
60
61         c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels16_8_msa;
62         c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels8_8_msa;
63         c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels4_8_msa;
64     }  // if (8 == bit_depth)
65 }
66 #endif  // #if HAVE_MSA
67
68 av_cold void ff_h264dsp_init_mips(H264DSPContext *c, const int bit_depth,
69                                   const int chroma_format_idc)
70 {
71 #if HAVE_MSA
72     h264dsp_init_msa(c, bit_depth, chroma_format_idc);
73 #endif  // #if HAVE_MSA
74 }