Skip to content

Commit

Permalink
Rename prevFrame into prevFrameContext (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug authored Jan 9, 2025
1 parent f02bd4f commit cd7cef6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/torchcodec/decoders/_core/VideoDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,10 @@ void VideoDecoder::convertAVFrameToDecodedOutputOnCPU(
outputTensor = preAllocatedOutputTensor.value_or(allocateEmptyHWCTensor(
expectedOutputHeight, expectedOutputWidth, torch::kCPU));

if (!streamInfo.swsContext || streamInfo.prevFrame != frameContext) {
if (!streamInfo.swsContext ||
streamInfo.prevFrameContext != frameContext) {
createSwsContext(streamInfo, frameContext, frame->colorspace);
streamInfo.prevFrame = frameContext;
streamInfo.prevFrameContext = frameContext;
}
int resultHeight =
convertFrameToTensorUsingSwsScale(streamIndex, frame, outputTensor);
Expand All @@ -960,10 +961,10 @@ void VideoDecoder::convertAVFrameToDecodedOutputOnCPU(
streamInfo.colorConversionLibrary ==
ColorConversionLibrary::FILTERGRAPH) {
if (!streamInfo.filterState.filterGraph ||
streamInfo.prevFrame != frameContext) {
streamInfo.prevFrameContext != frameContext) {
createFilterGraph(
streamInfo, expectedOutputHeight, expectedOutputWidth);
streamInfo.prevFrame = frameContext;
streamInfo.prevFrameContext = frameContext;
}
outputTensor = convertFrameToTensorUsingFilterGraph(streamIndex, frame);

Expand Down
2 changes: 1 addition & 1 deletion src/torchcodec/decoders/_core/VideoDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class VideoDecoder {
ColorConversionLibrary colorConversionLibrary = FILTERGRAPH;
std::vector<FrameInfo> keyFrames;
std::vector<FrameInfo> allFrames;
DecodedFrameContext prevFrame;
DecodedFrameContext prevFrameContext;
UniqueSwsContext swsContext;
};
// Returns the key frame index of the presentation timestamp using FFMPEG's
Expand Down

0 comments on commit cd7cef6

Please sign in to comment.