Open mithro opened 8 years ago
Generating static patterns is easy on the lm32 (patterns which use the same value for every frame).
Generating dynamic patterns is harder. The lm32 doesn't have the speed to generate them dynamically. The two options are;
On the current test pattern (color bars) add a square and/or circle for checking aspect ratio of the downstream processing (display device (projector) and whatever hardware is in front of it and the mjpg stream that eventually ends up on a desktop media player.)
Pattern generation code is found at https://github.com/timvideos/HDMI2USB-litex-firmware/blob/master/firmware/pattern.c#L167-L246
GitHubHDMI2USB-litex-firmware - A version of the HDMI2USB firmware based around LiteX tools produced by @Enjoy-Digital (based on misoc+migen created by @M-Labs)
void pattern_fill_framebuffer(int h_active, int w_active)
{
int i, j;
int color;
flush_l2_cache();
color = -1;
volatile unsigned int *framebuffer = (unsigned int *)(MAIN_RAM_BASE + PATTERN_FRAMEBUFFER_BASE);
if(pattern == COLOR_BAR_PATTERN) {
/* color bar pattern */
for(i=0; i<h_active*w_active*2/4; i++) {
if(i%(h_active/16) == 0)
color = inc_color(color);
if(color >= 0)
framebuffer[i] = color_bar[color];
}
} else {
/* vertical black white lines */
for(i=0; i<h_active*w_active*2/4; i++) {
if(i%(h_active/16) == 0)
color = inc_color(color);
if(color >= 0)
framebuffer[i] = 0x801080ff;
}
}
// draw a border around that.
for (i=0; i<h_active*2; i++) {
framebuffer[i] = YCBCR422_WHITE;
}
for (i=(w_active-4)*h_active*2/4; i<h_active*w_active*2/4; i++) {
framebuffer[i] = YCBCR422_WHITE;
}
for (i=0; i<w_active*2; i++) {
// do the left bar
for (j=0; j<2; j++) {
framebuffer[(i*h_active)+j] = YCBCR422_WHITE;
framebuffer[(i*h_active)+j + (1*h_active/2)] = YCBCR422_WHITE;
}
// do the right bar
for (j=h_active-2; j<h_active; j++) {
framebuffer[(i*h_active)+j] = YCBCR422_WHITE;
framebuffer[(i*h_active)+j + (1*h_active/2)] = YCBCR422_WHITE;
}
}
// Line 1 - uptime + version information
int line = 1;
pattern_draw_text(19, line, (char*)git_describe);
line++;
// Line 2 - build time data
pattern_draw_text(1, line, "Built: "__DATE__" "__TIME__);
line++;
// Line 3- running on
pattern_draw_text(1, line, "Running on ");
pattern_draw_text(12, line, (char*)board);
line++;
// Line 4 - empty
line++;
#ifndef HIDE_ADVERT
// Line 5 - Hi!
pattern_draw_text(1, line, "Hi! I am HDMI2USB ");
line++;
// Line 6+7 - Want...
pattern_draw_text_color(1, line, "Want to hack on FOSS video capture systems?", YCBCR422_BLUE, YCBCR422_WHITE);
line++;
pattern_draw_text_color(1, line, "Get in touch with us! #timvideos on Freenode IRC", YCBCR422_RED, YCBCR422_WHITE);
line++;
// Line 8 - URLs..
pattern_draw_text(1, line, "code.timvideos.us / enjoy-digital.fr");
pattern_draw_text_color(6, line, "tim", YCBCR422_WHITE, YCBCR422_RED);
pattern_draw_text_color(9, line, "videos", YCBCR422_WHITE, YCBCR422_BLUE);
pattern_draw_text_color(27, line, "digital", YCBCR422_WHITE, YCBCR422_CYAN);
#endif
flush_l2_cache();
I'm thinking of picking up this issue.
Plan being:
Any other tests I should be adding?
We have a bunch of test patterns we have found very useful here -> https://github.com/timvideos/test-patterns
Definitely start with the static patterns, doing non-static patterns is going to be a lot more complicated (as the CPU isn't fast enough to generate patterns in real time).
GitHubtest-patterns - Test patterns for debugging video problems.
for unit testing, it would be handy to be able to not show the text.
I expect there will also be tests that look for the text, but being able to turn it off would be handy.
the hard part about this is coming up with the command name. ;)
On Fri, Feb 16, 2018 at 1:06 PM, Tim Ansell notifications@github.com wrote:
We have a bunch of test patterns we have found very useful here -> https://github.com/timvideos/test-patterns
Definitely start with the static patterns, doing non-static patterns is going to be a lot more complicated (as the CPU isn't fast enough to generate patterns in real time).
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/timvideos/HDMI2USB-litex-firmware/issues/185#issuecomment-366329514, or mute the thread https://github.com/notifications/unsubscribe-auth/AABauQGEVrO8AOVf69r1O2bwACgen0OBks5tVdGvgaJpZM4HLSi4 .
-- Carl K
GitHubtest-patterns - Test patterns for debugging video problems.
GitHubGitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 78 million projects.
Test patterns are really useful for doing multiple things;
We should add a whole bunch of these useful test patterns to the firmware.
For example test patterns, see https://github.com/timvideos/test-patterns