From: Måns Rullgård Date: Thu, 7 Apr 2005 23:11:06 +0000 (+0000) Subject: Optionally use access unit delimiter NAL units. X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=e103917aa0cbb702ba09c2507565398d7f129c2e;p=x264.git Optionally use access unit delimiter NAL units. git-svn-id: svn://svn.videolan.org/x264/trunk@188 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/common/common.c b/common/common.c index a4be81da..a586c39d 100644 --- a/common/common.c +++ b/common/common.c @@ -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; } /**************************************************************************** diff --git a/common/common.h b/common/common.h index 540156d5..94d4574d 100644 --- a/common/common.h +++ b/common/common.h @@ -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; diff --git a/encoder/encoder.c b/encoder/encoder.c index ee5e4575..1ed7c185 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -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 1e5d6e5a..a3b32c70 100644 --- 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 c7b47e52..f7d9d181 100644 --- 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