-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
cudacodec
: Fix build warnings
#3517
base: 4.x
Are you sure you want to change the base?
Conversation
return true; | ||
case VideoReaderProps::PROP_RAW_MODE: | ||
propertyVal = videoSource_->RawModeEnabled(); | ||
return true; | ||
case VideoReaderProps::PROP_LRF_HAS_KEY_FRAME: { | ||
const int iPacket = propertyVal - rawPacketsBaseIdx; | ||
if (videoSource_->RawModeEnabled() && iPacket >= 0 && iPacket < rawPackets.size()) { | ||
const int iPacket = static_cast<int>(propertyVal) - rawPacketsBaseIdx; |
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.
propertyVal
is function output and could contain any value here. Looks like it's a bug.
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.
Its output and input, not sure what I was thinking here will alter this so that it makes more sense.
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 document "input" logic then.
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.
@asmorkalov I have added a new method rawPackageHasKeyFrame()
to avoid the input output argument confusion in the get()
method but now I am wondering if it is the right time to make some more alterations. Specifically those below which I "wrongly" introduced to mirror the VideoCapture
class:
- remove
grab()/retrieve()
for the decoded frame. This combination is completely unecessarygrab()
doesn't save any processing, it only remove the need to pass aGpuMat
when you don't want to retrieve the decoded frame. propertyVal
ofdouble
inget(const VideoReaderProps propertyId, CV_OUT double& propertyVal)
results in a lot of needless casting when the value will always be an integer.
What do you think?
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.
@asmorkalov I have pushed changes to demonstrate the removal of grab()
and making propertyVal
a size_t
what do you think?
Tested manually with Ubuntu 18.04, CUDA 10.2 and GF 1080. |
00ef267
to
2526e88
Compare
/** @brief Grabs the next frame from the video source. | ||
|
||
@param stream Stream for the asynchronous version. | ||
@return `true` (non-zero) in the case of success. | ||
|
||
The method/function grabs the next frame from video file or camera and returns true (non-zero) in | ||
the case of success. | ||
|
||
The primary use of the function is for reading both the encoded and decoded video data when rawMode is enabled. With rawMode enabled | ||
retrieve() can be called following grab() to retrieve all the data associated with the current video source since the last call to grab() or the creation of the VideoReader. | ||
*/ | ||
CV_WRAP virtual bool grab(Stream& stream = Stream::Null()) = 0; |
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.
Why do you removed grab? It breaks compatibility and it's still mentioned in other methods.
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.
now I am wondering if it is the right time to make some more alterations. Specifically those below which I "wrongly" introduced to mirror the VideoCapture class:
- remove grab()/retrieve() for the decoded frame. This combination is completely unecessary grab() doesn't save any processing, it only remove the need to pass a GpuMat when you don't want to retrieve the decoded frame.
- propertyVal of double in get(const VideoReaderProps propertyId, CV_OUT double& propertyVal) results in a lot of needless casting when the value will always be an integer.
What do you think?
@asmorkalov I have pushed changes to demonstrate the removal of grab() and making propertyVal a size_t what do you think?
I removed grab()
in that commit so you could take a look. It was an unecessary addition which adds a lot of code mess to VideoReader
and was "wrongly" introduced to mirror VideoCapture
without actually mirroring the funcitonality. I can back it out and place it in another PR if you think agree with its removal?
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.
@asmorkalov Added grab()
back into to this PR.
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.
@asmorkalov Should this be included in 4.9.0?
720e0b8
to
a10e30b
Compare
d7c3402
to
50c79b1
Compare
cudacodec
produces a number of build warnings, mainly introduced by myself:facepalm:.PR removes this pollution from the build output.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.