-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New RGB/YUV pcb + screencap fix + scaling improvements #115
Conversation
# Conflicts: # src/scripts/Profiles/BBC/BBC_Micro.txt # src/scripts/Profiles/BBC/Oric.txt # src/scripts/Profiles/BBC/Spectrum 2.txt
I think the offset was fixed with a profile tweak - did you update your profiles? What do you think?
This was to fix an integer scaling bug which I only just noticed.
Not heard of that, can you elaborate. You were using the overscan setting in the config file in the original software to get the scaling correct in exactly the same way.
I'll try to get something written up soon. |
Yes, I did a release build, then:
I'm still able to replicate that now, on a 1600x1200 monitor.
From a UI design perspective, it's consider bad form to give the user choices that don't have an effect. So generally I would try to avoid settings that have no effects in certain modes. If we need to do this, I wonder if we should find a way to "grey out" a setting, then it's much clearer that it's not applicable. I've just done a bit more testing, of a Beeb at both 1920x1080 and 1600x1200, in both Mode 7 and Mode 0, with a red border colour set. Fill All @ 1600x1200: working as expected
Fill 4:3 @ 1920x1080: working almost as expected:
Integer @ 1600x1200: working almost as expected:
Integer @ 1920x1080: this is where I'm seeing unintuitive results: I think what I wasn't expecting here is that in some cases the aspect ratio is severly distorted, because different H and V scale factors are allowed:
I thought we were trying to preserve the aspect ratio in Integer scaling mode? So returning to your original point:
My worry then is there may be some cases where the capture border is then lost. For example:
By only having the Auto option, I think the system would then eliminate the capture borders completely. Or am I wrong in that? It seems how much of the original border is captured is a choice we should give the user in all scaling modes, then we just have to do our best to work with that. That's especially true in systems where software could set the border colour, or where it contains "content" like tape loading information.
OK, I understand now. I had missed the fact that it was:
See the comments here: RGBtoHDMI/src/scripts/config.txt Line 39 in 2ae66d3
The values seem to be applied relative to a default, which is 32 or 48 depending on the mode. Our config file has disable_overscan=1, so it's possible you setting are being ignored. Or it's possible this just applies to the interpretation of the properties. I don't know if the same is true when setting the overscan through the API, but is suspect it may be. See what I mean about it being confusing? |
Ian, OK, so refreshing my memory a bit more regarding this property:
This has the effect of removing the default overscan value (32 or 48) so that system uses the absolute values that are specified (which musg be positive). However, see also this recent firmware change: Which I think means that overcan is never applied in DMT modes, only in CEA modes. Ouch! Dave |
Yes, I can see how doing this automatically in all cases is impossible. I have a couple of related questions:
Technically, I think the Beeb pixel aspect ratio is actually 14.75/16, see: See also the end of this post, which also ends up at 14.75/16 Also, thinking off the cuff here, is there case for a fill mode that perserves the aspect original ratio? Both the fill modes we have at the moment will can distort the image. |
Yes that's correct, square pixels as used on the Prisma 2/3 require a 14.769231 Mhz pixel clock: Interestingly those computers that use an NTSC crystal related pixel clock (i.e. 14.31818 etc) are much closer to producing square pixels on a PAL screen than the beebs 16Mhz clock.
It already is albeit in a non-obvious way:
Using the above info, if you change the max values on a BBC profile to 832x288 instead of 768x288, you will get exactly the correct BBC aspect ratio in the Fill modes.
Not heard of that before, all the panels I've seen in that past have had square pixels. I can imagine that would cause a lot of problems with systems that assume square pixels.
Is there a build of that firmware available to see if it breaks my above Oric scaling fix? |
I would try the latest from here: |
The overscan property setting still works with this version. Actually I found that the fix above wasn't quite right in that there were 2 oversized pixels and the fix removed just one. Increasing the Pi overscan by 1 so 2 pixels (L=1, R=1) got rid of the second oversized pixel so I guess there is some rounding issue in the scaler hardware. |
It's possible the recent firmware change people were talking about was this one: In which case we are fine. |
I did some further tests with the overscan value using different sized buffers and it seems that the correct value is always the calculated value +1 (if non-zero), not rounded up to an even number. |
Here is a more detailed explanation of why the Min/Halfway/Max/Auto are the way they are in your screen grabs above: Geometry min is 640x256 Min: In Half way, the capture area is 704x272 the H will still scale 2x to 1408 but the V won't scale 4x as that would be 1088 so it has to choose 3x which is 816 so it looks a bit letterboxed. There is no good solution to integer scale that capture area to a 1080p monitor In Max, the capture area is 768x288. H will scale 2x to 1536 and V will scale 3x to 864 so again no good solution for a 4:3 aspect ratio. In Auto the software looks at the min and max values and picks the an intermediate value with the highest x and y scale factors that exactly fits into the monitor's resolution which in this case is 768x270 which scales Hx2 and Vx4 to 1536x1080 so you get a good 4:3 solution. Note the halfway and max values will scale properly to 1600x1200 which is why it looks better on that monitor. |
Where in the code is that expansion to 1600x1080 done?
This (perhaps not surprisingly) is very like the manual calculations I would do in the early versions of RGBtoHDMI. The key difference being that I would never scale H and V differently. i.e. I would prioritise maintaining the aspect ratio over reducing the bars. I think that's mostly what I'm reacting too here, as I find aspect ratio distortion far more objectionable than black bars. Another area of confusion for me in the above calculation is at what point double height comes in to play. i.e. the capture area is 768x288, but the FB Size is double height. Isn't that the same as saying the capture area is 768x576, in which case I'm not sure what happens to the vertical scale factor. Does it end up as 1.5, and this is still integer (2 pixels -> 3 pixels, but those 2 pixels are identical)? Dave |
This line in geometry.c -
You would end up with a postage stamp image with scaling Hx1 and Vx2
H and V are almost always scaled differently though e.g. beeb Hx2 and Vx4, CGA Hx2 and Vx5. Currently the scaler doesn't inherently "know" that those values are equal so maybe some helper info is needed in the geometry settings.
Double height is mostly ignored during scaler calculations. This actually results in more flexible scaling. |
Thanks for the info Ian. I appreciate there is no right answer here. It will be interesting to see what happens when we put out a public beta. I know at least one user of the Atom interface (Ken Lowe) has some pretty unusual monitor resolutions:
https://stardot.org.uk/forums/viewtopic.php?f=3&t=14430&p=208720 So, taking 1680 x 1050, the usable area is 1400x1050 (I don't think your expansion rule applies to max_width of 320). The Atom's capture area is defined as 272x208 => 320x240 So that should allow 5x in X and Y, with auto ending up using something like 280x210, so quite close to min. I might try this one out myself, as I think I have a suitable monitor in the loft. Dave |
Thinking about it, the geometry helper info required is not the screen aspect ratio but the pixel aspect ratio which would be 1:2 for a beeb, 2:5 for cga 1:1 for atom etc. |
Final issue 2 pcb layout for universal RGB/YUV board
Fix screen cap issues in 4bpp mode
Fix scaling issues with screen caps
Add automatic small overscan to Pi's frame buffer when scaling fraction is not an exact multiple of the screen resolution
e.g. ORIC 1 scales 3x horizontal so buffer is 533 pixels. On a 1600x1200 monitor this is 1599 pixels so 1 pixel overscan is added to ensure all pixels are 3x. (Without this 1 pixel ends up wider)
Add new mode 7 horizontal integer scaling option: Mode7 Scaling: 4:3 (Uneven)/Even
This only affects integer scaling. The default is 4:3 (Uneven) which scales mode 7 to a 4:3 ratio but pixels are actually uneven as every 4th pixel is wider so the image can look a little ragged without interpolation (although it's a regular unevennes so not too noticeable). This was previously the only option. The new option "Even" allows even Integer scaling in mode 7 so all pixels are equal.
In 1600x1200 and 1080p monitors this results in a slightly wider image but results may vary in other resolutions.