summaryrefslogtreecommitdiff
path: root/src/ipa/rpi/cam_helper/md_parser_smia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/rpi/cam_helper/md_parser_smia.cpp')
-rw-r--r--src/ipa/rpi/cam_helper/md_parser_smia.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ipa/rpi/cam_helper/md_parser_smia.cpp b/src/ipa/rpi/cam_helper/md_parser_smia.cpp
index 210787ed..c7bdcf94 100644
--- a/src/ipa/rpi/cam_helper/md_parser_smia.cpp
+++ b/src/ipa/rpi/cam_helper/md_parser_smia.cpp
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2019-2021, Raspberry Pi Ltd
*
- * md_parser_smia.cpp - SMIA specification based embedded data parser
+ * SMIA specification based embedded data parser
*/
#include <libcamera/base/log.h>
@@ -86,10 +86,13 @@ MdParserSmia::ParseStatus MdParserSmia::findRegs(libcamera::Span<const uint8_t>
while (1) {
int tag = buffer[currentOffset++];
- if ((bitsPerPixel_ == 10 &&
- (currentOffset + 1 - currentLineStart) % 5 == 0) ||
- (bitsPerPixel_ == 12 &&
- (currentOffset + 1 - currentLineStart) % 3 == 0)) {
+ /* Non-dummy bytes come in even-sized blocks: skip can only ever follow tag */
+ while ((bitsPerPixel_ == 10 &&
+ (currentOffset + 1 - currentLineStart) % 5 == 0) ||
+ (bitsPerPixel_ == 12 &&
+ (currentOffset + 1 - currentLineStart) % 3 == 0) ||
+ (bitsPerPixel_ == 14 &&
+ (currentOffset - currentLineStart) % 7 >= 4)) {
if (buffer[currentOffset++] != RegSkip)
return BadDummy;
}