Bit Depth Conversion
The xFConvertBitDepth function converts the input image bit depth to the
required bit depth in the output image.
API Syntax
template <int SRC_T, int DST_T, int ROWS, int COLS, int NPC=1>
void xFconvertTo(xF::Mat<SRC_T, ROWS, COLS, NPC> &_src_mat, xF::Mat<DST_T, ROWS, COLS, NPC> &_dst_mat, ap_uint<4> _convert_type, int _shift)
Parameter Descriptions
The following table describes the template and the function parameters.
| Parameter | Description |
|---|---|
| SRC_T |
Input pixel type. 8-bit, unsigned, 1 channel (XF_8UC1), 16-bit, unsigned, 1 channel (XF_16UC1), 16-bit, signed, 1 channel (XF_16SC1), 32-bit, unsigned, 1 channel (XF_32UC1) 32-bit, signed, 1 channel (XF_32SC1) are supported. |
| DST_T |
Output pixel yype. 8-bit, unsigned, 1 channel (XF_8UC1), 16-bit, unsigned, 1 channel (XF_16UC1), 16-bit, signed, 1 channel (XF_16SC1), 32-bit, unsigned, 1 channel (XF_32UC1) 32-bit, signed, 1 channel (XF_32SC1) are supported. |
| ROWS | Height of input and output images |
| COLS | Width of input and output images |
| NPC | Number of pixels to be processed per cycle; possible options are XF_NPPC1 and XF_NPPC8 for 1 pixel and 8 pixel operations respectively. |
| _src_mat | Input image |
| _dst_mat | Output image |
| _convert_type | This parameter specifies the type of conversion required. (See XF_convert_bit_depth_e enumerated type in file xf_params.h for possible values.) |
| _shift | Optional scale factor |
Possible Conversions
The following table summarizes supported conversions. The rows are possible input image bit depths and the columns are corresponding possible output image bit depths (U=unsigned, S=signed).
| INPUT/OUTPUT | U8 | U16 | S16 | U32 | S32 |
|---|---|---|---|---|---|
| U8 | NA | yes | yes | NA | yes |
| U16 | yes | NA | NA | NA | yes |
| S16 | yes | NA | NA | NA | yes |
| U32 | NA | NA | NA | NA | NA |
| S32 | yes | yes | yes | NA | NA |
Resource Utilization
The following table summarizes the resource utilization of the xFConvertBitDepth function, generated using Vivado HLS 2017.1 tool for the Xilinx Xczu9eg-ffvb1156-1-i-es1 FPGA, to process a grayscale HD (1080x1920) image.| Operating Mode |
Operating Frequency (MHz) |
Utilization Estimate | ||||
|---|---|---|---|---|---|---|
| BRAM_18K | DSP_48Es | FF | LUT | CLB | ||
| 1 pixel | 300 | 0 | 8 | 581 | 523 | 119 |
| 8 pixel | 150 | 0 | 8 | 963 | 1446 | 290 |
| Operating Mode |
Operating Frequency (MHz) |
Utilization Estimate | ||||
|---|---|---|---|---|---|---|
| BRAM_18K | DSP_48Es | FF | LUT | CLB | ||
| 1 pixel | 300 | 0 | 8 | 591 | 541 | 124 |
| 8 pixel | 150 | 0 | 8 | 915 | 1500 | 308 |
Performance Estimate
The following table summarizes the performance in different configurations, as generated using Vivado HLS 2017.1 tool for the Xilinx Xczu9eg-ffvb1156-1-i-es1, to process a grayscale HD (1080x1920) image.
| Operating Mode | Latency Estimate |
|---|---|
| Max Latency | |
| 1 pixel operation (300 MHz) | 6.91 ms |
| 8 pixel operation (150 MHz) | 1.69 ms |