Sensor digital output data compression method

By dynamically truncating the effective data bit width and scaling factor of the sensor to compress the sensor's digital output data, the problems of insufficient memory and measurement error in sensor chips under high dynamic range and high sampling rate are solved, achieving a reduction in data volume and an improvement in measurement accuracy.

CN121770530APending Publication Date: 2026-03-31LEVELEK TECH (SUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-29
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Under high dynamic range and high sampling rate conditions, the FIFO memory capacity of the sensor chip is insufficient, leading to data overflow and loss. At the same time, the automatic gain control algorithm has problems with time delay and measurement result error.

Method used

By dynamically truncating the effective data bit width and scaling factor of the sensor, the digital output data of the sensor is compressed, ensuring that the amount of data is reduced without reducing the dynamic range, and the measurement results are highly accurate.

Benefits of technology

This reduces the data storage requirements of the sensor chip, improves the buffering capacity of the FIFO memory, reduces manufacturing costs, and enhances the accuracy and real-time performance of measurement results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121770530A_ABST
    Figure CN121770530A_ABST
Patent Text Reader

Abstract

The invention discloses a sensor digital output data compression method, and relates to the technical field of sensor chip design, and the method comprises the steps: obtaining the original digital output data of a sensor; determining a data interception bit width N and a bit width K of a scaling factor SF based on the bit width M of the original digital output data in combination with an error requirement of a digital output dynamic range of the sensor and a data volume compression requirement; intercepting N-bit data from the original digital output data to obtain effective data segments; determining the value of a scaling factor (SF) according to the position of the effective data segment in the original digital output data; and combining the effective data segment and the scaling factor SF to obtain compressed data output by the sensor. The method maintains an extremely high dynamic range while significantly reducing the amount of data by compressing the bit width of the original digital output data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of sensor chip design technology, and in particular to a method for compressing digital output data of a sensor. Background Technology

[0002] Sensor chips are used to detect, amplify, and convert external physical signals into digital signals for output. However, because external physical signals often change rapidly and have a large dynamic range, some applications require sensors with fast sampling rates and extremely high dynamic ranges. For example, ambient light sensors convert ambient light intensity into digital signals. In some system applications, ambient light sensors need a detection range from 1 mlux to 100 klux, or an ultra-high dynamic range of 160 dB. To cover this dynamic range, the digital output of the ambient light sensor needs a minimum bit width of 27 bits. Simultaneously, some applications require ambient light sensors to detect the flicker frequency of ambient light, necessitating a sampling rate of 2 kHz or higher. The data is temporarily stored in a FIFO (First In First Out) memory on the chip. The system MCU (microprocessor) reads the data from the FIFO periodically for subsequent algorithm analysis. During this process, it is crucial to ensure that the sensor chip's FIFO memory does not become full; otherwise, data overflow and loss will occur.

[0003] Extremely high dynamic range typically relies on high bit width data in the sensor's digital output, and fast sampling rates amplify the data volume pressure brought about by high bit width. The larger the bit width of the sensor's digital output, the larger the amount of data output per unit time, and the larger the required memory capacity. However, the capacity of the FIFO memory on the sensor chip is directly related to the chip area and cost; the larger the capacity, the larger the chip area and cost. To reduce the contradiction between the sensor's output data volume and maintaining extremely high dynamic range, the widely used Automatic Gain Control (AGC) algorithm utilizes the output data of the sensor's previous measurement to evaluate the signal strength range and automatically adjusts the gain used in the next measurement. This method allows the sensor to simultaneously output the truncated bit width and the corresponding gain, which can reduce the output data volume and achieve high dynamic range.

[0004] However, since the gain in the automatic gain control algorithm is estimated based on the data from the previous measurement, this inevitably introduces a certain time delay. If the external signal changes rapidly, the gain estimated using the previous data will no longer be suitable for the subsequent measurement, thus causing errors in the measurement results. Moreover, the accuracy of the output data of this method also depends on the accuracy of the previous data. If the previous data is incorrect, all subsequent data will be incorrect. Therefore, the reliability of the output data of this method is insufficient. Summary of the Invention

[0005] This application addresses the aforementioned problems and technical requirements by proposing a method for compressing sensor digital output data. The technical solution of this application is as follows: A method for compressing digital output data from a sensor includes the following steps: Acquire the raw digital output data of the sensor, wherein the bit width of the raw digital output data is M; Based on the bit width M of the original digital output data, combined with the error requirements of the dynamic range of the sensor digital output and the data compression requirements, the bit width N of the data truncation and the bit width K of the scaling factor SF are determined. The scaling factor SF indicates the number of data bits to be discarded from the original digital output data. M, N, and K are all positive integer parameters and M > N + K. N data bits are extracted from the original digital output data to obtain the valid data segment D[(N-1):0]; Based on the position of the valid data segment D[(N-1):0] in the original digital output data, determine the value of the scaling factor SF corresponding to the valid data segment D[(N-1):0]. The effective data segment D[(N-1):0] and the scaling factor SF are combined to obtain the compressed data output by the sensor. The compressed data is within the dynamic range of the sensor's digital output, and the bit width of the compressed data is N+K.

[0006] A further technical solution is to determine the maximum dynamic range error E of the compressed data relative to the original digital output data based on the data truncation bit width N; and to determine the data compression ratio P of the compressed data based on the bit width M of the digital output data, the data truncation bit width N, and the bit width K of the scaling factor SF. When the maximum value of the dynamic range error E is not higher than the error threshold and the data compression ratio P is not lower than the data compression threshold, the data truncation bit width N and the scaling factor SF bit width K are determined according to the constraint conditions of the dynamic range of the sensor digital output; the constraint conditions are used to limit the dynamic range of the compressed data to equivalently express the original digital output data.

[0007] A further technical solution is that the constraint condition for the dynamic range of the sensor's digital output is: .

[0008] Its further technical solution is to determine the maximum value of the dynamic range error. .

[0009] Its further technical solution is to increase the data compression ratio. .

[0010] The further technical solution is that determining the valid data segment D[(N-1):0] includes: Identify the highest non-zero bit among the first MN data of the original digital output data, and determine the valid data segment D[(N-1):0] based on the highest non-zero bit.

[0011] A further technical solution is that determining the valid data segment D[(N-1):0] based on the highest non-zero bit includes: If the first MN data of the original digital output data has a highest non-zero bit, N consecutive data bits are truncated from the position of the highest non-zero bit as the starting position, and used as the N consecutive data bits of the valid data segment D[(N-1):0]; otherwise, the last N data bits of the original digital output data are used as the N consecutive data bits of the valid data segment D[(N-1):0].

[0012] A further technical solution is to determine the bit index of the lowest data bit of the effective data segment D[(N-1):0] in the original digital output data as the value of the scaling factor SF.

[0013] Its further technical solution is to compress the data value. And K>1.

[0014] The beneficial technical effects of this application are: This application proposes a sensor digital output data compression method that reduces the amount of data in the sensor's digital output by compressing the bit width of the original digital output data. This allows a sensor chip with the same FIFO memory size to hold more sampled data. Furthermore, the FIFO memory can provide a longer buffer time without overflowing, effectively improving the performance of the sensor chip while reducing its manufacturing cost.

[0015] Traditional fixed-bit-width truncated data compression methods can represent a maximum signal strength that depends on the length of the fixed bit width. When the input signal strength exceeds the maximum signal strength, the data is forcibly truncated, leading to data saturation and loss of high dynamic range information. To solve this problem, this application dynamically selects effective data bits based on the actual strength of the original signal and records the signal magnitude through a scaling factor. This breaks the limitation of traditional fixed-bit-width truncated data compression methods on the maximum representable signal, enabling coverage of a larger signal strength range with a limited number of bits. It effectively avoids the saturation problem caused by insufficient bits, achieving an effective balance between bit width reduction and ultra-large dynamic range and low distortion. It can maintain an extremely high dynamic range while reducing the amount of digital output data from the sensor.

[0016] Furthermore, since the method of this application dynamically extracts the valid bits of the current data in real time, it does not require estimation based on historical data. The entire process relies solely on the current measurement data, resulting in high real-time performance and effectively solving the time delay problem inherent in conventional automatic gain control algorithms. This makes it particularly suitable for high-frequency sampling and rapidly changing signal scenarios. Additionally, because the method of this application does not depend on previous measurement data, measurement errors in historical data will not affect the current measurement results, leading to high accuracy. Attached Figure Description

[0017] Figure 1 This is a flowchart of a method for compressing digital output data from sensors.

[0018] Figure 2 This is a schematic diagram of data compression in an example. Detailed Implementation

[0019] The specific embodiments of this application will be further described below with reference to the accompanying drawings.

[0020] This application proposes a method for compressing sensor digital output data; please refer to [reference needed]. Figure 1 The flowchart shown illustrates the specific steps of this method: Step 1: Acquire the raw digital output data of the sensor in real time. The bit width of the raw digital output data is M.

[0021] Step 2: Based on the bit width M of the original digital output data, combined with the error requirements of the dynamic range of the sensor's digital output and the data compression requirements, determine the data truncation bit width N and the bit width K of the scaling factor SF. The scaling factor SF indicates the number of data bits to be discarded from the original digital output data; M, N, and K are all positive integer parameters and M > N + K.

[0022] Because the real-time acquired raw digital output data has a high bit width and a large data volume, to reduce the data storage footprint, it is first necessary to reduce the output data volume to decrease the FIFO memory usage. Compressing the bit width of the raw digital output data can effectively reduce the data volume, but directly truncating the raw digital output data leads to a reduction in the dynamic range of the data output, resulting in the inability to output high-order signal information and causing information loss. Therefore, a scaling factor is introduced to record the offset of the truncated data bits relative to the raw digital output data (i.e., the number of data bits discarded), and the scaling factor is used to restore the magnitude of the original signal.

[0023] Because different sensor types are used in different application scenarios, their required dynamic range for data output varies, and the amount of data to be compressed also differs depending on the design requirements of different chips. Therefore, it is necessary to flexibly set the truncation bit width N and the bit width K of the scaling factor SF according to the actual application. In one embodiment, the specific method for determining the data truncation bit width N and the bit width K of the scaling factor SF is as follows: (1) Determine the maximum dynamic range error E of the compressed data relative to the original digital output data based on the data truncation bit width N.

[0024] For compressed data composed of a bit width N and a scaling factor SF, the maximum value it can represent is... The bit width is Maximum value of binary numbers Therefore, the maximum dynamic range error of 2K-1+N bits can be expressed using K+N bits. .

[0025] (2) Determine the data volume compression ratio P of the compressed data based on the bit width M of the digital output data, the data truncation bit width N, and the bit width K of the scaling factor SF.

[0026] The calculation method for the data compression ratio can be selected according to specific scenario requirements, such as compression factor, reduction in data size after compression, and compression ratio per unit time. In one embodiment, the data compression ratio is determined by calculating the ratio of the compressed data bit width (K+N) to the original digital output data bit width (M). .

[0027] (3) When the maximum value of the dynamic range error E is not higher than the error threshold and the data compression ratio P is not lower than the data compression threshold, the data truncation bit width N and the bit width of the scaling factor SF are determined according to the constraint conditions of the dynamic range of the sensor digital output. The constraint conditions are used to limit the dynamic range of the compressed data to equivalently express the original digital output data.

[0028] Set the data volume compression threshold and the error threshold of the dynamic range according to the actual application requirements. On the premise of meeting this basic requirement, it is also necessary to ensure that the bit width (K + N) covers the required digital output dynamic range so that the compressed data can equivalently represent the dynamic range of the original digital output data. Use constraint conditions to limit. Specifically, the constraint conditions for the sensor digital output dynamic range are as follows: And K > 1... The bit width K of the scaling factor SF and the truncated bit width N can be comprehensively selected according to the constraint conditions, the data volume compression threshold, and the error threshold of the dynamic range, combined with to comprehensively select the truncated bit width N and the bit width K of the scaling factor SF.

[0029] When At this time, the bit width decreases and the data volume decreases, and only then can the compression effect be ensured. So is the basic principle for the selection of N and K. Under this basic principle, various combinations of N and K that meet the constraint conditions can be selected. In actual applications, in order to make the compression effect as large as possible, generally select the combination with the smallest sum of N + K that meets the conditions as the final values of N and K. Moreover, when K = 1, which contradicts N + 1 < M, so the value of K needs to be greater than 1.

[0030] Step 3: Intercept N bits of data from the original digital output data to obtain the valid data segment D[(N - 1):0].

[0031] Considering that the importance of the information contained in the original digital output data is closely related to the data bits, the signal at the higher position has a higher intensity and greater information content than the signal at the lower position. And in the binary digital output data, a non-zero data bit indicates that the data bit contains information. Therefore, the specific method for determining the valid data segment D[(N - 1):0] is as follows: Identify the highest non-zero bit in the first M - N data of the original digital output data, and determine the valid data segment D[(N - 1):0] based on the highest non-zero bit. Among them, in order to ensure that enough valid data can be intercepted, at least N data in the original digital output data need to be retained, and only the first M - N data bits need to be identified when identifying non-zero bits.

[0032] Furthermore, determining the valid data segment D[(N - 1):0] based on the highest non-zero bit includes: When there is a highest non-zero bit in the first M - N data of the original digital output data, intercept N consecutive bits of data backward starting from the position of the highest non-zero bit as the N consecutive bits of data of the valid data segment D[(N - 1):0]; otherwise, use the last N data of the original digital output data as the N consecutive bits of data of the valid data segment D[(N - 1):0].

[0033] Step 4, determine the value of the scaling factor SF corresponding to the valid data segment D[(N - 1):0] according to the position of the valid data segment D[(N - 1):0] in the original digital output data.

[0034] After obtaining the valid data segment, the number of low data bits to be discarded from the original digital output data can be determined, and then the value of the scaling factor SF can be determined. Specifically, the bit index of the lowest data bit of the valid data segment D[(N - 1):0] in the original digital output data is the value of the scaling factor SF.

[0035] Step 5, combine the valid data segment D[(N - 1):0] and the scaling factor SF to obtain the compressed data output by the sensor. The compressed data is within the dynamic range of the sensor digital output, and the bit width of the compressed data is N + K.

[0036] Finally, the N + K-bit compressed data can be used to equivalently represent the original digital output data. Since the data bit width N + K < M, the amount of output data is reduced. Decoding the compressed data can obtain the data value of the compressed data .

[0037] Taking an ambient light sensor as an example to illustrate the specific process of data compression by the method of the present application. The bit width of the original digital output data is 27 bits, denoted by b[26:0]. The data compression target is to only output 16-bit data, the intercepted bit width N = 12, the bit width K of the scaling factor SF = 4, and the 27-bit dynamic range needs to be maintained. At this time, the data volume can be reduced by 40.7%.

[0038] The method of the present application starts viewing from the MSB (the most significant bit, that is, b

[26] ) of the original digital output data. If the MSB bit is 1, stop searching, and then intercept the 12 bits below the MSB as the valid data segment, denoted as D[11:0], that is, b[26:15] as the valid data segment, and discard the remaining low data bits. At the same time, because 15 low data bits are discarded, at this time, use a 4-bit width to record the scaling factor SF[3:0] = 15, and the scaling amount of the final valid data segment is . If the MSB bit is 0, discard the MSB bit, continue to view the MSB - 1 bit, and stop searching when the MSB - 1 bit is 1. Intercept the 12 bits below the MSB - 1 as the valid data segment, denoted as D[11:0], that is, b[25:14] as the valid data segment, and discard the remaining low data bits. At the same time, because 14 low data bits are discarded, at this time, use a 4-bit width to record the scaling factor SF[3:0] = 14, and the scaling amount of the final valid data segment is . If the MSB - 1 bit is 0, discard the MSB - 1 bit, continue to view the MSB - 2 bit, and so on.

[0039] When MSB-16 is still 0, the search stops, and b[11:0] is recorded as the valid data segment D[11:0]. At this point, the remaining low-significant bits are not discarded, and the scaling factor SF[3:0] = 0, meaning the scaling of the valid data segment is... .

[0040] According to the above data compression process Figure 2 The original digital output data shown is compressed, and its highest non-zero bit is b

[23] . The effective data segment D[11:0]=b[23:12]=101100010110 (binary)=2838 (decimal). The remaining 12 low data bits are discarded, and the scaling factor SF[3:0]=1100 (binary)=12 (decimal). Then D[11:0] and SF[3:0] constitute the compressed data. The data value of the compressed data .

[0041] Ultimately, a dynamic range of 27 bits is expressed using a total of 16 bits of data, D[11:0] and SF[3:0]. A specific example is used to further verify the accuracy of the compressed data obtained by the method of this application: If the original digital output data is 1 (the smallest non-zero value), the data finally decoded using the method of this application is SF[3:0]=0, D[11:0]=1, that is... The data output is equal to the original digital output data.

[0042] If all 27 bits of the original digital output data are 1 (the maximum value), its data value is The data finally decoded using the method of this application is SF[3:0]=15, D[11:0]=4095, that is... Compared with the original digital output data, the error is only (1-134184960 / 134217727) x 100% = 0.0244%, which usually fully meets the accuracy requirements of practical applications.

[0043] The above descriptions are merely preferred embodiments of this application, and this application is not limited to the above embodiments. It is understood that other improvements and variations that can be directly derived or conceived by those skilled in the art without departing from the spirit and concept of this application should be considered to be included within the protection scope of this application.

Claims

1. A sensor digital output data compression method, characterized by, The sensor digital output data compression method comprises: obtaining original digital output data of a sensor, the original digital output data having a bit width of M; determining a data clipping bit width N and a bit width K of a scaling factor SF based on the bit width M of the original digital output data, in combination with an error requirement of a dynamic range of sensor digital output and a data volume compression requirement, the scaling factor SF indicating a number of data bits to be discarded from the original digital output data; M, N and K are all positive integer parameters and M>N+K; clipping N-bit data from the original digital output data to obtain an effective data segment D[(N-1):0]; determining a value of the scaling factor SF corresponding to the effective data segment D[(N-1):0] according to a position of the effective data segment D[(N-1):0] in the original digital output data; combining the effective data segment D[(N-1):0] and the scaling factor SF to obtain compressed data output by the sensor, the compressed data being within a dynamic range of sensor digital output and having a bit width of N+K.

2. The sensor digital output data compression method of claim 1, wherein, determining a maximum dynamic range error E of the compressed data relative to the original digital output data according to the data clipping bit width N; determining a data volume compression ratio P of the compressed data according to the bit width M of the digital output data, the data clipping bit width N and the bit width K of the scaling factor SF; when the maximum dynamic range error E is not higher than an error threshold and the data volume compression ratio P is not lower than a data volume compression threshold, determining the data clipping bit width N and the bit width K of the scaling factor SF according to a constraint condition of the dynamic range of sensor digital output; the constraint condition is used to limit a dynamic range of the compressed data equivalent to the original digital output data.

3. The sensor digital output data compression method of claim 2, wherein, The constraint on the dynamic range of the sensor digital output is: and K >

1.

4. The sensor digital output data compression method of claim 2, wherein, said dynamic range error maximum .

5. The sensor digital output data compression method of claim 2, wherein, The data volume compression ratio .

6. The sensor digital output data compression method of claim 1, wherein, determining the effective data segment D[(N-1):0] comprises: identifying a highest non-zero bit in the first M-N data of the original digital output data and determining the effective data segment D[(N-1):0] based on the highest non-zero bit.

7. The sensor digital output data compression method of claim 5, wherein, determining the effective data segment D[(N-1):0] based on the highest non-zero bit comprises: when the highest non-zero bit exists in the first M-N data of the original digital output data, clipping N-bit continuous data starting from a position of the highest non-zero bit as N-bit continuous data of the effective data segment D[(N-1):0]; otherwise, taking the last N data of the original digital output data as N-bit continuous data of the effective data segment D[(N-1):0].

8. The sensor digital output data compression method of claim 1, wherein, determining a bit index of a lowest data bit of the effective data segment D[(N-1):0] in the original digital output data as the value of the scaling factor SF.

9. The sensor digital output data compression method of claim 1, wherein, data values of the compressed data .