Hi,
I have got the video data by TVP5158 decoder.It can work well at 1-Ch D1,Non-interleaved, 27M,BT.656 mode. Now, I want to set the TVP5158 working at 4-Ch CIF,27M,Single BT.656,Line-Interleaved mode .But I can't understand the data format of 4-Ch CIF,27M,Single BT.656,Line-Interleaved Mode about TVP5158, from the "3.8.3.4 Metadata Insertion for Line-Interleaved Mode" in datasheet, I have some questions as follows:
1) what's meaning of "P0,P1,P2,P3,P4,P5,P6,P7" and "FID and V data" ?
2) what's the length of the "Channel Data" in 4-Ch CIF mode?
3) if I set the TVP5158 working at 4-Ch CIF,27M,Single BT.656,Line-Interleaved mode , Is the output format about BT656 like these(BT656 PAL : 720*576 ; CIF :360*288)??:
EAV + ControlCode + SAV + "Start Code + 356 1-Ch CIF ValidData" + "Start Code + 356 2-Ch CIF ValidData" // first line include 720 pixels
EAV + ControlCode + SAV + "Start Code + 356 3-Ch CIF ValidData" + "Start Code + 356 4-Ch CIF ValidData" // second line include 720 pixels
Best regards
Jerry
:
Jerry,
The 4-byte start code, SC[3:0], is inserted into both the luma and chroma data. Thus, there is a total of 8 bytes of metadata per line. These 8 bytes were designated P0 to P7 in the TVP5158 datasheet.
The SAV and EAV codes of the multi-channel super-frame correspond to a progressive frame. Thus, the F-bit and V-bit of the super-frame are both set to 0. However, the actual F-bit and V-bit of the channel data is provided in the 4-byte start code.
I'm not sure what you mean by length of the channel data. The TVP5158 output includes all active pixels per line (720 for D1 and 360 for CIF) and all lines per frame (525 for NTSC and 625 for PAL) for each video channel. Each super-frame also includes a few dummy lines. The dummy lines are inserted whenever the TVP5158 FIFOs are empty.
The output format for the 8-bit line-interleaved mode is shown in Figure 3-15 of the TVP5158 datasheet. Each line of the super-frame only includes one video channel.
SAV + StartCode + 360 1-Ch CIF valid data + EAV
SAV + StartCode + 360 2-Ch CIF valid data + EAV
Etc.
Also, the channel order is not guaranteed in the line-interleaved mode. Therefore, the channel ID must always be read from the 4-byte start code.
Regards,
Jim
Hi, Jim:
Thanks for your detailed interpretation.
as you say, "the F-bit and V-bit of the super-frame are both set to 0. However, the actual F-bit and V-bit of the channel data is provided in the 4-byte start code." so the SAV and EAV is always 0x80 and 0x9D. Is my understanding right ?
Actually, I can get the SAV(0x9D) and EAV(0x80) from the data after I set the register (not crop mode)
B0 = 0xA3;B1 = 0x10; B2 = 0x05; B3 = 0xE4;B4 = 0xE4;
but now , the data I got is not similar with what you said --"SAV + StartCode + 360 1-Ch CIF valid data + EAV", the data that I got is as follows:
ff 00 00 80 83 83 70 70 99 99 c7 c7 80 10 80 0f 80 0f 80 10 80 0f 80 0f ff 00 00 9d ff 00 00 80 83 83 70 70 58 58 c7 c7 80 0f 7f 10 80 10 80 10 80 0e 80 0e ff 00 00 9d ff 00 00 80 81 81 70 70 b6 b6 80 80 80 10 80 0f 81 10 80 10 7f 0e 7e 0e ff 00 00 9d ff 00 00 80 80 80 71 71 8d 8d 80 80 7f 12 80 0f 81 15 80 8d 80 08 81 08 ff 00 00 9d ff 00 00 80 82 82 70 70 95 95 80 80 80 0f 80 0e 80 0f 80 0f 80 0e 80 0e ff 00 00 9d ff 00 00 80 80 80 70 70 6d 6d c7 c7 + 1844 bytes Data + ff 00 00 9d
1) if the "ff 00 00 80" is SAV, then "80 80 70 70 6d 6d c7 c7" is StartCode, and "ff 00 00 9d " is EAV, why does "360 1-Ch CIF valid data " has so many data(1844 bytes)?
2)as you say, " The TVP5158 output includes all active pixels per line (720 for D1 and 360 for CIF) and all lines per frame (525 for NTSC and 625 for PAL) for each video channel." the CIF (PAL) is 360*288, the hight is 288, Does it has 625 lines per frame? I don't know that how to work, would you like to explain it ?
Hi , Jim :
Sorry, I can't assure that the 4-Ch CIF Line-Interleaved output data formats,so I have some questions to inquire.
As you say, if each line of the super-frame only includes one video channel.
That means "Channel Data" length is 360*2 bytes from Figure 3-15 of the TVP5158 datasheet, is right?
and if all lines per frame (525 for NTSC and 625 for PAL), a frame CIF data has 288 lines , is the other lines dummy lines ?
or a frame of BT656 data include 2 frame CIF data ?
Hello Jerry,
Yes, the channel data length is 360*2 bytes.
The lines per frame numbers I provided in my previous response were actually for D1 output formats.
For the 4-Ch CIF output format, the total number of lines per super frame (default super-frame size) is as follows.
NTSC: 4*(526/2) + 2 = 1054
PAL: 4*(626/2) + 2 = 1254
Each super--frame includes a 2-line vertical sync. For the nominal horizontal input frequency, the output super-frame typically includes a few dummy lines. The dummy lines are inserted whenever the TVP5158 output FIFOs are empty.
Also, the output frame rate of the super-frame is asynchronous with the input frame rate of all 4 video channels.
Thanks for your replying, now, I know the data formats of 4-Ch CIF PAL/NTSC mode , and I can verify it by the data that I received, It is :
SAV + StartCode + 360 X-Ch CIF valid data + EAV (X= 0~3)
SAV is "FF 00 00 80", EAV is "FF 00 00 9D"
As you say, each super--frame includes a 2-line vertical sync. yes , I find it in the data that I received.
the SAV and EAV in the 2-line vertical sync is always "FF 00 00 AB" and "FF 00 00 B6"
and the 2-line vertical sync is continuous. after 2-line vertical sync, then the new super--frame is start , is right ?
By the way, I have 4 channel camera data output to TVP5158 , but the chnanel ID I got from StartCode is always 0 and 3, what's the problem?
I have a another question, I find F ,V ,H in StartCode SC0 is variable and I find the value "F=1", so I want to know the CIF formats(TVP5158 output ) is progressive or interlacing ?
If the data of CIF formats is interlacing ,do I need merge a odd frame and a even frame to a whole frame?
best regards
Yes, the new super-frame starts immediately after the 2-line vertical sync.
In the 4-Ch CIF line-interleaved mode, the output metadata should include all 4 channel IDs. However, the video channels are not output in any particular order.
Yes, the CIF output is actually interlaced. For a true progressive CIF output, the easiest solution is to select the the Half-D1 output format and then drop every other field in the backend.
Thanks for your explanation, now ,I can get all 4 channel IDs from received data,and show the 4-Ch video image. but the video image is not normal.
I find each channel has 308 total lines (not include dummy lines), and 283~285 valid lines (V=0, include valid video data),
I think the total valid lines of each channel less than 288 leads to the video image is always moving.
the total valid lines of each channel is 284, is it right?
How to get 288 valid lines ?
The rest of the video lines will be in the next super-frame.
The total number of lines in a super-frame is a fixed arbitrary number.
Therefore, the number of actual channel lines per super-frame decreases as the number of dummy lines increases.
The insertion of dummy lines whenever the TVP5158 output FIFOs are empty is required to maintain synchronization with the input.
There will always be some dummy lines during normal operation. The actual number of dummy lines per super-frame depends on the input horizontal frequency of each video channel.
Hi,James:
I am using TVP5158 with DM642. The tvp5158 was be set 2-ch interleaved half-d1 output mode.
I also found the valid lines each channel is less than 576, you said " The rest of the video lines will be in the next super-frame." ?
The size of super-frame is 1250 lines for PAL ,How can I get the rest of video lines from next super-frame?
Hi, James:
I also found the bit F of SC0 is error, I can't drop one field through it. I only need one field, and How can I do?
Roy
Hi, Jerry:
You have posted:
Do you have resolved the problem?
Can you help me?
Roy zhang
Best Regards!
Hi, Roy:
The data order of StartCode(SC3 ,SC3, SC2,SC2,SC1,SC1,SC0,SC0) is
Data[0],Data[1],Data[2],Data[3],Data[4],Data[5],Data[6],Data[7],
not Data[7],Data[6],Data[5],Data[4],Data[3],Data[2],Data[1],Data[0].
You can try it.
regards
All,
The TVP5158 output formatter creates super-frames by inserting a 2-line VSYNC into the multiplexed channel data stream at fixed arbitrary time intervals.
For the 4-Ch CIF output format with PAL inputs, the default super-frame size including the 2-line VSYNC is 1254 lines.
The nominal duration of a PAL video frame is 40 ms.
However, the default duration of the 4-Ch CIF super-frame is only 38.64ms.
(832 pixels) * (1254 lines) / 27MHz = 38.64ms
Since the duration of the input frame (40 ms) is longer than the duration of the output super-frame (38.64 ms), it is impossible to fit all the lines of an entire input frame into an output super-frame of this size. However, it really doesn't matter. The rest of the video lines will be in the next super-frame and no lines will ever be lost.
Thanks for your useful replying.
Would you like to explain "832 pixels" in "(832 pixels) * (1254 lines) / 27MHz = 38.64ms"?
Why is not "360 pixels"?