English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 18 October 2013, 01:40   #61
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by NovaCoder View Post
As I mentioned above, I cannot build NetSurf so I cannot test any optimizations myself unfortunately
Why not ask arti to help you compile it?

Quote:
Originally Posted by NovaCoder View Post
The AGA SDL which NetSuf is built on only support 256 color AGA displays and so it will not support HAM8 without making changes to the SDL library.....please be my guest if you want to prove me wrong
The changes should be very simple if you know your way around SDL AGA's code. The idea is to simply open a HAM8 screen instead of a 256 color screen, and setup a 64 color palette instead of a 256 color palette.

Since HAM8 is an 8 bit mode, SDL AGA shouldn't know the difference, except that there are fewer palette colors available. After that, you simply use HAM8 render code to render images and what not, and blit that to the screen as normal. The only thing the browser needs to know is to only use the first 64 colors for the GUI instead of 256.

Hypothetically

Quote:
Originally Posted by NovaCoder View Post
I'd have thought rendering speed should be given priority over quality so why are we even discussing HAM displays?
Yes. The problem is that the moment you don't optimize the fixed palette rendering routine with tables, that you're going to get HAM8 rendering speeds, so that you may as well use that instead (even though that also uses a table).
Thorham is offline  
Old 18 October 2013, 02:15   #62
NovaCoder
Registered User
 
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
Arti once sent me his entire workspace but I still couldn't build it because he has his machine configured in a very strange way.

NetSurf is a massive project with lots of dependencies, it's really hard to get it to compile for 68k.
NovaCoder is offline  
Old 18 October 2013, 02:37   #63
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by NovaCoder View Post
Arti once sent me his entire workspace but I still couldn't build it because he has his machine configured in a very strange way.
No kidding, that sucks

Quote:
Originally Posted by NovaCoder View Post
NetSurf is a massive project with lots of dependencies, it's really hard to get it to compile for 68k.
And I thought Dopus 5.82 was hard to build (still can't)
Thorham is offline  
Old 18 October 2013, 07:56   #64
britelite
Registered User
 
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 818
Quote:
Originally Posted by Thorham View Post
Since HAM8 is an 8 bit mode, SDL AGA shouldn't know the difference, except that there are fewer palette colors available. After that, you simply use HAM8 render code to render images and what not, and blit that to the screen as normal. The only thing the browser needs to know is to only use the first 64 colors for the GUI instead of 256.
I'd say quite a lot of webpages might look quite bad if images are rendered in ham8 with all other elements mapped to the 64 color palette, rather than mapping everything to the same 256 color palette. Consider images that are used as elements on a webpage, with the ham8 they will most likely not match the rest of the page anymore.
britelite is offline  
Old 18 October 2013, 09:16   #65
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by britelite View Post
I'd say quite a lot of webpages might look quite bad if images are rendered in ham8 with all other elements mapped to the 64 color palette, rather than mapping everything to the same 256 color palette. Consider images that are used as elements on a webpage, with the ham8 they will most likely not match the rest of the page anymore.
I mean that you render the GUI using the palette and the page in HAM8. Didn't write that very clearly
Thorham is offline  
Old 18 October 2013, 09:52   #66
britelite
Registered User
 
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 818
Quote:
Originally Posted by Thorham View Post
I mean that you render the GUI using the palette and the page in HAM8. Didn't write that very clearly
Wouldn't text look even worse then?
britelite is offline  
Old 18 October 2013, 10:00   #67
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by britelite View Post
Wouldn't text look even worse then?
Not with good HAM8 rendering.
Thorham is offline  
Old 18 October 2013, 10:33   #68
britelite
Registered User
 
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 818
Quote:
Originally Posted by Thorham View Post
Not with good HAM8 rendering.
Care to show any examples?

EDIT: And with examples I mean different colored texts on different colored backgrounds, without using the colors from 64 color palette.

Last edited by britelite; 18 October 2013 at 10:38.
britelite is offline  
Old 18 October 2013, 11:05   #69
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by britelite View Post
Care to show any examples?
Perhaps, I'll see what I can do.

Quote:
Originally Posted by britelite View Post
EDIT: And with examples I mean different colored texts on different colored backgrounds, without using the colors from 64 color palette.
That's a little hard to control, because the HAM renderer I use (part of an open source viewer called V, by meynaf) will choose between palette colors and HAM colors automatically.
Thorham is offline  
Old 18 October 2013, 11:11   #70
britelite
Registered User
 
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 818
Quote:
Originally Posted by Thorham View Post
That's a little hard to control, because the HAM renderer I use (part of an open source viewer called V, by meynaf) will choose between palette colors and HAM colors automatically.
Well, you could set the palette to all black, that way it won't use the palette in most cases. Another, more realistic, idea would be to set the palette to 64 shades of grey. I mainly want to see how well it handles different color combinations in HAM8.
britelite is offline  
Old 18 October 2013, 12:03   #71
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by britelite View Post
Another, more realistic, idea would be to set the palette to 64 shades of grey. I mainly want to see how well it handles different color combinations in HAM8.
I can tell you right now that that won't work well. The algorithm relies on a proper palette to handle hard color combinations reasonably well. Using only greys reduces the rendering quality too much.

Anyway, you can try the algorithm with meynaf's picture viewer: http://meynaf.free.fr/pr/mv.lzx. Needs a 68020+ and AOS3. Supports JPG, PNG, BMP, IFF, GIF and some other formats.
Thorham is offline  
Old 18 October 2013, 16:09   #72
britelite
Registered User
 
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 818
Quote:
Originally Posted by Thorham View Post
I can tell you right now that that won't work well. The algorithm relies on a proper palette to handle hard color combinations reasonably well. Using only greys reduces the rendering quality too much.
That pretty much was my point. Considering the web isn't black text on a white background anymore, you need to be able to map both text AND background to the fixed 64 color palette, or the text will get ugly pretty quick.
britelite is offline  
Old 18 October 2013, 18:56   #73
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by britelite View Post
That pretty much was my point. Considering the web isn't black text on a white background anymore, you need to be able to map both text AND background to the fixed 64 color palette, or the text will get ugly pretty quick.
I meant a proper fixed palette. A gray scale palette really isn't very good, and will certainly get ugly fast. With a proper fixed palette (which it uses by default), it probably won't do so badly.

Why don't you try the viewer with a bunch of screen grabs of web pages which you think the algorithm will screw up? Or, you could link to a few pages which you think will look crappy.
Thorham is offline  
Old 18 October 2013, 23:06   #74
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
To PeterK:

If you're interested, here's the 676 version of my render program: render24bit676.s. You can make the image brighter or darker by increasing or decreasing a2 before the outer loop in the code below.

I managed to optimize the render loop further (discovered displacements are free):

Code:
;
; render loop
;
	move.l	#512-1,d7	; image height
.loopy
	move.l	#640-1,d6	; image width
.loopx
	move.b	(a0)+,d0
	move.b	(a2,d0.w,256*6.w),d1

	move.b	(a0)+,d0
	add.b	(a2,d0.w,256*3.w),d1

	move.b	(a0)+,d0
	add.b	(a2,d0.w),d1

	sub.l	d2,a2

	move.b	d1,(a1)+

; dithering
	subq.l	#1,d3
	bge	.l1
	moveq	#2,d3
	add.l	d4,a2

.l1
	dbra	d6,.loopx
	sub.l	#640*6,a0
	dbra	d7,.loopy
Changing the code to handle ABGR is no problem, but BMP files are BGR

Last edited by Thorham; 18 October 2013 at 23:15.
Thorham is offline  
Old 19 October 2013, 16:11   #75
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 662
Sorry I'm not posting anything but I don't have time atm. Maybe tommorrow.
arti is offline  
Old 20 October 2013, 07:50   #76
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,374
Hello arti,
how far could you get with my C coding efforts? Please, ask me to explain anything that looks confusing.

I've already found some small bugs and tried to optimize the code a bit by commenting out some lines which may not be required for Netsurf. The most important changes are here:
Code:
nsfb_palette_generate_cube_676(struct nsfb_palette_s *palette);
/* this call has to be used in the function set_palette(nsfb_t *nsfb) in sdl.c */
/* I'm not sure how this has to be handled to avoid the NetSurf dithering for my palette */
Code:
case NSFB_PALETTE_CUBE_676:
// unused	*r_error = 0;
// unused	*g_error = 0;
// unused	*b_error = 0;
// optional	if (c < 0x46000000) return 0; /* alpha < 70 gets pen 0 */
// optional	if (!(c & 0xF8F8F8)) return 1; /*this color is black */

	if (pushRGBlevel = ~pushRGBlevel) { /* push up every 2. pixel  = primitive dithering */
		if (((c & 0xFF) + 0x16) < 0x100) c += 0x16;
		if (((c & 0xFF00) + 0x1600) < 0x10000) c+= 0x1600;
		if (((c & 0xFF0000) + 0x160000) < 0x1000000) c+= 0x160000;
	}
	
	/* the following code can be replaced with Thorham's table later */
	best_col = 4;
	dr = (c & 0xFF) - 0x35;
	while (dr >= 0) {
		best_col +=0x2A;
		dr -= 0x2B;
	}
	dg = ((c >> 8) & 0xFF) - 0x29;
	while (dg >= 0) {
		best_col +=6;
		dg -= 0x25;
	}
	db = ((c >> 16) & 0xFF) - 0x35;
	while (db >= 0) {
		best_col ++;
		db -= 0x2B;
	} /* Thorham's end will come here ;) */
	
	if (best_col == 255)
		if (!(~(c | 0xFF070707))) return 2; /* this color is pure white */
	break;
@Thorham
It should be possible to merge my RGB level pushing code into the table by simply adding $16 extra entries for the color component saturation to each of the 3 subtables. So, this should result in a combined table (256 + 22) * 3 = 834 bytes.
Attached Files
File Type: c NewNetsurfPalette.c (4.9 KB, 113 views)

Last edited by PeterK; 20 October 2013 at 09:20.
PeterK is offline  
Old 20 October 2013, 16:25   #77
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by PeterK View Post
It should be possible to merge my RGB level pushing code into the table by simply adding $16 extra entries for the color component saturation to each of the 3 subtables. So, this should result in a combined table (256 + 22) * 3 = 834 bytes.
That's certainly possible. My routine already does that The tables are larger than they need to be for testing (fiddling with the dithering value).
Thorham is offline  
Old 20 October 2013, 17:11   #78
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,374
Since my C coding knowledge is very poor, I just ask if somebody could port this simple table generating ASM code to C ?
Code:
/* DataConstantBlock.Byte count, data */

 DCB.B 53,   4
 DCB.B 43,   5
 DCB.B 43,   6
 DCB.B 43,   7
 DCB.B 43,   8
 DCB.B 53,   9

 DCB.B 41,   0
 DCB.B 37,   6
 DCB.B 37,  12
 DCB.B 37,  18
 DCB.B 37,  24
 DCB.B 37,  30
 DCB.B 52,  36
 
 DCB.B 53,   0
 DCB.B 43,  42
 DCB.B 43,  84
 DCB.B 43, 126
 DCB.B 43, 168
 DCB.B 53, 210
uint8_t table_for_cube_676[834];

generate_table_for_cube_676() {
????
}

Last edited by PeterK; 20 October 2013 at 19:21.
PeterK is offline  
Old 20 October 2013, 17:42   #79
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by PeterK View Post
Since my C coding knowledge is very poor, I just ask if somebody could port this simple table generating ASM code to C ?
So is mine, but I googled 'c array' and found this:

Code:
int billy [] = { 16, 2, 77, 40, 12071 };
Thorham is offline  
Old 20 October 2013, 18:20   #80
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
instead of
Code:
	sub.l	#640*6,a0
how about
Code:
        lea -640*6(A0),A0
Mrs Beanbag 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
NetSurf for AGA arti News 92 14 March 2016 21:44
Optimizing question: instruction order TheDarkCoder Coders. Asm / Hardware 9 29 October 2011 17:07
Layered tile engine optimizing. Thorham Coders. General 0 30 September 2011 20:43
Benching and optimizing CF-IDE speed Photon support.Hardware 12 15 July 2009 01:48
For people who like optimizing 680x0 code. Thorham Coders. General 5 28 May 2008 11:48

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 23:48.

Top

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