bino-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bino-list] Multithreading video decoding


From: Alexey Osipov
Subject: [Bino-list] Multithreading video decoding
Date: Sun, 28 Aug 2011 04:10:58 +0700

Hi Martin and other developers!

I've just noticed that current git master of bino makes incorrect setup
of multithreading decoding, which leads to single-threaded decoding in
all cases. This is relevant for recent versions of ffmpeg and libav.

After commit [1] (h264 decoder was affected later in [2]) in ffmpeg and
same commits [3,4] in libav, count of threads for multithreading
decoding (AVCodecContext::thread_count) must be set _before_ call to
avcodec_open().

avcodec_open() calls avcodec_open2(), which calls ff_thread_init(),
which calls frame_thread_init(), which calls
validate_thread_parameters().

validate_thread_parameters() set new AVCodecContext data member named
"active_thread_type" to correct value using values of
AVCodecContext::thread_count and AVCodecContext::thread_type.

If we set AVCodecContext::thread_count _after_ call to avcodec_open(),
then validate_thread_parameters() got AVCodecContext::thread_count = 1
and hence set AVCodecContext::active_thread_type configured for
single-thread decoding.

I attach a dirty patch, which solve this. I think a real fix should be a
little different, because we don't want to set `thread_count =
video_decoding_threads()` for all stream types, but video.

Best regards,
Alexey.

[1] 
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=37b00b47cbeecd66bb34c5c7c534d016d6e8da24
[2] 
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=6a9c85944427e3c4355bce67d7f677ec69527bff
[3] 
http://git.libav.org/?p=libav.git;a=commit;h=37b00b47cbeecd66bb34c5c7c534d016d6e8da24
[4] 
http://git.libav.org/?p=libav.git;a=commit;h=6a9c85944427e3c4355bce67d7f677ec69527bff

Attachment: mtfix.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]