Skip to content

Commit

Permalink
Remove unused fields from RawDecodedOutput struct (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug authored Jan 21, 2025
1 parent 261b9b2 commit bda5c88
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/torchcodec/decoders/_core/VideoDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit bda5c88

Please sign in to comment.