1
0

r_defs.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. /*
  2. LICENSE
  3. -------
  4. Copyright 2005 Nullsoft, Inc.
  5. All rights reserved.
  6. Redistribution and use in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8. * Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. * Redistributions in binary form must reproduce the above copyright notice,
  11. this list of conditions and the following disclaimer in the documentation
  12. and/or other materials provided with the distribution.
  13. * Neither the name of Nullsoft nor the names of its contributors may be used to
  14. endorse or promote products derived from this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  16. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  18. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  21. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. #ifndef _R_DEFS_H_
  25. #define _R_DEFS_H_
  26. // base class declaration, compatibility class
  27. class RString;
  28. class C_RBASE {
  29. public:
  30. C_RBASE() { }
  31. virtual ~C_RBASE() { };
  32. virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h)=0; // returns 1 if fbout has dest
  33. virtual HWND conf(HINSTANCE hInstance, HWND hwndParent){return 0;};
  34. virtual char *get_desc()=0;
  35. virtual void load_config(unsigned char *data, int len) { }
  36. virtual int save_config(unsigned char *data) { return 0; }
  37. void load_string(RString &s,unsigned char *data, int &pos, int len);
  38. void save_string(unsigned char *data, int &pos, RString &text);
  39. };
  40. class C_RBASE2 : public C_RBASE {
  41. public:
  42. C_RBASE2() { }
  43. virtual ~C_RBASE2() { };
  44. int getRenderVer2() { return 2; }
  45. virtual int smp_getflags() { return 0; } // return 1 to enable smp support
  46. // returns # of threads you desire, <= max_threads, or 0 to not do anything
  47. // default should return max_threads if you are flexible
  48. virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { return 0; }
  49. virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { };
  50. virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { return 0; }; // return value is that of render() for fbstuff etc
  51. };
  52. // defined in main.cpp, render.cpp
  53. extern char g_path[];
  54. extern unsigned char g_blendtable[256][256];
  55. extern int g_reset_vars_on_recompile;
  56. // use this function to get a global buffer, and the last flag says whether or not to
  57. // allocate it if it's not valid...
  58. #define NBUF 8
  59. void *getGlobalBuffer(int w, int h, int n, int do_alloc);
  60. // implemented in util.cpp
  61. char* GetTextResource(UINT id);
  62. void GR_SelectColor(HWND hwnd, int *a);
  63. void GR_DrawColoredButton(DRAWITEMSTRUCT *di, COLORREF color);
  64. void loadComboBox(HWND dlg, char *ext, char *selectedName);
  65. void compilerfunctionlist(HWND hwndDlg, char *localinfo=NULL);
  66. // matrix.cpp
  67. void matrixRotate(float matrix[], char m, float Deg);
  68. void matrixTranslate(float m[], float x, float y, float z);
  69. void matrixMultiply(float *dest, float src[]);
  70. void matrixApply(float *m, float x, float y, float z, float *outx, float *outy, float *outz);
  71. // linedraw.cpp
  72. extern int g_line_blend_mode;
  73. void line(int *fb, int x1,int y1,int x2,int y2, int width, int height, int color, int lw);
  74. // inlines
  75. static unsigned int __inline BLEND(unsigned int a, unsigned int b)
  76. {
  77. register unsigned int r,t;
  78. r=(a&0xff)+(b&0xff);
  79. t=min(r,0xff);
  80. r=(a&0xff00)+(b&0xff00);
  81. t|=min(r,0xff00);
  82. r=(a&0xff0000)+(b&0xff0000);
  83. t|=min(r,0xff0000);
  84. r=(a&0xff000000)+(b&0xff000000);
  85. return t|min(r,0xff000000);
  86. }
  87. #if 1
  88. #define FASTMAX(x,y) max(x,y)
  89. // (x-(((x-y)>>(32-1))&(x-y))) // hmm not faster :(
  90. #define FASTMIN(x,y) min(x,y)
  91. //(x+(((y-x)>>(32-1))&(y-x)))
  92. #else
  93. #pragma warning( push, 1 )
  94. static __inline int FASTMAX(int x, int y)
  95. {
  96. __asm
  97. {
  98. mov ecx, [x]
  99. mov eax, [y]
  100. sub ecx, eax
  101. cmc
  102. and ecx, edx
  103. add eax, ecx
  104. }
  105. }
  106. static __inline int FASTMIN(int x, int y)
  107. {
  108. __asm
  109. {
  110. mov ecx, [x]
  111. mov eax, [y]
  112. sub ecx, eax
  113. sbb edx, edx
  114. and ecx, edx
  115. add eax, ecx
  116. }
  117. }
  118. #pragma warning( pop )
  119. #endif
  120. static unsigned int __inline BLEND_MAX(unsigned int a, unsigned int b)
  121. {
  122. register unsigned int t;
  123. int _a=a&0xff;
  124. int _b=b&0xff;
  125. t=FASTMAX(_a,_b);
  126. _a=a&0xff00; _b=b&0xff00;
  127. t|=FASTMAX(_a,_b);
  128. _a=a&0xff0000; _b=b&0xff0000;
  129. t|=FASTMAX(_a,_b);
  130. return t;
  131. }
  132. static unsigned int __inline BLEND_MIN(unsigned int a, unsigned int b)
  133. {
  134. #if 1
  135. register unsigned int t;
  136. int _a=a&0xff;
  137. int _b=b&0xff;
  138. t=FASTMIN(_a,_b);
  139. _a=a&0xff00; _b=b&0xff00;
  140. t|=FASTMIN(_a,_b);
  141. _a=a&0xff0000; _b=b&0xff0000;
  142. t|=FASTMIN(_a,_b);
  143. return t;
  144. #else
  145. __asm
  146. {
  147. mov ecx, [a]
  148. mov eax, [b]
  149. and ecx, 0xff
  150. and eax, 0xff
  151. mov esi, [a]
  152. mov ebx, [b]
  153. sub ecx, eax
  154. sbb edx, edx
  155. and esi, 0xff00
  156. and ebx, 0xff00
  157. and ecx, edx
  158. sub esi, ebx
  159. sbb edx, edx
  160. add eax, ecx
  161. and esi, edx
  162. mov ecx, [a]
  163. add ebx, esi
  164. and ecx, 0xff0000
  165. mov esi, [b]
  166. or eax, ebx
  167. and esi, 0xff0000
  168. sub ecx, esi
  169. sbb edx, edx
  170. and ecx, edx
  171. add esi, ecx
  172. or eax, esi
  173. }
  174. #endif
  175. }
  176. #ifdef FASTMAX
  177. #undef FASTMAX
  178. #undef FASTMIN
  179. #endif
  180. static unsigned int __inline BLEND_AVG(unsigned int a, unsigned int b)
  181. {
  182. return ((a>>1)&~((1<<7)|(1<<15)|(1<<23)))+((b>>1)&~((1<<7)|(1<<15)|(1<<23)));
  183. }
  184. static unsigned int __inline BLEND_SUB(unsigned int a, unsigned int b)
  185. {
  186. register int r,t;
  187. r=(a&0xff)-(b&0xff);
  188. t=max(r,0);
  189. r=(a&0xff00)-(b&0xff00);
  190. t|=max(r,0);
  191. r=(a&0xff0000)-(b&0xff0000);
  192. t|=max(r,0);
  193. r=(a&0xff000000)-(b&0xff000000);
  194. return t|max(r,0);
  195. }
  196. #ifdef NO_MMX
  197. #define BLEND_ADJ BLEND_ADJ_NOMMX
  198. #endif
  199. static unsigned int __inline BLEND_ADJ_NOMMX(unsigned int a, unsigned int b, int v)
  200. {
  201. register int t;
  202. t=g_blendtable[a&0xFF][v]+g_blendtable[b&0xFF][0xFF-v];
  203. t|=(g_blendtable[(a&0xFF00)>>8][v]+g_blendtable[(b&0xFF00)>>8][0xFF-v])<<8;
  204. t|=(g_blendtable[(a&0xFF0000)>>16][v]+g_blendtable[(b&0xFF0000)>>16][0xFF-v])<<16;
  205. return t;
  206. }
  207. static unsigned int __inline BLEND_MUL(unsigned int a, unsigned int b)
  208. {
  209. register int t;
  210. t=g_blendtable[a&0xFF][b&0xFF];
  211. t|=g_blendtable[(a&0xFF00)>>8][(b&0xFF00)>>8]<<8;
  212. t|=g_blendtable[(a&0xFF0000)>>16][(b&0xFF0000)>>16]<<16;
  213. return t;
  214. }
  215. static __inline void BLEND_LINE(int *fb, int color)
  216. {
  217. register int bm=g_line_blend_mode&0xff;
  218. switch (g_line_blend_mode&0xff)
  219. {
  220. case 1: *fb=BLEND(*fb,color); break;
  221. case 2: *fb=BLEND_MAX(*fb,color); break;
  222. case 3: *fb=BLEND_AVG(*fb,color); break;
  223. case 4: *fb=BLEND_SUB(*fb,color); break;
  224. case 5: *fb=BLEND_SUB(color,*fb); break;
  225. case 6: *fb=BLEND_MUL(*fb,color); break;
  226. case 7: *fb=BLEND_ADJ_NOMMX(*fb,color,(g_line_blend_mode>>8)&0xff); break;
  227. case 8: *fb=*fb^color; break;
  228. case 9: *fb=BLEND_MIN(*fb,color); break;
  229. default: *fb=color; break;
  230. }
  231. }
  232. extern unsigned int const mmx_blend4_revn[2];
  233. extern int const mmx_blend4_zero;
  234. extern int const mmx_blendadj_mask[2];
  235. // NOTE. WHEN USING THIS FUNCTION, BE SURE TO DO 'if (g_mmx_available) __asm emms;' before calling
  236. // any fpu code, or before returning.
  237. #pragma warning( push, 1 )
  238. #ifndef NO_MMX
  239. static unsigned int __inline BLEND_ADJ(unsigned int a, unsigned int b, int v)
  240. {
  241. __asm
  242. {
  243. movd mm3, [v] // VVVVVVVV
  244. movd mm0, [a]
  245. packuswb mm3, mm3 // 0000HHVV
  246. movd mm1, [b]
  247. punpcklwd mm3, mm3 // HHVVHHVV
  248. movq mm4, [mmx_blend4_revn]
  249. punpckldq mm3, mm3 // HHVVHHVV HHVVHHVV
  250. punpcklbw mm0, [mmx_blend4_zero]
  251. pand mm3, [mmx_blendadj_mask]
  252. punpcklbw mm1, [mmx_blend4_zero]
  253. psubw mm4, mm3
  254. pmullw mm0, mm3
  255. pmullw mm1, mm4
  256. paddw mm0, mm1
  257. psrlw mm0, 8
  258. packuswb mm0, mm0
  259. movd eax, mm0
  260. }
  261. }
  262. #endif
  263. static __inline unsigned int BLEND4(unsigned int *p1, unsigned int w, int xp, int yp)
  264. {
  265. #ifdef NO_MMX
  266. register int t;
  267. unsigned char a1,a2,a3,a4;
  268. a1=g_blendtable[255-xp][255-yp];
  269. a2=g_blendtable[xp][255-yp];
  270. a3=g_blendtable[255-xp][yp];
  271. a4=g_blendtable[xp][yp];
  272. t=g_blendtable[p1[0]&0xff][a1]+g_blendtable[p1[1]&0xff][a2]+g_blendtable[p1[w]&0xff][a3]+g_blendtable[p1[w+1]&0xff][a4];
  273. t|=(g_blendtable[(p1[0]>>8)&0xff][a1]+g_blendtable[(p1[1]>>8)&0xff][a2]+g_blendtable[(p1[w]>>8)&0xff][a3]+g_blendtable[(p1[w+1]>>8)&0xff][a4])<<8;
  274. t|=(g_blendtable[(p1[0]>>16)&0xff][a1]+g_blendtable[(p1[1]>>16)&0xff][a2]+g_blendtable[(p1[w]>>16)&0xff][a3]+g_blendtable[(p1[w+1]>>16)&0xff][a4])<<16;
  275. return t;
  276. #else
  277. __asm
  278. {
  279. movd mm6, xp
  280. mov eax, p1
  281. movd mm7, yp
  282. mov esi, w
  283. movq mm4, mmx_blend4_revn
  284. punpcklwd mm6,mm6
  285. movq mm5, mmx_blend4_revn
  286. punpcklwd mm7,mm7
  287. movd mm0, [eax]
  288. punpckldq mm6,mm6
  289. movd mm1, [eax+4]
  290. punpckldq mm7,mm7
  291. movd mm2, [eax+esi*4]
  292. punpcklbw mm0, [mmx_blend4_zero]
  293. movd mm3, [eax+esi*4+4]
  294. psubw mm4, mm6
  295. punpcklbw mm1, [mmx_blend4_zero]
  296. pmullw mm0, mm4
  297. punpcklbw mm2, [mmx_blend4_zero]
  298. pmullw mm1, mm6
  299. punpcklbw mm3, [mmx_blend4_zero]
  300. psubw mm5, mm7
  301. pmullw mm2, mm4
  302. pmullw mm3, mm6
  303. paddw mm0, mm1
  304. // stall (mm0)
  305. psrlw mm0, 8
  306. // stall (waiting for mm3/mm2)
  307. paddw mm2, mm3
  308. pmullw mm0, mm5
  309. psrlw mm2, 8
  310. // stall (mm2)
  311. pmullw mm2, mm7
  312. // stall
  313. // stall (mm2)
  314. paddw mm0, mm2
  315. // stall
  316. psrlw mm0, 8
  317. // stall
  318. packuswb mm0, mm0
  319. // stall
  320. movd eax, mm0
  321. }
  322. #endif
  323. }
  324. static __inline unsigned int BLEND4_16(unsigned int *p1, unsigned int w, int xp, int yp)
  325. {
  326. #ifdef NO_MMX
  327. register int t;
  328. unsigned char a1,a2,a3,a4;
  329. xp=(xp>>8)&0xff;
  330. yp=(yp>>8)&0xff;
  331. a1=g_blendtable[255-xp][255-yp];
  332. a2=g_blendtable[xp][255-yp];
  333. a3=g_blendtable[255-xp][yp];
  334. a4=g_blendtable[xp][yp];
  335. t=g_blendtable[p1[0]&0xff][a1]+g_blendtable[p1[1]&0xff][a2]+g_blendtable[p1[w]&0xff][a3]+g_blendtable[p1[w+1]&0xff][a4];
  336. t|=(g_blendtable[(p1[0]>>8)&0xff][a1]+g_blendtable[(p1[1]>>8)&0xff][a2]+g_blendtable[(p1[w]>>8)&0xff][a3]+g_blendtable[(p1[w+1]>>8)&0xff][a4])<<8;
  337. t|=(g_blendtable[(p1[0]>>16)&0xff][a1]+g_blendtable[(p1[1]>>16)&0xff][a2]+g_blendtable[(p1[w]>>16)&0xff][a3]+g_blendtable[(p1[w+1]>>16)&0xff][a4])<<16;
  338. return t;
  339. #else
  340. __asm
  341. {
  342. movd mm6, xp
  343. mov eax, p1
  344. movd mm7, yp
  345. mov esi, w
  346. movq mm4, mmx_blend4_revn
  347. psrlw mm6, 8
  348. movq mm5, mmx_blend4_revn
  349. psrlw mm7, 8
  350. movd mm0, [eax]
  351. punpcklwd mm6,mm6
  352. movd mm1, [eax+4]
  353. punpcklwd mm7,mm7
  354. movd mm2, [eax+esi*4]
  355. punpckldq mm6,mm6
  356. movd mm3, [eax+esi*4+4]
  357. punpckldq mm7,mm7
  358. punpcklbw mm0, [mmx_blend4_zero]
  359. psubw mm4, mm6
  360. punpcklbw mm1, [mmx_blend4_zero]
  361. pmullw mm0, mm4
  362. punpcklbw mm2, [mmx_blend4_zero]
  363. pmullw mm1, mm6
  364. punpcklbw mm3, [mmx_blend4_zero]
  365. psubw mm5, mm7
  366. pmullw mm2, mm4
  367. pmullw mm3, mm6
  368. paddw mm0, mm1
  369. // stall (mm0)
  370. psrlw mm0, 8
  371. // stall (waiting for mm3/mm2)
  372. paddw mm2, mm3
  373. pmullw mm0, mm5
  374. psrlw mm2, 8
  375. // stall (mm2)
  376. pmullw mm2, mm7
  377. // stall
  378. // stall (mm2)
  379. paddw mm0, mm2
  380. // stall
  381. psrlw mm0, 8
  382. // stall
  383. packuswb mm0, mm0
  384. // stall
  385. movd eax, mm0
  386. }
  387. #endif
  388. }
  389. #pragma warning( pop )
  390. static __inline void mmx_avgblend_block(int *output, int *input, int l)
  391. {
  392. #ifdef NO_MMX
  393. while (l--)
  394. {
  395. *output=BLEND_AVG(*input++,*output);
  396. output++;
  397. }
  398. #else
  399. static int mask[2]=
  400. {
  401. ~((1<<7)|(1<<15)|(1<<23)),
  402. ~((1<<7)|(1<<15)|(1<<23))
  403. };
  404. __asm
  405. {
  406. mov eax, input
  407. mov edi, output
  408. mov ecx, l
  409. shr ecx, 2
  410. align 16
  411. mmx_avgblend_loop:
  412. movq mm0, [eax]
  413. movq mm1, [edi]
  414. psrlq mm0, 1
  415. movq mm2, [eax+8]
  416. psrlq mm1, 1
  417. movq mm3, [edi+8]
  418. psrlq mm2, 1
  419. pand mm0, [mask]
  420. psrlq mm3, 1
  421. pand mm1, [mask]
  422. pand mm2, [mask]
  423. paddusb mm0, mm1
  424. pand mm3, [mask]
  425. add eax, 16
  426. paddusb mm2, mm3
  427. movq [edi], mm0
  428. movq [edi+8], mm2
  429. add edi, 16
  430. dec ecx
  431. jnz mmx_avgblend_loop
  432. emms
  433. };
  434. #endif
  435. }
  436. static __inline void mmx_addblend_block(int *output, int *input, int l)
  437. {
  438. #ifdef NO_MMX
  439. while (l--)
  440. {
  441. *output=BLEND(*input++,*output);
  442. output++;
  443. }
  444. #else
  445. __asm
  446. {
  447. mov eax, input
  448. mov edi, output
  449. mov ecx, l
  450. shr ecx, 2
  451. align 16
  452. mmx_addblend_loop:
  453. movq mm0, [eax]
  454. movq mm1, [edi]
  455. movq mm2, [eax+8]
  456. movq mm3, [edi+8]
  457. paddusb mm0, mm1
  458. paddusb mm2, mm3
  459. add eax, 16
  460. movq [edi], mm0
  461. movq [edi+8], mm2
  462. add edi, 16
  463. dec ecx
  464. jnz mmx_addblend_loop
  465. emms
  466. };
  467. #endif
  468. }
  469. static __inline void mmx_mulblend_block(int *output, int *input, int l)
  470. {
  471. #ifdef NO_MMX
  472. while (l--)
  473. {
  474. *output=BLEND_MUL(*input++,*output);
  475. output++;
  476. }
  477. #else
  478. __asm
  479. {
  480. mov eax, input
  481. mov edi, output
  482. mov ecx, l
  483. shr ecx, 1
  484. align 16
  485. mmx_mulblend_loop:
  486. movd mm0, [eax]
  487. movd mm1, [edi]
  488. movd mm2, [eax+4]
  489. punpcklbw mm0, [mmx_blend4_zero]
  490. movd mm3, [edi+4]
  491. punpcklbw mm1, [mmx_blend4_zero]
  492. punpcklbw mm2, [mmx_blend4_zero]
  493. pmullw mm0, mm1
  494. punpcklbw mm3, [mmx_blend4_zero]
  495. psrlw mm0, 8
  496. pmullw mm2, mm3
  497. packuswb mm0, mm0
  498. psrlw mm2, 8
  499. packuswb mm2, mm2
  500. add eax, 8
  501. movd [edi], mm0
  502. movd [edi+4], mm2
  503. add edi, 8
  504. dec ecx
  505. jnz mmx_mulblend_loop
  506. emms
  507. };
  508. #endif
  509. }
  510. static void __inline mmx_adjblend_block(int *o, int *in1, int *in2, int len, int v)
  511. {
  512. #ifdef NO_MMX
  513. while (len--)
  514. {
  515. *o++=BLEND_ADJ(*in1++,*in2++,inblendval);
  516. }
  517. #else
  518. __asm
  519. {
  520. movd mm3, [v] // VVVVVVVV
  521. mov ecx, len
  522. packuswb mm3, mm3 // 0000HHVV
  523. mov edx, o
  524. punpcklwd mm3, mm3 // HHVVHHVV
  525. mov esi, in1
  526. movq mm4, [mmx_blend4_revn]
  527. punpckldq mm3, mm3 // HHVVHHVV HHVVHHVV
  528. pand mm3, [mmx_blendadj_mask]
  529. mov edi, in2
  530. shr ecx, 1
  531. psubw mm4, mm3
  532. align 16
  533. _mmx_adjblend_loop:
  534. movd mm0, [esi]
  535. movd mm1, [edi]
  536. punpcklbw mm0, [mmx_blend4_zero]
  537. movd mm6, [esi+4]
  538. punpcklbw mm1, [mmx_blend4_zero]
  539. movd mm7, [edi+4]
  540. punpcklbw mm6, [mmx_blend4_zero]
  541. pmullw mm0, mm3
  542. punpcklbw mm7, [mmx_blend4_zero]
  543. pmullw mm1, mm4
  544. pmullw mm6, mm3
  545. pmullw mm7, mm4
  546. paddw mm0, mm1
  547. paddw mm6, mm7
  548. add edi, 8
  549. psrlw mm0, 8
  550. add esi, 8
  551. psrlw mm6, 8
  552. packuswb mm0, mm0
  553. packuswb mm6, mm6
  554. movd [edx], mm0
  555. movd [edx+4], mm6
  556. add edx, 8
  557. dec ecx
  558. jnz _mmx_adjblend_loop
  559. emms
  560. };
  561. #endif
  562. }
  563. class RString
  564. {
  565. public:
  566. RString() { m_str=0; m_size=0; }
  567. ~RString() { if (m_str) GlobalFree(m_str); };
  568. void resize(int size) { m_size=size; if (m_str) GlobalFree(m_str); m_str=0; if (size) m_str=(char*)GlobalAlloc(GPTR,size); }
  569. char *get() { return m_str; }
  570. int getsize() { if (!m_str) return 0; return m_size; }
  571. void assign(char *s) { resize(strlen(s)+1); strcpy(m_str,s); }
  572. void get_from_dlgitem(HWND hwnd, int dlgItem)
  573. {
  574. int l=SendDlgItemMessage(hwnd,dlgItem,WM_GETTEXTLENGTH,0,0);
  575. if ( l < 256) l=256;
  576. resize(l+1+256);
  577. GetDlgItemText(hwnd,dlgItem, m_str, l+1);
  578. m_str[l]=0;
  579. }
  580. private:
  581. char *m_str;
  582. int m_size;
  583. };
  584. void doAVSEvalHighLight(HWND hwndDlg, UINT sub, char *data);
  585. #include "laser/laserline.h"
  586. #endif