owsgeneral
Computer
- Dec 14, 2005
- 2
I'm trying to implement a DPCM_encoder like the following
(usin' an AR model as a predictor)
one ->
I'm usin' it to stream data (usin' windows of samples of specific
size, i.e. I'll have to renew AR coefficients only once in each
window, for instance, in each 250 samples).
My problem is how I can quantize the error Ê knowin' that only in the
end of that window_size I can get a good quantizer for that window).
My code is the following (now I'm not usin' quantized errors to add
to last predicted samples of the signal, cause I don't know the
quantizer).
My main doubt is: how to get that quantizer of the error
(during the streaming of that window of samples, not only in the
end)?
DPCM_encoder(signal, order, levels, window_size)
len_signal = length(signal);
for i=0:size(signal)/window_size
sample = signal(i*window_size+1:i*window_size+window_size);
% encoder data
[coefficients, signal_predicted] = AR_model(transpose(sample),
order);
len_signal_predicted = length(sample);
x = zeros(len_signal_predicted, 1);
e = zeros(len_signal_predicted, 1);
for j=i*window_size+1:i*window_size+size(sample)
% this signal_predicted only change in windows
out = signal_predicted(j-window_size*i);% * x
% we only know this error in the end of thw window
e(j-window_size*i) = signal(j) - out;
% in the beggining of each window send signal instead of error
if(j-window_size*i <= order)
e(j-window_size*i) = signal(j);
end;
% renew the estimated output
%x = [e(j-window_size*i) ; x(1:len_signal_predicted-1)];
end;
% now we can quantize errors
[e_quant] = offLine_quantizer(e, levels, size(sample));
end;
Tkx for all your help,
ows
(usin' an AR model as a predictor)
one ->
I'm usin' it to stream data (usin' windows of samples of specific
size, i.e. I'll have to renew AR coefficients only once in each
window, for instance, in each 250 samples).
My problem is how I can quantize the error Ê knowin' that only in the
end of that window_size I can get a good quantizer for that window).
My code is the following (now I'm not usin' quantized errors to add
to last predicted samples of the signal, cause I don't know the
quantizer).
My main doubt is: how to get that quantizer of the error
(during the streaming of that window of samples, not only in the
end)?
DPCM_encoder(signal, order, levels, window_size)
len_signal = length(signal);
for i=0:size(signal)/window_size
sample = signal(i*window_size+1:i*window_size+window_size);
% encoder data
[coefficients, signal_predicted] = AR_model(transpose(sample),
order);
len_signal_predicted = length(sample);
x = zeros(len_signal_predicted, 1);
e = zeros(len_signal_predicted, 1);
for j=i*window_size+1:i*window_size+size(sample)
% this signal_predicted only change in windows
out = signal_predicted(j-window_size*i);% * x
% we only know this error in the end of thw window
e(j-window_size*i) = signal(j) - out;
% in the beggining of each window send signal instead of error
if(j-window_size*i <= order)
e(j-window_size*i) = signal(j);
end;
% renew the estimated output
%x = [e(j-window_size*i) ; x(1:len_signal_predicted-1)];
end;
% now we can quantize errors
[e_quant] = offLine_quantizer(e, levels, size(sample));
end;
Tkx for all your help,
ows