(1) Introduction of GB code
(2) Encoding conversion
(3) Time acquisition
(4) Display toggle
Recently made a character overlay, including time overlay, word character overlay, position movement, and other functions open. Because the general character is superimposed on the dot matrix 16-bit, then the 16-bit encoding is gb2313 encoded, such as video two words,
First, depending on:
Encoding type |
Binary encoding |
Hexadecimal encoding |
Unicode |
10001001 11000110 |
0x89c6 |
UTF-8 |
11101000 10100111 10000110 |
0xe8a786 |
GB2312 |
11001010 11010011 |
0xcad3 |
Then the message:
Encoding type |
Binary encoding |
Hexadecimal encoding |
Unicode |
10001011 10101111 |
0x8baf |
UTF-8 |
11101000 10101110 10101111 |
0xe8aeaf |
GB2312 |
11010001 10110110 |
0xd1b6 |
gb2313 GB is occupied two bytes a word, international standard UTF8 is three bytes a word,
http://lijunlisu.blog.163.com/blog/static/1639814282012710101844158/
Http://www.cnblogs.com/windtail/archive/2012/08/26/2657485.html
Http://baike.baidu.com/link?url=CNP55LTT8JmvtkmmQm_Jy-KOLa2zh0_LtTqMpNDL_wepPK3gcqVHpRuX1USESsO4yPC_ HAMOPLNMZ34QSPE0HK Man GB Code
And then the Web page submitted to the Web server CGI received data is UTF8 and the font is also with the percent spacer,
Code Conversion online Find site:
Http://www.mytju.com/classcode/tools/encode_gb2312.asp
http://www.2fz1.com/so/
(2) Encoding conversion
Because the Web-based text encoding is UTF8, and the dot matrix is gb2314, here to sit down conversion, the 16 binary string converted to the corresponding number!
Converts the string representation of a hexadecimal number to the corresponding integer. The string form of the so-called hexadecimal number refers to the string containing only ' 0 '-' 9 ' or ' a '-' Z ' or ' a '-' Z ', the leading "0x" or "0X" will appear.
To solve this problem, you also need a tool function that converts uppercase letters to lowercase letters:
- /* Convert capital letters to lowercase letters */
- int tolower (int c)
- {
- if (c >= ' A ' && c <= ' Z ')
- {
- return C + ' a '- ' a ';
- }
- Else
- {
- return C;
- }
- }
Here is the conversion function:
- Converts a hexadecimal string into an integer
- int htoi (char s[])
- {
- int i;
- int n = 0;
- if (s[0] = = ' 0 ' && (s[1]==' x ' | | s[1]==' x '))//Determine if there is a leading 0x or 0X
- {
- i = 2;
- }
- Else
- {
- i = 0;
- }
- For (; (S[i] >= ' 0 ' && s[i] <= ' 9 ')
- || (S[i] >= ' a ' && s[i] <= ' z ') | | (S[i] >=' A ' && s[i] <= ' Z '); ++i)
- {
- if (ToLower (S[i]) > ' 9 ')
- {
- n = + * n + (+ tolower (S[i])- ' a ');
- }
- Else
- {
- n = * n + (ToLower (s[i])- ' 0 ');
- }
- }
- return n;
- }
- Encoding conversion:
void Utf_8tounicode (wchar_t* pout,char *ptext)
{
char* Uchar = (char *) pOut;
UCHAR[1] = ((ptext[0] & 0x0F) << 4) + ((Ptext[1] >> 2) & 0x0F);
Uchar[0] = ((ptext[1] & 0x03) << 6) + (Ptext[2] & 0x3F);
}
void Unicodetoutf_8 (char* pout,wchar_t* ptext)
{
Note The order of the WCHAR, low byte in front, high byte in the back
char* Pchar = (char *) ptext;
Pout[0] = (0xE0 | ((Pchar[1] & 0xF0) >> 4));
POUT[1] = (0x80 | ((Pchar[1] & 0x0F) << 2)) + ((pchar[0] & 0xC0) >> 6);
POUT[2] = (0x80 | (Pchar[0] & 0x3F));
}
void UnicodeToGB2312 (char* pout,wchar_t uData)
{
WideCharToMultiByte (Cp_acp,null,&udata,1,pout,sizeof (wchar_t), null,null);
}
void Gb2312tounicode (wchar_t* pout,char *gbbuffer)
{
:: MultiByteToWideChar (cp_acp,mb_precomposed,gbbuffer,2,pout,1);
}
void Gb2312toutf_8 (string& pout,char *ptext, int plen)
{
Char Buf[4] = {0};
int nlength = plen* 3;
char* rst = new Char[nlength];
memset (rst,0,nlength);
int i = 0, j = 0;
while (I < Plen)
{
If you copy it directly in English, you can
if (* (Ptext + i) >= 0)
{
Rst[j++] = ptext[i++];
}
Else
{
wchar_t pbuffer;
Gb2312tounicode (&pbuffer,ptext+i);
Unicodetoutf_8 (Buf,&pbuffer);
RST[J] = buf[0];
RST[J+1] = buf[1];
RST[J+2] = buf[2];
j + = 3;
i + = 2;
}
}
RST[J] = ' \ n '; return results
POut = rst;
delete []rst;
Return
}
void utf_8togb2312 (Char*pout, char *ptext, int plen)
{
Char ctemp[4];
memset (ctemp,0,4);
int i =0, j = 0;
while (I < Plen)
{
if (Ptext[i] >= 0)
{
Pout[j++] = ptext[i++];
}
Else
{
WCHAR wtemp;
Utf_8tounicode (&wtemp,ptext + i);
UnicodeToGB2312 (ctemp,wtemp);
POUT[J] = ctemp[0];
Pout[j + 1] = ctemp[1];
i + = 3;
J + = 2;
}
}
POUT[J] = ' \ n ';
Return
}
And, of course, there's a ready-made code behind it.
Http://www.linuxidc.com/Linux/2012-01/51571.htm
http://blog.163.com/lyq_163_2009/blog/static/13408269620116752322992/
http://blog.csdn.net/yeyuangen/article/details/6722193
http://blog.csdn.net/searchsun/article/details/2443867 YUV Format Detailed
Http://www.cnblogs.com/skywang12345/p/3360348.html
http://blog.csdn.net/shen_001/article/details/7785713 OpenGL
http://blog.csdn.net/shen_001/article/details/7818972
http://blog.csdn.net/hitexam/article/details/5996607
(3) Time acquisition
A8 Linux end time acquisition is easy to directly call the LocalTime function, but the DSP M3 end of the data acquisition can only be through the util_time, to obtain the timing from the start of the boot time, and did not get accurate time from the A8 end, do when the DSP side can obtain time, Later found no time to obtain, found before the IPNC is also from the A8 side through the message sent over, so the last is also through the data structure of the whole time to get over from the DSP,
Second conversion at DSP end:
/** ms conversion */public static String Formattime (long ms) {int SS = 1000; int mi = SS * 60; int hh = mi * 60; int dd = hh * 24; Long day = MS/DD; Long hour = (Ms-day * dd)/HH; Long minute = (Ms-day * dd-hour * hh)/mi; Long second = (Ms-day * dd-hour * hh-minute * mi)/SS; Long millisecond = Ms-day * Dd-hour * hh-minute * mi-second * SS; String strday = Day < 10? "0" + Day: "+ Day"; Day String Strhour = Hour < 10? "0" + Hour: "" + hour;//hours String Strminute = minute < 10? " 0 "+ minute:" "+ minute;//minutes String Strsecond = Second < 10?" 0 "+ Second:" "+ second;//sec String Strmillisecond = Millisecond < 10?" 0 "+ Millisecond:" "+ millisecond;//ms Strmillisecond = Millisecond < 100?" 0 "+ strmillisecond:" + strmillisecond; REturn Strminute + "minutes" + Strsecond + "seconds"; }
Http://www.educity.cn/wenda/307912.html
http://blog.csdn.net/fuxiaohui/article/details/25505823
http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/p/300747/1048610
Http://www.deyisupport.com/question_answer/dsp_arm/davinci_digital_media_processors/f/39/t/67246.aspx Pan brother Roar!
http://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=8148%20m3%20time& Rsv_pq=bda1d8430003d3c6&rsv_t=b4a1ggnfu6c4dqjdxpoj24o5svfyk1%2buvqhz4dotknlpqrcq0p5%2fsalby6k&rsv_ Enter=1&inputt=1233&rsv_sug3=25&rsv_sug4=2728&rsv_sug2=0
http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/271976
Http://www.360doc.com/content/12/0306/17/19692_192255025.shtml
Http://net.pku.edu.cn/~yhf/linux_c/function/02.html
Http://blog.donews.com/quickmouse/archive/2008/05/08/1287733.aspx
Http://blog.donews.com/quickmouse/archive/2008/05/08/1287733.aspx
(4) Display toggle
This time to do layout display switch found that 48 of the function is quite powerful, can do any rectangular layout, but also can do screen overlay.
http://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=8148%20m3%20time& Rsv_pq=bda1d8430003d3c6&rsv_t=b4a1ggnfu6c4dqjdxpoj24o5svfyk1%2buvqhz4dotknlpqrcq0p5%2fsalby6k&rsv_ Enter=1&inputt=1233&rsv_sug3=25&rsv_sug4=2728&rsv_sug2=0
http://www.deyisupport.com/question_answer/dsp_arm/davinci_digital_media_processors/f/39/t/17971.aspx M3 End Address Translation
http://www.deyisupport.com/question_answer/dsp_arm/davinci_digital_media_processors/f/39/t/54118.aspx Display
http://www.deyisupport.com/question_answer/dsp_arm/davinci_digital_media_processors/f/39/t/59513.aspx Display Link
Http://www.deyisupport.com/question_answer/dsp_arm/davinci_digital_media_processors/f/39/p/18848/63772.aspx 12-Way decoding
Raspberry Pi
http://www.2fz1.com/
Embedded development Character Overlay---gb2313 GB code, UTF8 International Code, Unicode uncensored