Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
13c98ad8
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
13c98ad8
编写于
10月 12, 2020
作者:
B
BohaoWu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adjust code for compilering nvdec-extractframe.
上级
730bdcd5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
67 addition
and
61 deletion
+67
-61
core/preprocess/nvdec-extractframe/CMakeLists.txt
core/preprocess/nvdec-extractframe/CMakeLists.txt
+50
-0
core/preprocess/nvdec-extractframe/include/ExtractFrameBGRARaw.h
...eprocess/nvdec-extractframe/include/ExtractFrameBGRARaw.h
+4
-15
core/preprocess/nvdec-extractframe/include/ExtractFrameBase.h
.../preprocess/nvdec-extractframe/include/ExtractFrameBase.h
+2
-13
core/preprocess/nvdec-extractframe/include/ExtractFrameJpeg.h
.../preprocess/nvdec-extractframe/include/ExtractFrameJpeg.h
+4
-15
core/preprocess/nvdec-extractframe/pybind/pybind_frame_extract.cpp
...rocess/nvdec-extractframe/pybind/pybind_frame_extract.cpp
+5
-0
core/preprocess/nvdec-extractframe/src/ExtractFrameBGRARaw.cpp
...preprocess/nvdec-extractframe/src/ExtractFrameBGRARaw.cpp
+1
-4
core/preprocess/nvdec-extractframe/src/ExtractFrameJpeg.cpp
core/preprocess/nvdec-extractframe/src/ExtractFrameJpeg.cpp
+1
-4
core/preprocess/nvdec-extractframe/src/main.cpp
core/preprocess/nvdec-extractframe/src/main.cpp
+0
-10
未找到文件。
core/preprocess/nvdec-extractframe/CMakeLists.txt
0 → 100644
浏览文件 @
13c98ad8
cmake_minimum_required
(
VERSION 3.2
)
project
(
hw-extract
)
include
(
cuda
)
include
(
configure
)
#execute_process(COMMAND wget https://paddle-serving.bj.bcebos.com/external_code/preprocesslib.zip)
#execute_process(COMMAND mv preprocesslib.zip ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/)
#execute_process(COMMAND unzip -oq ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/preprocesslib.zip -d ../core/preprocess/nvdec-extractframe/)
#execute_process(COMMAND rm -rf ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/__MACOSX)
#C flags
set
(
CMAKE_C_FLAGS
" -g -pipe -W -Wall -fPIC -Wmissing-field-initializers"
)
#C++ flags.
set
(
CMAKE_CXX_FLAGS
" -g -pipe -W -Wall -fPIC -std=c++11 -Wmissing-field-initializers"
)
add_subdirectory
(
cuda
)
set
(
CMAKE_CUDA_FLAGS
"-ccbin -Xcompiler -fPIC --std=c++11"
)
set
(
CUDA_NVCC_FLAGS
"-Xcompiler -fPIC --std=c++11"
)
set
(
EXTRA_LIBS
${
EXTRA_LIBS
}
hwgpu
)
set
(
CUDA_LIBRARIES
${
CUDA_TOOLKIT_ROOT_DIR
}
/lib64
)
#release headers
include_directories
(
*.h
)
include_directories
(
*.hpp
)
include_directories
(
include/*.h
)
include_directories
(
include/*.hpp
)
include_directories
(
.
)
include_directories
(
./include
)
include_directories
(
./codessdkinclude/include
)
include_directories
(
./ffmpeginclude/include
)
# include_directories(./pybind11/include)
include_directories
(
./pythoninclude/python2.7/
)
include_directories
(
./Utils
)
include_directories
(
${
CUDA_INCLUDE_DIRS
}
)
# Preprocessor libs.
file
(
GLOB LIB_FILES
${
CMAKE_SOURCE_DIR
}
/core/preprocess/nvdec-extractframe/lib/*.so
)
file
(
GLOB CUDA_LIB_FILES
${
CUDA_LIBRARIES
}
/*.so
)
file
(
GLOB NVJPEG_LIBS
${
CMAKE_SOURCE_DIR
}
/core/preprocess/nvdec-extractframe/lib/libnvjpeg.*
)
file
(
GLOB SOURCE_FILES src/*.cpp NvDecoder/*.cpp pybind/*.cpp
)
#.so
add_library
(
hwextract SHARED
${
SOURCE_FILES
}
)
target_link_libraries
(
hwextract
${
CMAKE_SOURCE_DIR
}
/core/preprocess/nvdec-extractframe/lib/libnvjpeg.so
)
target_link_libraries
(
hwextract
${
EXTRA_LIBS
}
)
target_link_libraries
(
hwextract
${
LIB_FILES
}
)
target_link_libraries
(
hwextract
${
CUDA_LIB_FILES
}
)
# execute_process(COMMAND rm ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/preprocesslib.zip)
core/preprocess/nvdec-extractframe/include/ExtractFrameBGRARaw.h
浏览文件 @
13c98ad8
...
@@ -12,21 +12,12 @@
...
@@ -12,21 +12,12 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
/*******************************************
*
* Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
*
******************************************/
/**
* @file ExtractFrameBGRARaw.h
* @author chengang06@baidu.com
* @date 2020-04-15
**/
#ifndef CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEBGRARAW_H_
#define CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEBGRARAW_H_
#include <string>
#include <string>
#include "ExtractFrameBase.h"
#include "ExtractFrameBase.h"
#ifndef CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEBGRARAW_H_
#define CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEBGRARAW_H_
namespace
baidu
{
namespace
baidu
{
namespace
xvision
{
namespace
xvision
{
class
ExtractFrameBGRARaw
:
public
ExtractFrameBase
{
class
ExtractFrameBGRARaw
:
public
ExtractFrameBase
{
...
@@ -54,9 +45,7 @@ class ExtractFrameBGRARaw : public ExtractFrameBase {
...
@@ -54,9 +45,7 @@ class ExtractFrameBGRARaw : public ExtractFrameBase {
* @returns
* @returns
* IMGDataList
* IMGDataList
**/
**/
IMGDataList
extract_frame
(
const
std
::
string
&
file_path
,
IMGDataList
extract_frame
(
const
std
::
string
&
file_path
,
int
n
=
1
);
int
n
=
1
,
int
count
=
200
);
};
};
}
// namespace xvision
}
// namespace xvision
}
// namespace baidu
}
// namespace baidu
...
...
core/preprocess/nvdec-extractframe/include/ExtractFrameBase.h
浏览文件 @
13c98ad8
...
@@ -12,16 +12,6 @@
...
@@ -12,16 +12,6 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
/*******************************************
*
* Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
*
******************************************/
/**
* @file ExtractFrameBase.h
* @author chengang06@baidu.com
* @date 2020-04-15
**/
#include <cuda.h>
#include <cuda.h>
#include <list>
#include <list>
...
@@ -29,8 +19,8 @@
...
@@ -29,8 +19,8 @@
#include <string>
#include <string>
#include "NvDecoder/NvDecoder.h"
#include "NvDecoder/NvDecoder.h"
#include "Utils/ColorSpace.h"
#include "Utils/FFmpegDemuxer.h"
#include "Utils/FFmpegDemuxer.h"
#include "cuda/ColorSpace.h"
#ifndef CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEBASE_H_
#ifndef CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEBASE_H_
#define CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEBASE_H_
#define CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEBASE_H_
namespace
baidu
{
namespace
baidu
{
...
@@ -140,8 +130,7 @@ class ExtractFrameBase {
...
@@ -140,8 +130,7 @@ class ExtractFrameBase {
}
}
virtual
int
init
();
virtual
int
init
();
virtual
IMGDataList
extract_frame
(
const
std
::
string
&
file_path
,
virtual
IMGDataList
extract_frame
(
const
std
::
string
&
file_path
,
int
n
=
1
,
int
n
=
1
)
=
0
;
int
count
=
200
)
=
0
;
virtual
~
ExtractFrameBase
()
{
virtual
~
ExtractFrameBase
()
{
if
(
p_cu_context
!=
nullptr
)
{
if
(
p_cu_context
!=
nullptr
)
{
cuCtxDestroy
(
p_cu_context
);
cuCtxDestroy
(
p_cu_context
);
...
...
core/preprocess/nvdec-extractframe/include/ExtractFrameJpeg.h
浏览文件 @
13c98ad8
...
@@ -12,23 +12,14 @@
...
@@ -12,23 +12,14 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
/*******************************************
*
* Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
*
******************************************/
/**
* @file ExtractFrameJpeg.h
* @author chengang06@baidu.com
* @date 2020-04-20
**/
#ifndef CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEJPEG_H_
#define CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEJPEG_H_
#include <nvjpeg.h>
#include <nvjpeg.h>
#include <string>
#include <string>
#include "ExtractFrameBase.h"
#include "ExtractFrameBase.h"
#ifndef CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEJPEG_H_
#define CORE_PREPROCESS_NVDEC_EXTRACTFRAME_INCLUDE_EXTRACTFRAMEJPEG_H_
namespace
baidu
{
namespace
baidu
{
namespace
xvision
{
namespace
xvision
{
class
ExtractFrameJpeg
:
public
ExtractFrameBase
{
class
ExtractFrameJpeg
:
public
ExtractFrameBase
{
...
@@ -57,9 +48,7 @@ class ExtractFrameJpeg : public ExtractFrameBase {
...
@@ -57,9 +48,7 @@ class ExtractFrameJpeg : public ExtractFrameBase {
* @returns
* @returns
* IMGDataList
* IMGDataList
**/
**/
IMGDataList
extract_frame
(
const
std
::
string
&
file_path
,
IMGDataList
extract_frame
(
const
std
::
string
&
file_path
,
int
n
=
1
);
int
n
=
1
,
int
count
=
200
);
int
init
();
int
init
();
virtual
~
ExtractFrameJpeg
()
{
virtual
~
ExtractFrameJpeg
()
{
...
...
core/preprocess/nvdec-extractframe/pybind/pybind_frame_extract.cpp
浏览文件 @
13c98ad8
...
@@ -28,6 +28,7 @@ PYBIND11_MODULE(hwextract, m) {
...
@@ -28,6 +28,7 @@ PYBIND11_MODULE(hwextract, m) {
pybind11
::
class_
<
baidu
::
xvision
::
ExtractFrameBGRARaw
>
(
m
,
pybind11
::
class_
<
baidu
::
xvision
::
ExtractFrameBGRARaw
>
(
m
,
"HwExtractFrameBGRARaw"
)
"HwExtractFrameBGRARaw"
)
.
def
(
pybind11
::
init
<
int
>
())
.
def
(
pybind11
::
init
<
int
>
())
.
def
(
"init_handler"
,
&
baidu
::
xvision
::
ExtractFrameBGRARaw
::
init
)
.
def
(
"init_handler"
,
&
baidu
::
xvision
::
ExtractFrameBGRARaw
::
init
)
.
def
(
"extract_frame"
,
.
def
(
"extract_frame"
,
&
baidu
::
xvision
::
ExtractFrameBGRARaw
::
extract_frame
);
&
baidu
::
xvision
::
ExtractFrameBGRARaw
::
extract_frame
);
...
@@ -41,6 +42,10 @@ PYBIND11_MODULE(hwextract, m) {
...
@@ -41,6 +42,10 @@ PYBIND11_MODULE(hwextract, m) {
&
baidu
::
xvision
::
FrameResult
::
free_memory
)
// for gcc 4.8.2 , this
&
baidu
::
xvision
::
FrameResult
::
free_memory
)
// for gcc 4.8.2 , this
// must be called ,both
// must be called ,both
// in cpp or python
// in cpp or python
// .def("__copy__", [](const baidu::xvision::FrameResult &self){return
// self.deepcopy();})
// .def("__deepcopy__", [](const baidu::xvision::FrameResult &self,
// pybind11::dict){return baidu::xvision::FrameResult(self);}, "memo"_a)
.
def_buffer
([](
baidu
::
xvision
::
FrameResult
&
m
)
->
pybind11
::
buffer_info
{
.
def_buffer
([](
baidu
::
xvision
::
FrameResult
&
m
)
->
pybind11
::
buffer_info
{
return
pybind11
::
buffer_info
(
return
pybind11
::
buffer_info
(
m
.
get_frame
(),
m
.
get_frame
(),
...
...
core/preprocess/nvdec-extractframe/src/ExtractFrameBGRARaw.cpp
浏览文件 @
13c98ad8
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#include <memory>
#include <memory>
#include <string>
#include <string>
baidu
::
xvision
::
IMGDataList
baidu
::
xvision
::
ExtractFrameBGRARaw
::
extract_frame
(
baidu
::
xvision
::
IMGDataList
baidu
::
xvision
::
ExtractFrameBGRARaw
::
extract_frame
(
const
std
::
string
&
file_path
,
int
n
,
int
count
)
{
const
std
::
string
&
file_path
,
int
n
)
{
FFmpegDemuxer
demuxer
(
file_path
.
c_str
());
FFmpegDemuxer
demuxer
(
file_path
.
c_str
());
NvDecoder
nvdec
(
NvDecoder
nvdec
(
p_cu_context
,
true
,
FFmpeg2NvCodecId
(
demuxer
.
GetVideoCodec
()));
p_cu_context
,
true
,
FFmpeg2NvCodecId
(
demuxer
.
GetVideoCodec
()));
...
@@ -111,9 +111,6 @@ baidu::xvision::IMGDataList baidu::xvision::ExtractFrameBGRARaw::extract_frame(
...
@@ -111,9 +111,6 @@ baidu::xvision::IMGDataList baidu::xvision::ExtractFrameBGRARaw::extract_frame(
nvdec.GetHeight() + (nvdec.GetChromaHeight() *
nvdec.GetHeight() + (nvdec.GetChromaHeight() *
nvdec.GetNumChromaPlanes()));*/
nvdec.GetNumChromaPlanes()));*/
}
}
if
(
result_list
.
size
()
>=
count
)
{
break
;
}
}
while
(
n_video_bytes
);
}
while
(
n_video_bytes
);
cuMemFree
(
p_tmp_image
);
cuMemFree
(
p_tmp_image
);
return
result_list
;
return
result_list
;
...
...
core/preprocess/nvdec-extractframe/src/ExtractFrameJpeg.cpp
浏览文件 @
13c98ad8
...
@@ -59,7 +59,7 @@ int baidu::xvision::ExtractFrameJpeg::init() {
...
@@ -59,7 +59,7 @@ int baidu::xvision::ExtractFrameJpeg::init() {
return
0
;
return
0
;
}
}
baidu
::
xvision
::
IMGDataList
baidu
::
xvision
::
ExtractFrameJpeg
::
extract_frame
(
baidu
::
xvision
::
IMGDataList
baidu
::
xvision
::
ExtractFrameJpeg
::
extract_frame
(
const
std
::
string
&
file_path
,
int
n
,
int
count
)
{
const
std
::
string
&
file_path
,
int
n
)
{
FFmpegDemuxer
demuxer
(
file_path
.
c_str
());
FFmpegDemuxer
demuxer
(
file_path
.
c_str
());
NvDecoder
nvdec
(
NvDecoder
nvdec
(
p_cu_context
,
true
,
FFmpeg2NvCodecId
(
demuxer
.
GetVideoCodec
()));
p_cu_context
,
true
,
FFmpeg2NvCodecId
(
demuxer
.
GetVideoCodec
()));
...
@@ -143,9 +143,6 @@ baidu::xvision::IMGDataList baidu::xvision::ExtractFrameJpeg::extract_frame(
...
@@ -143,9 +143,6 @@ baidu::xvision::IMGDataList baidu::xvision::ExtractFrameJpeg::extract_frame(
fm_tmp
);
fm_tmp
);
result_list
.
push_back
(
fm_tmp
);
result_list
.
push_back
(
fm_tmp
);
}
}
if
(
result_list
.
size
()
>=
count
)
{
break
;
}
}
while
(
n_video_bytes
);
}
while
(
n_video_bytes
);
cuMemFree
(
p_tmp_image
);
cuMemFree
(
p_tmp_image
);
return
result_list
;
return
result_list
;
...
...
core/preprocess/nvdec-extractframe/src/main.cpp
浏览文件 @
13c98ad8
...
@@ -12,16 +12,6 @@
...
@@ -12,16 +12,6 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
/*******************************************
*
* Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
*
******************************************/
/**
* @file ExtractFrameBGRARaw.h
* @author chengang06@baidu.com
* @date 2020-04-16
**/
#include <cstring>
#include <cstring>
#include <iomanip>
#include <iomanip>
#include <memory>
#include <memory>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录