24 May 2012

New Scaler API

This new api  attempts to solve problems with the old scalers that were difficult to fix without a full redesign. I'll give an overview.

void initialize(Graphics::PixelFormat format) 
  • This is called before each scaler is used so that it knows what the pixel format is.
  • Generating RGBYUV tables and other precomputed data should happen here.
int increaseFactor() 
int decreaseFactor() 
int getFactor()
int setFactor() // For loading from configuration
Common::Array<int> getFactors() // For displaying in GUI
  • These give easy ways for setting and manipulating the scale factor.
  • These functions always return a valid scale factor so mapping these functions to hotkeys is simple.
  • Also this allows different sized versions of the same scaler to be included in the same plugin.
 bool canDrawCursor()
  • Some scalers are not suitable for scaling the cursor since they blur the image.
  • Since the cursor is not always scaled the same way as the background and can use a 1.5x scaler, the mouse scaling needs extra thought. If you have good ideas for this, leave a message or otherwise contact me.
int extraPixels()
  • Since some scalers look at surrounding pixels outside of the area to be scaled, the rects to be scaled need to be expanded, and the surface needs to be extended to prevent memory access errors.

void scale(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32  dstPitch, int width, int height, int x, int y)
  •  This is the scaling function similar to what is currently used.
  • The addition of x and y coordinates allows position sensitive scalers like TV and DotMatrix to produce consistant results.
A couple changes could possibly be made.

void transform(Rect *dirty)
  • Instead of extraPixels(), this function changes a dirty Rect so that it will behave properly when passed to a scale function.  The backend can change this afterward in case the Rect was expanded off the edge of the surface (or possibly the dimensions of the surface can be given as well).
The same Rect struct could be passed to the scale function as well.

Currently I am working on proof of concept implementations try out some of these ideas and decide what to put in the final version. If you have suggestions please leave comments or message me.

EDIT: Also there is a deinitialize function. It's self explanatory.




1 comment:

  1. Me as an user would be interested about readability platforms when bein on long distance.

    I had difficulties when reading DoTT over a TV (of course it wasn't using component cable, but it was a friend's Wii and I did put the game because she wanted to play it).

    I have no idea about the technical inners, but it could be nice to see if there would be a way to improve fonts in some way. Maybe that's a very specialized task, focusing on some kind of font vectorizator filter or something like that.

    ReplyDelete