save fonction and compression

3 次查看(过去 30 天)
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