save fonction and compression

2 Ansichten (letzte 30 Tage)
Baptiste
Baptiste am 9 Mai 2015
Kommentiert: Baptiste am 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?

Akzeptierte Antwort

Baptiste
Baptiste am 10 Mai 2015
Bearbeitet: Baptiste am 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 Kommentare
Walter Roberson
Walter Roberson am 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 am 10 Mai 2015
I wasn't looking the wikipedia page, now it's clear!
Thank you very much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 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.

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by