VideoHelp Forum




+ Reply to Thread
Results 1 to 29 of 29
  1. <Solution provided in reply below>

    I'm planning to use a videoscope to make measurements of color. I am trying to calibrate based off of 100% color bars (specifically 100/7.5/100/7.5 SMPTE color bars for NTSC). However, when I do the math, the results are out of gamut though vaguely close to the expected values.

    Is my math is wrong (most likely) or are SMPTE colors bars not pure colors, though close, perhaps based off of original values from old film (less likely).

    Apologies in advance, but the math details require some length here.

    The starting values are Luminance in IRE units and Chrominance in IRE and degrees.

    The values for 100% color bars are:
    Code:
    Color Bar   Luminance (IRE)     Chrominance Range (IRE)   Chromanince Phase (degrees)
    Red         35.1575             116.9817                  103.4558
    Green       61.7972             109.2338                  240.7098
    Blue        18.045               82.7567                  347.0812
    Yellow      89.455               82.7567                  167.0812
    Cyan        72.3425             116.9817                  283.4558
    Magenta     45.7025             109.2338                   60.7098
    The expected results for gamma-corrected RGB would be:
    Code:
    Color Bar   R   G   B
    Red         1   0   0
    Green       0   1   0
    Blue        0   0   1
    Yellow      1   1   0
    Cyan        0   1   1
    Magenta     1   0   1
    However, the results from NTSC 1953 compute as follows. These are close but are as much as 7% off and some results are out-of-gamut.
    Code:
    Color Bar    R               G               B
    Red          1.048374466    -0.011474661    -0.075703052
    Green       -0.014669659     0.991418414     0.060670644
    Blue        -0.033707903     0.020052797     1.015029869
    Yellow       1.033707903     0.979947203    -0.015029869
    Cyan        -0.048374466     1.011474661     1.075703052
    Magenta      1.014666415     0.008578343     0.939326113
    Similar results occur for "modern" NTSC:
    Code:
    Color Bar    R               G               B
    Red          1.053800487    -0.012022691    -0.079199044
    Green       -0.015997858     0.996403337    0.06046408
    Blue        -0.037805727     0.015615899    1.018732427
    Yellow       1.037805727     0.984384101    -0.018732427
    Cyan        -0.053800487     1.012022691    1.079199044
    Magenta      1.015994615     0.00359342     0.939532677
    How am I computing these? Let's just use row for the Red color bar as an example.

    Initial values
    Code:
    L = 35.1575     = Luminance (IRE)
    C = 116.9817    = Chrominance Range (IRE)
    D = 103.4558    = Chromanince Phase (degrees)
    Computing YIQ using the above values:
    Code:
    Y = 0.299        = (L - 7.5) / (100 - 7.5 )
    I = 0.656709493  = 0.5957 * sin( D - 33 ) * C
    Q = 0.204516112  = 0.5226 * cos( D - 33 ) * C
    Y's value is expected. The 7.5 comes from NTSC's 7.5 IRE setup value (min IRE for L for black) and 100 comes from the max value for L for white.
    I's value is greater than 0.5957, which is a sign that something is already wrong. The 0.5957 is a known constant for computing I. The 33 is the number of degrees the IQ axes is rotated vs the UV axes.
    Similar for Q, the 0.5226 is a known constant for computing Q. The 33 is the number of degrees the IQ axes is rotated vs the UV axes.

    Finally, if you plug these YIQ values for the Red color bar into the NTSC 1953 equations for RGB, you get:
    Code:
    R =  1.048374466    = Y + 0.9469*I + 0.6236*Q
    G = -0.011474661    = Y - 0.2748*I - 0.6357*Q
    B = -0.075703052    = Y - 1.1*I    + 1.7*Q
    Criticisms / corrections welcome.
    Last edited by Lathe26; 13th Feb 2022 at 00:45.
    Quote Quote  
  2. Can't give you the answer, but:

    What is the source for your '100% color bars' (first table)?

    What gamma correction did you assume?
    Last edited by Sharc; 5th Feb 2022 at 05:14.
    Quote Quote  
  3. Yes, those colors are pure RGB signals however their level in not 100IRE but usually 75IRE (In RF domain 100% color bar will give CVBS i.e. Y+C levels up to 150IRE i.e. forbidden for amplitude modulation).

    I think 7BM26_0E.pdf & 7BM26_0E_Annex.pdf from R&S may be interesting for you, definitely you should familiarize also with ITU-R BT 801.
    Everything is there.

    One remark from me '-7.5 IRE pedestal' shall be not present in your source digital video data (by this i mean data used for regular video processing such as NLE and similar). In normal digital video domain 100 IRE is always 235 (940) in digital domain and 0 IRE is always 16 (64) - this is foundation for worldwide broadcast industry.
    Pedestal is added by dedicated logic at the final step conversion from digital to analog domain (i.e. just before DAC) and it should be automatically removed in ADC during capture (it may be removed digitally after sample acquisition or it can be removed in analog domain before sampling).

    You may need to add pedestal if you dealing with RAW Video digital samples (so this mean you are building digital composite NTSC signal encoder) - to perform this you need multiply all signals by (100-7.5)/100 then add 7.5 IRE bias - issue is that in analog domain from 0 IRE to 100 IRE is still OK after compression to 92.5 IRE range bit in digital domain you loose accuracy and introduce quantization issues as such it is quite obvious that this step (adding pedestal) is part of signal composition - video NTSC signal with 100IRE range is feed to DAC with higher than 8 bit resolution where it is combined with synchronization signals and pedestal.
    Usually this is how digital composite video encoders are designed - thus you can avoid re-quantization.

    My impression is that you are trying to calculate sample value with pedestal - this is obviously wrong - historically pedestal is used to improve RF modulation budget - technically pedestal reduce average power required by RF amplifier and as such you may have broader covering range (as video signal is inverted before modulating RF - whites are black and black are whites - peak power of RF is in sync tip is highest - so in theory poor SNR allows to demodulate sync pulses even in case where video itself is unwatchable due poor SNR - that's why in analog TV's sometimes RF level is specified separately for synchronization state).

    btw - don't involve gamma - signal in NTSC are already after gamma (you not operate in linear RGB) so introducing gamma is unnecessary.
    Last edited by pandy; 5th Feb 2022 at 07:11.
    Quote Quote  
  4. Thanks all for responses. I think one major oversight in my previous post was forgetting to clarify that this is in the pure analog domain (i.e. no digital... yet).

    Originally Posted by Sharc View Post
    What is the source for your '100% color bars' (first table)?
    I used SMPTE 170M-2004 in table A.1 on page 17 for the 100% color bars. The 75% color bars (75/7.5/75/7.5) table is on the next page.

    Originally Posted by Sharc View Post
    What gamma correction did you assume?
    I haven't assumed a specific gamma correction value, yet. The next step after the above equations are fixed would be to convert the gamma-corrected values to linear, but that is a later part of the project. However, that conversion shouldn't necessary for the 100% color bars since the equations for gamma-correction and for linear intersect at the values of 0 and 1 (only the values between 0 and 1 are affected by gamma-correction). Also, the published equations first convert from YIQ to gamma-corrected RGB.

    Originally Posted by pandy View Post
    Yes, those colors are pure RGB signals however their level in not 100IRE but usually 75IRE (In RF domain 100% color bar will give CVBS i.e. Y+C levels up to 150IRE i.e. forbidden for amplitude modulation).

    I think 7BM26_0E.pdf & 7BM26_0E_Annex.pdf from R&S may be interesting for you, definitely you should familiarize also with ITU-R BT 801.
    Everything is there.
    Thanks, I'll check those out. Maybe a basic question I should be asking is whether NTSC 75% color bars produce 100% color saturation. My assumption was that some or all of the 75% color bars were unsaturated (and that the 75% color bars were due to the max of 120 IRE for NTSC RF transmissions over the airwaves).

    Originally Posted by pandy View Post
    One remark from me '-7.5 IRE pedestal' ...
    I should have clarified that the sources signals are analog to start with. The present goal is to take the YIQ values in IRE and degrees and compute the gamma-corrected RGB values. One source I plan to use is analog composite video (i.e. the old school yellow RCA jack / CVBS) and another source is RF modulated NTSC signal (i.e. have to add a converter box that selects channel 3 or 4 to convert from analog NTSC RF to analog composite video). These signals already have the 7.5 IRE pedestal present in them. Before measuring from either analog source, the plan was to confirm the math was correct using documented values (i.e. the table of values for the 100% color bars, even though these are not transmittable over NTSC RF).

    I think I have the pedestal part of calculations correct since computing Y comes out as expected using the equation Y = (L - 7.5) / (100 - 7.5 ) where L is the IRE luminance. For example, when computing Y for 3 primary color bars:
    Code:
    Red 100% color bar   = 35.1575 IRE   -->   Y = (35.1575 - 7.5) / (100 - 7.5 ) = 0.299
    Green 100% color bar = 61.7972 IRE   -->   Y = (61.7972 - 7.5) / (100 - 7.5 ) = 0.587
    Blue 100% color bar  = 18.0450 IRE   -->   Y = (18.0450 - 7.5) / (100 - 7.5 ) = 0.114
    Maybe it is a coincidence, but generic formula for Y when combining arbitrary gamma-corrected RGB values is 0.299*R + 0.587*G + 0.114*B. I assumed it was a good sign that the computed values match the formula's constants, but perhaps this was dumb luck mistake.

    Currently, I suspect that that something is wrong with the I and Q math (or perhaps SMPTE color bars are not perfectly pure colors, though this still seems unlikely).

    Originally Posted by pandy View Post
    btw - don't involve gamma - signal in NTSC are already after gamma (you not operate in linear RGB) so introducing gamma is unnecessary.
    Thanks for confirming this. Some websites don't clarify gamma-corrected RGB vs linear RGB, which was sometimes confusing early on in reading up on all of this.

    One additional question: Is the chrominance's saturation in IRE scaled to the colorburst IRE? In other words, if the colorburst is below its normal amplitude, such as 30 IRE instead of 40 IRE, will the displayed color be over/under saturated? I haven't seen this specified anywhere but I've seen some off-hand comments (https://www.openeye.net/support/faqs/how-to-use-the-camera-master).
    Quote Quote  
  5. Second additional question: are there any references that list a table of analog NTSC colors in both YIQ values (in IRE and degrees) and in analog gamma-corrected RGB? I tried finding that for the 75% color bars since it is such a common reference point but could only fine the YIQ values in IRE and degrees.

    The idea would be to have known values for inputs (YIQ) and outputs (RGB) to then those values to the equations to confirm whether the math is correct or not.

    Separately, I've already downloaded the R&S documents (thanks!). At first glance, these manuals have similar info as my Tektronix TGS95 Pathfinder manual, but R&S goes into more detail in some areas so these manuals will be helpful.
    Quote Quote  
  6. Originally Posted by Lathe26 View Post
    Thanks all for responses. I think one major oversight in my previous post was forgetting to clarify that this is in the pure analog domain (i.e. no digital... yet).
    Perhaps this was overlooked by me - anyway seem overall process creation of the NTSC in digital domain is good to be directly transposed on analog domain.

    Originally Posted by Lathe26 View Post
    Thanks, I'll check those out. Maybe a basic question I should be asking is whether NTSC 75% color bars produce 100% color saturation. My assumption was that some or all of the 75% color bars were unsaturated (and that the 75% color bars were due to the max of 120 IRE for NTSC RF transmissions over the airwaves).
    My impression is 75% saturation is standard for RF broadcast and analog world, 100% was feasible only with digital sources (DVD) and only in cable connections - anyway as always in digital and analog domain signals are clamped to particular level or by design and natural limitations (analog) or by introducing special type of arithmetic with saturation (digital).


    Originally Posted by Lathe26 View Post
    I should have clarified that the sources signals are analog to start with. The present goal is to take the YIQ values in IRE and degrees and compute the gamma-corrected RGB values. One source I plan to use is analog composite video (i.e. the old school yellow RCA jack / CVBS) and another source is RF modulated NTSC signal (i.e. have to add a converter box that selects channel 3 or 4 to convert from analog NTSC RF to analog composite video). These signals already have the 7.5 IRE pedestal present in them. Before measuring from either analog source, the plan was to confirm the math was correct using documented values (i.e. the table of values for the 100% color bars, even though these are not transmittable over NTSC RF).

    I think I have the pedestal part of calculations correct since computing Y comes out as expected using the equation Y = (L - 7.5) / (100 - 7.5 ) where L is the IRE luminance. For example, when computing Y for 3 primary color bars:
    Code:
    Red 100% color bar   = 35.1575 IRE   -->   Y = (35.1575 - 7.5) / (100 - 7.5 ) = 0.299
    Green 100% color bar = 61.7972 IRE   -->   Y = (61.7972 - 7.5) / (100 - 7.5 ) = 0.587
    Blue 100% color bar  = 18.0450 IRE   -->   Y = (18.0450 - 7.5) / (100 - 7.5 ) = 0.114
    Maybe it is a coincidence, but generic formula for Y when combining arbitrary gamma-corrected RGB values is 0.299*R + 0.587*G + 0.114*B. I assumed it was a good sign that the computed values match the formula's constants, but perhaps this was dumb luck mistake.

    Currently, I suspect that that something is wrong with the I and Q math (or perhaps SMPTE color bars are not perfectly pure colors, though this still seems unlikely).
    RGB signals are pure - my impression is that you should calculate your composite signal (Y and C) as 100IRE and add pedestal at the last stage, before adding pedestal of course you need to attenuate CVBS signal by multiplying it by 0.925 - in digital world sync, pedestal and Y with C are created in separate blocks - they are combined in the very last stage - this is fair approach i think - in analog world they may be some shortcuts to save some elements but in digital world usually those blocks are independent (so they need to be aligned before being combined together to avoid excessive chroma/luma delay issues - but same apply to analog world - many analog encoders has separate chroma lowpass filter to shape chrominance spectrum and luminance has introduced bandstop (trap) filter to create place for chrominace signal - those filters usually have weird group delay characteristic as such usually you have also in luminance filter additional delay line).

    Originally Posted by Lathe26 View Post
    Thanks for confirming this. Some websites don't clarify gamma-corrected RGB vs linear RGB, which was sometimes confusing early on in reading up on all of this.

    One additional question: Is the chrominance's saturation in IRE scaled to the colorburst IRE? In other words, if the colorburst is below its normal amplitude, such as 30 IRE instead of 40 IRE, will the displayed color be over/under saturated? I haven't seen this specified anywhere but I've seen some off-hand comments (https://www.openeye.net/support/faqs/how-to-use-the-camera-master).
    I have impression that gamma correction appears in camera and after this is never touched in analog signal flow - in fact importance of gamma was discovered not so long ago - many algorithms for video processing from 80's is 'gamma agnostic'.
    My another impression is that color burst should have 40IRE level and this level is used as reference for AGC in color demodulator - in fact everything rely on phase of chroma burst and its amplitude when composite video is decoded - in old times everything was very cleverly designed.
    Too low chroma burst level will increase gain and chroma level will be gained by 10IRE (30IRE vs 40IRE)


    Originally Posted by Lathe26 View Post
    Second additional question: are there any references that list a table of analog NTSC colors in both YIQ values (in IRE and degrees) and in analog gamma-corrected RGB? I tried finding that for the 75% color bars since it is such a common reference point but could only fine the YIQ values in IRE and degrees.

    The idea would be to have known values for inputs (YIQ) and outputs (RGB) to then those values to the equations to confirm whether the math is correct or not.

    Separately, I've already downloaded the R&S documents (thanks!). At first glance, these manuals have similar info as my Tektronix TGS95 Pathfinder manual, but R&S goes into more detail in some areas so these manuals will be helpful.
    To be honest i never saw anything in video world in linear RGB (so before gamma), as i wrote earlier - linear RGB may appear at the camera sensor and it is probably this point where correction gamma is applied - output from camera is same video as you can receive in your TV - not even sure if RGB is linearized in analog TV as seem linearization is done by CRT tube phosphor characteristic.
    For sure signal generators like TSG90 don't produce linear RGB - they provide video with levels you may calculate by using provided equations.

    National Instruments provide such table https://zone.ni.com/reference/en-XX/help/373389B-01/nivms/ntsc_patterns/
    it is slightly more accurate than Tek data but this is not a problem with analog TV where tolerance +-5% is more than OK.
    RGB levels are known by definition of the colorbar - if your white is 100IRE then RED must have 75IRE (after subtracting pedestal).

    Originally Posted by Tektronix_NTSC_Television_Measurements.25W_7049_3
    White Bar Levels. Color bar signals
    can also have different white bar
    levels, typically either 75% or
    100%. This parameter is com-
    pletely independent of the
    75%/100% amplitude distinction
    and either white level may be
    associated with either type of bars.
    Effects of Setup. Because of setup,
    the 75% signal level for NTSC is
    at 77 IRE. The maximum available
    signal amplitude is 100 - 7.5, or
    92.5 IRE. 75% of 92.5 IRE is
    69.4 IRE, which when added to
    the 7.5 IRE pedestal, yields a
    level of approximately 77 IRE.
    Note in Figure 110 that the 75%
    white bar and the 75% RGB
    signals extend to 77 IRE.
    Last edited by pandy; 6th Feb 2022 at 09:02.
    Quote Quote  
  7. Originally Posted by pandy View Post
    Perhaps this was overlooked by me - anyway seem overall process creation of the NTSC in digital domain is good to be directly transposed on analog domain.
    I'll try out the digital versions of the equations. The equation coefficients are close to the analog ones, though not identical.

    Originally Posted by pandy View Post
    My impression is 75% saturation is standard for RF broadcast and analog world, 100% was feasible only with digital sources (DVD) and only in cable connections - anyway as always in digital and analog domain signals are clamped to particular level or by design and natural limitations (analog) or by introducing special type of arithmetic with saturation (digital).
    I agree for RF broadcast that 75% saturation color bars were used to prevent exceeding the NTSC maximum IRE levels. However, it isn't clear whether CVBS (yellow RCA) is limited in such a way since the signal is inverted (i.e. sync pulse is negative) and it uses direct voltages instead of RF modulation (i.e. no concern for loss-of-carrier). From reading the SMPTE specs, it appears that the analog 100% color bars are legal.

    Originally Posted by pandy View Post
    Originally Posted by Lathe26 View Post
    Code:
    Red 100% color bar   = 35.1575 IRE   -->   Y = (35.1575 - 7.5) / (100 - 7.5 ) = 0.299
    Green 100% color bar = 61.7972 IRE   -->   Y = (61.7972 - 7.5) / (100 - 7.5 ) = 0.587
    Blue 100% color bar  = 18.0450 IRE   -->   Y = (18.0450 - 7.5) / (100 - 7.5 ) = 0.114
    RGB signals are pure - my impression is that you should calculate your composite signal (Y and C) as 100IRE and add pedestal at the last stage, before adding pedestal of course you need to attenuate CVBS signal by multiplying it by 0.925 - in digital world sync, pedestal and Y with C are created in separate blocks - they are combined in the very last stage - this is fair approach i think - in analog world they may be some shortcuts to save some elements but in digital world usually those blocks are independent (so they need to be aligned before being combined together to avoid excessive chroma/luma delay issues - but same apply to analog world - many analog encoders has separate chroma lowpass filter to shape chrominance spectrum and luminance has introduced bandstop (trap) filter to create place for chrominace signal - those filters usually have weird group delay characteristic as such usually you have also in luminance filter additional delay line).
    I think you might be trying to compute the equations in reverse from what is desired. The starting values are the values from the SMPTE specs (in IRE and degrees) from the 100% color bars for the red, green, and blue color bars (there are also yellow, cyan, magenta, white, and other colors present in the 100% color bars). The SMPTE spec does not provide the RGB values, unfortunately. From the SMPTE values the YIQ values are derived. From YIQ values the RGB values are derived. The starting point SMPTE values already have the pedestal and 0.925 already present. In other words, the pedestal and the 0.925 need to be removed instead applying them a 2nd time. The equations above show the removal of these factors and results in values for Y that match the coefficients from the standard Y equation. Just to double-check, I did briefly test out applying the pedestal and 0.925 factors to the SMPTE values (instead of removing), but as expected the Y values got wonky and the output RGB values were worse than the original post above.

    Thanks for confirming that the color processing is separate from the luminance.

    Originally Posted by pandy View Post
    I have impression that gamma correction appears in camera and after this is never touched in analog signal flow - in fact importance of gamma was discovered not so long ago - many algorithms for video processing from 80's is 'gamma agnostic'.
    My another impression is that color burst should have 40IRE level and this level is used as reference for AGC in color demodulator - in fact everything rely on phase of chroma burst and its amplitude when composite video is decoded - in old times everything was very cleverly designed.
    Too low chroma burst level will increase gain and chroma level will be gained by 10IRE (30IRE vs 40IRE)
    Thanks, this explains a lot. The video game console I am using produces rather low amplitudes for both the color bursts and the displayed colors, but analog TVs still produced bright colors. This aligns with what you say above.

    Originally Posted by pandy View Post
    To be honest i never saw anything in video world in linear RGB (so before gamma), as i wrote earlier - linear RGB may appear at the camera sensor and it is probably this point where correction gamma is applied - output from camera is same video as you can receive in your TV - not even sure if RGB is linearized in analog TV as seem linearization is done by CRT tube phosphor characteristic.
    For sure signal generators like TSG90 don't produce linear RGB - they provide video with levels you may calculate by using provided equations.

    National Instruments provide such table https://zone.ni.com/reference/en-XX/help/373389B-01/nivms/ntsc_patterns/
    it is slightly more accurate than Tek data but this is not a problem with analog TV where tolerance +-5% is more than OK.
    RGB levels are known by definition of the colorbar - if your white is 100IRE then RED must have 75IRE (after subtracting pedestal).

    Originally Posted by Tektronix_NTSC_Television_Measurements.25W_7049_3
    White Bar Levels. Color bar signals
    can also have different white bar
    levels, typically either 75% or
    100%. This parameter is com-
    pletely independent of the
    75%/100% amplitude distinction
    and either white level may be
    associated with either type of bars.
    Effects of Setup. Because of setup,
    the 75% signal level for NTSC is
    at 77 IRE. The maximum available
    signal amplitude is 100 - 7.5, or
    92.5 IRE. 75% of 92.5 IRE is
    69.4 IRE, which when added to
    the 7.5 IRE pedestal, yields a
    level of approximately 77 IRE.
    Note in Figure 110 that the 75%
    white bar and the 75% RGB
    signals extend to 77 IRE.
    The Tektronix quote above does confirm the right way to convert from a % to IRE in the correct manner, so this confirms things.

    As for the other references, they only contain the SMPTE values previously mentioned (other than being 75% instead of 100%). However, they don't contain both sets of values for YIQ (in IRE and degrees) and gamma-corrected RGB. They only have the YIQ values in IRE and degrees, which the SMPTE spec already provides. As for having the linear RGB values, instead of gamma-corrected RGB, those would be a bonus but not required.

    Regarding the "if your white is 100IRE then RED must have 75IRE", I don't think this is correct if you're referring to the red color bar's luma level. The National Instruments link above shows the Luma IRE for the red 75% color bar is 28.243 IRE. If you then subtract the 7.5 pedestal, divide by 75%, and add back the 7.5 pedestal, the computed result is 35.1573 IRE which as expected matches the Luma IRE for the red 100% color bar (Red 100% color bar's luma is spec'ed at 35.1575 IRE).
    Quote Quote  
  8. Originally Posted by Lathe26 View Post
    I'll try out the digital versions of the equations. The equation coefficients are close to the analog ones, though not identical.
    Small error is normal

    Originally Posted by Lathe26 View Post
    I agree for RF broadcast that 75% saturation color bars were used to prevent exceeding the NTSC maximum IRE levels. However, it isn't clear whether CVBS (yellow RCA) is limited in such a way since the signal is inverted (i.e. sync pulse is negative) and it uses direct voltages instead of RF modulation (i.e. no concern for loss-of-carrier). From reading the SMPTE specs, it appears that the analog 100% color bars are legal.
    As i've wrote earlier - RF 100% ColorBar is NOK, for wire (CVBS, YPBPr, RGB) is OK - how TV respond i.e. if there is 25 IRE difference (between 100IRE and 75IRE) on screen especially in analog TV - not sure....

    Originally Posted by Lathe26 View Post
    Thanks for confirming that the color processing is separate from the luminance.
    This is outcome of signal bandwidth requirements - chrominance is highly bandwidth limited as such time delay for chrominance signal path is higher than for 3..4 times higher bandwidth on luminance path - (in digital world this is slightly different and easy to compensate - usually video encoders offers subpixel accuracy - but primitive hardware like ancient computers may don't care about bandwidth and chroma/luma delay)


    Originally Posted by Lathe26 View Post
    Thanks, this explains a lot. The video game console I am using produces rather low amplitudes for both the color bursts and the displayed colors, but analog TVs still produced bright colors. This aligns with what you say above.
    Yes, for RF broadcast chroma burst seem to be good test signal so based on received level video decoder may compensate attenuation in overall signal path, 30 IRE sound like PAL where chroma burst level is 300mV where CVBS level is 1000mV, 700mV for luma and 300mv for sync tip.
    Probably not an issue for NTSC where AGC should adjust gain and increase overall chrominance level.

    Originally Posted by Lathe26 View Post
    The Tektronix quote above does confirm the right way to convert from a % to IRE in the correct manner, so this confirms things.

    As for the other references, they only contain the SMPTE values previously mentioned (other than being 75% instead of 100%). However, they don't contain both sets of values for YIQ (in IRE and degrees) and gamma-corrected RGB. They only have the YIQ values in IRE and degrees, which the SMPTE spec already provides. As for having the linear RGB values, instead of gamma-corrected RGB, those would be a bonus but not required.

    Regarding the "if your white is 100IRE then RED must have 75IRE", I don't think this is correct if you're referring to the red color bar's luma level. The National Instruments link above shows the Luma IRE for the red 75% color bar is 28.243 IRE. If you then subtract the 7.5 pedestal, divide by 75%, and add back the 7.5 pedestal, the computed result is 35.1573 IRE which as expected matches the Luma IRE for the red 100% color bar (Red 100% color bar's luma is spec'ed at 35.1575 IRE).
    Ah, i was not precise - whenever i'm referring to 75 IRE Red (or any other color) this is at the RGB output after demodulation and pedestal removal.
    This was outcome of your question - thread title - whenever you have 75% color bar this is not about CVBS but about component level so your RGB color bar source has this level, RGB signal is feed to video encoder, then it is turned to Y, R-Y,B-Y, coded, combined and present as CVBS (or S-Video with separate Y/C) - video decoder perform inverted processing and at the output offer RGB - luminance and chrominance level in CVBS is obviously different.
    Quote Quote  
  9. Finally solved the issues!!!

    Thanks everyone for the help.

    Short version:
    1. Had assumed that trigonometry was to be applied on circularized I and Q and then scale the I and Q values. Instead, the trig computes the I and Q directly.
    2. Chrominance range starts as peak-to-peak. It needs to be converted to amplitude and scaled by 92.5.
    3. SMPTE values assume Modern NTSC equations are used. 1953's NTSC equations are still pretty close, though.

    Since I literally could not find this information anywhere, I'll provide the equations below. Hopefully this will save someone else considerable pain in the future.

    Terms:
    Code:
    L       = Luminance in IRE
    CR      = Chrominance Range, peak-to-peak, in IRE
    CP      = Chrominance Phase in degrees; values range from 0 to 360.  Colorburst is at 180 degrees.  
    Y       = standard gamma-corrected luminance in YIQ form; values range from 0 to 1.
    I       = The I portion of the chrominance signal in YIQ form; values range from -0.5957 to 0.5957
    Q       = The Q portion of the chrominance signal in YIQ form; values range from -0.5226 to 0.5226
    R'G'B'  = Gamma-corrected values for red, green, blue signals in RGB; values range from 0 to 1
    Since SMPTE color bars are given values for L, CR, and CA, we can compute YIQ and R'G'B' as below:
    Code:
    Y   = ( L - 7.5 ) / 92.5
    I   = SIN( CP - 33 ) * CR / (2 * 92.5 )
    Q   = COS( CP - 33 ) * CR / (2 * 92.5 )
    R'  = Y + 0.95605 * I + 0.62075 * Q
    G'  = Y - 0.27205 * I - 0.64721 * Q
    B'  = Y - 1.10670 * I + 1.70442 * Q
    Reversing the process by starting with R'G'B', we get YIQ and L, CR, and CP as below:
    Code:
    Y   = 0.299 * R'  + 0.587 * G'  + 0.114 * B'
    I   = 0.5959 * R' - 0.2746 * G' - 0.3213 * B'
    Q   = 0.2115 * R' - 0.5227 * G' + 0.3112 * B'
    L   = Y * ( 100 - 7.5 ) + 7.5
    CR  = SQRT( I^2 + Q^2 ) * 2 * 92.5
    CP  = ATAN2( I, Q ) + 33
    Note1: ATAN2( x, y ) is arctangent but takes 2 parameter the x-coordinate and y-coordinate separately and its output is -180 to 180 and thus has a range of 360 degrees (the normal ATAN function only ranges from -90 to 90, in contrast to ATAN2). Be mindful that calculators and computer languages differ in the order of the x and y parameters. Microsoft Excel uses ATAN2( x, y ) so compute using ATAN2( I, Q ) while in contrast the C computer language uses atan2( y, x ) so compute using ATAN2( Q, I ).
    Note2: To force CP to be 0 to 360 degrees, add 360 degrees when the above CP equation is negative (e.g. -10 becomes 350)
    Note3: The /2 and *2 factors in the I, Q, and CR equations simply convert between values for amplitude and peak-to-peak (e.g. a signal with 45 IRE amplitude is 90 IRE peak-to-peak)

    When the above equations are used, error of output values vs expected is about 0.005%, which is excellent. The equations for converting to/from YIQ and R'G'B' are from "Modern NTSC". If the older and original 1953 FCC NTSC equations are used, the error increases to 0.5%, which isn't terrible but not as good as above.

    Here are some example computed values, starting with input values for L, CR, CP. Notice how close the R'G'B' values are to either 1 or 0.
    Code:
    100% colorbar   L        CR        CP        Y      I        Q        R'      G'      B'
    -------------   -------  --------  --------  -----  -------  -------  ------  ------  -------
    Red             35.1575  116.9817  103.4558  0.299   0.5959   0.2115  1.0000  0.0000   0.0001
    Green           61.7972  109.2338  240.7098  0.587  -0.2746  -0.5227  0.0000  1.0000  -0.0001
    Blue            18.0450   82.7567  347.0812  0.114  -0.3213   0.3112  0.0000  0.0000   1.0000
    Yellow          89.4550   82.7567  167.0812  0.886   0.3213  -0.3112  1.0000  1.0000   0.0000
    Cyan            72.3425  116.9817  283.4558  0.701  -0.5959  -0.2115  0.0000  1.0000   0.9999
    Magenta         45.7025  109.2338   60.7098  0.413   0.2746   0.5227  1.0000  0.0000   1.0001
    Addendum:
    When using the SMPTE 75% color bars and then converting from L, CR, CP values to R'G'B' values, the individual R', G', B' values are 0 and 0.75. This is in contrast to the 0 and 1 R'G'B' values computed from the 100% color bars.
    Last edited by Lathe26; 13th Feb 2022 at 17:08.
    Quote Quote  
  10. Nice. Thanks for sharing your findings.
    Quote Quote  
  11. Nice one, thx! Thread stored for archive purposes - probably will be useful in few years when i start to do my digital encoder for Amiga.
    Quote Quote  
  12. Maybe it is a coincidence, but generic formula for Y when combining arbitrary gamma-corrected RGB values is 0.299*R + 0.587*G + 0.114*B. I assumed it was a good sign that the computed values match the formula's constants, but perhaps this was dumb luck mistake.
    Your coefficients are a little off. Those are the values for digital BT.601. You're working in analog NTSC where the coefficients are:

    30% Red

    59% Green

    11% Blue

    Does this help? Sorry for the sloppy table.

    Code:
    Color	Luma (IRE)	Chrominance Amplitude (%)	Chrominance Phase (°)
    Gray	77	0	
    Yellow	69	62	167.1
    Cyan	56	88	283.4
    Green	48	82	240.8
    Magenta	36	82	60.83
    Red	28	88	103.4
    Blue	15	62	347.1
    White	100	0	
    Black	7.5	0	
    -I	50	100	303
    +Q	50	100	33
    +I	50	100	123 (= 33 + 90)
    -Q	50	100	213 (= 303 - 90)
    To answer your original question, keep in mind that in analog NTSC you're dealing with a phase-modulated subcarrier. A reduction in saturation decreases the amplitude of this subcarrier. From the above table it appears that not all colors are fully saturated.

    Pandy is correct about gamma. You're generating a test signal. EOTF (electro-optical transfer function) only enters the picture when displaying a signal on a display device (LCD, LED, OLED or CRT). OETF (opto-electronic transfer function) enters the picture when dealing with a pickup device (iconoscope, image orthicon, Plumbicon, CCD or CMOS).

    Be careful about adding setup. If your whites are 100 IRE and you add 7.5 IRE of setup your whites will go up to 107.5 IRE. If you start with whites at 92.5 IRE before adding setup then your whites will come up to 100 IRE after adding setup. Adding setup is additive and adding gain is multiplicative.

    This may or may not be of interest to you but I finally got my software NTSC encoder/decoder working well, but there is one cheat. I do not have a filter to separate the 3.58 MHz subcarrier from the composite signal. Back in the day this was accomplished with a hardware filter. I can send you the source code if you want it.

    https://forum.videohelp.com/threads/397434-Software-NTSC-Encoder
    Last edited by chris319; 21st Feb 2022 at 20:18.
    Quote Quote  
  13. Originally Posted by chris319 View Post
    Your coefficients are a little off. Those are the values for digital BT.601. You're working in analog NTSC where the coefficients are:

    30% Red

    59% Green

    11% Blue
    I'll have to double-check but there was a change in the phosphors as well as an increase in precision from the 1953 standard. For reference the device's output whose Luminance/Chrominance I will eventually be measuring was manufactured in 1979. The Tektronix TSG 95 that generates the 75% color bars I'll use first for calibration purposes was manufactured later (hence all the equations above for decoding its output).

    Originally Posted by chris319 View Post
    Does this help? Sorry for the sloppy table.

    Code:
    Color	Luma (IRE)	Chrominance Amplitude (%)	Chrominance Phase (°)
    Gray	77	0	
    Yellow	69	62	167.1
    Cyan	56	88	283.4
    Green	48	82	240.8
    Magenta	36	82	60.83
    Red	28	88	103.4
    Blue	15	62	347.1
    White	100	0	
    Black	7.5	0	
    -I	50	100	303
    +Q	50	100	33
    +I	50	100	123 (= 33 + 90)
    -Q	50	100	213 (= 303 - 90)
    To answer your original question, keep in mind that in analog NTSC you're dealing with a phase-modulated subcarrier. A reduction in saturation decreases the amplitude of this subcarrier. From the above table it appears that not all colors are fully saturated.
    Those colors are not fully saturated since they are from the 75% color bars, not the 100% color bars.
    More precisely, those are from the 100/7.5/75/7.5 color bars since white in the table is at 100 IRE instead of 77 IRE (i.e. not SMPTE's specified 75% color bars). Having white at 100 IRE makes calibration difficult due to mismatching the thin middle row of color patterns.

    Also, are you sure about the I and Q being at 50 IRE? Most sources (including SMPTE) list these at 40 IRE since they are supposed to match the amplitude of the colorburst. Almost all the values above are with rounding errors of SMPTE 75% color bars, though the phase angle for Green and Magenta are slightly further off. Do you have a reference for the above values?

    Nevermind the strikeout text, I found a reference and had also overlooked the gray color (i.e. the 75% / 77 IRE white I was referring to). However, I should point out that Wikipedia's reference for the above values comes from a poster's Usenet post made 20+ years ago in regards to the Apple II, so the source is a little shaky. The Wikipedia article looks even more shaky when they improperly label the table as "(100/0/75/0)" which is mistaken in 2 ways: the 7.5 setup is missing so it is not US NTSC compatible and the gray bar is 100%. If the values in the table are correct, then those values indicate it would be a 75/7.5/75/7.5 color bar.

    Originally Posted by chris319 View Post
    Pandy is correct about gamma. You're generating a test signal.
    No. I am decoding a test signal. As stated before, this is why Luminance/Chrominance values are inputs, not outputs, to the equations.

    Originally Posted by chris319 View Post
    Be careful about adding setup. If your whites are 100 IRE and you add 7.5 IRE of setup your whites will go up to 107.5 IRE. If you start with whites at 92.5 IRE before adding setup then your whites will come up to 100 IRE after adding setup. Adding setup is additive and adding gain is multiplicative.
    I agree with the above, but only after it is corrected for the decoding process and not as the encoding process. Thus, when decoding, setup is subtracted, not added, and the 0.925 gain factor is division, not multiplication. In other words, 75% color bars specifies white at 76.8750 IRE. If you subtract 7.5 IRE and then divide by 0.925, the result is 75.

    Originally Posted by chris319 View Post
    This may or may not be of interest to you but I finally got my software NTSC encoder/decoder working well, but there is one cheat. I do not have a filter to separate the 3.58 MHz subcarrier from the composite signal. Back in the day this was accomplished with a hardware filter. I can send you the source code if you want it.

    https://forum.videohelp.com/threads/397434-Software-NTSC-Encoder
    I'll have to check the software out. Thanks.
    Last edited by Lathe26; 22nd Feb 2022 at 13:03.
    Quote Quote  
  14. It's not entirely clear to me what this project is all about. You have a hardware color-bar generator and you're trying to measure the output?

    I'll have to double-check but there was a change in the phosphors as well as an increase in precision from the 1953 standard.
    The phosphors wouldn't change anything about the signal but they may have added more precision to the coefficients which are the same as your original ones, so never mind about them being off.
    Last edited by chris319; 22nd Feb 2022 at 15:05.
    Quote Quote  
  15. Originally Posted by chris319 View Post
    It's not entirely clear to me what this project is all about. You have a hardware color-bar generator and you're trying to measure the output?
    This project has 2 parts to it:
    1. Start with a hardware color-bar generator, measure the Luminance & Chrominance, convert to YIQ, then to R'G'B', <omitting intermediate steps>, then finally to sRGB. Confirm all math is correct (this is the important part).
    2. Start with an old video game console, measure its Luminance and Chrominance values for the 16 colors it is capable of. Input these values in previously validated math. Produce sRGB values. This is similar to the Apple ][ color project listed in the Usenet article.

    Just as an FYI, from looking over the Wikipedia articles on both YIQ and on SMPTE color bars, there are mistakes all over the place. Some mistakes are small, some major. I'll see what I can find good references for and fix those parts articles. Usually, Wikipedia is reliable but those articles are yikes.
    Quote Quote  
  16. What mistakes do you think you've found in Wikipedia?
    Quote Quote  
  17. Originally Posted by chris319 View Post
    What mistakes do you think you've found in Wikipedia?
    There are about 6 items I've noticed so far. Some are definite mistakes; others are likely mistakes that need to be cross-checked first. A few of these were listed in one of my above replies (link here).
    Quote Quote  
  18. Originally Posted by Lathe26 View Post
    Originally Posted by chris319 View Post
    What mistakes do you think you've found in Wikipedia?
    There are about 6 items I've noticed so far. Some are definite mistakes; others are likely mistakes that need to be cross-checked first. A few of these were listed in one of my above replies (link here).
    I'll be very interested in hearing about any mistakes you find in Wikipedia.
    Quote Quote  
  19. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Don't get me started on the Wikipedia mistakes on the Stereo3D pages! I love the site, but quasi-info from user submissions needs to be better vetted before approval.


    Scott
    Quote Quote  
  20. Ok, I made some of Wikipedia updates already.

    For https://en.wikipedia.org/wiki/YIQ, I made only small-to-modest changes so far. I clarified that the RGB values are gamma-corrected and corrected the legal ranges for I and Q (they were backwards).

    For https://en.wikipedia.org/wiki/SMPTE_color_bars, I overhauled the Analog SMPTE table of values (fixed the units, added mV values, corrected some IRE values, etc, etc) with a number of supporting citations. I also correct the 75% color bar numbers to be the correct (75/7.5/75/7.5) with a direct supporting citation (some of the earlier citations also support this change).

    Yet to be done is that the YIQ page's two large groups of equations will require moderate-to-large clean up.
    Quote Quote  
  21. You changed the NTSC phase angle for the magenta bar. What is your source for the revised value?
    Quote Quote  
  22. Originally Posted by chris319 View Post
    You changed the NTSC phase angle for the magenta bar. What is your source for the revised value?
    Here are some of the citations. The 1st one is a specification, the 2nd is a book on the subject (I highly recommend downloading the PDF), and 3rd is from test equipment that lists the parameters for the SMPTE color bar signal it outputs. Pages included so folks don't need to read everything.
    • "SMPTE 170M-2004 - Television - Composite Analog Video Signal - NTSC for Studio Applications". standards.globalspec.com. SMPTE. p. 18.
    • Jack, Keith (2005). "Chapter 8: NTSC, PAL, and SECAM Overview". Video Demystified: A Handbook for the Digital Engineer (4th ed.). Amsterdam: Elsevier. pp. 321–331. ISBN 0-7506-7822-4.
    • "Tektronix TSG95 Pathfinder PAL-NTSC Signal Generator" (PDF). p. 39. Retrieved 28 February 2022.
    Quote Quote  
  23. Thanks for the references. I looked at Table A.4 of the SMPTE spec and all looks well.

    Right now I am having an argument on the "Talk" page of the Wikipedia article on SMPTE Color Bars. I'm trying to convince Valery that RP 219 is a standard for video, not computer graphics, so sRGB and PNG don't enter into the discussion.
    Last edited by chris319; 27th Mar 2022 at 10:44.
    Quote Quote  
  24. OP: how is your project going?
    Quote Quote  
  25. Originally Posted by chris319 View Post
    OP: how is your project going?
    At the moment, it is on hold. It seemed more important to update Wikipedia with information from various specifications.

    However, I'm not sure if this thread's findings will get added (specifically, the Luma+Chroma --> YIQ equations). Wikipedia is big on citations and references and I'm concerned this thread borders on crossing the "No Original Research" rule. I plan to return to the original project soon.
    Quote Quote  
  26. Which Wikipedia article are you correcting?
    Quote Quote  
  27. What are your references for this thread?
    Quote Quote  
  28. If by "this thread" you are referring to the YIQ article's Talk section, much of the information comes from SMPTE 170M, though there are some other sources. I plan on keeping most of the YIQ change discussions over there in one place.

    If by "this thread" you are referring this forum topic (i.e., how to convert from Luma-Chroma to YIQ), there are only a few vague/incomplete/tenuous references. The lack of clear references is what prompted creating this forum topic.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!