Skip to content

Commit 55a5840

Browse files
committed
More videoStreamOptions
1 parent f247884 commit 55a5840

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/torchcodec/decoders/_core/CPUOnlyDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace facebook::torchcodec {
1616

1717
void convertAVFrameToDecodedOutputOnCuda(
1818
const torch::Device& device,
19-
[[maybe_unused]] const VideoDecoder::VideoStreamOptions& options,
19+
[[maybe_unused]] const VideoDecoder::VideoStreamOptions& videoStreamOptions,
2020
[[maybe_unused]] VideoDecoder::RawDecodedOutput& rawOutput,
2121
[[maybe_unused]] VideoDecoder::DecodedOutput& output,
2222
[[maybe_unused]] std::optional<torch::Tensor> preAllocatedOutputTensor) {

src/torchcodec/decoders/_core/CudaDevice.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void initializeContextOnCuda(
185185

186186
void convertAVFrameToDecodedOutputOnCuda(
187187
const torch::Device& device,
188-
const VideoDecoder::VideoStreamOptions& options,
188+
const VideoDecoder::VideoStreamOptions& videoStreamOptions,
189189
VideoDecoder::RawDecodedOutput& rawOutput,
190190
VideoDecoder::DecodedOutput& output,
191191
std::optional<torch::Tensor> preAllocatedOutputTensor) {
@@ -195,7 +195,8 @@ void convertAVFrameToDecodedOutputOnCuda(
195195
src->format == AV_PIX_FMT_CUDA,
196196
"Expected format to be AV_PIX_FMT_CUDA, got " +
197197
std::string(av_get_pix_fmt_name((AVPixelFormat)src->format)));
198-
auto frameDims = getHeightAndWidthFromOptionsOrAVFrame(options, *src);
198+
auto frameDims =
199+
getHeightAndWidthFromOptionsOrAVFrame(videoStreamOptions, *src);
199200
int height = frameDims.height;
200201
int width = frameDims.width;
201202
torch::Tensor& dst = output.frame;
@@ -212,7 +213,7 @@ void convertAVFrameToDecodedOutputOnCuda(
212213
"x3, got ",
213214
shape);
214215
} else {
215-
dst = allocateEmptyHWCTensor(height, width, options.device);
216+
dst = allocateEmptyHWCTensor(height, width, videoStreamOptions.device);
216217
}
217218

218219
// Use the user-requested GPU for running the NPP kernel.

src/torchcodec/decoders/_core/DeviceInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void initializeContextOnCuda(
3131

3232
void convertAVFrameToDecodedOutputOnCuda(
3333
const torch::Device& device,
34-
const VideoDecoder::VideoStreamOptions& options,
34+
const VideoDecoder::VideoStreamOptions& videoStreamOptions,
3535
VideoDecoder::RawDecodedOutput& rawOutput,
3636
VideoDecoder::DecodedOutput& output,
3737
std::optional<torch::Tensor> preAllocatedOutputTensor = std::nullopt);

0 commit comments

Comments
 (0)