+1. I barely get 1fps in C# and this is using parallel processing with speed tweaks. >20fps would be insane, enough to animate the graphics.counting_pine wrote:(Are you glasyalabolas?)paul doe wrote:I'm not sure if this is what you want:
https://github.com/glasyalabolas/fb-image-resize-demo
The algorithm is very similar to the one by counting_pine, but without the smoothing (adding it is no problem, though).
If it's no problem for you to add the smoothing, please do!
I don't much enjoy working with FB image buffers - I tend to feel the need to cover cases like using the screen buffer, or where the source/destination buffer are the same, and it makes things a lot more complicated.
There's more math involved in smoothing, so 500fps is probably too much to hope for, but a few multiplications per (smoothed) pixel shouldn't result in unplayable framerates if done well.
Does anyone know what algo XP -> full screen DOS?
Re: Does anyone know what algo XP -> full screen DOS?
Re: Does anyone know what algo XP -> full screen DOS?
Yes, that's my repo: https://github.com/glasyalabolas. Been spamming the forum with it =Dcounting_pine wrote:(Are you glasyalabolas?)
counting_pine wrote:If it's no problem for you to add the smoothing, please do!
Now I get 645 FPS =DCGAMan wrote:+1. I barely get 1fps in C# and this is using parallel processing with speed tweaks. >20fps would be insane, enough to animate the graphics.
Ok, will add it. I'll update a working version to the repo now (the current one chokes depending on the image width), and add the interpolation. It will be an aproximation, of course, but will look similar to yours, counting_pine. Also, this only blows a fb.image buffer to match the screen resolution, it's not a general purpose scaling procedure like yours.
@CGAMan: if you absolutely need the highest speed, you should use shaders, pal. I coded a very simple example here: viewtopic.php?f=15&t=26105. There's two versions, a vanilla FB and other that uses shaders (I didn't implemented all the blending modes yet). Pay attention to the post by dafhi, it reminded me a cool trick that can be used to perform the interpolation relatively cheaply. It's called dual blending.
If you use shaders, you can pretty much get the same results as the code by counting_pine, only waaaaay faster and with all the parallelism you can possibly want =D
Re: Does anyone know what algo XP -> full screen DOS?
Hi Paul doe
Your image stretcher code didn't work here.
But I see that you have removed it.
I put this together to do pixel by pixel filling.
To smooth it I would use my filter function (used previously)
Your image stretcher code didn't work here.
But I see that you have removed it.
I put this together to do pixel by pixel filling.
To smooth it I would use my filter function (used previously)
Code: Select all
function resizeimage(im As Any Ptr,angle As long,Wdth As Single,Hght as single) as any ptr
#define map(a,b,x,c,d) ((d)-(c))*((x)-(a))\((b)-(a))+(c)
#define InRange() resultx>=0 And resultx<ddx And resulty>=0 And resulty<ddy And _
x>=0 And x<xres And y>=0 And y<yres
Dim As Integer pitch,pitchs,xres,yres
Dim As Any Ptr row,rowS
Dim As Ulong Ptr pixel,pixels
Dim As Integer ddx,ddy,resultx,resulty
Imageinfo im,ddx,ddy,,pitch,row
dim as any ptr im2=imagecreate(Wdth,Hght)
Screeninfo xres,yres
imageinfo im2,,,,pitchS,rowS
Dim As Ulong empty = Rgb(255,0,255)
For y As long=0 To Hght
resulty=map(0,Hght,y,0,ddy)
For x As long=0 To Wdth
resultx=map(0,Wdth,x,0,ddx)
If InRange() Then
pixel=row+pitch*resultY+resultX Shl 2
If *pixel <> empty Then
pixels=rowS+pitchS*(y)+(x) Shl 2
*pixels=*pixel
End If
End If
Next x
Next y
return im2
End function
dim as integer xres,yres
screeninfo xres,yres
screenres xres,yres,32,,&h08 'no frame
dim as any ptr i=imagecreate(250,200)
for n as long=1 to 1000:pset i,(rnd*250,rnd*200),rgb(rnd*255,rnd*255,rnd*255):next
draw string i,(20,20),"Hello, press any key"
circle i,(125,100),50,rgb (200,0,0),,,,f
line i,(0,0)-(249,199),rgb(0,200,0),b
put(0,0),i,trans
sleep
cls
var im=resizeimage(i,0,xres,yres)
put(0,0),im,trans
sleep
Last edited by dodicat on Dec 14, 2017 19:32, edited 1 time in total.
Re: Does anyone know what algo XP -> full screen DOS?
If it's not too much to ask, I'd much prefer a general purpose scaling procedure. The reason being, it becomes easier to preserve the aspect ratio of the images on different monitors...paul doe wrote:Yes, that's my repo: https://github.com/glasyalabolas. Been spamming the forum with it =Dcounting_pine wrote:(Are you glasyalabolas?)counting_pine wrote:If it's no problem for you to add the smoothing, please do!Now I get 645 FPS =DCGAMan wrote:+1. I barely get 1fps in C# and this is using parallel processing with speed tweaks. >20fps would be insane, enough to animate the graphics.
Ok, will add it. I'll update a working version to the repo now (the current one chokes depending on the image width), and add the interpolation. It will be an aproximation, of course, but will look similar to yours, counting_pine. Also, this only blows a fb.image buffer to match the screen resolution, it's not a general purpose scaling procedure like yours.
@CGAMan: if you absolutely need the highest speed, you should use shaders, pal. I coded a very simple example here: viewtopic.php?f=15&t=26105. There's two versions, a vanilla FB and other that uses shaders (I didn't implemented all the blending modes yet). Pay attention to the post by dafhi, it reminded me a cool trick that can be used to perform the interpolation relatively cheaply. It's called dual blending.
If you use shaders, you can pretty much get the same results as the code by counting_pine, only waaaaay faster and with all the parallelism you can possibly want =D
Re: Does anyone know what algo XP -> full screen DOS?
Hi, dodicatdodicat wrote:Hi Paul doe
Your image stretcher code didn't work here.
Yes, it had an off-by-one error (product of the interpolation). It's working correctly now (you can use it with any image), download it from the link I provided above, if you want to test it.
Your code is a bit slow (I get ~20 FPS here, the borderline required by the OP), and adding smoothing will slow it further, I'm afraid =( I'm almost finished with mine. Will post it as soon as I can.
You can modify it easily if you need such a thing. See the code by dodicat above for an example of a general scaler (it scales a bitmap onto another). Preserving the aspect ratio is easy, just pick the lowest size (usually the height) and use that to uniformly scale the image, instead of calculating it separately for each axis...CGAMan wrote:If it's not too much to ask, I'd much prefer a general purpose scaling procedure. The reason being, it becomes easier to preserve the aspect ratio of the images on different monitors...
Re: Does anyone know what algo XP -> full screen DOS?
Plz make the code super-easy to customize. For example, the old CRT monitors had pixels that were 20% taller than wider. On LCD displays, the pixels are squares to allow for landscape/portrait orientations. BUT my preferred pixel size is 20% wider than taller, just the opposite of CRT monitors. (I started using QBASIC on a wide screen laptop, so my legacy progs have this weird requirement of more vertical resolution.)paul doe wrote:Hi, dodicatdodicat wrote:Hi Paul doe
Your image stretcher code didn't work here.
Yes, it had an off-by-one error (product of the interpolation). It's working correctly now (you can use it with any image), download it from the link I provided above, if you want to test it.
Your code is a bit slow (I get ~20 FPS here, the borderline required by the OP), and adding smoothing will slow it further, I'm afraid =( I'm almost finished with mine. Will post it as soon as I can.You can modify it easily if you need such a thing. See the code by dodicat above for an example of a general scaler (it scales a bitmap onto another). Preserving the aspect ratio is easy, just pick the lowest size (usually the height) and use that to uniformly scale the image, instead of calculating it separately for each axis...CGAMan wrote:If it's not too much to ask, I'd much prefer a general purpose scaling procedure. The reason being, it becomes easier to preserve the aspect ratio of the images on different monitors...
Re: Does anyone know what algo XP -> full screen DOS?
This is the reference implementation of my blitter (along with some example code):CGAMan wrote:Plz make the code super-easy to customize. For example, the old CRT monitors had pixels that were 20% taller than wider. On LCD displays, the pixels are squares to allow for landscape/portrait orientations. BUT my preferred pixel size is 20% wider than taller, just the opposite of CRT monitors. (I started using QBASIC on a wide screen laptop, so my legacy progs have this weird requirement of more vertical resolution.)
Code: Select all
#include once "fbgfx.bi"
#define max( a, b ) iif( a > b, a, b )
#define min( a, b ) iif( a < b, a, b )
sub blit( _
byval x as integer, _
byval y as integer, _
byval srcBuffer as fb.image ptr, _
byval dstBuffer as fb.image ptr = 0 )
dim as integer srcStartX = any
dim as integer srcStartY = any
dim as integer srcEndX = any
dim as integer srcEndY = any
dim as integer dstStartX = any
dim as integer dstStartY = any
dim as integer srcPaddingPix = any
dim as integer dstPaddingPix = any
dim as integer srcPadding = any
dim as integer dstPadding = any
dim as integer srcStride = any
dim as integer dstStride = any
dim as ulong ptr src = any
dim as ulong ptr dst = any
dim as integer dstBufferWidth = any
dim as integer dstBufferHeight = any
dim as integer dstPitch = any
dim as integer dstBpp = any
dstStartX = max( 0, x )
dstStartY = max( 0, y )
srcStartX = max( 0, -x )
srcStartY = max( 0, -y )
if( dstBuffer = 0 ) then
'' drawing to the screen
'' get info on the screen
screenInfo( dstBufferWidth, dstBufferHeight, , dstBpp, dstPitch )
'' computes size of padding IN PIXELS
srcPaddingPix = srcBuffer->pitch \ sizeOf( ulong )
dstPaddingPix = dstPitch \ sizeOf( ulong )
'' pointer to source pixel data (skip header in bytes)
src = cast( ulong ptr, srcBuffer ) + sizeOf( fb.image ) \ srcBuffer->bpp
'' calculate size of padding, as FB aligns the width of the images to a multiple of 16 bytes
srcPadding = srcPaddingPix - srcBuffer->width
dstPadding = dstPaddingPix - dstBufferWidth
'' compute clipping values
srcEndX = min( srcBuffer->width - 1, ( ( dstBufferWidth - 1 ) - ( x + srcBuffer->width - 1 ) ) + srcBuffer->width - 1 )
srcEndY = min( srcBuffer->height - 1, ( ( dstBufferHeight - 1 ) - ( y + srcBuffer->height - 1 ) ) + srcBuffer->height - 1 )
'' calculate the strides
dstStride = dstPaddingPix - ( srcEndX - srcStartX ) - 1
srcStride = srcPadding + srcStartX + ( srcBuffer->width - 1 - srcEndX )
'' offset the destination buffer to its starting position
dst = screenPtr() + ( ( dstStartY * dstPitch ) + dstStartX * sizeOf( ulong ) )
else
'' drawing to a buffer
'' computes size of padding IN PIXELS
srcPaddingPix = srcBuffer->pitch \ sizeOf( ulong )
dstPaddingPix = dstBuffer->pitch \ sizeOf( ulong )
'' pointer to pixel data (skip header in bytes)
src = cast( ulong ptr, srcBuffer ) + sizeOf( fb.image ) \ srcBuffer->bpp
dst = cast( ulong ptr, dstBuffer ) + sizeOf( fb.image ) \ dstBuffer->bpp
'' calculate size of padding, as FB aligns the width of the images to a multiple of 16 bytes
srcPadding = srcPaddingPix - srcBuffer->width
dstPadding = dstPaddingPix - dstBuffer->width
'' compute clipping values
srcEndX = min( srcBuffer->width - 1, ( ( dstBuffer->width - 1 ) - ( x + srcBuffer->width - 1 ) ) + srcBuffer->width - 1 )
srcEndY = min( srcBuffer->height - 1, ( ( dstBuffer->height - 1 ) - ( y + srcBuffer->height - 1 ) ) + srcBuffer->height - 1 )
'' calculate the strides
dstStride = dstPaddingPix - ( srcEndX - srcStartX ) - 1
srcStride = srcPadding + srcStartX + ( srcBuffer->width - 1 - srcEndX )
'' offset the destination buffer to its starting position
dst += ( ( dstStartY * ( dstBuffer->pitch \ sizeOf( ulong ) + dstPadding ) ) + dstStartX )
end if
'' offset the source buffer to its starting position
src += ( ( srcStartY * srcPaddingPix ) + srcStartX )
'' blit pixels
for y as integer = srcStartY to srcEndY
for x as integer = srcStartX to srcEndX
*dst = *src
'' next pixel
dst += 1
src += 1
next
'' add the stride to the end of each horizontal scanline
dst += dstStride
src += srcStride
next
end sub
dim as integer screenWidth = 800, screenHeight = 600
screenRes( screenWidth, screenHeight, 32 )
/' Loads an image using bload, so you have to set the width and height of the
buffer manually, or peek them from the BMP file '/
dim as fb.image ptr img = imageCreate( 256, 208 )
bload( "c:/disco viejo/bmp/test001.bmp", img )
dim as double t, sum
dim as uinteger total
dim as integer mx, my
do
getMouse( mx, my )
screenLock()
cls()
t = timer()
blit( mx - img->width / 2, my - img->height / 2, img )
t = timer() - t
screenUnlock()
sum += t
total += 1
windowTitle( "FPS: " & str( int( 1 / ( sum / total ) ) ) )
sleep( 1 )
loop until( inkey() <> "" )
imageDestroy( img )
See the implementation (used by the blended blitter that I posted before), it's really easy to figure out what's going on. The main blitting loop is this:
Code: Select all
'' blit pixels
for y as integer = srcStartY to srcEndY
for x as integer = srcStartX to srcEndX
*dst = *src
'' next pixel
dst += 1
src += 1
next
'' add the stride to the end of each horizontal scanline
dst += dstStride
src += srcStride
next
As you can see, the code it's very similar to the scaler (sans the scaling code, of course), so you'll be able to customize it easily to suit your needs =D
Re: Does anyone know what algo XP -> full screen DOS?
Oh, I see. It seems relatively easy to modify. BTW, can this process bitmaps in memory? (Meaning the original bitmap is generated on demand, not read from a file.) I'd want to avoid reading/writing anything from/to the hard drive, if possible. (Sorry for sounding like a newbie, but I've never worked with bitmaps in BASIC before...)paul doe wrote:This is the reference implementation of my blitter (along with some example code):CGAMan wrote:Plz make the code super-easy to customize. For example, the old CRT monitors had pixels that were 20% taller than wider. On LCD displays, the pixels are squares to allow for landscape/portrait orientations. BUT my preferred pixel size is 20% wider than taller, just the opposite of CRT monitors. (I started using QBASIC on a wide screen laptop, so my legacy progs have this weird requirement of more vertical resolution.)Of course, change the image to load (don't forget to change its size also!)Code: Select all
#include once "fbgfx.bi" #define max( a, b ) iif( a > b, a, b ) #define min( a, b ) iif( a < b, a, b ) sub blit( _ byval x as integer, _ byval y as integer, _ byval srcBuffer as fb.image ptr, _ byval dstBuffer as fb.image ptr = 0 ) dim as integer srcStartX = any dim as integer srcStartY = any dim as integer srcEndX = any dim as integer srcEndY = any dim as integer dstStartX = any dim as integer dstStartY = any dim as integer srcPaddingPix = any dim as integer dstPaddingPix = any dim as integer srcPadding = any dim as integer dstPadding = any dim as integer srcStride = any dim as integer dstStride = any dim as ulong ptr src = any dim as ulong ptr dst = any dim as integer dstBufferWidth = any dim as integer dstBufferHeight = any dim as integer dstPitch = any dim as integer dstBpp = any dstStartX = max( 0, x ) dstStartY = max( 0, y ) srcStartX = max( 0, -x ) srcStartY = max( 0, -y ) if( dstBuffer = 0 ) then '' drawing to the screen '' get info on the screen screenInfo( dstBufferWidth, dstBufferHeight, , dstBpp, dstPitch ) '' computes size of padding IN PIXELS srcPaddingPix = srcBuffer->pitch \ sizeOf( ulong ) dstPaddingPix = dstPitch \ sizeOf( ulong ) '' pointer to source pixel data (skip header in bytes) src = cast( ulong ptr, srcBuffer ) + sizeOf( fb.image ) \ srcBuffer->bpp '' calculate size of padding, as FB aligns the width of the images to a multiple of 16 bytes srcPadding = srcPaddingPix - srcBuffer->width dstPadding = dstPaddingPix - dstBufferWidth '' compute clipping values srcEndX = min( srcBuffer->width - 1, ( ( dstBufferWidth - 1 ) - ( x + srcBuffer->width - 1 ) ) + srcBuffer->width - 1 ) srcEndY = min( srcBuffer->height - 1, ( ( dstBufferHeight - 1 ) - ( y + srcBuffer->height - 1 ) ) + srcBuffer->height - 1 ) '' calculate the strides dstStride = dstPaddingPix - ( srcEndX - srcStartX ) - 1 srcStride = srcPadding + srcStartX + ( srcBuffer->width - 1 - srcEndX ) '' offset the destination buffer to its starting position dst = screenPtr() + ( ( dstStartY * dstPitch ) + dstStartX * sizeOf( ulong ) ) else '' drawing to a buffer '' computes size of padding IN PIXELS srcPaddingPix = srcBuffer->pitch \ sizeOf( ulong ) dstPaddingPix = dstBuffer->pitch \ sizeOf( ulong ) '' pointer to pixel data (skip header in bytes) src = cast( ulong ptr, srcBuffer ) + sizeOf( fb.image ) \ srcBuffer->bpp dst = cast( ulong ptr, dstBuffer ) + sizeOf( fb.image ) \ dstBuffer->bpp '' calculate size of padding, as FB aligns the width of the images to a multiple of 16 bytes srcPadding = srcPaddingPix - srcBuffer->width dstPadding = dstPaddingPix - dstBuffer->width '' compute clipping values srcEndX = min( srcBuffer->width - 1, ( ( dstBuffer->width - 1 ) - ( x + srcBuffer->width - 1 ) ) + srcBuffer->width - 1 ) srcEndY = min( srcBuffer->height - 1, ( ( dstBuffer->height - 1 ) - ( y + srcBuffer->height - 1 ) ) + srcBuffer->height - 1 ) '' calculate the strides dstStride = dstPaddingPix - ( srcEndX - srcStartX ) - 1 srcStride = srcPadding + srcStartX + ( srcBuffer->width - 1 - srcEndX ) '' offset the destination buffer to its starting position dst += ( ( dstStartY * ( dstBuffer->pitch \ sizeOf( ulong ) + dstPadding ) ) + dstStartX ) end if '' offset the source buffer to its starting position src += ( ( srcStartY * srcPaddingPix ) + srcStartX ) '' blit pixels for y as integer = srcStartY to srcEndY for x as integer = srcStartX to srcEndX *dst = *src '' next pixel dst += 1 src += 1 next '' add the stride to the end of each horizontal scanline dst += dstStride src += srcStride next end sub dim as integer screenWidth = 800, screenHeight = 600 screenRes( screenWidth, screenHeight, 32 ) /' Loads an image using bload, so you have to set the width and height of the buffer manually, or peek them from the BMP file '/ dim as fb.image ptr img = imageCreate( 256, 208 ) bload( "c:/disco viejo/bmp/test001.bmp", img ) dim as double t, sum dim as uinteger total dim as integer mx, my do getMouse( mx, my ) screenLock() cls() t = timer() blit( mx - img->width / 2, my - img->height / 2, img ) t = timer() - t screenUnlock() sum += t total += 1 windowTitle( "FPS: " & str( int( 1 / ( sum / total ) ) ) ) sleep( 1 ) loop until( inkey() <> "" ) imageDestroy( img )
See the implementation (used by the blended blitter that I posted before), it's really easy to figure out what's going on. The main blitting loop is this:
The rest of the code are the calculations needed to blit the pixels safely and fast. You can use it to blit to screen, or to another buffer, and it performs clipping as well.Code: Select all
'' blit pixels for y as integer = srcStartY to srcEndY for x as integer = srcStartX to srcEndX *dst = *src '' next pixel dst += 1 src += 1 next '' add the stride to the end of each horizontal scanline dst += dstStride src += srcStride next
As you can see, the code it's very similar to the scaler (sans the scaling code, of course), so you'll be able to customize it easily to suit your needs =D
Re: Does anyone know what algo XP -> full screen DOS?
Straight from one image to full screen, I don't need clipping.
And If I know that there are no transparent bits, I can shortcut this condition also.
Fps about 44 here now.
Please note : use the 32 bit compiler, the 64 bit is much slower.
And If I know that there are no transparent bits, I can shortcut this condition also.
Fps about 44 here now.
Please note : use the 32 bit compiler, the 64 bit is much slower.
Code: Select all
function resizeimage(im As Any Ptr,angle As long,Wdth As Single,Hght as single) as any ptr
#define map(a,b,x,c,d) ((d)-(c))*((x)-(a))\((b)-(a))+(c)
#define InRange() resultx>=0 And resultx<ddx And resulty>=0 And resulty<ddy And _
x>=0 And x<xres And y>=0 And y<yres
static As Integer pitch,pitchs,xres,yres
static As Any Ptr row,rowS
static As Ulong Ptr pixel,pixels
static As Integer ddx,ddy,resultx,resulty
Imageinfo im,ddx,ddy,,pitch,row
static as any ptr im2:im2=imagecreate(Wdth,Hght)
Screeninfo xres,yres
imageinfo im2,,,,pitchS,rowS
static As Ulong empty = Rgb(255,0,255)
For y As long=0 To Hght-1
resulty=map(0,Hght,y,0,ddy)
For x As long=0 To Wdth-1
resultx=map(0,Wdth,x,0,ddx)
'If InRange() Then 'no clip
pixel=row+pitch*resultY+resultX Shl 2
'If *pixel <> empty Then 'no empty pixels
pixels=rowS+pitchS*(y)+(x) Shl 2
*pixels=*pixel
'End If
'End If
Next x
Next y
return im2
End function
Function framecounter() As long
dim as double t2=timer
Static As Double t3,frames,answer
frames=frames+1
If (t2-t3)>=1 Then
t3=t2
answer=frames
frames=0
End If
Return answer
End Function
dim as integer xres,yres
screeninfo xres,yres
screenres xres,yres,32,,&h08 'no frame
dim as any ptr i=imagecreate(250,200,rgb(0,100,255))
draw string i,(20,20),"Hello, press any key"
circle i,(125,100),50,rgb (200,0,0),,,,f
line i,(0,0)-(249,199),rgb(0,200,0),b
put(0,0),i,trans
sleep
cls
do
screenlock
cls
var im=resizeimage(i,0,xres,yres)
put(0,0),im,pset
draw string(50,50),"FPS " &framecounter
screenunlock
draw string i,(rnd*250,rnd*200),"" &chr(rnd*127),rgb(rnd*255,rnd*255,rnd*255)
sleep 1,1
imagedestroy im
loop until inkey=chr(27)
sleep
Re: Does anyone know what algo XP -> full screen DOS?
It already process the bitmaps from memory. All FB primitives accept a destination buffer as parameter. See dodicat's code above, he draws in a buffer, and then scales it to fit the screen:CGAMan wrote:Oh, I see. It seems relatively easy to modify. BTW, can this process bitmaps in memory? (Meaning the original bitmap is generated on demand, not read from a file.) I'd want to avoid reading/writing anything from/to the hard drive, if possible. (Sorry for sounding like a newbie, but I've never worked with bitmaps in BASIC before...)
Code: Select all
dim as any ptr i=imagecreate(250,200)
for n as long=1 to 1000:pset i,(rnd*250,rnd*200),rgb(rnd*255,rnd*255,rnd*255):next
draw string i,(20,20),"Hello, press any key"
circle i,(125,100),50,rgb (200,0,0),,,,f
line i,(0,0)-(249,199),rgb(0,200,0),b
I get 22, either in 32 or 64 bit. But my box is a piece of crap anyway =Ddodicat wrote:Straight from one image to full screen, I don't need clipping.
And If I know that there are no transparent bits, I can shortcut this condition also.
Fps about 44 here now.
Please note : use the 32 bit compiler, the 64 bit is much slower.
Re: Does anyone know what algo XP -> full screen DOS?
What FPS do you get for this?
Windows 32 bit compiler only.
Windows 32 bit compiler only.
Code: Select all
#include "fbgfx.bi"
Declare Function MoveWindow Alias "MoveWindow"(As Any Ptr,As Integer,As Integer,As Integer,As Integer,As Integer) As Integer
declare function settimer alias "timeBeginPeriod"(as Ulong=1) as long
declare function freetimer alias "timeEndPeriod" (as Ulong=1) as long
Function framecounter() As long
dim as double t2=timer
Static As Double t3,frames,answer
frames=frames+1
If (t2-t3)>=1 Then
t3=t2
answer=frames
frames=0
End If
Return answer
End Function
'========= SET UP WINDOW ==============
dim as integer w,h
screencontrol(FB.GET_DESKTOP_SIZE ,w,h)
screenres 350,300,32,,FB.GFX_NO_FRAME or FB.GFX_ALWAYS_ON_TOP
Dim As Integer I
Screencontrol(FB.GET_WINDOW_HANDLE ,I)
Dim As Any Ptr Win = Cast(Any Ptr,I)
movewindow(win,0,0,w,h,1)
'movewindow (window handle, upper left corner X,upper left corner Y,new width,new height,1)
'=======================================
dim as any ptr im=imagecreate(350,300,rgb(0,100,255))
draw string im,(20,20),"Hello, press any key"
circle im,(175,150),50,rgb (200,0,0),,,,f
line im,(0,0)-(349,299),rgb(0,200,0),b
'getmouse mx,my
do
screenlock
cls
put(0,0),im,pset
draw string im,(rnd*350,20+rnd*300),"" &chr(rnd*127),rgb(rnd*255,rnd*255,rnd*255)
draw string (50,10),"FPS " &framecounter,rgb(0,200,0)
screenunlock
settimer
sleep 1,1
freetimer
loop until len(inkey)
Last edited by dodicat on Dec 14, 2017 22:27, edited 1 time in total.
Re: Does anyone know what algo XP -> full screen DOS?
I get 65 with GAS, don't have 32 bit GCC (yet). Same in 64 bit.dodicat wrote:What FPS do you get for this?
Windows 32 bit compiler only.
Re: Does anyone know what algo XP -> full screen DOS?
I have tweaked the code a bit.
GAS is good, my favourite compiler.
I get 500 fps.
GAS is good, my favourite compiler.
I get 500 fps.
Re: Does anyone know what algo XP -> full screen DOS?
Nice! I would like to see the code, too!dodicat wrote:I have tweaked the code a bit.
GAS is good, my favourite compiler.
I get 500 fps.
Ok, I finished it. Download it from my repo, here: https://github.com/glasyalabolas/fb-image-resize-demo. It's merely an approximation, not the real thing. However, it gives very close results to the implementation by counting_pine (which I used as a reference). Use the same image on both and compare them.CGAMan wrote:[...] >20fps would be insane, enough to animate the graphics.
Bah, I get a measly ~200 FPS with 'test.bmp' (256x208), and ~150 with 'test2.bmp' (640x480), scaled to HD 720p (1280x720). Test it and tell me your results. For compiling, I use the 64-bit GCC backend with all optimizations in place (fbc -gen gcc -Wc -O3).
I forgot to mention it before, but the reference implementation of the scaling code can be found here: http://www.drdobbs.com/database/a-2-d-d ... /184410169. I adapted it to my coding style, of course, but it's straightforward enough.
Re: Does anyone know what algo XP -> full screen DOS?
Thank you. The algo by counting_pine was the one I ported to C# with parallel computing and subsequently deployed in an actual C# application I'm currently using...paul doe wrote:Nice! I would like to see the code, too!dodicat wrote:I have tweaked the code a bit.
GAS is good, my favourite compiler.
I get 500 fps.Ok, I finished it. Download it from my repo, here: https://github.com/glasyalabolas/fb-image-resize-demo. It's merely an approximation, not the real thing. However, it gives very close results to the implementation by counting_pine (which I used as a reference). Use the same image on both and compare them.CGAMan wrote:[...] >20fps would be insane, enough to animate the graphics.
Bah, I get a measly ~200 FPS with 'test.bmp' (256x208), and ~150 with 'test2.bmp' (640x480), scaled to HD 720p (1280x720). Test it and tell me your results. For compiling, I use the 64-bit GCC backend with all optimizations in place (fbc -gen gcc -Wc -O3).
I forgot to mention it before, but the reference implementation of the scaling code can be found here: http://www.drdobbs.com/database/a-2-d-d ... /184410169