Skip to content
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

Problem with image converter #1

Open
IanSB opened this issue Mar 5, 2019 · 8 comments
Open

Problem with image converter #1

IanSB opened this issue Mar 5, 2019 · 8 comments

Comments

@IanSB
Copy link

IanSB commented Mar 5, 2019

Hi Simon,
I don't know if you've been following the BBCtoHDMI thread on stardot but I've got a 16 colour mode 2 with programmable palette working with that and can display nula type mode 2 images with no internal hardware mods:
https://stardot.org.uk/forums/viewtopic.php?f=3&t=14430&start=600#p226594
However there is a problem with the converted images:
The BBCtoHDMI converter captures the BBC video output into a frame buffer on the Pi which is slightly larger than the displayed image because each mode is shifted differently in the horizontal direction and also to cope with *TV 255,0 etc.
However the Pi can't tell the difference between logical colour 0 on the mode 2 display and the BBC black screen border so if logical colour 0 is programmed to anything other than black you get a coloured border around the image. You can see that in the BBC micro image linked above and I've also attached another example:
car
Would you consider modding your converter and updating the images to always put the darkest colour on logical colour 0?

@simondotm
Copy link
Member

Hi Ian,
Thanks for your note. Great work on the project btw.
It shouldn't be a problem to sort the palette before remapping so I'll take a look at that when I get a free moment.
Out of interest, what will happen for example in an image such as this:
image
Where all 16-colours are used, but the image doesn't really have an obvious BG colour as such? Will the HDMI version have a pixel border based on whatever logical colour 0 is set to?
Intuitively an artist would assign the light blue colour to palette entry 0, but in an automated conversion there is a lack of subjectivity!

Best,
Simon

@simondotm
Copy link
Member

simondotm commented Mar 6, 2019

Just to add to that, by sorting the palette, we'll get a black or dark border since the image contains dark palette entries, so I'm sure it'll will be an effective fix for most cases.
This one is probably a better example:
image

As there's no 'dark' colours present. Mind you, the darkest colour is probably the blue BG .... but red might compete for that prize in which case we'd get a red border again. Hmmm..
Let's give it a go anyway.

@simondotm
Copy link
Member

Perhaps I could also run a histogram to weight toward the most prevalent colour in the image. Interesting stuff.

@IanSB
Copy link
Author

IanSB commented Mar 7, 2019

As there's no 'dark' colours present. Mind you, the darkest colour is probably the blue BG .... but red might compete for that prize in which case we'd get a red border again. Hmmm..
Let's give it a go anyway.

Yes I noticed the problem with that one myself. Perhaps one option would be to look for the darkest colour and if there isn't a suitable colour reasonably close to black then scan the boundary of the image and use the most common colour on the boundary as logical 0 which should give blue in the above example.

Once I've got the command codes fully implemented I plan on modifying your beeb code to drive the palette in the converter so the demo should run nearly identically to a nula. I think it should be possible to auto switch between nula and hdmi mode by detecting the nula driver ROM

@simondotm
Copy link
Member

Good idea to do the border scan. I'll incorporate that approach I think.

@IanSB
Copy link
Author

IanSB commented Mar 23, 2019

Hi Simon,
I've been working quite a lot on the HDMI converter recently including adding a profile system and auto switching support for PC style resolutions so another suggestion I have for your image converter is to have a selectable output resolution. The HDMI converter can now display PC CGA and EGA modes (640x200 and 640x350 respectively) and they are essentially the same as bbc mode 0 which is being interpreted as mode 2 so I could run a similar demo on early PCs at 160x200 and 160x350. Both of those resoloutions would be scaled to 4:3 so the image would have to be squashed vertically for CGA and stretched vertically for EGA.

@IanSB
Copy link
Author

IanSB commented Mar 23, 2019

I changed the way the frame buffer is implemented so it can now fill the entire active screen area and in many cases it looks quite good with a coloured border but the car one is still wrong I think:
capture29

This one looks good with a border even though it has black:
capture30

@IanSB IanSB closed this as completed Mar 23, 2019
@IanSB IanSB reopened this Mar 23, 2019
@IanSB
Copy link
Author

IanSB commented Mar 23, 2019

Sorry, hit close by accident

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants