Commit e69cf19fdd8a53c22c54f6bca34f69f37b7e7cfa

Authored by Hu Chunming
1 parent 307ce3ec

同步代码,修复任务结束时的崩溃

.vscode/c_cpp_properties.json 0 → 100644
  1 +{
  2 + "configurations": [
  3 + {
  4 + "name": "linux-gcc-x64",
  5 + "includePath": [
  6 + "${workspaceFolder}/**"
  7 + ],
  8 + "compilerPath": "/usr/bin/gcc",
  9 + "cStandard": "${default}",
  10 + "cppStandard": "${default}",
  11 + "intelliSenseMode": "linux-gcc-x64",
  12 + "compilerArgs": [
  13 + ""
  14 + ]
  15 + }
  16 + ],
  17 + "version": 4
  18 +}
0 19 \ No newline at end of file
... ...
.vscode/launch.json
1 1 {
2   - "version": "0.2.0",
3   - "configurations": [
4   - {
5   - "name": "mvpt",
6   - "type": "cppdbg",
7   - "request": "launch",
8   - "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/test",
9   - "args": ["file:///home/cmhu/data/video/Street.uvf","2","0","./db/mvpt.bin"],
10   - "stopAtEntry": false,
11   - "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512",
12   - "environment": [],
13   - "externalConsole": false,
14   - "MIMode": "gdb",
15   - "setupCommands": [
16   - {
17   - "description": "Enable pretty-printing for gdb",
18   - "text": "-enable-pretty-printing",
19   - "ignoreFailures": true
20   - }
21   - ]
22   - },{
23   - "name": "test_face",
24   - "type": "cppdbg",
25   - "request": "launch",
26   - "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/test_face",
27   - "args": ["file:///home/cmhu/data/video/Street.uvf?fastdecode=on","6","0","./db/mvpt.bin"],
28   - "stopAtEntry": false,
29   - "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512",
30   - "environment": [],
31   - "externalConsole": false,
32   - "MIMode": "gdb",
33   - "setupCommands": [
34   - {
35   - "description": "Enable pretty-printing for gdb",
36   - "text": "-enable-pretty-printing",
37   - "ignoreFailures": true
38   - }
39   - ]
40   - },{
41   - "name": "DxDecoderTest",
42   - "type": "cppdbg",
43   - "request": "launch",
44   - "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/DxDecoderTest",
45   - "args": ["file:///home/cmhu/data/video/Street.uvf?fastdecode=on","6","0","./db/mvpt.bin"],
46   - "stopAtEntry": false,
47   - "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512",
48   - "environment": [],
49   - "externalConsole": false,
50   - "MIMode": "gdb",
51   - "setupCommands": [
52   - {
53   - "description": "Enable pretty-printing for gdb",
54   - "text": "-enable-pretty-printing",
55   - "ignoreFailures": true
56   - }
57   - ]
58   - },{
59   - "name": "vpdr_test",
60   - "type": "cppdbg",
61   - "request": "launch",
62   - "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/vpdr_test",
63   - "args": ["file:///home/cmhu/data/video/Street.uvf?fastdecode=on","6","0","./db/mvpt.bin"],
64   - "stopAtEntry": false,
65   - "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512",
66   - "environment": [],
67   - "externalConsole": false,
68   - "MIMode": "gdb",
69   - "setupCommands": [
70   - {
71   - "description": "Enable pretty-printing for gdb",
72   - "text": "-enable-pretty-printing",
73   - "ignoreFailures": true
74   - }
75   - ]
76   - }
77   - ]
78   - }
79 2 \ No newline at end of file
  3 + "version": "0.2.0",
  4 + "configurations": [
  5 + {
  6 + "name": "mvpt",
  7 + "type": "cppdbg",
  8 + "request": "launch",
  9 + "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/test",
  10 + "args": [
  11 + "file:///home/cmhu/data/video/dongba.mp4",
  12 + "2",
  13 + "0",
  14 + "./db/mvpt.bin"
  15 + ],
  16 + "stopAtEntry": false,
  17 + "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512",
  18 + "environment": [],
  19 + "externalConsole": false,
  20 + "MIMode": "gdb",
  21 + "setupCommands": [
  22 + {
  23 + "description": "Enable pretty-printing for gdb",
  24 + "text": "-enable-pretty-printing",
  25 + "ignoreFailures": true
  26 + }
  27 + ]
  28 + },
  29 + {
  30 + "name": "test_face",
  31 + "type": "cppdbg",
  32 + "request": "launch",
  33 + "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/test_face",
  34 + "args": [
  35 + "file:///home/cmhu/data/video/Street.uvf?fastdecode=on",
  36 + "6",
  37 + "0",
  38 + "./db/mvpt.bin"
  39 + ],
  40 + "stopAtEntry": false,
  41 + "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512",
  42 + "environment": [],
  43 + "externalConsole": false,
  44 + "MIMode": "gdb",
  45 + "setupCommands": [
  46 + {
  47 + "description": "Enable pretty-printing for gdb",
  48 + "text": "-enable-pretty-printing",
  49 + "ignoreFailures": true
  50 + }
  51 + ]
  52 + },
  53 + {
  54 + "name": "DxDecoderTest",
  55 + "type": "cppdbg",
  56 + "request": "launch",
  57 + "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/DxDecoderTest",
  58 + "args": [
  59 + "file:///home/cmhu/data/video/Street.uvf?fastdecode=on",
  60 + "6",
  61 + "0",
  62 + "./db/mvpt.bin"
  63 + ],
  64 + "stopAtEntry": false,
  65 + "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512",
  66 + "environment": [],
  67 + "externalConsole": false,
  68 + "MIMode": "gdb",
  69 + "setupCommands": [
  70 + {
  71 + "description": "Enable pretty-printing for gdb",
  72 + "text": "-enable-pretty-printing",
  73 + "ignoreFailures": true
  74 + }
  75 + ]
  76 + },
  77 + {
  78 + "name": "vpdr_test",
  79 + "type": "cppdbg",
  80 + "request": "launch",
  81 + "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/vpdr_test",
  82 + "args": [
  83 + "file:///home/cmhu/data/video/Street.uvf?fastdecode=on",
  84 + "6",
  85 + "0",
  86 + "./db/mvpt.bin"
  87 + ],
  88 + "stopAtEntry": false,
  89 + "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512",
  90 + "environment": [],
  91 + "externalConsole": false,
  92 + "MIMode": "gdb",
  93 + "setupCommands": [
  94 + {
  95 + "description": "Enable pretty-printing for gdb",
  96 + "text": "-enable-pretty-printing",
  97 + "ignoreFailures": true
  98 + }
  99 + ]
  100 + },
  101 + {
  102 + "name": "C/C++ Runner: Debug Session",
  103 + "type": "cppdbg",
  104 + "request": "launch",
  105 + "args": [],
  106 + "stopAtEntry": false,
  107 + "externalConsole": false,
  108 + "cwd": "/home/cmhu/Project_VideoStructure/vehicle_structure_platform.git0708-3080-trt-face/src/VPT",
  109 + "program": "/home/cmhu/Project_VideoStructure/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/build/Debug/outDebug",
  110 + "MIMode": "gdb",
  111 + "miDebuggerPath": "gdb",
  112 + "setupCommands": [
  113 + {
  114 + "description": "Enable pretty-printing for gdb",
  115 + "text": "-enable-pretty-printing",
  116 + "ignoreFailures": true
  117 + }
  118 + ]
  119 + }
  120 + ]
  121 +}
