Video and Vision Processing Suite Intel® FPGA IP User Guide

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

42.5. Text Box 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 V 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 file: intel_vvp_text_box_regs.h

Include file: intel_vvp_text_box.h

Table 804.  Text Box IP Software API
Name Description
intel_vvp_text_box_init Initialize the Text Box instance
intel_vvp_core_* Acccessors defined in Video and Vision Processing IP Software Programming Model. Image info accessors are unused for this IP.
intel_vvp_ text_box_get_lite_mode Returns whether Lite mode is on
intel_vvp_text_box_get_debug_enabled Returns whether Debug enabled is on
intel_vvp_text_box_get_bits_per_sample Returns the Bits per color sample
intel_vvp_text_box_get_pixels_in_parallel Returns the pixels in parallel
intel_vvp_text_box_get_color_space Returns the color space of outgoing fields set at compile time
intel_vvp_text_box_get_alpha_enabled Returns if the IP has an extra alpha channel
intel_vvp_text_box_get_num_chars_per_line Returns the number of characters per line of text
intel_vvp_text_box_get_n um_lines Returns the number of lines of text
intel_vvp_text_box_get_double_buffered Returns if the IP has Double buffering
intel_vvp_text_box_get_max_font_size Returns the maximum supported font size
intel_vvp_text_box_get_status Reads and returns the contents of the status register
intel_vvp_text_box_is_running Returns if the IP is currently generating video fields
intel_vvp_text_box_get_commit_status Returns if any register writes are yet to be committed to the IP, excluding explicitly stated registers
intel_vvp_text_box_get_field_since_last_start Returns the number of fields the IP generated since it last started
intel_vvp_text_box_get_current_line Returns which line of text the IP is currently generating
intel_vvp_text_box_enable Start or stop the IP
intel_vvp_text_box_start Start the IP
intel_vvp_text_box_stop Stop the IP after the current field
intel_vvp_text_box_is_enabled Returns if the IP is enabled (reads the CONTROL register)
intel_vvp_text_box_set_write_bank Set which buffer the IP uses for writes to text registers
intel_vvp_text_box_get_write_bank Returns which buffer the IP uses for writes to text registers
intel_vvp_text_box_set_read_bank Set which buffer the IP retrieves text from
intel_vvp_text_box_get_read_bank Returns which buffer the IP uses to retrieve text
intel_vvp_text_box_set_field_interlace Set the initial interlace nibble/configuration of outgoing fields.
intel_vvp_text_box_get_field_interlace Returns the interlace nibble of the current field
intel_vvp_text_box_set_font_size Set the font size for rendered text
intel_vvp_text_box_get_font_size Returns the current font size
intel_vvp_text_box_set_font_color Set the text's font color
intel_vvp_text_box_get_font_color Return the text's current font color
intel_vvp_text_box_set_background_color Set the text's background color
intel_vvp_text_box_get_background_color Return the text's current background color
intel_vvp_text_box_write_word Write a word (uint32_t) to a text register
intel_vvp_text_box_write_string Helper method to write a string to the corresponding registers
intel_vvp_text_box_get_field_width Returns the current field width
intel_vvp_text_box_get_field_height Return the current field height
intel_vvp_text_box_commit_writes Commit any outstanding writes from set methods (except where specified)

enum eIntelVvpTextBoxColorSpace

Members

kIntelVvpTextBoxRgb - RGB

kIntelVvpTextBoxYcc444 - YCbCr 4:4:4

kIntelVvpTextBoxYcc422 - YCbCr 4:2:2

kIntelVvpTextBoxYcc420 - YCbCr 4:2:0

kIntelVvpTextBoxMono - Monochrome

kIntelVvpTextBoxInvalidColorSpace - Invalid color space (used for errors)

Description

Enumeration for the supported color spaces and subsampling

intel_vvp_text_box_init

Prototype
 int intel_vvp_text_box(intel_vvp_text_box_instance* instance, intel_vvp_core_base base);
                
Description

Initializes a Text Box instance. If the return code is non-zero, the structure was not successfully initialized and cannot be used further.

Arguments

instance - pointer to the intel_vvp_text_box_instance structure software driver instance structure

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is a null pointer

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

kIntelVvpCorePidErr if the product id of the IP is not the Text Box product ID (0x017E)

kIntelVvpTextBoxRegMapVersionErr if the register map version is not supported

intel_vvp_text_box_get_lite_mode

Prototype
 bool intel_vvp_text_box_get_lite_mode(intel_vvp_text_box_instance* instance);
                
Description

Returns whether the IP is in Lite mode

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

False if not lite mode or if instance is invalid, true otherwise

intel_vvp_text_box_get_debug_enabled

Prototype
 bool intel_vvp_text_box_get_debug_enabled(intel_vvp_text_box_instance* instance);
                
Description

Returns whether Debug enabled is on

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

False if debug is not available or if instance is invalid, true otherwise

intel_vvp_text_box_get_bits_per_sample

Prototype
 uint8_t intel_vvp_text_box_get_bits_per_sample(intel_vvp_text_box_instance* instance);
                
Description

Returns the Bits per color sample.

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

Returns the Bits per color sample

intel_vvp_text_box_get_pixels_in_parallel

Prototype
 uint8_t intel_vvp_text_box_get_pixels_in_parallel(intel_vvp_text_box_instance* instance);
                
Description

Returns the pixels in parallel

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The number of pixels processed in parallel (1-8), or 0 in case of error

intel_vvp_text_box_get_color_space

Prototype
 eIntelVvpTextBoxColorSpace intel_vvp_text_box_get_color_space(intel_vvp_text_box_instance* instance);
                
Description

Returns the color space of outgoing fields set at compile time if Enable alpha channel is on

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The color space the IP was compiled in, or kIntelVvpTextBoxInvalidColorSpace in case of error

intel_vvp_text_box_get_alpha_enabled

Prototype
 bool intel_vvp_text_box_get_alpha_enabled(intel_vvp_text_box_instance* instance);
                
Description

Returns the color space of outgoing fields set at compile time

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

True if alpha is enabled, false otherwise or in case of error

intel_vvp_text_box_get_num_chars_per_line

Prototype
 uint16_t intel_vvp_text_box_get_num_chars_per_line(intel_vvp_text_box_instance* instance);
                
Description

Returns the number of characters per line of text

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The number of characters per lines, or 0 in case of error

intel_vvp_text_box_get_num_lines

Prototype
 uint16_t intel_vvp_text_box_get_num_lines(intel_vvp_text_box_instance* instance);
                
Description

Returns the number of lines of text

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The number of lines, or 0 in case of error

intel_vvp_text_box_get_double_buffered

Prototype
 bool intel_vvp_text_box_get_double_buffered(intel_vvp_text_box_instance* instance);
                
Description

Returns if double buffering is on

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

True if double buffering is on, false otherwise or in case of error

intel_vvp_text_box_get_max_font_size

Prototype
 uint16_t intel_vvp_text_box_get_max_font_size(intel_vvp_text_box_instance* instance);
                
Description

Returns the maximum supported font size.

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The maximum font size, or 0 in case of error

intel_vvp_text_box_get_status

Prototype
 uint32_t intel_vvp_text_box_get_status(intel_vvp_text_box_instance* instance);
                
Description

Reads and returns the contents of the status register

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

Contents of the status register, or 0xFFFFFFFF in case of error

intel_vvp_text_box_is_running

Prototype
 bool intel_vvp_text_box_is_running(intel_vvp_text_box_instance* instance);
                
Description

Returns if the IP is generating video fields

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

True if currently generating video, false if stopped or in case of error

intel_vvp_text_box_get_commit_status

Prototype
 bool intel_vvp_text_box_get_commit_status(intel_vvp_text_box_instance* instance);
                
Description

Returns if there are register writes yet to be committed to the IP

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

True if there are outstanding writes, false otherwise or in case of error

intel_vvp_text_box_get_fields_since_last_start

Prototype
 uint32_t intel_vvp_text_box_get_fields_since_last_start(intel_vvp_text_box_instance* instance);
                
Description

Returns the number of fields the IP has generated since it was last started

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The number of fields generated, or 0xFFFFFFFF in case of error

