1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-22 06:42:03 +00:00
mpv/video/out
Stefano Pigozzi a9cb2dc1b8 video: add vda decode support (with hwaccel) and direct rendering
Decoding H264 using Video Decode Acceleration used the custom 'vda_h264_dec'
decoder in FFmpeg.

The Good: This new implementation has some advantages over the previous one:

 - It works with Libav: vda_h264_dec never got into Libav since they prefer
   client applications to use the hwaccel API.

 - It is way more efficient: in my tests this implementation yields a
   reduction of CPU usage of roughly ~50% compared to using `vda_h264_dec` and
   ~65-75% compared to h264 software decoding. This is mainly because
   `vo_corevideo` was adapted to perform direct rendering of the
   `CVPixelBufferRefs` created by the Video Decode Acceleration API Framework.

The Bad:
  - `vo_corevideo` is required to use VDA decoding acceleration.
  - only works with versions of ffmpeg/libav new enough (needs reference
    refcounting). That is FFmpeg 2.0+ and Libav's git master currently.

The Ugly: VDA was hardcoded to use UYVY (2vuy) for the uploaded video texture.
One one end this makes the code simple since Apple's OpenGL implementation
actually supports this out of the box. It would be nice to support other
output image formats and choose the best format depending on the input, or at
least making it configurable. My tests indicate that CPU usage actually
increases with a 420p IMGFMT output which is not what I would have expected.

NOTE: There is a small memory leak with old versions of FFmpeg and with Libav
since the CVPixelBufferRef is not automatically released when the AVFrame is
deallocated. This can cause leaks inside libavcodec for decoded frames that
are discarded before mpv wraps them inside a refcounted mp_image (this only
happens on seeks).
For frames that enter mpv's refcounting facilities, this is not a problem
since we rewrap the CVPixelBufferRef in our mp_image that properly forwards
CVPixelBufferRetain/CvPixelBufferRelease calls to the underying
CVPixelBufferRef.

So, for FFmpeg use something more recent than `b3d63995` for Libav the patch
was posted to the dev ML in July and in review since, apparently, the proposed
fix is rather hacky.
2013-08-22 12:13:30 +02:00
..
aspect.c options: remove --panscanrange option 2013-08-19 12:55:53 +02:00
aspect.h
bitmap_packer.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
bitmap_packer.h
cocoa_common.h cocoa_common: remove play/pause VOCTRL functions 2013-06-14 07:34:47 +02:00
cocoa_common.m cocoa_common: fix window positioning with --geometry 2013-08-22 11:54:28 +02:00
d3d_shader_yuv.h
d3d_shader_yuv.hlsl
dither.c dither: don't use long double 2013-07-05 20:26:32 +02:00
dither.h gl_video: improve dithering 2013-05-26 16:44:20 +02:00
filter_kernels.c
filter_kernels.h
gl_cocoa.c video/out: introduce vo_control for gl_common based VOs 2013-05-26 16:44:18 +02:00
gl_common.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
gl_common.h core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
gl_header_fixes.h
gl_lcms.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
gl_lcms.h
gl_osd.c
gl_osd.h
gl_video_shaders.glsl gl_video: add support for more rgb formats 2013-07-18 13:52:38 +02:00
gl_video.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
gl_video.h video/out: use new mp_msg stuff for vo.c and vo_opengl 2013-07-31 21:46:40 +02:00
gl_w32.c video/out: introduce vo_control for gl_common based VOs 2013-05-26 16:44:18 +02:00
gl_wayland.c wayland: switch to the new mp_msg api 2013-07-31 21:52:16 +02:00
gl_x11.c video/out: introduce vo_control for gl_common based VOs 2013-05-26 16:44:18 +02:00
pnm_loader.c
pnm_loader.h
vo_caca.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo_corevideo.c video: add vda decode support (with hwaccel) and direct rendering 2013-08-22 12:13:30 +02:00
vo_direct3d.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo_image.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo_lavc.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo_null.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo_opengl_old.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo_opengl.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo_sdl.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo_vaapi.c Revert "sub: support straight alpha additionally to premultiplied alpha" 2013-08-12 02:49:22 +02:00
vo_vdpau.c vo_vdpau: add RGB support 2013-08-18 05:46:02 +02:00
vo_x11.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo_xv.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
vo.c video: make it possible to scale/pan the video by arbitrary amounts 2013-08-19 13:03:08 +02:00
vo.h video: add vaapi decode and output support 2013-08-12 01:12:02 +02:00
w32_common.c core: move contents to mpvcore (2/2) 2013-08-06 22:52:31 +02:00
w32_common.h w32_common: Don't use globals for TRACKMOUSEEVENT 2013-07-25 14:47:49 -03:00
wayland_common.c wayland: separate shm and cursor context 2013-08-19 14:12:39 +02:00
wayland_common.h wayland: separate shm and cursor context 2013-08-19 14:12:39 +02:00
x11_common.c x11: fix --ontop 2013-08-14 00:36:33 +02:00
x11_common.h video: remove fullscreen flags chaos 2013-07-18 14:07:21 +02:00