1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * Copyright (c) 2010 Fiona Glaser <fiona@x264.com>
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * This file is part of FFmpeg.
5cabdff1aSopenharmony_ci *
6cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
7cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
8cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
9cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
10cabdff1aSopenharmony_ci *
11cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
12cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
13cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14cabdff1aSopenharmony_ci * Lesser General Public License for more details.
15cabdff1aSopenharmony_ci *
16cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
17cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
18cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19cabdff1aSopenharmony_ci */
20cabdff1aSopenharmony_ci
21cabdff1aSopenharmony_ci#include <stddef.h>
22cabdff1aSopenharmony_ci#include <stdint.h>
23cabdff1aSopenharmony_ci#include "config.h"
24cabdff1aSopenharmony_ci#include "libavutil/attributes.h"
25cabdff1aSopenharmony_ci#include "libavutil/cpu.h"
26cabdff1aSopenharmony_ci#include "libavutil/x86/cpu.h"
27cabdff1aSopenharmony_ci#include "libavcodec/codec_id.h"
28cabdff1aSopenharmony_ci#include "libavcodec/h264pred.h"
29cabdff1aSopenharmony_ci
30cabdff1aSopenharmony_ci#define PRED4x4(TYPE, DEPTH, OPT) \
31cabdff1aSopenharmony_civoid ff_pred4x4_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \
32cabdff1aSopenharmony_ci                                                    const uint8_t *topright, \
33cabdff1aSopenharmony_ci                                                    ptrdiff_t stride);
34cabdff1aSopenharmony_ci
35cabdff1aSopenharmony_ciPRED4x4(dc, 10, mmxext)
36cabdff1aSopenharmony_ciPRED4x4(down_left, 10, sse2)
37cabdff1aSopenharmony_ciPRED4x4(down_left, 10, avx)
38cabdff1aSopenharmony_ciPRED4x4(down_right, 10, sse2)
39cabdff1aSopenharmony_ciPRED4x4(down_right, 10, ssse3)
40cabdff1aSopenharmony_ciPRED4x4(down_right, 10, avx)
41cabdff1aSopenharmony_ciPRED4x4(vertical_left, 10, sse2)
42cabdff1aSopenharmony_ciPRED4x4(vertical_left, 10, avx)
43cabdff1aSopenharmony_ciPRED4x4(vertical_right, 10, sse2)
44cabdff1aSopenharmony_ciPRED4x4(vertical_right, 10, ssse3)
45cabdff1aSopenharmony_ciPRED4x4(vertical_right, 10, avx)
46cabdff1aSopenharmony_ciPRED4x4(horizontal_up, 10, mmxext)
47cabdff1aSopenharmony_ciPRED4x4(horizontal_down, 10, sse2)
48cabdff1aSopenharmony_ciPRED4x4(horizontal_down, 10, ssse3)
49cabdff1aSopenharmony_ciPRED4x4(horizontal_down, 10, avx)
50cabdff1aSopenharmony_ci
51cabdff1aSopenharmony_ci#define PRED8x8(TYPE, DEPTH, OPT) \
52cabdff1aSopenharmony_civoid ff_pred8x8_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \
53cabdff1aSopenharmony_ci                                                    ptrdiff_t stride);
54cabdff1aSopenharmony_ci
55cabdff1aSopenharmony_ciPRED8x8(dc, 10, sse2)
56cabdff1aSopenharmony_ciPRED8x8(top_dc, 10, sse2)
57cabdff1aSopenharmony_ciPRED8x8(plane, 10, sse2)
58cabdff1aSopenharmony_ciPRED8x8(vertical, 10, sse2)
59cabdff1aSopenharmony_ciPRED8x8(horizontal, 10, sse2)
60cabdff1aSopenharmony_ci
61cabdff1aSopenharmony_ci#define PRED8x8L(TYPE, DEPTH, OPT)\
62cabdff1aSopenharmony_civoid ff_pred8x8l_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \
63cabdff1aSopenharmony_ci                                                     int has_topleft, \
64cabdff1aSopenharmony_ci                                                     int has_topright, \
65cabdff1aSopenharmony_ci                                                     ptrdiff_t stride);
66cabdff1aSopenharmony_ci
67cabdff1aSopenharmony_ciPRED8x8L(dc, 10, sse2)
68cabdff1aSopenharmony_ciPRED8x8L(dc, 10, avx)
69cabdff1aSopenharmony_ciPRED8x8L(128_dc, 10, sse2)
70cabdff1aSopenharmony_ciPRED8x8L(top_dc, 10, sse2)
71cabdff1aSopenharmony_ciPRED8x8L(top_dc, 10, avx)
72cabdff1aSopenharmony_ciPRED8x8L(vertical, 10, sse2)
73cabdff1aSopenharmony_ciPRED8x8L(vertical, 10, avx)
74cabdff1aSopenharmony_ciPRED8x8L(horizontal, 10, sse2)
75cabdff1aSopenharmony_ciPRED8x8L(horizontal, 10, ssse3)
76cabdff1aSopenharmony_ciPRED8x8L(horizontal, 10, avx)
77cabdff1aSopenharmony_ciPRED8x8L(down_left, 10, sse2)
78cabdff1aSopenharmony_ciPRED8x8L(down_left, 10, ssse3)
79cabdff1aSopenharmony_ciPRED8x8L(down_left, 10, avx)
80cabdff1aSopenharmony_ciPRED8x8L(down_right, 10, sse2)
81cabdff1aSopenharmony_ciPRED8x8L(down_right, 10, ssse3)
82cabdff1aSopenharmony_ciPRED8x8L(down_right, 10, avx)
83cabdff1aSopenharmony_ciPRED8x8L(vertical_right, 10, sse2)
84cabdff1aSopenharmony_ciPRED8x8L(vertical_right, 10, ssse3)
85cabdff1aSopenharmony_ciPRED8x8L(vertical_right, 10, avx)
86cabdff1aSopenharmony_ciPRED8x8L(horizontal_up, 10, sse2)
87cabdff1aSopenharmony_ciPRED8x8L(horizontal_up, 10, ssse3)
88cabdff1aSopenharmony_ciPRED8x8L(horizontal_up, 10, avx)
89cabdff1aSopenharmony_ci
90cabdff1aSopenharmony_ci#define PRED16x16(TYPE, DEPTH, OPT)\
91cabdff1aSopenharmony_civoid ff_pred16x16_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \
92cabdff1aSopenharmony_ci                                                      ptrdiff_t stride);
93cabdff1aSopenharmony_ci
94cabdff1aSopenharmony_ciPRED16x16(dc, 10, sse2)
95cabdff1aSopenharmony_ciPRED16x16(top_dc, 10, sse2)
96cabdff1aSopenharmony_ciPRED16x16(128_dc, 10, sse2)
97cabdff1aSopenharmony_ciPRED16x16(left_dc, 10, sse2)
98cabdff1aSopenharmony_ciPRED16x16(vertical, 10, sse2)
99cabdff1aSopenharmony_ciPRED16x16(horizontal, 10, sse2)
100cabdff1aSopenharmony_ci
101cabdff1aSopenharmony_ci/* 8-bit versions */
102cabdff1aSopenharmony_ciPRED16x16(vertical, 8, sse)
103cabdff1aSopenharmony_ciPRED16x16(horizontal, 8, mmxext)
104cabdff1aSopenharmony_ciPRED16x16(horizontal, 8, ssse3)
105cabdff1aSopenharmony_ciPRED16x16(dc, 8, sse2)
106cabdff1aSopenharmony_ciPRED16x16(dc, 8, ssse3)
107cabdff1aSopenharmony_ciPRED16x16(plane_h264, 8, sse2)
108cabdff1aSopenharmony_ciPRED16x16(plane_h264, 8, ssse3)
109cabdff1aSopenharmony_ciPRED16x16(plane_rv40, 8, sse2)
110cabdff1aSopenharmony_ciPRED16x16(plane_rv40, 8, ssse3)
111cabdff1aSopenharmony_ciPRED16x16(plane_svq3, 8, sse2)
112cabdff1aSopenharmony_ciPRED16x16(plane_svq3, 8, ssse3)
113cabdff1aSopenharmony_ciPRED16x16(tm_vp8, 8, sse2)
114cabdff1aSopenharmony_ciPRED16x16(tm_vp8, 8, avx2)
115cabdff1aSopenharmony_ci
116cabdff1aSopenharmony_ciPRED8x8(top_dc, 8, mmxext)
117cabdff1aSopenharmony_ciPRED8x8(dc_rv40, 8, mmxext)
118cabdff1aSopenharmony_ciPRED8x8(dc, 8, mmxext)
119cabdff1aSopenharmony_ciPRED8x8(vertical, 8, mmx)
120cabdff1aSopenharmony_ciPRED8x8(horizontal, 8, mmxext)
121cabdff1aSopenharmony_ciPRED8x8(horizontal, 8, ssse3)
122cabdff1aSopenharmony_ciPRED8x8(plane, 8, sse2)
123cabdff1aSopenharmony_ciPRED8x8(plane, 8, ssse3)
124cabdff1aSopenharmony_ciPRED8x8(tm_vp8, 8, sse2)
125cabdff1aSopenharmony_ciPRED8x8(tm_vp8, 8, ssse3)
126cabdff1aSopenharmony_ci
127cabdff1aSopenharmony_ciPRED8x8L(top_dc, 8, mmxext)
128cabdff1aSopenharmony_ciPRED8x8L(top_dc, 8, ssse3)
129cabdff1aSopenharmony_ciPRED8x8L(dc, 8, mmxext)
130cabdff1aSopenharmony_ciPRED8x8L(dc, 8, ssse3)
131cabdff1aSopenharmony_ciPRED8x8L(horizontal, 8, mmxext)
132cabdff1aSopenharmony_ciPRED8x8L(horizontal, 8, ssse3)
133cabdff1aSopenharmony_ciPRED8x8L(vertical, 8, mmxext)
134cabdff1aSopenharmony_ciPRED8x8L(vertical, 8, ssse3)
135cabdff1aSopenharmony_ciPRED8x8L(down_left, 8, sse2)
136cabdff1aSopenharmony_ciPRED8x8L(down_left, 8, ssse3)
137cabdff1aSopenharmony_ciPRED8x8L(down_right, 8, sse2)
138cabdff1aSopenharmony_ciPRED8x8L(down_right, 8, ssse3)
139cabdff1aSopenharmony_ciPRED8x8L(vertical_right, 8, sse2)
140cabdff1aSopenharmony_ciPRED8x8L(vertical_right, 8, ssse3)
141cabdff1aSopenharmony_ciPRED8x8L(vertical_left, 8, sse2)
142cabdff1aSopenharmony_ciPRED8x8L(vertical_left, 8, ssse3)
143cabdff1aSopenharmony_ciPRED8x8L(horizontal_up, 8, mmxext)
144cabdff1aSopenharmony_ciPRED8x8L(horizontal_up, 8, ssse3)
145cabdff1aSopenharmony_ciPRED8x8L(horizontal_down, 8, sse2)
146cabdff1aSopenharmony_ciPRED8x8L(horizontal_down, 8, ssse3)
147cabdff1aSopenharmony_ci
148cabdff1aSopenharmony_ciPRED4x4(dc, 8, mmxext)
149cabdff1aSopenharmony_ciPRED4x4(down_left, 8, mmxext)
150cabdff1aSopenharmony_ciPRED4x4(down_right, 8, mmxext)
151cabdff1aSopenharmony_ciPRED4x4(vertical_left, 8, mmxext)
152cabdff1aSopenharmony_ciPRED4x4(vertical_right, 8, mmxext)
153cabdff1aSopenharmony_ciPRED4x4(horizontal_up, 8, mmxext)
154cabdff1aSopenharmony_ciPRED4x4(horizontal_down, 8, mmxext)
155cabdff1aSopenharmony_ciPRED4x4(tm_vp8, 8, mmxext)
156cabdff1aSopenharmony_ciPRED4x4(tm_vp8, 8, ssse3)
157cabdff1aSopenharmony_ciPRED4x4(vertical_vp8, 8, mmxext)
158cabdff1aSopenharmony_ci
159cabdff1aSopenharmony_ciav_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id,
160cabdff1aSopenharmony_ci                                   const int bit_depth,
161cabdff1aSopenharmony_ci                                   const int chroma_format_idc)
162cabdff1aSopenharmony_ci{
163cabdff1aSopenharmony_ci    int cpu_flags = av_get_cpu_flags();
164cabdff1aSopenharmony_ci
165cabdff1aSopenharmony_ci    if (bit_depth == 8) {
166cabdff1aSopenharmony_ci        if (EXTERNAL_MMX(cpu_flags)) {
167cabdff1aSopenharmony_ci            if (chroma_format_idc <= 1) {
168cabdff1aSopenharmony_ci                h->pred8x8  [VERT_PRED8x8     ] = ff_pred8x8_vertical_8_mmx;
169cabdff1aSopenharmony_ci            }
170cabdff1aSopenharmony_ci        }
171cabdff1aSopenharmony_ci
172cabdff1aSopenharmony_ci        if (EXTERNAL_MMXEXT(cpu_flags)) {
173cabdff1aSopenharmony_ci            h->pred16x16[HOR_PRED8x8            ] = ff_pred16x16_horizontal_8_mmxext;
174cabdff1aSopenharmony_ci            if (chroma_format_idc <= 1)
175cabdff1aSopenharmony_ci                h->pred8x8[HOR_PRED8x8          ] = ff_pred8x8_horizontal_8_mmxext;
176cabdff1aSopenharmony_ci            h->pred8x8l [TOP_DC_PRED            ] = ff_pred8x8l_top_dc_8_mmxext;
177cabdff1aSopenharmony_ci            h->pred8x8l [DC_PRED                ] = ff_pred8x8l_dc_8_mmxext;
178cabdff1aSopenharmony_ci            h->pred8x8l [HOR_PRED               ] = ff_pred8x8l_horizontal_8_mmxext;
179cabdff1aSopenharmony_ci            h->pred8x8l [VERT_PRED              ] = ff_pred8x8l_vertical_8_mmxext;
180cabdff1aSopenharmony_ci            h->pred8x8l [HOR_UP_PRED            ] = ff_pred8x8l_horizontal_up_8_mmxext;
181cabdff1aSopenharmony_ci            h->pred4x4  [DIAG_DOWN_RIGHT_PRED   ] = ff_pred4x4_down_right_8_mmxext;
182cabdff1aSopenharmony_ci            h->pred4x4  [VERT_RIGHT_PRED        ] = ff_pred4x4_vertical_right_8_mmxext;
183cabdff1aSopenharmony_ci            h->pred4x4  [HOR_DOWN_PRED          ] = ff_pred4x4_horizontal_down_8_mmxext;
184cabdff1aSopenharmony_ci            h->pred4x4  [DC_PRED                ] = ff_pred4x4_dc_8_mmxext;
185cabdff1aSopenharmony_ci            if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8 ||
186cabdff1aSopenharmony_ci                codec_id == AV_CODEC_ID_H264) {
187cabdff1aSopenharmony_ci                h->pred4x4  [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_8_mmxext;
188cabdff1aSopenharmony_ci            }
189cabdff1aSopenharmony_ci            if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) {
190cabdff1aSopenharmony_ci                h->pred4x4  [VERT_LEFT_PRED     ] = ff_pred4x4_vertical_left_8_mmxext;
191cabdff1aSopenharmony_ci            }
192cabdff1aSopenharmony_ci            if (codec_id != AV_CODEC_ID_RV40) {
193cabdff1aSopenharmony_ci                h->pred4x4  [HOR_UP_PRED        ] = ff_pred4x4_horizontal_up_8_mmxext;
194cabdff1aSopenharmony_ci            }
195cabdff1aSopenharmony_ci            if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) {
196cabdff1aSopenharmony_ci                if (chroma_format_idc <= 1) {
197cabdff1aSopenharmony_ci                    h->pred8x8[TOP_DC_PRED8x8   ] = ff_pred8x8_top_dc_8_mmxext;
198cabdff1aSopenharmony_ci                    h->pred8x8[DC_PRED8x8       ] = ff_pred8x8_dc_8_mmxext;
199cabdff1aSopenharmony_ci                }
200cabdff1aSopenharmony_ci            }
201cabdff1aSopenharmony_ci            if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {
202cabdff1aSopenharmony_ci                h->pred8x8  [DC_PRED8x8         ] = ff_pred8x8_dc_rv40_8_mmxext;
203cabdff1aSopenharmony_ci                h->pred4x4  [TM_VP8_PRED        ] = ff_pred4x4_tm_vp8_8_mmxext;
204cabdff1aSopenharmony_ci                h->pred4x4  [VERT_PRED          ] = ff_pred4x4_vertical_vp8_8_mmxext;
205cabdff1aSopenharmony_ci            }
206cabdff1aSopenharmony_ci        }
207cabdff1aSopenharmony_ci
208cabdff1aSopenharmony_ci        if (EXTERNAL_SSE(cpu_flags)) {
209cabdff1aSopenharmony_ci            h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_8_sse;
210cabdff1aSopenharmony_ci        }
211cabdff1aSopenharmony_ci
212cabdff1aSopenharmony_ci        if (EXTERNAL_SSE2(cpu_flags)) {
213cabdff1aSopenharmony_ci            h->pred16x16[DC_PRED8x8           ] = ff_pred16x16_dc_8_sse2;
214cabdff1aSopenharmony_ci            h->pred8x8l [DIAG_DOWN_LEFT_PRED  ] = ff_pred8x8l_down_left_8_sse2;
215cabdff1aSopenharmony_ci            h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_8_sse2;
216cabdff1aSopenharmony_ci            h->pred8x8l [VERT_RIGHT_PRED      ] = ff_pred8x8l_vertical_right_8_sse2;
217cabdff1aSopenharmony_ci            h->pred8x8l [VERT_LEFT_PRED       ] = ff_pred8x8l_vertical_left_8_sse2;
218cabdff1aSopenharmony_ci            h->pred8x8l [HOR_DOWN_PRED        ] = ff_pred8x8l_horizontal_down_8_sse2;
219cabdff1aSopenharmony_ci            if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {
220cabdff1aSopenharmony_ci                h->pred16x16[PLANE_PRED8x8    ] = ff_pred16x16_tm_vp8_8_sse2;
221cabdff1aSopenharmony_ci                h->pred8x8  [PLANE_PRED8x8    ] = ff_pred8x8_tm_vp8_8_sse2;
222cabdff1aSopenharmony_ci            } else {
223cabdff1aSopenharmony_ci                if (chroma_format_idc <= 1)
224cabdff1aSopenharmony_ci                    h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_plane_8_sse2;
225cabdff1aSopenharmony_ci                if (codec_id == AV_CODEC_ID_SVQ3) {
226cabdff1aSopenharmony_ci                    h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_8_sse2;
227cabdff1aSopenharmony_ci                } else if (codec_id == AV_CODEC_ID_RV40) {
228cabdff1aSopenharmony_ci                    h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_8_sse2;
229cabdff1aSopenharmony_ci                } else {
230cabdff1aSopenharmony_ci                    h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_8_sse2;
231cabdff1aSopenharmony_ci                }
232cabdff1aSopenharmony_ci            }
233cabdff1aSopenharmony_ci        }
234cabdff1aSopenharmony_ci
235cabdff1aSopenharmony_ci        if (EXTERNAL_SSSE3(cpu_flags)) {
236cabdff1aSopenharmony_ci            h->pred16x16[HOR_PRED8x8          ] = ff_pred16x16_horizontal_8_ssse3;
237cabdff1aSopenharmony_ci            h->pred16x16[DC_PRED8x8           ] = ff_pred16x16_dc_8_ssse3;
238cabdff1aSopenharmony_ci            if (chroma_format_idc <= 1)
239cabdff1aSopenharmony_ci                h->pred8x8  [HOR_PRED8x8      ] = ff_pred8x8_horizontal_8_ssse3;
240cabdff1aSopenharmony_ci            h->pred8x8l [TOP_DC_PRED          ] = ff_pred8x8l_top_dc_8_ssse3;
241cabdff1aSopenharmony_ci            h->pred8x8l [DC_PRED              ] = ff_pred8x8l_dc_8_ssse3;
242cabdff1aSopenharmony_ci            h->pred8x8l [HOR_PRED             ] = ff_pred8x8l_horizontal_8_ssse3;
243cabdff1aSopenharmony_ci            h->pred8x8l [VERT_PRED            ] = ff_pred8x8l_vertical_8_ssse3;
244cabdff1aSopenharmony_ci            h->pred8x8l [DIAG_DOWN_LEFT_PRED  ] = ff_pred8x8l_down_left_8_ssse3;
245cabdff1aSopenharmony_ci            h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_8_ssse3;
246cabdff1aSopenharmony_ci            h->pred8x8l [VERT_RIGHT_PRED      ] = ff_pred8x8l_vertical_right_8_ssse3;
247cabdff1aSopenharmony_ci            h->pred8x8l [VERT_LEFT_PRED       ] = ff_pred8x8l_vertical_left_8_ssse3;
248cabdff1aSopenharmony_ci            h->pred8x8l [HOR_UP_PRED          ] = ff_pred8x8l_horizontal_up_8_ssse3;
249cabdff1aSopenharmony_ci            h->pred8x8l [HOR_DOWN_PRED        ] = ff_pred8x8l_horizontal_down_8_ssse3;
250cabdff1aSopenharmony_ci            if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {
251cabdff1aSopenharmony_ci                h->pred8x8  [PLANE_PRED8x8    ] = ff_pred8x8_tm_vp8_8_ssse3;
252cabdff1aSopenharmony_ci                h->pred4x4  [TM_VP8_PRED      ] = ff_pred4x4_tm_vp8_8_ssse3;
253cabdff1aSopenharmony_ci            } else {
254cabdff1aSopenharmony_ci                if (chroma_format_idc <= 1)
255cabdff1aSopenharmony_ci                    h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_plane_8_ssse3;
256cabdff1aSopenharmony_ci                if (codec_id == AV_CODEC_ID_SVQ3) {
257cabdff1aSopenharmony_ci                    h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_8_ssse3;
258cabdff1aSopenharmony_ci                } else if (codec_id == AV_CODEC_ID_RV40) {
259cabdff1aSopenharmony_ci                    h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_8_ssse3;
260cabdff1aSopenharmony_ci                } else {
261cabdff1aSopenharmony_ci                    h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_8_ssse3;
262cabdff1aSopenharmony_ci                }
263cabdff1aSopenharmony_ci            }
264cabdff1aSopenharmony_ci        }
265cabdff1aSopenharmony_ci
266cabdff1aSopenharmony_ci        if(EXTERNAL_AVX2(cpu_flags)){
267cabdff1aSopenharmony_ci            if (codec_id == AV_CODEC_ID_VP8) {
268cabdff1aSopenharmony_ci                h->pred16x16[PLANE_PRED8x8    ] = ff_pred16x16_tm_vp8_8_avx2;
269cabdff1aSopenharmony_ci            }
270cabdff1aSopenharmony_ci        }
271cabdff1aSopenharmony_ci    } else if (bit_depth == 10) {
272cabdff1aSopenharmony_ci        if (EXTERNAL_MMXEXT(cpu_flags)) {
273cabdff1aSopenharmony_ci            h->pred4x4[DC_PRED             ] = ff_pred4x4_dc_10_mmxext;
274cabdff1aSopenharmony_ci            h->pred4x4[HOR_UP_PRED         ] = ff_pred4x4_horizontal_up_10_mmxext;
275cabdff1aSopenharmony_ci        }
276cabdff1aSopenharmony_ci        if (EXTERNAL_SSE2(cpu_flags)) {
277cabdff1aSopenharmony_ci            h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2;
278cabdff1aSopenharmony_ci            h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2;
279cabdff1aSopenharmony_ci            h->pred4x4[VERT_LEFT_PRED      ] = ff_pred4x4_vertical_left_10_sse2;
280cabdff1aSopenharmony_ci            h->pred4x4[VERT_RIGHT_PRED     ] = ff_pred4x4_vertical_right_10_sse2;
281cabdff1aSopenharmony_ci            h->pred4x4[HOR_DOWN_PRED       ] = ff_pred4x4_horizontal_down_10_sse2;
282cabdff1aSopenharmony_ci
283cabdff1aSopenharmony_ci            if (chroma_format_idc <= 1) {
284cabdff1aSopenharmony_ci                h->pred8x8[DC_PRED8x8      ] = ff_pred8x8_dc_10_sse2;
285cabdff1aSopenharmony_ci                h->pred8x8[TOP_DC_PRED8x8  ] = ff_pred8x8_top_dc_10_sse2;
286cabdff1aSopenharmony_ci                h->pred8x8[PLANE_PRED8x8   ] = ff_pred8x8_plane_10_sse2;
287cabdff1aSopenharmony_ci                h->pred8x8[VERT_PRED8x8    ] = ff_pred8x8_vertical_10_sse2;
288cabdff1aSopenharmony_ci                h->pred8x8[HOR_PRED8x8     ] = ff_pred8x8_horizontal_10_sse2;
289cabdff1aSopenharmony_ci            }
290cabdff1aSopenharmony_ci
291cabdff1aSopenharmony_ci            h->pred8x8l[VERT_PRED           ] = ff_pred8x8l_vertical_10_sse2;
292cabdff1aSopenharmony_ci            h->pred8x8l[HOR_PRED            ] = ff_pred8x8l_horizontal_10_sse2;
293cabdff1aSopenharmony_ci            h->pred8x8l[DC_PRED             ] = ff_pred8x8l_dc_10_sse2;
294cabdff1aSopenharmony_ci            h->pred8x8l[DC_128_PRED         ] = ff_pred8x8l_128_dc_10_sse2;
295cabdff1aSopenharmony_ci            h->pred8x8l[TOP_DC_PRED         ] = ff_pred8x8l_top_dc_10_sse2;
296cabdff1aSopenharmony_ci            h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_sse2;
297cabdff1aSopenharmony_ci            h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_sse2;
298cabdff1aSopenharmony_ci            h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_10_sse2;
299cabdff1aSopenharmony_ci            h->pred8x8l[HOR_UP_PRED         ] = ff_pred8x8l_horizontal_up_10_sse2;
300cabdff1aSopenharmony_ci
301cabdff1aSopenharmony_ci            h->pred16x16[DC_PRED8x8        ] = ff_pred16x16_dc_10_sse2;
302cabdff1aSopenharmony_ci            h->pred16x16[TOP_DC_PRED8x8    ] = ff_pred16x16_top_dc_10_sse2;
303cabdff1aSopenharmony_ci            h->pred16x16[DC_128_PRED8x8    ] = ff_pred16x16_128_dc_10_sse2;
304cabdff1aSopenharmony_ci            h->pred16x16[LEFT_DC_PRED8x8   ] = ff_pred16x16_left_dc_10_sse2;
305cabdff1aSopenharmony_ci            h->pred16x16[VERT_PRED8x8      ] = ff_pred16x16_vertical_10_sse2;
306cabdff1aSopenharmony_ci            h->pred16x16[HOR_PRED8x8       ] = ff_pred16x16_horizontal_10_sse2;
307cabdff1aSopenharmony_ci        }
308cabdff1aSopenharmony_ci        if (EXTERNAL_SSSE3(cpu_flags)) {
309cabdff1aSopenharmony_ci            h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3;
310cabdff1aSopenharmony_ci            h->pred4x4[VERT_RIGHT_PRED     ] = ff_pred4x4_vertical_right_10_ssse3;
311cabdff1aSopenharmony_ci            h->pred4x4[HOR_DOWN_PRED       ] = ff_pred4x4_horizontal_down_10_ssse3;
312cabdff1aSopenharmony_ci
313cabdff1aSopenharmony_ci            h->pred8x8l[HOR_PRED            ] = ff_pred8x8l_horizontal_10_ssse3;
314cabdff1aSopenharmony_ci            h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_ssse3;
315cabdff1aSopenharmony_ci            h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_ssse3;
316cabdff1aSopenharmony_ci            h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_10_ssse3;
317cabdff1aSopenharmony_ci            h->pred8x8l[HOR_UP_PRED         ] = ff_pred8x8l_horizontal_up_10_ssse3;
318cabdff1aSopenharmony_ci        }
319cabdff1aSopenharmony_ci        if (EXTERNAL_AVX(cpu_flags)) {
320cabdff1aSopenharmony_ci            h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx;
321cabdff1aSopenharmony_ci            h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx;
322cabdff1aSopenharmony_ci            h->pred4x4[VERT_LEFT_PRED      ] = ff_pred4x4_vertical_left_10_avx;
323cabdff1aSopenharmony_ci            h->pred4x4[VERT_RIGHT_PRED     ] = ff_pred4x4_vertical_right_10_avx;
324cabdff1aSopenharmony_ci            h->pred4x4[HOR_DOWN_PRED       ] = ff_pred4x4_horizontal_down_10_avx;
325cabdff1aSopenharmony_ci
326cabdff1aSopenharmony_ci            h->pred8x8l[VERT_PRED           ] = ff_pred8x8l_vertical_10_avx;
327cabdff1aSopenharmony_ci            h->pred8x8l[HOR_PRED            ] = ff_pred8x8l_horizontal_10_avx;
328cabdff1aSopenharmony_ci            h->pred8x8l[DC_PRED             ] = ff_pred8x8l_dc_10_avx;
329cabdff1aSopenharmony_ci            h->pred8x8l[TOP_DC_PRED         ] = ff_pred8x8l_top_dc_10_avx;
330cabdff1aSopenharmony_ci            h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_avx;
331cabdff1aSopenharmony_ci            h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_avx;
332cabdff1aSopenharmony_ci            h->pred8x8l[VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_10_avx;
333cabdff1aSopenharmony_ci            h->pred8x8l[HOR_UP_PRED         ] = ff_pred8x8l_horizontal_up_10_avx;
334cabdff1aSopenharmony_ci        }
335cabdff1aSopenharmony_ci    }
336cabdff1aSopenharmony_ci}
337