From patchwork Tue Sep 12 23:43:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 5109 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp295661jaa; Tue, 12 Sep 2017 16:44:35 -0700 (PDT) X-Received: by 10.223.146.4 with SMTP id 4mr14096185wrj.16.1505259875567; Tue, 12 Sep 2017 16:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505259875; cv=none; d=google.com; s=arc-20160816; b=waWa/cJRdIqwgU3PI4On9pXHW3cGKdQw+ZSbL0oxjkrrFNh9T0vlD6HdlTwfmvDQCt qgRAcqvkRaKaIvm5j2KzcCmEN5fZlRK8zGKtgep5o07xkvoX6Trk0Jv7UOdobk6z/ftc H3Nm/Di8CvAbMYkY7q4sEgoTCr7wLJfbVqAYovg3h/LmicgJn0CgKpLwrQ/NdtRMbDzV 870SBOxfZl2J8n9zGFAeTg4tPprKt5MVXOhXpml5v6DP40kzarMXvRJ5keeDJkuJdi6f MyvojtlU52/trpaO9Fs3kY7JiP5zclPtiQrW65lbIftTgbR3KoIGIeLFf3TkyZQ6cBhQ L0kg== 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=qcwH5BDC/1raFTdCUvJ2B+Th7SqzHRKZh5bPjL+uueDTC35VPADgrlVcCDC23WtHww G7ODLtd65S1wO/vIVaAADHA9ADGRtmhfy/YGqRxy7/KG7UjaZv+8aZ90bRAvdFXtdNiR 6WR5TFqZX+rAdwGbYs9Drd3zQK/YWWDjuysz9ztn4/Imra0AjQSwbO0SgUS8Ga/li1pt PighuW+4hRMdyEbZ7d5wHuRY3odrTwiLlQLrIq6xm/G/lsZEB1ACxppJHR+I1PUVRuWr X42HOeh3fOgy+UdFUdyVZtDpC9wDdENGe1QKlnkVgIEDeBWlwZByC0c28Wd+u3WgZf3p vSHw== 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=Gy0bYM+d; 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 g197si9721822wmg.209.2017.09.12.16.44.35; Tue, 12 Sep 2017 16:44:35 -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=Gy0bYM+d; 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 9F3CD689D89; Wed, 13 Sep 2017 02:44:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com [209.85.128.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5FCAD68048C for ; Wed, 13 Sep 2017 02:44:09 +0300 (EEST) Received: by mail-wr0-f171.google.com with SMTP id a43so25598362wrc.0 for ; Tue, 12 Sep 2017 16:44:15 -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=Gy0bYM+dC0Xb9t9+OSQrBF36pLB8OUdzJ/F3zk/0eNoYFTeNzovnt6mhh51/KyJGJe zxEF37HgJtIUQBFnggiflDtlZvA6V8rg5JrebKoYWtuA62hw1KYsHQrd/9LomZYG/F7z 3EZpNYJ4JO7rH/rB1X1RjthZMjpIXzzCTzpeoQfzOJmebCFxzZkQox7h5x67hQ56mwos dr/Cz4mtnRkNTxyPRbhZMnjmsIGabYlmb1THPxC2DNPe4K7OWyCTR3lJQfqWXFZzuGKG pQbj3EKkkQRKSJ+rMLa7xIIQxbeKCQ+ppqT10kHmFKMxANdMt+hQu3SE6cnZTJpEHjS/ RvnQ== 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=DYzYj65QILQsGgZ4XE5fu3l3fEXKorEoBRbTQ8SD+Rx8KzwfnqZJyUP8k6kagu4Esg NCiutDokxCWK57mjUm4TVl76jomN8Ko0noECIYMgxqpG/X0g0Y2kb5+RgTf8Dt03lgk8 Hrysb2A/zUVvRC7VzHGZKP0loQcl4CCJxKKybcrEya3GB6El8GzAexx05QoSngVOM84T GSxK3rzJGV/UPQH+lcL2rDF1VxbUPl1PyjFQ7g+vdFuoU7uCPLFHsv4dEDAly3xupyeq m73lr9QDMSFtjJaf0sodJoHl/CH/vPki0MI1VlW0YIOzfwTYr6ASlajkdbzdchzYf8Uw 2usw== X-Gm-Message-State: AHPjjUjr78cnBDWrYwebjPfp+Gw6LPkITtC4SPEsPQISBSY4JnyeqFYk ALYFEVUz9/8PSxaXCVY= X-Google-Smtp-Source: ADKCNb6s3xOkEH+5AWNVHqsDWl+Z92ggtX25I+UsJayAoKqkk9SSzvKRpPtO8eGxHR1oUI0i2MOBrw== X-Received: by 10.223.195.37 with SMTP id n34mr12831175wrf.219.1505259854779; Tue, 12 Sep 2017 16:44:14 -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 p193sm4378138wmg.37.2017.09.12.16.44.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 16:44:14 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Wed, 13 Sep 2017 00:43:51 +0100 Message-Id: <20170912234410.14093-2-sw@jkqxz.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912234410.14093-1-sw@jkqxz.net> References: <20170912234410.14093-1-sw@jkqxz.net> Subject: [FFmpeg-devel] [PATCH 01/20] 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 */