Skip to content

Commit ad3049b

Browse files
NicolasHugscotts
andauthored
More renaming, align output structs with Python code (#469)
Co-authored-by: Scott Schneider <[email protected]>
1 parent b3dc451 commit ad3049b

File tree

8 files changed

+176
-169
lines changed

8 files changed

+176
-169
lines changed

src/torchcodec/decoders/_core/CPUOnlyDevice.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ namespace facebook::torchcodec {
1414
TORCH_CHECK(false, "Unsupported device: " + device.str());
1515
}
1616

17-
void convertAVFrameToDecodedOutputOnCuda(
17+
void convertAVFrameToFrameOutputOnCuda(
1818
const torch::Device& device,
1919
[[maybe_unused]] const VideoDecoder::VideoStreamOptions& videoStreamOptions,
20-
[[maybe_unused]] VideoDecoder::RawDecodedOutput& rawOutput,
21-
[[maybe_unused]] VideoDecoder::DecodedOutput& output,
20+
[[maybe_unused]] VideoDecoder::AVFrameStream& avFrameStream,
21+
[[maybe_unused]] VideoDecoder::FrameOutput& frameOutput,
2222
[[maybe_unused]] std::optional<torch::Tensor> preAllocatedOutputTensor) {
2323
throwUnsupportedDeviceError(device);
2424
}

src/torchcodec/decoders/_core/CudaDevice.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ void initializeContextOnCuda(
183183
return;
184184
}
185185

186-
void convertAVFrameToDecodedOutputOnCuda(
186+
void convertAVFrameToFrameOutputOnCuda(
187187
const torch::Device& device,
188188
const VideoDecoder::VideoStreamOptions& videoStreamOptions,
189-
VideoDecoder::RawDecodedOutput& rawOutput,
190-
VideoDecoder::DecodedOutput& output,
189+
VideoDecoder::AVFrameStream& avFrameStream,
190+
VideoDecoder::FrameOutput& frameOutput,
191191
std::optional<torch::Tensor> preAllocatedOutputTensor) {
192-
AVFrame* avFrame = rawOutput.avFrame.get();
192+
AVFrame* avFrame = avFrameStream.avFrame.get();
193193

194194
TORCH_CHECK(
195195
avFrame->format == AV_PIX_FMT_CUDA,
@@ -199,7 +199,7 @@ void convertAVFrameToDecodedOutputOnCuda(
199199
getHeightAndWidthFromOptionsOrAVFrame(videoStreamOptions, *avFrame);
200200
int height = frameDims.height;
201201
int width = frameDims.width;
202-
torch::Tensor& dst = output.frame;
202+
torch::Tensor& dst = frameOutput.data;
203203
if (preAllocatedOutputTensor.has_value()) {
204204
dst = preAllocatedOutputTensor.value();
205205
auto shape = dst.sizes();

src/torchcodec/decoders/_core/DeviceInterface.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ void initializeContextOnCuda(
2929
const torch::Device& device,
3030
AVCodecContext* codecContext);
3131

32-
void convertAVFrameToDecodedOutputOnCuda(
32+
void convertAVFrameToFrameOutputOnCuda(
3333
const torch::Device& device,
3434
const VideoDecoder::VideoStreamOptions& videoStreamOptions,
35-
VideoDecoder::RawDecodedOutput& rawOutput,
36-
VideoDecoder::DecodedOutput& output,
35+
VideoDecoder::AVFrameStream& avFrameStream,
36+
VideoDecoder::FrameOutput& frameOutput,
3737
std::optional<torch::Tensor> preAllocatedOutputTensor = std::nullopt);
3838

3939
void releaseContextOnCuda(

0 commit comments

Comments
 (0)