PAL integer scaling doesn't look quite right on beta 3
Firmware version
GBS-Control 3.0.0-beta3
Board
Standard gbs-control board
Console or source
PAL Playstation 2 at 50 Hz
Input
RGB SCART
Cable
Standard PS2 PAL SCART cable over a passive SCART switch
Output resolution and display
1080p on LG 43UK6100
What happens
I'm using bob deinterlacing with scanlines set to 20.
I'm using the new integer scaling option.
This is from the PAL Persona 4.
Look at the sun icon at the right top corner. It is squeezed.
To me, it looks like the integer scale is doing a literal integer upscale here. But on real PAL tv's this is round.
In a conversation with AI, it told me that it could be because you treat the input as square pixels. This is more true for NTSC, but not so much for PAL.
Anyway, if I select aspect ratio "Full", it looks much more like it's supposed to look:
But I doubt I can call this integer scaling anymore. (then again, how do I even know?)
I did notice that you changed what the values used to mean in your web UI.
In the stock firmware, I used to set HScale to 1023 and VScale to 512 and it kinda looked like how it was supposed to look. But the meaning of HScale seems to have changed completely.
Did it work on 2.4.1?
Yes
Report from the web app
Device
- GBS-Control 3.0.0-beta3
- ADV Controller absent
- Board: standard
Last crash
none recorded
Console (last 50 lines)
[ 31.225] [api] set output.aspect=1
[ 31.313] [gbs] ADC offset: R:42 G:42 B:42
[ 31.323] [preset] geometry: aspect Force 4:3, integer on, 50Hz As 60Hz: width x1.000, clock 0x85 -> 0x85, vertical 512 -> 512
[ 31.324] [preset] geometry: mark 0x1C -> 0x1D, bar 0 -> 0, capture start 27 -> 27
[ 31.340] [gbs] clock gen reset: 108000000 Hz, lock 1779 us, sticky 0xB0
[ 31.588] [gbs] Active FrameTime Lock enabled, adjusting external clock gen frequency
[ 31.592] [preset] preset applied: 1920x1080 (custom) for PAL 50Hz (set your TV aspect ratio to 16:9!)
[ 31.597] [preset] on RGB SCART, profile p03
[ 31.624] [sys] loop slow: 371 ms, most in api (353 ms), 2 slow passes since the last report
[ 32.012] [profile] profiles matching the signal: 0 (mask 0000000000000000)
[ 32.683] [gbs] source Hz: 49.99931 new out: 49.99931 clock: 107980832 (-19168)
[ 33.014] [profile] profiles matching the signal: 1 (mask 0000000000000008)
[ 33.338] [sys] settings: saved /cfg/device.cfg
[ 34.331] [api] set output.aspect=0
[ 34.419] [gbs] ADC offset: R:42 G:42 B:42
[ 34.428] [preset] geometry: nothing to do
[ 34.437] [gbs] clock gen reset: 108000000 Hz, lock 2003 us, sticky 0xB0
[ 34.689] [gbs] Active FrameTime Lock enabled, adjusting external clock gen frequency
[ 34.692] [preset] preset applied: 1920x1080 (custom) for PAL 50Hz (set your TV aspect ratio to 16:9!)
[ 34.697] [preset] on RGB SCART, profile p03
[ 35.079] [profile] profiles matching the signal: 0 (mask 0000000000000000)
[ 35.341] [gbs] Error: trying to tune external clock frequency while clock frequency uninitialized!
[ 35.598] [api] set output.aspect=2
[ 35.671] [gbs] ADC offset: R:42 G:42 B:42
[ 35.684] [preset] geometry: aspect Full, integer on, 50Hz As 60Hz: width x1.557, clock 0x85 -> 0x85, vertical 512 -> 512
[ 35.686] [preset] geometry: mark 0x1C -> 0x1E, bar 0 -> 0, capture start 27 -> 27
[ 35.699] [gbs] clock gen reset: 108000000 Hz, lock 1541 us, sticky 0xB0
[ 35.948] [gbs] Active FrameTime Lock enabled, adjusting external clock gen frequency
[ 35.952] [preset] preset applied: 1920x1080 (custom) for PAL 50Hz (set your TV aspect ratio to 16:9!)
[ 35.957] [preset] on RGB SCART, profile p03
[ 37.040] [gbs] source Hz: 49.99934 new out: 49.99934 clock: 107980896 (-19104)
[ 37.168] [profile] profiles matching the signal: 1 (mask 0000000000000008)
[ 37.201] [api] live readbacks off (not asked for 10 s)
[ 37.704] [sys] settings: saved /cfg/device.cfg
[ 59.012] [api] live readbacks on (a page asked /api/live)
[ 60.083] [sys] heap 18824, block 18120, lowest 11032, loop stack free 1680
[ 101.726] [api] set output.aspect=0
[ 101.808] [gbs] ADC offset: R:42 G:42 B:42
[ 101.818] [preset] geometry: nothing to do
[ 101.826] [gbs] clock gen reset: 108000000 Hz, lock 1541 us, sticky 0xB0
[ 102.090] [gbs] Active FrameTime Lock enabled, adjusting external clock gen frequency
[ 102.094] [preset] preset applied: 1920x1080 (custom) for PAL 50Hz (set your TV aspect ratio to 16:9!)
[ 102.098] [preset] on RGB SCART, profile p03
[ 102.119] [sys] loop slow: 374 ms, most in api (358 ms), 3 slow passes since the last report
[ 102.570] [profile] profiles matching the signal: 0 (mask 0000000000000000)
[ 102.736] [gbs] Error: trying to tune external clock frequency while clock frequency uninitialized!
[ 103.182] [gbs] source Hz: 49.99931 new out: 49.99931 clock: 107980832 (-19168)
[ 103.571] [profile] profiles matching the signal: 1 (mask 0000000000000008)
[ 103.834] [sys] settings: saved /cfg/device.cfg
[ 108.549] [api] live readbacks off (not asked for 10 s)
By the way, you may notice that I have set the 50Hz style to 60Hz instead of PAL tv.
There's a good reason for this: Having it on "PAL TV" gives me extreme flickering. But having it set to 60Hz (with bob and scanlines) behaves how I want/expect it to. But then the aspect ratio seems to be out of whack.
Wind waker on Wii is even worse:
Aspect ratio "Auto":
Aspect ratio "Full":
It's stretched or squeezed either way.
@risingPhil thanks for the detailed report: with the photos and the log I could work out the whole thing.
The squeezed shape. It comes from the "As 60Hz" style. That style is meant for games that draw only 240 of the 288 lines at 50 Hz (NTSC conversions, with black bands above and below): it fills the height with those 240 lines and narrows the width, to give the game the shape it has at 60 Hz. The PAL versions of Persona 4 and Wind Waker use the whole PAL frame instead, so with "As 60Hz" they come out about 19 % narrower and cropped at the top and bottom. "Full" widens the picture to 16:9, so it is wrong the other way. The right style for these games is "PAL TV": it is the only one that gives the shape they had on a PAL TV.
The flickering. I reproduced it with a 576i source at 1080p, with bob and scanlines. Here it does not depend on the 50Hz style or on Integer scale: it is bob. Bob shows one field at a time, and the two fields are one line apart, so sharp horizontal edges shake at 25 Hz; scanlines make it more visible. With the Adaptive deinterlacer the flickering goes away, but on an interlaced source scanlines only work with bob (the original firmware does the same: the chip makes them with the same circuit it deinterlaces with).
Two tests would help me:
- "PAL TV" with Integer scale off, bob and scanlines as you have them now. At 1080p that is already a whole multiple (x4), with a few lines cropped at the top and bottom; with Integer scale on it becomes x3 with black bars, so that nothing is cropped. Does it flicker as before?
- The same with the deinterlacer on Adaptive (the scanlines will go): does the flickering stop?
I don't understand yet why "As 60Hz" flickers less than "PAL TV" on your unit with the same bob and scanlines: if the difference is still there after these tests, please send me a report taken in each of the two styles.
Hi, thanks for your response.
So, I have made a few videos. They were recorded with my smartphone (H264), but they are too large to attach here, I think.
So here's a google drive link: https://drive.google.com/drive/folders/1zQZD-TUKjvcawRzRDUURx9trnuFZLhob?usp=drive_link
mysettings-3.0.0-beta1.mp4:
This is my baseline on the 3.0.0-beta1 build. Yes, it flickers slightly, but that's expected and desired even. (More on that below).
PAL-60Hz-integerscale-1080.mp4:
1080p with integer scale enabled and 50Hz style: "As 60 Hz".
It flickers more than beta1, it seems. Not sure though.
PAL-AS_PAL-integerscale-1080.mp4:
1080p with integer scale enabled and 50Hz style: "PAL tv".
It flickers really badly.
beta3-nointeger-aspal-1080.mp4: 1080p with NO integer scale enabled and 50Hz style: "PAL tv".
The videos don't do it justice.
Also: I have been swapping back and forth between beta1 and beta3 and now I don't get the exact "size" settings anymore as I had before. But it seems like now it happily has accepted hscale 1023 and vscale 512 again.
It seems especially "integer scaling" makes it really bad.
Here are backups of my settings on beta1 and beta3. I hope that can give you a way to reproduce this better.
gbsc-backup-2026-11-20-3.0.0-beta1.txt
gbsc-backup-2026-11-20-3.0.0-beta3.txt
2.) deinterlacer on motion adaptive obviously makes the flickering stop. But it also makes the image appear lower res. (because lack of scanlines).
Let me tell you exactly why I like bob + scanlines: the alternating scanlines simulate weave deinterlacing. Traditional bob just smears each field across the entire screen, thereby delivering an image that bobs up and down.
But bob + scanlines causes something magical: it alternates scanlines where the previous field was supposed to be. This is fairly similar to what happens on CRTs. And it makes you perceive the full vertical resolution. That's why I like it, because you still see the old line where the scanline is getting drawn in a faded manner.
But with this integer scale setting, it appears like not only is the aspect ratio wrong, but when you have the "PAL TV" option enabled, it's almost as if these scanlines alternate at half the speed or something. It's WAY more noticeable.
Please try my profile backup files that I attached to this comment. Try it on beta1 and then compare. The videos don't do it justice.
By the way, I think Hscale 1023 and vscale 512 feel more correct for integer scaling on PAL. I did a write-up on these values some time ago on reddit: https://www.reddit.com/r/retrogaming/comments/1bfnkjz/gbs_control_and_integer_scaling_howto_i_suppose/
Your feature has made me doubt those claims the past few days. But testing this again, I just don't know anymore lol.
P.S. this is my gbs control:
I forgot to mention another thing about why I personally don't pick motion adaptive deinterlacing:
It degrades into traditional bob deinterlacing (smearing a field over the entire screen) whenever there's a ton of vertical movement. (walking into the z-axis or driving in a 3D world). Try one of the need for speed games for example. Motion adaptive is way worse in those scenarios than bob + scanlines.
pal preset uses 81MHz pixel clock totaling in 1440x1125@50Hz = something x 1080 in active pixels. horizontal active pixel count is a question to me.
formula for horizontal scale, HSCALE = 1024 * (Input H.active / Output H.active)
why gbsc project still use fixed frequencies with external clock mod. TV5725 max vclk is 108MHz, external can be higher?
I repeated the tests with a 576i source, Bob and scanlines at 1080p. What you see is reproducible, and unfortunately it is a limit of the scaler chip, not something the firmware can really fix. There are two separate effects.
The flicker comes from Bob. I saw it exactly the same at x2, x3 and x4, so the scale has nothing to do with it. Bob shows one field at a time, and in the TV5725 the scanlines are not generated on the output: they are an effect of the deinterlacer, which darkens the lines it rebuilds. On an interlaced source those lines change position at every field, so the pattern moves 25 times a second. With Adaptive the flicker goes away, but there the chip has no rebuilt lines to darken and the scanlines cannot be drawn. On a progressive source (240p/288p) the problem does not exist, and that is the case the scanlines were made for.
The uneven lines come from Integer scale. On an interlaced source Integer works out its multiple on the lines of a field: at 1080p with 576i it picks x3, which on the 576 lines of the frame is x1.5, so not an integer at all. The scanlines then fall at alternating steps. At x4 they are even.
The best combination the chip allows with 576i, Bob and scanlines at 1080p is Integer scale off and 50Hz style on PAL TV: the picture is already x4, with even lines. It is the one of the pictures you liked in your backups. The flicker of Bob stays in any case.
Since the limit is in the hardware there is not much more I can do here, so I am closing the issue. Thank you for the videos and the backups: they are what led me to the cause.
Welp, I'm not quite ready to let go, so I'm diving into the source code myself. My goal is to let "integer scale" for PAL select vscale 512 for 576p/576i
My findings so far are that a good spot to influence it would be in picOf OR kRows.
The easiest way would be to just replace the intPal row member of row 0x15 and let it have the GEO_TABLE value instead. That would make vscale 512 and widthPm 1000. But it would also make 288p scale the same way.
The thing is: content on a CRT tv used to take a "safe frame" into account. So losing a few lines at the top and bottom wouldn't a big deal at all. (=36 lines for 576i/576p, 18 lines for 288p). But I understand you/many other people might not consider that to be ideal.
I think it would be completely acceptable for 576i and 576p, but 288p could be a slightly harder sell.
Taking that into account, I suppose it preferably it should be an input-aware decision. 288p should retain the 3x scaling. But 576i/576p should get the 2x scaling (== GEO_TABLE == row.pal)
But that would cause more issues. Because then you'd have to take that metadata into account whenever you do a transition or load a profile.
It could be done by creating a bool is288pOrRGBHV in geometryStep(), passing it around all the way to picOf() and keep a static version of it as well to represent the previous value. After all: during transitions, vertUndo() needs to undo the right register values.
But it would also require doing something with the profiles to tie the stored register values to the 288pOrRGBHV state it was saved with.
I haven't completely figured out a good solution for that yet.
The reason why I persist, by the way, is because I consider this 1.5x scale to be a bug. If you select Integer scale and it gives you 1.5x, then it's just lying/bugged.
So I feel like integer scale for 576p/576i should result in 2x scale. Having it at 1x scale makes no sense at all, ever. So the only way it would make sense is to do 2x, even though that means some cropped lines at the top and bottom.
You read the code correctly, and on the starting point you are right: Integer scale picks its multiple on the lines of a field and does not know whether the source is interlaced. At 1080p with a 50 Hz source it uses x3 on the 288 lines of the field. For a 288p source that is a true integer; for 576i it is 864 lines out of 576, so x1.5. I understand that an option called "Integer" that gives x1.5 looks like a bug.
Let me explain why it is this way and where the difficulty is, because I would like to hear your proposal.
The arithmetic at 1080p
| Source | Multiple | Output lines | In 1080 lines |
|---|---|---|---|
| 288p | x3 | 864 | fits whole |
| 576i | x1 | 576 | fits, but fills half the screen |
| 576i | x1.5 (today) | 864 | fits whole, same height as 288p |
| 576i | x2 | 1152 | does not fit: 36 source lines cut |
At 1080p the only integer multiple of 576i with nothing cut is x1. Integer scale was made to show the whole picture with no cropping, and that is why I do not want it to cut lines by itself.
What you ask for already exists, under another name
The 1080p table at 50 Hz without Integer scale (50Hz style "PAL TV") is already x4 on the field: an exact x2 for 576i, with the 36 lines cut that you say you can accept. It is the combination I pointed to above.
Why I do not let Integer scale choose by the source
- Games that alternate 288p and 576i (gameplay and menus, for example). With x3 for 288p and x2 for 576i the picture would go from 864 to 1152 lines and back at every switch: a third larger, then small again.
- Today nothing is loaded between 288p and 576i: only the deinterlacer changes. The geometry would have to be rewritten on the fly exactly there, which is a delicate spot.
- Profiles, as you saw yourself: they store the registers without knowing which kind of scan they were saved with.
Where Integer scale is already an integer for 576i too, with nothing cut
From the tables: at 720p Integer scale uses x2 on the field, so 576i comes out at x1 (576 lines in 720); at 1200p it uses x4, so 576i comes out at x2 and 288p at x4, both 1152 lines, the same height and nothing cut. I have not looked at the 1200p case with a 576i source at my TV yet, so take it as what the tables say. If your display accepts 1200p, it is the road that gives exactly what you are after.
The question for you
With these constraints (nothing cut by default, no change of size inside the same game, profiles that keep working), how would you want it to behave at 1080p? I am interested in the behaviour before the code: for example an explicit third value of Integer scale that uses even multiples only, and so cuts or shrinks depending on the resolution, or something else you have in mind. If you then want to propose a PR, the three points above are the ones it would have to handle.
Hello Brisma,
Thanks for the follow-up.
What you ask for already exists, under another name
I was aware of that since your previous response. The problems with that are:
- From a UI perspective, this is obscure
- From a usability perspective, every time you switch consoles, you'd have to toggle the integer scale setting and possibly the PAL mode (not sure about the latter, because it's been a few days since I looked at the code). That's slightly annoying.
As a User, if my preference is integer scaling, I'd rather select it once and keep it set, no matter the console. If that wouldn't be possible, I'd like to tie these settings to the profile.
Integer scale was made to show the whole picture with no cropping
Let me preface this with that I respect your decision, but I feel like this specific design choice is precisely why it's not a "clean" setting. The current setting has 2 responsibilities: 1.) do integer scaling, 2.) restrict cropping. And both as a user and a developer, I feel like 1.5x in this context makes no sense. Especially because 576i/576p is not exactly a corner case.
That being said, you do raise a good point about games that alternate 288p and 576i. I suppose that's the reason why you made it that way and I can see that. That's fair.
Where Integer scale is already an integer for 576i too, with nothing cut
My problem with using a different resolution, is that it relies on the builtin scaler of the tv to scale the GBS-C output to the native resolution. These scalers often do a bad job of it. I would no longer call that integer scaling.
I think if you have a 4K tv, 1080p would be the sweet spot, because 1080p would be a clean integer scale. That being said, most tv's still use bicubic or other interpolation-based scaling, even for integer-scalable resolutions like this.
My 4K LG TV doesn't accept 1200p by the way.
My proposal, within your constraints
Having read your latest message, I do find myself agreeing with your arguments to not have source-based integer scaling.
But avoiding this, should simplify the implementation a lot.
Where I'm at right now, is what I argued earlier in this comment: the current "integer scaling" property is not clean.
But if we'd split up these 2 responsibilities into separate settings, then it should make everyone happy, right? So how about this:
In the Web UI, when you enable integer scaling, another "Allow overscan cropping" toggle will get shown below it.
We can argue all day about the default value (I suppose your choice would be to keep it as-is by default) , but if "Allow overscan cropping" is enabled, it would use the GEO_TABLE value. That means both 288p and 576p would have the slight cropping at the top and bottom, because 288p would end up being 4x scaled as well. But I feel like that's acceptable, because these games were designed with a "safe frame" in mind. And it does end up fulfilling your requirement of no scale switching when the game switches between 288p and 576i.
The "Action Safe" safe-frame standard, takes into account that up to 58 lines of the PAL output could be expected to be lost on CRT tvs (top + bottom). But allowing cropping in GBS-C, would only make us lose 36 lines of 576i/576p. So that should be well within this design frame.
Implementation: The implementation could be fairly easy: Just add another intPalCropped column to the Row struct for this setting. And just select that one in picOf() when the new setting is enabled.
And obviously there would need to be some changes in the webUI as well to make it show correctly. In addition, it needs to be saved either as a global or profile-based setting. In my opinion, it should always be stored the same way as the integer scale setting.
One more thing: I do realize that it would mean taking it into account for other resolutions as well. But I'm not sure if there are any other output resolutions for which such cropping would make sense. For input res 480p <-> output res 720p for example, it would make no sense to do 2x scale with cropping, because you'd lose too much. In fact, it's probably not needed for NTSC inputs at all.
But if and when I would start working on it, I'd make sure to look into that more closely for 240p, 288p, 480i/480p, 576i/576p, using the "Action Safe" safe-frame standard as my guideline.
Implemented in https://github.com/brisma/gbsc-pro/pull/97