August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)

Kamaelia.Video.PixFormatConversion

Converting the pixel format of video frames

These components convert the pixel format of video frames, for example, from interleaved RGB to planar YUV 420.

Example Usage

Decoding a Dirac encoded video file, then converting it to RGB for display on a pygame display surface:

Pipeline( RateControlledFileReader("video.drc",readmode="bytes", rate=100000),
          DiracDecoder(),
          ToRGB_interleaved(),
          VideoSurface(),
        ).run()

Which component for which conversion?

The components here are currently capable of the following pixel format conversions:

From To Which component?
"RGB_interleaved" "RGB_interleaved" ToRGB_interleaved
"YUV420_planar" "RGB_interleaved" ToRGB_interleaved
"YUV422_planar" "RGB_interleaved" ToRGB_interleaved
"RGB_interleaved" "YUV420_planar" ToYUV420_planar
"YUV420_planar" "YUV420_planar" ToYUV420_planar

More details

Send video frames to the "inbox" inbox of these components. They will be converted to the destination pixel format and sent out of the "outbox" outbox. Video frames are dictionaries, they must have the following keys:

  • "rgb" or "yuv" -- containing the pixel data
  • "pixformat" -- the pixel format
  • "size" -- (width,height) in pixels

Any other fields will be transparently passed through, unmodified.

These components support sending data out of its outbox to a size limited inbox. If the size limited inbox is full, these components will pause until able to send out the data. Data will not be consumed from the inbox if these components are waiting to send to the outbox.

If a producerFinished message is received on the "control" inbox, these components will complete converting and frames pending in its inbox, and finish sending any resulting data to its outbox. They will then send the producerFinished message on out of its "signal" outbox and terminate.

If a shutdownMicroprocess message is received on the "control" inbox, these components will immediately send it on out of its "signal" outbox and immediately terminate. It will not complete processing, or sending on any pending data.


Kamaelia.Video.PixFormatConversion.ToRGB_interleaved

class ToRGB_interleaved(Axon.Component.component)

" ToRGB_interleaved() -> new ToRGB_interleaved component.

Converts video frames sent to its "inbox" inbox, to "RGB_interleaved" pixel format and sends them out of its "outbox"

Supports conversion from:

  • YUV420_planar
  • YUV422_planar
  • RGB_interleaved (passthrough)

Inboxes

  • control : Shutdown signalling
  • inbox : Video frame

Outboxes

  • outbox : RGB_interleaved pixel format video frame
  • signal : Shutdown signalling

Methods defined here

Warning!

You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.

canStop(self)

handleControl(self)

main(self)

Main loop.

mustStop(self)

waitSend(self, data, boxname)

Kamaelia.Video.PixFormatConversion.ToYUV420_planar

class ToYUV420_planar(Axon.Component.component)

" ToYUV420_planar() -> new ToYUV420_planar component.

Converts video frames sent to its "inbox" inbox, to "ToYUV420_planar" pixel format and sends them out of its "outbox"

Supports conversion from:

  • RGB_interleaved
  • YUV420_planar (passthrough)

Inboxes

  • control : Shutdown signalling
  • inbox : Video frame

Outboxes

  • outbox : YUV420_planar pixel format video frame
  • signal : Shutdown signalling

Methods defined here

Warning!

You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.

canStop(self)

handleControl(self)

main(self)

Main loop.

mustStop(self)

waitSend(self, data, boxname)

Feedback

Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!

Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.

-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT