24 March 2016, 10:37 | #1 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
HAM6 output different on AGA vs OCS (UAE)
Hi,
So I have been playing with displaying laced ham6 images, and everything is working nicely on OCS configurations. When I tried it on an AGA configurations 1200/4000 I get slightly different colors. A500/3000: A1200/4000: Behaviour seems the same on FS/WinUAE. My app runs from the bootblock, zero OS, and runs only in chip ram, I don't have any specific code for the 4000 except reading back from COPJMP1 after installing the copper list (Seemed to have a slight flicker before I added that). My copper list just resets the bitplane pointers. Palette is set at the start, then forgotten. I switch copper lists for the interlaced bitplane pointers in the vblank isr, however this problem is the same in non-interlaced mode. Is there some AGA specific thing I need to set up ? Or other pointers to where I am going wrong ? |
24 March 2016, 13:54 | #2 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
AGA has 8 bits for color. You write the high-4 bits...maybe the OS keeps the low-4 bits at $F??? and you have to actually set those to #$0?
Don't have the knowledge, just guessing |
24 March 2016, 15:31 | #3 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
So to the best of my knowledge there should be no difference in the image. |
|
24 March 2016, 15:49 | #4 | |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
Quote:
If you write $8 then in non-aga it's $8, but in aga $88 which is halfway between $8 and $9 |
|
24 March 2016, 16:29 | #5 | |
Registered User
Join Date: Mar 2013
Location: Slovenia
Posts: 138
|
Quote:
OCS/ECS has 12bpp output, which is 4bit/color. AGA has 24bpp output, which is 8bit/color. If you want the same color intensity, you are "supposed to" write the OCS 4bit value to both parts of the AGA 8bit color, which is exactly what the AGA hardware does. This allows you to reach full $FF intensity, which will match OCS full intensity value $F - otherwise you would get only $F0 as max value, which is $F0/$FF less than full intensity. So, AGA $88 is the same as OCS $8. Of course taking into account that you made a small gain error in exchange for fixing the offset error, plus any possible non-linearity in play since gamma is not taken into account. alpine9000: you are setting LOCT=1 in BPLCON3? edit: actually, the gamma could be the cause of this. Did anyone ever look into what the video output of Amiga is encoded as? Is the output fully linear, or is it gamma encoded, perhaps in the DAC? Last edited by chaos; 24 March 2016 at 16:34. |
|
24 March 2016, 20:42 | #6 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
alpine9000, what version of WinUAE/FS-UAE are you using?
Do you see the same difference when you boot your disk on an AGA config after selecting original or enhanced chipset in the boot menu? Do both your ECS and AGA configs have the same settings for brightness/contrast/gamma? Can you post/attach an example ADF file that shows the problem? Last edited by mark_k; 24 March 2016 at 20:48. |
24 March 2016, 21:43 | #7 | ||
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Quote:
Quote:
Which boot menu do you mean ? The configs were all 100% default for FS-UAE and WinUAE. So unsure of the gamma/brightness settings to be honest. ADF is here: https://github.com/alpine9000/amiga_.../slideshow.adf There is a 10 second delay before the first image is displayed, so warp mode is your friend ;-) Source code: https://github.com/alpine9000/amiga_.../023.slideshow |
||
24 March 2016, 21:48 | #8 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
|
24 March 2016, 21:59 | #9 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
|
24 March 2016, 22:27 | #10 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Assuming this isn't some kind of emulator bug...
Are you clearing bit 0 of BPLCON0 (to disable BPLCON3)? I compared a couple of pixels that differ in the two images. Coordinates are based on screenshots with window border that I took not the images you uploaded. Code:
H,V coord R,G,B (decimal) R,G,B (hex) 435,443 224,176,160 E0,B0,A0 AGA 238,187,170 EE,BB,AA ECS 612,394 176,153,136 B0,99,88 AGA 187,153,136 BB,99,88 ECS |
24 March 2016, 22:37 | #11 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Try remapping mouse buttons to keys on the Mac keyboard. Also, WinUAE has a "One second reboot pause" option, maybe try enabling that if FS-UAE has that too.
|
25 March 2016, 02:38 | #12 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
After looking at the WinUAE code, I think you found an emulation bug! I'll write about what I think is the problem (in drawing.cpp) later today.
|
25 March 2016, 02:42 | #13 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
(Disregarding the inverted interlace phase in the screenshots.) Just tested this on a few versions old WinUAE vs A1200. Yes, there seems to be a difference between OCS and AGA emulation of HAM6. OCS emulation, real A500 and real A1200 looks correct, while stock A1200 in WinUAE gives rise to short horizontal lines (you can see them near the edge of the face). I've started an emulation bug thread, but if someone has the latest beta handy they could verify there.
I dealt with HAM6 lace in Frazetta, Jack Burton did accurate conversions of oil paintings (which are harder to get than oversaturated photos a la NewTek etc) in HamLab to the PCHG ilbm format. There is the possibility of HAM6 lace specifically to go 15-bit over 12-bit, when someone writes a PCHG exporter that supports what the format already does. When that happens, my converter will support it automatically. PCHG viewer/exporter to raw+copper lists plus source is on the disk there, please use them, this was the reason for the release. |
25 March 2016, 03:38 | #14 | ||
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Quote:
Quote:
I know Frazetta well, I watched it again (not for the first time) just last week in fact . I am generating the HAM6 raw data myself and am interested in improving my own converter. Can you expand on what you mean by going 15bit ? Last edited by alpine9000; 25 March 2016 at 05:44. |
||
25 March 2016, 15:44 | #15 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
There is a difference between Amiga and emu though, so perhaps best to await a resolution to that before changing code. Do you have an AGA Amiga? Maybe the problem goes away automatically then as it did for me.
HAMLab can output pictures with a copper list that changes 0-15 colors per scanline. This increases the number of actual distinct colors in a HAM pic from around 300 to around 1000-1500. Of course, it depends on the picture. A "color gamut test picture" will be able to show all 4096 colors. 15-bit increases the possible number of colors from 4096 up to 29791, with 5 bits per component, by swapping two individual copper lists adapted to each field of the interlaced picture in sync. Flickering close colors at 25 Hz will not cause a noticeable flicker, but seem to generate a steady color in between, say, $555 and $556. Unfortunately in our tests, we couldn't get HAMLab to output two such hunks with adapted palette changes. EDIT: run it in latest beta, it looks fixed to me! Last edited by Photon; 25 March 2016 at 17:14. |
25 March 2016, 21:20 | #16 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Could you elaborate on your 15-bit theory? From what you wrote, it sounds like you tried using different palettes/copperlists for odd and even fields of an interlaced image. Each list would have a slightly different palette.
But that wouldn't result in colour "mixing" because the colours of pixels in each field's lines would be constant. Unless you alternate between slightly different palettes for each field, but the colours would only change at 12.5Hz then. (i.e. odd field palette 1a, even field palette 2a, odd field palette 1b, even field palette 2b, odd field palette 1a etc. etc.) Where you could use colour mixing is for non-interlaced images. Down-convert the 24-bit source image to non-interlaced (i.e. halve its height). Generate two non-laced HAM+copperlist images from that, colours chosen to look as close to the original as possible when mixed. For display, alternate between the two images & copperlists on alternate frames. Of course writing a program to choose the two best/optimal palettes/copperlists might be tricky... |
25 March 2016, 23:26 | #17 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
A few weeks ago I started writing an example that switched in a new palette every scan line:
https://github.com/alpine9000/amiga_...015.sliced_ham Unfortunately it's not really there yet as it looks worse than the normal HAM version. I think it has problems both in the simplistic algorithm I used to select each line's palette as well as the display implementation. (It's possible the copper list is not correctly synced up with the image data or some other problem). At that stage I got bored with HAM so moved on :-) I will revisit this at some stage, as it should be a pretty easy way to get heaps more colors. |
26 March 2016, 21:58 | #18 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
It's untested due to lack of exporters.
As you say, it's impossible to have interlace and at the same time change "the same interlaced pixel" with only two copperlists. Some general info which I'm sure you know already and then some blurb how it might work. Without two copperlists, actually an interlaced picture is forced to use the same 12-bit palette for two pixel lines. The first thing that two copperlists would do is cause less 12-bit color errors. This should work fine on all CRTs, deinterlaces such as WinUAE and flickerfixers. On CRTs, because the raster beam is a fixed width of one lores pixel height, pixel line pairs would overlap by 50 percent and fade into each other. Also, pixels would melt into each other a bit as for lores, generally giving a more pleasant and forgiving picture, or simply a better picture. Not counting the flickering, obviously. But some flicker can be removed by running the exporter a bunch of times with slightly different settings and pre-processing of the picture to begin with (i.e. following the crap in crap out rule). (Normally such pre-processing can be things like blur, dither, avoiding adjacent dark/light swaths or patterns, selecting suitable motives, or using overcontrast/oversaturation or otherwise create blowouts. Generally Photoshop the shit out of it. This is typically what is done for f.ex. faces, like the one in OP. 15-bit is time dither. Swaths of the same color will hit the in-between color, and gradients too, they will be smoother. Edge pixels between such areas and generally chaotic areas and rapid adjacent color changes will not hit the in between color if the picture is full-res vertically in those areas. An exporter would have to identify those areas and apply a dither pattern to them, i.e. change the bitmap to look perceptually correct. As I see it, any dither would have to be applied together with this. Applying it beforehand would kill the concept. This is what should be solved if you don't want to go 12.5 Hz, two interlaced pictures, and 4 copperlists. But the swaths in between those edges would look good on all displays. Obviously a HAM exporter specifically will already calculate different bitmaps between each field as it is, partly due to the original picture contents, but also adjust/not follow contents when mapping to get more than 15 colors out. Modify above means modify the calculation. Maybe you could start with non-HAM modes and go from there, I don't know. But as I said, it's untested. Last edited by Photon; 27 March 2016 at 01:45. |
27 March 2016, 05:25 | #19 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
|
28 March 2016, 21:06 | #20 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
About HAM dithering (this is mainly to Photon)...
Did you test/experiment with generating non-interlaced HAM images? Obviously vertical resolution is worse but on the plus side, no flicker. And you could (after someone writes a suitable conversion program...) output two images from the single source image. Alternate between them on alternate frames to get the dithering effect. On real hardware with 50/60Hz CRT monitor I think that might look pretty good. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AGA vs OCS games | Another World | Retrogaming General Discussion | 42 | 30 August 2013 21:59 |
Bug in AGA and not OCS | msayed1977 | support.WinUAE | 35 | 03 April 2013 15:51 |
Using two voices for 56K sample/second audio output rate -- OCS -- No CPU or Copper | mc6809e | Coders. Asm / Hardware | 2 | 28 January 2012 00:29 |
ecs ocs games on aga | memothejanitor | support.Apps | 4 | 16 June 2007 04:30 |
aga and ocs version of a game? | PiCiJi | Retrogaming General Discussion | 11 | 14 October 2003 10:43 |
|
|