A method for encoding and decoding a z-order curve based on a multi-order value lookup table

By using a multi-order value lookup table method, the encoding and decoding process of the Z-order curve is processed in segments, which solves the problem of high lookup count caused by independent processing of each dimension in the existing technology, and achieves a more efficient encoding and decoding rate.

CN119829692BActive Publication Date: 2025-10-21KUNMING UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510027864.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-10-21
Estimated Expiration
2045-01-08

AI Technical Summary

Technical Problem

In existing Z-order curve encoding and decoding methods, the lookup table for each dimension needs to be processed independently, resulting in a very high number of lookups and low efficiency.

Method used

The space is divided into grid space by using a multi-order value lookup table method. Encoding and decoding are performed by using a segmentation mechanism through multi-order encoded value lookup tables and multi-order decoded value lookup tables, and the mapping relationship between grid coordinates and encoded values ​​is processed segment by segment.

Benefits of technology

By using a multi-level value lookup table method, the number of lookups is reduced, and the efficiency of encoding and decoding is improved, especially in high-dimensional data processing where the speed is significantly increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829692B_ABST
    Figure CN119829692B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of Z order curve encoding and decoding method based on multi-order value lookup table, belong to spatial database index technical field.The present application includes multi-order encoding value lookup table construction stage: construct multi-order encoding value lookup table, for realizing the mapping between coordinate and encoding value;Encoding stage: each coordinate component is segmented, through iterative inquiry multi-order encoding value lookup table, the result of each segment is spliced to calculate Z order curve encoding;Multi-order decoding value lookup table construction stage: construct multi-order decoding value lookup table, for realizing the mapping between encoding value and coordinate;Decoding stage: to coordinate encoding value is segmented, through iterative inquiry multi-order decoding value lookup table and the result of each segment is spliced to calculate coordinate.The present application can convert step-by-step encoding and decoding operation into step-by-step encoding and decoding operation by introducing segmentation mechanism and other technologies, improve encoding and decoding efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a Z-order curve encoding and decoding method based on a multi-order value lookup table, and belongs to the technical field of spatial database indexing. Background Art

[0002] Space-filling curves (SFCs) are a dimensionality reduction technique that achieves a compact representation of multidimensional data by mapping it into a one-dimensional space. They can map high-dimensional data onto a one-dimensional curve while preserving locality in the multidimensional space, thereby transforming complex high-dimensional problems into relatively simple low-dimensional ones. Consequently, they are widely used in a variety of fields, including spatial data processing, data mining, image processing, cloud computing, deep learning, point cloud representation and compression, search engines, and set similarity queries.

[0003] The Hilbert curve and the Z-order curve (also known as the Morton curve) are two typical representatives of space-filling curves. In related research, Chen et al. conducted an in-depth theoretical analysis to explore the compactness, clustering, and correlation (3C) characteristics of point clouds under different space-filling curve scanning orders. The study revealed that compared with the Z-order curve and the Gray code curve, the Hilbert curve performed best in preserving spatial correlation. However, despite this, the Hilbert curve still has some disadvantages, such as complex mapping rules and low efficiency in spatial range queries. Therefore, in practical applications, the Z-order curve is more widely used. Summary of the Invention

[0004] The purpose of the present invention is to provide a Z-order curve encoding and decoding method based on a multi-order value lookup table, aiming to solve the technical problem that each dimension in the dimension-based lookup table used in the existing encoding and decoding methods needs to be processed independently, resulting in a very high number of lookup times.

[0005] To achieve the above object, the technical solution of the present invention is: a Z-order curve encoding and decoding method based on a multi-order value lookup table, comprising:

[0006] Step 1: In the multi-level code value lookup table construction phase, given the parameter g, design the code g-level code value lookup table EVLUTg to store the mapping from the g-level coordinate to its corresponding g-level code;

[0007] Step 2: In the encoding phase, given a two-dimensional position point P (X, Y) and the order n, calculate the Z-order curve encoding value Z corresponding to point P;

[0008] Step 3: In the multi-level decoding value lookup table construction phase, given the parameter g, a multi-level decoding value lookup table DVLUTg is designed to store the mapping of the g-level encoding value to its corresponding g-level coordinate;

[0009] Step 4: In the decoding stage, given the Z-order curve code value Z and the order n, calculate the X and Y coordinates corresponding to the code value Z.

[0010] The Step 1 is specifically as follows:

[0011] Step 1.1: The Z-order curve divides the entire space into four sub-regions. By connecting the four sub-regions from the upper left, upper right, lower left, and lower right, a first-order Z-order curve is obtained. By embedding a first-order Z-order curve in each sub-region, a second-order Z-order curve is obtained, thereby generating an arbitrary-order curve.

[0012] Step 1.2: A g-order space is a 2 g Row, 2 g A Z-order curve passes through each grid in the g-order space, and the mapping relationship between the grid coordinates and their serial numbers on the Z curve is established in sequence, thereby forming the g-order encoding lookup table EVLUTg. The construction steps are as follows:

[0013] A grid in the storage space is represented by a coordinate (X, Y), where X = (x1x2...x g )、Y=(y1y2...y g ), where x g and y g Represent the g-th order values ​​of X and Y respectively;

[0014] Step 1.2.1: Initialize the g-order encoding lookup table EVLUTg to a 2 g '2 g A two-dimensional array of;

[0015] Step 1.2.2: For the i∈[0,2 g -1] row, j∈[0,2 g -1] column grid (X=(x1x2...x g ),Y=(y1y2...y g ) i ), interleave its Y and X coordinates step by step to obtain the g-order code value y0x0y1x1...y corresponding to the grid g-1 x g-1 and stores the encoded value in EVLUTg[i][j].

[0016] The Step 2 is specifically as follows:

[0017] Step 2.1: In the initialization phase, a point P(X,Y) and an order n are given, where X = (x1x2......x n-1 x n )2,Y=(y1y2......yn-1 y n )2, where x n and y n Represent the n-th order values ​​of X and Y respectively, and assume that the initial Z-order curve encoding value Z=0;

[0018] Step 2.2: In the data segmentation stage, the segmentation mechanism is used to segment the coordinate components X and Y from right to left. Each segment includes g orders, thereby dividing the n-order coordinate components into Segments are divided and numbered from left to right. i represents the i-th segment of X, Y i Represents the i-th segment of Y, and the corresponding encoding value of the i-th segment is represented by Z i ;

[0019] Step 2.3: In the segment coding stage, specifically:

[0020] Step 2.3.1: i loops from 1 to Execute Step 2.3.2 and Step 2.3.3;

[0021] Step 2.3.2: Given X i and Y i , search the multi-level value lookup table EVLUTg and obtain the encoding value Z of the i-th segment i =EVLUT[X i ][Y i ];

[0022] Step 2.3.3: Set Z = Z << 2g | Z i ;

[0023] Step 2.3.4: The code value Z at the end of the loop is the desired code.

[0024] The Step 3 is specifically as follows:

[0025] Step 3.1: The Z-order curve divides the entire space into four sub-regions. By connecting the four sub-regions from the upper left, upper right, lower left, and lower right, a first-order Z-order curve is obtained. By embedding a first-order Z-order curve in each sub-region, a second-order Z-order curve is obtained, thereby generating an arbitrary-order curve.

[0026] Step 3.2: A g-order space is a 2 g Row, 2 g A Z-order curve passes through each grid in the g-order space, and a mapping relationship between the grid coordinates and their serial numbers on the Z curve is established in sequence, thereby forming a g-order decoding lookup table DVLUTg.

[0027] The Step 4 is specifically as follows:

[0028] Step 4.1: In the initialization phase, given a point P(X,Y) and an order n, where Z = (z1z2......z 2n-1 z 2n )2, where z 2n-1 z 2n To represent the value of Z at the nth order, set X = Y = 0;

[0029] Step 4.2: In the data segmentation stage, the segmentation mechanism is used to segment the code value Z from right to left. Each segment includes g levels, thereby dividing the n-level code value Z into Segments are divided and numbered from left to right. i represents the i segment of X, Y i Represents the i-th segment of Y, and the corresponding encoding value of the i-th segment is represented by Z i ;

[0030] Step 4.3: In the segment decoding stage, specifically:

[0031] Step 4.3.1: i loops from 1 to Execute Step 4.3.2 and Step 4.3.3;

[0032] Step 4.3.2: Given Z i , search the multi-order value lookup table DVLUTg and obtain the coordinate component X of the i-th segment i =DVLUTg[Z i ],Y i =DVLUTg[Z i ];

[0033] Step 4.3.3: Set X = X << 2g | X i ; Y=Y<<2g|Y i ;

[0034] Step 4.3.4: At the end of the loop, the X and Y coordinates are the desired coordinates.

[0035] The present invention provides a Z-order curve encoding and decoding method based on a multi-order value lookup table. This method, which uses a segmentation mechanism to divide data into segments of equal size, can convert step-by-step encoding and decoding operations into segment-by-segment encoding and decoding operations. Consequently, the Z-order curve encoding and decoding method based on a multi-order value lookup table has a relatively high rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 is a flow chart of the steps of the present invention;

[0037] Figure 2This is an example of a schematic diagram of a 4th-order Z-order curve provided by the present invention;

[0038] Figure 3 This is an example of a 4-order value lookup table provided by the present invention;

[0039] Figure 4 This is a comparison chart of the experimental results of the 4-order coding of the present invention;

[0040] Figure 5 This is a comparison chart of the experimental results of the 4th-order decoding of the present invention. DETAILED DESCRIPTION

[0041] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0042] Example 1: Figure 1 As shown, a Z-order curve encoding and decoding method based on a multi-order value lookup table includes a multi-order encoding value lookup table construction stage, an encoding stage, a multi-order decoding value lookup table construction stage, and a decoding stage, specifically:

[0043] Step 1: In the multi-level code value lookup table construction phase, given the parameter g, design the code g-level code value lookup table EVLUTg to store the mapping from the g-level coordinate to its corresponding g-level code;

[0044] Step 2: In the encoding phase, given a two-dimensional position point P (X, Y) and the order n, calculate the Z-order curve encoding value Z corresponding to point P;

[0045] Step 3: In the multi-level decoding value lookup table construction phase, given the parameter g, a multi-level decoding value lookup table DVLUTg is designed to store the mapping of the g-level encoding value to its corresponding g-level coordinate;

[0046] Step 4: In the decoding stage, given the Z-order curve code value Z and the order n, calculate the X and Y coordinates corresponding to the code value Z.

[0047] The multi-level code value lookup table construction phase is as follows:

[0048] Step 1.1: The Z-order curve divides the entire space into four sub-regions. By connecting the four sub-regions from the upper left, upper right, lower left, and lower right, a first-order Z-order curve is obtained. By embedding a first-order Z-order curve in each sub-region, a second-order Z-order curve is obtained, thereby generating an arbitrary-order curve.

[0049] Step 1.2: A g-order space is a 2 g Row, 2 gA Z-order curve passes through each grid in the g-order space, and the mapping relationship between the grid coordinates and their serial numbers on the Z curve is established in sequence, thereby forming the g-order encoding lookup table EVLUTg. The construction steps are as follows:

[0050] A grid in the storage space is represented by a coordinate (X, Y), where X = (x1x2...x g )、Y=(y1y2...y g ), where x g and y g Represent the g-th order values ​​of X and Y respectively;

[0051] In this embodiment, assuming that the parameter g=4, the order of the corresponding Z-order curve is n=10.

[0052] Step 1.2.1: Initialize the g-order encoding lookup table EVLUTg to a 2 g '2 g A two-dimensional array of;

[0053] Step 1.2.2: For the i∈[0,2 g -1] row, j∈[0,2 g -1] column grid (X=(x1x2...x g ),Y=(y1y2...y g ) i ), interleave its Y and X coordinates step by step to obtain the g-order code value y0x0y1x1...y corresponding to the grid g-1 x g-1 And store the encoded value into EVLUTg[i][j];

[0054] The coding phase is as follows:

[0055] Step 2.1: In the initialization phase, a point P(X, Y) and an order n are given, where X = (x1x2......x n-1 x n )2,Y=(y1y2......y n-1 y n )2, where x n and y n Represent the n-th order values ​​of X and Y respectively, and assume that the initial Z-order curve encoding value Z=0;

[0056] Specifically, given point P(145,220), order n=10, where X=(1001000111)2, Y=(1101110011)2, x3 represents the value of the 3rd order of X, y3 represents the value of the 3rd order of Y, and Z=0.

[0057] Step 2.2: In the data segmentation stage, the segmentation mechanism is used to segment the coordinate components X and Y from right to left. Each segment includes g orders, thereby dividing the n-order coordinate components into Segments are divided and numbered from left to right. i represents the i-th segment of X, Y i Represents the i-th segment of Y, and the corresponding encoding value of the i-th segment is represented by Z i ;

[0058] Specifically, given the parameter g = 4, p = (X, Y) = (1001000111, 1101110011) 2, both X and Y are divided into three segments. The first segment does not meet the g order, but because of the independence between the orders, it does not affect the encoding. Figure 2 This is a schematic diagram of the 4th-order Z-order curve. Figure 3 A lookup table for 4th order values;

[0059] X1 and Y1 are (10) and (11) respectively;

[0060] X2 and Y2 are (0100) and (0111) respectively;

[0061] X3 and Y3 are (0111) and (0011), respectively;

[0062] Step 2.3: In the segment coding stage, specifically:

[0063] Step 2.3.1: i loops from 1 to Execute Step 2.3.2 and Step 2.3.3;

[0064] Step 2.3.2: Given X i and Y i , search the multi-level value lookup table EVLUTg and obtain the encoding value Z of the i-th segment i =EVLUT[X i ][Y i ];

[0065] Step 2.3.3: Set Z = Z << 2g | Z i ;

[0066] Step 2.3.4: The code value Z at the end of the loop is the desired code;

[0067] Specifically, X1=(10)2 and Y1=(11)2 can be obtained by searching EVLUTg to obtain Z1=(1110)2, X2=(0100)2 and Y2=(0111)2 can be obtained by searching EVLUTg to obtain Z2=(00111010)2; X3=(0111)2 and Y3=(0011)2 can be obtained by searching EVLUTg to obtain Z3=(00111010)2, and finally Z1, Z2 and Z3 are merged to obtain Z=(Z1Z2 Z3)2=(1110001110100001)2.

[0068] The multi-stage decoding value lookup table construction stage is specifically as follows:

[0069] The Step 3 is specifically as follows:

[0070] Step 3.1: The Z-order curve divides the entire space into four sub-regions. By connecting the four sub-regions from the upper left, upper right, lower left, and lower right, a first-order Z-order curve is obtained. By embedding a first-order Z-order curve in each sub-region, a second-order Z-order curve is obtained, thereby generating an arbitrary-order curve.

[0071] Step 3.2: A g-order space is a 2 g Row, 2 g A Z-order curve passes through each grid in the g-order space, and a mapping relationship between the grid coordinates and their serial numbers on the Z curve is established in sequence, thereby forming a g-order decoding lookup table DVLUTg;

[0072] The decoding stage is as follows:

[0073] Step 4.1: In the initialization phase, given a point P(X,Y) and an order n, where Z = (z1z2......z 2n-1 z 2n )2, where z 2n-1 z 2n To represent the value of Z at the nth order, set X = Y = 0;

[0074] Specifically, the code Z of the given point P is Z=(11100011101000011111)2, the order n=10, z3 represents the value of the 3rd order of Z, X=0, Y=0.

[0075] Step 4.2: In the data segmentation stage, the segmentation mechanism is used to segment the code value Z from right to left. Each segment includes g levels, thereby dividing the n-level code value Z into Segments are divided and numbered from left to right. i represents the i segment of X, Y i Represents the i-th segment of Y, and the corresponding encoding value of the i-th segment is represented by Z i ;

[0076] Specifically, g=4, the coordinate code of p is Z=(11100011101000011111)2, and segmentation is performed according to the segmentation mechanism. The first segment does not meet the g order, but because of the independence between the orders, it does not affect the decoding. Z1=(1110)2, Z2=(00111010)2, Z3=(00011111)2;

[0077] Step 4.3: In the segment decoding stage, specifically:

[0078] Step 4.3.1: i loops from 1 to Execute Step 4.3.2 and Step 4.3.3;

[0079] Step 4.3.2: Given Z i , search the multi-order value lookup table DVLUTg and obtain the coordinate component X of the i-th segment i =DVLUTg[Z i ],Y i =DVLUTg[Z i ];

[0080] Step 4.3.3: Set X = X << 2g | X i ; Y=Y<<2g|Y i ;

[0081] Step 4.3.4: At the end of the loop, the X and Y coordinates are the desired coordinates.

[0082] Specifically, segment Z1 = (1110)2, by searching DVLUTg, the corresponding X1 = (10)2 and Y1 = (11)2 can be obtained. Iterative query, the second Z segment Z2 = (00111010)2, by searching DVLUTg, the corresponding X2 = (0111)2, Y2 = (0100)2 can be obtained. The last Z segment Z3 = (00011111)2, by searching DVLUTg, the corresponding X3 = (0011)2, Y3 = (0111)2 can be obtained. The coordinate components of the segment are merged to obtain the physical coordinates (1001000111, 1101110011)2.

[0083] The present invention is further illustrated by the following experimental results.

[0084] Experimental environment: The CPU is a 12th Gen Intel(R) Core(TM) i5-12500H with 16GB of RAM. The GPU is an NVIDIA GeForce RTX 3050 with 4GB of VR RAM. Microsoft Windows 10 64-bit is used as the operating system, and Microsoft Visual Studio C++ 2022 is used as the integrated development environment. CUDA Toolkit version 12 is used.

[0085] Experimental data: The present invention provides a discrete data set of 25 million coordinates (n=8, 16, 24, 32) and a parameter g of 4.

[0086] Experimental result analysis: The experiment is a comparison of the encoding and decoding time of the Z-order curve encoding and decoding method based on the multi-order value lookup table and the bit interleaving method as the order changes. Figure 4 Figure 5 As shown in the figure. The coding efficiency comparison is as follows Figure 4 As shown in the figure, this method is more efficient than other methods. For example, when n=8, it takes only 296.192ms to encode the coordinate points of the entire data set, which is nearly 5 times more efficient than the bit interleaved encoding algorithm. Figure 5 As shown, this method is more efficient than other methods. For example, when n=8, it takes only 284.68ms to decode all the coded values, which is nearly 6 times more efficient than the bit-interleaved decoding algorithm.

[0087] The above describes the specific embodiments of the present invention in detail with reference to the accompanying drawings. The present invention is not limited to the above embodiments. Various changes can be made within the knowledge of ordinary technicians in this field without departing from the purpose of the present invention.

Claims

1. A multi-level value lookup table based on Z A step curve encoding and decoding method, characterized in that: Step 1: In the multi-level coding value lookup table construction phase, given parameters g , design coding g Step code value lookup table EVLUTg, storage g Order coordinates to their corresponding g Mapping of order codes; Step 2: In the encoding stage, given a two-dimensional position point P ( X , Y ) and order n , calculation point P Corresponding Z Step curve code value Z ; Step 3: In the multi-stage decoding value lookup table construction phase, given parameters g , design a multi-level decoding value lookup table DVLUTg, storage g rank encoding value to its corresponding g Mapping of order coordinates; Step 4: In the decoding stage, given Z Step curve code value Z and order n , calculate the encoding value Z Corresponding X and Y coordinate; The Step 2 is specifically as follows: Step 2.1: In the initialization phase, a given point P(X,Y) and order n ,in, ,in x n and y n Respectively X and Y No. n The value of the order, set the initial Z The order curve encoding value Z=0; Step 2.2: In the data segmentation stage, use the segmentation mechanism to divide the coordinate components X and Y Divide into segments from right to left, each segment includes g stage, thus n The order coordinate components are divided into ⌈ n / g ⌉ segments, and number the divided segments from left to right. X i express X No. i part, Y i express Y No. i Paragraph, corresponding i The coded value of the segment is represented as Z i ; Step 2.3: In the segment coding stage, specifically: Step 2.3.1: i From 1 to Execute Step 2.3.2 and Step 2.3.3; Step 2.3.2: Given X i and Y i , search the multi-level value lookup table EVLUTg, and get the i The encoding value of the segment Z i =EVLUT [ X i ][ Y i ]; Step 2.3.3: Settings Z = Z <<2g | Z i ; Step 2.3.4: Code value at the end of the loop Z Encode the requested code; The Step 4 is specifically as follows: Step 4.1: In the initialization phase, given point P(X,Y) and order n ,in, ,in, express Z No. n The value of the order, set X = Y =0; Step 4.2: In the data segmentation stage, use the segmentation mechanism to encode the value Z Divide into segments from right to left, each segment includes g stage, thus n Rank code value Z Divided into ⌈ n / g ⌉ segments, and number the divided segments from left to right. X i express X of i part, Y i express Y No. i Paragraph, corresponding i The coded value of the segment is represented as Z i ; Step 4.3: In the segment decoding stage, specifically: Step 4.3.1: i From 1 to Execute Step 4.3.2 and Step 4.3.3; Step 4.3.2: Given Z i , search the multi-level value lookup table DVLUTg, and get the i Coordinate components of the segment X i =DVLUTg [ Z i ], Y i =DVLUTg [ Z i ]; Step 4.3.3: Settings X = X <<2g | X i ; Y = Y <<2g|Y i ; Step 4.3.4: At the end of the loop X and Y The coordinates you want.

2. The method according to claim 1, wherein the multi-level value lookup table Z The step curve encoding and decoding method is characterized in that The Step 1 is specifically as follows: Step 1.1: Z The first-order curve divides the entire space into four sub-areas, and the first-order curve is obtained by connecting the four sub-areas from the upper left, upper right, lower left and lower right in sequence. Z order curve; by embedding a first-order Z order curve, obtain the second order Z Order curve, from which any order curve is generated; Step 1.2: One g The order space is one OK, Grid space for columns, one Z Step curve passes through g For each grid in the order space, the grid coordinates and their Z The mapping relationship between the serial numbers on the curve is thus formed g The construction steps of the EVLUTg are as follows: A grid in the storage space uses a coordinate ( X , Y ) indicates that 、 ,in, x g and y g Respectively X and Y No. g The value of the order; Step 1.2.1: Initialization g The order code lookup table EVLUTg is a A two-dimensional array of; Step 1.2.2: g In the order space Row, No. Column Grid , staggered step by step Y and X Get the coordinates of the grid g Rank code value , and store the encoded value in EVLUTg[ i ][ j ].

3. The method according to claim 1 Z The step curve encoding and decoding method is characterized in that The Step 3 is specifically as follows: Step 3.1: Z The first-order curve divides the entire space into four sub-areas, and the first-order curve is obtained by connecting the four sub-areas from the upper left, upper right, lower left and lower right in sequence. Z order curve; by embedding a first-order Z order curve, obtain the second order Z Order curve, from which any order curve is generated; Step 3.2: One g The order space is one OK, Grid space for columns, one Z Step curve passes through g For each grid in the order space, the grid coordinates and their Z The mapping relationship between the serial numbers on the curve is thus formed g The first-order decoding lookup table DVLUTg.

Citation Information

Patent Citations

  • Hilbert curve encoding and decoding method based on state view

    CN110457317A

  • Top-K trajectory similarity query method for privacy protection

    CN116415079A