]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h265_profile_level.c
avcodec/options: Reindent after previous commit
[ffmpeg] / libavcodec / h265_profile_level.c
index 692252bb4d9a7dbffa7e4dc8d9b6f1a8ead4b826..7ff9681f65e83adb74b2c405f1844afd79f102d1 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",
@@ -116,18 +120,6 @@ static const H265ProfileDescriptor h265_profiles[] = {
 };
 
 
-const H265LevelDescriptor *ff_h265_get_level(int level_idc)
-{
-    int i;
-
-    for (i = 0; i < FF_ARRAY_ELEMS(h265_levels); i++) {
-        if (h265_levels[i].level_idc == level_idc)
-            return &h265_levels[i];
-    }
-
-    return NULL;
-}
-
 const H265ProfileDescriptor *ff_h265_get_profile(const H265RawProfileTierLevel *ptl)
 {
     int i;
@@ -175,7 +167,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)
@@ -184,15 +176,18 @@ const H265LevelDescriptor *ff_h265_guess_level(const H265RawProfileTierLevel *pt
         profile = NULL;
     if (!profile) {
         // Default to using multiplication factors for Main profile.
-        profile = &h265_profiles[3];
+        profile = &h265_profiles[4];
     }
 
     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 +203,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 +220,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;