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

18.6. FIR Filter IP Software API

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

Register definition header file: intel_vvp_fir_regs.h

Include file: intel_vvp_fir.h

Table 275.  Frame Cleaner IP Software API
Name Description
intel_vvp_fir_init Initialize the FIR Filter instance
Intel_vvp_core_* Accessors defined in Video and Vision Processing IPs Software Programming Model
intel_vvp_fir_get_lite_mode Returns if lite mode is on.
intel_vvp_fir_get_debug_enabled Returns if debug features is on.
intel_vvp_fir_uses_fixed_coeffs Returns whether the IP uses a static or reprogrammable set of coefficients
intel_vvp_fir_get_max_width Returns the maximum supported width
intel_vvp_fir_get_max_height Returns the maximum supported height
intel_vvp_fir_get_bits_per_sample_in Returns the number of bits per color sample for the input interface
intel_vvp_fir_get_bits_per_sample_out Returns the number of bits per color sample for the output interface
intel_vvp_fir_get_num_h_taps Returns the width of the FIR kernel
intel_vvp_fir_get_num_v_taps Returns the height of the FIR kernel
intel_vvp_fir_has_horizontal_symmetry Returns if the FIR coefficients are symmetrical in the horizontal dimension
intel_vvp_fir_has_vertical_symmetry Returns if the FIR coefficients are symmetrical in the vertical dimension
intel_vvp_fir_has_diagonal_symmetry Returns if the FIR coefficients are diagonally symmetric
intel_vvp_fir_get_num_coeffs Returns the number of unique FIR coefficients once symmetries are considered
intel_vvp_fir_are_coeffs_signed Returns the signed/unsigned status of coefficients
intel_vvp_fir_get_coeffs_int_bits Returns the number of integer bits used for coefficients (sign bit excluded)
intel_vvp_fir_get_coeffs_frac_bits Returns the number of fractional bits used for filter coefficients
intel_vvp_fir_get_binary_point_right_move Returns the left/right binary point move applied to the computation
intel_vvp_fir_get_rounding_method Returns the rounding algorithm used for the final floating-point to integer conversion
intel_vvp_fir_is_running Returns if the IP is currently processing video data
intel_vvp_fir_get_status Reads the status register
intel_vvp_fir_set_quantized_coeffs Programs the FIR Filter with a set of quantized coefficients
intel_vvp_fir_set_coeffs Quantizes a set of floating-point coefficients and programs the FIR Filter.

enum eIntelVvpFirRounding

Members

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

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

kIntelVvpFirRoundTruncate (3) – Truncation (no rounding)

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

Description
Enumeration for the rounding method used by the IP

intel_vvp_fir_init

Prototype
 int intel_vvp_fir_init(intel_vvp_fir_instance *instance, intel_vvp_core_base base);
Description
Initializes a FIR Filter 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 is not fully initialized and the application should not use it further if returning a non-zero error code.
Argument

instance – pointer to the intel_vvp_fir_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 FIR Filter product ID

kIntelVvpCoreInstanceErr if the instance is a null pointer

kIntelVvpFirRegMapVersionErr if the register map is not supported

intel_vvp_fir_get_lite_mode

Prototype
 bool intel_vvp_fir_get_lite_mode(intel_vvp_fir_instance *instance);
Description
Returns the value of the LITE_MODE register. The instance must be a valid intel_vvp_fir_instance fully initialized
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
true if the IP is parameterized in lite mode

intel_vvp_fir_get_debug_enabled

Prototype
bool intel_vvp_fir_get_debug_enabled(intel_vvp_fir_instance *instance);
Description
Returns the value of the DEBUG_ENABLED register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
true if the IP is parameterized with debug features enabled

Intel_vvp_fir_uses_fixed_coeffs

Prototype
bool intel_vvp_fir_uses_fixed_coeffs(intel_vvp_fir_instance *instance);
Description
Returns the value of the USES_FIXED_COEFFS register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
True if the FIR Filter is configured with static compile-time coefficients, false if coefficients are programmed at run time

intel_vvp_fir_get_max_width

Prototype
uint32_t intel_vvp_fir_get_max_width(intel_vvp_fir_instance *instance);
Description
Returns the value of the MAX_WIDTH register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
Maximum supported width

intel_vvp_fir_get_max_height

Prototype
uint32_t intel_vvp_fir_get_max_height(intel_vvp_fir_instance *instance);
Description
Returns the value of the MAX_HEIGHT register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
Maximum supported height

intel_vvp_fir_get_bits_per_sample_in

Prototype
uint8_t intel_vvp_fir_get_bits_per_sample_in (intel_vvp_fir_instance *instance);
Description
Returns the value of the BPS_IN register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
Number of bits per color samples for the input interface

intel_vvp_fir_get_bits_per_sample_out

Prototype
uint8_t intel_vvp_fir_get_bits_per_sample_out(intel_vvp_fir_instance *instance);
Description
Returns the value of the BPS_OUT register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
Number of bits per color samples for the output interface

intel_vvp_fir_get_num_h_taps

Prototype
uint8_t intel_vvp_fir_get_num_h_taps (intel_vvp_fir_instance *instance);
Description
Returns the value of the NUM_H_TAPS register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
The width of the 2D FIR kernel

intel_vvp_fir_get_num_v_taps

Prototype
uint8_t intel_vvp_fir_get_num_v_taps (intel_vvp_fir_instance *instance);
Description
Returns the value of the NUM_V_TAPS register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
The height of the 2D FIR kernel

intel_vvp_fir_has_horizontal_symmetry

Prototype
bool intel_vvp_fir_has_horizontal_symmetry(intel_vvp_fir_instance *instance);
Description
Returns the value of the HORIZONTAL_SYM register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
Whether the 2D FIR kernel is symmetrical horizontally

intel_vvp_fir_has_vertical_symmetry

Prototype
bool intel_vvp_fir_has_vertical_symmetry(intel_vvp_fir_instance *instance);
Description
Returns the value of the VERTICAL_SYM register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
Whether the 2D FIR kernel is symmetrical vertically

intel_vvp_fir_has_diagonal_symmetry

Prototype
bool intel_vvp_fir_has_diagonal_symmetry(intel_vvp_fir_instance *instance);
Description
Returns the value of the DIAGONAL_SYM register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
Whether the 2D FIR kernel is symmetrical diagonally

intel_vvp_fir_get_num_coeffs

Prototype
 uint8_t intel_vvp_fir_get_num_coeffs(intel_vvp_fir_instance* instance);
Description
Deduce the number of unique coefficients used by the FIR kernel from the kernel dimensions and the symmetries.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
The number of unique coefficients used to program the FIR

intel_vvp_fir_are_coeffs_signed

Prototype
bool intel_vvp_fir_are_coeffs_signed(intel_vvp_fir_instance* instance);
Description
Returns the value of the COEFFS_SIGNED register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
Whether the 2D FIR coefficients have a sign bit

intel_vvp_fir_get_coeffs_int_bits

Prototype
bool intel_vvp_fir_get_coeffs_int_bits (intel_vvp_fir_instance* instance);
Description
Returns the value of the COEFFS_INT_BITS register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
The number of integer bits used by fixed-point coefficients

intel_vvp_fir_get_coeffs_frac_bits

Prototype
bool intel_vvp_fir_get_coeffs_frac_bits (intel_vvp_fir_instance* instance);
Description
Returns the value of the COEFFS_FRAC_BITS register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
The number of fractional bits used by fixed-point coefficients

intel_vvp_fir_get_binary_point_right_move

Prototype
int8_t intel_vvp_fir_get_binary_point_right_move(intel_vvp_fir_instance* instance);
Description
Returns the value of the BINARY_POINT_RIGHT_MOVE register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
The number of bits to the right used to move the binary point

intel_vvp_fir_get_rounding_method

Prototype
eIntelVvpFirRounding intel_vvp_fir_get_rounding_method(intel_vvp_fir_instance* instance);
Description
Returns the value of the ROUND_METHOD register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
The rounding algorithm used to convert fixed-point values back to integer values at the output of the FIR.

intel_vvp_fir_is_running

Prototype
bool intel_vvp_fir_is_running(intel_vvp_fir_instance* instance);
Description
Reads and returns the running bit of the STATUS register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
True is the IP is currently generating an output field, false when between two fields

intel_vvp_fir_get_status

Prototype
uint8_t intel_vvp_fir_get_status(intel_vvp_tpg_instance* instance);
Description
Reads and returns the STATUS register. The instance must be a valid intel_vvp_fir_instance fully initialized.
Argument
instance – pointer to the intel_vvp_fir_instance software driver instance structure
Returns
The value read from the status register

intel_vvp_fir_set_quantized_coeffs

Prototype
 int intel_vvp_fir_set_quantized_coeffs(intel_vvp_fir_instance* instance, const int32_t* quantized_coeffs, uint8_t num_coeffs);
Description
Programs the IP with a new set of coefficients for the FIR kernel. An error is returned if the IP is not properly configured to use these coefficients. The num_coeffs parameter indicates the size of the quantized_coeffs array and must match with the number of unique coefficients in the 2D kernel once symmetries are considered. Also, 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. Invalid quantized values do not prevent the coefficients from being updated
Argument

instance – pointer to the intel_vvp_fir_instance software driver instance structure

quantized_coeffs – pointer to the array containing the set of quantized coefficients

num_coeffs – the number of coefficients in the array. This must match with the number of expected coefficients: intel_vvp_fir_get_num_coeffs(instance)

Returns

kIntelVvpCoreOk in case of success, negative error code otherwise

kIntelVvpCoreInstanceErr if the instance is invalid, or not configured for run-time loading of coefficients

kIntelVvpFirParameterErr if the number of coefficients does not match with the IP configuration

kIntelVvpCoreNullPtrErr if quantized_coeffs is a NULL pointer

kIntelVvpFirQuantizationErr if the quantized coefficients are out-of-range (this does not prevent the coefficients update)

intel_vvp_fir_set_coeffs

Prototype
int intel_vvp_fir_set_coeffs(intel_vvp_fir_instance* instance, const float* coeffs, uint8_t num_coeffs);
Description
Programs the IP with a new set of coefficients for the FIR kernel. Coefficients are quantized using the fixed-point configuration reported by the IP. An error is returned if the IP is not properly configured to use these coefficients. The num_coeffs parameter indicates the size of the coeffs array and must match with the number of unique coefficients in the 2D kernel once symmetries are considered. An error is returned if the quantization could not be achieved successfully.
Argument

instance – pointer to the intel_vvp_fir_instance software driver instance structure

coeffs – pointer to the array containing the set of floating-point coefficients

num_coeffs – the number of coefficients in the array. This must match with the number of expected coefficients: intel_vvp_fir_get_num_coeffs(instance)

Returns

kIntelVvpCoreOk in case of success, negative error code otherwise

kIntelVvpCoreInstanceErr if the instance is invalid, or not configured for run-time loading of coefficients

kIntelVvpFirParameterErr if the number of coefficients does not match with the IP configuration

kIntelVvpCoreNullPtrErr if coeffs is a NULL pointer

kIntelVvpFirQuantizationErr if the quantized coefficients are out-of-range (this does not prevent the coefficients update)