From 2720efd6ab48eeeff2f1662e862b12b73831b5a8 Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Fri, 21 Jun 2024 14:02:59 -0700 Subject: [PATCH] `fn Lossless::from_array`: Add a comment explaining why it's not optimized as much as possible. --- include/dav1d/headers.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/dav1d/headers.rs b/include/dav1d/headers.rs index 245940a44..7d69d4947 100644 --- a/include/dav1d/headers.rs +++ b/include/dav1d/headers.rs @@ -2128,6 +2128,10 @@ impl Lossless { } pub fn from_array(a: [bool; RAV1D_MAX_SEGMENTS as usize]) -> Self { + // This could be further optimized quite a bit + // (https://stackoverflow.com/questions/8461126/how-to-create-a-byte-out-of-8-bool-values-and-vice-versa#answer-51750902), + // but since this is only called in `DRav1d` conversions and `mod obu`, + // neither of which are hot, the simpler, more readable code should suffice. let mut this = Self::empty(); let mut i = 0; while i < RAV1D_MAX_SEGMENTS {