hello, everyone,
my development platform is Devkit8500 (DM3700), and I use the xdctools to develop my code,
it by dvsdk_dm3730-evm_4_02_00_06_setuplinux and use dvsdk's Codec Engine GenCodecPkg Wizard,
At my ARM code:
XDAS_Int8 *inPtr_lbp;
XDAS_Int8 *outPtr_lbp;
double *svm_weight;
svm_weight = (double *)malloc( 5*sizeof(double) );
/* Initialize Codec Engine runtime */
CERuntime_init();
/* Initialize Davinci Multimedia Application Interface */
Dmai_init();
/* Open the codec engine */
hEngine = Engine_open(engineName, NULL, NULL);
if (hEngine == NULL) {
printf("Failed to open codec engine %s\n", engineName);
exit(-1);
}
/* Create the LBP encoder */
hLBP = LBP_create(hEngine, "lbp", &LBP_params, &LBP_dynParams);
if (hLBP == NULL) {
printf("Failed to create encoder: %s\n", "lbp");
exit(-1);
}
/* Create an input buffer*/
bufSize = 5;
hLBP_InBuf = Buffer_create(bufSize, &lbp_bufAttrs);
/* Create an output buffer*/
bufSize = 1;
hLBP_DstBuf = Buffer_create(bufSize, &lbp_bufAttrs);
svm_weight[0] = -0.731139
svm_weight[1] = 0.8126;
svm_weight[2] = 1.2956;
svm_weight[3] = 0.1256;
svm_weight[4] = -0.513019;
inPtr_lbp[0] = svm_weight[0];
inPtr_lbp[1] = svm_weight[1];
inPtr_lbp[2] = svm_weight[2];
inPtr_lbp[3] = svm_weight[3];
inPtr_lbp[4] = svm_weight[4];
//my question
printf("inPtr_lbp[0] = %lf \n", inPtr_lbp[0]);
printf("inPtr_lbp[1] = %lf \n", inPtr_lbp[1]);
printf("inPtr_lbp[2] = %lf \n", inPtr_lbp[2]);
printf("inPtr_lbp[3] = %lf \n", inPtr_lbp[3]);
printf("inPtr_lbp[4] = %lf \n", inPtr_lbp[4]);
/* Run LBP */
if (LBP_process(hLBP, hLBP_InBuf, hLBP_DstBuf) < 0) {
printf("Failed to encode video buffer(lbp)\n");
exit(-1);
}
At my DSP code:
/* * ======== LBP_TI_process ======== */ /* ARGSUSED - this line tells the TI compiler not to warn about unused args. */ XDAS_Int32 LBP_TI_process(IIMGENC1_Handle h, XDM1_BufDesc *inBufs, XDM1_BufDesc *outBufs, IIMGENC1_InArgs *inArgs, IIMGENC1_OutArgs *outArgs) { XDAS_Int32 numInBytes; unsigned char * restrict lbp_inputbuffer; unsigned char * restrict lbp_outputbuffer; int size;
double *svm_weight;
svm_weight = (double *)malloc( 5*sizeof(double) ); /* validate arguments - this codec only supports "base" xDM. */ if ((inArgs->size != sizeof(*inArgs)) || (outArgs->size != sizeof(*outArgs))) { outArgs->extendedError = XDM_UNSUPPORTEDPARAM; return (IIMGENC1_EUNSUPPORTED); } /* validate that there's at least a single inBuf and outBuf */ if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) { outArgs->extendedError = XDM_UNSUPPORTEDPARAM; return (IIMGENC1_EFAIL); } numInBytes = inBufs->descs[0].bufSize < outBufs->descs[0].bufSize ? inBufs->descs[0].bufSize : outBufs->descs[0].bufSize; /* everything looks good, do the 'encode', set outArgs and return */ //memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf, numInBytes); size = inBufs->descs[0].bufSize; lbp_inputbuffer = inBufs->descs[0].buf;
lbp_outputbuffer = outBufs->descs[0].buf;
// it will show zero value , not floating point svm_weight[0] = lbp_inputbuffer[0]; svm_weight[1] = lbp_inputbuffer[1]; svm_weight[2] = lbp_inputbuffer[2]; svm_weight[3] = lbp_inputbuffer[3]; svm_weight[4] = lbp_inputbuffer[4]; /***** run my code start ********/ ……………….
/***** run my code end *********/ lbp_outputbuffer[0] = my_code_result ; /* report _how_ we accessed the 2 data buffers */ XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask); XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask); XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask); XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask); /* outArgs->bytesGenerated reports the total number of bytes encoded */ outArgs->bytesGenerated = numInBytes; /* Fill out the rest of the outArgs struct */ outArgs->extendedError = 0; outArgs->currentAU = 0; /* TODO */ return (IIMGENC1_EOK); }
My Question :
for my question, I want put the svm_weight value into inPtr_lbp (in red word) ,
because I wnat put them to DSP code and calculate,
but when I printf the value (in blue word), it will show zero, not the floating point,
so In the DSP code, the svm_weight value will show zero,
How should I do for this problem , or any example that I can reference,
Thank you~