[x264-devel] NAL order inside access unit is not correct

Loïc Le Loarer lll+vlc at m4x.org
Wed May 10 17:15:56 CEST 2006


Hi,

According to the H.264 norm, the order of NAL inside an access unit
should be SPS, PPS, SEI, VCL but x264 is outputing the user data SEI
before the SPS and the PPS.

Here is a patch which is correcting this.

Best regards.

-- 
Loïc

"heaven is not a place, it's a feeling"
-------------- next part --------------
Index: encoder/encoder.c
===================================================================
--- encoder/encoder.c	(revision 520)
+++ encoder/encoder.c	(working copy)
@@ -673,11 +673,6 @@
     /* Put SPS and PPS */
     if( h->i_frame == 0 )
     {
-        /* identify ourself */
-        x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
-        x264_sei_version_write( h, &h->out.bs );
-        x264_nal_end( h );
-
         /* generate sequence parameters */
         x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
         x264_sps_write( &h->out.bs, h->sps );
@@ -687,6 +682,11 @@
         x264_nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
         x264_pps_write( &h->out.bs, h->pps );
         x264_nal_end( h );
+
+        /* identify ourself */
+        x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+        x264_sei_version_write( h, &h->out.bs );
+        x264_nal_end( h );
     }
     /* now set output*/
     *pi_nal = h->out.i_nal;
@@ -1331,14 +1331,6 @@
     /* Write SPS and PPS */
     if( i_nal_type == NAL_SLICE_IDR && h->param.b_repeat_headers )
     {
-        if( h->fenc->i_frame == 0 )
-        {
-            /* identify ourself */
-            x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
-            x264_sei_version_write( h, &h->out.bs );
-            x264_nal_end( h );
-        }
-
         /* generate sequence parameters */
         x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
         x264_sps_write( &h->out.bs, h->sps );
@@ -1348,6 +1340,14 @@
         x264_nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
         x264_pps_write( &h->out.bs, h->pps );
         x264_nal_end( h );
+
+        if( h->fenc->i_frame == 0 )
+        {
+            /* identify ourself */
+            x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+            x264_sei_version_write( h, &h->out.bs );
+            x264_nal_end( h );
+        }
     }
 
     /* Write frame */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.videolan.org/pipermail/x264-devel/attachments/20060510/471a3026/attachment.pgp 


More information about the x264-devel mailing list