From patchwork Sun Oct 15 15:04:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 5581 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp2787424jah; Sun, 15 Oct 2017 08:12:50 -0700 (PDT) X-Received: by 10.223.198.82 with SMTP id u18mr6397207wrg.5.1508080370360; Sun, 15 Oct 2017 08:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508080370; cv=none; d=google.com; s=arc-20160816; b=Fx6gF/j4Su/clYy7dfkDWd2BpmKNLBRTqRvfwsHoloHVpJhJyKCt592byVtIc2lNLd Qvebkvn2M2U51pu+u3/Yv3q1CIecp3JeeLkLxKH3G8fEzA23YVnJqpRu6dVYia9jRI/e 9Q7l0hizIbnlCvi9avPP8pXrelNIo4uHHRw+eCRFhbtZ7LxylU1Y4gtiAZXFA8IDf688 hQno6kEMvPTRDzNlWWrdOdP8g7am9sK+rom5Rt6tu80PPSBX/5Wp4zVhv/PR9700VJYB XCgAtAGCZRn/DHFncvv3sLqEAB3bfko1DrYH5UjhM5eSkfHshD2uMRocC5XacXVnmm+p Aq8A== 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=xOsYaVYpFnJ5mo4WfnbJ2XHk8Ch9lCoT1WXqOrXCNkP3/aM+XNxSHyGLJ61yY9LzNO 7KVESIQ5cxpsz+HYFQGz8PrqMJ03eE8CH/0G7nDf3jn/XWk+T9CipvGYLtXakVNZxpzc Hy2AppQJpz9y9wQ2a28OSuz7NOSxQenE0RPa/U3r2WpjBJvPbb2ZoiShR/BUg1YiMSjH sygIFn6gLjynlu2ESmMck+wFflSS1y8XVsTeQTwW92lCSf24jKkubYFVZruWJ+BKPvRs ONqp+F+teJ8m9zqoQgu+7E8jeG95AK7EtkVRo6BR/fd0D78r+qFBk2INVTdUVriYFzGW aJNw== 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=VGdQT2zQ; 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 t27si4431342wrb.320.2017.10.15.08.12.49; Sun, 15 Oct 2017 08:12:50 -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=VGdQT2zQ; 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 34AE768A22B; Sun, 15 Oct 2017 18:12:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3476E68A21B for ; Sun, 15 Oct 2017 18:11:59 +0300 (EEST) Received: by mail-wm0-f54.google.com with SMTP id m72so29190931wmc.1 for ; Sun, 15 Oct 2017 08:12:03 -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=VGdQT2zQNxlQjz7C7Ur3CAFQzulsrYZ3K8126luQ/XtgRv4UuO4yCNHTplUJgb4Dc0 R6AMYEdmn1uAXv1J4JvuVRqtDs49dDB+cVCOx8Qky451VoVp9BrHqud3CuuWY6MNVmbt mb1yk/bt+feEVHtmOjO92ir3ZKTOxGhO2YBmLooOVGWkIx7+Vllro+7BL8cAf1oKBJFI HHWb8bK8pskXs5/+UCd4ZRIDuPwFk8bOqDU1hrvNxT5LD58AvgjVxSEO8pNRcCJG+rRW fjl7HRUNcgdhFcAKSuku1DkZDB8a1Ny5mGAE/f3JpJB4+68y+GSTPUVf78Nmfd9On8fr 8I5w== 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=Oam4HfYdIHDVP89EDDUG8PxU4OG8AeqSeIiEbZa3X9RUXIwzJT/pql95rja2Pnwa+P aTrWFlef/ANx+t28vJ/SChQm1FYM2urh6s8q4UECWCUmr01grTIEPJPoyxZj7cstfz2i zPqtXC3E/zMup7jvopLYH4M8DZcN6OhxT7VzdS/d1mW+/flhn0bUGINRHGU+cm+hLJpc PdVJ/CeVhSFrBvDwzsPOhEYPFLP1I1wt8XpZOztUIXNsqvD8thAyVCKhK+Ta89Toy36M J45ujjAszKKLGXT459El5M3dtq+sld1QdjjkZuUPsgk5/aP/7ctmKuJP25i+ZMrQdBM4 HbCw== X-Gm-Message-State: AMCzsaXvXWPkc7iaU+GFtrj3OWoozaGBQvy7GiG4Sgp0dolgEEdon7lT EShKi5x+yk/tSUvcQmO7G+FIRsEJ X-Google-Smtp-Source: ABhQp+TwnDwscMMM0sMshnAypGeHap6/IlR5pDgwKYm7IQZBrjHmq5A7POnLa5yhvi7e7CExUVXLqA== X-Received: by 10.28.178.205 with SMTP id b196mr5293898wmf.103.1508079893020; Sun, 15 Oct 2017 08:04:53 -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 h4sm2080508wre.13.2017.10.15.08.04.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Oct 2017 08:04:52 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 Oct 2017 16:04:28 +0100 Message-Id: <20171015150447.18058-2-sw@jkqxz.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171015150447.18058-1-sw@jkqxz.net> References: <20171015150447.18058-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 */