0
Tải bản đầy đủ (.pdf) (139 trang)

thị ổt ngh ợp PSNR vs CR với thuật toỏn SPIHT

Một phần của tài liệu KỸ THUẬT NÉN ẢNH SỐ (Trang 121 -121 )

5.3.So sỏnh 2 thu t toỏn nộn

Đồ thị PSNR vs CR so sỏnh 2 thu t toỏn EZW và SPIHT ậ được v nh ẽ ư

trờn hỡnh dưới đõy.

T ừ đồ thị hỡnh 5.13 và 5.14, cú thể thấy SPIHT hiệu quả hơn nhi u so ề

với EZW. Cần lưu ý rằng thực nghiệm được tiến hành với SPIHT khụng cần phải sử dụng m t b mó húa s hộ ộ ố ọc để gi m thụng tin d th a. Trong khi ú, ả ư ừ đ

Hỡnh 5.13: So sỏnh EZW và SPIHT với bộ ọ l c Haar

Với tỷ lệ nộn th p (CR<10), SPIHT cho ch t lấ ấ ượng nh r t cao trong ả ấ

khi với thuật toỏn EZW, chất lượng ảnh v n bẫ ị suy giả đm ỏng kể. Vớ dụ ớ v i tỷ

lệ nộn là 5 và sử dụng b lộ ọc Bior6.8, SPIHT cho PSNR là 40.4758 dB (m t ắ

thường khụng phõn biệ đượt c sự khỏc nhau giữa ảnh gốc và ảnh khụi phục). Trong khi đú EZW với tỷ lệ nộn 2 cho PSNR ch là 27.5262 (ch t lỉ ấ ượng nh ả

khụng cao).

Ngoài ra tớnh toỏn trong mụi trường Matlab với EZW yờu cầu thời gian xử lý lõu. Trong khi đú, thời gian tớnh toỏn SPIHT nhanh hơn nhiều.

5.5.Kết luận chương 5

Chương 5 đó trỡnh bày kết quả tớnh toỏn thực nghiệm trong mụi trường Matlab với 2 thuật toỏn nộn EZW và SPIHT. Do SPIHT là phiờn bản cải tiến của EZW nờn hiệu năng nộn của SPIHT cao hơn so với EZW.

Khi tỷ lệ nộn cao EZW và SPIHT c ng cho ch t lũ ấ ượng nh suy gi m. ả ả

Tuy nhiờn so v i tiờu chuớ ẩn nộn JPEG thỡ cỏc thuật toỏn nộn wavelet này ưu việt hơn nhiều. Như quan sỏt ở hỡnh 5.11, với tỷ lệ nộn cao nh ch bả ỉ ị mờ đ i, mắt người vẫn cú được cỏi nhỡn tổng thể về ả nh hi n th , khụng cú c m giỏc ể ị ả ảnh b v v n và phõn rừ thành d ng ụ vuụng nh trong trị ỡ ụ ạ ư ường h p nộn JPEG ợ

KT LUN

Kết quả đạt được:

Luận văn đó tập trung nghiờn cứu phộp biế đổn i wavelet cũng như lý thuyết phõn tớch đa phõn giải. T cừ ơ sở đ ú, tỏc gi phõn tớch và ỏnh giỏ m t ả đ ộ

số kỹ thu t nộn nh d a trờn phộp bi n ậ ả ự ế đổi này nh EZW, SPIHT, WDR, ư

ASWDR, EBCOT…

Luận văn cũng đi sõu tỡm hiểu một tiờu chuẩn nộn ảnh ưu việt dựa trờn bi n ế đổi wavelet đó được kiểm nghiệm trong thực tế, đú là tiờu chuẩn JPEG2000. Đõy là lựa chọn ưu việt dần thay thế tiờu chuẩn JPEG cũ.

Ngoài ra, phần thực nghiệm của luận văn thực hiện đỏnh giỏ hai thuật toỏn nộn wavelet cơ bản là EZW và SPIHT. Qua ú m t l n n a minh ch ng đ ộ ầ ữ ứ

hiệu năng nộn vụ cựng hiệu quả của thuật toỏn nộn wavelet.

Hướng phỏt trin nghiờn cu:

