English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 01 September 2014, 15:09   #1021
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,305
Quote:
Originally Posted by PeterK View Post
Sorry, but your script seems to be unusable now. Under DOpus5 it says "No directories here. Choose the official test icon package!". Such a message is just annoying. And on the Workbench the script starts with its passes, but it seems to be in an endless loop of very fast measurements.
Please try again. Now it should open a CON window with trace output. Just send me the output. I`ve changed the error message to a better one
daxb is offline  
Old 01 September 2014, 18:21   #1022
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
Happy

@PeterK

Ok, I changed it. I just noticed that it requires longword ops. Doesn't it?

Code:
calc_pixels	; apply ARGB data onto RGB data

		moveq	#0,d0			; image
		moveq	#0,d1			; screen
		moveq	#0,d2			; alpha
		move.w	#255,d3

.loop		move.b	(a0)+,d2		; get alpha value
		beq	.skip			; full transparency?

		cmp.b	d3,d2			; full opaqueness?
		beq	.copy

		move.b	d2,d0
		lsl.w	#8,d2
		add.b	d0,d2

		moveq	#0,d0

		move.b	(a0)+,d0
		move.b	(a1),d1
		sub.l	d1,d0
		muls.l	d2,d0
		swap	d0
		add.w	d1,d0
		move.b	d0,(a1)+

		moveq	#0,d0

		move.b	(a0)+,d0
		move.b	(a1),d1
		sub.l	d1,d0
		muls.l	d2,d0
		swap	d0
		add.w	d1,d0
		move.b	d0,(a1)+

		moveq	#0,d0

		move.b	(a0)+,d0
		move.b	(a1),d1
		sub.l	d1,d0
		muls.l	d2,d0
		swap	d0
		add.w	d1,d0
		move.b	d0,(a1)+

		dbf	d7,.loop
		rts

.skip		addq.l	#3,a0
		addq.l	#3,a1
		dbf	d7,.loop
		rts

.copy		move.b	(a0)+,(a1)+
		move.b	(a0)+,(a1)+
		move.b	(a0)+,(a1)+
		dbf	d7,.loop
		rts
AGS is offline  
Old 01 September 2014, 18:27   #1023
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
And I think you have to add 1, so that you get (257 * alpha) + 1
PeterK is offline  
Old 01 September 2014, 18:29   #1024
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
Hmm, why this? I cannot see through here.
AGS is offline  
Old 01 September 2014, 18:34   #1025
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
Yeah, I'm not really sure if you would get 255 as a possible result. On the other hand, you may not get zero, when adding 1 ??

(255 * 257) * 255 = $FE FF 01 => $FE
((255 * 257) + 1) * 255 = $FF 00 00 => $FF

Last edited by PeterK; 03 September 2014 at 10:40.
PeterK is offline  
Old 01 September 2014, 18:43   #1026
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
The biggest alpha value that can come into the function is $fe, because $ff is treated as fully opaque and copied. I don't know if that matters here?
AGS is offline  
Old 01 September 2014, 18:47   #1027
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
Yes, that would solve the problem. So you don't need to add 1
PeterK is offline  
Old 01 September 2014, 18:49   #1028
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
That's good to know, even that I do not really understand what's going on.
AGS is offline  
Old 01 September 2014, 18:53   #1029
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
move.b d2,d0
lsl.w #8,d2
add.b d0,d2

That should better be all long

and also clear D2 at the top of the loop
you don't need to clear D0 the first time then

What's going on ?
It should become faster ...

Last edited by PeterK; 01 September 2014 at 19:08.
PeterK is offline  
Old 01 September 2014, 19:01   #1030
Michael
A1260T/PPC/BV/SCSI/NET
 
Michael's Avatar
 
Join Date: Jan 2013
Location: Moscow / Russia
Posts: 840
Quote:
Originally Posted by daxb View Post
Please try again. Now it should open a CON window with trace output. Just send me the output. I`ve changed the error message to a better one
Similar problems here, DOPUS or WB, same error in line 65
Command returned 10/47: Arithmetic conversion error
Michael is offline  
Old 01 September 2014, 19:11   #1031
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
Why long? I tried it. And the add can be changed into a move.
AGS is offline  
Old 01 September 2014, 19:15   #1032
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
Ok, ok, you're right, because the byte in D2 is empty

Ok, I better don't make any suggestions anymore (too many mistakes)

Is it faster now ??

Last edited by PeterK; 01 September 2014 at 19:39.
PeterK is offline  
Old 01 September 2014, 19:40   #1033
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
I have no real idea how to measure. What can be seen is the speed of WritePixelArray(). The blending works in the background.
AGS is offline  
Old 01 September 2014, 20:01   #1034
TuKo
Apollo Team
 
TuKo's Avatar
 
Join Date: May 2014
Location: not far
Posts: 381
A bit off topic, but would it be possible to write an icfind or wbfind equivalent for graphics.library ? I can't get it to fit into my small A4000D romfile.
TuKo is offline  
Old 01 September 2014, 20:10   #1035
Michael
A1260T/PPC/BV/SCSI/NET
 
Michael's Avatar
 
Join Date: Jan 2013
Location: Moscow / Russia
Posts: 840
My updated results
for icon.library 46.4.378 and Kens icon pack in ram
CGX 8bit - 11.24 s
CGX 16bit - 10.94 s
CGX 24bit - 10.98 s

for icon.library 46.4.378 and Crystal icon pack in ram
CGX 8bit - 2.00 s
CGX 16bit - 1.52 s
CGX 24bit - 1.56 s

It's amazing, 16 and 24 bit are now faster then 8 bit and run at similar speed (previously 24bit was considerably slower the 16bit)

