Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove getNextAVFrameNoDemux() #470

Merged
merged 68 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
16d698f
Start implementation of approximate mode
scotts Dec 16, 2024
9a5abce
Merge branch 'main' of github.com:pytorch/torchcodec into approx
scotts Dec 18, 2024
d95b128
Initial seek mode implementation in VideoDecoder.
scotts Dec 19, 2024
97ac764
Merge branch 'main' of github.com:pytorch/torchcodec into approx
scotts Dec 19, 2024
35f2e59
Added Python side support, extended tests.
scotts Dec 20, 2024
8c9aeac
Apply lints
scotts Dec 20, 2024
921b822
Default C++ tests to approximate mode
scotts Dec 20, 2024
b349282
Apply lints
scotts Dec 20, 2024
081a5bb
Updated metadata; all tests pass.
scotts Dec 20, 2024
802b881
Removed commened out code.
scotts Dec 20, 2024
911a3bc
Consolidated logic for timestamp batch. Big perf win.
scotts Dec 20, 2024
7267b5a
Consolidated logic for timestamp range.
scotts Dec 21, 2024
ae44f78
More mode consolidation.
scotts Dec 21, 2024
e4edaf4
Merge branch 'main' of github.com:pytorch/torchcodec into approx
scotts Jan 9, 2025
64ebefe
Merge branch 'main' into approx
NicolasHug Jan 10, 2025
f62af46
Provide constructor param names
scotts Jan 11, 2025
d15dfa0
getFramesSize -> getNumFrames
scotts Jan 11, 2025
8879c32
Use seek_mode to paramterize metadata tests
scotts Jan 11, 2025
8443de5
stream -> streamInfo
scotts Jan 11, 2025
446910d
Merge branch 'main' of github.com:pytorch/torchcodec into approx
scotts Jan 11, 2025
ebebb63
Merge branch 'approx' of github.com:scotts/torchcodec into approx
scotts Jan 11, 2025
e34ca31
seek -> seekMode
scotts Jan 11, 2025
67c1225
remove getFramePlayedAtTimestampNoDemuxInternal
scotts Jan 11, 2025
d13879d
Merge branch 'main' of github.com:pytorch/torchcodec into approx
scotts Jan 14, 2025
06bb2c3
Rationalize time based samplers and valid metadata
scotts Jan 14, 2025
8ed3c5e
Refactor setting and using scanned number of frames
scotts Jan 14, 2025
bc10db8
Tweak FrameInfo struct initialization
scotts Jan 14, 2025
a6a2b6a
Use validateFrameIndex in getFramesInIndices
scotts Jan 14, 2025
3cd6842
Update src/torchcodec/decoders/_video_decoder.py
scotts Jan 14, 2025
9a46404
Tweak VideoDecoder doc string
scotts Jan 14, 2025
f4c001b
Remove comment
scotts Jan 15, 2025
4574e95
Merge branch 'main' of github.com:pytorch/torchcodec into approx
scotts Jan 17, 2025
abad57b
FrameInfo struct initialization
scotts Jan 17, 2025
737e1b6
Remove explicit setting of seek_mode in unrelated tests
scotts Jan 21, 2025
99b0d4f
Merge branch 'main' of github.com:pytorch/torchcodec into approx
scotts Jan 21, 2025
32a0f8f
Handle stream names
NicolasHug Jan 22, 2025
64f4595
Handle frame names
NicolasHug Jan 22, 2025
c629073
Streams again
NicolasHug Jan 22, 2025
85569fb
metadata names
NicolasHug Jan 22, 2025
d914615
Handle options
NicolasHug Jan 22, 2025
621a64c
Frame again
NicolasHug Jan 22, 2025
f247884
Lint
NicolasHug Jan 22, 2025
55a5840
More videoStreamOptions
NicolasHug Jan 22, 2025
793c876
Merge branch 'main' of github.com:pytorch/torchcodec into renamingzzzz
NicolasHug Jan 22, 2025
79ea167
reduce diff
NicolasHug Jan 22, 2025
404b2e4
Fix C++ tests
NicolasHug Jan 22, 2025
941d6a3
Fix CUDA?
NicolasHug Jan 22, 2025
11779a7
Merge branch 'main' of github.com:pytorch/torchcodec into renamingzzzz
NicolasHug Jan 23, 2025
a7c5711
Use allStreamMetadata
NicolasHug Jan 23, 2025
16d5e52
Rename BatchDecodedOutput into FrameBatchOutput
NicolasHug Jan 23, 2025
78b095a
Rename RawDecodedOutput into AVFrameWithStreamIndex
NicolasHug Jan 23, 2025
e1e46ff
Rename DecodedOutput into FrameOutput
NicolasHug Jan 23, 2025
cd0a181
Rename .frames into .data
NicolasHug Jan 23, 2025
0111bfc
rename .frame to .data
NicolasHug Jan 23, 2025
42ea096
Use frameBatchOutput variable name
NicolasHug Jan 23, 2025
3a2ab2d
rename getFrameOutputWithFilter
NicolasHug Jan 23, 2025
05da318
Use frameOutput name
NicolasHug Jan 23, 2025
a6a47f1
lint
NicolasHug Jan 23, 2025
d1352fe
Merge branch 'main' of github.com:pytorch/torchcodec into framezzzzz
NicolasHug Jan 23, 2025
658b727
getNextAVFrameNoDemux
NicolasHug Jan 23, 2025
62818a7
more stuff
NicolasHug Jan 23, 2025
24d0035
use avFrameWithStreamIndex
NicolasHug Jan 23, 2025
a1805d1
Cpp tests
NicolasHug Jan 23, 2025
eb1773a
more
NicolasHug Jan 23, 2025
21b8ff2
Remove getNextAVFrameNoDemux
NicolasHug Jan 23, 2025
5571c67
Merge branch 'main' of github.com:pytorch/torchcodec into remove_getN…
NicolasHug Jan 23, 2025
4e48d5b
alefnaljefnlajenf
NicolasHug Jan 23, 2025
bc21895
Merge branch 'main' into remove_getNextAVFrameNoDemux
NicolasHug Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/torchcodec/decoders/_core/VideoDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1472,15 +1472,6 @@ VideoDecoder::FrameBatchOutput VideoDecoder::getFramesPlayedInRange(
return frameBatchOutput;
}

