Build the 4 phase chroma lookup table The YI'Q' colors are hard-coded ===========================================================================
| 917 | // The YI'Q' colors are hard-coded |
| 918 | //=========================================================================== |
| 919 | static void initChromaPhaseTables (void) |
| 920 | { |
| 921 | int phase,s,t,n; |
| 922 | real z,y0,y1,c,i,q; |
| 923 | real phi,zz; |
| 924 | float brightness; |
| 925 | double r64,g64,b64; |
| 926 | float r32,g32,b32; |
| 927 | |
| 928 | for (phase = 0; phase < 4; ++phase) |
| 929 | { |
| 930 | phi = (phase * RAD_90) + CYCLESTART; |
| 931 | for (s = 0; s < NTSC_NUM_SEQUENCES; ++s) |
| 932 | { |
| 933 | t = s; |
| 934 | y0 = y1 = c = i = q = 0.0; |
| 935 | |
| 936 | for (n = 0; n < 12; ++n) |
| 937 | { |
| 938 | z = (real)(0 != (t & 0x800)); |
| 939 | t = t << 1; |
| 940 | |
| 941 | for(int k = 0; k < 2; k++ ) |
| 942 | { |
| 943 | //z = z * 1.25; |
| 944 | zz = initFilterSignal(z); |
| 945 | c = initFilterChroma(zz); // "Mostly" correct _if_ CYCLESTART = PI/4 = 45 degrees |
| 946 | y0 = initFilterLuma0 (zz); |
| 947 | y1 = initFilterLuma1 (zz - c); |
| 948 | |
| 949 | c = c * 2.f; |
| 950 | i = i + (c * cos(phi) - i) / 8.f; |
| 951 | q = q + (c * sin(phi) - q) / 8.f; |
| 952 | |
| 953 | phi += RAD_45; |
| 954 | } // k |
| 955 | } // samples |
| 956 | |
| 957 | brightness = clampZeroOne( (float)z ); |
| 958 | g_aBnWMonitor[s].b = (uint8_t)(brightness * 255); |
| 959 | g_aBnWMonitor[s].g = (uint8_t)(brightness * 255); |
| 960 | g_aBnWMonitor[s].r = (uint8_t)(brightness * 255); |
| 961 | g_aBnWMonitor[s].a = 255; |
| 962 | |
| 963 | brightness = clampZeroOne( (float)y1); |
| 964 | g_aBnwColorTV[s].b = (uint8_t)(brightness * 255); |
| 965 | g_aBnwColorTV[s].g = (uint8_t)(brightness * 255); |
| 966 | g_aBnwColorTV[s].r = (uint8_t)(brightness * 255); |
| 967 | g_aBnwColorTV[s].a = 255; |
| 968 | |
| 969 | /* |
| 970 | YI'V' to RGB |
| 971 | |
| 972 | [r g b] = [y i v][ 1 1 1 ] |
| 973 | [0.956 -0.272 -1.105] |
| 974 | [0.621 -0.647 1.702] |
| 975 | |
| 976 | [r] [1 0.956 0.621][y] |
no test coverage detected