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 s_firsttime = 1;
53  if (s_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  s_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 s_firstime = 1;
158 
159  if (s_firstime) {
160  s_firstime = 0;
161 
162  for (int coefh = 0; coefh < 16; coefh++) {
163 
164  for (int coefv = 0; coefv < 16; coefv++) {
165  int i = 0;
166  int diffcoeffh = sqrtperte - coefh;
167  int diffcoeffv = sqrtperte - coefv;
168 
169  // coeffs[myPos] = ((px >> PERTEDEC) + prevX * (py >> PERTEDEC)) <<
170  // 2;
171  if (!(coefh || coefv))
172  i = 255;
173  else {
174  int i1 = diffcoeffh * diffcoeffv;
175  int i2 = coefh * diffcoeffv;
176  int i3 = diffcoeffh * coefv;
177  int i4 = coefh * coefv;
178  if (i1)
179  i1--;
180  if (i2)
181  i2--;
182  if (i3)
183  i3--;
184  if (i4)
185  i4--;
186 
187  i = (i1) | (i2 << 8) | (i3 << 16) | (i4 << 24);
188  }
189  precalCoef[coefh][coefv] = i;
190  }
191  }
192  }
193 }
194 
195 /*
196  calculer px et py en fonction de x,y,middleX,middleY et theMode
197  px et py indique la nouvelle position (en sqrtperte ieme de pixel)
198  (valeur * 16)
199  */
200 /*inline*/ void
201 calculatePXandPY (int x, int y, int *px, int *py)
202 {
203  if (theMode == WATER_MODE) {
204  static int s_wave = 0;
205  static int s_wavesp = 0;
206 
207  int yy = y + RAND () % 4 - RAND () % 4 + s_wave / 10;
208  if (yy < 0)
209  yy = 0;
210  if (yy >= (int)c_resoly)
211  yy = c_resoly - 1;
212 
213  *px = (x << 4) + firedec[yy] + (s_wave / 10);
214  *py = (y << 4) + 132 - ((vitesse < 131) ? vitesse : 130);
215 
216  // NOLINTNEXTLINE(misc-redundant-expression)
217  s_wavesp += RAND () % 3 - RAND () % 3;
218  if (s_wave < -10)
219  s_wavesp += 2;
220  if (s_wave > 10)
221  s_wavesp -= 2;
222  s_wave += (s_wavesp / 10) + RAND () % 3 - RAND () % 3;
223  if (s_wavesp > 100)
224  s_wavesp = (s_wavesp * 9) / 10;
225  }
226  else {
227  int dist = 0;
228  int fvitesse = vitesse << 4;
229 
230  if (noisify) {
231  // NOLINTNEXTLINE(misc-redundant-expression)
232  x += RAND () % noisify - RAND () % noisify;
233  // NOLINTNEXTLINE(misc-redundant-expression)
234  y += RAND () % noisify - RAND () % noisify;
235  }
236  int vx = (x - middleX) << 9;
237  int vy = (y - middleY) << 9;
238 
239  if (hPlaneEffect)
240  vx += hPlaneEffect * (y - middleY);
241  // else vx = (x - middleX) << 9 ;
242 
243  if (vPlaneEffect)
244  vy += vPlaneEffect * (x - middleX);
245  // else vy = (y - middleY) << 9 ;
246 
247  if (waveEffect) {
248  fvitesse *=
249  1024 +
251  [(unsigned short) (dist * 0xffff + EFFECT_DISTORS)], 6);
252  fvitesse /= 1024;
253  }
254 
255  if (hypercosEffect) {
256  vx += ShiftRight (sintable[(-vy + dist) & 0xffff], 1);
257  vy += ShiftRight (sintable[(vx + dist) & 0xffff], 1);
258  }
259 
260  int vx9 = ShiftRight (vx, 9);
261  int vy9 = ShiftRight (vy, 9);
262  dist = vx9 * vx9 + vy9 * vy9;
263 
264  switch (theMode) {
265  case WAVE_MODE:
266  fvitesse *=
267  1024 +
269  [(unsigned short) (dist * 0xffff * EFFECT_DISTORS)], 6);
270  fvitesse>>=10;
271  break;
272  case CRYSTAL_BALL_MODE:
273  fvitesse += (dist >> (10-EFFECT_DISTORS_SL));
274  break;
275  case AMULETTE_MODE:
276  fvitesse -= (dist >> (4 - EFFECT_DISTORS_SL));
277  break;
278  case SCRUNCH_MODE:
279  fvitesse -= (dist >> (10 - EFFECT_DISTORS_SL));
280  break;
281  case HYPERCOS1_MODE:
282  vx = vx + ShiftRight (sintable[(-vy + dist) & 0xffff], 1);
283  vy = vy + ShiftRight (sintable[(vx + dist) & 0xffff], 1);
284  break;
285  case HYPERCOS2_MODE:
286  vx =
287  vx + ShiftRight (sintable[(-ShiftRight (vy, 1) + dist) & 0xffff], 0);
288  vy =
289  vy + ShiftRight (sintable[(ShiftRight (vx, 1) + dist) & 0xffff], 0);
290  fvitesse = 128 << 4;
291  break;
292  case YONLY_MODE:
293  fvitesse *= 1024 + ShiftRight (sintable[vy & 0xffff], 6);
294  fvitesse >>= 10;
295  break;
296  case SPEEDWAY_MODE:
297  fvitesse -= (ShiftRight(vy,10-EFFECT_DISTORS_SL));
298  break;
299  }
300 
301  if (fvitesse < -3024)
302  fvitesse = -3024;
303 
304  int ppx = 0;
305  int ppy = 0;
306  if (vx < 0) { // pb avec decalage sur nb negatif
307  ppx = -(-(vx * fvitesse) >> 16);
308  /* 16 = 9 + 7 (7 = nb chiffre virgule de vitesse * (v = 128 => immobile)
309  * * * * * 9 = nb chiffre virgule de vx) */
310  } else {
311  ppx = ((vx * fvitesse) >> 16);
312  }
313 
314  if (vy < 0)
315  ppy = -(-(vy * fvitesse) >> 16);
316  else
317  ppy = ((vy * fvitesse) >> 16);
318 
319  *px = (middleX << 4) + ppx;
320  *py = (middleY << 4) + ppy;
321  }
322 }
323 
324 //#define _DEBUG
325 
326 /*inline*/ void
327 setPixelRGB (Uint * buffer, Uint x, Uint y, Color c)
328 {
329  // buffer[ y*WIDTH + x ] = (c.r<<16)|(c.v<<8)|c.b
330 #ifdef _DEBUG_PIXEL
331  if (x + y * resolx >= resolx * resoly) {
332  fprintf (stderr, "setPixel ERROR : hors du tableau... %i, %i\n", x, y);
333  // exit (1) ;
334  }
335 #endif
336 
337  buffer[y * resolx + x] =
338  (c.b << (BLEU * 8)) | (c.v << (VERT * 8)) | (c.r << (ROUGE * 8));
339 }
340 
341 
342 /*inline*/ void
343 setPixelRGB_ (Uint * buffer, Uint x, Color c)
344 {
345 #ifdef _DEBUG
346  if (x >= resolx * c_resoly) {
347  printf ("setPixel ERROR : hors du tableau... %i\n", x);
348  // exit (1) ;
349  }
350 #endif
351 
352  buffer[x] = (c.r << (ROUGE * 8)) | (c.v << (VERT * 8)) | c.b << (BLEU * 8);
353 }
354 
355 
356 
357 inline void
358 getPixelRGB (const Uint * buffer, Uint x, Uint y, Color * c)
359 {
360 #ifdef _DEBUG
361  if (x + y * resolx >= resolx * c_resoly) {
362  printf ("getPixel ERROR : hors du tableau... %i, %i\n", x, y);
363  // exit (1) ;
364  }
365 #endif
366 
367  /* ATTENTION AU PETIT INDIEN */
368  unsigned int i = *(buffer + (x + y * resolx));
369  c->b = (i >> (BLEU * 8)) & 0xff;
370  c->v = (i >> (VERT * 8)) & 0xff;
371  c->r = (i >> (ROUGE * 8)) & 0xff;
372 }
373 
374 
375 /*inline*/ void
376 getPixelRGB_ (const Uint * buffer, Uint x, Color * c)
377 {
378  register unsigned char *tmp8 = NULL;
379 
380 #ifdef _DEBUG
381  if (x >= resolx * c_resoly) {
382  printf ("getPixel ERROR : hors du tableau... %i\n", x);
383  // exit (1) ;
384  }
385 #endif
386 
387 #ifdef __BIG_ENDIAN__
388  c->b = *(unsigned char *) (tmp8 = (unsigned char *) (buffer + x));
389  c->r = *(unsigned char *) (++tmp8);
390  c->v = *(unsigned char *) (++tmp8);
391  c->b = *(unsigned char *) (++tmp8);
392 
393 #else
394  /* ATTENTION AU PETIT INDIEN */
395  c->b = *(unsigned char *) (tmp8 = (unsigned char *) (buffer + x));
396  c->v = *(unsigned char *) (++tmp8);
397  c->r = *(unsigned char *) (++tmp8);
398  // *c = (Color) buffer[x+y*WIDTH] ;
399 #endif
400 }
401 
402 
403 void c_zoom (unsigned int *lexpix1, unsigned int *lexpix2,
404  unsigned int lprevX, unsigned int lprevY,
405  const signed int *lbrutS, const signed int *lbrutD)
406 {
407  Color couleur;
408 // unsigned int coefv, coefh;
409 
410  unsigned int ax = (lprevX - 1) << PERTEDEC;
411  unsigned int ay = (lprevY - 1) << PERTEDEC;
412 
413  int bufsize = lprevX * lprevY * 2;
414  int bufwidth = lprevX;
415 
416  lexpix1[0]=lexpix1[lprevX-1]=lexpix1[lprevX*lprevY-1]=lexpix1[lprevX*lprevY-lprevX]=0;
417 
418  for (int myPos = 0; myPos < bufsize; myPos += 2) {
419  Color col1;
420  Color col2;
421  Color col3;
422  Color col4;
423  int brutSmypos = lbrutS[myPos];
424 
425  int myPos2 = myPos + 1;
426 
427  int px = brutSmypos + (((lbrutD[myPos] - brutSmypos) * buffratio) >> BUFFPOINTNB);
428  brutSmypos = lbrutS[myPos2];
429  int py = brutSmypos + (((lbrutD[myPos2] - brutSmypos) * buffratio) >> BUFFPOINTNB);
430 
431  if (px < 0)
432  px = 0;
433  if (py < 0)
434  py = 0;
435 
436  int pos = ((px >> PERTEDEC) + lprevX * (py >> PERTEDEC));
437  // coef en modulo 15
438  int lcoeffs = precalCoef[px & PERTEMASK][py & PERTEMASK];
439 
440  if ((py >= (int)ay) || (px >= (int)ax)) {
441  pos = lcoeffs = 0;
442  }
443 
444  getPixelRGB_ (lexpix1, pos, &col1);
445  getPixelRGB_ (lexpix1, pos + 1, &col2);
446  getPixelRGB_ (lexpix1, pos + bufwidth, &col3);
447  getPixelRGB_ (lexpix1, pos + bufwidth + 1, &col4);
448 
449  int c1 = lcoeffs;
450  int c2 = (c1 & 0x0000ff00) >> 8;
451  int c3 = (c1 & 0x00ff0000) >> 16;
452  int c4 = (c1 & 0xff000000) >> 24;
453  c1 = c1 & 0xff;
454 
455  couleur.r = col1.r * c1 + col2.r * c2 + col3.r * c3 + col4.r * c4;
456  if (couleur.r > 5)
457  couleur.r -= 5;
458  couleur.r >>= 8;
459 
460  couleur.v = col1.v * c1 + col2.v * c2 + col3.v * c3 + col4.v * c4;
461  if (couleur.v > 5)
462  couleur.v -= 5;
463  couleur.v >>= 8;
464 
465  couleur.b = col1.b * c1 + col2.b * c2 + col3.b * c3 + col4.b * c4;
466  if (couleur.b > 5)
467  couleur.b -= 5;
468  couleur.b >>= 8;
469 
470  setPixelRGB_ (lexpix2, myPos >> 1, couleur);
471  }
472 }
473 
474 #ifdef USE_ASM
475 void setAsmUse (int useIt);
476 int getAsmUse (void);
477 
478 static int use_asm = 1;
479 void
480 setAsmUse (int useIt)
481 {
482  use_asm = useIt;
483 }
484 
485 int
487 {
488  return use_asm;
489 }
490 #endif
491 
492 /*===============================================================*/
493 void
494 zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uint resy, int switchIncr, float switchMult)
495 {
496  static unsigned char s_pertedec = 8;
497  static char s_firstTime = 1;
498 
499 #define INTERLACE_INCR 16
500 #define INTERLACE_ADD 9
501 #define INTERLACE_AND 0xf
502  static int s_interlaceStart = -2;
503 
504  expix1 = pix1;
505  expix2 = pix2;
506 
508  if ((prevX != resx) || (prevY != resy)) {
509  prevX = resx;
510  prevY = resy;
511 
512  if (brutS)
513  free (freebrutS);
514  brutS = 0;
515  if (brutD)
516  free (freebrutD);
517  brutD = 0;
518  if (brutT)
519  free (freebrutT);
520  brutT = 0;
521 
522  middleX = resx / 2;
523  middleY = resy - 1;
524  s_firstTime = 1;
525  if (firedec)
526  free (firedec);
527  firedec = 0;
528  }
529 
530  if (s_interlaceStart != -2)
531  zf = NULL;
532 
534  if (zf) {
535  static char s_reverse = 0; // vitesse inversé..(zoom out)
536  s_reverse = zf->reverse;
537  vitesse = zf->vitesse;
538  if (s_reverse)
539  vitesse = 256 - vitesse;
540  s_pertedec = zf->pertedec;
541  middleX = zf->middleX;
542  middleY = zf->middleY;
543  theMode = zf->mode;
546  waveEffect = zf->waveEffect;
548  noisify = zf->noisify;
549  }
550 
551  /* Silence a gcc warning */
552  (void)s_pertedec;
553 
555  if (s_firstTime || zf) {
556 
557  // generation d'une table de sinus
558  if (s_firstTime) {
559  s_firstTime = 0;
562 
563  freebrutS = (signed int *) calloc (resx * resy * 2 + 128, sizeof(signed int));
564  brutS = (signed int *) ((1 + ((uintptr_t) (freebrutS)) / 128) * 128);
565 
566  freebrutD = (signed int *) calloc (resx * resy * 2 + 128, sizeof(signed int));
567  brutD = (signed int *) ((1 + ((uintptr_t) (freebrutD)) / 128) * 128);
568 
569  freebrutT = (signed int *) calloc (resx * resy * 2 + 128, sizeof(signed int));
570  brutT = (signed int *) ((1 + ((uintptr_t) (freebrutT)) / 128) * 128);
571 
573  {
574  int yperte = 0;
575  int yofs = 0;
576 
577  for (Uint y = 0; y < resy; y++, yofs += resx) {
578  int xofs = yofs << 1;
579  int xperte = 0;
580 
581  for (Uint x = 0; x < resx; x++) {
582  brutS[xofs++] = xperte;
583  brutS[xofs++] = yperte;
584  xperte += sqrtperte;
585  }
586  yperte += sqrtperte;
587  }
588  buffratio = 0;
589  }
590 
591  for (uint16_t us = 0; us < 0xffff; us++) {
592  sintable[us] =
593  roundf(1024 * sinf ((float) us * 360
594  / ((float)sizeof (sintable)
595  / sizeof (sintable[0]) - 1)
596  * 3.141592F / 180));
597  }
598 
599  {
600  firedec = (int *) malloc (prevY * sizeof (int));
601 
602  for (int loopv = prevY; loopv != 0;) {
603  static int s_decc = 0;
604  static int s_spdc = 0;
605  static int s_accel = 0;
606 
607  loopv--;
608  firedec[loopv] = s_decc;
609  s_decc += s_spdc / 10;
610  // NOLINTNEXTLINE(misc-redundant-expression)
611  s_spdc += RAND () % 3 - RAND () % 3;
612 
613  if (s_decc > 4)
614  s_spdc -= 1;
615  if (s_decc < -4)
616  s_spdc += 1;
617 
618  if (s_spdc > 30)
619  s_spdc = s_spdc - RAND () % 3 + s_accel / 10;
620  if (s_spdc < -30)
621  s_spdc = s_spdc + RAND () % 3 + s_accel / 10;
622 
623  if (s_decc > 8 && s_spdc > 1)
624  s_spdc -= RAND () % 3 - 2;
625 
626  if (s_decc < -8 && s_spdc < -1)
627  s_spdc += RAND () % 3 + 2;
628 
629  if (s_decc > 8 || s_decc < -8)
630  s_decc = s_decc * 8 / 9;
631 
632  // NOLINTNEXTLINE(misc-redundant-expression)
633  s_accel += RAND () % 2 - RAND () % 2;
634  if (s_accel > 20)
635  s_accel -= 2;
636  if (s_accel < -20)
637  s_accel += 2;
638  }
639  }
640  }
641 
642  s_interlaceStart = 0;
643  }
644  // generation du buffer de trans
645  if (s_interlaceStart==-1) {
646 
647  /* sauvegarde de l'etat actuel dans la nouvelle source */
648 
649  Uint y = prevX * prevY * 2;
650  for (Uint x = 0; x < y; x += 2) {
651  int brutSmypos = brutS[x];
652  int x2 = x + 1;
653 
654  brutS[x] =
655  brutSmypos + (((brutD[x] - brutSmypos) * buffratio) >> BUFFPOINTNB);
656  brutSmypos = brutS[x2];
657  brutS[x2] =
658  brutSmypos +
659  (((brutD[x2] - brutSmypos) * buffratio) >> BUFFPOINTNB);
660  }
661  buffratio = 0;
662  }
663 
664  if (s_interlaceStart==-1) {
665  signed int * tmp = brutD;
666  brutD=brutT;
667  brutT=tmp;
668  tmp = freebrutD;
670  freebrutT=tmp;
671  s_interlaceStart = -2;
672  }
673 
674  if (s_interlaceStart>=0) {
675  int maxEnd = (s_interlaceStart+INTERLACE_INCR);
676  /* creation de la nouvelle destination */
677  Uint y = (Uint)s_interlaceStart;
678  for ( ; (y < (Uint)prevY) && (y < (Uint)maxEnd); y++) {
679  Uint premul_y_prevX = y * prevX * 2;
680  for (Uint x = 0; x < prevX; x++) {
681  int px = 0;
682  int py = 0;
683 
684  calculatePXandPY (x, y, &px, &py);
685 
686  brutT[premul_y_prevX] = px;
687  brutT[premul_y_prevX + 1] = py;
688  premul_y_prevX += 2;
689  }
690  }
691  s_interlaceStart += INTERLACE_INCR;
692  if (y >= prevY-1) s_interlaceStart = -1;
693  }
694 
695  if (switchIncr != 0) {
696  buffratio += switchIncr;
697  if (buffratio > BUFFPOINTMASK)
699  }
700 
701  if (switchMult != 1.0F) {
702  buffratio =
703  (int) ((float) BUFFPOINTMASK * (1.0F - switchMult) +
704  (float) buffratio * switchMult);
705  }
706 
707  zoom_width = prevX;
709 
710 #ifdef USE_ASM
711 #ifdef MMX
712  if (zf_use_xmmx) {
715  } else if (zf_use_mmx) {
718  } else {
720  }
721 #endif
722 
723 #ifdef POWERPC
725 #endif
726 #else
728 #endif
729 }
730 
731 void
732 pointFilter (Uint * pix1, Color c, float t1, float t2, float t3, float t4, Uint cycle)
733 {
734  Uint x = (Uint) ((int) (resolx/2) + (int) (t1 * cosf ((float) cycle / t3)));
735  Uint y = (Uint) ((int) (c_resoly/2) + (int) (t2 * sinf ((float) cycle / t4)));
736 
737  if ((x > 1) && (y > 1) && (x < resolx - 2) && (y < c_resoly - 2)) {
738  setPixelRGB (pix1, x + 1, y, c);
739  setPixelRGB (pix1, x, y + 1, c);
740  setPixelRGB (pix1, x + 1, y + 1, WHITE);
741  setPixelRGB (pix1, x + 2, y + 1, c);
742  setPixelRGB (pix1, x + 1, y + 2, c);
743  }
744 }
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:343
void setAsmUse(int useIt)
Definition: filters.c:480
guint32 mmx_zoom_size
Definition: filters.c:82
static int use_asm
Definition: filters.c:478
#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:358
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:486
#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:376
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:327
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:403
#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:201
void pointFilter(Uint *pix1, Color c, float t1, float t2, float t3, float t4, Uint cycle)
Definition: filters.c:732
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])
unsigned short uint16_t
Definition: iso6937tables.h:1
#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:494
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