Line 53... |
Line 53... |
|
|
-- HOST IF
|
-- HOST IF
|
sof : in std_logic;
|
sof : in std_logic;
|
img_size_x : in std_logic_vector(15 downto 0);
|
img_size_x : in std_logic_vector(15 downto 0);
|
img_size_y : in std_logic_vector(15 downto 0);
|
img_size_y : in std_logic_vector(15 downto 0);
|
cmp_max : in std_logic_vector(1 downto 0);
|
|
|
|
-- RLE
|
-- RLE
|
rle_buf_sel : out std_logic;
|
rle_buf_sel : out std_logic;
|
rd_en : out std_logic;
|
rd_en : out std_logic;
|
runlength : in std_logic_vector(3 downto 0);
|
runlength : in std_logic_vector(3 downto 0);
|
Line 97... |
Line 96... |
signal ready_HFW : std_logic;
|
signal ready_HFW : std_logic;
|
signal fifo_wbyte : std_logic_vector(7 downto 0);
|
signal fifo_wbyte : std_logic_vector(7 downto 0);
|
signal fifo_wrt_cnt : unsigned(1 downto 0);
|
signal fifo_wrt_cnt : unsigned(1 downto 0);
|
signal fifo_wren : std_logic;
|
signal fifo_wren : std_logic;
|
signal last_block : std_logic;
|
signal last_block : std_logic;
|
signal image_area_size : unsigned(33 downto 0);
|
signal image_area_size : unsigned(31 downto 0);
|
signal block_cnt : unsigned(27 downto 0);
|
signal block_cnt : unsigned(27 downto 0);
|
signal VLC_size : unsigned(4 downto 0);
|
signal VLC_size : unsigned(4 downto 0);
|
signal VLC : unsigned(15 downto 0);
|
signal VLC : unsigned(15 downto 0);
|
signal VLC_DC_size : std_logic_vector(3 downto 0);
|
signal VLC_DC_size : std_logic_vector(3 downto 0);
|
signal VLC_DC : unsigned(8 downto 0);
|
signal VLC_DC : unsigned(8 downto 0);
|
Line 255... |
Line 254... |
VLC <= (others => '0');
|
VLC <= (others => '0');
|
elsif CLK'event and CLK = '1' then
|
elsif CLK'event and CLK = '1' then
|
-- DC
|
-- DC
|
if first_rle_word = '1' then
|
if first_rle_word = '1' then
|
-- luminance
|
-- luminance
|
if huf_sm_settings.cmp_idx = 0 then
|
if huf_sm_settings.cmp_idx < 2 then
|
VLC_size <= unsigned('0' & VLC_DC_size);
|
VLC_size <= unsigned('0' & VLC_DC_size);
|
VLC <= resize(VLC_DC, VLC'length);
|
VLC <= resize(VLC_DC, VLC'length);
|
-- chrominance
|
-- chrominance
|
else
|
else
|
VLC_size <= unsigned('0' & VLC_CR_DC_size);
|
VLC_size <= unsigned('0' & VLC_CR_DC_size);
|
VLC <= resize(VLC_CR_DC, VLC'length);
|
VLC <= resize(VLC_CR_DC, VLC'length);
|
end if;
|
end if;
|
-- AC
|
-- AC
|
else
|
else
|
-- luminance
|
-- luminance
|
if huf_sm_settings.cmp_idx = 0 then
|
if huf_sm_settings.cmp_idx < 2 then
|
VLC_size <= VLC_AC_size;
|
VLC_size <= VLC_AC_size;
|
VLC <= VLC_AC;
|
VLC <= VLC_AC;
|
-- chrominance
|
-- chrominance
|
else
|
else
|
VLC_size <= VLC_CR_AC_size;
|
VLC_size <= VLC_CR_AC_size;
|
Line 287... |
Line 286... |
begin
|
begin
|
if RST = '1' then
|
if RST = '1' then
|
image_area_size <= (others => '0');
|
image_area_size <= (others => '0');
|
last_block <= '0';
|
last_block <= '0';
|
elsif CLK'event and CLK = '1' then
|
elsif CLK'event and CLK = '1' then
|
image_area_size <= unsigned(cmp_max)*
|
image_area_size <= unsigned(img_size_x)*unsigned(img_size_y);
|
unsigned(img_size_x)*unsigned(img_size_y);
|
|
|
|
if sof = '1' then
|
if sof = '1' then
|
block_cnt <= (others => '0');
|
block_cnt <= (others => '0');
|
elsif start_pb = '1' then
|
elsif start_pb = '1' then
|
block_cnt <= block_cnt + 1;
|
block_cnt <= block_cnt + 1;
|
end if;
|
end if;
|
|
|
if block_cnt = image_area_size(33 downto 6) then
|
if block_cnt = image_area_size(31 downto 5) then
|
last_block <= '1';
|
last_block <= '1';
|
else
|
else
|
last_block <= '0';
|
last_block <= '0';
|
end if;
|
end if;
|
|
|