Chroma amplitude correction from the luma FM carrier - #357
Draft
eshaz wants to merge 4 commits into
Draft
Conversation
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.
Features
--chroma_env_gain <amount>| Default1| Wet/dry mix of the correction.0disables it. On by default.--dp luma_noiseplots the carrier amplitude, the demodulated luma, and the correction's confidence weight--cagc <fields>| Default0| Averages the chroma automatic gain control over N fields. Useful for camcorder recordings.Fixes
chroma_to_u16overflow so that clipping saturates rather than overflows.Chroma amplitude correction from the luma FM carrier
Corrects color-under amplitude using the luma FM carrier's envelope as a reference, recovering saturation through dropouts and modulation noise observed in the luma channel.
Premise
An FM carrier should hold constant amplitude, so every departure from constant is imposed by the tape. The luma FM carrier and the color-under were written by the same head, onto the same oxide, at the same instant — head-to-medium separation loss is shared between them and scales with wavelength. The luma envelope therefore measures, at full sample rate, the amplitude damage the color burst only samples once per line.
How it works
The luma channel is used as a reference to correct amplitude noise in the color under signal. This can be done since the luma is ideally a fixed amplitude (FM encoded). This means that any noise or changes in this amplitude represent noise introduced after it was written to the tape (tape noise, dropouts, other noise sources).
Measuring the luma noise
The demodulated luma represents the instantaneous frequency of the luma signal. An interesting property emerges from this frequency measurement because of the high frequency roll off of magnetic tape. The amplitude of the recorded luma is altered depending on the carrier frequency. By subtracting out the amplitude that correlates with the instantaneous frequency, we can isolate only the noise from the luma channel. This subtraction gives us the differential between the expected luma and the measured luma because the expected luma a fixed amplitude.
Applying the correction to the chroma
The correction is very simple since all that is needed is to inverse the luma's noise profile onto the chroma channel. This removes all of the noise that was measured in the luma channel.
Results
This performs very well, and I don't see any downsides in all of my tests. Examples coming soon.