80 122 \ No newline at end of file
... ...
.vscode/settings.json
1 1 {
2   - "files.associations": {
3   - "*.tcc": "cpp",
4   - "fstream": "cpp",
5   - "system_error": "cpp",
6   - "thread": "cpp",
7   - "chrono": "cpp",
8   - "cctype": "cpp",
9   - "clocale": "cpp",
10   - "cmath": "cpp",
11   - "csignal": "cpp",
12   - "cstdarg": "cpp",
13   - "cstddef": "cpp",
14   - "cstdio": "cpp",
15   - "cstdlib": "cpp",
16   - "cstring": "cpp",
17   - "ctime": "cpp",
18   - "cwchar": "cpp",
19   - "cwctype": "cpp",
20   - "*.ipp": "cpp",
21   - "array": "cpp",
22   - "atomic": "cpp",
23   - "hash_map": "cpp",
24   - "hash_set": "cpp",
25   - "strstream": "cpp",
26   - "bitset": "cpp",
27   - "complex": "cpp",
28   - "condition_variable": "cpp",
29   - "cstdint": "cpp",
30   - "deque": "cpp",
31   - "forward_list": "cpp",
32   - "list": "cpp",
33   - "unordered_map": "cpp",
34   - "unordered_set": "cpp",
35   - "vector": "cpp",
36   - "exception": "cpp",
37   - "rope": "cpp",
38   - "slist": "cpp",
39   - "functional": "cpp",
40   - "future": "cpp",
41   - "initializer_list": "cpp",
42   - "iomanip": "cpp",
43   - "iosfwd": "cpp",
44   - "iostream": "cpp",
45   - "istream": "cpp",
46   - "limits": "cpp",
47   - "mutex": "cpp",
48   - "new": "cpp",
49   - "ostream": "cpp",
50   - "numeric": "cpp",
51   - "ratio": "cpp",
52   - "sstream": "cpp",
53   - "stdexcept": "cpp",
54   - "streambuf": "cpp",
55   - "cfenv": "cpp",
56   - "cinttypes": "cpp",
57   - "regex": "cpp",
58   - "tuple": "cpp",
59   - "type_traits": "cpp",
60   - "utility": "cpp",
61   - "typeindex": "cpp",
62   - "typeinfo": "cpp",
63   - "valarray": "cpp",
64   - "bit": "cpp",
65   - "codecvt": "cpp",
66   - "compare": "cpp",
67   - "concepts": "cpp",
68   - "map": "cpp",
69   - "set": "cpp",
70   - "string": "cpp",
71   - "algorithm": "cpp",
72   - "iterator": "cpp",
73   - "memory": "cpp",
74   - "memory_resource": "cpp",
75   - "optional": "cpp",
76   - "random": "cpp",
77   - "string_view": "cpp",
78   - "numbers": "cpp",
79   - "semaphore": "cpp",
80   - "stop_token": "cpp",
81   - "variant": "cpp",
82   - "*.inc": "cpp"
83   - },
84   - "git.ignoreLimitWarning": true
  2 + "files.associations": {
  3 + "*.tcc": "cpp",
  4 + "fstream": "cpp",
  5 + "system_error": "cpp",
  6 + "thread": "cpp",
  7 + "chrono": "cpp",
  8 + "cctype": "cpp",
  9 + "clocale": "cpp",
  10 + "cmath": "cpp",
  11 + "csignal": "cpp",
  12 + "cstdarg": "cpp",
  13 + "cstddef": "cpp",
  14 + "cstdio": "cpp",
  15 + "cstdlib": "cpp",
  16 + "cstring": "cpp",
  17 + "ctime": "cpp",
  18 + "cwchar": "cpp",
  19 + "cwctype": "cpp",
  20 + "*.ipp": "cpp",
  21 + "array": "cpp",
  22 + "atomic": "cpp",
  23 + "hash_map": "cpp",
  24 + "hash_set": "cpp",
  25 + "strstream": "cpp",
  26 + "bitset": "cpp",
  27 + "complex": "cpp",
  28 + "condition_variable": "cpp",
  29 + "cstdint": "cpp",
  30 + "deque": "cpp",
  31 + "forward_list": "cpp",
  32 + "list": "cpp",
  33 + "unordered_map": "cpp",
  34 + "unordered_set": "cpp",
  35 + "vector": "cpp",
  36 + "exception": "cpp",
  37 + "rope": "cpp",
  38 + "slist": "cpp",
  39 + "functional": "cpp",
  40 + "future": "cpp",
  41 + "initializer_list": "cpp",
  42 + "iomanip": "cpp",
  43 + "iosfwd": "cpp",
  44 + "iostream": "cpp",
  45 + "istream": "cpp",
  46 + "limits": "cpp",
  47 + "mutex": "cpp",
  48 + "new": "cpp",
  49 + "ostream": "cpp",
  50 + "numeric": "cpp",
  51 + "ratio": "cpp",
  52 + "sstream": "cpp",
  53 + "stdexcept": "cpp",
  54 + "streambuf": "cpp",
  55 + "cfenv": "cpp",
  56 + "cinttypes": "cpp",
  57 + "regex": "cpp",
  58 + "tuple": "cpp",
  59 + "type_traits": "cpp",
  60 + "utility": "cpp",
  61 + "typeindex": "cpp",
  62 + "typeinfo": "cpp",
  63 + "valarray": "cpp",
  64 + "bit": "cpp",
  65 + "codecvt": "cpp",
  66 + "compare": "cpp",
  67 + "concepts": "cpp",
  68 + "map": "cpp",
  69 + "set": "cpp",
  70 + "string": "cpp",
  71 + "algorithm": "cpp",
  72 + "iterator": "cpp",
  73 + "memory": "cpp",
  74 + "memory_resource": "cpp",
  75 + "optional": "cpp",
  76 + "random": "cpp",
  77 + "string_view": "cpp",
  78 + "numbers": "cpp",
  79 + "semaphore": "cpp",
  80 + "stop_token": "cpp",
  81 + "variant": "cpp",
  82 + "*.inc": "cpp"
  83 + },
  84 + "git.ignoreLimitWarning": true,
  85 + "C_Cpp_Runner.cCompilerPath": "gcc",
  86 + "C_Cpp_Runner.cppCompilerPath": "g++",
  87 + "C_Cpp_Runner.debuggerPath": "gdb",
  88 + "C_Cpp_Runner.cStandard": "",
  89 + "C_Cpp_Runner.cppStandard": "",
  90 + "C_Cpp_Runner.msvcBatchPath": "",
  91 + "C_Cpp_Runner.useMsvc": false,
  92 + "C_Cpp_Runner.warnings": [
  93 + "-Wall",
  94 + "-Wextra",
  95 + "-Wpedantic",
  96 + "-Wshadow",
  97 + "-Wformat=2",
  98 + "-Wcast-align",
  99 + "-Wconversion",
  100 + "-Wsign-conversion",
  101 + "-Wnull-dereference"
  102 + ],
  103 + "C_Cpp_Runner.msvcWarnings": [
  104 + "/W4",
  105 + "/permissive-",
  106 + "/w14242",
  107 + "/w14287",
  108 + "/w14296",
  109 + "/w14311",
  110 + "/w14826",
  111 + "/w44062",
  112 + "/w44242",
  113 + "/w14905",
  114 + "/w14906",
  115 + "/w14263",
  116 + "/w44265",
  117 + "/w14928"
  118 + ],
  119 + "C_Cpp_Runner.enableWarnings": true,
  120 + "C_Cpp_Runner.warningsAsError": false,
  121 + "C_Cpp_Runner.compilerArgs": [],
  122 + "C_Cpp_Runner.linkerArgs": [],
  123 + "C_Cpp_Runner.includePaths": [],
  124 + "C_Cpp_Runner.includeSearch": [
  125 + "*",
  126 + "**/*"
  127 + ],
  128 + "C_Cpp_Runner.excludeSearch": [
  129 + "**/build",
  130 + "**/build/**",
  131 + "**/.*",
  132 + "**/.*/**",
  133 + "**/.vscode",
  134 + "**/.vscode/**"
  135 + ],
  136 + "C_Cpp_Runner.useAddressSanitizer": false,
  137 + "C_Cpp_Runner.useUndefinedSanitizer": false,
  138 + "C_Cpp_Runner.useLeakSanitizer": false,
  139 + "C_Cpp_Runner.showCompilationTime": false,
  140 + "C_Cpp_Runner.useLinkTimeOptimization": false,
  141 + "C_Cpp_Runner.msvcSecureNoWarnings": false
85 142 }
86 143 \ No newline at end of file
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp
... ... @@ -6,10 +6,6 @@
6 6  
7 7 #include "sfx_depend_inc.h"
8 8  
9   -#include "cuda_kernels.h"
10   -#include <fstream>
11   -#include <iostream>
12   -
13 9 using namespace std;
14 10  
15 11 SfxDecoder::SfxDecoder( )
... ... @@ -47,30 +43,30 @@ bool SfxDecoder::OpenDecoder(DxDecoderConfig&amp; cfg)
47 43 sfx_cfg->flags.useFastDecode = 0;
48 44 sfx_cfg->flags.accelId = m_cfg.devId;
49 45 sfx_cfg->flags.frameNumber = 1;
50   - // sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_NV12U8;
51   - sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_C3BGRU8;
  46 + sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_NV12U8;
  47 + //sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_C3BGRU8;
