PAL Video Example

Designing hardware and software that uses the VS23S0X0 family of ICs as a 8-bit or SPI SRAM memory or as a Video Controller for generating Composite Video (TV-Out) or driving other kinds of displays.
Post Reply
IsoPasi
VLSI Staff
Posts: 15
Joined: Tue 2015-11-24 12:31

PAL Video Example

Post by IsoPasi »

Dear VSDSP Forum Users,

Here is a SW example for setting up the VS23S010 video display controller in
PAL video mode. A picture containing 256 boxes of different colors is
generated.

This software is written for VS1005 using VSOS 3.25 operating system. VS1005
Developer board is connected to VS23S010 lab board. VS1005 SPI bus is used to
control VS23S010. VS23S010 VideoOut is connected via 75 ohm serial resistor to
composite video input of a TV.

The program is quite generic so it can be used as a guide for writing SW also
for other micro-controllers with SPI interface.

The main program is in main.c. It just calls the SpiRamVideoInit() function.

pal.c has the main functions and parameter setting for the video display
controller. SpiRamVideoInit() is the function that sets up the video display
controller and generates picture.

The pal.h header file has all the definitions used by video display controller.
There are several parameters that can be adjusted by editing #defines:
- INTERLACE selects progressive or interlaced picture. In this program
interlaced picture just makes the picture area of first field twice. The
vertical synchronization of video is changed in the programme according to
selected mode.
- BYTEPIC selects 8 bit or 16 bit pixels.
- PLL_CLKS_PER_PIXEL selects the length of pixel in VClk cycles. In this
program it should be three or more. This value sets the pixel length in VClk
cycles.
- BEXTRA is the amount of extra bytes after picture end to prevent picture
to proto area border artifacts. Zero is a good starting point. If there are no
artifacts, let the value be zero. If there are artifacts, set BEXTRA to eight.
- STARTLINE sets the line at which the picture area starts.
- YPIXELS set the picture area in pixels in Y direction. Check that the
picture data amount does not exceed the memory area.
- STARTPIX sets the horizontal pixel at which the picture area begins.
Notice that STARTPIX value has to be larger than line blanking end value.
STARTPIX value is given in CSClk cycles.
- XPIXELS set the picture area in pixels in X direction. Check that the
picture does not become bigger than the memory area. Also check that the length
of picture area is not longer than the line or does not reach the front porch
of the line.
- different BLANK_LEVEL, BLACK_LEVEL and BURST_LEVEL values
can be selected by commenting and uncommenting #defines. By adjusting
BURST_LEVEL different color palettes can be created.
- PAL horizontal sync timing constraints are defined here too (SHORT_SYNC_US,
SHORTSYNC, SHORTSYNCM ... FRPORCH).
Pal1-2015-11-26-15-13-8BitTestImage.zip
(25.01 KiB) Downloaded 817 times
Here is a picture of TV screen after the program is run. Video is
progressive and 8 bits is used for a pixel in picture area. The picture area
(299x240 pixels) is framed by greenish lines. Other parts of image are
generated by prototype lines.
pal1.JPG
pal1.JPG (99.72 KiB) Viewed 20830 times
The microcode program for picture area is B22 A22 Y44 N10:
- Pick 2 bits B (U), shift 2 bits B22
- Pick 2 bits A (V), shift 2 bits A22
- Pick 4 bits Y, shift 4 bits Y44
- and do nothing N10
- Total 8 bits is used for a picture area pixel

The color burst level (U and V value) is set to 0xb5 in the proto line. In the picture can be seen the
color palette of this setup. PLL_CLKS_PER_PIXEL is set to 5.

Here is the VS1005 std out to terminal when program is run:
  • VS23S010 INIT
    Manufacturer ID: 2b03
    ID ok, 4 VS23 ICs in system
    Linelen: 2260 PLL clks
    Picture line area is 299 x 240
    Upper left corner is point (0,0) and lower right corner (298,239)
    Memory space available for picture bytes 127860
    Free bytes 54180
    Picture line 308 bytes
    Picture length, 187 color cycles
    Picture pixel bits 8
    Start pixel 39
    End pixel f4
    Index start address 8e0
    Picture line 0 address c8c
    b8 <= 0eh
    01 <= 40h
    28 <= 0039h
    29 <= 00f4h
    2b <= 3000h
    2a <= 08d4h
    PROG:c09c0a4ah
    2c <= 0238h
    34 <= 0000000010h
    2d <= d138h
    Current line: 806e
