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