[FFmpeg-devel] [PATCH 5/6] lavc/vvc: Fix derivation of LmcsMaxBinIdx

Frank Plowman post at frankplowman.com
Fri Nov 29 00:17:27 EET 2024


Per H.266 (V3) section 7.4.3.19, LmcsMaxBinIdx is set equal to
15 - lmcs_delta_max_bin_idx.  The previous code instead had it equal to
15 - lmcs_min_bin_idx.  This could cause decoder mismatches.

Signed-off-by: Frank Plowman <post at frankplowman.com>
---
 libavcodec/vvc/ps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vvc/ps.c b/libavcodec/vvc/ps.c
index 9bd2d01776..ff9bc46169 100644
--- a/libavcodec/vvc/ps.c
+++ b/libavcodec/vvc/ps.c
@@ -736,7 +736,7 @@ static int lmcs_derive_lut(VVCLMCS *lmcs, const H266RawAPS *rlmcs, const H266Raw
         return AVERROR_INVALIDDATA;
 
     lmcs->min_bin_idx = rlmcs->lmcs_min_bin_idx;
-    lmcs->max_bin_idx = LMCS_MAX_BIN_SIZE - 1 - rlmcs->lmcs_min_bin_idx;
+    lmcs->max_bin_idx = LMCS_MAX_BIN_SIZE - 1 - rlmcs->lmcs_delta_max_bin_idx;
 
     memset(cw, 0, sizeof(cw));
     for (int i = lmcs->min_bin_idx; i <= lmcs->max_bin_idx; i++)
-- 
2.47.0



More information about the ffmpeg-devel mailing list