And for the fun icon.library v5x.xx
Kens does not render anything obvioulsy, but does the check 11 times!!!
and it takes 0.98 s for the loop

Crystal icon pack in ram
CGX 8bit - 36.92 s
CGX 16bit - 37.84 s
CGX 24bit - 38.02 s

So it's 25 times faster then OS4 lib
Michael is offline  
Old 01 September 2014, 20:18   #1036
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
Quote:
Originally Posted by TuKo View Post
A bit off topic, but would it be possible to write an icfind or wbfind equivalent for graphics.library ? I can't get it to fit into my small A4000D romfile.
Ask Don Adan, plz.

@Michael
Thank you for your results. Not rendering the PNG icons is a DOpus5 problem. If the drawer icon is in OS 3.5 format, then DOpus will display the contents of the drawer. See some posts above.
PeterK is offline  
Old 02 September 2014, 12:13   #1037
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,305
Quote:
Originally Posted by Michael View Post
Similar problems here, DOPUS or WB, same error in line 65
Command returned 10/47: Arithmetic conversion error
Sorry, I forgot to remove my test stuff. Should work now. Here it works with DOpus5 (cannot test WB). So I need the trace output to see what goes wrong on your system.

Last edited by daxb; 06 September 2014 at 18:44.
daxb is offline  
Old 03 September 2014, 15:21   #1038
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
Quote:
Originally Posted by PeterK View Post
Yeah, I'm not really sure if you would get 255 as a possible result. On the other hand, you may not get zero, when adding 1 ??

(255 * 257) * 255 = $FE FF 01 => $FE
((255 * 257) + 1) * 255 = $FF 00 00 => $FF
@AGS
Hello Andreas,
to be on the safe side, I've checked your and my formula for the alpha blending completely again by writing a small test routine. The result was that your original and my modified formula were both not rounding correctly.

My test program compares the results for all possible cases of Alpha, Image and Screen with the formula (A*I+(255-A)*S)/255. In order to get correct results you have to add 1 in my formula only when I-S is a positive value (see .fits). Use Set after AlphaTest is done to see the number of wrong roundings in RC. Of course, it's zero now!

Code:
        MOVEQ       #0,D0
        MOVE.L      #255,D7
        MOVE.L      D7,D1 ; a
.alpha  MOVE.L      D7,D2 : i
.image  MOVE.L      D7,D3 ; s
.screen MOVE.L      D1,D4
        LSL.L       #8,D4
        MOVE.B      D1,D4 ; 257*a
        MOVE.L      D2,D5
        SUB.L       D3,D5 ; i-s
        BMI.S       .fits
        ADDQ.L      #1,D4
.fits   MULS.L      D5,D4 ; (257*a+1)*(i-s) or (257*a)*(i-s)
        SWAP        D4    ;  / 65536
        ADD.W       D3,D4 ;  + s
.orig   MOVE.L      D1,D5
        MULU.L      D2,D5
        MOVE.L      D7,D6
        SUB.L       D1,D6
        MULS.L      D3,D6
        ADD.L       D5,D6
        DIVS.L      D7,D6 ; (a*i+(255-a)*s)/255 correct formula
        CMP.B       D4,D6
        BEQ.S       .next
        ADDQ.L      #1,D0 ; error counter
.next   DBRA        D3,.screen
        DBRA        D2,.image
        DBRA        D1,.alpha
        RTS
; Enter Set into the shell for RC = error counter
@daxb
The log from OpenWin.rexx on WB is attached. Please, don't use subdirs. That's all just confusing now. I still cannot see any advantage of your new features when I compare it with the script in my last Aminet release. The DOpus5 problem with handling PNG icons could be solved as I already suggested. That's the only improvement that would make sense IMHO. But of course, it's your script, and you must decide what it should do.
Attached Files
File Type: rar AlphaTest.rar (588 Bytes, 187 views)
File Type: rar OpenWinWB.rar (3.4 KB, 186 views)

Last edited by PeterK; 04 September 2014 at 15:31.
PeterK is offline  
Old 04 September 2014, 19:10   #1039
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
@PeterK

Thanks. Here Mrs Beanbag suggests to multiply with 258: http://eab.abime.net/showpost.php?p=973598&postcount=76 ... can that be correct?
AGS is offline  
Old 04 September 2014, 20:15   #1040
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
Quote:
Originally Posted by AGS View Post
Here Mrs Beanbag suggests to multiply with 258: http://eab.abime.net/showpost.php?p=973598&postcount=76
... can that be correct?
No sorry, I think not. My AlphaTest shows that my current formula is 100 % correct, because it uses a different rounding for positive and negative cases of (i-s).

But, of course, Mrs Beanbag can feel free to modify the AlphaTest and tell us the number of rounding errors. I'm curious about it.

What exactly is the formula suggested by Mrs Beanbag?
Mrs Beanbag should not just trust her eyes by comparing images. (S)he should better modify my AlphaTest and do a complete comparison of all 16 million cases.

Last edited by PeterK; 04 September 2014 at 20:40.
PeterK is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
ClassicWB Full and icon.library 46.4 Retroplay project.ClassicWB 8 05 August 2018 13:57
WB library conflict/versions Amiga1992 support.Apps 3 22 July 2010 18:47
PNG Icon to Color Icon Converter? Leandro Jardim request.Apps 1 24 May 2010 04:39
What's the latest version of icon.library for OS3.9? NovaCoder support.Apps 3 30 June 2009 15:43
Requesting icon.library v44+... nikvest request.Other 2 16 September 2007 01:58

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:17.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.17034 seconds with 15 queries