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

common: utils: Respect provided stride #22

Merged
merged 1 commit into from
Dec 12, 2023
Merged

common: utils: Respect provided stride #22

merged 1 commit into from
Dec 12, 2023

Conversation

will-v-pi
Copy link
Collaborator

When computing stride alignment, don't overwrite a provided stride.

@@ -67,7 +67,8 @@ void compute_stride_align(pisp_image_format_config &config, int align)
if (PISP_IMAGE_FORMAT_compressed(config.format))
width = (width + 7) & ~7; // compression uses blocks of 8 samples

config.stride = compute_x_offset(config.format, width);
if (!config.stride)
config.stride = compute_x_offset(config.format, width);
Copy link
Collaborator

@naushir naushir Dec 12, 2023

Choose a reason for hiding this comment

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

I wonder if this is not entirely safe, and we should perhaps do something like:

uint32_t computed_stride = compute_x_offset(config.format, width);
if (!config.stride || config.stride < computed_stride)
    config.stride = computed_stride;

When computing stride alignment, don't overwrite a provided stride
unless the stride provided is too small.
@naushir naushir merged commit 92c13c4 into main Dec 12, 2023
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