]> git.sesse.net Git - ffmpeg/blob - libavcodec/mips/h264pred_init_mips.c
avcodec/hevc_ps: Remove gotos from ff_hevc_parse_sps()
[ffmpeg] / libavcodec / mips / h264pred_init_mips.c
1 /*
2  * Copyright (c) 2015 Shivraj Patil (Shivraj.Patil@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 "config.h"
22 #include "h264dsp_mips.h"
23
24 #if HAVE_MSA
25 static av_cold void h264_pred_init_msa(H264PredContext *h, int codec_id,
26                                        const int bit_depth,
27                                        const int chroma_format_idc)
28 {
29     if (8 == bit_depth) {
30         if (chroma_format_idc == 1) {
31             h->pred8x8[VERT_PRED8x8] = ff_h264_intra_pred_vert_8x8_msa;
32             h->pred8x8[HOR_PRED8x8] = ff_h264_intra_pred_horiz_8x8_msa;
33         }
34
35         if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) {
36             if (chroma_format_idc == 1) {
37                 h->pred8x8[PLANE_PRED8x8] = ff_h264_intra_predict_plane_8x8_msa;
38             }
39         }
40         if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7
41             && codec_id != AV_CODEC_ID_VP8) {
42             if (chroma_format_idc == 1) {
43                 h->pred8x8[DC_PRED8x8] = ff_h264_intra_predict_dc_4blk_8x8_msa;
44                 h->pred8x8[LEFT_DC_PRED8x8] =
45                     ff_h264_intra_predict_hor_dc_8x8_msa;
46                 h->pred8x8[TOP_DC_PRED8x8] =
47                     ff_h264_intra_predict_vert_dc_8x8_msa;
48                 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8] =
49                     ff_h264_intra_predict_mad_cow_dc_l0t_8x8_msa;
50                 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8] =
51                     ff_h264_intra_predict_mad_cow_dc_0lt_8x8_msa;
52                 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8] =
53                     ff_h264_intra_predict_mad_cow_dc_l00_8x8_msa;
54                 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8] =
55                     ff_h264_intra_predict_mad_cow_dc_0l0_8x8_msa;
56             }
57         } else {
58             if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {
59                 h->pred8x8[7] = ff_vp8_pred8x8_127_dc_8_msa;
60                 h->pred8x8[8] = ff_vp8_pred8x8_129_dc_8_msa;
61             }
62         }
63
64         if (chroma_format_idc == 1) {
65             h->pred8x8[DC_128_PRED8x8] = ff_h264_intra_pred_dc_128_8x8_msa;
66         }
67
68         h->pred16x16[DC_PRED8x8] = ff_h264_intra_pred_dc_16x16_msa;
69         h->pred16x16[VERT_PRED8x8] = ff_h264_intra_pred_vert_16x16_msa;
70         h->pred16x16[HOR_PRED8x8] = ff_h264_intra_pred_horiz_16x16_msa;
71
72         switch (codec_id) {
73         case AV_CODEC_ID_SVQ3:
74             ;
75             break;
76         case AV_CODEC_ID_RV40:
77             ;
78             break;
79         case AV_CODEC_ID_VP7:
80         case AV_CODEC_ID_VP8:
81             h->pred16x16[7] = ff_vp8_pred16x16_127_dc_8_msa;
82             h->pred16x16[8] = ff_vp8_pred16x16_129_dc_8_msa;
83             break;
84         default:
85             h->pred16x16[PLANE_PRED8x8] =
86                 ff_h264_intra_predict_plane_16x16_msa;
87             break;
88         }
89
90         h->pred16x16[LEFT_DC_PRED8x8] = ff_h264_intra_pred_dc_left_16x16_msa;
91         h->pred16x16[TOP_DC_PRED8x8] = ff_h264_intra_pred_dc_top_16x16_msa;
92         h->pred16x16[DC_128_PRED8x8] = ff_h264_intra_pred_dc_128_16x16_msa;
93     }
94 }
95 #endif  // #if HAVE_MSA
96
97 av_cold void ff_h264_pred_init_mips(H264PredContext *h, int codec_id,
98                                     int bit_depth,
99                                     const int chroma_format_idc)
100 {
101 #if HAVE_MSA
102     h264_pred_init_msa(h, codec_id, bit_depth, chroma_format_idc);
103 #endif  // #if HAVE_MSA
104 }