← 返回首页
implement yuv and other colorspaces and "bufferless" `TextureArray` by kushalkolar · Pull Request #1033 · fastplotlib/fastplotlib · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

implement yuv and other colorspaces and "bufferless" TextureArray#1033

Merged
kushalkolar merged 19 commits into
ndwidgetfrom
image-colorspaces
Apr 17, 2026
Merged

implement yuv and other colorspaces and "bufferless" TextureArray#1033
kushalkolar merged 19 commits into
ndwidgetfrom
image-colorspaces

Conversation

kushalkolar commented Apr 13, 2026
edited
Loading

Copy link
Copy Markdown
Member
  • implement colorspaces. Existing ImageGraphic uses rgb colorspaces.
  • ImageYUVGraphic for yuv colorspaces yuv420p and yuv444p
  • ImageBase that is inherited byImageGraphic and ImageYUVGraphic
  • implement "bufferless" support in TextureArray using the cpu_buffer=False kwarg. Behaves exactly the same from the perspective of the ImageGraphic API! So image_graphic.data = new_data can be done just like before, but with bufferless it's much faster. ImageYUVGraphic is always bufferless.
  • update image graphic tooltip to handle bufferless, caveat is that it's no longer possible to get exact grayscale values so it does an inverse transform using the LUT. Tooltip has a note that the value is approximate, should document in the docstring too.
  • selector tools will not be able to grab the underlying data, document it and raise in the corresponding selector tools.
  • NDImage can handle both ImageGraphic and ImageYUVGraphic
  • NDImageProcessor subclass called VideoProcessor which can handle the tuple of arrays for (y, u, v)
  • ndw_subplot.add_video() which just calls add_nd_image() with with processor_type=VideoProcessor
  • docstrings for new functionality
  • example for yuv colorspaces
  • allow providing y, u, v explicitly, so it can be set directly from pyav.Frame.planes without creating an array which creates a copy.
    vh.current_frame Out[11]: <av.VideoFrame, pts=0 yuv420p 1600x1200 at 0x7f135828ea40> vh.current_frame.planes Out[12]: (<av.VideoPlane 1996800 bytes; buffer_ptr=0x7f12441525c0; at 0x7f135828a6b0>, <av.VideoPlane 499200 bytes; buffer_ptr=0x7f1244341340; at 0x7f135828abb0>, <av.VideoPlane 499200 bytes; buffer_ptr=0x7f12443bcf00; at 0x7f135828b010>)

This gives us easy ~80fps on Gily's gerbil stuff which we were previously getting ~15fps on 🥳

even-more-epic-fps-2026-04-13_16.10.25.mp4

kushalkolar requested a review from clewis7 as a code owner April 13, 2026 17:07
kushalkolar mentioned this pull request Apr 13, 2026
6 tasks

kushalkolar commented Apr 15, 2026
edited
Loading

Copy link
Copy Markdown
Member Author

ok I'm going to benchmark the unpacked YUV with larger data and more vids simultaneously and see if we really need it. If not I will just keep the packed since it's easier to deal with.

Copy link
Copy Markdown
Member Author

OK I'm going to add an entirely new ImageYUVGraphic for yuv images that uses a single texture specific for yuv, this is becoming a giant mess.

kushalkolar merged commit 32f656f into ndwidget Apr 17, 2026
kushalkolar deleted the image-colorspaces branch April 18, 2026 00:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Successfully merging this pull request may close these issues.

1 participant

Footer

© 2026 GitHub, Inc.