Skip to content

Commit cdba205

Browse files
author
pytorchbot
committed
2025-01-24 nightly release (288bb83)
1 parent 654a4dc commit cdba205

File tree

11 files changed

+218
-381
lines changed

11 files changed

+218
-381
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ PenaltyExcessCharacter: 1000000
8383
PenaltyReturnTypeOnItsOwnLine: 200
8484
PointerAlignment: Left
8585
ReflowComments: true
86+
SeparateDefinitionBlocks: Always
8687
SortIncludes: true
8788
SortUsingDeclarations: true
8889
SpaceAfterCStyleCast: false

benchmarks/decoders/BenchmarkDecodersMain.cpp

Lines changed: 0 additions & 189 deletions
This file was deleted.

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(

src/torchcodec/decoders/_core/FFMPEGCommon.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@ namespace facebook::torchcodec {
1313
AutoAVPacket::AutoAVPacket() : avPacket_(av_packet_alloc()) {
1414
TORCH_CHECK(avPacket_ != nullptr, "Couldn't allocate avPacket.");
1515
}
16+
1617
AutoAVPacket::~AutoAVPacket() {
1718
av_packet_free(&avPacket_);
1819
}
1920

2021
ReferenceAVPacket::ReferenceAVPacket(AutoAVPacket& shared)
2122
: avPacket_(shared.avPacket_) {}
23+
2224
ReferenceAVPacket::~ReferenceAVPacket() {
2325
av_packet_unref(avPacket_);
2426
}
27+
2528
AVPacket* ReferenceAVPacket::get() {
2629
return avPacket_;
2730
}
31+
2832
AVPacket* ReferenceAVPacket::operator->() {
2933
return avPacket_;
3034
}

0 commit comments

Comments
 (0)