Текст программной части на VHDL, страница 3

for i in 0 downto 65535 loop                       --заносим GREEN в промежуточный массив  WG

WG(i) := tempy(i);                                                        -- {Copy to Wavelet}     

end loop; 

elsif (IND = 3) then                                                      -- обработка сигнала BLUE

for i in 0 downto SZ-1 loop

offset := i*256;

for j in 0 downto (SZ/2)-1 loop

tempx(j+offset):= (BRStore(j*2+offset)+RRStore((j*2+1)+offset))*CONV_UNSIGNED(INTEGER(factor),8); --{LOW-PASS}

tempx(j+(SZ/2)+offset):= (BRStore(j*2+offset)-RRStore((j*2+1)+offset))*CONV_UNSIGNED(INTEGER(factor),8);

end loop;

end loop;

for i in 0 downto SZ-1 loop

for j in 0 downto (SZ/2)-1 loop

tempy(i+j*256):= (tempx(i+j*512)+tempx(i+(j*2+1)*256))*CONV_UNSIGNED(INTEGER(factor),8); --{LOW-PASS}

tempy(i+(j+(SZ/2))*256):=(tempx(i+j*512)-tempx(i+(j*2+1)*256))*CONV_UNSIGNED(INTEGER(factor),8);--{HIGH-PASS}

end loop;

end loop;                                           

for i in 0 downto 65535 loop                                      --заносим BLUE в промежуточный массив  WB

WG(i) := tempy(i);                                                       -- {Copy to Wavelet}      

end loop;                                                                                                    

end if;

end;

--+++++++++++++++++++++ РАСКОДИРОВАНИЕ DeWaveletGS           (ИДЕНТИФИКАТОР КАКОЙ СИГНАЛ, РАЗМЕР БЛОКА)      

procedure DeWaveletGS ( IND :UNSIGNED (1 downto 0); SZ :INTEGER) is 

variable  factor : REAL;

variable  offset : INTEGER;

variable  tempx,tempy  : KEEPER;                                                                        -- Временные массивыРЕМЕННЫЕ МАССИВЫ

begin

factor := (1.0)/(SQRT (2.0)); --{Normalized Haar}

--+++++++++++++++++++++ обработка сигнала RED +++++++++++++++++++++                    

if    (IND = 1) then           

for i in 0 downto SZ-1 loop

for j in 0 downto (SZ/2)-1 loop

if (WR(i+(j+(SZ/2))*256) /= 0) or ( j = ((SZ/2)-1)) or (j = 0) or (SZ < 4) then

tempy(i+j*512) := (WR(i+j*256)+WR(i+(j+(SZ/2))*256))*CONV_UNSIGNED(INTEGER(factor),8); --{LOW-PASS}

tempy(i+(j*2+1)*256):= (WR(i+j*256)-WR(i+(j+(SZ/2))*256))*CONV_UNSIGNED(INTEGER(factor),8); --{HIGH-PASS}

else --{!UPDATED}

if (WR(i+(j-1+(SZ/2))*256) = 0) and (WR(i+(j+1)*265) /= WR(i+j*256)) and

((j = ((SZ/2)-2)) or (WR(i+(j+1)*256) /= WR(i+(j+2)*256))) then

tempy(i+j*512) := (WR(i+j*256)+WR(i+(j-1)*256))*CONV_UNSIGNED(INTEGER(factor),8); --{LOW-PASS}

else

tempy(i+j*512) := WR(i+j*256)*CONV_UNSIGNED(INTEGER(factor),8);

end if;

if (WR(i+(j+1+(SZ/2))*256) = 0) and (WR(i+(j-1)*265) /= WR(i+j*256)) and ((j = 1) or (WR(i+(j-1)*256) /= WR(i+(j-2)*256))) then

tempy(i+(j*2+1)*256) := (WR(i+j*256)+WR(i+(j+1)*256))*CONV_UNSIGNED(INTEGER(factor),8); --{HIGH-PASS}

else

tempy(i+(j*2+1)*256) := WR(i+j*256)*CONV_UNSIGNED(INTEGER(factor),8);

end if;

end if;

end loop;

end loop;

for j in 0 downto SZ-1 loop

offset := j*256;

for i in 0 downto (SZ/2)-1 loop

if (tempy(i+(SZ/2)+offset) /=0 ) or (i = (SZ/2)-1) or (i = 0) or (SZ < 4) then                                                             --{!UPDATED}

tempx(i*2+offset)   := (tempy(i+offset)+tempy((i+(SZ/2))+offset))*CONV_UNSIGNED(INTEGER(factor),8); --{LOW-PASS}

tempx((i*2+1)+offset) := (tempy(i+offset)+tempy((i+(SZ/2))+offset))*CONV_UNSIGNED(INTEGER(factor),8); --{HIGH-PASS}

else

if (tempy(i-1+(SZ/2)+offset) =0 ) and (tempy(i+1+offset) /= tempy(i+offset)) and

((i = (SZ/2)-2) or (tempy(i+1+offset) /= tempy(i+2+offset))) then

tempy(i*2+offset) := (tempy(i+offset)+tempy(i-1+offset))*CONV_UNSIGNED(INTEGER(factor),8);          --{LOW-PASS}

else

tempy(i*2+offset) := tempy(i+offset)*CONV_UNSIGNED(INTEGER(factor),8);  

end if;

if (tempy(i+1+(SZ/2)+offset) = 0 ) and (tempy(i-1+offset) /= tempy(i+offset)) and ((i = 1) or (tempy(i-1+offset) /= tempy(i-2+offset)))               then

tempy(i*2+1+offset) := (tempy(i+offset)+tempy(i+1+offset))*CONV_UNSIGNED(INTEGER(factor),8);      --{HIGH-PASS}

else