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.
PROCESSOR-SDK-DRA8X-TDA4X: PROCESSOR-SDK-DRA8X-TDA4X: Video dump using encoder is possible in TDA4X?
Part Number: PROCESSOR-SDK-DRA8X-TDA4X
Hi,
i have added a encoder node after the scaler node into the existing usecase app_single_cam.
But when i am trying to call tivxVideoEncoderNode() function it's giving me the below error at run time.
[MCU2_1] 62.718570 s: TIMEOUT: topazdd_wait_on_sync timed out waiting for writeback 0x05a80000.
[MCU2_1] 82.984741 s: appHwaVideoCodecMemAlloc: ERROR: alloc failed!!!
Here is the code snippet:-
---------------------------------------------------------
if((image_width != obj->display_params.outWidth) || (image_height != obj->display_params.outHeight))
{
vx_uint16 scaler_out_w, scaler_out_h;
obj->scaler_enable = vx_true_e;
appIssGetResizeParams(image_width, image_height, obj->display_params.outWidth, obj->display_params.outHeight, &scaler_out_w, &scaler_out_h);
obj->scaler_out_img = vxCreateImage(obj->context, scaler_out_w, scaler_out_h, VX_DF_IMAGE_NV12);
obj->scalerNode = tivxVpacMscScaleNode(obj->graph, obj->y8_r8_c2, obj->scaler_out_img, NULL, NULL, NULL, NULL);
tivxSetNodeParameterNumBufByIndex(obj->scalerNode, 1u, obj->num_cap_buf);
vxSetNodeTarget(obj->scalerNode, VX_TARGET_STRING, TIVX_TARGET_VPAC_MSC1);
obj->display_params.outHeight = scaler_out_h;
obj->display_params.outWidth = scaler_out_w;
display_image = obj->scaler_out_img;
ASSERT_VX_OBJECT(obj->configuration_obj = vxCreateUserDataObject(obj->context, "tivx_video_encoder_params_t", sizeof(tivx_video_encoder_params_t), NULL),
(enum vx_type_e)VX_TYPE_USER_DATA_OBJECT);
VX_CALL(vxCopyUserDataObject(obj->configuration_obj, 0, sizeof(tivx_video_encoder_params_t), &obj->params, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST));
printf("\tCopy User created initilaised....! \n");
obj->max_bitstream_size = ((uint32_t)(scaler_out_w / 16)
* (uint32_t)(scaler_out_w / 16) * WORST_QP_SIZE)
+ ((scaler_out_h >> 4) * CODED_BUFFER_INFO_SECTION_SIZE);
ASSERT_VX_OBJECT(obj->bitstream_obj = vxCreateUserDataObject(obj->context, "tivx_video_bitstream_t", sizeof(uint8_t) * obj->max_bitstream_size, NULL),
(enum vx_type_e)VX_TYPE_USER_DATA_OBJECT);
ASSERT_VX_OBJECT(obj->node_encode = tivxVideoEncoderNode(obj->graph, obj->configuration_obj, display_image, obj->bitstream_obj), VX_TYPE_NODE);
vx_status status = vxGetStatus((vx_reference)obj->node_encode);
if (VX_SUCCESS == status)
{
printf("success d\n",status);
}
//tivxSetNodeParameterNumBufByIndex(obj->node_encode, 3u, obj->num_cap_buf
VX_CALL(vxSetNodeTarget(obj->node_encode, VX_TARGET_STRING, TIVX_TARGET_VENC1));
Kindly assist me if i am missing something here.
Thanks and Regards
Mausam Sinha
Mausam,
we have fixed few issues in the encoder node. which will be available in next release. So can you please wait for few days?
Rgds,
Brijesh
Many thanks for your reply, will wait for next release.
Regards
Mausam Sinha
Hi Brijesh,
Can I verify the encoder node with the recent release PROCESSOR-SDK-RTOS-DRA8X-TDA4X (version V07.00.00.11)?
Regards
Mausam Sinha
Hi Brijesh,
I tried with SDK7.0 release, but still i am getting memory related issue.
This time i am getting the error "MEM: ERROR: Failed to initialize DMA HEAP [/dev/dma_heap/vision_apps_shared-memories] !!!"
Here is the log snippet
--------------------------
APP: Init ... !!!
MEM: Init ... !!!
MEM: ERROR: Failed to initialize DMA HEAP [/dev/dma_heap/vision_apps_shared-memories] !!!
MEM: Init ... Done !!!
APP: ERROR: Memory init failed !!!
APP: Init ... Done !!!
-----------------------------
Regards
Mausam Sinha
Hi Mausam,
Can you run below commands on the uboot prompt?
env default -a -f
saveenv
and reboot?
Rgds,
Brijesh
Hi Mausam,
Could you also make sure you have below in your uenv.txt file?
name_overlays=k3-j721e-vision-apps.dtbo
Regards,
Vishal
Hi Vishal,
i found below configuration in uenv.txt,
dorprocboot=1
name_overlays=k3-j721e-vision-apps.dtbo
So it seems uenv.txt configuration file is ok.
Thanks and Regards
Mausam Sinha
Hi Vishal/Brijesh,
yes i did the "env default -a -f" and "env save" commands before the execution of usecase
But still i am getting the same error.
Here are the logs.
-----------------------------------------------
MCU2_0] 108.662379 s: IM_SENSOR_CMD_CONFIG returning status = 0
Encoder initilaised....!
Copy User created initilaised....!
status value cafter node creation of tivxVideoEncoderNode0
5668688: bitstream size!!!
output file : output/isp_output.h264
[MCU2_0] 108.976484 s: VX_ZONE_INFO:Enabled
[MCU2_0] 108.976544 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1193]
[MCU2_0] ==========================================================
[MCU2_0] 108.976597 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1195] : Capture Status: Instance|0
[MCU2_0] 108.976636 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1197] ==========================================================
[MCU2_0] 108.976683 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1200] : FIFO Overflow Count: 0
[MCU2_0] 108.976720 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1203] : Spurious UDMA interrupt count: 0
[MCU2_0] 108.976761 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1207] [Channel No] | Frame Queue Count | Frame De-queue Count | Frame Drop Count |
[MCU2_0] 108.976814 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1215] 0| 0| 0| 0|
[MCU2_0] 108.976845 s: VX_ZONE_INFO:Disabled
[MCU2_0] 110.311306 s: TIMEOUT: topazdd_wait_on_sync timed out waiting for writeback 0x01000000.
Scaler is enabled
[ 105.242171] EXT4-fs error (device mmcblk1p2): ext4_validate_block_bitmap:384: comm vx_app_single_c: bg 59: bad block bitmap checksum
[ 105.258334] EXT4-fs error (device mmcblk1p2): ext4_mb_generate_buddy:744: group 58, block bitmap and bg descriptor inconsistent: 14478 vs 14764 free clusters
[ 105.272422] EXT4-fs error (device mmcblk1p2): ext4_mb_generate_buddy:744: group 60, block bitmap and bg descriptor inconsistent: 20269 vs 23661 free clusters
[ 105.286546] JBD2: Spotted dirty metadata buffer (dev = mmcblk1p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
[ 105.303095] EXT4-fs error (device mmcblk1p2): ext4_mb_generate_buddy:744: group 52, block bitmap and bg descriptor inconsistent: 26333 vs 26334 free clusters
[ 105.317324] JBD2: Spotted dirty metadata buffer (dev = mmcblk1p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
==========================
Demo : Single Camera w/ 2A
==========================
p: Print performance statistics
s: Save Sensor RAW, VISS Output and H3A output images to File System
e: Export performance statistics
x: Exit
Enter Choice:
==========================
Demo : Single Camera w/ 2A
==========================
p: Print performance statistics
s: Save Sensor RAW, VISS Output and H3A output images to File System
e: Export performance statistics
x: Exit
Enter Choice: 110.655009 s: ISS: Starting sensor [IMX390-UB953_D3] ... !!!
[MCU2_0] 110.655132 s: ImageSensor_RemoteServiceHandler: IM_SENSOR_CMD_STREAM_ON
[MCU2_0] 110.655205 s: IM_SENSOR_CMD_STREAM_ON: channel_mask = 0x1
[MCU2_0] 110.655310 s: ub960_cfgScript : ub960I2cAddr = 0x3d
[MCU2_0] 110.655347 s: UB960 config start
[MCU2_0] 110.895365 s: End of UB960 config
[MCU2_0] 110.895453 s: ub960_cfgScript : ub960I2cAddr = 0x36
[MCU2_0] 110.895486 s: UB960 config start
[MCU2_0] 111.135364 s: End of UB960 config
[MCU2_0] 111.135418 s: Starting camera # 0
[MCU2_0] 111.135461 s: Entering IssSensor_Start
[MCU2_0] 111.145308 s: enableUB960Streaming ub960InstanceId = 0
[MCU2_0] 111.145501 s: ub960_cfgScript : ub960I2cAddr = 0x3d
[MCU2_0] 111.145533 s: UB960 config start
111.161515 s: ISS: Starting sensor [IMX390-UB953_D3] ... !!!
[MCU2_0] 111.161374 s: End of UB960 config
[MCU2_0] 112.558310 s: TIMEOUT: topazdd_wait_on_sync timed out waiting for writeback 0x05a80000.
[ 131.296897] Initializing XFRM netlink socket
[ 133.627470] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[ 133.641402] Bridge firewalling registered
-----------------------------------------------------------------------------------
Regards
Mausam Sinha
Hi Vishal/Brijesh,
yes i have executed the U-Boot command "env default -a -f" and "env safe" before the execution of usecase.
But still i am getting the same error, Here are the error logs
================
MCU2_0] 108.662379 s: IM_SENSOR_CMD_CONFIG returning status = 0
Encoder initilaised....!
Copy User created initilaised....!
status value cafter node creation of tivxVideoEncoderNode0
5668688: bitstream size!!!
output file : output/isp_output.h264
[MCU2_0] 108.976484 s: VX_ZONE_INFO:Enabled
[MCU2_0] 108.976544 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1193]
[MCU2_0] ==========================================================
[MCU2_0] 108.976597 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1195] : Capture Status: Instance|0
[MCU2_0] 108.976636 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1197] ==========================================================
[MCU2_0] 108.976683 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1200] : FIFO Overflow Count: 0
[MCU2_0] 108.976720 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1203] : Spurious UDMA interrupt count: 0
[MCU2_0] 108.976761 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1207] [Channel No] | Frame Queue Count | Frame De-queue Count | Frame Drop Count |
[MCU2_0] 108.976814 s: VX_ZONE_INFO:[tivxCapturePrintStatus:1215] 0| 0| 0| 0|
[MCU2_0] 108.976845 s: VX_ZONE_INFO:Disabled
[MCU2_0] 110.311306 s: TIMEOUT: topazdd_wait_on_sync timed out waiting for writeback 0x01000000.
Scaler is enabled
[ 105.242171] EXT4-fs error (device mmcblk1p2): ext4_validate_block_bitmap:384: comm vx_app_single_c: bg 59: bad block bitmap checksum
[ 105.258334] EXT4-fs error (device mmcblk1p2): ext4_mb_generate_buddy:744: group 58, block bitmap and bg descriptor inconsistent: 14478 vs 14764 free clusters
[ 105.272422] EXT4-fs error (device mmcblk1p2): ext4_mb_generate_buddy:744: group 60, block bitmap and bg descriptor inconsistent: 20269 vs 23661 free clusters
[ 105.286546] JBD2: Spotted dirty metadata buffer (dev = mmcblk1p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
[ 105.303095] EXT4-fs error (device mmcblk1p2): ext4_mb_generate_buddy:744: group 52, block bitmap and bg descriptor inconsistent: 26333 vs 26334 free clusters
[ 105.317324] JBD2: Spotted dirty metadata buffer (dev = mmcblk1p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
==========================
Demo : Single Camera w/ 2A
==========================
p: Print performance statistics
s: Save Sensor RAW, VISS Output and H3A output images to File System
e: Export performance statistics
x: Exit
Enter Choice:
==========================
Demo : Single Camera w/ 2A
==========================
p: Print performance statistics
s: Save Sensor RAW, VISS Output and H3A output images to File System
e: Export performance statistics
x: Exit
Enter Choice: 110.655009 s: ISS: Starting sensor [IMX390-UB953_D3] ... !!!
[MCU2_0] 110.655132 s: ImageSensor_RemoteServiceHandler: IM_SENSOR_CMD_STREAM_ON
[MCU2_0] 110.655205 s: IM_SENSOR_CMD_STREAM_ON: channel_mask = 0x1
[MCU2_0] 110.655310 s: ub960_cfgScript : ub960I2cAddr = 0x3d
[MCU2_0] 110.655347 s: UB960 config start
[MCU2_0] 110.895365 s: End of UB960 config
[MCU2_0] 110.895453 s: ub960_cfgScript : ub960I2cAddr = 0x36
[MCU2_0] 110.895486 s: UB960 config start
[MCU2_0] 111.135364 s: End of UB960 config
[MCU2_0] 111.135418 s: Starting camera # 0
[MCU2_0] 111.135461 s: Entering IssSensor_Start
[MCU2_0] 111.145308 s: enableUB960Streaming ub960InstanceId = 0
[MCU2_0] 111.145501 s: ub960_cfgScript : ub960I2cAddr = 0x3d
[MCU2_0] 111.145533 s: UB960 config start
111.161515 s: ISS: Starting sensor [IMX390-UB953_D3] ... !!!
[MCU2_0] 111.161374 s: End of UB960 config
[MCU2_0] 112.558310 s: TIMEOUT: topazdd_wait_on_sync timed out waiting for writeback 0x05a80000.
[ 131.296897] Initializing XFRM netlink socket
[ 133.627470] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[ 133.641402] Bridge firewalling registered
======================================================================================
Thanks and Regards
Mausam SInha
Hi Mausam,
At least, it looks like you are now able to boot and run the application.
The error topazdd_wait_on_sync, comes only on first frame and it is known error, we are still looking into this error. For the time being, you could ignore this error.
i think the memory allocation issue that you were seeing earlier, is no longer coming, correct?
Rgds,
Brijesh
Hi Brijesh,
Thanks for your reply,
yeah i am able to boot and run the application and it seems memory issue resolved too.
But still i am not able to dump video after adding encoder node into the existing single cam usecase, Need your help here.
Below are the code snippet which i added after the scaler node.
--------------------------------------------------------------------------------------------------
if((image_width != obj->display_params.outWidth) || (image_height != obj->display_params.outHeight))
{
vx_uint16 scaler_out_w, scaler_out_h;
obj->scaler_enable = vx_true_e;
appIssGetResizeParams(image_width, image_height, obj->display_params.outWidth, obj->display_params.outHeight, &scaler_out_w, &scaler_out_h);
obj->scaler_out_img = vxCreateImage(obj->context, scaler_out_w, scaler_out_h, VX_DF_IMAGE_NV12);
obj->scalerNode = tivxVpacMscScaleNode(obj->graph, obj->y8_r8_c2, obj->scaler_out_img, NULL, NULL, NULL, NULL);
tivxSetNodeParameterNumBufByIndex(obj->scalerNode, 1u, obj->num_cap_buf);
vxSetNodeTarget(obj->scalerNode, VX_TARGET_STRING, TIVX_TARGET_VPAC_MSC1);
obj->display_params.outHeight = scaler_out_h;
obj->display_params.outWidth = scaler_out_w;
display_image = obj->scaler_out_img;
ASSERT_VX_OBJECT(obj->configuration_obj = vxCreateUserDataObject(obj->context, "tivx_video_encoder_params_t", sizeof(tivx_video_encoder_params_t), NULL),
(enum vx_type_e)VX_TYPE_USER_DATA_OBJECT);
VX_CALL(vxCopyUserDataObject(obj->configuration_obj, 0, sizeof(tivx_video_encoder_params_t), &obj->params, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST));
printf("\tCopy User created initilaised....! \n");
obj->max_bitstream_size = ((uint32_t)(scaler_out_w / 16)
* (uint32_t)(scaler_out_w / 16) * WORST_QP_SIZE)
+ ((scaler_out_h >> 4) * CODED_BUFFER_INFO_SECTION_SIZE);
ASSERT_VX_OBJECT(obj->bitstream_obj = vxCreateUserDataObject(obj->context, "tivx_video_bitstream_t", sizeof(uint8_t) * obj->max_bitstream_size, NULL),
(enum vx_type_e)VX_TYPE_USER_DATA_OBJECT);
ASSERT_VX_OBJECT(obj->node_encode = tivxVideoEncoderNode(obj->graph, obj->configuration_obj, display_image, obj->bitstream_obj), VX_TYPE_NODE);
vx_status status = vxGetStatus((vx_reference)obj->node_encode);
if (VX_SUCCESS == status)
{
printf("success d\n",status);
}
//tivxSetNodeParameterNumBufByIndex(obj->node_encode, 3u, obj->num_cap_buf
VX_CALL(vxSetNodeTarget(obj->node_encode, VX_TARGET_STRING, TIVX_TARGET_VENC1));
-------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------Error Log---------------------------------------
105.242171] EXT4-fs error (device mmcblk1p2): ext4_validate_block_bitmap:384: comm vx_app_single_c: bg 59: bad block bitmap checksum
[ 105.258334] EXT4-fs error (device mmcblk1p2): ext4_mb_generate_buddy:744: group 58, block bitmap and bg descriptor inconsistent: 14478 vs 14764 free clusters
[ 105.272422] EXT4-fs error (device mmcblk1p2): ext4_mb_generate_buddy:744: group 60, block bitmap and bg descriptor inconsistent: 20269 vs 23661 free clusters
[ 105.286546] JBD2: Spotted dirty metadata buffer (dev = mmcblk1p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
[ 105.303095] EXT4-fs error (device mmcblk1p2): ext4_mb_generate_buddy:744: group 52, block bitmap and bg descriptor inconsistent: 26333 vs 26334 free clusters
[ 105.317324] JBD2: Spotted dirty metadata buffer (dev = mmcblk1p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Without encoder node, usecase is running fine but once i am adding the encoder node into the existing pipeline, it's capturing one frame after then it get stop.
could you please assist me what i am missing something here?
Regards
Mausam Sinha
Mausam,
It does not seem to be issue due to encoder. It looks like some MMCSD card issue. Can you try different SD Card?
Rgds,
Brijesh
Hi Brijesh,
We have successfully integrated the H264 encoder with single cam usecase, but the the captured video jittery, upon debugging we notice that the raw/yuv data has four consecutive frames(it's like 1,1,1,1,4,4,44,,7,7,7,7..... and so on) .
below is the configuration set for encoders.
-----------------------------------------------------------------------
ctx->rc.bits_per_second = 10*1000*1000; /* 5mbps */
ctx->rc.transfer_bits_per_second = ctx->rc.bits_per_second;
ctx->vparams.idr_period = 1800;
ctx->rc.intra_freq = 1; //1; /* all I-Frame encoding */
ctx->vparams.intra_cnt = 1;
ctx->rc.bu_size = 0;
ctx->rc.buffer_size = ctx->rc.transfer_bits_per_second;
ctx->rc.frame_rate = 30;
ctx->rc.initial_level = (3 * ctx->rc.buffer_size) >> 4;
ctx->rc.initial_level = ((ctx->rc.initial_level +
((ctx->rc.bits_per_second /
ctx->rc.frame_rate) / 2)) /
(ctx->rc.bits_per_second /
ctx->rc.frame_rate)) *
(ctx->rc.bits_per_second / ctx->rc.frame_rate);
ctx->rc.initial_level = MAX((uint32)ctx->rc.initial_level,
(uint32)(ctx->rc.bits_per_second /
ctx->rc.frame_rate), uint32);
ctx->rc.initial_delay = ctx->rc.buffer_size - ctx->rc.initial_level;
ctx->rc.bframes = 0;
---------------------------------------------------------------------
Could you please suggest us.
Thanks and Regards
Mausam Sinha
Hi Mausam,
I am sorry i did not get it.
You are seeing consecutive frames in raw/yuv format. Are you saving raw/yuv frames from sensor/isp and verifying that it is exactly same?
Rgds,
Brijesh
Hi Brijesh,
Thanks for your reply,
yeah i saved continuous raw/yuv frames from sensor/isp and verified , i found that the four consecutive raw/yuv frames are exactly same .
Thanks and Regards
Mausam Sinha
Mausam,
Typically one or two frames will be similar as camera is pointing to same scene. So they might look similar, but they are not. If you do binary comparison of consecutive frames, then will not be same. So can you try binary comparison of two frames?
Regards,
Brijesh
Hi Brijesh,
Thanks for your reply.
I have not dumped same scene, I placed a stop watch and dumped continuous raw/yuv frames. I have added yuv dump code after the below line.
---code snippet-------
"vxGraphParameterDequeueDoneRef(obj->graph, graph_parameter_num, (vx_reference*)&out_capture_frames, 1, &num_refs_capture);"
In that dumped frames, I'm seeing exactly same milli seconds in the stop watch for 3 or 4 consecutive frames. I have attached video dumped from encoder, of stop watch, please refer that. Please check frame by frame in VLC.
Mausam,
Just want to check if you have any further updates on this thread or you are still at the same point and need some directions to proceed?
Please let us know.
Regards
Karthik
Hi Karthik,
Thanks for your update. We are still stuck at the same point and need some direction from your side to proceed.
Regards
Mausam Sinha