11 October 2013, 03:48 | #41 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
To PeterK:
Why don't you use tables for this? It's faster than those loops. |
12 October 2013, 00:36 | #42 | |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
|
Quote:
... but first, I was too lazy and just wanted to see the results of this method, ...and second, these loops are only passed 3 times on average, thus the benefit of using tables is very small and requires 768 bytes of additional memory. Btw, the color components in my code example are not exactly equally weighted atm, blue is pushed up and red is reduced, but that can be changed again. The possible values are 20, 65, 110, 155, 200 and 245 now, moved a bit up to prefer the brighter colors in the cube, since "dark errors" are less visible. |
|
12 October 2013, 02:28 | #43 | ||
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Quote:
Quote:
Code:
lea argbImage,a0 lea argbImage_END,a5 lea indexedImage,a1 lea redTable,a2 lea greenTable,a3 lea blueTable,a4 clr.l d0 clr.l d6 ; index color 0 moveq #70-1,d7 ; alpha lower than 70 check .loop cmp.b (a0)+,d7 bls .isAlpha ; not alpha move.b (a0)+,d0 move.b (a2,d0.w),d1 move.b (a0)+,d0 add.b (a3,d0.w),d1 move.b (a0)+,d0 add.b (a4,d0.w),d1 move.b d1,(a1)+ cmp.l a0,a5 bne .loop bra .exit .isAlpha move.b d6,(a1)+ addq.l #3,a0 cmp.l a0,a5 bne .loop .exit ... ... Last edited by Thorham; 12 October 2013 at 02:45. |
||
12 October 2013, 02:49 | #44 | |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
|
Quote:
No sorry Thorham, but I would doubt that you will be able to notice any speed increase in a browser by saving a few CPU cycles with your tables. And regarding the code that you want to combine with your tables, you missed the fact that this code pushes the RGB level of every 2. pixel in order to get some sort of very primitive dithering by adding "noise" (which cannot be moved into the tables). And also the black and white handling can't be done with the tables since it detects the combined RGB values and not the componebts seperately. Last edited by PeterK; 12 October 2013 at 03:05. |
|
12 October 2013, 06:57 | #45 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
To PeterK:
I've tried some things and came up with a little something. It's in The Zone (render24bit.zip). It contains a source code, render24bit.s (and meynaf's c2p which is included by the main file, don't worry about it), which should assemble with PhxAss with the M=2 option. Personally I use AsmPro for these test programs. Just make sure to set the include paths in the source code. There are two. One for the system includes (I've used the includes from the archive you sent me) and one for the FULL path of the directory the source code is in (annoying, I know ). I've also included some BMP pictures to use with the program. Set the name of the BMP file you want to use close to the bottom of the source (also annoying ). If you want to use your own, make sure they're 640x512 pixel 24 bit BMP files. The program uses a 6x6x6 palette, and uses tables for color conversion and clamping of dithering values (one table per gun color). The dithering is really simple and quite effective. And do play with the dither value. I think 16 may be optimal. Last edited by Thorham; 12 October 2013 at 07:07. |
12 October 2013, 08:19 | #46 | |||
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
|
Quote:
Quote:
Thorham, please also upload some of your resulting images. I'm a bit too lazy now to start playing with your code, but I will try to do that later. |
|||
12 October 2013, 15:32 | #47 | |||
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Quote:
Also, when optimizations are done in other parts of the browser code, it all adds up. Quote:
Quote:
Turns out that the dithered image is too bright, which I didn't see on my SVGA CRT monitor whose gamma is on the dark side. I'll see what I can do to solve that (stick gamma correction into the tables perhaps). Edit: Brightness problem solved. Dithering happens around a value now, instead of above a value. Took only one extra instruction. Last edited by Thorham; 12 October 2013 at 21:01. |
|||
17 October 2013, 05:50 | #48 |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
|
@arti
Finally, I tried to write my 676 palette code down in C, but without ever compiling it and not optimized with tables as suggested by Thorham. Maybe someone who has successfully compiled Netsurf already could try to merge my code into the sources by using the new "cube_676_palette" instead of the default one. Please forgive me if I made some mistakes in writing untested C code: Last edited by PeterK; 17 October 2013 at 20:21. |
17 October 2013, 08:15 | #49 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
Hiya,
Thanks for your efforts Peter Unfortunately only Arti can compile this monster, I tried myself and failed miserably Hopefully Arti will try and implement these changes into NetSurf AGA soon. |
17 October 2013, 20:31 | #50 |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
|
Update 2: My first update was probably the wromg way to fix the palette generator.
After thinking it over again I believe now that I've merged the function declaration and the function call into just one piece of code before, which won't work. So, now I'm trying it again: 1. step = the palette generator declaration and ... 2. step = calling the function: nsfb_palette_generate_cube_676(struct nsfb_palette_s *cube_676_palette); |
17 October 2013, 21:36 | #51 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
I posted a method that's fast and dithers the image, I don't see the problem with some small tables. What you're doing is only slowing things down to save a few KB. What's the point?
As I've said before, there isn't a whole lot of room to work with here. You use tables, or you're going to end up getting the same speed as HAM8 rendering. Last edited by Thorham; 17 October 2013 at 21:44. |
17 October 2013, 21:43 | #52 | |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
|
Quote:
Thorham, I didn't say that your tables shouldn't be used, but first, it's more important for me to get my code to run at all, then we can talk about performance tweaks. If arti prefers your HAM8 rendering code then it's his decision and I will accept that, no problem! Last edited by PeterK; 17 October 2013 at 21:56. |
|
17 October 2013, 21:54 | #53 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
You're missing the point. If you're at the point where you're doing things at HAM8 rendering speed, then you might as well have the browser run in HAM8, and that might be a simple as simply opening a HAM8 screen instead of a 256 color one. SDL AGA is supports 8 bits per pixel, so it's probably no big deal to get this to work properly.
|
17 October 2013, 22:01 | #54 |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
|
Sorry, but I have no experience in writing HAM8 code. I can only offer a solution which I'm able to code. If you have a better solution then your code will make it.
|
17 October 2013, 22:02 | #55 | |||
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Quote:
Quote:
Quote:
Anyway, the program I uploaded for you to try contains a fast method with dithering. Did you check the images I posted a few posts earlier? The dithered image is too bright, but that's solved (the fixed version is in the archive I uploaded to The Zone). Last edited by prowler; 18 October 2013 at 00:08. Reason: Back-to-back posts merged. |
|||
17 October 2013, 22:24 | #56 |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
|
Thanks for the updated package. I regret, but I didn't do anything the last few days.
I know the same problem with the brighter image from my own code and fixed that too. The dithered image that you uploaded here looks not better IMO than the results from my current 676 palette code that I posted today. |
17 October 2013, 22:35 | #57 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
I was still using a 666 palette there. Could you post an image (including the original)?
|
17 October 2013, 22:53 | #58 |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
|
Ok, it's in the zone. But please remember that all images are in reduced size (256 pixels max width)
|
17 October 2013, 23:12 | #59 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Thanks
I'll change my code to do 676 and compare the results. |
18 October 2013, 00:40 | #60 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
If I were you guys, I'd wait until Arti responds to this thread before taking this any further.
As I mentioned above, I cannot build NetSurf so I cannot test any optimizations myself unfortunately 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 I'd have thought rendering speed should be given priority over quality so why are we even discussing HAM displays? |
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 |
|
|