AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
Widget Signal Routing

NTV2 device FPGA firmware implements several types of “widgets“ for receiving, processing and transmitting video data. These can be classified as follows:

Most widgets typically have one or more registers associated with them for reporting status, or to control their operation. Rather than calling CNTV2Card::ReadRegister or CNTV2Card::WriteRegister, client applications should use the appropriate widget-related API calls in the CNTV2Card class to inquire about and/or control the widget of interest.

All widgets have a unique identifier in software expressed by the NTV2WidgetID enumeration. To determine if a device implements a particular widget, call NTV2DeviceCanDoWidget.

Video data paths between widgets are implemented using crosspoints in firmware.

  • Widget inputs are identified by NTV2InputCrosspointID.
  • Widget outputs are identified by NTV2OutputCrosspointID.
  • Input Widgets only have output crosspoint connections.
  • Output Widgets only have input crosspoint connections.
  • Processing Widgets have both input and output crosspoint connections.

The CNTV2SignalRouter class has static methods that are useful for inquiring about device widgets and their input and output crosspoints:

A set of “crosspoint select” registers (e.g., kRegXptSelectGroup1, kRegXptSelectGroup2, etc.) determine which widget output will feed (source) each widget’s input.

Note
A widget’s output can source multiple widgets’ inputs, while a widget’s input can only be sourced by one other widget’s output. In other words, widget outputs are one-to-many, while widget inputs are one-to-one.
Widget inputs that are left open — i.e., disconnected — i.e. aren’t connected to any other widget’s output — default to the NTV2_XptBlack output crosspoint.

The CNTV2Card class has several methods dedicated to widget routing:

Due to FPGA size limitations, only a small fraction of the possible widget interconnection routes are implemented. Unfortunately, for many years, there was never a programmatic way to determine at runtime if a device implemented a specific connection path. The CNTV2Card::CanConnect function was in place to support this, but it was never functional. Around SDK 14.0, an attempt was made to compile a static “implemented routes” table for some firmware, but it wasn’t reliable and was abandoned.

Starting with SDK 16.0, newer devices have a firmware ROM bitmask that provides a true indication of actual, implemented connection paths. The CNTV2Card::CanConnect function makes use of this bitmask for those devices that support it.

The NTV2 SDK provides the Routing Inspector in “NTV2Watcher” that graphically shows the available device widgets and the signal routing between them. It lets you inspect and interactively change widget configuration and signal routing paths between widgets. Also, for devices that support this feature, it displays the legal, implemented routes when creating a new connection from a widget socket. Finally, as a programming aid, once a working routing has been achieved, NTV2Watcher can generate the C++ source code that implements it.


Input Widgets

These widgets only have output crosspoints that provide signal sources for signal-processing or output widgets.

Note
An input widget’s output can be used to source multiple output and signal-processing widgets’ inputs.

SDI Input

An SDI Input widget represents a physical SDI input connector.

HDMI Input

An HDMI Input widget represents a physical HDMI input connector.

  • There is one of these widgets for each input HDMI connector.
  • Older devices with our 1st-generation HDMI chip use NTV2_WgtHDMIIn1.
  • Devices that support our 2nd-generation HDMI chip use NTV2_WgtHDMIIn1v2.
  • Devices that support our 3rd-generation HDMI chip use NTV2_WgtHDMIIn1v3.
  • Devices that support our 4th-generation HDMI chip use NTV2_WgtHDMIIn1v4, etc. Each of these have separate YCbCr and RGB output crosspoints.
  • To obtain its NTV2OutputCrosspointID
    • Call GetInputSourceOutputXpt
      • Specify which HDMI input by passing it NTV2_INPUTSOURCE_HDMI1, NTV2_INPUTSOURCE_HDMI2, …etc.
      • For 4K/UHD applications, specify the appropriate quadrant number 0, 1, 2 or 3 in the inHDMI_Quadrant parameter.
      • For the RGB output crosspoint instead of the default YUV one (4th-generation HDMI only), pass true for the inIsHDMI_RGB parameter.

Analog Video Input

An Analog Video Input widget represents a physical analog video input connector (typically RCA connectors labeled Y/G/CVBS, Pb/B/Y and Pr/R/C RCA connectors).


Output Widgets

These widgets only have input crosspoints that accept signals from signal-processing or input widgets.

Note
An output widget’s input can only be sourced from a single input or signal-processing widget’s output.

SDI Output

An SDI Output widget represents one of the device’s physical SDI output connectors.

HDMI Output

