#12 Multithreading support (video playback)

open
nobody
None
5
2006-04-19
2006-04-19
h.yamagata
No

I upload this patch for testing. Please test this.
It might be buggy. Any advice is wellcome.
This patch can be applied to Rev 2507. Go to trunk
directory.

1. About multithreading of ffdshow video playback

The objective of multithreading is to reduce frame
drops. This patch reduce frame drops by decording and
resizing next frame while video renderer is working
on other thread. Resize is processed on multithread
when the video renderer is faster than the decoder.
For example upscaling DVD to HDTV with ffdshow and
VMR9 renderless mode of media player classic give
very good quality. But it requires very high CPU
power and even current powerfull CPU may drop frames
without multithreading. This patch is optimized for
such case.

2. Configuration

There is no configuration to stop multithreading
currently. If your CPU is single core and non hyper-
threading, multithreading is avoided.

3. How to compile

ffdshow.ax and libmplayer.dll(swscaler) is modified.
Because libmplayer.def is modified, you have to
create a installer and reinstall after compilation.

Discussion

1 2 > >> (Page 1 of 2)
  • h.yamagata
    h.yamagata
    2006-04-19

    patch to Rev 2507 for multithreading

     
  • bob0r
    bob0r
    2006-04-21

    Logged In: YES
    user_id=1293290

    gcc -c -I. -I.. -I../imgFilters -Ilibvo -w -ffast-math -
    mno-cygwin -mdll -mthreads -pipe -DNDEBUG -UDEBUG -
    DWIN32 -D_WIN32 -O3 -march=i586 -mtune=i686 -fomit-frame-
    pointer -finline-functions -finline -o postproc/swscale.o
    postproc/swscale.c
    postproc/swscale.c:80:30: error: swscale_multicpu.h: No
    such file or directory
    make[1]: *** [postproc/swscale.o] Error 1
    make[1]: Leaving directory
    `/home/user/ffdshow_gcc_mt/src/mplayer'
    make: *** [../bin/libmplayer.dll] Error 2

    http://google.com/search?q=swscale_multicpu.h
    Your search - swscale_multicpu.h - did not match any
    documents.

     
  • h.yamagata
    h.yamagata
    2006-04-21

    Logged In: YES
    user_id=1460523

    Thank you for your report.

    I'm sorry. A terrible mistake.
    I'll fix it in 8hours.

     
  • h.yamagata
    h.yamagata
    2006-04-21

    To 2523 fixed missing swscale_multicpu.h

     
  • h.yamagata
    h.yamagata
    2006-04-21

    Logged In: YES
    user_id=1460523

    I uploaded fixed version.
    I'm very very sory. I shoud have been more carefull.

     
  • h.yamagata
    h.yamagata
    2006-04-23

    To 2524 update in comments and vcproj

     
  • h.yamagata
    h.yamagata
    2006-04-23

    Logged In: YES
    user_id=1460523

    ffdshow_multithread_060423.patch

    Patch to 2524.
    added comments in TffDecoder.cpp, swscale.c and
    swscale_template.c.
    fixed libmplayer.vcproj and libmplayer_2005.vcproj.

     
  • h.yamagata
    h.yamagata
    2006-05-04

    Logged In: YES
    user_id=1460523

    bug fix: Crash on default setting of Zoom Player, old
    renderer of MPC, etc.

    Certain video renderer cannot run on child thread. It
    includes the default renderer of Windows 2000 or older,
    the default of Zoom Player(Overlay Mixer, Standard
    Renderer), "Old Renderer" of MPC, etc. In this case,
    multithreading around video renderer is avoided and Resize
    is processed on multithread.

    knouwn bug: Seek problem is not fixed yet. Maily on DX50?
    It sometimes crashes after seek.

     
  • h.yamagata
    h.yamagata
    2006-05-04

    To 2539 bug fix old renderer problem

     
  • h.yamagata
    h.yamagata
    2006-05-04

    Logged In: YES
    user_id=1460523

    To 2541

    updated document <Overview of implimentation>
    minor bug fix of the prior bug fix

     
  • h.yamagata
    h.yamagata
    2006-05-07

    Logged In: YES
    user_id=1460523

    I apologize for lacking consideration for ffmpeg
    project/libavcodec.
    Please forget the prior version of document.
    I am really sorry for it.

    To 2546 updated document.

     
  • h.yamagata
    h.yamagata
    2006-05-13

    Logged In: YES
    user_id=1460523

    To 2546 bug fix seek problem

    TffdshowDecVideoInputPin: Input pin for TffdshowDecVideo's
    exclusive use.
    trying to undo changes that I added to baseclasses by
    overriding classes.

     
  • h.yamagata
    h.yamagata
    2006-05-13

    To 2546 bug fix seek problem

     
  • h.yamagata
    h.yamagata
    2006-05-13

    Logged In: YES
    user_id=1460523

    ffdshow_multithread_060513a.patch
    To 2546 bug fix Swscaler

    Multithreading of swscaler
    handles "Resize", "Sharpen/swscaler" and "Blur &
    NR/swscaler gaussian blur". When two of them is checked
    and one try to uncheck one, older versions crashes. This
    patch includes bug fix for it.

     
  • h.yamagata
    h.yamagata
    2006-05-14

    Logged In: YES
    user_id=1460523

    To 2546 bug fix. Old video renderer problem

    Better detection of old renderer.

     
  • h.yamagata
    h.yamagata
    2006-05-14

    To 2546 bug fix. Old video renderer problem.

     
  • h.yamagata
    h.yamagata
    2006-05-17

    Logged In: YES
    user_id=1460523

    ffdshow_multithread_060517.patch
    To 2546 bug fix. _beginthreadex instead of CreateThread.
    Giving up ReceiveOnThread.

     
  • h.yamagata
    h.yamagata
    2006-05-17

    To 2546 bug fix. _beginthreadex

     
  • Logged In: NO

    It uses only one core mainly.
    Can you please get both cores to work evenly ?

     
  • h.yamagata
    h.yamagata
    2006-05-20

    Logged In: YES
    user_id=1460523

    >It uses only one core mainly.

    My patch is not desined to use each CPU evenly.
    As it is witten in the document, It just call downstream
    on thread(as for ffdshow.ax).
    It is effective when one use heavy video renderer such as
    VMR9 renderless/MPC.

    Here, once again "why swscaler/Resize + unsharp mask +
    VMR9 renderless/MPC".
    On my video system(*), hardware resize is as good as
    swscaler/Resize alone.
    I use unsharp mask after swscaler.
    Swsclaer + unsharp mask is slightly better than hardware
    resize. Does anybody agree?
    I can't find unsharp mask in 9600XT.

    To render resized video, VMR9 renderless/MPC is the best
    (as for MPC), though it's heavy.
    So my main target is users those who seek for quality of
    HTPC.

    (*)Radeon 9600XT 1904x960, Cine6(1080i projector)

     
  • Logged In: NO

    Thank you Very Much.

     
  • h.yamagata
    h.yamagata
    2006-06-01

    Logged In: YES
    user_id=1460523

    Output queue

    This patch queue samples just before sent to video
    renderer and execute video renderer on worker thread.
    Compared to rev2546, 10 to 20%(Max 35%) of frame rate
    improvement is expected. Single CPU/multithreading is
    interesting, though it is not tested.

    [Status]
    Alpha testing.
    Prior version should be more stable.

    [Patch]
    ffdshow_multithread_060601.patch is PATCH to PATCH.
    To rev2546+ffdshow_multithread_060517.patch

     
1 2 > >> (Page 1 of 2)