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.

Remap for fisheye YUV420SP image using eve_sw

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,

    I have forwarded your question to EVE library experts to comment.

    Regards,
    Yordan
  • 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

  • Hi Anshu.

    "Do you mean the processing is hanged at this function call?"
    Yes. And there is no any error massage.
    During operating processing function, I tried to suspend.
    Then I can see below massage.

    ARP32_EVE_1: Trouble Halting Target CPU: (Error -2062 @ 0x0) Unable to halt device. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 6.0.579.0)


    I have few question.
    At the step 1, When I made converted table, I used "fisheyeMap256x128.bin" that provided table.
    Is this table to remap for 1 channel image?

    To get YUV420SP converted table, I changed "colorFormat0 = 6" in converting config file.
    Then I think that converted table for YUV420SP is created.
    I wonder this is right.

    Please let me know If you need more information.

    Best regards,
    Myungjin.
  • Hi Myungjin,

    Anshu is working with the developer of this feature and might need some more time to respond.
    We will keep you updated.

    Regards,
    Yordan
  • 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.

    remapExecute_yuv420sp_fix.zip

    After unzipping the patch, please move thesefiles to the following locations:

    • apps/remap_merge/test/src/remapExecute.c
    • apps/remap_merge/test/src/remapExecute.h
    • apps/remap_merge/test/src/remapExecute_tb.c
    • apps/remap_merge/test/testvecs/input/checkerboard_color_256x128_yuv420sp.yuv
    • apps/remap_merge/test/testvecs/config/remapConvertTableFishEye.cfg
    • apps/remap_merge/test/testvecs/config/remapExecuteFishEye.cfg
    • common/ti_image_file_io.c
    • common/ti_image_file_io.h

    Future releases of Vision SDK will incorporate these fixes as well.

    regards,

    Victor