save fonction and compression

조회 수: 2 (최근 30일)
Baptiste
Baptiste 2015년 5월 9일
댓글: Baptiste 2015년 5월 10일
Hello!
I see something interesting about the 'save' function: I tried to code a huffman code in order to create a JPEG compression, I finish all technics (DCT, quatization, zigzaig, MLEM, etc...), and i'm stuck about Huffman's Entropy coding.
But I realyse sompething when I save the image's data with "save" fuction: Thie size of the compressed image (starting .bmp 6.000Ko) is reduce as a size like the same than the jpg version (600Ko), so: save function in .m file use the Huffman technique? How can I see the codesource of "save" function?

채택된 답변

Baptiste
Baptiste 2015년 5월 10일
편집: Baptiste 2015년 5월 10일
I talked about save() function . Ok, obviously, Matwork don't use a common compression algorithm and his function is too particular.
But If I success the Humann coding, and I must save those data, instead of save() who compress a already compressed files, I must use imwrite() or saveas()?
Anyway, I'll try to understand what this Huffman wanted to do with those AC & DC's RLE data for JPEG, I think I will don't sleep during 48 hours -_- .
Thank you for your answer!
  댓글 수: 3
Walter Roberson
Walter Roberson 2015년 5월 10일
To avoid re-compressing an already compressed binary stream, use fwrite() to write the binary out to a file.
When you are writing a Huffman type compression, remember to take care of the problem that files must store a whole number of bytes but the last Huffman encoding might end in the middle of a byte.
Baptiste
Baptiste 2015년 5월 10일
I wasn't looking the wikipedia page, now it's clear!
Thank you very much!

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2015년 5월 10일
The source of "save" is Mathworks proprietary, and it would be very expensive to get access to it unless you get a job with Mathworks.
I can pretty much guarantee that they do not use Huffman encoding. If save() is compressing data at all, it is likely an Lempel–Ziv–Welch type algorithm.
But please check to see if you are talking about save() or about saveas() or about imwrite() as save() does not create .bmp files but the other two do.

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by