52 48  
53 49 m_handler = SfxStreamHandlerInterface::SfxGetInstance(sfx_cfg);
54 50  
55 51 m_dec_name = m_cfg.dec_name;
56 52  
57   - cout << "open: " << m_cfg.uri << endl;
58   -
59 53 int nRet = m_handler->SfxOpenStreamHandler( m_cfg.uri.c_str() );
60 54 if (nRet != 0) {
61 55 m_bRun = false;
62   -
63   - LOG_INFO( "[{}]-OpenDecoder failed!", m_dec_name);
  56 + LOG_ERROR( "[{}]-OpenDecoder failed: {}", m_dec_name, m_cfg.uri);
64 57 return false;
65 58 }
66 59  
67 60 m_bRun = true;
  61 +
  62 + LOG_DEBUG("[{}]-OpenDecoder succeed: {}", m_dec_name, m_cfg.uri);
  63 +
68 64 return true;
69 65 }
70 66  
71 67 int SfxDecoder::CloseDecoder()
72 68 {
73   - if (sfx_null != m_handler) { // linux待同步
  69 + if (sfx_null != m_handler) {
74 70 m_handler->SfxCloseStreamHandler();
75 71 while (m_bRun)
76 72 {
... ... @@ -137,7 +133,7 @@ sfx_32 SfxDecoder::SfxLogDefaultHandler(
137 133 sfx_u32 logLen
138 134 )
139 135 {
140   - SfxDecoder * pThis = ( SfxDecoder * )userPtr;
  136 + SfxDecoder * pThis = (SfxDecoder*)userPtr;
141 137  
142 138 if ( SFX_LOG_LEVEL_IMPORTANT == level) //modify by zsh 220602
143 139 {
... ... @@ -147,13 +143,15 @@ sfx_32 SfxDecoder::SfxLogDefaultHandler(
147 143  
148 144 if ( SFX_LOG_LEVEL_CLEANUP == level )
149 145 {
  146 + pThis->m_handler = sfx_null;
150 147 pThis->m_bRun = sfx_false;
151 148 if ( pThis->m_cfg.logcbk )
152 149 {
  150 + //LOG_DEBUG("[{}]- DX_LOG_LEVEL_CLEANUP {}", pThis->m_dec_name, reinterpret_cast<int>(pThis));
153 151 pThis->m_cfg.logcbk( pThis->m_cfg.userPtr, DX_LOG_LEVEL_CLEANUP, "DxDecoder[CUDA] module exited..", 0 );
154 152 }
155 153 }
156   - else if (pThis->m_cfg.log_all)
  154 + else if (pThis->m_cfg.log_all)
157 155 {
158 156 pThis->m_cfg.log_all(pThis->m_cfg.log_user_ptr, (int)level, log, logLen);
159 157 }
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.h
... ... @@ -30,7 +30,7 @@ typedef void (*DXDECODER_CALLBACK)( const void * userPtr, void * buf, unsigned i
30 30 typedef struct DxDecoderConfig
31 31 {
32 32 DxLogHandler logcbk; // 日志回调接口
33   - LOG_ALL_CALLBACK log_all{nullptr};
  33 + LOG_ALL_CALLBACK log_all{ nullptr };
34 34 void* log_user_ptr{nullptr};
35 35 const void * userPtr; // 用户数据
36 36 DXDECODER_CALLBACK escbk; // 解码后帧数据回调接口
... ... @@ -69,6 +69,8 @@ public:
69 69 DxVideoConfig m_video;
70 70 SfxStreamHandlerInterface * m_handler;
71 71  
  72 + string m_dec_name;
  73 +
72 74 private:
73 75 static sfx_32 sfx_stdcall SfxStreamCallback(
74 76 const sfx_void * userPtr,
... ... @@ -91,7 +93,6 @@ private:
91 93 sfx_bool m_bRun;
92 94  
93 95 bool m_bReal{false};
94   - string m_dec_name;
95 96  
96 97 };
97 98  
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp
... ... @@ -352,7 +352,7 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh
352 352 return false;
353 353 }
354 354  
355   - LOG_INFO("[{}] - finish add codec.", cfg.name.c_str());
  355 + LOG_INFO("[{}] - add codec succeed.", cfg.name.c_str());
356 356  
357 357 new_task.taskState = PLAY;
358 358 new_task.taskFrameCount = 0;
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VPTProcess.cpp
... ... @@ -157,7 +157,7 @@ int VPTProcess::init(int gpuid, int max_batch_size)
157 157 param.device_type_ = DEVICE_GPU;
158 158 param.device_id_ = gpuid;
159 159 param.engine_type_ = ENGINE_TENSORRT;
160   - param.trt_serialize_file_ = "./serialize_file/V_VPT";
  160 + param.trt_serialize_file_ = "./serialize_file/VPT";
161 161  
162 162 m_max_batch_size = max_batch_size;
163 163  
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp
1 1 #include "opencv2/opencv.hpp"
2 2 #include "opencv2/highgui/highgui.hpp"
3 3 #include "snapshot_helper.h"
4   -#include "CropImg.h"
5 4  
6 5 #include <chrono>
  6 +#include <algorithm>
7 7  
8 8 #include "depend_inc.h"
9 9 #include "../mvpt_process_assist.h"
10 10 #include "../common.h"
11   -#include "../cuda_src/ImageSaveGPU.h"
  11 +#include "../../cuda_src/ImageSaveGPU.h"
  12 +#include "../../cuda_src/CropImg.h"
12 13  
13 14 using namespace std;
14 15  
... ... @@ -565,22 +566,26 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是
565 566  
566 567 if (hcp_batch_count == 0) continue;
567 568  
568   - sy_img finish_hcp_img[hcp_batch_count];
  569 + vector<sy_img> vec_hcp_img;
  570 + //sy_img finish_hcp_img[hcp_batch_count];
569 571 for (int j = 0; j < hcp_batch_count; j++)
570 572 {
571 573 OBJ_KEY cur_obj_key = hcp_keys[j];
572   - // printf()
573   - finish_hcp_img[j].set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  574 + sy_img finish_hcp_img;
  575 + finish_hcp_img.set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  576 + vec_hcp_img.push_back(finish_hcp_img);
574 577 }
575 578  
576   - hcp_analysis_result result[hcp_batch_count];
  579 + //hcp_analysis_result result[hcp_batch_count];
  580 + vector< hcp_analysis_result> result(hcp_batch_count);
577 581 if (hcp_analysis_cf == SY_CONFIG_OPEN) {
578   - m_human_car_parsing.process(finish_hcp_img, hcp_batch_count, result);
  582 + m_human_car_parsing.process(vec_hcp_img.data(), hcp_batch_count, result.data());
579 583 }
580 584  
581   - human_fea_result result_f[hcp_batch_count];
  585 + //human_fea_result result_f[hcp_batch_count];
  586 + vector< human_fea_result> result_f(hcp_batch_count);
582 587 if (hcf_recg_cf == SY_CONFIG_OPEN) {
583   - m_human_fea.process(finish_hcp_img, hcp_batch_count, result_f);
  588 + m_human_fea.process(vec_hcp_img.data(), hcp_batch_count, result_f.data());
584 589 }
585 590 int resIndex = 0;
586 591  
... ... @@ -646,13 +651,17 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是
646 651 det_batch_size = vehicle_keys.size();
647 652 }
648 653  
649   - sy_img finish_vehicle_img[det_batch_size];
  654 + vector< sy_img> vec_vehicle_img;
650 655 vector<OBJ_KEY> det_vehicle_keys;
651 656 for (int j = 0; j < det_batch_size; j++)
652 657 {
653 658 OBJ_KEY cur_obj_key = vehicle_keys.front();
654 659 det_vehicle_keys.push_back(cur_obj_key);
655   - finish_vehicle_img[j].set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  660 +
  661 + sy_img finish_vehicle_img;
  662 + finish_vehicle_img.set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  663 + vec_vehicle_img.push_back(finish_vehicle_img);
  664 +
656 665 vehicle_keys.pop();
657 666 }
658 667  
... ... @@ -660,9 +669,9 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是
660 669 vehicle_plate_result *vp_result = new vehicle_plate_result[det_batch_size]{};
661 670 vr_result *vrresult = new vr_result[det_batch_size]{};
662 671 if (vehicle_analysis_cf == SY_CONFIG_OPEN) {
663   - m_vehicle_color.process(finish_vehicle_img, det_batch_size, vcresult);
664   - m_vehicle_plate.process(finish_vehicle_img, det_batch_size, vp_result);
665   - VehicleRecog_Process(finish_vehicle_img, det_batch_size, vrresult, det_vehicle_keys.data());
  672 + m_vehicle_color.process(vec_vehicle_img.data(), det_batch_size, vcresult);
  673 + m_vehicle_plate.process(vec_vehicle_img.data(), det_batch_size, vp_result);
  674 + VehicleRecog_Process(vec_vehicle_img.data(), det_batch_size, vrresult, det_vehicle_keys.data());
666 675 }
667 676  
668 677 int8 ** fea = nullptr;
... ... @@ -672,7 +681,7 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是
672 681 fea[ii] = new int8[FEATURESIZE]{};
673 682 }
674 683  
675   - m_vehicle_feature.process_vf(finish_vehicle_img, det_batch_size, fea);
  684 + m_vehicle_feature.process_vf(vec_vehicle_img.data(), det_batch_size, fea);
676 685 }
677 686  
678 687 int feaIndex = 0;
... ... @@ -797,7 +806,7 @@ void snapshot_helper::hp_analysis()
797 806  
798 807 int cur_batchsize = index == 0 ? per_batchsize : OBJ_BATCH_COUNT - per_batchsize;
799 808  
800   - sy_img batch_hp[cur_batchsize];
  809 + vector<sy_img> vec_hp_img;
801 810 for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT / OBJ_SCALE*/; i++)
802 811 {
803 812 OBJ_KEY cur_obj_key = count_person.front();
... ... @@ -820,19 +829,23 @@ void snapshot_helper::hp_analysis()
820 829 }
821 830 //printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~count_person = %d\n", count_person.size());
822 831 erase_obj_key.push_back(cur_obj_key);
823   - batch_hp[i].set_data(HP_WIDTH, HP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  832 +
  833 + sy_img hp_img;
  834 + hp_img.set_data(HP_WIDTH, HP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  835 + vec_hp_img.push_back(hp_img);
  836 +
824 837 ++obj_batch_count;
825 838 }
826 839  
827 840 //算法分析
828 841 if (hp_analysis_cf == SY_CONFIG_OPEN) {
829 842 result = new hp_analysis_res[obj_batch_count]{};
830   - m_human_parsing.process(batch_hp, obj_batch_count, result);
  843 + m_human_parsing.process(vec_hp_img.data(), obj_batch_count, result);
831 844 }
832 845  
833 846 if (hf_recg_cf == SY_CONFIG_OPEN) {
834 847 result_f = new human_fea_result[obj_batch_count]{};
835   - m_human_fea.process(batch_hp, obj_batch_count, result_f);
  848 + m_human_fea.process(vec_hp_img.data(), obj_batch_count, result_f);
836 849 }
837 850  
838 851 //删除已经进行保存和二次属性分析的目标
... ... @@ -906,7 +919,7 @@ void snapshot_helper::hcp_analysis()
906 919 human_fea_result * result_f = nullptr;
907 920  
908 921 int cur_batchsize = index == 0 ? per_batchsize : OBJ_BATCH_COUNT - per_batchsize;
909   - sy_img batch_hcp[cur_batchsize];
  922 + vector<sy_img> vec_hcp_img;
910 923 for (int i = 0; i < cur_batchsize; i++)
911 924 {
912 925 OBJ_KEY cur_obj_key = count_bike.front();
... ... @@ -930,18 +943,21 @@ void snapshot_helper::hcp_analysis()
930 943 }
931 944  
932 945 erase_obj_key.push_back(cur_obj_key);
933   - batch_hcp[i].set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  946 + sy_img hcp_img;
  947 + hcp_img.set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  948 + vec_hcp_img.push_back(hcp_img);
  949 +
934 950 ++obj_batch_count;
935 951 }
936 952 //printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~count_bike = %d\n", count_bike.size());
937 953 if (hcp_analysis_cf == SY_CONFIG_OPEN) {
938 954 result = new hcp_analysis_result[obj_batch_count]{};
939   - m_human_car_parsing.process(batch_hcp, obj_batch_count, result);
  955 + m_human_car_parsing.process(vec_hcp_img.data(), obj_batch_count, result);
940 956 }
941 957  
942 958 if (hcf_recg_cf == SY_CONFIG_OPEN) {
943 959 result_f = new human_fea_result[obj_batch_count]{};
944   - m_human_fea.process(batch_hcp, obj_batch_count, result_f);
  960 + m_human_fea.process(vec_hcp_img.data(), obj_batch_count, result_f);
945 961 }
946 962  
947 963 int resIndex = 0;
... ... @@ -1018,7 +1034,7 @@ bool snapshot_helper::vehicle_color_analysis()
1018 1034  
1019 1035 int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count;
1020 1036  
1021   - sy_img batch_vehicle[cur_batchsize];
  1037 + vector< sy_img> vec_vehicle_img;
1022 1038 for (int i = 0; i < /*OBJ_BATCH_COUNT_VEHICLE/ OBJ_SCALE*/cur_batchsize; i++)
1023 1039 {
1024 1040  
... ... @@ -1044,11 +1060,13 @@ bool snapshot_helper::vehicle_color_analysis()
1044 1060 return false;
1045 1061 }
1046 1062  
1047   - batch_vehicle[i].set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  1063 + sy_img batch_vehicle;
  1064 + batch_vehicle.set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  1065 + vec_vehicle_img.push_back(batch_vehicle);
1048 1066 }
1049 1067  
1050 1068 vc_result *vcresult = new vc_result[cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/]{};
1051   - m_vehicle_color.process(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vcresult);
  1069 + m_vehicle_color.process(vec_vehicle_img.data(), cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vcresult);
1052 1070  
1053 1071 for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++)
1054 1072 {
... ... @@ -1100,7 +1118,7 @@ bool snapshot_helper::vehicle_plate_dr_analysis()
1100 1118 int start_idx = cur_iter_count * index;
1101 1119 int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count;
1102 1120  
1103   - sy_img batch_vehicle[cur_batchsize];
  1121 + vector< sy_img> vec_vehicle_img;
1104 1122 for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++)
1105 1123 {
1106 1124 OBJ_KEY cur_obj_key = count_vehicle_v[i+ start_idx];
... ... @@ -1125,10 +1143,13 @@ bool snapshot_helper::vehicle_plate_dr_analysis()
1125 1143  
1126 1144 return false;
1127 1145 }
1128   - batch_vehicle[i].set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  1146 +
  1147 + sy_img batch_vehicle;
  1148 + batch_vehicle.set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  1149 + vec_vehicle_img.push_back(batch_vehicle);
1129 1150 }
1130 1151 vehicle_plate_result *vp_result = new vehicle_plate_result[cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/]{};
1131   - m_vehicle_plate.process(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vp_result);
  1152 + m_vehicle_plate.process(vec_vehicle_img.data(), cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vp_result);
1132 1153  
1133 1154 int resIndex = 0;
1134 1155 for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++)
... ... @@ -1141,7 +1162,7 @@ bool snapshot_helper::vehicle_plate_dr_analysis()
1141 1162 {
1142 1163 vehicle_result &curRes = vehicle_result_v[i + start_idx];
1143 1164  
1144   - memcpy(&curRes.vp_res, &vp_result[resIndex], sizeof(vehicle_plate_result));
  1165 + memcpy(&curRes.vp_res, &vp_result[resIndex], sizeof(vplate_result));
1145 1166 resIndex++;
1146 1167 }
1147 1168 }
... ... @@ -1337,7 +1358,7 @@ bool snapshot_helper::vehicle_recg_analysis()
1337 1358 {
1338 1359 int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count;
1339 1360  
1340   - sy_img batch_vehicle[cur_batchsize];
  1361 + vector<sy_img> vec_vehicle_img;
1341 1362 for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++)
1342 1363 {
1343 1364 OBJ_KEY cur_obj_key = count_vehicle_v[i];
... ... @@ -1361,7 +1382,10 @@ bool snapshot_helper::vehicle_recg_analysis()
1361 1382 erase_snapshotImage(cur_obj_key);
1362 1383 return false;
1363 1384 }
1364   - batch_vehicle[i].set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  1385 +
  1386 + sy_img batch_vehicle;
  1387 + batch_vehicle.set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
  1388 + vec_vehicle_img.push_back(batch_vehicle);
