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