Skip to content

Commit 2580948

Browse files
author
Daniel Flores
committed
additional nits
1 parent 3165ba3 commit 2580948

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/torchcodec/_core/Encoder.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ TensorFormat analyzeTensorFormat(const torch::Tensor& frames) {
537537
sizes.size() == 4, "Expected 4D tensor (N, C, H, W) or (N, H, W, C)");
538538

539539
bool isNCHW = sizes[1] == 3 || sizes[1] == 4;
540-
541540
int numChannels = isNCHW ? sizes[1] : sizes[3];
542541
int height = isNCHW ? sizes[2] : sizes[1];
543542
int width = isNCHW ? sizes[3] : sizes[2];
@@ -767,8 +766,8 @@ void VideoEncoder::encode() {
767766
AutoAVPacket autoAVPacket;
768767
int numFrames = frames_.sizes()[0];
769768
for (int i = 0; i < numFrames; ++i) {
770-
torch::Tensor singleFrame = frames_.select(0, i);
771-
UniqueAVFrame avFrame = convertTensorToAVFrame(singleFrame, i);
769+
torch::Tensor currFrame = frames_[i];
770+
UniqueAVFrame avFrame = convertTensorToAVFrame(currFrame, i);
772771
encodeFrame(autoAVPacket, avFrame);
773772
}
774773

@@ -827,7 +826,7 @@ void VideoEncoder::encodeFrame(
827826

828827
void VideoEncoder::flushBuffers() {
829828
AutoAVPacket autoAVPacket;
830-
// Send NULL frame to signal end of input
829+
// Send null frame to signal end of input
831830
encodeFrame(autoAVPacket, UniqueAVFrame(nullptr));
832831
}
833832

0 commit comments

Comments
 (0)