1365 1389 }
1366 1390  
1367 1391  
... ... @@ -1382,7 +1406,7 @@ bool snapshot_helper::vehicle_recg_analysis()
1382 1406 vhd_res[b].vpd_res = new vpd_info[OBJ_MAX_COUNT];
1383 1407 }
1384 1408  
1385   - m_vehicle_feature.process_vpd(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vhd_res);
  1409 + m_vehicle_feature.process_vpd(vec_vehicle_img.data(), cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vhd_res);
1386 1410  
1387 1411 for (int vc_idx = 0; vc_idx < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; vc_idx++)
1388 1412 {
... ... @@ -1544,7 +1568,7 @@ bool snapshot_helper::vehicle_recg_analysis()
1544 1568 memset(fea[i], 0, sizeof(int8) * FEATURESIZE);
1545 1569 }
1546 1570  
1547   - m_vehicle_feature.process_vf(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, fea);
  1571 + m_vehicle_feature.process_vf(vec_vehicle_img.data(), cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, fea);
1548 1572  
1549 1573 int resIndex = 0;
1550 1574  
... ... @@ -1803,7 +1827,6 @@ void snapshot_helper:: snapshot_imagewrite_thread_process()
1803 1827 std::this_thread::sleep_for(std::chrono::milliseconds(10));
1804 1828 }
1805 1829 }
1806   - return ;
1807 1830 }
1808 1831  
1809 1832 void snapshot_helper::snapshot_thread_process()
... ... @@ -2101,8 +2124,8 @@ CropInfo snapshot_helper::cacheSnapShotInfo(OBJ_KEY newObj, VPT_ObjInfo obj, sy_
2101 2124 //--------------------- 保存快照抠图 -----------------------------/
2102 2125 int vLeft = max(0, obj.left - boundary);
2103 2126 int vTop = max(0, obj.top - boundary);
2104   - int vRight = min({ frameWidth - 1, obj.right + boundary });
2105   - int vBottom = min({ frameHeight - 1, obj.bottom + boundary });
  2127 + int vRight = min(frameWidth - 1, obj.right + boundary );
  2128 + int vBottom = min(frameHeight - 1, obj.bottom + boundary);
2106 2129  
2107 2130 if (bCacheLittle) {
2108 2131 int cur_width = 0;
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h
1 1 #include <bitset>
2   -#include "../../FFNvDecoder/DxDecoderWrap.h"
3   -#include "common.h"
  2 +#include "../../SfxDecoder/DxDecoderWrap.h"
  3 +#include "../common.h"
4 4 #include <queue>
5 5 #include <string>
6 6 #include <set>
... ... @@ -9,7 +9,7 @@
9 9 #include <vector>
10 10 #include <thread>
11 11 #include <condition_variable>
12   -#include "ImageSaveCache.h"
  12 +#include "../ImageSaveCache.h"
13 13 #include "HumanCarParsing.h"
14 14 #include "HumanParsing.h"
15 15 #include "HumanFea.h"
... ...