Skip to content

Commit 88e1299

Browse files
committed
remove cuda header from Encoder.cpp
1 parent 54d1a1f commit 88e1299

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/torchcodec/_core/Encoder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
extern "C" {
88
#include <libavutil/hwcontext.h>
9-
#include <libavutil/hwcontext_cuda.h>
109
#include <libavutil/opt.h>
1110
#include <libavutil/pixdesc.h>
1211
}

src/torchcodec/_core/custom_ops.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ void _add_video_stream(
415415
}
416416

417417
validateDeviceInterface(std::string(device), std::string(device_variant));
418-
419418
videoStreamOptions.device = torch::Device(std::string(device));
420419
videoStreamOptions.deviceVariant = device_variant;
421420

@@ -648,11 +647,10 @@ void encode_video_to_file(
648647
std::optional<std::string_view> preset = std::nullopt,
649648
std::optional<std::vector<std::string>> extra_options = std::nullopt) {
650649
VideoStreamOptions videoStreamOptions;
650+
videoStreamOptions.device = torch::Device(std::string(device));
651651
videoStreamOptions.codec = std::move(codec);
652652
videoStreamOptions.pixelFormat = std::move(pixel_format);
653653
videoStreamOptions.crf = crf;
654-
655-
videoStreamOptions.device = torch::Device(std::string(device));
656654
videoStreamOptions.preset = preset;
657655

658656
if (extra_options.has_value()) {
@@ -680,11 +678,10 @@ at::Tensor encode_video_to_tensor(
680678
std::optional<std::vector<std::string>> extra_options = std::nullopt) {
681679
auto avioContextHolder = std::make_unique<AVIOToTensorContext>();
682680
VideoStreamOptions videoStreamOptions;
681+
videoStreamOptions.device = torch::Device(std::string(device));
683682
videoStreamOptions.codec = std::move(codec);
684683
videoStreamOptions.pixelFormat = std::move(pixel_format);
685684
videoStreamOptions.crf = crf;
686-
687-
videoStreamOptions.device = torch::Device(std::string(device));
688685
videoStreamOptions.preset = preset;
689686

690687
if (extra_options.has_value()) {
@@ -719,10 +716,10 @@ void _encode_video_to_file_like(
719716
std::unique_ptr<AVIOFileLikeContext> avioContextHolder(fileLikeContext);
720717

721718
VideoStreamOptions videoStreamOptions;
719+
videoStreamOptions.device = torch::Device(std::string(device));
722720
videoStreamOptions.codec = std::move(codec);
723721
videoStreamOptions.pixelFormat = std::move(pixel_format);
724722
videoStreamOptions.crf = crf;
725-
videoStreamOptions.device = torch::Device(std::string(device));
726723
videoStreamOptions.preset = preset;
727724

728725
if (extra_options.has_value()) {

0 commit comments

Comments
 (0)