]> git.videolan.org Git - x264.git/commitdiff
Optionally use access unit delimiter NAL units.
authorMåns Rullgård <mru@mru.ath.cx>
Thu, 7 Apr 2005 23:11:06 +0000 (23:11 +0000)
committerMåns Rullgård <mru@mru.ath.cx>
Thu, 7 Apr 2005 23:11:06 +0000 (23:11 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@188 df754926-b1dd-0310-bc7b-ec298dee348c

common/common.c
common/common.h
encoder/encoder.c
x264.c
x264.h

index a4be81da8fd601143df85b52e530720c230c2a97..a586c39d9838c473800d2e1941b248e3b8fd69c7 100644 (file)
@@ -110,6 +110,8 @@ void    x264_param_default( x264_param_t *param )
     param->analyse.i_mv_range = 512;
     param->analyse.i_chroma_qp_offset = 0;
     param->analyse.b_psnr = 1;
+
+    param->b_aud = 0;
 }
 
 /****************************************************************************
index 540156d5da90a2e63ed198cc8c2a7a4c294a347c..94d4574d3c45aff99804190f793b96811c51aa29 100644 (file)
@@ -205,7 +205,7 @@ struct x264_t
     struct
     {
         int         i_nal;
-        x264_nal_t  nal[4];         /* for now 4 is enough */
+        x264_nal_t  nal[5];         /* for now 5 is enough */
         int         i_bitstream;    /* size of p_bitstream */
         uint8_t     *p_bitstream;   /* will hold data for all nal */
         bs_t        bs;
index ee5e4575ec0ebfc7da3a5ed76683d31f5b2196e5..1ed7c18556b414060cf7903fcf4ac41cd5a234d1 100644 (file)
@@ -1151,6 +1151,23 @@ do_encode:
     h->out.i_nal = 0;
     bs_init( &h->out.bs, h->out.p_bitstream, h->out.i_bitstream );
 
+    if(h->param.b_aud){
+        int pic_type;
+
+        if(i_slice_type == SLICE_TYPE_I)
+            pic_type = 0;
+        else if(i_slice_type == SLICE_TYPE_P)
+            pic_type = 1;
+        else if(i_slice_type == SLICE_TYPE_B)
+            pic_type = 2;
+        else
+            pic_type = 7;
+
+        x264_nal_start(h, NAL_AUD, NAL_PRIORITY_DISPOSABLE);
+        bs_write(&h->out.bs, 3, pic_type);
+        x264_nal_end(h);
+    }
+
     /* Write SPS and PPS */
     if( i_nal_type == NAL_SLICE_IDR )
     {
diff --git a/x264.c b/x264.c
index 1e5d6e5a698f2640c34234cbc45e4d4c0e4b016b..a3b32c70d8408f0d24181da8823c6032ccfbf8f1 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -185,6 +185,7 @@ static void Help( x264_param_t *defaults )
              "      --no-psnr               Disable PSNR computaion\n"
              "      --quiet                 Quiet Mode\n"
              "  -v, --verbose               Print stats for each frame\n"
+             "      --aud                   Use access unit delimiters\n"
              "\n",
             X264_BUILD, X264_VERSION,
             defaults->i_keyint_max,
@@ -268,6 +269,7 @@ static int  Parse( int argc, char **argv,
 #define OPT_CHROMA_QP 280
 #define OPT_NO_CHROMA_ME 281
 #define OPT_NO_CABAC 282
+#define OPT_AUD 283
 
         static struct option long_options[] =
         {
@@ -314,6 +316,7 @@ static int  Parse( int argc, char **argv,
             { "no-psnr", no_argument,       NULL, OPT_NOPSNR },
             { "quiet",   no_argument,       NULL, OPT_QUIET },
             { "verbose", no_argument,       NULL, 'v' },
+            { "aud",     no_argument,       NULL, OPT_AUD },
             {0, 0, 0, 0}
         };
 
@@ -520,6 +523,9 @@ static int  Parse( int argc, char **argv,
             case 'v':
                 param->i_log_level = X264_LOG_DEBUG;
                 break;
+            case OPT_AUD:
+                param->b_aud = 1;
+                break;
             default:
                 fprintf( stderr, "unknown option (%c)\n", optopt );
                 return -1;
diff --git a/x264.h b/x264.h
index c7b47e5264321d8d4454213d70625e859375ac4a..f7d9d18136a6fb374b8c2171ac56169876a1d885 100644 (file)
--- a/x264.h
+++ b/x264.h
@@ -180,6 +180,7 @@ typedef struct
         float       f_complexity_blur; /* temporally blur complexity */
     } rc;
 
+    int b_aud;                  /* generate access unit delimiters */
 } x264_param_t;
 
 /* x264_param_default:
@@ -235,7 +236,8 @@ enum nal_unit_type_e
     NAL_SLICE_IDR   = 5,    /* ref_idc != 0 */
     NAL_SEI         = 6,    /* ref_idc == 0 */
     NAL_SPS         = 7,
-    NAL_PPS         = 8
+    NAL_PPS         = 8,
+    NAL_AUD         = 9,
     /* ref_idc == 0 for 6,9,10,11,12 */
 };
 enum nal_priority_e