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

Multiple crops #32

Merged
merged 7 commits into from
Aug 1, 2024
Merged

Multiple crops #32

merged 7 commits into from
Aug 1, 2024

Conversation

naushir
Copy link
Collaborator

@naushir naushir commented Jul 15, 2024

No description provided.

Tiles may produce output on only a single branch when multiple branches
are active. Track the completion using a new BranchComplete() helper,
which traverses the pipeline till the output stage and returns a flag
if the stage has completed all its output.

In the split stage, do not inject tiles into a branch if the output is
complete.

Signed-off-by: Naushir Patuck <[email protected]>
For backward compatibility, we keep the existing BackEnd::SetCrop
behaving the same and setting the same crop params for all outputs.

Signed-off-by: Naushir Patuck <[email protected]>
… tile

It is possible to have a configuration where a branch starts producing
output after the first tile in a row/column. In such cases, the tile
edge flag will not be set, and cause the resample to start filtering at
the wrong pixel offset.

Fix this by tracking when a branch has started producing output, and
allowing neative input_start values to be used in PushStartUp() on all
but the first tile in the row/column.

Signed-off-by: Naushir Patuck <[email protected]>
@naushir naushir force-pushed the multiple_crops branch 2 times, most recently from 560a14e to 1904ed4 Compare July 25, 2024 08:49
@naushir
Copy link
Collaborator Author

naushir commented Jul 26, 2024

@davidplowman my torture tests are still running, likely only done by the weekend now. However I expect everything to pass now, so we ought to get ready to merge this soon.

Given the magnitude of the changes, can you check through my work please?

{
started_ = false;
return !output_interval_.length;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess I feel slightly weird that BranchInactive() looks at the output_interval, but BranchComplete() doesn't - it slight offends my need for symmetry. Should BranchCompletel() look at output_interval_.End() or something? Or do I worry too much?

@@ -46,7 +46,7 @@ class RescaleStage : public BasicStage

private:
Config config_;
uint32_t round_up;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ouch! That must have reacted badly to the negative offsets we now have...

@davidplowman
Copy link
Collaborator

Mostly this all looks pretty good to me. I guess I've seen most of it before. Though there are surprisingly few changes compared to the amount of head-scratching required to find them!

I'm still wondering a little bit about the symmetry (or lack of) between BranchComplete() and BranchInactive(). If you wanted you could leave it with me and I could scratch my head some more on that question?

@naushir
Copy link
Collaborator Author

naushir commented Jul 26, 2024

Mostly this all looks pretty good to me. I guess I've seen most of it before. Though there are surprisingly few changes compared to the amount of head-scratching required to find them!

I'm still wondering a little bit about the symmetry (or lack of) between BranchComplete() and BranchInactive(). If you wanted you could leave it with me and I could scratch my head some more on that question?

Yes, perhaps we can replace this with output_interval_.End()? Will have to rerun all the tests again...

Remove the started flag from the crop stage and rely on the output
interval length instead. Add a BranchInactive() helper to the base stage
class.

When testing for the above, ensure we handle the case where the output
interval end is > min tile size, but the length is not because of a
possible negative offset.

In BasicStage::CopyOut(), if a stage is inactive or complete, reset all
intervals before copying out to the tile structures.

Signed-off-by: Naushir Patuck <[email protected]>
The round_up const was unsigned whereas the offsets might be signed
negative, causing an overflow. Fix this by changing the round_up const
to a signed int.

Signed-off-by: Naushir Patuck <[email protected]>
Also mark functions as override to keep clang happy.

Signed-off-by: Naushir Patuck <[email protected]>
Remove OutputStage::Done() and explicitly test the output interval
size from the top level pipeline. We also set the branch complete flag
with a new helper OutputStage::SetBranchComplete() to be explicit.

Rename OutputStage::BranchComplete() to OutputStage::GetBranchComplete()
for consistency.

Signed-off-by: Naushir Patuck <[email protected]>
@naushir
Copy link
Collaborator Author

naushir commented Aug 1, 2024

@davidplowman 3a61f12 makes things neater with the branch complete flag. I think this is now good to go.

@naushir naushir merged commit 17cf7b0 into main Aug 1, 2024
6 of 7 checks passed
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.

2 participants