Thema: C++ Dynamische Arrays

Einzelnen Beitrag anzeigen

Benutzerbild von Garfield
Garfield

Registriert seit: 9. Jul 2004
Ort: Aken (Anhalt-Bitterfeld)
1.334 Beiträge
 
Delphi XE5 Professional
 
#1

Dynamische Arrays

  Alt 19. Okt 2014, 21:56
Hallo,

da ich das Avisynth-Plugin nicht in Delphi zum Laufen bekomme, wollte ich rkFastBlur von Roy Magne Klever aus dem Beitrag in Visual Studio Express 2012 C++ nachbauen. Ich habe bisher nur das waagerechte Verwischen versucht. Als Ergebnis erhalte ich jedoch kein Rechteck sondern nur einen senkrechen Strich, welcher den rechten Rand des Rechteckes darstellt. Ich nehme an, dass es an der Deklaration der dynamischen Arrays liegt. Ich habe einiges im Internet gefunden, aber nichts hat bisher funktioniert.

Code:
      const unsigned int Entries = maskWidth + 1 + 2 * radius;
      int* blurB = new int[Entries];
      int* blurG = new int[Entries];
      int* blurR = new int[Entries];
      int tmp;
   
      minH = vi.height - maskTop - maskHeight;
      maxH = vi.height - maskTop - 1;
      minW = maskLeft * 3;
      maxW = (maskLeft + maskWidth - 1) * 3;

      dstp = dst->GetWritePtr();
      dstp = dstp + (minH * dst_pitch);
      for (h = minH; h < maxH; h ++)
      {   
         for (rp = 0; rp < replays; rp ++)
         {
            for (w = (minW - radius * 3); w < (maxW + radius * 3); w += 3)
            {
               tmp = w;
               if (w < minW)
               {
                  tmp = minW;
               }
               else
               {
                  if (tmp > maxW)
                  {
                     tmp = maxW;
                  }
               }
               if (minW = (w - radius * 3))
               {
                  blurB[0] = *(dstp + tmp);
                  blurG[0] = *(dstp + tmp + 1);
                  blurR[0] = *(dstp + tmp + 2);
               }
               else
               {
                  blurB[w / 3] = blurB[(w / 3) - 1] + *(dstp + tmp);
                  blurG[w / 3] = blurG[(w / 3) - 1] + *(dstp + tmp + 1);
                  blurR[w / 3] = blurR[(w / 3) - 1] + *(dstp + tmp + 2);
               }
            }
            for (w = 0; w < (maxW - minW); w += 3)
            {
               *(dstp + minW + w)    = (blurR[w + radius + 1] - blurR[w + radius]) / (radius * 2 + 1);
               *(dstp + minW + w + 1) = (blurG[w + radius + 1] - blurG[w + radius]) / (radius * 2 + 1);
               *(dstp + minW + w + 2) = (blurB[w + radius + 1] - blurB[w + radius]) / (radius * 2 + 1);
            }
         }
         dstp = dstp + dst_pitch;
      }
Zum Beispiel funktioniert nicht:
Code:
        int** blurB;
      blurB = (int**)calloc(Entries, sizeof(int*));
        int** blurG;
      blurG = (int**)calloc(Entries, sizeof(int*));
        int** blurR;
      blurR = (int**)calloc(Entries, sizeof(int*));
Code:
const unsigned int N = 4;
    int c[N];
Gruss Garfield
Ubuntu 22.04: Laz2.2.2/FPC3.2.2 - VirtBox6.1+W10: D7PE, DXE5Prof

Geändert von Garfield (19. Okt 2014 um 22:23 Uhr)
  Mit Zitat antworten Zitat