Files
gk-sdk/sample/common/sample_comm.h
T

245 lines
7.0 KiB
C
Executable File

/*
* Copyright (c) XMEDIA. All rights reserved.
*/
#ifndef __SAMPLE_COMM_H__
#define __SAMPLE_COMM_H__
#include "xmedia_type.h"
#include "xmedia_video_common.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* End of #ifdef __cplusplus */
#define SAMPLE_PRT(fmt...) \
do {\
printf("[%s]-%d: ", __FUNCTION__, __LINE__);\
printf(fmt);\
} while(0)
#define SAMPLE_ERR(fmt...) \
do {\
printf("[%s]-%d: ", __FUNCTION__, __LINE__);\
printf(fmt);\
} while(0)
#ifndef CHECK_RET
#define CHECK_RET(express, name)\
do {\
xmedia_s32 express_ret;\
express_ret = express;\
if (XMEDIA_SUCCESS != express_ret) {\
printf("%s failed at %s: line: %d with %#x!\n", name, __FUNCTION__, __LINE__, express_ret);\
return express_ret;\
}\
} while (0)
#endif
#define CHECK_NULL_PTR(p)\
do {\
if (XMEDIA_NULL == p) {\
printf("null ptr at %s: line: %d\n", __FUNCTION__, __LINE__);\
return XMEDIA_FAILURE;\
}\
} while (0)
#define CHECK_NULL_PTR_VOID(p)\
do {\
if (XMEDIA_NULL == p) {\
printf("null ptr at %s: line: %d\n", __FUNCTION__, __LINE__);\
}\
} while (0)
#define PAUSE(exit)\
printf("---------------press any key to exit!---------------\n");\
do {\
xmedia_s32 c = sample_comm_sys_getchar_timeout(200);\
if (XMEDIA_FAILURE != c) {\
break;\
}\
} while (!exit)
#define SAMPLE_COMM_COMPONENT_NUM 3
#define MAX_SENSOR_NUM 5
#define MAX_SCREEN_NUM 2
typedef enum pic_size_e
{
PIC_CIF,
PIC_360P, /* 640 * 360 */
PIC_VGA,
PIC_640x360,
PIC_D1_PAL, /* 720 * 576 */
PIC_D1_NTSC, /* 720 * 480 */
PIC_720P, /* 1280 * 720 */
PIC_1080P, /* 1920 * 1080 */
PIC_2304x1296,
PIC_2560x1440,
PIC_2560x1920,
PIC_2592x1520,
PIC_2592x1536,
PIC_2592x1944,
PIC_2688x1520,
PIC_2688x1536,
PIC_2688x1944,
PIC_2716x1524,
PIC_2880x1620,
PIC_3840x2160,
PIC_4096x2160,
PIC_3000x3000,
PIC_4000x3000,
PIC_7680x4320,
PIC_3840x8640,
PIC_3072x1728,
PIC_BUTT
} pic_size_e;
typedef enum {
SONY_IMX290_MIPI_2M_30FPS_10BIT = 0,
SONY_IMX290_MIPI_2M_30FPS_16BIT,
SONY_IMX290_MIPI_2M_30FPS_10BIT_WDR2TO1,
SONY_IMX327_MIPI_2M_30FPS_12BIT,
SONY_IMX307_MIPI_2M_2L_30FPS_10BIT,
SONY_IMX307_MIPI_2M_2L_30FPS_10BIT_WDR2TO1,
SONY_IMX415_MIPI_8M_20FPS_10BIT,
SONY_IMX415_MIPI_8M_20FPS_10BIT_WDR2TO1,
SONY_IMX678_MIPI_8M_20FPS_12BIT,
SONY_IMX678_MIPI_8M_20FPS_10BIT_WDR2TO1,
SONY_IMX179_MIPI_8M_20FPS_10BIT,
SONY_IMX179_MIPI_640_480_120FPS_10BIT,
GALAXYCORE_GC2053_MIPI_2M_30FPS_10BIT,
GALAXYCORE_GC2053_MIPI_2M_30FPS_10BIT_WDR2TO1,
GALAXYCORE_GC20C3_MIPI_2M_30FPS_10BIT,
GALAXYCORE_GC2083_MIPI_2M_30FPS_10BIT,
GALAXYCORE_GC4663_MIPI_4M_30FPS_10BIT,
GALAXYCORE_GC4663_MIPI_4M_25FPS_10BIT_WDR2TO1,
GALAXYCORE_GC8613_MIPI_8M_20FPS_14BIT,
GALAXYCORE_GC8613_MIPI_8M_20FPS_10BIT,
GALAXYCORE_GC5603_MIPI_5M_30FPS_10BIT,
GALAXYCORE_GC4653_MIPI_4M_30FPS_10BIT,
GALAXYCORE_GC6603_MIPI_5M_30FPS_10BIT,
GALAXYCORE_OV4689_MIPI_4M_30FPS_10BIT,
SMART_SC8238_MIPI_2M_30FPS_10BIT,
SMART_SC8238_MIPI_2M_30FPS_10BIT_WDR2TO1,
SMART_SC8238_MIPI_3M_30FPS_10BIT,
SMART_SC8238_MIPI_3M_30FPS_10BIT_WDR2TO1,
SMART_SC8238_MIPI_4M_30FPS_10BIT,
SMART_SC8238_MIPI_4M_30FPS_10BIT_WDR2TO1,
SMART_SC8238_MIPI_5M_30FPS_10BIT,
SMART_SC8238_MIPI_5M_30FPS_10BIT_WDR2TO1,
SMART_SC8238_MIPI_8M_20FPS_10BIT,
SMART_SC8238_MIPI_8M_20FPS_10BIT_WDR2TO1,
SMART_SC4336_MIPI_4M_30FPS_10BIT,
SMART_SC4336P_MIPI_4M_30FPS_10BIT,
SMART_SC3338_MIPI_3M_30FPS_10BIT,
OMNIVISION_OS08A20_MIPI_2M_30FPS_10BIT,
OMNIVISION_OS08A20_MIPI_2M_30FPS_10BIT_WDR2TO1,
OMNIVISION_OS08A20_MIPI_4M_30FPS_10BIT,
OMNIVISION_OS08A20_MIPI_4M_30FPS_10BIT_WDR2TO1,
OMNIVISION_OS08A20_MIPI_5M_30FPS_10BIT,
OMNIVISION_OS08A20_MIPI_5M_30FPS_10BIT_WDR2TO1,
OMNIVISION_OS08A20_MIPI_8M_20FPS_10BIT,
OMNIVISION_OS08A20_MIPI_8M_20FPS_10BIT_WDR2TO1,
OMNIVISION_OS05A10_MIPI_4M_30FPS_12BIT,
OMNIVISION_OS05A10_MIPI_4M_30FPS_10BIT_WDR2TO1,
OMNIVISION_OS05A10_MIPI_5M_30FPS_12BIT,
OMNIVISION_OS05A10_MIPI_5M_30FPS_10BIT_WDR2TO1,
OMNIVISION_OS02K10_MIPI_2M_30FPS_10BIT,
OMNIVISION_OS02K10_MIPI_2M_30FPS_12BIT_BUILT_IN,
OMNIVISION_OX03F10_MIPI_1M_10FPS_14BIT_BUILT_IN,
OMNIVISION_OX03F10_MIPI_3M_60FPS_14BIT_BUILT_IN,
OMNIVISION_OX03F10_MIPI_3M_60FPS_10BIT,
SMART_SC850SL_MIPI_8M_20FPS_12BIT,
SMART_SC850SL_MIPI_8M_20FPS_10BIT_WDR2TO1,
SMART_SC850SL_MIPI_5M_30FPS_12BIT,
SMART_SC850SL_MIPI_5M_20FPS_10BIT_WDR2TO1,
SMART_SC850SL_MIPI_4M_30FPS_12BIT,
SMART_SC850SL_MIPI_4M_20FPS_10BIT_WDR2TO1,
SMART_SC485SL_MIPI_4M_2688_1520_30FPS_4LANE_12BIT,
SMART_SC485SL_MIPI_4M_2560_1440_30FPS_4LANE_12BIT,
SMART_SC485SL_MIPI_4M_30FPS_2LANE_12BIT,
SMART_SC485SL_MIPI_4M_30FPS_4LANE_10BIT_WDR2TO1,
SMART_SC231HAI_MIPI_2M_2LANE_30FPS_10BIT,
SMART_SC235HAI_MIPI_2M_2LANE_30FPS_10BIT,
SMART_SC431HAI_MIPI_4M_30FPS_10BIT,
SMART_SC435HAI_MIPI_4M_30FPS_10BIT,
SMART_SC285SL_MIPI_2M_4LANE_30FPS_12BIT,
SMART_SC285SL_MIPI_2M_2LANE_30FPS_12BIT,
SMART_SC533HAI_MIPI_5M_2L_30FPS_10BIT,
SMART_SC465SL_MIPI_4M_4LANE_30FPS_12BIT,
SMART_SC465SL_MIPI_4M_2LANE_30FPS_12BIT,
SMART_SC465SL_MIPI_4M_30FPS_4LANE_10BIT_WDR2TO1,
IMAGEDESIGN_MIS40H1_MIPI_4M_2LANE_30FPS_10BIT,
IMAGEDESIGN_MIS20S1_MIPI_2M_2LANE_30FPS_10BIT,
CVSENS_CV4003_MIPI_4M_30FPS_10BIT,
CVSENS_CV4003_MIPI_1M_120FPS_10BIT_PREROLL_READBACK,
CVSENS_CV2005_MIPI_2M_30FPS_10BIT,
SMART_SC200AI_MIPI_2M_30FPS_10BIT,
SMART_SC200AI_MIPI_2M_30FPS_10BIT_WDR2TO1,
SMART_SC500AI_MIPI_5M_30FPS_10BIT,
SMART_SC500AI_MIPI_5M_30FPS_10BIT_WDR2TO1,
SMART_SC450AI_MIPI_4M_30FPS_10BIT,
SMART_SC2337P_MIPI_2M_30FPS_10BIT,
SMART_SC530AI_MIPI_5M_4L_30FPS_10BIT,
SMART_SC530AI_MIPI_5M_2L_30FPS_10BIT,
SMART_SC530AI_MIPI_5M_4L_30FPS_10BIT_WDR2TO1,
OMNIVISION_OS04A10_MIPI_4M_30FPS_12BIT,
OMNIVISION_OS04A10_MIPI_4M_30FPS_10BIT_WDR2TO1,
OMNIVISION_OS04D10_MIPI_4M_30FPS_10BIT,
OMNIVISION_OS04C10_MIPI_4M_30FPS_10BIT,
OMNIVISION_OS04J10_MIPI_4M_30FPS_12BIT,
SONY_IMX334_MIPI_8M_20FPS_12BIT,
OMNIVISION_OX05B1S_MIPI_1M_30FPS_10BIT, //RGBIR
OMNIVISION_OX05B1S_MIPI_5M_60FPS_10BIT,
VI_AHD_MIPI_2M_YUV,
SENSOR_TYPE_INVALID,
} sample_comm_sensor_type;
typedef struct {
xmedia_video_format video_fmt;
xmedia_video_pixel_format pixel_fmt;
xmedia_video_data_width data_width;
xmedia_video_compress_mode compress_mode;
} sample_comm_video_param;
typedef enum {
BOARD_TYPE_XM7206_V10_RB = 0,
BOARD_TYPE_XM7206_V10B_RBA,
BOARD_TYPE_XM7206_V10B_EVB,
BOARD_TYPE_XM7206_V11A_RBA,
BOARD_TYPE_XM7206_V11A_EVB,
BOARD_TYPE_MAX,
} sample_comm_board_type;
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* End of #ifndef __SAMPLE_COMM_H__ */