home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2004 March / PCWELT_3_2004.ISO / pcwsoft / flaskmpeg_078_39_src.z.exe / flaskmpeg / Auxiliary.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-28  |  5.5 KB  |  213 lines

  1. /* 
  2.  *  Auxiliary.h
  3.  *
  4.  *    Copyright (C) Alberto Vigata - January 2000 - ultraflask@yahoo.com
  5.  *
  6.  *  This file is part of FlasKMPEG, a free MPEG to MPEG/AVI converter
  7.  *    
  8.  *  FlasKMPEG is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  FlasKMPEG is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  */
  23.  
  24. #ifndef AUX_H
  25. #define AUX_H
  26.  
  27. HWND CreateNormalWindow(WNDPROC WndProc, HINSTANCE hInstance, HWND hParent);
  28. void WindowMove(HWND window, int x, int y);
  29. void WindowShow(HWND hWnd);
  30. void WindowHide(HWND hWnd);
  31. void WindowResize(HWND window, int w, int h);
  32.  
  33. void WindowClientResize(HWND window, int w, int h);
  34.  
  35. void MenuCheck(HWND hWnd, int item);
  36. void MenuUnCheck(HWND hWnd, int item);
  37. void MenuEnable(HWND hWnd, int item);
  38. void MenuAddItem(HMENU hMenu,int item ,int wID, char *text);
  39. void MenuAddSeparator(HMENU hMenu,int item );
  40. void MenuDisable(HWND hWnd, int item);
  41. void MenuSetText(HMENU hMenu,int item ,char *text );
  42. HMENU MenuGetPopup( HMENU hMenu, int item );
  43.  
  44. void SetText(HWND hWnd, char *text);
  45.  
  46. void TabSetText(HWND hTab, int item, char *text);
  47.  
  48. void DlgCheck(HWND hDlg, int item, bool check);
  49. void DlgCheck(HWND hDlg, int item);
  50. void DlgUnCheck(HWND hDlg, int item);
  51.  
  52. bool DlgIsChecked(HWND hDlg, int item);
  53.  
  54. void DlgEnable(HWND hDlg, int item, bool enable);
  55. void DlgEnable(HWND hDlg, int item);
  56. void DlgDisable(HWND hDlg, int item);
  57. void DlgSetFocus(HWND hDlg, int control);
  58. int DlgGetInt(HWND hDlg, int item);
  59.  
  60. int DlgGetText( HWND hDlg, int item);
  61. char *DlgGetText( HWND hDlg, int item, char* text);
  62. void DlgSetText(HWND hDlg, int item, int number);
  63. void DlgSetText(HWND hDlg, int item, char* text);
  64. void DlgSetDouble(HWND hDlg, int item, double number);
  65. void DlgCheckBoxState(HWND hDlg, int item, int state);
  66.  
  67. void DlgAttachToolTip(HINSTANCE hInst, HWND hDlg, int nId, char *pTitle, char *pText);
  68. void AttachTooltip (HINSTANCE hInst, HWND hwnd, char *pTitle, char *pText);
  69.  
  70. int GetOutputFileName(HWND hWnd, char* fileName, char* Dir, char* Title);
  71.  
  72. //LIST BOXES
  73. void ListAddText(HWND list, char *text);
  74. int ListGetCur(HWND list);
  75. void ListSetCur(HWND list, int cur);
  76. void ListClean(HWND list);
  77.  
  78. void MillisecondsToTime( char *str, DWORD time);
  79. void LocalTimePlusMilliseconds(char *str, DWORD msec, bool show_seconds);
  80. void StringFrameRate(int fr, char *sFrameRate);
  81.  
  82. bool validateFileName( char *filename );
  83.  
  84. // General Routines
  85. __declspec(align(16))
  86. static char flmemcpy_buf[2048];
  87. static char *tbuf;
  88. // MMX memcopy
  89. void static flmemcpy(void *dest, void *src, int n) 
  90. {
  91.  
  92. #if 1
  93.     __asm
  94.     {
  95.     mov  edi,dest
  96.     mov  esi,src
  97.     mov  ecx,n
  98.     push ecx
  99.      
  100.     // align 64 byte
  101.     and  ecx,63
  102.     rep  movsb
  103.     pop  ecx
  104.     shr  ecx,6
  105.     cmp  ecx,0
  106.     je   _mmx_copy_end
  107.       
  108. _mmx_copy:
  109.     
  110.     movq mm0,[esi+0]
  111.     movq mm1,[esi+8]
  112.     movq [edi+0],mm0
  113.     movq [edi+8],mm1
  114.     movq mm2,[esi+16]
  115.     movq mm3,[esi+24]
  116.     movq [edi+16],mm2
  117.     movq [edi+24],mm3
  118.     movq mm0,[esi+32]
  119.     movq mm1,[esi+40]
  120.     movq [edi+32],mm0
  121.     movq [edi+40],mm1
  122.     movq mm2,[esi+48]
  123.     movq mm3,[esi+56]
  124.     movq [edi+48],mm2
  125.     movq [edi+56],mm3
  126.       
  127.     add esi,64
  128.     add edi,64
  129.     dec ecx
  130.     jnz _mmx_copy
  131.       
  132. _mmx_copy_end:
  133.     emms   
  134.   }
  135. #else
  136.   __asm 
  137.   { 
  138.       mov esi, src 
  139.       mov ecx, n
  140.       mov ebx, ecx 
  141.       shr ebx, 11 // 2048 bytes at a time 
  142.       mov edi, dest 
  143.       
  144. loop2k: // Copy 2k into temporary buffer 
  145.     push edi 
  146.       mov edi, tbuf 
  147.       mov ecx, 2048 
  148.       shr ecx, 6 
  149.       
  150. loopMemToL1: 
  151.     prefetchnta 64[ESI] // Prefetch next loop, non-temporal 
  152.       prefetchnta 96[ESI] 
  153.       
  154.       movq mm1,  0[ESI] // Read in source data 
  155.       movq mm2,  8[ESI] 
  156.       movq mm3, 16[ESI] 
  157.       movq mm4, 24[ESI] 
  158.       movq mm5, 32[ESI] 
  159.       movq mm6, 40[ESI] 
  160.       movq mm7, 48[ESI] 
  161.       movq mm0, 56[ESI] 
  162.       
  163.       movq  0[EDI], mm1 // Store into L1 
  164.       movq  8[EDI], mm2 
  165.       movq 16[EDI], mm3 
  166.       movq 24[EDI], mm4 
  167.       movq 32[EDI], mm5 
  168.       movq 40[EDI], mm6 
  169.       movq 48[EDI], mm7 
  170.       movq 56[EDI], mm0 
  171.       add esi, 64 
  172.       add edi, 64 
  173.       dec ecx 
  174.       jnz loopMemToL1 
  175.       
  176.       pop edi // Now copy from L1 to system memory 
  177.       push esi 
  178.       mov esi, tbuf 
  179.       mov ecx, 2048 
  180.       shr ecx, 6 
  181.       
  182. loopL1ToMem: 
  183.     movq mm1, 0[ESI] // Read in source data from L1 
  184.       movq mm2, 8[ESI] 
  185.       movq mm3, 16[ESI] 
  186.       movq mm4, 24[ESI] 
  187.       movq mm5, 32[ESI] 
  188.       movq mm6, 40[ESI] 
  189.       movq mm7, 48[ESI] 
  190.       movq mm0, 56[ESI] 
  191.       
  192.       movntq 0[EDI], mm1 // Non-temporal stores 
  193.       movntq 8[EDI], mm2 
  194.       movntq 16[EDI], mm3 
  195.       movntq 24[EDI], mm4 
  196.       movntq 32[EDI], mm5 
  197.       movntq 40[EDI], mm6 
  198.       movntq 48[EDI], mm7 
  199.       movntq 56[EDI], mm0 
  200.       
  201.       add esi, 64 
  202.       add edi, 64 
  203.       dec ecx 
  204.       jnz loopL1ToMem 
  205.       
  206.       pop esi // Do next 2k block 
  207.       dec ebx 
  208.       jnz loop2k 
  209.   } 
  210. #endif  
  211. }
  212.  
  213. #endif