Much much faster HQ3X filter code [MaxSt]

This commit is contained in:
pagefault
2003-07-29 01:37:55 +00:00
parent 72aa93af20
commit 8ac67e89ae
3 changed files with 660 additions and 205 deletions

View File

@@ -23,6 +23,7 @@
%include "macros.mac" %include "macros.mac"
EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2, EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2,
EXTSYM vidbufferofsb
EXTSYM FilteredGUI,resolutn,lineleft,cfield EXTSYM FilteredGUI,resolutn,lineleft,cfield
EXTSYM hirestiledat,newengen,SpecialLine,HalfTrans EXTSYM hirestiledat,newengen,SpecialLine,HalfTrans
EXTSYM hq3xFilter EXTSYM hq3xFilter
@@ -37,7 +38,9 @@ NEWSYM CopyVWinAsmStart
%endif %endif
SECTION .bss SECTION .bss
NEWSYM firstline, resd 1 NEWSYM prevline, resd 1
NEWSYM nextline, resd 1
NEWSYM deltaptr, resd 1
NEWSYM xcounter, resd 1 NEWSYM xcounter, resd 1
NEWSYM w1, resd 1 NEWSYM w1, resd 1
NEWSYM w2, resd 1 NEWSYM w2, resd 1
@@ -417,6 +420,8 @@ NEWSYM copy768x720x16bwin
mov esi,[vidbuffer] mov esi,[vidbuffer]
mov edi,[WinVidMemStart] mov edi,[WinVidMemStart]
add esi,16*2+256*2+32*2 add esi,16*2+256*2+32*2
mov ecx,[vidbufferofsb]
mov [deltaptr],ecx
cmp byte[FilteredGUI],0 cmp byte[FilteredGUI],0
jne .filtergui jne .filtergui
cmp byte[GUIOn2],1 cmp byte[GUIOn2],1
@@ -460,7 +465,8 @@ nointerp:
hq3x: hq3x:
mov dl,[resolutn] mov dl,[resolutn]
mov byte[lineleft],dl mov byte[lineleft],dl
mov byte[firstline],1 mov dword[prevline],0
mov dword[nextline],576
mov ebx,hirestiledat+1 mov ebx,hirestiledat+1
cmp byte[GUIOn],1 cmp byte[GUIOn],1
je .loopy je .loopy
@@ -472,54 +478,106 @@ hq3x:
cmp byte[ebx],1 cmp byte[ebx],1
jbe .nohires jbe .nohires
call HighResProc call HighResProc
jmp .nextline mov edx,[deltaptr]
.nohires mov ecx,128
movzx eax,word[esi] mov eax,0xAAAAAAAA
mov [w5],eax
mov [w6],eax
mov edx,eax
cmp byte[firstline],1
je .firstline
movzx eax,word[esi-576]
.firstline
mov [w2],eax
mov [w3],eax
cmp byte[lineleft], 1
je .lastline
movzx edx,word[esi+576]
.lastline
mov dword[xcounter],256
mov [w8],edx
mov [w9],edx
.loopx
mov eax,[w2]
mov [w1],eax
mov eax,[w5]
mov [w4],eax
mov eax,[w8]
mov [w7],eax
mov eax,[w3]
mov [w2],eax
mov eax,[w6]
mov [w5],eax
mov eax,[w9]
mov [w8],eax
cmp dword[xcounter],1
je .a
movzx eax,word[esi+2]
mov [w6],eax
cmp byte[firstline],1
je .first
movzx eax,word[esi-576+2]
.first
mov [w3],eax
mov eax,[w6]
cmp byte[lineleft],1
je .last
movzx eax,word[esi+576+2]
.last
mov [w9],eax
.a .a
mov [edx],eax
add edx,4
dec ecx
jnz .a
mov [deltaptr],edx
jmp .nexty
.nohires
mov dword[xcounter],254 ; x={Xres-2, Xres-1} are special cases.
; x=0 - special case
mov edx,[deltaptr]
mov ecx,[prevline]
mov eax,[nextline]
movq mm2,[esi+ecx]
movq mm3,[esi]
movq mm4,[esi+eax]
movq mm5,mm2
movq mm6,mm3
movq mm7,mm4
pcmpeqw mm2,[edx+ecx]
pcmpeqw mm3,[edx]
pcmpeqw mm4,[edx+eax]
pand mm2,mm3
pand mm2,mm4
movd eax,mm2
inc eax
jz .loopx_end
movd eax,mm5
movzx edx,ax
mov [w1],edx
mov [w2],edx
shr eax,16
mov [w3],eax
movd eax,mm6
movzx edx,ax
mov [w4],edx
mov [w5],edx
shr eax,16
mov [w6],eax
movd eax,mm7
movzx edx,ax
mov [w7],edx
mov [w8],edx
shr eax,16
mov [w9],eax
jmp .flags
.loopx
mov edx,[deltaptr]
mov ecx,[prevline]
mov eax,[nextline]
movq mm2,[esi+ecx-2]
movq mm3,[esi-2]
movq mm4,[esi+eax-2]
movq mm5,mm2
movq mm6,mm3
movq mm7,mm4
pcmpeqw mm2,[edx+ecx-2]
pcmpeqw mm3,[edx-2]
pcmpeqw mm4,[edx+eax-2]
pand mm2,mm3
pand mm2,mm4
movd ebx,mm2
psrlq mm2,32
movd eax,mm2
cwde
and eax,ebx
inc eax
jz .loopx_end
movd eax,mm5
mov [edx+ecx-2],ax
movzx edx,ax
mov [w1],edx
shr eax,16
mov [w2],eax
psrlq mm5,32
movd eax,mm5
movzx edx,ax
mov [w3],edx
movd eax,mm6
movzx edx,ax
mov [w4],edx
shr eax,16
mov [w5],eax
psrlq mm6,32
movd eax,mm6
movzx edx,ax
mov [w6],edx
movd eax,mm7
movzx edx,ax
mov [w7],edx
shr eax,16
mov [w8],eax
psrlq mm7,32
movd eax,mm7
movzx edx,ax
mov [w9],edx
.flags
mov ebx,[RGBtoYUVPtr] mov ebx,[RGBtoYUVPtr]
mov eax,[w5] mov eax,[w5]
xor ecx,ecx xor ecx,ecx
@@ -2329,7 +2387,7 @@ hq3x:
..@cross0 ..@cross0
mov edx,eax mov edx,eax
shl eax,16 shl eax,16
mov ax,dx or eax,edx
mov [edi],eax mov [edi],eax
mov [edi+4],ax mov [edi+4],ax
mov [edi+ebx],eax mov [edi+ebx],eax
@@ -2340,7 +2398,7 @@ hq3x:
..@cross1 ..@cross1
mov edx,eax mov edx,eax
shl eax,16 shl eax,16
mov ax,dx or eax,edx
mov ecx,[w2] mov ecx,[w2]
and edx,[HalfTrans] and edx,[HalfTrans]
and ecx,[HalfTrans] and ecx,[HalfTrans]
@@ -2361,7 +2419,7 @@ hq3x:
..@cross2 ..@cross2
mov edx,eax mov edx,eax
shl eax,16 shl eax,16
mov ax,dx or eax,edx
mov ecx,[w4] mov ecx,[w4]
and edx,[HalfTrans] and edx,[HalfTrans]
and ecx,[HalfTrans] and ecx,[HalfTrans]
@@ -2381,7 +2439,7 @@ hq3x:
..@cross4 ..@cross4
mov edx,eax mov edx,eax
shl eax,16 shl eax,16
mov ax,dx or eax,edx
mov ecx,[w6] mov ecx,[w6]
and edx,[HalfTrans] and edx,[HalfTrans]
and ecx,[HalfTrans] and ecx,[HalfTrans]
@@ -2401,7 +2459,7 @@ hq3x:
..@cross8 ..@cross8
mov edx,eax mov edx,eax
shl eax,16 shl eax,16
mov ax,dx or eax,edx
mov ecx,[w8] mov ecx,[w8]
and edx,[HalfTrans] and edx,[HalfTrans]
and ecx,[HalfTrans] and ecx,[HalfTrans]
@@ -2422,13 +2480,115 @@ hq3x:
.loopx_end .loopx_end
add esi,2 add esi,2
add dword[deltaptr],2
add edi,6 add edi,6
dec dword[xcounter] dec dword[xcounter]
jz .nextline jle .xres_2
jmp .loopx jmp .loopx
.nextline .xres_2
mov byte[firstline],0 ; x=Xres-2 - special case
jl .xres_1
mov edx,[deltaptr]
mov ecx,[prevline]
mov eax,[nextline]
movq mm2,[esi+ecx-4]
movq mm3,[esi-4]
movq mm4,[esi+eax-4]
movq mm5,mm2
movq mm6,mm3
movq mm7,mm4
pcmpeqw mm2,[edx+ecx-4]
pcmpeqw mm3,[edx-4]
pcmpeqw mm4,[edx+eax-4]
pand mm2,mm3
pand mm2,mm4
psrlq mm2,16
movd ebx,mm2
psrlq mm2,32
movd eax,mm2
cwde
and eax,ebx
inc eax
jz .loopx_end
psrlq mm5,16
psrlq mm6,16
psrlq mm7,16
movd eax,mm5
mov [edx+ecx-2],ax
movzx edx,ax
mov [w1],edx
shr eax,16
mov [w2],eax
psrlq mm5,32
movd eax,mm5
mov [w3],eax
movd eax,mm6
movzx edx,ax
mov [w4],edx
shr eax,16
mov [w5],eax
psrlq mm6,32
movd eax,mm6
mov [w6],eax
movd eax,mm7
movzx edx,ax
mov [w7],edx
shr eax,16
mov [w8],eax
psrlq mm7,32
movd eax,mm7
mov [w9],eax
jmp .flags
.xres_1
cmp dword[xcounter],-1
jl .endofline
; x=Xres-1 - special case
mov edx,[deltaptr]
mov ecx,[prevline]
mov eax,[nextline]
movq mm2,[esi+ecx-6]
movq mm3,[esi-6]
movq mm4,[esi+eax-6]
movq mm5,mm2
movq mm6,mm3
movq mm7,mm4
pcmpeqw mm2,[edx+ecx-6]
pcmpeqw mm3,[edx-6]
pcmpeqw mm4,[edx+eax-6]
pand mm2,mm3
pand mm2,mm4
psrlq mm2,32
movd eax,mm2
inc eax
jz .loopx_end
psrlq mm5,32
psrlq mm6,32
psrlq mm7,32
movd eax,mm5
mov [edx+ecx-2],eax
movzx edx,ax
mov [w1],edx
shr eax,16
mov [w2],eax
mov [w3],eax
movd eax,mm6
movzx edx,ax
mov [w4],edx
shr eax,16
mov [w5],eax
mov [w6],eax
movd eax,mm7
movzx edx,ax
mov [w7],edx
shr eax,16
mov [w8],eax
mov [w9],eax
jmp .flags
.endofline
mov ebx,[NumBytesPerLine]
.nexty
add esi,64 add esi,64
add dword[deltaptr],64
add edi,[AddEndBytes] add edi,[AddEndBytes]
add edi,ebx add edi,ebx
add edi,ebx add edi,ebx
@@ -2436,6 +2596,14 @@ hq3x:
inc ebx inc ebx
dec byte[lineleft] dec byte[lineleft]
jz .fin jz .fin
cmp byte[lineleft],1
je .lastline
mov dword[nextline],576
mov dword[prevline],-576
jmp .loopy
.lastline
mov dword[nextline],0
mov dword[prevline],-576
jmp .loopy jmp .loopy
.fin .fin
emms emms

