Skip to content

Commit d668a4d

Browse files
committed
Merge branch 'main' of github.com:pytorch/torchcodec into getFramesAtIndices_cleanup
2 parents 578094e + b82ea81 commit d668a4d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ double ptsToSeconds(int64_t pts, const AVRational& timeBase) {
3939
// or 4D.
4040
// Calling permute() is guaranteed to return a view as per the docs:
4141
// https://pytorch.org/docs/stable/generated/torch.permute.html
42-
torch::Tensor MaybeHWC2CHW(
42+
torch::Tensor MaybePermuteHWC2CHW(
4343
const VideoDecoder::VideoStreamDecoderOptions& options,
4444
torch::Tensor& hwcTensor) {
4545
if (options.dimensionOrder == "NHWC") {
@@ -937,7 +937,7 @@ void VideoDecoder::convertAVFrameToDecodedOutputOnCPU(
937937
// batch API) to do the conversion. This is more efficient as it allows
938938
// batch NHWC tensors to be permuted only once, instead of permuting HWC
939939
// tensors N times.
940-
output.frame = MaybeHWC2CHW(streamInfo.options, output.frame);
940+
output.frame = MaybePermuteHWC2CHW(streamInfo.options, output.frame);
941941
}
942942

943943
} else if (output.streamType == AVMEDIA_TYPE_AUDIO) {
@@ -1053,7 +1053,7 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesAtIndices(
10531053
// Note that for now we ignore the pts and duration parts of the output,
10541054
// because they're never used in any caller.
10551055
}
1056-
output.frames = MaybeHWC2CHW(options, output.frames);
1056+
output.frames = MaybePermuteHWC2CHW(options, output.frames);
10571057
return output;
10581058
}
10591059

@@ -1089,7 +1089,7 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesInRange(
10891089
output.ptsSeconds[f] = singleOut.ptsSeconds;
10901090
output.durationSeconds[f] = singleOut.durationSeconds;
10911091
}
1092-
output.frames = MaybeHWC2CHW(options, output.frames);
1092+
output.frames = MaybePermuteHWC2CHW(options, output.frames);
10931093
return output;
10941094
}
10951095

@@ -1142,7 +1142,7 @@ VideoDecoder::getFramesDisplayedByTimestampInRange(
11421142
// need this special case below.
11431143
if (startSeconds == stopSeconds) {
11441144
BatchDecodedOutput output(0, options, streamMetadata);
1145-
output.frames = MaybeHWC2CHW(options, output.frames);
1145+
output.frames = MaybePermuteHWC2CHW(options, output.frames);
11461146
return output;
11471147
}
11481148

@@ -1185,7 +1185,7 @@ VideoDecoder::getFramesDisplayedByTimestampInRange(
11851185
output.ptsSeconds[f] = singleOut.ptsSeconds;
11861186
output.durationSeconds[f] = singleOut.durationSeconds;
11871187
}
1188-
output.frames = MaybeHWC2CHW(options, output.frames);
1188+
output.frames = MaybePermuteHWC2CHW(options, output.frames);
11891189

11901190
return output;
11911191
}

0 commit comments

Comments
 (0)