Following are more example images using different parameters for BURST LEVEL
and different microcodes of picture area.

Please feel free to ask any questions regarding this example or VS23S010 usage.

Best regards,
Pasi Isotalus, Senior IC Design Engineer, VLSI Solution Oy
Pasi Isotalus, VLSI Solution Oy
IsoPasi
VLSI Staff
Posts: 15
Joined: Tue 2015-11-24 12:31

Re: VS23S010 PAL Video Example

Post by IsoPasi »

In the following picture the color burst level is adjusted to smaller value 0xe2. The last given adjustment can be seen on the bottom left of the picture area (B as burst). The color burst value is shown also on the right bottom of the picture area.

The color burst value in the original picture in the first message is 0xb5. The A(V) is 0xb and B(U) is 0x5. They are both signed 4 bit values. Then the color burst value is changed 0xe2, which is smaller than the original value. The change is done by writing new values to memory addresses of the color burst of the prototype line 0. Prototype line 0 is used in the whole visible area of the picture. The result is shown below. The colors of the image have become stronger.
pal2.JPG
pal2.JPG (110.03 KiB) Viewed 20799 times
More examples are following.

Best regards,
Pasi
Pasi Isotalus, VLSI Solution Oy
IsoPasi
VLSI Staff
Posts: 15
Joined: Tue 2015-11-24 12:31

Re: VS23S010 PAL Video Example

Post by IsoPasi »

In the next image the picture area microcode program is changed compared to first image. In the first image the program was:
The microcode program for picture area is B22 A22 Y44 N10:
- Pick 2 bits B (U), shift 2 bits B22
- Pick 2 bits A (V), shift 2 bits A22
- Pick 4 bits Y, shift 4 bits Y44
- and do nothing N10
- Total 8 bits is used for a picture area pixel
The amount of bits for each pixel can be chosen quite freely. For example in 8 bit case:
- you can take 8 Y bits, shift 1 bit Y81
- take 6 bits A, shift 1 bit A61
- take 6 bits B, shift 1 bit B61
- take nothing, shift 5 bits N15
The total amount of shifts is 8 so the one byte for one pixel data organization stays in sync. On the following image can be seen 8-bit color space generated by the before-mentioned program. The program is also printed on the screen (M as Microcode).
pal3.JPG
pal3.JPG (114.12 KiB) Viewed 20797 times
In the next image the color burst value is changed form the 0xb5 to 0xe2 for getting stronger colors.
pal4.JPG
pal4.JPG (118 KiB) Viewed 20797 times
In the last image the microcode program is changed so that the order of picking A and B is changed. The color palette is changed from the above.
pal5.JPG
pal5.JPG (117.19 KiB) Viewed 20797 times
Best regards,
Pasi
Pasi Isotalus, VLSI Solution Oy
IsoPasi
VLSI Staff
Posts: 15
Joined: Tue 2015-11-24 12:31

Re: VS23S010 PAL Video Example

Post by IsoPasi »

Following are tests with different data widths and also color burst value is inverted.

Compared to previous picture here is taken:
- 6 bits for B, shifted 2 bits
- then the same 6 bits are taken for A and also for Y
Total 8 bits is used again.
pal6.JPG
pal6.JPG (109.97 KiB) Viewed 20729 times
In the next one:
- 4 MSBs of the byte are for A, shift 2
- 4 middle bits of byte are for B, shift 2
- 4 LSBs are for Y, shift 2
- last shift by 2 to make the total of shifts to 8. This could have been done also in the previous line, then there would have been 4 shifts
pal7.JPG
pal7.JPG (106.23 KiB) Viewed 20729 times
In the following picture the colors were made stronger by making the color burst amplitude lower to 0xe2.
pal8.JPG
pal8.JPG (107.62 KiB) Viewed 20729 times
Now the color burst is inverted, its value becomes 0x2e. The whole color palette changes also.
pal9.JPG
pal9.JPG (112.57 KiB) Viewed 20729 times
There can be a program in the host micro-controller that makes a RGB-to-YUV conversion to RGB video data for VS23S010. Then, if the color burst is inverted, also the RGB-to-YUV conversion algorithm has to be adjusted accordingly so that the colors will still stay correct (so that red will still become red and so on...).

There is more to follow still. Please, feel free to comment.

Best regards,
Pasi
Pasi Isotalus, VLSI Solution Oy
IsoPasi
VLSI Staff
Posts: 15
Joined: Tue 2015-11-24 12:31

Re: VS23S010 PAL Video Example

Post by IsoPasi »

It is possible to use less than 8 bits for pixel, if needed. In the following image only three bits are used for a pixel. The program is:
- pick 1 bit Y, shift 1 bit
- pick 1 bit A, shift 1 bit
- pick 1 bit B, shift 1 bit
- take nothing, shift 5 bits. This shift of 5 is done only to retain the 8 bits/pixel synch in the data.

There are eight different colors generated by 3 bits. The color palette could be changed with different color burst values.
pal10.JPG
pal10.JPG (107.74 KiB) Viewed 20621 times
A,B and Y values stay in the video generator as long as new values are loaded. So, if the picture area microcode program has for instance no operation for picking A, then the last A value from protoline area stays the same for the whole picture line area. This could be used for generating some very low bit-rate video.

Best regards,
Pasi
Pasi Isotalus, VLSI Solution Oy
IsoPasi
VLSI Staff
Posts: 15
Joined: Tue 2015-11-24 12:31

Re: VS23S010 PAL Video Example

Post by IsoPasi »

The following picture is a gray-scale image, where all 256 levels of gray of a 8-bit pixel in the picture area are shown. The program picks only Y:
- pick 8 bits for Y, shift 2 bits
- pick nothing, shift 6 bits
- do nothing twice

This microcode program uses the last A and B values of the protoline before the picture area starts, like it was mentioned on the previous post. The protoline is black there (before the picture area border line) so A and B stay as zeros until picture area ends.
pal11.JPG
pal11.JPG (111.02 KiB) Viewed 20615 times
In the next images there are two of the several ways of selecting A and B and the resulting color palettes. The Y (luminance) value is the same as in the first image.

In the first image the four MSBs of byte are reused as A and four LSBs as B, hence the microcode:
- pick 8 bits Y
- pick 4 bits A, shift 4 bits
- pick 4 bits B, shift 4 bits
- do nothing
pal12.JPG
pal12.JPG (115.29 KiB) Viewed 20615 times
In the second image six bits are reused for both A and B after eight bits of Y are taken, The A uses the 6 MSBs and B takes the 6 LSBs of the pixel byte.
pal13.JPG
pal13.JPG (118.16 KiB) Viewed 20615 times
Best regards,
Pasi
Pasi Isotalus, VLSI Solution Oy
IsoPasi
VLSI Staff
Posts: 15
Joined: Tue 2015-11-24 12:31

Re: VS23S010 PAL Video Example

Post by IsoPasi »

Hello,

Here is shown as an example a PAL picture, which has a color palette, where there are plenty of darker and lighter colors. Also all basic colors are shown in this palette. Color burst value is 0xc4.
pal14.JPG
pal14.JPG (114.94 KiB) Viewed 20339 times
Best regards,
Pasi
Pasi Isotalus, VLSI Solution Oy
Brek
Senior User
Posts: 61
Joined: Sun 2016-09-11 5:51

Re: PAL Video Example

Post by Brek »

Hello :) Very nice demo!

I have to wonder why you’d develop a chip in modern times to output composite video.
How could that appeal to industry? ... or why would a chip fab company make a chip just to appeal to hobbyists?

Can I buy these chips in hobbyist quantities?
Cheers, Brek.
Hannu
VLSI Staff
Posts: 527
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: PAL Video Example

Post by Hannu »

Analog video has still some uses. It goes nicely long distances in coaxial cable, image generation is easy and there are a lot of legacy systems in industry. Also the delay is smaller than any stream video codec can provide if done right. Maybe composite video is gone from living room but sure it isn't dead yet.

As always, web store provides:
http://webstore.vlsi.fi/epages/vlsi.sf? ... 2/VS23S010

Quantities start from one.

Hannu
Post Reply