Kamaelia docs : 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

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

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, 19 Oct 2008 at 14:29:09 UTC/GMT

This is a page from the Kamaelia website. You can find the original here: