0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00
mpv/test
wm4 c1a961ad78 draw_bmp: rewrite
draw_bmp.c is the software blender for subtitles and OSD. It's used by
encoding mode (burning subtitles), and some VOs, like vo_drm, vo_x11,
vo_xv, and possibly more.

This changes the algorithm from upsampling the video to 4:4:4 and then
blending to downsampling the OSD and then blending directly to video.
This has far-reaching consequences for its internals, and results in an
effective rewrite.

Since I wanted to avoid un-premultiplying, all blending is done with
premultiplied alpha. That's actually the sane thing to do. The old code
just didn't do it, because it's very weird in YUV fixed point.
Essentially, you'd have to compensate for the chroma centering constant
by subtracting src_alpha/255*128. This seemed so hairy (especially with
correct rounding and high bit depths involved) that I went for using
float.

I think it turned out mostly OK, although it's more complex and less
maintainable than before. reinit() is certainly a bit too long. While it
should be possible to optimize the RGB path more (for example by
blending directly instead of doing the stupid float conversion), this is
probably slower. vo_xv users probably lose in this, because it takes the
slowest path (due to subsampling requirements and using YUV).

Why this rewrite? Nobody knows. I simply forgot the reason. But you'll
have it anyway. Whether or not this would have required a full rewrite,
at least it supports target alpha now (you can for example hard sub
transparent PNGs, if you ever wanted to use mpv for this).

Remove the check in vf_sub. The new draw_bmp.c is not as reliant on
libswscale anymore (mostly uses repack.c now), and osd.c shows an
error message on missing support instead now.

Formats with chroma subsampling of 4 are not supported, because FFmpeg
doesn't provide pixfmt definitions for alpha variants. We could provide
those ourselves (relatively trivial), but why bother.
2020-05-09 18:02:57 +02:00
..
ref draw_bmp: rewrite 2020-05-09 18:02:57 +02:00
chmap.c test: merge test_helpers.c and index.c 2019-11-08 20:34:07 +01:00
gl_video.c test: merge test_helpers.c and index.c 2019-11-08 20:34:07 +01:00
img_format.c video: change chroma_w/chroma_h fields to use shift instead of size 2020-04-23 13:24:35 +02:00
input-gamepad.conf input: add gamepad support through SDL2 2019-10-23 09:40:30 +02:00
json.c test: merge test_helpers.c and index.c 2019-11-08 20:34:07 +01:00
linked_list.c test: merge test_helpers.c and index.c 2019-11-08 20:34:07 +01:00
paths.c path: add mp_path_is_absolute() 2020-02-06 14:14:35 +01:00
repack.c draw_bmp: rewrite 2020-05-09 18:02:57 +02:00
scale_sws.c test: add tests for zimg RGB repacking 2019-11-09 01:55:13 +01:00
scale_test.c video: change chroma_w/chroma_h fields to use shift instead of size 2020-04-23 13:24:35 +02:00
scale_test.h test: add tests for zimg RGB repacking 2019-11-09 01:55:13 +01:00
scale_zimg.c test: fix some idiotic UB 2020-05-06 15:27:25 +02:00
subtimes.js command: add sub-start & sub-end properties 2019-09-22 09:19:45 +02:00
tests.c video: separate repacking code from zimg and make it independent 2020-05-09 18:02:57 +02:00
tests.h video: separate repacking code from zimg and make it independent 2020-05-09 18:02:57 +02:00