1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * HEVC video decoder
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * Copyright (C) 2012 - 2013 Guillaume Martres
5cabdff1aSopenharmony_ci * Copyright (C) 2013 - 2014 Pierre-Edouard Lepere
6cabdff1aSopenharmony_ci *
7cabdff1aSopenharmony_ci *
8cabdff1aSopenharmony_ci * This file is part of FFmpeg.
9cabdff1aSopenharmony_ci *
10cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
11cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
12cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
13cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
14cabdff1aSopenharmony_ci *
15cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
16cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
17cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18cabdff1aSopenharmony_ci * Lesser General Public License for more details.
19cabdff1aSopenharmony_ci *
20cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
21cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
22cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23cabdff1aSopenharmony_ci */
24cabdff1aSopenharmony_ci
25cabdff1aSopenharmony_ci#include "hevcdsp.h"
26cabdff1aSopenharmony_ci
27cabdff1aSopenharmony_cistatic const int8_t transform[32][32] = {
28cabdff1aSopenharmony_ci    { 64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,
29cabdff1aSopenharmony_ci      64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64 },
30cabdff1aSopenharmony_ci    { 90,  90,  88,  85,  82,  78,  73,  67,  61,  54,  46,  38,  31,  22,  13,   4,
31cabdff1aSopenharmony_ci      -4, -13, -22, -31, -38, -46, -54, -61, -67, -73, -78, -82, -85, -88, -90, -90 },
32cabdff1aSopenharmony_ci    { 90,  87,  80,  70,  57,  43,  25,   9,  -9, -25, -43, -57, -70, -80, -87, -90,
33cabdff1aSopenharmony_ci     -90, -87, -80, -70, -57, -43, -25,  -9,   9,  25,  43,  57,  70,  80,  87,  90 },
34cabdff1aSopenharmony_ci    { 90,  82,  67,  46,  22,  -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13,
35cabdff1aSopenharmony_ci      13,  38,  61,  78,  88,  90,  85,  73,  54,  31,   4, -22, -46, -67, -82, -90 },
36cabdff1aSopenharmony_ci    { 89,  75,  50,  18, -18, -50, -75, -89, -89, -75, -50, -18,  18,  50,  75,  89,
37cabdff1aSopenharmony_ci      89,  75,  50,  18, -18, -50, -75, -89, -89, -75, -50, -18,  18,  50,  75,  89 },
38cabdff1aSopenharmony_ci    { 88,  67,  31, -13, -54, -82, -90, -78, -46, -4,   38,  73,  90,  85,  61,  22,
39cabdff1aSopenharmony_ci     -22, -61, -85, -90, -73, -38,   4,  46,  78,  90,  82,  54,  13, -31, -67, -88 },
40cabdff1aSopenharmony_ci    { 87,  57,   9, -43, -80, -90, -70, -25,  25,  70,  90,  80,  43,  -9, -57, -87,
41cabdff1aSopenharmony_ci     -87, -57,  -9,  43,  80,  90,  70,  25, -25, -70, -90, -80, -43,   9,  57,  87 },
42cabdff1aSopenharmony_ci    { 85,  46, -13, -67, -90, -73, -22,  38,  82,  88,  54,  -4, -61, -90, -78, -31,
43cabdff1aSopenharmony_ci      31,  78,  90,  61,   4, -54, -88, -82, -38,  22,  73,  90,  67,  13, -46, -85 },
44cabdff1aSopenharmony_ci    { 83,  36, -36, -83, -83, -36,  36,  83,  83,  36, -36, -83, -83, -36,  36,  83,
45cabdff1aSopenharmony_ci      83,  36, -36, -83, -83, -36,  36,  83,  83,  36, -36, -83, -83, -36,  36,  83 },
46cabdff1aSopenharmony_ci    { 82,  22, -54, -90, -61,  13,  78,  85,  31, -46, -90, -67,   4,  73,  88,  38,
47cabdff1aSopenharmony_ci     -38, -88, -73,  -4,  67,  90,  46, -31, -85, -78, -13,  61,  90,  54, -22, -82 },
48cabdff1aSopenharmony_ci    { 80,   9, -70, -87, -25,  57,  90,  43, -43, -90, -57,  25,  87,  70,  -9, -80,
49cabdff1aSopenharmony_ci     -80,  -9,  70,  87,  25, -57, -90, -43,  43,  90,  57, -25, -87, -70,   9,  80 },
50cabdff1aSopenharmony_ci    { 78,  -4, -82, -73,  13,  85,  67, -22, -88, -61,  31,  90,  54, -38, -90, -46,
51cabdff1aSopenharmony_ci      46,  90,  38, -54, -90, -31,  61,  88,  22, -67, -85, -13,  73,  82,   4, -78 },
52cabdff1aSopenharmony_ci    { 75, -18, -89, -50,  50,  89,  18, -75, -75,  18,  89,  50, -50, -89, -18,  75,
53cabdff1aSopenharmony_ci      75, -18, -89, -50,  50,  89,  18, -75, -75,  18,  89,  50, -50, -89, -18,  75 },
54cabdff1aSopenharmony_ci    { 73, -31, -90, -22,  78,  67, -38, -90, -13,  82,  61, -46, -88,  -4,  85,  54,
55cabdff1aSopenharmony_ci     -54, -85,   4,  88,  46, -61, -82,  13,  90,  38, -67, -78,  22,  90,  31, -73 },
56cabdff1aSopenharmony_ci    { 70, -43, -87,   9,  90,  25, -80, -57,  57,  80, -25, -90,  -9,  87,  43, -70,
57cabdff1aSopenharmony_ci     -70,  43,  87,  -9, -90, -25,  80,  57, -57, -80,  25,  90,   9, -87, -43,  70 },
58cabdff1aSopenharmony_ci    { 67, -54, -78,  38,  85, -22, -90,   4,  90,  13, -88, -31,  82,  46, -73, -61,
59cabdff1aSopenharmony_ci      61,  73, -46, -82,  31,  88, -13, -90,  -4,  90,  22, -85, -38,  78,  54, -67 },
60cabdff1aSopenharmony_ci    { 64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,
61cabdff1aSopenharmony_ci      64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64 },
62cabdff1aSopenharmony_ci    { 61, -73, -46,  82,  31, -88, -13,  90,  -4, -90,  22,  85, -38, -78,  54,  67,
63cabdff1aSopenharmony_ci     -67, -54,  78,  38, -85, -22,  90,   4, -90,  13,  88, -31, -82,  46,  73, -61 },
64cabdff1aSopenharmony_ci    { 57, -80, -25,  90,  -9, -87,  43,  70, -70, -43,  87,   9, -90,  25,  80, -57,
65cabdff1aSopenharmony_ci     -57,  80,  25, -90,   9,  87, -43, -70,  70,  43, -87,  -9,  90, -25, -80,  57 },
66cabdff1aSopenharmony_ci    { 54, -85,  -4,  88, -46, -61,  82,  13, -90,  38,  67, -78, -22,  90, -31, -73,
67cabdff1aSopenharmony_ci      73,  31, -90,  22,  78, -67, -38,  90, -13, -82,  61,  46, -88,   4,  85, -54 },
68cabdff1aSopenharmony_ci    { 50, -89,  18,  75, -75, -18,  89, -50, -50,  89, -18, -75,  75,  18, -89,  50,
69cabdff1aSopenharmony_ci      50, -89,  18,  75, -75, -18,  89, -50, -50,  89, -18, -75,  75,  18, -89,  50 },
70cabdff1aSopenharmony_ci    { 46, -90,  38,  54, -90,  31,  61, -88,  22,  67, -85,  13,  73, -82,   4,  78,
71cabdff1aSopenharmony_ci     -78,  -4,  82, -73, -13,  85, -67, -22,  88, -61, -31,  90, -54, -38,  90, -46 },
72cabdff1aSopenharmony_ci    { 43, -90,  57,  25, -87,  70,   9, -80,  80,  -9, -70,  87, -25, -57,  90, -43,
73cabdff1aSopenharmony_ci     -43,  90, -57, -25,  87, -70,  -9,  80, -80,   9,  70, -87,  25,  57, -90,  43 },
74cabdff1aSopenharmony_ci    { 38, -88,  73,  -4, -67,  90, -46, -31,  85, -78,  13,  61, -90,  54,  22, -82,
75cabdff1aSopenharmony_ci      82, -22, -54,  90, -61, -13,  78, -85,  31,  46, -90,  67,   4, -73,  88, -38 },
76cabdff1aSopenharmony_ci    { 36, -83,  83, -36, -36,  83, -83,  36,  36, -83,  83, -36, -36,  83, -83,  36,
77cabdff1aSopenharmony_ci      36, -83,  83, -36, -36,  83, -83,  36,  36, -83,  83, -36, -36,  83, -83,  36 },
78cabdff1aSopenharmony_ci    { 31, -78,  90, -61,   4,  54, -88,  82, -38, -22,  73, -90,  67, -13, -46,  85,
79cabdff1aSopenharmony_ci     -85,  46,  13, -67,  90, -73,  22,  38, -82,  88, -54,  -4,  61, -90,  78, -31 },
80cabdff1aSopenharmony_ci    { 25, -70,  90, -80,  43,   9, -57,  87, -87,  57,  -9, -43,  80, -90,  70, -25,
81cabdff1aSopenharmony_ci     -25,  70, -90,  80, -43,  -9,  57, -87,  87, -57,   9,  43, -80,  90, -70,  25 },
82cabdff1aSopenharmony_ci    { 22, -61,  85, -90,  73, -38,  -4,  46, -78,  90, -82,  54, -13, -31,  67, -88,
83cabdff1aSopenharmony_ci      88, -67,  31,  13, -54,  82, -90,  78, -46,   4,  38, -73,  90, -85,  61, -22 },
84cabdff1aSopenharmony_ci    { 18, -50,  75, -89,  89, -75,  50, -18, -18,  50, -75,  89, -89,  75, -50,  18,
85cabdff1aSopenharmony_ci      18, -50,  75, -89,  89, -75,  50, -18, -18,  50, -75,  89, -89,  75, -50,  18 },
86cabdff1aSopenharmony_ci    { 13, -38,  61, -78,  88, -90,  85, -73,  54, -31,   4,  22, -46,  67, -82,  90,
87cabdff1aSopenharmony_ci     -90,  82, -67,  46, -22,  -4,  31, -54,  73, -85,  90, -88,  78, -61,  38, -13 },
88cabdff1aSopenharmony_ci    {  9, -25,  43, -57,  70, -80,  87, -90,  90, -87,  80, -70,  57, -43,  25, -9,
89cabdff1aSopenharmony_ci      -9,  25, -43,  57, -70,  80, -87,  90, -90,  87, -80,  70, -57,  43, -25,   9 },
90cabdff1aSopenharmony_ci    {  4, -13,  22, -31,  38, -46,  54, -61,  67, -73,  78, -82,  85, -88,  90, -90,
91cabdff1aSopenharmony_ci      90, -90,  88, -85,  82, -78,  73, -67,  61, -54,  46, -38,  31, -22,  13,  -4 },
92cabdff1aSopenharmony_ci};
93cabdff1aSopenharmony_ci
94cabdff1aSopenharmony_ciDECLARE_ALIGNED(16, const int8_t, ff_hevc_epel_filters)[7][4] = {
95cabdff1aSopenharmony_ci    { -2, 58, 10, -2},
96cabdff1aSopenharmony_ci    { -4, 54, 16, -2},
97cabdff1aSopenharmony_ci    { -6, 46, 28, -4},
98cabdff1aSopenharmony_ci    { -4, 36, 36, -4},
99cabdff1aSopenharmony_ci    { -4, 28, 46, -6},
100cabdff1aSopenharmony_ci    { -2, 16, 54, -4},
101cabdff1aSopenharmony_ci    { -2, 10, 58, -2},
102cabdff1aSopenharmony_ci};
103cabdff1aSopenharmony_ci
104cabdff1aSopenharmony_ciDECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters)[3][16] = {
105cabdff1aSopenharmony_ci    { -1,  4,-10, 58, 17, -5,  1,  0, -1,  4,-10, 58, 17, -5,  1,  0},
106cabdff1aSopenharmony_ci    { -1,  4,-11, 40, 40,-11,  4, -1, -1,  4,-11, 40, 40,-11,  4, -1},
107cabdff1aSopenharmony_ci    {  0,  1, -5, 17, 58,-10,  4, -1,  0,  1, -5, 17, 58,-10,  4, -1}
108cabdff1aSopenharmony_ci};
109cabdff1aSopenharmony_ci
110cabdff1aSopenharmony_ci#define BIT_DEPTH 8
111cabdff1aSopenharmony_ci#include "hevcdsp_template.c"
112cabdff1aSopenharmony_ci#undef BIT_DEPTH
113cabdff1aSopenharmony_ci
114cabdff1aSopenharmony_ci#define BIT_DEPTH 9
115cabdff1aSopenharmony_ci#include "hevcdsp_template.c"
116cabdff1aSopenharmony_ci#undef BIT_DEPTH
117cabdff1aSopenharmony_ci
118cabdff1aSopenharmony_ci#define BIT_DEPTH 10
119cabdff1aSopenharmony_ci#include "hevcdsp_template.c"
120cabdff1aSopenharmony_ci#undef BIT_DEPTH
121cabdff1aSopenharmony_ci
122cabdff1aSopenharmony_ci#define BIT_DEPTH 12
123cabdff1aSopenharmony_ci#include "hevcdsp_template.c"
124cabdff1aSopenharmony_ci#undef BIT_DEPTH
125cabdff1aSopenharmony_ci
126cabdff1aSopenharmony_civoid ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth)
127cabdff1aSopenharmony_ci{
128cabdff1aSopenharmony_ci#undef FUNC
129cabdff1aSopenharmony_ci#define FUNC(a, depth) a ## _ ## depth
130cabdff1aSopenharmony_ci
131cabdff1aSopenharmony_ci#undef PEL_FUNC
132cabdff1aSopenharmony_ci#define PEL_FUNC(dst1, idx1, idx2, a, depth)                                   \
133cabdff1aSopenharmony_ci    for(i = 0 ; i < 10 ; i++)                                                  \
134cabdff1aSopenharmony_ci{                                                                              \
135cabdff1aSopenharmony_ci    hevcdsp->dst1[i][idx1][idx2] = a ## _ ## depth;                            \
136cabdff1aSopenharmony_ci}
137cabdff1aSopenharmony_ci
138cabdff1aSopenharmony_ci#undef EPEL_FUNCS
139cabdff1aSopenharmony_ci#define EPEL_FUNCS(depth)                                                     \
140cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel, 0, 0, put_hevc_pel_pixels, depth);                \
141cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel, 0, 1, put_hevc_epel_h, depth);                    \
142cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel, 1, 0, put_hevc_epel_v, depth);                    \
143cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel, 1, 1, put_hevc_epel_hv, depth)
144cabdff1aSopenharmony_ci
145cabdff1aSopenharmony_ci#undef EPEL_UNI_FUNCS
146cabdff1aSopenharmony_ci#define EPEL_UNI_FUNCS(depth)                                                 \
147cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_uni, 0, 0, put_hevc_pel_uni_pixels, depth);        \
148cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_uni, 0, 1, put_hevc_epel_uni_h, depth);            \
149cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_uni, 1, 0, put_hevc_epel_uni_v, depth);            \
150cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_uni, 1, 1, put_hevc_epel_uni_hv, depth);           \
151cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_uni_w, 0, 0, put_hevc_pel_uni_w_pixels, depth);    \
152cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_uni_w, 0, 1, put_hevc_epel_uni_w_h, depth);        \
153cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_uni_w, 1, 0, put_hevc_epel_uni_w_v, depth);        \
154cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_uni_w, 1, 1, put_hevc_epel_uni_w_hv, depth)
155cabdff1aSopenharmony_ci
156cabdff1aSopenharmony_ci#undef EPEL_BI_FUNCS
157cabdff1aSopenharmony_ci#define EPEL_BI_FUNCS(depth)                                                \
158cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_bi, 0, 0, put_hevc_pel_bi_pixels, depth);        \
159cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_bi, 0, 1, put_hevc_epel_bi_h, depth);            \
160cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_bi, 1, 0, put_hevc_epel_bi_v, depth);            \
161cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_bi, 1, 1, put_hevc_epel_bi_hv, depth);           \
162cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_bi_w, 0, 0, put_hevc_pel_bi_w_pixels, depth);    \
163cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_bi_w, 0, 1, put_hevc_epel_bi_w_h, depth);        \
164cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_bi_w, 1, 0, put_hevc_epel_bi_w_v, depth);        \
165cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_epel_bi_w, 1, 1, put_hevc_epel_bi_w_hv, depth)
166cabdff1aSopenharmony_ci
167cabdff1aSopenharmony_ci#undef QPEL_FUNCS
168cabdff1aSopenharmony_ci#define QPEL_FUNCS(depth)                                                     \
169cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel, 0, 0, put_hevc_pel_pixels, depth);                \
170cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel, 0, 1, put_hevc_qpel_h, depth);                    \
171cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel, 1, 0, put_hevc_qpel_v, depth);                    \
172cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel, 1, 1, put_hevc_qpel_hv, depth)
173cabdff1aSopenharmony_ci
174cabdff1aSopenharmony_ci#undef QPEL_UNI_FUNCS
175cabdff1aSopenharmony_ci#define QPEL_UNI_FUNCS(depth)                                                 \
176cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_uni, 0, 0, put_hevc_pel_uni_pixels, depth);        \
177cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_uni, 0, 1, put_hevc_qpel_uni_h, depth);            \
178cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_uni, 1, 0, put_hevc_qpel_uni_v, depth);            \
179cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_uni, 1, 1, put_hevc_qpel_uni_hv, depth);           \
180cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_uni_w, 0, 0, put_hevc_pel_uni_w_pixels, depth);    \
181cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_uni_w, 0, 1, put_hevc_qpel_uni_w_h, depth);        \
182cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_uni_w, 1, 0, put_hevc_qpel_uni_w_v, depth);        \
183cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_uni_w, 1, 1, put_hevc_qpel_uni_w_hv, depth)
184cabdff1aSopenharmony_ci
185cabdff1aSopenharmony_ci#undef QPEL_BI_FUNCS
186cabdff1aSopenharmony_ci#define QPEL_BI_FUNCS(depth)                                                  \
187cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_bi, 0, 0, put_hevc_pel_bi_pixels, depth);          \
188cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_bi, 0, 1, put_hevc_qpel_bi_h, depth);              \
189cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_bi, 1, 0, put_hevc_qpel_bi_v, depth);              \
190cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_bi, 1, 1, put_hevc_qpel_bi_hv, depth);             \
191cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_bi_w, 0, 0, put_hevc_pel_bi_w_pixels, depth);      \
192cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_bi_w, 0, 1, put_hevc_qpel_bi_w_h, depth);          \
193cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_bi_w, 1, 0, put_hevc_qpel_bi_w_v, depth);          \
194cabdff1aSopenharmony_ci    PEL_FUNC(put_hevc_qpel_bi_w, 1, 1, put_hevc_qpel_bi_w_hv, depth)
195cabdff1aSopenharmony_ci
196cabdff1aSopenharmony_ci#define HEVC_DSP(depth)                                                     \
197cabdff1aSopenharmony_ci    hevcdsp->put_pcm                = FUNC(put_pcm, depth);                 \
198cabdff1aSopenharmony_ci    hevcdsp->add_residual[0]        = FUNC(add_residual4x4, depth);         \
199cabdff1aSopenharmony_ci    hevcdsp->add_residual[1]        = FUNC(add_residual8x8, depth);         \
200cabdff1aSopenharmony_ci    hevcdsp->add_residual[2]        = FUNC(add_residual16x16, depth);       \
201cabdff1aSopenharmony_ci    hevcdsp->add_residual[3]        = FUNC(add_residual32x32, depth);       \
202cabdff1aSopenharmony_ci    hevcdsp->dequant                = FUNC(dequant, depth);                 \
203cabdff1aSopenharmony_ci    hevcdsp->transform_rdpcm        = FUNC(transform_rdpcm, depth);         \
204cabdff1aSopenharmony_ci    hevcdsp->transform_4x4_luma     = FUNC(transform_4x4_luma, depth);      \
205cabdff1aSopenharmony_ci    hevcdsp->idct[0]                = FUNC(idct_4x4, depth);                \
206cabdff1aSopenharmony_ci    hevcdsp->idct[1]                = FUNC(idct_8x8, depth);                \
207cabdff1aSopenharmony_ci    hevcdsp->idct[2]                = FUNC(idct_16x16, depth);              \
208cabdff1aSopenharmony_ci    hevcdsp->idct[3]                = FUNC(idct_32x32, depth);              \
209cabdff1aSopenharmony_ci                                                                            \
210cabdff1aSopenharmony_ci    hevcdsp->idct_dc[0]             = FUNC(idct_4x4_dc, depth);             \
211cabdff1aSopenharmony_ci    hevcdsp->idct_dc[1]             = FUNC(idct_8x8_dc, depth);             \
212cabdff1aSopenharmony_ci    hevcdsp->idct_dc[2]             = FUNC(idct_16x16_dc, depth);           \
213cabdff1aSopenharmony_ci    hevcdsp->idct_dc[3]             = FUNC(idct_32x32_dc, depth);           \
214cabdff1aSopenharmony_ci                                                                            \
215cabdff1aSopenharmony_ci    hevcdsp->sao_band_filter[0] =                                              \
216cabdff1aSopenharmony_ci    hevcdsp->sao_band_filter[1] =                                              \
217cabdff1aSopenharmony_ci    hevcdsp->sao_band_filter[2] =                                              \
218cabdff1aSopenharmony_ci    hevcdsp->sao_band_filter[3] =                                              \
219cabdff1aSopenharmony_ci    hevcdsp->sao_band_filter[4] = FUNC(sao_band_filter, depth);                \
220cabdff1aSopenharmony_ci    hevcdsp->sao_edge_filter[0] =                                              \
221cabdff1aSopenharmony_ci    hevcdsp->sao_edge_filter[1] =                                              \
222cabdff1aSopenharmony_ci    hevcdsp->sao_edge_filter[2] =                                              \
223cabdff1aSopenharmony_ci    hevcdsp->sao_edge_filter[3] =                                              \
224cabdff1aSopenharmony_ci    hevcdsp->sao_edge_filter[4] = FUNC(sao_edge_filter, depth);                \
225cabdff1aSopenharmony_ci    hevcdsp->sao_edge_restore[0] = FUNC(sao_edge_restore_0, depth);            \
226cabdff1aSopenharmony_ci    hevcdsp->sao_edge_restore[1] = FUNC(sao_edge_restore_1, depth);            \
227cabdff1aSopenharmony_ci                                                                               \
228cabdff1aSopenharmony_ci    QPEL_FUNCS(depth);                                                         \
229cabdff1aSopenharmony_ci    QPEL_UNI_FUNCS(depth);                                                     \
230cabdff1aSopenharmony_ci    QPEL_BI_FUNCS(depth);                                                      \
231cabdff1aSopenharmony_ci    EPEL_FUNCS(depth);                                                         \
232cabdff1aSopenharmony_ci    EPEL_UNI_FUNCS(depth);                                                     \
233cabdff1aSopenharmony_ci    EPEL_BI_FUNCS(depth);                                                      \
234cabdff1aSopenharmony_ci                                                                               \
235cabdff1aSopenharmony_ci    hevcdsp->hevc_h_loop_filter_luma     = FUNC(hevc_h_loop_filter_luma, depth);   \
236cabdff1aSopenharmony_ci    hevcdsp->hevc_v_loop_filter_luma     = FUNC(hevc_v_loop_filter_luma, depth);   \
237cabdff1aSopenharmony_ci    hevcdsp->hevc_h_loop_filter_chroma   = FUNC(hevc_h_loop_filter_chroma, depth); \
238cabdff1aSopenharmony_ci    hevcdsp->hevc_v_loop_filter_chroma   = FUNC(hevc_v_loop_filter_chroma, depth); \
239cabdff1aSopenharmony_ci    hevcdsp->hevc_h_loop_filter_luma_c   = FUNC(hevc_h_loop_filter_luma, depth);   \
240cabdff1aSopenharmony_ci    hevcdsp->hevc_v_loop_filter_luma_c   = FUNC(hevc_v_loop_filter_luma, depth);   \
241cabdff1aSopenharmony_ci    hevcdsp->hevc_h_loop_filter_chroma_c = FUNC(hevc_h_loop_filter_chroma, depth); \
242cabdff1aSopenharmony_ci    hevcdsp->hevc_v_loop_filter_chroma_c = FUNC(hevc_v_loop_filter_chroma, depth)
243cabdff1aSopenharmony_ciint i = 0;
244cabdff1aSopenharmony_ci
245cabdff1aSopenharmony_ci    switch (bit_depth) {
246cabdff1aSopenharmony_ci    case 9:
247cabdff1aSopenharmony_ci        HEVC_DSP(9);
248cabdff1aSopenharmony_ci        break;
249cabdff1aSopenharmony_ci    case 10:
250cabdff1aSopenharmony_ci        HEVC_DSP(10);
251cabdff1aSopenharmony_ci        break;
252cabdff1aSopenharmony_ci    case 12:
253cabdff1aSopenharmony_ci        HEVC_DSP(12);
254cabdff1aSopenharmony_ci        break;
255cabdff1aSopenharmony_ci    default:
256cabdff1aSopenharmony_ci        HEVC_DSP(8);
257cabdff1aSopenharmony_ci        break;
258cabdff1aSopenharmony_ci    }
259cabdff1aSopenharmony_ci
260cabdff1aSopenharmony_ci#if ARCH_AARCH64
261cabdff1aSopenharmony_ci    ff_hevc_dsp_init_aarch64(hevcdsp, bit_depth);
262cabdff1aSopenharmony_ci#elif ARCH_ARM
263cabdff1aSopenharmony_ci    ff_hevc_dsp_init_arm(hevcdsp, bit_depth);
264cabdff1aSopenharmony_ci#elif ARCH_PPC
265cabdff1aSopenharmony_ci    ff_hevc_dsp_init_ppc(hevcdsp, bit_depth);
266cabdff1aSopenharmony_ci#elif ARCH_X86
267cabdff1aSopenharmony_ci    ff_hevc_dsp_init_x86(hevcdsp, bit_depth);
268cabdff1aSopenharmony_ci#elif ARCH_MIPS
269cabdff1aSopenharmony_ci    ff_hevc_dsp_init_mips(hevcdsp, bit_depth);
270cabdff1aSopenharmony_ci#elif ARCH_LOONGARCH
271cabdff1aSopenharmony_ci    ff_hevc_dsp_init_loongarch(hevcdsp, bit_depth);
272cabdff1aSopenharmony_ci#endif
273cabdff1aSopenharmony_ci}
274