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