From bda5c88cbc812138e580f8ae06cde0bfb20b4794 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Tue, 21 Jan 2025 17:00:42 +0000 Subject: [PATCH] Remove unused fields from `RawDecodedOutput` struct (#456) --- src/torchcodec/decoders/_core/VideoDecoder.h | 24 ++------------------ 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/torchcodec/decoders/_core/VideoDecoder.h b/src/torchcodec/decoders/_core/VideoDecoder.h index 7d828bf2..c6083a2f 100644 --- a/src/torchcodec/decoders/_core/VideoDecoder.h +++ b/src/torchcodec/decoders/_core/VideoDecoder.h @@ -160,33 +160,13 @@ class VideoDecoder { // Calling getNextFrameOutputNoDemuxInternal() will return the first frame at // or after this position. void setCursorPtsInSeconds(double seconds); - // This is an internal structure that is used to store the decoded output - // from decoding a frame through color conversion. Example usage is: - // - // RawDecodedOutput rawOutput = getDecodedOutputWithFilter(); - // // Now allocate a single tensor or a batch tensor. - // torch::Tensor userOutput = torch::empty(...); - // // Now fill in `data` and `size`. - // rawOutput.data = userOutput.data_ptr(); - // // Now run the color conversion. - // convertFrameToBufferUsingSwsScale(rawOutput); - // - // This structure ensures we always keep the streamIndex and frame together - // with the data output. Note that AVFrame itself doesn't retain the - // streamIndex. + // This structure ensures we always keep the streamIndex and AVFrame together + // Note that AVFrame itself doesn't retain the streamIndex. struct RawDecodedOutput { // The actual decoded output as a unique pointer to an AVFrame. UniqueAVFrame frame; // The stream index of the decoded frame. int streamIndex; - // This is an unowned pointer that we copy the frame data to after color - // conversion. - // For a single tensor this points to the start of data_ptr. For a batch - // tensor it may point to the middle of the allocated batch tensor. - void* data = nullptr; - // We carry around the size to ensure we don't stomp on memory while doing - // color conversion. - size_t size = 0; }; struct DecodedOutput { // The actual decoded output as a Tensor.