Skip to content

Commit 3b1d100

Browse files
committed
clean up old function
1 parent e145b47 commit 3b1d100

File tree

4 files changed

+4
-24
lines changed

4 files changed

+4
-24
lines changed

src/torchcodec/_core/CudaDeviceInterface.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,6 @@ std::string CudaDeviceInterface::getDetails() {
379379
(usingCPUFallback_ ? "CPU fallback." : "NVDEC.");
380380
}
381381

382-
UniqueAVFrame CudaDeviceInterface::convertTensorToAVFrameForEncoding(
383-
const torch::Tensor& tensor,
384-
int frameIndex,
385-
AVCodecContext* codecContext) {
386-
return convertCUDATensorToAVFrameForEncoding(
387-
tensor, frameIndex, codecContext);
388-
}
389-
390382
// --------------------------------------------------------------------------
391383
// Below are methods exclusive to video encoding:
392384
// --------------------------------------------------------------------------
@@ -507,7 +499,7 @@ const Npp32f (*getConversionMatrix(AVCodecContext* codecContext))[4] {
507499
}
508500
} // namespace
509501

510-
UniqueAVFrame CudaDeviceInterface::convertCUDATensorToAVFrameForEncoding(
502+
UniqueAVFrame CudaDeviceInterface::convertTensorToAVFrameForEncoding(
511503
const torch::Tensor& tensor,
512504
int frameIndex,
513505
AVCodecContext* codecContext) {

src/torchcodec/_core/CudaDeviceInterface.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ class CudaDeviceInterface : public DeviceInterface {
4848
int frameIndex,
4949
AVCodecContext* codecContext) override;
5050

51-
UniqueAVFrame convertCUDATensorToAVFrameForEncoding(
52-
const torch::Tensor& tensor,
53-
int frameIndex,
54-
AVCodecContext* codecContext) override;
55-
5651
void setupHardwareFrameContextForEncoding(
5752
AVCodecContext* codecContext) override;
5853

src/torchcodec/_core/DeviceInterface.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,11 @@ class DeviceInterface {
142142
// Pixel format used for encoding on CUDA devices
143143
static constexpr AVPixelFormat CUDA_ENCODING_PIXEL_FORMAT = AV_PIX_FMT_NV12;
144144

145-
virtual UniqueAVFrame convertTensorToAVFrameForEncoding(
146-
[[maybe_unused]] const torch::Tensor& tensor,
147-
[[maybe_unused]] int frameIndex,
148-
[[maybe_unused]] AVCodecContext* codecContext) {
149-
TORCH_CHECK(false);
150-
}
151-
152145
// Function used for video encoding, only implemented in CudaDeviceInterface.
153146
// It is here to isolate CUDA dependencies from CPU builds
154147
// TODO Video-Encoder: Reconsider using video encoding functions in device
155148
// interface
156-
virtual UniqueAVFrame convertCUDATensorToAVFrameForEncoding(
149+
virtual UniqueAVFrame convertTensorToAVFrameForEncoding(
157150
[[maybe_unused]] const torch::Tensor& tensor,
158151
[[maybe_unused]] int frameIndex,
159152
[[maybe_unused]] AVCodecContext* codecContext) {

src/torchcodec/_core/Encoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ void VideoEncoder::initializeEncoder(
743743
TORCH_CHECK(
744744
avFormatContext_->oformat != nullptr,
745745
"Output format is null, unable to find default codec.");
746-
// Try to find hardware codec. This will return std::nullopt when device is
747-
// CPU.
746+
// Try to substitute the default codec with its hardware equivalent
747+
// This will return std::nullopt when device is CPU.
748748
auto hwCodec = deviceInterface_->findCodec(
749749
avFormatContext_->oformat->video_codec, /*isDecoder=*/false);
750750
if (hwCodec.has_value()) {

0 commit comments

Comments
 (0)