Method and device for encoding data and computer readable storage medium
By integrating different scanning methods in the encoding unit, the problem that different scanning methods cannot be integrated in the encoding unit in the prior art is solved, and higher encoding efficiency and flexibility are achieved.
Patent Information
- Application Number
- CN202411819541.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-18
AI Technical Summary
The existing string prediction technology only supports different scanning methods at the encoding unit level, and does not support the integration of different scanning methods within the encoding unit, resulting in a significant reduction in encoding efficiency.
By determining the set of string prediction scanning methods of the current encoding unit, including the division method and the corresponding scanning method, string prediction encoding and pixel reconstruction are performed in turn, distortion and evaluation function values of each scanning method are evaluated, and scanning methods and encoding parameters corresponding to the minimum evaluation function value are selected for entropy encoding.
It realizes the integration of different scanning methods in the encoding unit, improves the flexibility and encoding efficiency of string prediction, reduces redundant information, and thus improves the effect of data compression.
Smart Images

Figure CN119854507A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of data compression technology. More specifically, the present disclosure relates to a method, apparatus and computer-readable storage medium for encoding data. Further, the present disclosure also relates to a method, apparatus and computer-readable storage medium for decoding data. Background Art
[0002] At present, the technologies that greatly improve the coding efficiency of screen videos are intra block copy technology (IBC) and intra string copy technology (ISC). IBC technology is a block matching-based technology that extends traditional inter-frame prediction to the current frame. If the optimal reference block (also called reference block) can be found in the reference pixel set, the positional relationship between the reference block and the current coding block (also called current block) is represented by a displacement vector parameter. IBC technology has a relatively high coding efficiency for patterns of fixed size and shape that appear repeatedly in screen images. ISC technology uses "string" as the smallest copying unit. If the optimal reference pixel string (also called reference string) can be found in the reference pixel set, the positional relationship between the reference string and the current coding pixel string (also called current string) and the length of the reference string are represented by a copy relationship parameter, otherwise the current pixel value is directly encoded. Compared with other methods, ISC technology can flexibly copy string size (the minimum can be one pixel or one component of a pixel) and shape, which has a natural adaptability to patterns of various sizes and shapes that are similar or identical in screen images, and can achieve higher copying accuracy.
[0003] As the number of computer-generated content in screen content continues to increase, including professionally generated content (PGC), user generated content (UGC), and artificial intelligence generated content (AIGC), screen content is highly mixed, not only between coding units, but also within coding units. However, existing string prediction technology only supports different scanning methods at the coding unit level, and does not support the integration of different scanning methods within the coding unit, which greatly reduces the coding efficiency.
[0004] In view of this, there is an urgent need to provide a solution for encoding data so as to integrate different scanning modes within the encoding unit, improve the flexibility of string prediction, and further improve the encoding efficiency of the screen content. Summary of the invention
[0005] In order to at least solve one or more of the technical problems mentioned above, the present disclosure proposes a solution for encoding data in multiple aspects.
[0006] In a first aspect, the present disclosure provides a method for encoding data, comprising: determining a set of string prediction scanning modes for a current coding unit, each string prediction scanning mode in the set of string prediction scanning modes comprising a division mode and at least one corresponding scanning mode; sequentially performing string prediction coding and pixel reconstruction on the current coding unit based on each string prediction scanning mode in the set of string prediction scanning modes to obtain multiple string prediction coding parameter sets and multiple reconstructed pixel arrays of the current coding unit; determining the distortion degree corresponding to each string prediction scanning mode based on an initial pixel array and multiple reconstructed pixel arrays of the current coding unit to obtain multiple distortion degrees; obtaining multiple evaluation function values based on the multiple string prediction scanning parameter sets and multiple distortion degrees, and determining a minimum value among the multiple evaluation function values, as well as determining the string prediction scanning mode and the string prediction coding parameter set corresponding to the minimum value; converting the string prediction scanning mode and the string prediction coding parameter set corresponding to the minimum value into a code stream through entropy coding to achieve encoding of the current coding unit.
[0007] In some embodiments, string prediction coding and pixel reconstruction are performed on the current coding unit based on a string prediction scanning method to obtain a string prediction coding parameter set and a reconstructed pixel array of the current coding unit, including: dividing the initial pixel array of the current coding unit using a division method in the string prediction scanning method to obtain at least one sub-pixel array; scanning the at least one sub-pixel array respectively using at least one scanning method in the string prediction scanning method to obtain at least one pixel string constituting a pixel string set; performing string prediction coding on the at least one pixel string respectively to obtain at least one string prediction coding parameter constituting a string prediction coding parameter set; performing pixel reconstruction based on the division method, the at least one scanning method and the at least one string prediction coding parameter to obtain the reconstructed pixel array of the current unit.
[0008] In some embodiments, determining a set of string prediction scanning modes for a current coding unit includes: determining a maximum number of different scanning modes within the fusion of the current coding unit; and based on the maximum number, determining at least one division method constituting the set of string prediction scanning modes, and at least one scanning mode corresponding to each division method.
[0009] In some embodiments, based on the maximum number, at least one division method constituting a set of string prediction scanning methods is determined, and at least one scanning method corresponding to each division method includes: when the maximum number is 2, the at least one division method includes no division and two divisions, and the scanning method corresponding to the no division is forward horizontal back-and-forth scanning or reverse horizontal back-and-forth scanning, and the scanning method corresponding to the two divisions is forward horizontal back-and-forth scanning and reverse horizontal back-and-forth scanning, or reverse horizontal back-and-forth scanning and forward horizontal back-and-forth scanning; when the maximum number is 3, the at least one division method also includes three divisions, and the scanning methods corresponding to the three divisions are forward horizontal back-and-forth scanning, reverse horizontal back-and-forth scanning and forward horizontal grating scanning, or reverse horizontal back-and-forth scanning, forward horizontal back-and-forth scanning and forward horizontal grating scanning; when the maximum number is 4, the at least one division method also includes four divisions, and the scanning methods corresponding to the four divisions are forward horizontal grating scanning, reverse horizontal grating scanning, forward horizontal back-and-forth scanning and reverse horizontal back-and-forth scanning, or forward horizontal back-and-forth scanning, reverse horizontal back-and-forth scanning, forward horizontal grating scanning and reverse horizontal grating scanning.
[0010] In some embodiments, dividing the initial pixel array of the current coding unit using the division method in the string prediction scanning method includes: determining a division ratio based on the division method and the size of the current coding unit; and dividing the initial pixel array according to the division ratio.
[0011] In some embodiments, based on the division mode and the size of the current coding unit, determining the division ratio includes: when the division mode is two-division and the size is 4×4, the division ratio is horizontal 2:2, horizontal 1:3, vertical 2:2 or vertical 1:3; when the division mode is two-division and the size is 8×8, the division ratio is horizontal 3:5 or vertical 3:5; when the division mode is three-division and the size is 4×4, the division ratio is horizontal 1:1:2, horizontal 1:2:1 , horizontally 2:1:1, vertically 1:1:2, vertically 1:2:1, vertically 2:1:1; when the division method is three divisions and the size is 8×8, the division ratio is horizontally 2:4:2 or vertically 2:4:2; when the division method is four divisions and the size is 4×4, the division ratio is horizontally 1:1:1:1 or vertically 1:1:1:1; when the division method is four divisions and the size is 8×8, the division ratio is horizontally 1:3:3:1 or vertically 1:3:3:1.
[0012] In a second aspect, the present disclosure provides a device for encoding data, including an acquisition module, which is configured to acquire a set of string prediction scanning modes, each string prediction scanning mode in the string prediction scanning mode set includes a division mode and a corresponding at least one scanning mode; a first encoding module, which is configured to perform string prediction encoding and pixel reconstruction on a current encoding unit based on each string prediction scanning mode in the string prediction scanning mode set in turn, so as to obtain multiple string prediction encoding parameter sets and multiple reconstructed pixel arrays of the current encoding unit; an evaluation module, which is configured to determine the distortion corresponding to each string prediction scanning mode based on an initial pixel array and multiple reconstructed pixel arrays of the current encoding unit, so as to obtain multiple distortion degrees; a determination module, which is configured to obtain multiple evaluation function values based on the multiple string prediction scanning parameter sets and multiple distortion degrees, and determine the minimum value among the multiple evaluation function values, as well as the string prediction scanning mode and the string prediction encoding parameter set corresponding to the minimum value; a second encoding module, which is configured to write the string prediction scanning mode and the string prediction encoding parameter set corresponding to the minimum value into a bitstream after entropy encoding, so as to realize encoding of the current encoding unit.
[0013] In a third aspect, the present disclosure provides a method for decoding data, comprising: receiving a code stream of a current coding unit generated according to the method described in the first aspect and its multiple embodiments; performing entropy decoding on the code stream to obtain a string prediction scanning method and a string prediction coding parameter set; performing string prediction decoding on the string prediction coding parameter set to obtain a pixel string set; and based on the string prediction scanning method, performing array combination on the pixel string set to obtain a reconstructed pixel array of the current coding unit.
[0014] In a fourth aspect, the present disclosure provides an apparatus for decoding data, comprising: a receiving module configured to receive a code stream of a current coding unit generated according to the method described in the first aspect and its multiple embodiments; a first decoding module configured to perform entropy decoding on the code stream to obtain a string prediction scanning method and a string prediction coding parameter set; a second decoding module configured to perform string prediction decoding on the string prediction coding parameter set to obtain a pixel string set; and a combining module configured to perform array combination on the pixel string set based on the string prediction scanning method to obtain a reconstructed pixel array of the current coding unit.
[0015] In the fifth aspect, the present disclosure provides a computer-readable storage medium having stored thereon program instructions for encoding or decoding data, which, when executed by a processor, implement the method and its multiple embodiments described in the first aspect or the method and its multiple embodiments described in the third aspect.
[0016] As provided above, the scheme for encoding data can determine the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum evaluation function value by performing string prediction coding and pixel reconstruction on the current coding unit based on each string prediction scanning mode in the string prediction scanning mode set, and then convert the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum value into a code stream through entropy coding. The scheme disclosed in the present invention fully considers the high mixing of screen content, and by adopting a partitioning method to divide the current coding unit, it is possible to integrate multiple scanning modes in the current coding unit, greatly increasing the flexibility of string prediction. In addition, the smaller the evaluation function value, the higher the efficiency of data compression at a given distortion level, which can reduce redundant information, thereby improving the coding efficiency of string prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] By reading the detailed description below with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0018] Figure 1 A schematic diagram showing different scanning modes at the coding unit level of an embodiment of the present disclosure is shown;
[0019] Figure 2 A schematic diagram showing the fusion of different scanning modes in a coding unit according to an embodiment of the present disclosure is shown;
[0020] Figure 3 An exemplary flow chart showing a method for encoding data according to some embodiments of the present disclosure is shown;
[0021] Figure 4 An exemplary flow chart showing a method for performing string prediction coding and pixel reconstruction on a current coding unit based on a string prediction scanning mode according to some other embodiments of the present disclosure is shown;
[0022] Figure 5 An exemplary flow chart of a method for decoding data according to an embodiment of the present disclosure is shown;
[0023] Figure 6 An exemplary structural block diagram of a device for encoding data according to an embodiment of the present disclosure is shown;
[0024] Figure 7 An exemplary structural block diagram of a device for decoding data according to an embodiment of the present disclosure is shown;
[0025] Figure 8 An exemplary structural block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0027] It should be understood that the terms "include" and "comprising" used in the specification and claims of the present disclosure indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0028] It should also be understood that the terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. As used in this disclosure and claims, the singular forms of "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in this disclosure and claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations.
[0029] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0030] The specific implementation of the present disclosure is described in detail below with reference to the accompanying drawings.
[0031] For ease of understanding, before introducing in detail the scheme for encoding data disclosed in the present invention, the technical background involved in the present invention is first introduced.
[0032] Screen video refers to the video captured directly from the image display unit. It is the core data element of explosively growing applications such as remote screen control, cloud teaching / office, video conferencing and metaverse. Its content is diverse and mixed. Efficient screen video encoding technology is the key to low-cost storage and real-time transmission of screen video, and it is also a high ground for international competition.
[0033] From the perspective of video coding, the most notable feature of screen video is the diversity and hybridity of screen images. Screen images not only contain natural video or image content captured by a video camera or digital camera, but also various graphics, icons, charts, texts, menus, and buttons generated by computers. The hybrid coding technology of prediction and transformation based on blocks as the basic unit in traditional video coding technology has a relatively high compression efficiency for natural videos or images, but it is not very efficient for screen images. It is necessary to seek new coding tools to fully explore the characteristics of screen images in order to significantly improve the coding efficiency of screen images.
[0034] Therefore, efficient screen image coding technology has received great attention from academia and industry. At present, the research on screen image coding technology mainly focuses on the HEVC (High Efficiency Video Coding), VVC (Versatile Video Coding) SCC extended version jointly formulated by the three major international standard organizations of the International Telecommunications Union (ITU), the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC), and the AVS second and third generation (abbreviated as AVS2, AVS3) standard jointly formulated by the Institute of Electrical and Electronics Engineers (IEEE) and my country's digital audio and video coding technology standard (Audio Video Coding Standard, AVS) The screen mixed content video coding (Screen and Mixed Content Coding, SMCC) extended version standard and AV1 led by the Open Media Alliance.
[0035] In AVS3, a variety of intra-frame string copying sub-modes and string types have been adopted. The existing string copy intra-frame prediction mode has two sub-modes: ordinary string sub-mode and non-ordinary string sub-mode. The coding unit of the non-ordinary string sub-mode consists of an equivalent string, a unit base vector string and an unmatched sample. The values of all samples of an equivalent string are equal to the values of the samples at the same common position. The coding unit of the ordinary string sub-mode consists of a matching string and an incomplete matching string. An incomplete matching string refers to a string that contains at least one unmatched sample; a matching string refers to a string that does not contain unmatched samples. In addition, according to the scanning method, whether the string pixel values are equal, the motion vector and the string length, it can be divided into many types of strings, such as forward scanning strings and reverse scanning strings; equivalent strings and non-equivalent strings; upper strings, left strings and non-upper strings, non-left strings, etc.; the length is equal to the entire coding unit string (also called large string or CUsize string, etc.).
[0036] An image data set is a collection of finite data arranged in a certain spatial (one-dimensional, two-dimensional or multi-dimensional) shape, consisting of data samples, also called elements (e.g., bytes, bits, pixels, pixel components, spatial sampling points, transform domain coefficients) (e.g., a one-dimensional data queue, a two-dimensional data file, an image, a video sequence, a transform domain, a transform block, multiple transform blocks, a three-dimensional scene, a sequence of continuously changing three-dimensional scenes).
[0037] When encoding (and correspondingly decoding) a data set, especially a two-dimensional or larger data set, for data compression, the data set is usually divided into a number of subsets with predetermined shapes, called coding units (from the perspective of decoding, also called decoding units), and encoding or decoding is performed one by one in a predetermined time sequence in units of coding units or decoding units. At any moment, the coding unit being encoded is called the current coding unit. At any moment, the decoding unit being decoded is called the current decoding unit. The current coding unit or the current decoding unit can be referred to as the current unit. The sample value being encoded or decoded is called the current encoding sample value or the current decoding sample value, which can be referred to as the current sample value or the current element.
[0038] Existing digital audio and video coding technology standards support more flexible division methods. For example, the block division method of AVS3 includes a joint division structure of quadtree (QT), binary tree (BT) and enhanced quadtree (EQT). In the research on string prediction technology in early video coding standards (for example, High Efficiency Video Coding, HEVC), the coding unit adopted a variety of scanning methods, such as raster horizontal scanning method, raster vertical scanning method, back-and-forth horizontal scanning method and back-and-forth vertical scanning method. For example, the AVS3 standard adopts the string prediction technology of the forward back-and-forth horizontal scanning method. The exploration software of AVS4 adopts the string prediction technology of the reverse back-and-forth horizontal scanning method. Different division methods and scanning methods increase the flexibility of string prediction and help improve the coding efficiency of string prediction.
[0039] However, the existing string prediction technology only supports different scanning modes at the coding unit level, and does not support the integration of different scanning modes within the coding unit, which greatly reduces the coding efficiency. Figure 1 and Figure 2 Understand the different scanning methods at the coding unit level and the integration of different scanning methods within the coding unit respectively.
[0040] like Figure 1As shown in FIG. 1 , different scanning modes at the coding unit level may include 8 scanning modes, namely, forward back-and-forth horizontal scanning, forward back-and-forth vertical scanning, forward raster horizontal scanning, forward raster vertical scanning, reverse back-and-forth horizontal scanning, reverse back-and-forth vertical scanning, reverse raster horizontal scanning, and reverse raster vertical scanning. After applying different scanning modes at the coding unit level to the coding units on the left, the corresponding 8 scanning results on the right can be obtained. It can be seen that, in this case, only one scanning mode is applied to the entire coding unit.
[0041] like Figure 2 As shown, the fusion of different scanning modes in the coding unit may include forward back-and-forth horizontal scanning and reverse back-and-forth horizontal scanning (referred to as forward and reverse back-and-forth horizontal scanning), reverse back-and-forth horizontal scanning and forward back-and-forth horizontal scanning (referred to as reverse back-and-forth horizontal scanning), forward back-and-forth vertical scanning and reverse back-and-forth vertical scanning (referred to as forward and reverse back-and-forth vertical scanning), reverse back-and-forth vertical scanning and forward back-and-forth vertical scanning (referred to as reverse back-and-forth vertical scanning), forward grating horizontal scanning and reverse grating horizontal scanning (referred to as forward and reverse grating horizontal scanning), reverse grating horizontal scanning and forward grating horizontal scanning (referred to as reverse grating horizontal scanning), forward grating vertical scanning and reverse grating vertical scanning (referred to as forward and reverse grating vertical scanning), reverse grating vertical scanning and forward grating vertical scanning (referred to as reverse grating vertical scanning), a total of 8 fusion scanning modes. After applying different fusion scanning modes to the coding units on the left, 8 scanning results corresponding to the first two rows on the right can be obtained. It can be seen that in this case, the coding unit is divided into two left and right or upper and lower sub-units, and two different scanning methods are applied to the two sub-units respectively, that is, the two different scanning methods are fused in the coding unit, that is, the fused scanning method is applied to the coding unit.
[0042] In addition, when the coding unit is divided into two sub-units, that is, when the coding unit is divided into two, the horizontal ratio can be 2:2 (such as Figure 2 The first row and first column of the scan results are shown in the figure), vertical 2:2 (as ... Figure 2 The first row and second column of the scan results are shown), horizontal 1:3 (as shown in Figure 2 The third row and first column of the scan result are shown in the figure) or vertical 1:3 (as shown in the figure) Figure 2 Thus, when scanning the coding unit, different division ratios are combined with different fusion scanning methods to obtain 16 scanning results corresponding to the right side. This undoubtedly greatly increases the flexibility of the subsequent string prediction process.
[0043] Next, combine Figure 3The method 300 for encoding data provided by the embodiment of the present disclosure is exemplarily introduced. It is understandable that the method 300 can be executed by any appropriate device with data processing capability, such as but not limited to a processor, a terminal device, and a server.
[0044] like Figure 3 As shown, at step S301, the method 300 may determine a set of string prediction scanning modes for a current coding unit, each string prediction scanning mode in the set of string prediction scanning modes including a partitioning mode and at least one corresponding scanning mode.
[0045] Then, at step S302, the method 300 may sequentially perform string prediction coding and pixel reconstruction on the current coding unit based on each string prediction scanning mode in the string prediction scanning mode set to obtain multiple string prediction coding parameter sets and multiple reconstructed pixel arrays of the current coding unit. To facilitate understanding, how to obtain multiple string prediction coding parameter sets and multiple reconstructed pixel arrays of the current coding unit will be described later in conjunction with Figure 4 A method for performing string prediction coding and pixel reconstruction on a current coding unit based on a string prediction scanning method is described in detail.
[0046] Next, at step S303, the method 300 may determine the distortion corresponding to each string prediction scanning mode based on the initial pixel array and multiple reconstructed pixel arrays of the current coding unit to obtain multiple distortion degrees. Here, the distortion degree may be a mean square error or an absolute error between the initial pixel array and the reconstructed pixel array.
[0047] Thereafter, at step S304, the method 300 may obtain multiple evaluation function values based on multiple string prediction scanning parameter sets and multiple distortion degrees, and determine the minimum value among the multiple evaluation function values, and determine the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum value. In the disclosed solution, the evaluation function value may be a rate distortion value.
[0048] Finally, at step S305, the method 300 may convert the string prediction scanning mode and the string prediction encoding parameter set corresponding to the minimum value into a bit stream through entropy coding to achieve coding of the current coding unit.
[0049] In the HEVC standard, the largest coding unit (LCU) is a pixel array of size 64×64. The coding unit disclosed in the present invention is a smaller coding unit obtained by further dividing the largest coding unit. In practical applications, the size of the coding unit can be 4×4 pixels, 4×8 pixels, 8×4 pixels or 8×8 pixels, that is, the coding unit is a W×H pixel array. Here, W is the width of the coding unit and H is the height of the coding unit. Based on this, the encoding and decoding method disclosed in the present invention can be used for any two-dimensional or more than two-dimensional data that can be divided into coding units.
[0050] In one embodiment, the encoding and decoding method disclosed herein can be applicable to one or more of one-dimensional data, two-dimensional data, multi-dimensional data, graphics, fractal graphics, images, sequences of images, videos, remote videos, online conferences, online teaching, three-dimensional scenes, sequences of continuously changing three-dimensional scenes, virtual reality scenes, sequences of continuously changing virtual reality scenes, images in pixel form, transform domain data of images, sets of two-dimensional or more bytes, sets of two-dimensional or more bits, sets of pixels, and sets of three-component pixels (Y, U, V).
[0051] In the scheme disclosed herein, the division method may include but is not limited to no division, two-division (i.e., dividing the coding unit into two sub-units), three-division (i.e., dividing the coding unit into three sub-units) and four-division (i.e., dividing the coding unit into four sub-units). The scanning method may include but is not limited to forward horizontal raster scanning, forward vertical raster scanning, forward horizontal back and forth scanning, forward vertical back and forth scanning, reverse horizontal raster scanning, reverse vertical raster scanning, reverse horizontal back and forth scanning and reverse vertical back and forth scanning.
[0052] In practical applications, the encoding end and the decoding end can agree on the size of the encoding unit and the set of string prediction scanning modes. In one embodiment, when method 100 determines the set of string prediction scanning modes of the current encoding unit, the maximum number of different scanning modes integrated in the current encoding unit can be determined first. Then, based on the maximum number, at least one division method constituting the set of string prediction scanning modes and at least one scanning method corresponding to each division method can be determined. It can be understood that those skilled in the art can select a specific value range of the maximum number according to actual needs, and the present disclosure does not make specific limitations on this. Preferably, the value range of the maximum number is greater than or equal to 2 and less than or equal to 4.
[0053] Specifically, when the maximum number is 2, at least one division mode may include no division and two divisions. No division corresponds to a forward horizontal back-and-forth scanning or a reverse horizontal back-and-forth scanning, and two divisions correspond to a forward horizontal back-and-forth scanning and a reverse horizontal back-and-forth scanning, or a reverse horizontal back-and-forth scanning and a forward horizontal back-and-forth scanning.
[0054] When the maximum number is 3, at least one division mode may include three divisions in addition to no division and two divisions. The scanning modes corresponding to the three divisions are forward horizontal back-and-forth scanning, reverse horizontal back-and-forth scanning and forward horizontal raster scanning, or reverse horizontal back-and-forth scanning, forward horizontal back-and-forth scanning and forward horizontal raster scanning.
[0055] In addition, when the maximum number is 4, at least one division mode may include four divisions in addition to no division, two divisions and three divisions. The scanning modes corresponding to the four divisions are forward horizontal raster scanning, reverse horizontal raster scanning, forward horizontal back and forth scanning and reverse horizontal back and forth scanning, or forward horizontal back and forth scanning, reverse horizontal back and forth scanning, forward horizontal raster scanning and reverse horizontal raster scanning.
[0056] At the aforementioned step S305, when method 300 converts the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum value into a code stream through entropy coding, the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum value can be entropy encoded separately and entropy decoded separately respectively, and the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum value can be put together for overall entropy coding and entropy decoding respectively.
[0057] In one embodiment, a unary truncation code may be used to entropy encode the string prediction scanning mode and the string prediction coding parameter set corresponding to the minimum value as a whole. As an example, it is assumed that the string prediction scanning mode corresponding to the minimum value has two scanning modes SM1 and SM2. When the two scanning modes SM1 and SM2 are encoded using a unary truncation code, SM1 may be represented by 0 and SM2 may be represented by 10. Thus, when the string prediction scanning mode includes more scanning modes, other scanning modes may be encoded by analogy.
[0058] Combination of the above Figure 3A method for encoding data is described. By performing string prediction encoding and pixel reconstruction on the current coding unit based on each string prediction scanning mode in the string prediction scanning mode set, the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum evaluation function value can be determined, and then the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum value are converted into a code stream through entropy coding. The scheme disclosed in this disclosure fully considers the high mixing of screen content. By dividing the current coding unit by a division method, multiple scanning modes can be integrated in the current coding unit, greatly increasing the flexibility of string prediction. In addition, the smaller the evaluation function value, the higher the efficiency of data compression at a given distortion level, which can reduce redundant information, thereby improving the coding efficiency of string prediction. Furthermore, the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum evaluation function value are converted into a code stream through entropy coding, ensuring that the scheme disclosed in this disclosure can be applied to both lossy data compression and lossless data compression.
[0059] Figure 4 FIG. 4 is an exemplary flow chart of a method 400 for performing string prediction coding and pixel reconstruction on a current coding unit based on a string prediction scanning method according to an embodiment of the present application. Figure 4 The description is a specific implementation of the aforementioned step S302. Figure 3 The features described in can be applied analogously here.
[0060] like Figure 4 As shown, at step S401, method 400 may divide the initial pixel array of the current coding unit by using a division method in a string prediction scanning method to obtain at least one sub-pixel array.
[0061] Then, at step S402 , the method 400 may use at least one scanning method in the string prediction scanning method to scan at least one sub-pixel array respectively to obtain at least one pixel string constituting a pixel string set.
[0062] Next, at step S403, the method 400 may perform string prediction coding on at least one pixel string respectively to obtain at least one string prediction coding parameter constituting a string prediction coding parameter set.
[0063] Finally, at step S404, the method 400 performs pixel reconstruction based on the partitioning mode, at least one scanning mode and at least one string prediction coding parameter to obtain a reconstructed pixel array of the current unit. Specifically, the string prediction coding parameter set may be firstly subjected to string prediction decoding to obtain a pixel string set of the current coding unit, and then, based on the string prediction scanning mode (i.e., the partitioning mode and the corresponding at least one scanning mode), the pixel string set may be array-combined to obtain a reconstructed pixel array of the current coding unit.
[0064] In the aforementioned step S401, when the initial pixel array of the current coding unit is divided by the division method in the string prediction scanning method, the division ratio can be determined based on the division method and the size of the current coding unit, and then the initial pixel array is divided according to the division ratio.
[0065] Here, the division ratio is determined based on the division method and the size of the current coding unit. Specifically, when the division method is two-division and the size is 4×4, the division ratio can be an equal ratio or an unequal ratio, for example, the division ratio can be horizontal 2:2, horizontal 1:3, vertical 2:2 or vertical 1:3; when the division method is two-division and the size is 8×8, the division ratio is an unequal ratio, for example, the division ratio is horizontal 3:5 or vertical 3:5.
[0066] In addition, when the division method is three divisions and the size is 4×4, the division ratio is 1:1:2 horizontally, 1:2:1 horizontally, 2:1:1 horizontally, 1:1:2 vertically, 1:2:1 vertically, or 2:1:1 vertically; when the division method is three divisions and the size is 8×8, the division ratio should satisfy that the width of the sub-unit obtained by the division is an integer multiple of 2, for example, the division ratio is 2:4:2 horizontally or 2:4:2 vertically. Furthermore, when the division method is four divisions and the size is 4×4, the division ratio is 1:1:1:1 horizontally or 1:1:1:1 vertically; when the division method is four divisions and the size is 8×8, the division ratio is 1:3:3:1 horizontally or 1:3:3:1 vertically.
[0067] After obtaining at least one sub-pixel array, a scanning mode of each sub-pixel array can be determined, and then each sub-pixel array is scanned to obtain at least one pixel string constituting a pixel string set. For ease of understanding, the following example is used to more intuitively describe the fusion of different scanning modes within the coding unit.
[0068] In one implementation scenario, the division method in the string prediction scanning method is two-division, and at least one scanning method corresponding to the division method is forward horizontal back-and-forth scanning and reverse horizontal back-and-forth scanning. In this scenario, when the coding unit size is 8×8 and the division ratio is 3:5 horizontally, the current coding unit can be divided into two sub-units of 8×3 and 8×5, wherein the scanning method of the first sub-unit is forward horizontal back-and-forth scanning, and the scanning method of the second sub-unit is reverse horizontal back-and-forth scanning; when the coding unit size is 8×4 and the division ratio is 3:1 horizontally, the current coding unit can be divided into two sub-units of 8×3 and 8×1, wherein the scanning method of the first sub-unit is forward horizontal back-and-forth scanning, and the scanning method of the second sub-unit is reverse horizontal back-and-forth scanning. Back scan; when the coding unit size is 4×8 and the division ratio is 3:5 horizontally, the current coding unit can be divided into two sub-units of 4×3 and 4×5, wherein the scanning mode of the first sub-unit is forward horizontal back-and-forth scanning, and the scanning mode of the second sub-unit is reverse horizontal back-and-forth scanning; when the coding unit size is 4×4 and the division ratio is 2:2 horizontally, the current coding unit can be divided into two sub-units of 4×2 and 4×2, wherein the scanning mode of the first sub-unit is forward horizontal back-and-forth scanning, and the scanning mode of the second sub-unit is reverse horizontal back-and-forth scanning.
[0069] In one implementation scenario, the division method in the string prediction scanning method is two-division, and at least one scanning method corresponding to the division method is reverse horizontal back-and-forth scanning and forward horizontal back-and-forth scanning. In this scenario, when the coding unit size is 8×8 and the division ratio is 3:5 horizontally, the current coding unit can be divided into two sub-units of 8×3 and 8×5, wherein the scanning method of the first sub-unit is reverse horizontal back-and-forth scanning, and the scanning method of the second sub-unit is forward horizontal back-and-forth scanning; when the coding unit size is 8×4 and the division ratio is 3:1 horizontally, the current coding unit can be divided into two sub-units of 8×3 and 8×1, wherein the scanning method of the first sub-unit is reverse horizontal back-and-forth scanning, and the scanning method of the second sub-unit is forward horizontal back-and-forth scanning. Back scan; when the coding unit size is 4×8 and the division ratio is 3:5 horizontally, the current coding unit can be divided into two sub-units of 4×3 and 4×5, wherein the scanning mode of the first sub-unit is reverse horizontal back-and-forth scanning, and the scanning mode of the second sub-unit is forward horizontal back-and-forth scanning; when the coding unit size is 4×4 and the division ratio is 2:2 horizontally, the current coding unit can be divided into two sub-units of 4×2 and 4×2, wherein the scanning mode of the first sub-unit is reverse horizontal back-and-forth scanning, and the scanning mode of the second sub-unit is forward horizontal back-and-forth scanning.
[0070] Combination of the above Figure 3 to Figure 4A method for encoding data is described. Accordingly, the present disclosure also provides a method for decoding data. Here, reference may be made to Figure 5 , which shows an exemplary flow chart of a method 500 for decoding data according to an embodiment of the present application. It is understood that the method 500 can be executed by any appropriate device with data processing capabilities, such as but not limited to a processor, a terminal device, and a server.
[0071] like Figure 5 As shown, at step S501, method 500 may receive a code stream of a current coding unit generated according to the method for encoding data described in the previous embodiments.
[0072] Then, at step S502, the method 500 may perform entropy decoding on the bitstream to obtain a string prediction scanning mode and a string prediction encoding parameter set of the current coding unit.
[0073] Next, at step S503 , the method 500 may perform string prediction decoding on the string prediction encoding parameter set to obtain a pixel string set of the current coding unit.
[0074] Finally, at step S504, the method 500 may perform array combination on the pixel string set based on the string prediction scanning mode to obtain a reconstructed pixel array of the current coding unit.
[0075] Next, combine Figure 6 An exemplary introduction is given to a device 600 for encoding data provided in an embodiment of the present disclosure. Figure 6 As shown, the apparatus 600 of the embodiment of the present disclosure may include an acquisition module 601 , a first encoding module 602 , an evaluation module 603 , a determination module 604 and a second encoding module 605 .
[0076] In the solution disclosed herein, an acquisition module 601 is configured to acquire a set of string prediction scanning modes, each of which includes a partitioning mode and at least one corresponding scanning mode. A first encoding module 602 is configured to sequentially perform string prediction encoding and pixel reconstruction on a current coding unit based on each string prediction scanning mode in the string prediction scanning mode set, so as to obtain multiple string prediction encoding parameter sets and multiple reconstructed pixel arrays of the current coding unit.
[0077] In addition, the evaluation module 603 is configured to determine the distortion corresponding to each string prediction scanning mode based on the initial pixel array and multiple reconstructed pixel arrays of the current coding unit to obtain multiple distortion degrees. The determination module 604 is configured to obtain multiple evaluation function values based on multiple string prediction scanning parameter sets and multiple distortion degrees, and determine the minimum value among the multiple evaluation function values, and determine the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum value. The second encoding module 605 is configured to write the string prediction scanning mode and string prediction coding parameter set corresponding to the minimum value into the bitstream after entropy encoding to realize encoding of the current coding unit.
[0078] Combination of the above Figure 6 A device for encoding data that can be used to perform the present disclosure is described. It should be understood that the device structure or architecture here is merely exemplary, and the implementation method and implementation entity of the present application are not limited thereto, but can be changed without departing from the spirit of the present application. It is understandable that the description of each embodiment in the present disclosure emphasizes the differences between the various embodiments, and the same or corresponding parts can be referenced to each other. For the purpose of brevity, the present disclosure will not repeat them one by one.
[0079] Next, combine Figure 7 An exemplary description is given of a device 700 for decoding data provided by the embodiment of the present disclosure. Figure 7 As shown, the apparatus 700 of the embodiment of the present disclosure may include a receiving module 701 , a first decoding module 702 , a second decoding module 703 and a combining module 704 .
[0080] In the scheme disclosed herein, a receiving module 701 is configured to receive a code stream of a current coding unit generated according to the method for encoding data described in the previous embodiment; a first decoding module 702 is configured to perform entropy decoding on the code stream to obtain a string prediction scanning method and a string prediction coding parameter set; a second decoding module 703 is configured to perform string prediction decoding on the string prediction coding parameter set to obtain a pixel string set; and a combining module 704 is configured to perform array combination on the pixel string set based on the string prediction scanning method to obtain a reconstructed pixel array of the current coding unit.
[0081] Combination of the above Figure 7A device for decoding data that can be used to perform the present disclosure is described. It should be understood that the device structure or architecture here is merely exemplary, and the implementation method and implementation entity of the present application are not limited thereto, but can be changed without departing from the spirit of the present application. It is understandable that the description of each embodiment of the present disclosure emphasizes the differences between the various embodiments, and the same or corresponding parts can be referenced to each other. For the purpose of brevity, the present disclosure will not be repeated one by one.
[0082] Next, combine Figure 8 An electronic device 800 provided in an embodiment of the present application is exemplarily introduced. Figure 8 As shown, the electronic device 800 of the embodiment of the present application may include a processor 801 , a memory 802 and a communication bus 803 .
[0083] In the process of a specific embodiment, the processor 801 may be at least one of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing image processing device (DSPD), a programmable logic image processing device (PLD), a field programmable gate array (FPGA), a CPU, a controller, a microcontroller, and a microprocessor. It can be understood that for different devices, the electronic device used to implement the function of the processor may also be other, which is not specifically limited in this embodiment.
[0084] In the embodiment of the present application, the communication bus 803 is used to realize the connection and communication between the processor 801 and the memory 802; the memory 802 stores program instructions for adjusting the scanning electron microscope image; when the processor 801 executes the program instructions stored in the memory 802, the present application is realized. Figure 3 and Figure 4 The method or combination described for encoding data Figure 5 A method for decoding data is described.
[0085] Combination of the above Figure 8An electronic device for adjusting a scanning electron microscope image that can be used to perform the present application is described. It should be understood that the device structure or architecture here is merely exemplary, and the implementation and implementation entity of the present application are not limited thereto, but can be changed without departing from the spirit of the present application. It is understandable that the description of each embodiment in the present disclosure emphasizes the differences between the various embodiments, and the same or corresponding parts can be referenced to each other. For the purpose of brevity, the present disclosure will not repeat them one by one.
[0086] According to the above description in combination with the accompanying drawings, those skilled in the art can also understand that the embodiments of the present application can also be implemented by a software program. Therefore, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores program instructions for controlling the startup of the device, and the program instructions can be used to implement the present application in combination with Figure 3 and Figure 4 The method or combination described for encoding data Figure 5 A method for decoding data is described.
[0087] It should be noted that although the operations of the method of the present application are described in a specific order in the accompanying drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0088] Although multiple embodiments of the present application have been shown and described herein, it is obvious to those skilled in the art that such embodiments are provided only by way of example. Those skilled in the art can think of many changes, modifications and alternatives without departing from the thought and spirit of the present application. It should be understood that in the process of practicing the present application, various alternatives to the embodiments of the present application described herein can be adopted. The attached claims are intended to limit the scope of protection of the present application, and therefore cover equivalents or alternatives within the scope of these claims.
Claims
1. A method for encoding data, comprising: Determine a set of string prediction scanning modes for a current coding unit, wherein each string prediction scanning mode in the set of string prediction scanning modes includes a partitioning mode and at least one corresponding scanning mode; sequentially performing string prediction coding and pixel reconstruction on the current coding unit based on each string prediction scanning mode in the string prediction scanning mode set to obtain multiple string prediction coding parameter sets and multiple reconstructed pixel arrays of the current coding unit; Determining the distortion degree corresponding to each string prediction scanning mode based on the initial pixel array and multiple reconstructed pixel arrays of the current coding unit to obtain multiple distortion degrees; Obtaining multiple evaluation function values based on the multiple string prediction scanning parameter sets and multiple distortion degrees, and determining a minimum value among the multiple evaluation function values, and determining a string prediction scanning mode and a string prediction coding parameter set corresponding to the minimum value; The string prediction scanning mode and the string prediction coding parameter set corresponding to the minimum value are converted into a code stream through entropy coding to achieve coding of the current coding unit.
2. The method according to claim 1, wherein: Performing string prediction coding and pixel reconstruction on the current coding unit based on the string prediction scanning mode to obtain a string prediction coding parameter set and a reconstructed pixel array of the current coding unit includes: Dividing the initial pixel array of the current coding unit by using the division method in the string prediction scanning method to obtain at least one sub-pixel array; Scanning the at least one sub-pixel array respectively using at least one scanning method in the string prediction scanning method to obtain at least one pixel string constituting a pixel string set; Performing string prediction coding on the at least one pixel string respectively to obtain at least one string prediction coding parameter constituting a string prediction coding parameter set; Pixel reconstruction is performed based on the division mode, the at least one scanning mode and the at least one string prediction coding parameter to obtain a reconstructed pixel array of the current unit.
3. The method according to claim 2, wherein: The set of string prediction scanning modes for determining the current coding unit includes: Determine a maximum number of different scanning modes merged in the current coding unit; At least one division method constituting a string prediction scanning method set and at least one scanning method corresponding to each division method are determined according to the maximum number.
4. The method according to claim 3, wherein: Determining, according to the maximum number, at least one partitioning method constituting a set of string prediction scanning methods, and at least one scanning method corresponding to each partitioning method comprises: In the case where the maximum number is 2, the at least one division mode includes no division and two divisions, the scanning mode corresponding to the no division is forward horizontal back-and-forth scanning or reverse horizontal back-and-forth scanning, and the scanning mode corresponding to the two divisions is forward horizontal back-and-forth scanning and reverse horizontal back-and-forth scanning, or reverse horizontal back-and-forth scanning and forward horizontal back-and-forth scanning; In the case where the maximum number is 3, the at least one division mode further includes three divisions, and the scanning modes corresponding to the three divisions are forward horizontal back-and-forth scanning, reverse horizontal back-and-forth scanning and forward horizontal raster scanning, or reverse horizontal back-and-forth scanning, forward horizontal back-and-forth scanning and forward horizontal raster scanning; When the maximum number is 4, the at least one division method also includes four divisions, and the scanning methods corresponding to the four divisions are forward horizontal raster scanning, reverse horizontal raster scanning, forward horizontal back and forth scanning and reverse horizontal back and forth scanning, or forward horizontal back and forth scanning, reverse horizontal back and forth scanning, forward horizontal raster scanning and reverse horizontal raster scanning.
5. The method according to claim 4, wherein: The initial pixel array of the current coding unit is divided by the division method in the string prediction scanning method, including: Determining a division ratio based on the division mode and the size of the current coding unit; The initial pixel array is divided according to the division ratio.
6. The method according to claim 5, wherein: Based on the division mode and the size of the current coding unit, determining the division ratio includes: When the division mode is two-division and the size is 4×4, the division ratio is 2:2 in horizontal direction, 1:3 in horizontal direction, 2:2 in vertical direction or 1:3 in vertical direction; When the division mode is two-division and the size is 8×8, the division ratio is 3:5 horizontally or 3:5 vertically; When the division mode is three divisions and the size is 4×4, the division ratios are 1:1:2 in horizontal direction, 1:2:1 in horizontal direction, 2:1:1 in horizontal direction, 1:1:2 in vertical direction, 1:2:1 in vertical direction, and 2:1:1 in vertical direction; When the division mode is three divisions and the size is 8×8, the division ratio is 2:4:2 horizontally or 2:4:2 vertically; When the division mode is four divisions and the size is 4×4, the division ratio is 1:1:1:1 horizontally or 1:1:1:1 vertically; When the division mode is four divisions and the size is 8×8, the division ratio is 1:3:3:1 horizontally or 1:3:3:1 vertically.
7. An apparatus for encoding data, comprising: An acquisition module configured to acquire a set of string prediction scanning modes, each string prediction scanning mode in the set of string prediction scanning modes comprising a partitioning mode and at least one corresponding scanning mode; A first encoding module configured to sequentially perform string prediction encoding and pixel reconstruction on a current encoding unit based on each string prediction scanning mode in the string prediction scanning mode set, so as to obtain a plurality of string prediction encoding parameter sets and a plurality of reconstructed pixel arrays of the current encoding unit; An evaluation module configured to determine the distortion degree corresponding to each string prediction scanning mode based on an initial pixel array and a plurality of reconstructed pixel arrays of the current coding unit to obtain a plurality of distortion degrees; A determination module configured to obtain a plurality of evaluation function values based on the plurality of string prediction scanning parameter sets and a plurality of distortion degrees, and to determine a minimum value among the plurality of evaluation function values, and to determine a string prediction scanning mode and a string prediction coding parameter set corresponding to the minimum value; The second encoding module is configured to write the string prediction scanning mode and string prediction encoding parameter set corresponding to the minimum value into the bit stream after entropy encoding, so as to realize encoding of the current encoding unit.
8. A method for decoding data, comprising: Receiving a code stream of a current coding unit generated according to the method described in any one of claims 1 to 5; Performing entropy decoding on the code stream to obtain a string prediction scanning mode and a string prediction coding parameter set; Performing string prediction decoding on the string prediction coding parameter set to obtain a pixel string set; Based on the string prediction scanning method, the pixel string set is array-combined to obtain a reconstructed pixel array of the current coding unit.
9. An apparatus for decoding data, comprising: A receiving module, configured to receive a code stream of a current coding unit generated by the method according to any one of claims 1 to 5; A first decoding module configured to perform entropy decoding on the bit stream to obtain a string prediction scanning mode and a string prediction coding parameter set; A second decoding module configured to perform string prediction decoding on the string prediction coding parameter set to obtain a pixel string set; A combination module is configured to perform array combination on the pixel string set based on the string prediction scanning method to obtain a reconstructed pixel array of the current coding unit.
10. A computer-readable storage medium having stored thereon program instructions for encoding or decoding data, wherein when the program instructions are executed by a processor, the method according to any one of claims 1 to 6 and / or the method according to claim 8 is implemented.