heestand-xyz / AsyncGraphics

Edit images and video with Swift concurrency, powered by Metal.
http://async.graphics
MIT License
328 stars 17 forks source link

`levels` effect not consistent between video & camera source #9

Open nkleemann opened 6 months ago

nkleemann commented 6 months ago

When processing frames from Graphic.playVideo with the levels effect, and setting the gamma uniform in the levels shader to values greater than 1, the image does not get inverted. But when you obtain frames from the camera, the image does get inverted.

This is just a small issue, but swapping between video/camera sources might be common during development to prototype effects. So it might be worth looking into parity between the two frame sources.

Example:

let processed = try await frame.levels(
            brightness: 2,
            darkness: 0.6,
            contrast: 0.2,
            gamma: 1.2 
        )
heestand-xyz commented 5 months ago

Interesting, I'll try to look into this, thanks!

heestand-xyz commented 5 months ago

I think it has to do with high bit graphics, you can force it to 8bit here: https://heestand-xyz.github.io/AsyncGraphics-Docs/documentation/asyncgraphics/graphic/bits(_:)

nkleemann commented 5 months ago

Will try it out, thanks!