[x264-devel] [Git][videolan/x264][master] Add support for Sony XAVC Class 300 and 480

Anton Mitrofanov gitlab at videolan.org
Sun Jun 13 20:39:32 UTC 2021



Anton Mitrofanov pushed to branch master at VideoLAN / x264


Commits:
ae03d92b by Phillip Blucas at 2021-06-13T20:32:44+00:00
Add support for Sony XAVC Class 300 and 480

This allows for 2160p UHD at up to 960 Mbit/s.

- - - - -


7 changed files:

- common/set.h
- common/tables.c
- common/tables.h
- encoder/encoder.c
- encoder/set.c
- x264.c
- x264.h


Changes:

=====================================
common/set.h
=====================================
@@ -140,7 +140,8 @@ typedef struct
     int b_qpprime_y_zero_transform_bypass;
     int i_chroma_format_idc;
 
-    int b_avcintra;
+    int b_avcintra_hd;
+    int b_avcintra_4k;
     int i_cqm_preset;
     const uint8_t *scaling_list[8]; /* could be 12, but we don't allow separate Cb/Cr lists */
 


=====================================
common/tables.c
=====================================
@@ -243,7 +243,7 @@ const uint8_t * const x264_cqm_jvt[8] =
     x264_cqm_jvt8i, x264_cqm_jvt8p
 };
 
-// 1080i25_avci50, 1080p25_avci50
+// 720p_avci50, 1080i_avci50, 1080p_avci50
 const uint8_t x264_cqm_avci50_4ic[16] =
 {
     16,22,28,40,
@@ -252,7 +252,7 @@ const uint8_t x264_cqm_avci50_4ic[16] =
     40,44,48,60
 };
 
-//  1080p25_avci50, 720p25_avci50, 720p50_avci50
+// 720p_avci50, 1080p_avci50
 const uint8_t x264_cqm_avci50_p_8iy[64] =
 {
     16,18,19,21,24,27,30,33,
@@ -265,7 +265,7 @@ const uint8_t x264_cqm_avci50_p_8iy[64] =
     33,78,81,84,87,90,93,96
 };
 
-//  1080i25_avci50,
+// 1080i_avci50
 const uint8_t x264_cqm_avci50_1080i_8iy[64] =
 {
     16,18,19,21,27,33,81,87,
@@ -278,7 +278,7 @@ const uint8_t x264_cqm_avci50_1080i_8iy[64] =
     30,33,33,78,81,84,87,96
 };
 
-// 720p25_avci100, 720p50_avci100
+// 720p_avci100
 const uint8_t x264_cqm_avci100_720p_4ic[16] =
 {
     16,21,27,34,
@@ -287,7 +287,7 @@ const uint8_t x264_cqm_avci100_720p_4ic[16] =
     34,41,46,54
 };
 
-// 720p25_avci100, 720p50_avci100
+// 720p_avci100
 const uint8_t x264_cqm_avci100_720p_8iy[64] =
 {
     16,18,19,21,22,24,26,32,
@@ -300,7 +300,7 @@ const uint8_t x264_cqm_avci100_720p_8iy[64] =
     32,32,32,34,34,36,38,42
 };
 
-//  1080i25_avci100, 1080p25_avci100
+// 1080i_avci100, 1080p_avci100
 const uint8_t x264_cqm_avci100_1080_4ic[16] =
 {
     16,20,26,32,
@@ -309,7 +309,7 @@ const uint8_t x264_cqm_avci100_1080_4ic[16] =
     32,38,44,50
 };
 
-//  1080i25_avci100,
+// 1080i_avci100
 const uint8_t x264_cqm_avci100_1080i_8iy[64] =
 {
     16,19,20,23,24,26,32,42,
@@ -322,7 +322,7 @@ const uint8_t x264_cqm_avci100_1080i_8iy[64] =
     22,23,24,26,36,42,59,72
 };
 
-// 1080p25_avci100,
+// 1080p_avci100
 const uint8_t x264_cqm_avci100_1080p_8iy[64] =
 {
     16,18,19,20,22,23,24,26,
@@ -335,6 +335,37 @@ const uint8_t x264_cqm_avci100_1080p_8iy[64] =
     26,32,36,42,59,63,68,72
 };
 
