Skip to content

Refactor EncAdaptiveLoopFilter::getPreBlkStats#710

Open
athulya-arm wants to merge 2 commits into
fraunhoferhhi:masterfrom
athulya-arm:getPreBlkStats_refactor_upstream
Open

Refactor EncAdaptiveLoopFilter::getPreBlkStats#710
athulya-arm wants to merge 2 commits into
fraunhoferhhi:masterfrom
athulya-arm:getPreBlkStats_refactor_upstream

Conversation

@athulya-arm

Copy link
Copy Markdown
Contributor

Refactor EncAdaptiveLoopFilter::getPreBlkStats

Refactor the weighted and unweighted covariance accumulation paths out
of `EncAdaptiveLoopFilter::getPreBlkStats()` into dispatchable helper
functions.

Introduce function pointers `m_getPreBlkStatsAccum` and
`m_getPreBlkStatsWeightedAccum` to `EncAdaptiveLoopFilter` class.
Move the x86 implementations into the EncoderLib x86 SIMD layer and
assign them during EncAdaptiveLoopFilter x86 initialization, while
keeping scalar helpers as the default fallback.

Also include the EncoderLib x86 sources in the VVenC CMake x86 file
lists.

Add unit tests for EncAdaptiveLoopFilter::getPreBlkStats functions.

Modify the EncAdaptiveLoopFilter constructor to include a new
'enableOpt' parameter to create a reference object and an optimized
object for testing.

Add optional `tolerance` handling to `compare_value` so unit tests can
compare results that are numerically equivalent but not bit-exact. This
allows small floating-point accuracy differences in
`getPreBlkStatsWeightedAccum` test cases. SIMD implementations can
change the order of floating-point operations compared with the scalar
reference, which may produce tiny differences while still being
mathematically correct.

@athulya-arm

Copy link
Copy Markdown
Contributor Author

This is an initial commit that extracts EncAdaptiveLoopFilter::getPreBlkStats as a standalone function. A Neon implementation of the same will be added in a subsequent patch.

Refactor the weighted and unweighted covariance accumulation paths out
of `EncAdaptiveLoopFilter::getPreBlkStats()` into dispatchable helper
functions.

Introduce function pointers `m_getPreBlkStatsAccum` and
`m_getPreBlkStatsWeightedAccum` to `EncAdaptiveLoopFilter` class.
Move the x86 implementations into the EncoderLib x86 SIMD layer and
assign them during EncAdaptiveLoopFilter x86 initialization, while
keeping scalar helpers as the default fallback.

Also include the EncoderLib x86 sources in the VVenC CMake x86 file
lists.
Add unit tests for EncAdaptiveLoopFilter::getPreBlkStats functions.

Modify the EncAdaptiveLoopFilter constructor to include a new
'enableOpt' parameter to create a reference object and an optimized
object for testing.

Add optional `tolerance` handling to `compare_value` so unit tests can
compare results that are numerically equivalent but not bit-exact. This
allows small floating-point accuracy differences in
`getPreBlkStatsWeightedAccum` test cases. SIMD implementations can
change the order of floating-point operations compared with the scalar
reference, which may produce tiny differences while still being
mathematically correct.
@athulya-arm athulya-arm force-pushed the getPreBlkStats_refactor_upstream branch from a64660e to dd24369 Compare June 18, 2026 08:39
@K-os

K-os commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Hi, thank you very much for the patch. In principle, the introduced structure looks good to me, but I am not sure if there was a specific reason why the SIMD code was implemented inline here, or if maybe the added indirect function call adds too much overhead here. We'll talk about that internally and I'll get back to you.

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