Video and Vision Processing Suite Intel® FPGA IP User Guide

ID 683329
Date 9/30/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents
1. About the Video and Vision Processing Suite 2. Getting Started with the Video and Vision Processing IPs 3. Video and Vision Processing IPs Functional Description 4. Video and Vision Processing IP Interfaces 5. Video and Vision Processing IP Registers 6. Video and Vision Processing IPs Software Programming Model 7. Protocol Converter Intel® FPGA IP 8. 3D LUT Intel® FPGA IP 9. AXI-Stream Broadcaster Intel® FPGA IP 10. Chroma Key Intel® FPGA IP 11. Chroma Resampler Intel® FPGA IP 12. Clipper Intel® FPGA IP 13. Clocked Video Input Intel® FPGA IP 14. Clocked Video to Full-Raster Converter Intel® FPGA IP 15. Clocked Video Output Intel® FPGA IP 16. Color Space Converter Intel® FPGA IP 17. Deinterlacer Intel® FPGA IP 18. FIR Filter Intel® FPGA IP 19. Frame Cleaner Intel® FPGA IP 20. Full-Raster to Clocked Video Converter Intel® FPGA IP 21. Full-Raster to Streaming Converter Intel® FPGA IP 22. Generic Crosspoint Intel® FPGA IP 23. Genlock Signal Router Intel® FPGA IP 24. Guard Bands Intel® FPGA IP 25. Interlacer Intel® FPGA IP 26. Mixer Intel® FPGA IP 27. Pixels in Parallel Converter Intel® FPGA IP 28. Scaler Intel® FPGA IP 29. Stream Cleaner Intel® FPGA IP 30. Switch Intel® FPGA IP 31. Tone Mapping Operator Intel® FPGA IP 32. Test Pattern Generator Intel® FPGA IP 33. Video Frame Buffer Intel® FPGA IP 34. Video Streaming FIFO Intel® FPGA IP 35. Video Timing Generator Intel® FPGA IP 36. Warp Intel® FPGA IP 37. Design Security 38. Document Revision History for Video and Vision Processing Suite User Guide

16.5. Color Space Converter IP Software API

The IP includes software for run-time control. The IP does not fit any of the generic device models provided by the Nios II HAL and it exposes a set of dedicated accessors to the control and status registers. The IP driver structure inherits the base driver structure so all common methods defined in Video and Vision Processing IPs Software API are applicable.

Register definition header file: intel_vvp_csc_regs.h

Include file: intel_vvp_csc.h

Table 250.  Color Space Converter IP Software API
Name Description
intel_vvp_csc_init Initialize the Color Space Converter instance
Intel_vvp_core_* Accessors defined in Video and Vision Processing IPs Software Programming Model. Writable when Lite is on. Readable when Lite is off and Debug features is on.
intel_vvp_csc_get_lite_mode Returns if Lite mode is on
intel_vvp_csc_get_debug_enabled Returns if Debug features is on

intel_vvp_csc_get_bits_per_sample_in

Returns the number of input bits per color sample

intel_vvp_csc_get_bits_per_sample_out

Returns the number of output bits per color sample
intel_vvp_csc_are_coeffs_signed Returns if the nine coefficients have a sign bit and can be negative

intel_vvp_csc_get_coeffs_int_bits

Returns the number of integer bits (excluding sign bit) available to quantize coefficients
intel_vvp_csc_are_summands_signed Returns if the three summands have a sign bit and can be negative

intel_vvp_csc_get_summands_int_bits

Returns the number of integer bits (excluding sign bit) available to quantize summands

intel_vvp_csc_get_coeffs_frac_bits