+// 2160p_avci300
+const uint8_t x264_cqm_avci300_2160p_4iy[16] =
+{
+    12,16,19,20,
+    16,19,20,24,
+    19,20,24,33,
+    20,24,33,39
+};
+
+// 2160p_avci300
+const uint8_t x264_cqm_avci300_2160p_4ic[16] =
+{
+    28,39,56,67,
+    39,56,67,77,
+    56,67,77,104,
+    67,77,104,133
+};
+
+// 2160p_avci300
+const uint8_t x264_cqm_avci300_2160p_8iy[64] =
+{
+    12,14,16,17,19,20,20,24,
+    14,16,17,19,20,20,24,30,
+    16,17,19,20,20,24,30,42,
+    17,19,20,20,24,30,42,56,
+    19,20,20,24,30,42,56,72,
+    20,20,24,30,42,56,72,76,
+    20,24,30,42,56,72,76,80,
+    24,30,42,56,72,76,80,84
+};
+
 /*****************************************************************************
  * QUANT
  *****************************************************************************/


=====================================
common/tables.h
=====================================
@@ -63,6 +63,9 @@ extern const uint8_t x264_cqm_avci100_720p_8iy[64];
 extern const uint8_t x264_cqm_avci100_1080_4ic[16];
 extern const uint8_t x264_cqm_avci100_1080i_8iy[64];
 extern const uint8_t x264_cqm_avci100_1080p_8iy[64];
+extern const uint8_t x264_cqm_avci300_2160p_4iy[16];
+extern const uint8_t x264_cqm_avci300_2160p_4ic[16];
+extern const uint8_t x264_cqm_avci300_2160p_8iy[64];
 
 extern const uint8_t x264_decimate_table4[16];
 extern const uint8_t x264_decimate_table8[64];


=====================================
encoder/encoder.c
=====================================
@@ -717,7 +717,9 @@ static int validate_parameters( x264_t *h, int b_open )
             return -1;
         }
 
-        int type = h->param.i_avcintra_class == 200 ? 2 :
+        int type = h->param.i_avcintra_class == 480 ? 4 :
+                   h->param.i_avcintra_class == 300 ? 3 :
+                   h->param.i_avcintra_class == 200 ? 2 :
                    h->param.i_avcintra_class == 100 ? 1 :
                    h->param.i_avcintra_class == 50 ? 0 : -1;
         if( type < 0 )
@@ -725,63 +727,88 @@ static int validate_parameters( x264_t *h, int b_open )
             x264_log( h, X264_LOG_ERROR, "Invalid AVC-Intra class\n" );
             return -1;
         }
+        else if( type > 2 && h->param.i_avcintra_flavor != X264_AVCINTRA_FLAVOR_SONY )
+        {
+            x264_log( h, X264_LOG_ERROR, "AVC-Intra %d only supported by Sony XAVC flavor\n", h->param.i_avcintra_class );
+            return -1;
+        }
 
