correct mmx blit algos for cropped layers

git-svn-id: svn://dyne.org/rastasoft/freej/freej@49 383723c8-4afa-0310-b8a8-b1afb83214fc
This commit is contained in:
jaromil
2002-10-12 00:39:20 +00:00
parent 4f99909e3f
commit 87b3ad8a35
7 changed files with 96 additions and 60 deletions
+4 -4
View File
@@ -24,10 +24,10 @@
extern "C" {
void mmxcopy(void *src1, void *dst, unsigned int size);
void mmxblit(void *src1, void *dst, unsigned int width, unsigned int height, unsigned int pitch, unsigned int scr_pitch);
void mmxblit_add(void *src1, void *dst, unsigned int height, unsigned int pitch, unsigned int scr_pitch);
void mmxblit_sub(void *src1, void *dst, unsigned int height, unsigned int pitch, unsigned int scr_pitch);
void mmxblit_and(void *src1, void *dst, unsigned int height, unsigned int pitch, unsigned int scr_pitch);
void mmxblit_or(void *src1, void *dst, unsigned int height, unsigned int pitch, unsigned int scr_pitch);
void mmxblit_add(void *src1, void *dst, unsigned int width, unsigned int height, unsigned int pitch, unsigned int scr_pitch);
void mmxblit_sub(void *src1, void *dst, unsigned int width, unsigned int height, unsigned int pitch, unsigned int scr_pitch);
void mmxblit_and(void *src1, void *dst, unsigned int width, unsigned int height, unsigned int pitch, unsigned int scr_pitch);
void mmxblit_or(void *src1, void *dst, unsigned int width, unsigned int height, unsigned int pitch, unsigned int scr_pitch);
void vline(void *scr, unsigned int height, unsigned int pitch, unsigned int bpp);
void hline(void *scr, unsigned int width, unsigned int bpp);
void mmxosd_clean(void *scr, double col);
+8 -4
View File
@@ -378,19 +378,23 @@ void Layer::blit(void *offset) {
return;
case 5:
mmxblit_add(offset,screen->coords(geo.x,geo.y),geo.h,geo.pitch,screen->pitch);
mmxblit_add((Uint8*)offset+blit_offset,screen->coords(blit_x,blit_y),
blit_width,blit_height,geo.pitch,screen->pitch);
return;
case 6:
mmxblit_sub(offset,screen->coords(geo.x,geo.y),geo.h,geo.pitch,screen->pitch);
mmxblit_sub((Uint8*)offset+blit_offset,screen->coords(blit_x,blit_y),
blit_width,blit_height,geo.pitch,screen->pitch);
return;
case 7:
mmxblit_and(offset,screen->coords(geo.x,geo.y),geo.h,geo.pitch,screen->pitch);
mmxblit_and((Uint8*)offset+blit_offset,screen->coords(blit_x,blit_y),
blit_width,blit_height,geo.pitch,screen->pitch);
return;
case 8:
mmxblit_or(offset,screen->coords(geo.x,geo.y),geo.h,geo.pitch,screen->pitch);
mmxblit_or((Uint8*)offset+blit_offset,screen->coords(blit_x,blit_y),
blit_width,blit_height,geo.pitch,screen->pitch);
return;
default: return;
+16 -12
View File
@@ -59,42 +59,46 @@ void mmxblit(void *src1, void *dst, unsigned int width, unsigned int height, uns
mmx_blit();
}
void mmxblit_add(void *src1, void *dst, unsigned int height, unsigned int pitch, unsigned int scr_pitch) {
void mmxblit_add(void *src1, void *dst, unsigned int width, unsigned int height, unsigned int pitch, unsigned int scr_pitch) {
asmsrc1 = src1;
asmdst = dst;
asmnum1 = height;
asmnum2 = pitch;
asmnum3 = scr_pitch;
asmnum2 = width;
asmnum3 = pitch;
asmnum4 = scr_pitch;
mmx_blit_add();
}
void mmxblit_sub(void *src1, void *dst, unsigned int height, unsigned int pitch, unsigned int scr_pitch) {
void mmxblit_sub(void *src1, void *dst, unsigned int width, unsigned int height, unsigned int pitch, unsigned int scr_pitch) {
asmsrc1 = src1;
asmdst = dst;
asmnum1 = height;
asmnum2 = pitch;
asmnum3 = scr_pitch;
asmnum2 = width;
asmnum3 = pitch;
asmnum4 = scr_pitch;
mmx_blit_sub();
}
void mmxblit_and(void *src1, void *dst, unsigned int height, unsigned int pitch, unsigned int scr_pitch) {
void mmxblit_and(void *src1, void *dst, unsigned int width, unsigned int height, unsigned int pitch, unsigned int scr_pitch) {
asmsrc1 = src1;
asmdst = dst;
asmnum1 = height;
asmnum2 = pitch;
asmnum3 = scr_pitch;
asmnum2 = width;
asmnum3 = pitch;
asmnum4 = scr_pitch;
mmx_blit_and();
}
void mmxblit_or(void *src1, void *dst, unsigned int height, unsigned int pitch, unsigned int scr_pitch) {
void mmxblit_or(void *src1, void *dst, unsigned int width, unsigned int height, unsigned int pitch, unsigned int scr_pitch) {
asmsrc1 = src1;
asmdst = dst;
asmnum1 = height;
asmnum2 = pitch;
asmnum3 = scr_pitch;
asmnum2 = width;
asmnum3 = pitch;
asmnum4 = scr_pitch;
mmx_blit_or();
}
+17 -10
View File
@@ -11,6 +11,7 @@ global mmx_blit_add
extern asmnum1
extern asmnum2
extern asmnum3
extern asmnum4
mmx_blit_add:
;; EAX source
@@ -33,33 +34,39 @@ mmx_blit_add:
push ebp
;; place data
mov eax,[asmsrc1] ; SRC
mov edx,[asmdst] ; DST
mov ecx,[asmnum1]
push edx ; puntatore a inizio linea dst
mov eax,[asmsrc1] ; SRC
push eax ; puntatore a inizio linea src
mov ecx,[asmnum1] ; src height
.OuterLoop
push ecx ; altezza
mov ecx,[asmnum2] ; src pitch
shr ecx,3 ; pitch=pitch/8 (il loop decrementa di 1)
mov ecx,[asmnum2] ; src width
shr ecx,1 ; we move 2 pixels at a time
.InnerLoop
movq mm1,[eax] ; mette il src in mm1 (64bit) (MMX!)
movq mm2,[edx]
paddusb mm1,mm2
movq [edx],mm1 ; mette mm1 in dst (64bit) (MMX!)
add eax,8 ; incrementa il puntatore *src
movq mm2,[edx] ; mette il dst in mm2 (64bit) (MMX!)
paddusb mm1,mm2 ; PACKED ADD UNSIGNED BYTES (MMX!)
movq [edx],mm1 ; mette mm1 in dst (64bit) (MMX!)
add edx,8 ; incrementa il puntatore *dst
loop .InnerLoop ; se ha blittato tutta la linea va a capo
.PitchReached ; ANDIAMO A CAPO
pop ecx ; prende il contatore delle linee
pop eax ; prende l'inizio della linea di *src
add eax,[asmnum3] ; va a capo col *src
pop edx ; prende l'inizio della linea di *dst
add edx,[asmnum3] ; va a capo col *dst
add edx,[asmnum4] ; va a capo col *dst
push edx ; rimette tutto apposto nello stack
push eax
loop .OuterLoop ; riluppa
.TheEnd
pop eax
pop edx
emms
;; restore registers
@@ -73,4 +80,4 @@ mmx_blit_add:
leave
ret
SEGMENT DATA
SEGMENT DATA
+17 -10
View File
@@ -11,6 +11,7 @@ global mmx_blit_and
extern asmnum1
extern asmnum2
extern asmnum3
extern asmnum4
mmx_blit_and:
;; EAX source
@@ -33,33 +34,39 @@ mmx_blit_and:
push ebp
;; place data
mov eax,[asmsrc1] ; SRC
mov edx,[asmdst] ; DST
mov ecx,[asmnum1]
push edx ; puntatore a inizio linea dst
mov eax,[asmsrc1] ; SRC
push eax ; puntatore a inizio linea src
mov ecx,[asmnum1] ; src height
.OuterLoop
push ecx ; altezza
mov ecx,[asmnum2] ; src pitch
shr ecx,3 ; pitch=pitch/8 (il loop decrementa di 1)
mov ecx,[asmnum2] ; src width
shr ecx,1 ; we move 2 pixels at a time
.InnerLoop
movq mm1,[eax] ; mette il src in mm1 (64bit) (MMX!)
movq mm2,[edx]
pand mm1,mm2
movq [edx],mm1 ; mette mm1 in dst (64bit) (MMX!)
add eax,8 ; incrementa il puntatore *src
movq mm2,[edx] ; mette il dst in mm2 (64bit) (MMX!)
pand mm1,mm2 ; PACKED ADD UNSIGNED BYTES (MMX!)
movq [edx],mm1 ; mette mm1 in dst (64bit) (MMX!)
add edx,8 ; incrementa il puntatore *dst
loop .InnerLoop ; se ha blittato tutta la linea va a capo
.PitchReached ; ANDIAMO A CAPO
pop ecx ; prende il contatore delle linee
pop eax ; prende l'inizio della linea di *src
add eax,[asmnum3] ; va a capo col *src
pop edx ; prende l'inizio della linea di *dst
add edx,[asmnum3] ; va a capo col *dst
add edx,[asmnum4] ; va a capo col *dst
push edx ; rimette tutto apposto nello stack
push eax
loop .OuterLoop ; riluppa
.TheEnd
pop eax
pop edx
emms
;; restore registers
@@ -73,4 +80,4 @@ mmx_blit_and:
leave
ret
SEGMENT DATA
SEGMENT DATA
+17 -10
View File
@@ -11,6 +11,7 @@ global mmx_blit_or
extern asmnum1
extern asmnum2
extern asmnum3
extern asmnum4
mmx_blit_or:
;; EAX source
@@ -33,33 +34,39 @@ mmx_blit_or:
push ebp
;; place data
mov eax,[asmsrc1] ; SRC
mov edx,[asmdst] ; DST
mov ecx,[asmnum1]
push edx ; puntatore a inizio linea dst
mov eax,[asmsrc1] ; SRC
push eax ; puntatore a inizio linea src
mov ecx,[asmnum1] ; src height
.OuterLoop
push ecx ; altezza
mov ecx,[asmnum2] ; src pitch
shr ecx,3 ; pitch=pitch/8 (il loop decrementa di 1)
mov ecx,[asmnum2] ; src width
shr ecx,1 ; we move 2 pixels at a time
.InnerLoop
movq mm1,[eax] ; mette il src in mm1 (64bit) (MMX!)
movq mm2,[edx]
por mm1,mm2
movq [edx],mm1 ; mette mm1 in dst (64bit) (MMX!)
add eax,8 ; incrementa il puntatore *src
movq mm2,[edx] ; mette il dst in mm2 (64bit) (MMX!)
por mm1,mm2 ; PACKED ADD UNSIGNED BYTES (MMX!)
movq [edx],mm1 ; mette mm1 in dst (64bit) (MMX!)
add edx,8 ; incrementa il puntatore *dst
loop .InnerLoop ; se ha blittato tutta la linea va a capo
.PitchReached ; ANDIAMO A CAPO
pop ecx ; prende il contatore delle linee
pop eax ; prende l'inizio della linea di *src
add eax,[asmnum3] ; va a capo col *src
pop edx ; prende l'inizio della linea di *dst
add edx,[asmnum3] ; va a capo col *dst
add edx,[asmnum4] ; va a capo col *dst
push edx ; rimette tutto apposto nello stack
push eax
loop .OuterLoop ; riluppa
.TheEnd
pop eax
pop edx
emms
;; restore registers
@@ -73,4 +80,4 @@ mmx_blit_or:
leave
ret
SEGMENT DATA
SEGMENT DATA
+17 -10
View File
@@ -11,6 +11,7 @@ global mmx_blit_sub
extern asmnum1
extern asmnum2
extern asmnum3
extern asmnum4
mmx_blit_sub:
;; EAX source
@@ -33,33 +34,39 @@ mmx_blit_sub:
push ebp
;; place data
mov eax,[asmsrc1] ; SRC
mov edx,[asmdst] ; DST
mov ecx,[asmnum1]
push edx ; puntatore a inizio linea dst
mov eax,[asmsrc1] ; SRC
push eax ; puntatore a inizio linea src
mov ecx,[asmnum1] ; src height
.OuterLoop
push ecx ; altezza
mov ecx,[asmnum2] ; src pitch
shr ecx,3 ; pitch=pitch/8 (il loop decrementa di 1)
mov ecx,[asmnum2] ; src width
shr ecx,1 ; we move 2 pixels at a time
.InnerLoop
movq mm1,[eax] ; mette il src in mm1 (64bit) (MMX!)
movq mm2,[edx]
psubusb mm1,mm2
movq [edx],mm1 ; mette mm1 in dst (64bit) (MMX!)
add eax,8 ; incrementa il puntatore *src
movq mm2,[edx] ; mette il dst in mm2 (64bit) (MMX!)
psubusb mm1,mm2 ; PACKED ADD UNSIGNED BYTES (MMX!)
movq [edx],mm1 ; mette mm1 in dst (64bit) (MMX!)
add edx,8 ; incrementa il puntatore *dst
loop .InnerLoop ; se ha blittato tutta la linea va a capo
.PitchReached ; ANDIAMO A CAPO
pop ecx ; prende il contatore delle linee
pop eax ; prende l'inizio della linea di *src
add eax,[asmnum3] ; va a capo col *src
pop edx ; prende l'inizio della linea di *dst
add edx,[asmnum3] ; va a capo col *dst
add edx,[asmnum4] ; va a capo col *dst
push edx ; rimette tutto apposto nello stack
push eax
loop .OuterLoop ; riluppa
.TheEnd
pop eax
pop edx
emms
;; restore registers
@@ -73,4 +80,4 @@ mmx_blit_sub:
leave
ret
SEGMENT DATA
SEGMENT DATA