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

Refactor videotest driver #69

Merged
merged 1 commit into from
Feb 18, 2020
Merged

Refactor videotest driver #69

merged 1 commit into from
Feb 18, 2020

Conversation

at-wat
Copy link
Member

@at-wat at-wat commented Feb 17, 2020

It took too much CPU time.
Cache fixed region to reduce CPU usage.

@@ -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 {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@lherman-cs lherman-cs Feb 18, 2020

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.

Copy link
Member

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.

Comment on lines 77 to 78
if y > hColorBarEnd {
} else {
Copy link
Member

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 {

Copy link
Member Author

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++ {.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this if

Comment on lines 83 to 84
cbBase[ci+x/2] = colors[c][1]
crBase[ci+x/2] = colors[c][2]
Copy link
Member

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.
Copy link
Member

@lherman-cs lherman-cs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lherman-cs lherman-cs merged commit 0c6c271 into master Feb 18, 2020
@lherman-cs lherman-cs deleted the refactor-videotest branch February 18, 2020 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants