save fonction and compression

2 vues (au cours des 30 derniers jours)
Baptiste
Baptiste le 9 Mai 2015
Commenté : Baptiste le 10 Mai 2015
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?

Réponse acceptée

Baptiste
Baptiste le 10 Mai 2015
Modifié(e) : Baptiste le 10 Mai 2015
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 commentaires
Walter Roberson
Walter Roberson le 10 Mai 2015
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 le 10 Mai 2015
I wasn't looking the wikipedia page, now it's clear!
Thank you very much!

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 10 Mai 2015
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.

Catégories

En savoir plus sur Large Files and Big Data dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by