blob: 38d84b45fbe510c697e72ee55e52c95c127bd8b9
1 | /* |
2 | * drivers/amvdec_ports/decoder/aml_h264_parser.h |
3 | * |
4 | * Copyright (C) 2015 Amlogic, Inc. All rights reserved. |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. |
10 | * |
11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
14 | * more details. |
15 | * |
16 | */ |
17 | |
18 | |
19 | #ifndef AML_H264_PARSER_H |
20 | #define AML_H264_PARSER_H |
21 | |
22 | #define QP_MAX_NUM (51 + 6*6) // The maximum supported qp |
23 | |
24 | /* NAL unit types */ |
25 | enum { |
26 | H264_NAL_SLICE = 1, |
27 | H264_NAL_DPA = 2, |
28 | H264_NAL_DPB = 3, |
29 | H264_NAL_DPC = 4, |
30 | H264_NAL_IDR_SLICE = 5, |
31 | H264_NAL_SEI = 6, |
32 | H264_NAL_SPS = 7, |
33 | H264_NAL_PPS = 8, |
34 | H264_NAL_AUD = 9, |
35 | H264_NAL_END_SEQUENCE = 10, |
36 | H264_NAL_END_STREAM = 11, |
37 | H264_NAL_FILLER_DATA = 12, |
38 | H264_NAL_SPS_EXT = 13, |
39 | H264_NAL_AUXILIARY_SLICE = 19, |
40 | }; |
41 | |
42 | |
43 | enum { |
44 | // 7.4.2.1.1: seq_parameter_set_id is in [0, 31]. |
45 | H264_MAX_SPS_COUNT = 32, |
46 | // 7.4.2.2: pic_parameter_set_id is in [0, 255]. |
47 | H264_MAX_PPS_COUNT = 256, |
48 | |
49 | // A.3: MaxDpbFrames is bounded above by 16. |
50 | H264_MAX_DPB_FRAMES = 16, |
51 | // 7.4.2.1.1: max_num_ref_frames is in [0, MaxDpbFrames], and |
52 | // each reference frame can have two fields. |
53 | H264_MAX_REFS = 2 * H264_MAX_DPB_FRAMES, |
54 | |
55 | // 7.4.3.1: modification_of_pic_nums_idc is not equal to 3 at most |
56 | // num_ref_idx_lN_active_minus1 + 1 times (that is, once for each |
57 | // possible reference), then equal to 3 once. |
58 | H264_MAX_RPLM_COUNT = H264_MAX_REFS + 1, |
59 | |
60 | // 7.4.3.3: in the worst case, we begin with a full short-term |
61 | // reference picture list. Each picture in turn is moved to the |
62 | // long-term list (type 3) and then discarded from there (type 2). |
63 | // Then, we set the length of the long-term list (type 4), mark |
64 | // the current picture as long-term (type 6) and terminate the |
65 | // process (type 0). |
66 | H264_MAX_MMCO_COUNT = H264_MAX_REFS * 2 + 3, |
67 | |
68 | // A.2.1, A.2.3: profiles supporting FMO constrain |
69 | // num_slice_groups_minus1 to be in [0, 7]. |
70 | H264_MAX_SLICE_GROUPS = 8, |
71 | |
72 | // E.2.2: cpb_cnt_minus1 is in [0, 31]. |
73 | H264_MAX_CPB_CNT = 32, |
74 | |
75 | // A.3: in table A-1 the highest level allows a MaxFS of 139264. |
76 | H264_MAX_MB_PIC_SIZE = 139264, |
77 | // A.3.1, A.3.2: PicWidthInMbs and PicHeightInMbs are constrained |
78 | // to be not greater than sqrt(MaxFS * 8). Hence height/width are |
79 | // bounded above by sqrt(139264 * 8) = 1055.5 macroblocks. |
80 | H264_MAX_MB_WIDTH = 1055, |
81 | H264_MAX_MB_HEIGHT = 1055, |
82 | H264_MAX_WIDTH = H264_MAX_MB_WIDTH * 16, |
83 | H264_MAX_HEIGHT = H264_MAX_MB_HEIGHT * 16, |
84 | }; |
85 | |
86 | |
87 | #endif /* AML_H264_PARSER_H */ |
88 | |
89 |