TIOVX User Guide
hwa_vpac_msc.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2019-2021 Texas Instruments Incorporated
4  *
5  * All rights reserved not granted herein.
6  *
7  * Limited License.
8  *
9  * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10  * license under copyrights and patents it now or hereafter owns or controls to make,
11  * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12  * terms herein. With respect to the foregoing patent license, such license is granted
13  * solely to the extent that any such patent is necessary to Utilize the software alone.
14  * The patent license shall not apply to any combinations which include this software,
15  * other than combinations with devices manufactured by or for TI ("TI Devices").
16  * No hardware patent is licensed hereunder.
17  *
18  * Redistributions must preserve existing copyright notices and reproduce this license
19  * (including the above copyright notice and the disclaimer and (if applicable) source
20  * code license limitations below) in the documentation and/or other materials provided
21  * with the distribution
22  *
23  * Redistribution and use in binary form, without modification, are permitted provided
24  * that the following conditions are met:
25  *
26  * * No reverse engineering, decompilation, or disassembly of this software is
27  * permitted with respect to any software provided in binary form.
28  *
29  * * any redistribution and use are licensed by TI for use only with TI Devices.
30  *
31  * * Nothing shall obligate TI to provide you with source code for the software
32  * licensed and provided to you in object code.
33  *
34  * If software source code is provided to you, modification and redistribution of the
35  * source code are permitted provided that the following conditions are met:
36  *
37  * * any redistribution and use of the source code, including any resulting derivative
38  * works, are licensed by TI for use only with TI Devices.
39  *
40  * * any redistribution and use of any object code compiled from the source code
41  * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42  *
43  * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44  *
45  * may be used to endorse or promote products derived from this software without
46  * specific prior written permission.
47  *
48  * DISCLAIMER.
49  *
50  * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53  * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59  * OF THE POSSIBILITY OF SUCH DAMAGE.
60  *
61  */
62 
63 #ifndef HWA_VPAC_MSC_H_
64 #define HWA_VPAC_MSC_H_
65 
66 #include <VX/vx.h>
67 #include <VX/vx_kernels.h>
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
81 #define TIVX_KERNEL_VPAC_MSC_MULTI_SCALE_NAME "com.ti.hwa.vpac_msc_multi_scale"
82 
86 #define TIVX_KERNEL_VPAC_MSC_PYRAMID_NAME "com.ti.hwa.vpac_msc_pyramid"
87 
91 #define TIVX_KERNEL_VPAC_MSC_MULTI_SCALE2_NAME "com.ti.hwa.vpac_msc_multi_scale2"
92 
93 /*********************************
94  * VPAC_MSC Control Commands
95  *********************************/
96 
103 #define TIVX_VPAC_MSC_CMD_SET_COEFF (0x20000000u)
104 
120 #define TIVX_VPAC_MSC_CMD_SET_INPUT_PARAMS (0x20000001u)
121 
140 #define TIVX_VPAC_MSC_CMD_SET_OUTPUT_PARAMS (0x20000002u)
141 
164 #define TIVX_VPAC_MSC_CMD_SET_CROP_PARAMS (0x20000003u)
165 
182 #define TIVX_VPAC_MSC_CMD_GET_ERR_STATUS (0x20000004u)
183 
187 #define TIVX_VPAC_MSC_CMD_GET_PSA_STATUS (0x20000005u)
188 
192 #define TIVX_VPAC_MSC_CMD_ENABLE_ERROR_EVENTS (0x20000006u)
193 
194 /* MSC: Add command for enabling safety mechanism */
195 #define TIVX_VPAC_MSC_CMD_ENABLE_SAFETY_MECHANISM (0x20000007u)
196 
197 /*********************************
198  * VPAC_MSC Defines
199  *********************************/
200 
208 #define TIVX_VPAC_MSC_MAX_MP_COEFF_SET (4U)
209 
211 #define TIVX_VPAC_MSC_MAX_SP_COEFF_SET (2U)
212 
215 #define TIVX_VPAC_MSC_MAX_OUTPUT (10U)
216 
218 #define TIVX_VPAC_MSC_MAX_TAP (5U)
219 
221 #define TIVX_VPAC_MSC_32_PHASE_COEFF (32U)
222 
224 #define TIVX_VPAC_MSC_AUTOCOMPUTE (0xFFFFFFFFU)
225 
227 #define TIVX_VPAC_MSC_INTERPOLATION_GAUSSIAN_32_PHASE (0)
228 
230 #define TIVX_VPAC_MSC_MODE_LUMA_ONLY (0U)
231 
233 #define TIVX_VPAC_MSC_MODE_CHROMA_ONLY (1U)
234 
236 #define TIVX_VPAC_MSC_MODE_420SP_UV_CHROMA_ONLY (1U)
237 
239 #define TIVX_VPAC_MSC_MODE_420SP_VU_CHROMA_ONLY (2U)
240 
242 #define TIVX_VPAC_MSC_MODE_422SP_UV_CHROMA_ONLY (3U)
243 
245 #define TIVX_VPAC_MSC_MODE_422SP_VU_CHROMA_ONLY (4U)
246 
248 #define TIVX_VPAC_MSC_INIT_DIV_FACTOR (1U)
249 
251 #define TIVX_VPAC_MSC_DEFAULT_MAX_DS_FACTOR (2U)
252 
254 #define TIVX_VPAC_MSC_VBUSM_RD_ERR (0x4U)
255 
257 #define TIVX_VPAC_MSC_SL2_WR_ERR (0x8U)
258 
260 #define TIVX_VPAC_MSC0_WDTIMER_ERR (0x40000000U)
261 
263 #define TIVX_VPAC_MSC1_WDTIMER_ERR (0x80000000U)
264 
266 #define TIVX_VPAC_MSC0_ALL_ERR_EVENTS ( \
267  TIVX_VPAC_MSC_VBUSM_RD_ERR | \
268  TIVX_VPAC_MSC_SL2_WR_ERR | \
269  TIVX_VPAC_MSC0_WDTIMER_ERR \
270 )
271 
273 #define TIVX_VPAC_MSC1_ALL_ERR_EVENTS ( \
274  TIVX_VPAC_MSC_VBUSM_RD_ERR | \
275  TIVX_VPAC_MSC_SL2_WR_ERR | \
276  TIVX_VPAC_MSC1_WDTIMER_ERR \
277 )
278 
279 #define TIVX_VPAC_MSC_WDTIMER_DISABLE (0u)
280 
281 #define TIVX_VPAC_MSC_WDTIMER_ENABLE (1u)
282 
283 #define TIVX_VPAC_MSC_WDTIMER_64K_CYCLES (0u)
284 
285 #define TIVX_VPAC_MSC_WDTIMER_128K_CYCLES (1u)
286 
288 #define TIVX_VPAC_MSC_MAX_COMP (2u)
289 
292 /*********************************
293  * VPAC_MSC STRUCTURES
294  *********************************/
295 
302 typedef struct {
306  int32_t multi_phase[TIVX_VPAC_MSC_MAX_MP_COEFF_SET]
309 
316 typedef struct {
322  uint32_t horz_coef_src;
330  uint32_t horz_coef_sel;
336  uint32_t vert_coef_src;
344  uint32_t vert_coef_sel;
346 
353 typedef struct {
355  uint32_t phase_mode;
364  uint32_t horz_coef_sel;
373  uint32_t vert_coef_sel;
378  uint32_t init_phase_x;
383  uint32_t init_phase_y;
385 
391 typedef struct {
393  uint32_t crop_start_x;
395  uint32_t crop_start_y;
397  uint32_t crop_width;
399  uint32_t crop_height;
401 
407 typedef struct {
410  uint32_t signed_data;
413  uint32_t filter_mode;
416  uint32_t coef_shift;
420  uint32_t saturation_mode;
424  uint32_t offset_x;
428  uint32_t offset_y;
432 
438 
445 typedef struct {
447  uint32_t kern_sz;
449  uint32_t src_ln_inc_2;
457  uint32_t yc_mode;
467  uint32_t max_ds_factor;
468  #if defined(VPAC3) || defined(VPAC3L)
469 
472  uint32_t is_enable_simul_processing;
477  uint32_t in_img0_yc_mode;
481  uint32_t in_img1_yc_mode;
482  #endif
483 
509  uint32_t enable_psa;
517 
523 typedef struct {
530 
536  uint64_t timestamp;
538 
562 typedef struct {
563 
564  /* This flag will be used to control the reconfig of MMR safety mechanism feature */
565  /*
566  * Note: The user/application must periodically trigger the control command
567  * "TIVX_VPAC_MSC_CMD_SET_COEFF" along with "TIVX_VPAC_MSC_CMD_ENABLE_SAFETY_MECHANISM".
568  * This ensures that the MSC coefficients are reconfigured for every frame being processed.
569  */
570  uint32_t enable_reconfig_and_reinit_Reg;
571 
572  /* This flag will be used to control the status register validation safety mechanism feature */
573  uint32_t enable_status_reg_validation;
574 
575  /* This flag will be used to control the readback of configuration registers for safety validation */
576  uint32_t enable_readback_config_registers;
577 
579 
580 /*********************************
581  * Function Prototypes
582  *********************************/
583 
589 
595 
662  vx_image in_img0,
663  vx_image out0_img,
664  vx_image out1_img,
665  vx_image out2_img,
666  vx_image out3_img,
667  vx_image out4_img);
668 
780  vx_image in_img0,
781  vx_image out0_img,
782  vx_image out1_img,
783  vx_image out2_img,
784  vx_image out3_img,
785  vx_image out4_img,
786  vx_image in_img1,
787  vx_image out5_img,
788  vx_image out6_img,
789  vx_image out7_img,
790  vx_image out8_img,
791  vx_image out9_img);
792 
828  vx_image in_img,
829  vx_pyramid out_pyramid);
830 
831 
846 
856 
866 
867 #if !defined(VPAC3L)
868 
877 #endif
878 #ifdef __cplusplus
879 }
880 #endif
881 
882 #endif /* HWA_VPAC_MSC_H_ */
883 
struct _vx_image * vx_image
VX_API_ENTRY vx_node VX_API_CALL tivxVpacMscScaleNode(vx_graph graph, vx_image in_img0, vx_image out0_img, vx_image out1_img, vx_image out2_img, vx_image out3_img, vx_image out4_img)
Creates a VPAC_MSC Node with multi-scale outputs (at most 5 outputs).
Safety parameters structure for VPAC MSC.
Definition: hwa_vpac_msc.h:562
void tivx_vpac_msc_safety_mech_prms_init(tivx_vpac_msc_safety_mechanism_params_t *prms)
Function to initialize MSC safety mechanism parameters with default values.
The coefficients input data structure used by the TIVX_KERNEL_VPAC_MSC kernel.
Definition: hwa_vpac_msc.h:302
#define TIVX_VPAC_MSC_MAX_SP_COEFF_SET
Definition: hwa_vpac_msc.h:211
int32_t vx_enum
VX_API_ENTRY vx_node VX_API_CALL tivxVpacMscPyramidNode(vx_graph graph, vx_image in_img, vx_pyramid out_pyramid)
Creates a VPAC_MSC Node with multi-scale pyramid output.
Structure to hold PSA timestamp data.
Definition: hwa_vpac_msc.h:523
void tivxRegisterHwaTargetVpacMscKernels(void)
Function to register HWA Kernels on the vpac_msc Target.
#define TIVX_VPAC_MSC_MAX_TAP
Definition: hwa_vpac_msc.h:218
uint64_t timestamp
Timestamp value.
Definition: hwa_vpac_msc.h:536
void tivx_vpac_msc_coefficients_params_init(tivx_vpac_msc_coefficients_t *coeff, vx_enum interpolation)
Function to initialize MSC Coefficients Parameters This initializes Coefficients to default values...
void tivxUnRegisterHwaTargetVpacMscKernels(void)
Function to un-register HWA Kernels on the vpac_msc Target.
The input config data structure used by the TIVX_KERNEL_VPAC_MSC kernel.
Definition: hwa_vpac_msc.h:445
struct _vx_pyramid * vx_pyramid
The configuration data structure used by the TIVX_KERNEL_VPAC_MSC kernel.
Definition: hwa_vpac_msc.h:316
#define TIVX_VPAC_MSC_MAX_COMP
Maximum possible MSC iteration for a simgle request (Luma + Chroma)
Definition: hwa_vpac_msc.h:288
The output config data structure used by the TIVX_KERNEL_VPAC_MSC kernel.
Definition: hwa_vpac_msc.h:407
#define TIVX_VPAC_MSC_MAX_OUTPUT
Definition: hwa_vpac_msc.h:215
#define TIVX_VPAC_MSC_32_PHASE_COEFF
Definition: hwa_vpac_msc.h:221
VX_API_ENTRY vx_node VX_API_CALL tivxVpacMscScaleNode2(vx_graph graph, vx_image in_img0, vx_image out0_img, vx_image out1_img, vx_image out2_img, vx_image out3_img, vx_image out4_img, vx_image in_img1, vx_image out5_img, vx_image out6_img, vx_image out7_img, vx_image out8_img, vx_image out9_img)
Creates a VPAC_MSC Node with multi-scale outputs (at most 10 outputs). This node takes at most 2 sing...
void tivx_vpac_msc_input_params_init(tivx_vpac_msc_input_params_t *prms)
Function to initialize MSC input Parameters This is used for control command: TIVX_VPAC_MSC_CMD_SET_I...
struct _vx_graph * vx_graph
void tivx_vpac_msc_output_params_init(tivx_vpac_msc_output_params_t *prms)
Function to initialize MSC output Parameters This is used for control command: TIVX_VPAC_MSC_CMD_SET_...
struct _vx_node * vx_node
tivx_vpac_msc_single_phase_params_t single_phase
Definition: hwa_vpac_msc.h:434
The multi_phase data structure in the configuration data structure used by the TIVX_KERNEL_VPAC_MSC k...
Definition: hwa_vpac_msc.h:353
The crop config data structure used by the TIVX_KERNEL_VPAC_MSC kernel.
Definition: hwa_vpac_msc.h:391
vx_status(* VX_API_CALL)(vx_reference *ref)
Callback type used to register release callbacks from object derived from references.
Definition: vx_reference.h:56
#define TIVX_VPAC_MSC_MAX_MP_COEFF_SET
Definition: hwa_vpac_msc.h:208
tivx_vpac_msc_multi_phase_params_t multi_phase
Definition: hwa_vpac_msc.h:436