Unnest compound mode search loops and clean up inter search - #5343
Draft
kslu-aom wants to merge 3 commits into
Draft
Unnest compound mode search loops and clean up inter search#5343kslu-aom wants to merge 3 commits into
kslu-aom wants to merge 3 commits into
Conversation
Unnest the JMVD scale factor, CWP, and RefineMV loops in handle_compound_inter_prediction into sequential evaluation stages: 1. Base compound mode (scale 0, CWP EQUAL, RefineMV 0) 2. RefineMV mode (scale 0, CWP EQUAL, RefineMV 1) 3. CWP modes (scale 0, CWP != EQUAL, RefineMV 0) 4. JMVD scale factor modes (scale 1..N-1, CWP EQUAL, RefineMV 0) Avoid redundant motion search and skip invalid tool combinations.
…prediction - Hoist invariant mbmi initializations, rate computations, and loop invariants out of search loops in handle_single_inter_prediction and handle_compound_inter_prediction. - Use reset_inter_mode_info helper to unify mode_info field resets. - Use base template struct assignment in compound search instead of re-assigning individual invariant fields per iteration. - Clean up BAWP search in single prediction by simplifying scalar BAWP MV tracking and mode_info access. - Remove redundant dead checks in CWP and JMVD scaling stages.
kslu-aom
requested review from
jingninghan,
leolzhao,
urvangjoshi,
yeqing-wu and
yunqingwang1
August 28, 2026 17:18
Contributor
Author
|
Please review this refactoring patch and let me know if anything can be improved. I have a follow up patch to clean up more variables, search state structs, and function signatures, but I think it is better to separate this unnesting change for code review. I will mark the PR as ready when speed 0 tests are finished. |
yeqing-wu
approved these changes
Aug 28, 2026
| &it_ctx, bsize, ref_mv_idx[0], ref_mv_idx[1], precision_dx, bawp_flag, | ||
| ref_mv_idx_type, 0, single_cwp_mask, this_mode, refs, flex_mv_cost, | ||
| drl_cost, jmvd_scale_mode_cost, base_rate, cur_mv, rate_mv, | ||
| ref_mv_idx_type, 0, NULL, this_mode, refs, flex_mv_cost, |
Contributor
There was a problem hiding this comment.
The old code allocated int single_cwp_mask[MAX_CWP_NUM] = { 0 }; single_cwp_mask[0] = 1; on the stack and passed that. The new code passes NULL.
Would this cause a problem? Please check.
Contributor
Author
There was a problem hiding this comment.
This is a minor cleanup for handle_single_inter_prediction. Since CWP and JMVD are irrelevant to the single prediction case, the mask and cost are removed from here.
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.
This change includes the following cleanups
STATS_CHANGED
Results tested with RA 33 frames based on ae462ed