Skip to content

Commit f391582

Browse files
committed
Comments
1 parent 133c213 commit f391582

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,11 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesAtIndices(
10401040
const auto& options = stream.options;
10411041
BatchDecodedOutput output(frameIndices.size(), options, streamMetadata);
10421042

1043+
// if frameIndices is [13, 10, 12, 11]
1044+
// when sorted, it's [10, 11, 12, 13] <-- this is the sorted order we want
1045+
// to use to decode the frames
1046+
// and argsort is [ 1, 3, 2, 0]
10431047
std::vector<size_t> argsort;
1044-
10451048
if (sortIndices) {
10461049
argsort.resize(frameIndices.size());
10471050
for (size_t i = 0; i < argsort.size(); ++i) {

0 commit comments

Comments
 (0)