An HDMI Output widget represents a physical HDMI output connector.

Analog Video Output

An Analog Video Output widget represents a physical analog video output connector (typically RCA connectors labeled Y/G/CVBS, Pb/B/Y and Pr/R/C RCA connectors).


Signal-Processing Widgets

These widgets have both input and output crosspoints. They accept and consume a signal from another source, and perform some kind of processing on it, and send it on to another widget for consumption downstream.

Note
A signal-processing widget’s output can source multiple widgets’ inputs, while each of its inputs can only be sourced by one other widget’s output.

Frame Store

A Frame Store widget represents the firmware entity responsible for writing or reading video frames to or from device SDRAM.

  • NTV2DeviceGetNumFrameStores will report the number of Frame Store widgets that are available on a given device.
  • Frame Store widgets are identified by NTV2_WgtFrameBuffer1, NTV2_WgtFrameBuffer2, etc.
  • In Capture Mode
    • The normal (“Level A”) input crosspoint is available and should be used for most applications.
    • There is a “Level B” input crosspoint that is available for dual-link applications.
    • Call GetFrameBufferInputXptFromChannel to obtain a Frame Store’s NTV2InputCrosspointID
      • Specify the Frame Store of interest by NTV2Channel (i.e., NTV2_CHANNEL1, NTV2_CHANNEL2, …etc.).
      • By default, the function returns the normal “Level A” input crosspoint. Specify true for inIsBInput for the “Level B” crosspoint.
  • In Playout Mode
    • If the Frame Store is configured for SD, HD, or 4K/UHD Quads/Squares (i.e. non-Tsi) mode:
    • If the Frame Store is configured for 4K/UHD Tsi (SMPTE 425 two-sample-interleave) mode:
    • Call GetFrameBufferOutputXptFromChannel to obtain a Frame Store’s NTV2OutputCrosspointID
      • Specify the Frame Store of interest by NTV2Channel (i.e., NTV2_CHANNEL1, NTV2_CHANNEL2, …etc.).
      • By default, the function returns the YUV output crosspoint. If the Frame Store’s NTV2FrameBufferFormat is an RGB format, pass true for inIsRGB to obtain the RGB crosspoint.
      • By default, the function will return a normal, non-SMPTE-425 (non-Tsi) output crosspoint. If the Frame Store is configured for 4K/UHD and for two-sample-interleave, pass true for inIs425, to obtain the “425” crosspoint.

See the FrameStore Operation section for information about how to programmatically interrogate and configure Frame Stores.

ColorSpace Converter (CSC) Routing

A ColorSpace Converter widget represents the firmware entity that can convert YCbCr video into RGBA or vice-versa.

  • NTV2DeviceGetNumCSCs reports the number of CSC widgets that are available on a given device.
  • CSC widgets are identified by NTV2_WgtCSC1, NTV2_WgtCSC2, etc.
  • Each CSC has two input crosspoints:
    • Video Input: When this is sourced from another widget’s output crosspoint, and it’s receiving…
      • YCbCr/YUV video, then the CSC will produce valid RGB[A] data on its RGBA output crosspoint.
      • RGB[A] video, then the CSC will produce valid YCbCr data on its YUV output crosspoint.
    • Key Input: This supplies the alpha channel data for the CSC’s RGBA output.
    • Call GetCSCInputXptFromChannel to obtain the NTV2InputCrosspointID for a CSC:
      • Specify the CSC by NTV2Channel (e.g., use NTV2_CHANNEL3 for CSC 3).
      • By default, the function returns the video input crosspoint. To obtain the alpha/key input crosspoint, pass true for inIsKeyInput.
  • Each CSC has 3 output crosspoints:
    • YUV Video: This will produce valid YCbCr video data only when the CSC’s Video Input is receiving RGB[A] video data.
    • RGB Video: This will produce valid RGB[A] video data only when the CSC’s Video Input is receiving YCbCr video data.
    • Key YUV: This will produce valid YCbCr key data only when the CSC’s Video Input is receiving RGB[A] video data.
    • Call GetCSCOutputXptFromChannel to obtain one of the CSC’s NTV2OutputCrosspointID values:
      • Specify the CSC by NTV2Channel (e.g., use NTV2_CHANNEL3 for CSC 3).
      • By default, the function returns the video output crosspoint. To obtain the Key crosspoint, pass true for inIsKey.
      • By default, the function returns the YUV output crosspoint. To obtain the RGB crosspoint, pass true for inIsRGB.

The Color Space Converter Operation section has more information on CSC configuration.

LUT Routing

A LUT widget represents the firmware entity that converts R, G, and B values into different R, G, and B values.

The LUT Operation section has more information on LUT configuration.

Mixer/Keyer Routing

A Mixer/Keyer widget represents the firmware entity that can mix two YCbCr video sources into a single YCbCr raster (and key).

  • Each Mixer/Keyer widget has four input crosspoints:
    • Foreground Inputs:
      • Video: This determines the video that will appear in the foreground of the mix, and should be routed to a widget that produces YCbCr video.
      • Key: This determines the foreground key, and should be routed to another widget’s YCbCr output. Only the Y component is used — the Cb and Cr components are ignored.
      • Call GetMixerFGInputXpt to obtain a foreground NTV2InputCrosspointID:
        • Specify the NTV2Channel used. (The actual zero-based Mixer index that’s used will be half the ordinal value of NTV2Channel.)
        • Pass false for inIsKey for the Video input; pass true for the Key input.
    • Background Inputs:
      • Video: This determines the video that will appear in the background, and should be routed to a widget that produces YCbCr video.
      • Key: This determines the background key, and should be routed to another widget’s YCbCr output. Note that only the Y component is used — the Cb and Cr components are ignored.
      • Call GetMixerBGInputXpt to obtain a background NTV2InputCrosspointID:
        • Specify the NTV2Channel used. (The actual zero-based Mixer index that’s used will be half the ordinal value of NTV2Channel.)
        • Pass false for inIsKey for the Video input; pass true for the Key input.
  • Each Mixer/Keyer widget has two output crosspoints:
    • Video Output: This produces the mixed/keyed YCbCr video raster.
    • Key Output: This produces a YCbCr signal with the resulting mixed key data in the Y channel.
    • Call GetMixerOutputXptFromChannel to obtain a Mixer’s NTV2OutputCrosspointID:
      • Specify the NTV2Channel used. (The actual zero-based Mixer index that’s used will be half the ordinal value of NTV2Channel.)
      • Pass false for inIsKey for the Mixer’s Video output; pass true for the Mixer’s Key output.

End-to-End (E-E) Routing

This section shows how to programmatically set up a device to pass through an input signal to at least one corresponding output.

TBD


Routing for Capture

This section shows how to programmatically set up a device to receive video for several commmon scenarios.

SD/HD YCbCr

TBD

SD/HD RGB

TBD

SD/HD RGB Over-the-Wire Dual-Link

TBD


Routing for Playout

This section shows how to programmatically set up a device for transmitting video for several commmon scenarios.

SD/HD YCbCr Playout From YCbCr Frame Buffer
// Example: Set up FrameStore3 for RGB playout, route to SDI 3...
theDevice.Connect (NTV2_XptSDIOut3Input, NTV2_XptFrameBuffer3YUV); // SDIOut3 <== FB3
// Or, more generically...
theDevice.SetFrameBufferFormat (chan, fbf);
theDevice.SetMode (chan, NTV2_MODE_OUTPUT);
theDevice.Connect (::GetSDIOutputInputXpt(chan), ::GetFrameBufferOutputXptFromChannel(chan, NTV2_IS_FBF_RGB(fbf))); // SDIOut3 <== FB3
SD/HD YCbCr Playout From RGB Frame Buffer
// Example: Set up FrameStore3 for RGB playout, route to SDI 3...
theDevice.Connect (NTV2_XptCSC3VidInput, NTV2_XptFrameBuffer3RGB); // CSC3 <== FB3RGB
theDevice.Connect (NTV2_XptSDIOut3Input, NTV2_XptCSC3VidRGB); // SDIOut3 <== CSC3RGB
// Or, more generically...
theDevice.SetFrameBufferFormat (chan, fbf);
theDevice.SetMode (chan, NTV2_MODE_OUTPUT);
theDevice.Connect (::GetCSCInputXptFromChannel(chan), ::GetFrameBufferOutputXptFromChannel(chan, NTV2_IS_FBF_RGB(fbf))); // CSC3 <== FB3RGB
theDevice.Connect (::GetSDIOutputInputXpt(chan), ::GetCSCOutputXptFromChannel(chan)); // SDIOut3 <== CSC3RGB
HD RGB Playout Over 2 × 1.5G Dual-Link SDI From YCbCr Frame Buffer

TBD

HD RGB Playout Over 1 × 3G Dual-Link SDI From YCbCr Frame Buffer

TBD

HD RGB Playout Over 2 × 1.5G Dual-Link SDI From RGB Frame Buffer

TBD

HD RGB Playout Over 1 × 3G Dual-Link SDI From RGB Frame Buffer
// Example: Set up FrameStore3 for RGB playout, route to SDI 3...
theDevice.Connect (NTV2_XptDualLinkOut3Input, NTV2_XptFrameBuffer3RGB); // DLOut3 <== FB3RGB
theDevice.Connect (NTV2_XptSDIOut3Input, NTV2_XptDuallinkOut3); // SDIOut3 <== DLOut3
theDevice.Connect (NTV2_XptSDIOut3InputDS2, NTV2_XptDuallinkOut3DS2); // SDIOut3DS <== DLOut3DS
// Or, more generically...
theDevice.SetFrameBufferFormat (chan, fbf);
theDevice.SetMode (chan, NTV2_MODE_OUTPUT);
theDevice.Connect (::GetDLOutInputXptFromChannel(chan), ::GetFrameBufferOutputXptFromChannel(chan, NTV2_IS_FBF_RGB(fbf))); // DLOut3 <== FB3RGB
theDevice.Connect (::GetSDIOutputInputXpt(chan, false), ::GetDLOutOutputXptFromChannel(chan, false)); // SDIOut3 <== DLOut3
theDevice.Connect (::GetSDIOutputInputXpt(chan, true), ::GetDLOutOutputXptFromChannel(chan, true)); // SDIOut3DS <== DLOut3DS
HD HFR YCbCr Playout Over 2 × 3G SDI From YCbCr Frame Buffer

TBD

HD HFR YCbCr Playout Over 2 × 3G SDI From RGB Frame Buffer

TBD

2K×1080 YCbCr Playout Over 2 × 3G SDI From YCbCr Frame Buffer

TBD

HD HFR YCbCr Playout Over 2 × 3G SDI From RGB Frame Buffer

TBD

UHD/4K 4:2:2 YCbCr Playout Over 4 × 3G SDI (“Squares”)

TBD

UHD/4K 4:2:2 YCbCr Playout Over 4 × 3G SDI (“Two-Sample Interleave”)

TBD

UHD/4K 4:2:2 YCbCr Playout Over 2 × 6G SDI (“Two-Sample Interleave”)

TBD

UHD/4K 4:2:2 YCbCr Playout Over 1 × 12G SDI

TBD


End-to-End (E-E) Routing

This section shows how to programmatically set up a device for transmitting input video with a variety of latencies.

SD/HD YCbCr E-E (Sub-Frame Latency)

TBD

SD/HD YCbCr Frame Synchronizer (One-Frame Latency)

TBD

HD E-E Mix RGBA Graphic Over Live Video

with sub-frame latency TBD

HD HFR YCbCr E-E Over 2 × 1.5G Dual-Link SDI

TBD

HD HFR YCbCr E-E Over 1 × 3G Dual-Link SDI

TBD

E-E Over 2 × 3G SDI

TBD

E-E Over 1 × 6G SDI

TBD

4K and 8K Background

There is quite a history with 4K/Quad.  Since the introduction of 1.5G HD signaling, the SDI image size has quadrupled twice.

The first time from HD to UHD we called it “Quad“, since it required 4 × HD connections.  Initially, each link was a square division of the quad image –– so “quad squares”.

Then SMPTE devised TSI (a.k.a. 2SI or two-sample-interleaved), with each link carrying a subsample of the whole image, which we then called “Quad TSI”. To make TSI from a planar image requires a simple kind of muxing, so mux widgets were added to the firmware, which had to be routed before the FrameStore (for capture). For playback, demux widgets were added and must be routed after the FrameStore. We call this “TSI routing”.

The firmware could now do SD up to 4K of all the various SD, HD, and 3G SDI formats.  The kona4, Corvid 44 and Corvid 88 are good examples of devices that supported these 3G crosspoints and the full complement of TSI muxers/demuxers.

When 12G came along, we designed the KONA 5 and this same quadrupling started all over again.  The 8K/UHD2 firmware now has a 12G crosspoint, so we can route UHD signals like HD ones on the kona4.&nbsp; Initially UHD2 was square division too, and of course, SMPTE added TSI. These formats became “Quad-Quad Squares” and “Quad-Quad TSI” … only this time we built the muxers/demuxers into the FrameStores, which greatly simplifies the routing, and can be inferred from the format.

There is still a difference in the way FrameStores are routed to make “squares” and TSI work on the KONA 5 and Corvid 44 12G. Square division requires 4 FrameStores, since the “squares” are simultaneously read from different places in the image. TSI only requires 2 FrameStores, since it only reads from 2 lines at a time.

GetSDIOutputInputXpt
NTV2InputXptID GetSDIOutputInputXpt(const NTV2Channel inSDIOutput, const bool inIsDS2=false)
Definition: ntv2signalrouter.cpp:942
NTV2_FBF_ARGB
@ NTV2_FBF_ARGB
See 8-Bit ARGB, RGBA, ABGR Formats.
Definition: ntv2enums.h:212
NTV2_XptSDIOut3InputDS2
@ NTV2_XptSDIOut3InputDS2
Definition: ntv2enums.h:2737
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific Frame Store. They're also commonly used to i...
Definition: ntv2enums.h:1305
NTV2_XptFrameBuffer3YUV
@ NTV2_XptFrameBuffer3YUV
Definition: ntv2enums.h:2515
NTV2FrameBufferFormat
NTV2FrameBufferFormat
Identifies a particular video frame buffer format. See Device Frame Buffer Formats for details.
Definition: ntv2enums.h:207
NTV2_XptFrameBuffer3RGB
@ NTV2_XptFrameBuffer3RGB
Definition: ntv2enums.h:2516
NTV2_XptCSC3VidRGB
@ NTV2_XptCSC3VidRGB
Definition: ntv2enums.h:2535
NTV2_IS_FBF_RGB
#define NTV2_IS_FBF_RGB(__fbf__)
Definition: ntv2enums.h:271
NTV2_XptDuallinkOut3
@ NTV2_XptDuallinkOut3
Definition: ntv2enums.h:2530
GetCSCOutputXptFromChannel
NTV2OutputXptID GetCSCOutputXptFromChannel(const NTV2Channel inCSC, const bool inIsKey=false, const bool inIsRGB=false)
Definition: ntv2signalrouter.cpp:819
CNTV2Card::Connect
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=false)
Connects the given widget signal input (sink) to the given widget signal output (source).
Definition: ntv2regroute.cpp:87
NTV2_CHANNEL3
@ NTV2_CHANNEL3
Specifies channel or Frame Store 3 (or the 3rd item).
Definition: ntv2enums.h:1309
NTV2_XptCSC3VidInput
@ NTV2_XptCSC3VidInput
Definition: ntv2enums.h:2708
GetCSCInputXptFromChannel
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
Definition: ntv2signalrouter.cpp:775
NTV2_FBF_10BIT_YCBCR
@ NTV2_FBF_10BIT_YCBCR
See 10-Bit YCbCr Format.
Definition: ntv2enums.h:210
GetFrameBufferOutputXptFromChannel
NTV2OutputXptID GetFrameBufferOutputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsRGB=false, const bool inIs425=false)
Definition: ntv2signalrouter.cpp:845
NTV2_XptDualLinkOut3Input
@ NTV2_XptDualLinkOut3Input
Definition: ntv2enums.h:2766
NTV2_MODE_OUTPUT
@ NTV2_MODE_OUTPUT
Output (playout, display) mode, which reads from device SDRAM.
Definition: ntv2enums.h:1201
GetDLOutInputXptFromChannel
NTV2InputXptID GetDLOutInputXptFromChannel(const NTV2Channel inDLOutWidget)
Definition: ntv2signalrouter.cpp:808
CNTV2Card::SetFrameBufferFormat
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=true, NTV2HDRXferChars inXferChars=NTV2_VPID_TC_SDR_TV, NTV2HDRColorimetry inColorimetry=NTV2_VPID_Color_Rec709, NTV2HDRLuminance inLuminance=NTV2_VPID_Luminance_YCbCr)
Sets the frame buffer format for the given FrameStore on the AJA device.
Definition: ntv2register.cpp:1828
CNTV2Card::SetMode
virtual bool SetMode(const NTV2Channel inChannel, const NTV2Mode inNewValue, const bool inIsRetail=true)
Determines if a given FrameStore on the AJA device will be used to capture or playout video.
Definition: ntv2register.cpp:1613
NTV2_XptSDIOut3Input
@ NTV2_XptSDIOut3Input
Definition: ntv2enums.h:2736
GetDLOutOutputXptFromChannel
NTV2OutputXptID GetDLOutOutputXptFromChannel(const NTV2Channel inDLOutput, const bool inIsLinkB=false)
Definition: ntv2signalrouter.cpp:905
NTV2_XptDuallinkOut3DS2
@ NTV2_XptDuallinkOut3DS2
Definition: ntv2enums.h:2531