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