deepstream源碼

雜記、typedef—typedef int INTERGER 相當於用INTERGER來代表int類型; 或 typedef float REAL 用REAL來代表float
一、deepstream_sdk_v4.0_jetson/sources/apps/apps-common/src
從配置文件裏面拿東西,裝到h文件裏定義的結構體內。用dpm_app.c將結構體激活起作用,通過管道,連成一條線
1、dpm_common.c
1)link_element_to_tee_src_pad
2)link_element_to_streammux_sink_pad
3)取消鏈接 unlink_element_from_streammux_sink_pad
4)link_element_to_demux_src_pad
5)str_replace
2、dpm_config_file_parser.c

裏面是所有解析[ ]那組數據的方法,key和value一一對應,包括自定義的ds-example你也可以加入新的key

1)裏面有所有大配置裏的宏定義。例如:
#define CONFIG_GROUP_SOURCE_CAMERA_WIDTH "camera-width"
這些定義代表着管道中的各個插件,你可以在這裏定義自己的插件,比如:
#define CONFIG_GROUP_DSEXAMPLE "ds-example"
2)get_absolute_file_path
3)parse_labels_file 解析標籤files,類別class
4)parse_source 解析攝像頭,視頻源那個方面
5)parse_streammux,parse_dsexample,parse_osd,parse_dewarper,parse_gie,parse_tracker,parse_sink,parse_tiled_display

3、dpm_dewarper_bin.c
deepstream-dewarper-test
├ 演示單個或多個360度攝像機流的扭曲功能。從CSV文件讀取相機校準參數,
├ 並在顯示屏上渲染過道和斑點表面。
1)create_dewarper_bin
4、dpm_dsexample.c
1)create_dsexample_bin
5、dpm_osd_bin.c
1)create_osd_bin
7、dpm_perf.c
1)sink_bin_buf_probe //Buffer probe探查 function on sink element
2)perf_measurement_callback 性能測量回調
3)pause_perf_measurement,resume_perf_measurement,enable_perf_measurement
8、dpm_primary_gie_bin.c
1)write_infer_output_to_file //infer 推斷
2)create_primary_gie_bin //gie 網絡
9、dpm_secondary_gie_bin.c
1)wait_queue_buf_probe //等待爲了所有第二階段推理能平行進行
2)wait_queue_buf_probe1 //捕獲EOS event,這樣就可以停止等待所有次要任務完成
3)write_infer_output_to_file //output 輸出
4)create_secondary_gie //Create secondary infer sub bin and sets properties mentioned in configuration file.
5)should_create_secondary_gie //This decides if secondary infer sub bin should be created or not
如果創建了第三級或更高級別的推斷,則應以這樣的方式創建對gie-id和unique-id的操作,即對second的輸出執行第三個推斷,對primary的輸出執行第二個操作,依此類推
6)create_secondary_gie_bin
7)destroy_secondary_gie_bin

10、dpm_sink_bin.c
1)create_render_bin
2)create_encode_file_bin //Function to create sink bin to generate encoded output
3)start_rtsp_streaming
4)create_udpsink_bin
5)create_sink_bin

11、dpm_source_bin.c
1)set_camera_csi_params
2)set_camera_v4l2_params
3)create_camera_source_bin分情況,看是csi,v4l2還是不支持source type
4)cb_newpad —Decodebin linked to pipeline連接到管道的解碼器;
cb_newpad2 cb_newpad3
5)cb_sourcesetup — latency延遲
6)seek_decode — Function to seek the source stream to start,It is required to play the stream in loop.
7)restart_stream_buf_prob 探測函數用於刪除某些事件,以支持每個源流循環的自定義邏輯。prob探查
8)decodebin_child_added
9)create_rtsp_src_bin
10)create_uridecode_src_bin
11)create_source_bin
12)create_multi_source_bin
13)reset_source_pipeline
14)set_source_to_playing
15)reset_encodebin

12、dpm_streammux.c
1)set_streammux_properties // Create bin, add queue and the element, link all elements and ghost pads,Set the element properties from the parsed config解析配置

13、dpm_tiled_display_bin.c
1)create_tiled_display_bin tiled 平鋪

14、dpm_tracker_bin.c
1)create_tracking_bin //ll-config-file ll-lib-file


二、deepstream_sdk_v4.0_jetson/sources/apps/apps-common/includes
這些頭文件定義裏一羣結構體


三、deepstream_sdk_v4.0_jetson/sources/apps/sample_apps/deepstream-app
1、dpm_app.h將includes文件夾裏面的結構體們組裝成了新的大結構體
1)create_pipeline,pause_pipeline,resume_pipeline,seek_pipeline 聲明
2)toggle_show_bbox_text
3)destroy_pipeline,restart_pipeline
4)這裏是根據大config文件中的cfg_file_path讀取小config裏的properties.
parse_config_file

2、dpm_app.c
1)watch_source_status //This function try to reconnect the source by resetting that source pipeline.
2)bus_callback //從管道里收消息,然後做處理
EOS就是釋放資源、退出循環,等待所有管道完工
3)bus_sync_handler //bus同步處理
4)write_kitti_output,write_kitti_track_output
5)component_id_compare_func
6)process_meta 處理元數據
7)process_buffer 處理推斷buffer和元數據
8)gie_primary_processing_done_buf_prob //得到初步推斷的結果
9)gie_processing_done_buf_prob //探針函數得到 Primary + Secondary推理的結果
10)tracking_done_buf_prob //在tracker後的buffer探針函數
11)latency_measurement_buf_prob //延遲測量
12)create_processing_instance //單獨的緩衝區上工作
13)create_common_elements //Function to create common elements(Primary infer, tracker, secondary infer) of the pipeline.These components operate on muxed混合的 data from all the streams. So they are independent of number of streams in the pipeline.
14)create_pipeline 暫停,繼續,毀掉都在這裏//dpm_app.h裏聲明的方法在這裏實現了

3、dpm_app_config_parser.c
1)#define CONFIG_GROUP_APP “application”
#define CONFIG_GROUP_APP_ENABLE_PERF_MEASUREMENT “enable-perf-measurement”
#define CONFIG_GROUP_TESTS “tests”
#define CONFIG_GROUP_TESTS_FILE_LOOP “file-loop”
2)parse_tests
3)parse_app
4)parse_config_file

4、dpm_app_main.c
1)all_bbox_generated // Callback function to be called once all inferences (Primary + Secondary) are done.不需要可以全部移除
2)_intr_handler //處理中斷信號
3)perf_cb //callback function to print the performance性能 numbers of each stream是
4)check_for_interrupt //用於檢查中斷狀態的循環函數
_intr_setup //Function to install custom handler for program interrupt signal
5)kbhit,changemode //用於啓用/禁用終端規範模式的函數
print_runtime_commands
6)event_thread_func //循環功能檢查鍵盤輸入和每個管道的狀態
7)get_source_id_from_coordinates //是平鋪顯示時候源的id嗎?
8)nvds_x_event_thread //Thread to monitor監視 X window events.按下prq有反應?
9)overlay_graphics //關於最後顯示字體,字間距什麼的
10)main 一些終端的打印和開啓整個程序

四、dpm-image-decode-test
1、dpm_image_decode_app.c
1)輸出屏幕大小
2)gchar pgie_classes_str[4][32] = { “Vehicle”, “TwoWheeler”, “Person”,
“RoadSign”};
3)tiler_sink_pad_buffer_probe 將提取OSD sink pad上接收到的元數據,並更新繪製矩形、對象信息等的參數。 循環得到"Frame Number = %d Number of objects = %d "
“Vehicle Count = %d Person Count = %d\n”
4)buss_call //裏面case GST_MESSAGE_WARNING,ERROR,ELEMENT啥的
5)create_source_bin //factory_make了 soure,jpeg-parser,nvv4l2-decoder
6)main gstnvdsmeta.h gst-nvmessage.h
建立裏pipeline來連接elements,factory_make出來stream-muxer element來接收源—一系列操作–建立element engine nvtiler converter display transform renderer----
接下來配置這個element根據宏定義和config文件----將bus配備好buscall音箱(時刻報告前方消息)開到pipeline上----將所有element放到pipeline上,鏈接起來,就像站點—開通pipeline,buffer船裝着源元素開始在pipeline裏流動,在osd最後的element出口sink pad上,元素已經組裝完整,加入探針告訴全世界完整元素生成—關閉管道

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章