-        /* [50/100/200][res][fps] */
+        /* [50/100/200/300/480][res][fps] */
         static const struct
         {
             uint16_t fps_num;
             uint16_t fps_den;
             uint8_t interlaced;
             uint16_t frame_size;
+            const uint8_t *cqm_4iy;
             const uint8_t *cqm_4ic;
             const uint8_t *cqm_8iy;
-        } avcintra_lut[3][2][7] =
-        {
-            {{{ 60000, 1001, 0,  912, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
-              {    50,    1, 0, 1100, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
-              { 30000, 1001, 0,  912, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
-              {    25,    1, 0, 1100, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
-              { 24000, 1001, 0,  912, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }},
-             {{ 30000, 1001, 1, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy },
-              {    25,    1, 1, 2196, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy },
-              { 60000, 1001, 0, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
-              { 30000, 1001, 0, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
-              {    50,    1, 0, 2196, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
-              {    25,    1, 0, 2196, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
-              { 24000, 1001, 0, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }}},
-            {{{ 60000, 1001, 0, 1848, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },
-              {    50,    1, 0, 2224, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },
-              { 30000, 1001, 0, 1848, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },
-              {    25,    1, 0, 2224, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },
-              { 24000, 1001, 0, 1848, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }},
-             {{ 30000, 1001, 1, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },
-              {    25,    1, 1, 4444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },
-              { 60000, 1001, 0, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
-              { 30000, 1001, 0, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
-              {    50,    1, 0, 4444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
-              {    25,    1, 0, 4444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
-              { 24000, 1001, 0, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}},
-            {{{ 60000, 1001, 0, 3724, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },
-              {    50,    1, 0, 4472, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }},
-             {{ 30000, 1001, 1, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },
-              {    25,    1, 1, 8940, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },
-              { 60000, 1001, 0, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
-              { 30000, 1001, 0, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
-              {    50,    1, 0, 8940, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
-              {    25,    1, 0, 8940, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
-              { 24000, 1001, 0, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}}
+        } avcintra_lut[5][2][7] =
+        {
+            {{{ 60000, 1001, 0,   912, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
+              {    50,    1, 0,  1100, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
+              { 30000, 1001, 0,   912, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
+              {    25,    1, 0,  1100, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
+              { 24000, 1001, 0,   912, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }},
+             {{ 30000, 1001, 1,  1820, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy },
+              {    25,    1, 1,  2196, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy },
+              { 60000, 1001, 0,  1820, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
+              { 30000, 1001, 0,  1820, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
+              {    50,    1, 0,  2196, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
+              {    25,    1, 0,  2196, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },
+              { 24000, 1001, 0,  1820, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }}},
+            {{{ 60000, 1001, 0,  1848, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },
+              {    50,    1, 0,  2224, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },
+              { 30000, 1001, 0,  1848, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },
+              {    25,    1, 0,  2224, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },
+              { 24000, 1001, 0,  1848, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  }},
+             {{ 30000, 1001, 1,  3692, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },
+              {    25,    1, 1,  4444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },
+              { 60000, 1001, 0,  3692, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
+              { 30000, 1001, 0,  3692, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
+              {    50,    1, 0,  4444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
+              {    25,    1, 0,  4444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
+              { 24000, 1001, 0,  3692, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}},
+            {{{ 60000, 1001, 0,  3724, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },
+              {    50,    1, 0,  4472, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  }},
+             {{ 30000, 1001, 1,  7444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },
+              {    25,    1, 1,  8940, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },
+              { 60000, 1001, 0,  7444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
+              { 30000, 1001, 0,  7444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
+              {    50,    1, 0,  8940, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
+              {    25,    1, 0,  8940, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },
+              { 24000, 1001, 0,  7444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}},
+            {{{ 60000, 1001, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },
+              {    50,    1, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },
+              { 30000, 1001, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },
+              {    25,    1, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },
+              { 24000, 1001, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy }}},
+            {{{ 60000, 1001, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },
+              {    50,    1, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },
+              { 30000, 1001, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },
+              {    25,    1, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },
+              { 24000, 1001, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy }}}
         };
 
         int res = -1;
         if( i_csp >= X264_CSP_I420 && i_csp < X264_CSP_I422 && !type )
         {
-            if(      h->param.i_width == 1440 && h->param.i_height == 1080 ) res =  1;
-            else if( h->param.i_width ==  960 && h->param.i_height ==  720 ) res =  0;
+            if(      h->param.i_width == 1440 && h->param.i_height == 1080 ) res = 1;
+            else if( h->param.i_width ==  960 && h->param.i_height ==  720 ) res = 0;
         }
         else if( i_csp >= X264_CSP_I422 && i_csp < X264_CSP_I444 && type )
         {
-            if(      h->param.i_width == 1920 && h->param.i_height == 1080 ) res =  1;
-            else if( h->param.i_width == 1280 && h->param.i_height ==  720 ) res =  0;
+            if( type < 3 )
+            {
+                if(      h->param.i_width == 1920 && h->param.i_height == 1080 ) res = 1;
+                else if( h->param.i_width == 2048 && h->param.i_height == 1080 ) res = 1;
+                else if( h->param.i_width == 1280 && h->param.i_height ==  720 ) res = 0;
+            }
+            else
+            {
+                if(      h->param.i_width == 3840 && h->param.i_height == 2160 ) res = 0;
+                else if( h->param.i_width == 4096 && h->param.i_height == 2160 ) res = 0;
+            }
         }
         else
         {
@@ -822,8 +849,8 @@ static int validate_parameters( x264_t *h, int b_open )
         }
         if( i == 7 )
         {
-            x264_log( h, X264_LOG_ERROR, "FPS %d/%d%c not compatible with AVC-Intra\n",
-                      h->param.i_fps_num, h->param.i_fps_den, PARAM_INTERLACED ? 'i' : 'p' );
+            x264_log( h, X264_LOG_ERROR, "FPS %d/%d%c not compatible with AVC-Intra %d\n",
+                      h->param.i_fps_num, h->param.i_fps_den, PARAM_INTERLACED ? 'i' : 'p', h->param.i_avcintra_class );
             return -1;
         }
 
@@ -843,7 +870,7 @@ static int validate_parameters( x264_t *h, int b_open )
         h->param.b_pic_struct = 0;
         h->param.analyse.b_transform_8x8 = 1;
         h->param.analyse.intra = X264_ANALYSE_I8x8;
-        h->param.analyse.i_chroma_qp_offset = res && type ? 3 : 4;
+        h->param.analyse.i_chroma_qp_offset = type > 2 ? -4 : res && type ? 3 : 4;
         h->param.b_cabac = !type;
         h->param.rc.i_vbv_buffer_size = avcintra_lut[type][res][i].frame_size;
         h->param.rc.i_vbv_max_bitrate =
@@ -852,7 +879,7 @@ static int validate_parameters( x264_t *h, int b_open )
         h->param.rc.f_vbv_buffer_init = 1.0;
         h->param.rc.b_filler = 1;
         h->param.i_cqm_preset = X264_CQM_CUSTOM;
-        memcpy( h->param.cqm_4iy, x264_cqm_jvt4i, sizeof(h->param.cqm_4iy) );
+        memcpy( h->param.cqm_4iy, avcintra_lut[type][res][i].cqm_4iy, sizeof(h->param.cqm_4iy) );
         memcpy( h->param.cqm_4ic, avcintra_lut[type][res][i].cqm_4ic, sizeof(h->param.cqm_4ic) );
         memcpy( h->param.cqm_8iy, avcintra_lut[type][res][i].cqm_8iy, sizeof(h->param.cqm_8iy) );
 
@@ -1545,7 +1572,7 @@ x264_t *x264_encoder_open( x264_param_t *param, void *api )
     h->i_frame_num = 0;
 
     if( h->param.i_avcintra_class )
-        h->i_idr_pic_id = 5;
+        h->i_idr_pic_id = h->param.i_avcintra_class > 200 ? 4 : 5;
     else
         h->i_idr_pic_id = 0;
 
@@ -3665,7 +3692,7 @@ int     x264_encoder_encode( x264_t *h,
                 int total_len = 256;
                 /* Sony XAVC uses an oversized PPS instead of SEI padding */
                 if( h->param.i_avcintra_flavor == X264_AVCINTRA_FLAVOR_SONY )
-                    total_len += h->param.i_height == 1080 ? 18*512 : 10*512;
+                    total_len += h->param.i_height >= 1080 ? 18*512 : 10*512;
                 h->out.nal[h->out.i_nal-1].i_padding = total_len - h->out.nal[h->out.i_nal-1].i_payload - NALU_OVERHEAD;
             }
             overhead += h->out.nal[h->out.i_nal-1].i_payload + h->out.nal[h->out.i_nal-1].i_padding + NALU_OVERHEAD;


=====================================
encoder/set.c
=====================================
@@ -241,7 +241,8 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
         sps->vui.i_log2_max_mv_length_vertical = (int)log2f( X264_MAX( 1, param->analyse.i_mv_range*4-1 ) ) + 1;
     }
 
-    sps->b_avcintra = !!param->i_avcintra_class;
+    sps->b_avcintra_hd = param->i_avcintra_class && param->i_avcintra_class <= 200;
+    sps->b_avcintra_4k = param->i_avcintra_class > 200;
     sps->i_cqm_preset = param->i_cqm_preset;
 }
 
@@ -325,8 +326,8 @@ void x264_sps_write( bs_t *s, x264_sps_t *sps )
         bs_write_ue( s, BIT_DEPTH-8 ); // bit_depth_chroma_minus8
         bs_write1( s, sps->b_qpprime_y_zero_transform_bypass );
         /* Exactly match the AVC-Intra bitstream */
-        bs_write1( s, sps->b_avcintra ); // seq_scaling_matrix_present_flag
-        if( sps->b_avcintra )
+        bs_write1( s, sps->b_avcintra_hd ); // seq_scaling_matrix_present_flag
+        if( sps->b_avcintra_hd )
         {
             scaling_list_write( s, sps, CQM_4IY );
             scaling_list_write( s, sps, CQM_4IC );
@@ -524,7 +525,7 @@ void x264_pps_write( bs_t *s, x264_sps_t *sps, x264_pps_t *pps )
     bs_write1( s, pps->b_constrained_intra_pred );
     bs_write1( s, pps->b_redundant_pic_cnt );
 
-    int b_scaling_list = !sps->b_avcintra && sps->i_cqm_preset != X264_CQM_FLAT;
+    int b_scaling_list = !sps->b_avcintra_hd && sps->i_cqm_preset != X264_CQM_FLAT;
     if( pps->b_transform_8x8_mode || b_scaling_list )
     {
         bs_write1( s, pps->b_transform_8x8_mode );
@@ -533,14 +534,27 @@ void x264_pps_write( bs_t *s, x264_sps_t *sps, x264_pps_t *pps )
         {
             scaling_list_write( s, sps, CQM_4IY );
             scaling_list_write( s, sps, CQM_4IC );
-            bs_write1( s, 0 ); // Cr = Cb
-            scaling_list_write( s, sps, CQM_4PY );
-            scaling_list_write( s, sps, CQM_4PC );
-            bs_write1( s, 0 ); // Cr = Cb
+            if( sps->b_avcintra_4k )
+            {
+                scaling_list_write( s, sps, CQM_4IC );
+                bs_write1( s, 0 ); // no inter
+                bs_write1( s, 0 ); // no inter
+                bs_write1( s, 0 ); // no inter
+            }
+            else
+            {
+                bs_write1( s, 0 ); // Cr = Cb
+                scaling_list_write( s, sps, CQM_4PY );
+                scaling_list_write( s, sps, CQM_4PC );
+                bs_write1( s, 0 ); // Cr = Cb
+            }
             if( pps->b_transform_8x8_mode )
             {
                 scaling_list_write( s, sps, CQM_8IY+4 );
-                scaling_list_write( s, sps, CQM_8PY+4 );
+                if( sps->b_avcintra_4k )
+                    bs_write1( s, 0 ); // no inter
+                else
+                    scaling_list_write( s, sps, CQM_8PY+4 );
                 if( sps->i_chroma_format_idc == CHROMA_444 )
                 {
                     scaling_list_write( s, sps, CQM_8IC+4 );


=====================================
x264.c
=====================================
@@ -140,7 +140,7 @@ static cli_output_t cli_output;
 /* video filter operation struct */
 static cli_vid_filter_t filter;
 
-const char * const x264_avcintra_class_names[] = { "50", "100", "200", 0 };
+const char * const x264_avcintra_class_names[] = { "50", "100", "200", "300", "480", 0 };
 const char * const x264_cqm_names[] = { "flat", "jvt", 0 };
 const char * const x264_log_level_names[] = { "none", "error", "warning", "info", "debug", 0 };
 const char * const x264_partition_names[] = { "p8x8", "p4x4", "b8x8", "i8x8", "i4x4", "none", "all", 0 };


=====================================
x264.h
=====================================
@@ -45,7 +45,7 @@ extern "C" {
 
 #include "x264_config.h"
 
-#define X264_BUILD 163
+#define X264_BUILD 164
 
 #ifdef _WIN32
 #   define X264_DLL_IMPORT __declspec(dllimport)



View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/ae03d92b52bb7581df2e75d571989cb1ecd19cbd

-- 
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/ae03d92b52bb7581df2e75d571989cb1ecd19cbd
You're receiving this email because of your account on code.videolan.org.




More information about the x264-devel mailing list