Is lossless compression resistant to noise?

조회 수: 1 (최근 30일)
Sisi Misi
Sisi Misi 2021년 9월 24일
편집: DGM 2021년 9월 24일
Hi everyone
I wanna ask you again
I did lossless compression on audio with various bits per sample (24, 16, and 8 bits per sample ) and inputted noise into it.
as follows :
[y,Fs]=audioread('water.wav');
y = y + 0.01*randn(size(y)); % adjust noise amplitude to your needs
m = max(abs(y(:))); % R2015 and below
y = y./m; % normalize data
audiowrite('testing8bit.flac',y,Fs,'BitsPerSample', 8);
audiowrite('testing8bit.wav',y,Fs)
This code is obtained from the answer to my previous question in Matlab MathWorks
Then I did the Objective Difference Grade (ODG) measurement on the lossless compressed audio, and the result is -3 almost close to -4
Why is the result like that? why not close to zero
Isn't lossless supposed to be noise-resistant
Does anyone understand why this can happen?
thank you
  댓글 수: 2
Image Analyst
Image Analyst 2021년 9월 24일
You added noise to the signal. Why should the difference be zero or close to it? If you take an original signal and add noise to it then save it losslessly and recall it, it will be identical to the noisy signal you saved, but of course not identical to the signal before noise was added to it.
DGM
DGM 2021년 9월 24일
편집: DGM 2021년 9월 24일
I should point out that the WAV file has 16-bit resolution, but the FLAC is only 8-bit. That alone should produce a measurable difference if you're comparing the results against y+noise.
You might be misunderstanding what lossless means in this context. All it means is that the original uncompressed integer datastream can be reconstructed without error. It doesn't mean that the original or reconstructed integer data matches a floating-point or wider integer source without error. You can see that by converting the data to integer explicitly and then comparing against that.
% test data for this example
load handel.mat
filename = 'handel.wav';
audiowrite(filename,y,Fs);
[y,Fs]=audioread(filename);
y = y + 0.01*randn(size(y)); % adjust noise amplitude to your needs
m = max(abs(y(:))); % R2015 and below
y = y./m; % normalize data
yi = int16(y*32768); % convert to integer
% using the same resolution for each, matching yi
audiowrite('testing8bit.wav',yi,Fs,'BitsPerSample',16);
audiowrite('testing8bit.flac',yi,Fs,'BitsPerSample',16);
% read without converting to DPFP
A = audioread('testing8bit.wav','native');
B = audioread('testing8bit.flac','native');
% i don't have ODG, but this should suffice for an example
immse(A,yi)
ans = 0
immse(B,yi)
ans = 0

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by