1,086 questions
Tooling
0
votes
1
replies
36
views
How does a Deflate compressor know when to choose Dynamic or Fixed Huffman codes?
I have been following the inner working of Deflate compression and i have came across a junction in which i need to understand how efficient are compressor's choices with this lossless compression ...
2
votes
1
answer
75
views
Can initial similarity between 2 files create similarity in the start of their Deflate compressed output?
Assuming we have 2 files:
FILE 1
Uncompressed size: 793765 bytes
Compressed size: 604911 bytes
Data type: 99% Base64
Compression method : deflate dynamic
FILE 2
Uncompressed size: 793765 ...
1
vote
2
answers
98
views
Order of Huffman List when there are many characters with the same frequency
I am running into a very interesting dilemma while learning Huffman compression. I am currently studying in a course that uses zyBooks and the examples are absolutely terrible in my opinion. In 2 ...
0
votes
1
answer
111
views
When would Huffman coding outperform Deflate?
What features in a data set would lead to Huffman coding outperforming Deflate compression?
I am looking at lossless data compression for numerical raster data sets such as terrestrial elevation data. ...
1
vote
1
answer
45
views
Empty Encoder Map but the Huffman tree is generating
So I am making a data compression tool using Huffman Encoding and decoding, I am at the stage where I have built the Huffman Tree and it is a success but I am feeding that tree in a GenerateCodes ...
-1
votes
1
answer
117
views
Huffman Coding Java
I have this question:
Consider a DMS with seven possible symbols Xi, i = 1, 2, ... , 7 and
the corresponding probabilities p1 = 0.37, p2 = 0.33, p3 = 0.16, p4 =
0.07, p5 = 0.04, p6 = 0.02, and p7 = 0....
2
votes
2
answers
182
views
Huffman's algorithm produces a compressed file that is larger than the original one
I have written this function. It does some magic with the file that I input (the one to compress) - a .txt (text) file, however the output (compressed) file is larger than the original one. For ...
0
votes
1
answer
124
views
How to write already generated Huffman Codes to file in Rust
I am trying to implement Huffman encoding to compress files (for learning purpouses). I can generate Huffman codes for a given message and use that to build a binary string containing the compressed ...
0
votes
1
answer
77
views
Compressing a list of low bit integers (2, 3, 4 bits)
I have a relatively long list of low bit integers by size 16*10^6.
The sparsity level of this list is about 40%, so applying any sparse matrix does not work.
The first step I tried Run-length encoding,...
1
vote
0
answers
109
views
To buffer or not to buffer - fputc() vs fwrite()
Edit: My bench marking code was wrong (SIZE / BUFSIZ in fwrite() should only be BUFSIZ), so everything is cleared up: in my case buffered fwrite() is giving better performance.
I try to speed optimize ...
0
votes
1
answer
85
views
Huffman code segfaults on random input but not on text input
(I asked multiple questions to the implementation of the huffman code here, if I ask too many questions please tell me and I'll stop. Any tips on how to learn to find those mistakes myself are ...
0
votes
2
answers
137
views
Bit bufferer doesn't behave as expected in C
I have to write individual Bits to a file (for huffman code). To do so I send bits to a function which buffers them until a byte is filled and then returns the byte. I can´t figure out why it doesn't ...
0
votes
0
answers
12
views
Huffman Coding Error When Passing Parameter
code:
typedef struct
{
int weight;
char c;
int parent, lchild, rchild;
} Node, *HTree;
void findmin(HTree ht, int len, int *p1, int *p2)
void CreateHTree(HTree ht, int n)
void print(...
0
votes
0
answers
112
views
How to extract DCT coefficient matrix by jpeglib in python?
I have the below code and i get this error:
File "C:\Users\omar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jpeglib\functional.py", line 71, in read_dct
return DCTJPEG(
^^^^^^^...
0
votes
1
answer
156
views
JPEG decoder colour issue - suspect DC coefficient/Huffman decoding is the cause
I'm trying to build a JPEG decoder, and I'm testing it on a greyscale image to keep things simple:
https://commons.wikimedia.org/wiki/File:Grayscale_%28182824419%29.jpeg
The code works OK, but the ...
1
vote
1
answer
117
views
How can one correctly extract Huffman Tree from a dynamic compressed block?
My problem is similar to the one solved HERE, with few differences.
So the a Deflated block with dynamic Huffman codes is structured like this:
|Block Header|compressed block|end of block|
Then Block ...
1
vote
2
answers
142
views
How to handle the remaining bits in file decompression
I am creating a file compression and decompression, and I don't know how to handle the remaining bits when I decompressed.
For example, I have 63 bits.length() and since byte = 8 bits, bits.length() % ...
0
votes
1
answer
39
views
Does the BRCI algorithm work for *all* Huffman Trees?
I'm trying to create a height-limited Huffman Tree. One algorithm proposed for this is the BRCI Algorithm, which promises a comparatively fast and simple to implement solution.
This means that the ...
1
vote
1
answer
261
views
How can I read a binary file bit-by-bit?
I'm working on a project to compress/decompress a text file with the Huffman algorithm. I've successfully managed to compress a given text file into binary -- I've checked with the Visual Studio Hex ...
0
votes
1
answer
3k
views
huffman table in jpeg decoding
i am trying to implement a JPEG decoder. i was following JPEG standard T.81.
i understand how the JPEG file is structured, different marker, etc.
the type of images i am dealing with is lossless, ...
-1
votes
1
answer
29
views
What is the process of counting the frequencies of each character which is then feeded into huffman encoding?
I'm reserching about a method to decreses the time and space complexity of the process before huffman encoding where the computer have to give the frequency of each character to the code.I wanted to ...
-1
votes
1
answer
560
views
Compute the compression ratio for Huffman algorithm
I used this code HuffmanCodeto compress this text
...
0
votes
3
answers
175
views
Huffman Coding Complexity
In Huffman coding we perform a series of iterations in which each time we remove from a priority queue the two minimum elements and add to it an element corresponding to the sum of the two elements ...
1
vote
0
answers
82
views
How to fix the issue of getting a black square while compressing PNG image using Huffman code?
I am writing a program that converts PNG image into the text by using Huffman code(It's like a compressed file) and after decompressed this file by using a CodeDictionary and as result I should get ...
0
votes
1
answer
27
views
Is this a correct huffman tree for the following distributions of characters?
letter frequency
a 5
b 6
c 5
d 6
e 11
f 13
g 23
h 25
i 26
j 46
Here is what I get, correct me if I'm wrong: a and c both 5, to get node 10, b and d both 6 to get 12, combine to get 22, e and f on ...