h->mc.mc_luma( &h->mb.pic.p_fdec[p][4*y*FDEC_STRIDE+4*x], FDEC_STRIDE, \
&h->mb.pic.p_fref[list][i_ref][p*4], h->mb.pic.i_stride[p], \
mvx, mvy, 4*width, 4*height, \
- list ? weight_none : &h->sh.weight[i_ref][p] );
+ list ? x264_weight_none : &h->sh.weight[i_ref][p] );
static NOINLINE void x264_mb_mc_0xywh( x264_t *h, int x, int y, int width, int height )
{
#define MC_LUMA_BI(p) \
src0 = h->mc.get_ref( tmp0, &i_stride0, &h->mb.pic.p_fref[0][i_ref0][p*4], h->mb.pic.i_stride[p], \
- mvx0, mvy0, 4*width, 4*height, weight_none ); \
+ mvx0, mvy0, 4*width, 4*height, x264_weight_none ); \
src1 = h->mc.get_ref( tmp1, &i_stride1, &h->mb.pic.p_fref[1][i_ref1][p*4], h->mb.pic.i_stride[p], \
- mvx1, mvy1, 4*width, 4*height, weight_none ); \
+ mvx1, mvy1, 4*width, 4*height, x264_weight_none ); \
h->mc.avg[i_mode]( &h->mb.pic.p_fdec[p][4*y*FDEC_STRIDE+4*x], FDEC_STRIDE, \
src0, i_stride0, src1, i_stride1, weight );
mc_weight_w16,
mc_weight_w20,
};
-const x264_weight_t weight_none[3] = { {{0}} };
+const x264_weight_t x264_weight_none[3] = { {{0}} };
static void mc_copy( pixel *src, int i_src_stride, pixel *dst, int i_dst_stride, int i_width, int i_height )
{
for( int y = 0; y < i_height; y++ )
weight_fn_t *weightfn;
} ALIGNED_16( x264_weight_t );
-extern const x264_weight_t weight_none[3];
+extern const x264_weight_t x264_weight_none[3];
#define SET_WEIGHT( w, b, s, d, o )\
{\
return ssim;
}
-int pixel_vsad( pixel *src, int stride, int height )
+static int pixel_vsad( pixel *src, int stride, int height )
{
int score = 0;
for( int i = 1; i < height; i++, src += stride )
else \
(m)->p_fref[4] = &(src)[4][(xoff)+((yoff)>>1)*(m)->i_stride[1]]; \
(m)->integral = &h->mb.pic.p_integral[list][ref][(xoff)+(yoff)*(m)->i_stride[0]]; \
- (m)->weight = weight_none; \
+ (m)->weight = x264_weight_none; \
(m)->i_ref = ref; \
}
if( CHROMA444 ) \
{ \
h->mc.mc_luma( pix[0], 16, &m0.p_fref[4], m0.i_stride[1], \
- m0.mv[0], m0.mv[1], 2*width, 2*height, weight_none ); \
+ m0.mv[0], m0.mv[1], 2*width, 2*height, x264_weight_none ); \
h->mc.mc_luma( pix[1], 16, &m0.p_fref[8], m0.i_stride[2], \
- m0.mv[0], m0.mv[1], 2*width, 2*height, weight_none ); \
+ m0.mv[0], m0.mv[1], 2*width, 2*height, x264_weight_none ); \
h->mc.mc_luma( pix[2], 16, &m1.p_fref[4], m1.i_stride[1], \
- m1.mv[0], m1.mv[1], 2*width, 2*height, weight_none ); \
+ m1.mv[0], m1.mv[1], 2*width, 2*height, x264_weight_none ); \
h->mc.mc_luma( pix[3], 16, &m1.p_fref[8], m1.i_stride[2], \
- m1.mv[0], m1.mv[1], 2*width, 2*height, weight_none ); \
+ m1.mv[0], m1.mv[1], 2*width, 2*height, x264_weight_none ); \
h->mc.avg[i_pixel]( bi[0], 16, pix[0], 16, pix[2], 16, h->mb.bipred_weight[m0.i_ref][m1.i_ref] ); \
h->mc.avg[i_pixel]( bi[1], 16, pix[1], 16, pix[3], 16, h->mb.bipred_weight[m0.i_ref][m1.i_ref] ); \
i_chroma_cost = h->pixf.mbcmp[i_pixel]( m0.p_fenc[1], FENC_STRIDE, bi[0], 16 ); \
int ref_costs = REF_COST( 0, a->l0.bi16x16.i_ref ) + REF_COST( 1, a->l1.bi16x16.i_ref );
src0 = h->mc.get_ref( pix0, &stride0,
h->mb.pic.p_fref[0][a->l0.bi16x16.i_ref], h->mb.pic.i_stride[0],
- a->l0.bi16x16.mv[0], a->l0.bi16x16.mv[1], 16, 16, weight_none );
+ a->l0.bi16x16.mv[0], a->l0.bi16x16.mv[1], 16, 16, x264_weight_none );
src1 = h->mc.get_ref( pix1, &stride1,
h->mb.pic.p_fref[1][a->l1.bi16x16.i_ref], h->mb.pic.i_stride[0],
- a->l1.bi16x16.mv[0], a->l1.bi16x16.mv[1], 16, 16, weight_none );
+ a->l1.bi16x16.mv[0], a->l1.bi16x16.mv[1], 16, 16, x264_weight_none );
h->mc.avg[PIXEL_16x16]( pix0, 16, src0, stride0, src1, stride1, h->mb.bipred_weight[a->l0.bi16x16.i_ref][a->l1.bi16x16.i_ref] );
/* BI mode */
src[0] = h->mc.get_ref( pix[0], &stride[0], a->l0.me8x8[i].p_fref, a->l0.me8x8[i].i_stride[0],
- a->l0.me8x8[i].mv[0], a->l0.me8x8[i].mv[1], 8, 8, weight_none );
+ a->l0.me8x8[i].mv[0], a->l0.me8x8[i].mv[1], 8, 8, x264_weight_none );
src[1] = h->mc.get_ref( pix[1], &stride[1], a->l1.me8x8[i].p_fref, a->l1.me8x8[i].i_stride[0],
- a->l1.me8x8[i].mv[0], a->l1.me8x8[i].mv[1], 8, 8, weight_none );
+ a->l1.me8x8[i].mv[0], a->l1.me8x8[i].mv[1], 8, 8, x264_weight_none );
h->mc.avg[PIXEL_8x8]( pix[0], 8, src[0], stride[0], src[1], stride[1],
h->mb.bipred_weight[a->l0.me8x8[i].i_ref][a->l1.me8x8[i].i_ref] );
/* BI mode */
src[l] = h->mc.get_ref( pix[l], &stride[l], m->p_fref, m->i_stride[0],
- m->mv[0], m->mv[1], 8, 8, weight_none );
+ m->mv[0], m->mv[1], 8, 8, x264_weight_none );
i_part_cost_bi += m->cost_mv + m->i_ref_cost;
}
h->mc.avg[PIXEL_8x8]( pix[0], 8, src[0], stride[0], src[1], stride[1], h->mb.bipred_weight[a->l0.me16x16.i_ref][a->l1.me16x16.i_ref] );
/* BI mode */
src[0] = h->mc.get_ref( pix[0], &stride[0], a->l0.me16x8[i].p_fref, a->l0.me16x8[i].i_stride[0],
- a->l0.me16x8[i].mv[0], a->l0.me16x8[i].mv[1], 16, 8, weight_none );
+ a->l0.me16x8[i].mv[0], a->l0.me16x8[i].mv[1], 16, 8, x264_weight_none );
src[1] = h->mc.get_ref( pix[1], &stride[1], a->l1.me16x8[i].p_fref, a->l1.me16x8[i].i_stride[0],
- a->l1.me16x8[i].mv[0], a->l1.me16x8[i].mv[1], 16, 8, weight_none );
+ a->l1.me16x8[i].mv[0], a->l1.me16x8[i].mv[1], 16, 8, x264_weight_none );
h->mc.avg[PIXEL_16x8]( pix[0], 16, src[0], stride[0], src[1], stride[1],
h->mb.bipred_weight[a->l0.me16x8[i].i_ref][a->l1.me16x8[i].i_ref] );
/* BI mode */
src[0] = h->mc.get_ref( pix[0], &stride[0], a->l0.me8x16[i].p_fref, a->l0.me8x16[i].i_stride[0],
- a->l0.me8x16[i].mv[0], a->l0.me8x16[i].mv[1], 8, 16, weight_none );
+ a->l0.me8x16[i].mv[0], a->l0.me8x16[i].mv[1], 8, 16, x264_weight_none );
src[1] = h->mc.get_ref( pix[1], &stride[1], a->l1.me8x16[i].p_fref, a->l1.me8x16[i].i_stride[0],
- a->l1.me8x16[i].mv[0], a->l1.me8x16[i].mv[1], 8, 16, weight_none );
+ a->l1.me8x16[i].mv[0], a->l1.me8x16[i].mv[1], 8, 16, x264_weight_none );
h->mc.avg[PIXEL_8x16]( pix[0], 8, src[0], stride[0], src[1], stride[1], h->mb.bipred_weight[a->l0.me8x16[i].i_ref][a->l1.me8x16[i].i_ref] );
i_part_cost_bi = h->pixf.mbcmp[PIXEL_8x16]( a->l0.me8x16[i].p_fenc[0], FENC_STRIDE, pix[0], 8 )
/* Duplication is a hack to compensate for crappy rounding in motion compensation.
* With high bit depth, it's not worth doing, so turn it off except in the case of
* unweighted dupes. */
- if( BIT_DEPTH > 8 && w != weight_none )
+ if( BIT_DEPTH > 8 && w != x264_weight_none )
return -1;
newframe = x264_frame_pop_blank_unused( h );
{
SET_WEIGHT( h->fenc->weight[0][0], 1, 1, 0, h->fenc->weight[0][0].i_offset );
}
- x264_weighted_reference_duplicate( h, 0, weight_none );
+ x264_weighted_reference_duplicate( h, 0, x264_weight_none );
if( h->fenc->weight[0][0].i_offset > -128 )
{
w[0] = h->fenc->weight[0][0];
int mvy = bm##list##y+dy;\
stride[0][list][i] = bw;\
src[0][list][i] = h->mc.get_ref( pixy_buf[list][i], &stride[0][list][i], &m->p_fref[0],\
- m->i_stride[0], mvx, mvy, bw, bh, weight_none );\
+ m->i_stride[0], mvx, mvy, bw, bh, x264_weight_none );\
if( rd )\
{\
if( CHROMA444 )\
{\
stride[1][list][i] = bw;\
src[1][list][i] = h->mc.get_ref( pixu_buf[list][i], &stride[1][list][i], &m->p_fref[4],\
- m->i_stride[1], mvx, mvy, bw, bh, weight_none );\
+ m->i_stride[1], mvx, mvy, bw, bh, x264_weight_none );\
stride[2][list][i] = bw;\
src[2][list][i] = h->mc.get_ref( pixv_buf[list][i], &stride[2][list][i], &m->p_fref[8],\
- m->i_stride[2], mvx, mvy, bw, bh, weight_none );\
+ m->i_stride[2], mvx, mvy, bw, bh, x264_weight_none );\
}\
else\
h->mc.mc_chroma( pixu_buf[list][i], pixv_buf[list][i], 8, m->p_fref[4], m->i_stride[1],\
int mvx = fenc->lowres_mvs[0][ref0_distance][i_mb_xy][0];
int mvy = fenc->lowres_mvs[0][ref0_distance][i_mb_xy][1];
h->mc.mc_luma( p+x, i_stride, ref->lowres, i_stride,
- mvx+(x<<2), mvy+(y<<2), 8, 8, weight_none );
+ mvx+(x<<2), mvy+(y<<2), 8, 8, x264_weight_none );
}
x264_emms();
return dest;
m[1].i_stride[0] = i_stride;
m[1].p_fenc[0] = h->mb.pic.p_fenc[0];
m[1].i_ref = 0;
- m[1].weight = weight_none;
+ m[1].weight = x264_weight_none;
LOAD_HPELS_LUMA( m[1].p_fref, fref1->lowres );
m[1].p_fref_w = m[1].p_fref[0];
{
int i_score = 0;
int do_search[2];
- const x264_weight_t *w = weight_none;
+ const x264_weight_t *w = x264_weight_none;
/* Check whether we already evaluated this frame
* If we have tried this frame as P, then we have also tried
* the preceding frames as B. (is this still true?) */
return -1;
h->cur_frame = -1;
- if( input.picture_alloc( &h->pic, info->csp, info->width, info->height ) )
+ if( cli_input.picture_alloc( &h->pic, info->csp, info->width, info->height ) )
return -1;
h->hin = *handle;
{
source_hnd_t *h = handle;
/* do not allow requesting of frames from before the current position */
- if( frame <= h->cur_frame || input.read_frame( &h->pic, h->hin, frame ) )
+ if( frame <= h->cur_frame || cli_input.read_frame( &h->pic, h->hin, frame ) )
return -1;
h->cur_frame = frame;
*output = h->pic;
static int release_frame( hnd_t handle, cli_pic_t *pic, int frame )
{
source_hnd_t *h = handle;
- if( input.release_frame && input.release_frame( &h->pic, h->hin ) )
+ if( cli_input.release_frame && cli_input.release_frame( &h->pic, h->hin ) )
return -1;
return 0;
}
static void free_filter( hnd_t handle )
{
source_hnd_t *h = handle;
- input.picture_clean( &h->pic );
- input.close_file( h->hin );
+ cli_input.picture_clean( &h->pic );
+ cli_input.close_file( h->hin );
free( h );
}
extern const cli_input_t ffms_input;
extern cli_input_t timecode_input;
-extern cli_input_t input;
+extern cli_input_t cli_input;
/* extended colorspace list that isn't supported by libx264 but by the cli */
#define X264_CSP_I422 X264_CSP_MAX /* yuv 4:2:2 planar */
static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, cli_input_opt_t *opt )
{
thread_hnd_t *h = malloc( sizeof(thread_hnd_t) );
- FAIL_IF_ERR( !h || input.picture_alloc( &h->pic, info->csp, info->width, info->height ),
+ FAIL_IF_ERR( !h || cli_input.picture_alloc( &h->pic, info->csp, info->width, info->height ),
"x264", "malloc failed\n" )
- h->input = input;
+ h->input = cli_input;
h->p_handle = *p_handle;
h->next_frame = -1;
h->next_args = malloc( sizeof(thread_input_arg_t) );
FILE *tcfile_in;
timecode_hnd_t *h = malloc( sizeof(timecode_hnd_t) );
FAIL_IF_ERROR( !h, "malloc failed\n" )
- h->input = input;
+ h->input = cli_input;
h->p_handle = *p_handle;
if( opt->timebase )
{
static int write_header( flv_buffer *c )
{
- x264_put_tag( c, "FLV" ); // Signature
- x264_put_byte( c, 1 ); // Version
- x264_put_byte( c, 1 ); // Video Only
- x264_put_be32( c, 9 ); // DataOffset
- x264_put_be32( c, 0 ); // PreviousTagSize0
+ flv_put_tag( c, "FLV" ); // Signature
+ flv_put_byte( c, 1 ); // Version
+ flv_put_byte( c, 1 ); // Video Only
+ flv_put_be32( c, 9 ); // DataOffset
+ flv_put_be32( c, 0 ); // PreviousTagSize0
return flv_flush_data( c );
}
flv_hnd_t *p_flv = handle;
flv_buffer *c = p_flv->c;
- x264_put_byte( c, FLV_TAG_TYPE_META ); // Tag Type "script data"
+ flv_put_byte( c, FLV_TAG_TYPE_META ); // Tag Type "script data"
int start = c->d_cur;
- x264_put_be24( c, 0 ); // data length
- x264_put_be24( c, 0 ); // timestamp
- x264_put_be32( c, 0 ); // reserved
+ flv_put_be24( c, 0 ); // data length
+ flv_put_be24( c, 0 ); // timestamp
+ flv_put_be32( c, 0 ); // reserved
- x264_put_byte( c, AMF_DATA_TYPE_STRING );
- x264_put_amf_string( c, "onMetaData" );
+ flv_put_byte( c, AMF_DATA_TYPE_STRING );
+ flv_put_amf_string( c, "onMetaData" );
- x264_put_byte( c, AMF_DATA_TYPE_MIXEDARRAY );
- x264_put_be32( c, 7 );
+ flv_put_byte( c, AMF_DATA_TYPE_MIXEDARRAY );
+ flv_put_be32( c, 7 );
- x264_put_amf_string( c, "width" );
- x264_put_amf_double( c, p_param->i_width );
+ flv_put_amf_string( c, "width" );
+ flv_put_amf_double( c, p_param->i_width );
- x264_put_amf_string( c, "height" );
- x264_put_amf_double( c, p_param->i_height );
+ flv_put_amf_string( c, "height" );
+ flv_put_amf_double( c, p_param->i_height );
- x264_put_amf_string( c, "framerate" );
+ flv_put_amf_string( c, "framerate" );
if( !p_param->b_vfr_input )
- x264_put_amf_double( c, (double)p_param->i_fps_num / p_param->i_fps_den );
+ flv_put_amf_double( c, (double)p_param->i_fps_num / p_param->i_fps_den );
else
{
p_flv->i_framerate_pos = c->d_cur + c->d_total + 1;
- x264_put_amf_double( c, 0 ); // written at end of encoding
+ flv_put_amf_double( c, 0 ); // written at end of encoding
}
- x264_put_amf_string( c, "videocodecid" );
- x264_put_amf_double( c, FLV_CODECID_H264 );
+ flv_put_amf_string( c, "videocodecid" );
+ flv_put_amf_double( c, FLV_CODECID_H264 );
- x264_put_amf_string( c, "duration" );
+ flv_put_amf_string( c, "duration" );
p_flv->i_duration_pos = c->d_cur + c->d_total + 1;
- x264_put_amf_double( c, 0 ); // written at end of encoding
+ flv_put_amf_double( c, 0 ); // written at end of encoding
- x264_put_amf_string( c, "filesize" );
+ flv_put_amf_string( c, "filesize" );
p_flv->i_filesize_pos = c->d_cur + c->d_total + 1;
- x264_put_amf_double( c, 0 ); // written at end of encoding
+ flv_put_amf_double( c, 0 ); // written at end of encoding
- x264_put_amf_string( c, "videodatarate" );
+ flv_put_amf_string( c, "videodatarate" );
p_flv->i_bitrate_pos = c->d_cur + c->d_total + 1;
- x264_put_amf_double( c, 0 ); // written at end of encoding
+ flv_put_amf_double( c, 0 ); // written at end of encoding
- x264_put_amf_string( c, "" );
- x264_put_byte( c, AMF_END_OF_OBJECT );
+ flv_put_amf_string( c, "" );
+ flv_put_byte( c, AMF_END_OF_OBJECT );
unsigned length = c->d_cur - start;
- rewrite_amf_be24( c, length - 10, start );
+ flv_rewrite_amf_be24( c, length - 10, start );
- x264_put_be32( c, length + 1 ); // tag length
+ flv_put_be32( c, length + 1 ); // tag length
p_flv->i_fps_num = p_param->i_fps_num;
p_flv->i_fps_den = p_param->i_fps_den;
// SPS
uint8_t *sps = p_nal[0].p_payload + 4;
- x264_put_byte( c, FLV_TAG_TYPE_VIDEO );
- x264_put_be24( c, 0 ); // rewrite later
- x264_put_be24( c, 0 ); // timestamp
- x264_put_byte( c, 0 ); // timestamp extended
- x264_put_be24( c, 0 ); // StreamID - Always 0
+ flv_put_byte( c, FLV_TAG_TYPE_VIDEO );
+ flv_put_be24( c, 0 ); // rewrite later
+ flv_put_be24( c, 0 ); // timestamp
+ flv_put_byte( c, 0 ); // timestamp extended
+ flv_put_be24( c, 0 ); // StreamID - Always 0
p_flv->start = c->d_cur; // needed for overwriting length
- x264_put_byte( c, 7 | FLV_FRAME_KEY ); // Frametype and CodecID
- x264_put_byte( c, 0 ); // AVC sequence header
- x264_put_be24( c, 0 ); // composition time
+ flv_put_byte( c, 7 | FLV_FRAME_KEY ); // Frametype and CodecID
+ flv_put_byte( c, 0 ); // AVC sequence header
+ flv_put_be24( c, 0 ); // composition time
- x264_put_byte( c, 1 ); // version
- x264_put_byte( c, sps[1] ); // profile
- x264_put_byte( c, sps[2] ); // profile
- x264_put_byte( c, sps[3] ); // level
- x264_put_byte( c, 0xff ); // 6 bits reserved (111111) + 2 bits nal size length - 1 (11)
- x264_put_byte( c, 0xe1 ); // 3 bits reserved (111) + 5 bits number of sps (00001)
+ flv_put_byte( c, 1 ); // version
+ flv_put_byte( c, sps[1] ); // profile
+ flv_put_byte( c, sps[2] ); // profile
+ flv_put_byte( c, sps[3] ); // level
+ flv_put_byte( c, 0xff ); // 6 bits reserved (111111) + 2 bits nal size length - 1 (11)
+ flv_put_byte( c, 0xe1 ); // 3 bits reserved (111) + 5 bits number of sps (00001)
- x264_put_be16( c, sps_size - 4 );
+ flv_put_be16( c, sps_size - 4 );
flv_append_data( c, sps, sps_size - 4 );
// PPS
- x264_put_byte( c, 1 ); // number of pps
- x264_put_be16( c, pps_size - 4 );
+ flv_put_byte( c, 1 ); // number of pps
+ flv_put_be16( c, pps_size - 4 );
flv_append_data( c, p_nal[1].p_payload + 4, pps_size - 4 );
// rewrite data length info
unsigned length = c->d_cur - p_flv->start;
- rewrite_amf_be24( c, length, p_flv->start - 10 );
- x264_put_be32( c, length + 11 ); // Last tag size
+ flv_rewrite_amf_be24( c, length, p_flv->start - 10 );
+ flv_put_be32( c, length + 11 ); // Last tag size
CHECK( flv_flush_data( c ) );
return sei_size + sps_size + pps_size;
p_flv->i_prev_cts = cts;
// A new frame - write packet header
- x264_put_byte( c, FLV_TAG_TYPE_VIDEO );
- x264_put_be24( c, 0 ); // calculated later
- x264_put_be24( c, dts );
- x264_put_byte( c, dts >> 24 );
- x264_put_be24( c, 0 );
+ flv_put_byte( c, FLV_TAG_TYPE_VIDEO );
+ flv_put_be24( c, 0 ); // calculated later
+ flv_put_be24( c, dts );
+ flv_put_byte( c, dts >> 24 );
+ flv_put_be24( c, 0 );
p_flv->start = c->d_cur;
- x264_put_byte( c, p_picture->b_keyframe ? FLV_FRAME_KEY : FLV_FRAME_INTER );
- x264_put_byte( c, 1 ); // AVC NALU
- x264_put_be24( c, offset );
+ flv_put_byte( c, p_picture->b_keyframe ? FLV_FRAME_KEY : FLV_FRAME_INTER );
+ flv_put_byte( c, 1 ); // AVC NALU
+ flv_put_be24( c, offset );
if( p_flv->sei )
{
flv_append_data( c, p_nalu, i_size );
unsigned length = c->d_cur - p_flv->start;
- rewrite_amf_be24( c, length, p_flv->start - 10 );
- x264_put_be32( c, 11 + length ); // Last tag size
+ flv_rewrite_amf_be24( c, length, p_flv->start - 10 );
+ flv_put_be32( c, 11 + length ); // Last tag size
CHECK( flv_flush_data( c ) );
p_flv->i_framenum++;
static void rewrite_amf_double( FILE *fp, uint64_t position, double value )
{
- uint64_t x = endian_fix64( dbl2int( value ) );
+ uint64_t x = endian_fix64( flv_dbl2int( value ) );
fseek( fp, position, SEEK_SET );
fwrite( &x, 8, 1, fp );
}
#include "output.h"
#include "flv_bytestream.h"
-uint64_t dbl2int( double value )
+uint64_t flv_dbl2int( double value )
{
return (union {double f; uint64_t i;}){value}.i;
}
/* Put functions */
-void x264_put_byte( flv_buffer *c, uint8_t b )
+void flv_put_byte( flv_buffer *c, uint8_t b )
{
flv_append_data( c, &b, 1 );
}
-void x264_put_be32( flv_buffer *c, uint32_t val )
+void flv_put_be32( flv_buffer *c, uint32_t val )
{
- x264_put_byte( c, val >> 24 );
- x264_put_byte( c, val >> 16 );
- x264_put_byte( c, val >> 8 );
- x264_put_byte( c, val );
+ flv_put_byte( c, val >> 24 );
+ flv_put_byte( c, val >> 16 );
+ flv_put_byte( c, val >> 8 );
+ flv_put_byte( c, val );
}
-void x264_put_be64( flv_buffer *c, uint64_t val )
+void flv_put_be64( flv_buffer *c, uint64_t val )
{
- x264_put_be32( c, val >> 32 );
- x264_put_be32( c, val );
+ flv_put_be32( c, val >> 32 );
+ flv_put_be32( c, val );
}
-void x264_put_be16( flv_buffer *c, uint16_t val )
+void flv_put_be16( flv_buffer *c, uint16_t val )
{
- x264_put_byte( c, val >> 8 );
- x264_put_byte( c, val );
+ flv_put_byte( c, val >> 8 );
+ flv_put_byte( c, val );
}
-void x264_put_be24( flv_buffer *c, uint32_t val )
+void flv_put_be24( flv_buffer *c, uint32_t val )
{
- x264_put_be16( c, val >> 8 );
- x264_put_byte( c, val );
+ flv_put_be16( c, val >> 8 );
+ flv_put_byte( c, val );
}
-void x264_put_tag( flv_buffer *c, const char *tag )
+void flv_put_tag( flv_buffer *c, const char *tag )
{
while( *tag )
- x264_put_byte( c, *tag++ );
+ flv_put_byte( c, *tag++ );
}
-void x264_put_amf_string( flv_buffer *c, const char *str )
+void flv_put_amf_string( flv_buffer *c, const char *str )
{
uint16_t len = strlen( str );
- x264_put_be16( c, len );
+ flv_put_be16( c, len );
flv_append_data( c, (uint8_t*)str, len );
}
-void x264_put_amf_double( flv_buffer *c, double d )
+void flv_put_amf_double( flv_buffer *c, double d )
{
- x264_put_byte( c, AMF_DATA_TYPE_NUMBER );
- x264_put_be64( c, dbl2int( d ) );
+ flv_put_byte( c, AMF_DATA_TYPE_NUMBER );
+ flv_put_be64( c, flv_dbl2int( d ) );
}
/* flv writing functions */
return 0;
}
-void rewrite_amf_be24( flv_buffer *c, unsigned length, unsigned start )
+void flv_rewrite_amf_be24( flv_buffer *c, unsigned length, unsigned start )
{
*(c->data + start + 0) = length >> 16;
*(c->data + start + 1) = length >> 8;
int flv_append_data( flv_buffer *c, uint8_t *data, unsigned size );
int flv_write_byte( flv_buffer *c, uint8_t *byte );
int flv_flush_data( flv_buffer *c );
-void rewrite_amf_be24( flv_buffer *c, unsigned length, unsigned start );
-
-uint64_t dbl2int( double value );
-uint64_t get_amf_double( double value );
-void x264_put_byte( flv_buffer *c, uint8_t b );
-void x264_put_be32( flv_buffer *c, uint32_t val );
-void x264_put_be64( flv_buffer *c, uint64_t val );
-void x264_put_be16( flv_buffer *c, uint16_t val );
-void x264_put_be24( flv_buffer *c, uint32_t val );
-void x264_put_tag( flv_buffer *c, const char *tag );
-void x264_put_amf_string( flv_buffer *c, const char *str );
-void x264_put_amf_double( flv_buffer *c, double d );
+void flv_rewrite_amf_be24( flv_buffer *c, unsigned length, unsigned start );
+
+uint64_t flv_dbl2int( double value );
+void flv_put_byte( flv_buffer *c, uint8_t b );
+void flv_put_be32( flv_buffer *c, uint32_t val );
+void flv_put_be64( flv_buffer *c, uint64_t val );
+void flv_put_be16( flv_buffer *c, uint16_t val );
+void flv_put_be24( flv_buffer *c, uint32_t val );
+void flv_put_tag( flv_buffer *c, const char *tag );
+void flv_put_amf_string( flv_buffer *c, const char *str );
+void flv_put_amf_double( flv_buffer *c, double d );
#endif
#define MC_TEST_LUMA( w, h ) \
if( mc_a.mc_luma != mc_ref.mc_luma && !(w&(w-1)) && h<=16 ) \
{ \
- const x264_weight_t *weight = weight_none; \
+ const x264_weight_t *weight = x264_weight_none; \
set_func_name( "mc_luma_%dx%d", w, h ); \
used_asm = 1; \
for( int i = 0; i < 1024; i++ ) \
pixel *ref = dst2; \
int ref_stride = 32; \
int w_checked = ( ( sizeof(pixel) == 2 && (w == 12 || w == 20)) ? w-2 : w ); \
- const x264_weight_t *weight = weight_none; \
+ const x264_weight_t *weight = x264_weight_none; \
set_func_name( "get_ref_%dx%d", w_checked, h ); \
used_asm = 1; \
for( int i = 0; i < 1024; i++ ) \
} cli_opt_t;
/* file i/o operation structs */
-cli_input_t input;
-static cli_output_t output;
+cli_input_t cli_input;
+static cli_output_t cli_output;
/* video filter operation struct */
static cli_vid_filter_t filter;
if( filter.free )
filter.free( opt.hin );
else if( opt.hin )
- input.close_file( opt.hin );
+ cli_input.close_file( opt.hin );
if( opt.hout )
- output.close_file( opt.hout, 0, 0 );
+ cli_output.close_file( opt.hout, 0, 0 );
if( opt.tcfile_out )
fclose( opt.tcfile_out );
if( opt.qpfile )
H0( "\n" );
}
-enum
+typedef enum
{
OPT_FRAMES = 256,
OPT_SEEK,
if( !strcasecmp( ext, "mp4" ) )
{
#if HAVE_GPAC
- output = mp4_output;
+ cli_output = mp4_output;
param->b_annexb = 0;
param->b_repeat_headers = 0;
if( param->i_nal_hrd == X264_NAL_HRD_CBR )
}
else if( !strcasecmp( ext, "mkv" ) )
{
- output = mkv_output;
+ cli_output = mkv_output;
param->b_annexb = 0;
param->b_repeat_headers = 0;
}
else if( !strcasecmp( ext, "flv" ) )
{
- output = flv_output;
+ cli_output = flv_output;
param->b_annexb = 0;
param->b_repeat_headers = 0;
}
else
- output = raw_output;
+ cli_output = raw_output;
return 0;
}
if( !strcasecmp( module, "avs" ) || !strcasecmp( ext, "d2v" ) || !strcasecmp( ext, "dga" ) )
{
#if HAVE_AVS
- input = avs_input;
+ cli_input = avs_input;
module = "avs";
#else
x264_cli_log( "x264", X264_LOG_ERROR, "not compiled with AVS input support\n" );
#endif
}
else if( !strcasecmp( module, "y4m" ) )
- input = y4m_input;
+ cli_input = y4m_input;
else if( !strcasecmp( module, "raw" ) || !strcasecmp( ext, "yuv" ) )
- input = raw_input;
+ cli_input = raw_input;
else
{
#if HAVE_FFMS
{
module = "ffms";
b_auto = 0;
- input = ffms_input;
+ cli_input = ffms_input;
}
#endif
#if HAVE_LAVF
{
module = "lavf";
b_auto = 0;
- input = lavf_input;
+ cli_input = lavf_input;
}
#endif
#if HAVE_AVS
{
module = "avs";
b_auto = 0;
- input = avs_input;
+ cli_input = avs_input;
}
#endif
if( b_auto && !raw_input.open_file( filename, p_handle, info, opt ) )
{
module = "raw";
b_auto = 0;
- input = raw_input;
+ cli_input = raw_input;
}
FAIL_IF_ERROR( !(*p_handle), "could not open input file `%s' via any method!\n", filename )
if( select_output( muxer, output_filename, param ) )
return -1;
- FAIL_IF_ERROR( output.open_file( output_filename, &opt->hout, &output_opt ), "could not open output file `%s'\n", output_filename )
+ FAIL_IF_ERROR( cli_output.open_file( output_filename, &opt->hout, &output_opt ), "could not open output file `%s'\n", output_filename )
input_filename = argv[optind++];
video_info_t info = {0};
if( select_input( demuxer, demuxername, input_filename, &opt->hin, &info, &input_opt ) )
return -1;
- FAIL_IF_ERROR( !opt->hin && input.open_file( input_filename, &opt->hin, &info, &input_opt ),
+ FAIL_IF_ERROR( !opt->hin && cli_input.open_file( input_filename, &opt->hin, &info, &input_opt ),
"could not open input file `%s'\n", input_filename )
x264_reduce_fraction( &info.sar_width, &info.sar_height );
{
FAIL_IF_ERROR( b_user_fps, "--fps + --tcfile-in is incompatible.\n" )
FAIL_IF_ERROR( timecode_input.open_file( tcfile_name, &opt->hin, &info, &input_opt ), "timecode input failed\n" )
- input = timecode_input;
+ cli_input = timecode_input;
}
else FAIL_IF_ERROR( !info.vfr && input_opt.timebase, "--timebase is incompatible with cfr input\n" )
fprintf( stderr, "x264 [error]: threaded input failed\n" );
return -1;
}
- input = thread_input;
+ cli_input = thread_input;
}
#endif
if( i_frame_size )
{
- i_frame_size = output.write_frame( hout, nal[0].p_payload, i_frame_size, &pic_out );
+ i_frame_size = cli_output.write_frame( hout, nal[0].p_payload, i_frame_size, &pic_out );
*last_dts = pic_out.i_dts;
}
x264_encoder_parameters( h, param );
- FAIL_IF_ERROR2( output.set_param( opt->hout, param ), "can't set outfile param\n" );
+ FAIL_IF_ERROR2( cli_output.set_param( opt->hout, param ), "can't set outfile param\n" );
i_start = x264_mdate();
int i_nal;
FAIL_IF_ERROR2( x264_encoder_headers( h, &headers, &i_nal ) < 0, "x264_encoder_headers failed\n" )
- FAIL_IF_ERROR2( (i_file = output.write_headers( opt->hout, headers )) < 0, "error writing headers to output file\n" );
+ FAIL_IF_ERROR2( (i_file = cli_output.write_headers( opt->hout, headers )) < 0, "error writing headers to output file\n" );
}
if( opt->tcfile_out )
if( b_ctrl_c )
fprintf( stderr, "aborted at input frame %d, output frame %d\n", opt->i_seek + i_frame, i_frame_output );
- output.close_file( opt->hout, largest_pts, second_largest_pts );
+ cli_output.close_file( opt->hout, largest_pts, second_largest_pts );
opt->hout = NULL;
if( i_frame_output > 0 )