1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * HEVC video Decoder
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * Copyright (C) 2012 - 2013 Guillaume Martres
5cabdff1aSopenharmony_ci *
6cabdff1aSopenharmony_ci * This file is part of FFmpeg.
7cabdff1aSopenharmony_ci *
8cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
9cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
10cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
11cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
12cabdff1aSopenharmony_ci *
13cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
14cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
15cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16cabdff1aSopenharmony_ci * Lesser General Public License for more details.
17cabdff1aSopenharmony_ci *
18cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
19cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
20cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21cabdff1aSopenharmony_ci */
22cabdff1aSopenharmony_ci
23cabdff1aSopenharmony_ci#include "hevcdec.h"
24cabdff1aSopenharmony_ci
25cabdff1aSopenharmony_ci#include "hevcpred.h"
26cabdff1aSopenharmony_ci
27cabdff1aSopenharmony_ci#define BIT_DEPTH 8
28cabdff1aSopenharmony_ci#include "hevcpred_template.c"
29cabdff1aSopenharmony_ci#undef BIT_DEPTH
30cabdff1aSopenharmony_ci
31cabdff1aSopenharmony_ci#define BIT_DEPTH 9
32cabdff1aSopenharmony_ci#include "hevcpred_template.c"
33cabdff1aSopenharmony_ci#undef BIT_DEPTH
34cabdff1aSopenharmony_ci
35cabdff1aSopenharmony_ci#define BIT_DEPTH 10
36cabdff1aSopenharmony_ci#include "hevcpred_template.c"
37cabdff1aSopenharmony_ci#undef BIT_DEPTH
38cabdff1aSopenharmony_ci
39cabdff1aSopenharmony_ci#define BIT_DEPTH 12
40cabdff1aSopenharmony_ci#include "hevcpred_template.c"
41cabdff1aSopenharmony_ci#undef BIT_DEPTH
42cabdff1aSopenharmony_ci
43cabdff1aSopenharmony_civoid ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth)
44cabdff1aSopenharmony_ci{
45cabdff1aSopenharmony_ci#undef FUNC
46cabdff1aSopenharmony_ci#define FUNC(a, depth) a ## _ ## depth
47cabdff1aSopenharmony_ci
48cabdff1aSopenharmony_ci#define HEVC_PRED(depth)                                \
49cabdff1aSopenharmony_ci    hpc->intra_pred[0]   = FUNC(intra_pred_2, depth);   \
50cabdff1aSopenharmony_ci    hpc->intra_pred[1]   = FUNC(intra_pred_3, depth);   \
51cabdff1aSopenharmony_ci    hpc->intra_pred[2]   = FUNC(intra_pred_4, depth);   \
52cabdff1aSopenharmony_ci    hpc->intra_pred[3]   = FUNC(intra_pred_5, depth);   \
53cabdff1aSopenharmony_ci    hpc->pred_planar[0]  = FUNC(pred_planar_0, depth);  \
54cabdff1aSopenharmony_ci    hpc->pred_planar[1]  = FUNC(pred_planar_1, depth);  \
55cabdff1aSopenharmony_ci    hpc->pred_planar[2]  = FUNC(pred_planar_2, depth);  \
56cabdff1aSopenharmony_ci    hpc->pred_planar[3]  = FUNC(pred_planar_3, depth);  \
57cabdff1aSopenharmony_ci    hpc->pred_dc         = FUNC(pred_dc, depth);        \
58cabdff1aSopenharmony_ci    hpc->pred_angular[0] = FUNC(pred_angular_0, depth); \
59cabdff1aSopenharmony_ci    hpc->pred_angular[1] = FUNC(pred_angular_1, depth); \
60cabdff1aSopenharmony_ci    hpc->pred_angular[2] = FUNC(pred_angular_2, depth); \
61cabdff1aSopenharmony_ci    hpc->pred_angular[3] = FUNC(pred_angular_3, depth);
62cabdff1aSopenharmony_ci
63cabdff1aSopenharmony_ci    switch (bit_depth) {
64cabdff1aSopenharmony_ci    case 9:
65cabdff1aSopenharmony_ci        HEVC_PRED(9);
66cabdff1aSopenharmony_ci        break;
67cabdff1aSopenharmony_ci    case 10:
68cabdff1aSopenharmony_ci        HEVC_PRED(10);
69cabdff1aSopenharmony_ci        break;
70cabdff1aSopenharmony_ci    case 12:
71cabdff1aSopenharmony_ci        HEVC_PRED(12);
72cabdff1aSopenharmony_ci        break;
73cabdff1aSopenharmony_ci    default:
74cabdff1aSopenharmony_ci        HEVC_PRED(8);
75cabdff1aSopenharmony_ci        break;
76cabdff1aSopenharmony_ci    }
77cabdff1aSopenharmony_ci
78cabdff1aSopenharmony_ci#if ARCH_MIPS
79cabdff1aSopenharmony_ci    ff_hevc_pred_init_mips(hpc, bit_depth);
80cabdff1aSopenharmony_ci#endif
81cabdff1aSopenharmony_ci}
82