Opened 2 hours ago
Last modified 106 minutes ago
#11357 new defect
Results may be inconsistent when decoding an H.264 bitstream with bi-prediction weighted prediction enabled on ARM and x86 devices
Reported by: | Bin Peng | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | H264 decoder arm |
Cc: | Bin Peng | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description (last modified by )
Summary of the bug:
When decoding a bitstream with weighted-bipred enabled, the output of FFmpeg on ARM and x86 platforms may differ.
How to reproduce:
using ffmpeg git-master built on aarch64 and test on aarch64 devices % ffmpeg -i inter_weighted_bipred2.264 -f framemd5 -y md5_arm using ffmpeg git-master built on x86 and test on x86 devices % ffmpeg -i inter_weighted_bipred2.264 -f framemd5 -y md5_x86 md5_arm and md5_x86 would be different, but we expect the same decode result on different CPUs with the same input bit-stream.
Attachments (1)
Change History (7)
by , 2 hours ago
Attachment: | inter_weighted_bipred2.264 added |
---|
comment:1 by , 2 hours ago
Description: | modified (diff) |
---|
comment:2 by , 2 hours ago
The reason for the inconsistency is that the value of STRIDE_ALIGN differs between platforms. On x86 platforms, it is greater than 16 (typically 32 or 64), while on ARM platforms, it is 16.
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/internal.h#L39
The STRIDE_ALIGN is set to the buffer stride of temporary buffers for U and V components in mc_part_weighted.
uint8_t *tmp_cb = sl->bipred_scratchpad; uint8_t *tmp_cr = sl->bipred_scratchpad + (16 << pixel_shift);
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/h264_mb.c#L410
But the offset of temporary buffers for U and V components is hardcoded to 16.
If the buffer stride is 32 or 64 (as on x86 platforms), the U and V pixels can be interleaved row by row without overlapping, resulting in correct output. However, on ARM platforms where the stride is 16, the V component will overwrite part of the U component's pixels, leading to incorrect predicted pixels.
comment:3 by , 2 hours ago
Summary: | H.264 decoder bug on Arm → Inconsistency on ARM when decoding weighted-bipred enabled H.264 bitstream |
---|
comment:4 by , 2 hours ago
Keywords: | arm added |
---|
comment:5 by , 2 hours ago
Summary: | Inconsistency on ARM when decoding weighted-bipred enabled H.264 bitstream → Inconsistency on ARM and X86 when decoding H.264 bitstream with weighted-bipred enabled |
---|
comment:6 by , 106 minutes ago
Summary: | Inconsistency on ARM and X86 when decoding H.264 bitstream with weighted-bipred enabled → Results may be inconsistent when decoding an H.264 bitstream with bi-prediction weighted prediction enabled on ARM and x86 devices |
---|
h264 bitstream with weighted-bipred enabled