diff options
author | Bin Jin <bjin1990@gmail.com> | 2015-10-28 01:37:55 +0000 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-11-05 17:38:20 +0100 |
commit | 27dc834f37cd2427798c8cb582a574409865d1e7 (patch) | |
tree | fcc4fdfb0a4c8b20958ee110d5d8068439779848 /DOCS | |
parent | 3f73d6352306d470821f3ea5078b7b7f8031f0d7 (diff) |
vo_opengl: implement NNEDI3 prescaler
Implement NNEDI3, a neural network based deinterlacer.
The shader is reimplemented in GLSL and supports both 8x4 and 8x6
sampling window now. This allows the shader to be licensed
under LGPL2.1 so that it can be used in mpv.
The current implementation supports uploading the NN weights (up to
51kb with placebo setting) in two different way, via uniform buffer
object or hard coding into shader source. UBO requires OpenGL 3.1,
which only guarantee 16kb per block. But I find that 64kb seems to be
a default setting for recent card/driver (which nnedi3 is targeting),
so I think we're fine here (with default nnedi3 setting the size of
weights is 9kb). Hard-coding into shader requires OpenGL 3.3, for the
"intBitsToFloat()" built-in function. This is necessary to precisely
represent these weights in GLSL. I tried several human readable
floating point number format (with really high precision as for
single precision float), but for some reason they are not working
nicely, bad pixels (with NaN value) could be produced with some
weights set.
We could also add support to upload these weights with texture, just
for compatibility reason (etc. upscaling a still image with a low end
graphics card). But as I tested, it's rather slow even with 1D
texture (we probably had to use 2D texture due to dimension size
limitation). Since there is always better choice to do NNEDI3
upscaling for still image (vapoursynth plugin), it's not implemented
in this commit. If this turns out to be a popular demand from the
user, it should be easy to add it later.
For those who wants to optimize the performance a bit further, the
bottleneck seems to be:
1. overhead to upload and access these weights, (in particular,
the shader code will be regenerated for each frame, it's on CPU
though).
2. "dot()" performance in the main loop.
3. "exp()" performance in the main loop, there are various fast
implementation with some bit tricks (probably with the help of the
intBitsToFloat function).
The code is tested with nvidia card and driver (355.11), on Linux.
Closes #2230
Diffstat (limited to 'DOCS')
-rw-r--r-- | DOCS/man/vo.rst | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst index 36ca35d51f..0dc633494e 100644 --- a/DOCS/man/vo.rst +++ b/DOCS/man/vo.rst @@ -565,6 +565,13 @@ Available video output drivers are: Some parameters can be tuned with ``superxbr-sharpness`` and ``superxbr-edge-strength`` options. + ``nnedi3`` + An artificial neural network based deinterlacer, which can be used + to upscale images. + + Extremely slow and requires a recent mid or high end graphics card + to work smoothly (as of 2015). + Note that all the filters above are designed (or implemented) to process luma plane only and probably won't work as intended for video in RGB format. @@ -587,6 +594,29 @@ Available video output drivers are: A value less than 1.0 will disable the check. + ``nnedi3-neurons=<16|32|64|128>`` + Specify the neurons for nnedi3 prescaling (defaults to be 32). The + rendering time is expected to be linear to the number of neurons. + + ``nnedi3-window=<8x4|8x6>`` + Specify the size of local window for sampling in nnedi3 prescaling + (defaults to be ``8x4``). The ``8x6`` window produces sharper images, + but is also slower. + + ``nnedi3-upload=<ubo|shader>`` + Specify how to upload the NN weights to GPU. Depending on the graphics + card, driver, shader compiler and nnedi3 settings, both method can be + faster or slower. + + ``ubo`` + Upload these weights via uniform buffer objects. This is the + default. (requires OpenGL 3.1) + + ``shader`` + Hard code all the weights into the shader source code. (requires + OpenGL 3.3) + + ``pre-shaders=<files>``, ``post-shaders=<files>``, ``scale-shader=<file>`` Custom GLSL fragment shaders. |