MythTV  master
filters.c
Go to the documentation of this file.
1 /* filter.c version 0.7
2 * contient les filtres applicable a un buffer
3 * creation : 01/10/2000
4 * -ajout de sinFilter()
5 * -ajout de zoomFilter()
6 * -copie de zoomFilter() en zoomFilterRGB(), gérant les 3 couleurs
7 * -optimisation de sinFilter (utilisant une table de sin)
8 * -asm
9 * -optimisation de la procedure de génération du buffer de transformation
10 * la vitesse est maintenant comprise dans [0..128] au lieu de [0..100]
11 */
12 
13 //#define _DEBUG_PIXEL;
14 
15 #include "filters.h"
16 #include "graphic.h"
17 #include "goom_tools.h"
18 #include <stdlib.h>
19 #include <math.h>
20 #include <stdio.h>
21 #include <inttypes.h>
22 
23 #ifdef MMX
24 #define USE_ASM
25 #endif
26 #ifdef POWERPC
27 #define USE_ASM
28 #endif
29 
30 #define EFFECT_DISTORS 4
31 #define EFFECT_DISTORS_SL 2
32 
33 extern volatile guint32 resolx;
34 extern volatile guint32 c_resoly;
35 
36 void c_zoom (unsigned int *expix1, unsigned int *expix2, unsigned int prevX, unsigned int prevY, const signed int *brutS, const signed int *brutD);
37 
38 /* Prototype to keep gcc from spewing warnings */
39 static void select_zoom_filter (void);
40 
41 #ifdef MMX
42 
43 void zoom_filter_xmmx (int prevX, int prevY, unsigned int *expix1, unsigned int *expix2, int *brutS, int *brutD, int buffratio, int precalCoef[16][16]);
45 void zoom_filter_mmx (int prevX, int prevY, unsigned int *expix1, unsigned int *expix2, int *brutS, int *brutD, int buffratio, int precalCoef[16][16]);
46 int zoom_filter_mmx_supported (void);
47 
48 static int zf_use_xmmx = 0;
49 static int zf_use_mmx = 0;
50 
51 static void select_zoom_filter (void) {
52  static int firsttime = 1;
53  if (firsttime){
55  zf_use_xmmx = 1;
56  printf ("Extended MMX detected. Using the fastest method !\n");
57  }
58  else if (zoom_filter_mmx_supported()) {
59  zf_use_mmx = 1;
60  printf ("MMX detected. Using fast method !\n");
61  }
62  else {
63  printf ("Too bad ! No MMX detected.\n");
64  }
65  firsttime = 0;
66  }
67 }
68 
69 #else /* MMX */
70 
71 static void select_zoom_filter (void) {
72  static int firsttime = 1;
73  if (firsttime) {
74  printf ("No MMX support compiled in\n");
75  firsttime = 0;
76  }
77 }
78 
79 #endif /* MMX */
80 
81 
83 
84 #ifdef USE_ASM
85 
86 #ifdef POWERPC
87 #include "altivec.h"
88 extern unsigned int useAltivec;
89 extern const void ppc_zoom (unsigned int *frompixmap, unsigned int *topixmap, unsigned int sizex, unsigned int sizey, unsigned int *brutS, unsigned int *brutD, unsigned int buffratio, int precalCoef[16][16]);
90 
91 #endif /* PowerPC */
92 
93 #endif /* ASM */
94 
95 
96 unsigned int *coeffs = 0, *freecoeffs = 0;
97 
98 signed int *brutS = 0, *freebrutS = 0; // source
99 signed int *brutD = 0, *freebrutD = 0; // dest
100 signed int *brutT = 0, *freebrutT = 0; // temp (en cours de génération)
101 
102 // TODO : virer
103 guint32 *expix1 = 0; // pointeur exporte vers p1
104 guint32 *expix2 = 0; // pointeur exporte vers p2
105 // fin TODO
106 
108 
109 unsigned int prevX = 0, prevY = 0;
110 
111 static int sintable[0x10000];
112 static int vitesse = 127;
113 static char theMode = AMULETTE_MODE;
114 static int waveEffect = 0;
115 static int hypercosEffect = 0;
116 static int vPlaneEffect = 0;
117 static int hPlaneEffect = 0;
118 static char noisify = 2;
119 static int middleX, middleY;
120 
121 //static unsigned char sqrtperte = 16 ;
122 
124 //static int buffratio = 0;
125 int buffratio = 0;
126 
127 #define BUFFPOINTNB 16
128 #define BUFFPOINTMASK 0xffff
129 #define BUFFINCR 0xff
130 
131 #define sqrtperte 16
132 // faire : a % sqrtperte <=> a & pertemask
133 #define PERTEMASK 0xf
134 // faire : a / sqrtperte <=> a >> PERTEDEC
135 #define PERTEDEC 4
136 
137 static int *firedec = 0;
138 
139 
140 // retourne x>>s , en testant le signe de x
141 #define ShiftRight(_x,_s) (((_x)<0) ? -(-(_x)>>(_s)) : ((_x)>>(_s)))
142 
144 int precalCoef[16][16];
145 
146 /* Prototypes to keep gcc from spewing warnings */
147 void generatePrecalCoef (void);
148 void calculatePXandPY (int x, int y, int *px, int *py);
149 void setPixelRGB (Uint * buffer, Uint x, Uint y, Color c);
150 void setPixelRGB_ (Uint * buffer, Uint x, Color c);
151 inline void getPixelRGB (const Uint * buffer, Uint x, Uint y, Color * c);
152 void getPixelRGB_ (const Uint * buffer, Uint x, Color * c);
153 
154 void
156 {
157  static int firstime = 1;
158 
159  if (firstime) {
160  int coefh, coefv;
161 
162  firstime = 0;
163 
164  for (coefh = 0; coefh < 16; coefh++) {
165 
166  for (coefv = 0; coefv < 16; coefv++) {
167  int i;
168  int diffcoeffh;
169  int diffcoeffv;
170 
171  diffcoeffh = sqrtperte - coefh;
172  diffcoeffv = sqrtperte - coefv;
173 
174  // coeffs[myPos] = ((px >> PERTEDEC) + prevX * (py >> PERTEDEC)) <<
175  // 2;
176  if (!(coefh || coefv))
177  i = 255;
178  else {
179  int i1, i2, i3, i4;
180 
181  i1 = diffcoeffh * diffcoeffv;
182  i2 = coefh * diffcoeffv;
183  i3 = diffcoeffh * coefv;
184  i4 = coefh * coefv;
185  if (i1)
186  i1--;
187  if (i2)
188  i2--;
189  if (i3)
190  i3--;
191  if (i4)
192  i4--;
193 
194  i = (i1) | (i2 << 8) | (i3 << 16) | (i4 << 24);
195  }
196  precalCoef[coefh][coefv] = i;
197  }
198  }
199  }
200 }
201 
202 /*
203  calculer px et py en fonction de x,y,middleX,middleY et theMode
204  px et py indique la nouvelle position (en sqrtperte ieme de pixel)
205  (valeur * 16)
206  */
207 /*inline*/ void
208 calculatePXandPY (int x, int y, int *px, int *py)
209 {
210  if (theMode == WATER_MODE) {
211  static int wave = 0;
212  static int wavesp = 0;
213  int yy;
214 
215  yy = y + RAND () % 4 - RAND () % 4 + wave / 10;
216  if (yy < 0)
217  yy = 0;
218  if (yy >= (int)c_resoly)
219  yy = c_resoly - 1;
220 
221  *px = (x << 4) + firedec[yy] + (wave / 10);
222  *py = (y << 4) + 132 - ((vitesse < 131) ? vitesse : 130);
223 
224  wavesp += RAND () % 3 - RAND () % 3;
225  if (wave < -10)
226  wavesp += 2;
227  if (wave > 10)
228  wavesp -= 2;
229  wave += (wavesp / 10) + RAND () % 3 - RAND () % 3;
230  if (wavesp > 100)
231  wavesp = (wavesp * 9) / 10;
232  }
233  else {
234  int dist = 0, vx9, vy9;
235  int vx, vy;
236  int ppx, ppy;
237  int fvitesse = vitesse << 4;
238 
239  if (noisify) {
240  x += RAND () % noisify - RAND () % noisify;
241  y += RAND () % noisify - RAND () % noisify;
242  }
243  vx = (x - middleX) << 9;
244  vy = (y - middleY) << 9;
245 
246  if (hPlaneEffect)
247  vx += hPlaneEffect * (y - middleY);
248  // else vx = (x - middleX) << 9 ;
249 
250  if (vPlaneEffect)
251  vy += vPlaneEffect * (x - middleX);
252  // else vy = (y - middleY) << 9 ;
253 
254  if (waveEffect) {
255  fvitesse *=
256  1024 +
258  [(unsigned short) (dist * 0xffff + EFFECT_DISTORS)], 6);
259  fvitesse /= 1024;
260  }
261 
262  if (hypercosEffect) {
263  vx += ShiftRight (sintable[(-vy + dist) & 0xffff], 1);
264  vy += ShiftRight (sintable[(vx + dist) & 0xffff], 1);
265  }
266 
267  vx9 = ShiftRight (vx, 9);
268  vy9 = ShiftRight (vy, 9);
269  dist = vx9 * vx9 + vy9 * vy9;
270 
271  switch (theMode) {
272  case WAVE_MODE:
273  fvitesse *=
274  1024 +
276  [(unsigned short) (dist * 0xffff * EFFECT_DISTORS)], 6);
277  fvitesse>>=10;
278  break;
279  case CRYSTAL_BALL_MODE:
280  fvitesse += (dist >> (10-EFFECT_DISTORS_SL));
281  break;
282  case AMULETTE_MODE:
283  fvitesse -= (dist >> (4 - EFFECT_DISTORS_SL));
284  break;
285  case SCRUNCH_MODE:
286  fvitesse -= (dist >> (10 - EFFECT_DISTORS_SL));
287  break;
288  case HYPERCOS1_MODE:
289  vx = vx + ShiftRight (sintable[(-vy + dist) & 0xffff], 1);
290  vy = vy + ShiftRight (sintable[(vx + dist) & 0xffff], 1);
291  break;
292  case HYPERCOS2_MODE:
293  vx =
294  vx + ShiftRight (sintable[(-ShiftRight (vy, 1) + dist) & 0xffff], 0);
295  vy =
296  vy + ShiftRight (sintable[(ShiftRight (vx, 1) + dist) & 0xffff], 0);
297  fvitesse = 128 << 4;
298  break;
299  case YONLY_MODE:
300  fvitesse *= 1024 + ShiftRight (sintable[vy & 0xffff], 6);
301  fvitesse >>= 10;
302  break;
303  case SPEEDWAY_MODE:
304  fvitesse -= (ShiftRight(vy,10-EFFECT_DISTORS_SL));
305  break;
306  }
307 
308  if (fvitesse < -3024)
309  fvitesse = -3024;
310 
311  if (vx < 0) // pb avec decalage sur nb negatif
312  ppx = -(-(vx * fvitesse) >> 16);
313  /* 16 = 9 + 7 (7 = nb chiffre virgule de vitesse * (v = 128 => immobile)
314  * * * * * 9 = nb chiffre virgule de vx) */
315  else
316  ppx = ((vx * fvitesse) >> 16);
317 
318  if (vy < 0)
319  ppy = -(-(vy * fvitesse) >> 16);
320  else
321  ppy = ((vy * fvitesse) >> 16);
322 
323  *px = (middleX << 4) + ppx;
324  *py = (middleY << 4) + ppy;
325  }
326 }
327 
328 //#define _DEBUG
329 
330 /*inline*/ void
331 setPixelRGB (Uint * buffer, Uint x, Uint y, Color c)
332 {
333  // buffer[ y*WIDTH + x ] = (c.r<<16)|(c.v<<8)|c.b
334 #ifdef _DEBUG_PIXEL
335  if (x + y * resolx >= resolx * resoly) {
336  fprintf (stderr, "setPixel ERROR : hors du tableau... %i, %i\n", x, y);
337  // exit (1) ;
338  }
339 #endif
340 
341  buffer[y * resolx + x] =
342  (c.b << (BLEU * 8)) | (c.v << (VERT * 8)) | (c.r << (ROUGE * 8));
343 }
344 
345 
346 /*inline*/ void
347 setPixelRGB_ (Uint * buffer, Uint x, Color c)
348 {
349 #ifdef _DEBUG
350  if (x >= resolx * c_resoly) {
351  printf ("setPixel ERROR : hors du tableau... %i\n", x);
352  // exit (1) ;
353  }
354 #endif
355 
356  buffer[x] = (c.r << (ROUGE * 8)) | (c.v << (VERT * 8)) | c.b << (BLEU * 8);
357 }
358 
359 
360 
361 inline void
362 getPixelRGB (const Uint * buffer, Uint x, Uint y, Color * c)
363 {
364 // register unsigned char *tmp8;
365  unsigned int i;
366 
367 #ifdef _DEBUG
368  if (x + y * resolx >= resolx * c_resoly) {
369  printf ("getPixel ERROR : hors du tableau... %i, %i\n", x, y);
370  // exit (1) ;
371  }
372 #endif
373 
374  /* ATTENTION AU PETIT INDIEN */
375  i = *(buffer + (x + y * resolx));
376  c->b = (i >> (BLEU * 8)) & 0xff;
377  c->v = (i >> (VERT * 8)) & 0xff;
378  c->r = (i >> (ROUGE * 8)) & 0xff;
379 }
380 
381 
382 /*inline*/ void
383 getPixelRGB_ (const Uint * buffer, Uint x, Color * c)
384 {
385  register unsigned char *tmp8;
386 
387 #ifdef _DEBUG
388  if (x >= resolx * c_resoly) {
389  printf ("getPixel ERROR : hors du tableau... %i\n", x);
390  // exit (1) ;
391  }
392 #endif
393 
394 #ifdef __BIG_ENDIAN__
395  c->b = *(unsigned char *) (tmp8 = (unsigned char *) (buffer + x));
396  c->r = *(unsigned char *) (++tmp8);
397  c->v = *(unsigned char *) (++tmp8);
398  c->b = *(unsigned char *) (++tmp8);
399 
400 #else
401  /* ATTENTION AU PETIT INDIEN */
402  c->b = *(unsigned char *) (tmp8 = (unsigned char *) (buffer + x));
403  c->v = *(unsigned char *) (++tmp8);
404  c->r = *(unsigned char *) (++tmp8);
405  // *c = (Color) buffer[x+y*WIDTH] ;
406 #endif
407 }
408 
409 
410 void c_zoom (unsigned int *lexpix1, unsigned int *lexpix2,
411  unsigned int lprevX, unsigned int lprevY,
412  const signed int *lbrutS, const signed int *lbrutD)
413 {
414  int myPos;
415  Color couleur;
416 // unsigned int coefv, coefh;
417 
418  unsigned int ax = (lprevX - 1) << PERTEDEC, ay = (lprevY - 1) << PERTEDEC;
419 
420  int bufsize = lprevX * lprevY * 2;
421  int bufwidth = lprevX;
422 
423  lexpix1[0]=lexpix1[lprevX-1]=lexpix1[lprevX*lprevY-1]=lexpix1[lprevX*lprevY-lprevX]=0;
424 
425  for (myPos = 0; myPos < bufsize; myPos += 2) {
426  Color col1, col2, col3, col4;
427  int c1, c2, c3, c4, px, py;
428  int pos;
429  int lcoeffs;
430 
431  int brutSmypos = lbrutS[myPos];
432  int myPos2;
433 
434  myPos2 = myPos + 1;
435 
436  px = brutSmypos + (((lbrutD[myPos] - brutSmypos) * buffratio) >> BUFFPOINTNB);
437  brutSmypos = lbrutS[myPos2];
438  py = brutSmypos + (((lbrutD[myPos2] - brutSmypos) * buffratio) >> BUFFPOINTNB);
439 
440  if (px < 0)
441  px = 0;
442  if (py < 0)
443  py = 0;
444 
445  pos = ((px >> PERTEDEC) + lprevX * (py >> PERTEDEC));
446  // coef en modulo 15
447  lcoeffs = precalCoef[px & PERTEMASK][py & PERTEMASK];
448 
449  if ((py >= (int)ay) || (px >= (int)ax)) {
450  pos = lcoeffs = 0;
451  }
452 
453  getPixelRGB_ (lexpix1, pos, &col1);
454  getPixelRGB_ (lexpix1, pos + 1, &col2);
455  getPixelRGB_ (lexpix1, pos + bufwidth, &col3);
456  getPixelRGB_ (lexpix1, pos + bufwidth + 1, &col4);
457 
458  c1 = lcoeffs;
459  c2 = (c1 & 0x0000ff00) >> 8;
460  c3 = (c1 & 0x00ff0000) >> 16;
461  c4 = (c1 & 0xff000000) >> 24;
462  c1 = c1 & 0xff;
463 
464  couleur.r = col1.r * c1 + col2.r * c2 + col3.r * c3 + col4.r * c4;
465  if (couleur.r > 5)
466  couleur.r -= 5;
467  couleur.r >>= 8;
468 
469  couleur.v = col1.v * c1 + col2.v * c2 + col3.v * c3 + col4.v * c4;
470  if (couleur.v > 5)
471  couleur.v -= 5;
472  couleur.v >>= 8;
473 
474  couleur.b = col1.b * c1 + col2.b * c2 + col3.b * c3 + col4.b * c4;
475  if (couleur.b > 5)
476  couleur.b -= 5;
477  couleur.b >>= 8;
478 
479  setPixelRGB_ (lexpix2, myPos >> 1, couleur);
480  }
481 }
482 
483 #ifdef USE_ASM
484 void setAsmUse (int useIt);
485 int getAsmUse (void);
486 
487 static int use_asm = 1;
488 void
489 setAsmUse (int useIt)
490 {
491  use_asm = useIt;
492 }
493 
494 int
496 {
497  return use_asm;
498 }
499 #endif
500 
501 /*===============================================================*/
502 void
503 zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uint resy, int switchIncr, float switchMult)
504 {
505  register Uint x, y;
506 
507  static unsigned char pertedec = 8;
508  static char firstTime = 1;
509 
510 #define INTERLACE_INCR 16
511 #define INTERLACE_ADD 9
512 #define INTERLACE_AND 0xf
513  static int interlace_start = -2;
514 
515  expix1 = pix1;
516  expix2 = pix2;
517 
519  if ((prevX != resx) || (prevY != resy)) {
520  prevX = resx;
521  prevY = resy;
522 
523  if (brutS)
524  free (freebrutS);
525  brutS = 0;
526  if (brutD)
527  free (freebrutD);
528  brutD = 0;
529  if (brutT)
530  free (freebrutT);
531  brutT = 0;
532 
533  middleX = resx / 2;
534  middleY = resy - 1;
535  firstTime = 1;
536  if (firedec)
537  free (firedec);
538  firedec = 0;
539  }
540 
541  if (interlace_start != -2)
542  zf = NULL;
543 
545  if (zf) {
546  static char reverse = 0; // vitesse inversé..(zoom out)
547  reverse = zf->reverse;
548  vitesse = zf->vitesse;
549  if (reverse)
550  vitesse = 256 - vitesse;
551  pertedec = zf->pertedec;
552  middleX = zf->middleX;
553  middleY = zf->middleY;
554  theMode = zf->mode;
557  waveEffect = zf->waveEffect;
559  noisify = zf->noisify;
560  }
561 
562  /* Silence a gcc warning */
563  (void)pertedec;
564 
566  if (firstTime || zf) {
567 
568  // generation d'une table de sinus
569  if (firstTime) {
570  unsigned short us;
571 
572  firstTime = 0;
575 
576  freebrutS = (signed int *) calloc (resx * resy * 2 + 128, sizeof(signed int));
577  brutS = (signed int *) ((1 + ((uintptr_t) (freebrutS)) / 128) * 128);
578 
579  freebrutD = (signed int *) calloc (resx * resy * 2 + 128, sizeof(signed int));
580  brutD = (signed int *) ((1 + ((uintptr_t) (freebrutD)) / 128) * 128);
581 
582  freebrutT = (signed int *) calloc (resx * resy * 2 + 128, sizeof(signed int));
583  brutT = (signed int *) ((1 + ((uintptr_t) (freebrutT)) / 128) * 128);
584 
586  {
587  int yperte = 0;
588  int yofs;
589 
590  for (y = 0, yofs = 0; y < resy; y++, yofs += resx) {
591  int xofs = yofs << 1;
592  int xperte = 0;
593 
594  for (x = 0; x < resx; x++) {
595  brutS[xofs++] = xperte;
596  brutS[xofs++] = yperte;
597  xperte += sqrtperte;
598  }
599  yperte += sqrtperte;
600  }
601  buffratio = 0;
602  }
603 
604  for (us = 0; us < 0xffff; us++) {
605  sintable[us] = (int) (1024 * sin ((double) us * 360 / (sizeof (sintable) / sizeof (sintable[0]) - 1) * 3.141592 / 180) + .5);
606  }
607 
608  {
609  int loopv;
610  firedec = (int *) malloc (prevY * sizeof (int));
611 
612  for (loopv = prevY; loopv != 0;) {
613  static int decc = 0;
614  static int spdc = 0;
615  static int accel = 0;
616 
617  loopv--;
618  firedec[loopv] = decc;
619  decc += spdc / 10;
620  spdc += RAND () % 3 - RAND () % 3;
621 
622  if (decc > 4)
623  spdc -= 1;
624  if (decc < -4)
625  spdc += 1;
626 
627  if (spdc > 30)
628  spdc = spdc - RAND () % 3 + accel / 10;
629  if (spdc < -30)
630  spdc = spdc + RAND () % 3 + accel / 10;
631 
632  if (decc > 8 && spdc > 1)
633  spdc -= RAND () % 3 - 2;
634 
635  if (decc < -8 && spdc < -1)
636  spdc += RAND () % 3 + 2;
637 
638  if (decc > 8 || decc < -8)
639  decc = decc * 8 / 9;
640 
641  accel += RAND () % 2 - RAND () % 2;
642  if (accel > 20)
643  accel -= 2;
644  if (accel < -20)
645  accel += 2;
646  }
647  }
648  }
649 
650  interlace_start = 0;
651  }
652  // generation du buffer de trans
653  if (interlace_start==-1) {
654 
655  /* sauvegarde de l'etat actuel dans la nouvelle source */
656 
657  y = prevX * prevY * 2;
658  for (x = 0; x < y; x += 2) {
659  int brutSmypos = brutS[x];
660  int x2 = x + 1;
661 
662  brutS[x] =
663  brutSmypos + (((brutD[x] - brutSmypos) * buffratio) >> BUFFPOINTNB);
664  brutSmypos = brutS[x2];
665  brutS[x2] =
666  brutSmypos +
667  (((brutD[x2] - brutSmypos) * buffratio) >> BUFFPOINTNB);
668  }
669  buffratio = 0;
670  }
671 
672  if (interlace_start==-1) {
673  signed int * tmp;
674  tmp = brutD;
675  brutD=brutT;
676  brutT=tmp;
677  tmp = freebrutD;
679  freebrutT=tmp;
680  interlace_start = -2;
681  }
682 
683  if (interlace_start>=0) {
684  int maxEnd = (interlace_start+INTERLACE_INCR);
685  /* creation de la nouvelle destination */
686  for (y = (Uint)interlace_start; (y < (Uint)prevY) && (y < (Uint)maxEnd); y++) {
687  Uint premul_y_prevX = y * prevX * 2;
688  for (x = 0; x < prevX; x++) {
689  int px, py;
690 
691  calculatePXandPY (x, y, &px, &py);
692 
693  brutT[premul_y_prevX] = px;
694  brutT[premul_y_prevX + 1] = py;
695  premul_y_prevX += 2;
696  }
697  }
698  interlace_start += INTERLACE_INCR;
699  if (y >= prevY-1) interlace_start = -1;
700  }
701 
702  if (switchIncr != 0) {
703  buffratio += switchIncr;
704  if (buffratio > BUFFPOINTMASK)
706  }
707 
708  if (switchMult != 1.0F) {
709  buffratio =
710  (int) ((float) BUFFPOINTMASK * (1.0F - switchMult) +
711  (float) buffratio * switchMult);
712  }
713 
714  zoom_width = prevX;
716 
717 #ifdef USE_ASM
718 #ifdef MMX
719  if (zf_use_xmmx)
722  else if (zf_use_mmx)
725  else c_zoom (expix1, expix2, prevX, prevY, brutS, brutD);
726 #endif
727 
728 #ifdef POWERPC
730 #endif
731 #else
733 #endif
734 }
735 
736 void
737 pointFilter (Uint * pix1, Color c, float t1, float t2, float t3, float t4, Uint cycle)
738 {
739  Uint x = (Uint) ((int) (resolx/2) + (int) (t1 * cosf ((float) cycle / t3)));
740  Uint y = (Uint) ((int) (c_resoly/2) + (int) (t2 * sinf ((float) cycle / t4)));
741 
742  if ((x > 1) && (y > 1) && (x < resolx - 2) && (y < c_resoly - 2)) {
743  setPixelRGB (pix1, x + 1, y, c);
744  setPixelRGB (pix1, x, y + 1, c);
745  setPixelRGB (pix1, x + 1, y + 1, WHITE);
746  setPixelRGB (pix1, x + 2, y + 1, c);
747  setPixelRGB (pix1, x + 1, y + 2, c);
748  }
749 }
static int hypercosEffect
Definition: filters.c:115
unsigned short v
Definition: graphic.h:8
int buffratio
modif by jeko : fixedpoint : buffration = (16:16) (donc 0<=buffration<=2^16)
Definition: filters.c:125
void generatePrecalCoef(void)
Definition: filters.c:155
void zoom_filter_xmmx(int prevX, int prevY, unsigned int *expix1, unsigned int *expix2, int *brutS, int *brutD, int buffratio, int precalCoef[16][16])
stderr
Definition: ttvdb.py:1426
void setPixelRGB_(Uint *buffer, Uint x, Color c)
Definition: filters.c:347
void setAsmUse(int useIt)
Definition: filters.c:489
guint32 mmx_zoom_size
Definition: filters.c:82
static int use_asm
Definition: filters.c:487
#define NULL
Definition: H264Parser.h:62
signed int * freebrutD
Definition: filters.c:99
int hPlaneEffect
Definition: filters.h:18
signed int * freebrutT
Definition: filters.c:100
static int waveEffect
Definition: filters.c:114
signed int * brutT
Definition: filters.c:100
unsigned char pertedec
Definition: filters.h:12
#define ROUGE
position des composantes
Definition: goomconfig.h:10
void getPixelRGB(const Uint *buffer, Uint x, Uint y, Color *c)
Definition: filters.c:362
static guint32 cycle
Definition: goom_core.c:36
const void ppc_zoom(unsigned int *frompixmap, unsigned int *topixmap, unsigned int sizex, unsigned int sizey, unsigned int *brutS, unsigned int *brutD, unsigned int buffratio, int precalCoef[16][16])
int vPlaneEffect
Definition: filters.h:19
Definition: graphic.h:6
#define WAVE_MODE
Definition: filters.h:31
unsigned short r
Definition: graphic.h:8
static int middleY
Definition: filters.c:119
static guint32 * tmp
Definition: goom_core.c:35
int getAsmUse(void)
Definition: filters.c:495
#define EFFECT_DISTORS
Definition: filters.c:30
unsigned int * coeffs
Definition: filters.c:96
unsigned int prevY
Definition: filters.c:109
static int hPlaneEffect
Definition: filters.c:117
int zoom_filter_xmmx_supported(void)
unsigned short b
Definition: graphic.h:8
static void select_zoom_filter(void)
Definition: filters.c:51
static int zf_use_mmx
Definition: filters.c:49
unsigned int prevX
Definition: filters.c:109
static int zf_use_xmmx
Definition: filters.c:48
#define BUFFPOINTMASK
Definition: filters.c:128
void getPixelRGB_(const Uint *buffer, Uint x, Color *c)
Definition: filters.c:383
guint32 * expix2
Definition: filters.c:104
#define guint32
Definition: goomconfig.h:35
static int vitesse
Definition: filters.c:112
volatile guint32 resolx
Definition: goom_core.c:65
char noisify
Definition: filters.h:25
static int x2
Definition: mythsocket.cpp:61
#define CRYSTAL_BALL_MODE
Definition: filters.h:32
int waveEffect
Definition: filters.h:21
static char theMode
Definition: filters.c:113
int zoom_filter_mmx_supported(void)
void setPixelRGB(Uint *buffer, Uint x, Uint y, Color c)
Definition: filters.c:331
void c_zoom(unsigned int *expix1, unsigned int *expix2, unsigned int prevX, unsigned int prevY, const signed int *brutS, const signed int *brutD)
Definition: filters.c:410
#define sqrtperte
Definition: filters.c:131
#define BUFFPOINTNB
Definition: filters.c:127
#define YONLY_MODE
Definition: filters.h:38
#define SCRUNCH_MODE
Definition: filters.h:33
void calculatePXandPY(int x, int y, int *px, int *py)
Definition: filters.c:208
void pointFilter(Uint *pix1, Color c, float t1, float t2, float t3, float t4, Uint cycle)
Definition: filters.c:737
int precalCoef[16][16]
modif d'optim by Jeko : precalcul des 4 coefs résultant des 2 pos
Definition: filters.c:144
int hypercosEffect
Definition: filters.h:22
#define INTERLACE_INCR
static int middleX
Definition: filters.c:119
static int * firedec
Definition: filters.c:137
static int vPlaneEffect
Definition: filters.c:116
unsigned int useAltivec
void zoom_filter_mmx(int prevX, int prevY, unsigned int *expix1, unsigned int *expix2, int *brutS, int *brutD, int buffratio, int precalCoef[16][16])
#define PERTEMASK
Definition: filters.c:133
#define PERTEDEC
Definition: filters.c:135
guint32 resoly
Definition: goom_core.c:65
signed int * brutD
Definition: filters.c:99
#define BLEU
Definition: goomconfig.h:11
static int sintable[0x10000]
Definition: filters.c:111
#define WATER_MODE
Definition: filters.h:35
#define HYPERCOS1_MODE
Definition: filters.h:36
signed int * brutS
Definition: filters.c:98
unsigned int * freecoeffs
Definition: filters.c:96
void zoomFilterFastRGB(Uint *pix1, Uint *pix2, ZoomFilterData *zf, Uint resx, Uint resy, int switchIncr, float switchMult)
Definition: filters.c:503
static char noisify
Definition: filters.c:118
guint32 * expix1
Definition: filters.c:103
guint32 zoom_width
Definition: filters.c:107
#define AMULETTE_MODE
Definition: filters.h:34
#define EFFECT_DISTORS_SL
Definition: filters.c:31
const Color WHITE
Definition: graphic.c:4
char reverse
Definition: filters.h:15
volatile guint32 c_resoly
Definition: goom_core.c:65
#define ShiftRight(_x, _s)
Definition: filters.c:141
static int RAND(void)
Definition: goom_tools.h:22
#define VERT
Definition: goomconfig.h:12
signed int * freebrutS
Definition: filters.c:98
#define SPEEDWAY_MODE
Definition: filters.h:39
#define HYPERCOS2_MODE
Definition: filters.h:37
unsigned int Uint
Definition: graphic.h:4