Problem statement: simple 2 colors vertical stripes pattern is not displayed properly when rendered via NTSC composite output. Colors are not correctly reproduced, output is polluted by different shades of initial colors and video flickers in some cases.
Conditions: video0 is activated, video1, osd and attribute window are disabled; color space is ColorSpace_UYVY; video standard is D1 NTSC; video output is composite.
Background: I have tried to output a simple image contained green and white vertical stripes via NTSC to both my TV and capture card. Neither of them rendered image properly. Instead of clear white and green lines I was able to see all shades of green and even yellow and cyan. The pattern was fairly simple: 2 white pixels and 2 green pixels. You can see a cropped fragment(512x64) of one resulted frame, captured by capture card below.
White and black pattern after being output over NTSC contains shades of grey and lines are somehow smeared. Moreover, some color combinations(striking pink and white for instance) and/or 4 pixel wide stripes produce a visible and annoying flickering noise on the line edge.
As opposed to vertical stripes, horizontal stripes can be seen without any distortion.
I have also tested this issue via component 480p output. Image can also be seen clearly without any artifacts.
Questions: could you please provide some solution or explanation to this problem ? Is it common for all NTSC encoders ? Are there any hardware horizontal filters which can produce such artifacts?
Function for pattern generation is provided below:
Int SetStripePatternUYVY(Buffer_Handle hBuf)
{
Int8 *ptr, *ptr1, *ptr2;
Int32 *ptr4;
UInt32 offset;
Int y, x;
BufferGfx_Dimensions dim;
BufferGfx_getDimensions(hBuf, &dim);
offset = dim.y * dim.lineLength + dim.x * 2;
ptr = Buffer_getUserPtr(hBuf) + offset;
// vertical stripes pattern
for (y = 0; y < dim.height; y++) {
for (x = 0; x < dim.width*2; x+=8) {
// white
ptr[x+ 0] = 128;
ptr[x+ 1] = 255;
ptr[x+ 2] = 128;
ptr[x+ 3] = 255;
// green
ptr[x+ 4] = 0;
ptr[x+ 5] = 20;
ptr[x+ 6] = 0;
ptr[x+ 7] = 20;
}
ptr += dim.lineLength;
}
// horizontal stripes pattern
/*
ptr1 = Buffer_getUserPtr(hBuf) + offset + 0*dim.lineLength;
ptr2 = Buffer_getUserPtr(hBuf) + offset + 1*dim.lineLength;
for (y = 0; y < dim.height; y++) {
for (x = 0; x < dim.width*2; x+=4) {
// white
ptr1[x+ 0] = 128; ptr1[x+ 1] = 255; ptr1[x+ 2] = 128; ptr1[x+ 3] = 255;
// green
ptr2[x+ 0] = 0; ptr2[x+ 1] = 20; ptr2[x+ 2] = 0; ptr2[x+ 3] = 20;
}
ptr1 += 2*dim.lineLength;
ptr2 += 2*dim.lineLength;
}*/
return 0;
}