Repository navigation
--field: remove the b-adapt restriction, add tests, and document --field and --interlace - #999
Open
Akilan-Sivakumar wants to merge 3 commits into
Open
Akilan-Sivakumar wants to merge 3 commits into
Akilan-Sivakumar wants to merge 3 commits into
Conversation
Akilan-Sivakumar
force-pushed
the
field-badapt-tests-docs
branch
from
October 17, 2026 11:55
0a49b15 to
b4d86c2
Compare
Akilan-Sivakumar
force-pushed
the
field-badapt-tests-docs
branch
from
October 17, 2026 14:53
b4d86c2 to
cc005e1
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.
Summary
Follow-up to the
--fieldwork. This PR has three commits:source/common/param.cppsource/test/regression-tests.txtdoc/reST/cli.rst,source/x265cli.cpp,source/x265.hIssues and root cause
1.
--fieldrejected with--b-adapt 0and the ultrafast to fast presets (from #986)While testing
--frame-packingwith--fieldin #986, @danielcamposramos noticed that--fieldonly works with a nonzero--b-adapt(comment). The regression line added in #986 (--preset veryfastwith--field) fails for the same reason, and I agreed to look at the check separately.x265_check_paramshas this check, added with--fieldin 7521fc9 and unchanged since:The condition and the message contradict each other.
CHECKfails when b-adapt is 0, but the message says adaptive B-frame decision should be disabled ("closed"). Neither direction is needed: b-adapt only affects the lookahead, which doesn't depend on field coding, and--interlacewithout--fieldalready encodes fields with b-adapt 0 (ultrafast, superfast, veryfast, faster and fast all set b-adapt 0). As a result,--fieldfailed at startup with those presets for no reason.2. No regression test covered
--field(#981, #982)None of the CI, smoke or regression tests used
--field. That's why the frame skipping and hang in #981, and thepic_structand bff field order problems in #982, went unnoticed.3.
--fieldand--interlacewere unclear (#982)The
--fielddocumentation only said "Enable or disable field coding". The two options describe different input layouts, and the docs didn't explain that:--interlace: the input is already fields (field height, field rate);--interlace --field: the input is interlaced frames (both fields woven together), and the CLI splits each frame into its two fields.The difference came up in the #982 discussion, where it was suggested that
--fieldwas redundant with--interlace.Fix
Remove the b-adapt check.
--fieldnow works with every preset.Add regression tests using real interlaced content:
washdc_422_ntsc.y4mandvtc1nw_422_ntsc.y4m: BFF, 4:2:2.cut_fox_1920x1080_30.yuv: TFF, 4:2:0.They cover fast and slow presets, plus
--bframes 0:Document both input layouts in
cli.rst, in the--helptext of--interlaceand--field, and in thex265.hcomments forbFieldandfieldNum. The library-side behaviour is also described: applications pass fields and setfieldNum.Testing and results
b-adapt check removal.
--interlace X --fieldwith the check removed is bit-identical (apart from the options SEI) to--interlace X --no-fieldon the same frames split into fields with ffmpeg (setfield=X,separatefields):--b-adapt 0--preset ultrafastpic_structis 1/2 with the correct parity in all cases. Before this change, the same commands failed with "Adaptive B-frame decision method should be closed for field feature".New regression test lines, all 4 run on this branch:
medium, bffpic_struct360 × 1 / 360 × 2ultrafast, bffpic_struct360 × 1 / 360 × 2slow, tffpic_struct100 × 1 / 100 × 2fast,--bframes 0, tffpic_struct100 × 1 / 100 × 2Build: clean (0 warnings). The doc change only touches comments and help strings.
Related: #981, #982, #986