Azzera filtri
Azzera filtri

Size of the array after Huffman Encoding

1 visualizzazione (ultimi 30 giorni)
Ayesha
Ayesha il 18 Giu 2014
Risposto: José-Luis il 18 Giu 2014
Hello,
I have observed that the size of the array generally increasing after huffman encoding process in MATLAB. For example:
sig = repmat([3 3 1 3 3 3 3 3 2 3],1,5); % Data to encode
symbols = [1 2 3]; % Distinct data symbols appearing in sig
p = [0.1 0.1 0.8]; % Probability of each data symbol
dict = huffmandict(symbols,p); % Create the dictionary.
hcode = huffmanenco(sig,dict); % Encode the data.
Here, sig: 1x50 double, however, after encoding, hcode becomes 1x60 double. I thought encoding process would reduce the number of elements. I would appreciate if someone could explain this and if possible, how to determine the size of array after encoding.
Thanks

Risposte (1)

José-Luis
José-Luis il 18 Giu 2014
The performance of encoding algorithms will depend on the structure of the underlying data. The combination of structure/algorithm will yield better or worse results depending on the fit. Sometimes you might get a longer file than what you originally had.
If you want to get the size of the array, please look at the built-in function size()

Categorie

Scopri di più su Denoising and Compression in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by