Austrian Coder

Members
  • Content count

    475
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Austrian Coder

  • Rank
    Member
  1. Hi guys. I am wokring at the moment on some onscrren menu handling routines for a mutlimeda system. Now i have a framebuffer (720 x 480) and want to copy in a image buffer. I am using this old code - not from me, a person before me coded this. [SOURCE] void CopyBlockIntoOSD(int linewidth, int x0, int y0, int x1, int y1, u_char *data) { int i; int w; u_char *cp; u_char *sp = data; // linewidth contains the width of one line in the data block, // linewidth<=0 uses blockwidth as linewidth if (linewidth <= 0) { w = m_windows[m_lastwindow].x1 - m_windows[m_lastwindow].x0; } else { w = linewidth; } for (i = y0; i <= y1; ++i) { cp = &m_OSD[i*OSDWIDTH + x0]; if ((cp+x1-x0+1) < &m_OSD[OSDWIDTH * OSDHEIGHT-1]) { for (int xx=0; xx <= (x1-x0); xx++) { *(cp+xx) = m_windows[m_lastwindow].colors[*(sp+xx) & 0x0f]; } } else { continue; } sp += w; } } [/SOURCE] Now can somebody tell me if there is a faster methode for doing this? Thanks, AC
  2. Quote:Original post by leiavoia Sound* s = Manager->CheckoutSound( "a_sound" ); // now just use "s" every time you need it So "a_sound" gets removed from the manager? Or what does the function CheckoutSound? Greets, AC
  3. Hi. I am working on a programm, which uses a std::ofstream based loger class. Now i need to know, if std::ofstream is threadsafe on windows and linux. Thanks, Christian
  4. gcc-2.95 and cpuid

    Hi. This little snip compiles fine on a gcc-3.x, but not on a 2.95. bool cDxr3CPU::Cpuid(unsigned long function, unsigned long& out_eax, unsigned long& out_ebx, unsigned long& out_ecx, unsigned long& out_edx) { asm("cpuid": "=a" (out_eax), "=b" (out_ebx), "=c" (out_ecx), "=d" (out_edx) : "a" (function)); return true; } dxr3cpu.c: In method `bool cDxr3CPU::cpuid(long unsigned int, long unsigned int &, long unsigned int &, long unsigned int &, long unsigned int &)': dxr3cpu.c:125: Invalid `asm' statement: dxr3cpu.c:125: fixed or forbidden register 3 (bx) was spilled for class BREG. I hope somebody can help me. Thanks, Christian
  5. ARGB to YCrCb

    Hi guys, i have here a buffer (w*h) in which every byte contains a colorvalue in ARGB-Format. Now i need a way to convert a) the whole buffer to YCrCb b) one single ARGB value to YCrCb I hope somebody can help me. Thanks, Christian
  6. Hi all. The last filesystem i have wroten, only supported physical and small memory based files. Now i want to create a much better filesystem :) Now i want to open, for instance, a archive file like this: gFileSystem->RegisterArchive("ar.tar"); cFile FileInArchive; FileInArchive.Open("sound.media"); FileInArchive.Read(void* buf, size_t size); Now i hacked together this header: class cFile { public: cFile(); ~cFile(); bool Open(String Filename, bool Readonly = true); void Close(); size_t Read(void* buf, size_t size); size_t Write(void* data, size_t size); void Seek(long amout, MoveMethode methode); void Flush(); bool Eof(); size_t Tell(); inline size_t GetSize() { return m_Size; } private: #ifdef USE_WCHAR_T_STRINGS std::basic_streambuf<wchar_t> m_Stream; #else std::basic_streambuf<char> m_Stream; #endif size_t m_Size; }; Now the fine thing about this stl-way. I could also make a Networkarchive-class, which can communicate via tcp. So i can use as many "archives" without writing extra code in cFile. I dont know if this all correct, what i have written until now. Maybe somebody can give me some tipps on designing, maybe somebody has an api doc or something else. Everything is welcome. Merci, Christian
  7. I dont know if intel has 64 bit cpus, but i know how to detect a AMD 64Bit cpu - untested, but should work. cpuid(0x80000000,eax,ebx,unused,edx); // now in eax there is the max. supported extended CPUID level // we check if theres an extended CPUID level support if (eax >= 0x80000001) { // If we can access the extended CPUID level 0x80000001 we get the // edx register if (cpuid(0x80000001,eax,ebx,unused,edx)) { // Now we can mask some specific cpu extensions m_Info._AMD64Bit = ((edx & 1<<29) != 0); } }
  8. GetCycleCount

    Hi. Can somebody help me to port this function to gcc? static inline unsigned __int64 GetCycleCount() { unsigned int timehi, timelo; // Use the assembly instruction rdtsc, which gets the current // cycle count (since the process started) and puts it in edx:eax. __asm { rdtsc mov timehi, edx; mov timelo, eax; } return ((unsigned __int64)timehi << 32) + (unsigned __int64)timelo; } Thanks, AC
  9. Looking for algo

    Hi. I am working on the dxr3 plugin for VDR. At the moment i am reworking the old and huggy osd routines. Now i have found a bottleneck, which i want to fix. Look at this picture: http://www.visual-page.de/problem.jpg Here you will see not a modern artwork, it is a fast drawing of the problem. The old routins are going through each line of the "picutre" and it starts with the color red. Now the old routine looks where the red stops and makrs its place. Now we have a quad wich will be later send to the dxr3 card. Now i am searching for an algorithm, which creates a list of quads/rectals. So a quad/rectal can be e.g. quite the whole first red recal. I hope you understand me, because it is quite hard to explain. Thanks, Christian PS: I forgot to say, that there only can be 16 different colors in a "picture".
  10. Fill Triangle routine

    Hi community. I have only the function DrawPixle(x,y,color) and now need a nice algorithm to draw a filled tringle. The function must look like this: void FillTriangle(x1,y1,x2,y2,x3,y3,color) I hope you can help me. Christian