Commit e103917a authored by Måns Rullgård's avatar Måns Rullgård

Optionally use access unit delimiter NAL units.


git-svn-id: svn://svn.videolan.org/x264/trunk@188 df754926-b1dd-0310-bc7b-ec298dee348c
parent d4663a41
......@@ -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;
}
/****************************************************************************
......
......@@ -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;
......
......@@ -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 )
{
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment