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

Arm-2D applies chromakeying to LV_IMG_CF_TRUE_COLOR images #4169

Closed
2 of 4 tasks
kjbracey opened this issue Apr 27, 2023 · 13 comments
Closed
2 of 4 tasks

Arm-2D applies chromakeying to LV_IMG_CF_TRUE_COLOR images #4169

kjbracey opened this issue Apr 27, 2023 · 13 comments

Comments

@kjbracey
Copy link

Perform all steps below and tick them with [x]

  • Read the FAQ
  • Check the related part of the Documentation
  • Update lvgl to the latest version
  • Reproduce the issue in a Simulator

Describe the bug

The Arm-2D accelerator applies chromakeying even when not requested. Observed in 8.3.4, but issue still present by code inspection.

This section of code does not distinguish the values of cf.

if((LV_COLOR_FORMAT_NATIVE_CHROMA_KEYED == cf) ||
(LV_COLOR_FORMAT_NATIVE == cf)) {
__ARM_2D_PREPARE_TRANS_AND_TARGET_REGION(
arm_2d_tile_transform_with_opacity_prepare,
&source_tile,
source_center,
ARM_2D_ANGLE((draw_dsc->angle / 10.0f)),
draw_dsc->zoom / 256.0f,
(color_int)lv_color_to_int(LV_COLOR_CHROMA_KEY),
blend_dsc.opa);
arm_2d_tile_transform(
&target_tile,
&target_region,
NULL
);
is_accelerated = true;
}

To Reproduce

    imageObj = lv_img_create(lv_scr_act());
    imageDesc.data = (const uint8_t *)lvgl_image;
    imageDesc.data_size = sizeof lvgl_image;
    imageDesc.header.always_zero = 0;
    imageDesc.header.reserved = 0;
    imageDesc.header.cf = LV_IMG_CF_TRUE_COLOR;
    imageDesc.header.w = 224;
    imageDesc.header.h = 224;
    lv_img_set_src(imageObj, &imageDesc);

With the image (test bars in my case) containing some pure green, with default config.

Expected behavior

No pixels should be transparent (unless indicated by alpha).

@kisvegabor
Copy link
Member

@GorgonMeducer, could you take a look at it?

@GorgonMeducer
Copy link
Contributor

OK, I will fix it.

@kjbracey Just one question, are you using Cortex-M55 or Cortex-M85 processors?

@GorgonMeducer
Copy link
Contributor

The issue is fixed in cmsis-pack v8.3.7-dev

@kjbracey
Copy link
Author

@kjbracey Just one question, are you using Cortex-M55 or Cortex-M85 processors?

M55.

Thanks for the quick fix!

@kisvegabor
Copy link
Member

I've merged the PR.

@kjbracey
Copy link
Author

As I asked on #4179, this looks like it's just disabling the acceleration for non-colorkey images - or does it end up accelerated via another path?

@GorgonMeducer
Copy link
Contributor

GorgonMeducer commented Apr 28, 2023

@kjbracey Yes. It will use other basic acceleration.

So the whole acceleration strategy is:

First, use condition filters to find those specific scenarios that can be accelerated with dedicated arm-2d API directly,
After that, the left parts will go to the default acceleration routine which is also good.

@GorgonMeducer
Copy link
Contributor

GorgonMeducer commented May 3, 2023

@kjbracey dedicated acceleration for transform-only-with-opacity is added: #4203
And as the code suggested,

#if ARM_2D_VERISON >= 10103
else if (LV_IMG_CF_TRUE_COLOR == cf) {
__ARM_2D_PREPARE_TRANS_AND_TARGET_REGION(
arm_2d_tile_transform_only_with_opacity_prepare,
&source_tile,
source_center,
ARM_2D_ANGLE((draw_dsc->angle / 10.0f)),
draw_dsc->zoom / 256.0f,
blend_dsc.opa);
arm_2d_tile_transform(
&target_tile,
&target_region,
NULL
);
is_accelerated = true;
}
#endif

you won't get the acceleration until the release of arm-2d v1.1.3.

@GorgonMeducer
Copy link
Contributor

GorgonMeducer commented May 12, 2023

@kjbracey arm-2d v1.1.3 is released.
https://github.com/ARM-software/Arm-2D/releases/tag/v1.1.3

Please have a try and let me know whether the issue is solved or not.

@GorgonMeducer
Copy link
Contributor

@kjbracey Any update? Or are you happy with this fix?

@kjbracey
Copy link
Author

Sorry, I've not had a chance to try it yet. I will let you know when I do. (Looks good to me from inspection though).

@kjbracey
Copy link
Author

Okay, tested 8.3.7 + 1.1.3 now, and it's fixed the display error in our app. But I've not profiled it to check performance, and I'm only testing that chromakey isn't applied - I have nothing attempting to use it. Thanks!

@GorgonMeducer
Copy link
Contributor

@kjbracey Thank you for the confirmation. Don't worry about the performance part. I have done that locally. It is identical to the previous.

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

No branches or pull requests

3 participants