]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h265_profile_level.c
avcodec/simple_idct_template: fix integer overflow
[ffmpeg] / libavcodec / h265_profile_level.c
index 692252bb4d9a7dbffa7e4dc8d9b6f1a8ead4b826..70db1a52f6e00f2ed22bceb871ce1a0b43ac0de9 100644 (file)
@@ -47,6 +47,8 @@ static const H265ProfileDescriptor h265_profiles[] = {
     //   |  |  |  10bit |  |  | intra  |    |     | FormatCapabilityFactor
     { "Monochrome", //  |  |  |  |  |  |    |     |     |     |   |
       4, 0, 2, 1, 1, 1, 1, 1, 1, 0, 0, 1,  667,  733, 1.000, 1.0, 6 },
+    { "Monochrome 10",
+      4, 0, 2, 1, 1, 0, 1, 1, 1, 0, 0, 1,  833,  917, 1.250, 1.0, 6 },
     { "Monochrome 12",
       4, 0, 2, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1000, 1100, 1.500, 1.0, 6 },
     { "Monochrome 16",
@@ -56,13 +58,15 @@ static const H265ProfileDescriptor h265_profiles[] = {
     { "Screen-Extended Main",
       9, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1000, 1100, 1.500, 1.0, 7 },
     { "Main 10",
-      2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1000, 1100, 1.875, 1.0, 6 },
+      2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 1000, 1100, 1.875, 1.0, 6 },
     { "Screen-Extended Main 10",
       9, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1000, 1100, 1.875, 1.0, 7 },
     { "Main 12",
       4, 0, 2, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1500, 1650, 2.250, 1.0, 6 },
     { "Main Still Picture",
       3, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1000, 1100, 1.500, 1.0, 6 },
+    { "Main 10 Still Picture",
+      2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1000, 1100, 1.875, 1.0, 6 },
     { "Main 4:2:2 10",
       4, 0, 2, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1667, 1833, 2.500, 0.5, 6 },
     { "Main 4:2:2 12",
@@ -175,7 +179,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 +193,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 +215,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 +232,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;