Last active
December 14, 2023 23:04
-
-
Save bjin/399cb23818ad210941725ef768893499 to your computer and use it in GitHub Desktop.
dynamic stretching filter for mpv, aiming to bring effects similar to GoPro SuperView. use along with '--no-keepaspect'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//!DESC hyperview | |
//!HOOK MAIN | |
//!WHEN OUTPUT.width OUTPUT.height / MAIN.width MAIN.height / / 0.667 > | |
//!WIDTH OUTPUT.width | |
//!BIND HOOKED | |
vec4 hook() { | |
float r = (target_size.x / target_size.y) / (HOOKED_size.x / HOOKED_size.y); | |
// y = (r - 1) * x^3 + x | |
float y = (HOOKED_pos.x - 0.5) * 2.0 * r; | |
float x = y / r; | |
x -= ((r - 1.0) * x * x * x + x - y) / (3 * (r - 1.0) * x * x + 1.0); | |
x -= ((r - 1.0) * x * x * x + x - y) / (3 * (r - 1.0) * x * x + 1.0); | |
x -= ((r - 1.0) * x * x * x + x - y) / (3 * (r - 1.0) * x * x + 1.0); | |
x -= ((r - 1.0) * x * x * x + x - y) / (3 * (r - 1.0) * x * x + 1.0); | |
x -= ((r - 1.0) * x * x * x + x - y) / (3 * (r - 1.0) * x * x + 1.0); | |
return HOOKED_tex(vec2(x / 2.0 + 0.5, HOOKED_pos.y)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment