hi,all:
I work on the dm642 platform, and now i want to write a some string on the video frame,
and my questions how to improve the efficiency of char display?
Can someone give some useful suggestions?
i also see the example of ti:
void OSDUTIL_text(
Uint8 *pFrame, // pointer to the OSD pixel frame
Uint32 pitch, // Line-to-line pitch, expressed in pixels
OSDUTIL_Point* loc, // Location of first character
char *pString, // Pointer to ASCII string to be shown
OSDUTIL_Font *font, // Font to use
Uint8 fgColor, // Foreground color (i.e. on pixel color)
Uint8 bgColor) // Background color (i.e. off pixel color)
{
Uint32 charSize;
Uint32 stringSize;
Uint8 data;
Uint32 i, j, k;
Uint8 *p;
Uint8 pixColor;
char c;
if(font == OSDUTIL_FONT_DEFAULT) {
font = &fontDefault;
}
stringSize = strlen(pString); // see how long the string is
if (stringSize == 0)
return;
charSize = (font->fontWidth + 7) >> 3; // number of bytes per horz scan line
pFrame += (loc->y * pitch) + loc->x; // move to start of string
for (i = 0; i < font->fontHeight; i++) {
p = pFrame;
for (j = 0; j < stringSize; j++) {
c = pString[j];
c = (c < ' ') ? 0 : c - ' ';
for (k = 0; k < font->fontWidth; k++) {
if ((k & 7) == 0)
data = font->fontData[(c * font->fontHeight + i) * charSize + (k >> 3)];
pixColor = (data & 0x80) ? fgColor : bgColor;
if (pixColor != OSDCOLOR_NODRAW) {
*p++ = pixColor;
*p++ = pixColor;
} else
p+=2; // don't draw these pixels
data <<= 1; // next pixel in current scan line
}
//p+=2; // two more for inter-character spacing
}
pFrame += pitch;
p = pFrame;
for (j = 0; j < stringSize; j++) {
c = pString[j];
c = (c < ' ') ? 0 : c - ' ';
for (k = 0; k < font->fontWidth; k++) {
if ((k & 7) == 0)
data = font->fontData[(c * font->fontHeight + i) * charSize + (k >> 3)];
pixColor = (data & 0x80) ? fgColor : bgColor;
if (pixColor != OSDCOLOR_NODRAW) {
*p++ = pixColor;
*p++ = pixColor;
} else
p+=2; // don't draw these pixels
data <<= 1; // next pixel in current scan line
}
//p+=2; // two more for inter-character spacing
}
pFrame += pitch;
}
}
but when i want to draw every frame, so how to optimize it.
thank you very much!