4. Tool Application Reference¶
4.1. toolofParameterasthe relevant informationimportexport?¶
4.1.1. usetoolimportexportParameter¶
CviPQ ToolsupportinPCthe relevant informationofjsonformatthe relevant informationfileimportandexport, andandsupportwilltoolofParameterthe relevant informationboard side.
ifuserthe relevant informationexportorimportCviPQ ToolofParameterfile, canreferencesection 2.4.3.1. and 2.4.3.2. ofDescriptionperformoperation.
ifuserthe relevant informationwillParameterimportthe relevant informationboard sideorfromboard sideexportthe relevant informationPCthe relevant informationperformthe relevant information, the relevant informationusethe relevant informationtool(Bin Utilitytool)performoperation.specificofoperationDescriptionas follows:
importexportboard sideParameterofBINfile
inalreadyconnectionthe relevant informationboard sideofthe relevant informationunder, clickmenubarthe relevant informationofBin Utility, that iscanopenthe relevant informationtoolwindow, as Figure as shown:
Figure 4.1 the relevant informationtool¶
inBin Import Exportthe relevant informationhasthe relevant informationbutton, respectivelyclickbuttoncancompleteas followsoperation:
importParameterbinfilethe relevant informationboard side: click"Import Bin File"inthe relevant informationofopenfiledialogthe relevant informationselectneedimportofthe relevant informationParameterbinfile, whentoolcompletethe relevant informationfilethe relevant informationboard sidewhen, Parameterwillthe relevant informationthat istake effect.
exportboard sideParameterbinfile: clickbin typedrop-downthe relevant informationselectexporttype, the relevant informationclick"Export Bin File"inthe relevant informationofsavefiledialogthe relevant informationselectthe relevant informationsavepath, toolwillwillboard sideabovethe relevant informationtypeofParametersaveinthe relevant informationofpath.
willParameterthe relevant informationFlash
inBin Fixthe relevant information, Descriptioninformationandwhenthe relevant informationinformationthe relevant information, canclick"Fix Bin to Flash"the relevant informationboard sidethe relevant information, willcurrentboard sideofParameterinformationwritethe relevant informationFlashthe relevant information.
4.1.2. usethe relevant informationimportexportimagequalityParameter¶
board sidetoolthe relevant informationimportexportParameterlibrary file, usingunderthe relevant informationwaythe relevant informationcanaccording tothe relevant informationofneedperformselect.Note: usingunderinterfacethe relevant informationincallCVI_ISP_Initinterfaceafterwardthe relevant informationcall.
obtainandsaveallmodulebindata(ISP x, VPSS, VOetc.):
CVI_BIN_GetBinTotalLen: obtainbindataofthe relevant informationlength;
CVI_BIN_ExportBinData: exportallmodulebindata;
CVI_BIN_ImportBinData: importbindata, willaccording tobinthe relevant informationofmoduledataandcurrentofallmoduleperformthe relevant information, willallthe relevant informationofdataimport;
obtainandsavesinglemodulebindata(ISP x, VPSS, VOetc.):
CVI_BIN_GetSingleISPBinLen: obtainthe relevant informationmoduleofbindataoflength;
CVI_BIN_ExportSingleISPBinData: exportsinglemodulebindata;
CVI_BIN_SaveParamToBin: exportallmodulebindata;
CVI_BIN_LoadParamFromBin: importsinglemodulebindata;
CVI_BIN_LoadParamFromBinEx: importsinglemodulebin(the relevant informationInputbuflength)data;
canreferencethe relevant informationuseflow, as followsFigureas shown.
itsthe relevant informationrelatedinterfaceAPIs:
CVI_BIN_SetBinName: setPQBinstoredpathandfilename;
CVI_BIN_GetBinName: obtainPQBinstoredpathandfilename;
CVI_BIN_GetBinExtraAttr: obtainbinthe relevant informationdatainformation;
CVI_ISP_BIN_SetBypassParams: setbinloadwhenParameterofthe relevant informationandthe relevant information, defaultthe relevant informationtake effect;
CVI_ISP_BIN_GetBypassParams: obtainbinloadwhenParameteroftake effectinformation;
4.1.3. APIreference¶
4.1.3.1. CVI_BIN_GetBinTotalLen¶
[Description]
obtainbindataofthe relevant informationlength.
[Syntax]
CVI_U32 CVI_BIN_GetBinTotalLen(void);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
None |
None |
None |
[Return Value]
Return Value |
Description |
|---|---|
CVI_U32 |
binfileofthe relevant informationlength |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
thisfunctionthe relevant informationincall CVI_BIN_ExportBinData interfacethe relevant informationcall.
[Example]
CVI_U32 u32BinLen = 0;
u32BinLen = CVI_BIN_GetBinTotalLen();
[Related Topics]
4.1.3.2. CVI_BIN_ExportBinData¶
[Description]
exportallmodulebindata.
[Syntax]
CVI_S32 CVI_BIN_ExportBinData(CVI_U8*pu8Buffer, CVI_U32 u32DataLength);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
pu8Buffer |
savepqbindataofbuffer |
Input |
u32DataLength |
pqbindataofthe relevant informationlength |
Input |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success. |
the relevant information 0 |
Failure,see its value in error code1. |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
callthisfunctionthe relevant informationcall CVI_BIN_GetBinTotalLen function, obtaindataofsize, otherwisecanthe relevant informationmemorythe relevant information.
[Example]
CVI_S32 ret = CVI_SUCCESS;
CVI_BIN_HEADER header;
CVI_U32 u32BinLen = 0, u32TempLen = 0;
CVI_U8 *pBuffer;
memset(&header, 0, sizeof(CVI_BIN_HEADER));
u32BinLen = CVI_BIN_GetBinTotalLen();
pBuffer = (CVI_U8 *)malloc(u32BinLen);
if (pBuffer == NULL) {
ISP_DAEMON_DEBUG(LOG_ALERT, "malloc err!\\n");
return CVI_FAILURE;
}
header.extraInfo = *binExtra;
memcpy(pBuffer, &header, sizeof(CVI_BIN_HEADER));
ret = CVI_BIN_ExportBinData(pBuffer, u32BinLen);
if (ret != CVI_SUCCESS) {
ISP_DAEMON_DEBUG_EX(LOG_ALERT, "CVI_BIN_ExportBinData err(%#x)!\\n", ret);
} else {
u32TempLen = fwrite(pBuffer, 1, u32BinLen, fp);
if (u32TempLen != u32BinLen) {
ISP_DAEMON_DEBUG(LOG_ALERT, "writeIspRegToBin fail\\n");
ret = CVI_FAILURE;
}
}
if (pBuffer != NULL) {
free(pBuffer);
}
ISP_DAEMON_UNUSED(numDevice);
return ret;
[Related Topics]
None
4.1.3.3. CVI_BIN_ImportBinData¶
[Description]
importallmodulebindata, willaccording tobinthe relevant informationofmoduledataandcurrentallofmoduleperformthe relevant information, willallthe relevant informationofdataimport.
[Syntax]
CVI_S32 CVI_BIN_ImportBinData(CVI_U8*pu8Buffer, CVI_U32 u32DataLength);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
pu8Buffer |
Binofmemoryspace |
Input |
u32DataLength |
Binsize |
Input |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success. |
the relevant information 0 |
Failure, see its value in error code2 |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so libcvi_bin_isp.so
[Note]
None
[Example]
CVI_S32 ret = CVI_SUCCESS;
FILE *fp = NULL;
CVI_U8 *buf = NULL;
CVI_CHAR binName[BIN_FILE_LENGTH] = { 0 };
CVI_U32 u32TempLen = 0, u32FileSize = 0;
ret = CVI_BIN_GetBinName(binName);
if (ret != CVI_SUCCESS) {
CVI_TRACE_SYS(CVI_DBG_WARN, "GetBinName(%s) fail\\n", binName);
}
fp = fopen((const CVI_CHAR *)binName, "rb");
if (fp == NULL) {
CVI_TRACE_SYS(CVI_DBG_WARN, "Can't find bin(%s)\\n", binName);
ret = CVI_FAILURE;
goto ERROR_HANDLER;
} else {
CVI_TRACE_SYS(CVI_DBG_WARN, "Bin exist (%s)\\n", binName);
}
getFileSize(fp, &u32FileSize);
buf = (CVI_U8 *)malloc(u32FileSize);
if (buf == NULL) {
ret = CVI_FAILURE;
CVI_TRACE_SYS(CVI_DBG_WARN, "Allocate memory fail\\n");
goto ERROR_HANDLER;
}
u32TempLen = fread(buf, u32FileSize, 1, fp);
if (u32TempLen <= 0) {
CVI_TRACE_SYS(CVI_DBG_WARN, "read data to buff fail!\\n");
ret = CVI_FAILURE;
goto ERROR_HANDLER;
}
ret = CVI_BIN_ImportBinData(buf, (CVI_U32)u32FileSize);
if (ret != CVI_SUCCESS) {
CVI_TRACE_SYS(CVI_DBG_WARN, "CVI_BIN_ImportBinData error! value:(0x%x)\\n", ret);
goto ERROR_HANDLER;
}
ERROR_HANDLER:
if (fp != NULL) {
fclose(fp);
}
if (buf != NULL) {
free(buf);
}
return ret;
[Related Topics]
None
4.1.3.4. CVI_BIN_GetSingleISPBinLen¶
[Description]
obtainthe relevant informationmoduleofbindataoflength.
[Syntax]
CVI_S32 CVI_BIN_GetSingleISPBinLen(enum CVI_BIN_SECTION_ID id);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
id |
module ID |
Input |
[Return Value]
Return Value |
Description |
|---|---|
CVI_U32 |
the relevant informationmoduleofbinfilelength |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
thisfunctionthe relevant informationincall CVI_BIN_ExportSingleISPBinData interfacethe relevant informationcall.
[Example]
CVI_U32 u32BinLen = 0;
enum CVI_BIN_SECTION_ID id = CVI_BIN_ID_ISP0;
u32BinLen = CVI_BIN_GetBinTotalLen(id);
[Related Topics]
4.1.3.5. CVI_BIN_ExportSingleISPBinData¶
[Description]
exportsinglemoduleofbindata.
[Syntax]
CVI_BIN_ExportSingleISPBinData(enum CVI_BIN_SECTION_ID id, CVI_U8*pu8Buffer, CVI_U32 u32DataLength);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
id |
module ID |
Input |
pu8Buffer |
savepqbindataofbuffer |
Input |
u32DataLength |
pqbindataofthe relevant informationlength |
Input |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success. |
the relevant information 0 |
Failure,see its value in error code1. |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
callthisfunctionthe relevant informationcall CVI_BIN_GetSingleISPBinLen function, obtaindataofsize, otherwisecanthe relevant informationmemorythe relevant information.
[Example]
CVI_S32 ret = CVI_SUCCESS;
CVI_BIN_HEADER header;
CVI_U32 u32BinLen = 0, u32TempLen = 0;
CVI_U8 *pBuffer;
enum CVI_BIN_SECTION_ID id = CVI_BIN_ID_ISP0;
memset(&header, 0, sizeof(CVI_BIN_HEADER));
u32BinLen = CVI_BIN_GetSingleISPBinLen(id);
pBuffer = (CVI_U8 *)malloc(u32BinLen);
if (pBuffer == NULL) {
ISP_DAEMON_DEBUG(LOG_ALERT, "malloc err!\\n");
return CVI_FAILURE;
}
header.extraInfo = *binExtra;
memcpy(pBuffer, &header, sizeof(CVI_BIN_HEADER));
ret = CVI_BIN_ExportSingleISPBinData(id, pBuffer, u32BinLen);
if (ret != CVI_SUCCESS) {
ISP_DAEMON_DEBUG_EX(LOG_ALERT, "CVI_BIN_ExportBinData err(%#x)!\\n", ret);
} else {
u32TempLen = fwrite(pBuffer, 1, u32BinLen, fp);
if (u32TempLen != u32BinLen) {
ISP_DAEMON_DEBUG(LOG_ALERT, "writeIspRegToBin fail\\n");
ret = CVI_FAILURE;
}
}
if (pBuffer != NULL) {
free(pBuffer);
}
ISP_DAEMON_UNUSED(numDevice);
return ret;
[Related Topics]
None
4.1.3.6. CVI_BIN_SaveParamToBin¶
[Description]
exportsinglemoduleofbindata
[Syntax]
CVI_S32 CVI_BIN_SaveParamToBin(FILE*fp, CVI_BIN_EXTRA_S*extraInfo);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
fp |
PQBinfilethe relevant information |
Input |
extraInfo |
PQBin informationandDescription |
Input |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success. |
the relevant information 0 |
Failure,see its value in error code1 |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
None
[Example]
CVI_BIN_EXTRA_S BinExtra = {
"User",
"test-default",
"2021-04-19",
};
FILE *fd = fopen(TEST_BIN, "wb");
if (fd == NULL) {
ISP_DEBUG(LOG_ERR, "Open file failed\\n");
}
CVI_BIN_SaveParamToBin(fd, &BinExtra);
fclose(fd);
[Related Topics]
None
4.1.3.7. CVI_BIN_LoadParamFromBin¶
[Description]
importsinglemodulebindata.
[Syntax]
CVI_S32 CVI_BIN_LoadParamFromBin(enum CVI_BIN_SECTION_ID id, CVI_U8*buf);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
id |
module ID |
Input |
buf |
PQBinofdatacontent |
Input |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success. |
the relevant information 0 |
Failure,see error code2 |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
the relevant informationwillPQBinfromdatathe relevant informationmemoryspace, the relevant informationthisfunctionthe relevant information.this API ofFunctionafterwardwillby CVI_BIN_LoadParamFromBinEx the relevant information , recommendthe relevant information.
[Example]
CVI_S32 result = CVI_FAILURE;
CVI_U32 size = 0;
FILE *fp;
ISP_DEBUG(LOG_DEBUG, "try load default value from bin %s\\n", TEST_BIN);
fp = fopen(TEST_BIN, "rb");
if (fp == NULL) {
ISP_DEBUG(LOG_WARNING, "Cant find bin(%s)\\n", TEST_BIN);
} else {
ISP_DEBUG(LOG_INFO, "Bin exist (%s)\\n", TEST_BIN);
}
fseek(fp, 0L, SEEK_END);
size = ftell(fp);
rewind(fp);
if (size > 0) {
// allocate buffer
CVI_U8 *binBuffer = malloc(size);
fread(binBuffer, size, 1, fp);
for (CVI_U32 idx = CVI_BIN_ID_MIN ; idx < CVI_BIN_ID_MAX ; idx++) {
result = CVI_BIN_LoadParamFromBin((enum CVI_BIN_SECTION_ID)idx, binBuffer);
}
// free buffer
free(binBuffer);
if (result == CVI_SUCCESS) {
ISP_DEBUG(LOG_DEBUG, "load default value from bin %s\\n", TEST_BIN);
}
[Related Topics]
4.1.3.8. CVI_BIN_LoadParamFromBinEx¶
[Description]
same CVI_BIN_LoadParamFromBin .
[Syntax]
CVI_S32 CVI_BIN_LoadParamFromBin(enum CVI_BIN_SECTION_ID id, CVI_U8*buf, CVI_U32 u32DataLength);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
id |
module ID |
Input |
buf |
PQBinofdatacontent |
Input |
u32DataLength |
bufofsize |
Input |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success. |
the relevant information 0 |
Failure,see error code2 |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
same CVI_BIN_LoadParamFromBin .
[Example]
refer to CVI_BIN_LoadParamFromBin , Noteofthe relevant information: the relevant informationwillbufofsizethe relevant information.
4.1.3.9. CVI_BIN_SetBinName¶
[Description]
setPQBinstoredpathandfilename.
[Syntax]
CVI_S32 CVI_BIN_SetBinName(WDR_MODE_E wdrMode, const CVI_CHAR *binName);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
wdrMode |
Sensor wdr mode |
Input |
binName |
settingandwdr modecorrespondingpqbinofpathandfilename exampleas"/mnt/data/cvi_sdr_bin" |
Input |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success. |
the relevant information 0 |
Failure,seeerror code. |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
None
[Example]
None
[Related Topics]
4.1.3.10. CVI_BIN_GetBinName¶
[Description]
obtainPQBinstoredpathandfilename.
[Syntax]
CVI_S32 CVI_BIN_GetBinName(CVI_CHAR*binName);
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
binName |
pqbinpathandfilename |
Output |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success. |
the relevant information 0 |
Failure,seeerror code. |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
None
[Example]
None
[Related Topics]
4.1.3.11. CVI_BIN_GetBinExtraAttr¶
[Description]
obtainbinthe relevant informationdatainformation.
[Syntax]
CVI_S32 CVI_BIN_GetBinExtraAttr(FILE*fp, CVI_BIN_EXTRA_S*extraInfo)
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
fp |
PQBinfilethe relevant information |
Input |
extraInfo |
binthe relevant informationinformationofmemoryspace |
Input |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success. |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
None
[Example]
CVI_BIN_EXTRA_S BinExtraAttr = {};
FILE *fd = fopen("/mnt/data/bin/cvi_sdr_bin", "rb");
CVI_BIN_GetBinExtraAttr(fd, &BinExtraAttr);
[Related Topics]
None
4.1.3.12. CVI_ISP_BIN_SetBypassParams¶
[Description]
setbinloadwhenParameterofthe relevant informationandthe relevant information, defaultthe relevant informationtake effect.
[Syntax]
CVI_S32 CVI_ISP_BIN_SetBypassParams(enum CVI_BIN_SECTION_ID id, ISP_BIN_BYPASS_U * ispBinBypass)
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
id |
module ID |
Input |
ispBinBypass |
binParametertake effectinformation |
Input |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success |
-1 |
Failure |
0xCB000013 |
iderror |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
None
[Example]
CVI_S32 ret = CVI_SUCCESS;
ISP_BIN_BYPASS_U ispBinBypass = {0};
ispBinBypass.bitBypassFrameRate = CVI_TRUE;
ret = CVI_ISP_BIN_SetBypassParams(CVI_BIN_ID_ISP0, &ispBinBypass);
[Related Topics]
None
4.1.3.13. CVI_ISP_BIN_GetBypassParams¶
[Description]
setbinloadwhenParameterofthe relevant informationandthe relevant information, defaultthe relevant informationtake effect.
[Syntax]
CVI_S32 CVI_ISP_BIN_GetBypassParams(enum CVI_BIN_SECTION_ID id, ISP_BIN_BYPASS_U * ispBinBypass)
[Parameter]
Parameter Name |
Description |
Input/Output |
|---|---|---|
id |
module ID |
Input |
ispBinBypass |
binParametertake effectinformation |
Output |
[Return Value]
Return Value |
Description |
|---|---|
0 |
Success |
-1 |
Failure |
0xCB000013 |
iderror |
[Requirements]
header file: cvi_bin.h
library file: libcvi_bin.so, libcvi_bin_isp.so
[Note]
None
[Example]
CVI_S32 ret = CVI_SUCCESS;
ISP_BIN_BYPASS_U ispBinBypass = {0};
ret = CVI_ISP_BIN_GetBypassParams(CVI_BIN_ID_ISP0, &ispBinBypass);
[Related Topics]
None
4.1.3.14. error code1¶
interfaceReturn Value |
meaning |
|---|---|
0xCB000001 |
the relevant informationisthe relevant information |
0xCB000003 |
the relevant informationmemoryspace |
0xCB00000B |
jsonthe relevant informationFailure |
0xCB00000D |
Inputofbufferspacenotthe relevant information |
0xCB00000F |
the relevant informationParameterthe relevant informationPQbinfileFailure |
0xCB000012 |
the relevant informationjsonthe relevant informationFailure |
0xCB000013 |
Inputofmodule IDinvalid |
0xCB000014 |
fromfilethe relevant informationParameterFailure |
4.1.3.15. error code2¶
interfaceReturn Value |
meaning |
|---|---|
0xCB000001 |
the relevant informationisthe relevant information |
0xCB000003 |
the relevant informationmemoryspace |
0xCB000006 |
Inputbufofsizeis0 |
0xCB000008 |
PQbinthe relevant informationofdatahasthe relevant information |
0xCB00000C |
jsonextractthe relevant informationFailure |
0xCB00000F |
the relevant informationParameterthe relevant informationPQbinfileFailure |
0xCB000010 |
Nonethe relevant informationbinfile |
0xCB000011 |
currentPQbinfilethe relevant informationjsonParameterthe relevant informationinvalidof |
0xCB000012 |
the relevant informationjsonthe relevant informationFailure |
0xCB000013 |
Inputofmodule IDinvalid |
0xCB000014 |
fromfilethe relevant informationParameterFailure |
0xCB000015 |
currentthe relevant informationofPQbinfilethe relevant informationinvalidof |
0xCB000016 |
Sensornumberitemthe relevant informationPQbinfilethe relevant informationofnumberitem |