AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Assembler-Bildaufhellung

Ein Thema von Pearl Harbor · begonnen am 8. Apr 2004
Antwort Antwort
Pearl Harbor

Registriert seit: 7. Apr 2004
1 Beiträge
 
#1

Assembler-Bildaufhellung

  Alt 8. Apr 2004, 09:42
Hallo,

ich wollte mal als Übung eine Bildaufhellung in Assembler schreiben. Das habe ich dann auch getan. Nur was dabei heraus kommt, finde ich nicht gerade prickelnd (siehe Anhang). Die Berechnung für jeden Pixel sieht so aus: NeuerPixel := Alterpixel+Wert.
Hier der Sourcecode:
Delphi-Quellcode:
procedure EffectsAufhellenAsm(wert: cardinal);
var
   i, j: Integer;
   p, q: PPixel;
   temp1: Cardinal;
begin
   ////// Wert zur aufhellung berechnen /////
   temp1 := wert shl 8;
   wert := wert or temp1;
   temp1 := wert shl 16;
   wert := wert or temp1;
   temp1 := wert shl 24;
   wert := wert or temp1;
   ///// wert := 0www; (in Byte) /////
   asm
      movd MM1, wert
      movq MM0, MM1
      psllq MM1, 32
      paddd MM1, MM0
   end;
   ///// MM1 := 0www 0www; (wieder in Byte) /////

   ////// Die Hauptschleife /////
   for i := 0 to Bitmap.Height-1 do
   begin
      p := Bitmap.ScanLine[i];
      for j := 0 to (Bitmap.Width div 2)-1 do
      begin

         ///// Die Pixel in die Register schieben /////
         q := p;
         temp1 := (q^[1] shl 0) or (q^[2] shl 8) or (q^[3] shl 16);
         ///// temp1 := 0bgr; (vom ersten Pixel) /////
         asm
            movd MM0, temp1
         end;
         ///// MM0 := 0000 0bgr;
         inc(q);
         temp1 := (q^[1] shl 0) or (q^[2] shl 8) or (q^[3] shl 16);
         ///// temp1 := 0bgr; (vom zweiten Pixel) /////
         asm
            movd MM2, temp1
            psllq MM2, 32
            ///// MM2 := 0bgr 0000; (vom zweiten Pixel) /////
            paddd MM0, MM2
         end;
         ///// 2. 1. Pixel /////
         ///// MM0 := 0bgr 0bgr; /////

         ///// Die Rechenoperation ausführen /////
         asm
            paddusb MM0, MM1
         end;

         ///// Pixel wieder in das Bild schieben /////
         asm
            movd temp1, MM0
         end;
         ///// temp1 := 0bgr; (erster Pixel) /////
         p^[1] := (temp1 and $000000ff) shr 0;
         p^[2] := (temp1 and $0000ff00) shr 8;
         p^[3] := (temp1 and $00ff0000) shr 16;
         inc(p);
         asm
            psrld MM0, 32
            movd temp1, MM0
         end;
         ///// temp1 := 0bgr; (zweiter Pixel) /////
         p^[1] := (temp1 and $000000ff) shr 0;
         p^[2] := (temp1 and $0000ff00) shr 8;
         p^[3] := (temp1 and $00ff0000) shr 16;
         inc(p);
      end;
   end;
end;
Miniaturansicht angehängter Grafiken
temp_133.jpg  
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:32 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz