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