github上hamsternz/FPGA_DisplayPort 的VHDL源码分析(二)

本文深入探讨了在视频数据流中插入MSA(Main Stream Attributes)的机制,特别是在每帧发送完成后的BS和BE间进行插入的过程。文章详细分析了在特定条件下如何触发MSA的插入,以及如何利用计数器逐字替换原始无效数据。此外,还讨论了在不同情况下,如BS和VB-ID不在同一字时的处理策略。

分析insert_main_stream_attrbutes_one_channel.vhd

顾名思义,改代码是在原始数据流的基础上插入MSA。MSA的内容只能在每帧发送完成后的BS和BE间插入。(我读协议时好像看到是一帧结束后才能插入MSA,后来没仔细核对,但是代码也确实是这么做的)

 

            ---------------------------------------------
            -- Is the BS in the channel 0's data0 symbol? 
            ---------------------------------------------
            if in_data(8 downto 0) = BS then
                ---------------------------------
                -- This time in_data(17 downto 9) = VB-ID
                -- First, see if this is a line in 
                -- the VSYNC
                ---------------------------------
                if in_data(9) = '1' then
                    if armed = '1' then
                        count <= "00001";
                        armed <= '0';
                    end if;
                else
                    -- Not in the Vblank. so arm the trigger to send the MSA 
                    -- when the next BS with Vblank asserted occurs                      
                    armed <= '1';
                end if;
            end if;

这段的意思是检测到BS及VB-ID的最后一个bit为1时,count置为1,然后count会从1计数到27后保持为0,利用这个计数器将MSA的内容逐字插入到数据流中替换原始无效数据。里面有个armed,意义就是原始发送数据流中600~627行同样满足BS及VB-ID的最后一个bit为1,但此时我们不插入MSA,MSA仅在传完第599行(从0计数)有效数据的Blanding期间插入

 

            ---------------------------------------------
            -- Is the BS in the channel 0's data1 symbol? 
            ---------------------------------------------
            if in_data(17 downto 9) = BS then
                last_was_bs <= '1';
            else
                last_was_bs <= '0';               
            end if;

            ---------------------------------------------
            -- Was the BS in the channel 0's data1 symbol
            -- during the last cycle? 
            ---------------------------------------------            
            if last_was_bs = '1' then
                ---------------------------------
                -- This time in_ch0_data0 = VB-ID
                -- First, see if this is a line in 
                -- the VSYNC
                ---------------------------------
                if in_data(0) = '1' then
                    if armed = '1' then
                        count <= "00001";
                        armed <= '0';
                    end if;
                else
                    -- Not in the Vblank. so arm the trigger to send the MSA 
                    -- when the next BS with Vblank asserted occurs                      
                    armed <= active;
                end if;
            end if;

这两段是处理BS和VB-ID不在同一个字时的情况。在使用自己产生的数据时,没有设计这种情况

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值