Repository navigation
Add a luma-only mode (--color-space yiq) - #64
Merged
Merged
Conversation
Magnifying R, G and B separately triples the work and lets the channel phases drift apart, which shows as colour fringing at higher k. With --color-space yiq only the BT.601 luma is magnified; because the Y column of the inverse YIQ matrix is all ones, the luma change is added to each of R, G and B, which keeps the input's chroma. On face.mp4 at k=5 the CPU run takes 16 s instead of 56 s and the mean chroma change drops from 2.35 to 0.01. The default stays rgb so existing output doesn't change. Closes #37
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #37
What changed
--color-space {rgb,yiq}(defaultrgb, so existing output is unchanged). Inyiqmode,magnify_luma()computes BT.601 luma, magnifies it once, and adds the luma change to R, G and B. That is exactly "convert to YIQ, replace Y, convert back", because the Y column of the inverse YIQ matrix is all ones, so I and Q stay as in the input. YCrCb uses the same luma and would give identical results, so onlyyiqis offered.--gputoo. The Parameters block prints the colour space.main()'s per-channel loop was folded into onemagnify()helper shared by both modes..github/images/luma_vs_rgb.png, 156 KB): input vs k=5rgb(magenta fringes on the glasses frame) vs k=5yiq.Measurements (face.mp4, k=5, CPU, default
--jobs 2)rgbyiqGPU:
--gpu --color-space yiqon face.mp4 takes 15.3 s and passesverify_output.py.Peak memory is a bit higher in
yiqmode (the float32 luma and the magnified result coexist), not lower as the issue expected; the issue's ~3x memory saving doesn't apply because channels were already processed one at a time. The remaining chroma change inyiqmode comes only from clipping: in saturated areas (the red shirt) adding brightness clips one channel and shifts the pixel toward grey. The README mentions this.Tests
--color-space yiq.