?? huffman.vhd
字號(hào):
end if;
end loop;
end loop;
end if;
else
if (frm.sideinfo.scfsi(0) = '0') or (gr = '0') then
for sfb in 0 to 5 loop
if 8191-conv_integer(bitpos)+1>=slenval0 then
scout.scalefac_l(sfb):= conv_std_logic_vector(conv_integer(valuebuffer(conv_integer(bitpos) to conv_integer(bitpos)+slenval0-1)),4);
if 8191-conv_integer(bitpos)+1=slenval0 then
bitpos:=(others=>'0');
tempcount1:='1';
else
bitpos := conv_std_logic_vector((conv_integer(bitpos) + slenval0),13);
end if;
else
temppos:=conv_integer(bitpos);
tempval:=8191-temppos+1;
scout.scalefac_l(sfb):=
conv_std_logic_vector(conv_integer(valuebuffer(temppos to 8191)& valuebuffer(0 to slenval0-tempval-1)),4);
bitpos:=(others=>'0');
tempcount1:='1';
bitpos := conv_std_logic_vector((slenval0-tempval),13);
end if;
end loop;
end if;
if (frm.sideinfo.scfsi(1)= '0') or (gr = '0') then
for sfb in 6 to 10 loop
if 8191-conv_integer(bitpos)+1>=slenval0 then
scout.scalefac_l(sfb) := conv_std_logic_vector(conv_integer(valuebuffer(conv_integer(bitpos) to conv_integer(bitpos)+slenval0-1)),4);
if 8191-conv_integer(bitpos)+1=slenval0 then
bitpos:=(others=>'0');
tempcount1:='1';
else
bitpos := conv_std_logic_vector((conv_integer(bitpos) + slenval0),13);
end if;
else
temppos:=conv_integer(bitpos);
tempval:=8191-temppos+1;
scout.scalefac_l(sfb) :=
conv_std_logic_vector(conv_integer(valuebuffer(temppos to 8191)& valuebuffer(0 to slenval0-tempval-1)),4);
bitpos:=(others=>'0');
tempcount1:='1';
bitpos := conv_std_logic_vector((slenval0-tempval),13);
end if;
end loop;
end if;
if (frm.sideinfo.scfsi(2) = '0') or (gr = '0') then
for sfb in 11 to 15 loop
if 8191-conv_integer(bitpos)+1>=slenval1 then
scout.scalefac_l(sfb) :=
conv_std_logic_vector(conv_integer(valuebuffer(conv_integer(bitpos) to conv_integer(bitpos)+slenval1-1)),4);
if 8191-conv_integer(bitpos)+1=slenval1 then
bitpos:=(others=>'0');
tempcount1:='1';
else
bitpos := conv_std_logic_vector((conv_integer(bitpos) + slenval1),13);
end if;
else
temppos:=conv_integer(bitpos);
tempval:=8191-temppos+1;
scout.scalefac_l(sfb) :=
conv_std_logic_vector(conv_integer(valuebuffer(temppos to 8191)& valuebuffer(0 to slenval1-tempval-1)),4);
bitpos:=(others=>'0');
tempcount1:='1';
bitpos := conv_std_logic_vector((slenval1-tempval),13);
end if;
end loop;
end if;
if (frm.sideinfo.scfsi(3) = '0') or (gr = '0') then
for sfb in 16 to 20 loop
if 8191-conv_integer(bitpos)+1>=slenval1 then
scout.scalefac_l(sfb) :=
conv_std_logic_vector(conv_integer(valuebuffer(conv_integer(bitpos) to conv_integer(bitpos)+slenval1-1)),4);
if 8191-conv_integer(bitpos)+1=slenval1 then
bitpos:=(others=>'0');
tempcount1:='1';
else
bitpos := conv_std_logic_vector((conv_integer(bitpos) + slenval1),13);
end if;
else
temppos:=conv_integer(bitpos);
tempval:=8191-temppos+1;
scout.scalefac_l(sfb) :=
conv_std_logic_vector(conv_integer(valuebuffer(temppos to 8191)& valuebuffer(0 to slenval1-tempval-1)),4);
bitpos:=(others=>'0');
tempcount1:='1';
bitpos := conv_std_logic_vector((slenval1-tempval),13);
end if;
end loop;
end if;
end if;
scout.scalefac_l(21) := "0000";
scout.scalefac_l(22) := "0000";
for window in 0 to 2 loop
scout.scalefac_s(12)(window) := "0000";
end loop;
ns<= HUFFMAN;
when HUFFMAN =>
if (frm.sideinfo.blocksplit_flag = '1') and (frm.sideinfo.block_type = "10") then
region1start := 36;
region2start :=576;
else
region1start := sfBandIndex_l(conv_integer(frm.header.frequency),conv_integer(frm.sideinfo.region_address1)+1);
if (frm.sideinfo.blocksplit_flag = '1') then
region2start :=576;
else
region2start :=
sfBandIndex_l(conv_integer(frm.header.frequency),conv_integer(frm.sideinfo.region_address1)+conv_integer(frm.sideinfo.region_address2)+2);
end if;
end if;
bigvalues := conv_integer(frm.sideinfo.big_values);
old_region :=3;
ns<= HUFFBIGVALUE;
when HUFFBIGVALUE =>
if (line < region1start) then
region :=0;
elsif line < region2start then
region :=1;
else
region :=2;
end if;
if (region /= old_region) then
tindex := conv_integer(frm.sideinfo.table_select(region));
linbits :=table(tindex,3);
old_region :=region;
end if;
ns<= TABLELOOKUP1;
when TABLELOOKUP1 =>
level :=0;
loop
temp := get_value(tindex,level,0);
if temp = 0 then
value :=get_value(tindex,level,1);
end if;
exit when temp =0;
if conv_integer(valuebuffer(conv_integer(bitpos)))=1 then
templevel:=get_value(tindex,level,1);
if templevel>=250 then
loop
level:=level+ templevel;
templevel:=get_value(tindex,level,1);
exit when templevel<250;
end loop;
end if;
level := level+ templevel;
else
templevel:=get_value(tindex,level,0);
if templevel>=250 then
loop
level:=level+ templevel;
templevel:=get_value(tindex,level,0);
exit when templevel<250;
end loop;
end if;
level := level+ templevel;
end if;
if conv_integer(bitpos)=8191 then
bitpos:=(others=>'0');
tempcount1:='1';
else
bitpos := bitpos + '1';
end if;
end loop;
level:=0;
tempvector :=conv_std_logic_vector(value,8);
x := conv_integer(tempvector(7 downto 4));
y := conv_integer(tempvector(3 downto 0));
if x = 15 and linbits > 0 then
if 8191-conv_integer(bitpos)+1 >=linbits then
x := x + conv_integer(valuebuffer(conv_integer(bitpos) to conv_integer(bitpos)+linbits-1));
if 8191-conv_integer(bitpos)+1 =linbits then
bitpos:=(others=>'0');
tempcount1:='1';
else
bitpos := conv_std_logic_vector((conv_integer(bitpos) + linbits),13);
end if;
else
temppos:=conv_integer(bitpos);
temphuff:= 8191 - temppos+1;
x := x + conv_integer(valuebuffer(temppos to 8191) & valuebuffer(0 to linbits-temphuff-1));
bitpos:=(others=>'0');
tempcount1:='1';
bitpos:=conv_std_logic_vector((linbits-temphuff),13);
end if;
end if;
if x > 0 then
if conv_integer(valuebuffer(conv_integer(bitpos)))=1 then
x := -x;
end if;
if conv_integer(bitpos)=8191 then
bitpos:=(others=>'0');
tempcount1:='1';
else
bitpos := bitpos + '1';
end if;
end if;
if y = 15 and linbits > 0 then
if 8191-conv_integer(bitpos)+ 1 >=linbits then
y := y + conv_integer(valuebuffer(conv_integer(bitpos) to conv_integer(bitpos)+linbits-1));
if 8191-conv_integer(bitpos)+ 1 =linbits then
bitpos:=(others=>'0');
tempcount1:='1';
else
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -