From patchwork Mon May 6 21:02:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 13018 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B1026442219 for ; Tue, 7 May 2019 00:11:38 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 484D268ADA3; Tue, 7 May 2019 00:02:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 569F268ACB6 for ; Tue, 7 May 2019 00:02:33 +0300 (EEST) Received: by mail-wm1-f49.google.com with SMTP id y197so16923025wmd.0 for ; Mon, 06 May 2019 14:02:33 -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:mime-version :content-transfer-encoding; bh=FMuVVecdDxXclkDLG/mS0CkC35Zd6bHZn4RXHNtJ7Sk=; b=JFFEwcwEjWjd/lMdylJmD7U066xwY02//KV+O6fnfT0uezwCjfHVeTfuHPaHIkIHWW hw9vT559Dpb1kN293TpYH69EOOqs7kak3rtlXxhkzOHXu1XrvfS7/BQk11y61tZiXaxE 1pWdLj+ulyFZNaWprN+bkniihyajB/Xwv3s/lvhId6PxF9Fly0J6bhIP3LBP9sVsAZaR q1TF77h3Dycn8ITlAxtBWQhgFLPUjjpZBGca8v0p29ASxPXynHWNZKFTF6xWBOSXeJu9 83fIWWWyuC4rIbon3l62XYkSvV07qgChYukTfHutBCIiZVXh5IMcmNzLC5gYKMNTSait Fi8Q== 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:mime-version:content-transfer-encoding; bh=FMuVVecdDxXclkDLG/mS0CkC35Zd6bHZn4RXHNtJ7Sk=; b=QPMt+jotDrwwfMZDIdFqGbQBDKKd+fgEuqz9croKMFX0BJUvqPlOYkSRn3WZZ0J+on zlaXiT+RuhQv21H6dQAMiQf2X0g17omVz7TmAH4WKtf76WRMqGXaTKNXJGfIcaHkk53N /PybGhWAGzyrGYScey5Amb5FrqlSXGinCtg2jWCt/bwojkJDVsi8DLeyKN6sRV5V60BN KagCaefJD2bKQ4q6BfCcvvu9ocwS2/opdkAyuYaeWyf6y2uyBQmFsBnKekgvY/LoobxG tXx1au9sVvAolhsJQTAt7HOaZWswOKGt7SeBuxWO43fk7WG49RoICrZTvNMcE2O1UGQr rg3w== X-Gm-Message-State: APjAAAVGQWvY9WkIt9NnyEm7qGmR75BckAo2Au9H5ChQLXjXZncmuFFh 3nuNGrijWIpBCQlZ5+HDkgjYlDKju3k= X-Google-Smtp-Source: APXvYqzCNoRUOg6NDAzJjvETxj/W6gC/CkXfvy0bC91rurfsLw1NQyPzkIJYtyUTuHkk+75b0vnuwQ== X-Received: by 2002:a7b:c7cc:: with SMTP id z12mr18782284wmk.103.1557176552560; Mon, 06 May 2019 14:02:32 -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 u11sm20777747wmu.15.2019.05.06.14.02.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 14:02:31 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 May 2019 22:02:20 +0100 Message-Id: <20190506210223.25159-2-sw@jkqxz.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190506210223.25159-1-sw@jkqxz.net> References: <20190506210223.25159-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 2/5] lavc/h265_profile_level: Do not allow high tier at level < 4 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/h265_profile_level.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavcodec/h265_profile_level.c b/libavcodec/h265_profile_level.c index 692252bb4d..126f8dbc2a 100644 --- a/libavcodec/h265_profile_level.c +++ b/libavcodec/h265_profile_level.c @@ -175,7 +175,7 @@ const H265LevelDescriptor *ff_h265_guess_level(const H265RawProfileTierLevel *pt int max_dec_pic_buffering) { const H265ProfileDescriptor *profile; - int pic_size, lbr_flag, hbr_factor; + int pic_size, tier_flag, lbr_flag, hbr_factor; int i; if (ptl) @@ -189,10 +189,13 @@ const H265LevelDescriptor *ff_h265_guess_level(const H265RawProfileTierLevel *pt pic_size = width * height; - if (ptl) - lbr_flag = ptl->general_lower_bit_rate_constraint_flag; - else - lbr_flag = profile->lower_bit_rate > 0; + if (ptl) { + tier_flag = ptl->general_tier_flag; + lbr_flag = ptl->general_lower_bit_rate_constraint_flag; + } else { + tier_flag = 0; + lbr_flag = profile->lower_bit_rate > 0; + } if (profile->profile_idc == 1 || profile->profile_idc == 2) { hbr_factor = 1; } else if (profile->high_throughput) { @@ -208,6 +211,9 @@ const H265LevelDescriptor *ff_h265_guess_level(const H265RawProfileTierLevel *pt const H265LevelDescriptor *level = &h265_levels[i]; int max_br, max_dpb_size; + if (tier_flag && !level->max_br_high) + continue; + if (pic_size > level->max_luma_ps) continue; if (width * width > 8 * level->max_luma_ps) @@ -222,7 +228,7 @@ const H265LevelDescriptor *ff_h265_guess_level(const H265RawProfileTierLevel *pt if (tile_cols > level->max_tile_cols) continue; - if (ptl && ptl->general_tier_flag) + if (tier_flag) max_br = level->max_br_high; else max_br = level->max_br_main;