Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: May 2022
Location: Brazil
Posts: 27
|
Trying to recreate a composite signal simulation
I've been thinking very much about doing an simulation of an video signal through Composite.
But i will need some help in order to get that done. If this idea works well, i will try to rewrite DotCrawl++ to use this new script. First is to create a luma signal. The luma signal has an checkerboard look (and that's where dotcrawls come from). I will be very thankfully for the help. Images from DoctorDothraki's Domesday Duplicator uploads. ![]() ![]() |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: Jul 2018
Posts: 900
|
Luma do not have dotcrawl - it is chroma encoded addition. So to create more or less standard chroma subcarrier data it is required to read documentation and implement colour encoder to target colour system (typically PAL or NTSC) and more or less simply mix to luma data. The full composite encoder may (or typically do) have luma partial suppression filter at chroma band to make cross-distortions less visible. So better composite simulation mixer need also filter luma signal before final output mix.
Signal with checkerboard it is already mixed composite signal (luma +encoded chroma). The PAL/NTSC chroma subcarrier have phase flip to 180degrees (inversion) at each line to make residual distortion (after not ideal luma/chroma separation at decoder) less visible (checkerboard instead of vertical lines). The sad story about digital processing after composite decoder - the input composite signal may be partially damaged after passing colour decoder (its residual colour subcarrier that cause effect of dotcrawl) so it may be not completely equal to simulated standard composite data. It may have both phase and amplitude errors not present in input composite data and these errors may be unique for each colour decoder implementation. So better way is in that doomsday-duplicator project is full composite colour decoder with dotcrawl effect suppression by single developer - not trying to make addition to (unknown) external decoder. Last edited by DTL; 13th October 2022 at 23:16. |
![]() |
![]() |
![]() |
#3 | Link | |
Registered User
Join Date: May 2022
Location: Brazil
Posts: 27
|
Quote:
Interesting info though. Let's see. How i can make this chroma addition? I need to think about it. |
|
![]() |
![]() |
![]() |
#4 | Link |
Registered User
Join Date: Jul 2018
Posts: 900
|
Take any open documentation on your target colour composite system encoder and make math program to some execution environment.
PAL and NTSC quadrature modulation is simple enough like multiplication and sum of sin() functions. I think most information can be taken from ITU-BT 470 - https://www.itu.int/dms_pubrec/itu-r...1-S!!PDF-E.pdf For example math equation for chroma signal from 2.9 of Table 2. Also read about phase switching of chroma subcarrier - like 2.16 of Table 2 and may be other notes in that document. |
![]() |
![]() |
![]() |
#5 | Link | |
Registered User
Join Date: May 2022
Location: Brazil
Posts: 27
|
Quote:
I will see if i can use math with images on AVS, and then use these equations. |
|
![]() |
![]() |
![]() |
#7 | Link |
Registered User
Join Date: May 2022
Location: Brazil
Posts: 27
|
I'm trying out some way...
Code:
Tweak(hue=44) Y = ShowY() I = ShowU() Q = ShowV() C = BlankClip(last).mt_lutspa(mode="absolute", chroma="-128", expr=("x 4 % 2 < 0 1 ? y 4 % 2 < 0 1 ? + 1 == 0 255 ?")) I_luma = ex_lutxy(I,C,"x y - abs") Q_luma = ex_lutxy(Q,I_luma,"x y - abs") Y = ex_lutxy(Y,Q_luma,"x y + abs") return Y ![]() Last edited by RGMOfficial; 23rd October 2022 at 18:12. Reason: Forgot to clear the code a bit |
![]() |
![]() |
![]() |
#9 | Link |
Registered User
Join Date: May 2022
Location: Brazil
Posts: 27
|
Now, if someone can help fix the chroma issue i had.
(I'm using an DotCrawl++ function for the mults at the moment, but i will change to an original function later) Code:
function composite_effect(clip clip, float "subcarrier_amplitude"){ subcarrier_amplitude = Default(subcarrier_amplitude,0.5) clip.Tweak(hue=44) Y = ShowY() I = ShowU() Q = ShowV() ## LUMA SIGNAL (merge information from chroma planes) U_C = dcpp_makedotcrawl(2) V_C = ex_invert(U_C) I_luma = ex_lutxy(I,U_C,"x y - abs "+string(subcarrier_amplitude)+" *") Q_luma = ex_lutxy(Q,V_C,"x y - abs "+string(subcarrier_amplitude)+" *") Y = ex_lutxyz(Y,I_luma,Q_luma,"x y + z + abs "+string(subcarrier_amplitude)+" *") I = BlankClip(Y) Q = BlankClip(Y) c = Overlay(BlankClip(Y),Y,x=2) sum = ex_lutxy(Y,c,"x y -") sum = sum.Overlay(c,mode="add",mask=c,opacity=1).blur(1,0) Y = sum.Levels(0,1,128,0,255) chroma = ex_lutxy(c,Y,"x y 0.5 * -") chroma = invert(chroma) chroma = ex_lut(chroma,"x 0.31 * 0.5 /").invert() chroma_s1 = Overlay(BlankClip(chroma),chroma,x=2) chroma_s3 = Overlay(chroma,chroma,x=2,mask=U_C) chroma_s4 = Overlay(chroma,chroma,x=2,mask=V_C) I_1 = Overlay(chroma_s3,chroma_s3,x=2,mask=U_C) Q_1 = Overlay(chroma_s4,chroma_s4,x=-2,mask=V_C) I_2 = Overlay(chroma_s4,chroma_s4,x=-2,mask=U_C) Q_2 = Overlay(chroma_s3,chroma_s3,x=2,mask=V_C) GScriptClip(last,""" #Y = ConditionalSelect(Y, "current_frame % 2",Y,Y_test) I = ConditionalSelect(I, "current_frame % 2",I_1,I_2) Q = ConditionalSelect(Q, "current_frame % 2",Q_1,Q_2) """,local=true) I = I_1 Q = Q_1 return YToUV(I,Q,Y).Tweak(hue=-44) StackHorizontal(last,vid) #StackHorizontal(original,chroma) } ![]() |
![]() |
![]() |
![]() |
#10 | Link |
Registered User
Join Date: Jul 2018
Posts: 900
|
After you calculate I and Q chroma signals - you need to quadrature modulate chroma subcarrier and mix (addition) it with your luma data. The composite data is Y-only - not visibly colored. To demodulate it back to coloured you need to process it with composite decoder. I not sure if it is easy to do with AVS scripting only - better with C-program.
Last edited by DTL; 25th October 2022 at 08:01. |
![]() |
![]() |
![]() |
#11 | Link | |
Registered User
Join Date: May 2022
Location: Brazil
Posts: 27
|
Quote:
|
|
![]() |
![]() |
![]() |
#12 | Link |
Registered User
Join Date: Jul 2018
Posts: 900
|
For software composite demodulator you may look at vhs-decode project https://github.com/oyvindln/vhs-decode . Looks like this file https://github.com/oyvindln/vhs-deco...ode/process.py
|
![]() |
![]() |
![]() |
Tags |
composite, ntsc, simulation |
Thread Tools | Search this Thread |
Display Modes | |
|
|