From patchwork Sun Oct 8 20:01:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 5464 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp1904511jah; Sun, 8 Oct 2017 13:02:18 -0700 (PDT) X-Received: by 10.223.171.167 with SMTP id s36mr7969703wrc.256.1507492938523; Sun, 08 Oct 2017 13:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507492938; cv=none; d=google.com; s=arc-20160816; b=ng88xY/IVplKtI/nbEV1+x1/h/XzxEx4avHiD0rvgnaILimwpvx/zjbJsiWgaLM1q4 NymFuYsoIciIWWNJYJVybPjRRCNyENYfqymaqVkFPAT9P/yN0YqR6LET/E8ieQPUpAFq yaUQ4Ikv3QdaWE9zp/ofNgDoiTCdUuaL+Rl1HvUObU/KZjz8Xz+qF8fdiEI4Zkf+D97A hSRdTE++IyXGANVOE+pxce/muJzrXHRhowOoskQ5dojvpeF3rHsdSa8NNqA0ohuQ6f70 KHtShonn+4REzhwyJu5krgQ6TPiNrvfCBG6yz91BU7d0paB0uRNEIIKxJEx08V4BPCKH SIKQ== 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=JPOHw3x1YTVZj2IZ4L2ioq0/jyAcVBAgHNHs93pgfHNqgblyoFnMUZMsKgCLRWgxEp 9bLl/G6hMFuQIgR0nOvt/LuyI5Ws8aE+AMD03yGAz5vn/vtxNU0PAtGuFvDZWQvF/T58 DrQuansv72gA5vBqUfxdDHxs+618J6xC9HyOnbe4yJHoK8s+Zg94FRQ2GCL8kB5KFOaI YzV8QdsSVtSFOf9tsNKUGPWhAC2YCl5zSjGpkVcCvk4c/ak16Ksuvi7v2WZo9rxjCAtA 3JNwQOxvuibwEaZBB12Rhtkq71uD0OnT+iZxCNq9s9QJ7QwKfxZpekG5fMgFKh+iRKD7 WgOw== 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=ONS6AIWI; 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 q4si5132518wre.355.2017.10.08.13.02.18; Sun, 08 Oct 2017 13:02:18 -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=ONS6AIWI; 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 77A1A689CFB; Sun, 8 Oct 2017 23:02:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 96330689C15 for ; Sun, 8 Oct 2017 23:01:57 +0300 (EEST) Received: by mail-wm0-f48.google.com with SMTP id m72so8938820wmc.0 for ; Sun, 08 Oct 2017 13:01:59 -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=ONS6AIWIYheR33kbcIoqWwDn1YfCluz3pBb5ZF7mM/ObAweUONTFdF/xzAfpsXnpxB TcjnjyZdz+K8+g0hsJQriPU1P2Dj+Ipwmz3NjLXg69lcwzyiDMUYE8/XzngUcKbLN2PG NB5VTN52UVO3BqI4nQ0nZrZP42dZ0U6apn0VkCwYwxbjM3ndm0Ky6tZjh9vA3fjUpNt5 BFG5+QHP7nHgYNxOSKTT9ss9dY74U5BMYtJ96L+dgptMUhMCx4tx3pG9IUpY9BtnJKyz CZFwFbfVtVaeNrR4HgqR9wby1v22+qdAFEnRZVjsXanJE0eTCsKme8hlSWZPkyBHdaOb ghjQ== 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=niV44loZI8MScVMyiRvBUp8CugvDyuRhCia6zgMuLXHOZGwP+8Rl5IQJU2I/lcm2E5 +ptcU7jbyre0+PTWf1GNFDSsoKsyhvPN0c4euM1w3vPW2L9EUU/XvUj33nd8sQ1ZU/Ag h5j7sNHn77aCiqDNJkXdaN0y8uV9l/RvC27BpTUpa+nUJ6eu2XsUukxl4O3Tec4jpALk uv0OQowxGPAqP9igccu3oCyVOLqCoSkLKYLwQUwkL26I0DvMDmzkldEEla2XGO48VdMp yW/eGMGHvTc6/i6HqqVbjJJmVpumzJxk/T7+Erk7AbL2PvRCX1tfzmroqwP998EBe5B4 0NSg== X-Gm-Message-State: AMCzsaVtn3tKtvlHLjK+BgZ/xtUD3rmO/lJnEQ9aGTkVUZn4XuuIpAis UY/20X2Q4B4L+OrOqX2uTcM3L3IE X-Google-Smtp-Source: AOwi7QDOy+nCt1TlblhwhAbL6JJKLt5lF9OD+YMYhphzPyf5zj/wmRL4R7sC0mARXRaHGCheZltLbA== X-Received: by 10.223.177.143 with SMTP id q15mr2578112wra.269.1507492918679; Sun, 08 Oct 2017 13:01:58 -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 x49sm2897856wrb.25.2017.10.08.13.01.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Oct 2017 13:01:58 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Oct 2017 21:01:35 +0100 Message-Id: <20171008200154.4873-2-sw@jkqxz.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171008200154.4873-1-sw@jkqxz.net> References: <20171008200154.4873-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 */