• Takeshi (Kesh) Ikuma's avatar
    avfilter/vf_curves: add PCHIP interpolator and interp option · 65f96a96
    Takeshi (Kesh) Ikuma authored
    summary: This patch modifies the `curves` filter with new `interp` option
             to let user pick the existing natural cubic spline interpolation
             and the new PCHIP interapolation.
    
    reason:  The natural cubic spline does not impose monotonicity between
             the keypoints. As such, the fitted curve may vary wildly against
             user's intension. The PCHIP interpolation is not as smooth as
             the natural spline but guarantees the monotonicity. Providing
             both options enhances users experience (e.g., reduces the number
             of keypoints to realize the desired curve). See the related bug
             report for the example of an ill-interpolated curve.
    
    alternate solution:
             Both Photoshop and GIMP appear to use monotonic interpolation in
             their curve tools, which were the models for this filter. As
             such, an alternate solution is to drop the natural spline and
             go without the `interp` option.
    
    related bug report: https://trac.ffmpeg.org/ticket/9947 (filed by myself)
    Signed-off-by: 's avatarTakeshi (Kesh) Ikuma <tikuma@hotmail.com>
    65f96a96
vf_curves.c 36 KB