View File

@@ -23,6 +23,7 @@
%include "macros.mac" %include "macros.mac"
EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2, EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2,
EXTSYM vidbufferofsb
EXTSYM FilteredGUI,resolutn,lineleft,cfield EXTSYM FilteredGUI,resolutn,lineleft,cfield
EXTSYM hirestiledat,newengen,SpecialLine EXTSYM hirestiledat,newengen,SpecialLine
EXTSYM hq3xFilter EXTSYM hq3xFilter
@@ -31,7 +32,7 @@ EXTSYM NumBytesPerLine
EXTSYM WinVidMemStart EXTSYM WinVidMemStart
EXTSYM BitConv32Ptr EXTSYM BitConv32Ptr
EXTSYM RGBtoYUVPtr EXTSYM RGBtoYUVPtr
EXTSYM firstline, xcounter EXTSYM prevline, nextline, deltaptr, xcounter
EXTSYM w1, w2, w3, w4, w5, w6, w7, w8, w9 EXTSYM w1, w2, w3, w4, w5, w6, w7, w8, w9
EXTSYM reg_blank, const7, cross, threshold EXTSYM reg_blank, const7, cross, threshold
@@ -370,6 +371,8 @@ NEWSYM copy768x720x32bwin
mov esi,[vidbuffer] mov esi,[vidbuffer]
mov edi,[WinVidMemStart] mov edi,[WinVidMemStart]
add esi,16*2+256*2+32*2 add esi,16*2+256*2+32*2
mov ecx,[vidbufferofsb]
mov [deltaptr],ecx
cmp byte[FilteredGUI],0 cmp byte[FilteredGUI],0
jne .filtergui jne .filtergui
cmp byte[GUIOn2],1 cmp byte[GUIOn2],1
@@ -417,7 +420,8 @@ nointerp:
hq3x: hq3x:
mov dl,[resolutn] mov dl,[resolutn]
mov byte[lineleft],dl mov byte[lineleft],dl
mov byte[firstline], 1 mov dword[prevline],0
mov dword[nextline],576
mov ebx,hirestiledat+1 mov ebx,hirestiledat+1
cmp byte[GUIOn],1 cmp byte[GUIOn],1
je .loopy je .loopy
@@ -429,55 +433,106 @@ hq3x:
cmp byte[ebx],1 cmp byte[ebx],1
jbe .nohires jbe .nohires
call HighResProc call HighResProc
jmp .nextline mov edx,[deltaptr]
.nohires mov ecx,128
movzx eax,word[esi] mov eax,0xAAAAAAAA
mov [w5],eax
mov [w6],eax
mov edx,eax
cmp byte[firstline],1
je .firstline
movzx eax,word[esi-576]
.firstline
mov [w2],eax
mov [w3],eax
cmp byte[lineleft], 1
je .lastline
movzx edx,word[esi+576]
.lastline
mov dword[xcounter],256
mov [w8],edx
mov [w9],edx
.loopx
mov ebx,[BitConv32Ptr]
mov eax,[w2]
mov [w1],eax
mov eax,[w5]
mov [w4],eax
mov eax,[w8]
mov [w7],eax
mov eax,[w3]
mov [w2],eax
mov eax,[w6]
mov [w5],eax
mov eax,[w9]
mov [w8],eax
cmp dword[xcounter],1
je .a
movzx eax,word[esi+2]
mov [w6],eax
cmp byte[firstline],1
je .first
movzx eax,word[esi-576+2]
.first
mov [w3],eax
mov eax,[w6]
cmp byte[lineleft],1
je .last
movzx eax,word[esi+576+2]
.last
mov [w9],eax
.a .a
mov [edx],eax
add edx,4
dec ecx
jnz .a
mov [deltaptr],edx
jmp .nexty
.nohires
mov dword[xcounter],254 ; x={Xres-2, Xres-1} are special cases.
; x=0 - special case
mov edx,[deltaptr]
mov ecx,[prevline]
mov eax,[nextline]
movq mm2,[esi+ecx]
movq mm3,[esi]
movq mm4,[esi+eax]
movq mm5,mm2
movq mm6,mm3
movq mm7,mm4
pcmpeqw mm2,[edx+ecx]
pcmpeqw mm3,[edx]
pcmpeqw mm4,[edx+eax]
pand mm2,mm3
pand mm2,mm4
movd eax,mm2
inc eax
jz .loopx_end
movd eax,mm5
movzx edx,ax
mov [w1],edx
mov [w2],edx
shr eax,16
mov [w3],eax
movd eax,mm6
movzx edx,ax
mov [w4],edx
mov [w5],edx
shr eax,16
mov [w6],eax
movd eax,mm7
movzx edx,ax
mov [w7],edx
mov [w8],edx
shr eax,16
mov [w9],eax
jmp .flags
.loopx
mov edx,[deltaptr]
mov ecx,[prevline]
mov eax,[nextline]
movq mm2,[esi+ecx-2]
movq mm3,[esi-2]
movq mm4,[esi+eax-2]
movq mm5,mm2
movq mm6,mm3
movq mm7,mm4
pcmpeqw mm2,[edx+ecx-2]
pcmpeqw mm3,[edx-2]
pcmpeqw mm4,[edx+eax-2]
pand mm2,mm3
pand mm2,mm4
movd ebx,mm2
psrlq mm2,32
movd eax,mm2
cwde
and eax,ebx
inc eax
jz .loopx_end
movd eax,mm5
mov [edx+ecx-2],ax
movzx edx,ax
mov [w1],edx
shr eax,16
mov [w2],eax
psrlq mm5,32
movd eax,mm5
movzx edx,ax
mov [w3],edx
movd eax,mm6
movzx edx,ax
mov [w4],edx
shr eax,16
mov [w5],eax
psrlq mm6,32
movd eax,mm6
movzx edx,ax
mov [w6],edx
movd eax,mm7
movzx edx,ax
mov [w7],edx
shr eax,16
mov [w8],eax
psrlq mm7,32
movd eax,mm7
movzx edx,ax
mov [w9],edx
.flags
mov ebx,[RGBtoYUVPtr] mov ebx,[RGBtoYUVPtr]
mov eax,[w5] mov eax,[w5]
xor ecx,ecx xor ecx,ecx
@@ -544,21 +599,12 @@ hq3x:
jz .noflag8 jz .noflag8
or ecx,64 or ecx,64
.noflag8 .noflag8
cmp dword[cross],0 test ecx,ecx
jne .testflag1 jnz .testflag1
mov ecx,[cross]
mov ebx,[BitConv32Ptr] mov ebx,[BitConv32Ptr]
mov eax,[ebx+eax*4] mov eax,[ebx+eax*4]
mov ebx,[NumBytesPerLine] jmp [FuncTable2+ecx*4]
mov [edi],eax
mov [edi+4],eax
mov [edi+8],eax
mov [edi+ebx],eax
mov [edi+ebx+4],eax
mov [edi+ebx+8],eax
mov [edi+ebx*2],eax
mov [edi+ebx*2+4],eax
mov [edi+ebx*2+8],eax
jmp .loopx_end
.testflag1 .testflag1
mov edx,[w1] mov edx,[w1]
cmp eax,edx cmp eax,edx
@@ -2364,15 +2410,217 @@ hq3x:
DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2
jmp .loopx_end jmp .loopx_end
..@cross0
mov ebx,[NumBytesPerLine]
mov [edi],eax
mov [edi+4],eax
mov [edi+8],eax
mov [edi+ebx],eax
mov [edi+ebx+4],eax
mov [edi+ebx+8],eax
mov [edi+ebx*2],eax
mov [edi+ebx*2+4],eax
mov [edi+ebx*2+8],eax
jmp .loopx_end
..@cross1
mov ecx,[w2]
mov edx,eax
shl edx,2
add edx,[ebx+ecx*4]
sub edx,eax
shr edx,2
mov ebx,[NumBytesPerLine]
mov [edi],edx
mov [edi+4],edx
mov [edi+8],edx
mov [edi+ebx],eax
mov [edi+ebx+4],eax
mov [edi+ebx+8],eax
mov [edi+ebx*2],eax
mov [edi+ebx*2+4],eax
mov [edi+ebx*2+8],eax
jmp .loopx_end
..@cross2
mov ecx,[w4]
mov edx,eax
shl edx,2
add edx,[ebx+ecx*4]
sub edx,eax
shr edx,2
mov ebx,[NumBytesPerLine]
mov [edi],edx
mov [edi+4],eax
mov [edi+8],eax
mov [edi+ebx],edx
mov [edi+ebx+4],eax
mov [edi+ebx+8],eax
mov [edi+ebx*2],edx
mov [edi+ebx*2+4],eax
mov [edi+ebx*2+8],eax
jmp .loopx_end
..@cross4
mov ecx,[w6]
mov edx,eax
shl edx,2
add edx,[ebx+ecx*4]
sub edx,eax
shr edx,2
mov ebx,[NumBytesPerLine]
mov [edi],eax
mov [edi+4],eax
mov [edi+8],edx
mov [edi+ebx],eax
mov [edi+ebx+4],eax
mov [edi+ebx+8],edx
mov [edi+ebx*2],eax
mov [edi+ebx*2+4],eax
mov [edi+ebx*2+8],edx
jmp .loopx_end
..@cross8
mov ecx,[w8]
mov edx,eax
shl edx,2
add edx,[ebx+ecx*4]
sub edx,eax
shr edx,2
mov ebx,[NumBytesPerLine]
mov [edi],eax
mov [edi+4],eax
mov [edi+8],eax
mov [edi+ebx],eax
mov [edi+ebx+4],eax
mov [edi+ebx+8],eax
mov [edi+ebx*2],edx
mov [edi+ebx*2+4],edx
mov [edi+ebx*2+8],edx
jmp .loopx_end
..@crossN
mov edx,[w2]
mov ecx,[ebx+edx*4]
mov [c2],ecx
mov edx,[w4]
mov ecx,[ebx+edx*4]
mov [c4],ecx
mov edx,[w6]
mov ecx,[ebx+edx*4]
mov [c6],ecx
mov edx,[w8]
mov ecx,[ebx+edx*4]
mov [c8],ecx
mov ebx,[NumBytesPerLine]
jmp ..@flag0
.loopx_end .loopx_end
add esi,2 add esi,2
add dword[deltaptr],2
add edi,12 add edi,12
dec dword[xcounter] dec dword[xcounter]
jz .nextline jle .xres_2
jmp .loopx jmp .loopx
.nextline .xres_2
mov byte[firstline],0 ; x=Xres-2 - special case
jl .xres_1
mov edx,[deltaptr]
mov ecx,[prevline]
mov eax,[nextline]
movq mm2,[esi+ecx-4]
movq mm3,[esi-4]
movq mm4,[esi+eax-4]
movq mm5,mm2
movq mm6,mm3
movq mm7,mm4
pcmpeqw mm2,[edx+ecx-4]
pcmpeqw mm3,[edx-4]
pcmpeqw mm4,[edx+eax-4]
pand mm2,mm3
pand mm2,mm4
psrlq mm2,16
movd ebx,mm2
psrlq mm2,32
movd eax,mm2
cwde
and eax,ebx
inc eax
jz .loopx_end
psrlq mm5,16
psrlq mm6,16
psrlq mm7,16
movd eax,mm5
mov [edx+ecx-2],ax
movzx edx,ax
mov [w1],edx
shr eax,16
mov [w2],eax
psrlq mm5,32
movd eax,mm5
mov [w3],eax
movd eax,mm6
movzx edx,ax
mov [w4],edx
shr eax,16
mov [w5],eax
psrlq mm6,32
movd eax,mm6
mov [w6],eax
movd eax,mm7
movzx edx,ax
mov [w7],edx
shr eax,16
mov [w8],eax
psrlq mm7,32
movd eax,mm7
mov [w9],eax
jmp .flags
.xres_1
cmp dword[xcounter],-1
jl .endofline
; x=Xres-1 - special case
mov edx,[deltaptr]
mov ecx,[prevline]
mov eax,[nextline]
movq mm2,[esi+ecx-6]
movq mm3,[esi-6]
movq mm4,[esi+eax-6]
movq mm5,mm2
movq mm6,mm3
movq mm7,mm4
pcmpeqw mm2,[edx+ecx-6]
pcmpeqw mm3,[edx-6]
pcmpeqw mm4,[edx+eax-6]
pand mm2,mm3
pand mm2,mm4
psrlq mm2,32
movd eax,mm2
inc eax
jz .loopx_end
psrlq mm5,32
psrlq mm6,32
psrlq mm7,32
movd eax,mm5
mov [edx+ecx-2],eax
movzx edx,ax
mov [w1],edx
shr eax,16
mov [w2],eax
mov [w3],eax
movd eax,mm6
movzx edx,ax
mov [w4],edx
shr eax,16
mov [w5],eax
mov [w6],eax
movd eax,mm7
movzx edx,ax
mov [w7],edx
shr eax,16
mov [w8],eax
mov [w9],eax
jmp .flags
.endofline
mov ebx,[NumBytesPerLine]
.nexty
add esi,64 add esi,64
add dword[deltaptr],64
add edi,[AddEndBytes] add edi,[AddEndBytes]
add edi,ebx add edi,ebx
add edi,ebx add edi,ebx
@@ -2380,6 +2628,14 @@ hq3x:
inc ebx inc ebx
dec byte[lineleft] dec byte[lineleft]
jz .fin jz .fin
cmp byte[lineleft],1
je .lastline
mov dword[nextline],576
mov dword[prevline],-576
jmp .loopy
.lastline
mov dword[nextline],0
mov dword[prevline],-576
jmp .loopy jmp .loopy
.fin .fin
emms emms
@@ -2563,6 +2819,12 @@ FuncTable
dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247
dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255
FuncTable2
dd ..@cross0, ..@cross1, ..@cross2, ..@crossN,
dd ..@cross4, ..@crossN, ..@crossN, ..@crossN,
dd ..@cross8, ..@crossN, ..@crossN, ..@crossN,
dd ..@crossN, ..@crossN, ..@crossN, ..@crossN
SECTION .bss SECTION .bss
InterPtr resd 1 InterPtr resd 1
SECTION .text SECTION .text

