Interesting patch... <br><br>---------- Forwarded message ----------<br>From: <b>Anton Mitrofanov</b> <<a href="mailto:gitlab@videolan.org">gitlab@videolan.org</a>><br>Date: Sunday, June 13, 2021<br>Subject: [x264-devel] [Git][videolan/x264][master] Add support for Sony XAVC Class 300 and 480<br>To: <a href="mailto:x264-devel@videolan.org">x264-devel@videolan.org</a><br><br><br><br>
<br>
Anton Mitrofanov pushed to branch master at VideoLAN / x264<br>
<br>
<br>
Commits:<br>
ae03d92b by Phillip Blucas at 2021-06-13T20:32:44+00:00<br>
Add support for Sony XAVC Class 300 and 480<br>
<br>
This allows for 2160p UHD at up to 960 Mbit/s.<br>
<br>
- - - - -<br>
<br>
<br>
7 changed files:<br>
<br>
- common/set.h<br>
- common/tables.c<br>
- common/tables.h<br>
- encoder/encoder.c<br>
- encoder/set.c<br>
- x264.c<br>
- x264.h<br>
<br>
<br>
Changes:<br>
<br>
==============================<wbr>=======<br>
common/set.h<br>
==============================<wbr>=======<br>
@@ -140,7 +140,8 @@ typedef struct<br>
     int b_qpprime_y_zero_transform_<wbr>bypass;<br>
     int i_chroma_format_idc;<br>
<br>
-    int b_avcintra;<br>
+    int b_avcintra_hd;<br>
+    int b_avcintra_4k;<br>
     int i_cqm_preset;<br>
     const uint8_t *scaling_list[8]; /* could be 12, but we don't allow separate Cb/Cr lists */<br>
<br>
<br>
<br>
==============================<wbr>=======<br>
common/tables.c<br>
==============================<wbr>=======<br>
@@ -243,7 +243,7 @@ const uint8_t * const x264_cqm_jvt[8] =<br>
     x264_cqm_jvt8i, x264_cqm_jvt8p<br>
 };<br>
<br>
-// 1080i25_avci50, 1080p25_avci50<br>
+// 720p_avci50, 1080i_avci50, 1080p_avci50<br>
 const uint8_t x264_cqm_avci50_4ic[16] =<br>
 {<br>
     16,22,28,40,<br>
@@ -252,7 +252,7 @@ const uint8_t x264_cqm_avci50_4ic[16] =<br>
     40,44,48,60<br>
 };<br>
<br>
-//  1080p25_avci50, 720p25_avci50, 720p50_avci50<br>
+// 720p_avci50, 1080p_avci50<br>
 const uint8_t x264_cqm_avci50_p_8iy[64] =<br>
 {<br>
     16,18,19,21,24,27,30,33,<br>
@@ -265,7 +265,7 @@ const uint8_t x264_cqm_avci50_p_8iy[64] =<br>
     33,78,81,84,87,90,93,96<br>
 };<br>
<br>
-//  1080i25_avci50,<br>
+// 1080i_avci50<br>
 const uint8_t x264_cqm_avci50_1080i_8iy[64] =<br>
 {<br>
     16,18,19,21,27,33,81,87,<br>
@@ -278,7 +278,7 @@ const uint8_t x264_cqm_avci50_1080i_8iy[64] =<br>
     30,33,33,78,81,84,87,96<br>
 };<br>
<br>
-// 720p25_avci100, 720p50_avci100<br>
+// 720p_avci100<br>
 const uint8_t x264_cqm_avci100_720p_4ic[16] =<br>
 {<br>
     16,21,27,34,<br>
@@ -287,7 +287,7 @@ const uint8_t x264_cqm_avci100_720p_4ic[16] =<br>
     34,41,46,54<br>
 };<br>
<br>
-// 720p25_avci100, 720p50_avci100<br>
+// 720p_avci100<br>
 const uint8_t x264_cqm_avci100_720p_8iy[64] =<br>
 {<br>
     16,18,19,21,22,24,26,32,<br>
@@ -300,7 +300,7 @@ const uint8_t x264_cqm_avci100_720p_8iy[64] =<br>
     32,32,32,34,34,36,38,42<br>
 };<br>
