Movie on the propeller
Dr_Acula
Posts: 5,484
I know movies have been done before, but this is a demo of a movie playing on the propeller chip on a TV screen http://www.youtube.com/user/DoctorVernAcula#p/a/u/0/qVb8d7ls8Tg
This uses Kye's SD driver code and a 128x96 bitmap driver from Baggers.
No sound as yet, but I think Rayman has a movie player with sound and maybe this can be added?
The propeller boots up into the new TV version of Kyedos (thanks Oldbitcollector) with a fairly small font in green on black. The movie is played by running a compiled binary file "tvmovie.exe" which is simply a propeller .binary renamed to .exe.
The color algorithm takes an RGB value and converts to 86 TV colors. Colors below a certain saturation are converted to gray scale, and colors with very high or very low luminance are converted to white and black.
The TV has contrast/brightness etc adjustable, and at default values, the saturation is about 0.7 for fully saturated colors when comparing with a calibrated VGA palatte. I've set grayscale at 0.25 and you can see this in the movie when the turtle is coming out of the cave, the sides of the cave are just at the threshold of grayscale vs color.
The color processing algorithm is a compromise between what looks good for movies, for outdoor pictures and for faces.
I have an idea that it might be possible to convert this to Spin and then be able to load standard .bmp bitmap files rather than having to pre-process them on a PC.
A few questions for those that have so helpfully contributed code:
@OBC - do you by any chance have a text driver where the text is a bit bigger. Somewhere between 20-40 columns?
@Rayman - when you add sound, how do you keep the audio and video in sync?
@Baggers - this is 128x96 with 16x16 tiles. Is it possible to change to 8x8 tiles, then gradually increase the number of pixels? Any chance of going to 160x120? Also, 128x96 ix 4:3 but there are black bars on the screen. I tried changing vertical tiles from 6 to 7 and it did seem to get rid of the bars.
@anyone - is there a 4 color TV driver out there - I'm thinking of a 320x240 gray scale as for the VGA GUI.
This is all great fun! Thanks to all the great people on the forum and the spirit of open-source and creating things collaboratively.
This uses Kye's SD driver code and a 128x96 bitmap driver from Baggers.
No sound as yet, but I think Rayman has a movie player with sound and maybe this can be added?
The propeller boots up into the new TV version of Kyedos (thanks Oldbitcollector) with a fairly small font in green on black. The movie is played by running a compiled binary file "tvmovie.exe" which is simply a propeller .binary renamed to .exe.
The color algorithm takes an RGB value and converts to 86 TV colors. Colors below a certain saturation are converted to gray scale, and colors with very high or very low luminance are converted to white and black.
The TV has contrast/brightness etc adjustable, and at default values, the saturation is about 0.7 for fully saturated colors when comparing with a calibrated VGA palatte. I've set grayscale at 0.25 and you can see this in the movie when the turtle is coming out of the cave, the sides of the cave are just at the threshold of grayscale vs color.
The color processing algorithm is a compromise between what looks good for movies, for outdoor pictures and for faces.
Private Function RGB_to_PropTV(ByVal R As Byte, ByVal G As Byte, ByVal B As Byte) Dim PropByte As Byte Dim MyColor As Color Dim H, S, L As Double Dim NewH, NewS, NewL As Double Dim PropHue As Integer Dim PropLum As Double MyColor = Color.FromArgb(255, R, G, B) ' 0-255 for each value H = MyColor.GetHue ' 0-359 S = MyColor.GetSaturation ' 0-1 L = MyColor.GetBrightness ' 0-1 NewH = H NewS = S NewL = L If S > 0.25 Then ' some color present NewS = 1 ' fully saturated colors Else NewS = 0 ' gray scale End If If L > 0.84 Then ' a very bright color is almost white NewS = 0 ' gray scale and white NewL = 1 End If If L < 0.16 Then ' black NewS = 0 ' grayscale and black NewL = 0 End If NewH = 0.5 + H / 22.5 ' round to 0-15 NewH = Int(NewH) ' round NewH = NewH * 22.5 ' convert back to degrees NewH = NewH / 360 ' convert to 0-1 If NewS = 0 Then ' grayscale NewL = NewL * 5 + 0.5 ' round to 5 discrete steps and add 0.5 offset so integer works NewL = Int(NewL) NewL = NewL / 5 ' convert back to 0-1 PropByte = 2 + NewL * 5 ' gray values hex 02,03,04,05,06,07 Else Select Case NewH * 16 ' there probably is a mathematical formula for this Case 11 To 12 : PropHue = 0 Case 10 To 11 : PropHue = 1 Case 9 To 10 : PropHue = 2 Case 8 To 9 : PropHue = 3 Case 7 To 8 : PropHue = 4 Case 6 To 7 : PropHue = 5 Case 5 To 6 : PropHue = 6 Case 4 To 5 : PropHue = 7 Case 3 To 4 : PropHue = 8 Case 2 To 3 : PropHue = 9 Case 1 To 2 : PropHue = 10 Case 0 To 1 : PropHue = 11 Case 15 To 16 : PropHue = 12 Case 14 To 15 : PropHue = 13 Case 13 To 14 : PropHue = 14 Case 12 To 13 : PropHue = 15 End Select PropLum = L ' original L value ' black and white already converted to gray scale so value will be ' 0.16 to 0.84. There are 5 discrete steps here which is 1 more than the gray scale PropLum = PropLum - 0.16 ' remove the black, range is now 0 to 2/3 PropLum = PropLum * 7.5 ' 5/(2/3) is 15/2 = 7.5 so range 0 to 5 PropLum = Int(PropLum) ' scale to an integer If PropLum > 4 Then PropLum = 4 ' now a value 0,1,2,3,4 If PropLum < 0 Then PropLum = 0 PropByte = PropHue * 16 + PropLum + 10 ' convert to propeller value End If Return PropByte End Function
I have an idea that it might be possible to convert this to Spin and then be able to load standard .bmp bitmap files rather than having to pre-process them on a PC.
A few questions for those that have so helpfully contributed code:
@OBC - do you by any chance have a text driver where the text is a bit bigger. Somewhere between 20-40 columns?
@Rayman - when you add sound, how do you keep the audio and video in sync?
@Baggers - this is 128x96 with 16x16 tiles. Is it possible to change to 8x8 tiles, then gradually increase the number of pixels? Any chance of going to 160x120? Also, 128x96 ix 4:3 but there are black bars on the screen. I tried changing vertical tiles from 6 to 7 and it did seem to get rid of the bars.
@anyone - is there a 4 color TV driver out there - I'm thinking of a 320x240 gray scale as for the VGA GUI.
This is all great fun! Thanks to all the great people on the forum and the spirit of open-source and creating things collaboratively.