-
Notifications
You must be signed in to change notification settings - Fork 615
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
Add support for decoding multiple resolution videos in the same pipeline. #1144
Add support for decoding multiple resolution videos in the same pipeline. #1144
Conversation
810955e
to
67997f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check my comment
67997f5
to
3adac83
Compare
3adac83
to
b7aaf65
Compare
!build |
CI MESSAGE: [857629]: BUILD STARTED |
CI MESSAGE: [857629]: BUILD FAILED |
@@ -217,8 +237,9 @@ class VideoLoader : public Loader<GPUBackend, SequenceWrapper> { | |||
int stride_; | |||
int output_height_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang is complaining about not used output_height_
and output_width_
.
@@ -168,6 +171,8 @@ class NvDecoder { | |||
bool rgb_; | |||
DALIDataType dtype_; | |||
bool normalized_; | |||
int max_height_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max_height_
and max_width_
are not used (thank you clang build 😄 )
b7aaf65
to
7934281
Compare
if (width_ != codecpar(stream)->width || | ||
height_ != codecpar(stream)->height || | ||
codec_id_ != codec_id) { | ||
if (codec_id_ != codec_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DALI_ENFORCE(codec_id_ == codec_id, "File " + filename + " is not the same codec as previous files");
would be a little more compact
if (max_width_ != width || | ||
max_height_ != height) { | ||
std::stringstream err; | ||
err << "File " << filename << " is not the same size as previous files. (" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err << "File " << filename << " is not the same size as previous files. (" | |
err << "File " << filename << " does not have the same resolution as previous files. (" |
@@ -138,6 +140,7 @@ class VideoLoader : public Loader<GPUBackend, SequenceWrapper> { | |||
|
|||
file_label_pair_ = filesystem::get_file_label_pair(file_root_, filenames_, | |||
file_list_); | |||
DALI_ENFORCE(file_label_pair_.size() != 0, "No files were read."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DALI_ENFORCE(file_label_pair_.size() != 0, "No files were read."); | |
DALI_ENFORCE(!file_label_pair_.empty(), "No files were read."); |
|
||
if (width < caps_.nMinWidth || | ||
height < caps_.nMinHeight) { | ||
DALI_FAIL("Video is too small in at least one dimension."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider rephrasing this in terms of DALI_ENFORCE
|
||
if (width > caps_.nMaxWidth || | ||
height > caps_.nMaxHeight) { | ||
DALI_FAIL("Video is too large in at least one dimension."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider rephrasing this in terms of DALI_ENFORCE
} | ||
|
||
if (width * height / 256 > caps_.nMaxMBCount) { | ||
DALI_FAIL("Video is too large (too many macroblocks)."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider rephrasing this in terms of DALI_ENFORCE
7934281
to
e86a2fd
Compare
!build |
CI MESSAGE: [863225]: BUILD STARTED |
CI MESSAGE: [863225]: BUILD FAILED |
CI MESSAGE: [864884]: BUILD STARTED |
CI MESSAGE: [864884]: BUILD FAILED |
CI MESSAGE: [869869]: BUILD STARTED |
CI MESSAGE: [869869]: BUILD FAILED |
1 similar comment
CI MESSAGE: [869869]: BUILD FAILED |
CI MESSAGE: [869869]: BUILD PASSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (just couple of minor comments added)
!build |
CI MESSAGE: [909480]: BUILD STARTED |
Signed-off-by: Abhishek Sansanwal <asansanwal@nvidia.com>
Description: Add tests to video_reader_op_test.cc and test_video_pipeline.py Depends upon NVIDIA/DALI_extra#20 Signed-off-by: Abhishek Sansanwal <asansanwal@nvidia.com>
b251770
to
036ec76
Compare
CI MESSAGE: [909480]: BUILD PASSED |
Hi! Can I use this feature in the nightly-build python version right now? if yes, which function? |
Right now, you'll have to build it yourself after applying this patch. It's not available in nightly yet because its not merged. Build steps are here. |
@a-sansanwal I will do, thank you |
!build |
CI MESSAGE: [915036]: BUILD STARTED |
CI MESSAGE: [915036]: BUILD FAILED |
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/opt/dali/dali/pipeline/operators/reader/video_reader_op_test.cc:154: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a linter error in video_reader_op_test.cc
59591d1
to
b4c194f
Compare
CI MESSAGE: [915064]: BUILD STARTED |
CI MESSAGE: [915064]: BUILD PASSED |
…ine. (NVIDIA#1144) * Add support for decoding multiple resolutions in the same pipeline. * Add tests for multiple resolution decode for VideoReader Signed-off-by: Abhishek Sansanwal <asansanwal@nvidia.com> Signed-off-by: Jianjun Liu <00liujj@163.com>
Why we need this PR?
What happened in this PR?
cuvidReconfigureDecoder
fromlibnvcuvid.so
.If this symbol is found then we assume that the video codec library installed
supports re-configuring the decoder.
gracefully and do not process further.
cuvidReconfigureDecoder
is found then then we call the aforementioned API and perform decode as usual.and 415 for PPC. This information is given to the user when we are not able to perform
decode.
What is most important part that reviewers should focus on?
VideoLoader::get_or_open_file
invideo_loader.cc
CUVideoDecoder::reconfigure
andCUVideoDecoder::initialize
incuvideodecoder.cc
Was this PR tested? How?
cuvidReconfigureDecoder
from libnvcuvid.so using a hex editor.