From cb021cc9dfa29106f990ff127f457c11af015183 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 27 Feb 2026 21:23:52 +0100 Subject: [PATCH] h264: make sure that mv_cache is aligned --- nihav-itu/src/codecs/h264/types.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nihav-itu/src/codecs/h264/types.rs b/nihav-itu/src/codecs/h264/types.rs index 9619e06..0cb3f8e 100644 --- a/nihav-itu/src/codecs/h264/types.rs +++ b/nihav-itu/src/codecs/h264/types.rs @@ -435,6 +435,12 @@ pub struct SliceState { const BLK4_TO_D8: [usize; 16] = [ 0, 0, 3, 3, 0, 0, 3, 3, 12, 12, 15, 15, 12, 12, 15, 15 ]; +#[repr(align(8))] +#[derive(Default)] +struct MVCache { + data: [[MV; 2]; 25] +} + impl SliceState { pub fn new() -> Self { Self { @@ -515,7 +521,8 @@ impl SliceState { let mut top_intra = self.get_top_mb().mb_type.is_intra(); let mut coded_cache = [false; 25]; - let mut mv_cache = [[ZERO_MV; 2]; 25]; + let mut mvc = MVCache::default(); + let mv_cache = &mut mvc.data; let mut ref_cache = [[INVALID_REF; 2]; 25]; if self.mb_y != 0 || self.has_top { -- 2.39.5