[FFmpeg-cvslog] h264: Add stream constraint values to the common header
Mark Thompson
git at videolan.org
Tue Oct 17 22:56:38 EEST 2017
ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Sat Jun 24 00:30:20 2017 +0100| [d05444d2c6d99767547b1f0761e8459fb07b305d] | committer: Mark Thompson
h264: Add stream constraint values to the common header
With comments describing the derivation of each value.
(cherry picked from commit aaf441465080b9bc57f5ca8dea656f9b2c5dc821)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d05444d2c6d99767547b1f0761e8459fb07b305d
---
libavcodec/h264.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 86df5eb9b3..650580bf3a 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -44,4 +44,49 @@ enum {
H264_NAL_AUXILIARY_SLICE = 19,
};
+
+enum {
+ // 7.4.2.1.1: seq_parameter_set_id is in [0, 31].
+ H264_MAX_SPS_COUNT = 32,
+ // 7.4.2.2: pic_parameter_set_id is in [0, 255].
+ H264_MAX_PPS_COUNT = 256,
+
+ // A.3: MaxDpbFrames is bounded above by 16.
+ H264_MAX_DPB_FRAMES = 16,
+ // 7.4.2.1.1: max_num_ref_frames is in [0, MaxDpbFrames], and
+ // each reference frame can have two fields.
+ H264_MAX_REFS = 2 * H264_MAX_DPB_FRAMES,
+
+ // 7.4.3.1: modification_of_pic_nums_idc is not equal to 3 at most
+ // num_ref_idx_lN_active_minus1 + 1 times (that is, once for each
+ // possible reference), then equal to 3 once.
+ H264_MAX_RPLM_COUNT = H264_MAX_REFS + 1,
+
+ // 7.4.3.3: in the worst case, we begin with a full short-term
+ // reference picture list. Each picture in turn is moved to the
+ // long-term list (type 3) and then discarded from there (type 2).
+ // Then, we set the length of the long-term list (type 4), mark
+ // the current picture as long-term (type 6) and terminate the
+ // process (type 0).
+ H264_MAX_MMCO_COUNT = H264_MAX_REFS * 2 + 3,
+
+ // A.2.1, A.2.3: profiles supporting FMO constrain
+ // num_slice_groups_minus1 to be in [0, 7].
+ H264_MAX_SLICE_GROUPS = 8,
+
+ // E.2.2: cpb_cnt_minus1 is in [0, 31].
+ H264_MAX_CPB_CNT = 32,
+
+ // A.3: in table A-1 the highest level allows a MaxFS of 139264.
+ H264_MAX_MB_PIC_SIZE = 139264,
+ // A.3.1, A.3.2: PicWidthInMbs and PicHeightInMbs are constrained
+ // to be not greater than sqrt(MaxFS * 8). Hence height/width are
+ // bounded above by sqrt(139264 * 8) = 1055.5 macroblocks.
+ H264_MAX_MB_WIDTH = 1055,
+ H264_MAX_MB_HEIGHT = 1055,
+ H264_MAX_WIDTH = H264_MAX_MB_WIDTH * 16,
+ H264_MAX_HEIGHT = H264_MAX_MB_HEIGHT * 16,
+};
+
+
#endif /* AVCODEC_H264_H */
More information about the ffmpeg-cvslog
mailing list