intel_vvp_text_box_get_current_line

Prototype
 uint16_t intel_vvp_text_box_get_current_line(intel_vvp_text_box_instance* instance);
                
Description

Returns which line of text the IP is currently generating

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The current line number, or 0xFFFF in case of error

intel_vvp_text_box_enable

Prototype
 int intel_vvp_text_box_enable(intel_vvp_text_box_instance* instance, bool enabled);
                
Description

Start the IP

Arguments

instance - Pointer to the intel_vvp_text_box_instance structure

enabled - True to start the IP, false to stop

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

intel_vvp_text_box_start

Prototype
int intel_vvp_text_box_start(intel_vvp_text_box_instance* instance);
                
Description

Start the IP

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

intel_vvp_text_box_stop

Prototype
int intel_vvp_text_box_stop(intel_vvp_text_box_instance* instance);
                
Description

Stop the IP after generating the current field

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

intel_vvp_text_box_is_enabled

Prototype
bool intel_vvp_text_box_is_enabled(intel_vvp_text_box_instance* instance);
                
Description

Returns if the IP is enabled (reads the CONTROL register)

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

True if enabled, false disabled or if instance is NULL or debug features is off

intel_vvp_text_box_set_write_bank

Prototype
int intel_vvp_text_box_set_write_bank(intel_vvp_text_box_instance* instance, bool bank);
                
Description

Set which buffer writes to text go to

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

bank - False to write to the buffer 0, true to write to buffer 1

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

kIntelVvpCoreTextBoxBankErr if the double buffering is off

intel_vvp_text_box_get_write_bank

Prototype
bool intel_vvp_text_box_get_write_bank(intel_vvp_text_box_instance* instance);
                
Description

Return which buffer the IP is querying from

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

False for the first buffer or if error, true for the second buffer

intel_vvp_text_box_set_read_bank

Prototype
int intel_vvp_text_box_set_read_bank(intel_vvp_text_box_instance* instance, bool bank);
                
Description

Set which buffer the IP queries text from

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

bank - False to write to the first buffer, true to write to the second buffer

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

kIntelVvpCoreTextBoxBankErr if double buffering is off

intel_vvp_text_box_get_read_bank

Prototype
bool intel_vvp_text_box_get_read_bank(intel_vvp_text_box_instance* instance);
                
Description

Return which buffer the IP is querying from

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

False for the first buffer or if error, true for the second buffer

intel_vvp_text_box_set_field_interlace

Prototype
uint8_t intel_vvp_text_box_get_field_interlace(intel_vvp_text_box_instance* instance);
                
Description

Set the initial interlace configuration nibble of outgoing fields. This is applied at the field boundary, such that it is applied to the next field.

This value is used to initially populate the Image Information Packet if the IP was compiled in Full mode.

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

interlace - The interlace configuration nibble

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

intel_vvp_text_box_get_field_interlace

Prototype
uint8_t intel_vvp_text_box_get_field_interlace(intel_vvp_text_box_instance* instance);
                
Description

Return the interlace configuration nibble of the current field

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The current field's interlace configuration nibble, or 0xFF in case of error

intel_vvp_text_box_set_font_size

Prototype
int intel_vvp_text_box_set_font_size(intel_vvp_text_box_instance* instance, uint8_t font_size);
                
Description

Set the font size to render text at. A change in font size will change the field dimensions.

If font size is 1, then each character is 8x8 pixels

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

font_size - The required font size

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

kIntelVvpCoreTextBoxFontSizeErr if font size is greater than the compiled maximum font size

intel_vvp_text_box_get_font_size

Prototype
uint8_t intel_vvp_text_box_get_font_size(intel_vvp_text_box_instance* instance);
                
Description

Returns the current font size

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The current font size, or 0 in case of error

intel_vvp_text_box_set_font_color

Prototype
int intel_vvp_text_box_set_font_color(intel_vvp_text_box_instance* instance, uint16_t r_cr, uint16_t g_y, uint16_t b_cb, uint16_t alpha);
                
Description

Set the text's font color

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

r_cr - the red component in RGB, or Cr in YCbCr

g_y - the green component in RGB, or Y in YCbCr

b_cb - the blue component in RGB, or Cb in YCbCr, or the monochrome component

alpha - the alpha component; this is ignored if alpha is not enabled

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

kIntelVvpCoreTextBoxColorErr if any color component is greater than the maximum allowed by the bits per color sample

intel_vvp_text_box_get_font_color

Prototype
 int intel_vvp_text_box_get_font_color(intel_vvp_text_box_instance* instance, uint16_t *r_cr, uint16_t *g_y, uint16_t *b_cb, uint16_t *alpha);
                
Description

Set the text's font color

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

r_cr - pointer to store the red component in RGB, or Cr in YCbCr

g_y - pointer to store the red component in RGB, or Y in YCbCr

b_cb - pointer to store the blue component in RGB, Cb in YCbCr, or the monochrome component

alpha - pointer to store the alpha component. Set to 0 if Enable alpha is off

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL or if Debug features is offf

intel_vvp_text_box_set_background_color

Prototype
 int intel_vvp_text_box_set_background_color(intel_vvp_text_box_instance* instance, uint16_t r_cr, uint16_t g_y, uint16_t b_cb, uint16_t alpha);
                
Description

Set the text's background color

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

r_cr - the red component in RGB, or Cr in YCbCr

g_y - the green component in RGB, or Y in YCbCr

b_cb - the blue component in RGB, or Cb in YCbCr, or the monochrome component

alpha - the alpha component; this is ignored if alpha is not enabled

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

kIntelVvpCoreTextBoxColorErr if any color component is greater than the maximum allowed by the bits per color sample

intel_vvp_text_box_get_background_color

Prototype
 int intel_vvp_text_box_get_background_color(intel_vvp_text_box_instance* instance, uint16_t *r_cr, uint16_t *g_y, uint16_t *b_cb, uint16_t *alpha);
                
Description

Set the text's background color

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

r_cr - pointer to store the red component in RGB, or Cr in YCbCr

g_y - pointer to store the red component in RGB, or Y in YCbCr

b_cb - pointer to store the blue component in RGB, Cb in YCbCr, or the monochrome component

alpha - pointer to store the alpha component; this is set to 0 if alpha is not enabled

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL or if Debug features is off

intel_vvp_text_box_write_word

Prototype
 int intel_vvp_text_box_write_word(intel_vvp_text_box_instance* instance, uint32_t data, uint32_t reg_num);
                
Description

Write a word (uint32_t) to a text register. This method can be used to implement a custom, optimised version of intel_vvp_text_box_write_string.

Characters are stored in little-endian order, such that register 0 & 0xFF returns the first character.

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

data - The word to write

reg_num - The text register number to write to

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

kIntelVvpCoreTextBoxOutOfBoundsErr if reg_num is out of bounds

intel_vvp_text_box_write_string

Prototype
 int intel_vvp_text_box_write_string(intel_vvp_text_box_instance* instance, const char str[]);
                
Description

Helper method to write a string to the corresponding registers

This is an inefficient function; it will always write to every register. If \n is detected, then spaces are added until the end of the line. If the string is shorter than the maximum capacity, then spaces are also added.

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

str - String to write

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL

intel_vvp_text_box_get_field_width

Prototype
 uint32_t intel_vvp_text_box_get_field_width(intel_vvp_text_box_instance* instance);
                
Description

Returns the current field width

This is derived from the current font size and compiled number of characters per line

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The field width, or 0 in case of error

intel_vvp_text_box_get_field_height

Prototype
 uint32_t intel_vvp_text_box_get_field_height(intel_vvp_text_box_instance* instance);
                
Description

Returns the current field height

This is derived from the current font size and compiled number of lines

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

The field height, or 0 in case of error

intel_vvp_text_box_commit_writes

Prototype
 int intel_vvp_text_box_get_commit_writes(intel_vvp_text_box_instance* instance);
                
Description

Commit any outstanding register writes (except where specified)

Arguments

instance - pointer to the intel_vvp_text_box_instance structure

Returns

kIntelVvpCoreOk in case of success

kIntelVvpCoreInstanceErr if instance is NULL