View File

@@ -1376,10 +1376,18 @@ int InitDirectDraw()
return FALSE; return FALSE;
} }
if (lpDD->SetDisplayMode(WindowWidth, WindowHeight, 16, Refresh, 0) != DD_OK) if (lpDD->SetDisplayMode(WindowWidth, WindowHeight, 16, Refresh, 0) != DD_OK)
{
if (lpDD->SetDisplayMode(WindowWidth, WindowHeight, 16, 0, 0) != DD_OK)
{ {
MessageBox(NULL, "IDirectDraw7::SetDisplayMode failed.\nMake sure your video card supports this mode.", "DirectDraw Error", MB_ICONERROR); MessageBox(NULL, "IDirectDraw7::SetDisplayMode failed.\nMake sure your video card supports this mode.", "DirectDraw Error", MB_ICONERROR);
return FALSE; return FALSE;
} }
else
{
KitchenSync = 0;
Refresh = 0;
}
}
} }
else else
{ {
@@ -1483,6 +1491,8 @@ int InitDirectDraw()
return FALSE; return FALSE;
} }
AltSurface = 0;
// create alt. drawing surface // create alt. drawing surface
if ( BitDepth == 32 ) if ( BitDepth == 32 )
{ {
@@ -1499,6 +1509,9 @@ int InitDirectDraw()
MessageBox(NULL, "IDirectDraw7::CreateSurface failed.", "DirectDraw Error", MB_ICONERROR); MessageBox(NULL, "IDirectDraw7::CreateSurface failed.", "DirectDraw Error", MB_ICONERROR);
return FALSE; return FALSE;
} }
if ((SurfaceX==512) || (SurfaceX==640))
AltSurface = 1;
} }
if (!blur_buffer) blur_buffer = malloc(SurfaceX * SurfaceY * (BitDepth == 16 ? 2 : 4)); if (!blur_buffer) blur_buffer = malloc(SurfaceX * SurfaceY * (BitDepth == 16 ? 2 : 4));
@@ -1924,7 +1937,6 @@ void initwinvideo(void)
if (SurfaceX == 768) BlitArea.bottom = (SurfaceY/240)*resolutn; if (SurfaceX == 768) BlitArea.bottom = (SurfaceY/240)*resolutn;
if (PrevRes == 0) PrevRes = resolutn; if (PrevRes == 0) PrevRes = resolutn;
} }
if (((PrevStereoSound!=StereoSound)||(PrevSoundQuality!=SoundQuality))&&FirstSound!=1) if (((PrevStereoSound!=StereoSound)||(PrevSoundQuality!=SoundQuality))&&FirstSound!=1)
@@ -2260,14 +2272,16 @@ void clearwin()
void clear_display() void clear_display()
{ {
if (FullScreen == 1) if (FullScreen == 1)
{
if ((DD_Primary != NULL) && (DD_BackBuffer != NULL))
{ {
DDBLTFX ddbltfx; DDBLTFX ddbltfx;
ddbltfx.dwSize = sizeof(ddbltfx); ddbltfx.dwSize = sizeof(ddbltfx);
ddbltfx.dwFillColor = 0; ddbltfx.dwFillColor = 0;
if (TripleBufferWin == 1)
{
if ((DD_Primary != NULL) && (DD_BackBuffer != NULL))
{
if (DD_BackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST) if (DD_BackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST)
DD_Primary->Restore(); DD_Primary->Restore();
@@ -2284,6 +2298,22 @@ void clear_display()
DD_Primary->Restore(); DD_Primary->Restore();
} }
} }
else
{
if (DD_Primary != NULL)
{
if (vsyncon == 1)
{
if (lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL) != DD_OK)
{
DDrawError();
}
}
if (DD_Primary->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST)
DD_Primary->Restore();
}
}
}
} }
extern void DrawWin256x224x16(); extern void DrawWin256x224x16();
@@ -2316,11 +2346,6 @@ void drawscreenwin(void)
UpdateVFrame(); UpdateVFrame();
if (curblank!=0) return; if (curblank!=0) return;
AltSurface = 0;
if ( ((SurfaceX==512) || (SurfaceX==640)) && (BitDepth == 32) )
AltSurface = 1;
if (!(pitch = LockSurface())) if (!(pitch = LockSurface()))
return; return;