Giter Club home page Giter Club logo

vapoursynth-tonemap's Introduction

Description

A filter for converting high dynamic range (HDR) video to standard dynamic range (SDR).

Ported from mpv and the FFmpeg vf_tonemap filter http://mpv.io/ http://www.ffmpeg.org/ffmpeg-filters.html#tonemap

Usage

Hable

tonemap.Hable(clip clip[, float exposure=2.0, float a=0.15, float b=0.50, float c=0.10, float d=0.20, float e=0.02, float f=0.30, float w=11.2])

Peserve both dark and bright details better than Reinhard, at the cost of slightly darkening everything. Use it when detail preservation is more important than color and brightness accuracy.

  • clip: Clip to process. Only planar 32-bit float is supported.

  • exposure: Gain to apply.

  • a: Shoulder strength

  • b: Linear strength

  • c: Linear angle

  • d: Toe strength

  • e: Toe numerator

  • f: Toe denominator

  • w: Linear white point

hable(x) = ( (x*(a*x+c*b)+d*e) / (x*(a*x+b)+d*f) ) - e/f

output = hable(exposure * input) / hable(w)

References: http://filmicworlds.com/blog/filmic-tonemapping-operators http://www.slideshare.net/ozlael/hable-john-uncharted2-hdr-lighting

Mobius

tonemap.Mobius(clip clip[, float exposure=2.0, float transition=0.3, float peak=1.0])

Generalization of Reinhard to a Mobius transform with linear section. Smoothly maps out-of-range values while retaining contrast and colors for in-range material as much as possible. Use this when you care about color accuracy more than detail preservation.

  • clip: Clip to process. Only planar 32-bit float is supported.

  • exposure: Gain to apply.

  • transition: Specifies the transition point from linear to mobius transform. Every value below this point is guaranteed to be mapped 1:1. The higher the value, the more accurate the result will be, at the cost of losing bright details. Defaults to 0.3, which due to the steep initial slope still preserves in-range colors fairly accurately.

  • peak: Reference peak brightness

References: https://github.com/mpv-player/mpv/commit/d8a3b10f45eb10fb34ce9da3a9a76e3bd8644e3d

Reinhard

tonemap.Reinhard(clip clip[, float exposure=1.5, contrast=0.5, float peak=1.0])
  • clip: Clip to process. Only planar 32-bit float is supported.

  • exposure: Gain to apply.

  • contrast: Controls the local contrast coefficient at the display peak. Default to 0.5, which means that in-gamut values will be about half as bright as when clipping.

  • peak: Reference peak brightness

References: https://www.cs.utah.edu/~reinhard/cdrom/

Compilation

The usual autotools method:

./autogen.sh
./configure
make

On Mingw-w64 you can try something like the following:

gcc -c tonemap.c -I include/vapoursynth -O3 -ffast-math -mfpmath=sse -msse2 -march=native -std=c99 -Wall
gcc -shared -o tonemap.dll tonemap.o -Wl,--out-implib,tonemap.a

vapoursynth-tonemap's People

Contributors

ifb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

shssoichiro

vapoursynth-tonemap's Issues

Mobius&Reinhard - Peak missing in ReadMe

judging from the VapourSynthPluginInit-function:
tonemap.Mobius(clip clip[, float exposure=2.0, float transition=0.3])
should be:
tonemap.Mobius(clip clip[, float exposure=2.0, float transition=0.3, float peak=1.0]])
and
tonemap.Reinhard(clip clip[, float exposure=2.0, contrast=0.5])
should be:
tonemap.Reinhard(clip clip[, float exposure=2.0, contrast=0.5, float peak=1.0])

newbie questions "Only planar 32-bit float is supported"

For newbies (like me) ... "Only planar 32-bit float is supported" ... would you please be able to either briefly outline the formats and/or provide link(s) to stuff which outlines what these things are ?

An example or a link to example outlining how to convert a clip to these input formats which the plugin requires would be most appreciated.

For context, a goal is to convert from HDR BT.2020 to BT.709 for encoding into avc using ffmpeg(with NVEnc) or x264, (piped via VSPIPE) so that an older media player can play the videos.

Now I'm off to check whether nvidia's nvdec on a 750Ti and 1050Ti can decode HDR BT.2020 via Donald Graft's DGDecNV http://rationalqm.us/board/viewforum.php?f=8&sid=1c7197caea0bfda80f7071e7988c14ed and give it to Vapoursynth for input to your plugin.

Here's hoping :)

reinhard ignores exposure

The whole exposure thing is a bit of a hack anyway, but currently Reinhard() ignores it completely. Either fix it or remove it.

tonemap causing artifacts

Got artifacts using the toneMap filter, see: https://forum.doom9.org/showthread.php?t=175324 since this doesn't happen when I use toneMap directly with current ffmpeg builds I guess this is a bug introduced during the porting to Vapoursynth or a bug that was there and got fixed in the toneMap source.
-> would be nice if you could have a look at it.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.