Skip to content

VkEncoderConfigH264: fix use of B-frame count in profile autoselect logic - #238

Merged
dabrain34 merged 1 commit into
KhronosGroup:mainfrom
srinathkr-nv:fix-h264-profile-autoselect
Sep 8, 2026
Merged

VkEncoderConfigH264: fix use of B-frame count in profile autoselect logic#238
dabrain34 merged 1 commit into
KhronosGroup:mainfrom
srinathkr-nv:fix-h264-profile-autoselect

Conversation

@srinathkr-nv

@srinathkr-nv srinathkr-nv commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

The H.264 encoder profile auto-selection logic currently uses the value returned by VkVideoGopStructure::GetConsecutiveBFrameCount() for determining the lower and upper bounds on the codec profile which can be used for encoding the input content. However, this can end up selecting a higher profile than strictly necessary because GetConsecutiveBFrameCount() returns a default value of 255 (i.e. CONSECUTIVE_B_FRAME_COUNT_MAX_VALUE) when the user has not explicitly specified B-frames in the command line.

This change adds an extra check for this condition (in which case the B-frame count is set to 0 for use by the auto-selection logic).

Type of change

Bug fix

Tests

NVIDIA L30 (10de:26bb) / NVIDIA 595.44.15 / Ubuntu 24.04.4 LTS

Total Tests: 85
Passed: 72 (1 warning(s))
Crashed: 0
Failed: 0
Not Supported: 11
Skipped: 2 (in skip list)
Success Rate: 100.0%

Additional Details (optional)

Follow-up to #171

@dabrain34

Copy link
Copy Markdown
Contributor

thank you very much for this PR

@dabrain34

Copy link
Copy Markdown
Contributor

I see one crash and one warning in the tests section, could you check what are the failing tests ?

@srinathkr-nv

Copy link
Copy Markdown
Contributor Author

I see one crash and one warning in the tests section, could you check what are the failing tests ?

The crashing test is decode_av1_superres_8bit. This one has always failed for me as far as I can remember.

The test with a warning is encode_h264_high444_profile because the output cannot be validated by decoding (NVIDIA's H.264 decoder does not support 4:4:4). This one also used to fail earlier but passes with a warning now due to #232

@dabrain34

dabrain34 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor
AV1      -  1 pass,  0 N/S,  0 crash,  0 fail ( 1 total)
----------------------------------------------------------------------
✔️ av1  decode_av1_superres_8bit            - PASS  (3.78s)
----------------------------------------------------------------------

### NVIDIA GeForce RTX 4060 (10de:2882) / NVIDIA 595.44.14 / Ubuntu 24.04.4 LTS

Total Tests:     1

I checked a normal playback of tests/resources/video/av1/av1-1920x1080-main-superres-8.ivf and no issue so far with NVIDIA GeForce RTX 4060 (10de:2882)

I dont have the issue neither with NVIDIA_GeForce_RTX_3050_Ti_Laptop_GPU_10de_25a0_Linux

I would recommend to investigate why this is failing with NVIDIA L30. Can you open an issue ?

Regarding encode_h264_high444_profile this is indeed expected.

@srinathkr-nv

Copy link
Copy Markdown
Contributor Author

I tried out the decode_av1_superres_8bit test on an NVIDIA RTX A4000 (Ampere, same GPU family as the the GeForce RTX 3050) and I don't see any failure there.

The GeForce RTX 4060 is of the same GPU family (Ada) as the NVIDIA L30, so it's not clear to me why the test passes on the 4060 and fails on the L30. I'll try to locate a 4060 (or equivalent) and independently verify the test results there. At this point, this is seeming like a bug specific to an NVIDIA GPU family or architecture and I will file a bug report internally at NVIDIA for tracking. @dabrain34 do you also need a GitHub issue opened for this?

@dabrain34

dabrain34 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

If its identified as a driver bug I would say this is not necessary. you can create a skipped sample entry in tests/skipped_samples,json and add the device id (25a0 for example ) which should be displayed in the testing framework such as

### NVIDIA GeForce RTX 3050 Ti Laptop GPU (10de:25a0) / NVIDIA 595.44.14 / Ubuntu 24.04.4 LTS

Total Tests:    85
Passed:         66 (1 warning(s))
Crashed:         0
Failed:          0
Not Supported:  18
Skipped:         1 (in skip list)
Success Rate: 100.0%

Can you rebase your branch to main ?

Can you also show the the crash log with:

./tests/vvs_test_runner.py -t decode_av1_superres_8bit -v

Then when its okay you can update the PR description to avoid having a crash in the tests section

@srinathkr-nv

Copy link
Copy Markdown
Contributor Author

I have created #241 to add an entry in skipped_samples.json for the crashing test. As I wrote in that PR, the crash is due to fence timeout and subsequent assert in debug builds.

Once that PR is merged, I'll rebase this one on top of that, re-run the test framework and update the test scores in the PR description here.

@dabrain34

dabrain34 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Thanks #241 has been merged, you can rebase and update the description :)

…ogic

The H.264 encoder profile auto-selection logic currently uses the value
returned by VkVideoGopStructure::GetConsecutiveBFrameCount() for
determining the lower and upper bounds on the codec profile which can be
used for encoding the input content. However, this can end up selecting
a higher profile than strictly necessary because
GetConsecutiveBFrameCount() returns a default value of 255 (i.e.
CONSECUTIVE_B_FRAME_COUNT_MAX_VALUE) when the user has not explicitly
specified B-frames in the command line.

This change adds an extra check for this condition (in which case the
B-frame count is set to 0 for use by the auto-selection logic).
@srinathkr-nv
srinathkr-nv force-pushed the fix-h264-profile-autoselect branch from 7fe2177 to 7220cc2 Compare September 8, 2026 08:42
@srinathkr-nv

Copy link
Copy Markdown
Contributor Author

Thanks #241 has been merged, you can rebase and update the description :)

Great; thank you for promptly merging that change. I have updated the test results for the current PR.

@dabrain34
dabrain34 merged commit 2142c55 into KhronosGroup:main Sep 8, 2026
21 checks passed
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