MediaX v1.0.0rc7 [7e6cb74]
Video streaming for military vehicles
Loading...
Searching...
No Matches
mediax::video::ColourSpaceCpu Class Reference

Helper functions for different colour space options, optimised for CPU. More...

#include <colourspace_cpu.h>

Inheritance diagram for mediax::video::ColourSpaceCpu:
Inheritance graph
Collaboration diagram for mediax::video::ColourSpaceCpu:
Collaboration graph

Public Member Functions

 ColourSpaceCpu ()=default
 Construct a new Colour Space object.
 
 ~ColourSpaceCpu () final=default
 Destroy the Colour Space Cpu object.
 
int Convert (mediax::rtp::Resolution res, uint8_t *in, AVPixelFormat in_format, uint8_t in_bytes, uint8_t *out, AVPixelFormat out_format, uint8_t out_bytes) const
 Convert the image from one format to another.
 
int RgbToYuv (uint32_t height, uint32_t width, uint8_t *rgb, uint8_t *yuv) const final
 Convert YUV to RGBA on the CPU.
 
int RgbToMono8 (uint32_t height, uint32_t width, uint8_t *rgb, uint8_t *mono8) const final
 Convert RGB to Monochrome 8 bits ber pixel on the CPU.
 
int RgbToMono16 (uint32_t height, uint32_t width, uint8_t *rgb, uint8_t *mono16) const final
 Convert RGB to Monochrome 16 bits ber pixel on the CPU.
 
int RgbaToYuv (uint32_t width, uint32_t height, uint8_t *rgba, uint8_t *yuv) const final
 Convert RGBA to YUV on the CPU.
 
int RgbaToRgb (uint32_t width, uint32_t height, uint8_t *rgba, uint8_t *rgb) const final
 Convert RGBA to RGB on the CPU.
 
int RgbaToBgra (uint32_t width, uint32_t height, uint8_t *rgba, uint8_t *bgra) const final
 Convert RGBA to BGRA on the CPU.
 
int RgbToBgra (uint32_t width, uint32_t height, uint8_t *rgb, uint8_t *bgra) const final
 Convert RGB to RGBA on the CPU.
 
int YuvToBgra (uint32_t height, uint32_t width, uint8_t *yuv, uint8_t *bgra) const final
 Convert YUV to RGBA on the CPU.
 
int Mono8ToBgra (uint32_t width, uint32_t height, uint8_t *mono8, uint8_t *bgra) const final
 Convert Mono8 to RGBA on the CPU.
 
int Mono16ToBgra (uint32_t width, uint32_t height, uint8_t *mono16, uint8_t *bgra) const final
 Convert Mono16 to RGBA on the CPU.
 
int Nv12ToBgra (uint32_t height, uint32_t width, uint8_t *nv12, uint8_t *bgra) const
 Construct a new Nv12 To Bgra object.
 
int Nv12ToRgb (uint32_t height, uint32_t width, uint8_t *nv12, uint8_t *rgb) const
 Construct a new Nv12 To Rgb object.
 
int RgbToRgba (uint32_t width, uint32_t height, uint8_t *rgb, uint8_t *rgba) const final
 Convert RGB to RGBA on the CPU.
 
int Yuv422ToRgba (uint32_t height, uint32_t width, uint8_t *yuv422, uint8_t *rgba) const final
 Convert YUV to RGBA on the CPU.
 
int Yuv420ToRgba (uint32_t height, uint32_t width, uint8_t *yuv420, uint8_t *rgba) const final
 Convert YUV420P to RGBA on the CPU.
 
int Mono8ToRgba (uint32_t width, uint32_t height, uint8_t *mono8, uint8_t *rgba) const final
 Convert Mono8 to RGBA on the CPU.
 
int Mono8ToRgb (uint32_t width, uint32_t height, uint8_t *mono8, uint8_t *rgb) const final
 Convert Mono8 to RGB on the CPU.
 
int Mono16ToRgba (uint32_t width, uint32_t height, uint8_t *mono16, uint8_t *rgba) const final
 Convert Mono16 to RGBA on the CPU.
 
int Mono16ToRgb (uint32_t width, uint32_t height, uint8_t *mono16, uint8_t *rgb) const final
 Convert Mono16 to RGBA on the CPU.
 
int YuvToArgb (uint32_t height, uint32_t width, uint8_t *yuv, uint8_t *argb) const
 Convert YUV to RGBA on the CPU.
 
int YuvToRgb (uint32_t height, uint32_t width, uint8_t *yuv, uint8_t *rgb) const final
 Convert YUV to RGB on the CPU.
 
int Yuv420pToRgb (uint32_t height, uint32_t width, uint8_t *yuv, uint8_t *rgb) const final
 Convert YUV to RGBA on the CPU.
 
int ScaleToSizeRgb (uint32_t source_height, uint32_t source_width, uint8_t *source_rgb_buffer, uint32_t target_height, uint32_t target_width, uint8_t *target_rgb_buffer) const final
 Scale the image to the target size.
 
int ScaleToSizeRgba (uint32_t source_height, uint32_t source_width, uint8_t *source_rgb_buffer, uint32_t target_height, uint32_t target_width, uint8_t *target_rgba_buffer) const final
 Scale the image to the target size.
 
int ScaleToSizeBgra (uint32_t source_height, uint32_t source_width, uint8_t *source_rgb_buffer, uint32_t target_height, uint32_t target_width, uint8_t *target_bgra_buffer) const
 Scale the image to the target size.
 
- Public Member Functions inherited from mediax::video::ColourSpace
 ColourSpace ()=default
 Construct a new Colour Space object.
 
virtual ~ColourSpace ()=default
 Destroy the Colour Space object.
 

Detailed Description

Helper functions for different colour space options, optimised for CPU.

Member Function Documentation

◆ Convert()

int mediax::video::ColourSpaceCpu::Convert ( mediax::rtp::Resolution  res,
uint8_t *  in,
AVPixelFormat  in_format,
uint8_t  in_bytes,
uint8_t *  out,
AVPixelFormat  out_format,
uint8_t  out_bytes 
) const

Convert the image from one format to another.

Parameters
resThe resolution of the image
inThe input image buffer
in_formatThe input image format
in_bytesThe input image bytes per pixel
outThe output image buffer
out_formatThe output image format
out_bytesThe output image bytes per pixel
Returns
int The number of bytes converted

◆ Mono16ToBgra()

int mediax::video::ColourSpaceCpu::Mono16ToBgra ( uint32_t  width,
uint32_t  height,
uint8_t *  mono16,
uint8_t *  bgra 
) const
finalvirtual

Convert Mono16 to RGBA on the CPU.

Parameters
widthThe height of the image
heightThe width of the image
mono16The monochrome 16 bit image
bgraThe BGRA image buffer

Implements mediax::video::ColourSpace.

◆ Mono16ToRgb()

int mediax::video::ColourSpaceCpu::Mono16ToRgb ( uint32_t  width,
uint32_t  height,
uint8_t *  mono16,
uint8_t *  rgb 
) const
finalvirtual

Convert Mono16 to RGBA on the CPU.

Parameters
widthThe height of the image
heightThe width of the image
mono16The monochrome 16 bit image
rgbThe RGB image buffer

Implements mediax::video::ColourSpace.

◆ Mono16ToRgba()

int mediax::video::ColourSpaceCpu::Mono16ToRgba ( uint32_t  width,
uint32_t  height,
uint8_t *  mono16,
uint8_t *  rgba 
) const
finalvirtual

Convert Mono16 to RGBA on the CPU.

Parameters
widthThe height of the image
heightThe width of the image
mono16The monochrome 16 bit image
rgbaThe RGBA image buffer

Implements mediax::video::ColourSpace.

◆ Mono8ToBgra()

int mediax::video::ColourSpaceCpu::Mono8ToBgra ( uint32_t  width,
uint32_t  height,
uint8_t *  mono8,
uint8_t *  bgra 
) const
finalvirtual

Convert Mono8 to RGBA on the CPU.

Parameters
widthThe height of the image
heightThe width of the image
mono8The monochrome 8 bit image
bgraThe BGRA image buffer

Implements mediax::video::ColourSpace.

◆ Mono8ToRgb()

int mediax::video::ColourSpaceCpu::Mono8ToRgb ( uint32_t  width,
uint32_t  height,
uint8_t *  mono8,
uint8_t *  rgb 
) const
finalvirtual

Convert Mono8 to RGB on the CPU.

Parameters
width
height
mono8
rgb
Returns
int

Implements mediax::video::ColourSpace.

◆ Mono8ToRgba()

int mediax::video::ColourSpaceCpu::Mono8ToRgba ( uint32_t  width,
uint32_t  height,
uint8_t *  mono8,
uint8_t *  rgba 
) const
finalvirtual

Convert Mono8 to RGBA on the CPU.

Parameters
widthThe height of the image
heightThe width of the image
mono8The monochrome 8 bit image
rgbaThe RGBA image buffer

Implements mediax::video::ColourSpace.

◆ Nv12ToBgra()

int mediax::video::ColourSpaceCpu::Nv12ToBgra ( uint32_t  height,
uint32_t  width,
uint8_t *  nv12,
uint8_t *  bgra 
) const

Construct a new Nv12 To Bgra object.

Parameters
widthThe height of the image
heightThe width of the image
nv12The NV12 bit image
bgraThe BGRA image buffer

◆ Nv12ToRgb()

int mediax::video::ColourSpaceCpu::Nv12ToRgb ( uint32_t  height,
uint32_t  width,
uint8_t *  nv12,
uint8_t *  rgb 
) const

Construct a new Nv12 To Rgb object.

Parameters
height
width
nv12
rgb
Returns
int

◆ RgbaToBgra()

int mediax::video::ColourSpaceCpu::RgbaToBgra ( uint32_t  width,
uint32_t  height,
uint8_t *  rgba,
uint8_t *  bgra 
) const
finalvirtual

Convert RGBA to BGRA on the CPU.

Parameters
width
height
rgba
bgra
Returns
int

Implements mediax::video::ColourSpace.

◆ RgbaToRgb()

int mediax::video::ColourSpaceCpu::RgbaToRgb ( uint32_t  width,
uint32_t  height,
uint8_t *  rgba,
uint8_t *  rgb 
) const
finalvirtual

Convert RGBA to RGB on the CPU.

Parameters
width
height
rgba
rgb

Implements mediax::video::ColourSpace.

◆ RgbaToYuv()

int mediax::video::ColourSpaceCpu::RgbaToYuv ( uint32_t  width,
uint32_t  height,
uint8_t *  rgba,
uint8_t *  yuv 
) const
finalvirtual

Convert RGBA to YUV on the CPU.

Parameters
widthThe width of the image
heightThe height of the image
rgbaThe RGB image buffer
yuvThe YUV:422 image buffer

Implements mediax::video::ColourSpace.

◆ RgbToBgra()

int mediax::video::ColourSpaceCpu::RgbToBgra ( uint32_t  width,
uint32_t  height,
uint8_t *  rgb,
uint8_t *  bgra 
) const
finalvirtual

Convert RGB to RGBA on the CPU.

Parameters
widthThe height of the image
heightThe width of the image
rgbThe RGB image buffer
bgraThe BGRA image buffer

Implements mediax::video::ColourSpace.

◆ RgbToMono16()

int mediax::video::ColourSpaceCpu::RgbToMono16 ( uint32_t  height,
uint32_t  width,
uint8_t *  rgb,
uint8_t *  mono16 
) const
finalvirtual

Convert RGB to Monochrome 16 bits ber pixel on the CPU.

Parameters
heightThe height of the image
widthThe width of the image
rgbThe RGB image buffer
mono16The monochrome 16 image buffer

Implements mediax::video::ColourSpace.

◆ RgbToMono8()

int mediax::video::ColourSpaceCpu::RgbToMono8 ( uint32_t  height,
uint32_t  width,
uint8_t *  rgb,
uint8_t *  mono8 
) const
finalvirtual

Convert RGB to Monochrome 8 bits ber pixel on the CPU.

Parameters
heightThe height of the image
widthThe width of the image
rgbThe RGB image buffer
mono8The monochrome 8 image buffer

Implements mediax::video::ColourSpace.

◆ RgbToRgba()

int mediax::video::ColourSpaceCpu::RgbToRgba ( uint32_t  width,
uint32_t  height,
uint8_t *  rgb,
uint8_t *  rgba 
) const
finalvirtual

Convert RGB to RGBA on the CPU.

Parameters
widthThe height of the image
heightThe width of the image
rgbThe RGB image buffer
rgbaThe RGBA image buffer

Implements mediax::video::ColourSpace.

◆ RgbToYuv()

int mediax::video::ColourSpaceCpu::RgbToYuv ( uint32_t  height,
uint32_t  width,
uint8_t *  rgb,
uint8_t *  yuv 
) const
finalvirtual

Convert YUV to RGBA on the CPU.

Parameters
heightThe height of the image
widthThe width of the image
rgbThe RGB image buffer
yuvThe YUV:422 image buffer

Implements mediax::video::ColourSpace.

◆ ScaleToSizeBgra()

int mediax::video::ColourSpaceCpu::ScaleToSizeBgra ( uint32_t  source_height,
uint32_t  source_width,
uint8_t *  source_rgb_buffer,
uint32_t  target_height,
uint32_t  target_width,
uint8_t *  target_bgra_buffer 
) const

Scale the image to the target size.

Parameters
source_heightThe height of the source image
source_widthThe width of the source image
source_rgb_bufferThe source image buffer
target_heightThe height of the target image
target_widthThe width of the target image
target_bgra_bufferThe target image buffer
Returns
int

◆ ScaleToSizeRgb()

int mediax::video::ColourSpaceCpu::ScaleToSizeRgb ( uint32_t  source_height,
uint32_t  source_width,
uint8_t *  source_rgb_buffer,
uint32_t  target_height,
uint32_t  target_width,
uint8_t *  target_rgb_buffer 
) const
finalvirtual

Scale the image to the target size.

Parameters
source_heightThe height of the source image
source_widthThe width of the source image
source_rgb_bufferThe source image buffer
target_heightThe height of the target image
target_widthThe width of the target image
target_rgb_bufferThe target image buffer

Implements mediax::video::ColourSpace.

◆ ScaleToSizeRgba()

int mediax::video::ColourSpaceCpu::ScaleToSizeRgba ( uint32_t  source_height,
uint32_t  source_width,
uint8_t *  source_rgb_buffer,
uint32_t  target_height,
uint32_t  target_width,
uint8_t *  target_rgba_buffer 
) const
finalvirtual

Scale the image to the target size.

Parameters
source_heightThe height of the source image
source_widthThe width of the source image
source_rgb_bufferThe source image buffer
target_heightThe height of the target image
target_widthThe width of the target image
target_rgba_bufferThe target image buffer
Returns
int

Implements mediax::video::ColourSpace.

◆ Yuv420pToRgb()

int mediax::video::ColourSpaceCpu::Yuv420pToRgb ( uint32_t  height,
uint32_t  width,
uint8_t *  yuv,
uint8_t *  rgb 
) const
finalvirtual

Convert YUV to RGBA on the CPU.

Parameters
heightThe height of the image
widthThe width of the image
yuvThe YUV:420p image buffer
rgbThe RGB image buffer

Implements mediax::video::ColourSpace.

◆ Yuv420ToRgba()

int mediax::video::ColourSpaceCpu::Yuv420ToRgba ( uint32_t  height,
uint32_t  width,
uint8_t *  yuv420,
uint8_t *  rgba 
) const
finalvirtual

Convert YUV420P to RGBA on the CPU.

Parameters
heightThe height of the image
widthThe width of the image
yuv420The YUV:420P image buffer
rgbaThe RGBA image buffer

Implements mediax::video::ColourSpace.

◆ Yuv422ToRgba()

int mediax::video::ColourSpaceCpu::Yuv422ToRgba ( uint32_t  height,
uint32_t  width,
uint8_t *  yuv422,
uint8_t *  rgba 
) const
finalvirtual

Convert YUV to RGBA on the CPU.

Parameters
heightThe height of the image
widthThe width of the image
yuv422The YUV:422 image buffer
rgbaThe RGBA image buffer

Implements mediax::video::ColourSpace.

◆ YuvToArgb()

int mediax::video::ColourSpaceCpu::YuvToArgb ( uint32_t  height,
uint32_t  width,
uint8_t *  yuv,
uint8_t *  argb 
) const

Convert YUV to RGBA on the CPU.

Parameters
height
width
yuv
argb
Returns
int

◆ YuvToBgra()

int mediax::video::ColourSpaceCpu::YuvToBgra ( uint32_t  height,
uint32_t  width,
uint8_t *  yuv,
uint8_t *  bgra 
) const
finalvirtual

Convert YUV to RGBA on the CPU.

Parameters
heightThe height of the image
widthThe width of the image
yuvThe YUV:422 image buffer
bgraThe BGRA image buffer

Implements mediax::video::ColourSpace.

◆ YuvToRgb()

int mediax::video::ColourSpaceCpu::YuvToRgb ( uint32_t  height,
uint32_t  width,
uint8_t *  yuv,
uint8_t *  rgb 
) const
finalvirtual

Convert YUV to RGB on the CPU.

Parameters
heightThe height of the image
widthThe width of the image
yuvThe YUV:422 image buffer
rgbThe RGB image buffer

Implements mediax::video::ColourSpace.


The documentation for this class was generated from the following files: