From a3563881c98928a3390b94fc81f3ca3de9f210a7 Mon Sep 17 00:00:00 2001 From: touki Date: Fri, 31 Jul 2026 23:42:10 +0800 Subject: [PATCH] Convert P010/P016 hardware-decoder frames to 8-bit before analysis Hardware decoders emit P010LE (not YUV420P10LE) for 10-bit HEVC, so the 8-bit conversion from #143 was skipped and frames were processed as a double-width 8-bit buffer, corrupting brightness, uniformity and logo metrics on Main10 sources. --- mpeg2dec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mpeg2dec.c b/mpeg2dec.c index c4bbc9b..d7e0a88 100755 --- a/mpeg2dec.c +++ b/mpeg2dec.c @@ -1347,7 +1347,10 @@ static int prev_strange_framenum = 0; { frameFinished = 1; // convert to 8bit - if (is->pFrame->format == AV_PIX_FMT_YUV420P10LE) { + if (is->pFrame->format == AV_PIX_FMT_YUV420P10LE || + is->pFrame->format == AV_PIX_FMT_P010LE || + is->pFrame->format == AV_PIX_FMT_P016LE || + is->pFrame->format == AV_PIX_FMT_YUV420P12LE) { is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx, is->pFrame->width, is->pFrame->height, is->pFrame->format, is->pFrame->width, is->pFrame->height, AV_PIX_FMT_YUV420P, SWS_POINT, NULL, NULL, NULL); AVFrame *newframe = av_frame_alloc(); av_frame_copy_props(newframe, is->pFrame);