Class ov::op::util::ConvertColorNV12Base#

class ConvertColorNV12Base : public ov::op::Op#

Base class for color conversion operation from NV12 to RGB/BGR format. Input:

  • Operation expects input shape in NHWC layout.

  • Input NV12 image can be represented in a two ways: a) Single plane: NV12 height dimension is 1.5x bigger than image height. ‘C’ dimension shall be 1 b) Two separate planes: Y and UV. In this case b1) Y plane has height same as image height. ‘C’ dimension equals to 1 b2) UV plane has dimensions: ‘H’ = image_h / 2; ‘W’ = image_w / 2; ‘C’ = 2.

  • Supported element types: u8 or any supported floating-point type. Output:

  • Output node will have NHWC layout and shape HxW same as image spatial dimensions.

  • Number of output channels ‘C’ will be 3

    Conversion of each pixel from NV12 (YUV) to RGB space is represented by following formulas: R = 1.164 * (Y - 16) + 1.596 * (V - 128) G = 1.164 * (Y - 16) - 0.813 * (V - 128) - 0.391 * (U - 128) B = 1.164 * (Y - 16) + 2.018 * (U - 128) Then R, G, B values are clipped to range (0, 255)

Subclassed by ov::op::v8::NV12toBGR, ov::op::v8::NV12toRGB

Public Types

enum class ColorConversion : int#

Exact conversion format details Currently supports conversion from NV12 to RGB or BGR, in future can be extended with NV21_to_RGBA/BGRA, etc.


enumerator NV12_TO_RGB#
enumerator NV12_TO_BGR#

Public Functions

virtual void validate_and_infer_types() override#

Verifies that attributes and inputs are consistent and computes output shapes and element types. Must be implemented by concrete child classes so that it can be run any number of times.

Throws if the node is invalid.