📄 h264cavlc.vhd
字号:
b"0011" when totalzeros=0 and totalcoeffs=2 and ztable='0' else
b"0011" when totalzeros=1 and totalcoeffs=2 and ztable='0' else
b"0011" when totalzeros=2 and totalcoeffs=2 and ztable='0' else
b"0011" when totalzeros=3 and totalcoeffs=2 and ztable='0' else
b"0011" when totalzeros=4 and totalcoeffs=2 and ztable='0' else
b"0100" when totalzeros=5 and totalcoeffs=2 and ztable='0' else
b"0100" when totalzeros=6 and totalcoeffs=2 and ztable='0' else
b"0100" when totalzeros=7 and totalcoeffs=2 and ztable='0' else
b"0100" when totalzeros=8 and totalcoeffs=2 and ztable='0' else
b"0101" when totalzeros=9 and totalcoeffs=2 and ztable='0' else
b"0101" when totalzeros=10 and totalcoeffs=2 and ztable='0' else
b"0110" when totalzeros=11 and totalcoeffs=2 and ztable='0' else
b"0110" when totalzeros=12 and totalcoeffs=2 and ztable='0' else
b"0110" when totalzeros=13 and totalcoeffs=2 and ztable='0' else
b"0110" when totalzeros=14 and totalcoeffs=2 and ztable='0' else
b"0100" when totalzeros=0 and totalcoeffs=3 and ztable='0' else
b"0011" when totalzeros=1 and totalcoeffs=3 and ztable='0' else
b"0011" when totalzeros=2 and totalcoeffs=3 and ztable='0' else
b"0011" when totalzeros=3 and totalcoeffs=3 and ztable='0' else
b"0100" when totalzeros=4 and totalcoeffs=3 and ztable='0' else
b"0100" when totalzeros=5 and totalcoeffs=3 and ztable='0' else
b"0011" when totalzeros=6 and totalcoeffs=3 and ztable='0' else
b"0011" when totalzeros=7 and totalcoeffs=3 and ztable='0' else
b"0100" when totalzeros=8 and totalcoeffs=3 and ztable='0' else
b"0101" when totalzeros=9 and totalcoeffs=3 and ztable='0' else
b"0101" when totalzeros=10 and totalcoeffs=3 and ztable='0' else
b"0110" when totalzeros=11 and totalcoeffs=3 and ztable='0' else
b"0101" when totalzeros=12 and totalcoeffs=3 and ztable='0' else
b"0110" when totalzeros=13 and totalcoeffs=3 and ztable='0' else
b"0101" when totalzeros=0 and totalcoeffs=4 and ztable='0' else
b"0011" when totalzeros=1 and totalcoeffs=4 and ztable='0' else
b"0100" when totalzeros=2 and totalcoeffs=4 and ztable='0' else
b"0100" when totalzeros=3 and totalcoeffs=4 and ztable='0' else
b"0011" when totalzeros=4 and totalcoeffs=4 and ztable='0' else
b"0011" when totalzeros=5 and totalcoeffs=4 and ztable='0' else
b"0011" when totalzeros=6 and totalcoeffs=4 and ztable='0' else
b"0100" when totalzeros=7 and totalcoeffs=4 and ztable='0' else
b"0011" when totalzeros=8 and totalcoeffs=4 and ztable='0' else
b"0100" when totalzeros=9 and totalcoeffs=4 and ztable='0' else
b"0101" when totalzeros=10 and totalcoeffs=4 and ztable='0' else
b"0101" when totalzeros=11 and totalcoeffs=4 and ztable='0' else
b"0101" when totalzeros=12 and totalcoeffs=4 and ztable='0' else
b"0100" when totalzeros=0 and totalcoeffs=5 and ztable='0' else
b"0100" when totalzeros=1 and totalcoeffs=5 and ztable='0' else
b"0100" when totalzeros=2 and totalcoeffs=5 and ztable='0' else
b"0011" when totalzeros=3 and totalcoeffs=5 and ztable='0' else
b"0011" when totalzeros=4 and totalcoeffs=5 and ztable='0' else
b"0011" when totalzeros=5 and totalcoeffs=5 and ztable='0' else
b"0011" when totalzeros=6 and totalcoeffs=5 and ztable='0' else
b"0011" when totalzeros=7 and totalcoeffs=5 and ztable='0' else
b"0100" when totalzeros=8 and totalcoeffs=5 and ztable='0' else
b"0101" when totalzeros=9 and totalcoeffs=5 and ztable='0' else
b"0100" when totalzeros=10 and totalcoeffs=5 and ztable='0' else
b"0101" when totalzeros=11 and totalcoeffs=5 and ztable='0' else
b"0110" when totalzeros=0 and totalcoeffs=6 and ztable='0' else
b"0101" when totalzeros=1 and totalcoeffs=6 and ztable='0' else
b"0011" when totalzeros=2 and totalcoeffs=6 and ztable='0' else
b"0011" when totalzeros=3 and totalcoeffs=6 and ztable='0' else
b"0011" when totalzeros=4 and totalcoeffs=6 and ztable='0' else
b"0011" when totalzeros=5 and totalcoeffs=6 and ztable='0' else
b"0011" when totalzeros=6 and totalcoeffs=6 and ztable='0' else
b"0011" when totalzeros=7 and totalcoeffs=6 and ztable='0' else
b"0100" when totalzeros=8 and totalcoeffs=6 and ztable='0' else
b"0011" when totalzeros=9 and totalcoeffs=6 and ztable='0' else
b"0110" when totalzeros=10 and totalcoeffs=6 and ztable='0' else
b"0110" when totalzeros=0 and totalcoeffs=7 and ztable='0' else
b"0101" when totalzeros=1 and totalcoeffs=7 and ztable='0' else
b"0011" when totalzeros=2 and totalcoeffs=7 and ztable='0' else
b"0011" when totalzeros=3 and totalcoeffs=7 and ztable='0' else
b"0011" when totalzeros=4 and totalcoeffs=7 and ztable='0' else
b"0010" when totalzeros=5 and totalcoeffs=7 and ztable='0' else
b"0011" when totalzeros=6 and totalcoeffs=7 and ztable='0' else
b"0100" when totalzeros=7 and totalcoeffs=7 and ztable='0' else
b"0011" when totalzeros=8 and totalcoeffs=7 and ztable='0' else
b"0110" when totalzeros=9 and totalcoeffs=7 and ztable='0' else
b"0110" when totalzeros=0 and totalcoeffs=8 and ztable='0' else
b"0100" when totalzeros=1 and totalcoeffs=8 and ztable='0' else
b"0101" when totalzeros=2 and totalcoeffs=8 and ztable='0' else
b"0011" when totalzeros=3 and totalcoeffs=8 and ztable='0' else
b"0010" when totalzeros=4 and totalcoeffs=8 and ztable='0' else
b"0010" when totalzeros=5 and totalcoeffs=8 and ztable='0' else
b"0011" when totalzeros=6 and totalcoeffs=8 and ztable='0' else
b"0011" when totalzeros=7 and totalcoeffs=8 and ztable='0' else
b"0110" when totalzeros=8 and totalcoeffs=8 and ztable='0' else
b"0110" when totalzeros=0 and totalcoeffs=9 and ztable='0' else
b"0110" when totalzeros=1 and totalcoeffs=9 and ztable='0' else
b"0100" when totalzeros=2 and totalcoeffs=9 and ztable='0' else
b"0010" when totalzeros=3 and totalcoeffs=9 and ztable='0' else
b"0010" when totalzeros=4 and totalcoeffs=9 and ztable='0' else
b"0011" when totalzeros=5 and totalcoeffs=9 and ztable='0' else
b"0010" when totalzeros=6 and totalcoeffs=9 and ztable='0' else
b"0101" when totalzeros=7 and totalcoeffs=9 and ztable='0' else
b"0101" when totalzeros=0 and totalcoeffs=10 and ztable='0' else
b"0101" when totalzeros=1 and totalcoeffs=10 and ztable='0' else
b"0011" when totalzeros=2 and totalcoeffs=10 and ztable='0' else
b"0010" when totalzeros=3 and totalcoeffs=10 and ztable='0' else
b"0010" when totalzeros=4 and totalcoeffs=10 and ztable='0' else
b"0010" when totalzeros=5 and totalcoeffs=10 and ztable='0' else
b"0100" when totalzeros=6 and totalcoeffs=10 and ztable='0' else
b"0100" when totalzeros=0 and totalcoeffs=11 and ztable='0' else
b"0100" when totalzeros=1 and totalcoeffs=11 and ztable='0' else
b"0011" when totalzeros=2 and totalcoeffs=11 and ztable='0' else
b"0011" when totalzeros=3 and totalcoeffs=11 and ztable='0' else
b"0001" when totalzeros=4 and totalcoeffs=11 and ztable='0' else
b"0011" when totalzeros=5 and totalcoeffs=11 and ztable='0' else
b"0100" when totalzeros=0 and totalcoeffs=12 and ztable='0' else
b"0100" when totalzeros=1 and totalcoeffs=12 and ztable='0' else
b"0010" when totalzeros=2 and totalcoeffs=12 and ztable='0' else
b"0001" when totalzeros=3 and totalcoeffs=12 and ztable='0' else
b"0011" when totalzeros=4 and totalcoeffs=12 and ztable='0' else
b"0011" when totalzeros=0 and totalcoeffs=13 and ztable='0' else
b"0011" when totalzeros=1 and totalcoeffs=13 and ztable='0' else
b"0001" when totalzeros=2 and totalcoeffs=13 and ztable='0' else
b"0010" when totalzeros=3 and totalcoeffs=13 and ztable='0' else
b"0010" when totalzeros=0 and totalcoeffs=14 and ztable='0' else
b"0010" when totalzeros=1 and totalcoeffs=14 and ztable='0' else
b"0001" when totalzeros=2 and totalcoeffs=14 and ztable='0' else
b"0001" when totalzeros=0 and totalcoeffs=15 and ztable='0' else
b"0001" when totalzeros=1 and totalcoeffs=15 and ztable='0' else
--
b"0001" when totalzeros=0 and totalcoeffs=1 and ztable='1' else
b"0010" when totalzeros=1 and totalcoeffs=1 and ztable='1' else
b"0011" when totalzeros=2 and totalcoeffs=1 and ztable='1' else
b"0011" when totalzeros=3 and totalcoeffs=1 and ztable='1' else
b"0001" when totalzeros=0 and totalcoeffs=2 and ztable='1' else
b"0010" when totalzeros=1 and totalcoeffs=2 and ztable='1' else
b"0010" when totalzeros=2 and totalcoeffs=2 and ztable='1' else
b"0001" when totalzeros=0 and totalcoeffs=3 and ztable='1' else
b"0001"; -- totalzeros=1 and totalcoeffs=3 and ztable='1'
--
-- tables for run_before, up to 6
rbtoken <=
b"111" when runb=0 else
b"000" when runb=1 and rbzerosleft=1 else
b"001" when runb=1 and rbzerosleft=2 else
b"010" when runb=1 and rbzerosleft=3 else
b"010" when runb=1 and rbzerosleft=4 else
b"010" when runb=1 and rbzerosleft=5 else
b"000" when runb=1 and rbzerosleft=6 else
b"110" when runb=1 else
b"000" when runb=2 and rbzerosleft=2 else
b"001" when runb=2 and rbzerosleft=3 else
b"001" when runb=2 and rbzerosleft=4 else
b"011" when runb=2 and rbzerosleft=5 else
b"001" when runb=2 and rbzerosleft=6 else
b"101" when runb=2 else
b"000" when runb=3 and rbzerosleft=3 else
b"001" when runb=3 and rbzerosleft=4 else
b"010" when runb=3 and rbzerosleft=5 else
b"011" when runb=3 and rbzerosleft=6 else
b"100" when runb=3 else
b"000" when runb=4 and rbzerosleft=4 else
b"001" when runb=4 and rbzerosleft=5 else
b"010" when runb=4 and rbzerosleft=6 else
b"011" when runb=4 else
b"000" when runb=5 and rbzerosleft=5 else
b"101" when runb=5 and rbzerosleft=6 else
b"010" when runb=5 else
b"100" when runb=6 and rbzerosleft=6 else
b"001"; --runb=6
--
READY <= not eenable;
NOUT <= etotalcoeffs;
--
process(CLK2)
begin
if rising_edge(CLK2) then
--reading subprocess
--principle variables start 'e' so are separate pipeline stage from output
--t1sign is used by output before overwritten here; likewise arrays
if ENABLE='1' then
eenable <= '1';
emaxcoeffs <= emaxcoeffs + 1; --this is a coefficient
es <= SIN;
if VIN /= 0 then
etotalcoeffs <= etotalcoeffs + 1; --total nz coefficients
ecnz <= '1'; --we've seen a non-zero
if VIN = 1 or VIN = x"FFF" then -- 1 or -1
if ecgt1 = '0' and etrailingones /= 3 then
etrailingones <= etrailingones + 1;
et1signs <= et1signs(1 downto 0) & VIN(11); --encode sign
end if;
else
ecgt1 <= '1'; --we've seen a greater-than-1
end if;
--put coeffs into array; put runs into array
--coeff is coded as sign & abscoeff
if VIN(11)='1' then
coeffarray(conv_integer(eparity&eindex)) <= '1'&(b"00000000000"-VIN(10 downto 0));
else
coeffarray(conv_integer(eparity&eindex)) <= VIN;
end if;
runbarray(conv_integer(eparity&eindex)) <= erun;
erun <= x"0";
eindex <= eindex+1;
elsif ecnz='1' then --VIN=0 and ecnz
etotalzeros <= etotalzeros + 1; --totalzeros after first nz coeff
erun <= erun + 1;
end if;
--select table for coeff_token (assume 4x4)
if NIN < 2 then
etable <= CTABLE0(1 downto 0);
elsif NIN < 4 then
etable <= CTABLE1(1 downto 0);
elsi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -