RTSP Latency (~1 second) with luckfox_pico_rtsp_opencv example on Pico Plus (RV1103)

  • Hello, the examples we provide are mainly intended to facilitate learners' understanding of RKMPI. During RTSP transmission, a delay of approximately 1 second is normal. The main reasons for the delay include four parts:
    1. Processing frame data using opencv-mobile. This involves data copying and CPU operations. Since the delay issue also exists in the rkipc routine without using opencv-mobile, the introduction of opencv-mobile is not the main source of the delay.
    2. Delay caused by the encoding process. There is a project on GitHub that uses the rkmpi library for RTSP transmission and can achieve a delay of less than 100ms. Therefore, the delay caused by encoding is not the main source.
    3. Delay caused by the RTSP library. Since I haven't tested other media libraries, it is impossible to determine whether the librtsp provided by Rockchip causes significant delay.
    4. Buffering mechanism of VLC. Previously, we received feedback from customers that using VLC to pull Luckfox pico in Ubuntu performs better than in Windows.
    For secondary development based on the example, I suggest replacing librtsp with other libraries. Librtsp itself has fewer configurable options, and Rockchip has not provided the source code, making it difficult to conduct further debugging.
  • Thanks for your assistance.

    I have modified the code to measure the runtime of different sections:

    1. Capturing a frame and converting its color space (from YUV420SP to BGR).
    2. Encoding the frame.
    3. Streaming the frame via RTSP.

    Code: Select all

    #define IT_NUM 600
    
    int main(int argc, char *argv[]) {
      	system("RkLunch-stop.sh");
    	RK_S32 s32Ret = 0; 
    
    	struct timespec start = {0, 0};
    	struct timespec stop = {0, 0};
    	float times[3 * IT_NUM];
    	
    	FILE *fp = NULL;
    	char f_path[] = "/root/time_log.txt";
    	fp = fopen(f_path, "wb");
    
    	int width    = DISP_WIDTH;
        int height   = DISP_HEIGHT;
    
    	char fps_text[16];
    	float fps = 0;
    	memset(fps_text,0,16);
    
    	//h264_frame	
    	VENC_STREAM_S stFrame;	
    	stFrame.pstPack = (VENC_PACK_S *)malloc(sizeof(VENC_PACK_S));
    	RK_U64 H264_PTS = 0;
    	RK_U32 H264_TimeRef = 0; 
    	VIDEO_FRAME_INFO_S stViFrame;
    	
    	// Create Pool
    	MB_POOL_CONFIG_S PoolCfg;
    	memset(&PoolCfg, 0, sizeof(MB_POOL_CONFIG_S));
    	PoolCfg.u64MBSize = width * height * 3 ;
    	PoolCfg.u32MBCnt = 1;
    	PoolCfg.enAllocType = MB_ALLOC_TYPE_DMA;
    	//PoolCfg.bPreAlloc = RK_FALSE;
    	MB_POOL src_Pool = RK_MPI_MB_CreatePool(&PoolCfg);
    	printf("Create Pool success !\n");	
    
    	// Get MB from Pool 
    	MB_BLK src_Blk = RK_MPI_MB_GetMB(src_Pool, width * height * 3, RK_TRUE);
    	
    	// Build h264_frame
    	VIDEO_FRAME_INFO_S h264_frame;
    	h264_frame.stVFrame.u32Width = width;
    	h264_frame.stVFrame.u32Height = height;
    	h264_frame.stVFrame.u32VirWidth = width;
    	h264_frame.stVFrame.u32VirHeight = height;
    	h264_frame.stVFrame.enPixelFormat =  RK_FMT_RGB888; 
    	h264_frame.stVFrame.u32FrameFlag = 160;
    	h264_frame.stVFrame.pMbBlk = src_Blk;
    	unsigned char *data = (unsigned char *)RK_MPI_MB_Handle2VirAddr(src_Blk);
    	cv::Mat frame(cv::Size(width,height),CV_8UC3,data);
    
    	// rkaiq init
    	RK_BOOL multi_sensor = RK_FALSE;	
    	const char *iq_dir = "/etc/iqfiles";
    	rk_aiq_working_mode_t hdr_mode = RK_AIQ_WORKING_MODE_NORMAL;
    	//hdr_mode = RK_AIQ_WORKING_MODE_ISP_HDR2;
    	SAMPLE_COMM_ISP_Init(0, hdr_mode, multi_sensor, iq_dir);
    	SAMPLE_COMM_ISP_Run(0);
    
    	// rkmpi init
    	if (RK_MPI_SYS_Init() != RK_SUCCESS) {
    		RK_LOGE("rk mpi sys init fail!");
    		return -1;
    	}
    
    	// rtsp init	
    	rtsp_demo_handle g_rtsplive = NULL;
    	rtsp_session_handle g_rtsp_session;
    	g_rtsplive = create_rtsp_demo(554);
    	g_rtsp_session = rtsp_new_session(g_rtsplive, "/live/0");
    	rtsp_set_video(g_rtsp_session, RTSP_CODEC_ID_VIDEO_H264, NULL, 0);
    	rtsp_sync_video_ts(g_rtsp_session, rtsp_get_reltime(), rtsp_get_ntptime());
    
    	// vi init
    	vi_dev_init();
    	vi_chn_init(0, width, height);
    
    	// venc init
    	RK_CODEC_ID_E enCodecType = RK_VIDEO_ID_AVC;
    	venc_init(0, width, height, enCodecType);
    	
    	printf("init success\n");	
    	
    	sleep(10);
    
    	for (int i = 0;i < 3 * IT_NUM;i += 3) {			
    		// get vi frame
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
    		h264_frame.stVFrame.u32TimeRef = H264_TimeRef++;
    		h264_frame.stVFrame.u64PTS = TEST_COMM_GetNowUs(); 
    		s32Ret = RK_MPI_VI_GetChnFrame(0, 0, &stViFrame, -1);
    		if(s32Ret == RK_SUCCESS)
    		{
    			void *vi_data = RK_MPI_MB_Handle2VirAddr(stViFrame.stVFrame.pMbBlk);
    			cv::Mat yuv420sp(height + height / 2, width, CV_8UC1, vi_data);
    			cv::Mat bgr(height, width, CV_8UC3, data);			
    			cv::cvtColor(yuv420sp, bgr, cv::COLOR_YUV420sp2BGR);
    			cv::resize(bgr, frame, cv::Size(width ,height), 0, 0, cv::INTER_LINEAR);
    			
    			//sprintf(fps_text,"fps = %.2f",fps);		
                		//cv::putText(frame,fps_text,
    			//				cv::Point(40, 40),
    			//				cv::FONT_HERSHEY_SIMPLEX,1,
    			//				cv::Scalar(0,255,0),2);
    			
    		}
    		memcpy(data, frame.data, width * height * 3);
    		
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop);
    		times[i + 0] = (float)stop.tv_sec * 1000000 + (float)stop.tv_nsec / 1000 - ((float)start.tv_sec  * 1000000 + (float)start.tv_nsec  / 1000);
    
    		// encode H264
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
    
    		RK_MPI_VENC_SendFrame(0,  &h264_frame ,-1);
    
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop);
    		times[i + 1] = (float)stop.tv_sec * 1000000 + (float)stop.tv_nsec / 1000 - ((float)start.tv_sec  * 1000000 + (float)start.tv_nsec  / 1000);
    
    		// rtsp
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
    		s32Ret = RK_MPI_VENC_GetStream(0, &stFrame, -1);	
    		if(s32Ret == RK_SUCCESS) {
    			if(g_rtsplive && g_rtsp_session) {
    				//printf("len = %d PTS = %d \n",stFrame.pstPack->u32Len, stFrame.pstPack->u64PTS);	
    				void *pData = RK_MPI_MB_Handle2VirAddr(stFrame.pstPack->pMbBlk);
    				rtsp_tx_video(g_rtsp_session, (uint8_t *)pData, stFrame.pstPack->u32Len,
    							  stFrame.pstPack->u64PTS);
    				rtsp_do_event(g_rtsplive);
    			}
    			//RK_U64 nowUs = TEST_COMM_GetNowUs();
    			//fps = (float) 1000000 / (float)(nowUs - h264_frame.stVFrame.u64PTS);			
    		}
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop);
    		times[i + 2] = (float)stop.tv_sec * 1000000 + (float)stop.tv_nsec / 1000 - ((float)start.tv_sec  * 1000000 + (float)start.tv_nsec  / 1000);
    
    
    		// release frame 
    		s32Ret = RK_MPI_VI_ReleaseChnFrame(0, 0, &stViFrame);
    		if (s32Ret != RK_SUCCESS) {
    			RK_LOGE("RK_MPI_VI_ReleaseChnFrame fail %x", s32Ret);
    		}
    		s32Ret = RK_MPI_VENC_ReleaseStream(0, &stFrame);
    		if (s32Ret != RK_SUCCESS) {
    			RK_LOGE("RK_MPI_VENC_ReleaseStream fail %x", s32Ret);
    		}
    	
    	}
    
    	// Destory MB
    	RK_MPI_MB_ReleaseMB(src_Blk);
    	// Destory Pool
    	RK_MPI_MB_DestroyPool(src_Pool);
    
    	RK_MPI_VI_DisableChn(0, 0);
    	RK_MPI_VI_DisableDev(0);
    		
    	SAMPLE_COMM_ISP_Stop(0);
    
    	RK_MPI_VENC_StopRecvFrame(0);
    	RK_MPI_VENC_DestroyChn(0);
    
    	free(stFrame.pstPack);
    
    	if (g_rtsplive)
    		rtsp_del_demo(g_rtsplive);
    	
    	RK_MPI_SYS_Exit();
    
    	for (int j = 0;j < 3 * IT_NUM;j += 3){
    		fprintf(fp, "%f\t%f\t%f\n", times[j], times[j + 1], times[j + 2]);
    	}
    
    	fclose(fp);
    	return 0;
    }
    As shown in the (first) code snippet, the runtime for each section is stored. After capturing a set number of frames (IT_NUM), these measurements (in microseconds) are saved to a file.

    Code: Select all

    22173.625000	154.000000	1533.500000
    14435.500000	112.625000	1518.125000
    20612.375000	156.875000	2091.625000
    13759.625000	155.750000	1576.125000
    19583.125000	164.500000	1492.125000
    13825.250000	149.125000	998.625000
    17823.125000	158.625000	1265.750000
    13793.250000	151.625000	858.875000
    13627.250000	142.375000	855.500000
    17497.375000	148.125000	1175.000000
    13682.000000	137.375000	871.750000
    13632.875000	118.125000	843.500000
    20603.625000	146.125000	1190.000000
    13709.000000	147.875000	830.125000
    20613.500000	117.000000	854.500000
    13705.125000	145.875000	848.750000
    13711.250000	140.875000	824.500000
    13610.375000	121.875000	821.375000
    17487.875000	175.500000	1262.500000
    13706.000000	150.250000	792.125000
    13652.625000	118.125000	840.375000
    17912.125000	156.875000	1190.250000
    14300.000000	130.500000	867.500000
    14249.500000	150.750000	883.625000
    14226.125000	137.500000	848.375000
    13975.625000	121.250000	836.375000
    14207.125000	139.750000	859.625000
    14184.625000	140.625000	844.250000
    14291.000000	133.750000	820.250000
    14389.750000	160.375000	888.375000
    14249.000000	147.875000	826.875000
    14455.000000	116.625000	829.500000
    14548.625000	129.125000	822.500000
    14668.250000	119.625000	820.875000
    14813.125000	141.500000	858.625000
    14680.250000	133.000000	864.500000
    19677.375000	167.250000	1176.000000
    15088.500000	119.000000	846.125000
    15130.500000	128.125000	809.625000
    15114.625000	140.000000	814.875000
    14790.750000	125.125000	846.125000
    14915.000000	116.250000	835.000000
    14917.375000	157.000000	945.125000
    14843.250000	141.500000	804.375000
    14991.375000	119.250000	837.500000
    14668.750000	141.750000	811.375000
    15270.250000	120.500000	840.000000
    14715.125000	154.250000	794.500000
    14547.000000	152.625000	885.250000
    14971.875000	153.500000	839.375000
    14795.250000	163.500000	840.250000
    14954.625000	231.000000	857.500000
    15312.875000	124.250000	870.125000
    15117.375000	150.500000	840.000000
    19926.875000	157.500000	1249.875000
    15270.750000	137.875000	824.000000
    15268.500000	133.250000	851.125000
    15313.625000	143.250000	852.250000
    15089.250000	154.000000	849.250000
    15011.000000	121.500000	827.250000
    20253.750000	125.500000	884.500000
    15370.500000	147.750000	808.500000
    14572.750000	123.500000	816.750000
    14608.750000	120.250000	813.250000
    15001.500000	146.000000	810.000000
    14877.250000	119.750000	836.750000
    20241.000000	165.250000	1251.500000
    15553.750000	161.500000	825.500000
    15159.500000	146.000000	866.500000
    14661.250000	136.500000	822.750000
    15104.750000	150.500000	844.500000
    14832.000000	125.500000	823.750000
    14928.000000	132.250000	990.250000
    15261.250000	140.500000	807.250000
    14870.750000	3318.750000	697.500000
    11880.750000	146.500000	861.250000
    28051.000000	118.250000	910.750000
    15398.750000	129.500000	884.750000
    15319.500000	153.750000	927.750000
    14649.500000	121.250000	841.750000
    15176.500000	190.750000	840.500000
    15344.250000	119.500000	842.000000
    15392.000000	113.000000	829.250000
    20590.000000	143.250000	912.750000
    14858.000000	116.500000	856.500000
    14885.000000	125.750000	834.250000
    19999.750000	157.250000	1210.250000
    15240.500000	146.250000	851.000000
    15025.750000	136.000000	814.000000
    14934.500000	210.750000	840.250000
    15367.000000	112.000000	832.000000
    15078.250000	140.500000	828.000000
    14937.000000	240.250000	810.000000
    14803.000000	145.000000	797.500000
    14922.250000	162.000000	856.750000
    14673.750000	133.000000	798.250000
    15076.750000	140.750000	826.500000
    14761.500000	151.500000	824.750000
    14699.500000	131.750000	814.750000
    15092.250000	126.000000	812.250000
    14535.750000	116.750000	812.750000
    19196.000000	160.750000	1143.750000
    14688.000000	124.750000	914.750000
    14187.500000	115.500000	811.500000
    21286.250000	176.750000	1194.500000
    14180.250000	123.500000	812.500000
    15895.500000	169.500000	1234.500000
    13917.000000	117.000000	809.750000
    19556.000000	161.000000	1024.000000
    13803.000000	147.750000	817.000000
    17447.000000	163.000000	1162.750000
    13714.250000	115.750000	792.750000
    13591.250000	119.500000	819.500000
    17453.750000	153.250000	1161.500000
    13773.500000	128.750000	804.750000
    15323.000000	155.250000	1201.750000
    15631.250000	139.750000	773.750000
    13696.500000	151.500000	815.500000
    13760.500000	146.250000	813.000000
    17472.250000	181.000000	1136.750000
    13711.500000	143.500000	802.000000
    13626.500000	117.000000	806.250000
    17485.250000	154.250000	1155.500000
    13719.750000	141.750000	809.250000
    13582.250000	126.750000	824.750000
    17523.750000	161.750000	1178.500000
    13701.250000	121.500000	811.500000
    13555.000000	156.500000	903.000000
    17463.750000	159.000000	1145.000000
    13707.500000	158.500000	819.500000
    13589.250000	122.500000	819.000000
    17452.500000	152.750000	1147.500000
    13727.000000	137.250000	808.250000
    13645.750000	126.000000	874.250000
    20667.000000	171.250000	1172.000000
    13656.500000	148.750000	763.750000
    20606.250000	153.000000	1157.250000
    13743.250000	135.250000	840.500000
    19555.000000	154.500000	947.500000
    13809.250000	143.500000	809.250000
    17464.250000	157.500000	1129.500000
    13724.000000	134.000000	806.000000
    13639.500000	122.500000	808.250000
    17463.500000	159.750000	1142.000000
    13769.750000	126.000000	845.250000
    13645.750000	120.000000	810.500000
    17457.750000	162.250000	1159.500000
    13673.750000	120.000000	819.500000
    13753.750000	124.250000	838.500000
    17476.500000	173.500000	1150.750000
    13712.750000	140.750000	813.500000
    13612.500000	118.500000	813.750000
    17537.500000	168.250000	1237.250000
    13722.500000	118.500000	808.000000
    15262.000000	161.000000	1159.500000
    13636.750000	138.500000	822.000000
    19577.500000	159.250000	969.250000
    13824.750000	122.250000	828.750000
    17494.500000	169.250000	1242.500000
    13772.250000	142.000000	792.250000
    13580.500000	119.500000	828.250000
    17494.250000	152.250000	1134.750000
    13741.000000	122.250000	789.250000
    13607.750000	118.750000	823.500000
    17490.250000	174.000000	1250.250000
    13953.500000	136.000000	808.250000
    14053.250000	130.000000	800.250000
    17547.250000	159.250000	1184.000000
    14107.750000	134.750000	799.000000
    14224.000000	148.500000	813.000000
    18742.500000	162.250000	1175.250000
    14767.750000	116.750000	825.500000
    14976.000000	149.500000	847.500000
    15217.500000	116.000000	814.500000
    15269.500000	141.000000	822.750000
    14812.000000	120.750000	834.750000
    14628.250000	131.250000	828.500000
    15037.250000	134.250000	836.250000
    15029.500000	124.000000	838.000000
    15052.500000	175.750000	812.500000
    14759.250000	119.750000	825.500000
    14835.500000	128.000000	831.000000
    14528.000000	149.000000	816.000000
    14341.000000	130.500000	888.500000
    14517.500000	153.000000	835.000000
    14704.500000	126.000000	831.500000
    14783.000000	126.000000	813.500000
    14539.000000	142.500000	784.500000
    14821.000000	137.000000	830.000000
    14616.000000	139.000000	935.500000
    14270.500000	135.500000	806.500000
    18273.500000	165.500000	1163.500000
    13931.000000	146.500000	761.500000
    15649.000000	153.000000	1181.000000
    15646.000000	141.000000	805.000000
    13723.500000	135.500000	827.000000
    13609.500000	119.500000	807.500000
    17492.000000	152.000000	1135.500000
    13742.500000	120.500000	820.000000
    13673.000000	145.000000	793.500000
    17503.500000	152.000000	1166.500000
    13697.500000	119.000000	807.000000
    13639.500000	126.500000	783.000000
    19471.000000	127.500000	840.500000
    19659.500000	171.000000	907.000000
    13774.500000	141.500000	830.000000
    17484.500000	149.000000	1139.500000
    13686.000000	138.500000	785.000000
    13785.500000	151.000000	892.000000
    20564.000000	163.000000	1145.500000
    13705.000000	127.500000	821.500000
    13596.000000	120.000000	818.500000
    17471.500000	154.000000	1152.000000
    13757.000000	150.500000	792.000000
    13611.500000	125.000000	870.000000
    17518.500000	168.000000	1159.000000
    13688.000000	149.500000	819.000000
    15358.000000	139.500000	1171.000000
    13600.000000	159.500000	812.000000
    19572.000000	163.500000	973.000000
    13746.000000	155.500000	805.000000
    17508.500000	184.000000	1140.500000
    13687.000000	126.000000	800.000000
    13622.000000	116.000000	812.000000
    20630.000000	148.500000	1171.500000
    14274.500000	2602.500000	686.500000
    11790.000000	134.000000	834.000000
    21637.000000	148.000000	785.000000
    13622.500000	165.000000	792.000000
    17441.000000	160.500000	1153.000000
    13740.500000	138.500000	782.500000
    13609.500000	119.000000	818.000000
    17505.000000	144.500000	1132.000000
    13704.000000	147.000000	855.000000
    13585.500000	122.000000	812.500000
    17372.500000	178.000000	1170.500000
    13660.000000	116.500000	823.500000
    13798.500000	127.500000	804.500000
    17443.500000	157.500000	1166.500000
    13730.500000	132.500000	882.000000
    13619.000000	121.000000	815.500000
    17444.000000	163.000000	1150.000000
    13635.000000	125.000000	803.000000
    13592.500000	126.500000	829.000000
    17453.000000	165.000000	1163.000000
    13741.500000	152.500000	814.500000
    13626.500000	117.000000	810.500000
    17480.000000	160.000000	1147.500000
    13746.500000	143.000000	826.000000
    13605.000000	118.000000	809.000000
    17508.000000	165.500000	1198.000000
    13692.000000	138.500000	785.500000
    13616.500000	121.000000	814.500000
    17413.000000	166.500000	1150.500000
    13704.500000	122.000000	811.500000
    13605.500000	115.500000	821.000000
    17440.500000	156.000000	1156.000000
    13759.500000	129.500000	819.000000
    13571.000000	132.500000	897.500000
    17493.000000	165.500000	1158.000000
    13698.500000	124.000000	823.000000
    13578.000000	131.500000	821.500000
    17442.500000	162.000000	1168.500000
    13724.000000	130.500000	803.000000
    13580.000000	120.000000	875.500000
    17467.500000	155.000000	1163.000000
    13727.500000	133.500000	802.000000
    13696.000000	134.500000	850.500000
    17487.500000	154.500000	1127.500000
    13698.000000	134.000000	827.500000
    13617.500000	133.500000	802.500000
    17479.500000	163.000000	1139.000000
    13687.000000	116.000000	810.500000
    13592.500000	124.500000	828.000000
    17498.500000	145.500000	1149.500000
    13709.500000	127.500000	811.500000
    13656.000000	128.000000	823.500000
    17483.000000	154.500000	1158.000000
    13709.000000	120.500000	811.000000
    20561.500000	164.500000	1177.500000
    13640.000000	146.500000	774.500000
    19561.000000	162.500000	982.000000
    13746.500000	154.500000	806.500000
    17495.500000	164.000000	1240.000000
    13758.500000	157.500000	756.000000
    13639.500000	118.500000	799.500000
    17431.000000	165.500000	1153.000000
    13662.500000	135.500000	799.500000
    13598.000000	123.500000	841.000000
    17496.000000	153.500000	1252.000000
    13687.500000	111.500000	797.000000
    20586.000000	145.500000	1158.000000
    13705.500000	115.000000	807.500000
    19643.000000	165.500000	887.000000
    13719.000000	140.000000	824.000000
    17503.500000	149.500000	1166.500000
    13696.000000	127.500000	803.500000
    13727.500000	142.500000	740.000000
    17609.000000	162.000000	1078.500000
    13697.000000	114.000000	769.000000
    13582.500000	142.000000	771.000000
    17530.000000	141.000000	1079.500000
    13709.000000	142.000000	725.500000
    13599.000000	129.000000	769.500000
    17470.000000	157.000000	1088.500000
    13663.000000	138.000000	749.500000
    13629.500000	118.000000	782.000000
    20555.000000	160.500000	1085.000000
    13692.000000	142.000000	733.500000
    20582.500000	152.000000	1109.000000
    13606.500000	152.000000	729.500000
    19519.500000	162.000000	907.500000
    13718.500000	164.500000	763.500000
    17430.000000	155.000000	1083.500000
    13652.000000	125.000000	824.500000
    13610.000000	120.500000	771.000000
    17511.500000	157.500000	1083.500000
    13724.000000	131.500000	754.000000
    13543.000000	159.000000	731.000000
    17505.500000	146.500000	1071.000000
    13712.500000	139.000000	811.500000
    13632.500000	123.500000	766.500000
    17478.000000	163.000000	1092.500000
    13726.500000	131.500000	767.500000
    15273.500000	170.000000	1087.000000
    13556.500000	139.000000	776.500000
    19624.500000	162.500000	882.000000
    13845.500000	120.000000	765.500000
    17457.500000	152.000000	1085.500000
    13722.500000	140.000000	745.500000
    13641.500000	126.500000	757.000000
    17470.500000	155.500000	1076.500000
    13664.000000	134.000000	758.000000
    13608.500000	117.000000	759.500000
    20554.000000	148.000000	1090.500000
    13696.500000	138.000000	744.500000
    20572.500000	130.500000	773.500000
    13704.500000	139.000000	744.500000
    19574.000000	149.500000	889.500000
    13764.000000	121.500000	846.500000
    17472.000000	157.500000	1076.000000
    13679.500000	146.000000	748.500000
    13620.000000	122.000000	784.000000
    17478.000000	166.500000	1077.000000
    13719.500000	136.500000	763.500000
    13589.500000	116.500000	834.000000
    17438.500000	174.500000	1093.000000
    13729.500000	140.000000	757.500000
    13568.000000	125.000000	770.000000
    17461.000000	165.000000	1092.000000
    13668.500000	134.000000	749.500000
    13575.000000	115.500000	777.500000
    17506.500000	169.000000	1095.500000
    13737.000000	124.000000	759.500000
    15273.000000	167.000000	1065.000000
    15527.500000	209.000000	751.000000
    13734.000000	133.500000	761.000000
    13748.000000	146.500000	763.000000
    17488.500000	156.500000	1077.000000
    13683.500000	130.500000	755.000000
    13628.500000	116.500000	772.000000
    17479.500000	159.500000	1083.000000
    13690.000000	113.000000	759.500000
    13581.500000	141.500000	816.500000
    17429.000000	166.000000	1174.500000
    13707.500000	149.500000	766.000000
    13630.500000	139.000000	729.000000
    17501.000000	155.000000	1101.000000
    13652.500000	127.500000	756.500000
    13541.500000	117.000000	775.500000
    17500.000000	154.500000	1167.500000
    13720.000000	142.000000	732.500000
    13617.000000	136.000000	765.500000
    17451.000000	158.000000	1089.000000
    13681.500000	127.500000	764.000000
    17450.500000	188.500000	820.000000
    13966.500000	116.000000	794.500000
    20573.000000	146.500000	751.000000
    13702.000000	144.500000	745.000000
    13683.500000	117.500000	766.500000
    13613.500000	126.000000	776.000000
    17515.000000	170.000000	1080.500000
    13762.000000	150.500000	726.000000
    13636.500000	139.000000	755.500000
    17469.500000	156.000000	1081.500000
    13662.500000	136.500000	762.000000
    13806.000000	111.500000	765.000000
    17447.000000	164.500000	1084.000000
    13718.500000	121.500000	759.500000
    15259.500000	167.000000	1170.500000
    15563.500000	199.500000	758.000000
    13671.000000	117.500000	759.000000
    13609.500000	120.500000	772.000000
    17473.000000	160.000000	1083.000000
    13637.000000	125.500000	764.000000
    13648.000000	132.500000	836.000000
    17391.500000	176.000000	1094.000000
    13755.000000	144.000000	747.000000
    13532.500000	159.500000	748.000000
    17440.000000	164.500000	1075.000000
    13727.000000	141.000000	747.500000
    13590.500000	130.500000	752.500000
    17500.000000	178.500000	1090.500000
    13718.000000	138.000000	766.500000
    15306.500000	164.000000	1082.500000
    13664.000000	141.500000	760.000000
    19545.000000	168.000000	941.500000
    13794.000000	166.000000	768.000000
    17504.000000	162.500000	1096.500000
    13741.000000	132.000000	742.500000
    13622.500000	123.000000	766.000000
    17453.500000	158.000000	1093.500000
    13716.000000	156.000000	734.500000
    13606.000000	116.500000	770.500000
    17489.500000	152.000000	1146.500000
    13717.000000	123.500000	750.000000
    13725.500000	154.500000	838.500000
    17484.000000	150.500000	1096.000000
    13710.000000	137.000000	754.000000
    13647.500000	128.500000	760.000000
    17476.500000	158.000000	1155.500000
    13704.500000	134.500000	772.000000
    13574.500000	142.000000	743.500000
    17459.500000	162.500000	1084.000000
    13728.000000	151.000000	767.000000
    13642.500000	114.000000	769.000000
    17482.500000	142.500000	1092.000000
    13764.500000	142.000000	759.000000
    13566.000000	133.000000	770.000000
    17467.000000	163.500000	1097.500000
    13654.500000	131.000000	746.500000
    13622.500000	117.000000	760.000000
    17507.000000	152.000000	1076.000000
    13697.500000	134.000000	758.000000
    13596.000000	135.000000	761.000000
    17414.000000	167.000000	1083.000000
    13733.000000	137.000000	756.000000
    13618.000000	116.000000	771.000000
    17471.000000	158.000000	1073.000000
    13674.000000	139.000000	808.000000
    13585.000000	138.000000	762.000000
    17530.000000	149.000000	1082.000000
    13738.000000	135.000000	752.000000
    13597.000000	121.000000	766.000000
    17516.000000	168.000000	1087.000000
    13690.000000	123.000000	837.000000
    13623.000000	224.000000	803.000000
    17524.000000	165.000000	1072.000000
    13672.000000	146.000000	719.000000
    13590.000000	135.000000	780.000000
    17465.000000	158.000000	1080.000000
    13735.000000	132.000000	758.000000
    13579.000000	116.000000	769.000000
    17451.000000	159.000000	1068.000000
    13747.000000	132.000000	755.000000
    13616.000000	125.000000	794.000000
    17439.000000	166.000000	1082.000000
    13700.000000	124.000000	765.000000
    13613.000000	118.000000	770.000000
    20554.000000	162.000000	1082.000000
    13714.000000	123.000000	775.000000
    13535.000000	150.000000	736.000000
    17445.000000	161.000000	1067.000000
    13669.000000	115.000000	778.000000
    13627.000000	113.000000	769.000000
    17522.000000	144.000000	1074.000000
    13676.000000	158.000000	756.000000
    15356.000000	176.000000	1095.000000
    13636.000000	150.000000	761.000000
    19555.000000	160.000000	929.000000
    13795.000000	163.000000	859.000000
    17434.000000	154.000000	1092.000000
    13734.000000	149.000000	731.000000
    13608.000000	116.000000	780.000000
    17490.000000	161.000000	1076.000000
    13670.000000	162.000000	758.000000
    15435.000000	173.000000	1272.000000
    13630.000000	123.000000	766.000000
    19555.000000	166.000000	944.000000
    13716.000000	120.000000	776.000000
    17520.000000	161.000000	1091.000000
    13690.000000	127.000000	762.000000
    13638.000000	124.000000	755.000000
    17474.000000	161.000000	1081.000000
    13656.000000	132.000000	764.000000
    13610.000000	117.000000	772.000000
    17459.000000	160.000000	1086.000000
    13674.000000	122.000000	754.000000
    20624.000000	150.000000	1105.000000
    13629.000000	150.000000	749.000000
    19656.000000	153.000000	804.000000
    13733.000000	148.000000	789.000000
    17460.000000	165.000000	1090.000000
    13692.000000	140.000000	742.000000
    13584.000000	126.000000	765.000000
    17469.000000	163.000000	1180.000000
    13763.000000	137.000000	759.000000
    15456.000000	163.000000	1101.000000
    14516.000000	155.000000	781.000000
    20550.000000	144.000000	843.000000
    14421.000000	120.000000	786.000000
    18763.000000	177.000000	1215.000000
    14755.000000	115.000000	777.000000
    15172.000000	129.000000	766.000000
    22647.000000	160.000000	1015.000000
    14737.000000	160.000000	754.000000
    21485.000000	145.000000	761.000000
    14751.000000	158.000000	751.000000
    14636.000000	135.000000	761.000000
    14300.000000	118.000000	769.000000
    19594.000000	170.000000	1083.000000
    14926.000000	128.000000	769.000000
    14674.000000	116.000000	774.000000
    14682.000000	119.000000	784.000000
    14938.000000	122.000000	757.000000
    14606.000000	143.000000	771.000000
    14513.000000	128.000000	771.000000
    14532.000000	138.000000	762.000000
    14413.000000	125.000000	766.000000
    19295.000000	179.000000	1092.000000
    14897.000000	145.000000	833.000000
    14131.000000	136.000000	758.000000
    21007.000000	149.000000	1094.000000
    13941.000000	128.000000	772.000000
    20826.000000	146.000000	790.000000
    13738.000000	148.000000	733.000000
    16218.000000	155.000000	835.000000
    11864.000000	123.000000	771.000000
    26473.000000	173.000000	1366.000000
    13790.000000	168.000000	777.000000
    17561.000000	166.000000	1100.000000
    13744.000000	140.000000	750.000000
    13632.000000	143.000000	721.000000
    17496.000000	160.000000	1098.000000
    13723.000000	132.000000	759.000000
    13640.000000	127.000000	767.000000
    17555.000000	154.000000	1099.000000
    13726.000000	147.000000	745.000000
    13621.000000	139.000000	758.000000
    17562.000000	174.000000	1096.000000
    13734.000000	133.000000	762.000000
    13602.000000	115.000000	785.000000
    17487.000000	161.000000	1070.000000
    13734.000000	141.000000	745.000000
    13678.000000	140.000000	752.000000
    17550.000000	150.000000	1150.000000
    13692.000000	138.000000	732.000000
    13595.000000	129.000000	775.000000
    17453.000000	160.000000	1083.000000
    13693.000000	124.000000	758.000000
    13619.000000	115.000000	773.000000
    17488.000000	146.000000	1195.000000
    13742.000000	138.000000	752.000000
    13614.000000	118.000000	767.000000
    17503.000000	151.000000	1093.000000
    13756.000000	133.000000	759.000000
    13602.000000	118.000000	774.000000
    17522.000000	173.000000	1103.000000
    13697.000000	139.000000	733.000000
    13601.000000	116.000000	782.000000
    17535.000000	176.000000	1091.000000
    13741.000000	142.000000	742.000000
    13652.000000	133.000000	752.000000
    17561.000000	175.000000	1093.000000
    13734.000000	136.000000	741.000000
    13635.000000	148.000000	732.000000
    20650.000000	155.000000	1083.000000
    13670.000000	136.000000	756.000000
    20596.000000	128.000000	792.000000
    13746.000000	158.000000	781.000000
    19594.000000	151.000000	945.000000
    13720.000000	140.000000	778.000000
    17544.000000	159.000000	1112.000000
    13724.000000	153.000000	740.000000
    13653.000000	125.000000	778.000000
    17439.000000	140.000000	1077.000000
    13712.000000	128.000000	827.000000
    13592.000000	116.000000	775.000000
    17667.000000	155.000000	1077.000000
    13752.000000	156.000000	718.000000
    13606.000000	115.000000	767.000000
    20562.000000	155.000000	1084.000000
    13722.000000	128.000000	779.000000
    15244.000000	183.000000	1094.000000
    13608.000000	158.000000	765.000000
    19543.000000	151.000000	912.000000
    13782.000000	154.000000	772.000000
    17586.000000	167.000000	1086.000000
    13778.000000	119.000000	769.000000
    13609.000000	119.000000	783.000000
    17500.000000	141.000000	1098.000000
    13729.000000	119.000000	765.000000
    20591.000000	157.000000	1092.000000
    13655.000000	120.000000	767.000000
    19543.000000	167.000000	926.000000
    13806.000000	150.000000	851.000000
    17673.000000	167.000000	1079.000000
    13716.000000	139.000000	759.000000
    13589.000000	130.000000	754.000000
    17508.000000	145.000000	1099.000000
    From this data, it can be seen that the total processing time for a frame is slightly less than 20 milliseconds. Interestingly, the RTSP streaming section itself only takes around 1 millisecond. The most time-consuming part appears to be the combined "capturing frame and changing the color space" step.
    To investigate further, I separated the "capturing frame and changing the color space" step into two distinct measurements:
    1. Capturing the frame from the VI (Video Input) module.
    2. Performing the color space transformation (YUV420SP to BGR).

    Here's the modified code snippet for this finer-grained timing:

    Code: Select all

    int main(int argc, char *argv[]) {
      	system("RkLunch-stop.sh");
    	RK_S32 s32Ret = 0; 
    
    	struct timespec start = {0, 0};
    	struct timespec stop = {0, 0};
    	float times[4 * IT_NUM];
    	
    	FILE *fp = NULL;
    	char f_path[] = "/root/time_log.txt";
    	fp = fopen(f_path, "wb");
    
    	int width    = DISP_WIDTH;
        int height   = DISP_HEIGHT;
    
    	char fps_text[16];
    	float fps = 0;
    	memset(fps_text,0,16);
    
    	//h264_frame	
    	VENC_STREAM_S stFrame;	
    	stFrame.pstPack = (VENC_PACK_S *)malloc(sizeof(VENC_PACK_S));
    	RK_U64 H264_PTS = 0;
    	RK_U32 H264_TimeRef = 0; 
    	VIDEO_FRAME_INFO_S stViFrame;
    	
    	// Create Pool
    	MB_POOL_CONFIG_S PoolCfg;
    	memset(&PoolCfg, 0, sizeof(MB_POOL_CONFIG_S));
    	PoolCfg.u64MBSize = width * height * 3 ;
    	PoolCfg.u32MBCnt = 1;
    	PoolCfg.enAllocType = MB_ALLOC_TYPE_DMA;
    	//PoolCfg.bPreAlloc = RK_FALSE;
    	MB_POOL src_Pool = RK_MPI_MB_CreatePool(&PoolCfg);
    	printf("Create Pool success !\n");	
    
    	// Get MB from Pool 
    	MB_BLK src_Blk = RK_MPI_MB_GetMB(src_Pool, width * height * 3, RK_TRUE);
    	
    	// Build h264_frame
    	VIDEO_FRAME_INFO_S h264_frame;
    	h264_frame.stVFrame.u32Width = width;
    	h264_frame.stVFrame.u32Height = height;
    	h264_frame.stVFrame.u32VirWidth = width;
    	h264_frame.stVFrame.u32VirHeight = height;
    	h264_frame.stVFrame.enPixelFormat =  RK_FMT_RGB888; 
    	h264_frame.stVFrame.u32FrameFlag = 160;
    	h264_frame.stVFrame.pMbBlk = src_Blk;
    	unsigned char *data = (unsigned char *)RK_MPI_MB_Handle2VirAddr(src_Blk);
    	cv::Mat frame(cv::Size(width,height),CV_8UC3,data);
    
    	// rkaiq init
    	RK_BOOL multi_sensor = RK_FALSE;	
    	const char *iq_dir = "/etc/iqfiles";
    	rk_aiq_working_mode_t hdr_mode = RK_AIQ_WORKING_MODE_NORMAL;
    	//hdr_mode = RK_AIQ_WORKING_MODE_ISP_HDR2;
    	SAMPLE_COMM_ISP_Init(0, hdr_mode, multi_sensor, iq_dir);
    	SAMPLE_COMM_ISP_Run(0);
    
    	// rkmpi init
    	if (RK_MPI_SYS_Init() != RK_SUCCESS) {
    		RK_LOGE("rk mpi sys init fail!");
    		return -1;
    	}
    
    	// rtsp init	
    	rtsp_demo_handle g_rtsplive = NULL;
    	rtsp_session_handle g_rtsp_session;
    	g_rtsplive = create_rtsp_demo(554);
    	g_rtsp_session = rtsp_new_session(g_rtsplive, "/live/0");
    	rtsp_set_video(g_rtsp_session, RTSP_CODEC_ID_VIDEO_H264, NULL, 0);
    	rtsp_sync_video_ts(g_rtsp_session, rtsp_get_reltime(), rtsp_get_ntptime());
    
    	// vi init
    	vi_dev_init();
    	vi_chn_init(0, width, height);
    
    	// venc init
    	RK_CODEC_ID_E enCodecType = RK_VIDEO_ID_AVC;
    	venc_init(0, width, height, enCodecType);
    	
    	printf("init success\n");	
    	
    	sleep(10);
    
    	for (int i = 0;i < 4 * IT_NUM;i += 4) {			
    		// get vi frame
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
    		h264_frame.stVFrame.u32TimeRef = H264_TimeRef++;
    		h264_frame.stVFrame.u64PTS = TEST_COMM_GetNowUs(); 
    		s32Ret = RK_MPI_VI_GetChnFrame(0, 0, &stViFrame, -1);
    		if(s32Ret == RK_SUCCESS)
    		{
    			void *vi_data = RK_MPI_MB_Handle2VirAddr(stViFrame.stVFrame.pMbBlk);
    			clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop);
    			times[i + 0] = (float)stop.tv_sec * 1000000 + (float)stop.tv_nsec / 1000 - ((float)start.tv_sec  * 1000000 + (float)start.tv_nsec  / 1000);
    
    			clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
    			cv::Mat yuv420sp(height + height / 2, width, CV_8UC1, vi_data);
    			cv::Mat bgr(height, width, CV_8UC3, data);			
    			cv::cvtColor(yuv420sp, bgr, cv::COLOR_YUV420sp2BGR);
    			cv::resize(bgr, frame, cv::Size(width ,height), 0, 0, cv::INTER_LINEAR);
    			
    			//sprintf(fps_text,"fps = %.2f",fps);		
                		//cv::putText(frame,fps_text,
    			//				cv::Point(40, 40),
    			//				cv::FONT_HERSHEY_SIMPLEX,1,
    			//				cv::Scalar(0,255,0),2);
    			
    		}
    		memcpy(data, frame.data, width * height * 3);
    		
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop);
    		times[i + 1] = (float)stop.tv_sec * 1000000 + (float)stop.tv_nsec / 1000 - ((float)start.tv_sec  * 1000000 + (float)start.tv_nsec  / 1000);
    
    		// encode H264
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
    
    		RK_MPI_VENC_SendFrame(0,  &h264_frame ,-1);
    
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop);
    		times[i + 2] = (float)stop.tv_sec * 1000000 + (float)stop.tv_nsec / 1000 - ((float)start.tv_sec  * 1000000 + (float)start.tv_nsec  / 1000);
    
    		// rtsp
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
    		s32Ret = RK_MPI_VENC_GetStream(0, &stFrame, -1);	
    		if(s32Ret == RK_SUCCESS) {
    			if(g_rtsplive && g_rtsp_session) {
    				//printf("len = %d PTS = %d \n",stFrame.pstPack->u32Len, stFrame.pstPack->u64PTS);	
    				void *pData = RK_MPI_MB_Handle2VirAddr(stFrame.pstPack->pMbBlk);
    				rtsp_tx_video(g_rtsp_session, (uint8_t *)pData, stFrame.pstPack->u32Len,
    							  stFrame.pstPack->u64PTS);
    				rtsp_do_event(g_rtsplive);
    			}
    			//RK_U64 nowUs = TEST_COMM_GetNowUs();
    			//fps = (float) 1000000 / (float)(nowUs - h264_frame.stVFrame.u64PTS);			
    		}
    		clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop);
    		times[i + 3] = (float)stop.tv_sec * 1000000 + (float)stop.tv_nsec / 1000 - ((float)start.tv_sec  * 1000000 + (float)start.tv_nsec  / 1000);
    
    
    		// release frame 
    		s32Ret = RK_MPI_VI_ReleaseChnFrame(0, 0, &stViFrame);
    		if (s32Ret != RK_SUCCESS) {
    			RK_LOGE("RK_MPI_VI_ReleaseChnFrame fail %x", s32Ret);
    		}
    		s32Ret = RK_MPI_VENC_ReleaseStream(0, &stFrame);
    		if (s32Ret != RK_SUCCESS) {
    			RK_LOGE("RK_MPI_VENC_ReleaseStream fail %x", s32Ret);
    		}
    	
    	}
    
    	// Destory MB
    	RK_MPI_MB_ReleaseMB(src_Blk);
    	// Destory Pool
    	RK_MPI_MB_DestroyPool(src_Pool);
    
    	RK_MPI_VI_DisableChn(0, 0);
    	RK_MPI_VI_DisableDev(0);
    		
    	SAMPLE_COMM_ISP_Stop(0);
    
    	RK_MPI_VENC_StopRecvFrame(0);
    	RK_MPI_VENC_DestroyChn(0);
    
    	free(stFrame.pstPack);
    
    	if (g_rtsplive)
    		rtsp_del_demo(g_rtsplive);
    	
    	RK_MPI_SYS_Exit();
    
    	for (int j = 0;j < 4 * IT_NUM;j += 4){
    		fprintf(fp, "%f\t%f\t%f\t%f\n", times[j], times[j + 1], times[j + 2], times[j + 3]);
    	}
    
    	fclose(fp);
    	return 0;
    }
    1/2
    Last edited by CounterMader on 2025-05-22 10:01, edited 1 time in total.
  • And the corresponding results:

    Code: Select all

    835.625000	21630.250000	202.500000	1646.750000
    491.250000	11972.250000	164.250000	1980.750000
    1927.375000	17855.875000	167.750000	1437.000000
    1946.625000	12254.375000	131.500000	1128.750000
    1873.375000	15792.625000	166.000000	2144.000000
    2002.500000	11751.500000	137.750000	971.000000
    1890.625000	11610.375000	148.250000	556.500000
    1879.250000	15739.875000	164.250000	827.500000
    1874.875000	11681.500000	156.375000	557.375000
    1874.625000	11666.500000	155.500000	548.500000
    1859.750000	15754.875000	172.875000	845.500000
    1882.750000	11746.875000	139.375000	577.750000
    1862.500000	13658.125000	160.125000	921.125000
    1894.125000	11790.500000	118.750000	589.500000
    1859.375000	17832.750000	168.625000	623.875000
    1922.625000	11765.500000	137.125000	589.000000
    1868.375000	15787.250000	157.000000	818.500000
    1860.000000	11683.625000	154.625000	542.500000
    1855.250000	11636.250000	164.500000	572.875000
    1873.375000	15692.250000	172.375000	851.625000
    1882.125000	11748.625000	126.875000	611.125000
    1856.500000	11661.125000	155.125000	545.125000
    2543.625000	17934.250000	164.000000	830.625000
    1900.250000	11706.125000	128.750000	590.875000
    1895.500000	11733.500000	143.000000	541.250000
    1852.625000	15757.000000	165.750000	850.125000
    1884.125000	11686.250000	157.250000	559.500000
    1897.625000	11706.625000	118.375000	587.750000
    1856.250000	15742.375000	162.500000	832.625000
    1969.750000	11659.750000	138.250000	585.250000
    1870.750000	11648.875000	169.125000	575.125000
    1846.125000	15732.500000	170.875000	860.750000
    1902.750000	11828.250000	150.250000	552.500000
    1889.375000	11727.250000	120.125000	584.125000
    1885.875000	15761.625000	174.750000	861.625000
    1855.250000	11705.750000	157.875000	549.500000
    1852.125000	11638.750000	142.125000	563.000000
    1851.500000	15686.500000	158.000000	855.750000
    1865.250000	11647.500000	135.000000	562.875000
    1845.750000	11663.500000	156.125000	564.625000
    1883.875000	15747.500000	163.875000	818.750000
    1849.750000	11734.625000	146.750000	590.750000
    1887.750000	11631.375000	154.250000	575.500000
    1890.000000	15798.375000	181.500000	847.500000
    1859.875000	11745.250000	124.500000	581.000000
    1882.250000	11644.250000	158.125000	552.625000
    1862.875000	15738.375000	167.375000	835.875000
    1888.500000	11728.125000	126.250000	570.125000
    1881.250000	11660.500000	145.625000	583.500000
    1857.000000	15761.500000	163.375000	839.750000
    1902.750000	11687.125000	138.875000	583.375000
    1876.250000	11681.625000	142.125000	594.750000
    1873.125000	15739.750000	166.875000	849.625000
    1891.375000	11761.500000	124.250000	583.375000
    1897.625000	11623.000000	155.125000	551.250000
    1850.875000	15769.500000	163.875000	812.875000
    1867.250000	11699.625000	120.500000	580.500000
    1879.250000	13607.750000	155.000000	908.250000
    2557.000000	12840.250000	133.750000	572.500000
    1965.250000	11689.000000	142.000000	574.000000
    1874.000000	11663.000000	146.250000	577.250000
    1855.250000	15745.750000	168.500000	838.500000
    1873.250000	11702.000000	123.250000	583.750000
    1885.750000	11704.000000	127.500000	603.250000
    1854.750000	15761.250000	167.500000	830.250000
    1885.250000	11682.250000	152.500000	551.250000
    1870.750000	11628.250000	143.250000	540.750000
    1866.750000	15823.500000	165.750000	877.500000
    1960.000000	11768.000000	144.750000	573.500000
    1904.250000	11679.500000	122.250000	573.500000
    1876.500000	15774.000000	169.750000	861.000000
    1866.750000	11722.000000	144.750000	545.500000
    1864.500000	11646.750000	148.750000	564.000000
    1865.250000	15729.500000	165.250000	817.750000
    1860.000000	11645.500000	127.250000	570.000000
    1887.000000	11661.500000	148.000000	592.000000
    1866.250000	15790.000000	156.750000	841.000000
    1874.500000	11738.000000	134.500000	593.000000
    1846.750000	11668.750000	156.250000	552.000000
    1878.250000	15736.250000	168.000000	826.500000
    1885.500000	11769.250000	122.750000	574.500000
    1878.750000	11637.250000	151.500000	578.250000
    1855.000000	15756.250000	170.000000	826.000000
    1856.500000	11700.250000	142.750000	535.000000
    1841.000000	11659.000000	144.250000	563.250000
    1909.250000	15768.500000	164.500000	847.000000
    1877.250000	11743.000000	127.250000	576.500000
    1879.000000	11700.000000	127.750000	591.000000
    2532.000000	16636.000000	142.500000	560.500000
    1872.000000	17930.250000	164.000000	616.250000
    1923.000000	11804.000000	137.000000	587.750000
    1880.250000	15762.750000	170.250000	835.500000
    1876.500000	11703.000000	156.500000	547.750000
    1891.750000	11663.750000	141.000000	581.250000
    1864.250000	15745.250000	165.000000	839.000000
    1856.250000	11699.500000	160.500000	546.000000
    1862.000000	11661.500000	152.000000	567.000000
    1887.250000	15747.000000	165.500000	825.250000
    1893.750000	11737.000000	120.250000	596.250000
    1875.250000	13574.500000	162.000000	882.750000
    1947.000000	11697.500000	166.000000	551.000000
    1846.250000	17766.000000	162.000000	648.000000
    1930.750000	11702.000000	126.500000	585.000000
    1895.500000	15834.750000	166.250000	843.500000
    1893.500000	11700.750000	127.500000	587.000000
    1871.250000	11684.250000	137.750000	585.500000
    1882.000000	15809.500000	181.250000	858.750000
    1891.000000	11669.500000	169.250000	549.500000
    1867.500000	11647.000000	157.750000	570.000000
    1869.750000	15769.500000	168.500000	858.750000
    1867.250000	11752.000000	140.500000	580.250000
    1856.000000	13573.500000	162.250000	901.500000
    2562.000000	12865.750000	136.750000	579.750000
    1856.250000	11710.750000	139.500000	570.000000
    1868.750000	11651.500000	160.750000	565.750000
    1856.250000	15767.750000	170.250000	847.750000
    1887.750000	11747.250000	140.250000	545.750000
    1876.500000	11720.250000	124.250000	584.500000
    1865.000000	15720.000000	167.750000	820.250000
    1868.000000	11815.750000	149.000000	536.000000
    2542.500000	17930.500000	171.250000	842.750000
    1868.750000	11667.250000	144.250000	553.500000
    1867.250000	18223.000000	181.000000	887.500000
    1918.250000	11846.750000	122.500000	1315.000000
    1870.000000	15731.750000	174.750000	2098.500000
    1938.000000	11776.750000	167.500000	1586.750000
    1869.500000	11644.000000	161.750000	1299.000000
    2558.750000	16586.250000	133.750000	933.750000
    1841.000000	18114.250000	166.500000	883.250000
    1926.000000	11826.500000	171.250000	875.250000
    1864.250000	15747.750000	163.500000	1165.500000
    1871.250000	11770.500000	126.500000	807.750000
    1869.250000	11672.750000	131.500000	846.000000
    1860.750000	15794.250000	182.500000	1186.250000
    1861.750000	11755.250000	128.000000	889.750000
    1884.250000	11644.250000	162.250000	812.000000
    2552.250000	16586.000000	160.500000	855.250000
    1872.750000	17837.750000	167.250000	1170.750000
    1854.250000	11694.500000	139.250000	811.750000
    1935.750000	15850.500000	156.250000	1042.750000
    841.000000	13159.500000	124.000000	910.000000
    2137.000000	11779.000000	121.000000	839.000000
    2500.500000	16133.500000	162.000000	1186.500000
    2689.500000	11759.250000	125.000000	847.000000
    2557.500000	11662.250000	160.250000	850.250000
    1352.000000	13205.500000	145.000000	967.000000
    1372.750000	13425.000000	121.250000	850.500000
    1382.500000	13672.000000	123.000000	835.750000
    1496.500000	13416.000000	114.250000	842.000000
    1463.250000	13925.500000	129.000000	836.250000
    1446.750000	13338.250000	117.500000	867.500000
    1517.000000	19016.000000	166.500000	1250.750000
    1520.250000	13827.500000	127.000000	959.250000
    2919.000000	11692.500000	128.250000	819.000000
    1473.250000	13354.250000	158.000000	854.000000
    1469.000000	13517.000000	129.000000	819.500000
    1385.250000	13312.000000	142.000000	848.000000
    1485.250000	13096.000000	164.500000	816.500000
    1489.000000	13475.000000	118.500000	896.250000
    1493.500000	13592.250000	139.000000	819.750000
    2818.250000	11672.250000	148.000000	889.750000
    2925.000000	11685.500000	137.500000	793.500000
    1469.750000	13255.250000	120.750000	844.750000
    1379.500000	13646.000000	128.000000	800.000000
    1474.750000	13764.250000	151.000000	843.750000
    1478.750000	13695.500000	137.500000	821.000000
    1490.000000	13544.750000	136.750000	871.750000
    1503.500000	13766.750000	159.000000	887.000000
    1466.250000	13601.750000	158.000000	862.750000
    3162.750000	11716.500000	167.750000	838.500000
    1459.000000	13395.250000	155.000000	900.500000
    1508.500000	13646.000000	124.250000	844.250000
    1428.500000	13322.500000	112.250000	823.000000
    1667.250000	13508.500000	135.000000	874.750000
    1489.500000	13088.500000	123.000000	855.250000
    1420.000000	13599.000000	136.250000	791.250000
    1478.250000	13492.000000	163.500000	846.250000
    1478.000000	13495.500000	132.500000	822.250000
    1501.000000	13333.750000	156.750000	858.750000
    1480.500000	13849.000000	138.500000	848.000000
    3018.500000	11654.000000	159.000000	811.750000
    2811.250000	11665.500000	160.500000	865.500000
    1616.500000	13453.750000	163.000000	876.750000
    2168.000000	20453.000000	159.250000	1207.250000
    1557.000000	13921.250000	136.000000	873.000000
    1514.500000	20301.500000	142.000000	1163.500000
    1525.000000	13753.500000	124.500000	850.500000
    1532.000000	18574.000000	169.500000	1193.000000
    1533.000000	13648.000000	128.000000	848.500000
    1507.000000	13375.000000	130.000000	855.000000
    1468.000000	13343.500000	117.000000	810.000000
    1489.000000	13450.000000	116.000000	825.000000
    2928.000000	11677.500000	120.000000	828.000000
    1477.500000	13298.000000	120.500000	820.000000
    1474.500000	13580.000000	138.000000	898.000000
    1444.500000	13611.000000	127.000000	831.500000
    2975.000000	16692.500000	187.000000	1221.500000
    1499.000000	13532.500000	138.500000	841.000000
    1499.000000	13463.000000	116.500000	876.000000
    1451.500000	13604.500000	210.000000	852.000000
    1471.000000	13779.500000	126.500000	937.500000
    1494.000000	13403.500000	158.500000	862.500000
    2173.500000	18230.500000	140.500000	802.000000
    1419.000000	13430.000000	157.000000	843.000000
    1486.500000	13417.500000	121.500000	835.500000
    1483.500000	13027.000000	206.500000	819.000000
    1458.000000	13446.500000	155.000000	866.000000
    1494.000000	13050.000000	145.000000	869.000000
    1476.000000	13009.000000	134.000000	933.500000
    1469.500000	13469.000000	117.500000	817.500000
    1361.500000	12926.500000	125.000000	804.500000
    1877.000000	17885.000000	137.000000	808.500000
    1324.500000	12982.000000	141.000000	839.000000
    1242.000000	12985.500000	145.500000	798.000000
    2295.000000	16052.000000	163.000000	1171.000000
    2162.500000	11630.000000	139.500000	803.500000
    2159.500000	11609.000000	146.500000	818.000000
    2032.500000	15858.000000	186.000000	1174.000000
    1898.000000	11733.000000	122.500000	844.500000
    1897.000000	11699.000000	117.500000	811.000000
    2558.500000	16598.000000	140.000000	813.500000
    1904.000000	17825.500000	172.500000	879.500000
    1915.500000	11798.500000	133.500000	829.000000
    1902.500000	15810.000000	154.000000	1137.500000
    1901.500000	11732.000000	128.000000	813.000000
    1887.500000	11632.500000	158.500000	881.000000
    2546.000000	16537.500000	145.000000	807.500000
    1877.500000	17827.000000	172.500000	888.500000
    1913.000000	11750.500000	128.500000	829.000000
    1881.500000	15846.000000	155.000000	1192.500000
    1899.000000	11764.000000	127.500000	824.000000
    1893.000000	11713.000000	120.500000	899.000000
    1881.500000	15792.000000	167.000000	1162.500000
    1882.000000	11755.000000	130.000000	807.500000
    1901.000000	11644.500000	151.000000	848.500000
    1892.000000	15748.500000	171.500000	1140.000000
    1904.000000	11711.500000	138.500000	848.000000
    1903.000000	11719.500000	124.000000	815.000000
    1904.000000	15721.000000	167.500000	1160.500000
    1880.000000	11963.000000	134.500000	821.500000
    1861.500000	13610.500000	170.500000	1200.000000
    2556.500000	12867.000000	134.000000	837.500000
    1864.000000	11759.000000	149.000000	819.000000
    1871.000000	11727.500000	114.000000	837.000000
    2563.500000	16609.500000	154.500000	781.000000
    1871.500000	17925.500000	166.500000	857.000000
    1921.000000	11741.500000	134.000000	818.500000
    1872.500000	15754.000000	167.500000	1149.000000
    1875.000000	11792.500000	127.000000	836.000000
    1868.000000	11709.500000	123.500000	821.500000
    1850.500000	15759.500000	170.500000	1249.000000
    1871.500000	11734.000000	139.500000	804.000000
    1863.500000	13514.500000	168.000000	1226.000000
    1849.000000	11712.500000	161.000000	828.500000
    1860.000000	17864.500000	169.000000	876.000000
    1922.500000	11744.000000	128.500000	841.000000
    1864.500000	15763.000000	157.500000	1248.500000
    1890.500000	11803.000000	142.500000	826.000000
    1865.500000	11712.500000	127.500000	855.000000
    1860.500000	15743.000000	170.500000	1160.000000
    1882.000000	11766.500000	146.000000	811.000000
    1843.000000	11623.500000	142.500000	802.500000
    1870.000000	15709.000000	173.000000	1188.000000
    1868.500000	11723.500000	155.500000	788.500000
    1856.500000	11662.500000	157.000000	824.000000
    2540.500000	16681.000000	127.500000	813.000000
    1833.000000	17824.500000	177.500000	873.500000
    1919.000000	11797.500000	138.500000	844.500000
    1873.000000	15788.500000	174.000000	1155.000000
    1901.000000	11811.000000	147.000000	825.000000
    1858.500000	13576.000000	170.000000	1185.000000
    1869.000000	11725.000000	163.000000	813.500000
    1862.000000	17857.000000	153.500000	830.500000
    1909.500000	11746.000000	130.000000	808.500000
    1872.500000	15756.500000	166.500000	1172.000000
    1877.000000	11801.500000	126.000000	890.000000
    1838.500000	11665.500000	142.000000	817.000000
    1828.000000	15765.000000	172.000000	1150.000000
    1865.000000	11746.500000	136.500000	823.000000
    1851.000000	11784.000000	134.000000	875.000000
    1874.000000	15733.000000	170.000000	1172.000000
    1893.000000	11740.500000	125.500000	910.000000
    1875.500000	11672.500000	137.500000	844.000000
    1851.000000	15750.000000	163.500000	1153.500000
    1891.000000	11780.500000	132.500000	808.000000
    1880.500000	11713.500000	118.000000	816.000000
    1843.500000	15757.000000	162.000000	1196.000000
    1876.000000	11697.500000	128.500000	907.000000
    1866.500000	11664.000000	121.500000	815.500000
    1866.000000	15768.000000	152.000000	1149.000000
    1897.500000	11712.500000	160.500000	831.000000
    604.000000	15284.000000	154.000000	786.500000
    85.000000	11659.500000	138.000000	794.500000
    4221.500000	18005.000000	160.500000	1152.000000
    1851.000000	11702.500000	157.000000	816.000000
    1867.000000	17832.000000	163.000000	895.000000
    1902.000000	11808.000000	145.500000	813.000000
    1868.000000	15735.000000	160.500000	1174.000000
    1884.500000	11902.000000	130.000000	784.500000
    1948.500000	13595.000000	153.000000	1161.000000
    2539.000000	12921.000000	120.500000	799.500000
    1862.500000	11736.000000	140.000000	760.000000
    1826.000000	11683.000000	160.500000	759.000000
    1869.500000	15779.000000	169.500000	1094.000000
    1870.000000	11745.000000	121.500000	800.500000
    1875.500000	11649.000000	151.000000	769.500000
    1855.500000	15736.000000	178.000000	1228.000000
    1875.000000	11816.000000	124.500000	798.000000
    1840.500000	13551.000000	173.000000	1120.000000
    2545.500000	12859.500000	140.000000	773.000000
    1857.500000	11753.000000	158.500000	764.000000
    1871.000000	11639.500000	159.000000	741.000000
    1867.500000	15693.000000	178.500000	1204.500000
    1869.000000	11735.000000	128.000000	762.500000
    1844.500000	11648.000000	151.000000	738.000000
    1874.000000	15774.500000	157.000000	1104.500000
    1873.000000	11714.500000	164.500000	761.500000
    1842.000000	11674.500000	149.000000	743.500000
    2536.000000	17924.500000	172.000000	1106.000000
    1857.000000	11738.500000	140.000000	780.000000
    1850.000000	11715.500000	126.000000	797.500000
    1890.500000	15695.500000	172.500000	1138.500000
    1863.500000	11775.500000	130.000000	786.500000
    1848.500000	11656.500000	140.500000	767.500000
    2532.500000	17916.000000	172.000000	1153.500000
    1860.000000	11727.500000	127.500000	800.000000
    2520.000000	17874.000000	163.000000	782.000000
    1971.500000	11709.000000	138.500000	779.000000
    2588.000000	11801.000000	117.000000	796.000000
    2567.000000	14118.000000	170.000000	1104.500000
    1321.000000	13139.000000	142.000000	864.000000
    1314.000000	19520.000000	168.000000	957.000000
    1353.500000	13795.500000	133.500000	791.000000
    3144.500000	16735.000000	174.000000	1105.000000
    1704.000000	13305.000000	124.000000	797.000000
    1687.500000	13139.000000	142.500000	765.000000
    1416.000000	13235.500000	128.000000	779.000000
    1477.000000	13176.500000	138.000000	840.000000
    1503.500000	13234.500000	158.500000	745.000000
    1466.500000	13004.500000	134.500000	916.000000
    2628.500000	11629.000000	163.000000	755.500000
    1405.500000	12875.500000	133.000000	774.000000
    1258.500000	12833.500000	124.500000	774.000000
    1261.500000	13042.000000	128.000000	770.500000
    2204.500000	11639.500000	128.000000	778.500000
    2151.500000	16034.000000	157.000000	1092.000000
    2025.500000	11668.500000	121.500000	777.500000
    1988.500000	11696.500000	170.500000	759.000000
    1879.000000	15732.500000	169.500000	1108.500000
    1894.500000	11748.500000	135.500000	759.000000
    1874.000000	11645.500000	163.500000	753.500000
    1889.000000	15705.000000	175.500000	1089.000000
    1869.000000	11736.000000	148.000000	775.000000
    1884.000000	11674.000000	126.500000	781.000000
    2525.000000	17930.000000	160.500000	1080.500000
    1883.000000	11814.000000	144.000000	737.000000
    1892.000000	13673.000000	164.000000	1269.500000
    2555.500000	12945.000000	130.500000	774.000000
    1879.500000	11833.500000	130.000000	766.500000
    1917.000000	11660.500000	145.500000	784.500000
    1877.500000	15703.500000	169.500000	1081.500000
    1896.500000	11741.000000	126.000000	776.500000
    1882.500000	11729.000000	121.500000	839.000000
    1851.500000	15732.000000	161.500000	1073.000000
    1882.500000	11735.500000	127.000000	766.500000
    1875.000000	11697.500000	130.000000	788.000000
    1849.500000	15836.500000	165.000000	1087.500000
    2206.000000	11664.000000	147.000000	754.000000
    1918.500000	11616.500000	157.000000	760.000000
    2415.000000	16066.500000	171.500000	1125.000000
    2271.000000	11656.000000	141.500000	747.500000
    2238.000000	13898.000000	170.000000	1110.500000
    2182.000000	11690.000000	149.000000	755.500000
    1893.000000	17922.500000	160.500000	800.000000
    1940.000000	11804.000000	139.000000	781.000000
    1890.500000	15828.500000	162.000000	1082.000000
    1870.000000	11778.000000	122.000000	772.000000
    1859.000000	11714.000000	120.500000	790.500000
    1866.500000	15710.000000	184.500000	1108.000000
    1879.000000	11753.000000	115.000000	781.500000
    1862.500000	11480.500000	156.500000	778.500000
    2542.000000	17945.000000	166.000000	1196.500000
    1847.500000	11749.500000	136.000000	780.000000
    1884.000000	11666.500000	157.500000	804.500000
    1861.000000	15717.000000	165.500000	1117.000000
    1854.000000	11736.500000	120.500000	782.000000
    1864.500000	11716.500000	127.500000	765.500000
    1854.000000	15697.000000	166.500000	1203.000000
    1854.000000	11835.000000	122.500000	777.000000
    1849.000000	11671.000000	158.500000	743.000000
    2540.500000	17899.000000	178.000000	1104.500000
    1879.000000	11796.500000	126.000000	772.500000
    1856.000000	11691.000000	142.000000	782.000000
    1863.000000	15739.500000	164.500000	1100.000000
    1848.500000	11698.000000	166.000000	748.000000
    1878.000000	11674.500000	128.500000	783.500000
    1853.000000	15755.500000	180.500000	1118.000000
    1871.000000	11758.500000	128.500000	781.000000
    1871.000000	11667.500000	163.000000	753.500000
    1956.500000	15853.500000	159.000000	1090.500000
    1865.500000	11749.500000	127.000000	780.000000
    1875.000000	11701.500000	127.500000	776.000000
    1876.000000	15722.500000	167.000000	1081.500000
    1876.000000	11769.000000	132.000000	769.500000
    1856.500000	11672.000000	154.500000	736.000000
    1854.500000	15873.000000	174.500000	1101.500000
    1852.500000	11742.000000	146.500000	803.500000
    1850.500000	13593.000000	166.000000	1166.500000
    2534.500000	12886.500000	136.000000	728.500000
    1845.000000	11801.000000	164.500000	780.000000
    1845.000000	11731.000000	120.500000	788.000000
    1886.000000	15696.500000	182.500000	1106.000000
    1862.500000	11771.500000	129.000000	834.500000
    1855.000000	11670.500000	159.000000	743.000000
    1854.000000	15753.000000	169.000000	1101.000000
    1858.500000	11751.500000	122.000000	774.500000
    1861.000000	11664.500000	153.000000	747.000000
    2533.000000	17958.500000	170.000000	1081.500000
    1883.000000	11781.500000	159.500000	733.000000
    1864.000000	11724.000000	134.000000	767.000000
    1886.000000	15776.500000	151.500000	1085.000000
    1882.500000	11693.000000	127.500000	784.500000
    1885.500000	11682.000000	150.000000	775.500000
    2548.500000	17921.000000	167.500000	1103.500000
    1861.500000	11767.000000	120.500000	773.000000
    2505.500000	17896.500000	161.000000	796.000000
    1919.000000	11685.500000	130.500000	781.000000
    1863.500000	11764.000000	141.000000	752.000000
    1858.000000	11710.500000	130.000000	810.000000
    1867.500000	15739.500000	150.500000	1092.000000
    1867.000000	11720.500000	123.500000	782.000000
    1859.000000	11671.500000	164.500000	760.000000
    1859.500000	15731.500000	158.500000	1078.500000
    1868.500000	11729.000000	146.500000	756.000000
    1850.000000	13594.000000	166.500000	1015.500000
    2545.000000	12931.000000	133.000000	778.000000
    1855.000000	11738.000000	134.000000	761.000000
    1858.000000	11635.000000	140.000000	801.000000
    1878.000000	15755.000000	166.000000	1110.000000
    1903.000000	11804.000000	126.000000	764.000000
    1850.000000	11639.000000	137.000000	765.000000
    1861.000000	16265.000000	1906.000000	714.000000
    134.000000	11700.000000	125.000000	781.000000
    4688.000000	18433.000000	122.000000	844.000000
    1842.000000	11770.000000	143.000000	752.000000
    1849.000000	11688.000000	172.000000	756.000000
    1857.000000	15764.000000	168.000000	1094.000000
    1877.000000	11744.000000	128.000000	826.000000
    1867.000000	11620.000000	141.000000	751.000000
    1869.000000	15747.000000	162.000000	1091.000000
    1890.000000	11661.000000	145.000000	733.000000
    1857.000000	11764.000000	144.000000	733.000000
    2555.000000	17965.000000	163.000000	1097.000000
    1855.000000	11752.000000	132.000000	766.000000
    1884.000000	11685.000000	126.000000	782.000000
    1862.000000	15780.000000	169.000000	1094.000000
    1857.000000	11693.000000	166.000000	736.000000
    1857.000000	11687.000000	124.000000	779.000000
    2515.000000	17854.000000	161.000000	1100.000000
    1868.000000	11709.000000	162.000000	780.000000
    1861.000000	11657.000000	142.000000	741.000000
    2533.000000	16622.000000	144.000000	785.000000
    1848.000000	17814.000000	182.000000	901.000000
    1900.000000	11794.000000	158.000000	798.000000
    1869.000000	15828.000000	165.000000	1101.000000
    1856.000000	11737.000000	122.000000	767.000000
    1878.000000	11687.000000	124.000000	779.000000
    1851.000000	15720.000000	178.000000	1094.000000
    1887.000000	11721.000000	152.000000	847.000000
    1853.000000	11645.000000	144.000000	738.000000
    1865.000000	15713.000000	164.000000	1090.000000
    1851.000000	11789.000000	142.000000	777.000000
    1855.000000	13533.000000	171.000000	1168.000000
    2521.000000	12876.000000	138.000000	745.000000
    1852.000000	11774.000000	138.000000	769.000000
    1860.000000	11654.000000	149.000000	739.000000
    1849.000000	15749.000000	168.000000	1103.000000
    1873.000000	11755.000000	132.000000	872.000000
    1858.000000	11641.000000	149.000000	748.000000
    1860.000000	15719.000000	172.000000	1083.000000
    1869.000000	11779.000000	127.000000	774.000000
    1845.000000	11788.000000	124.000000	778.000000
    2524.000000	16615.000000	155.000000	733.000000
    1866.000000	17849.000000	169.000000	832.000000
    1921.000000	11773.000000	122.000000	779.000000
    1867.000000	15741.000000	167.000000	1097.000000
    1863.000000	11787.000000	120.000000	767.000000
    1879.000000	11661.000000	160.000000	844.000000
    1862.000000	15771.000000	164.000000	1102.000000
    1859.000000	11770.000000	120.000000	771.000000
    1847.000000	11693.000000	156.000000	783.000000
    1857.000000	15739.000000	167.000000	1090.000000
    1875.000000	11764.000000	146.000000	733.000000
    1873.000000	13592.000000	174.000000	1229.000000
    1864.000000	11750.000000	155.000000	814.000000
    1856.000000	17878.000000	169.000000	828.000000
    1912.000000	11812.000000	150.000000	769.000000
    1873.000000	15810.000000	167.000000	1087.000000
    1947.000000	11761.000000	140.000000	760.000000
    1991.000000	11696.000000	155.000000	760.000000
    1850.000000	15738.000000	162.000000	1086.000000
    1864.000000	11739.000000	136.000000	769.000000
    1834.000000	11683.000000	150.000000	741.000000
    1877.000000	15786.000000	165.000000	1099.000000
    1868.000000	11706.000000	154.000000	741.000000
    1858.000000	13585.000000	166.000000	1045.000000
    2551.000000	12866.000000	131.000000	761.000000
    1851.000000	11786.000000	131.000000	790.000000
    1914.000000	11626.000000	139.000000	762.000000
    1833.000000	15755.000000	172.000000	1086.000000
    1871.000000	11731.000000	121.000000	765.000000
    1875.000000	11682.000000	155.000000	752.000000
    1857.000000	15678.000000	152.000000	1178.000000
    1868.000000	11786.000000	120.000000	786.000000
    1880.000000	11669.000000	156.000000	773.000000
    2556.000000	17959.000000	159.000000	1093.000000
    1853.000000	11789.000000	123.000000	777.000000
    1870.000000	11667.000000	125.000000	780.000000
    1841.000000	15769.000000	166.000000	1184.000000
    1883.000000	11735.000000	124.000000	774.000000
    1866.000000	11687.000000	126.000000	788.000000
    2536.000000	17948.000000	177.000000	1084.000000
    1878.000000	11783.000000	144.000000	771.000000
    2512.000000	17881.000000	157.000000	774.000000
    1887.000000	11708.000000	136.000000	801.000000
    1859.000000	11761.000000	125.000000	780.000000
    1862.000000	11667.000000	158.000000	756.000000
    1867.000000	15752.000000	151.000000	1081.000000
    1857.000000	11755.000000	119.000000	781.000000
    1874.000000	11623.000000	143.000000	738.000000
    2516.000000	15768.000000	150.000000	776.000000
    1852.000000	11786.000000	133.000000	768.000000
    1840.000000	11642.000000	159.000000	743.000000
    1862.000000	15735.000000	169.000000	1099.000000
    1854.000000	11755.000000	130.000000	792.000000
    1856.000000	11744.000000	121.000000	772.000000
    1856.000000	15722.000000	174.000000	1095.000000
    1865.000000	11737.000000	144.000000	817.000000
    1929.000000	11617.000000	144.000000	768.000000
    1840.000000	15746.000000	166.000000	1087.000000
    1843.000000	11785.000000	137.000000	763.000000
    1890.000000	11736.000000	127.000000	776.000000
    1874.000000	15757.000000	162.000000	1082.000000
    1864.000000	11823.000000	131.000000	822.000000
    1868.000000	11669.000000	162.000000	744.000000
    1843.000000	15736.000000	168.000000	1113.000000
    1866.000000	11737.000000	126.000000	781.000000
    1863.000000	11665.000000	163.000000	774.000000
    1864.000000	15739.000000	178.000000	1098.000000
    1884.000000	11756.000000	126.000000	790.000000
    1850.000000	11669.000000	120.000000	771.000000
    1869.000000	15751.000000	159.000000	1091.000000
    1857.000000	11741.000000	142.000000	773.000000
    1870.000000	11689.000000	147.000000	788.000000
    1842.000000	15758.000000	165.000000	1111.000000
    1846.000000	11733.000000	136.000000	780.000000
    1870.000000	11698.000000	129.000000	789.000000
    1858.000000	15758.000000	171.000000	1100.000000
    1855.000000	11720.000000	142.000000	762.000000
    1842.000000	13577.000000	164.000000	1034.000000
    2537.000000	12940.000000	126.000000	761.000000
    1847.000000	11735.000000	130.000000	767.000000
    1847.000000	11688.000000	148.000000	844.000000
    1854.000000	15840.000000	170.000000	1098.000000
    1853.000000	11748.000000	136.000000	769.000000
    1853.000000	11698.000000	142.000000	782.000000
    1841.000000	15747.000000	176.000000	1091.000000
    1887.000000	11755.000000	125.000000	767.000000
    1934.000000	11656.000000	159.000000	824.000000
    1856.000000	15789.000000	147.000000	1094.000000
    1866.000000	11740.000000	163.000000	747.000000
    1878.000000	11753.000000	124.000000	770.000000
    1851.000000	15751.000000	169.000000	1103.000000
    1842.000000	11767.000000	153.000000	736.000000
    1866.000000	11650.000000	161.000000	741.000000
    1834.000000	15731.000000	178.000000	1113.000000
    1860.000000	11719.000000	155.000000	758.000000
    1861.000000	11657.000000	161.000000	752.000000
    2529.000000	16696.000000	153.000000	787.000000
    1856.000000	17834.000000	173.000000	868.000000
    1896.000000	11774.000000	173.000000	786.000000
    1839.000000	15663.000000	150.000000	1104.000000
    1881.000000	11736.000000	158.000000	736.000000
    1859.000000	11677.000000	129.000000	762.000000
    1848.000000	15755.000000	172.000000	1112.000000
    1855.000000	11720.000000	162.000000	750.000000
    1856.000000	11700.000000	154.000000	784.000000
    1862.000000	15727.000000	172.000000	1099.000000
    1850.000000	11789.000000	128.000000	774.000000
    1856.000000	11723.000000	128.000000	790.000000
    1851.000000	15756.000000	164.000000	1101.000000
    1867.000000	11711.000000	128.000000	764.000000
    788.000000	17809.000000	148.000000	670.000000
    80.000000	11727.000000	133.000000	848.000000
    4632.000000	20244.000000	119.000000	791.000000
    1917.000000	11746.000000	121.000000	793.000000
    1858.000000	11774.000000	123.000000	790.000000
    1998.000000	11690.000000	133.000000	756.000000
    1879.000000	15772.000000	150.000000	1088.000000
    1866.000000	11788.000000	137.000000	826.000000
    and it can be seen that the color space transform is the most time consuming part. so i have some questions:
    1) VI Module Output Format: The VI module outputs data in YUV420SP format. its configured in the vi_chn_init().

    Code: Select all

    int vi_chn_init(int channelId, int width, int height) {
    	int ret;
    	int buf_cnt = 2;
    	// VI init
    	VI_CHN_ATTR_S vi_chn_attr;
    	memset(&vi_chn_attr, 0, sizeof(vi_chn_attr));
    	vi_chn_attr.stIspOpt.u32BufCount = buf_cnt;
    	vi_chn_attr.stIspOpt.enMemoryType =
    	    VI_V4L2_MEMORY_TYPE_DMABUF; // VI_V4L2_MEMORY_TYPE_MMAP;
    	vi_chn_attr.stSize.u32Width = width;
    	vi_chn_attr.stSize.u32Height = height;
    	vi_chn_attr.enPixelFormat = RK_FMT_YUV420SP;
    	vi_chn_attr.enCompressMode = COMPRESS_MODE_NONE; // COMPRESS_AFBC_16x16;
    	vi_chn_attr.u32Depth = 2; //0, get fail, 1 - u32BufCount, can get, if bind to other device, must be < u32BufCount
    	ret = RK_MPI_VI_SetChnAttr(0, channelId, &vi_chn_attr);
    	ret |= RK_MPI_VI_EnableChn(0, channelId);
    	if (ret) {
    		printf("ERROR: create VI error! ret=%d\n", ret);
    		return ret;
    	}
    
    	return ret;
    }
    Is it possible that the VI hardware inherently outputs YUV420SP, or is there typically a way to configure it to output BGR directly (or another format that might be less costly to convert to BGR, if BGR is my final requirement before encoding)? Changing this could significantly reduce processing time.

    2)RTSP Latency vs. VLC Latency: My measurements show the RTSP processing section taking only around 1 millisecond. However, when viewing the stream in VLC, I observe an end-to-end latency of approximately 1 second. Could this large discrepancy suggest that a significant portion of the observed latency is introduced by VLC's internal buffering or processing, rather than my streaming application itself?

    3)Purpose of memcpy after Color Space Transformation: After transforming the color space, I have a memcpy operation:

    Code: Select all

    memcpy(data, frame.data, width * height * 3);

    Can you explain the reason for this? would exploring DMA (Direct Memory Access) for this transfer be beneficial?

    2/2

    best regards.
  • The understanding of the routine source code and its secondary development do not fall within the scope of technical support. I will simply answer your questions. For further understanding, please start by referring to the documentation and source code and conducting experiments. Please understand that our resources are limited. The routine only provides a framework, and there are many optimization spaces that cannot be fully assisted.
    1. If you do not need opencv-mobile to perform secondary processing on the image, refer to the example in $SDK/media/sample and directly bind VI to VENC (set the output of VI and the input of VENC to the same mode). Without using color format conversion, the frame rate can be significantly improved.
    2. librtsp is closed-source and the internal details are unclear. However, it can be confirmed that after VENC outputs the frame to g_rtsp_session, there will be further operations in the background or other threads to complete the transmission. Therefore, I recommend using other solutions to replace librtsp to obtain more information and optimization space.
    3. The memcpy after color format conversion is for the convenience of adjusting the output image size and synchronizing the memory block. Removing it can increase the frame rate by one frame, but it will cause ghosting in the secondary processing of opencv-mobile. If you need further optimization of the program, you can use OSD to replace opencv-mobile for image processing methods. This will not lose the frame rate and will not affect the display effect, but it is more complex to use.