You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// CodecContext is available early when a stream is added. This is why we use
// the CodecContext for pre-allocating batched output tensors (we could
// pre-allocate those only once we decode the first frame to get the info frame
// the AVFrame, but that's a more complex logic).
//
// Because the sources for height and width may disagree, we may end up with
// conflicts: e.g. if we pre-allocate a batch output tensor based on the
// metadata info, but the decoded AVFrame has a different height and width.
// it is very important to check the height and width assumptions where the
// tensors memory is used/filled in order to avoid segfaults.
Basically, the idea is that instead of allocating batch output tensors based on H and W from the metadata, we could allocate them only after we have decoded the first frame, and rely on the H and W from that decoded frame, which is the source of truth for dimensions.
The text was updated successfully, but these errors were encountered:
Pre-read: the current state of output tensor allocation as described in the comment below:
torchcodec/src/torchcodec/decoders/_core/VideoDecoder.h
Lines 430 to 473 in 84cef50
This issue is about addressing that specific part of the comment:
torchcodec/src/torchcodec/decoders/_core/VideoDecoder.h
Lines 464 to 474 in 84cef50
Basically, the idea is that instead of allocating batch output tensors based on H and W from the metadata, we could allocate them only after we have decoded the first frame, and rely on the H and W from that decoded frame, which is the source of truth for dimensions.
The text was updated successfully, but these errors were encountered: