[FFmpeg-trac] #11551(avcodec:new): [HEVC] Incorrect PCM coding block length derivation for YUV400 (was: [HEVC] Incorrect PCM Coding Block Length Derivation For YUV400)
FFmpeg
trac at avcodec.org
Sun May 4 21:54:59 EEST 2025
#11551: [HEVC] Incorrect PCM coding block length derivation for YUV400
------------------------------------+-----------------------------------
Reporter: ksthey | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: avcodec
Version: git-master | Resolution:
Keywords: hevc | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 1 |
------------------------------------+-----------------------------------
Changes (by MasterQuestionable):
* analyzed: 0 => 1
* cc: MasterQuestionable (added)
* component: ffmpeg => avcodec
* keywords: Hevc => hevc
* summary: [HEVC] Incorrect PCM Coding Block Length Derivation For YUV400
=> [HEVC] Incorrect PCM coding block length derivation for YUV400
Comment:
͏ In "libavcodec/hevc/hevcdec.c", function "hls_pcm_sample":
͏ The derivation of length below doesn't consider the case of YUV400
(!`chroma_format_idc == 0`).
͏ Which results in incorrect byte skipped, and parsing errors for later
blocks: when YUV400 PCM blocks appear.
͏
https://github.com/FFmpeg/FFmpeg/blob/0ce8868878c90153e45648b180cef59a9bcb0109/libavcodec/hevc/hevcdec.c#L1668-L1671
͏ Modify the code as below does solve the problem:
[[
{{{#!diff
--- libavcodec/hevc/hevcdec.c 2025-04-02T07:25:38Z
+++ libavcodec/hevc/hevcdec.c 2025-04-22T03:17:36Z
@@ -1668,4 +1668,6 @@
int length = cb_size * cb_size * sps->pcm.bit_depth + (
+ sps->chroma_format_idc != 0 ? (
( cb_size >> sps->hshift[1] ) * ( cb_size >> sps->vshift[1] ) +
( cb_size >> sps->hshift[2] ) * ( cb_size >> sps->vshift[2] )
- ) * sps->pcm.bit_depth_chroma;
+ ) * sps->pcm.bit_depth_chroma
+ : 0 );
}}}
]]
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11551#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list