1 /*
2 * Copyright (c) 2021 Loongson Technology Corporation Limited
3 * Contributed by Hao Chen <chenhao@loongson.cn>
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 "libavutil/loongarch/cpu.h"
23 #include "libavcodec/h264pred.h"
24 #include "h264_intrapred_lasx.h"
25
ff_h264_pred_init_loongarch(H264PredContext * h,int codec_id,const int bit_depth,const int chroma_format_idc)26 av_cold void ff_h264_pred_init_loongarch(H264PredContext *h, int codec_id,
27 const int bit_depth,
28 const int chroma_format_idc)
29 {
30 int cpu_flags = av_get_cpu_flags();
31
32 if (bit_depth == 8) {
33 if (have_lasx(cpu_flags)) {
34 if (chroma_format_idc <= 1) {
35 }
36 if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {
37 } else {
38 if (chroma_format_idc <= 1) {
39 }
40 if (codec_id == AV_CODEC_ID_SVQ3) {
41 h->pred16x16[PLANE_PRED8x8] = ff_h264_pred16x16_plane_svq3_8_lasx;
42 } else if (codec_id == AV_CODEC_ID_RV40) {
43 h->pred16x16[PLANE_PRED8x8] = ff_h264_pred16x16_plane_rv40_8_lasx;
44 } else {
45 h->pred16x16[PLANE_PRED8x8] = ff_h264_pred16x16_plane_h264_8_lasx;
46 }
47 }
48 }
49 }
50 }
51