@@ -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) {
@@ -1069,7 +1069,7 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesAtIndices(
10691069 }
10701070 i++;
10711071 }
1072- output.frames = MaybeHWC2CHW (options, output.frames );
1072+ output.frames = MaybePermuteHWC2CHW (options, output.frames );
10731073 return output;
10741074}
10751075
@@ -1105,7 +1105,7 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesInRange(
11051105 output.ptsSeconds [f] = singleOut.ptsSeconds ;
11061106 output.durationSeconds [f] = singleOut.durationSeconds ;
11071107 }
1108- output.frames = MaybeHWC2CHW (options, output.frames );
1108+ output.frames = MaybePermuteHWC2CHW (options, output.frames );
11091109 return output;
11101110}
11111111
@@ -1158,7 +1158,7 @@ VideoDecoder::getFramesDisplayedByTimestampInRange(
11581158 // need this special case below.
11591159 if (startSeconds == stopSeconds) {
11601160 BatchDecodedOutput output (0 , options, streamMetadata);
1161- output.frames = MaybeHWC2CHW (options, output.frames );
1161+ output.frames = MaybePermuteHWC2CHW (options, output.frames );
11621162 return output;
11631163 }
11641164
@@ -1201,7 +1201,7 @@ VideoDecoder::getFramesDisplayedByTimestampInRange(
12011201 output.ptsSeconds [f] = singleOut.ptsSeconds ;
12021202 output.durationSeconds [f] = singleOut.durationSeconds ;
12031203 }
1204- output.frames = MaybeHWC2CHW (options, output.frames );
1204+ output.frames = MaybePermuteHWC2CHW (options, output.frames );
12051205
12061206 return output;
12071207}
0 commit comments