Skip to content

Reworked ImageResampler #1744

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

Merged
merged 1 commit into from
May 24, 2024
Merged

Conversation

Thinner77
Copy link
Contributor

Summary

Hi,

this is a reworked version of ImageResampler. IMHO there is no need to check pixelformat and flipmode for every pixel.

Benchmark was done with 1920x1080@30FPS/YUYV input, cropping 10/10/5/5, signal detection disabled, on Raspberry Pi Zero 2W, cpu usage from htop, for different pixeldecimations (pixeldecimation=frametime in ms/cpu usage in %)

org: 1=223ms/103%, 2=67ms/105%, 3=37ms/109%, 4=33ms/78%, 5=33ms/64%, 6=33ms/56%, 7=33ms/51%, 8=33ms/48%, 16=33ms/43%
new: 1=153ms/103%, 2=49ms/105%, 3=33ms/89% , 4=33ms/66%, 5=33ms/55%, 6=33ms/49%, 7=33ms/47%, 8=33ms/45%, 16=33ms/43%

Benchmark code was added for V4L2-grabber. For 30 FPS minimal frametime is 33ms.

wbr

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of web configuration, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing setups:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's body (e.g. Fixes: #xxx[,#xxx], where "xxx" is the issue number)

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated (docs/docs/en)
  • Related tests have been updated

PLEASE DON'T FORGET TO ADD YOUR CHANGES TO CHANGELOG.MD

  • Yes, CHANGELOG.md is also updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

@Lord-Grey
Copy link
Collaborator

@Thinner77 Thanks you for your contribution.
The refactoring makes sense.
I assume you tested the different Pixelformats?

@Thinner77
Copy link
Contributor Author

Thinner77 commented May 22, 2024

@Lord-Grey Hi, i couldn't check all pixelformats, because i don't have input devices for all. I have double-checked code for NV12 and I420 for uOffset/vOffset code. And i have tested flipmode (BGR24 is still flipped 😉). As i have only rearranged code to move the case switches outside the nested for loops i don't expect any problems for the untested ones. I have no doubt that it will work, otherwise i wouldn't have created the PR. Feel free to refute me. 😄 Review and test the code, tell me if there is something wrong, i will check. wbr

@Lord-Grey
Copy link
Collaborator

Lord-Grey commented May 22, 2024

Thank you!

@Lord-Grey Lord-Grey merged commit bde5d15 into hyperion-project:master May 24, 2024
@Thinner77
Copy link
Contributor Author

@Lord-Grey Hi, are you aware that the benchmarking code is still in there? It shouldn't be a problem since the output is only in debug mode. But it could fill the logs. I just wanted to point that out. wbr

@Lord-Grey
Copy link
Collaborator

Hi @Thinner77 ohhh. Thanks for pointing out.
I assumed that the benchmark code was left in, but disabled.
I should have checked 😄

@Lord-Grey
Copy link
Collaborator

Disabled the benchmark code

@Thinner77 Thinner77 deleted the imgres branch May 25, 2024 06:11
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