Video and Vision Processing Suite Intel® FPGA IP User Guide

ID 683329
Date 4/01/2024
Public
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. 1D LUT Intel® FPGA IP 9. 3D LUT Intel® FPGA IP 10. AXI-Stream Broadcaster Intel® FPGA IP 11. Bits per Color Sample Adapter Intel FPGA IP 12. Black Level Correction Intel® FPGA IP 13. Black Level Statistics Intel® FPGA IP 14. Chroma Key Intel® FPGA IP 15. Chroma Resampler Intel® FPGA IP 16. Clipper Intel® FPGA IP 17. Clocked Video Input Intel® FPGA IP 18. Clocked Video to Full-Raster Converter Intel® FPGA IP 19. Clocked Video Output Intel® FPGA IP 20. Color Plane Manager Intel® FPGA IP 21. Color Space Converter Intel® FPGA IP 22. Defective Pixel Correction Intel® FPGA IP 23. Deinterlacer Intel® FPGA IP 24. Demosaic Intel® FPGA IP 25. FIR Filter Intel® FPGA IP 26. Frame Cleaner Intel® FPGA IP 27. Full-Raster to Clocked Video Converter Intel® FPGA IP 28. Full-Raster to Streaming Converter Intel® FPGA IP 29. Genlock Controller Intel® FPGA IP 30. Generic Crosspoint Intel® FPGA IP 31. Genlock Signal Router Intel® FPGA IP 32. Guard Bands Intel® FPGA IP 33. Histogram Statistics Intel® FPGA IP 34. Interlacer Intel® FPGA IP 35. Mixer Intel® FPGA IP 36. Pixels in Parallel Converter Intel® FPGA IP 37. Scaler Intel® FPGA IP 38. Stream Cleaner Intel® FPGA IP 39. Switch Intel® FPGA IP 40. Tone Mapping Operator Intel® FPGA IP 41. Test Pattern Generator Intel® FPGA IP 42. Unsharp Mask Intel® FPGA IP 43. Video and Vision Monitor Intel FPGA IP 44. Video Frame Buffer Intel® FPGA IP 45. Video Frame Reader Intel FPGA IP 46. Video Frame Writer Intel FPGA IP 47. Video Streaming FIFO Intel® FPGA IP 48. Video Timing Generator Intel® FPGA IP 49. Vignette Correction Intel® FPGA IP 50. Warp Intel® FPGA IP 51. White Balance Correction Intel® FPGA IP 52. White Balance Statistics Intel® FPGA IP 53. Design Security 54. Document Revision History for Video and Vision Processing Suite User Guide

46.5. Video Frame Writer 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_vfw_regs.h

Include file: intel_vvp_vfw.h

Table 910.  Video Frame Writer IP Software API
Name Description
intel_vvp_vfw_init Initialize the Frame Writer 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_vfw_get_lite_mode Returns if Lite mode is on
intel_vvp_vfw_get_debug_enabled Returns if Debug features is on
intel_vvp_vfw_get_max_height Returns the maximum supported height
intel_vvp_vfw_get_max_width Returns the maximum supported width
intel_vvp_vfw_get_bps Returns the number of bits per color sample
intel_vvp_vfw_get_number_of_color_planes Returns the number of color planes per pixel
intel_vvp_vfw_get_pixels_in_parallel Returns the number of pixels streamed in parallel
intel_vvp_vfw_get_mem_word_packing Returns the algorithm used for pixels packing in memory
intel_vvp_vfw_is_running Returns if the IP is currently processing video data
intel_vvp_vfw_get_commit_status Returns if there are uncommitted writes
intel_vvp_vfw_get_status Reads the status register
intel_vvp_vfw_is_buffer_available Returns if a field has been buffered to memory
intel_vvp_vfw_get_buffer_write_count Returns the number of fields written to memory
intel_vvp_vfw_get_buffer_start_addr Returns the base address in memory of the last buffer made available
intel_vvp_vfw_is_buffer_f1 Returns whether the field in the last buffer made available is a F1 field
intel_vvp_vfw_get_buffer_width Returns the field width for the last buffer made available
intel_vvp_vfw_get_buffer_height Returns the field height for the last buffer made available
intel_vvp_vfw_get_field_count Returns the field_count field extracted from the last image info packet (full variant only)
intel_vvp_vfw_acknowledge_buffer Acknowledges a newly written buffer
intel_vvp_vfw_set_run_mode Changes the run mode
intel_vvp_vfw_get_run_mode Returns the run mode
intel_vvp_vfw_set_num_buffers Sets the number of buffers in use
intel_vvp_vfw_get_num_buffers Returns the number of buffers in use
intel_vvp_vfw_set_base_addr Sets the base address for the first buffer in memory
intel_vvp_vfw_get_base_addr Returns the base address of the first buffer in memory
intel_vvp_vfw_set_inter_buffer_offset Sets the offset between field buffers in memory
intel_vvp_vfw_get_inter_buffer_offset Returns the offset between field buffers in memory
intel_vvp_vfw_set_inter_line_offset Sets the offset between lines in memory
intel_vvp_vfw_get_inter_line_offset Returns the offset between lines in memory
intel_vvp_vfw_set_irq_line_threshold Selects the line threshold used to fire the interrupt
intel_vvp_vfw_get_irq_line_threshold Returns the line threshold used to fire the interrupt
intel_vvp_vfw_overwrite_broken_fields Selects the overwrite behavior for broken fields
intel_vvp_vfw_get_overwrite_broken_fields Returns if broken fields are overwritten
intel_vvp_vfw_commit_writes Commit all outstanding writes

enum eIntelVvpVfwPacking

Members

kIntelVvpVfwPerfectPacking (0) - Perfect sample packing (no bits wasted)

kIntelVvpVfwColorPacking (1) - Color sample packing (color samples are not split across memory words)

kIntelVvpVfwPixelPacking (2) - Pixel packing (pixels are not split across memory words)

kIntelVvpVfwInvalidPacking (-1) - Invalid packing algorithm (used to indicate errors)

Description

Enumeration for the configurable sample packing in memory algorithms

enum eIntelVvpVfwRunMode

Members

kIntelVvpVfwStop (0) - Frame Writer is stopped

kIntelVvpVfwFreeRunning (1) - Frame Writer proceeds in a round-robin scheme using all available buffers

kIntelVvpVfwSingleShot (3) - Frame Writer proceeds and stops once all buffers have been written once

kIntelVvpVfwInvalidRunMode (-1) – Invalid value (used to indicate errors)

Description

Enumeration for the various write methods

intel_vvp_vfw_init

Prototype
int intel_vvp_vfw_init(intel_vvp_vfw_instance *instance, intel_vvp_core_base base);
Description

Initializes a Frame Writer 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.

Arguments

instance - pointer to the intel_vvp_vfw_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 Frame Writer product ID

kIntelVvpCoreInstanceErr if the instance is a null pointer

kIntelVvpFrameWriterRegMapVersionErr if the register map is not supported

intel_vvp_vfw_get_lite_mode

Prototype
bool intel_vvp_vfw_get_lite_mode(intel_vvp_vfw_instance *instance);
Description

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

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

true if the IP is parameterized in lite mode

intel_vvp_vfw_get_debug_enabled

Prototype
 bool intel_vvp_vfw_get_debug_enabled(intel_vvp_vfw_instance *instance);
Description

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

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

true if the IP is parameterized with debug features enabled

intel_vvp_vfw_get_max_height

Prototype
 uint32_t intel_vvp_vfw_get_max_height(intel_vvp_vfw_instance *instance);
Description

Returns the value of the MAX_HEIGHT register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

The maximum supported height set at configuration

intel_vvp_vfw_get_max_width

Prototype
 uint32_t intel_vvp_vfw_get_max_width(intel_vvp_vfw_instance *instance);
Description

Returns the value of the MAX_WIDTH register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

The maximum supported width set at configuration

intel_vvp_vfw_get_bps

Prototype
 uint8_t intel_vvp_vfw_get_bps(intel_vvp_vfw_instance *instance);
Description

Returns the value of the BPS register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

the number of bits per color sample selected at configuration

intel_vvp_vfw_get_number_of_color_planes

Prototype
 uint8_t intel_vvp_vfw_get_number_of_color_planes(intel_vvp_vfw_instance *instance);
Description

Returns the value of the NUMBER_OF_COLOR_PLANES register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

the number of color planes per pixel selected at configuration

intel_vvp_vfw_get_pixels_in_parallel

Prototype
 uint8_t intel_vvp_vfw_get_pixels_in_parallel(intel_vvp_vfw_instance *instance);
Description

Returns the value of the PIXELS_IN_PARALLEL register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

the number of pixels streamed in parallel selected at configuration

intel_vvp_vfw_get_mem_word_packing

Prototype
 eIntelVvpVfwPacking intel_vvp_vfw_get_mem_word_packing(intel_vvp_vfw_instance *instance);
Description

Returns the value of the WORD_PACKING register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

the algorithm used to pack/unpack pixels and color samples of a field in memory

intel_vvp_vfw_is_running

Prototype
 bool intel_vvp_vfw_is_running(intel_vvp_vfw_instance* instance);
Description

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

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

True is the IP is currently reading a field, false when between two output fields

intel_vvp_vfw_get_commit_status

Prototype
 bool intel_vvp_vfw_get_commit_status(intel_vvp_vfw_instance* instance);
Description

Reads and returns the commit status bit of the STATUS register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

True is there are uncommitted writes

intel_vvp_vfw_get_status

Prototype
 uint32_t intel_vvp_vfw_get_status(intel_vvp_vfw_instance* instance);
Description

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

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

The content of the STATUS register

intel_vvp_vfw_is_buffer_available

Prototype
 bool intel_vvp_vfw_is_buffer_available(intel_vvp_vfw_instance* instance);
Description

Reads the BUFFER_AVAILABLE register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

True if a new buffer has been written to memory since the last call to intel_vvp_vfw_acknowledge_buffer

intel_vvp_vfw_get_buffer_write_count

Prototype
 uint32_t intel_vvp_vfw_get_buffer_write_count(intel_vvp_vfw_instance* instance);
Description

Reads the BUFFER_WRITE_COUNT register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

The number of buffers written to memory that were not discarded

intel_vvp_vfw_get_buffer_start_addr

Prototype
 uint32_t intel_vvp_vfw_get_buffer_start_addr(intel_vvp_vfw_instance* instance);
Description

Reads the BUFFER_START_ADDRESS register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

The memory address for the last field flagged as available

intel_vvp_vfw_is_buffer_f1

Prototype
 bool intel_vvp_vfw_is_buffer_f1(intel_vvp_vfw_instance* instance);
Description

Reads and returns the BUFFER_F1_FLAG register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

True if the last buffer made available is a F1 field

intel_vvp_vfw_get_buffer_width

Prototype
 uint32_t intel_vvp_vfw_get_buffer_width(intel_vvp_vfw_instance* instance);
Description

Reads and returns the BUFFER_WIDTH register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

The width of the last buffer made available

intel_vvp_vfw_get_buffer_height

Prototype
 uint32_t intel_vvp_vfw_get_buffer_height(intel_vvp_vfw_instance* instance);
Description

Reads and returns the BUFFER_HEIGHT register. The instance must be a valid intel_vvp_vfw_instance fully initialized.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

The height of the last buffer made available

intel_vvp_vfw_get_field_count

Prototype
 uint32_t intel_vvp_vfw_get_field_count(intel_vvp_vfw_instance* instance);
Description

Reads and returns the FIELD_COUNT register. The instance must be a valid intel_vvp_vfw_instance fully initialized and configured for full variant.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

T

intel_vvp_vfw_acknowledge_buffer

Prototype
 int intel_vvp_vfw_acknowledge_buffer(intel_vvp_vfw_instance *instance);
Description

Writes to the BUFFER_ACKNOWLEDGE register, freeing space for future buffers

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

kIntelVvpCoreOk for success, negative error code in case of failures

kIntelVvpCoreInstanceErr if the instance is invalid

intel_vvp_vfw_set_run_mode

Prototype
 int intel_vvp_vfw_set_run_mode(intel_vvp_vfw_instance *instance, eIntelVvpVfwRunMode run_mode);
Description

Writes a new value to the RUN_MODE register and chooses the write process used while storing buffers in memory

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

run_mode - the new run_mode

kIntelVvpVfwStop to stop the frame writer until another run-mode is selected

kIntelVvpVfwFreeRunning to store incoming fields using all buffers in round-robin fashion

kIntelVvpVfwSingleShot to store incoming fields until all buffers have been written once

Returns

kIntelVvpCoreOk for success, negative error code in case of failures

kIntelVvpCoreInstanceErr if the instance is invalid

intel_vvp_vfw_get_run_mode

Prototype
 eIntelVvpVfwRunMode intel_vvp_vfw_get_run_mode(intel_vvp_vfw_instance* instance);
Description

Reads and returns the current value of the RUN_MODE register. The instance must be a valid intel_vvp_vfw_instance fully initialized and configured to enable debug.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

Last value written to the RUN_MODE register if the IP is configured to enable register read-back

intel_vvp_vfw_set_num_buffers

Prototype
 int intel_vvp_vfw_set_num_buffers(intel_vvp_vfw_instance *instance, uint32_t num_buffers);
Description

Writes a new value to the NUM_BUFFERS register and selects the number of buffers

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

num_buffers - new number of buffers

Returns

kIntelVvpCoreOk for success, negative error code in case of failures

kIntelVvpCoreInstanceErr if the instance is invalid

intel_vvp_vfw_get_num_buffers

Prototype
 uint32_t intel_vvp_vfw_get_num_buffers(intel_vvp_vfw_instance* instance);
Description

Reads and returns the current value of the NUM_BUFFERS register. The instance must be a valid intel_vvp_vfw_instance fully initialized and configured to enable debug.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

Last value written to the NUM_BUFFERS register if the IP is configured to enable register read-back

intel_vvp_vfw_set_base_addr

Prototype
 int intel_vvp_vfw_set_base_addr(intel_vvp_vfw_instance *instance, uint32_t base_addr);
Description

Writes a new value to the BUFFER_BASE register and selects a new base address for buffers in memory

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

base_addr - the base address for the first buffer

Returns

kIntelVvpCoreOk for success, negative error code in case of failures

kIntelVvpCoreInstanceErr if the instance is invalid

intel_vvp_vfw_get_base_addr

Prototype
 uint32_t intel_vvp_vfw_get_base_addr(intel_vvp_vfw_instance* instance);
Description

Reads and returns the current value of the BUFFER_BASE register. The instance must be a valid intel_vvp_vfw_instance fully initialized and configured to enable debug.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

Last value written to the BUFFER_BASE register if the IP is configured to enable register read-back

intel_vvp_vfw_set_inter_buffer_offset

Prototype
 int intel_vvp_vfw_set_inter_buffer_offset(intel_vvp_vfw_instance *instance, uint32_t inter_buffer_offset);
Description

Writes a new value to the INTER_BUFFER_OFFSET register and selects a new inter-buffer offset for the buffers

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

inter_buffer_offset - the offset, in bytes, between two buffers, or, in other words, the number of bytes allocated to each buffer

Returns

kIntelVvpCoreOk for success, negative error code in case of failures

kIntelVvpCoreInstanceErr if the instance is invalid

intel_vvp_vfw_get_inter_buffer_offset

Prototype
 uint32_t intel_vvp_vfw_get_inter_buffer_offset(intel_vvp_vfw_instance* instance);
Description

Reads and returns the current value of the INTER_BUFFER_OFFSET register. The instance must be a valid intel_vvp_vfw_instance fully initialized and configured to enable debug.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

Last value written to the INTER_BUFFER_OFFSET register if the IP is configured to enable register read-back

intel_vvp_vfw_set_inter_line_offset

Prototype
 int intel_vvp_vfw_set_inter_line_offset(intel_vvp_vfw_instance *instance, uint32_t inter_line_offset);
Description

Writes a new value to the INTER_LINE_OFFSET register and selects a new inter-line offset for the buffers

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

inter_line_offset - the offset, in bytes, between consecutive lines

Returns

kIntelVvpCoreOk for success, negative error code in case of failures

kIntelVvpCoreInstanceErr if the instance is invalid

intel_vvp_vfw_get_inter_line_offset

Prototype
 uint32_t intel_vvp_vfw_get_inter_line_offset(intel_vvp_vfw_instance* instance);
Description

Reads and returns the current value of the INTER_LINE_OFFSET register. The instance must be a valid intel_vvp_vfw_instance fully initialized and configured to enable debug.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

Last value written to the INTER_LINE_OFFSET register if the IP is configured to enable register read-back

intel_vvp_vfw_set_irq_line_threshold

Prototype
 int intel_vvp_vfw_set_irq_line_threshold(intel_vvp_vfw_instance *instance, uint32_t line_threshold);
Description

Writes a new value to the IRQ_LINE_THRESHOLD register and selects a new threshold to fire the interrupt

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

line_threshold - the new line threshold

Returns

kIntelVvpCoreOk for success, negative error code in case of failures

kIntelVvpCoreInstanceErr if the instance is invalid

intel_vvp_vfw_get_irq_line_threshold

Prototype
 uint32_t intel_vvp_vfw_get_irq_line_threshold(intel_vvp_vfw_instance* instance);
Description

Reads and returns the current value of the IRQ_LINE_THRESHOLD register. The instance must be a valid intel_vvp_vfw_instance fully initialized and configured to enable debug.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

Last value written to the IRQ_LINE_THRESHOLD register for the selected buffer set if the IP is configured to enable register read-back

intel_vvp_vfw_overwrite_broken_fields

Prototype
 int intel_vvp_vfw_overwrite_broken_fields(intel_vvp_vfw_instance *instance, bool overwrite_broken);
Description

Writes a new value to the OVERWRITE_BROKEN register and selects how the Frame Writer handles broken fields

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

overwrite_broken - True to ignore and overwrite broken fields, false otherwise

Returns

kIntelVvpCoreOk for success, negative error code in case of failures

kIntelVvpCoreInstanceErr if the instance is invalid

intel_vvp_vfw_get_overwrite_broken_fields

Prototype
 bool intel_vvp_vfw_get_overwrite_broken_fields(intel_vvp_vfw_instance* instance);
Description

Reads and returns the current value of the OVERWRITE_BROKEN register. The instance must be a valid intel_vvp_vfw_instance fully initialized and configured to enable debug.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

Last value written to the OVERWRITE_BROKEN register if the IP is configured to enable register read-back

intel_vvp_vfw_commit_writes

Prototype
 int intel_vvp_vfw_commit_writes(intel_vvp_vfw_instance* instance)
Description

Commits all pending writes before processing the next field. The instance must be valid.

Arguments

instance - pointer to the intel_vvp_vfw_instance software driver instance structure

Returns

kIntelVvpCoreOk (0) for success, negative error code otherwise