Skip to content

Implement real-time variance-based partitioning - #5173

Open
jianj-g wants to merge 1 commit into
AOMediaCodec:av2-encfrom
jianj-g:rtc-var-partition
Open

Implement real-time variance-based partitioning#5173
jianj-g wants to merge 1 commit into
AOMediaCodec:av2-encfrom
jianj-g:rtc-var-partition

Conversation

@jianj-g

@jianj-g jianj-g commented Jul 29, 2026

Copy link
Copy Markdown

No description provided.

@jianj-g
jianj-g force-pushed the rtc-var-partition branch 4 times, most recently from 674c909 to 33c4434 Compare July 29, 2026 19:29
@jianj-g
jianj-g requested a review from marpan-max July 29, 2026 19:33
@jianj-g
jianj-g force-pushed the rtc-var-partition branch 10 times, most recently from 7ef66fc to b7a0c25 Compare July 31, 2026 18:16
@jianj-g
jianj-g force-pushed the rtc-var-partition branch 2 times, most recently from ca90df0 to 416a7b0 Compare July 31, 2026 20:58
@jianj-g
jianj-g requested a review from yeqing-wu July 31, 2026 21:17
@leolzhao

leolzhao commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Please provide results for your code change. @jianj-g

@jianj-g

jianj-g commented Aug 3, 2026

Copy link
Copy Markdown
Author

Please provide results for your code change. @jianj-g

Here's the command line we use now to test RTC mode:

./avmenc --passes=1 --bit-depth=8 --obu --lag-in-frames=0 --kf-min-dist=1000 --kf-max-dist=1000 ~/Videos/inp_webrtc.640_360.yuv -w 640 -h 360 -o out.ivf --fps=15/1 --target-bitrate=400 --auto-alt-ref=0 --enable-tpl-model=0 --enable-keyframe-filtering=0 --enable-deblocking=1 --enable-restoration=0 --enable-intra-edge-filter=0 --enable-flip-idtx=1 --enable-masked-comp=0 --enable-onesided-comp=0 --enable-interintra-comp=0 --enable-smooth-interintra=0 --enable-diff-wtd-comp=0 --enable-interinter-wedge=0 --enable-interintra-wedge=0 --enable-global-motion=0 --enable-warped-motion=0 --enable-smooth-intra=0 --enable-paeth-intra=0 --enable-cfl-intra=0 --force-video-mode=1 --enable-overlay=0 --enable-angle-delta=0 --enable-trellis-quant=0 --enable-qm=0 --use-intra-dct-only=1 --coeff-cost-upd-freq=2 --mode-cost-upd-freq=2 --mv-cost-upd-freq=3 --frame-parallel=0 --aq-mode=0 --deltaq-mode=0 --frame-boost=0 --noise-sensitivity=0 --cdf-update-mode=1 --reduced-reference-set=1 --enable-ref-frame-mvs=0 --erp-pruning-level=0 --use-ml-erp-pruning=0 --enable-ext-partitions=0 --enable-mrls=0 --enable-pc-wiener=0 --enable-wiener-nonsep=0 --enable-tip=0 --enable-bawp=0 --enable-cwp=0 --enable-imp-msk-bld=0 --enable-ist=0 --enable-inter-ist=0 --enable-inter-ddt=0 --enable-cctx=0 --enable-ibp=0 --max-drl-refmvs=0 --max-drl-refbvs=0 --enable-refmvbank=0 --enable-opfl-refine=0 --enable-ccso=0 --enable-lf-sub-pu=0 --enable-adaptive-mvd=0 --enable-flex-mvres=0 --enable-joint-mvd=0 --enable-refinemv=0 --enable-mvd-sign-derive=0 --enable-parity-hiding=0 --enable-warp-delta=0 --enable-warp-extend=0 --tile-columns=0 --gf-min-pyr-height=0 --gf-max-pyr-height=0 --end-usage=q --use-fixed-qp-offsets=0 --psnr --threads=1 --enable-sdp=0 --min-gf-interval=8 --max-gf-interval=8 --explicit-ref-frame-map=1 --enable-bru=0 --enable-ext-seg=0 --enable-six-param-warp-delta=0 --enable-cdef=1 --enable-cdef-on-skip-txfm=0 --limit=1000 --dpb-size=3 --use-inter-dct-only=0 enable-fsc=1 --enable-idtx-intra=1 --enable-palette=1 --enable-intrabc-ext=0 --enable-intrabc=1 --tune-content=0 --rt --cpu-used=6 --min-qp=100 --max-qp=100 --enable-gdf=0 --max-reference-frames=1

Here's the result on the 360p clip:

With variance based partitioning:

Bitrate(kbps)  |  PSNR(Y)  |  PSNR(U)  |  PSNR(V)  |  PSNR(Avg)  |  PSNR(Overall)  |  Encoding time (FPS)
407.401600  |  41.390690  |  44.641992  |  45.486243  |  42.303441    |  42.302828        |    18.0s (16.6 fps)

Without:

Bitrate(kbps)  |  PSNR(Y)  |  PSNR(U)  |  PSNR(V)  |  PSNR(Avg)  |  PSNR(Overall)  |  Encoding time (FPS)
336.636800  |  41.987292  |  45.136939  |  46.031441  |  42.885996    |  42.885658        |  2022.1s (0.1 fps)

@jianj-g
jianj-g requested a review from leolzhao August 4, 2026 14:36
Comment thread test/rtc_test.cc Outdated

@yeqing-wu yeqing-wu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve reviewed the code and have a few comments. Since the code changes are extensive, I’ll read them again tomorrow.

Comment thread av2/encoder/encoder.h Outdated
Comment thread av2/encoder/var_based_part.c Outdated
Comment thread av2/encoder/var_based_part.c Outdated
Comment thread av2/encoder/var_based_part.c Outdated
Comment thread av2/encoder/var_based_part.c Outdated
Comment thread av2/encoder/var_based_part.c Outdated
Comment thread av2/encoder/var_based_part.c
Comment thread av2/encoder/var_based_part.c Outdated
Comment thread av2/encoder/var_based_part.c
Comment thread test/rtc_test.cc Outdated
@jianj-g
jianj-g force-pushed the rtc-var-partition branch from 416a7b0 to cac8958 Compare August 5, 2026 20:21
@jianj-g

jianj-g commented Aug 5, 2026

Copy link
Copy Markdown
Author

I’ve reviewed the code and have a few comments. Since the code changes are extensive, I’ll read them again tomorrow.

Thanks for the careful review! I've addressed the comments.

@yeqing-wu
yeqing-wu requested a review from yunqingwang1 August 5, 2026 20:43
@yeqing-wu

Copy link
Copy Markdown
Contributor

@yunqingwang1, since you have a better understanding of the code for the RT use case in libavm, could you please help review this PR as well? The code changes are quite a lot, so let's review them carefully to solve the issues as early as possible.

Thanks
Yeqing

Comment thread av2/encoder/var_based_part.c
Comment thread av2/encoder/var_based_part.c
Comment thread av2/encoder/var_based_part.c
Comment thread av2/encoder/var_based_part.h Outdated
@jianj-g
jianj-g force-pushed the rtc-var-partition branch 2 times, most recently from 127d31f to 1a13738 Compare August 7, 2026 17:02
@jianj-g

jianj-g commented Aug 7, 2026

Copy link
Copy Markdown
Author

The failed integer / undefined sanitizer runs don't seem to be related to this PR...

@urvangjoshi

Copy link
Copy Markdown
Contributor

The failed integer / undefined sanitizer runs don't seem to be related to this PR...

Yes, the current head of av2-enc seems to have this failure. Filed issue: #5231

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants