Skip to content

Add 12-bit profile (Main_444C_12_IP2) - #5112

Merged
urvangjoshi merged 9 commits into
AOMediaCodec:mainfrom
xinzhao-apple:contrib/avm-12bit-fix
Aug 4, 2026
Merged

Add 12-bit profile (Main_444C_12_IP2)#5112
urvangjoshi merged 9 commits into
AOMediaCodec:mainfrom
xinzhao-apple:contrib/avm-12bit-fix

Conversation

@xinzhao-apple

@xinzhao-apple xinzhao-apple commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

This PR enables the 12-bit profile by default and brings its implementation into conformance with AV2 Spec Draft with 12-bit support: https://github.com/AOMediaCodec/av2-spec-internal/pull/776.

  1. Enable CONFIG_TESTONLY_12BIT_SUPPORT by default
  • Flips the 12-bit config default from 0 to 1 so 12-bit encode/decode is built in by default. (Superseded by the rename below; the flag is now CONFIG_12BIT_PROFILE.)
  1. Align MAIN_4xx_12_IP2 profile with AV2 spec Annex A
  • Renames CONFIG_TESTONLY_12BIT_SUPPORT to CONFIG_12BIT_PROFILE, and the profile enum TEST_ONLY_12BIT_PROFILE to Main_444C_12_IP2 (spec Main_444C_12_IP2, seq_profile_idc = 5).
  • Accepts 8/10/12-bit and all chroma formats (4:0:0/4:2:0/4:2:2/4:4:4) for profile 5, per Table A.1 (previously 8/10-bit were rejected).
  • Sets the max embedded-layer count for profile 5 to 3, matching its IOP2 limit (Table A.3).
  • Gives profile 5 its own PicSize/Bitrate factor row (36 / 3.0) per Table A.2.
  • Updates the in-code Annex A profile/config tables (A.1/A.2/A.5/A.6) and comments, including the bit_depth_idc mapping.

@xinzhao-apple
xinzhao-apple marked this pull request as draft July 14, 2026 22:28

@wantehchang wantehchang 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.

Xin: Thank you for writing this PR. I suggest some simple changes.

Comment thread av2/common/enums.h Outdated
Comment thread av2/common/annexA.c
Comment thread av2/common/annexA.c Outdated
Comment thread av2/common/annexA.c
Comment thread av2/av2_cx_iface.c Outdated
@xinzhao-apple
xinzhao-apple force-pushed the contrib/avm-12bit-fix branch 5 times, most recently from 9527f14 to 7493fd0 Compare July 16, 2026 20:28
@xinzhao-apple
xinzhao-apple marked this pull request as ready for review July 28, 2026 20:08
@xinzhao-apple xinzhao-apple changed the title Add 12-bit profile (Main_4xx_12_IP2) Add 12-bit profile (Main_444C_12_IP2) Jul 29, 2026
@xinzhao-apple
xinzhao-apple force-pushed the contrib/avm-12bit-fix branch from 0c15375 to 978195d Compare July 29, 2026 16:51

@wantehchang wantehchang 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.

