Comments (3)
Thank you for reporting this. How did you get this stream?
I will try to fix the routine. Is the workaround of detecting this case and recompressing the data to avoid the problem acceptable for you?
from zlib6502.
I fixed this by getting rid of nbitCode_totalCount
. This even saves 7 bytes of code. The cost is slower fetchCode
- zopfli-compressed GPL v3 takes 3% more time.
Now I wonder if:
- more than 256 codes of same length
- all 256 literal codes of same length
are possible? If you are able to generate such streams, please submit separate issues.
Thank you!
from zlib6502.
Wow, fast work. rep16.bin.gz comes from using standard gzip on a file I created specially. All I did was create some data that is compressible and only has 1 occurrence of literal values 0 .. 254. Since 256 (end of block code) appears once there are 256 symbols with the same frequency so the Huffman encoding gives them the same code length. Here's the little C program I wrote:
int main(int argc, char *argv[])
{
int i, j;
FILE *fp = fopen("rep16.bin", "wb");
for (i = 0; i < 255; i++) {
int n = i == 0 ? 1 : 16;
for (j = 0; j < n; j++) {
fputc(i, fp);
}
}
fclose(fp);
return 0;
}
I think both trees you suggest are possible by directly constructing the deflate data. I'm not so sure if one could make a data file that results in those trees when run through gzip. I'll have to think about that.
from zlib6502.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zlib6502.