Skip to content

Commit 5113b9c

Browse files
committed
Avoid temporary variable
1 parent c8f2e79 commit 5113b9c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,9 +1073,8 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesInRange(
10731073
BatchDecodedOutput output(numOutputFrames, options, streamMetadata);
10741074

10751075
for (int64_t i = start, f = 0; i < stop; i += step, ++f) {
1076-
auto preAllocatedOutputTensor = output.frames[f];
10771076
DecodedOutput singleOut =
1078-
getFrameAtIndex(streamIndex, i, preAllocatedOutputTensor);
1077+
getFrameAtIndex(streamIndex, i, output.frames[f]);
10791078
output.ptsSeconds[f] = singleOut.ptsSeconds;
10801079
output.durationSeconds[f] = singleOut.durationSeconds;
10811080
}
@@ -1167,9 +1166,8 @@ VideoDecoder::getFramesDisplayedByTimestampInRange(
11671166
int64_t numFrames = stopFrameIndex - startFrameIndex;
11681167
BatchDecodedOutput output(numFrames, options, streamMetadata);
11691168
for (int64_t i = startFrameIndex, f = 0; i < stopFrameIndex; ++i, ++f) {
1170-
auto preAllocatedOutputTensor = output.frames[f];
11711169
DecodedOutput singleOut =
1172-
getFrameAtIndex(streamIndex, i, preAllocatedOutputTensor);
1170+
getFrameAtIndex(streamIndex, i, output.frames[f]);
11731171
output.ptsSeconds[f] = singleOut.ptsSeconds;
11741172
output.durationSeconds[f] = singleOut.durationSeconds;
11751173
}

0 commit comments

Comments
 (0)