Repository navigation
Fix HEVC decoding artifacts in VA-API to NVDEC translation - #445
Merged
Merged
Conversation
Three bugs in copyHEVCPicParam caused persistent visual artifacts (blocks, shadows) during HEVC playback via VA-API, while the same streams played clean via VDPAU (direct NVDEC): 1. NumPocTotalCurr counted all DPB entries instead of only pictures flagged as used by the current frame (RPS_ST_CURR_BEFORE, RPS_ST_CURR_AFTER, RPS_LT_CURR). Now computed as the sum of NumPocStCurrBefore + NumPocStCurrAfter + NumPocLtCurr, matching FFmpeg's nvdec_hevc.c reference implementation. 2. Tile uniform_spacing_flag detection looped over hardcoded bounds (19 columns, 21 rows), reading out-of-bounds memory. Now uses num_tile_columns_minus1 / num_tile_rows_minus1 as loop bounds. 3. NumDeltaPocsOfRefRpsIdx was hardcoded to 0 (TODO comment). Now computed as the count of short-term (non-long-term) reference pictures with valid RefPicIdx in the DPB. Tested on RTX 4060 Max-Q (Optimus/PRIME), driver 570.211.01, Firefox 151, HEVC Main 1080p HLS streams.
elFarto
approved these changes
Jun 27, 2026
Owner
|
Thanks for the patch! |
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.
Three bugs in copyHEVCPicParam caused persistent visual artifacts (blocks, shadows) during HEVC playback via VA-API, while the same streams played clean via VDPAU (direct NVDEC):
NumPocTotalCurr counted all DPB entries instead of only pictures flagged as used by the current frame (RPS_ST_CURR_BEFORE, RPS_ST_CURR_AFTER, RPS_LT_CURR). Now computed as the sum of NumPocStCurrBefore + NumPocStCurrAfter + NumPocLtCurr, matching FFmpeg's nvdec_hevc.c reference implementation.
Tile uniform_spacing_flag detection looped over hardcoded bounds (19 columns, 21 rows), reading out-of-bounds memory. Now uses num_tile_columns_minus1 / num_tile_rows_minus1 as loop bounds.
NumDeltaPocsOfRefRpsIdx was hardcoded to 0 (TODO comment). Now computed as the count of short-term (non-long-term) reference pictures with valid RefPicIdx in the DPB.
Tested on RTX 4060 Max-Q (Optimus/PRIME), driver 570.211.01, Firefox 151, HEVC Main 1080p HLS streams.
Fixes #444