Skip to content

Fix mixed value type decoding in sds-convert - #304

Open
ricardoasouz wants to merge 1 commit into
ARM-software:mainfrom
ricardoasouz:fix/mixed-value-type-decoding
Open

Fix mixed value type decoding in sds-convert#304
ricardoasouz wants to merge 1 commit into
ARM-software:mainfrom
ricardoasouz:fix/mixed-value-type-decoding

Conversation

@ricardoasouz

Copy link
Copy Markdown

Fixes #271

The original IndexError reported in #271 is no longer reproducible on the current main branch, but the remaining mixed-type conversion issue persists.

When a record contains values with different sizes, such as:

  • double
  • uint32_t
  • uint32_t
  • uint32_t
  • uint32_t

The current decoder processes each channel independently, assuming a uniform stride. This causes the byte stream to become misaligned across channels.

For example, the SDS data referenced in #271 decodes correctly as:

For example, the SDS data referenced in #271 decodes correctly as:

confidence=0.7162540555000305
x=143
y=9
w=40
h=55

while the current converter produces:

confidence=0.7162540555000305
x=1072098189
y=143
w=9
h=40

This change decodes each complete sample using the combined metadata format, then distributes the decoded values to the corresponding channels. Standard-size packing is used without native alignment padding.

Validation:

  • Reproduced the incorrect conversion using the SDS-Examples data referenced in [Bug]: sds-convert does not properly handle different value types #271.
  • Verified the corrected output against an independent struct-based decode.
  • Added regression coverage for mixed-size value types.
  • Added compatibility coverage for equal-size value types.
  • Added coverage for per-channel scale and offset handling.
  • All 3 unit tests pass with unittest discovery.

Signed-off-by: Ricardo Alves de Souza <ricardoasouz@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: sds-convert does not properly handle different value types

1 participant