Skip to content

[x265] Add multilib feature with runtime bit-depth switching - #53168

Draft
Shen (QShen3) wants to merge 15 commits into
microsoft:masterfrom
QShen3:x265
Draft

Shen (QShen3) wants to merge 15 commits into
microsoft:masterfrom
QShen3:x265

Conversation

@QShen3

@QShen3 Shen (QShen3) commented Aug 2, 2026 •

Copy link
Copy Markdown
  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version, or no changes were necessary.
  • Any fixed CI baseline and CI feature baseline entries are removed from that file, or no entries needed to be changed.
  • All patch files in the port are applied and succeed.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Exactly one version is added in each modified versions file.

@QShen3

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@QShen3
Shen (QShen3) marked this pull request as ready for review August 2, 2026 06:59
@QShen3

Copy link
Copy Markdown
Author

Shen (@QShen3) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@BillyONeal Billy O'Neal (BillyONeal) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does upstream expect playing these kinds of merge library games?

Comment thread ports/x265/portfile.cmake Outdated
Comment thread scripts/ci.feature.baseline.txt Outdated
Comment thread ports/x265/portfile.cmake Outdated
Comment thread ports/x265/portfile.cmake Outdated
@BillyONeal
Billy O'Neal (BillyONeal) marked this pull request as draft August 3, 2026 22:00
@QShen3

Shen (QShen3) commented Aug 4, 2026 •

Copy link
Copy Markdown
Author

I really don't like the idea that build the library 3 times and merge the results into one library. But this looks like the only way to produce multi-bit-depth library according to the design.
build implications from x265 doc

By default libx265 will place all of its internal C++ classes and functions within an x265 namespace and export all of the C functions documented in this file. Obviously this prevents 8bit and 10bit builds of libx265 from being statically linked into a single binary, all of those symbols would collide.
However, if you set the EXPORT_C_API cmake option to OFF then libx265 will use a bit-depth specific namespace and prefix for its assembly functions (x265_8bit, x265_10bit or x265_12bit) and export no C functions.
In this way you can build one or more libx265 libraries without any exported C interface and link them into a libx265 build that does export a C interface. The build which exported the C functions becomes the default bit depth for the combined library, and the other bit depths are available via the bit-depth introspection methods.

I could remove 10bit and 12bit features and the port will be looked like this:

  • x265: default 8bit build
  • x265[multilib]: 8bit + 10bit + 12bit

Or, just follow recommendation from the doc and build the multilib by default.

We recommend that packagers distribute a single combined shared/static library build which includes all the bit depth libraries linked together. See the multilib scripts in our build/ subdirectories for examples of how to affect these combined library builds. It is the packager’s discretion which bit-depth exports the public C functions and thus becomes the default bit-depth for the combined library.

Billy O'Neal (@BillyONeal) Which do you think is better

@QShen3 Shen (QShen3) changed the title [x265] Add 10-bit, 12-bit and multilib features [x265] Add multilib feature with runtime bit-depth switching Aug 5, 2026
@QShen3

Copy link
Copy Markdown
Author

A patch is created to move all the logic into x265's CMakeLists.txt so that the portfile.cmake is clean now.

When ENABLE_MULTILIB is set to ON, 10 bit and 12 bit static build target will be defined and do the merge in post build step.

@QShen3
Shen (QShen3) marked this pull request as ready for review August 8, 2026 08:22
Comment thread ports/x265/vcpkg.json Outdated
Comment thread versions/x-/x265.json
Comment thread ports/x265/multilib.diff Outdated
endif(EXTRA_LIB)
mark_as_advanced(EXTRA_LIB EXTRA_LINK_FLAGS)

+# Build a single library containing the 8-bit, 10-bit and 12-bit encoders,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Given that this appears to implement what upstream has explicitly asked packagers to do have you submitted this upstream? I suspect that their comments will make whether this should be a feature clearer.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Multicorewareinc/x265#955 A PR is created for upstream

Comment thread ports/x265/multilib.diff Outdated
@BillyONeal
Billy O'Neal (BillyONeal) marked this pull request as draft August 10, 2026 23:18
@BillyONeal

Billy O'Neal (BillyONeal) commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Drafting due to check failures.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants