Skip to content

Fix mismatch when end-usage=q: QP inconsistency between encoder and d… - #5154

Open
xueyi2iyeux-cmd wants to merge 2 commits into
AOMediaCodec:mainfrom
xueyi2iyeux-cmd:fix/encode_decode_mismatch_v1_0_0
Open

Fix mismatch when end-usage=q: QP inconsistency between encoder and d…#5154
xueyi2iyeux-cmd wants to merge 2 commits into
AOMediaCodec:mainfrom
xueyi2iyeux-cmd:fix/encode_decode_mismatch_v1_0_0

Conversation

@xueyi2iyeux-cmd

Copy link
Copy Markdown

Problem

When delta-q syntax is not signaled for skip_txfm superblock, decoder uses last SB QP while encoder uses frame level /TPL calculated QP, leading to reconstruction mismatch in loop filter (DBK/CDEF/LR).

Solution

Replay delta-q state in bitstream order per tile before encoder loop filtering, refresh final_qindex_dc/ac with decoder-derived effective QP to align encoder & decoder filter QP.

Test

  • BD-Rate no regression
  • Encode/decoder reconstruction pixel match

Test Encode Command on Linux x64(end-usage=q)

./avmenc -v --test-decode=warn --usage=0 --cpu-used=0 --threads=1 -w 448 -h 960 --end-usage=q --cq-level=37 --psnr=1 --limit=65 --psnr=1 --kf-max-dist=256 --kf-min-dist=256 --lag-in-frames=35 --cpu-used=0 --passes=1 --sb-size=128 --enable-interintra-comp=0 --min-gf-interval=32 --max-gf-interval=32 --threads=64 --row-mt=1 --enable-uneven-4way-partitions=0 --enable-extended-sdp=1 --enable-palette=0 --enable-imp-msk-bld=0 --enable-fsc=0 --enable-idtx-intra=0 --enable-chroma-dctonly=1 --enable-flex-mvres=0 --enable-masked-comp=0 --enable-smooth-interintra=0 --enable-diff-wtd-comp=0 --enable-interintra-wedge=0 --enable-global-motion=0 --enable-mhccp=0 --enable-angle-delta=0 --reduced-ref-frame-mvs-mode=1 --reduced-reference-set=1 --enable-gdf=0 --enable-tip=0 --enable-bawp=0 --enable-cwp=0 --max-drl-refmvs=3 --enable-mv-traj=0 --max-reference-frames=7 --enable-warped-motion=0 --enable-intrabc=0 --enable-inter-ist=0 --enable-inter-ddt=0 --enable-ccso=0 --enable-tcq=2 -o fork_mismatch.bs ./xx.yuv  --recon=recon.yuv 

recon/decode md5

md5

encode bitstream

v0d00fde0000bvttt2v3j66n5rbi0td0_fork_mismatch.bs.zip

@xueyi2iyeux-cmd
xueyi2iyeux-cmd force-pushed the fix/encode_decode_mismatch_v1_0_0 branch from 154affc to c2ce20b Compare July 25, 2026 01:11
@xueyi2iyeux-cmd

Copy link
Copy Markdown
Author

@aomedia-cla-bot recheck

@xueyi2iyeux-cmd
xueyi2iyeux-cmd force-pushed the fix/encode_decode_mismatch_v1_0_0 branch 2 times, most recently from 412f5b4 to b846f15 Compare July 25, 2026 07:30
@xueyi2iyeux-cmd

Copy link
Copy Markdown
Author

Hi! I believe I have already signed the Individual CLA (I even completed the signing process twice), but the CLA bot still reports “CLA has not been signed yet”. Could someone please help check whether my CLA is correctly associated with this GitHub account, or re-run the CLA check? Thank you!

@urvangjoshi
urvangjoshi force-pushed the fix/encode_decode_mismatch_v1_0_0 branch from b846f15 to e38db16 Compare August 3, 2026 22:06
@urvangjoshi

Copy link
Copy Markdown
Contributor

Hi! I believe I have already signed the Individual CLA (I even completed the signing process twice), but the CLA bot still reports “CLA has not been signed yet”. Could someone please help check whether my CLA is correctly associated with this GitHub account, or re-run the CLA check? Thank you!

Thank you for your contribution. I have just made relevant updates, so the CLA check should clear now.

@urvangjoshi

Copy link
Copy Markdown
Contributor

@msarwer2 or @andrey-norkin : could you review? Or suggest the best folks to review this bugfix?

…ecoder loop filter when delta-q of sb&skip is not signaled

Signed-off-by: Yi Xue <xueyi.01@bytedance.com>
@xueyi2iyeux-cmd
xueyi2iyeux-cmd force-pushed the fix/encode_decode_mismatch_v1_0_0 branch from e38db16 to e61413e Compare August 4, 2026 12:10
@xueyi2iyeux-cmd

Copy link
Copy Markdown
Author

Hi! I believe I have already signed the Individual CLA (I even completed the signing process twice), but the CLA bot still reports “CLA has not been signed yet”. Could someone please help check whether my CLA is correctly associated with this GitHub account, or re-run the CLA check? Thank you!

Thank you for your contribution. I have just made relevant updates, so the CLA check should clear now.

Thank you for clearing the CLA check, the PR encountered another format issue, which has now been resolved. Now it seems to need you to review it, Thank you

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.

3 participants