[x264-devel] Updated (and hopefully final) threaded slicetype patch
Leon Woestenberg
leon.woestenberg at gmail.com
Tue Apr 7 19:10:56 CEST 2009
On Tue, Apr 7, 2009 at 6:55 PM, Mike Kazmier <DaKaZ at zenbe.com> wrote:
>> $ ./x264 --crf 26 -b2 -m5 -r2 --me hex -8 -w --cqm jvt --nr 100 --
>> interlaced --threads 3 ../capture-720-480-yv12.y4m -o foo.h264
>
> You don't get a lot of improvement until you move to b-adapt 2 and 3+ b frames. Otherwise, the slicetype decision is not your bottleneck. So these mediocore to same results are expected.
>
I have instrumented the code a bit to quickly see which paths are
taken, see below
I could get it deadlocked, this are the last two prints:
../x264/x264/x264 -v --b-adapt 2 --bframes 4 -B 5000 --threads 2 -o
test.x264 test_1280x720.yuv
...
frame_list_put() was not full
frame_list_put() was not full
frame_list_get() 24, 0: 135788592
frame_list_get() has place, signaling space.
frame_list_put() full, waiting for space.
I think the x264_pthread_cond_broadcast( &slist->cv_empty ) must be
within the mutex lock
void x264_synch_frame_list_put( synch_frame_list_t *slist, x264_frame_t *frame )
{
if ( slist->i_max_size < 1 ) return;
x264_pthread_mutex_lock( &slist->mutex );
//printf("frame_list_put() %d, max-1: %d\n", slist->i_max_size,
slist->list[slist->i_max_size - 1]);
if ( ( slist->i_max_size > 0 ) && (slist->list[slist->i_max_size - 1] ) ) {
printf("frame_list_put() full, waiting for space.\n");
x264_pthread_cond_wait( &slist->cv_empty, &slist->mutex );
}
else
{
printf("frame_list_put() was not full\n");
}
x264_frame_push( slist->list,frame );
slist->i_size++;
x264_pthread_mutex_unlock( &slist->mutex );
}
x264_frame_t * x264_synch_frame_list_get( synch_frame_list_t *slist )
{
x264_frame_t *frame = NULL;
if ( slist->i_max_size < 1 ) return NULL;
x264_pthread_mutex_lock( &slist->mutex );
printf("frame_list_get() %d, 0: %d\n", slist->i_max_size, slist->list[0]);
if ( ( slist->i_max_size > 0 ) && (!slist->list[0]) ) {
printf("frame_list_get() empty, waiting for content.\n");
x264_pthread_cond_wait( &slist->cv_full, &slist->mutex );
}
frame = x264_frame_shift( slist->list );
slist->i_size--;
x264_pthread_mutex_unlock( &slist->mutex );
printf("frame_list_get() has place, signaling space.\n");
x264_pthread_cond_broadcast( &slist->cv_empty );
return frame;
}
Regards,
--
Leon
More information about the x264-devel
mailing list