Xin: LGTM. Thanks! Note that I did not compare this PR with the corresponding spec PR (https://github.com/AOMediaCodec/av2-spec-internal/pull/776),

Comment thread av2/common/annexA.c
Comment thread av2/common/annexA.c Outdated
Comment thread av2/common/enums.h Outdated
Comment thread av2/common/timing.c
Comment thread av2/common/timing.c
Comment thread av2/common/timing.c
@xinzhao-apple
xinzhao-apple force-pushed the contrib/avm-12bit-fix branch from cfa60fb to 075f76c Compare July 30, 2026 16:29
Comment thread av2/encoder/rd.c
Comment thread av2/common/timing.c
Comment thread av2/common/timing.c Outdated
@xinzhao-apple
xinzhao-apple force-pushed the contrib/avm-12bit-fix branch from 075f76c to c194f43 Compare July 30, 2026 21:11
Comment thread av2/common/timing.c Outdated
Comment thread .github/workflows/build-job-reusable.yaml Outdated

@urvangjoshi urvangjoshi 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.

One comment related to CI job -- otherwise looks good.

@xinzhao-apple
xinzhao-apple force-pushed the contrib/avm-12bit-fix branch from 08e7b0d to a052daa Compare August 3, 2026 21:57
Flip the default for the 12-bit test-only profile from 0 to 1 so that
12-bit encode/decode is built in by default. Builds that explicitly
opt out can still pass -DCONFIG_TESTONLY_12BIT_SUPPORT=0.
- Rename CONFIG_TESTONLY_12BIT_SUPPORT to CONFIG_12BIT_PROFILE and the
  profile enum to MAIN_4xx_12_IP2 (spec Main_4xx_12_IP2)
- Accept 8/10/12-bit and all chroma formats for profile 5
- Set max mlayer count for profile 5 to 3 (IOP2 limit)
- Give profile 5 its own PicSize/Bitrate factor row (36 / 3.0) per Table A.2
- Update Annex A profile/config tables and comments
Per the VCWG decision on 12-bit profile naming, rename the 12-bit
profile from MAIN_4xx_12_IP2 to MAIN_444C_12_IP2 (spec
Main_444C_12_IP2), where "C" stands for Comprehensive.

- Rename the profile enum MAIN_4xx_12_IP2 to MAIN_444C_12_IP2
- Rename the multi-sequence configuration label C_MAIN_4xx_12 to
  C_MAIN_444C_12 to keep it aligned with the profile label
- Update the Annex A profile/configuration tables and comments
- Update the CONFIG_12BIT_PROFILE cmake help string

Naming only; enum values (profile idc 5, configuration id 3) and all
profile constraints and level factors are unchanged.
The spec defines MAXQ_12_BITS (MAXQ_8_BITS + 4 * MAXQ_OFFSET) as the
maximum quantizer for bit depth 12, separately from MAXQ_BITS.

No functional change: all values are identical before and after.
The function returns a row index into the PicSize/Bitrate factor tables,
not the spec's ProfileScalingFactor from Table A.2. The two coincide for
profiles 0..4, but MAIN_444C_12_IP2 (idc 5) shares ProfileScalingFactor 2
with MAIN_444_10_IP1 (idc 4) while needing different factors (36 / 3.0 vs
30 / 2.5), so it gets its own row index.

Rename the function to get_profile_factor_table_row_index and the callers'
locals to profile_factor_row, so the name states what the value is instead
of relying on a comment to disclaim the old name. Trim the now-redundant
sentence from the comment and replace the stale one-line description in
annexA.h with a pointer to the full explanation.

No functional change.
@urvangjoshi
urvangjoshi force-pushed the contrib/avm-12bit-fix branch from a052daa to 0db1923 Compare August 3, 2026 22:31
@urvangjoshi

Copy link
Copy Markdown
Contributor

@xinzhao-apple @wantehchang : the PR contains 9 commits. When merging, do we want Github to squash them into a single commit? Or keep 9 separate commits?

@wantehchang

Copy link
Copy Markdown
Member

Urvang: Please wait for Xin's reply. I think the 9 commits shoud be squashed into a single commit when you merge this PR.

@xinzhao-apple

Copy link
Copy Markdown
Contributor Author

@xinzhao-apple @wantehchang : the PR contains 9 commits. When merging, do we want Github to squash them into a single commit? Or keep 9 separate commits?

Hi @urvangjoshi I think we should squash them into a single commit. Thanks.

@urvangjoshi
urvangjoshi enabled auto-merge (squash) August 4, 2026 00:18
@urvangjoshi
urvangjoshi disabled auto-merge August 4, 2026 23:03
@urvangjoshi
urvangjoshi merged commit 3c93d30 into AOMediaCodec:main Aug 4, 2026
107 checks passed
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.

4 participants