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

Reduce memory usage: do not allocate memory for the transform layer for single layer images #7233

Conversation

Districh-ru
Copy link
Collaborator

This PR disables the transform layer for images that are set as singleLayer and reworks the image processing functions not to work with this layer for such images.

For 1366x768 resolution with opened View World for XL map the engine takes 72 MB, in master build - 82 MB.

Rework most image processing functions to work with singleLayer images without 'transform' layer.
@Districh-ru Districh-ru added improvement New feature, request or improvement ui UI/GUI related stuff labels May 26, 2023
@Districh-ru Districh-ru added this to the 1.0.5 milestone May 26, 2023
@Districh-ru Districh-ru self-assigned this May 26, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/3)

src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (2/3)

src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (3/3)

src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.h Outdated Show resolved Hide resolved
@Districh-ru Districh-ru changed the title Reduce memory usage by the engine: do not allocate memory for the transform layer when it is not used (for single layer image case) Reduce memory usage: do not allocate memory for the transform layer for single layer images May 26, 2023
@Districh-ru Districh-ru modified the milestones: 1.0.5, 1.0.6 May 27, 2023
@Districh-ru Districh-ru marked this pull request as ready for review May 27, 2023 19:28
@Districh-ru Districh-ru requested a review from ihhub May 27, 2023 19:29
Copy link
Owner

@ihhub ihhub left a comment

Choose a reason for hiding this comment

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

Hi @Districh-ru , I left several comments in this pull request. Would you mind to take a look at them?

src/engine/h2d_file.cpp Outdated Show resolved Hide resolved
src/engine/image.h Outdated Show resolved Hide resolved
src/engine/image.h Outdated Show resolved Hide resolved
src/engine/image.h Outdated Show resolved Hide resolved
src/engine/image.h Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/engine/image.cpp Outdated Show resolved Hide resolved
src/fheroes2/agg/agg_image.cpp Outdated Show resolved Hide resolved
src/engine/image_tool.cpp Outdated Show resolved Hide resolved
@Districh-ru Districh-ru marked this pull request as draft May 28, 2023 08:05
@Districh-ru Districh-ru marked this pull request as ready for review July 7, 2023 20:30
@ihhub ihhub modified the milestones: 1.0.6, 1.0.7 Jul 15, 2023
@Districh-ru Districh-ru marked this pull request as draft July 22, 2023 14:09
@Districh-ru Districh-ru added the low priority Low priority item which could be addressed in the future label Jul 22, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

src/fheroes2/agg/agg_image.cpp Outdated Show resolved Hide resolved
@Districh-ru Districh-ru modified the milestones: 1.0.7, 1.0.8 Jul 24, 2023
@Districh-ru Districh-ru modified the milestones: 1.0.8, 1.0.9 Sep 10, 2023
@ihhub ihhub modified the milestones: 1.0.9, 1.1.0 Oct 11, 2023
@Districh-ru
Copy link
Collaborator Author

Closing this PR in favor to #8241

@Districh-ru Districh-ru closed this Jan 7, 2024
@Districh-ru Districh-ru deleted the disable_transform_layer_for_singlelayer_images branch January 20, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature, request or improvement low priority Low priority item which could be addressed in the future ui UI/GUI related stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants