Skip to content

From quadratic to linear complexity. - #225

Open
lordnn wants to merge 2 commits into
AcademySoftwareFoundation:mainfrom
lordnn:main
Open

From quadratic to linear complexity.#225
lordnn wants to merge 2 commits into
AcademySoftwareFoundation:mainfrom
lordnn:main

Conversation

@lordnn

@lordnn lordnn commented Jul 14, 2026

Copy link
Copy Markdown

I've lose my fight vs git and have opened new PR.

lordnn added 2 commits July 15, 2026 00:35
Signed-off-by: lordnn <lordnn@yahoo.com>
Signed-off-by: lordnn <lordnn@yahoo.com>
@lordnn

lordnn commented Jul 14, 2026

Copy link
Copy Markdown
Author

Multithreading may be difficult, Let's try once again:
For example - 3 threads (A, B, C).

Thread A: finding loop 0 (NOT_ENCODED) -> process tile 0
Thread C: finding loop 0 (ON_ENCODING), 1 (NOT_ENCODED) -> process tile 1
Thread B: finding loop 0 (ON_ENCODING), 1 (ON_ENCODING), 2 (NOT_ENCODED) -> process tile 2
// here it doesn't matter what thread will finish first, because next NOT_ENCODED tile has index 3. Let it be C.
Thread C: finding loop 0 (ON_ENCODING), 1 (ENCODED), 2 (ON_ENCODING), 3 (NOT_ENCODED) -> process tile 3

And so on. Tiles processing start in monotonic order. So ctx->tile_idx is an index of the next NOT_ENCODED tile.

Regarding new variable to ctx - you don't need at all oapve_tile_t.stat variable.
So you may save sizeof(s32) * OAPV_MAX_TILES number of bytes, at least for encoder case.

P.S. SATD calculation has constant time (not a funtion of number of tiles). Quadratic will alway beat constant, you only need to increase number of tiles. And finding loop leads to CPU-cache pollution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant