String vector encoding and decoding method, encoding device, decoding device and storage medium
By obtaining the position and length information of the string to be encoded, and encoding the string vectors in video encoding are adopted for different lengths, solving the problem of low long-list encoding efficiency in the prior art and improving the encoding effect.
Patent Information
- Application Number
- CN202011416477.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-04
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2040-12-04
AI Technical Summary
In the intra-string copying of existing video encoding technologies, the encoding effect of the to-coded string is poor, especially the encoding efficiency of long strings, which leads to an increase in encoding bits.
By obtaining the position information and length information of the string to be encoded, the string vector is encoded in different encoding methods to adapt to string to be encoded of different lengths, thereby improving the encoding effect.
The encoding effect of various strings to be encoded is improved, the encoding bits are reduced, and the encoding efficiency of long strings is significantly improved.
Smart Images

Figure CN114598888B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a string vector encoding and decoding method, an encoding device, a decoding device, and a storage medium. Background Art
[0002] The current mainstream video coding standards, such as High Efficiency Video Coding (HEVC), Versatile Video Coding (VVC), and Audio Video Coding Standard (AVS)3, all adopt a hybrid coding framework based on image blocks. They divide the original frame of an image into a series of image blocks, and combine video coding methods such as prediction, transform, and entropy coding to achieve video data compression. Among them, motion compensation is a commonly used prediction method in video coding and decoding. Motion compensation is based on the redundant characteristics of video content in the time domain or spatial domain, and determines the prediction value of the current image block to be encoded based on the reference block. This type of prediction method based on motion compensation includes: inter-frame prediction, intra-frame block copying, intra-frame string copying, etc. For image blocks using these prediction methods, it is usually necessary to explicitly or implicitly encode one or more two-dimensional displacement vectors in the bitstream to indicate the displacement of the current image block to be encoded relative to one or more of its reference blocks.
[0003] In order to reduce the bits required for the displacement vector, the prior art also uses various methods to achieve this goal. For example: in intra-frame string replication, the encoding end will encode an identifier to identify whether the string vector (StringVector, SV) of the string to be encoded is (0, -1). If the SV is not (0, -1), the encoding end continues to encode an identifier, which is used to identify whether the SV is in the history list. If it is, the encoding end encodes the index of the SV in the history list. If the SV is not in the history list, the encoding end needs to encode the SV, that is, encode the horizontal and vertical coordinates of the SV. Among them, the encoding end encoding identifiers, indexes, etc. can be understood as implicit encoding of the SV, and the encoding of the horizontal and vertical coordinates of the SV can be understood as explicit encoding of the SV.
[0004] In summary, in intra-frame string replication, the encoding end does not distinguish between long strings and short strings in explicit or implicit encoding of SV. Therefore, this method may lead to better encoding effect for short strings and poor encoding effect for long strings. Summary of the invention
[0005] The present application provides a string vector encoding and decoding method, encoding device, decoding device and storage medium, so as to improve the encoding effect of various strings to be encoded.
[0006] In a first aspect, a method for encoding a string vector is provided, comprising: obtaining attribute information of a string to be encoded. Encoding a first string vector or related information of the first string vector according to the attribute information to obtain a code stream. Outputting the code stream. The first string vector is a string vector of the string to be encoded. The attribute information includes at least one of the following: position information and length information of the string to be encoded.
[0007] In a second aspect, a method for decoding a string vector is provided, comprising: obtaining a code stream and attribute information of a string to be decoded. Parsing the code stream according to the attribute information to obtain a first string vector. The first string vector is a string vector of the string to be decoded. The attribute information includes at least one of the following: position information and length information of the string to be decoded.
[0008] In a third aspect, a coding device is provided, including: an acquisition module, an encoding module, and an output module, wherein the acquisition module is used to acquire attribute information of a string to be encoded. The encoding module is used to encode a first string vector or related information of the first string vector according to the attribute information to obtain a code stream. The output module is used to output the code stream. The first string vector is a string vector of the string to be encoded. The attribute information includes at least one of the following: position information and length information of the string to be encoded.
[0009] In a fourth aspect, a decoding device is provided, comprising: an acquisition module and a parsing module, wherein the acquisition module is used to acquire attribute information of a code stream and a string to be decoded. The parsing module is used to parse the code stream according to the attribute information to obtain a first string vector. The first string vector is a string vector of the string to be decoded. The attribute information includes at least one of the following: position information and length information of the string to be decoded.
[0010] In a fifth aspect, a coding device is provided, wherein the coding device is used to execute the method of the first aspect.
[0011] In a sixth aspect, a decoding device is provided, wherein the decoding device is used to execute the method of the second aspect.
[0012] In a seventh aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program enables a computer to execute the method of the first aspect.
[0013] In an eighth aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program enables a computer to execute the method of the first aspect.
[0014] Through the technical solution provided by the present application, the encoding end can encode the first string vector or the related information of the first string vector according to at least one of the position information and the length information of the string to be encoded, that is, for the strings to be encoded with different position information and at least one of the length, the encoding method used may be different to adapt to the encoding of different strings to be encoded, thereby improving the encoding effect of various strings to be encoded. The decoding end can decode the first string vector or the related information of the first string vector according to at least one of the position information and the length information of the string to be decoded, that is, for the strings to be decoded with different position information and at least one of the length, the decoding method used may be different to adapt to the decoding of different strings to be decoded, thereby improving the decoding effect of various strings to be decoded. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A schematic diagram of a coding framework provided in an embodiment of the present application;
[0017] Figure 2 A schematic diagram of a decoding framework provided in an embodiment of the present application;
[0018] Figure 3 It is a schematic diagram of an intra-frame string replication provided by an embodiment of the present application;
[0019] Figure 4 A flowchart of a string vector encoding method provided in an embodiment of the present application;
[0020] Figure 5 A flowchart of another string vector encoding method provided in an embodiment of the present application;
[0021] Figure 6 A schematic diagram of a string to be encoded and a reference string provided in an embodiment of the present application;
[0022] Figure 7 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application;
[0023] Figure 8 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application;
[0024] Fig. 9 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application;
[0025] Fig.10 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application;
[0026] Fig.11 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application;
[0027] Fig.12 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application;
[0028] Fig.13 A flowchart of another string vector encoding method provided in an embodiment of the present application;
[0029] Fig.14 A flowchart of another string vector encoding method provided in an embodiment of the present application;
[0030] Fig.15 A flowchart of a method for decoding a string vector provided in an embodiment of the present application;
[0031] Fig.16 A flowchart of another string vector decoding method provided in an embodiment of the present application;
[0032] Fig.17 A flowchart of another string vector decoding method provided in an embodiment of the present application;
[0033] Fig.18 A flowchart of another string vector decoding method provided in an embodiment of the present application;
[0034] Fig.19 A schematic diagram of an encoding device provided in an embodiment of the present application;
[0035] Fig. 20 A schematic diagram of a decoding device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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 making creative work are within the scope of protection of the present invention.
[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0038] Before introducing the technical solution of the present application, the following first describes the image or video encoding framework and decoding framework, intra-frame string copying technology, SV prediction in AVS3, derivation of SV prediction information (String Vector Predictor, SVP), and the encoding process and decoding process of SV in AVS3:
[0039] 1. Image or video encoding framework and decoding framework, that is, hybrid encoding framework.
[0040] For example, Figure 1 Schematic diagram of the coding framework provided in the embodiment of the present application. Figure 1 As shown, the coding framework includes: a prediction unit 11, a residual generation unit 12, a transform unit 13, a quantization unit 14, an inverse quantization unit 15, an inverse transform unit 16, a reconstruction unit 17, a filtering unit 18 and an entropy coding unit 19. The prediction unit 11 includes an inter-frame prediction unit 111 and an intra-frame prediction unit 112. The inter-frame prediction unit 111 includes a motion estimation unit 1111 and a motion compensation unit 1112.
[0041] After receiving the video, the encoder divides each frame of the video into multiple image blocks to be encoded. For the current image block to be encoded, the prediction unit 11 first predicts the current image block to be encoded by referring to the reconstructed image block to obtain prediction information of the current image block to be encoded. The encoder can use inter-frame prediction or intra-frame prediction technology to obtain the prediction information.
[0042] Specifically, the motion estimation unit 1111 in the inter-frame prediction unit 111 may search the reference pictures in the list of reference pictures to find the reference block of the image block to be encoded. The motion estimation unit 1111 may generate an index indicating the reference block and a motion vector indicating the spatial displacement between the image block to be encoded and the reference block. The motion estimation unit 1111 may output the index of the reference block and the motion vector as the motion information of the image block to be encoded. The motion compensation unit 1112 may obtain the prediction information of the image block to be encoded based on the motion information of the image block to be encoded.
[0043] The intra prediction unit 112 may use an intra prediction mode to generate prediction information for the current image block to be encoded. There are currently 15 intra prediction modes, including a Planar mode, a DC mode, and 13 angle prediction modes. The intra prediction unit 112 may also use intra block copy (IBC), intra string copy (ISC) technology, etc.
[0044] The residual generating unit 12 is used to subtract the prediction information from the original signal of the current image block to be encoded to obtain a residual signal. After prediction, the amplitude of the residual signal is much smaller than the original signal. The transform unit 13 and the quantization unit 14 are used to transform and quantize the residual signal. After transformation and quantization, the transformation quantization coefficient is obtained. The entropy coding unit 19 is used to encode the quantization coefficient and other indication information in the encoding through entropy coding technology to obtain a code stream.
[0045] Furthermore, the encoding end also needs to reconstruct the current image block to be encoded in order to provide reference pixels for the encoding of the subsequent image blocks to be encoded. Specifically, after obtaining the transform quantization coefficients of the current image block to be encoded, the inverse quantization unit 15 and the inverse transformation unit 16 perform inverse quantization and inverse transformation on the transform quantization coefficients of the current image block to be encoded to obtain a reconstructed residual signal, and the reconstruction unit 17 adds the reconstructed residual signal to the prediction information corresponding to the current image block to be encoded to obtain the reconstructed signal of the current image block to be encoded, and obtains the reconstructed image block according to the reconstructed signal. Furthermore, the filtering unit 18 can filter the reconstructed image block, wherein deblocking filtering, adaptive sample offset (Sample Adaptive Offset, SAO) or adaptive loop filtering (Adaptive Loop Filter, ALF) and the like can be used. Among them, the reconstructed image block can predict the subsequent image block to be encoded.
[0046] For example, Figure 2 Schematic diagram of a decoding framework provided in an embodiment of the present application. Figure 2As shown, the decoding framework includes: an entropy decoding unit 21, a prediction unit 22, an inverse quantization unit 23, an inverse transformation unit 24, a reconstruction unit 25, and a filtering unit 26. The prediction unit 22 includes: a motion compensation unit 221 and an intra-frame prediction unit 222.
[0047] Specifically, after the decoding end obtains the bitstream, the entropy decoding unit 21 first entropy decodes the bitstream to obtain the transform quantization coefficients of the current image block to be reconstructed, and then the inverse quantization unit 23 and the inverse transform unit 24 inverse quantize and inverse transform the transform quantization coefficients to obtain the reconstructed residual signal of the current image block to be reconstructed. The prediction unit 22 predicts the current image block to be reconstructed to obtain the prediction information of the current image block to be reconstructed. If the prediction unit 22 adopts inter-frame prediction, the motion compensation unit 221 can construct a first reference picture list (list 0) and a second reference picture list (list 1) according to the syntax elements parsed from the bitstream. In addition, the entropy decoding unit 21 can parse the motion information of the image block to be reconstructed. The motion compensation unit 221 can determine one or more reference blocks of the image block to be reconstructed based on the motion information. The motion compensation unit 221 can generate prediction information of the image block to be reconstructed based on one or more reference blocks. If the prediction unit 22 uses intra-frame prediction, the entropy decoding unit 21 can parse the index of the intra-frame prediction mode used, and the intra-frame prediction unit 222 can use the intra-frame prediction mode to perform intra-frame prediction according to the index to obtain prediction information of the image block to be reconstructed. The intra-frame prediction unit 222 can also use IBC or ISC technology.
[0048] Further, the reconstruction unit 25 is used to add the prediction information and the reconstructed residual signal to obtain the reconstruction signal of the current image block to be reconstructed, and then obtain the current reconstructed image block corresponding to the current image block to be reconstructed according to the reconstruction signal, wherein the current reconstructed image block can predict other subsequent image blocks to be reconstructed. Similar to the above-mentioned encoding end, optionally, the filtering unit 26 at the decoding end can filter the current reconstructed image block.
[0049] 2. ISC Technology
[0050] ISC divides a to-be-encoded image block into a series of pixel strings or unmatched pixels according to a certain scanning order (raster scanning, round-trip scanning or Zig-Zag scanning, etc.). Similar to IBC, the current string searches for a reference string of the same shape in the encoded area of the current frame of the image, based on which the prediction information of the current string is derived, and the residual signal of the current string is obtained by encoding the original signal and the prediction information of the current string, and the residual signal is encoded. For example: Figure 3 is a schematic diagram of an intra-frame string replication provided by an embodiment of the present application, such as Figure 3As shown in the figure, the 28 pixels of the oblique stripes are string 1, the 35 pixels of the horizontal stripes are string 2, and the black pixel represents an unmatched pixel. Among them, the reference string of string 1 is on its left, and the displacement of string 1 to its corresponding reference string is represented by string vector 1. The reference string of string 2 is above it, and the displacement of string 2 to its corresponding reference string is represented by string vector 2.
[0051] The ISC technology needs to encode the SV corresponding to each string in the current image block to be encoded, the string length, and the flag of whether there is a reference string.
[0052] It should be noted that, in the present application, the current image block to be encoded is also referred to as a coding unit, a current unit to be encoded, a unit to be encoded, an image block to be encoded, etc., and the present application does not impose any restrictions on this.
[0053] 3. SV Prediction in AVS3
[0054] IBC and ISC are intra-coding tools adopted in the HEVC Screen Content Coding (Screen Cotent Coding, SCC) extension, which significantly improves the coding efficiency of screen content. They both use the current frame image as a reference and derive the prediction information of the current block or current string through motion compensation. Considering that IBC and ISC have similar reference areas, the block vector (Block Vector, BV) and SV have a high correlation, and the coding efficiency can be further improved by allowing prediction between the two. AVS3 uses an intra-frame prediction history motion information table (IntraHMVP) similar to HMVP to record the displacement vector information, position information, size information and number of repetitions of these two types of coding blocks (i.e., the current block in IBC and the current string in ISC), and IntraHMVP derives the prediction information of the block vector (Block Vector Predictor, BVP) and SVP.
[0055] 4. Export of SVP
[0056] In AVS3, the encoder encodes an index, which is the index of the SVP of the SV in IntraHMVP, where, similar to the skip mode in inter-frame prediction, the SV of the current string is equal to the SVP. Therefore, in this case, there is no need to encode the residual between the SV and the SVP.
[0057] 5. SV encoding process in AVS3
[0058] In intra-frame string replication, the encoder encodes an identifier to indicate whether the SV of the string to be encoded is (0, -1). If the SV is not (0, -1), the encoder continues to encode an identifier to indicate whether the SV is in the history list. If so, the encoder encodes the index of the SV in the history list. If the SV is not in the history list, the encoder needs to encode the SV, that is, encode the horizontal coordinate and vertical coordinate of the SV. Specifically, the horizontal coordinate svX[i] and vertical coordinate svY[i] of the string vector SV[i] of the i-th part in the current coding unit can be calculated and encoded by the following method, wherein the horizontal coordinate svX[i] of SV[i] is also called the horizontal component of SV[i], and the vertical coordinate svY[i] of SV[i] is called the vertical component of SV[i]:
[0059] svX[i]=SvXNonZeroFlag[i]? (SvXSign[i]?–(SvXAbsMinus1+1):SvXAbsMinus1+1):0
[0060] svY[i]=SvYNonZeroFlag[i]? (SvYSign[i]?–(SvYAbsMinus1+1):SvYAbsMinus1+1):0
[0061] if(svY[i]<=-1&&svX[i]==0)
[0062] {
[0063] svY[i]=svY[i]-1
[0064] }
[0065] Where SvXNonZeroFlag[i] is equal to the value of sv_x_non_zero_flag[i]. The value of sv_x_non_zero_flag[i] is '0', indicating that the value of svX[i] is not equal to 0, and the value of sv_x_non_zero_flag[i] is '1', indicating that the value of SvX[i] is equal to 0. If sv_x_non_zero_flag[i] does not exist in the bitstream, the value of SvXNonZeroFlag[i] is 1.
[0066] SvXSign[i] is a binary variable equal to the value of sv_x_sign[i]. sv_x_sign[i] is used to determine the positive or negative value of svX[i] of the current coding unit. A value of '0' indicates that svX[i] is positive; a value of '1' indicates that SvX[i] is negative. If sv_x_sign[i] does not exist in the bitstream, the value of SvXSign[i] is 1.
[0067] SvXAbsMinus1[i] is equal to the value of sv_x_abs_minus1[i]. sv_x_abs_minus1[i] is the absolute value of SvX[i] minus 1. If sv_x_abs_minus1[i] is not present in the bitstream, the value of SvXAbsMinus1[i] is 1.
[0068] SvYNonZeroFlag[i] is equal to the value of sv_y_non_zero_flag[i]. The value of sv_y_non_zero_flag[i] is '0', which means that the value of SvY[i] of the current coding unit is not equal to 0; the value of sv_y_non_zero_flag is '1', which means that the value of SvY[i] is equal to 0. If sv_y_non_zero_flag[i] does not exist in the bitstream, the value of SvYNonZeroFlag[i] is 1.
[0069] SvYSign[i] is equal to the value of sv_y_sign[i]. The value of sv_y_sign[i] is used to determine the positive or negative of the current coding unit SvX[i]. The value of sv_y_sign[i] is '0', which means that SvX[i] is a positive number; the value of '1' means that SvX[i] is a negative number. If sv_y_sign[i] does not exist in the bitstream, the value of SvYSign[i] is 1.
[0070] SvYAbsMinus1[i] is equal to the value of sv_y_abs_minus1[i]. The value of sv_y_abs_minus1[i] is the absolute value of SvY[i] minus 1. If sv_y_abs_minus1[i] does not exist in the bitstream, the value of SvYAbsMinus1[i] is 1.
[0071] In the above encoding method, the encoding end does not distinguish between long strings and short strings in explicit or implicit encoding of SV. Therefore, this method may lead to the problem that the encoding effect of short strings is better and the encoding effect of long strings is poor. For example: if the encoding end encodes the horizontal coordinate svX[i] and the vertical coordinate svY[i] of SV[i], it is related to the absolute value of svX[i] and the absolute value of svY[i]. For a short string, the absolute value of svX[i] and the absolute value of svY[i] are small, so the encoding efficiency is relatively high. However, for a long string, the absolute value of svX[i] and the absolute value of svY[i] are large, and the encoding bits are more, which leads to the problem of low encoding efficiency. Another example: If for all strings to be encoded, the encoding end will encode an identifier to indicate whether the SV of the string to be encoded is (0, -1), for a long string, its SV is likely not to be (0, -1), and at this time it is necessary to encode the identifier, which will cause the problem of too many encoding bits. Obviously, the encoding of the identifier is unnecessary in this case.
[0072] In order to solve the above technical problems, the present application mainly encodes the SV of the string to be encoded based on the position information, or the length information, or the position information and the length information of the string to be encoded.
[0073] The technical solution of this application will be described in detail below:
[0074] Example 1
[0075] Figure 4 A flowchart of a string vector encoding method provided in an embodiment of the present application, such as Figure 4 As shown, the execution subject of the method may be the following device, but is not limited thereto: an encoder, or a device for performing string vector encoding, such as a desktop computer, a mobile computing device, a notebook (e.g., laptop) computer, a tablet computer, a set-top box, a handheld device such as a smart phone, a television, a camera, a display device, a digital media player, a video game console, a car computer, or the like. Figure 4 As shown, the method comprises the following steps:
[0076] S410: Obtain attribute information of the string to be encoded.
[0077] S420: Encode the first string of vectors or related information of the first string of vectors according to the attribute information to obtain a code stream.
[0078] S430: Output code stream.
[0079] It should be understood that the string to be encoded is the current string to be encoded in the current encoding unit. Therefore, the string to be encoded is also referred to as the current string to be encoded. Among them, the current encoding unit is also referred to as an encoding unit.
[0080] Optionally, the attribute information includes at least one of the following: position information and length information of the string to be encoded.
[0081] Optionally, the position information of the string to be encoded includes at least one of the following: the abscissa and the ordinate of the starting point of the string to be encoded, and the abscissa and the ordinate of the ending point of the string to be encoded.
[0082] It should be understood that the first string vector is the string vector of the string to be encoded.
[0083] Optionally, the relevant information of the first string vector may be information encoded when the first string vector is implicitly encoded, for example, the relevant information of the first string vector may include a first identifier, and the first identifier is used to identify whether the first string vector is a preset string vector. Alternatively, the relevant information of the first string vector may include a second identifier, and the second identifier is used to identify whether the first string vector is in the first displacement vector prediction list.
[0084] Optionally, the encoding end may encode the first string vector or related information of the first string vector according to attribute information, such as the length of the string to be encoded, or the difference between the vertical coordinates of the end point and the starting point of the string to be encoded.
[0085] It should be understood that in addition to carrying the first string of vectors or related information of the first string of vectors, the above-mentioned code stream also carries other information in the image encoding process, such as quantization coefficients encoded by entropy coding technology, etc. This application mainly focuses on the encoding process of the first string of vectors.
[0086] In summary, in the present application, the encoding end can encode the first string vector or related information of the first string vector according to at least one of the position information and length information of the string to be encoded, that is, for the string to be encoded with different position information and at least one of the length, the encoding method used may be different to adapt to the encoding of different strings to be encoded, thereby improving the encoding effect of various strings to be encoded.
[0087] The following is an explanation of step S420:
[0088] Example 2
[0089] Figure 5 A flowchart of another string vector encoding method provided in an embodiment of the present application, such as Figure 5 As shown, the above S420 includes the following steps:
[0090] S510: Determine whether to encode the first identifier according to the attribute information, if so, execute S520, otherwise, execute S540.
[0091] S520: Encode the first identifier.
[0092] S530: If the first identifier indicates that the first string vector is not a preset string vector, execute S540; otherwise, end.
[0093] S540: Determine whether the first string of vectors is in the first displacement vector prediction list. If so, execute S550; otherwise, execute S560.
[0094] S550: Obtain the index of the first string of vectors in the first displacement vector prediction list, and encode the index of the first string of vectors in the first displacement vector prediction list.
[0095] S560: Determine a preset condition satisfied by the attribute information, and encode the first string of vectors or related information of the first string of vectors according to an encoding method corresponding to the preset condition.
[0096] As described above, the first identifier is used to identify whether the first string vector is a preset string vector. For example, the first identifier is 1, indicating that the first string vector is a preset string vector, and the first identifier is 0, indicating that the first string vector is not a preset string vector. Alternatively, the first identifier is 0, indicating that the first string vector is a preset string vector, and the first identifier is 1, indicating that the first string vector is not a preset string vector.
[0097] Optionally, if the scanning direction of the prediction mode of the string to be encoded is the horizontal scanning direction, the preset string vector is the string vector between the upper reference string of the string to be encoded and the string to be encoded, for example, the string vector is (0, -1). If the scanning direction of the prediction mode of the string to be encoded is the vertical scanning direction, the preset string vector is the string vector between the left reference string of the string to be encoded and the string to be encoded, for example, the string vector is (-1, 0).
[0098] It should be understood that the longer the length of the string to be encoded is, the more different it is from the reference string, such as the reference string above or the reference string on the left. In this case, the string vector corresponding to this type of reference string may not be used, that is, the above-mentioned preset string vector will not be used. Therefore, in this case, the encoding of the above-mentioned first identifier can be skipped. On the contrary, the shorter the length of the string to be encoded is, the more similar it is to the reference string, such as the reference string above or the reference string on the left. In this case, the string vector corresponding to this type of reference string may be used, that is, the above-mentioned preset string vector will be used. Therefore, in this case, the above-mentioned first identifier can be encoded.
[0099] It should be understood that a string vector corresponding to a reference string is a string vector used to characterize the displacement of the string to be encoded relative to the reference string.
[0100] It should be understood that the length of the string to be encoded can be directly reflected by the length information of the string to be encoded, or can be reflected by the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded. Based on this, the present application provides any of the following optional methods to determine whether to encode the first identifier, but is not limited to this:
[0101] 1. If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than a first threshold, it is determined not to encode the first identifier; if the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is less than or equal to the first threshold, it is determined to encode the first identifier.
[0102] 2. If the length of the string to be encoded is greater than the second threshold, it is determined not to encode the first identifier; if the length of the string to be encoded is less than or equal to the second threshold, it is determined to encode the first identifier.
[0103] 3. If the difference between the ordinate of the end point and the ordinate of the start point of the string to be encoded is greater than the first threshold, and the length of the string to be encoded is greater than the second threshold, it is determined not to encode the first identifier; otherwise, it is determined to encode the first identifier.
[0104] 4. If the difference between the ordinate of the end point and the starting point of the string to be encoded is greater than or equal to the first threshold, it is determined not to encode the first identifier; if the difference between the ordinate of the end point and the starting point of the string to be encoded is less than the first threshold, it is determined to encode the first identifier.
[0105] 5. If the length of the string to be encoded is greater than or equal to the second threshold, it is determined not to encode the first identifier; if the length of the string to be encoded is less than the second threshold, it is determined to encode the first identifier.
[0106] 6. If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than or equal to the first threshold, and the length of the string to be encoded is greater than or equal to the second threshold, it is determined not to encode the first identifier; otherwise, it is determined to encode the first identifier.
[0107] It should be understood that, as described above, for the to-be-encoded string with different at least one of the position information and length information, the encoding method used may be different, that is, the information to be encoded may also be different. For example, some to-be-encoded strings can encode the first identifier corresponding to them. Some to-be-encoded strings can encode their index in the first displacement vector prediction list, and some to-be-encoded strings can directly encode their horizontal and vertical coordinates. Based on this, the encoding end can select different context models according to at least one of the position information and length information of the to-be-encoded string.
[0108] This application provides any of the following optional ways to select a context model, but is not limited to these:
[0109] 1. If the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than the first threshold, the first context model is selected; if the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is less than or equal to the first threshold, the second context model is selected.
[0110] 2. If the length of the string to be encoded is greater than the second threshold, the first context model is selected; if the length of the string to be encoded is less than or equal to the second threshold, the second context model is selected.
[0111] 3. If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than the first threshold, and the length of the string to be encoded is greater than the second threshold, the first context model is selected; otherwise, the second context model is selected.
[0112] 4. If the difference between the vertical coordinates of the end point and the starting point of the string to be encoded is greater than or equal to the first threshold, the first context model is selected; if the difference between the vertical coordinates of the end point and the starting point of the string to be encoded is less than the first threshold, the second context model is selected.
[0113] 5. If the length of the string to be encoded is greater than or equal to the second threshold, the first context model is selected; if the length of the string to be encoded is less than the second threshold, the second context model is selected.
[0114] 6. If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than or equal to the first threshold, and the length of the string to be encoded is greater than or equal to the second threshold, the first context model is selected; otherwise, the second context model is selected.
[0115] It should be understood that the first context model and the second context model are context models constructed when context-based adaptive binary arithmetic coding is adopted, but the first context model and the second context model are different, that is, the first context model is more suitable for long strings, while the second context model is more suitable for short strings. This application focuses on the selection of different context models based on attribute information, but does not focus on the context model itself. In short, selecting different context models for encoding based on attribute information is conducive to improving encoding efficiency.
[0116] It should be understood that the first threshold and the second threshold may be pre-configured for the encoding end, or may be dynamically configured for the encoding end, and this application does not impose any limitation on this.
[0117] Optionally, the encoder may construct a first displacement vector prediction list, based on which the encoder may select the best SVP of the string to be encoded in the first displacement vector prediction list.
[0118] Optionally, the first displacement vector prediction list includes at least one of the following items, but is not limited thereto:
[0119] 1. The displacement vector of the historical coding block adjacent to the string to be coded in the spatial domain.
[0120] 2. Displacement vector of historical coding block.
[0121] 3. Including but not limited to (0, -1), (-1, 0), (-w, 0), (0, -h), (-w, -h), etc.
[0122] 4. Including but not limited to (0,start_y-end_y), (0,start_y-end_y-1), (-start_x-1,0), (-min(start_x+len,w),0), (-w,start_y-end_y), (-w,start_y-end_y-1).
[0123] The starting point of the string to be encoded is (start_x, start_y), the end point is (end_x, end_y), and w and h can both be integers greater than 1.
[0124] It should be noted that the historical coding block involved in the first displacement vector prediction list refers to the encoded image block, which can be understood as an encoded coding tree unit (Coding Tree Unit, CTU), coding unit (Coding Unit, CU), prediction unit (Prediction Unit, PU), transform unit (Transform Unit, TU), encoded string, etc. This application does not impose any restrictions on this.
[0125] It should be understood that the historical coding block adjacent to the to-be-coded string may be a historical coding unit adjacent to the coding unit where the to-be-coded string is located, or may be a historical coding string in the historical coding unit, and this community does not impose any restrictions on this.
[0126] The above displacement vector may be BV, SV or a motion vector (MV) in inter-frame prediction, and the present application does not impose any limitation on this.
[0127] Optionally, if the first string of vectors is in the first displacement vector prediction list, the encoding end only needs to encode the index of the first string of vectors in the first displacement vector prediction list, that is, the index of the SVP of the first string of vectors in the first displacement vector prediction list, without encoding the residual signal of the first string of vectors and the SVP corresponding to it. If the first string of vectors is not in the first displacement vector prediction list, determine the preset conditions satisfied by the attribute information, and encode the first string of vectors or related information of the first string of vectors according to the encoding method corresponding to the preset conditions.
[0128] Optionally, the encoding end may determine the encoding method used for the first string of vectors in the following manner to perform encoding, but is not limited thereto:
[0129] 1. If the preset condition is that the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is less than or equal to a third threshold, the first string vector is encoded.
[0130] 2. If the preset condition is that the length of the string to be encoded is less than or equal to the fourth threshold, the first string vector is encoded.
[0131] 3. If the preset condition is that the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than a third threshold, then the residual information between the first string vector and the prediction information of the first string vector is obtained, and the index of the prediction information and the residual information are encoded.
[0132] 4. If the preset condition is that the length of the string to be encoded is greater than a fourth threshold, then the residual information between the first string vector and the prediction information of the first string vector is obtained, and the index of the prediction information and the residual information are encoded.
[0133] 5. If the preset condition is that the difference between the vertical coordinate of the end point of the string to be encoded and the vertical coordinate of the starting point is greater than the third threshold, and the length of the string to be encoded is greater than the fourth threshold, then the residual information between the first string vector and the prediction information of the first string vector is obtained, and the index of the prediction information and the residual information are encoded.
[0134] 6. If the preset condition is that the difference between the vertical coordinate of the end point of the string to be encoded and the vertical coordinate of the starting point is greater than the third threshold, then obtain the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information, and encode the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value, and the index of the direction offset value.
[0135] 7. If the preset condition is that the length of the string to be encoded is greater than the fourth threshold, then obtain the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information, and encode the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value, and the index of the direction offset value.
[0136] 8. If the preset condition is that the difference between the vertical coordinate of the end point of the string to be encoded and the vertical coordinate of the starting point is greater than the third threshold, and the length of the string to be encoded is greater than the fourth threshold, then the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information are obtained, and the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value are encoded.
[0137] It should be understood that the third threshold and the fourth threshold may be pre-configured for the encoding end or may be dynamically configured for the encoding end, and this application does not impose any limitation on this.
[0138] Optionally, when the encoding end directly encodes the first string of vectors, that is, explicitly encodes, the following methods may be used, but are not limited to:
[0139] If the ordinate sv_y of the first string vector is greater than 0, based on the reference range restriction, the first string vector must point to the lower left of the string to be encoded, then the abscissa sv_x of the first string vector is added with the first offset value SvOffsetX and then encoded to reduce the encoding bits; or,
[0140] If the horizontal coordinate sv_x of the first string vector is greater than 0, based on the reference range limit, the first string vector must point to the upper right of the string to be encoded, then the vertical coordinate sv_y of the first string vector is added with the second offset value SvOffsetY and then encoded to reduce the encoding bits.
[0141] It should be understood that the setting of the first offset value and the second offset value at least ensures that the reference string of the string to be encoded does not overlap with the unencoded region or the string to be encoded itself.
[0142] Assuming that the encoding end adopts a horizontal reciprocating scanning method for encoding, the following is a method for determining the first offset value and the second offset value in this case:
[0143] Optionally, if the starting point of the string to be encoded is in an even row, the first offset value SvOffsetX is the minimum value of the first value and the width width of the encoding unit where the string to be encoded is located. The first value is the sum of the horizontal coordinate start_x of the starting point and the length str_len of the string to be encoded, that is, SvOffsetX=min(start_x+str_len, width).
[0144] It should be noted that the coordinates of the starting point and the coordinates of the end point described in this application refer to the coordinates of the starting point and the end point in the encoding unit where the string to be encoded is located, which will not be repeated below.
[0145] For example, Figure 6 A schematic diagram of a string to be encoded and a reference string provided in an embodiment of the present application, such as Figure 6 As shown, each small square can represent a pixel, the oblique stripe area is the string to be encoded, and the dotted area is the reference string. Figure 6 The starting point of the string to be encoded is in row 0, i.e., an even row. In order to ensure that the reference string of the string to be encoded does not overlap with the unencoded area or the string to be encoded itself, the reference string is at most adjacent to the left boundary of the encoding unit where the string to be encoded is located, such as Figure 6In this case, in order to reduce the coding bits, SvOffsetX can take the maximum distance between the pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, that is, the distance between the rightmost pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, which is equal to start_x+str_len. In this case, sv_x+SvOffsetX=0, and the coding bits are reduced compared to sv_x before coding.
[0146] For example, Figure 7 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application, such as Figure 7 As shown, each small square can represent a pixel, the oblique stripe area is the string to be encoded, and the dotted area is the reference string. Figure 7 The starting point of the string to be encoded is in row 0, i.e., an even row. In order to ensure that the reference string of the string to be encoded cannot overlap with the unencoded area or the string to be encoded itself, the reference string is at most adjacent to the left boundary of the encoding unit where the string to be encoded is located, such as Figure 7 In this case, in order to reduce the coding bits, SvOffsetX can take the maximum distance between the pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, that is, the distance between the rightmost pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, which is equal to width. In this case, sv_x+SvOffsetX=0, and the coding bits are reduced compared to sv_x before coding.
[0147] Optionally, if the starting point of the string to be encoded is in an odd row, the first offset value SvOffsetX is the sum of the horizontal coordinate of the starting point and 1, that is, SvOffsetX=start_x+1.
[0148] For example, Figure 8 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application, such as Figure 8 As shown, each small square can represent a pixel, the oblique stripe area is the string to be encoded, and the dotted area is the reference string. Figure 8 The starting point of the string to be encoded is in the first row, that is, an odd row. In order to ensure that the reference string of the string to be encoded cannot overlap with the unencoded area or the string to be encoded itself, the reference string is at most adjacent to the left boundary of the encoding unit where the string to be encoded is located, such as Figure 8In this case, in order to reduce the coding bits, SvOffsetX can take the maximum distance between the pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, that is, the distance between the rightmost pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, which is equal to start_x+1. In this case, sv_x+SvOffsetX=0, and the coding bits are reduced compared to sv_x before coding.
[0149] Optionally, if the ordinate end_y of the end point of the string to be encoded is greater than the second value, the first offset value SvOffsetX is the width width of the encoding unit where the string to be encoded is located, and the second value is the sum of the ordinate of the starting point of the string to be encoded and 1, that is, the second value is start_y+1.
[0150] For example, Fig. 9 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application, such as Fig. 9 As shown, each small square can represent a pixel, the oblique stripe area is the string to be encoded, and the dotted area is the reference string. Fig. 9 The string to be encoded shown has multiple rows, that is, end_y>start_y+1. In order to ensure that the reference string of the string to be encoded cannot overlap with the unencoded area or the string to be encoded itself, the reference string is at most adjacent to the left boundary of the encoding unit where the string to be encoded is located, such as Fig. 9 In this case, in order to reduce the coding bits, SvOffsetX can take the maximum distance between the pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, that is, the distance between the rightmost pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, which is equal to width. In this case, sv_x+SvOffsetX=0, and the coding bits are reduced compared to sv_x before coding.
[0151] Optionally, if the starting point of the string to be encoded is in an odd row, the vertical coordinate of the end point of the string to be encoded is equal to the second value, that is, end_y=start_y+1, and the horizontal coordinate of the end point end_x is greater than the horizontal coordinate of the starting point start_x, then the first offset value is the sum of the horizontal coordinate of the end point and 1, that is, SvOffsetX=end_x+1.
[0152] For example, Fig.10 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application, such as Fig.10 As shown, each small square can represent a pixel, the oblique stripe area is the string to be encoded, and the dotted area is the reference string. Fig.10The starting point of the string to be encoded is in the first row, that is, an odd row, end_y = start_y + 1, that is, there are two rows of strings to be encoded. In order to ensure that the reference string of the string to be encoded cannot overlap with the unencoded area or the string to be encoded itself, the reference string is at most adjacent to the left boundary of the encoding unit where the string to be encoded is located, such as Fig.10 In this case, in order to reduce the coding bits, SvOffsetX can take the maximum distance between the pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, that is, the distance between the rightmost pixel in the to-be-coded string and the left boundary of the coding unit where the to-be-coded string is located, which is equal to end_x+1. In this case, sv_x+SvOffsetX=0, and the coding bits are reduced compared to sv_x before coding.
[0153] Optionally, if the end point of the string to be encoded is in an even row, the sum of the horizontal coordinate end_x of the end point and the horizontal coordinate sv_x of the first string vector is greater than or equal to the width width of the encoding unit where the string to be encoded is located, then the second offset value SvOffsetY is equal to the sum of the vertical coordinate end_y of the end point and 1.
[0154] For example, Fig.11 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application, such as Fig.11 As shown, each small square can represent a pixel, the oblique stripe area is the string to be encoded, and the dotted area is the reference string. Fig.11 The end point of the string to be encoded is in the second row, that is, an even row, end_x = 1, sv_x = 3, width = 4, then end_x + sv_x = width, in order to ensure that the reference string of the string to be encoded cannot overlap with the unencoded area or the string to be encoded itself, the reference string is at most adjacent to the upper boundary of the encoding unit where the string to be encoded is located, such as Fig.11 In the reference string shown, in order to reduce the coding bits, SvOffsetY can take the maximum distance between the pixel in the to-be-coded string and the upper boundary of the coding unit where the to-be-coded string is located, which is equal to end_y+1=3. In this case, sv_y=-3, sv_y+SvOffsetY=0, and the coding bits are reduced compared to sv_y before coding.
[0155] Optionally, if horizontal reciprocating scanning is used for encoding, and the end point of the string to be encoded is in an even row, and the sum of the horizontal coordinate of the end point and the horizontal coordinate of the first string vector is less than the width of the encoding unit where the string to be encoded is located, then the second offset value is equal to 0.
[0156] Optionally, if the third value is greater than or equal to the width width of the coding unit where the string to be encoded is located, the second offset value is equal to the sum of the ordinate end_y of the end point and 1. The third value is the abscissa end_x of the end point plus the length str_len of the string to be encoded, the abscissa sv_x of the first string vector, and then minus 1, that is, the third value is end_x+str_len-1+sv_x.
[0157] For example, Fig.12 A schematic diagram of another to-be-encoded string and a reference string provided in an embodiment of the present application, such as Fig.12 As shown, each small square can represent a pixel, the oblique stripe area is the string to be encoded, and the dotted area is the reference string. Fig.12 The end point of the string to be encoded is in the first row, that is, an odd row, end_x = 0, str_len = 2, sv_x = 3, then end_x + str_len - 1 + sv_x = 4, which is equal to width = 4. In order to ensure that the reference string of the string to be encoded cannot overlap with the unencoded area or the string to be encoded itself, the reference string is at most adjacent to the upper boundary of the encoding unit where the string to be encoded is located, such as Fig.12 In the reference string shown, in order to reduce the coding bits, SvOffsetY can take the maximum distance between the pixel in the to-be-coded string and the upper boundary of the coding unit where the to-be-coded string is located, which is equal to end_y+1=2. In this case, sv_y=-2, sv_y+SvOffsetY=0, and the coding bits are reduced compared to sv_y before coding.
[0158] Optionally, as described above, the encoding end may obtain residual information between the first string of vectors and the prediction information of the first string of vectors, and encode the index of the prediction information in the second displacement vector prediction list and the residual information.
[0159] Optionally, the encoder can construct a second displacement vector prediction list, based on which the encoder can select the best SVP of the string to be encoded in the second displacement vector prediction list.
[0160] Optionally, the second displacement vector prediction list includes at least one of the following items, but is not limited thereto:
[0161] 1. The displacement vector of the historical coding block adjacent to the string to be coded in the spatial domain.
[0162] 2. Displacement vector of historical coding block.
[0163] 3. Including but not limited to (0, -1), (-1, 0), (-w, 0), (0, -h), (-w, -h), etc.
[0164] 4. Including but not limited to (0,start_y-end_y), (0,start_y-end_y-1), (-start_x-1,0), (-min(start_x+len,w),0), (-w,start_y-end_y), (-w,start_y-end_y-1).
[0165] The starting point of the string to be encoded is (start_x, start_y), the end point is (end_x, end_y), and w and h can both be integers greater than 1.
[0166] It should be noted that the historical coding block involved in the second displacement vector prediction list refers to the encoded image block, and the historical coding block can be understood as the encoded CTU, CU, PU, TU, encoded string, etc., and this application does not impose any restrictions on this.
[0167] It should be understood that the historical coding block adjacent to the to-be-coded string may be a historical coding unit adjacent to the coding unit where the to-be-coded string is located, or may be a historical coding string in the historical coding unit, and this community does not impose any restrictions on this.
[0168] The above displacement vector may be BV, SV or MV in inter-frame prediction, and this application does not impose any limitation on this.
[0169] It should be noted that the second displacement vector prediction list may be the same as or different from the first displacement vector prediction list, for example, the first displacement vector prediction list includes the second item, ie, the displacement vector of the historical coding block, and the second displacement vector prediction list includes the four items.
[0170] Optionally, as described above, the encoding end can obtain the index of the distance offset value and the index of the direction offset value between the first string of vectors and the prediction information, and encode the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value, and the index of the direction offset value.
[0171] Exemplarily, the direction offset value between the first string vector and the prediction information svp includes: a direction offset value svd_sign_x in the abscissa direction, and a direction offset value svd_sign_y in the ordinate direction. Assuming that the index of the direction offset value is represented by svd_sign_idx, the corresponding relationship between svd_sign_idx and svd_sign_x and svd_sign_y can be seen in Table 1:
[0172] Table 1
[0173] svd_sign_idx svd_sign_x svd_sign_y 0 +1 0 1 -1 0 2 0 +1 3 0 -1
[0174] Assuming that the index of the distance offset value is represented by svd_distance_index and the distance offset value is represented by svd_distance, the corresponding relationship between svd_distance_index and svd_distance can be seen in Table 2:
[0175] Table 2
[0176]
[0177]
[0178] sv_x and sv_y can be calculated as follows
[0179] sv_x = svp_x + svd_distance * svd_sign_x (1)
[0180] sv_y = svp_y + svd_distance * svd_sign_y (2)
[0181] Among them, svp_x represents the horizontal coordinate of svp, svp_y represents the vertical coordinate of svp, and other parameters in formulas (1) and (2) can refer to the corresponding explanations above, which will not be repeated here.
[0182] In summary, in the present application, the encoding end can determine whether to skip encoding of the first identifier based on at least one of the position information and length information of the string to be encoded. If the encoding of the first identifier is skipped, the encoding bits can be reduced. The encoding end can also determine the preset condition to be satisfied based on at least one of the position information and length information of the string to be encoded, and encode the first string vector or related information of the first string vector according to the encoding method corresponding to the preset condition, for example: encoding the residual information and index corresponding to the first string vector, or direct encoding, etc. In direct encoding, the above-mentioned first offset value and second offset value can be determined. Compared with the direct encoding scheme of the prior art, the present application can better reduce the encoding bits. For example, in the above example, sv_x is almost 0 after adding the first offset value, and sv_y is also 0 after adding the second offset value.
[0183] Example 3
[0184] Fig.13 A flowchart of another string vector encoding method provided in an embodiment of the present application is shown in FIG. Fig.13 As shown, the above S420 includes the following steps:
[0185] S1310: Encode the first identifier.
[0186] S1320: If the first identifier indicates that the first string vector is not a preset string vector, execute S1330; otherwise, end.
[0187] S1330: Determine whether the first string of vectors is in the first displacement vector prediction list. If so, execute S1340; otherwise, execute S1350.
[0188] S1340: Obtain the index of the first string of vectors in the first displacement vector prediction list, and encode the index of the first string of vectors in the first displacement vector prediction list.
[0189] S1350: Determine a preset condition satisfied by the attribute information, and encode the first string of vectors or related information of the first string of vectors according to an encoding method corresponding to the preset condition.
[0190] It should be understood that the difference between Example 3 and Example 2 is that Example 3 does not need to determine whether to encode the first identifier based on the attribute information, and the other parts are the same. Therefore, Example 3 can refer to the explanation in Example 2, and this application will not go into details.
[0191] Example 4
[0192] Fig.14 A flowchart of another string vector encoding method provided in an embodiment of the present application is shown in FIG. Fig.14 As shown, the above S420 includes the following steps:
[0193] S1410: Determine whether to encode the first identifier according to the attribute information, if so, execute S1420, otherwise, execute S1440.
[0194] S1420: Encode the first identifier.
[0195] S1430: If the first identifier indicates that the first string vector is not a preset string vector, execute S1440; otherwise, end.
[0196] S1440: Determine whether the first string of vectors is in the first displacement vector prediction list. If so, execute S1450; otherwise, execute S1460.
[0197] S1450: Obtain the index of the first string of vectors in the first displacement vector prediction list, and encode the index of the first string of vectors in the first displacement vector prediction list.
[0198] S1460: Encode the first string of vectors, or obtain the residual information between the first string of vectors and the prediction information of the first string of vectors, encode the index of the prediction information in the second displacement vector prediction list and the residual information, or obtain the index of the distance offset value and the index of the direction offset value between the first string of vectors and the prediction information, and encode the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value.
[0199] It should be understood that the difference between Example 4 and Example 2 is that Example 4 does not need to determine the preset conditions satisfied by the attribute information, and encodes the first string of vectors or the related information of the first string of vectors according to the encoding method corresponding to the preset conditions. Instead, the residual information between the first string of vectors and the prediction information of the first string of vectors is directly obtained, and the index of the prediction information in the second displacement vector prediction list and the residual information are encoded, or the index of the distance offset value and the index of the direction offset value between the first string of vectors and the prediction information are obtained, and the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value are encoded. The other parts are the same. Therefore, Example 4 can refer to the explanation in Example 2, and this application will not repeat it.
[0200] It should be noted that the string vector encoding method provided in the present application is not limited to embodiments 1-4. In fact, the present application can protect a single string vector encoding method, as long as the encoding method is combined with the attribute information of the string to be encoded. The present application can also protect a combination of at least two encoding methods, such as a combination of at least two of the following: a method for encoding the above-mentioned first identifier, encoding the index of the first string vector in the first displacement vector prediction list, using a direct encoding method, encoding the index of the prediction information in the second displacement vector prediction list and the residual information, encoding the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value, etc., as long as at least one encoding method is combined with the attribute information of the string to be encoded, for example: judging whether to encode the first identifier based on the attribute information, if it is determined to encode the first identifier, then encoding the first identifier; if it is determined not to encode the first identifier or the first string vector is not a preset string vector, then any string vector encoding method can be used, such as directly encoding the first string vector. The direct encoding method can be an existing direct encoding method or a direct encoding method provided by the present application. The present application does not impose any restrictions on this.
[0201] Example 5
[0202] Fig.15A flowchart of a method for decoding a string vector provided in an embodiment of the present application, wherein the execution subject of the method may be the following devices, but is not limited thereto: a decoder, or a device for decoding a string vector, such as a desktop computer, a mobile computing device, a notebook (e.g., a laptop) computer, a tablet computer, a set-top box, a handheld device such as a smart phone, a television, a camera, a display device, a digital media player, a video game console, a car computer, or the like. Fig.15 As shown, the method comprises the following steps:
[0203] S1510: Obtain attribute information of the code stream and the string to be decoded.
[0204] S1520: Parse the code stream according to the attribute information to obtain a first string of vectors.
[0205] The first string vector is a string vector of a string to be decoded; the attribute information includes at least one of the following: position information and length information of the string to be decoded.
[0206] It should be understood that the string to be decoded is the current string to be decoded in the current decoding unit. Therefore, the string to be decoded is also referred to as the current string to be decoded. The current decoding unit is also referred to as a decoding unit.
[0207] Optionally, the position information of the string to be decoded includes at least one of the following: the abscissa and the ordinate of the starting point of the string to be decoded, and the abscissa and the ordinate of the ending point of the string to be decoded.
[0208] Optionally, the relevant information of the first string vector may be information encoded when the first string vector is implicitly encoded, for example, the relevant information of the first string vector may include a first identifier, and the first identifier is used to identify whether the first string vector is a preset string vector. Alternatively, the relevant information of the first string vector may include a second identifier, and the second identifier is used to identify whether the first string vector is in the first displacement vector prediction list.
[0209] Optionally, the decoding end may decode the first string vector or related information of the first string vector according to attribute information, such as the length of the string to be decoded, or the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded.
[0210] It should be understood that, in addition to carrying the first string of vectors or related information of the first string of vectors, the above-mentioned code stream also carries other information in the image encoding process, such as quantization coefficients encoded by entropy coding technology, etc. This application mainly focuses on the decoding process of the first string of vectors.
[0211] In summary, in the present application, the decoding end can decode the first string vector or related information of the first string vector according to at least one of the position information and length information of the string to be decoded, that is, for the string to be decoded with different position information and at least one of the lengths, the decoding method adopted may be different to adapt to the decoding of different strings to be decoded, thereby improving the decoding effects of various strings to be decoded.
[0212] Example 6
[0213] Fig.16 A flowchart of another method for decoding a string vector provided in an embodiment of the present application is shown in FIG. Fig.16 As shown, the above S1520 includes the following steps:
[0214] S1610: Determine whether to decode the first identifier according to the attribute information, if so, execute S1620, otherwise, execute S1640.
[0215] S1620: Parse the code stream to obtain a first identifier.
[0216] S1630: If the first identifier indicates that the first string vector is not a preset string vector, execute S1640; otherwise, end.
[0217] S1640: Determine whether the first string of vectors is in the first displacement vector prediction list. If so, execute S1650; otherwise, execute S1660.
[0218] S1650: Parse the code stream to obtain the index of the first string of vectors in the first displacement vector prediction list, and obtain the first string of vectors through the index.
[0219] S1660: Determine the preset conditions satisfied by the attribute information, and parse the code stream according to a decoding method corresponding to the preset conditions.
[0220] As described above, the first identifier is used to identify whether the first string vector is a preset string vector. For example, the first identifier is 1, indicating that the first string vector is a preset string vector, and the first identifier is 0, indicating that the first string vector is not a preset string vector. Alternatively, the first identifier is 0, indicating that the first string vector is a preset string vector, and the first identifier is 1, indicating that the first string vector is not a preset string vector.
[0221] Optionally, if the scanning direction of the prediction mode of the string to be decoded is the horizontal scanning direction, the preset string vector is the string vector between the reference string above the string to be decoded and the string to be decoded, for example, the string vector is (0, -1). If the scanning direction of the prediction mode of the string to be decoded is the vertical scanning direction, the preset string vector is the string vector between the reference string on the left side of the string to be decoded and the string to be decoded, for example, the string vector is (-1, 0).
[0222] It should be understood that the longer the length of the string to be decoded is, the more different it is from the reference string, such as the upper reference string or the left reference string. In this case, the string vector corresponding to this type of reference string may not be used, that is, the above-mentioned preset string vector will not be used. Therefore, in this case, the decoding of the above-mentioned first identifier can be skipped. On the contrary, the shorter the length of the string to be decoded is, the more similar it is to the reference string, such as the upper reference string or the left reference string. In this case, the string vector corresponding to this type of reference string may be used, that is, the above-mentioned preset string vector will be used. Therefore, in this case, the above-mentioned first identifier can be decoded.
[0223] It should be understood that a string vector corresponding to a reference string is the following string vector, which is used to characterize the displacement of the string to be decoded relative to the reference string.
[0224] It should be understood that the length of the string to be decoded can be directly reflected by the length information of the string to be decoded, or can be reflected by the difference between the ordinate of the end point and the ordinate of the starting point of the string to be decoded. Based on this, the present application provides any of the following optional methods to determine whether to decode the first identifier, but is not limited to this:
[0225] 1. If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be decoded is greater than a first threshold, it is determined not to decode the first identifier; if the difference between the ordinate of the end point and the ordinate of the starting point of the string to be decoded is less than or equal to the first threshold, it is determined to decode the first identifier.
[0226] 2. If the length of the string to be decoded is greater than the second threshold, it is determined not to decode the first identifier; if the length of the string to be decoded is less than or equal to the second threshold, it is determined to decode the first identifier.
[0227] 3. If the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded is greater than the first threshold, and the length of the string to be decoded is greater than the second threshold, it is determined not to decode the first identifier; otherwise, it is determined to decode the first identifier.
[0228] 4. If the difference between the ordinate of the end point and the starting point of the string to be decoded is greater than or equal to the first threshold, it is determined not to decode the first identifier; if the difference between the ordinate of the end point and the starting point of the string to be decoded is less than the first threshold, it is determined to decode the first identifier.
[0229] 5. If the length of the string to be decoded is greater than or equal to the second threshold, it is determined not to decode the first identifier; if the length of the string to be decoded is less than the second threshold, it is determined to decode the first identifier.
[0230] 6. If the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded is greater than or equal to the first threshold, and the length of the string to be decoded is greater than or equal to the second threshold, determine not to decode the first identifier; otherwise, determine to decode the first identifier.
[0231] It should be understood that, as described above, for strings to be decoded with different at least one of the position information and length information, the encoding methods used may be different, that is, the information to be decoded may also be different. For example, some strings to be decoded can decode the first identifier corresponding to them. Some strings to be decoded can decode their index in the first displacement vector prediction list, and some strings to be decoded can directly decode their horizontal and vertical coordinates. Based on this, the encoder can select different context models according to at least one of the position information and length information of the string to be decoded.
[0232] This application provides any of the following optional ways to select a context model, but is not limited to these:
[0233] 1. If the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is greater than the first threshold, the first context model is selected; if the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is less than or equal to the first threshold, the second context model is selected.
[0234] 2. If the length of the string to be decoded is greater than the second threshold, the first context model is selected; if the length of the string to be decoded is less than or equal to the second threshold, the second context model is selected.
[0235] 3. If the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded is greater than the first threshold, and the length of the string to be decoded is greater than the second threshold, the first context model is selected; otherwise, the second context model is selected.
[0236] 4. If the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is greater than or equal to the first threshold, the first context model is selected; if the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is less than the first threshold, the second context model is selected.
[0237] 5. If the length of the string to be decoded is greater than or equal to the second threshold, the first context model is selected; if the length of the string to be decoded is less than the second threshold, the second context model is selected.
[0238] 6. If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be decoded is greater than or equal to the first threshold, and the length of the string to be decoded is greater than or equal to the second threshold, the first context model is selected; otherwise, the second context model is selected.
[0239] It should be understood that the first context model and the second context model are different, that is, the first context model is more suitable for long strings, while the second context model is more suitable for short strings. This application focuses on selecting different context models based on attribute information, but does not focus on the context model itself.
[0240] It should be understood that the first threshold and the second threshold may be pre-configured for the decoding end, or may be dynamically configured for the decoding end, and this application does not impose any limitation on this.
[0241] Optionally, the decoding end may construct a first displacement vector prediction list, based on which the decoding end may select the best SVP of the string to be decoded in the first displacement vector prediction list.
[0242] Optionally, the first displacement vector prediction list includes at least one of the following items, but is not limited thereto:
[0243] 1. The displacement vector of the historical decoding block adjacent to the to-be-decoded string in the spatial domain.
[0244] 2. Displacement vector of the historical decoded block.
[0245] 3. Including but not limited to (0, -1), (-1, 0), (-w, 0), (0, -h), (-w, -h), etc.
[0246] 4. Including but not limited to (0,start_y-end_y), (0,start_y-end_y-1), (-start_x-1,0), (-min(start_x+len,w),0), (-w,start_y-end_y), (-w,start_y-end_y-1).
[0247] The starting point of the string to be decoded is (start_x, start_y), the end point is (end_x, end_y), and w and h can both be integers greater than 1.
[0248] It should be noted that the historical decoded block involved in the first displacement vector prediction list refers to a decoded image block. The historical decoded block can be understood as a decoded image block, a decoded string, etc., and this application does not impose any restrictions on this.
[0249] It should be understood that the historical decoding block adjacent to the to-be-decoded string may be a historical decoding unit adjacent to the decoding unit where the to-be-decoded string is located, or may be a historical decoding string in the historical decoding unit, and the present application does not impose any limitation on this.
[0250] The above displacement vector may be BV, SV or MV in inter-frame prediction, and this application does not impose any limitation on this.
[0251] Optionally, if the first string of vectors is in the first displacement vector prediction list, the decoding end only needs to decode the index of the first string of vectors in the first displacement vector prediction list, that is, the index of the SVP of the first string of vectors in the first displacement vector prediction list. If the first string of vectors is not in the first displacement vector prediction list, determine the preset conditions satisfied by the attribute information, and decode the first string of vectors or related information of the first string of vectors according to the decoding method corresponding to the preset conditions.
[0252] Optionally, the decoding end may determine a decoding method to be used for the first string of vectors in the following manner to perform decoding, but is not limited thereto:
[0253] 1. If the preset condition is that the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded is less than or equal to a third threshold, the code stream is parsed to obtain a first string vector.
[0254] 2. If the preset condition is that the length of the string to be decoded is less than or equal to the fourth threshold, the bit stream is parsed to obtain a first string vector.
[0255] 3. If the preset condition is that the difference between the vertical coordinate of the end point and the vertical coordinate of the starting point of the string to be decoded is greater than a third threshold, the bit stream is parsed to obtain the residual information between the first string vector and the prediction information of the first string vector and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the residual information and the index.
[0256] 4. If the preset condition is that the length of the string to be decoded is greater than the fourth threshold, parse the bit stream to obtain the residual information between the first string vector and the prediction information of the first string vector and the index of the prediction information in the second displacement vector prediction list, and obtain the first string vector based on the residual information and the index.
[0257] 5. If the preset condition is that the difference between the vertical coordinate of the end point of the string to be decoded and the vertical coordinate of the starting point is greater than the third threshold, and the length of the string to be decoded is greater than the fourth threshold, the code stream is parsed to obtain the residual information between the first string vector and the prediction information of the first string vector and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the residual information and the index.
[0258] 6. If the preset condition is that the difference between the vertical coordinate of the end point and the vertical coordinate of the starting point of the string to be decoded is greater than a third threshold, the code stream is parsed to obtain the index of the distance offset value between the first string vector and the prediction information, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list.
[0259] 7. If the preset condition is that the length of the string to be decoded is greater than the fourth threshold, the code stream is parsed to obtain the index of the distance offset value between the first string vector and the prediction information, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list.
[0260] 8. If the preset condition is that the difference between the vertical coordinate of the end point of the string to be decoded and the vertical coordinate of the starting point is greater than the third threshold, and the length of the string to be decoded is greater than the fourth threshold, the code stream is parsed to obtain the index of the distance offset value between the first string vector and the prediction information, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list.
[0261] It should be understood that the third threshold and the fourth threshold may be pre-configured for the decoding end, or may be dynamically configured for the decoding end, and this application does not impose any limitation on this.
[0262] Optionally, the decoding end directly decodes the first string of vectors in the following manner, but is not limited thereto:
[0263] If the ordinate sv_y of the first string vector is greater than 0, based on the reference range restriction, the first string vector must point to the lower left of the string to be decoded, then the first offset value SvOffsetX is subtracted from the parsed abscissa to obtain the abscissa sv_x of the first string vector; or,
[0264] If the horizontal coordinate sv_x of the first string vector is greater than 0, based on the reference range restriction, the first string vector must point to the upper right of the string to be decoded, and then the second offset value SvOffsetY is subtracted from the parsed vertical coordinate to obtain the vertical coordinate sv_y of the first string vector.
[0265] It should be noted that, for how to determine the first offset value and the second offset value, reference may be made to Example 2, and this application will not elaborate on this.
[0266] Optionally, as described above, the decoding end may parse the bitstream to obtain residual information between the first string of vectors and the prediction information of the first string of vectors and the index of the prediction information in the second displacement vector prediction list, and obtain the first string of vectors based on the residual information and the index.
[0267] Optionally, the decoding end may construct a second displacement vector prediction list, based on which the decoding end may select the best SVP of the string to be decoded in the second displacement vector prediction list.
[0268] Optionally, the second displacement vector prediction list includes at least one of the following items, but is not limited thereto:
[0269] 1. The displacement vector of the historical decoding block adjacent to the to-be-decoded string in the spatial domain.
[0270] 2. Displacement vector of the historical decoding block.
[0271] 3. Including but not limited to (0, -1), (-1, 0), (-w, 0), (0, -h), (-w, -h), etc.
[0272] 4. Including but not limited to (0,start_y-end_y), (0,start_y-end_y-1), (-start_x-1,0), (-min(start_x+len,w),0), (-w,start_y-end_y), (-w,start_y-end_y-1).
[0273] The starting point of the string to be decoded is (start_x, start_y), the end point is (end_x, end_y), and w and h can both be integers greater than 1.
[0274] It should be noted that the historical decoded block involved in the second displacement vector prediction list refers to a decoded image block. The historical decoded block can be understood as a decoded image block, a decoded string, etc., and this application does not impose any restrictions on this.
[0275] It should be understood that the historical decoding block adjacent to the to-be-decoded string may be a historical decoding unit adjacent to the decoding unit where the to-be-decoded string is located, or may be a historical decoding string in the historical decoding unit, and the present application does not impose any limitation on this.
[0276] The above displacement vector may be BV, SV or MV in inter-frame prediction, and this application does not impose any limitation on this.
[0277] It should be noted that the second displacement vector prediction list may be the same as or different from the first displacement vector prediction list, for example, the first displacement vector prediction list includes the second item, ie, the displacement vector of the historical decoding block, and the second displacement vector prediction list includes the four items.
[0278] Optionally, as described above, the decoding end can parse the code stream to obtain the index of the distance offset value between the first string of vectors and the prediction information, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list, and obtain the first string of vectors according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list.
[0279] Exemplarily, the directional offset value between the first string of vectors and the prediction information svp includes: the directional offset value svd_sign_x in the horizontal coordinate direction, and the directional offset value svd_sign_y in the vertical coordinate direction. Assuming that the index of the directional offset value is represented by svd_sign_idx, then the correspondence between svd_sign_idx and svd_sign_x and svd_sign_y can be seen in Table 1 above.
[0280] Assuming that the index of the distance offset value is represented by svd_distance_index and the distance offset value is represented by svd_distance, the corresponding relationship between svd_distance_index and svd_distance can be seen in Table 2 above.
[0281] sv_x and sv_y can be calculated as follows
[0282] sv_x = svp_x + svd_distance * svd_sign_x (1)
[0283] sv_y = svp_y + svd_distance * svd_sign_y (2)
[0284] Among them, svp_x represents the horizontal coordinate of svp, svp_y represents the vertical coordinate of svp, and other parameters in formulas (1) and (2) can refer to the corresponding explanations above, which will not be repeated here.
[0285] In summary, in the present application, the decoding end can determine whether to skip decoding of the first identifier based on at least one of the position information and length information of the string to be decoded. If the decoding of the first identifier is skipped, the decoding efficiency can be improved. The decoding end can also determine the preset condition that is satisfied based on at least one of the position information and length information of the string to be decoded, and decode the first string vector or related information of the first string vector according to the decoding method corresponding to the preset condition, for example: decoding the residual information and index corresponding to the first string vector, or directly decoding, etc. In direct decoding, the above-mentioned first offset value and second offset value can be determined. Compared with the direct decoding scheme of the prior art, the present application can better reduce decoding bits.
[0286] Example 7
[0287] Fig.17 A flowchart of another method for decoding a string vector provided in an embodiment of the present application is shown in FIG. Fig.17 As shown, the above S1520 includes the following steps:
[0288] S1710: Parse the code stream to obtain a first identifier.
[0289] S1720: If the first identifier indicates that the first string vector is not a preset string vector, execute S1730; otherwise, end.
[0290] S1730: Determine whether the first string of vectors is in the first displacement vector prediction list. If so, execute S1740; otherwise, execute S1750.
[0291] S1740: Parse the code stream to obtain the index of the first string of vectors in the first displacement vector prediction list, and obtain the first string of vectors through the index.
[0292] S1750: Determine the preset conditions satisfied by the attribute information, and parse the code stream according to a decoding method corresponding to the preset conditions.
[0293] It should be understood that the difference between Example 7 and Example 6 is that Example 3 does not need to determine whether to parse the code stream based on the attribute information to obtain the first identifier, and the other parts are the same. Therefore, Example 7 can refer to the explanation in Example 6, and this application will not go into details.
[0294] Example 8
[0295] Fig.18 A flowchart of another method for decoding a string vector provided in an embodiment of the present application is shown in FIG. Fig.18 As shown, the above S1520 includes the following steps:
[0296] S1810: Determine whether to decode the first identifier based on the attribute information, if so, execute S1820, otherwise, execute S1840.
[0297] S1820: Parse the code stream to obtain a first identifier.
[0298] S1830: If the first identifier indicates that the first string vector is not a preset string vector, execute S1840; otherwise, end.
[0299] S1840: Determine whether the first string of vectors is in the first displacement vector prediction list. If so, execute S1850; otherwise, execute S1860.
[0300] S1850: Parse the code stream to obtain the index of the first string of vectors in the first displacement vector prediction list, and obtain the first string of vectors through the index.
[0301] S1860: Parse the bitstream to obtain a first string of vectors, or parse the bitstream to obtain residual information between the first string of vectors and the prediction information of the first string of vectors and the index of the prediction information in the second displacement vector prediction list, and obtain the first string of vectors according to the residual information and the index, or parse the bitstream to obtain the index of the distance offset value between the first string of vectors and the prediction information, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list, and obtain the first string of vectors according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list.
[0302] It should be understood that the difference between Example 8 and Example 6 is that Example 8 does not need to determine the preset conditions satisfied by the attribute information, and decodes the first string of vectors or the related information of the first string of vectors according to the encoding method corresponding to the preset conditions. Instead, the code stream is directly parsed to obtain the first string of vectors, or the code stream is parsed to obtain the residual information between the first string of vectors and the prediction information of the first string of vectors and the index of the prediction information in the second displacement vector prediction list, and the first string of vectors is obtained according to the residual information and the index, or the code stream is parsed to obtain the index of the distance offset value between the first string of vectors and the prediction information, the index of the direction offset and the index of the prediction information in the second displacement vector prediction list, and the first string of vectors is obtained according to the index of the distance offset value, the index of the direction offset and the index of the prediction information in the second displacement vector prediction list. The other parts are the same, so Example 8 can refer to the explanation in Example 6, and this application will not repeat it.
[0303] It should be noted that the string vector decoding method provided in the present application is not limited to embodiments 5-8. In fact, the present application can protect a single string vector decoding method, as long as the decoding method is combined with the attribute information of the string to be decoded. The present application can also protect a combination of at least two decoding methods, such as a combination of at least two of the following: a method for decoding the above-mentioned first identifier, decoding the index of the first string vector in the first displacement vector prediction list, using a direct decoding method, decoding the index of the prediction information in the second displacement vector prediction list and the residual information, decoding the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value, etc., as long as there is at least one decoding method combined with the attribute information of the string to be decoded, for example: judging whether to decode the first identifier based on the attribute information, if it is determined to decode the first identifier, then decoding the first identifier; if it is determined not to decode the first identifier or the first string vector is not a preset string vector, then any string vector decoding method can be used, such as directly decoding the first string vector. The direct decoding method can be an existing direct decoding method or a direct decoding method provided in the present application. The present application does not impose any restrictions on this.
[0304] Example 9
[0305] Fig.19 A schematic diagram of an encoding device provided in an embodiment of the present application, such as Fig.19 As shown, the device includes:
[0306] The acquisition module 1910 is used to acquire the attribute information of the string to be encoded.
[0307] The encoding module 1920 is used to encode the first string of vectors or related information of the first string of vectors according to the attribute information to obtain a code stream.
[0308] The output module 1930 is used to output a code stream.
[0309] The first string vector is a string vector of the string to be encoded. The attribute information includes at least one of the following: position information and length information of the string to be encoded.
[0310] Optionally, the encoding module 1920 is specifically used to: determine whether to encode the first identifier according to the attribute information, and the first identifier is used to identify whether the first string vector is a preset string vector.
[0311] Optionally, the encoding module 1920 is also used to: if it is determined that the first identifier is to be encoded, then encode the first identifier; if it is determined that the first identifier is not to be encoded or the first string vector is not a preset string vector, then determine whether the first string vector is in a first displacement vector prediction list; if it is determined that the first string vector is in the first displacement vector prediction list, then obtain the index of the first string vector in the first displacement vector prediction list, and encode the index of the first string vector in the first displacement vector prediction list; if it is determined that the first string vector is not in the first displacement vector prediction list, then determine the preset conditions satisfied by the attribute information, and encode the first string vector or related information of the first string vector according to the encoding method corresponding to the preset conditions.
[0312] Optionally, the encoding module 1920 is also used to: if it is determined that the first identifier is encoded, then encode the first identifier; if it is determined that the first identifier is not encoded or the first string vector is not a preset string vector, then determine whether the first string vector is in the first displacement vector prediction list; if it is determined that the first string vector is in the first displacement vector prediction list, obtain the index of the first string vector in the first displacement vector prediction list, and encode the index of the first string vector in the first displacement vector prediction list; if it is determined that the first string vector is not in the first displacement vector prediction list, then encode the first string vector, or obtain the residual information between the first string vector and the prediction information of the first string vector, encode the index of the prediction information in the second displacement vector prediction list and the residual information, or obtain the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information, and encode the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value.
[0313] Optionally, the encoding module 1920 is further configured to: if it is determined to encode the first identifier, encode the first identifier; if it is determined not to encode the first identifier or the first string vector is not a preset string vector, encode the first string vector.
[0314] Optionally, the encoding module 1920 is specifically used to: determine a preset condition satisfied by the attribute information; and encode the first string of vectors or related information of the first string of vectors according to an encoding method corresponding to the preset condition.
[0315] Optionally, the encoding module 1920 is also used to: encode a first identifier, the first identifier is used to identify whether the first string vector is a preset string vector; if it is determined that the first string vector is not a preset string vector, then determine whether the first string vector is in a first displacement vector prediction list; accordingly, the encoding module 1920 is specifically used to: if it is determined that the first string vector is not in the first displacement vector prediction list, then determine the preset conditions satisfied by the attribute information.
[0316] Optionally, the encoding module 1920 is also used to: if it is determined that the first string of vectors is in the first displacement vector prediction list, obtain the index of the first string of vectors in the first displacement vector prediction list, and encode the index of the first string of vectors in the first displacement vector prediction list.
[0317] Optionally, the encoding module 1920 is specifically used to: if the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than a first threshold, it is determined that the first identifier is not encoded; if the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is less than or equal to the first threshold, it is determined that the first identifier is encoded. Alternatively, if the length of the string to be encoded is greater than a second threshold, it is determined that the first identifier is not encoded; if the length of the string to be encoded is less than or equal to the second threshold, it is determined that the first identifier is encoded. Alternatively, if the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than the first threshold, and the length of the string to be encoded is greater than the second threshold, it is determined that the first identifier is not encoded; otherwise, it is determined that the first identifier is encoded.
[0318] Optionally, a selection module 1940 is also included, which is used to select a context model according to the attribute information.
[0319] Optionally, the selection module 1940 is specifically used to: if the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than a first threshold, then select the first context model; if the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is less than or equal to the first threshold, then select the second context model. Alternatively, if the length of the string to be encoded is greater than the second threshold, then select the first context model; if the length of the string to be encoded is less than or equal to the second threshold, then select the second context model. Alternatively, if the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than the first threshold, and the length of the string to be encoded is greater than the second threshold, then select the first context model; otherwise, select the second context model.
[0320] Optionally, if the scanning direction of the prediction mode of the string to be encoded is the horizontal scanning direction, the preset string vector is the string vector between the upper reference string of the string to be encoded and the string to be encoded. If the scanning direction of the prediction mode of the string to be encoded is the vertical scanning direction, the preset string vector is the string vector between the left reference string of the string to be encoded and the string to be encoded.
[0321] Optionally, the encoding module 1920 is specifically configured to: if the preset condition is that the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is less than or equal to a third threshold, encode the first string vector. Alternatively, if the preset condition is that the length of the string to be encoded is less than or equal to a fourth threshold, encode the first string vector.
[0322] Optionally, the encoding module 1920 is specifically configured to: if the ordinate of the first string of vectors is greater than 0, then add a first offset value to the abscissa of the first string of vectors and then encode it. Alternatively, if the abscissa of the first string of vectors is greater than 0, then add a second offset value to the ordinate of the first string of vectors and then encode it.
[0323] Optionally, if the encoding is performed by horizontal reciprocating scanning, and the starting point of the string to be encoded is in an even row, the first offset value is the minimum value of the first value and the width of the encoding unit where the string to be encoded is located, and the first value is the sum of the horizontal coordinate of the starting point and the length of the string to be encoded. Alternatively, if the encoding is performed by horizontal reciprocating scanning, and the starting point of the string to be encoded is in an odd row, the first offset value is the sum of the horizontal coordinate of the starting point and 1. Alternatively, if the encoding is performed by horizontal reciprocating scanning, and the vertical coordinate of the end point of the string to be encoded is greater than the second value, the first offset value is the width of the encoding unit where the string to be encoded is located, and the second value is the sum of the vertical coordinate of the starting point of the string to be encoded and 1. Alternatively, if the encoding is performed by horizontal reciprocating scanning, and the starting point of the string to be encoded is in an odd row, the vertical coordinate of the end point of the string to be encoded is equal to the second value, and the horizontal coordinate of the end point is greater than the horizontal coordinate of the starting point, then the first offset value is the sum of the horizontal coordinate of the end point and 1.
[0324] Optionally, if a horizontal reciprocating scanning method is used for encoding, and the end point of the string to be encoded is in an even row, the sum of the horizontal coordinate of the end point and the horizontal coordinate of the first string vector is greater than or equal to the width of the encoding unit where the string to be encoded is located, then the second offset value is equal to the sum of the vertical coordinate of the end point and 1. Alternatively, if a horizontal reciprocating scanning method is used for encoding, and the end point of the string to be encoded is in an even row, the sum of the horizontal coordinate of the end point and the horizontal coordinate of the first string vector is less than the width of the encoding unit where the string to be encoded is located, then the second offset value is equal to 0; alternatively, if a horizontal reciprocating scanning method is used for encoding, and the third value is greater than or equal to the width of the encoding unit where the string to be encoded is located, then the second offset value is equal to the sum of the vertical coordinate of the end point and 1. The third value is the horizontal coordinate of the end point plus the length of the string to be encoded, the horizontal coordinate of the first string vector, and then minus 1.
[0325] Optionally, the encoding module 1920 is specifically used to: if the preset condition is that the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than a third threshold, then obtain the residual information between the first string vector and the prediction information of the first string vector, and encode the index of the prediction information and the residual information. Alternatively, if the preset condition is that the length of the string to be encoded is greater than a fourth threshold, then obtain the residual information between the first string vector and the prediction information of the first string vector, and encode the index of the prediction information and the residual information. Alternatively, if the preset condition is that the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than the third threshold, and the length of the string to be encoded is greater than the fourth threshold, then obtain the residual information between the first string vector and the prediction information of the first string vector, and encode the index of the prediction information and the residual information.
[0326] Optionally, the encoding module 1920 is specifically used to: if the preset condition is that the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than the third threshold, then obtain the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information, and encode the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value, and the index of the direction offset value. Alternatively, if the preset condition is that the length of the string to be encoded is greater than the fourth threshold, then obtain the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information, and encode the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value, and the index of the direction offset value. If the preset condition is that the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than the third threshold, and the length of the string to be encoded is greater than the fourth threshold, then obtain the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information, and encode the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value, and the index of the direction offset value.
[0327] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, they will not be described here. Specifically, Fig.19 The encoding device shown can execute the method embodiment corresponding to the above-mentioned encoding end, and the aforementioned and other operations and / or functions of each module in the encoding device are respectively for implementing the corresponding processes of the method embodiment corresponding to the above-mentioned encoding end. For the sake of brevity, they will not be repeated here.
[0328] The encoding device of the embodiment of the present application is described above from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.
[0329] Example 10
[0330] Fig. 20 A schematic diagram of a decoding device provided in an embodiment of the present application, such as Fig. 20 As shown, the device includes:
[0331] The acquisition module 2010 is used to acquire the attribute information of the code stream and the string to be decoded.
[0332] The parsing module 2020 is used to parse the code stream according to the attribute information to obtain a first string of vectors.
[0333] The first string vector is a string vector of the string to be decoded. The attribute information includes at least one of the following: position information and length information of the string to be decoded.
[0334] Optionally, the parsing module 2020 is specifically used to: determine whether to decode the first identifier according to the attribute information, and the first identifier is used to identify whether the first string vector is a preset string vector.
[0335] Optionally, the parsing module 2020 is also used to: if it is determined that the first identifier is to be decoded, then decode the first identifier; if it is determined that the first identifier is not to be decoded or the first string vector is not a preset string vector, then parse the code stream to determine whether the first string vector is in the first displacement vector prediction list; if it is determined that the first string vector is in the first displacement vector prediction list, then parse the code stream to obtain the index of the first string vector in the first displacement vector prediction list, and obtain the first string vector through the index; if it is determined that the first string vector is not in the first displacement vector prediction list, then determine the preset conditions satisfied by the attribute information, and parse the code stream according to the decoding method corresponding to the preset conditions.
[0336] Optionally, the parsing module 2020 is also used to: if it is determined that the first identifier is decoded, then decode the first identifier; if it is determined that the first identifier is not decoded or the first string vector is not a preset string vector, then parse the code stream to determine whether the first string vector is in the first displacement vector prediction list; if it is determined that the first string vector is in the first displacement vector prediction list, then parse the code stream to obtain the index of the first string vector in the first displacement vector prediction list, and obtain the first string vector through the index; if it is determined that the first string vector is not in the first displacement vector prediction list, then parse the code stream to obtain the first string vector, or parse the code stream to obtain the residual information between the first string vector and the prediction information of the first string vector and the index of the prediction information in the second displacement vector prediction list, and obtain the first string vector according to the residual information and the index, or parse the code stream to obtain the index of the distance offset value between the first string vector and the prediction information, the index of the direction offset and the index of the prediction information in the second displacement vector prediction list, and obtain the first string vector according to the index of the distance offset value, the index of the direction offset and the index of the prediction information in the second displacement vector prediction list.
[0337] Optionally, the parsing module 2020 is further configured to: if it is determined to decode the first identifier, decode the first identifier; if it is determined not to decode the first identifier or the first string vector is not a preset string vector, parse the code stream to obtain the first string vector.
[0338] Optionally, the parsing module 2020 is specifically used to: determine a preset condition satisfied by the attribute information; and parse the code stream according to a decoding method corresponding to the preset condition.
[0339] Optionally, the parsing module 2020 is also used to: parse the code stream to obtain a first identifier, the first identifier is used to identify whether the first string vector is a preset string vector; if it is determined that the first string vector is not a preset string vector, parse the code stream to determine whether the first string vector is in a first displacement vector prediction list; accordingly, the parsing module 2020 is specifically used to: if it is determined that the first string vector is not in the first displacement vector prediction list, determine the preset conditions satisfied by the attribute information.
[0340] Optionally, the parsing module 2020 is further used to: if it is determined that the first string of vectors is in the first displacement vector prediction list, parse the bitstream to obtain the index of the first string of vectors in the first displacement vector prediction list, and obtain the first string of vectors through the index.
[0341] Optionally, the parsing module 2020 is specifically used to: if the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is greater than a first threshold, determine not to decode the first identifier; if the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is less than or equal to the first threshold, determine to decode the first identifier. Alternatively, if the length of the string to be decoded is greater than a second threshold, determine not to decode the first identifier; if the length of the string to be decoded is less than or equal to the second threshold, determine to decode the first identifier. Alternatively, if the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is greater than the first threshold, and the length of the string to be decoded is greater than the second threshold, determine not to decode the first identifier; otherwise, determine to decode the first identifier.
[0342] Optionally, a selection module 2030 is also included, which is used to select a context model according to the attribute information.
[0343] Optionally, the selection module 2030 is specifically used to: if the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is greater than a first threshold, then select the first context model; if the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is less than or equal to the first threshold, then select the second context model. Alternatively, if the length of the string to be decoded is greater than the second threshold, then select the first context model; if the length of the string to be decoded is less than or equal to the second threshold, then select the second context model. Alternatively, if the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is greater than the first threshold, and the length of the string to be decoded is greater than the second threshold, then select the first context model; otherwise, select the second context model.
[0344] Optionally, if the scanning direction of the prediction mode of the string to be decoded is the horizontal scanning direction, the preset string vector is the string vector between the reference string above the string to be decoded and the string to be decoded. If the scanning direction of the prediction mode of the string to be decoded is the vertical scanning direction, the preset string vector is the string vector between the reference string on the left side of the string to be decoded and the string to be decoded.
[0345] Optionally, the parsing module 2020 is specifically configured to: if the preset condition is that the difference between the ordinate of the end point of the to-be-decoded string and the ordinate of the start point is less than or equal to a third threshold, parse the bitstream to obtain the first string vector. Alternatively, if the preset condition is that the length of the to-be-decoded string is less than or equal to a fourth threshold, parse the bitstream to obtain the first string vector.
[0346] Optionally, the parsing module 2020 is specifically used to: parse the code stream to obtain the ordinate and abscissa of the first string of vectors after parsing. If the parsed ordinate is greater than 0, subtract the first offset value from the parsed abscissa to obtain the abscissa of the first string of vectors. Alternatively, if the parsed abscissa is greater than 0, subtract the second offset value from the parsed ordinate to obtain the ordinate of the first string of vectors.
[0347] Optionally, if the decoding is performed by horizontal reciprocating scanning, and the starting point of the string to be decoded is in an even row, the first offset value is the minimum value of the first value and the width of the decoding unit where the string to be decoded is located, and the first value is the sum of the horizontal coordinate of the starting point and the length of the string to be decoded. Alternatively, if the decoding is performed by horizontal reciprocating scanning, and the starting point of the string to be decoded is in an odd row, the first offset value is the sum of the horizontal coordinate of the starting point and 1. Alternatively, if the decoding is performed by horizontal reciprocating scanning, and the vertical coordinate of the end point of the string to be decoded is greater than the second value, the first offset value is the width of the decoding unit where the string to be decoded is located, and the second value is the sum of the vertical coordinate of the starting point of the string to be decoded and 1. Alternatively, if the decoding is performed by horizontal reciprocating scanning, and the starting point of the string to be decoded is in an odd row, the vertical coordinate of the end point of the string to be decoded is equal to the second value, and the horizontal coordinate of the end point is greater than the horizontal coordinate of the starting point, then the first offset value is the sum of the horizontal coordinate of the end point and 1.
[0348] Optionally, if a horizontal reciprocating scanning method is used for decoding, and the end point of the string to be decoded is in an even row, the sum of the horizontal coordinate of the end point and the horizontal coordinate of the first string vector is greater than or equal to the width of the decoding unit where the string to be decoded is located, then the second offset value is equal to the sum of the vertical coordinate of the end point and 1. Alternatively, if a horizontal reciprocating scanning method is used for encoding, and the end point of the string to be decoded is in an even row, the sum of the horizontal coordinate of the end point and the horizontal coordinate of the first string vector is less than the width of the decoding unit where the string to be decoded is located, then the second offset value is equal to 0; or, if a horizontal reciprocating scanning method is used for decoding, and the third value is greater than or equal to the width of the decoding unit where the string to be decoded is located, then the second offset value is equal to the sum of the vertical coordinate of the end point and 1. The third value is the horizontal coordinate of the end point plus the length of the string to be decoded, the horizontal coordinate of the first string vector, and then minus 1.
[0349] Optionally, the parsing module 2020 is specifically used to: if the preset condition is that the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is greater than a third threshold, then parse the code stream to obtain the residual information between the first string vector and the prediction information of the first string vector and the index of the prediction information in the second displacement vector prediction list, and obtain the first string vector according to the residual information and the index. Alternatively, if the preset condition is that the length of the string to be decoded is greater than a fourth threshold, then parse the code stream to obtain the residual information between the first string vector and the prediction information of the first string vector and the index of the prediction information in the second displacement vector prediction list, and obtain the first string vector according to the residual information and the index. Alternatively, if the preset condition is that the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is greater than the third threshold, and the length of the string to be decoded is greater than the fourth threshold, then parse the code stream to obtain the residual information between the first string vector and the prediction information of the first string vector and the index of the prediction information in the second displacement vector prediction list, and obtain the first string vector according to the residual information and the index.
[0350] Optionally, the parsing module 2020 is specifically used to: if the preset condition is that the difference between the ordinate of the end point of the to-be-decoded string and the ordinate of the starting point is greater than a third threshold, then parse the code stream to obtain the index of the distance offset value between the first string vector and the prediction information, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list, and obtain the first string vector according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list. Alternatively, if the preset condition is that the length of the to-be-decoded string is greater than a fourth threshold, then parse the code stream to obtain the index of the distance offset value between the first string vector and the prediction information, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list, and obtain the first string vector according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list. If the preset condition is that the difference between the vertical coordinate of the end point of the string to be decoded and the vertical coordinate of the starting point is greater than the third threshold, and the length of the string to be decoded is greater than the fourth threshold, the code stream is parsed to obtain the index of the distance offset value between the first string vector and the prediction information, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list.
[0351] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, they will not be described here. Specifically, Fig. 20 The decoding device shown can execute the method embodiment corresponding to the above-mentioned decoding end, and the aforementioned and other operations and / or functions of each module in the decoding device are respectively for implementing the corresponding processes of the method embodiment corresponding to the above-mentioned decoding end. For the sake of brevity, they will not be repeated here.
[0352] The decoding device of the embodiment of the present application is described above from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.
[0353] The present application also provides a coding device, which can be used to perform the method embodiments corresponding to the above-mentioned coding end, wherein the device can be an encoder, or a device for performing string vector coding, such as a desktop computer, a mobile computing device, a notebook (e.g., laptop) computer, a tablet computer, a set-top box, a handheld device such as a smart phone, a television, a camera, a display device, a digital media player, a video game console, a car computer, or other string vector coding devices such as the like. If it is a device for performing string vector coding, the device may include an encoder, a display, and a memory, etc., and the encoder is mainly used to perform the method embodiments corresponding to the coding end.
[0354] The present application also provides a decoding device, which can be used to perform the method embodiments corresponding to the above decoding end, wherein the device can be a decoder, or a device for performing string vector decoding, such as a desktop computer, a mobile computing device, a notebook (e.g., laptop) computer, a tablet computer, a set-top box, a handheld device such as a smart phone, a television, a camera, a display device, a digital media player, a video game console, a car computer, or other string vector decoding devices such as the like. If it is a device for performing string vector decoding, the device may include a decoder, a display, and a memory, etc. The decoder is mainly used to perform the method embodiments corresponding to the decoding end.
[0355] In some embodiments of the present application, the memory includes but is not limited to:
[0356] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0357] In some embodiments of the present application, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the image processing device.
[0358] The present application also provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, the present application embodiment also provides a computer program product containing instructions, and when the instructions are executed by a computer, the computer can perform the method of the above method embodiment.
[0359] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.
[0360] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0361] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0362] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0363] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for encoding a string vector, characterized in that: include: Get the attribute information of the string to be encoded; Encoding the relevant information of the first string of vectors according to the attribute information to obtain a code stream; Outputting the code stream; The first string vector is a string vector of the string to be encoded; the attribute information includes at least one of the following: position information and length information of the string to be encoded; The step of encoding the relevant information of the first string of vectors according to the attribute information includes: Determining whether to encode the first identifier according to the attribute information, the relevant information of the first string vector includes: the first identifier, the first identifier is used to identify whether the first string vector is a preset string vector; The step of determining whether to encode the first identifier according to the attribute information includes: If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than a first threshold, it is determined that the first identifier is not encoded; if the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is less than or equal to the first threshold, it is determined that the first identifier is encoded; or, If the length of the string to be encoded is greater than the second threshold, it is determined not to encode the first identifier; if the length of the string to be encoded is less than or equal to the second threshold, it is determined to encode the first identifier; or, If the difference between the ordinate of the end point and the ordinate of the start point of the string to be encoded is greater than a first threshold, and the length of the string to be encoded is greater than a second threshold, it is determined not to encode the first identifier; otherwise, it is determined to encode the first identifier.
2. The method according to claim 1, characterized in that After determining whether to encode the first identifier according to the attribute information, the method further includes: If it is determined to encode the first identifier, encode the first identifier; If it is determined not to encode the first identifier or the first string vector is not the preset string vector, determining whether the first string vector is in the first displacement vector prediction list; If it is determined that the first string of vectors is in the first displacement vector prediction list, obtaining an index of the first string of vectors in the first displacement vector prediction list, and encoding the index of the first string of vectors in the first displacement vector prediction list; wherein the relevant information of the first string of vectors includes: the index of the first string of vectors in the first displacement vector prediction list; If it is determined that the first string of vectors is not in the first displacement vector prediction list, determine the preset conditions satisfied by the attribute information, and encode the first string of vectors or related information of the first string of vectors according to the encoding method corresponding to the preset conditions.
3. The method according to claim 1, characterized in that After determining whether to encode the first identifier according to the attribute information, the method further includes: If it is determined to encode the first identifier, encode the first identifier; If it is determined not to encode the first identifier or the first string vector is not the preset string vector, determining whether the first string vector is in the first displacement vector prediction list; If it is determined that the first string of vectors is in the first displacement vector prediction list, obtaining an index of the first string of vectors in the first displacement vector prediction list, and encoding the index of the first string of vectors in the first displacement vector prediction list; wherein the relevant information of the first string of vectors includes: the index of the first string of vectors in the first displacement vector prediction list; If it is determined that the first string vector is not in the first displacement vector prediction list, the first string vector is encoded, or the residual information between the first string vector and the prediction information of the first string vector is obtained, and the index of the prediction information in the second displacement vector prediction list and the residual information are encoded, wherein the relevant information of the first string vector includes: the index of the prediction information in the second displacement vector prediction list and the residual information; or the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information are obtained, and the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value are encoded; wherein the relevant information of the first string vector includes: the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value.
4. The method according to claim 1, characterized in that After determining whether to encode the first identifier according to the attribute information, the method further includes: If it is determined to encode the first identifier, encode the first identifier; If it is determined not to encode the first identifier or the first string vector is not the preset string vector, the first string vector is encoded.
5. The method according to any one of claims 1 to 4, characterized in that: Also includes: A context model is selected according to the attribute information.
6. The method according to claim 5, characterized in that Selecting a context model according to the attribute information includes: If the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is greater than a first threshold, the first context model is selected; if the difference between the ordinate of the end point of the string to be encoded and the ordinate of the starting point is less than or equal to the first threshold, the second context model is selected; or, If the length of the string to be encoded is greater than a second threshold, the first context model is selected; if the length of the string to be encoded is less than or equal to the second threshold, the second context model is selected; or, If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than a first threshold, and the length of the string to be encoded is greater than a second threshold, the first context model is selected, otherwise, the second context model is selected.
7. The method according to any one of claims 1 to 4, characterized in that: If the scanning direction of the prediction mode of the string to be encoded is the horizontal scanning direction, the preset string vector is a string vector between the upper reference string of the string to be encoded and the string to be encoded; If the scanning direction of the prediction mode of the string to be encoded is a vertical scanning direction, the preset string vector is a string vector between a reference string on the left side of the string to be encoded and the string to be encoded.
8. The method according to claim 2, characterized in that: The encoding of the first string of vectors or related information of the first string of vectors according to the encoding method corresponding to the preset condition includes: If the preset condition is that the difference between the ordinate of the end point and the ordinate of the start point of the string to be encoded is less than or equal to a third threshold, the first string vector is encoded; or, If the preset condition is that the length of the string to be encoded is less than or equal to a fourth threshold, the first string vector is encoded.
9. The method according to claim 8, characterized in that The encoding of the first string of vectors includes: If the ordinate of the first string of vectors is greater than 0, the abscissa of the first string of vectors is encoded after adding a first offset value; or, If the horizontal coordinate of the first string of vectors is greater than 0, the vertical coordinate of the first string of vectors is added with a second offset value and then encoded.
10. The method according to claim 9, characterized in that If encoding is performed by horizontal reciprocating scanning, and the starting point of the string to be encoded is in an even row, the first offset value is the minimum value of the first value and the width of the encoding unit where the string to be encoded is located, and the first value is the sum of the horizontal coordinate of the starting point and the length of the string to be encoded; or, If the encoding is performed in a horizontal reciprocating scanning manner, and the starting point of the string to be encoded is in an odd row, the first offset value is the sum of the horizontal coordinate of the starting point and 1; or, If the encoding is performed by horizontal reciprocating scanning, and the ordinate of the end point of the string to be encoded is greater than the second value, the first offset value is the width of the encoding unit where the string to be encoded is located, and the second value is the sum of the ordinate of the start point of the string to be encoded and 1; or, If encoding is performed using a horizontal reciprocating scanning method, and the starting point of the string to be encoded is in an odd row, the vertical coordinate of the end point of the string to be encoded is equal to the second value, and the horizontal coordinate of the end point is greater than the horizontal coordinate of the starting point, then the first offset value is the sum of the horizontal coordinate of the end point and 1.
11. The method according to claim 9, characterized in that If encoding is performed in a horizontal reciprocating scanning manner, and the end point of the string to be encoded is in an even row, and the sum of the abscissa of the end point and the abscissa of the first string vector is greater than or equal to the width of the encoding unit where the string to be encoded is located, then the second offset value is equal to the sum of the ordinate of the end point and 1; or, If encoding is performed in a horizontal reciprocating scanning manner, and the end point of the string to be encoded is in an even row, and the sum of the abscissa of the end point and the abscissa of the first string vector is less than the width of the encoding unit where the string to be encoded is located, then the second offset value is equal to 0; or, If encoding is performed using a horizontal reciprocating scanning method, and the third value is greater than or equal to the width of the encoding unit where the string to be encoded is located, then the second offset value is equal to the sum of the vertical coordinate of the end point and 1; wherein the third value is the horizontal coordinate of the end point plus the length of the string to be encoded, the horizontal coordinate of the first string vector, and then minus 1.
12. The method according to claim 2, characterized in that: The encoding of the first string of vectors or related information of the first string of vectors according to the encoding method corresponding to the preset condition includes: If the preset condition is that the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than a third threshold, then obtaining residual information between the first string vector and the prediction information of the first string vector, and encoding the index of the prediction information and the residual information; wherein the relevant information of the first string vector includes: the index of the prediction information and the residual information; or, If the preset condition is that the length of the to-be-encoded string is greater than a fourth threshold, obtaining residual information between the first string vector and the prediction information of the first string vector, and encoding the index of the prediction information and the residual information; wherein the relevant information of the first string vector includes: the index of the prediction information and the residual information; or, If the preset condition is that the difference between the vertical coordinate of the end point and the vertical coordinate of the starting point of the string to be encoded is greater than a third threshold, and the length of the string to be encoded is greater than a fourth threshold, then the residual information between the first string vector and the prediction information of the first string vector is obtained, and the index of the prediction information and the residual information are encoded; wherein the relevant information of the first string vector includes: the index of the prediction information and the residual information.
13. The method according to claim 2, characterized in that The encoding of the first string of vectors or related information of the first string of vectors according to the encoding method corresponding to the preset condition includes: If the preset condition is that the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than a third threshold, then the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information of the first string vector are obtained, and the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value are encoded; wherein the relevant information of the first string vector includes: the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value; or, If the preset condition is that the length of the string to be encoded is greater than a fourth threshold, then obtaining the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information, and encoding the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value, and the index of the direction offset value; wherein the relevant information of the first string vector includes: the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value, and the index of the direction offset value; or, If the preset condition is that the difference between the vertical coordinate of the end point and the vertical coordinate of the starting point of the string to be encoded is greater than a third threshold, and the length of the string to be encoded is greater than a fourth threshold, then the index of the distance offset value and the index of the direction offset value between the first string vector and the prediction information are obtained, and the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value are encoded; wherein the relevant information of the first string vector includes: the index of the prediction information in the second displacement vector prediction list, the index of the distance offset value and the index of the direction offset value.
14. A method for decoding a string vector, characterized in that: include: Get the attribute information of the code stream and the string to be decoded; Parsing the code stream according to the attribute information to obtain a first string of vectors; The first string vector is a string vector of a string to be decoded; the attribute information includes at least one of the following: position information and length information of the string to be decoded; The step of parsing the code stream according to the attribute information includes: Determining whether to decode a first identifier according to the attribute information, where the first identifier is used to identify whether the first string vector is a preset string vector; The step of determining whether to decode the first identifier according to the attribute information includes: If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be decoded is greater than a first threshold, it is determined not to decode the first identifier; if the difference between the ordinate of the end point and the ordinate of the starting point of the string to be decoded is less than or equal to the first threshold, it is determined to decode the first identifier; or, If the length of the string to be decoded is greater than the second threshold, it is determined not to decode the first identifier; if the length of the string to be decoded is less than or equal to the second threshold, it is determined to decode the first identifier; or, If the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded is greater than a first threshold, and the length of the string to be decoded is greater than a second threshold, it is determined not to decode the first identifier; otherwise, it is determined to decode the first identifier.
15. The method according to claim 14, characterized in that After determining whether to decode the first identifier according to the attribute information, the method further includes: If it is determined to decode the first identifier, decoding the first identifier; If it is determined not to decode the first identifier or the first string vector is not the preset string vector, parsing the bitstream to determine whether the first string vector is in a first displacement vector prediction list; If it is determined that the first string of vectors is in the first displacement vector prediction list, parsing the bitstream to obtain an index of the first string of vectors in the first displacement vector prediction list, and obtaining the first string of vectors through the index; If it is determined that the first string of vectors is not in the first displacement vector prediction list, the preset conditions satisfied by the attribute information are determined, and the code stream is parsed according to a decoding method corresponding to the preset conditions.
16. The method according to claim 14, characterized in that After determining whether to decode the first identifier according to the attribute information, the method further includes: If it is determined to decode the first identifier, decoding the first identifier; If it is determined not to decode the first identifier or the first string vector is not the preset string vector, parsing the bitstream to determine whether the first string vector is in a first displacement vector prediction list; If it is determined that the first string of vectors is in the first displacement vector prediction list, parsing the bitstream to obtain an index of the first string of vectors in the first displacement vector prediction list, and obtaining the first string of vectors through the index; If it is determined that the first string vector is not in the first displacement vector prediction list, the code stream is parsed to obtain the first string vector, or the code stream is parsed to obtain the residual information between the first string vector and the prediction information of the first string vector and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the residual information and the index, or the code stream is parsed to obtain the index of the distance offset value between the first string vector and the prediction information, the index of the direction offset and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the index of the distance offset value, the index of the direction offset and the index of the prediction information in the second displacement vector prediction list.
17. The method according to claim 14, characterized in that After determining whether to decode the first identifier according to the attribute information, the method further includes: If it is determined to decode the first identifier, decoding the first identifier; If it is determined not to decode the first identifier or the first string vector is not the preset string vector, the code stream is parsed to obtain the first string vector.
18. The method according to any one of claims 14 to 17, characterized in that: Also includes: A context model is selected according to the attribute information.
19. The method according to claim 18, characterized in that Selecting a context model according to the attribute information includes: If the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is greater than a first threshold, the first context model is selected; if the difference between the ordinate of the end point of the string to be decoded and the ordinate of the starting point is less than or equal to the first threshold, the second context model is selected; or, If the length of the string to be decoded is greater than a second threshold, the first context model is selected; if the length of the string to be decoded is less than or equal to the second threshold, the second context model is selected; or, If the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded is greater than a first threshold, and the length of the string to be decoded is greater than a second threshold, the first context model is selected; otherwise, the second context model is selected.
20. The method according to any one of claims 14 to 17, characterized in that: If the scanning direction of the prediction mode of the to-be-decoded string is the horizontal scanning direction, the preset string vector is a string vector between the upper reference string of the to-be-decoded string and the to-be-decoded string; If the scanning direction of the prediction mode of the to-be-decoded string is a vertical scanning direction, the preset string vector is a string vector between a reference string on the left side of the to-be-decoded string and the to-be-decoded string.
21. The method according to claim 15, characterized in that The parsing the code stream according to the decoding method corresponding to the preset condition includes: If the preset condition is that the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded is less than or equal to a third threshold, the bit stream is parsed to obtain the first string vector; or, If the preset condition is that the length of the to-be-decoded string is less than or equal to a fourth threshold, the code stream is parsed to obtain the first string vector.
22. The method according to claim 21, characterized in that The parsing the code stream to obtain the first string of vectors includes: Parsing the code stream to obtain the parsed ordinate and abscissa of the first string of vectors; If the resolved ordinate is greater than 0, subtracting the first offset value from the resolved abscissa to obtain the abscissa of the first string of vectors; or, If the resolved horizontal coordinate is greater than 0, the second offset value is subtracted from the resolved vertical coordinate to obtain the vertical coordinate of the first string of vectors.
23. The method according to claim 22, characterized in that If the decoding is performed by horizontal reciprocating scanning, and the starting point of the to-be-decoded string is in an even-numbered row, the first offset value is the minimum value of the first value and the width of the decoding unit where the to-be-decoded string is located, and the first value is the sum of the horizontal coordinate of the starting point and the length of the to-be-decoded string; or, If the decoding is performed in a horizontal reciprocating scanning mode, and the starting point of the to-be-decoded string is in an odd-numbered row, the first offset value is the sum of the horizontal coordinate of the starting point and 1; or, If the decoding is performed by horizontal reciprocating scanning, and the ordinate of the end point of the to-be-decoded string is greater than the second value, the first offset value is the width of the decoding unit where the to-be-decoded string is located, and the second value is the sum of the ordinate of the start point of the to-be-decoded string and 1; or, If horizontal reciprocating scanning is used for decoding, and the starting point of the string to be decoded is in an odd row, the vertical coordinate of the end point of the string to be decoded is equal to the second value, and the horizontal coordinate of the end point is greater than the horizontal coordinate of the starting point, then the first offset value is the sum of the horizontal coordinate of the end point and 1.
24. The method according to claim 22, characterized in that If decoding is performed in a horizontal reciprocating scanning manner, and the end point of the to-be-decoded string is in an even row, and the sum of the abscissa of the end point and the abscissa of the first string vector is greater than or equal to the width of the decoding unit where the to-be-decoded string is located, then the second offset value is equal to the sum of the ordinate of the end point and 1; or, If encoding is performed in a horizontal reciprocating scanning manner, and the end point of the to-be-decoded string is in an even row, and the sum of the abscissa of the end point and the abscissa of the first string vector is less than the width of the decoding unit where the to-be-decoded string is located, then the second offset value is equal to 0; or, If decoding is performed using a horizontal reciprocating scanning method, and the third value is greater than or equal to the width of the decoding unit where the string to be decoded is located, then the second offset value is equal to the sum of the vertical coordinate of the end point and 1; wherein the third value is the horizontal coordinate of the end point plus the length of the string to be decoded, the horizontal coordinate of the first string vector, and then minus 1.
25. The method according to claim 15, characterized in that The parsing the code stream according to the decoding method corresponding to the preset condition includes: If the preset condition is that the difference between the ordinate of the end point and the ordinate of the start point of the to-be-decoded string is greater than a third threshold, the bitstream is parsed to obtain residual information between the first string vector and the prediction information of the first string vector and an index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the residual information and the index; or If the preset condition is that the length of the to-be-decoded string is greater than a fourth threshold, parsing the bitstream to obtain residual information between the first string vector and the prediction information of the first string vector and an index of the prediction information in the second displacement vector prediction list, and obtaining the first string vector according to the residual information and the index; or If the preset condition is that the difference between the vertical coordinate of the end point and the vertical coordinate of the starting point of the string to be decoded is greater than a third threshold, and the length of the string to be decoded is greater than a fourth threshold, the code stream is parsed to obtain residual information between the first string vector and the prediction information of the first string vector and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the residual information and the index.
26. The method according to claim 15, characterized in that The parsing the code stream according to the decoding method corresponding to the preset condition includes: If the preset condition is that the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded is greater than a third threshold, the code stream is parsed to obtain an index of a distance offset value between the first string vector and the prediction information of the first string vector, an index of a direction offset, and an index of the prediction information in a second displacement vector prediction list, and the first string vector is obtained according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list; or If the preset condition is that the length of the to-be-decoded string is greater than a fourth threshold, parsing the code stream to obtain an index of a distance offset value between the first string vector and the prediction information, an index of a direction offset, and an index of the prediction information in the second displacement vector prediction list, and obtaining the first string vector according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list; If the preset condition is that the difference between the vertical coordinate of the end point and the vertical coordinate of the starting point of the string to be decoded is greater than a third threshold, and the length of the string to be decoded is greater than a fourth threshold, the code stream is parsed to obtain the index of the distance offset value between the first string vector and the prediction information, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list, and the first string vector is obtained according to the index of the distance offset value, the index of the direction offset, and the index of the prediction information in the second displacement vector prediction list.
27. An encoding device, characterized in that include: An acquisition module, used to obtain attribute information of the string to be encoded; An encoding module, used for encoding the relevant information of the first string of vectors according to the attribute information to obtain a code stream; An output module, used for outputting the code stream; The first string vector is a string vector of the string to be encoded; the attribute information includes at least one of the following: position information and length information of the string to be encoded; Wherein, the encoding module is specifically used for: Determining whether to encode the first identifier according to the attribute information, the relevant information of the first string vector includes: the first identifier, the first identifier is used to identify whether the first string vector is a preset string vector; Wherein, the encoding module is specifically used for: If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is greater than a first threshold, it is determined that the first identifier is not encoded; if the difference between the ordinate of the end point and the ordinate of the starting point of the string to be encoded is less than or equal to the first threshold, it is determined that the first identifier is encoded; or, If the length of the string to be encoded is greater than the second threshold, it is determined not to encode the first identifier; if the length of the string to be encoded is less than or equal to the second threshold, it is determined to encode the first identifier; or, If the difference between the ordinate of the end point and the ordinate of the start point of the string to be encoded is greater than a first threshold, and the length of the string to be encoded is greater than a second threshold, it is determined not to encode the first identifier; otherwise, it is determined to encode the first identifier.
28. A decoding device, characterized in that: include: The acquisition module is used to obtain the attribute information of the code stream and the string to be decoded; A parsing module, configured to parse the code stream according to the attribute information to obtain a first string of vectors; The first string vector is a string vector of a string to be decoded; the attribute information includes at least one of the following: position information and length information of the string to be decoded; Wherein, the parsing module is specifically used for: Determining whether to decode a first identifier according to the attribute information, where the first identifier is used to identify whether the first string vector is a preset string vector; Wherein, the parsing module is specifically used for: If the difference between the ordinate of the end point and the ordinate of the starting point of the string to be decoded is greater than a first threshold, it is determined not to decode the first identifier; if the difference between the ordinate of the end point and the ordinate of the starting point of the string to be decoded is less than or equal to the first threshold, it is determined to decode the first identifier; or, If the length of the string to be decoded is greater than the second threshold, it is determined not to decode the first identifier; if the length of the string to be decoded is less than or equal to the second threshold, it is determined to decode the first identifier; or, If the difference between the ordinate of the end point and the ordinate of the start point of the string to be decoded is greater than a first threshold, and the length of the string to be decoded is greater than a second threshold, it is determined not to decode the first identifier; otherwise, it is determined to decode the first identifier.
29. A computer-readable storage medium, characterized in that: Used to store a computer program, the computer program causing a computer to execute the method according to any one of claims 1 to 26.
Citation Information
Patent Citations
Encoding and decoding methods and devices for data compression
CN107071450A
Data compression method and device for carrying out string displacement vector coding through value range division
CN107483941A
