Unverified Commit 0b6ca28d authored by moto's avatar moto Committed by GitHub
Browse files

Do not compile CUDA helper for CPU build (#3657)

parent fa78fb64
...@@ -27,6 +27,7 @@ AVCodecContextPtr alloc_codec_context( ...@@ -27,6 +27,7 @@ AVCodecContextPtr alloc_codec_context(
return AVCodecContextPtr(codec_ctx); return AVCodecContextPtr(codec_ctx);
} }
#ifdef USE_CUDA
const AVCodecHWConfig* get_cuda_config(const AVCodec* codec) { const AVCodecHWConfig* get_cuda_config(const AVCodec* codec) {
for (int i = 0;; ++i) { for (int i = 0;; ++i) {
const AVCodecHWConfig* config = avcodec_get_hw_config(codec, i); const AVCodecHWConfig* config = avcodec_get_hw_config(codec, i);
...@@ -80,6 +81,7 @@ enum AVPixelFormat get_hw_format( ...@@ -80,6 +81,7 @@ enum AVPixelFormat get_hw_format(
TORCH_WARN("Failed to get HW surface format."); TORCH_WARN("Failed to get HW surface format.");
return AV_PIX_FMT_NONE; return AV_PIX_FMT_NONE;
} }
#endif // USE_CUDA
AVBufferRef* get_hw_frames_ctx(AVCodecContext* codec_ctx) { AVBufferRef* get_hw_frames_ctx(AVCodecContext* codec_ctx) {
AVBufferRef* p = av_hwframe_ctx_alloc(codec_ctx->hw_device_ctx); AVBufferRef* p = av_hwframe_ctx_alloc(codec_ctx->hw_device_ctx);
......
...@@ -527,6 +527,7 @@ void configure_video_codec_ctx( ...@@ -527,6 +527,7 @@ void configure_video_codec_ctx(
} }
} }
#ifdef USE_CUDA
void configure_hw_accel(AVCodecContext* ctx, const std::string& hw_accel) { void configure_hw_accel(AVCodecContext* ctx, const std::string& hw_accel) {
torch::Device device{hw_accel}; torch::Device device{hw_accel};
TORCH_CHECK( TORCH_CHECK(
...@@ -570,6 +571,7 @@ void configure_hw_accel(AVCodecContext* ctx, const std::string& hw_accel) { ...@@ -570,6 +571,7 @@ void configure_hw_accel(AVCodecContext* ctx, const std::string& hw_accel) {
"Failed to initialize CUDA frame context: ", "Failed to initialize CUDA frame context: ",
av_err2string(ret)); av_err2string(ret));
} }
#endif // USE_CUDA
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// AVStream // AVStream
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment