Skip to content

Remove unused fields from RawDecodedOutput struct #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading