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