Sorry, I was busy.
For Image, I wrote code. Before I used follows code.
This tips is very slow. coz 8192x8192 imaging. I am creating photo print software.
In Future, 15000x1000 imaging will use at Digital still camera. then this tips don't use future.
DrawingBuffer used, 3x Speed up.
1. TIFF LOAD 32bit
2. GrabImage or DrawImage
3. SaveImage ..... Create dust image.
I add code at 2, DrawImage & $FFFFFF, Mask Process. 3 is OK. 32to24 need & $FFFFFF.
Maybe, Purebasic TIFF load and SaveImage Process Problem. Display is OK.
Code: Select all
Procedure CopyImageToMemory(ImageNumber.l, Memory.l)
Protected TemporaryDC.l, TemporaryBitmap.BITMAP, TemporaryBitmapInfo.BITMAPINFO
TemporaryDC = CreateDC_("DISPLAY", #Null, #Null, #Null)
GetObject_(ImageID(ImageNumber), SizeOf(BITMAP), TemporaryBitmap.BITMAP)
TemporaryBitmapInfo\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
TemporaryBitmapInfo\bmiHeader\biWidth = TemporaryBitmap\bmWidth
TemporaryBitmapInfo\bmiHeader\biHeight = -TemporaryBitmap\bmHeight
TemporaryBitmapInfo\bmiHeader\biPlanes = 1
TemporaryBitmapInfo\bmiHeader\biBitCount = 32
TemporaryBitmapInfo\bmiHeader\biCompression = #BI_RGB
GetDIBits_(TemporaryDC, ImageID(ImageNumber), 0, TemporaryBitmap\bmHeight, Memory, TemporaryBitmapInfo, #DIB_RGB_COLORS)
DeleteDC_(TemporaryDC)
EndProcedure
Procedure CopyImageToMemory2(ImageNumber.l, Memory.l)
Shared PrinterDC
Protected TemporaryBitmap.BITMAP, TemporaryBitmapInfo.BITMAPINFO
GetObject_(ImageID(ImageNumber), SizeOf(BITMAP), @TemporaryBitmap.BITMAP)
TemporaryBitmapInfo\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
TemporaryBitmapInfo\bmiHeader\biWidth = TemporaryBitmap\bmWidth
TemporaryBitmapInfo\bmiHeader\biHeight = -TemporaryBitmap\bmHeight
TemporaryBitmapInfo\bmiHeader\biPlanes = 1
TemporaryBitmapInfo\bmiHeader\biBitCount = 32
TemporaryBitmapInfo\bmiHeader\biCompression = #BI_RGB
GetDIBits_(PrinterDC, ImageID(ImageNumber), 0, TemporaryBitmap\bmHeight, Memory, TemporaryBitmapInfo, #DIB_RGB_COLORS)
EndProcedure
Procedure CopyMemoryToImage(Memory.l,ImageNumber.l)
Protected TemporaryDC.l, TemporaryBitmap.BITMAP, TemporaryBitmapInfo.BITMAPINFO
TemporaryDC = CreateDC_("DISPLAY", #Null, #Null, #Null)
GetObject_(ImageID(ImageNumber), SizeOf(BITMAP), TemporaryBitmap.BITMAP)
TemporaryBitmapInfo\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
TemporaryBitmapInfo\bmiHeader\biWidth = TemporaryBitmap\bmWidth
TemporaryBitmapInfo\bmiHeader\biHeight = -TemporaryBitmap\bmHeight
TemporaryBitmapInfo\bmiHeader\biPlanes = 1
TemporaryBitmapInfo\bmiHeader\biBitCount = 32
TemporaryBitmapInfo\bmiHeader\biCompression = #BI_RGB
SetDIBits_(TemporaryDC, ImageID(ImageNumber), 0, TemporaryBitmap\bmHeight, Memory, TemporaryBitmapInfo, #DIB_RGB_COLORS)
DeleteDC_(TemporaryDC)
EndProcedure
2. For Audio
I want to ALL way, If it is honest. CPU today can be sped up in the process in cpu cache.
The target of the software that I think about has CPU that is faster than Core2Duo.
SSE4.1 using is OK. Before my audio code.
Code: Select all
Procedure.l Float32toInt32(*Float32, len.l)
; #Float32toInt24_LittleEdian = 1
; #Float32toInt24_BigEdian = 2
Protected tmpIn.f, tmp.l ;, len2.l
For i = 0 To len-1 Step 4
tmpIn = PeekF(*Float32+i)
tmpIn * $7FFFFFF0
tmp = Int(tmpIn)
PokeL(*Float32+i, tmp)
; If flg=#Float32toInt24_LittleEdian
; PokeA(*Int24 +len2 , ( tmp >> 8 )&$FF )
; PokeA(*Int24 +len2 +1, ( tmp >> 16 )&$FF )
; PokeA(*Int24 +len2 +2, ( tmp >> 24 )&$FF )
; len2 +3
; Else
; PokeA(*Int24 +len2 , ( tmp >> 24 )&$FF )
; PokeA(*Int24 +len2 +1, ( tmp >> 16 )&$FF )
; PokeA(*Int24 +len2 +2, ( tmp >>8 )&$FF )
; len2 +3
; EndIf
Next
; ;WriteData(10, *Int24, len2-8)
; Debug "LEN2>>"+Str(len2)
; Debug len*0.75+3
; ProcedureReturn len2
EndProcedure
; Procedure Float32toInt24(*in_buf, in_len.l, *out_buf)
; Protected Result.l
; !PXOR xmm5, xmm5 ; R
; !MOV Esi, $7FFFFFFF
; !MOVD xmm5, Esi
; !XOR Esi, Esi
; !XOR Edi, Edi
; !MOV Esi, [p.p_in_buf]
; !MOV Edi, [p.p_out_buf]
; For i=0 To in_len Step 4
; !XOR Ebx, Ebx
; !PXOR xmm0, xmm0 ; L
; !MOVSS xmm0, [Esi] ; L
; !ADD Esi,4
; !MULSS xmm0, xmm5
; !CVTSS2SI Ebx, xmm0
; !MOV [Edi], Ebx
; !ADD Edi, 3
; Next
; ; For i=0 To len Step 4
; ; Result = PeekF(*in_buf+i*4) * 8388607
; ; PokeA(*out_buf+i*3, (Result >> 16)&$FF)
; ; PokeA(*out_buf+i*3+1, (Result >> 8)&$FF)
; ; PokeA(*out_buf+i*3+2, Result&$FF)
; ; Next
; EndProcedure
The SINCE interpolations, I posted before are 32 bits Float.
I worried from the experience of making it using neither BASS nor FOOD
the audio processing because of processing that the bit conversion was
fatal and slow. The code in which CPU cache was used with
the MultiThreading was written. Moreover, the memory buffer of 200MB
or more was needed.
I need ...
Float32 to int24, int24 to Float32, int24 to int32, and int32 to int24.
and need in future
Float64 to int32, int24 to Float64, etc
His character was too bad though I had consulted the audio programmer in Japan.
He created most high quality audio player in the world at 2003. It's freeware.
In Time, KarlKox asissted me.
Here, SINC code. more fast.
http://karlkox.blogspot.com/2009/05/pro ... ie-de.html
But I did not understand it, coz very difficult.
resiult
KarlKox wrote:
Mais ces deux simples différences sont éloquentes :
- code PureBasic : 6520 ms en moyenne,
- code SSE2 : 170 ms en moyenne.
My audio souce code (I needed 4 month 24/7)
http://purebasic.coolverse.jp/_userdata/nr3.7z
It was pointed out it was higher than ten dollars when it tried to
set 1000 yen, and was rejected the license to FMOD.
$1 = 80 yen. but correct rate is $1= 130 yen, 1 euro = 150 yen.
BASS cannot be mastered by the error's of the memory processing
occurring easily. When 5000 lines are passed, it doesn't understand
even if the cause of the error passes one month.
I had failed very much before the support of KarlKox though
PortAudio was used easily. Now, Bug fixed.
then I used WaveOut only. Japanese resouces wrote about int16
and float32 only. I didn't know about int24.
The acquaintance of the highest audio consultation in Japan
told it to support Int24 last year. He worked USB-DAC design
about Styleaudio CARAT-Ruby, Topaz, Topaz signature.
The product of Topaz signature is the first customer satisfaction
measurement place in Japan.
If I will make new audio player, need int24 process.