<br>
-//  1080i25_avci100, 1080p25_avci100<br>
+// 1080i_avci100, 1080p_avci100<br>
 const uint8_t x264_cqm_avci100_1080_4ic[16] =<br>
 {<br>
     16,20,26,32,<br>
@@ -309,7 +309,7 @@ const uint8_t x264_cqm_avci100_1080_4ic[16] =<br>
     32,38,44,50<br>
 };<br>
<br>
-//  1080i25_avci100,<br>
+// 1080i_avci100<br>
 const uint8_t x264_cqm_avci100_1080i_8iy[64] =<br>
 {<br>
     16,19,20,23,24,26,32,42,<br>
@@ -322,7 +322,7 @@ const uint8_t x264_cqm_avci100_1080i_8iy[64] =<br>
     22,23,24,26,36,42,59,72<br>
 };<br>
<br>
-// 1080p25_avci100,<br>
+// 1080p_avci100<br>
 const uint8_t x264_cqm_avci100_1080p_8iy[64] =<br>
 {<br>
     16,18,19,20,22,23,24,26,<br>
@@ -335,6 +335,37 @@ const uint8_t x264_cqm_avci100_1080p_8iy[64] =<br>
     26,32,36,42,59,63,68,72<br>
 };<br>
<br>
+// 2160p_avci300<br>
+const uint8_t x264_cqm_avci300_2160p_4iy[16] =<br>
+{<br>
+    12,16,19,20,<br>
+    16,19,20,24,<br>
+    19,20,24,33,<br>
+    20,24,33,39<br>
+};<br>
+<br>
+// 2160p_avci300<br>
+const uint8_t x264_cqm_avci300_2160p_4ic[16] =<br>
+{<br>
+    28,39,56,67,<br>
+    39,56,67,77,<br>
+    56,67,77,104,<br>
+    67,77,104,133<br>
+};<br>
+<br>
+// 2160p_avci300<br>
+const uint8_t x264_cqm_avci300_2160p_8iy[64] =<br>
+{<br>
+    12,14,16,17,19,20,20,24,<br>
+    14,16,17,19,20,20,24,30,<br>
+    16,17,19,20,20,24,30,42,<br>
+    17,19,20,20,24,30,42,56,<br>
+    19,20,20,24,30,42,56,72,<br>
+    20,20,24,30,42,56,72,76,<br>
+    20,24,30,42,56,72,76,80,<br>
+    24,30,42,56,72,76,80,84<br>
+};<br>
+<br>
 /*****************************<wbr>******************************<wbr>******************<br>
  * QUANT<br>
  ******************************<wbr>******************************<wbr>*****************/<br>
<br>
<br>
==============================<wbr>=======<br>
common/tables.h<br>
==============================<wbr>=======<br>
@@ -63,6 +63,9 @@ extern const uint8_t x264_cqm_avci100_720p_8iy[64];<br>
 extern const uint8_t x264_cqm_avci100_1080_4ic[16];<br>
 extern const uint8_t x264_cqm_avci100_1080i_8iy[64]<wbr>;<br>
 extern const uint8_t x264_cqm_avci100_1080p_8iy[64]<wbr>;<br>
+extern const uint8_t x264_cqm_avci300_2160p_4iy[16]<wbr>;<br>
+extern const uint8_t x264_cqm_avci300_2160p_4ic[16]<wbr>;<br>
+extern const uint8_t x264_cqm_avci300_2160p_8iy[64]<wbr>;<br>
<br>
 extern const uint8_t x264_decimate_table4[16];<br>
 extern const uint8_t x264_decimate_table8[64];<br>
<br>
<br>
==============================<wbr>=======<br>
encoder/encoder.c<br>
==============================<wbr>=======<br>
@@ -717,7 +717,9 @@ static int validate_parameters( x264_t *h, int b_open )<br>
             return -1;<br>
         }<br>
<br>
-        int type = h->param.i_avcintra_class == 200 ? 2 :<br>
+        int type = h->param.i_avcintra_class == 480 ? 4 :<br>
+                   h->param.i_avcintra_class == 300 ? 3 :<br>
+                   h->param.i_avcintra_class == 200 ? 2 :<br>
                    h->param.i_avcintra_class == 100 ? 1 :<br>
                    h->param.i_avcintra_class == 50 ? 0 : -1;<br>
         if( type < 0 )<br>
@@ -725,63 +727,88 @@ static int validate_parameters( x264_t *h, int b_open )<br>
             x264_log( h, X264_LOG_ERROR, "Invalid AVC-Intra class\n" );<br>
             return -1;<br>
         }<br>
+        else if( type > 2 && h->param.i_avcintra_flavor != X264_AVCINTRA_FLAVOR_SONY )<br>
+        {<br>
+            x264_log( h, X264_LOG_ERROR, "AVC-Intra %d only supported by Sony XAVC flavor\n", h->param.i_avcintra_class );<br>
+            return -1;<br>
+        }<br>
<br>
-        /* [50/100/200][res][fps] */<br>
+        /* [50/100/200/300/480][res][fps] */<br>
         static const struct<br>
         {<br>
             uint16_t fps_num;<br>
             uint16_t fps_den;<br>
             uint8_t interlaced;<br>
             uint16_t frame_size;<br>
+            const uint8_t *cqm_4iy;<br>
             const uint8_t *cqm_4ic;<br>
             const uint8_t *cqm_8iy;<br>
-        } avcintra_lut[3][2][7] =<br>
-        {<br>
-            {{{ 60000, 1001, 0,  912, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
-              {    50,    1, 0, 1100, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
-              { 30000, 1001, 0,  912, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
-              {    25,    1, 0, 1100, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
-              { 24000, 1001, 0,  912, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }},<br>
-             {{ 30000, 1001, 1, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy },<br>
-              {    25,    1, 1, 2196, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy },<br>
-              { 60000, 1001, 0, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
-              { 30000, 1001, 0, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
-              {    50,    1, 0, 2196, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
-              {    25,    1, 0, 2196, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
-              { 24000, 1001, 0, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }}},<br>
-            {{{ 60000, 1001, 0, 1848, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },<br>
-              {    50,    1, 0, 2224, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },<br>
-              { 30000, 1001, 0, 1848, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },<br>
-              {    25,    1, 0, 2224, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },<br>
-              { 24000, 1001, 0, 1848, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }},<br>
-             {{ 30000, 1001, 1, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },<br>
-              {    25,    1, 1, 4444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },<br>
-              { 60000, 1001, 0, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
-              { 30000, 1001, 0, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
-              {    50,    1, 0, 4444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
-              {    25,    1, 0, 4444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
-              { 24000, 1001, 0, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}},<br>
-            {{{ 60000, 1001, 0, 3724, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy },<br>
-              {    50,    1, 0, 4472, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }},<br>
-             {{ 30000, 1001, 1, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },<br>
-              {    25,    1, 1, 8940, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },<br>
-              { 60000, 1001, 0, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
-              { 30000, 1001, 0, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
-              {    50,    1, 0, 8940, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
-              {    25,    1, 0, 8940, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
-              { 24000, 1001, 0, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}}<br>
+        } avcintra_lut[5][2][7] =<br>
+        {<br>
+            {{{ 60000, 1001, 0,   912, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
+              {    50,    1, 0,  1100, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
+              { 30000, 1001, 0,   912, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
+              {    25,    1, 0,  1100, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
+              { 24000, 1001, 0,   912, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }},<br>
+             {{ 30000, 1001, 1,  1820, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy },<br>
+              {    25,    1, 1,  2196, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy },<br>
+              { 60000, 1001, 0,  1820, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
+              { 30000, 1001, 0,  1820, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
+              {    50,    1, 0,  2196, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
+              {    25,    1, 0,  2196, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy },<br>
+              { 24000, 1001, 0,  1820, x264_cqm_jvt4i, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }}},<br>
+            {{{ 60000, 1001, 0,  1848, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },<br>
+              {    50,    1, 0,  2224, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },<br>
+              { 30000, 1001, 0,  1848, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },<br>
+              {    25,    1, 0,  2224, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },<br>
+              { 24000, 1001, 0,  1848, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  }},<br>
+             {{ 30000, 1001, 1,  3692, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },<br>
+              {    25,    1, 1,  4444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },<br>
+              { 60000, 1001, 0,  3692, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
+              { 30000, 1001, 0,  3692, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
+              {    50,    1, 0,  4444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
+              {    25,    1, 0,  4444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
+              { 24000, 1001, 0,  3692, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}},<br>
+            {{{ 60000, 1001, 0,  3724, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  },<br>
+              {    50,    1, 0,  4472, x264_cqm_jvt4i, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy  }},<br>
+             {{ 30000, 1001, 1,  7444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },<br>
+              {    25,    1, 1,  8940, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy },<br>
+              { 60000, 1001, 0,  7444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
+              { 30000, 1001, 0,  7444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
+              {    50,    1, 0,  8940, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
+              {    25,    1, 0,  8940, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy },<br>
+              { 24000, 1001, 0,  7444, x264_cqm_jvt4i, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}},<br>
+            {{{ 60000, 1001, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },<br>
+              {    50,    1, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },<br>
+              { 30000, 1001, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },<br>
+              {    25,    1, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },<br>
+              { 24000, 1001, 0,  9844, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy }}},<br>
+            {{{ 60000, 1001, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },<br>
+              {    50,    1, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },<br>
+              { 30000, 1001, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },<br>
+              {    25,    1, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy },<br>
+              { 24000, 1001, 0, 15700, x264_cqm_avci300_2160p_4iy, x264_cqm_avci300_2160p_4ic, x264_cqm_avci300_2160p_8iy }}}<br>
         };<br>
<br>
         int res = -1;<br>
         if( i_csp >= X264_CSP_I420 && i_csp < X264_CSP_I422 && !type )<br>
         {<br>
-            if(      h->param.i_width == 1440 && h->param.i_height == 1080 ) res =  1;<br>
-            else if( h->param.i_width ==  960 && h->param.i_height ==  720 ) res =  0;<br>
+            if(      h->param.i_width == 1440 && h->param.i_height == 1080 ) res = 1;<br>
+            else if( h->param.i_width ==  960 && h->param.i_height ==  720 ) res = 0;<br>
         }<br>
         else if( i_csp >= X264_CSP_I422 && i_csp < X264_CSP_I444 && type )<br>
         {<br>
-            if(      h->param.i_width == 1920 && h->param.i_height == 1080 ) res =  1;<br>
-            else if( h->param.i_width == 1280 && h->param.i_height ==  720 ) res =  0;<br>
+            if( type < 3 )<br>
+            {<br>
+                if(      h->param.i_width == 1920 && h->param.i_height == 1080 ) res = 1;<br>
+                else if( h->param.i_width == 2048 && h->param.i_height == 1080 ) res = 1;<br>
+                else if( h->param.i_width == 1280 && h->param.i_height ==  720 ) res = 0;<br>
+            }<br>
+            else<br>
+            {<br>
+                if(      h->param.i_width == 3840 && h->param.i_height == 2160 ) res = 0;<br>
+                else if( h->param.i_width == 4096 && h->param.i_height == 2160 ) res = 0;<br>
+            }<br>
         }<br>
         else<br>
         {<br>
@@ -822,8 +849,8 @@ static int validate_parameters( x264_t *h, int b_open )<br>
         }<br>
         if( i == 7 )<br>
         {<br>
-            x264_log( h, X264_LOG_ERROR, "FPS %d/%d%c not compatible with AVC-Intra\n",<br>
-                      h->param.i_fps_num, h->param.i_fps_den, PARAM_INTERLACED ? 'i' : 'p' );<br>
+            x264_log( h, X264_LOG_ERROR, "FPS %d/%d%c not compatible with AVC-Intra %d\n",<br>
+                      h->param.i_fps_num, h->param.i_fps_den, PARAM_INTERLACED ? 'i' : 'p', h->param.i_avcintra_class );<br>
             return -1;<br>
         }<br>
<br>
@@ -843,7 +870,7 @@ static int validate_parameters( x264_t *h, int b_open )<br>
         h->param.b_pic_struct = 0;<br>
         h->param.analyse.b_transform_<wbr>8x8 = 1;<br>
         h->param.analyse.intra = X264_ANALYSE_I8x8;<br>
-        h->param.analyse.i_chroma_qp_<wbr>offset = res && type ? 3 : 4;<br>
+        h->param.analyse.i_chroma_qp_<wbr>offset = type > 2 ? -4 : res && type ? 3 : 4;<br>
         h->param.b_cabac = !type;<br>
         h->param.rc.i_vbv_buffer_size = avcintra_lut[type][res][i].<wbr>frame_size;<br>
         h->param.rc.i_vbv_max_bitrate =<br>
@@ -852,7 +879,7 @@ static int validate_parameters( x264_t *h, int b_open )<br>
         h->param.rc.f_vbv_buffer_init = 1.0;<br>
         h->param.rc.b_filler = 1;<br>
         h->param.i_cqm_preset = X264_CQM_CUSTOM;<br>
-        memcpy( h->param.cqm_4iy, x264_cqm_jvt4i, sizeof(h->param.cqm_4iy) );<br>
+        memcpy( h->param.cqm_4iy, avcintra_lut[type][res][i].<wbr>cqm_4iy, sizeof(h->param.cqm_4iy) );<br>
         memcpy( h->param.cqm_4ic, avcintra_lut[type][res][i].<wbr>cqm_4ic, sizeof(h->param.cqm_4ic) );<br>
         memcpy( h->param.cqm_8iy, avcintra_lut[type][res][i].<wbr>cqm_8iy, sizeof(h->param.cqm_8iy) );<br>
<br>
@@ -1545,7 +1572,7 @@ x264_t *x264_encoder_open( x264_param_t *param, void *api )<br>
     h->i_frame_num = 0;<br>
<br>
     if( h->param.i_avcintra_class )<br>
-        h->i_idr_pic_id = 5;<br>
+        h->i_idr_pic_id = h->param.i_avcintra_class > 200 ? 4 : 5;<br>
     else<br>
         h->i_idr_pic_id = 0;<br>
<br>
@@ -3665,7 +3692,7 @@ int     x264_encoder_encode( x264_t *h,<br>
                 int total_len = 256;<br>
                 /* Sony XAVC uses an oversized PPS instead of SEI padding */<br>
                 if( h->param.i_avcintra_flavor == X264_AVCINTRA_FLAVOR_SONY )<br>
-                    total_len += h->param.i_height == 1080 ? 18*512 : 10*512;<br>
+                    total_len += h->param.i_height >= 1080 ? 18*512 : 10*512;<br>
                 h->out.nal[h->out.i_nal-1].i_<wbr>padding = total_len - h->out.nal[h->out.i_nal-1].i_<wbr>payload - NALU_OVERHEAD;<br>
             }<br>
             overhead += h->out.nal[h->out.i_nal-1].i_<wbr>payload + h->out.nal[h->out.i_nal-1].i_<wbr>padding + NALU_OVERHEAD;<br>
<br>
<br>
==============================<wbr>=======<br>
encoder/set.c<br>
==============================<wbr>=======<br>
@@ -241,7 +241,8 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )<br>
         sps->vui.i_log2_max_mv_length_<wbr>vertical = (int)log2f( X264_MAX( 1, param->analyse.i_mv_range*4-1 ) ) + 1;<br>
     }<br>
<br>
-    sps->b_avcintra = !!param->i_avcintra_class;<br>
+    sps->b_avcintra_hd = param->i_avcintra_class && param->i_avcintra_class <= 200;<br>
+    sps->b_avcintra_4k = param->i_avcintra_class > 200;<br>
     sps->i_cqm_preset = param->i_cqm_preset;<br>
 }<br>
<br>
@@ -325,8 +326,8 @@ void x264_sps_write( bs_t *s, x264_sps_t *sps )<br>
         bs_write_ue( s, BIT_DEPTH-8 ); // bit_depth_chroma_minus8<br>
         bs_write1( s, sps->b_qpprime_y_zero_<wbr>transform_bypass );<br>
         /* Exactly match the AVC-Intra bitstream */<br>
-        bs_write1( s, sps->b_avcintra ); // seq_scaling_matrix_present_<wbr>flag<br>
-        if( sps->b_avcintra )<br>
+        bs_write1( s, sps->b_avcintra_hd ); // seq_scaling_matrix_present_<wbr>flag<br>
+        if( sps->b_avcintra_hd )<br>
         {<br>
             scaling_list_write( s, sps, CQM_4IY );<br>
             scaling_list_write( s, sps, CQM_4IC );<br>
@@ -524,7 +525,7 @@ void x264_pps_write( bs_t *s, x264_sps_t *sps, x264_pps_t *pps )<br>
     bs_write1( s, pps->b_constrained_intra_pred );<br>
     bs_write1( s, pps->b_redundant_pic_cnt );<br>
<br>
-    int b_scaling_list = !sps->b_avcintra && sps->i_cqm_preset != X264_CQM_FLAT;<br>
+    int b_scaling_list = !sps->b_avcintra_hd && sps->i_cqm_preset != X264_CQM_FLAT;<br>
     if( pps->b_transform_8x8_mode || b_scaling_list )<br>
     {<br>
         bs_write1( s, pps->b_transform_8x8_mode );<br>
@@ -533,14 +534,27 @@ void x264_pps_write( bs_t *s, x264_sps_t *sps, x264_pps_t *pps )<br>
         {<br>
             scaling_list_write( s, sps, CQM_4IY );<br>
             scaling_list_write( s, sps, CQM_4IC );<br>
-            bs_write1( s, 0 ); // Cr = Cb<br>
-            scaling_list_write( s, sps, CQM_4PY );<br>
-            scaling_list_write( s, sps, CQM_4PC );<br>
-            bs_write1( s, 0 ); // Cr = Cb<br>
+            if( sps->b_avcintra_4k )<br>
+            {<br>
+                scaling_list_write( s, sps, CQM_4IC );<br>
+                bs_write1( s, 0 ); // no inter<br>
+                bs_write1( s, 0 ); // no inter<br>
+                bs_write1( s, 0 ); // no inter<br>
+            }<br>
+            else<br>
+            {<br>
+                bs_write1( s, 0 ); // Cr = Cb<br>
+                scaling_list_write( s, sps, CQM_4PY );<br>
+                scaling_list_write( s, sps, CQM_4PC );<br>
+                bs_write1( s, 0 ); // Cr = Cb<br>
+            }<br>
             if( pps->b_transform_8x8_mode )<br>
             {<br>
                 scaling_list_write( s, sps, CQM_8IY+4 );<br>
-                scaling_list_write( s, sps, CQM_8PY+4 );<br>
+                if( sps->b_avcintra_4k )<br>
+                    bs_write1( s, 0 ); // no inter<br>
+                else<br>
+                    scaling_list_write( s, sps, CQM_8PY+4 );<br>
                 if( sps->i_chroma_format_idc == CHROMA_444 )<br>
                 {<br>
                     scaling_list_write( s, sps, CQM_8IC+4 );<br>
<br>
<br>
==============================<wbr>=======<br>
x264.c<br>
==============================<wbr>=======<br>
@@ -140,7 +140,7 @@ static cli_output_t cli_output;<br>
 /* video filter operation struct */<br>
 static cli_vid_filter_t filter;<br>
<br>
-const char * const x264_avcintra_class_names[] = { "50", "100", "200", 0 };<br>
+const char * const x264_avcintra_class_names[] = { "50", "100", "200", "300", "480", 0 };<br>
 const char * const x264_cqm_names[] = { "flat", "jvt", 0 };<br>
 const char * const x264_log_level_names[] = { "none", "error", "warning", "info", "debug", 0 };<br>
 const char * const x264_partition_names[] = { "p8x8", "p4x4", "b8x8", "i8x8", "i4x4", "none", "all", 0 };<br>
<br>
<br>
==============================<wbr>=======<br>
x264.h<br>
==============================<wbr>=======<br>
@@ -45,7 +45,7 @@ extern "C" {<br>
<br>
 #include "x264_config.h"<br>
<br>
-#define X264_BUILD 163<br>
+#define X264_BUILD 164<br>
<br>
 #ifdef _WIN32<br>
 #   define X264_DLL_IMPORT __declspec(dllimport)<br>
<br>
<br>
<br>
View it on GitLab: <a href="https://code.videolan.org/videolan/x264/-/commit/ae03d92b52bb7581df2e75d571989cb1ecd19cbd" target="_blank">https://code.videolan.org/<wbr>videolan/x264/-/commit/<wbr>ae03d92b52bb7581df2e75d571989c<wbr>b1ecd19cbd</a><br>
<br>
-- <br>
View it on GitLab: <a href="https://code.videolan.org/videolan/x264/-/commit/ae03d92b52bb7581df2e75d571989cb1ecd19cbd" target="_blank">https://code.videolan.org/<wbr>videolan/x264/-/commit/<wbr>ae03d92b52bb7581df2e75d571989c<wbr>b1ecd19cbd</a><br>
You're receiving this email because of your account on <a href="http://code.videolan.org" target="_blank">code.videolan.org</a>.<br>
<br>
<br>
<br>