Optimize SSE2 temporal-filter invariant calculations - #5315
Open
chengchen-google wants to merge 1 commit into
Open
Optimize SSE2 temporal-filter invariant calculations#5315chengchen-google wants to merge 1 commit into
chengchen-google wants to merge 1 commit into
Conversation
chengchen-google
force-pushed
the
0824/0002_x86_sse2_temporal_filter_invariants
branch
from
August 25, 2026 19:59
af0b827 to
4ee3e2f
Compare
chengchen-google
force-pushed
the
0824/0002_x86_sse2_temporal_filter_invariants
branch
2 times, most recently
from
August 25, 2026 23:57
f908b88 to
83a0ff7
Compare
jjustiss-apple
approved these changes
Aug 26, 2026
jjustiss-apple
left a comment
Contributor
There was a problem hiding this comment.
LGTM, only two minor non-blocking comments.
| if (plane > PLANE_TYPE_Y) assert(chroma_sq_error != NULL); | ||
|
|
||
| uint32_t acc_5x5_sse[BH][BW]; | ||
| uint32_t acc_5x5_sse[BH][BW] = { 0 }; |
Contributor
There was a problem hiding this comment.
Does acc_5x5_sse need to be zero-init'd?
Contributor
Author
There was a problem hiding this comment.
It aims to silence static analysis warning.
| const MV subblock_mvs[16] = { { 0, 0 }, { 1, 2 }, { 2, 1 }, { 3, 3 }, | ||
| { 5, 5 }, { 4, 6 }, { 6, 4 }, { 7, 7 }, | ||
| { 7, 8 }, { 8, 7 }, { 9, 6 }, { 6, 9 }, | ||
| { 2, 10 }, { 10, 2 }, { 11, 4 }, { 4, 11 } }; |
Contributor
There was a problem hiding this comment.
minor suggestion: with min_frame_size=360 and TF_SEARCH_DISTANCE_THRESHOLD=0.1 and distance_threshold=36, the largest MV magnitude is ~11.7, so d_factor = max(distance/36, 1) gets clamped to 1.0. This results in the distance-scaling path going untested. Would adding a large MV test (e.g. {30, 30} -> d_factor = 1.18) be useful to increase coverage?
Contributor
Author
There was a problem hiding this comment.
Thanks for the suggestion. Done.
Precompute decay, normalization, motion-distance, and block-error factors outside the per-pixel loops. Align SSE2 implementation with C function to support 64x64 blocks (TF_BLOCK_SIZE = BLOCK_64X64, 16 subblocks), enabling SSE2 SIMD dispatch in the temporal filter. Instantiate HBDTemporalFilterTest for C vs SSE2 in test/temporal_filter_test.cc. Unit tests show that SSE2 is ~2.6x faster than C (61-62% reduction), 1.5-2x faster than the original SSE2. [ RUN ] SSE2/HBDTemporalFilterTest.DISABLED_Speed/0 ref_time=2562927 us | tst_time=1012646 us | gain=2.53x (60.5% reduction) width=64 height=64 ref_time=2317598 us | tst_time=881671 us | gain=2.63x (62.0% reduction) width=64 height=64 ref_time=2431593 us | tst_time=954904 us | gain=2.55x (60.7% reduction) width=64 height=64 Change-Id: Ie7e18dd919eb8c14527c2be1506a3f78bcce6c65
chengchen-google
force-pushed
the
0824/0002_x86_sse2_temporal_filter_invariants
branch
from
August 26, 2026 17:12
83a0ff7 to
c9f81f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Precompute decay, normalization, motion-distance, and block-error
factors outside the per-pixel loops.
Align SSE2 implementation with C function to support 64x64 blocks
(TF_BLOCK_SIZE = BLOCK_64X64, 16 subblocks), enabling SSE2 SIMD
dispatch in the temporal filter.
Instantiate HBDTemporalFilterTest for C vs SSE2 in test/temporal_filter_test.cc.
Unit tests show that SSE2 is ~2.6x faster than C (61-62% reduction),
1.5-2x faster than the original SSE2.
[ RUN ] SSE2/HBDTemporalFilterTest.DISABLED_Speed/0
ref_time=2562927 us | tst_time=1012646 us | gain=2.53x (60.5% reduction) width=64 height=64
ref_time=2317598 us | tst_time=881671 us | gain=2.63x (62.0% reduction) width=64 height=64
ref_time=2431593 us | tst_time=954904 us | gain=2.55x (60.7% reduction) width=64 height=64