-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Palette needs to be power of 2 and multiple of 3? #1
Comments
Seems to work fine. From what I saw in my test your palette was 24 colors. Sorry, I will try to clarify the code up a bit. There is two different aspects.
So for now really what you need is palette.length / 3 to be a power of 2. omggif checks for both of those things. So what you really want is to pass omggif something like 64*3, 32 * 3, etc, since there are separate elements for RGB. I just wrote this code today, now that you mention it I will probably change the palettes to be RGB together, it's a bit more convenient when you are writing things out by hand to (0xff78fa vs 0xff, 0x78, 0xfa) and it means less array elements which is probably not a bad thing. Hope that helps |
Oh damn. I was missing the * 3... So now it kind of works: It shows the top half of the gif fine, the second half gets corrupted. |
I have a look at it tomorrow, thanks for the code to reproduce |
I think it should be fixed in 99faac4. |
Cool! Works fine now :) |
I just spent a few hours optimizing (yesterday I just wrote the naive initial implementation). There is about a 4x performance increase in the LZW compressor. It made the code slightly trickier, so let me know if you see any problems. I will spend a little bit more time looking at optimizations, although I've tried a few and I think I am pretty close to the balance of making the code very ugly for only helping a few percent. PS: Thanks for the examples! It works! ; ) |
Wow. It's much faster compared to this morning. It's almost realtime now. |
I just pushed another improvement of 15%, but it's getting to the manually unrolled/inlined point, so I think I'll call it good for now. Overall it's about 5x yesterday's code. |
Impressed |
So I thought that this could be handy for easily creating these hypnotic animated gifs that you can find on the internets and I decided to try to export a 3d animation with it.
After figuring out how to get a usable string out of the buffer (thus displaying the example gif on the page) I started to write my own images.
Then I realised that I need to build the palette, then remembering the 256 max colors. After crappily decimating the color values I got my palette down to 77 or so. But now I keep getting these errors:
I've tried to initialise the array with 256 values but it's not really helping.
https://gist.github.com/4582927
Any ideas?
The text was updated successfully, but these errors were encountered: