A method for generating image compression and decompression test cases based on depth buffer algorithm
Through image data encoding and random generation methods based on depth buffer algorithm, the problem of difficult to generate test cases in the prior art that can specify the compression size of image data is solved, and efficient image compression algorithm verification and design coverage are achieved.
Patent Information
- Application Number
- CN202411465835.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-10-21
AI Technical Summary
The prior art is difficult to efficiently generate decompression/compression test cases that can specify the compression size of image data, resulting in difficulty in designing and verifying image compression algorithms.
Based on the depth buffer algorithm, the compression and decompression test cases are generated by dividing the image data into 7 parts (N0, N1, N2, N3, N4, N5, N6), and random generation and predicted value calculation methods are used to generate compression and decompression test cases to ensure the test cases. randomness and verification coverage.
It realizes efficient generation of test cases that can specify the compression size of image data, enriches verification scenarios, discovers defects and problems in design implementation in advance, and improves the verification efficiency of image compression algorithms.
Smart Images

Figure CN118972607B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing, and in particular to a method for generating image compression and decompression test cases based on a depth buffer algorithm. Background Art
[0002] Usually, image data transmission consumes a lot of bandwidth. Unprocessed image data transmission is both inefficient and power-intensive. Lossless image compression is a technology that converts the original image data into a format with a smaller storage unit for storage and transmission after certain specific processing, and then restores it after specific processing. The depth buffer compression algorithm based on the Anchor-Delta algorithm can compress 128B / 256B original image data into different sizes such as 32B / 64B / 94B… / 224B. Because there is a lot of uncertainty in the scenario of whether image data can be compressed, it is usually impossible to know in advance whether the generated test case is compressible data and the size to which the test case can be compressed when the compression module is designed and verified. This brings certain difficulties to the verification of the design and implementation of the image compression algorithm.
[0003] Therefore, how to efficiently generate decompression / compression test cases that can specify the compression size of image data based on a specific image compression algorithm is an urgent problem to be solved. Summary of the invention
[0004] The object of the present invention is to provide a method for generating image compression and decompression test cases based on a depth buffer algorithm, so as to at least partially solve the above-mentioned problems.
[0005] According to one aspect of the present disclosure, a method for generating image decompression test cases based on a depth buffer algorithm is proposed. Based on image tiles, the compressed image data encoding package is divided into 7 parts, namely N0, N1, N2, N3, N4, N5, and N6, where tile is represented by x*y. The method is characterized in that the generation of image decompression test cases includes the following steps:
[0006] S601, randomly select the value of N2, and assume that the number of 1s in N2 is N3_num,
[0007] S602, randomly generate the value of N3, and assume that the number of N3 values that are 2'b00 or 2'b10 is N4_num, and use N4_symbol_0[*] to represent the value of the 0th bit of the symbol in N4.
[0008] If the current pixel's random N3 value is 2'b00, the corresponding N4_symbol_0[N4_num]=1'b0;
[0009] If the current pixel's random N3 value is 2'b10, the corresponding N4_symbol_0[N4_num]=1'b1;
[0010] S603, random N4 value, assuming that the size of N5 corresponding to the pixel's N4 value is N5_size, and the size of N6 corresponding to the pixel's N4 value is N6_size,
[0011] Randomly generate the value of each pixel in N4, each value ranges from 4'b0000 to 4'b1111, and this value together with N4_symbol_0[*] in S602 constitutes a complete symbol value;
[0012] Based on the complete symbol value, generate the size of the corresponding pixel in N5, N5_size, and the size of the pixel in N6, N6_size.
[0013] S604, generating each pixel delta value according to the values of N5_size and N6_size,
[0014] According to the values of each N5_size and N6_size, randomly generate the values of each N5 and N6:
[0015] Each N5 ranges from 2 to the power of N5_size-1 to 2 to the power of N5_size-1.
[0016] The range of each N6 is 2 to the power of N6_size-1 ~ 2 to the power of N6_size-1,
[0017] N0_temp is the count value of the total length of N5.
[0018] S605, calculate the value of N0 according to the value of N0_temp, N0=N0_temp / 2,
[0019] S606, random N1 value, where N1 = 0~24'hff_ffff.
[0020] According to another aspect of the present disclosure, a method for generating image compression test cases based on a depth buffer algorithm is proposed. Based on image tiles, the compressed image data encoding package is divided into 7 parts, namely N0, N1, N2, N3, N4, N5, and N6, where tile is represented by x*y. The method is characterized in that the generation of image compression test cases includes the following steps:
[0021] Step S701: Determine the position of the pixel of N1 based on the value of N2, i.e., the row and column where the first 1 in N2 is located.
[0022] Step S702: Determine the pixel of FC and the pixel where Delta is equal to predict delta based on the value of N2. Specifically:
[0023] (1) Starting from the first pixel until the first pixel where N2[i]=1 is encountered, its pixel value is FC, i.e., pixel[m,n]= FC, m<x, n<y, and mark the position of this pixel.
[0024] (2) Starting from the position where N1 is marked until the end, if N2[x,y]=0, then its pixel value is FC or its delta value is predict delta.
[0025] If the values of the pixels smaller than the row or column where this pixel is located are all FC, then this pixel is FC, and mark the position of this pixel. Otherwise, the Delta of this pixel is equal to predict delta, and mark the position of this pixel.
[0026] (3) Starting from the position where N1 is marked until the end, if N2[x,y]=1, then its delta value needs to be parsed according to the value of N3.
[0027] S703: Determine the pixel where delta is equal to predict delta + 1 or delta is equal to predict delta - 1 based on the value of N3, and the delta value of the pixels other than the above cases.
[0028] Calculate the total length of N3 based on the number of 1s in N2, that is, starting from the first 1 in N2 until N2 is traversed. If N2[i] is equal to 1, then the total length of N3 is incremented by 2.
[0029] Extract each value in N3 and determine the delta situation of the pixel according to each value:
[0030] If the value is 2’b01, then Delta is equal to predict delta - 1, and mark the position where this delta is located.
[0031] If the value is 2’b11, then Delta is equal to predict delta + 1, and mark the position where this delta is located.
[0032] Otherwise, extract the lowest bit of symbol, that is, Symbol_l[*]= N3[j*2+1],
[0033] Calculate the number of data in N4, that is, each value of 2'b00 or 2'b10 in N3 corresponds to a number in N4,
[0034] S704, according to the value of N4 and the value of Symbol_l[*] in S703, the delta_szie of the remaining pixels is obtained, where symbol_l[*] represents the lowest 1 bit of the symbol in N3, and delta_szie represents the number of bits occupied by the delta of each remaining pixel, that is, the value of each symbol.
[0035] S705, calculate the delta value of each pixel according to the symbol value,
[0036] According to the symbol value, get the number of bits occupied by the corresponding pixel's delta in N5 and N6.
[0037] S706, obtaining pixel value according to delta value of each pixel,
[0038] If it is the pixel at row 0 and column 0, the predicted value of the pixel is FC.
[0039] If it is a pixel in the 0th column of another pixel, the predicted value of the pixel is the pixel value in the 0th column of the previous row.
[0040] Otherwise, the predicted value of the pixel is the pixel value of the previous column in the same row.
[0041] Calculate the value of each pixel based on the predicted value of each pixel and the delta value. The pixel value is equal to the sum of the predicted value of the pixel and the corresponding delta value.
[0042] S707, generating the original pixel value according to the value of each pixel,
[0043] In the original data, the header data of the pixel can be obtained randomly in the range of 0~8'hff, and the actual value of the pixel is the value obtained in step S706. The two are combined to obtain the original value of the pixel.
[0044] S708, generating an original package according to the original value of each pixel, and obtaining a compressed test vector.
[0045] According to another aspect of the present disclosure, a device for generating image decompression test cases based on a depth buffer algorithm is provided, comprising:
[0046] The first random module is used to randomly generate the value of N2, and assumes that the number of 1s in N2 is N3_num.
[0047] The second random module is used to randomly generate the value of N3, and assumes that the number of 2'b00 or 2'b10 in N3 is N4_num, and uses N4_symbol_0[*] to represent the value of the 0th bit of the symbol in N4.
[0048] If the current pixel's random N3 value is 2'b00, the corresponding N4_symbol_0[N4_num]=1'b0;
[0049] If the current pixel's random N3 value is 2'b10, the corresponding N4_symbol_0[N4_num]=1'b1;
[0050] The third random module is used to randomly set the value of N4. Assume that the size of N5 corresponding to the pixel value of N4 is N5_size, and the size of N6 corresponding to N4 is N6_size.
[0051] Randomly generate the value of each pixel in N4. The range of each value is 4'b0000~4'b1111. This value and N4_symbol_0[*] together form a complete symbol value.
[0052] Based on the complete symbol value, generate the size of the corresponding pixel in N5, N5_size, and the size of the pixel in N6, N6_size.
[0053] The generation module is used to generate each pixel delta value according to the values of N5_size and N6_size. According to the values of each N5_size and N6_size, each N5 and N6 value is randomly generated: the range of each N5 is 2 to the power of N5_size-1~2 to the power of N5_size-1, the range of each N6 is 2 to the power of N6_size-1~2 to the power of N6_size-1, and N0_temp is the count value of the total length of N5.
[0054] The calculation module is used to calculate the value of N0 according to the value of N0_temp, N0=N0_temp / 2,
[0055] The fourth random module is used for randomizing the value of N1, where N1 = 0~24'hff_ffff.
[0056] According to another aspect of the present disclosure, a device for generating image compression test cases based on a depth buffer algorithm is provided, comprising:
[0057] The first acquisition module is used to obtain the pixel of N1 based on the value of N2, that is, the row and column where the first 1 in N2 is located.
[0058] The second acquisition module is used to obtain the pixel of FC and the pixel where Delta is equal to predict delta based on the value of N2. Specifically,
[0059] (1) Starting from the first pixel until the first pixel where N2[i]=1 is encountered, its pixel value is FC, that is, pixel[m,n]=FC, m<x, n<y, and mark the position of this pixel.
[0060] (2) Starting from the position where N1 is marked until the end, if N2[x,y]=0, then its pixel value is FC or its delta value is predict delta.
[0061] If the values of the pixels smaller than the row or column where this pixel is located are all FC, then this pixel is FC, and mark the position of this pixel. Otherwise, the Delta of this pixel is equal to predict delta, and mark the position of this pixel.
[0062] (3) Starting from the position where N1 is marked until the end, if N2[x,y]=1, then its delta value needs to be parsed according to the value of N3.
[0063] The third acquisition module is used to obtain the pixel where delta is equal to predict delta + 1 or delta is equal to predict delta - 1 based on the value of N3, and the delta value of the pixel in other cases.
[0064] Calculate the total length of N3 according to the number of 1s in N2, that is, starting from the first 1 in N2 until N2 is traversed. If N2[i] is equal to 1, then the total length of N3 is increased by 2.
[0065] Extract each value in N3 and judge the delta situation of the pixel according to each value:
[0066] If the value is 2’b01, then Delta is equal to predict delta - 1, and mark the position where this delta is located.
[0067] If the value is 2’b11, then Delta is equal to predict delta + 1, and mark the position where this delta is located.
[0068] Otherwise, extract the lowest bit of symbol, that is, Symbol_l[*]= N3[j*2+1],
[0069] Calculate the number of data in N4, that is, each value of 2'b00 or 2'b10 in N3 corresponds to a number in N4,
[0070] The fourth acquisition module is used to obtain the delta_szie of the remaining pixels according to the value of N4 and the value of Symbol_l[*], where symb_l[*] represents the lowest 1 bit of the symbol in N3, and delta_szie represents the number of bits occupied by the delta of each remaining pixel, that is, the value of each symbol.
[0071] The fifth acquisition module is used to obtain the delta value of each pixel according to the symbol value.
[0072] According to the symbol value, get the number of bits occupied by the corresponding pixel's delta in N5 and N6.
[0073] The sixth acquisition module is used to obtain the pixel value according to the delta value of each pixel.
[0074] If it is the pixel at row 0 and column 0, the predicted value of the pixel is FC.
[0075] If it is a pixel in the 0th column of another pixel, the predicted value of the pixel is the pixel value in the 0th column of the previous row.
[0076] Otherwise, the predicted value of the pixel is the pixel value of the previous column in the same row.
[0077] Calculate the value of each pixel based on the predicted value of each pixel and the delta value. The pixel value is equal to the sum of the predicted value of the pixel and the corresponding delta value.
[0078] The seventh acquisition module is used to generate the original pixel value according to the value of each pixel.
[0079] In the original data, the pixel header data can be randomly obtained in the range of 0~8'hff. The pixel header data and the pixel value are combined to obtain the original value of the pixel.
[0080] The eighth acquisition module is used to generate an original package according to the original value of each pixel to obtain a compressed test vector.
[0081] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the steps in the method of any of the above embodiments by calling the computer program stored in the memory.
[0082] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program executes the steps in any of the above method embodiments when executed by a processor.
[0083] The present application provides a method for generating image compression and decompression test cases for a depth buffer algorithm. The total length and value in the compressed data are described using SV constraints, and finally the SV is automatically solved based on these constraints. Specifically, according to the typical data format of the compressed data, it usually includes 7 parts, N0-N6, and N2, N3, and N4 are randomly generated in sequence based on the SV constraints. The size values of N5 and N6 are estimated based on the value of N4, and the pixel delta value is generated according to the size values of N5 and N6. Then the value of N0 is calculated and the value of N1 is obtained immediately. According to the method provided by the present disclosure, a sufficiently random compressed data test vector can be efficiently generated, and a verification method for test stimuli that can specify the compression size of image data can be efficiently generated, which greatly enriches the verification scenario and discovers defects in the design implementation in advance. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] Figure 1 A schematic diagram of a method for generating image decompression test cases based on a depth buffer algorithm provided in an embodiment of the present application.
[0085] Figure 2 A schematic diagram of the uncompressed data format provided in an embodiment of the present application.
[0086] Figure 3 A schematic diagram of a typical combination of pixels of a tile provided in an embodiment of the present application.
[0087] Figure 4 A schematic diagram of the predicted value predict for each pixel provided in an embodiment of the present application.
[0088] Figure 5 A schematic diagram of a typical data format after compression provided in an embodiment of the present application.
[0089] Figure 6 A schematic diagram of the lengths of various parts of the compressed data provided in an embodiment of the present application.
[0090] Figure 7 A schematic diagram of decompressed data generation provided in an embodiment of the present application.
[0091] Figure 8 A schematic diagram of compressed data generation provided in an embodiment of the present application.
[0092] Fig. 9 Schematic diagram of a device for generating test cases for an image decompression algorithm provided in an embodiment of the present application.
[0093] Fig.10 Schematic diagram of the image compression algorithm test case generation device provided in an embodiment of the present application.
[0094] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0095] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0096] In the description of the present invention, it should be understood that the terms "upper", "upper", "lower", "front", "rear", etc., indicating the orientation or positional relationship are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In the description of the invention, "plurality" means two or more, unless otherwise precisely and specifically specified.
[0097] The depth buffer compression algorithm based on the Anchor-Delta algorithm can compress the original image data of 128B / 256B into different sizes such as 32B / 64B / 94B... / 224B. The present disclosure generates compression / decompression test cases based on the depth buffer compression algorithm of the Anchor-Delta algorithm. The depth buffer compression algorithm is specifically introduced below.
[0098] like Figure 2As shown in the figure, it is a typical uncompressed data format sent by the upstream module to the compression module. It contains 4 tiles, each tile has 16 pixels, and a total of 64 pixels of depth information. Each pixel occupies 32 bits. The effective depth information of a pixel is generally composed of 24 bits. In order to align the depth information with 4 bytes, there are generally 8 bits of redundant bits. As shown in the figure, bit0~bit23 are the effective depth information of pixel0, and bit24~bit31 are redundant information.
[0099] like Figure 3 As shown, Figure 3 It is a typical combination of pixels of a tile. Data compression is based on tiles and is generally divided into the following steps.
[0100] Based on the image block tile, the compressed image data encoding package is divided into 7 parts, namely N0, N1, N2, N3, N4, N5, N6, where tile is expressed as x*y;
[0101] The encoding of each pixel in a tile includes the following steps:
[0102] Step S1, obtain the predicted value predict of each pixel, such as Figure 4 As shown, the code is as follows,
[0103] Pred*= (x==0?)? pixel(0,y-1): pixel(x-1,y);
[0104] When x is equal to 0 and y is equal to 0, i.e. the pixel in column 0 and row 0, the predicted value is fc (not included in the formula).
[0105] When x is equal to 0, that is, the first column of pixels, the predicted value is the pixel value of the 0th column, y minus one row;
[0106] When x is not equal to 0, that is, from the second column to the last column, the predicted value is the pixel value of the x-1th column and the yth row.
[0107] The prediction value of the first pixel is the reference value FC. When x is equal to 0, the prediction value corresponding to the pixel in the first column is the pixel value in the 0th column and the yth minus row. When x is not equal to 0, that is, from the second column to the last column, the corresponding prediction value is the pixel value in the x-1th column and the yth row.
[0108] Except for the first pixel, if the corresponding pixel value is non-FC, but its predicted value is FC, then its predicted value is the first non-FC pixel value.
[0109] Step S2, get the delta value of each pixel, the code is as follows,
[0110] Step 2, get the delta value of each pixel.
[0111] If pix*=fc, delta*=0; else delta*=pix*-pred*
[0112] If delta
[24] =1, abs=~delta[23:0]+1, esel abs=delta
[0113] Size = the number of significant digits of abs.
[0114] When the pixel value is fc, its delta value is 0, otherwise the delta value is the current pixel value minus the predicted value of the current pixel
[0115] When the delta value is negative (that is, the sign bit delta
[24] is equal to 1), the absolute value of delta (abs) is delta[23:0] negated plus 1, otherwise the absolute value of delta is the delta value.
[0116] Size is equal to the number of bits occupied when the absolute value is represented in binary.
[0117] When delta is a negative number, that is, delta
[24] =1, abs is stored in binary complement format.
[0118] That is, when the pixel value is FC, its delta value is 0, otherwise the delta value is the current pixel value minus the predicted value of the current pixel.
[0119] Step S3, get the predicted delta of each pixel,
[0120] If(x==0 && y==0)
[0121] Preddelta00 = 0
[0122] else
[0123] Preddelta*= (x==0?)? delta(0,y-1): delta(x-1,y);
[0124] When the pixel is in column 0 and row 0, the predicted delta is 0;
[0125] When the pixel is in the 0th column, the predicted delta is equal to the delta value corresponding to the pixel in the 0th column and the y-1th row;
[0126] When the pixel is from the first to the last column, the predicted delta is equal to the delta value corresponding to the pixel in the x-1th column and the yth row.
[0127] Step S4, generating a code symbol of size according to the size of the delta value, where the symbol contains 5 bits.
[0128] if pix=fc,symbol=30('h1e)
[0129] else if size<=5, symbol=size,
[0130] else if size=6,symbol=size|delta[0],
[0131] else is size>=7&&size<=9, symbol=(size*4-20)|delta[1:0],
[0132] else if size=10,symbol=20|delta[0],
[0133] else if size>=11&&size<=18,symbol=size+11,
[0134] else if symbol=31('h1f),
[0135] Step S5, generating pre-compressed data, specifically:
[0136] S500, starting from the first pixel, if the pixel value is the preset reference value FC, the pixel is encoded as 0 until the first non-FC value pixel is encountered. If the pixel and its subsequent pixels, if the pixels on the left or above the pixel are all FC, the pixel is represented by fcMostly=1, otherwise it is represented by fcMostly=0.
[0137] If the pixel is fcMostly=1, and the value of the pixel is FC, the pixel is encoded as 0, otherwise it is encoded as 1.
[0138] If the pixel is fcMostly=0, if the delta value of the pixel is equal to the predicted delta, and the value of the pixel is non-FC, then the pixel is encoded as 0, otherwise it is encoded as 1.
[0139] The encoding values of all pixels are combined to form N2.
[0140] S501, further encode all pixels coded as 1 in S500,
[0141] If the pixel is fcMostly=1, (1) if the delta of the pixel is equal to the predicted delta, it is encoded with 2 bits of 2'b01, (2) if the delta of the pixel is equal to the predicted delta + 1, it is encoded with 2 bits of 2'b11, (3) otherwise, it is represented by 2 bits of 2'b00 or 2'b10, indicating that the pixel contains the value of symbol[0].
[0142] If the pixel is fcMostly=0, and the pixel is a non-FC value, (1) if the delta of the pixel is equal to the predicted delta-1, then use 2bit 2'b01 to encode, (2) if the delta of the pixel is equal to the predicted delta+1, then use 2bit 2'b11 to encode, (3) otherwise, use 2bit 2'b00 or 2'b10 to indicate that the pixel contains the value of symbol[0]. Symbol can be understood as the encoding of size. Here, in this case (3), the current encoding stores the value of the lowest bit of symbol, that is, symbol[0].
[0143] The above codes are combined to form N3.
[0144] S502, further encode the pixel coded as 2'b00 or 2'b10 in N3,
[0145] The pixel is encoded as the high 4 bits of the symbol, and together with symbol[0] in S501, it forms a complete symbol value. The complete symbol value stores the delta value information of the pixel.
[0146] S503, for the encoding of symbol[4:0] in S502, encode the pixels from 1 to 29, and there are some values of delta, because symbol has only 5 bits, and the range that a 5-bit binary number can represent is 0 to 31, of which 30 and 31 have been used (30 means the pixel value is fc, 31 means size is greater than or equal to 19),
[0147] S504, for the encoding of symbol[4:0] in S502, the encoding is performed on pixels 1 to 29, and there are other partial values of delta, where:
[0148] N0 means the total length of N5 divided by 2, and the fixed length is 10 bits, because the encoding of the pixel in stage 3 (i.e. N5) is an even number. Therefore, the total length of N5 is also an even number, that is, the lowest bit is 0. Since the lowest bit is a fixed value of 0, there is no need to occupy 1 bit to store the lowest bit. Therefore, the total length minus the lowest bit is divided by 2.
[0149] N1 represents the value of the first non-FC pixel, with a fixed length of 24 bits.
[0150] N2 represents the coded value of all pixels in step S500, each pixel occupies 1 bit, and the fixed length is the number of pixels in the tile.
[0151] N3 represents the combination of the coded values in step S501. If the corresponding N2=0, it does not exist. Otherwise, it is 2 bits, and the fixed length is twice the number of 1s in N2.
[0152] N4 represents the combination of delta values of all pixels in step S502. If N2=0 or N3=01 or N3=11, it does not exist. Otherwise, it is 4 bits. The total length is 4n, where n is the number of pixels minus the number of 0s in N2 minus the number of 01s or 11s in N3.
[0153] N5 represents the encoding value of all pixels after step S503, that is, N0 multiplied by 2 equals the value of N5.
[0154] N6 represents the coded values of all pixels after step S504, and the total length is the remaining part of the total length of the package. Package is a data packet composed of N0+N1+N2+N3+N4+N5+N6.
[0155] As shown in Table 1 below, it is the relationship between symbol and N5_size, N6_size. The third column is the number of bits occupied by the pixel in N5, that is, N5_size, and the second column is the meaning of the occupied bits. Similarly, the fifth column is the number of bits occupied in N6, and the fourth column is the meaning of these bits. For example, if the symbol of a pixel is 5'b01000, then the pixel occupies 4 bits in N5, and these 4 bits represent the delta[6:3] of the pixel ex1; it occupies 1 bit in N6, and this 1 bit represents the delta[2] of the pixel. That is, when symbol=5'b01000, N5, N6 contain the delta[6:2] value of the pixel.
[0156] Table 1
[0157]
[0158] Figure 5 It is a typical data format after compression. It consists of 7 parts.
[0159] Stg3_len: the total length of stg3_data divided by 2, fixed length 10 bits,
[0160] Raw_data: the value of the first non-FC pixel, fixed length 24 bits,
[0161] Stg0_data: the values of all pixel stage0, 1 bit per pixel, fixed length pix_num (pix_num will have different values depending on fromat),
[0162] Stg1_data: the value of all pixel stage1. If the corresponding pixel stage0=0, it does not exist. Otherwise, it is 2 bits, with a fixed length of 2*the number of 1s in stg0_data.
[0163] Stg2_data: the value of all pixel stage2. If the defined pixel stage0=0 or stage1=01 / 11, it does not exist. Otherwise, it is 4 bits, and the total length is 4*n (n is the number of pix_num-stg0 being 0-the number of 01 / 11 in stg1_data).
[0164] Stg3_data: all pixel stage3 values, total length is 2* Stg3_len,
[0165] Stg4_data: the values of all pixel stage4, the total length is the remaining part of the total length of the package.
[0166] The relationship between the total length of compressed data and the compression rate is shown in Table 2:
[0167] Table 2
[0168] Compression Overall length 32B 0~256bit 64B 257~512bit 96B 513~768bit7 128B 769~1024bit 160B 1025~1280bit 192B 1281~1536bit 224B 1537~1792bit fail 1793~2048bit
[0169] Based on the above-mentioned depth buffer algorithm, an embodiment of the present application provides a method for generating image decompression test cases based on the depth buffer algorithm.
[0170] Specifically, Figure 1 As shown, the following steps are included:
[0171] If the length of each part of the compressed data is Figure 6 As shown,
[0172] If the tile format is x*y, then:
[0173] The total length N = N0 + N1 + N2 + N3 + N4 + N5 + N6, such as Figure 7 shown.
[0174] The steps for generating data for each module are as follows:
[0175] S601, (stg0_data generator) Random N2 (stg0_data) value, range 1~(2**pix_num-1), and assume that the number of 1 in stag0_data is N3_num, where Pix_num is the number of pixels in a tile. Each pixel occupies 1 bit in N2. If there are 16 pixels in a tile, then the value of N2 is in the range of 1~(2**16)-1. To give another simple example, if there are 4 pixels in a tile, because each pixel occupies 1 bit in N2, then 4 pixels require 4 bits, and the maximum 4-bit binary number is 4'b1111, that is, 15, so the range of N2 is 1~2**4-1, that is, 1~15.
[0176] For(i=0; i< pix_num; i++)begin
[0177] N2[i] = 1'b0~1'b1;
[0178] If(N2[i] ==1)
[0179] N3_num++;
[0180] end ,
[0181] Randomly generate the value of N2, and use N3_num to represent the number of 1s in N2. This code shows how to calculate the value of N3_num.
[0182] S602, (stg1_data generator) randomly generates the value of N3, and assumes that the number of 2'b00 or 2'b10 in N3 is N4_num, and uses N4_symbol_0[*] to represent the value of the 0th bit of symbol in N4.
[0183] For(i=0; i <N3_num; i++)begin
[0184] N3[2*i+1:2*i] = 2'b00~2'b11
[0185] If(N3[2*i+1:2*i] = 2'b00) begin
[0186] N4_symbol_0[N4_num]=1'b0;
[0187] N4_num++;
[0188] End
[0189] Else If(N3[2*i+1:2*i] =2'b10) begin
[0190] N4_symbol_0[N4_num]=1'b1;
[0191] N4_num++;
[0192] end
[0193] end
[0194] Randomly generate each value in N3, use N4_num to count the number of current values that are 2'b00 or 2'b10, and use N4_symbol_0[*] to represent the value of the 0th bit of the symbol in N4.
[0195] If the current pixel's random N3 value is 2'b00, the corresponding N4_symbol_0[N4_num]=1'b0;
[0196] If the current pixel's random N3 value is 2'b10, the corresponding N4_symbol_0[N4_num]=1'b1;
[0197] S603, (stg2_data generator) Random N4 value, assuming that the size of N5 corresponding to the pixel's N4 value is N5_size, and the size of N6 corresponding to N4 value is N6_size,
[0198] For(i=0; i< N4_num; i++)begin
[0199] N4[4*i+3:4*i] = 4'b0000~4'b1111;
[0200] Symbol = {N4[4*i+3:4*i], N4_symbol_0[N4_num]};
[0201] Case(Symbol)
[0202] 5'b0000:
[0203] N5_size[i]=0;
[0204] N6_size[i]=0;
[0205] 5'b0001:
[0206] N5_size[i]=0;
[0207] N6_size[i]=1;
[0208] 5'b0010:
[0209] N5_size[i]=0;
[0210] N6_size[i]=1;
[0211] …
[0212] 5'b11111:
[0213] N5_size[i]=16;
[0214] N6_size[i]=8;
[0215] Endcase
[0216] End
[0217] Randomly generate the value of each pixel in N4, each value ranges from 4'b0000 to 4'b1111, and this value together with N4_symbol_0[*] in S602 constitutes a complete symbol value;
[0218] Based on the complete symbol value, the size of the corresponding pixel in N5, N5_size, and the size of the pixel in N6, N6_size, are generated.
[0219] In one embodiment, the relationship between the symbol value and the corresponding relationship N5_size, N6_size is as shown in Table 3 below: the relationship between symbol and stage_3_len, stage_4_len.
[0220] Table 3
[0221]
[0222] This table shows the relationship between symbol and N5_size, N6_size. The third column is the number of bits that the pixel occupies in N5, that is, N5_size, and the second column is the meaning of the bits occupied. Similarly, the fifth column is the number of bits occupied in N6, and the fourth column is the meaning of these bits. For example, if the symbol of a pixel is 5'b01000, then the pixel occupies 4 bits in N5, and these 4 bits represent the delta[6:3] of the pixel ex1; it occupies 1 bit in N6, and this 1 bit represents the delta[2] of the pixel. That is, when symbol=5'b01000, N5 and N6 contain the delta[6:2] value of the pixel.
[0223] S604, (Difference Generator) generates delta values for each pixel according to the values of N5_size and N6_size,
[0224] For(i=0; i< N4_num; i++)begin
[0225] If(N5_size[i]>=1) begin
[0226] N5[i]={1'b1 ,{N5_size[i]-1{1'b0}}} ~{1'b1,{N5_size[i]-1{1'b1}}};
[0227] N0_temp = N0_temp+N5_size[i];
[0228] end
[0229] If(N6_size[i]>=1)
[0230] N6[i]={1'b1,{N6_size[i]-1{1'b0}}} ~{1'b1,{N6_size[i]-1{1'b1}}};
[0231] end
[0232] According to the values of each N5_size and N6_size, randomly generate the values of each N5 and N6:
[0233] Each N5 ranges from 2 to the power of N5_size-1 to 2 to the power of N5_size-1.
[0234] The range of each N6 is 2 to the power of N6_size-1 ~ 2 to the power of N6_size-1,
[0235] N0_temp is the count value of the total length of N5.
[0236] In the code, 1'b1 refers to a binary digit. 'b represents binary, the first 1 represents the number of binary digits, and the last 1 represents the value of the binary number. For example, 2'b11 represents binary 3; 3'b101 represents binary 5; 4'b0100 represents binary 4 (it can also represent 4'b100, that is, the first 0 of the value can be omitted).
[0237] S605, (stg3_len generator) calculates the value of N0 according to the value of N0_temp, N0=N0_temp / 2,
[0238] A pixel requires 24 bits to represent it. The maximum value of a 24-bit binary number is when all 24 bits are 1, which is represented in hexadecimal as 24'hff_ffff (a hexadecimal number f represents 4'b1111 in binary).
[0239] S606, (Raw_data generator) random N1 value, where N1 = 0~24'hff_ffff, the code indicates that the range of N1 is between 0 and 24'hff_ffff in hexadecimal. The hexadecimal representation is similar to the binary representation. 'h represents hexadecimal, the first 24 represents the number of bits, i.e. 24 bits (one bit is one binary number), and the following ff_ffff is the value. One 'f' occupies 4 bits, i.e. 4 binary digits, 4'b1111).
[0240] According to the above six steps, a complete compressed data test case can be generated.
[0241] According to an embodiment of the present disclosure, based on the above-mentioned depth buffer algorithm, the steps of generating an image decompression data test case are as follows.
[0242] Compress each part of data N, such as Figure 6 As shown, assuming the tile format is x*y, it is understandable that 16 pixels is just one of the typical formats, it can also be 32 pixels or 64 pixels, so x*y is used here. If it is 16 pixels, x=4, y=4; if it is 32 pixels, x=8, y=4.
[0243] According to the compression algorithm, we can get:
[0244] N0 = N[9:0] ;
[0245] N1 = N[33:10];
[0246] N2 = N[x*y+34:34];
[0247] The compressed data is represented in binary, N[9:0] represents the 0th to 9th bits of the compressed data, N[33:10] represents the 10th to 33rd bits of the compressed data, and N[x*y+34:34] represents the 34th to 34+x*y bits.
[0248] like Figure 8 As shown, the steps to generate a test vector of uncompressed data with a specified compression size are as follows:
[0249] Step S701, according to the value of N2, obtain the pixel of N1, that is, the row and column where the first 1 in N2 is located,
[0250] For(i=0; i <x; i++)begin
[0251] For(j=0; j <y; j++)begin
[0252] If(N2[i*y+j] ==1)
[0253] Pixel[i,j] == N1;
[0254] Raw_data_row=x;
[0255] Raw_data_col = y
[0256] Break;
[0257] End
[0258] End
[0259] According to the encoding rule of N2 (i.e., stage0), the pixel values before the first 1 in N2 are all fc, which are represented by the encoding 0.
[0260] Step S702: Based on the value of N2, obtain the pixel of FC and the pixel whose Delta is equal to predict delta. Specifically,
[0261] (1) Starting from the first pixel until the first pixel where N2[i]=1 is encountered, its pixel value is FC, that is, pixel[m,n]= FC, m<x, n<y, and mark the position of this pixel.
[0262] (2) Starting from the position where N1 is marked until the end, if N2[x,y]=0, then its pixel value is FC or its delta value is predict delta.
[0263] If the pixel values of the pixels smaller than this pixel in the same row or the same column are all FC, then this pixel is FC, and mark the position of this pixel; otherwise, the Delta of this pixel is equal to predict delta, and mark the position of this pixel.
[0264] (3) Starting from the position where N1 is marked until the end, if N2[x,y]=1, then its delta value needs to be parsed according to the value of N3.
[0265] S703: Based on the value of N3, obtain the pixel whose delta is equal to predict delta + 1 or delta is equal to predict delta - 1, and the delta value of the pixel that does not fall into the above situations.
[0266] For(i=m*n+1; i<x*y; i++)begin
[0267] If(N2[i]==1)
[0268] N3_len= N3_len+2;
[0269] End
[0270] N3 = N[n3_h:n3_l]; where n3_l= x*y+34, n3_h= n3_l+N3_len,
[0271] For(j=0; j< N3_len; j=j+2)
[0272] If(N3[j*2+1:j*2] ==2'b01)
[0273] Delta = pred_delta-1;
[0274] else if(N3[j*2+1:j*2] ==2'b11)
[0275] Delta = pred_delta+1;
[0276] Else begin
[0277] Symbol_l[*]= N3[j*2+1];
[0278] N4_num++;
[0279] end
[0280] According to the total length of N3 N3_len, extract N3 in N, the position of N3 in N is N[n3_h:n3_l], the lowest bit is n3_l = x*y+34 (N0 10bit, N1 24bit, N2 x*y bit), the highest bit is n3_h =n3_l+N3_len (the lowest bit plus the total length),
[0281] According to the number of 1s in N2, the total length of N3 is calculated, that is, starting from the first 1 in N2 until N2 is traversed, if N2[i] is equal to 1, the total length of N3 is increased by 2.
[0282] Extract each value in N3 and determine the delta of the pixel based on each value:
[0283] If the value is 2'b01, Delta is equal to predicted delta-1, and the position of the delta is marked.
[0284] If the value is 2'b11, Delta is equal to predicted delta + 1, and the position of the delta is marked.
[0285] Otherwise, extract the lowest bit of symbol, that is, Symbol_l[*]= N3[j*2+1],
[0286] Calculate the number of data in N4, that is, each value of 2'b00 or 2'b10 in N3 corresponds to a number in N4,
[0287] S704, according to the value of N4 and the value of symb_l[*] in S3, the delta_szie of the remaining pixels is obtained, where symb_l[*] represents the lowest 1 bit of the symbol in N3, and delta_szie represents the number of bits occupied by the delta of each remaining pixel, that is, the value of each symbol.
[0288] N4=N[n4_h:n4_l], where n4_l=n3_h+1, n4_h=n4_l+ N4_num*4;
[0289] For(i=0; i< N4_num; i++)
[0290] Symbol_h[i]=N4[i*4+3:i*4]
[0291] symbol[i]={ Symbol_h[i], Symbol_l[i]}
[0292] Extract N4 from N, the position of N4 in N is N[n4_h:n4_l], the lowest bit is n4_l= n3_h+1 (the next bit of the highest bit of N3 in N), the highest bit is n4_h =n4_l+N4_num*4 (the lowest bit plus the total length, the total length is the number of data in N4*4, because each value in N4 occupies 4 bits),
[0293] After extracting N4 from N, extract the high bits of each symbol from N4. Because each value in N4 occupies 4 bits, the high bits of each symbol are: starting from 0, loop N4_num times, and intercept 4 bits from N4 each time.
[0294] The complete value of each symbol is constructed based on the low bit of the symbol extracted from S3 and the high bit extracted from N4.
[0295] Extract the value of N5 in N. The position of N5 in N is N[n5_h:n5_l]. The lowest bit is n5_l = n4_h+1 (the bit next to the highest bit of N4 in N). The highest bit is n5_h = n5_l+N0*2 (the lowest bit of N5 plus the length of N5. The length of N5 is N0 multiplied by 2).
[0296] Extract the value of N6 in N. The position of N6 in N is N[n6_h:n6_l]. The lowest bit is n6_l = n5_h+1 (the bit next to the position of the highest bit of N5 in N), and the highest bit is n6_h = the highest bit of N.
[0297] S705, calculate the delta value of each pixel according to the symbol value,
[0298] N5=N[n5_h:n5_l], where n5_l=n4_h+1; n5_h=n5l+N0*2;
[0299] N6=N[n6_h:n6_l], where n6_l=n5_h+1, n6_h=?
[0300] According to the symbol value, the number of bits occupied by the delta of the corresponding pixel in N5 and N6 is obtained. The corresponding relationship is shown in Table 4 below:
[0301] Table 4
[0302]
[0303] For(i=0; i <N4_num; i++)begin
[0304] Case(symbol[i])
[0305] 5'b00000:
[0306] Pixel_n5_num[i]= 0;
[0307] Pixel_n6_num[i]= 0;
[0308] 5'b00001:
[0309] Pixel_n5_num[i]= 0;
[0310] Pixel_n6_num[i]= 1;
[0311] 5'b00010:
[0312] Pixel_n5_num[i]= 2;
[0313] Pixel_n6_num[i]= 0;
[0314] …
[0315] 5'b1111:
[0316] Pixel_n5_num[i] = 16;
[0317] Pixel_n6_num[i] = 8;
[0318] Endcase
[0319] If(symbol == 6)
[0320] Delta[0] = 0;
[0321] Else if(symbol == 7)
[0322] Delta[0] = 1
[0323] Else If(symbol >=8 && symbol <=19)
[0324] Delta[1:0] = symbol[1:0]
[0325] Else if(symbol == 20)
[0326] Delta[0] = 0;
[0327] Else if(symbol==21)
[0328] Delta[0] = 1; According to the complete symbol value, the number of bits occupied by each pixel in N4 in N5 and N6 is obtained in turn. The corresponding relationship is shown in the 1st, 3rd, and 5th columns of Table 5. Pixel_n5_num[i]] represents the number of bits occupied by the i-th pixel in N5, and Pixel_n6_num[i]] represents the number of bits occupied by the i-th pixel in N6.
[0329] Table 5
[0330]
[0331] For(i=0; i <N4_num; i++)begin
[0332] Delta_h[i] = N5[Pixel_n5_num[i]+lsb:lsb];
[0333] Lsb= Pixel_n5_num[i]+lsb+1;
[0334] End
[0335] Lsb=0
[0336] For(i=0; i <N4_num; i++)begin
[0337] Delta_l[i] = N6[Pixel_n6_num[i]+lsb:lsb];
[0338] Lsb= Pixel_n6_num[i]+lsb+1;
[0339] End
[0340] According to the number of bits occupied by each pixel in N5, the high bit of the pixel delta value is extracted, that is, delta_h[i], and according to the number of bits occupied by each pixel in N6, the low bit of the pixel delta value is extracted, that is, delta_l[i].
[0341] S706, obtaining pixel value according to delta value of each pixel,
[0342] If it is the pixel at row 0 and column 0, the predicted value of the pixel is FC.
[0343] If it is a pixel in the 0th column of another pixel, the predicted value of the pixel is the pixel value in the 0th column of the previous row.
[0344] Otherwise, the predicted value of the pixel is the pixel value of the previous column in the same row.
[0345] Calculate the value of each pixel based on the predicted value of each pixel and the delta value. The pixel value is equal to the sum of the predicted value of the pixel and the corresponding delta value.
[0346] For(i=0; i <N4_num; i++)
[0347] Delta[i] = {delta_h, delta_l};
[0348] For(I = 0; i <x; i++)begin
[0349] For(j=0;j <y; j++)begin
[0350] If(x==0 && y==0)
[0351] Pred_pix[x,y]= fc
[0352] Else
[0353] Pred_pix[x,y]= (x==0?)? pix(0,y-1): pix(x-1,y);
[0354] Pix[x,y]= Pred_pix[x,y]+delta[x,y]
[0355] End
[0356] End
[0357] For each value in N4, the delta value of each pixel is obtained, that is, Delta[i] = {delta_h, delta_l}, where delta_h and delta_l are delta_h and delta_l obtained in S705 respectively.
[0358] According to the marks in S701, S702, S703 and S706, the delta values of all pixels are calculated.
[0359] S707, generating the original pixel value according to the value of each pixel,
[0360] In the original data, the header data of the pixel can be obtained randomly in the range of 0~8'hff, and the actual value of the pixel is the value obtained in step S706. The two are combined to obtain the original value of the pixel.
[0361] Pix[n] = {pix_hand[7:0], pixel[23:0]}, pix_hand= 0~8'hff.
[0362] Each pixel is usually 4Byte, that is, 32bit, so the original pixel value consists of two parts, an 8bit header and a 24bit actual value. The 8bit header pix_hand can be random in the range of 0~8'hff, and the 24bit actual value is the 24bit value obtained in S6.
[0363] S708, generating an original package according to the original value of each pixel, and obtaining a compressed test vector.
[0364] Package_orig = {pix[n], pix[n-1], …, pix[1], pix[0]}.
[0365] According to the original value of each pixel, a compressed test vector is combined, that is, the compressed test vector is all pixels, arranged in sequence from 0 to n.
[0366] According to the above eight steps, a complete uncompressed data packet test case can be generated from the randomly generated compressed data packet.
[0367] Accordingly, the embodiment of the present disclosure also provides a device for generating image decompression test cases based on a depth buffer algorithm, such as Fig. 9 As shown, the device comprises:
[0368] The first random module is used to randomly generate the value of N2, and assumes that the number of 1s in N2 is N3_num.
[0369] The second random module is used to randomly generate the value of N3, and assumes that the number of 2'b00 or 2'b10 in N3 is N4_num, and uses N4_symbol_0[*] to represent the value of the 0th bit of the symbol in N4.
[0370] If the current pixel's random N3 value is 2'b00, the corresponding N4_symbol_0[N4_num]=1'b0;
[0371] If the current pixel's random N3 value is 2'b10, the corresponding N4_symbol_0[N4_num]=1'b1;
[0372] The third random module is used to randomly set the value of N4. Assume that the size of N5 corresponding to the pixel value of N4 is N5_size, and the size of N6 corresponding to N4 is N6_size.
[0373] Randomly generate the value of each pixel in N4, each value ranges from 4'b0000 to 4'b1111, and this value together with N4_symbol_0[*] in S2 constitutes a complete symbol value;
[0374] Based on the complete symbol value, generate the size of the corresponding pixel in N5, N5_size, and the size of the pixel in N6, N6_size.
[0375] The generation module is used to generate each pixel delta value according to the values of N5_size and N6_size. According to the values of each N5_size and N6_size, each N5 and N6 value is randomly generated: the range of each N5 is 2 to the power of N5_size-1~2 to the power of N5_size-1, the range of each N6 is 2 to the power of N6_size-1~2 to the power of N6_size-1, and N0_temp is the count value of the total length of N5.
[0376] The calculation module is used to calculate the value of N0 according to the value of N0_temp, N0=N0_temp / 2,
[0377] The fourth random module is used for randomizing the value of N1, where N1 = 0~24'hff_ffff.
[0378] Among them, the specific steps of the above-mentioned device to execute the decompression test case generation method can refer to the description in the above-mentioned method embodiment, which will not be repeated here.
[0379] Correspondingly, the embodiment of the present disclosure further provides an image compression test case generation device based on the depth buffer algorithm, as Fig.10 shown, the device includes:
[0380] The first acquisition module is used to obtain the pixel of N1 based on the value of N2, that is, the row and column where the first 1 in N2 is located,
[0381] The second acquisition module is used to obtain the pixel of FC and the pixel where Delta is equal to predict delta according to the value of N2. Specifically,
[0382] (1) Starting from the first pixel until the first pixel where N2[i]=1 is encountered, its pixel value is FC, that is, pixel[m,n]=FC, m<x, n<y, and mark the position of this pixel,
[0383] (2) Starting from the position where N1 is marked until the end, if N2[x,y]=0, then its pixel value is FC or its delta value is predict delta,
[0384] If the values of the pixels smaller than the row or column where this pixel is located are all FC, then this pixel is FC, and mark the position of this pixel. Otherwise, the Delta of this pixel is equal to predict delta, and mark the position of this pixel,
[0385] (3) Starting from the position where N1 is marked until the end, if N2[x,y]=1, then its delta value needs to be parsed according to the value of N3,
[0386] The third acquisition module is used to obtain the pixel where delta is equal to predict delta + 1 or delta is equal to predict delta - 1 according to the value of N3, and the delta value of the pixel in other cases,
[0387] Calculate the total length of N3 according to the number of 1s in N2, that is, starting from the first 1 in N2 until N2 is traversed. If N2[i] is equal to 1, the total length of N3 is increased by 2,
[0388] Extract each value in N3 and judge the delta situation of the pixel according to each value:
[0389] If the value is 2’b01, then Delta is equal to predict delta - 1, and mark the position where this delta is located,
[0390] If the value is 2'b11, Delta is equal to predicted delta + 1, and the position of the delta is marked.
[0391] Otherwise, extract the lowest bit of symbol, that is, Symbol_l[*]= N3[j*2+1],
[0392] Calculate the number of data in N4, that is, each value of 2'b00 or 2'b10 in N3 corresponds to a number in N4,
[0393] The fourth acquisition module is used to obtain the delta_szie of the remaining pixels according to the value of N4 and the value of symb_l[*] in S3, where symb_l[*] represents the lowest 1 bit of the symbol in N3, and delta_szie represents the number of bits occupied by the delta of each remaining pixel, that is, the value of each symbol.
[0394] The fifth acquisition module is used to obtain the delta value of each pixel according to the symbol value.
[0395] According to the symbol value, get the number of bits occupied by the corresponding pixel's delta in N5 and N6.
[0396] The sixth acquisition module is used to obtain the pixel value according to the delta value of each pixel.
[0397] If it is the pixel at row 0 and column 0, the predicted value of the pixel is FC.
[0398] If it is a pixel in the 0th column of another pixel, the predicted value of the pixel is the pixel value in the 0th column of the previous row.
[0399] Otherwise, the predicted value of the pixel is the pixel value of the previous column in the same row.
[0400] Calculate the value of each pixel based on the predicted value of each pixel and the delta value. The pixel value is equal to the sum of the predicted value of the pixel and the corresponding delta value.
[0401] The seventh acquisition module is used to generate the original pixel value according to the value of each pixel.
[0402] In the original data, the header data of the pixel can be obtained randomly in the range of 0~8'hff, and the actual value of the pixel is the value obtained in step S706. The two are combined to obtain the original value of the pixel.
[0403] The eighth acquisition module is used to generate an original package according to the original value of each pixel to obtain a compressed test vector.
[0404] Among them, the specific steps of the above-mentioned device to execute the compression test case generation method can refer to the description in the above-mentioned method embodiment, and will not be repeated here.
[0405] Accordingly, an embodiment of the present application further provides an electronic device, which may be a terminal or a server. Fig.11 As shown, Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0406] The electronic device 1100 includes a processor 1101 having one or more processing cores, a memory 1102 having one or more computer-readable storage media, and a computer program stored in the memory 1102 and executable on the processor. The processor 1101 is electrically connected to the memory 1102. Those skilled in the art will appreciate that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0407] The processor 1101 is the control center of the electronic device 1100. It uses various interfaces and lines to connect various parts of the entire electronic device 1100, executes various functions of the electronic device 1100 and processes data by running or loading software programs (computer programs) and / or units stored in the memory 1102, and calling data stored in the memory 1102, thereby monitoring the electronic device 1100 as a whole.
[0408] In the embodiment of the present application, the processor 1101 in the electronic device 1100 will load the instructions corresponding to the processes of one or more applications into the memory 1102 according to the following steps, and the processor 1101 will run the application stored in the memory 1102 to implement various functions. The specific implementation of each operation to implement the function can be referred to the aforementioned embodiment, which will not be repeated here.
[0409] Optional, such as Fig.11 As shown, the electronic device 1100 further includes: a test case generation module 1103, a communication module 1104, an input unit 1105 and a power supply 1106. The processor 1101 is electrically connected to the test case generation module 1103, the communication module 1104, the input unit 1105 and the power supply 1106 respectively. Those skilled in the art can understand that Fig.11The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0410] The test case generation module can be used to generate decompression / compression test cases.
[0411] The communication module 1104 may be used to communicate with other devices.
[0412] The input unit 1105 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0413] The power supply 1106 is used to supply power to various components of the electronic device 1100. Optionally, the power supply 1106 can be logically connected to the processor 1101 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 1106 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0414] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0415] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0416] To this end, an embodiment of the present application provides a computer-readable storage medium, which stores multiple computer programs. The computer programs can be loaded by a processor to execute the steps of a test case generation method based on a depthbuffer algorithm provided in an embodiment of the present application.
[0417] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0418] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0419] Since the computer program stored in the storage medium can execute the steps in any one of the test case generation methods based on the depth buffer algorithm provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the test case generation methods based on the depth buffer algorithm provided in the embodiments of the present application can be achieved. Please see the previous embodiments for details and will not be repeated here.
[0420] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0421] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0422] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0423] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions and variations of these embodiments are made without departing from the principles and spirit of the present invention, and still fall within the scope of protection of the present invention.
Claims
1. A method for generating image decompression test cases based on a depth buffer algorithm, based on image tiles, the compressed image data encoding package is divided into 7 parts, namely N0, N1, N2, N3, N4, N5, N6, where tile is expressed as x*y; the characteristics are as follows: The generation of image decompression test cases includes the following steps: S601, randomly generate the value of N2, and assume that the number of 1s in N2 is N3_num. S602, randomly generate the value of N3, and assume that the number of values of 2’b00 or 2’b10 in N3 is N4_num. Use N4_symbol_0[*] to represent the value of the 0th bit of symbol in N4. If the randomly generated N3 value of the current pixel is 2’b00, then the corresponding N4_symbol_0[N4_num] = 1’b0; If the randomly generated N3 value of the current pixel is 2’b10, then the corresponding N4_symbol_0[N4_num] = 1’b1; S603, randomly generate the value of N4. Assume that the size of N5 corresponding to the N4 value of the pixel is N5_size, and the size of N6 corresponding to it is N6_size. Randomly generate the value of each pixel in N4. The range of each value is 4’b0000~4’b1111. This value and N4_symbol_0[*] in S602 together form the complete symbol value. Based on the complete symbol value, generate the size of N5 corresponding to the pixel, N5_size, and the size of N6 corresponding to the pixel, N6_size. S604, generate the delta value of each pixel according to the values of N5_size and N6_size. Randomly generate the values of each N5 and N6 according to the values of each N5_size and N6_size: The range of each N5 is from 2 to the power of (N5_size - 1) to 2 to the power of N5_size - 1. The range of each N6 is from 2 to the power of (N6_size - 1) to 2 to the power of N6_size - 1. N0_temp is the count value of the total length of N5. S605, calculate the value of N0 according to the value of N0_temp, N0 = N0_temp / 2. S606, randomly generate the value of N1, where N1 = 0~24‘hff_ffff.
2. A method for generating image compression test cases based on a depth buffer algorithm, based on image tiles, the compressed image data encoding package is divided into 7 parts, namely N0, N1, N2, N3, N4, N5, N6, where tile is expressed as x*y; characterized in that, The generation of image compression test cases includes the following steps: Step S701, according to the value of N2, obtain the pixel of N1, that is, the row and column where the first 1 in N2 is located. Step S702, according to the value of N2, obtain the pixel of FC and the pixel where Delta is equal to predict delta. Specifically, (1) Starting from the first pixel until the first pixel where N2[i]=1 is encountered, its pixel value is FC, that is, pixel[m,n]= FC, m<x, n<y, and mark the position of this pixel. (2) Starting from the position where N1 is marked until the end, if N2[x,y]=0, then its pixel value is FC or its delta value is predict delta. If the values of pixels smaller than the row or column of the pixel are all FC, then the pixel is FC and the position of the pixel is marked. Otherwise, the Delta of the pixel is equal to the predicted delta, and the position of the pixel is marked. (3) Starting from the position marked N1 until the end, if N2[x, y] = 1, its delta value needs to be parsed according to the value of N3. S703, according to the value of N3, obtain the pixel whose delta is equal to predicted delta+1 or delta is equal to predicted delta-1, as well as the delta value of the pixel that is not in the above cases, According to the number of 1s in N2, the total length of N3 is calculated, that is, starting from the first 1 in N2 until N2 is traversed, if N2[i] is equal to 1, the total length of N3 is increased by 2. Extract each value in N3 and determine the delta of the pixel based on each value: If the value is 2'b01, Delta is equal to predicted delta-1, and the position of the delta is marked. If the value is 2'b11, Delta is equal to predicted delta + 1, and the position of the delta is marked. Otherwise, extract the lowest bit of symbol, that is, Symbol_l[*]= N3[j*2+1], Calculate the number of data in N4, that is, each value of 2'b00 or 2'b10 in N3 corresponds to a number in N4, S704, according to the value of N4 and the value of Symbol_l[*] in S703, the delta_szie of the remaining pixels is obtained, where symbol_l[*] indicates that the symbol exists in the lowest 1 bit in N3, and delta_szie indicates the number of bits occupied by the delta of each remaining pixel, that is, the value of each symbol. S705, calculate the delta value of each pixel according to the symbol value, According to the symbol value, get the number of bits occupied by the corresponding pixel's delta in N5 and N6. S706, obtaining pixel value according to delta value of each pixel, If it is the pixel at row 0 and column 0, the predicted value of the pixel is FC. If it is a pixel in the 0th column of another pixel, the predicted value of the pixel is the pixel value in the 0th column of the previous row. Otherwise, the predicted value of the pixel is the pixel value of the previous column in the same row. Calculate the value of each pixel based on the predicted value of each pixel and the delta value. The pixel value is equal to the sum of the predicted value of the pixel and the corresponding delta value. S707, generating the original pixel value according to the value of each pixel, In the original data, the header data of the pixel can be obtained randomly in the range of 0~8'hff, and the actual value of the pixel is the value obtained in step S706. The two are combined to obtain the original value of the pixel. S708. Generate an original package based on the original values of each pixel to obtain a compression test vector.
3. An apparatus for generating an image decompression test case based on the depth buffer algorithm, the apparatus comprising: A first random module for randomly generating a value of N2 and assuming that the number of 1s in N2 is N3_num. A second random module for randomly generating a value of N3 and assuming that the number of values of 2'b00 or 2'b10 in N3 is N4_num. Let N4_symbol_0[*] represent the value of the 0th bit of the symbol in N4. If the randomly generated value of N3 for the current pixel is 2'b00, then the corresponding N4_symbol_0[N4_num] = 1'b0; If the randomly generated value of N3 for the current pixel is 2'b10, then the corresponding N4_symbol_0[N4_num] = 1'b1; A third random module for randomly generating a value of N4. Assume that the size of N5 corresponding to the N4 value of the pixel is N5_size, and the size of N6 corresponding to it is N6_size. Randomly generate the value of each pixel in N4, where the range of each value is 4'b0000 to 4'b1111. This value and N4_symbol_0[*] together form a complete symbol value. Based on the complete symbol value, generate the size of N5 corresponding to the pixel, N5_size, and the size of N6 corresponding to the pixel, N6_size. A generation module for generating the delta value of each pixel according to the values of N5_size and N6_size, and randomly generating the values of each N5 and N6 according to the values of each N5_size and N6_size: the range of each N5 is from 2 to the power of N5_size - 1 to 2 to the power of N5_size - 1, the range of each N6 is from 2 to the power of N6_size - 1 to 2 to the power of N6_size - 1, and N0_temp is the count value of the total length of N5. A calculation module for calculating the value of N0 according to the value of N0_temp, where N0 = N0_temp / 2. A fourth random module for randomly generating a value of N1, where N1 = 0 to 24'hff_ffff.
4. An apparatus for generating an image compression test case based on the depth buffer algorithm, the apparatus comprising: A first acquisition module for obtaining the pixel of N1 according to the value of N2, that is, the row and column where the first 1 in N2 is located. A second acquisition module for obtaining the pixel of FC and the pixel where Delta is equal to the predict delta according to the value of N2. Specifically, (1) Starting from the first pixel until the first pixel where N2[i] = 1 is encountered, its pixel value is FC, that is, pixel[m,n] = FC, m < x, n < y, and mark the position of this pixel. (2) Starting from the position marked N1 until the end, if N2[x, y] = 0, then its pixel value is FC or its delta value is predicted delta, If the values of pixels smaller than the row or column of the pixel are all FC, then the pixel is FC and the position of the pixel is marked. Otherwise, the Delta of the pixel is equal to the predicted delta, and the position of the pixel is marked. (3) Starting from the position marked N1 until the end, if N2[x, y] = 1, its delta value needs to be parsed according to the value of N3. The third acquisition module is used to obtain the pixel whose delta is equal to predicted delta+1 or delta is equal to predicted delta-1, and the delta value of the pixel other than the above cases according to the value of N3. According to the number of 1s in N2, the total length of N3 is calculated, that is, starting from the first 1 in N2 until N2 is traversed, if N2[i] is equal to 1, the total length of N3 is increased by 2. Extract each value in N3 and determine the delta of the pixel based on each value: If the value is 2'b01, Delta is equal to predicted delta-1, and the position of the delta is marked. If the value is 2'b11, Delta is equal to predicted delta +1, and the position of the delta is marked. Otherwise, extract the lowest bit of symbol, that is, Symbol_l[*]= N3[j*2+1], Calculate the number of data in N4, that is, each value of 2'b00 or 2'b10 in N3 corresponds to a number in N4, The fourth acquisition module is used to obtain the delta_szie of the remaining pixels according to the value of N4 and the value of Symbol_l[*], where symb_l[*] indicates the lowest bit of the symbol in N3, and delta_szie indicates the number of bits occupied by the delta of each remaining pixel, that is, the value of each symbol. The fifth acquisition module is used to obtain the delta value of each pixel according to the symbol value. According to the symbol value, get the number of bits occupied by the corresponding pixel's delta in N5 and N6. The sixth acquisition module is used to obtain the pixel value according to the delta value of each pixel. If it is the pixel at row 0 and column 0, the predicted value of the pixel is FC. If it is a pixel in the 0th column of another pixel, the predicted value of the pixel is the pixel value in the 0th column of the previous row. Otherwise, the predicted value of the pixel is the pixel value of the previous column in the same row. Calculate the value of each pixel based on the predicted value of each pixel and the delta value. The pixel value is equal to the sum of the predicted value of the pixel and the corresponding delta value. The seventh acquisition module is used to generate the original pixel value according to the value of each pixel. In the original data, the pixel header data can be randomly obtained in the range of 0~8'hff. The pixel header data and the pixel value are combined to obtain the original value of the pixel. The eighth acquisition module is used to generate an original package according to the original value of each pixel to obtain a compressed test vector.
5. An electronic device, characterized in that: It comprises a memory storing executable program code and a processor coupled to the memory; wherein the processor calls the executable program code stored in the memory to execute the method according to any one of claims 1-2.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 2 is performed.