English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   support.WinUAE (http://eab.abime.net/forumdisplay.php?f=5)
-   -   Akiko Chunky-to-Planar conversion (http://eab.abime.net/showthread.php?t=55819)

Mequa 15 October 2010 23:43

Akiko Chunky-to-Planar conversion
 
Having looked through the WinUAE sources to see how WinUAE handles CD32 Akiko Chunky-to-Planar conversion, I noticed that Toni seemed dissatisfied with the choice of algorithm employed for this purpose.

From akiko.cpp:
Code:

static void akiko_c2p_do (void)
{
        int i;

        for (i = 0; i < 8; i++)
                akiko_result[i] = 0;
        /* FIXME: better c2p algoritm than this piece of crap.... */
        for (i = 0; i < 8 * 32; i++) {
                if (akiko_buffer[7 - (i >> 5)] & (1 << (i & 31)))
                        akiko_result[i & 7] |= 1 << (i >> 3);
        }
}

From my understanding, this code takes part of a 256-color palleted image in "chunky" format, and splits it into 8 bitplanes for display on emulated AGA hardware. It relies heavily on C/C++ bitwise operators to manipulate the bits.

My question is, why is it a "piece of crap"? And can anyone think of a better alternative?

Toni Wilen 16 October 2010 21:29

It works but it is quite inefficient. (not that it does not really matter)

watertonian 16 October 2010 23:31

If WinUAE works on mostly chunky H/W, or at least a chunky-based API (OpenGL or DirectX, can't remember WinUAE too much since using Ubuntu), I'd think the Akiko routines would be better served by a pass-through of some sort? Might explain why the original method is "crappy", because converting chunky to planer and back to chunky would be a pain.

Mequa 17 October 2010 11:47

Quote:

Originally Posted by watertonian (Post 708924)
If WinUAE works on mostly chunky H/W, or at least a chunky-based API (OpenGL or DirectX, can't remember WinUAE too much since using Ubuntu), I'd think the Akiko routines would be better served by a pass-through of some sort?

Which CD32/AGA games actually make use of this? I believe Microcosm is one, and Gloom Deluxe also appears to support Akiko C2P (though works much better with RTG for emulation).

A pass-through method works for RTG, but as far as I'm aware, Akiko's C2P is used to produce images displayable with the AGA chipset, which are then (potentially) subject to whatever bitplane-based modifications, copper effects and suchforth the programmer wishes to use before being outputted - as with any (emulated) AGA display. So chunky -> planar -> chunky conversion would likely be required for full compatibility.

A pass-through option (as e.g. a "faster but less compatible Akiko emulation" tickbox) MIGHT potentially work in some cases though, and would be much faster. Perhaps it could speed up some CD32 games on slower PCs such as netbooks.
But I'm not Toni, so can't really comment on the feasibility of such a method. ;)

Toni Wilen 17 October 2010 12:57

Akiko C2P is single long-word size register, program writes max 8 longs and then reads 8 longs back (quite stupid design, isn't it?)

You don't know what the program is attempting to do with the data, it might not be for real or display C2P but some other weird bit manipulation..

Either patch the application, replace WriteChunkPixels() gfx.library routine or use RTG :)

Mequa 21 January 2012 10:50

Update: Optimised Akiko Chunky-to-Planar emulation :D


All times are GMT +2. The time now is 13:28.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.

Page generated in 0.04078 seconds with 11 queries