One of the last things I need to implement is the horizontal and vertical coordinate offsets. The vertical offset is pretty easy, just 25% of a full height of a character. The horizontal is much trickier. Fortunately, the programming manual for these Sony players has a (convoluted) formula that explains how it works:

Hp = {5 + {HCoordValue} * 4} * DotClockCycle + {26 * HorizontalCharacterClockCycle}

HorizontalCharacterClockCycle = 2 * {(HScaleValue) + 1} * DotClockCycle

DotClockCycle = 0.143 microseconds

HScaleValue is a 2 bit value, so it can be 0-3. 0 means no scaling, 1 means 2X scaling, 2 means 3X scaling, 3 means 4X scaling, all horizontally.

I am not yet sure what DotClockCycle refers to.

The manual also mentions a HorizontalSyncCycle as being 63.5 microseconds but this seems to only relate to the vertical coordinate. I have not done the math, but this value likely is related somehow to the length of one horizontal line on an NTSC TV.

Observations: I've observed this by doing experimental video capturing, but I can also see that Hp (which I assume stands for Horizontal Position) will be left justified proportionally to the horizontal scaling value. However, after that, the coordinates themselves seem fixed no matter what the scaling factor is. Frankly, I see very little value in this kind of design at this point.

UPDATE: Ok, I've figured it out. Here are some captures of each mode at X coordinate of 0.

These images were scaled to 444x240 down from 720x480 to try to make each horizontal pixel map to a "dot" (I think I got pretty dang close). I chose the value of 444 by doing 63.5/0.143 (see timing above) and while I don't know if this is exactly correct, it is really close.

So my modified formula for the X position is:

X coordinate = -6 + (26 * (scale value + 1)) where 0 is no scaling, 1 is 2x, 2 is 3x, and 3 is 4x.

I chose -6 somewhat arbitrarily, just to make it match up to my screenshots; the exact value here doesn't matter, all that matters is that _some_ initial offset is considered and that it is consistent and close.

Using this formula, the initial X coordinate becomes:

20 - no scaling

46 - 2X scaling

72 - 3X scaling

98 - 4X scaling

As you can see, this is very close to what I got in my captures and it is derived from the official formula from the documentation so I think

**we have a winner**!

## No comments:

## Post a Comment