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.

TDA4VM: How to feed 12 bit packed RAW file to VISS using local RAW image file

Part Number: TDA4VM

Hello all,

I would like to process RAW image(12b packed) files using HWA and ISP on TDA4VM.

I have tried to use `app_single_cam` but it has critical comment is "Supports only RAW 12b Unpacked format" in below code.

vx_int32 read_test_image_raw(char *raw_image_test_fname, tivx_raw_image raw_image, vx_uint32 test_mode)
{
char raw_image_fname[MAX_FNAME] = {0};
char failsafe_test_data_path[3] = "./";
char * test_data_path = app_get_test_file_path();
FILE * fp;
vx_uint32 width, height, i;
vx_imagepatch_addressing_t image_addr;
vx_rectangle_t rect;
vx_map_id map_id;
void *data_ptr;
vx_uint32 num_bytes_per_pixel = 2; /*Supports only RAW 12b Unpacked format*/
vx_uint32 num_bytes_read_from_file = 0;
tivx_raw_image_format_t format;
vx_uint32 imgaddr_width, imgaddr_height, imgaddr_stride;

How can I feed 12Bit packed RAW to VISS? 

Is there way to convert 12bit packed RAW to unpacked RAW using HWA?

Best regards,

  • Hi,

    Yes, that's possible by setting input image format as TIVX_RAW_IMAGE_P12_BIT. In this case, VISS input format is assumed to be 12bit packed.. Not sure how you are feeding input to the VISS, but if you are using capture, then capture does also support 12bit packed output and that can be directly given to the VISS.

    Regards,

    Brijesh

  • Hello Brijesh,

    Thanks for your comment.

    I have tried it that using `app_single_cam` in vision_apps as below. 

    ```
    sensorParams.sensorInfo.raw_params.format[0].pixel_container = TIVX_RAW_IMAGE_P12_BIT;
    ```
    This change as hard coding get not correct result.
  • Hello Taisuke,

    Sure, i have recreated this issue on SDK8.0 and am currently looking at it. Will share the results as soon as possible. 

    Regards,

    Brijesh

  • Hello Taisuke,

    Please find attached patch on the ti-processor-sdk-rtos-j721e-evm-08_02_00_05\pdk_jacinto_08_02_00_21 folder and rebuild pdk, sdk to check RAW12 packed format.

    /cfs-file/__key/communityserver-discussions-components-files/791/CSIRX_5F00_Fix_5F00_For_5F00_RAW12_5F00_Packed.patch

    Regards,

    Brijesh

  • Hello Brijesh,

    Thank you for the advice, but it couldn't resolve the problem.

    I tried as below sequence, could you check these?

    1. Install SDK to Host PC(ver 8.2)

    3. Apply the patch file to `$PSDKR_PATH/pdk_jacinto_08_02_00_21/packages/ti/drv/csirx/src/csirx_drvUdma.c`

    4. Build pdk package

     ```

    source ./pdksetupenv.sh

    make

    ```

    4. Changed source code of single_cam_app.

    5. Build SD Image (according to this page - https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/08_02_00_05/exports/docs/vision_apps/docs/user_guide/RUN_INSTRUCTIONS.html)

    6. Try modified 'single_cam_app'

    vx_status app_create_graph(AppObj *obj)
    {
    
     ----------------------------------------------
         if(ISS_SENSOR_FEATURE_DCC_SUPPORTED == (sensor_features_supported & ISS_SENSOR_FEATURE_DCC_SUPPORTED))
        {
            sensor_features_enabled |= ISS_SENSOR_FEATURE_DCC_SUPPORTED;
            APP_PRINTF("Sensor DCC is enabled \n");
        }else
        {
            APP_PRINTF("Sensor DCC is NOT enabled \n");
        }
     
        sensorParams.sensorInfo.raw_params.format[0].pixel_container = TIVX_RAW_IMAGE_P12_BIT;
    
        APP_PRINTF("Sensor width = %d\n", sensorParams.sensorInfo.raw_params.width);
        APP_PRINTF("Sensor height = %d\n", sensorParams.sensorInfo.raw_params.height);
        APP_PRINTF("Sensor meta before = %d\n", sensorParams.sensorInfo.raw_params.meta_height_before);
        APP_PRINTF("Sensor meta after = %d\n", sensorParams.sensorInfo.raw_params.meta_height_after);
        APP_PRINTF("Sensor DCC ID = %d\n", sensorParams.dccId);
        APP_PRINTF("Sensor Supported Features = 0x%x\n", sensor_features_supported);
        APP_PRINTF("Sensor Enabled Features = 0x%x\n", sensor_features_enabled);
        APP_PRINTF("Sensor num channels = %d\n", sensorParams.num_channels);
        APP_PRINTF("Sensor num dccID = %d\n", sensorParams.dccId);
        APP_PRINTF("Sensor num DataLanes = %d\n", sensorParams.sensorInfo.numDataLanes);
        APP_PRINTF("Sensor DataLaneBand = %d\n", sensorParams.sensorInfo.csi_laneBandSpeed);
        APP_PRINTF("Sensor fps = %d\n", sensorParams.sensorInfo.fps);
        APP_PRINTF("Sensor Info features = %d\n", sensorParams.sensorInfo.features);
        APP_PRINTF("Sensor param exposures = %d\n", sensorParams.sensorInfo.raw_params.num_exposures);
        APP_PRINTF("Sensor param format0 = %d\n", sensorParams.sensorInfo.raw_params.format[0].pixel_container);
        APP_PRINTF("Sensor param format1 = %d\n", sensorParams.sensorInfo.raw_params.format[1].pixel_container);
        APP_PRINTF("Sensor param format-msb0 = %d\n", sensorParams.sensorInfo.raw_params.format[0].msb);
        APP_PRINTF("Sensor param format-msb1 = %d\n", sensorParams.sensorInfo.raw_params.format[1].msb);
    
        sensor_init_status = appInitImageSensor(obj->sensor_name, sensor_features_enabled, channel_mask);/*Mask = 1 for camera # 0*/
        if(0 != sensor_init_status)
        {
            /* Not returning failure because application may be waiting for
                error/test frame */
            printf("Error initializing sensor %s \n", obj->sensor_name);
        }
    
    ------------------------------------------
    }
    
    //result
    Sensor width = 3840
    Sensor height = 2160
    Sensor meta before = 0
    Sensor meta after = 0
    Sensor DCC ID = 820
    Sensor Supported Features = 0x178
    Sensor Enabled Features = 0x158
    Sensor num channels = 1
    Sensor num dccID = 820
    Sensor num DataLanes = 4
    Sensor DataLaneBand = 18
    Sensor fps = 30
    Sensor Info features = 376
    Sensor param exposures = 1
    Sensor param format0 = 1052674
    Sensor param format1 = 0
    Sensor param format-msb0 = 11
    Sensor param format-msb1 = 0
    Sensor param line_interleaved = 0


    processed image

    Best regards, 

    Taisuke

  • Hi Taisuke,

    This does not seem to be issue related to 12bit packed output. Is this working fine when you use 12bit unpacked format? Can you please check it? 

    Regards,

    Brijesh

  • Hi Brijesh,

    Yes, It can work without problem when I use 12bit unpacked format(2bytes per pix) raw file.

    I checked using two types of images and these got good results.

     - Exported by 'single_cam_app' when I connected the camera and pushed "s" key.

     - It was convert from 12bit packed raw(3bytes per 2 pix) that I added 4 bit padding.

     

    BTW, when I use modified 'app_viss', the processed image is better than before.

    What is the different? I set the parameters of sensor are referenced from printed values of 'single_cam_app'.

    Best regards,

  • Hi Taisuke,

    ok, can you please check with multi-cam-app? I checked with this example for IMX390 camera on EVM and it worked fine. 

    Not sure why single-camera-app is not working, May be more changes required in this application.

    Also could you please confirm that after applying the changes, you are rebuilding sdk, using "make sdk" command?

    Regards,

    Brijesh 

  • Hi Brijesh,

    I rebuild sdk and `multi_cam_app` works as same as `app_viss`. 

    But I don't have 12bit packed raw of IMX390 and the camera...

    By the way, my "12bit packed raw" is below format. (a and b mean a pixel in 3bytes)

    | aB aA a9 a8 a7 a6 a5 a4 | bB bA b9 b8 b7 b6 b5 b4 | b3 b2 b1 b0 a3 a2 a1 a0 |
    Is this same as `TIVX_RAW_IMAGE_P12_BIT` ?

    Best regards,

  • Hello Taisuke,

    No, this is MIPI format for 12bit data, not the output format for 12Bit packed from the CSIRX. 

    CSIRX will output like below in the memory 

    | b11 b10 b9 b8 b7 b6 b5 b4 | b3 b2 b1 b0 a11 a10 a9 a8 | a7 a6 a5 a4 a3 a2 a1 a0 |

    MIPI output format is not supported in the VISS... 

    Regards,

    Brijesh

  • Hello Brijesh,

    Thank you!

    This issue is closed by your helpful answer.

    Best regards,

    Taisuke