Luận văn mới chỉ tập trung nghiờn c u ng d ng c a bi n ứ ứ ụ ủ ế đổi wavelet với ảnh tĩnh. Những ưu đ ểi m của wavelet khiến nú cú thể ỏp dụng cho xử lý hiệu quả những kiểu dữ liệ đu a phương tiện khỏc như õm thanh, video…

Thuật toỏn nộn wavelet cú khả năng ch ng nhi u cao và th hi n s c ố ễ ể ệ ứ

mạnh trong mụi trường truyền dẫn vụ tuyến chịu nhiều ảnh hưởng của tạp õm, pha đinh. Trong tương lai, tỏc giả sẽ đ i sau nghiờn c u kh nứ ả ăng ch ng sai l i ố ỗ

TÀI LIU THAM KHO

Tiếng Vit:

1. Nguyễn Kim Sỏch - “Xử lý ảnh và video số” - NXB KHKT, Trang 12-38, 1997

Tiếng Anh:

2. A.Said and W.A. Pearlman - “Image compression using the spatial- orientation tree” - IEEE Int. Symp. on Circuits and Systems, Chicago, IL, trang 279–282, May, 1993.

3. J. Shapiro - “Smart Compression Using the Embedded Zerotree Wavelet (EZW) Algorithm” - Proc. Asilomar Conf. Sig., Syst. and Comp., IEEE, trang

486-490, 1993.

4.Pankaj N. Topiwala – “Wavelet Image and Video Compression” –Kluwer Acamdemic Publishers, trang 158-165, 2002

5. S.Mallat - “A Theory for Multiresolution Signal Decomposition: The

Wavelet Representation” - IEEE Trans. on Pattern Analysis and Machine

Intelligence, Vol. 11, No. 7, trang 674-693, July 1989

6. S. Mallat – “A Wavelet Tour of Signal Processing” - Academic Press, New York, trang 52- 58, 1998.

7. Tinku Acharya – “JPEG2000 – Standard for Image Compression” – Kluwer Academic Publisher, trang 140-157, 2005.

PH LC

Dưới đõy là mó ngu n m t s hàm c b n s d ng trong ch ng trỡnh. ồ ộ ố ơ ả ử ụ ươ

Một số hàm phụ tỏc giả khụng trỡnh bày do quỏ dài. Hàm function_DWT:

function [I_W , S] = function_DWT(I, level, Lo_D, Hi_D);

% Wavelet decomposition %

% input: I : input image

% level : wavelet decomposition level % Lo_D : low-pass decomposition filter % Hi_D : high-pass decomposition filter %

% output: I_W : decomposed image vector

% S : corresponding bookkeeping matrix %

[C,S] = func_Mywavedec2(I,level,Lo_D,Hi_D);

S(:,3) = S(:,1).*S(:,2); % dim of detail coef nmatrices

L = length(S); I_W = zeros(S(L,1),S(L,2)); % approx part I_W( 1:S(1,1) , 1:S(1,2) ) = reshape(C(1:S(1,3)),S(1,1:2)); for k = 2 : L-1 rows = [sum(S(1:k-1,1))+1:sum(S(1:k,1))]; columns = [sum(S(1:k-1,2))+1:sum(S(1:k,2))]; % horizontal part c_start = S(1,3) + 3*sum(S(2:k-1,3)) + 1; c_stop = S(1,3) + 3*sum(S(2:k-1,3)) + S(k,3);

I_W( 1:S(k,1) , columns ) = reshape( C(c_start:c_stop) , S(k,1:2) ); % vertical part

c_start = S(1,3) + 3*sum(S(2:k-1,3)) + S(k,3) + 1; c_stop = S(1,3) + 3*sum(S(2:k-1,3)) + 2*S(k,3);

I_W( rows , 1:S(k,2) ) = reshape( C(c_start:c_stop) , S(k,1:2) ); % diagonal part

c_start = S(1,3) + 3*sum(S(2:k-1,3)) + 2*S(k,3) + 1; c_stop = S(1,3) + 3*sum(S(2:k,3));

I_W( rows , columns ) = reshape( C(c_start:c_stop) , S(k,1:2) ); End

Hàm function_InvDWT

function im_rec = function_InvDWT(I_W, S, Lo_R, Hi_R, level);

% input: I_W : decomposed image vector

% S : corresponding bookkeeping matrix % Lo_D : low-pass decomposition filter % Hi_D : high-pass decomposition filter % level : wavelet decomposition level %

