Dear all,
I'm running the SCALE example app of DVSDK on my target. Then I changed the value of inst->scaleFactor to 1, and I found that output was different from input when pointer offset of inBuf changed to 45 or a value greater than 45.
app.c (ti/sdo/ce/examples/apps/scale/):
// for (n = 0; fread(inBuf, IFRAMESIZE, 1, in) == 1; n++) {
for (n = 0; fread(inBuf+ 160, 20, 1, in) == 1; n++) {
// printf("App-> Processing frame %d...\n", n);
scaleInArgs.inBufSize = 20;//IFRAMESIZE;
scaleInArgs.outBufSize = 20;//OFRAMESIZE;
scaleInArgs.inBufValidBytes = 20;//IFRAMESIZE;
/* scale the frame */
status = SCALE_process(codec, inBuf, outBuf, &scaleInArgs,
&scaleOutArgs);
// GT_2trace(curMask, GT_2CLASS, "App-> Scaled frame %d (0x%x)\n", n, status);
if (status == SCALE_EOK) {
// GT_1trace(curMask, GT_2CLASS, "\toutArgs: (0x%x)\n", scaleOutArgs.outBufValidBytes);
}
else {
/* failure, exit the processing loop */
break;
}
/* write to file */
// fwrite(outBuf, OFRAMESIZE, 1, out);
fwrite(outBuf, 20, 1, out);
}
scale_ti_impl.c (ti/sdo/ce/examples/codecs/scale):
/*
* ======== SCALE_TI_process ========
*/
XDAS_Int32 SCALE_TI_process(ISCALE_Handle handle, XDAS_Int8 *inBuf,
XDAS_Int8 *outBuf, ISCALE_InArgs *inArgs, ISCALE_OutArgs *outArgs)
{
XDAS_Int32 i;
SCALE_TI_Obj *inst = (SCALE_TI_Obj *)handle;
for (i = 0; i < inArgs->inBufValidBytes; i++) {
outBuf[i] = inBuf[i+ 160]* inst->scaleFactor;
}
/* Fill outArgs */
outArgs->outBufValidBytes = i;
return (ISCALE_EOK);
}
If pointer offset of inBuf changed to 0 or a value less than 45, the output is correct.
app.c (ti/sdo/ce/examples/apps/scale/):
// for (n = 0; fread(inBuf, IFRAMESIZE, 1, in) == 1; n++) {
for (n = 0; fread(inBuf+ 44, 20, 1, in) == 1; n++) {
// printf("App-> Processing frame %d...\n", n);
scaleInArgs.inBufSize = 20;//IFRAMESIZE;
scaleInArgs.outBufSize = 20;//OFRAMESIZE;
scaleInArgs.inBufValidBytes = 20;//IFRAMESIZE;
/* scale the frame */
status = SCALE_process(codec, inBuf, outBuf, &scaleInArgs,
&scaleOutArgs);
// GT_2trace(curMask, GT_2CLASS, "App-> Scaled frame %d (0x%x)\n", n, status);
if (status == SCALE_EOK) {
// GT_1trace(curMask, GT_2CLASS, "\toutArgs: (0x%x)\n", scaleOutArgs.outBufValidBytes);
}
else {
/* failure, exit the processing loop */
break;
}
/* write to file */
// fwrite(outBuf, OFRAMESIZE, 1, out);
fwrite(outBuf, 20, 1, out);
}
scale_ti_impl.c (ti/sdo/ce/examples/codecs/scale):
/*
* ======== SCALE_TI_process ========
*/
XDAS_Int32 SCALE_TI_process(ISCALE_Handle handle, XDAS_Int8 *inBuf,
XDAS_Int8 *outBuf, ISCALE_InArgs *inArgs, ISCALE_OutArgs *outArgs)
{
XDAS_Int32 i;
SCALE_TI_Obj *inst = (SCALE_TI_Obj *)handle;
for (i = 0; i < inArgs->inBufValidBytes; i++) {
outBuf[i] = inBuf[i+ 44]* inst->scaleFactor;
}
/* Fill outArgs */
outArgs->outBufValidBytes = i;
return (ISCALE_EOK);
}
Why?
Attached is my test example.
Best regards,
Buga