Skip to content

Navigation Menu

Sign in
Appearance settings

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

Provide feedback

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

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
kushalkolar merged 19 commits intondwidgetfastplotlib/fastplotlib:ndwidgetfrom
image-colorspacesfastplotlib/fastplotlib:image-colorspacesCopy head branch name to clipboard
Apr 17, 2026
Merged

implement yuv and other colorspaces and "bufferless" TextureArray#1033
kushalkolar merged 19 commits intondwidgetfastplotlib/fastplotlib:ndwidgetfrom
image-colorspacesfastplotlib/fastplotlib:image-colorspacesCopy head branch name to clipboard

Conversation

@kushalkolar
Copy link
Copy Markdown
Member

@kushalkolar kushalkolar commented Apr 13, 2026

  • 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 kushalkolar requested a review from clewis7 as a code owner April 13, 2026 17:07
@kushalkolar kushalkolar mentioned this pull request Apr 13, 2026
6 tasks
@kushalkolar
Copy link
Copy Markdown
Member Author

kushalkolar commented Apr 15, 2026

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.

@kushalkolar
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 kushalkolar merged commit 32f656f into ndwidget Apr 17, 2026
@kushalkolar kushalkolar deleted the image-colorspaces branch April 18, 2026 00:15
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.