Skip to content

Commit

Permalink
Update samples and fix include dir
Browse files Browse the repository at this point in the history
  • Loading branch information
ZigFisher committed Jun 11, 2018
1 parent 3cfc287 commit 46526fd
Show file tree
Hide file tree
Showing 18 changed files with 687 additions and 574 deletions.
1 change: 0 additions & 1 deletion hisi-sample/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ define Package/$(PKG_NAME)
SUBMENU:=Hisilicon OSDRV-2 for HI35_16C_18E_V200 with kernel 3.4.35
MAINTAINER:[email protected]
DEPENDS:=+hisi-osdrv2-lib +libpthread
#DEPENDS:=+libstdcpp +libyaml-cpp +libpthread +hidrv
endef

define Package/$(PKG_NAME)/description
Expand Down
16 changes: 9 additions & 7 deletions hisi-sample/src/jpg.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern "C"{
/******************************************************************************
* function : Thumbnail of 1*1080p jpeg
******************************************************************************/
HI_S32 VENC_1080P_JPEG_Thumb(SOC_TYPE socType, SAMPLE_VI_MODE_E sensorType) {
HI_S32 VENC_1080P_JPEG_Thumb(SOC_TYPE socType, SAMPLE_VI_MODE_E sensorType, const char *img_path) {
VIDEO_NORM_E gs_enNorm = VIDEO_ENCODING_MODE_NTSC;
/******************************************
step 1: init sys variable
Expand Down Expand Up @@ -194,7 +194,7 @@ HI_S32 VENC_1080P_JPEG_Thumb(SOC_TYPE socType, SAMPLE_VI_MODE_E sensorType) {
/******************************************
step 7: stream venc process -- get stream, then save it to file.
******************************************/
s32Ret = SAMPLE_COMM_VENC_SnapProcess(VencChn, HI_TRUE, HI_TRUE);
s32Ret = SAMPLE_COMM_VENC_SnapProcess(VencChn, img_path, HI_TRUE, HI_FALSE);
if (HI_SUCCESS != s32Ret) {
printf("%s: sanp process failed!\n", __FUNCTION__);
}
Expand Down Expand Up @@ -228,18 +228,20 @@ HI_S32 VENC_1080P_JPEG_Thumb(SOC_TYPE socType, SAMPLE_VI_MODE_E sensorType) {


int main(int argc, char *argv[]) {
SOC_TYPE socType;
HI_S32 s32Ret = initSoc(argc, argv, &socType);
if (s32Ret == HI_FAILURE) return EXIT_FAILURE;
SOC_TYPE socType = hi3518ev200;
// HI_S32 s32Ret = initSoc(argc, argv, &socType);
// if (s32Ret == HI_FAILURE) return EXIT_FAILURE;
char *image_path = "/tmp/snap.jpg";
if (argc >= 2) image_path = argv[2];

SAMPLE_VI_MODE_E sensorType;
s32Ret = initSensor(argc, argv, &sensorType);
HI_S32 s32Ret = initSensor(argc, argv, &sensorType);
if (s32Ret == HI_FAILURE) return EXIT_FAILURE;

signal(SIGINT, SAMPLE_VENC_HandleSig);
signal(SIGTERM, SAMPLE_VENC_HandleSig);

s32Ret = VENC_1080P_JPEG_Thumb(socType, sensorType);
s32Ret = VENC_1080P_JPEG_Thumb(socType, sensorType, image_path);
if (HI_SUCCESS == s32Ret) return EXIT_SUCCESS;
printf("program exit abnormally EXIT_FAILURE!\n");
UnloadSensorLibrary();
Expand Down
5 changes: 2 additions & 3 deletions hisi-sample/src/loadbmp.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __LOAD_BMP_H__
#define __LOAD_BMP_H__

#include "hi_type.h"
#include <hi_type.h>

#ifdef __cplusplus
#if __cplusplus
Expand Down Expand Up @@ -68,7 +68,7 @@ typedef struct tag_OSD_BITMAPFILEHEADER {
HI_U16 bfReserved1;
HI_U16 bfReserved2;
HI_U32 bfOffBits;
} OSD_BITMAPFILEHEADER;
} OSD_BITMAPFILEHEADER;

typedef struct tag_OSD_RGBQUAD {
HI_U8 rgbBlue;
Expand Down Expand Up @@ -104,4 +104,3 @@ HI_S32 GetBmpInfo(const HI_CHAR *filename, OSD_BITMAPFILEHEADER *pBmpFileHeader
#endif /* End of #ifdef __cplusplus */

#endif /* End of #ifndef __LOAD_BMP_H__*/

8 changes: 4 additions & 4 deletions hisi-sample/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ extern int g_s32Quit ;
extern void * SAMPLE_VENC_1080P_CLASSIC(void *p);
int main(int argc, char *argv[])
{
SOC_TYPE socType;
HI_S32 s32Ret = initSoc(argc, argv, &socType);
if (s32Ret == HI_FAILURE) return EXIT_FAILURE;
SOC_TYPE socType = hi3518ev200;
// HI_S32 s32Ret = initSoc(argc, argv, &socType);
// if (s32Ret == HI_FAILURE) return EXIT_FAILURE;

SAMPLE_VI_MODE_E enMode;
s32Ret = initSensor(argc, argv, &enMode);
HI_S32 s32Ret = initSensor(argc, argv, &enMode);
if (s32Ret == HI_FAILURE) return EXIT_FAILURE;

signal(SIGINT, SAMPLE_VENC_HandleSig);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
118 changes: 64 additions & 54 deletions hisi-sample/src/sample_comm.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,51 @@
#ifndef __SAMPLE_COMM_H__
#define __SAMPLE_COMM_H__

#include "hi_common.h"
#include "hi_comm_sys.h"
#include "hi_comm_vb.h"
#include "hi_comm_isp.h"
#include "hi_comm_vi.h"
#include "hi_comm_vo.h"
#include "hi_comm_venc.h"
#include "hi_comm_vpss.h"
#include "hi_comm_vdec.h"
#include "hi_comm_region.h"
#include "hi_comm_adec.h"
#include "hi_comm_aenc.h"
#include "hi_comm_ai.h"
#include "hi_comm_ao.h"
#include "hi_comm_aio.h"
#include "hi_defines.h"

#include "mpi_sys.h"
#include "mpi_vb.h"
#include "mpi_vi.h"
#include "mpi_vo.h"
#include "mpi_venc.h"
#include "mpi_vpss.h"
#include "mpi_vdec.h"
#include "mpi_region.h"
#include "mpi_adec.h"
#include "mpi_aenc.h"
#include "mpi_ai.h"
#include "mpi_ao.h"
#include "mpi_isp.h"
#include "mpi_ae.h"
#include "mpi_awb.h"
#include "mpi_af.h"
#include "hi_vreg.h"
#include "hi_sns_ctrl.h"
#include <hi_common.h>
#include <hi_comm_sys.h>
#include <hi_comm_vb.h>
#include <hi_comm_isp.h>
#include <hi_comm_vi.h>
#include <hi_comm_vo.h>
#include <hi_comm_venc.h>
#include <hi_comm_vpss.h>
#include <hi_comm_vdec.h>
#include <hi_comm_region.h>
#include <hi_comm_adec.h>
#include <hi_comm_aenc.h>
#include <hi_comm_ai.h>
#include <hi_comm_ao.h>
#include <hi_comm_aio.h>
#include <hi_defines.h>
#include <hi_mipi.h>



#include <hi_debug.h>
#include <hi_comm_video.h>
#include <hi_comm_ive.h>
#include <hi_comm_vgs.h>

#include <mpi_sys.h>
#include <mpi_vb.h>
#include <mpi_vi.h>
#include <mpi_vo.h>
#include <mpi_venc.h>
#include <mpi_vpss.h>
#include <mpi_vdec.h>
#include <mpi_region.h>
#include <mpi_adec.h>
#include <mpi_aenc.h>
#include <mpi_ai.h>
#include <mpi_ao.h>
#include <mpi_isp.h>
#include <mpi_ae.h>
#include <mpi_awb.h>
#include <mpi_af.h>
#include <hi_vreg.h>
#include <hi_sns_ctrl.h>

#include <mpi_ive.h>


#ifdef __cplusplus
Expand All @@ -53,7 +63,7 @@ extern "C"{
#endif /* End of #ifdef __cplusplus */

/*******************************************************
macro define
macro define
*******************************************************/
#define FILE_NAME_LEN 128
#define ALIGN_UP(x, a) ((x+a-1)&(~(a-1)))
Expand Down Expand Up @@ -88,7 +98,7 @@ extern "C"{
#define TLV320_FILE "/dev/tlv320aic31"


#if (HICHIP == HI3518E_V200)
#if (HICHIP == HI3518E_V200)
#define SAMPLE_VO_DEV_DSD1 0
#define SAMPLE_VO_DEV_DSD0 SAMPLE_VO_DEV_DSD1
#else
Expand Down Expand Up @@ -118,7 +128,7 @@ do{\
printf("---------------press the Enter key to exit!---------------\n");\
getchar();\
} while (0)


#define SAMPLE_PRT(fmt...) \
do {\
Expand All @@ -141,14 +151,14 @@ do{\
#define WIDTH_LCD 240
#define HEIGHT_LCD 320
#endif

#ifdef LCD_ILI9342
#define INTF_LCD VO_INTF_LCD_6BIT
#define SYNC_LCD VO_OUTPUT_320X240_50
#define WIDTH_LCD 320
#define HEIGHT_LCD 240
#endif

#ifdef LCD_OTA5182
#define INTF_LCD VO_INTF_LCD_8BIT
#define SYNC_LCD VO_OUTPUT_320X240_60
Expand All @@ -174,7 +184,7 @@ do{\


/*******************************************************
enum define
enum define
*******************************************************/

typedef enum sample_ispcfg_opt_e
Expand All @@ -186,7 +196,7 @@ typedef enum sample_ispcfg_opt_e
}SAMPLE_CFG_OPT_E;

typedef enum sample_vi_mode_e
{
{
APTINA_AR0130_DC_720P_30FPS = 0,
APTINA_9M034_DC_720P_30FPS,
APTINA_AR0230_HISPI_1080P_30FPS,
Expand Down Expand Up @@ -220,7 +230,7 @@ typedef struct hithreadArgs_tag {
SAMPLE_VI_MODE_E enMode;
} hithreadArgs_t;

typedef enum
typedef enum
{
VI_DEV_BT656_D1_1MUX = 0,
VI_DEV_BT656_D1_4MUX,
Expand All @@ -245,7 +255,7 @@ typedef enum sample_vo_mode_e
VO_MODE_2MUX = 1,
VO_MODE_BUTT
}SAMPLE_VO_MODE_E;

typedef enum sample_rc_e
{
SAMPLE_RC_CBR = 0,
Expand All @@ -262,7 +272,7 @@ typedef enum sample_rgn_change_type_e


/*******************************************************
structure define
structure define
*******************************************************/
typedef struct sample_vi_param_s
{
Expand All @@ -282,7 +292,7 @@ typedef struct sample_video_loss_s

typedef struct sample_vi_frame_info_s
{
VB_BLK VbBlk;
VB_BLK VbBlk;
VIDEO_FRAME_INFO_S stVideoFrame;
HI_U32 u32FrmSize;
}SAMPLE_VI_FRAME_INFO_S;
Expand All @@ -297,15 +307,15 @@ typedef struct sample_venc_getstream_s
typedef struct sample_vi_config_s
{
SAMPLE_VI_MODE_E enViMode;
VIDEO_NORM_E enNorm; /*DC: VIDEO_ENCODING_MODE_AUTO */
VIDEO_NORM_E enNorm; /*DC: VIDEO_ENCODING_MODE_AUTO */
ROTATE_E enRotate;
SAMPLE_VI_CHN_SET_E enViChnSet;
SAMPLE_VI_CHN_SET_E enViChnSet;
WDR_MODE_E enWDRMode;
}SAMPLE_VI_CONFIG_S;


/*******************************************************
function announce
function announce
*******************************************************/
HI_S32 SAMPLE_COMM_SYS_GetPicSize(VIDEO_NORM_E enNorm, PIC_SIZE_E enPicSize, SIZE_S *pstSize);
HI_U32 SAMPLE_COMM_SYS_CalcPicVbBlkSize(VIDEO_NORM_E enNorm, PIC_SIZE_E enPicSize, PIXEL_FORMAT_E enPixFmt, HI_U32 u32AlignWidth);
Expand Down Expand Up @@ -343,7 +353,7 @@ HI_S32 SAMPLE_COMM_VI_ChangeCapSize(VI_CHN ViChn, HI_U32 u32CapWidth, HI_U32 u32
HI_S32 SAMPLE_COMM_VI_StartVi(SAMPLE_VI_CONFIG_S* pstViConfig);
HI_S32 SAMPLE_COMM_VI_StopVi(SAMPLE_VI_CONFIG_S* pstViConfig);
HI_S32 SAMPLE_COMM_VI_SwitchResParam( SAMPLE_VI_CONFIG_S* pstViConfig,
ISP_PUB_ATTR_S *pstPubAttr,
ISP_PUB_ATTR_S *pstPubAttr,
RECT_S *pstCapRect );


Expand All @@ -359,14 +369,14 @@ HI_S32 SAMPLE_COMM_VI_FPN_CALIBRATE_CONFIG(const char* fpn_file, /* fpn file
HI_S32 SAMPLE_COMM_VI_CORRECTION_CONFIG(const char* fpn_file, /* fpn file_name */
ISP_FPN_TYPE_E enFpnType, /* line/frame */
ISP_OP_TYPE_E enOpType, /* auto/manual */
HI_U32 u32Strength, /* strength */
HI_U32 u32Strength, /* strength */
PIXEL_FORMAT_E enPixelFormat);

HI_S32 SAMPLE_COMM_VPSS_MemConfig();
HI_S32 SAMPLE_COMM_VPSS_Start(HI_S32 s32GrpCnt, SIZE_S *pstSize, HI_S32 s32ChnCnt,VPSS_GRP_ATTR_S *pstVpssGrpAttr);
HI_S32 SAMPLE_COMM_VPSS_Stop(HI_S32 s32GrpCnt, HI_S32 s32ChnCnt) ;
HI_S32 SAMPLE_COMM_VPSS_StartGroup(VPSS_GRP VpssGrp, VPSS_GRP_ATTR_S *pstVpssGrpAttr);
HI_S32 SAMPLE_COMM_VPSS_EnableChn(VPSS_GRP VpssGrp, VPSS_CHN VpssChn,
HI_S32 SAMPLE_COMM_VPSS_EnableChn(VPSS_GRP VpssGrp, VPSS_CHN VpssChn,
VPSS_CHN_ATTR_S *pstVpssChnAttr,
VPSS_CHN_MODE_S *pstVpssChnMode,
VPSS_EXT_CHN_ATTR_S *pstVpssExtChnAttr);
Expand All @@ -390,7 +400,7 @@ HI_S32 SAMPLE_COMM_VENC_MemConfig(HI_VOID);
HI_S32 SAMPLE_COMM_VENC_Start(VENC_CHN VencChn, PAYLOAD_TYPE_E enType, VIDEO_NORM_E enNorm, PIC_SIZE_E enSize, SAMPLE_RC_E enRcMode,HI_U32 u32Profile);
HI_S32 SAMPLE_COMM_VENC_Stop(VENC_CHN VencChn);
HI_S32 SAMPLE_COMM_VENC_SnapStart(VENC_CHN VencChn, SIZE_S *pstSize, HI_BOOL bSupportDCF);
HI_S32 SAMPLE_COMM_VENC_SnapProcess(VENC_CHN VencChn, HI_BOOL bSaveJpg, HI_BOOL bSaveThm);
HI_S32 SAMPLE_COMM_VENC_SnapProcess(VENC_CHN VencChn, const char *img_path, HI_BOOL bSaveJpg, HI_BOOL bSaveThm);
HI_S32 SAMPLE_COMM_VENC_SnapStop(VENC_CHN VencChn);
HI_S32 SAMPLE_COMM_VENC_StartGetStream(HI_S32 s32Cnt);
HI_S32 SAMPLE_COMM_VENC_StopGetStream();
Expand Down
Loading

0 comments on commit 46526fd

Please sign in to comment.