Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add channel separation repair filter using the BBC PAL Transform #6

Closed
JustinTArthur opened this issue Nov 14, 2022 · 1 comment
Closed
Assignees
Labels
enhancement New feature or request repair

Comments

@JustinTArthur
Copy link
Owner

For video that's been transmitted as a PAL composite signal (PAL CVBS or PAL terrestrial broadcast), the compositing of Yʹ, U, and V signals causes crosstalk, projected as rainbowing and dot crawl artifacts in the decoded pictures.

The BBC Transform PAL Decoder originally conceived by @jim-easterbrook has been celebrated in its ability to better reconstruct the original separate Yʹ, U, and V signals from the composite signal prior to decoding to light/color samples. There's even evidence it can help with NTSC composite video artifacts after reinterpreting the NTSC video as PAL. I'd love to see this concept realized as a VapourSynth filter so it can be used alongside fill_analog_frame_ends and upstream of TFM/VFM or QTGMC.

To perform this repair in transform space within a VapourSynth filter, we'd want to first construct a pseudo-analog PAL CVBS signal using something like pulse code modulation of 4-times-subcarrier-frequency, run the PAL Transform algorithm on the PCM data, then re-digitize the signal as light/color samples before finally resampling the original clip's format characteristics.

The open source ld-decode project has implementations of conversions between motion RGB and PAL CVBS PCM data. The open source pyctools-pal project has a Python and Cython implementation of the BBC PAL Transform for PAL CVBS PCM. However, both @atsampson's PAL CVBS conversion code and @jim-easterbrook's PAL transform code in these projects are only licensed to the public under the restrictive GNU Public License. A note for myself and anyone looking to add this to vsfieldkit: please avoid looking at the ld-decode/tools/ld-chroma-decoder or pyctools-pal/src/pyctools/components/pal source directories when working on this task. vsfieldkit is currently licensed to the public under the less restrictive MIT License.

My first try at this in vsfieldkit would be to open a subprocess to installed ld-chroma-encoder and ld-chroma-decoder executables if the user has installed them. The function would convert to/from the ld-* toolchain native RGB format using typical zimg/core.resize resampling kernels. This could potentially avoid licensing issues, but is likely to be inefficient.

A C, Rust, or even Python implementation of the CVBS conversion and PAL transform separation for VapourSynth could potentially be done in a separate GPL-licensed project using code or deriving code from ld-decode and/or pyctools-pal.

@JustinTArthur JustinTArthur added enhancement New feature or request repair labels Nov 14, 2022
@JustinTArthur JustinTArthur added this to the Future Feature Release milestone Nov 14, 2022
@JustinTArthur JustinTArthur self-assigned this Nov 14, 2022
@JustinTArthur JustinTArthur removed this from the 2.0.0 milestone Mar 14, 2023
@JustinTArthur
Copy link
Owner Author

I think I will drop this for now. It would be better in its own C or Rust vs plugin that was GPL and could bring in some ld-chroma-encoder and ld-chroma-decoder code. The GPL is too strict for me to be able to even work those executables directly in vsfieldkit without legal risk. I am working on re-sampling functions that will make it convenient to go to and from pixel formats compatible with those tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request repair
Projects
None yet
Development

No branches or pull requests

1 participant