L = length(S); m = I_W; C1 = zeros(1,S(1,3)+3*sum(S(2:L-1,3))); % approx part C1(1:S(1,3)) = reshape( m( 1:S(1,1) , 1:S(1,2) ), 1 , S(1,3) ); for k = 2:L-1 rows = [sum(S(1:k-1,1))+1:sum(S(1:k,1))]; columns = [sum(S(1:k-1,2))+1:sum(S(1:k,2))]; % horizontal part c_start = S(1,3) + 3*sum(S(2:k-1,3)) + 1; c_stop = S(1,3) + 3*sum(S(2:k-1,3)) + S(k,3);

C1(c_start:c_stop) = reshape( m( 1:S(k,1) , columns ) , 1, c_stop- c_start+1);

% vertical part

c_start = S(1,3) + 3*sum(S(2:k-1,3)) + S(k,3) + 1; c_stop = S(1,3) + 3*sum(S(2:k-1,3)) + 2*S(k,3);

C1(c_start:c_stop) = reshape( m( rows , 1:S(k,2) ) , 1 , c_stop- c_start+1 );

% diagonal part

c_start = S(1,3) + 3*sum(S(2:k-1,3)) + 2*S(k,3) + 1; c_stop = S(1,3) + 3*sum(S(2:k,3));

C1(c_start:c_stop) = reshape( m( rows , columns ) , 1 , c_stop- c_start+1);

end

if (( L - 2) > level) %set those coef. in higher scale to 0

temp = zeros(1, length(C1) - (S(1,3)+3*sum(S(2:(level+1),3)))); C1(S((level+2),3)+1 : length(C1)) = temp;

end

S(:,3) = [];

im_rec = func_Mywaverec2(C1,S, Lo_R, Hi_R);

PHẦN THUẬT TOÁN EZW: Hàm function_ezw_encode:

function [significance_map, refinement] =

function_ezw_encode(img_wavedata,ezw_encoding_threshold);

% img_wavedata: wavelet coefficients

% ezw_encoding_threshold: determine where to stop encoding

% significance_map: a string matrix containing significance data for different passes (‘+’,’-’,’I’,’R’)

% refinement: a strubg matrix containing refinement data for different passes ('0' or '1'

refinement = [];

significance_map = [];

img_wavedata_save = img_wavedata;

% calculate Morton scan order

n = size(img_wavedata,1);

scan = func_morton([0:(n*n)-1],n);

% calculate initial threshold

init_threshold = pow2(floor(log2(max(max(abs(img_wavedata)))))); threshold = init_threshold;

while (threshold >= ezw_encoding_threshold)

[str, list, img_wavedata] = func_dominant_pass(img_wavedata, threshold, scan);

significance_map = strvcat(significance_map, char(str));

if(threshold == init_threshold), subordinate_list = list; else

subordinate_list = func_rearrange_list(subordinate_list, list, scan, img_wavedata_save);

end

[encoded, subordinate_list] =

func_subordinate_pass(subordinate_list, threshold);

refinement = strvcat(refinement, strrep(num2str(encoded), ' ', ''));

threshold = threshold / 2; end

Hàm function_ezw_decode:

function img_wavedata_dec = function_ezw_decode(dim, threshold, significance_map, refinement);

% dim: dimension of the wavelet matrix to reconstruct % threshold: initial threshold used while encoding

% significance_map: a string matrix containing significance data for % different scanning passes (‘+’,’-’,’I’,’R’

%

% refinement: a string matrix containing refinement data for % different scanning passes ('0' or '1')

%

% img_wavedata_dec: reconstructed wavelet coefficients %

img_wavedata_dec = zeros(dim,dim);

% calculate Morton scan order

scan = func_morton([0:(dim*dim)-1],dim);

% number of steps significance map (and refinement data)

for step = 1:steps,

% decode significancemap for this step

img_wavedata_dec = func_decode_significancemap(img_wavedata_dec, significance_map(step,:), threshold, scan);

img_wavedata_dec = func_decode_refine(img_wavedata_dec, refinement(step,:), threshold, scan);

threshold = threshold/2;

end

Hàm function_huffman_encode:

function img_ezw_stream_bit = function_huffman_encode(significance_map, refinement);

% significance map: a string array containing significace map data (‘+’,’-’,’I’ and ‘R’)

% refinement: a string array containing refinement data ('0' and '1') %

% img_ezw_stream_bit: resulting bitstream ('0' and '1') %

img_ezw_stream_bit = [];

strings = size(significance_map,1);

for i = 1:strings,

% insert significance map using Huffman

index = 1;

while(index <= size(significance_map,2) & ~strcmp(significance_map(i,index),' ')),

if(strcmp(significance_map(i,index),’R’)),

img_ezw_stream_bit = [img_ezw_stream_bit '0']; elseif(strcmp(significance_map(i,index),’I’)), img_ezw_stream_bit = [img_ezw_stream_bit '10']; elseif(strcmp(significance_map(i,index),’-’)), img_ezw_stream_bit = [img_ezw_stream_bit '110']; else img_ezw_stream_bit = [img_ezw_stream_bit '1110']; end index = index + 1; end % insert seperator img_ezw_stream_bit = [img_ezw_stream_bit '1111']; refine = size(strrep(refinement(i,:), ' ', ''),2); % insert length of refinement (20 bits)

img_ezw_stream_bit = [img_ezw_stream_bit strrep(char(dec2bin(refine,20)), ' ', '')]; % insert refinement

img_ezw_stream_bit = [img_ezw_stream_bit strrep(refinement(i,:), ' ', '')];

% append end of stream

img_ezw_stream_bit = [img_ezw_stream_bit '11111'];

% stringlength should be multiple of 8: append zeros % ASCII code for '0' is 48

append = 8 - mod(size(img_ezw_stream_bit,2), 8);

img_ezw_stream_bit = [img_ezw_stream_bit char(ones(1,append)*48)];

Hàm function_huffman_decode:

function [significance_map, refinement] =

function_huffman_decode(img_ezw_stream_bit,bit_limit);

% significance map: a string array containing significace map data (‘+’,’-’,’I’ and ‘R’)

% refinement: a string array containing refinement data ('0' and '1') %

% img_ezw_stream_bit: input bitstream ('0' and '1') % significance_map = []; refinement = []; complete = 0; decode = 1; index = 1; significance = []; refine = []; while(decode), if(index>=bit_limit) break; end % get bit bit = img_ezw_stream_bit(index); index = index + 1; if(bit == '1'), % get next bit

bit = img_ezw_stream_bit(index); index = index + 1;

if(bit == '1'), % get next bit

bit = img_ezw_stream_bit(index); index = index + 1;

if(bit == '1'), % get next bit

bit = img_ezw_stream_bit(index); index = index + 1; if(bit == '1'), % seperator detected complete = 1; else significance = [significance, ‘+’]; end

else

significance = [significance, ‘-’]; end

else

significance = [significance, ‘I’]; end else significance = [significance, ‘R’]; end if(complete), complete = 0;

% get size of refinement data (next 20 bits)

stringlength = bin2dec(img_ezw_stream_bit(1,index:index+19)); index = index + 20;

refine = [refine img_ezw_stream_bit(1,index:index+stringlength- 1)];

index = index + stringlength;

% update significance map and refinement data

significance_map = strvcat(significance_map, significance); refinement = strvcat(refinement, refine);

significance = []; refine = [];

end

% check for end of stream ('11111')

bits = img_ezw_stream_bit(1,index:index+4); if(strcmp(bits, '11111')),

decode = 0; end

end

PHẦN THUẬT TOÁN SPIHT:

function out = function_SPIHT_Encode(m, max_bits, block_size, level)

% input: m : input image in wavelet domain % max_bits : maximum bits can be used % block_size : image size

% level : wavelet decomposition level %

% output: out : bit stream

%--- Initialization --- bitctr = 0; out = 2*ones(1,max_bits); n_max = floor(log2(abs(max(max(m)')))); Bits_Header = 0; Bits_LSP = 0; Bits_LIP = 0; Bits_LIS = 0;

%--- output bit stream header ---

% image size, number of bit plane, wavelet decomposition level should be % written as bit stream header.

index = 4;

Bits_Header = Bits_Header + 24;

%--- Initialize LIP, LSP, LIS ---

temp = [];

bandsize = 2.^(log2(size(m, 1)) - level + 1); temp1 = 1 : bandsize;

for i = 1 : bandsize temp = [temp; temp1]; end LIP(:, 1) = temp(:); temp = temp'; LIP(:, 2) = temp(:); LIS(:, 1) = LIP(:, 1); LIS(:, 2) = LIP(:, 2); LIS(:, 3) = zeros(length(LIP(:, 1)), 1); pstart = 1; pend = bandsize / 2; for i = 1 : bandsize / 2 LIS(pstart : pend, :) = []; pdel = pend - pstart + 1;

pstart = pstart + bandsize - pdel; pend = pend + bandsize - pdel; end LSP = []; n = n_max; %--- coding --- while(bitctr < max_bits) % Sorting Pass

LIPtemp = LIP; temp = 0; for i = 1:size(LIPtemp,1) temp = temp+1; if (bitctr + 1) >= max_bits if (bitctr < max_bits) out(length(out))=[]; end return end if abs(m(LIPtemp(i,1),LIPtemp(i,2))) >= 2^n % 1: positive; 0: negative

out(index) = 1; bitctr = bitctr + 1;

index = index +1; Bits_LIP = Bits_LIP + 1; sgn = m(LIPtemp(i,1),LIPtemp(i,2))>=0; out(index) = sgn; bitctr = bitctr + 1; index = index +1; Bits_LIP = Bits_LIP + 1; LSP = [LSP; LIPtemp(i,:)];

LIP(temp,:) = []; temp = temp - 1; else

out(index) = 0; bitctr = bitctr + 1; index = index +1;

Bits_LIP = Bits_LIP + 1; end

LIStemp = LIS; temp = 0; i = 1; while ( i <= size(LIStemp,1)) temp = temp + 1; if LIStemp(i,3) == 0 if bitctr >= max_bits return end max_d = func_MyDescendant(LIStemp(i,1),LIStemp(i,2),LIStemp(i,3),m); if max_d >= 2^n

out(index) = 1; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; x = LIStemp(i,1); y = LIStemp(i,2); if (bitctr + 1) >= max_bits if (bitctr < max_bits) out(length(out))=[]; end return end if abs(m(2*x-1,2*y-1)) >= 2^n LSP = [LSP; 2*x-1 2*y-1];

out(index) = 1; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; sgn = m(2*x-1,2*y-1)>=0;

out(index) = sgn; bitctr = bitctr + 1; index = index +1; Bits_LIS = Bits_LIS + 1; else

out(index) = 0; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; LIP = [LIP; 2*x-1 2*y-1];

end if (bitctr + 1) >= max_bit s if (bitctr < max_bits) out(length(out))=[]; end return end if abs(m(2*x-1,2*y)) >= 2^n LSP = [LSP; 2*x-1 2*y];

out(index) = 1; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; sgn = m(2*x-1,2*y)>=0;

out(index) = sgn; bitctr = bitctr + 1; index = index +1; Bits_LIS = Bits_LIS + 1; else

out(index) = 0; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; LIP = [LIP; 2*x-1 2*y];

end

if (bitctr + 1) >= max_bits if (bitctr < max_bits) out(length(out))=[];

end return end

if abs(m(2*x,2*y-1)) >= 2^n LSP = [LSP; 2*x 2*y-1];

out(index) = 1; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; sgn = m(2*x,2*y-1)>=0;

out(index) = sgn; bitctr = bitctr + 1; index = index +1; Bits_LIS = Bits_LIS + 1; else

out(index) = 0; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; LIP = [LIP; 2*x 2*y-1];

end if (bitctr + 1) >= max_bits if (bitctr < max_bits) out(length(out))=[]; end return end if abs(m(2*x,2*y)) >= 2^n LSP = [LSP; 2*x 2*y];

out(index) = 1; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; sgn = m(2*x,2*y)>=0;

out(index) = sgn; bitctr = bitctr + 1; index = index +1; Bits_LIS = Bits_LIS + 1; else

out(index) = 0; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; LIP = [LIP; 2*x 2*y];

end

if ((2*(2*x)-1) < size(m) & (2*(2*y)-1) < size(m)) LIS = [LIS; LIStemp(i,1) LIStemp(i,2) 1];

LIStemp = [LIStemp; LIStemp(i,1) LIStemp(i,2) 1]; end

LIS(temp,:) = []; temp = temp-1;

else

out(index) = 0; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; end else if bitctr >= max_bits return end max_d = func_MyDescendant(LIStemp(i,1),LIStemp(i,2),LIStemp(i,3),m); if max_d >= 2^n

out(index) = 1; bitctr = bitctr + 1; index = index +1;

x = LIStemp(i,1); y = LIStemp(i,2);

LIStemp = [LIStemp; 2*x-1 2*y-1 0; 2*x-1 2*y 0; 2*x 2*y-1 0; 2*x 2*y 0];

LIS(temp,:) = []; temp = temp - 1; else

out(index) = 0; bitctr = bitctr + 1;

index = index +1; Bits_LIS = Bits_LIS + 1; end end i = i+1; end % Refinement Pass temp = 1; value = floor(abs(2^(n_max-n+1)*m(LSP(temp,1),LSP(temp,2)))); while (value >= 2^(n_max+2) & (temp <= size(LSP,1)))

if bitctr >= max_bits return

end

s = bitget(value,n_max+2);

out(index) = s; bitctr = bitctr + 1;

index = index +1; Bits_LSP = Bits_LSP + 1; temp = temp + 1; if temp <= size(LSP,1) value = floor(abs(2^(n_max-n+1)*m(LSP(temp,1),LSP(temp,2)))); end end n = n - 1; end Hàm function_SPIHT_decode: function m = function_SPIHT_Decode(in)

% input: in : bit stream %

% output: m : reconstructed image in wavelet domain %--- Initialization ---

% image size, number of bit plane, wavelet decomposition level should be % written as bit stream header.

m = zeros(in(1,1)); n_max = in(1,2); level = in(1,3); ctr = 4;

%--- Initialize LIP, LSP, LIS ---

temp = [];

bandsize = 2.^(log2(in(1,1)) - level + 1); temp1 = 1 : bandsize;

for i = 1 : bandsize temp = [temp; temp1]; end

LIP(:, 1) = temp(:); temp = temp';

LIS(:, 1) = LIP(:, 1); LIS(:, 2) = LIP(:, 2); LIS(:, 3) = zeros(length(LIP(:, 1)), 1); pstart = 1; pend = bandsize / 2; for i = 1 : bandsize / 2 LIS(pstart : pend, :) = []; pdel = pend - pstart + 1;

pstart = pstart + bandsize - pdel; pend = pend + bandsize - pdel; end LSP = []; %--- coding --- n = n_max; while (ctr <= size(in,2)) %Sorting Pass

LIPtemp = LIP; temp = 0; for i = 1:size(LIPtemp,1) temp = temp+1; if ctr > size(in,2) return end if in(1,ctr) == 1 ctr = ctr + 1; if in(1,ctr) > 0 m(LIPtemp(i,1),LIPtemp(i,2)) = 2^n + 2^(n-1); else m(LIPtemp(i,1),LIPtemp(i,2)) = -2^n - 2^(n-1); end LSP = [LSP; LIPtemp(i,:)];

LIP(temp,:) = []; temp = temp - 1; end

ctr = ctr + 1; end

LIStemp = LIS; temp = 0; i = 1; while ( i <= size(LIStemp,1)) temp = temp + 1; if ctr > size(in,2) return end if LIStemp(i,3) == 0 if in(1,ctr) == 1 ctr = ctr + 1; x = LIStemp(i,1); y = LIStemp(i,2); if ctr > size(in,2) return end if in(1,ctr) == 1 LSP = [LSP; 2*x-1 2*y-1]; ctr = ctr + 1; if in(1,ctr) == 1

m(2*x-1,2*y-1) = 2^n + 2^(n-1); else m(2*x-1,2*y-1) = -2^n - 2^(n-1); end ctr = ctr + 1; else

LIP = [LIP; 2*x-1 2*y-1]; ctr = ctr + 1; end if ctr > size(in,2) return end if in(1,ctr) == 1 ctr = ctr + 1; LSP = [LSP; 2*x-1 2*y]; if in(1,ctr) == 1; m(2*x-1,2*y) = 2^n + 2^(n-1); else m(2*x-1,2*y) = -2^n - 2^(n-1); end ctr = ctr + 1; else

LIP = [LIP; 2*x-1 2*y]; ctr = ctr + 1; end if ctr > size(in,2) return end if in(1,ctr) == 1

Một phần của tài liệu KỸ THUẬT NÉN ẢNH SỐ (Trang 121 -121 )

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×