[FFmpeg-cvslog] lavc/h265_profile_level: Fix level guessing with no PTL structure

Mark Thompson git at videolan.org
Tue Sep 25 01:17:02 EEST 2018


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Mon Sep 24 22:55:35 2018 +0100| [1215fbad96da6dc9f81cf335332fc7ebafd0c557] | committer: Mark Thompson

lavc/h265_profile_level: Fix level guessing with no PTL structure

Fixes CID #1439661.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1215fbad96da6dc9f81cf335332fc7ebafd0c557
---

 libavcodec/h265_profile_level.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h265_profile_level.c b/libavcodec/h265_profile_level.c
index bc67fdc951..6604ca254d 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, hbr_factor;
+    int pic_size, lbr_flag, hbr_factor;
     int i;
 
     if (ptl)
@@ -189,15 +189,19 @@ 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 (profile->profile_idc == 1 || profile->profile_idc == 2) {
         hbr_factor = 1;
     } else if (profile->high_throughput) {
         if (profile->intra)
-            hbr_factor = 24 - 12 * ptl->general_lower_bit_rate_constraint_flag;
+            hbr_factor = 24 - 12 * lbr_flag;
         else
             hbr_factor = 6;
     } else {
-        hbr_factor = 2 - ptl->general_lower_bit_rate_constraint_flag;
+        hbr_factor = 2 - lbr_flag;
     }
 
     for (i = 0; i < FF_ARRAY_ELEMS(h265_levels); i++) {
@@ -218,7 +222,7 @@ const H265LevelDescriptor *ff_h265_guess_level(const H265RawProfileTierLevel *pt
         if (tile_cols > level->max_tile_cols)
             continue;
 
-        if (ptl->general_tier_flag)
+        if (ptl && ptl->general_tier_flag)
             max_br = level->max_br_high;
         else
             max_br = level->max_br_main;



More information about the ffmpeg-cvslog mailing list