Skip to content
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

Error when packing #2

Open
perpetual-hydrofoil opened this issue Jan 22, 2016 · 5 comments
Open

Error when packing #2

perpetual-hydrofoil opened this issue Jan 22, 2016 · 5 comments

Comments

@perpetual-hydrofoil
Copy link

jamieson@box: ~/x11-canvas-screencast/ # ./pack_animation.py example.js
example packing, num rects: 442 num frames: 320

Traceback (most recent call last):
File "./pack_animation.py", line 302, in
generate_animation(sys.argv[1])
File "./pack_animation.py", line 255, in generate_animation
dy, dx = allocator.allocate(w, h)
File "./pack_animation.py", line 109, in allocate
raise RuntimeError()
RuntimeError

@rprichard
Copy link
Owner

I'm not all that familiar with the Python code that's failing. The image processing parts all came from Sublime's anim_encoder project.

It looks like it's trying to allocate space in the output bitmap and running out. You could try increasing MAX_PACKED_HEIGHT to something larger than 10000. I guess it ought to resize the bitmap when that happens. I wonder what the run-time of find_matching_rect is, though. If the output bitmap grows too much, perhaps the script will be too slow.

I also wonder what would happen if the images didn't all have the same size, because the output bitmap has the same width as the first image. The images should all have the same size, though, as long as x11-canvas-screencast generated them.

@perpetual-hydrofoil
Copy link
Author

I see... I haven't looked at the code yet, but is there any way to get a better traceback or debug mode? (These were generated by x11-canvas-screencast.)

@rprichard
Copy link
Owner

... is there any way to get a better traceback or debug mode?

Not that I know of. The code is fairly short, though, so if you know Python, it shouldn't be too hard to debug.

@perpetual-hydrofoil
Copy link
Author

See upstream: sublimehq/anim_encoder#11

@wbond
Copy link

wbond commented Aug 11, 2017

Just a note, the run time does increase because currently anim_encoder searches the existing image data whenever adding a rect to the packed result. As the buffer gets larger, the number of locations that need to be searched increases also.

According to the source comments, reusing the image data resulted in up to a 20% savings in some of the Sublime Text screencasts originally recorded. That savings may not be worth it once it starts taking 20 minutes to pack the image data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants