The Warp Initializer IP descriptor should be placed in external memory in the following format. The address of this descriptor is provided to the IP through the Descriptor Address register and the IP reads the descriptor from this address. The descriptor is a tightly packed structure of size 144 bytes in memory.
typedef struct {
u16 width;
u16 height;
u16 bytes_per_pixel;
u8 reserved_0[2];
u64 filter_table_addr_0;
u64 filter_table_addr_1;
u32 width_Q4;
u32 height_Q4;
s16 k_pre;
s16 k_post;
u16 k0_pre;
u16 k1_pre;
u16 k0_post;
u16 k1_post;
u32 Q_fact_pre;
u32 Q_fact_post;
s8 k0_pre_Q_bits;
s8 k0_post_Q_bits;
s8 k1_pre_Q_bits;
s8 k1_post_Q_bits;
s16 h[6];
s32 h_trans[3];
u8 h_Qbits[6];
u8 reserved_1[2];
u32 normfactor;
u16 cenX;
u16 cenY;
u32 num_ctrl_pts;
u64 src_ctrl_x_pts;
u64 src_ctrl_y_pts;
u64 src_tangents_x;
u64 src_tangents_y;
u64 interm_x;
u64 interm_y;
u8 warp_type;
u8 reserved_2[3];
u32 valid_segs;
u32 lblk_count;
u32 line_num_seg;
} XVWarpInitVector_Hw;
S8 : Signed 8 bit
S16: Signed 16 bit
U8 : Unsigned 8 bit
U16: Unsigned 16 bit
U32: Unsigned 32 bit
U64: Unsigned 64 bit
Rest all k0_pre, k0_post, k1_pre, k1_post, Q_fact_pre, Q_fact_post, k0_pre_Q_bits, k0_post_Q_bits, k1_pre_Q_bits, k1_post_Q_bits parameters are internally calculated and used by Warp Initializer IP.
The fields in the descriptor are explained in the following table:
Field | Explanation |
---|---|
width | Width of the input source image. Supported values are between 320 and the value provided in the Maximum Number of Columns field in the Vivado IDE. |
height | Height of the input source image. Supported values are between 240 and the value provided in the Maximum Number of Rows field in the Vivado Integrated Design Environment (IDE). |
bytes_per_pixel | Number of bytes per pixel. |
filter_table_addr_0 | Memory address of warp filter table0. |
filter_table_addr_1 | Memory address of warp filter table1. |
width_Q4 | Width of the image in Q4 fixed point format. |
height_Q4 | Height of the image in Q4 fixed point format. |
k_pre | Lens distortion value applied on the image before applying any other distortions. The user provided value is converted into a fixed format by the driver. Supported range without any other distortions is -5.0 to 5.0. The range will vary if other distortions are applied on images. |
k_post | Lens distortion value applied on the image after applying all other distortions. The user provided value is converted into a fixed format by the driver. Supported range without any other distortions is -5.0 to 5.0. The range will vary if other distortions are applied on images. |
k0_pre | Fixed point parameter estimated by the driver in onetime_calcs_warp() function. Its value depends on the k_pre. |
k1_pre | Fixed point parameter estimated by the driver in onetime_calcs_warp() function. Its value depends on the k_pre. |
k0_post | Fixed point parameter estimated by the driver in onetime_calcs_warp() function. Its value depends on the k_post. |
k1_post | Fixed point parameter estimated by the driver in onetime_calcs_warp() function. Its value depends on the k_post. |
Q_fact_pre | Fixed point format used for k_pre. This parameter is estimated by the driver in onetime_calcs_warp() function. |
Q_fact_post | Fixed point format used for k_post. This parameter is estimated by the driver in onetime_calcs_warp() function. |
k0_pre_Q_bits | Fixed point format used for k0_pre. This parameter is estimated by the driver in onetime_calcs_warp() function. |
k0_post_Q_bits | Fixed point format used for k0_post. This parameter is estimated by the driver in onetime_calcs_warp() function. |
k1_pre_Q_bits | Fixed point format used for k1_pre. This parameter is estimated by the driver in onetime_calcs_warp() function. |
k1_post_Q_bits | Fixed point format used for k1_post. This parameter is estimated by the driver in onetime_calcs_warp() function. |
h[6] | Homography matrix estimated based on the inputs of the rotation, scale, transition and keystone distortion values. h[6] represents the first two columns of homography 3x3 matrix in fixed point format. |
h_trans [3] | Represents the last column of homography 3x3 matrix in fixed point format. |
h_Qbits[6] | Fixed point format used for each element of the h[6]. These parameters are estimated by the driver in onetime_calcs_warp() function. |
normfactor | Fixed point value estimated by the driver in onetime_calcs_warp() function based on image width and height. |
cenX | Center column position of the image estimated based on width. |
cenY | Center row position of the image estimated based on height. |
num_ctrl_pts | Number of control point used in arbitrary distortion. This parameter is required for arbitrary warp. |
src_ctrl_x_pts | Memory address of the column locations of source control points. These parameters are input from the user for arbitrary warp. |
src_ctrl_y_pts | Memory address of the row locations of source control points. These parameters are input from the user for arbitrary warp. |
src_tangents_x | Memory address of the column direction tangents estimated by the driver in onetime_calcs_warp() function based on source and destination control points. |
src_tangents_y | Memory address of the row direction tangents estimated by the driver in onetime_calcs_warp() function based on source and destination control points. |
interm_x | Memory address for storing intermediate information during warp filter parameters estimation block by block. |
interm_y | Memory address for storing intermediate information during warp filter parameters estimation block by block. |
warp_type | Type of warp. 0 for regular and 1 for arbitrary distortion. |
valid_segs | Number of valid blocks that the Warp Filter needs to reconstruct. This value must be read from the valid_segs field of the Warp Initializer descriptor. |
lblk_count | For faster processing, the Warp Filter runs two cores in parallel. The total number of valid blocks is divided between the two cores. The number of blocks that need to be processed by the first core comes from lblock_count. This value must be read from the lblock_count field of the Warp Initializer descriptor. |
line_num_seg |
The line number from which the second core in the Warp Filter starts reading the source image. This value must be read from the line_num field of the Warp Initializer descriptor. |
valid_segs
) are 0
for a particular configuration in Warp Initializer IP, the particular configuration is
invalid and the warp filter interrupt is low. Further warp filter processing is not
done. This descriptor is filled in the driver based on the user input configuration. Provide the following input configuration structure to the driver.
typedef struct {
int frame_width;
int frame_height;
int warp_type;
float pre_fisheye;
float post_fisheye;
int left_top_x;
int left_top_y;
int right_top_x;
int right_top_y;
int left_bottom_x;
int left_bottom_y;
int right_bottom_x;
int right_bottom_y;
float scale_x;
float scale_y;
float rotation;
float trans_x;
float trans_y;
float zoom;
int num_ctrl_pts;
XVWarpInit_ArbParam_MeshInfo *ctrl_pts;
} WARP_CFG;
Warp Configuration Parameter | Range |
---|---|
frame_width |
320 to 3840 |
frame_height |
240 to 2160 |
warp_type |
0 (fixed), 1 (arbitrary) |
pre_fisheye |
-5.0 to 5.0 |
post_fisheye |
-5.0 to 5.0 |
left_top_x |
0 to width |
left_top_y |
0 to height |
right_top_x |
0 to width |
right_top_y |
0 to height |
left_bottom_x |
0 to width |
left_bottom_y |
0 to height |
right_bottom_x |
0 to width |
right_bottom_y |
0 to height |
scale_x |
0.5 to 2.0 |
scale_y |
0.5 to 2.0 |
rotation |
-90 to 90 |
trans_x |
-width to width |
trans_y |
-height to height |
zoom |
0.5 to 2 |
num_ctrl_pts |
4, 8, 16, 32 |
The following figures show the effect of these values on a 3840x2160 image.