From patchwork Sat Oct 27 22:19:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 10811 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 8530B44D94D for ; Sun, 28 Oct 2018 01:20:07 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 01F3B68A368; Sun, 28 Oct 2018 01:19:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D0D85689C3E for ; Sun, 28 Oct 2018 01:19:31 +0300 (EEST) Received: by mail-wm1-f42.google.com with SMTP id r63-v6so4624507wma.4 for ; Sat, 27 Oct 2018 15:20:02 -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=RSGHSGa3uAJ6miJyIZZjJ4gqiCEsCL+v/rPMnY4PawA=; b=MKhSpm9hPtOEEZS0vFBHC/bSkURP5TgtMlgDaPlbaXaAxlyOuHSyheugBlvpIhEeO8 WHGCYFcH2OG/Gxkbtqb+soOyXytUA4dgAlQr6yS+r0EF82ksPQsQOUuc9ssT0tpSb2xn gQAA+bDTdttWm5druWP80LDnDjQdXmgodeQP7giQrzBFs56fsPz4Zai3uHSrYyeFDfxC i3kVZckXXaQNI5GfIuLI0SEFS3k+QNVfLpmoB8rxh4gaPNaI45+yFCrUuzUmXzxpqFlX BwFNnEJyGyg6aGJZ8DEOh3X7XswaYKrIUYZA4+I0LsyfZaCJWZQri6DRRK7sh914uRoK x2wQ== 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=RSGHSGa3uAJ6miJyIZZjJ4gqiCEsCL+v/rPMnY4PawA=; b=aNVRJxivmz8VtQAB05dy/NAq5QfhWSBVtTlAeyOYjvGnqhrj5EoCx9IH61Dq1go/NH g6i0hHxygr6xatYeyc4dzylyHAaYGJkuxNx7fEJQCpzAx3UCt+U8R7cmfC2ZiWtl+W91 CQbB1zc389Pi8rAlvWwUc86Ktt5IfAe0BKkgJxx2D8HHGOpy8voeFbljdLQ4KPNoAuTA 8a60IZBmN80duYIy8F5CBCvO+0Y/vF118RJkOmqOI/+0vrmisOOc6Mtj3R+APPyApSpx qzzLzOcReTO8Dng4lyWnOQwQwlk/k8fOcp7558x70ioKAfvUjCBF8KZZBKIxPqzscuS1 ZQUg== X-Gm-Message-State: AGRZ1gLKHDMZIU6wKfBYCmbfT+1fc92dzEwFtrBSyla0Sul5EutWZBwK BM4k7w3m9MP8XTvaRZ7ahWsYoUgZR6g= X-Google-Smtp-Source: AJdET5fiu82LKaiynC7WTTxSaOfQaMwAgSiwyEehnu8UeX42giLxT+5AcOyCnAM/uTN4SX3UH1pF6g== X-Received: by 2002:a1c:38c5:: with SMTP id f188-v6mr9114039wma.19.1540678801010; Sat, 27 Oct 2018 15:20:01 -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 v189-v6sm1255527wmd.40.2018.10.27.15.19.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Oct 2018 15:20:00 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sat, 27 Oct 2018 23:19:51 +0100 Message-Id: <20181027221954.8589-3-sw@jkqxz.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181027221954.8589-1-sw@jkqxz.net> References: <20181027221954.8589-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 3/6] 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;