Returns the number of fractional bits available to quantize both coefficients and summands
intel_vvp_csc_get_binary_point_right_move Returns the fixed scaling factor applied to values at the output of the IP
intel_vvp_csc_get_rounding_method Returns the method used to convert floating-point values back to integer values at the output of the IP
intel_vvp_csc_is_running Returns if the IP is currently processing video data
intel_vvp_csc_get_commit_status Returns if there are uncommitted writes
intel_vvp_csc_get_status Reads the status register
intel_vvp_csc_set_quantized_coeff_data Program the IP with a new set of quantized coefficients/summands
intel_vvp_csc_get_quantized_coeff_data Retrieve the set of quantized coefficients/summands programmed into the IP
intel_vvp_csc_set_coeff_data Program the IP with a new set of floating-point coefficients/summands
intel_vvp_csc_get_coeff_data Retrieve the set of floating-point coefficients/summands programmed into the IP
intel_vvp_csc_set_output_color_space Selects the current output color space (full mode)
intel_vvp_csc_get_output_color_space Returns the current output color space (full mode)
intel_vvp_csc_commit_writes Commit all outstanding writes

enum eIntelVvpCscRounding

Members

kIntelVvpCscRoundUp (1) – Rounding up (half up towards positive infinity)

kIntelVvpCscRoundHalfEven (2) – Rounding half to even (bankers’ rounding)

kIntelVvpCscRoundTruncate (3) – Truncation (no rounding)

kIntelVvpCscRoundInvalid (-1) – Invalid rounding method (used to indicate errors)

Description

Enumeration for the rounding method used by the IP

enum eIntelVvpCscColorSpace

Members

kIntelVvpCsRgb (0) – Rounding up (half up towards positive infinity)

kIntelVvpCsYcc (1) – Rounding half to even (bankers’ rounding)

kIntelVvpCsMono (2) – Truncation (no rounding)

kIntelVvpCscRoundInvalid (-1) – Invalid rounding method (used to indicate errors)

Description

Enumeration for the rounding method used by the IP

struct intel_vvp_coefficients

Members

struct { float c1; float c2; float c3; } coeffs[3]; – Matrix of 9 coefficients

float s[3] – Vector of 3 summands

Description

The coefficients and summands as floating-point values

struct intel_vvp_quantized_coefficients

Members

struct { int32_t c1; int32_t c2; int32_t c3; } coeffs[3]; – Matrix of 9 coefficients

int32_t s[3] – Vector of 3 summands

Description

The coefficients and summands as quantized integer values

intel_vvp_csc_init

Prototype
 int intel_vvp_csc_init(intel_vvp_csc_instance *instance, intel_vvp_core_base base);
Description

Initializes a Color Space Converter instance. The initialization stops early if the vendor ID or product ID read at the base address are not a match or if the register map version is not supported. Otherwise, the function proceeds to read and store the IP compile-time parameterization. The instance does not fully initialized and should not be used further by the application if returning a non-zero error code.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

base – base address of the register map

Returns

kIntelVvpCoreOk (0) in case of success, a negative error code in case of error

kIntelVvpCoreVidErr if the vendor id of the core is not the IntelFPGA vendor ID (0x6AF7).

kIntelVvpCorePidErr if the product_id does not match with the Color Space Converter product ID

kIntelVvpCoreInstanceErr if the instance is a null pointer

kIntelVvpCrsRegMapVersionErr if the register map is not supported

intel_vvp_csc_get_lite_mode

Prototype
 bool intel_vvp_csc_get_lite_mode(intel_vvp_csc_instance *instance);
Description

Returns the value of the LITE_MODE register. The instance must be a valid intel_vvp_csc_instance fully initialized

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

true if the IP is parameterized in lite mode

intel_vvp_csc_get_debug_enabled

Prototype
 bool intel_vvp_csc_get_debug_enabled(intel_vvp_csc_instance *instance);
Description

Returns the value of the DEBUG_ENABLED register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

true if the IP is parameterized with debug features enabled

intel_vvp_csc_get_bits_per_sample_in

Prototype
 uint8_t intel_vvp_csc_get_bits_per_sample_in(intel_vvp_csc_instance *instance);
Description

Returns the value of the BPS_IN register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

the input bits per sample parameter used to generate the IP.

intel_vvp_csc_get_bits_per_sample_out

Prototype
 uint8_t intel_vvp_csc_get_bits_per_sample_out(intel_vvp_csc_instance *instance);
Description

Returns the value of the BPS_OUT register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

the output bits per sample parameter used to generate the IP.

intel_vvp_csc_are_coeffs_signed

Prototype
 bool intel_vvp_csc_are_coeffs_signed(intel_vvp_csc_instance* instance);
Description

Returns the value of the COEFFS_SIGNED register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

If signed coefficients have been allowed at IP generation time.

intel_vvp_csc_get_coeffs_int_bits

Prototype
 uint8_t intel_vvp_csc_get_coeffs_int_bits (intel_vvp_csc_instance *instance);
Description

Returns the value of the COEFFS_INT_BITS register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

the number of integer bits set at IP generation time to parameterize the quantization of the coefficients

intel_vvp_csc_are_summands_signed

Prototype
 bool intel_vvp_csc_are_summands_signed(intel_vvp_csc_instance* instance);
Description

Returns the value of the SUMMANDS_SIGNED register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

If signed summands have been allowed at IP generation time.

intel_vvp_csc_get_summands_int_bits

Prototype
 uint8_t intel_vvp_csc_get_summands_int_bits (intel_vvp_csc_instance *instance);
Description

Returns the value of the SUMMANDS_INT_BITS register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

the number of integer bits set at IP generation time to parameterize the quantization of the summands

intel_vvp_csc_get_coeffs_frac_bits

Prototype
 uint8_t intel_vvp_csc_get_coeffs_frac_bits (intel_vvp_csc_instance *instance);
Description

Returns the value of the FRAC_BITS register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

the number of fractional bits set at IP generation time to parameterize the quantization of the coefficients and summands

intel_vvp_csc_get_binary_point_right_move

Prototype
 int8_t intel_vvp_csc_get_binary_point_right_move(intel_vvp_csc_instance *instance);
Description

Returns the value of the BINARY_POINT_RIGHT_MOVE register. The fixed scaling factor applied to the IP output samples and selected at IP generation time. Output values are scaled by 2^(binary_point_right_move). This is usually done to account for differences between bps_in and bps_out. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

The binary_point_right_move value selected at generation time

intel_vvp_csc_get_rounding_method

Prototype
 eIntelVvpCscRounding intel_vvp_csc_get_rounding_method(intel_vvp_csc_instance *instance);
Description

Returns the value of the ROUND_METHOD register. The instance must be a valid intel_vvp_csc_instance fully initialized. This is the method to convert fixed-point values to integer values at the end of the CSC processing.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

The IP rounding method.

intel_vvp_csc_is_running

Prototype
 bool intel_vvp_csc_is_running(intel_vvp_csc_instance* instance);
Description

Reads and returns the running bit of the STATUS register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

True is the IP is currently receiving/storing an input field, false when between two input fields

intel_vvp_csc_get_commit_status

Prototype
 bool intel_vvp_csc_get_commit_status(intel_vvp_csc_instance* instance);
Description

Reads and returns the commit pending bit of the STATUS register. The instance must be a valid intel_vvp_csc_instance fully initialized and configured in full mode.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

True is the IP is configured in full mode and if the agent interface contains uncommitted writes.

intel_vvp_csc_get_status

Prototype
 uint32_t intel_vvp_csc_get_status(intel_vvp_csc_instance* instance);
Description

Reads the STATUS register. The instance must be a valid intel_vvp_csc_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

The content of the STATUS register

intel_vvp_csc_set_quantized_coeff_data

Prototype
 int intel_vvp_csc_set_quantized_coeff_data(intel_vvp_csc_instance* instance, const intel_vvp_quantized_coefficients* quantized_coeffs);
Description

Programs the IP with the set of coefficients and summands. The call checks for correctness of the quantized values and returns an error if invalid bits are set. Sign extension to the full 32 bit range is accepted. Quantization errors do not prevent the coefficients from being updated

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

quantized_coeffs – pointer to the structure containing the 9 quantized coefficients and summands

Returns

kIntelVvpCoreOk in case of success, negative error code otherwise

kIntelVvpCoreInstanceErr if the instance is invalid

kIntelVvpCoreNullPtrErr if quantized_coeffs is a NULL pointer

kIntelVvpCscQuantizationErr if the quantized coefficients/summands are out-of-range

intel_vvp_csc_get_quantized_coeff_data

Prototype
 int intel_vvp_csc_get_quantized_coeff_data(intel_vvp_csc_instance* instance, intel_vvp_quantized_coefficients* quantized_coeffs)
Description

Reads and returns the current set of coefficients programmed in the IP. The instance must be a valid intel_vvp_csc_instance fully initialized and configured with debug enabled.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

quantized_coeffs – storage space to return the quantized coefficients

Returns

kIntelVvpCoreOk or a negative error code in case of error

kIntelVvpCoreInstanceErr, if the instance is invalid

kIntelVvpCoreNullPtrErr, if quantized_coeffs is the NULL pointer

intel_vvp_csc_set_coeff_data

Prototype
 int intel_vvp_csc_set_coeff_data(intel_vvp_csc_instance* instance, const intel_vvp_coefficients* coeffs, int summand_rescale);
Description

Programs the IP with the set of coefficients and summands. The call quantizes the user-defined floating-point coefficients and returns an error if values are out-of-range. Quantization errors do not prevent the coefficients from being updated

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

coeffs – pointer to the structure containing the 9 floating-point coefficients and 3 summands

summand_rescale – scaling factor (2^summand_rescale) applied to the input summand values. Non-zero values are typically used when using a ready-made conversion table designed for a number of bits per color sample that does not match with the input bits per sample value used to parameterize the IP

Returns

kIntelVvpCoreOk in case of success, negative error code otherwise

kIntelVvpCoreInstanceErr if the instance is invalid

kIntelVvpCoreNullPtrErr if coeffs is a NULL pointer

kIntelVvpCscQuantizationErr if the coefficients/summands are out-of-range and cannot be quantized accurately

intel_vvp_csc_get_coeff_data

Prototype
int intel_vvp_csc_get_coeff_data(intel_vvp_csc_instance* instance, intel_vvp_coefficients* coeffs)
Description

Reads and returns the current set of coefficients programmed in the IP. The instance must be a valid intel_vvp_csc_instance fully initialized and configured with debug enabled. Coefficients are converted back to floating-point values before being returned.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

coeffs – storage space to return the floating-point coefficients

Returns

kIntelVvpCoreOk or a negative error code in case of error

kIntelVvpCoreInstanceErr, if the instance is invalid

kIntelVvpCoreNullPtrErr, if coeffs is the NULL pointer

intel_vvp_csc_set_output_colorspace

Prototype
 int intel_vvp_csc_set_output_colorspace(intel_vvp_csc_instance* instance, int8_t output_color_space);
Description

Writes the required output colorspace to the OUTPUT_CS register. The instance must be a valid intel_vvp_csc_instance fully initialized and configured in full mode.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

output_color_space – a colorspace code

Returns

kIntelVvpCoreOk or a negative error code in case of error

kIntelVvpCoreInstanceErr, if the instance is invalid

kIntelVvpCrsParamErr, if the output colorspace is invalid (<0)

intel_vvp_csc_get_output_colorspace

Prototype

int8_t intel_vvp_csc_get_output_colorspace(intel_vvp_csc_instance* instance);

Description
 Reads the OUTPUT_CS register. The instance must be a valid intel_vvp_csc_instance fully initialized and configured in full mode with debug enabled.
Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

the last value written to the OUTPUT_CS register, negative value in case of errors

intel_vvp_csc_commit_writes

Prototype
int intel_vvp_csc_commit_writes(intel_vvp_csc_instance* instance)
Description

Commits all pending writes before processing the next field. The instance must be valid and parameterized in full mode.

Arguments

instance – pointer to the intel_vvp_csc_instance software driver instance structure

Returns

kIntelVvpCoreOk (0) for success, negative error code otherwise