[x264-devel] [PATCH] add pps_id option and define sps_id and pps_id as uint8_t

Limin Wang lance.lmwang at gmail.com
Wed Jan 31 09:11:38 CET 2007


Hi there,

The patch try to allow user configure sps_id and pps_id with different value.
In addition, by the specs, sps_id range is from 0 to 31, pps range is from
0 to 255, so replace int with uint8_t type. Please review it.


Thanks,
Limin

-------------- next part --------------
Index: encoder/encoder.c
===================================================================
--- encoder/encoder.c	(revision 622)
+++ encoder/encoder.c	(working copy)
@@ -116,7 +116,7 @@
 
     sh->i_first_mb  = 0;
     sh->i_last_mb   = h->sps->i_mb_width * h->sps->i_mb_height;
-    sh->i_pps_id    = pps->i_id;
+    sh->i_pps_id    = pps->i_pps_id;
 
     sh->i_frame_num = i_frame;
 
@@ -619,7 +619,7 @@
     x264_sps_init( h->sps, h->param.i_sps_id, &h->param );
 
     h->pps = &h->pps_array[0];
-    x264_pps_init( h->pps, h->param.i_sps_id, &h->param, h->sps);
+    x264_pps_init( h->pps, h->param.i_pps_id, &h->param, h->sps);
 
     x264_validate_levels( h );
 
Index: encoder/set.c
===================================================================
--- encoder/set.c	(revision 622)
+++ encoder/set.c	(working copy)
@@ -369,7 +369,7 @@
 {
     int i, j;
 
-    pps->i_id = i_id;
+    pps->i_pps_id = i_id;
     pps->i_sps_id = sps->i_id;
     pps->b_cabac = param->b_cabac;
 
@@ -427,7 +427,7 @@
 
 void x264_pps_write( bs_t *s, x264_pps_t *pps )
 {
-    bs_write_ue( s, pps->i_id );
+    bs_write_ue( s, pps->i_pps_id );
     bs_write_ue( s, pps->i_sps_id );
 
     bs_write( s, 1, pps->b_cabac );
Index: x264.c
===================================================================
--- x264.c	(revision 622)
+++ x264.c	(working copy)
@@ -318,7 +318,8 @@
     H1( "      --non-deterministic     Slightly improve quality of SMP, at the cost of repeatability\n" );
     H1( "      --no-asm                Disable all CPU optimizations\n" );
     H1( "      --visualize             Show MB types overlayed on the encoded video\n" );
-    H1( "      --sps-id <integer>      Set SPS and PPS id numbers [%d]\n", defaults->i_sps_id );
+    H1( "      --sps-id <integer>      Set SPS id numbers [%d]\n", defaults->i_sps_id );
+    H1( "      --pps-id <integer>      Set PPS id numbers [%d]\n", defaults->i_pps_id );
     H1( "      --aud                   Use access unit delimiters\n" );
     H0( "\n" );
 }
@@ -444,6 +445,7 @@
             { "progress",no_argument,       NULL, OPT_PROGRESS },
             { "visualize",no_argument,      NULL, OPT_VISUALIZE },
             { "sps-id",  required_argument, NULL, 0 },
+            { "pps-id",  required_argument, NULL, 0 },
             { "aud",     no_argument,       NULL, 0 },
             { "nr",      required_argument, NULL, 0 },
             { "cqm",     required_argument, NULL, 0 },
Index: common/set.h
===================================================================
--- common/set.h	(revision 622)
+++ common/set.h	(working copy)
@@ -50,7 +50,7 @@
 
 typedef struct
 {
-    int i_id;
+    uint8_t i_id;
 
     int i_profile_idc;
     int i_level_idc;
@@ -133,8 +133,8 @@
 
 typedef struct
 {
-    int i_id;
-    int i_sps_id;
+    uint8_t i_pps_id;
+    uint8_t i_sps_id;
 
     int b_cabac;
 
Index: common/common.c
===================================================================
--- common/common.c	(revision 622)
+++ common/common.c	(working copy)
@@ -525,6 +525,8 @@
         p->b_aud = atobool(value);
     OPT("sps-id")
         p->i_sps_id = atoi(value);
+    OPT("pps-id")
+        p->i_pps_id = atoi(value);
     OPT("global-header")
         p->b_repeat_headers = !atobool(value);
     OPT("repeat-headers")
Index: x264.h
===================================================================
--- x264.h	(revision 622)
+++ x264.h	(working copy)
@@ -268,7 +268,8 @@
     /* Muxing parameters */
     int b_aud;                  /* generate access unit delimiters */
     int b_repeat_headers;       /* put SPS/PPS before each keyframe */
-    int i_sps_id;               /* SPS and PPS id number */
+    uint8_t i_sps_id;            /* SPS id number */
+    uint8_t i_pps_id;            /* PPS id number */
 } x264_param_t;
 
 typedef struct {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: not available
Url : http://mailman.videolan.org/pipermail/x264-devel/attachments/20070131/781beb43/attachment.pgp 


More information about the x264-devel mailing list