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

added sourceBox parameter to resizeInto in RasterYuv420Semiplanar #1852

Merged
merged 1 commit into from Aug 2, 2016
Merged

Conversation

ghost
Copy link

@ghost ghost commented Aug 2, 2016

This allows to crop & resize in single pass.
@marcusnaslund review

@ghost ghost added the peer review label Aug 2, 2016
resizeInto: func (target: This) {
resizeInto: func (target: This, sourceBox := IntBox2D new()) {
if (sourceBox hasZeroArea)
sourceBox = IntBox2D new(this size)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose sourceBox := IntBox2D new(this size) does not work as a default argument?

Copy link
Author

Choose a reason for hiding this comment

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

I think it is evaluated only once. It does not seem to be a problem now, but maybe someone would like to change the size at some point.
Should I change it anyway ?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine. I think my suggestion actually does not work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

:(

thisStride := srcRow * this uv stride / 2
targetStride := row * target uv stride / 2
for (column in 0 .. targetSizeHalf x) {
srcColumn := (thisSizeHalf x * column) / targetSizeHalf x
srcColumn := (thisSizeHalf x * column) / targetSizeHalf x + sourceBox left / 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I should ask: You are reading the sourceBox properties once per iteration, do you want to speed them up as you did with thisSize* and targetSize*?

Copy link
Contributor

Choose a reason for hiding this comment

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

lines 105, 109, 120, 124

Copy link
Author

Choose a reason for hiding this comment

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

We can do that later, I'm currently still working on this function.

Copy link
Author

Choose a reason for hiding this comment

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

But thanks for noticing 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

It's what they pay me for.

@marcusnaslund marcusnaslund merged commit 576d803 into magic-lang:develop Aug 2, 2016
@ghost ghost deleted the resizeSourceBox branch August 2, 2016 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant