SIMD Character Counting for Variable-Length Encoded Data

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Determining the validity and character count in data encoded in variable-length formats, such as CESU-8, is inefficient and resource-intensive, especially when errors may be present due to improper encoding or transmission, and existing techniques like Lemire's are limited to two-byte sequences and do not handle surrogate pairs effectively.

Innovation Solution

Utilizing SIMD techniques with lookup tables to efficiently validate encoded data by analyzing sequences of bytes, identifying errors through combined lookup results, and counting continuation bytes to determine the number of characters, which can handle surrogate pairs and multiple-byte sequences efficiently.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If variable-length encoding formats (such as CESU-8) are used to support diverse character sets, then the adaptability and character set coverage are improved, but the complexity of determining character count and validating encoding increases

Engineering Contradiction:
Improvecharacter set coverageVSAvoidencoding validation complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent segments the encoding validation process into distinct lookup tables for different byte sequence patterns. Each lookup table handles specific encoding scenarios (1-byte, 2-byte, 3-byte, 4-byte sequences), breaking down the complex validation task into manageable, pre-computed segments that can be quickly referenced without full decoding.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary action by pre-computing and storing valid encoding patterns in lookup tables before runtime validation. These tables contain pre-analyzed byte sequence patterns and their corresponding validity status, allowing the system to quickly validate encoded data without performing complex real-time analysis of each byte sequence.

Inventive Principle:
Principle #10Preliminary action

2Measurement precision

If full decoding is performed to determine character count in variable-length formats, then the measurement precision of character count is improved, but the processing time and resource consumption increase

Engineering Contradiction:
Improvecharacter count accuracyVSAvoidprocessing time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent extracts only the necessary information for character counting from the encoded data without performing full decoding. By using lookup tables that map byte sequence patterns directly to character count contributions, the system extracts character count information efficiently without needing to fully interpret or decode the entire data set.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent substitutes the mechanical process of sequential decoding with a table-lookup-based validation and counting mechanism. Instead of mechanically processing each byte through decoding logic, the system uses pre-computed lookup tables to rapidly determine character counts, replacing complex computational mechanics with simpler memory access operations.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

3Reliability

If encoding validation is performed to ensure data integrity, then the reliability of processed data is improved, but the resource intensity and processing overhead increase

Engineering Contradiction:
Improvedata encoding validityVSAvoidprocessing resource consumption
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent performs preliminary action by pre-computing and storing valid encoding patterns in lookup tables before runtime validation. These tables contain pre-analyzed byte sequence patterns and their corresponding validity status, allowing the system to quickly validate encoded data without performing complex real-time analysis of each byte sequence.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent substitutes the mechanical process of sequential decoding with a table-lookup-based validation and counting mechanism. Instead of mechanically processing each byte through decoding logic, the system uses pre-computed lookup tables to rapidly determine character counts, replacing complex computational mechanics with simpler memory access operations.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

4Device complexity

If existing validation techniques (such as Lemire's) are used, then the validation process is simplified, but the handling of surrogate pairs and multi-byte sequences is limited

Engineering Contradiction:
Improvevalidation process simplicityVSAvoidsurrogate pair handling capability
Core Design Contradiction:
Device complexityVSAdaptability or versatility

Solution Approach 1:

The patent implements universality by designing a lookup table system that handles multiple encoding scenarios within a unified framework. The same lookup table mechanism processes 1-byte sequences, 2-byte sequences, 3-byte sequences, 4-byte sequences, and surrogate pairs, making the validation system versatile without increasing operational complexity.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The patent segments the encoding validation process into distinct lookup tables for different byte sequence patterns. Each lookup table handles specific encoding scenarios (1-byte, 2-byte, 3-byte, 4-byte sequences), breaking down the complex validation task into manageable, pre-computed segments that can be quickly referenced without full decoding.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS12425046B2Efficient character counting for variable length encoding formats
Publication Date: 2025.09.23 SAP SE
  • US12425046B2 patent drawing
  • US12425046B2 patent drawing
  • US12425046B2 patent drawing

AI summary

Technologies and solutions are also provided for determining a number of characters in encoded data, particularly for encoding formats that have variable byte lengths. Bytes in the encoding format can have different types, including at least one type that represents a continuation byte. That is, rather than having all data for a character being in a single byte, the data is encoded using two or more bytes. The number of continuation bytes can be counted and subtracted from a total number of bytes in a data set to determine the number of characters in the data set. Optionally, the validity of the data set with respect to an encoding format can be determined prior to, or concurrently with, determining a number of characters in the data set. SIMD techniques can be used with the character counting/validation processes to improve their performance.