--- ./encoder/encoder.c 2007-04-20 19:56:58.000000000 -0600 (with x264_thread_pool.00.diff) +++ ./encoder/encoder.c 2007-04-20 19:57:49.000000000 -0600 @@ -61,6 +61,8 @@ #define NALU_OVERHEAD 5 // startcode + NAL type costs 5 bytes per frame +#define dbg_printf(id) fprintf(stderr, "[%p] f=%d t=%"PRId64 id, h, h->fdec->i_frame, x264_mdate()); + static void x264_encoder_frame_end( x264_t *h, x264_t *thread_current, x264_nal_t **pp_nal, int *pi_nal, x264_picture_t *pic_out ); @@ -1225,6 +1227,8 @@ { int i_frame_size; + dbg_printf(" slice_start\n"); + #if VISUALIZE if( h->param.b_visualize ) x264_visualize_init( h ); @@ -1242,6 +1246,8 @@ } #endif + dbg_printf(" slice_stop\n"); + h->out.i_frame_size = i_frame_size; return 0; } @@ -1256,12 +1262,16 @@ if( h->thread_exit ) return 0; + dbg_printf(" slice_start\n"); + x264_stack_align( x264_slice_write, h ); i_frame_size = h->out.nal[h->out.i_nal-1].i_payload; x264_fdec_filter_row( h, h->sps->i_mb_height ); h->out.i_frame_size = i_frame_size; + dbg_printf(" slice_stop\n"); + x264_cond_broadcast( &h->thread_active_cv, &h->thread_active_mutex, &h->thread_active, 0 ); if( h->thread_exit ) return 0; @@ -1328,6 +1338,9 @@ /* 1: Copy the picture to a frame and move it to a buffer */ x264_frame_t *fenc = x264_frame_pop_unused( h ); + h->fdec->i_frame = h->frames.i_input; + dbg_printf(" encode_start\n"); + x264_frame_copy_picture( h, fenc, pic_in ); if( h->param.i_width != 16 * h->sps->i_mb_width || @@ -1350,6 +1363,8 @@ } } + dbg_printf(" prolog_cp\n"); + if( h->frames.current[0] == NULL ) { int bframes = 0; @@ -1379,6 +1394,8 @@ } TIMER_STOP( i_mtime_encode_frame ); + dbg_printf(" prolog_rc\n"); + /* ------------------- Get frame to be encoded ------------------------- */ /* 4: get picture to encode */ h->fenc = x264_frame_shift( h->frames.current ); @@ -1511,6 +1528,8 @@ x264_nal_end( h ); } + dbg_printf(" thread_create\n"); + /* Write frame */ if( h->param.i_threads > 1 ) x264_cond_broadcast( &h->thread_active_cv, &h->thread_active_mutex, &h->thread_active, 1 ); @@ -1629,8 +1648,10 @@ int i; char psz_message[80]; + if( h->out.i_nal || h->thread_active ) dbg_printf(" join?\n"); if( h->param.i_threads > 1 ) x264_cond_wait( &h->thread_active_cv, &h->thread_active_mutex, &h->thread_active, 0, 0 ); + if( h->out.i_nal ) dbg_printf(" join.\n"); if( !h->out.i_nal ) { @@ -1787,6 +1808,8 @@ /* Dump reconstructed frame */ x264_frame_dump( h, h->fdec, "fdec.yuv" ); #endif + + dbg_printf(" encode_stop\n"); } /****************************************************************************