/src/ffmpeg/libavcodec/hevc/pred.c
Line | Count | Source |
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 "hevcdec.h" |
24 | | |
25 | | #include "pred.h" |
26 | | |
27 | 7.66M | #define BIT_DEPTH 8 |
28 | | #include "pred_template.c" |
29 | | #undef BIT_DEPTH |
30 | | |
31 | 14.6M | #define BIT_DEPTH 9 |
32 | | #include "pred_template.c" |
33 | | #undef BIT_DEPTH |
34 | | |
35 | 19.2M | #define BIT_DEPTH 10 |
36 | | #include "pred_template.c" |
37 | | #undef BIT_DEPTH |
38 | | |
39 | 13.1M | #define BIT_DEPTH 12 |
40 | | #include "pred_template.c" |
41 | | #undef BIT_DEPTH |
42 | | |
43 | | void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth) |
44 | 23.5k | { |
45 | 23.5k | #undef FUNC |
46 | 399k | #define FUNC(a, depth) a ## _ ## depth |
47 | | |
48 | 23.5k | #define HEVC_PRED(depth) \ |
49 | 23.5k | hpc->intra_pred[0] = FUNC(intra_pred_2, depth); \ |
50 | 23.5k | hpc->intra_pred[1] = FUNC(intra_pred_3, depth); \ |
51 | 23.5k | hpc->intra_pred[2] = FUNC(intra_pred_4, depth); \ |
52 | 23.5k | hpc->intra_pred[3] = FUNC(intra_pred_5, depth); \ |
53 | 23.5k | hpc->pred_planar[0] = FUNC(pred_planar_0, depth); \ |
54 | 23.5k | hpc->pred_planar[1] = FUNC(pred_planar_1, depth); \ |
55 | 23.5k | hpc->pred_planar[2] = FUNC(pred_planar_2, depth); \ |
56 | 23.5k | hpc->pred_planar[3] = FUNC(pred_planar_3, depth); \ |
57 | 23.5k | hpc->pred_dc = FUNC(pred_dc, depth); \ |
58 | 23.5k | hpc->pred_angular[0] = FUNC(pred_angular_0, depth); \ |
59 | 23.5k | hpc->pred_angular[1] = FUNC(pred_angular_1, depth); \ |
60 | 23.5k | hpc->pred_angular[2] = FUNC(pred_angular_2, depth); \ |
61 | 23.5k | hpc->pred_angular[3] = FUNC(pred_angular_3, depth); \ |
62 | 23.5k | hpc->ref_filter_3tap[0] = FUNC(ref_filter_3tap, depth); \ |
63 | 23.5k | hpc->ref_filter_3tap[1] = FUNC(ref_filter_3tap, depth); \ |
64 | 23.5k | hpc->ref_filter_3tap[2] = FUNC(ref_filter_3tap, depth); \ |
65 | 23.5k | hpc->ref_filter_strong = FUNC(ref_filter_strong, depth); |
66 | | |
67 | 23.5k | switch (bit_depth) { |
68 | 4.58k | case 9: |
69 | 4.58k | HEVC_PRED(9); |
70 | 4.58k | break; |
71 | 7.19k | case 10: |
72 | 7.19k | HEVC_PRED(10); |
73 | 7.19k | break; |
74 | 4.37k | case 12: |
75 | 4.37k | HEVC_PRED(12); |
76 | 4.37k | break; |
77 | 7.35k | default: |
78 | 7.35k | HEVC_PRED(8); |
79 | 7.35k | break; |
80 | 23.5k | } |
81 | | |
82 | | #if ARCH_AARCH64 |
83 | | ff_hevc_pred_init_aarch64(hpc, bit_depth); |
84 | | #endif |
85 | | #if ARCH_MIPS |
86 | | ff_hevc_pred_init_mips(hpc, bit_depth); |
87 | | #endif |
88 | 23.5k | } |