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"
25 
26 #ifdef MMX
27 #define USE_ASM
28 #endif
29 #ifdef POWERPC
30 #define USE_ASM
31 #endif
32 
33 static constexpr int8_t EFFECT_DISTORS { 4 };
34 static constexpr int8_t 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 static constexpr uint8_t BUFFPOINTNB { 16 };
129 static constexpr int32_t BUFFPOINTMASK { 0xffff };
130 //static constexpr uint8_t BUFFINCR { 0xff };
131 
132 static constexpr int8_t sqrtperte { 16 };
133 // faire : a % sqrtperte <=> a & pertemask
134 static constexpr int8_t PERTEMASK { 0xf };
135 // faire : a / sqrtperte <=> a >> PERTEDEC
136 static constexpr uint8_t PERTEDEC { 4 };
137 
138 static int *firedec = nullptr;
139 
140 
141 // retourne x>>s , en testant le signe de x
142 static inline int ShiftRight(int x,int s) {return (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 +
251  ShiftRight (sintable[(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 +
268  ShiftRight (sintable[(unsigned short) (dist * 0xffff * EFFECT_DISTORS)], 6);
269  fvitesse>>=10;
270  break;
271  case CRYSTAL_BALL_MODE:
272  fvitesse += (dist >> (10-EFFECT_DISTORS_SL));
273  break;
274  case AMULETTE_MODE:
275  fvitesse -= (dist >> (4 - EFFECT_DISTORS_SL));
276  break;
277  case SCRUNCH_MODE:
278  fvitesse -= (dist >> (10 - EFFECT_DISTORS_SL));
279  break;
280  case HYPERCOS1_MODE:
281  vx = vx + ShiftRight (sintable[(-vy + dist) & 0xffff], 1);
282  vy = vy + ShiftRight (sintable[(vx + dist) & 0xffff], 1);
283  break;
284  case HYPERCOS2_MODE:
285  vx =
286  vx + ShiftRight (sintable[(-ShiftRight (vy, 1) + dist) & 0xffff], 0);
287  vy =
288  vy + ShiftRight (sintable[(ShiftRight (vx, 1) + dist) & 0xffff], 0);
289  fvitesse = 128 << 4;
290  break;
291  case YONLY_MODE:
292  fvitesse *= 1024 + ShiftRight (sintable[vy & 0xffff], 6);
293  fvitesse >>= 10;
294  break;
295  case SPEEDWAY_MODE:
296  fvitesse -= (ShiftRight(vy,10-EFFECT_DISTORS_SL));
297  break;
298  }
299 
300  if (fvitesse < -3024)
301  fvitesse = -3024;
302 
303  int ppx = 0;
304  int ppy = 0;
305  if (vx < 0) { // pb avec decalage sur nb negatif
306  ppx = -(-(vx * fvitesse) >> 16);
307  /* 16 = 9 + 7 (7 = nb chiffre virgule de vitesse * (v = 128 => immobile)
308  * * * * * 9 = nb chiffre virgule de vx) */
309  } else {
310  ppx = ((vx * fvitesse) >> 16);
311  }
312 
313  if (vy < 0)
314  ppy = -(-(vy * fvitesse) >> 16);
315  else
316  ppy = ((vy * fvitesse) >> 16);
317 
318  *px = (middleX << 4) + ppx;
319  *py = (middleY << 4) + ppy;
320  }
321 }
322 
323 //#define _DEBUG
324 
325 /*inline*/ void
326 setPixelRGB (Uint * buffer, Uint x, Uint y, Color c)
327 {
328  // buffer[ y*WIDTH + x ] = (c.r<<16)|(c.v<<8)|c.b
329 #ifdef _DEBUG_PIXEL
330  if (x + y * resolx >= resolx * resoly) {
331  fprintf (stderr, "setPixel ERROR : hors du tableau... %i, %i\n", x, y);
332  // exit (1) ;
333  }
334 #endif
335 
336  buffer[y * resolx + x] =
337  (c.b << (BLEU * 8)) | (c.v << (VERT * 8)) | (c.r << (ROUGE * 8));
338 }
339 
340 
341 /*inline*/ void
342 setPixelRGB_ (Uint * buffer, Uint x, Color c)
343 {
344 #ifdef _DEBUG
345  if (x >= resolx * c_resoly) {
346  printf ("setPixel ERROR : hors du tableau... %i\n", x);
347  // exit (1) ;
348  }
349 #endif
350 
351  buffer[x] = (c.r << (ROUGE * 8)) | (c.v << (VERT * 8)) | c.b << (BLEU * 8);
352 }
353 
354 
355 
356 inline void
357 getPixelRGB (const Uint * buffer, Uint x, Uint y, Color * c)
358 {
359 #ifdef _DEBUG
360  if (x + y * resolx >= resolx * c_resoly) {
361  printf ("getPixel ERROR : hors du tableau... %i, %i\n", x, y);
362  // exit (1) ;
363  }
364 #endif
365 
366  /* ATTENTION AU PETIT INDIEN */
367  unsigned int i = *(buffer + (x + y * resolx));
368  c->b = (i >> (BLEU * 8)) & 0xff;
369  c->v = (i >> (VERT * 8)) & 0xff;
370  c->r = (i >> (ROUGE * 8)) & 0xff;
371 }
372 
373 
374 /*inline*/ void
375 getPixelRGB_ (const Uint * buffer, Uint x, Color * c)
376 {
377  unsigned char *tmp8 = nullptr;
378 
379 #ifdef _DEBUG
380  if (x >= resolx * c_resoly) {
381  printf ("getPixel ERROR : hors du tableau... %i\n", x);
382  // exit (1) ;
383  }
384 #endif
385 
386 #ifdef __BIG_ENDIAN__
387  c->b = *(unsigned char *) (tmp8 = (unsigned char *) (buffer + x));
388  c->r = *(unsigned char *) (++tmp8);
389  c->v = *(unsigned char *) (++tmp8);
390  c->b = *(unsigned char *) (++tmp8);
391 
392 #else
393  /* ATTENTION AU PETIT INDIEN */
394  c->b = *(tmp8 = (unsigned char *) (buffer + x));
395  c->v = *(++tmp8);
396  c->r = *(++tmp8);
397  // *c = (Color) buffer[x+y*WIDTH] ;
398 #endif
399 }
400 
401 
402 void c_zoom (unsigned int *lexpix1, unsigned int *lexpix2,
403  unsigned int lprevX, unsigned int lprevY,
404  const signed int *lbrutS, const signed int *lbrutD)
405 {
406  Color couleur {};
407 // unsigned int coefv, coefh;
408 
409  unsigned int ax = (lprevX - 1) << PERTEDEC;
410  unsigned int ay = (lprevY - 1) << PERTEDEC;
411 
412  int bufsize = lprevX * lprevY * 2;
413  int bufwidth = lprevX;
414 
415  lexpix1[0]=lexpix1[lprevX-1]=lexpix1[lprevX*lprevY-1]=lexpix1[lprevX*lprevY-lprevX]=0;
416 
417  for (int myPos = 0; myPos < bufsize; myPos += 2) {
418  Color col1 {};
419  Color col2 {};
420  Color col3 {};
421  Color col4 {};
422  int brutSmypos = lbrutS[myPos];
423 
424  int myPos2 = myPos + 1;
425 
426  int px = brutSmypos + (((lbrutD[myPos] - brutSmypos) * buffratio) >> BUFFPOINTNB);
427  brutSmypos = lbrutS[myPos2];
428  int py = brutSmypos + (((lbrutD[myPos2] - brutSmypos) * buffratio) >> BUFFPOINTNB);
429 
430  if (px < 0)
431  px = 0;
432  if (py < 0)
433  py = 0;
434 
435  int pos = ((px >> PERTEDEC) + lprevX * (py >> PERTEDEC));
436  // coef en modulo 15
437  int lcoeffs = precalCoef[px & PERTEMASK][py & PERTEMASK];
438 
439  if ((py >= (int)ay) || (px >= (int)ax)) {
440  pos = lcoeffs = 0;
441  }
442 
443  getPixelRGB_ (lexpix1, pos, &col1);
444  getPixelRGB_ (lexpix1, pos + 1, &col2);
445  getPixelRGB_ (lexpix1, pos + bufwidth, &col3);
446  getPixelRGB_ (lexpix1, pos + bufwidth + 1, &col4);
447 
448  int c1 = lcoeffs;
449  int c2 = (c1 & 0x0000ff00) >> 8;
450  int c3 = (c1 & 0x00ff0000) >> 16;
451  int c4 = (c1 & 0xff000000) >> 24;
452  c1 = c1 & 0xff;
453 
454  couleur.r = col1.r * c1 + col2.r * c2 + col3.r * c3 + col4.r * c4;
455  if (couleur.r > 5)
456  couleur.r -= 5;
457  couleur.r >>= 8;
458 
459  couleur.v = col1.v * c1 + col2.v * c2 + col3.v * c3 + col4.v * c4;
460  if (couleur.v > 5)
461  couleur.v -= 5;
462  couleur.v >>= 8;
463 
464  couleur.b = col1.b * c1 + col2.b * c2 + col3.b * c3 + col4.b * c4;
465  if (couleur.b > 5)
466  couleur.b -= 5;
467  couleur.b >>= 8;
468 
469  setPixelRGB_ (lexpix2, myPos >> 1, couleur);
470  }
471 }
472 
473 #ifdef USE_ASM
474 void setAsmUse (int useIt);
475 int getAsmUse (void);
476 
477 static int use_asm = 1;
478 void
479 setAsmUse (int useIt)
480 {
481  use_asm = useIt;
482 }
483 
484 int
486 {
487  return use_asm;
488 }
489 #endif
490 
491 /*===============================================================*/
492 void
493 zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uint resy, int switchIncr, float switchMult)
494 {
495  [[maybe_unused]] static unsigned char s_pertedec = 8;
496  static char s_firstTime = 1;
497 
498  static constexpr int8_t INTERLACE_INCR { 16 };
499  //static constexpr int8_t INTERLACE_ADD { 9 };
500  //static constexpr int8_t INTERLACE_AND { 0xf };
501  static int s_interlaceStart = -2;
502 
503  expix1 = pix1;
504  expix2 = pix2;
505 
507  if ((prevX != resx) || (prevY != resy)) {
508  prevX = resx;
509  prevY = resy;
510 
511  if (brutS)
512  free (freebrutS);
513  brutS = nullptr;
514  if (brutD)
515  free (freebrutD);
516  brutD = nullptr;
517  if (brutT)
518  free (freebrutT);
519  brutT = nullptr;
520 
521  middleX = resx / 2;
522  middleY = resy - 1;
523  s_firstTime = 1;
524  if (firedec)
525  free (firedec);
526  firedec = nullptr;
527  }
528 
529  if (s_interlaceStart != -2)
530  zf = nullptr;
531 
533  if (zf) {
534  static bool s_reverse = false; // vitesse inversé..(zoom out)
535  s_reverse = zf->reverse;
536  vitesse = zf->vitesse;
537  if (s_reverse)
538  vitesse = 256 - vitesse;
539  s_pertedec = zf->pertedec;
540  middleX = zf->middleX;
541  middleY = zf->middleY;
542  theMode = zf->mode;
545  waveEffect = zf->waveEffect;
547  noisify = zf->noisify;
548  }
549 
551  if (s_firstTime || zf) {
552 
553  // generation d'une table de sinus
554  if (s_firstTime) {
555  s_firstTime = 0;
558 
559  freebrutS = (signed int *) calloc (resx * resy * 2 + 128, sizeof(signed int));
560  brutS = (signed int *) ((1 + ((uintptr_t) (freebrutS)) / 128) * 128);
561 
562  freebrutD = (signed int *) calloc (resx * resy * 2 + 128, sizeof(signed int));
563  brutD = (signed int *) ((1 + ((uintptr_t) (freebrutD)) / 128) * 128);
564 
565  freebrutT = (signed int *) calloc (resx * resy * 2 + 128, sizeof(signed int));
566  brutT = (signed int *) ((1 + ((uintptr_t) (freebrutT)) / 128) * 128);
567 
569  {
570  int yperte = 0;
571  int yofs = 0;
572 
573  for (Uint y = 0; y < resy; y++, yofs += resx) {
574  int xofs = yofs << 1;
575  int xperte = 0;
576 
577  for (Uint x = 0; x < resx; x++) {
578  brutS[xofs++] = xperte;
579  brutS[xofs++] = yperte;
580  xperte += sqrtperte;
581  }
582  yperte += sqrtperte;
583  }
584  buffratio = 0;
585  }
586 
587  for (uint16_t us = 0; us < 0xffff; us++) {
588  sintable[us] =
589  roundf(1024 * sinf ((float) us * 360
590  / ((float)sintable.size() - 1)
591  * 3.141592F / 180));
592  }
593 
594  {
595  firedec = (int *) malloc (prevY * sizeof (int));
596 
597  for (int loopv = prevY; loopv != 0;) {
598  static int s_decc = 0;
599  static int s_spdc = 0;
600  static int s_accel = 0;
601 
602  loopv--;
603  firedec[loopv] = s_decc;
604  s_decc += s_spdc / 10;
605  // NOLINTNEXTLINE(misc-redundant-expression)
606  s_spdc += RAND () % 3 - RAND () % 3;
607 
608  if (s_decc > 4)
609  s_spdc -= 1;
610  if (s_decc < -4)
611  s_spdc += 1;
612 
613  if (s_spdc > 30)
614  s_spdc = s_spdc - RAND () % 3 + s_accel / 10;
615  if (s_spdc < -30)
616  s_spdc = s_spdc + RAND () % 3 + s_accel / 10;
617 
618  if (s_decc > 8 && s_spdc > 1)
619  s_spdc -= RAND () % 3 - 2;
620 
621  if (s_decc < -8 && s_spdc < -1)
622  s_spdc += RAND () % 3 + 2;
623 
624  if (s_decc > 8 || s_decc < -8)
625  s_decc = s_decc * 8 / 9;
626 
627  // NOLINTNEXTLINE(misc-redundant-expression)
628  s_accel += RAND () % 2 - RAND () % 2;
629  if (s_accel > 20)
630  s_accel -= 2;
631  if (s_accel < -20)
632  s_accel += 2;
633  }
634  }
635  }
636 
637  s_interlaceStart = 0;
638  }
639  // generation du buffer de trans
640  if (s_interlaceStart==-1) {
641 
642  /* sauvegarde de l'etat actuel dans la nouvelle source */
643 
644  Uint y = prevX * prevY * 2;
645  for (Uint x = 0; x < y; x += 2) {
646  int brutSmypos = brutS[x];
647  int x2 = x + 1;
648 
649  brutS[x] =
650  brutSmypos + (((brutD[x] - brutSmypos) * buffratio) >> BUFFPOINTNB);
651  brutSmypos = brutS[x2];
652  brutS[x2] =
653  brutSmypos +
654  (((brutD[x2] - brutSmypos) * buffratio) >> BUFFPOINTNB);
655  }
656  buffratio = 0;
657 
658  signed int * tmp = brutD;
659  brutD=brutT;
660  brutT=tmp;
661  tmp = freebrutD;
663  freebrutT=tmp;
664  s_interlaceStart = -2;
665  }
666 
667  if (s_interlaceStart>=0) {
668  int maxEnd = (s_interlaceStart+INTERLACE_INCR);
669  /* creation de la nouvelle destination */
670  Uint y = (Uint)s_interlaceStart;
671  for ( ; (y < (Uint)prevY) && (y < (Uint)maxEnd); y++) {
672  Uint premul_y_prevX = y * prevX * 2;
673  for (Uint x = 0; x < prevX; x++) {
674  int px = 0;
675  int py = 0;
676 
677  calculatePXandPY (x, y, &px, &py);
678 
679  brutT[premul_y_prevX] = px;
680  brutT[premul_y_prevX + 1] = py;
681  premul_y_prevX += 2;
682  }
683  }
684  s_interlaceStart += INTERLACE_INCR;
685  if (y >= prevY-1) s_interlaceStart = -1;
686  }
687 
688  if (switchIncr != 0) {
689  buffratio += switchIncr;
690  if (buffratio > BUFFPOINTMASK)
692  }
693 
694  if (switchMult != 1.0F) {
695  buffratio =
696  (int) ((float) BUFFPOINTMASK * (1.0F - switchMult) +
697  (float) buffratio * switchMult);
698  }
699 
700  zoom_width = prevX;
702 
703 #ifdef USE_ASM
704 #ifdef MMX
705  if (zf_use_xmmx) {
708  } else if (zf_use_mmx) {
711  } else {
713  }
714 #endif
715 
716 #ifdef POWERPC
718 #endif
719 #else
721 #endif
722 }
723 
724 void
725 pointFilter (Uint * pix1, Color c, float t1, float t2, float t3, float t4, Uint cycle)
726 {
727  Uint x = (Uint) ((int) (resolx/2) + (int) (t1 * cosf ((float) cycle / t3)));
728  Uint y = (Uint) ((int) (c_resoly/2) + (int) (t2 * sinf ((float) cycle / t4)));
729 
730  if ((x > 1) && (y > 1) && (x < resolx - 2) && (y < c_resoly - 2)) {
731  setPixelRGB (pix1, x + 1, y, c);
732  setPixelRGB (pix1, x, y + 1, c);
733  setPixelRGB (pix1, x + 1, y + 1, WHITE);
734  setPixelRGB (pix1, x + 2, y + 1, c);
735  setPixelRGB (pix1, x + 1, y + 2, c);
736  }
737 }
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:29
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
zoom_width
guint32 zoom_width
Definition: filters.cpp:108
hypercosEffect
static bool hypercosEffect
Definition: filters.cpp:116
graphic.h
use_asm
static int use_asm
Definition: filters.cpp:477
freecoeffs
unsigned int * freecoeffs
Definition: filters.cpp:97
x2
static int x2
Definition: mythsocket.cpp:51
setPixelRGB
void setPixelRGB(Uint *buffer, Uint x, Uint y, Color c)
Definition: filters.cpp:326
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:725
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:402
expix1
guint32 * expix1
Definition: filters.cpp:104
useAltivec
unsigned int useAltivec
EFFECT_DISTORS_SL
static constexpr int8_t 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:26
freebrutS
signed int * freebrutS
Definition: filters.cpp:99
middleX
static int middleX
Definition: filters.cpp:120
getAsmUse
int getAsmUse(void)
Definition: filters.cpp:485
mmx_zoom_size
guint32 mmx_zoom_size
Definition: filters.cpp:80
resoly
guint32 resoly
Definition: goom_core.cpp:56
c_resoly
volatile guint32 c_resoly
Definition: goom_core.cpp:56
zoom_filter_mmx_supported
int zoom_filter_mmx_supported()
Definition: zoom_filter_mmx.cpp:22
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:493
ZoomFilterData::noisify
char noisify
Definition: filters.h:25
ShiftRight
static int ShiftRight(int x, int s)
Definition: filters.cpp:142
vPlaneEffect
static int vPlaneEffect
Definition: filters.cpp:117
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:357
hPlaneEffect
static int hPlaneEffect
Definition: filters.cpp:118
ZoomFilterData::pertedec
unsigned char pertedec
Definition: filters.h:13
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:26
select_zoom_filter
static void select_zoom_filter(void)
Definition: filters.cpp:49
SCRUNCH_MODE
#define SCRUNCH_MODE
Definition: filters.h:32
brutT
signed int * brutT
Definition: filters.cpp:101
Uint
unsigned int Uint
Definition: graphic.h:4
PERTEDEC
static constexpr uint8_t PERTEDEC
Definition: filters.cpp:136
resolx
volatile guint32 resolx
Definition: goom_core.cpp:56
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
bbciplayer.stderr
stderr
Definition: bbciplayer.py:199
ZoomFilterData::middleX
int middleX
Definition: filters.h:15
BLEU
#define BLEU
Definition: goomconfig.h:11
cycle
static guint32 cycle
Definition: goom_core.cpp:27
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:342
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
PERTEMASK
static constexpr int8_t PERTEMASK
Definition: filters.cpp:134
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
getPixelRGB_
void getPixelRGB_(const Uint *buffer, Uint x, Color *c)
Definition: filters.cpp:375
Color::b
unsigned short b
Definition: graphic.h:8
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:27
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:479
sqrtperte
static constexpr int8_t sqrtperte
Definition: filters.cpp:132
calculatePXandPY
void calculatePXandPY(int x, int y, int *px, int *py)
Definition: filters.cpp:202
firedec
static int * firedec
Definition: filters.cpp:138
BUFFPOINTNB
static constexpr uint8_t BUFFPOINTNB
Definition: filters.cpp:128
BUFFPOINTMASK
static constexpr int32_t BUFFPOINTMASK
Definition: filters.cpp:129
brutS
signed int * brutS
Definition: filters.cpp:99
Color
Definition: graphic.h:6
zoom_filter_xmmx
void zoom_filter_xmmx(int prevX, int prevY, unsigned int *expix1, unsigned int *expix2, const int *lbruS, const int *lbruD, int buffratio, GoomCoefficients &precalCoef)
Definition: zoom_filter_xmmx.cpp:31
expix2
guint32 * expix2
Definition: filters.cpp:105
noisify
static char noisify
Definition: filters.cpp:119
EFFECT_DISTORS
static constexpr int8_t EFFECT_DISTORS
Definition: filters.cpp:33
ZoomFilterData::middleY
int middleY
Definition: filters.h:15