VideoDecoder::AVFrameStream VideoDecoder::getNextAVFrameNoDemux() {
auto avFrameStream = getAVFrameUsingFilterFunction(
[this](int frameStreamIndex, AVFrame* avFrame) {
StreamInfo& activeStreamInfo = streamInfos_[frameStreamIndex];
return avFrame->pts >= activeStreamInfo.discardFramesBeforePts;
});
return avFrameStream;
}

VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemux() {
auto output = getNextFrameNoDemuxInternal();
output.data = maybePermuteHWC2CHW(output.streamIndex, output.data);
Expand All @@ -1489,7 +1480,11 @@ VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemux() {

VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemuxInternal(
std::optional<torch::Tensor> preAllocatedOutputTensor) {
auto avFrameStream = getNextAVFrameNoDemux();
AVFrameStream avFrameStream = getAVFrameUsingFilterFunction(
[this](int frameStreamIndex, AVFrame* avFrame) {
StreamInfo& activeStreamInfo = streamInfos_[frameStreamIndex];
return avFrame->pts >= activeStreamInfo.discardFramesBeforePts;
});
return convertAVFrameToFrameOutput(avFrameStream, preAllocatedOutputTensor);
}

Expand Down
1 change: 0 additions & 1 deletion src/torchcodec/decoders/_core/VideoDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ class VideoDecoder {
void maybeSeekToBeforeDesiredPts();
AVFrameStream getAVFrameUsingFilterFunction(
std::function<bool(int, AVFrame*)>);
AVFrameStream getNextAVFrameNoDemux();
// Once we create a decoder can update the metadata with the codec context.
// For example, for video streams, we can add the height and width of the
// decoded stream.
Expand Down
Loading