I'd like to use NvPipe with the x264 FFMPEG backend to support visualization clients with pre-Kepler hardware. Unfortunately, NvPipe master fails to compile as soon as I enable USE_FFMPEG:
NvPipe/build-pristine$ cmake -DUSE_FFMPEG=ON -DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda/7.5 ..
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CUDA: /opt/cuda/7.5 (found version "7.5")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28")
-- Checking for module 'libavformat'
-- Found libavformat, version 57.56.101
-- Checking for module 'libavcodec'
-- Found libavcodec, version 57.64.101
-- Checking for module 'libavutil'
-- Found libavutil, version 55.34.101
-- Could NOT find EGL (missing: EGL_LIBRARY EGL_opengl_LIBRARY EGL_INCLUDE_DIR)
-- Found GLEW: /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: NvPipe/build-pristine
NvPipe/build-pristine$ make
[ 7%] Building NVCC (Device) object CMakeFiles/nvpipe.dir/convert.o
[ 15%] Building NVCC (Device) object CMakeFiles/nvpipe.dir/util/kernels.o
Scanning dependencies of target nvpipe
[ 23%] Building CXX object CMakeFiles/nvpipe.dir/ffmpeg.cxx.o
/home/r/build/nvpipe/NvPipe/ffmpeg.cxx: In function ‘nvp_impl_t* nvp_create_ffmpeg(bool, uint64_t)’:
/home/r/build/nvpipe/NvPipe/ffmpeg.cxx:135:21: error: invalid conversion from ‘nvp_err_t (*)(nvpipe*, const void*, size_t, void*, size_t*, size_t, size_t, nvp_fmt_t) {aka nvpipe_error_code (*)(void*, const void*, long unsigned int, void*, long unsigned int*, long unsigned int, long unsigned int, nvpipe_format)}’ to ‘nvp_err_t (*)(nvpipe*, const void*, size_t, void*, size_t*, uint32_t, uint32_t, nvp_fmt_t) {aka nvpipe_error_code (*)(void*, const void*, long unsigned int, void*, long unsigned int*, unsigned int, unsigned int, nvpipe_format)}’ [-fpermissive]
rv->impl.encode = nvp_ffmpeg_encode;
^
/home/r/build/nvpipe/NvPipe/ffmpeg.cxx:137:21: error: invalid conversion from ‘nvp_err_t (*)(nvpipe*, const void*, size_t, void*, size_t, size_t) {aka nvpipe_error_code (*)(void*, const void*, long unsigned int, void*, long unsigned int, long unsigned int)}’ to ‘nvp_err_t (*)(nvpipe*, const void*, size_t, void*, uint32_t, uint32_t, nvp_fmt_t) {aka nvpipe_error_code (*)(void*, const void*, long unsigned int, void*, unsigned int, unsigned int, nvpipe_format)}’ [-fpermissive]
rv->impl.decode = nvp_ffmpeg_decode;
^
CMakeFiles/nvpipe.dir/build.make:76: recipe for target 'CMakeFiles/nvpipe.dir/ffmpeg.cxx.o' failed
make[2]: *** [CMakeFiles/nvpipe.dir/ffmpeg.cxx.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/nvpipe.dir/all' failed
make[1]: *** [CMakeFiles/nvpipe.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
diff --git a/decode.c b/decode.c
index c5949fc..94f5133 100644
--- a/decode.c
+++ b/decode.c
@@ -351,7 +351,7 @@ nvp_cuvid_decode(nvpipe* const cdc,
const void* const __restrict ibuf,
const size_t ibuf_sz,
void* const __restrict obuf,
- const uint32_t width, const uint32_t height,
+ const size_t width, const size_t height,
nvp_fmt_t format) {
struct nvp_decoder* nvp = (struct nvp_decoder*)cdc;
if(nvp->impl.type != DECODER) {
@@ -485,7 +485,7 @@ nvp_cuvid_encode(nvpipe * const __restrict codec,
const size_t ibuf_sz,
void *const __restrict obuf,
size_t* const __restrict obuf_sz,
- const uint32_t width, const uint32_t height,
+ const size_t width, const size_t height,
nvp_fmt_t format) {
(void)codec; (void)ibuf; (void)ibuf_sz;
(void)obuf; (void)obuf_sz;
diff --git a/ffmpeg.cxx b/ffmpeg.cxx
index 8d40b17..dc38bca 100644
--- a/ffmpeg.cxx
+++ b/ffmpeg.cxx
@@ -94,7 +94,8 @@ nvp_ffmpeg_decode(nvpipe* const __restrict cdc,
const void* const __restrict input_buffer,
const size_t input_buffer_size,
void* const __restrict output_buffer,
- size_t width, size_t height) {
+ size_t width, size_t height,
+ const nvp_fmt_t format) {
assert(cdc);
/* input images must be a power of two */
if(((width | height) & 1) != 0) {
@@ -104,6 +105,12 @@ nvp_ffmpeg_decode(nvpipe* const __restrict cdc,
if(input_buffer_size == 0) {
return NVPIPE_EINVAL;
}
+
+ /* only RGB input is supported */
+ if(format != NVPIPE_RGB) {
+ return NVPIPE_EINVAL;
+ }
+
nvpipe_* codec = static_cast<nvpipe_*>(cdc);
NvPipeCodec *codec_ptr = static_cast<NvPipeCodec*>(codec->codec_ptr_);
diff --git a/internal-api.h b/internal-api.h
index d0af9df..00c6397 100644
--- a/internal-api.h
+++ b/internal-api.h
@@ -40,7 +40,7 @@ typedef nvp_err_t (fqn_encode)(
const size_t ibuf_sz,
void *const __restrict obuf,
size_t* const __restrict obuf_sz,
- const uint32_t width, const uint32_t height,
+ const size_t width, const size_t height,
nvp_fmt_t format
);
typedef nvp_err_t (fqn_bitrate)(nvpipe* codec, uint64_t);
@@ -48,8 +48,8 @@ typedef nvp_err_t (fqn_decode)(
nvpipe* const __restrict codec,
const void* const __restrict ibuf, const size_t ibuf_sz,
void* const __restrict obuf,
- const uint32_t width, const uint32_t height,
- nvp_fmt_t format
+ const size_t width, const size_t height,
+ const nvp_fmt_t format
);
typedef void (fqn_destroy)(nvpipe* const __restrict);
After the above changes NvPipe compiles but an NVPIPE_H264_FFMPEG decoder fails to decode frames encoded by NVPIPE_H264_NV. I believe that's a separate issue (which I'll submit shortly) but I'd still appreciate it if the compilation issue could be fixed properly in NvPipe upstream.