This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi.
I`m myungjin.
I am trying to apply remap application for fisheye YUV420 image.
I am using remapEvecute that is in "$(eve_sw_root)/apps/remap_merge"
I tried following step.
1. creating converted table
In testvecs director, there is config file named remapConverTableFishEye.cfg
I changed config file. Colorforamt 6 means YUV420SP. Is it right?
At this step, I got "map256x128_conv_sp.bin"
numTestCases = 1
remapWidth0 = 256
remapHeight0 = 128
blockWidth0 = 128
blockHeight0 = 8
colorFormat0 = 6
qShift0 = 2
functionName0 = "fisheye_getLeftBlockMap"
inputMapFileFormat0 = 0
inputMapFile0 = "../testvecs/input/fisheyeMap256x128.bin"
outputMapFileFormat0 = 0
outputMapFile0 = "../testvecs/output/map256x128_conv_sp.bin"
2. I implemented some function for reading and writing YUV420 image.
int32_t readFile_YUV420SP(const int8_t *infilename,
uint8_t **image,
uint16_t height,
uint16_t width)
{
TI_FILE *fp;
int chr;
int32_t status= 0;
/***************************************************************************
* Open the input image file for reading if a filename was given. If no
* filename was provided, set fp to read from standard input.
***************************************************************************/
//printf("\n\tStarting ReadFilePGM() routine.\n");fflush(stdout);
if ((fp = FOPEN((const char*)infilename, "rb")) == NULL) {
printf("\nError reading the file %s in ReadFile_YUV420SP().", infilename);fflush(stdout);
status= -1;
goto Exit;
}
/***************************************************************************
* Allocate memory to store the image then read the image from the file.
***************************************************************************/
if(((*image) = (uint8_t *) malloc(width*height*3/2)) == NULL) {
printf("\nMemory allocation failure in ReadFile_YUV420SP().\n");fflush(stdout);
FCLOSE(fp);
status=1;
goto Exit;
}
// printf("\n\t\tAllocated %d bytes in ReadFilePGM().\n", width*height*(*bytesPerPixel));fflush(stdout);
// TODO: check endianess to see if we need to switch the order later
//chr = (width*height);
chr = FREAD((*image), 1, width*height*3/2, fp); /////CCS FILE LOAD: Comment this block until line 57 and set breakpoint here. Upload data of size width*height bytes to address *image.
if (chr != (width*height*3/2)){
printf("\nError reading the image data in ReadFile_YUV420SP().");fflush(stdout);
FCLOSE(fp);
free((*image));
status= -1;
goto Exit;
}
FCLOSE(fp);
// printf("\n\tClosed file in ReadFilePGM().\n");fflush(stdout);
Exit:
return status;
}
int32_t writeFile_YUV420SP(const int8_t *outfilename,
const uint8_t *image,
uint16_t n_rows,
uint16_t n_cols)
{
TI_FILE *fp;
uint32_t size;
int32_t status= 0;
/***************************************************************************
* Open the output image file for writing if a filename was given. If no
* filename was provided, set fp to write to standard output.
***************************************************************************/
if((fp = FOPEN((const char*)outfilename, "wb")) == NULL){
printf("Error writing the file %s in writeFileYUV420SP().\n", outfilename);fflush(stdout);
status= -1;
goto Exit;
}
/***************************************************************************
* Write the image data to the file.
***************************************************************************/
size = n_rows * n_cols;
FWRITE((void*)image, 1, size*3/2, fp);
FCLOSE(fp);
Exit:
return status;
}
And I added below code for reading YUV420SP image. Behind remapExecute function I also added writing function.
else if(gConfig_remapExecute[t].colorFormat== 6)
{
readFile_YUV420SP((const int8_t*)filepath,
&input,
gConfig_remapExecute[t].inputHeight,
gConfig_remapExecute[t].inputWidth);
output= (uint8_t*)malloc(gConfig_remapExecute[t].remapWidth*gConfig_remapExecute[t].remapHeight*3/2);
}
status= remapExecute(&gConfig_remapExecute[t], input, output);
3. Executing remap
I changed config file named remapExecuteFishEye.cfg
At this step, It stopped at processing function(status = handle->ivision->algProcess((IVISION_Handle)handle, &inBufs, &outBufs, &inArgs, &outArgs);)
numTestCases = 1
remapWidth0 = 256
remapHeight0 = 128
inputWidth0 = 256
inputHeight0 = 128
colorFormat0 = 6
originalMapFile0 = "../testvecs/input/fisheyeMap256x128.bin"
convertedBinMapFile0 = "../testvecs/output/map256x128_conv_sp.bin"
inputFile0 = "../testvecs/input/img256x128_sp.yuv"
outputFile0 = "../testvecs/output/fish_256x128_sp.yuv"
Is these processing right?
Please let me know. I want to operate remapping function for YUV420SP using eve_sw lib
Best regards,
Myungjin.
Hi Myungjin,
1. I changed config file. Colorforamt 6 means YUV420SP. Is it right?
Yes this is correct.
3. " At this step, It stopped at processing function(status = handle->ivision->algProcess((IVISION_Handle)handle, &inBufs, &outBufs, &inArgs, &outArgs);) ". Do you mean the processing is hanged at this function call? Are you seeing any error messages being displayed?
Regards,
Anshu
Hello Myungjin,
The code in apps\remap_merge\test\src\remapExecute.c was incomplete, it was not implemented to handle yuv420 SP format. In function remapExecute(), the input UV plane should have been passed to input inputBlkBufDesc.bufPlanes[1].buf and the output UV plane should have been passed to outputBlkBufDesc.bufPlanes[1].buf.
I am attaching a zip patch containing the corrected file along with other files that upgrade remapExecute testbench to support yuv420SP.
After unzipping the patch, please move thesefiles to the following locations:
Future releases of Vision SDK will incorporate these fixes as well.
regards,
Victor