-
Notifications
You must be signed in to change notification settings - Fork 119
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
Refactor videotest driver #69
Conversation
@@ -47,12 +47,10 @@ func (d *dummy) Close() error { | |||
} | |||
|
|||
func (d *dummy) VideoRecord(p prop.Media) (video.Reader, error) { | |||
yi := p.Width * p.Height | |||
ci := yi / 2 | |||
if p.FrameRate == 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.
This seems to be a very common thing, having default values for some properties. I feel like we should automatically do it in the wrapper instead. 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.
I think default value may depend on the device.
It might be better to have an interface to get default prop by the wrapper.
btw, #61 is bit related.
videotest and screen can take any framerate, but the value the user specified is not passed to VideoRecord at now.
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.
Ah right. I think that I missed the main problem. I think the problem is not actually about having the default value or not. But, the problem is how we handle non-discrete values, for example frame rate.
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.
I'll continue the conversation in #61. I think the design decision for this can take a while.
pkg/driver/videotest/dummy.go
Outdated
if y > hColorBarEnd { | ||
} else { |
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.
I think this one should be just if y <= hColorBarEnd {
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.
oh, this if
is no longer needed as I splitted for loop as for y := 0; y < hColorBarEnd; y++ {
.
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.
removed this if
pkg/driver/videotest/dummy.go
Outdated
cbBase[ci+x/2] = colors[c][1] | ||
crBase[ci+x/2] = colors[c][2] |
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.
I like it. It definitely looks better than having an if statement for just handling Chroma subsampling
Cache fixed region to reduce CPU usage.
7a42557
to
1e87b71
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.
LGTM
It took too much CPU time.
Cache fixed region to reduce CPU usage.