Comments (6)
I put in a PR. Unfortunately, I don't have a suitable Windows build environment readily available, so it's totally untested.
I noticed some other colorimetry issues along the way. I'll try to write them up.
from ffnx.
Assuming I understand the math correctly, it appears that using a decoding gamma of ~2.2 instead of the bt601/709 transfer curve gives wrong results that are very close to the observed wrong results. So my current working hypothesis is that something in the pipeline is ignoring the "transfer" metadata set by x264 and using something near 2.2 instead.
from ffnx.
Yep, it looks like that's it exactly. In /src/video/movies.cpp, ffmpeg is never asked to fetch the transfer metadata. And then, in misc/FFNx.common.sh, the srgb transfer curve is used to decode gamma. Which is wrong because the gamma encoding was almost certainly done with the SMPTE170M transfer curve (shared by rec601 and rec709) in the first instance.
So the fix is:
Add this function to misc/FFNx.common.sh:
vec3 toLinearSMPTE170M(vec3 _rgb)
{
bvec3 cutoff = lessThan(_rgb.rgb, vec3_splat(0.081));
vec3 higher = pow((_rgb.rgb + vec3_splat(0.099)) / vec3_splat(1.099), (vec3_splat(1.0) / vec3_splat(0.45)));
vec3 lower = _rgb.rgb / vec3_splat(4.5);
return mix(higher, lower, cutoff);
}
Then on line 96 of /misc/FFNx.frag, replace
color.rgb = toLinear(color.rgb);
with
if (isMovie){
color.rgb = toLinearSMPTE170M(color.rgb);
}
else {
color.rgb = toLinear(color.rgb);
}
And then make the same change on line 116 of misc/FFNx.lighting.frag.
from ffnx.
Thanks for the research and knowledge share. Care to make a PR? :) I'll be happy to review, thank you!
from ffnx.
Thanks a lot
from ffnx.
Closing in favor of #536
from ffnx.
Related Issues (20)
- [ Common ] Incorrect Full-Range YUV->RGB Conversion HOT 1
- [ Common ] Improve the FFMpeg video decoding HOT 97
- [ FF7 ] Janky analog movement in latest Canary 1.15.0.12 after #523 enhancement
- Game Crashes on startup HOT 2
- [ FF8 ] Weird textures on battle when external textures are used in WorldMap HOT 1
- [ FF7 ] BUG at each launch, impossible to use the mod :( HOT 1
- [ FF7 ] Snow footsteps not shown in Worldmap (Icicle Area) HOT 2
- [ FF7 ] New analogue autorun doesn't work with footstep sounds
- [Core] Replace CMakeSettings.json with CMakeProfiles.json HOT 2
- Not responding after installing FFNx
- [ FF7 ] Widescreen Should Be Force Disabled for the Honeybee Inn Keyhole Scenes HOT 1
- [FF8] Use High-Res Models only
- [ FF7 ] Resolution dropdown box only shows resolutions for Monitor 1 HOT 1
- [ FF8 DE NV ] Cannot enter worldmap HOT 2
- Game crasher after trying to load 1st battle HOT 2
- [FF7] FFNx v1.14.0 & v1.15.0 Softlock in Northern Crater HOT 3
- [ FF7 Steam ] Battle Animations are Faster When Set to 30 or 60 FPS
- [ COMMON ] Build Tools Problems
- [ Common ] FFNx Logo Blackscreen HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ffnx.