From patchwork Sun Aug 20 22:41:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 4763 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.37.132 with SMTP id g126csp2343227jag; Sun, 20 Aug 2017 15:42:31 -0700 (PDT) X-Received: by 10.223.199.143 with SMTP id l15mr10139192wrg.243.1503268951628; Sun, 20 Aug 2017 15:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503268951; cv=none; d=google.com; s=arc-20160816; b=EQWrsz60jTKyuViaLGj0gjIPPFFBTu9KTBuFO/N3/EZfB+0p2xqtMWE/VLNtbX3iza ZsodbOXsYDOE+gVdMAHm4gJl4+XrtMH9OYlV1DnTpdKBVeAYGUm06xBMZPLs8RSlr60v rvjEC6qVAGNE5Tsf0GsWYDPyhl0rMjhcEm5Q0DWewlx8HUAbgZ4BBciepGodVWPaCy6y cvNH1KsXourhUNTWS8UjkyUhJA1c7gW6qgelrLlMYd6aFMHaLwkI+bWyz5pyINN0B7O2 IPjaldAyP6xr4gB3hOFQFbfgEEcaQJn34PUo+MhwDKzIQVHPXOUE6T+dsLWM08aNOH8J PdHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=5E1VuEHQnn2HR6vgqCgtpyGyk/dZzaIhHz9jc3LyrO8=; b=rFrQZfkGOH6yaQDXpLVZSOxh6vk5LXawJ5LFJFRZMYu1VTb96XQzEvjGLNiRZZBfVc nU3S5VVA+DDPTIj6YnV+BmbndmcBiNTyTN1aGy7msHjSxn9wfWcQn5uubW6uTpURzgVG uWE3mdCUsXEWp0UXxtnLmqzkspe5ACBtH81KI9p9RzEltRyFX6I5apmzpYeTrVoXpOkW zPIjuOs7glC5xNNXH0cxmlS1xc4Mo2EhJs+sJ0JyEfwOid61QMGJbBFZCx1YfcPo23o9 CcFPwsGDKf1axWMhVXAZn8CyF6IG3Qh8BRz0gyT64Yplzxl4UTtjVP5+zP2tDHY+atz7 Jp2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20150623.gappssmtp.com header.s=20150623 header.b=V5uPvH+G; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p17si8385453wrg.213.2017.08.20.15.42.31; Sun, 20 Aug 2017 15:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20150623.gappssmtp.com header.s=20150623 header.b=V5uPvH+G; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9F7BD680A6C; Mon, 21 Aug 2017 01:42:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AF05B680734 for ; Mon, 21 Aug 2017 01:41:54 +0300 (EEST) Received: by mail-wr0-f170.google.com with SMTP id 30so11533347wrk.0 for ; Sun, 20 Aug 2017 15:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=drBGLZls2Rai6fhXlNHc3+rqBmnP1/V3xexNgmWWGxc=; b=V5uPvH+GLiTNuO+HGe1JUyZ7iQPt5TgZ3ZQBmFyI+ZSLOqzR4Uyyam9iGpYCoQ21RD BaykuMed0S/ZdSh0aNdiJqOSjThINxxw+b+DKvBFbIS/qmcoVvuyv7jRUH8oSbsSBJy3 /m9DLCnMivh2UkWry2z9iFv8WQez0MxgeXaMIk1QLwrDcaMEQ+I2sv0Ed+dSY8dPLtUi EJJzBrq6r4yw5kONNUcomlp6qAsvDDFidxAxDBYcozj+FhrMYfOYOjrRCgDTc4GrzaCS pqG0eQffPRtckGtI9IpxzZb1JnDtwoD51EMaFbRXfwIY0e0B1tY5sJLIYI10sQNnIWVZ 31Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=drBGLZls2Rai6fhXlNHc3+rqBmnP1/V3xexNgmWWGxc=; b=m5lQYMNe4Ee+XVM30c0/2Eg4XSgjzyhaWy9DfgbuLRfbaMVE9UDBOmEbmBLyGieZa0 4FdYuoEL9Xq/1QAqFtTFwLGjqqFkzSt3UQrw74jWIHQ84WFjPqZdRzkgotqOb9qGjtSy /gmqGiBOux/Apc9uStcJNzyFfDdFEIlS4Vd4pxh2K680XdUQpQNxCIQE6b/Ikcs+ZSqR 9cq2+u0nF9+I+0muzQmu0rhgTRqE1XgcN3RrhFU+J1yAzkouaBmcIzqK92pRVRbwDssk p2be/QLGbdxjRoHLEYHPoBmZqVDOVMPVUv3+Q4XwY7v97p2beUJb7MwcGpf1h4VCqTUw M+Pg== X-Gm-Message-State: AHYfb5jqtfZOcbSDN3guwTNAxWKpQH00b/Pb9Glf0UiKJbfzYRhfhzux tXekpcfp6+GfuNzbpwo= X-Received: by 10.28.95.69 with SMTP id t66mr6107875wmb.74.1503268920841; Sun, 20 Aug 2017 15:42:00 -0700 (PDT) Received: from rywe.jkqxz.net (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id f9sm5391116wmf.18.2017.08.20.15.41.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Aug 2017 15:42:00 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 20 Aug 2017 23:41:30 +0100 Message-Id: <20170820224146.21289-3-sw@jkqxz.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170820224146.21289-1-sw@jkqxz.net> References: <20170820224146.21289-1-sw@jkqxz.net> Subject: [FFmpeg-devel] [PATCH 02/18] h264: Add stream constraint values to the common header X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" With comments describing the derivation of each value. (cherry picked from commit aaf441465080b9bc57f5ca8dea656f9b2c5dc821) --- 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 */