Video decoding method and device, video coding method and device, equipment and storage medium
By introducing string length resolution into video encoding and decoding technology and improving the encoding and decoding method of string length information, the intra-string copy prediction technology in the prior art is solved, and a more efficient video encoding and decoding process is achieved.
Patent Information
- Application Number
- CN202411688183.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-20
- Publication Date
- 2025-02-28
AI Technical Summary
Among the existing video encoding and decoding technologies, intra-string copy prediction technology has the problem of low encoding and decoding efficiency.
By introducing string length resolution in the video decoding method and video encoding method, the length of the pixel string in the codec block is limited to a multiple of the string length resolution, and the encoding and debinarization of the string length information is improved by binarization and inverse binarization processing.
The neatness of the pixel string is improved, so that the codec can code under memory alignment, improve the encoding and decoding efficiency of the pixel string, and reduce the encoding and decoding complexity.
Smart Images

Figure CN119545002A_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application with application number 202010841108.9 filed on August 20, 2020, and invention name “Video decoding method, video encoding method, device, equipment and storage medium”. Technical Field
[0002] The embodiments of the present application relate to the field of video coding and decoding technology, and in particular to a video decoding method, a video encoding method, an apparatus, a device and a storage medium. Background Art
[0003] In current video coding standards, such as VVC (Versatile Video Coding) and AVS3 (Audio Video Coding Standard 3), ISC (Intra String Copy) prediction technology is introduced.
[0004] In the related intra-frame string copy technology, a coding block is divided into a series of pixel strings or unmatched pixels according to a certain scanning order. In essence, it allows the coding block to be divided into pixel strings of any integer pixel length. For example, an unmatched pixel can be considered as a pixel string with a length of 1. In this way, the length of the pixel string can be any positive integer such as 1, 2, 3, 4, etc.
[0005] The related technology has the problem of low encoding and decoding efficiency. Summary of the invention
[0006] The embodiments of the present application provide a video decoding method, a video encoding method, an apparatus, a device and a storage medium, which can improve the encoding and decoding efficiency of pixel strings. The technical solution is as follows:
[0007] According to one aspect of an embodiment of the present application, a video decoding method is provided, the method comprising:
[0008] Decoding a binary symbol string of string length information of a current string from a bit stream, wherein the string length information includes information related to the string length of the current string;
[0009] Debinarize the binary symbol string according to the string length resolution of the current string to obtain the string length information;
[0010] The string length of the current string is determined according to the string length information.
[0011] According to one aspect of an embodiment of the present application, a video encoding method is provided, the method comprising:
[0012] Determine the string length of the current string;
[0013] Determining string length information of the current string based on the string length of the current string, the string length information including information related to the string length of the current string;
[0014] The string length information is binarized according to the string length resolution of the current string to obtain a binary symbol string of the string length information.
[0015] According to one aspect of an embodiment of the present application, a video decoding device is provided, the device comprising:
[0016] A binary symbol acquisition module, used for decoding a binary symbol string of string length information of a current string from a code stream, wherein the string length information includes information related to the string length of the current string;
[0017] A debinarization processing module, used for performing debinarization processing on the binary symbol string according to the string length resolution of the current string to obtain the string length information;
[0018] The string length determination module is used to determine the string length of the current string according to the string length information.
[0019] According to one aspect of an embodiment of the present application, a video encoding device is provided, the device comprising:
[0020] A string length determination module, used to determine the string length of the current string;
[0021] A length information determination module, configured to determine the string length information of the current string based on the string length of the current string, wherein the string length information includes information related to the string length of the current string;
[0022] The binarization processing module is used to perform binarization processing on the string length information according to the string length resolution of the current string to obtain a binary symbol string of the string length information.
[0023] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the above-mentioned video decoding method.
[0024] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the above-mentioned video encoding method.
[0025] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned video decoding method.
[0026] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned video encoding method.
[0027] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned video decoding method.
[0028] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned video encoding method.
[0029] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0030] By using the string length resolution as the basis for dividing and encoding pixel strings, the length of the pixel string in the encoding and decoding block can be limited to a multiple of the string length resolution, thereby improving the uniformity of the pixel string and enabling the codec end to perform encoding and decoding under the condition of memory alignment, thereby improving the encoding and decoding efficiency of the pixel string.
[0031] In addition, the present application takes into account the influence of string length resolution on the encoding and decoding of string length information, and proposes a method for binarizing and debinarizing string length information according to string length resolution, which improves the encoding and decoding method of string length information under different string length resolutions. Specifically, when the encoding end performs binarization on the value of string length information, the string length resolution can be used to compress the value first, and then the compressed value (that is, the quotient obtained by dividing the value by the string length resolution) is binarized instead of directly binarizing the value. Accordingly, when the decoding end performs debinarization, the compressed value is obtained by debinarization recovery, and then the value of the string length information is obtained based on the compressed value and the string length resolution (that is, multiplying the compressed value by the string length resolution). In this way, the number of characters required for binary representation can be reduced, thereby reducing the complexity of encoding and decoding, which is conducive to the improvement of encoding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is a basic flow chart of a video encoding process exemplarily shown in this application;
[0033] Figure 2 is a schematic diagram of an inter-frame prediction mode provided by an embodiment of the present application;
[0034] Figure 3 is a schematic diagram of candidate motion vectors provided by an embodiment of the present application;
[0035] Figure 4 is a schematic diagram of an intra-frame block copy mode provided by an embodiment of the present application;
[0036] Figure 5 is a schematic diagram of an intra-frame string replication mode provided by an embodiment of the present application;
[0037] Figure 6 is a simplified block diagram of a communication system provided by one embodiment of the present application;
[0038] Figure 7 is a schematic diagram of the placement of a video encoder and a video decoder in a streaming transmission environment exemplarily shown in the present application;
[0039] Figure 8 is a flowchart of a video decoding method provided by an embodiment of the present application;
[0040] Fig. 9 is a flowchart of a video encoding method provided by an embodiment of the present application;
[0041] Fig.10 is a block diagram of a video decoding device provided by an embodiment of the present application;
[0042] Fig.11 is a block diagram of a video encoding device provided by an embodiment of the present application;
[0043] Fig.12 It is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0044] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0045] Before introducing the embodiments of the present application, Figure 1 A brief introduction to video encoding technology. Figure 1 A basic flow chart of a video encoding process is exemplarily shown.
[0046] Video signal refers to an image sequence consisting of multiple frames. A frame is a representation of the spatial information of a video signal. Taking the YUV mode as an example, a frame includes a brightness sample matrix (Y) and two chrominance sample matrices (Cb and Cr). From the perspective of how the video signal is obtained, it can be divided into two methods: captured by a camera and generated by a computer. Due to different statistical characteristics, the corresponding compression encoding methods may also be different.
[0047] In some mainstream video coding technologies, such as H.265 / HEVC (High Efficient Video Coding), H.266 / VVC (Versatile Video Coding), AVS (Audio Video Coding Standard) (such as AVS3), a hybrid coding framework is used to perform the following operations and processing on the input original video signal:
[0048] 1. Block partition structure: The input image is divided into several non-overlapping processing units, each of which will perform similar compression operations. This processing unit is called CTU (Coding Tree Unit) or LCU (Large Coding Unit). Below CTU, more detailed divisions can be made to obtain one or more basic coding units, called CUs. Each CU is the most basic element in a coding process. The following describes various possible coding methods for each CU.
[0049] 2. Predictive Coding: It includes intra-frame prediction and inter-frame prediction. The original video signal is predicted by the selected reconstructed video signal to obtain the residual video signal. The encoder needs to choose the most suitable one among many possible predictive coding modes for the current CU and inform the decoder. Intra-frame prediction means that the predicted signal comes from the area that has been encoded and reconstructed in the same image. Inter-frame prediction means that the predicted signal comes from other images that have been encoded and are different from the current image (called reference images).
[0050] 3. Transform coding and quantization (Transform & Quantization): The residual video signal is transformed into the transform domain through transformation operations such as DFT (Discrete Fourier Transform) and DCT (Discrete Cosine Transform), which are called transform coefficients. The signal in the transform domain is further subjected to lossy quantization operations, which loses certain information, making the quantized signal conducive to compression expression. In some video coding standards, there may be more than one transform mode to choose from, so the encoder also needs to select one of the transforms for the current CU and inform the decoder. The degree of quantization is usually determined by the quantization parameter. A larger QP (Quantization Parameter) value means that coefficients with a larger value range will be quantized to the same output, which usually results in greater distortion and lower bit rate; on the contrary, a smaller QP value means that coefficients with a smaller value range will be quantized to the same output, which usually results in less distortion and a higher bit rate.
[0051] 4. Entropy Coding or Statistical Coding: The quantized transform domain signal will be statistically compressed and encoded according to the frequency of occurrence of each value, and finally output as a binary (0 or 1) compressed bit stream. At the same time, the encoding generates other information, such as the selected mode, motion vector, etc., which also needs to be entropy encoded to reduce the bit rate. Statistical coding is a lossless coding method that can effectively reduce the bit rate required to express the same signal. Common statistical coding methods include variable length coding (VLC) or context-based binary arithmetic coding (CABAC).
[0052] 5. Loop Filtering: The encoded image can be reconstructed into a decoded image after undergoing inverse quantization, inverse transformation and prediction compensation (the reverse operation of 2 to 4 above). Compared with the original image, the reconstructed image has some information that is different from the original image due to the influence of quantization, resulting in distortion. Filtering the reconstructed image, such as deblocking, SAO (Sample Adaptive Offset) or ALF (Adaptive Lattice Filter), can effectively reduce the distortion caused by quantization. Since these filtered reconstructed images will be used as a reference for subsequent encoded images and used to predict future signals, the above filtering operation is also called loop filtering, and the filtering operation in the encoding loop.
[0053] According to the above encoding process, it can be seen that at the decoding end, for each CU, after the decoder obtains the compressed bitstream, it first performs entropy decoding to obtain various mode information and quantized transform coefficients. Each coefficient is dequantized and inversely transformed to obtain a residual signal. On the other hand, based on the known encoding mode information, the prediction signal corresponding to the CU can be obtained. After adding the two, the reconstructed signal can be obtained. Finally, the reconstructed value of the decoded image needs to undergo a loop filtering operation to generate the final output signal.
[0054] Some mainstream video coding standards, such as HEVC, VVC, AVS3, etc., all adopt a block-based hybrid coding framework. They divide the original video data into a series of coding 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 for video coding. Motion compensation is based on the redundant characteristics of video content in the time domain or spatial domain, and derives the prediction value of the current coding block from the encoded area. This type of prediction method includes: inter-frame prediction, intra-frame block copy prediction, intra-frame string copy prediction, etc. In specific coding implementations, these prediction methods may be used alone or in combination. For coding 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 block (or the same-position block of the current block) relative to one or more reference blocks.
[0055] It should be noted that in different prediction modes and different implementations, the displacement vector may have different names. This article uniformly describes them in the following way: 1) The displacement vector in the inter-frame prediction mode is called the motion vector (MV); 2) The displacement vector in the IBC (Intra Block Copy) prediction mode is called the block vector (BV); 3) The displacement vector in the ISC (Intra String Copy) prediction mode is called the string vector (SV). Intra-frame string copy is also called "string prediction" or "string matching".
[0056] MV refers to the displacement vector used in the inter-frame prediction mode, which points from the current image to the reference image, and its value is the coordinate offset between the current block and the reference block, where the current block and the reference block are in two different images. In the inter-frame prediction mode, motion vector prediction can be introduced. By predicting the motion vector of the current block, the predicted motion vector corresponding to the current block is obtained, and the difference between the predicted motion vector corresponding to the current block and the actual motion vector is encoded and transmitted. Compared with directly encoding and transmitting the actual motion vector corresponding to the current block, it is beneficial to save bit overhead. In the embodiment of the present application, the predicted motion vector refers to the predicted value of the motion vector of the current block obtained by the motion vector prediction technology.
[0057] BV refers to the displacement vector used in the IBC prediction mode, and its value is the coordinate offset between the current block and the reference block, where both the current block and the reference block are in the current image. In the IBC mode, block vector prediction can be introduced. By predicting the block vector of the current block, the predicted block vector corresponding to the current block is obtained, and the difference between the predicted block vector corresponding to the current block and the actual block vector is encoded and transmitted. Compared with directly encoding and transmitting the actual block vector corresponding to the current block, it is beneficial to save bit overhead. In an embodiment of the present application, the predicted block vector refers to the predicted value of the block vector of the current block obtained by the block vector prediction technology.
[0058] SV refers to the displacement vector used in the ISC prediction mode, and its value is the coordinate offset between the current string and the reference string, where both the current string and the reference string are in the current image. In the ISC mode, string vector prediction can be introduced. By predicting the string vector of the current string, a predicted string vector corresponding to the current string is obtained, and the difference between the predicted string vector corresponding to the current string and the actual string vector is encoded and transmitted. Compared with directly encoding and transmitting the actual string vector corresponding to the current string, it is beneficial to save bit overhead. In the embodiment of the present application, the predicted string vector refers to the predicted value of the string vector of the current string obtained by the string vector prediction technology.
[0059] Several different prediction modes are introduced below:
[0060] 1. Inter-frame prediction mode
[0061] like Figure 2 As shown in the figure, inter-frame prediction uses the correlation in the video time domain and uses the pixels of the adjacent encoded images to predict the pixels of the current image, so as to effectively remove the redundancy in the video time domain and effectively save the bits of the encoded residual data. Where P is the current frame, Pr is the reference frame, B is the current block to be encoded, and Br is the reference block of B. B' and B have the same coordinate position in the image, Br coordinates are (xr, yr), and B' coordinates are (x, y). The displacement between the current block to be encoded and its reference block is called the motion vector (MV), that is:
[0062] MV=(xr-x,yr-y).
[0063] Considering that adjacent blocks in the temporal or spatial domain have a strong correlation, MV prediction technology can be used to further reduce the bits required for encoding MV. In H.265 / HEVC, inter-frame prediction includes two MV prediction technologies: Merge and AMVP (Advanced Motion Vector Prediction).
[0064] The Merge mode will establish an MV candidate list for the current PU (Prediction Unit), which contains 5 candidate MVs (and their corresponding reference images). It will traverse these 5 candidate MVs and select the one with the lowest rate-distortion cost as the optimal MV. If the codec establishes the candidate list in the same way, the encoder only needs to transmit the index of the optimal MV in the candidate list. It should be noted that HEVC's MV prediction technology also has a skip mode, which is a special case of the Merge mode. After the Merge mode finds the optimal MV, if the current block is basically the same as the reference block, then there is no need to transmit the residual data, only the MV index and a skip flag.
[0065] The MV candidate list established in Merge mode includes two cases: spatial domain and temporal domain. For B Slice (B frame image), it also includes a combined list. Among them, the spatial domain provides up to 4 candidate MVs, and its establishment is as follows: Figure 3 The spatial list is established in the order of A1→B1→B0→A0→B2, where B2 is a substitute, that is, when one or more of A1, B1, B0, A0 does not exist, the motion information of B2 needs to be used; the temporal domain only provides one candidate MV at most, and its establishment is as follows Figure 3 As shown in part (b) of , the MV of the same-position PU is scaled as follows:
[0066] curMV=td*colMV / tb;
[0067] Among them, curMV represents the MV of the current PU, colMV represents the MV of the co-located PU, td represents the distance between the current image and the reference image, and tb represents the distance between the co-located image and the reference image. If the PU at position D0 on the co-located block is not available, it is replaced by the co-located PU at position D1. For the PU in B Slice, since there are two MVs, its MV candidate list also needs to provide two MVPs (Motion Vector Predictor). HEVC generates a combination list for B Slice by combining the first 4 candidate MVs in the MV candidate list in pairs.
[0068] Similarly, the AMVP mode uses the MV correlation of neighboring blocks in the spatial and temporal domains to establish a MV candidate list for the current PU. Unlike the Merge mode, the AMVP mode selects the optimal predicted MV from the MV candidate list, and performs differential encoding with the optimal MV obtained through motion search for the current block to be encoded, that is, encoding MVD = MV-MVP, where MVD is the motion vector residual (Motion Vector Difference); by establishing the same list, the decoding end only needs the sequence number of MVD and MVP in the list to calculate the MV of the current decoding block. The MV candidate list of the AMVP mode also includes both spatial and temporal scenarios. The difference is that the length of the MV candidate list of the AMVP mode is only 2.
[0069] As mentioned above, in the AMVP mode of HEVC, MVD (Motion Vector Difference) needs to be encoded. In HEVC, the resolution of MVD is controlled by the use_integer_mv_flag in the slice_header. When the value of the flag is 0, MVD is encoded at 1 / 4 (brightness) pixel resolution; when the value of the flag is 1, MVD is encoded at an integer (brightness) pixel resolution. An adaptive motion vector precision (Adaptive Motion Vector Resolution, referred to as AMVR) method is used in VVC. This method allows each CU to adaptively select the resolution of the encoded MV. In the normal AMVP mode, the optional resolutions include 1 / 4, 1 / 2, 1 and 4 pixel resolutions. For a CU with at least one non-zero MVD component, a flag is first encoded to indicate whether the quarter brightness sampling MVD precision is used for the CU. If the flag is 0, the MVD of the current CU is encoded at 1 / 4 pixel resolution. Otherwise, a second flag needs to be encoded to indicate that the CU uses a 1 / 2 pixel resolution or other MVD resolution. Otherwise, a third flag is encoded to indicate whether 1-pixel resolution or 4-pixel resolution is used for the CU.
[0070] 2. IBC Prediction Model
[0071] IBC is an intra-frame coding tool adopted in the HEVC Screen Content Coding (Screen Content Coding, referred to as SCC) extension, which significantly improves the coding efficiency of screen content. In AVS3 and VVC, IBC technology is also adopted to improve the performance of screen content coding. IBC uses the spatial correlation of screen content video and uses the coded image pixels on the current image to predict the pixels of the current block to be coded, which can effectively save the bits required for coding pixels. Figure 4 As shown, the displacement between the current block and its reference block in IBC is called BV (block vector). H.266 / VVC uses a BV prediction technique similar to inter-frame prediction to further save the bits required to encode BV, and allows encoding BVD (Block Vector Difference) with 1 or 4 pixel resolution.
[0072] 3. ISC Forecast Model
[0073] ISC technology divides a coding block into a series of pixel strings or unmatched pixels according to a certain scanning order (such as raster scanning, round-trip scanning and Zig-Zag scanning, etc.). Similar to IBC, each string searches for a reference string of the same shape in the encoded area of the current image, derives the predicted value of the current string, and effectively saves bits by encoding the residual between the current string pixel value and the predicted value instead of directly encoding the pixel value. Figure 5 The schematic diagram of intra-frame string replication is given. The dark gray area is the encoded area, the 28 white pixels are string 1, the 35 light gray pixels are string 2, and the 1 black pixel represents the unmatched pixel. The displacement between string 1 and its reference string is Figure 4 The string vector 1 in the equation; the displacement between string 2 and its reference string is Figure 4 The string vector 2 in .
[0074] The intra-frame string replication technology needs to encode the SV corresponding to each string in the current coding block, the string length, and the flag of whether there is a matching string. Among them, SV represents the displacement of the string to be encoded to its reference string. The string length represents the number of pixels contained in the string. In different implementations, there are many ways to encode the string length. The following are several examples (some examples may be used in combination): 1) Encode the length of the string directly in the code stream; 2) Encode the number of pixels to be processed in the code stream, and the decoding end calculates the length of the current string according to the size N of the current block, the number of processed pixels N1, and the number of pixels to be processed obtained by decoding N2, L = N-N1-N2; 3) Encode a flag in the code stream to indicate whether the string is the last string. If it is the last string, the length of the current string L = N-N1 is calculated according to the size N of the current block and the number of processed pixels N1. If a pixel does not find a corresponding reference in the referenceable area, the pixel value of the unmatched pixel will be directly encoded.
[0075] At the 73rd meeting of the AVS Working Group in June 2020, string prediction technology was adopted into the standard. The following is the decoding process of string prediction in the current scheme (underlined and bold fields represent syntax elements that need to be decoded, and ununderlined fields with capitalized first letters represent variables, and the values of variables can be obtained by decoding syntax elements. The following process omits some details not related to this application):
[0076]
[0077] Related semantic description:
[0078] 1. Match type flag of string copy intra prediction isc_match_type_flag[i]
[0079] Binary variable. A value of '1' indicates that the i-th part of the current coding unit is a string; a value of '0' indicates that the i-th part of the current coding unit is an unmatched pixel. IscMatchTypeFlag[i] is equal to the value of isc_match_type_flag[i]. If isc_match_type_flag[i] does not exist in the bitstream, the value of IscMatchTypeFlag[i] is 0.
[0080] 2. The last flag of the string copy intra prediction isc_last_flag[i]
[0081] Binary variable. A value of '1' indicates that the i-th part of the current coding unit is the last part of the current coding unit, and the length of this part StrLen[i] is equal to NumTotalPixel-NumCodedPixel; a value of '0' indicates that the i-th part of the current coding unit is not the last part of the current coding unit, and the length of this part StrLen[i] is equal to NumTotalPixel-NumCodedPixel-NumRemainingPixelMinus1[i]-1. IscLastFlag[i] is equal to the value of isc_last_flag[i].
[0082] 3. Next remaining pixel number next_remaining_pixel_in_cu[i]
[0083] The value of next_remaining_pixel_in_cu[i] represents the number of pixels remaining in the current coding unit that have not yet been decoded after the decoding of the i-th part of the current coding unit is completed. The value of NextRemainingPixelInCu[i] is equal to the value of next_remaining_pixel_in_cu[i].
[0084] 4. Copy the Y component value of the unmatched pixel in the intra-frame prediction isc_unmatched_pixel_y[i]
[0085] String copy intra prediction unmatched pixel U component value isc_unmatched_pixel_u[i]
[0086] String copy intra prediction unmatched pixel V component value isc_unmatched_pixel_v[i]
[0087] 10-bit unsigned integer. The value of the Y, Cb, or Cr component of the unmatched pixel in the i-th part of the current coding unit. IscUnmatchedPixelY[i], IscUnmatchedPixelU[i], and IscUnmatchedPixelV[i] are equal to the values of isc_unmatched_pixel_y[i], isc_unmatched_pixel_u[i], and isc_unmatched_pixel_v[i], respectively.
[0088] In order for the decoder to know the string length of the current string, the encoder needs to encode the string length information of the current string (including information related to the string length, such as the syntax element next_remaining_pixel_in_cu introduced above). During the encoding process, the encoder will binarize the string length information of the current string to obtain the corresponding binary symbol string, and then add the binary symbol string to the bit stream and send it to the decoder. Accordingly, when the decoder decodes the string length of the current string, it obtains the above-mentioned binary symbol string from the bit stream, and then debinarizes the binary symbol string to obtain the string length information of the current string, and further determines the string length of the current string based on this.
[0089] Next, the debinarization method of string length information in the AVS3 standard is introduced.
[0090] 1. Debinarization method using truncated unary code
[0091] The value of synElVal (ie, the value restored after debinarization) is obtained from the binary symbol string according to Table 1.
[0092] Table 1 Relationship between synElVal and binary symbol string (truncated unary code)
[0093]
[0094] 2. Debinarization method using unary code
[0095] The value of synElVal (ie, the value restored after debinarization) is obtained from the binary symbol string according to Table 2.
[0096] Table 2 Relationship between the value of synElVal and the binary symbol string (unary code)
[0097]
[0098] 3. Debinarization method of next_remaining_pixel_in_cu
[0099] If NumTotalPixel–NumCodedPixel is equal to 1, next_remaining_pixel_in_cu does not exist in the bitstream, and the value of NextRemainingPixelInCu is 0; otherwise (that is, NumPixelInCu–NumCodedPixel is greater than 1), the debinarization method of next_remaining_pixel_in_cu is as follows:
[0100] The binary symbol string of next_remaining_pixel_in_cu consists of three parts.
[0101] The first step is to perform the first part of the debinarization. First, calculate maxValPrefix according to the following method:
[0102] if((NumTotalPixel–NumCodedPixel)<=5)maxValPrefix=1
[0103] else if((NumTotalPixel–NumCodedPixel)<=21)maxValPrefix=2
[0104] else if((NumTotalPixel–NumCodedPixel)<=277)maxValPrefix=3
[0105] else maxValPrefix=4
[0106] Here, maxValPrefix refers to the index of the numerical interval to which the maximum value of the parameter (next_remaining_pixel_in_cu in this example) that needs to be restored through debinarization processing belongs.
[0107] The value of synElVal is obtained by looking up Table 1 from the first part and maxVal=maxValPrefix and a is set equal to the value of synElVal.
[0108] If a is equal to 0, the second and third parts do not exist in the code stream, and the value of next_remaining_pixel_in_cu is 0 (then the string length of the current string is NumTotalPixel-NumCodedPixel); otherwise (ie, a is greater than 0), proceed to the next step.
[0109] The second step is to perform the debinarization of the second part. First, maxValInfix is calculated according to the following method:
[0110]
[0111] Next, calculate n=Ceil(Log(maxValInfix+1)). Then, look up Table 3 based on the second part and len=n-1 to get the value b of synElVal. When len<1, the binary symbol string is empty (that is, it does not actually exist in the bit stream, so there is no need to actually parse the bit stream).
[0112] Table 3 Relationship between synElVal and binary symbol string (fixed-length code with length len)
[0113]
[0114] The third step is to debinarize the third part. If b is less than 2 n -maxValInfix-1 or maxValInfix is equal to 0, the value of k is set to 0, otherwise, the value of k is set to 1. Then, the value c of synElVal is obtained by looking up Table 3 based on the third part and len=k.
[0115] Finally, from the values of d, b, c, k, n, and maxValInfix, the value of next_remaining_pixel_in_cu is calculated according to the following method:
[0116] next_remaining_pixel_in_cu=d+(b< <k)+c-(2 n -maxValInfix-1)×k.
[0117] For the encoding end, the binarization process of next_remaining_pixel_in_cu is mainly as follows:
[0118] 1. Determine a series of value intervals (such as intervals 1, 2, ..., N) based on the remaining maximum number of pixels max_remaining_pixel_in_cu, and record the index of the interval where the value of next_remaining_pixel_in_cu is located. When next_remaining_pixel_in_cu is equal to 0, set the index to 0. Record the index value as the first part of the string length;
[0119] 2. Subtract the starting value of the group from max_remaining_pixel_in_cu and record it as maxValInfix. Calculate n=Ceil(Log(maxValInfix+1)). Subtract the starting value of the group from next_remaining_pixel_in_cu and record it as valInfix. Then, according to n and 2 n-maxValInfix-1 value, valInfix is divided into the second and third parts for encoding (the specific steps are omitted here).
[0120] In the current intra-frame string replication scheme, the resolution of the string length is 1 pixel, allowing the coding unit to be divided into substrings of any integer pixel length (that is, the allowed coding string length can be 1, 2, 3, ...). Under this scheme, the coding unit may be divided into finer-grained pixel strings, and the position of the pixel string may not be aligned with the memory, resulting in frequent memory access when reconstructing the pixel string, affecting the coding efficiency. For example, assuming that the memory unit can process the data corresponding to 4 pixels in parallel at the same time, if the string length of the current string is 7, there may be a situation where the data corresponding to the pixels in the current string are allocated to two or three memory units. In this case, the decoding end needs to access the memory unit 2 or 3 times to complete the decoding of the current string.
[0121] In order to improve the neatness of pixel strings and the decoding efficiency of pixel strings, the present application proposes a video decoding method and a video encoding method. By using the string length resolution as the basis for the division and encoding and decoding of pixel strings, the length of the pixel string in the encoding and decoding block can be limited to a multiple of the string length resolution, thereby improving the neatness of the pixel string, enabling the encoding and decoding end to perform encoding and decoding under the condition of memory alignment, thereby improving the encoding and decoding efficiency of the pixel string. For example, assuming that the memory unit can process the data corresponding to 4 pixels in parallel at the same time, and the string length resolution is set to 4 accordingly, then the length of the pixel string can only be an integer multiple of 4, and there will be no misalignment with the memory unit. Assuming that the string length of the current string is 8, the data of the pixels in the current string will only exist in two memory units, and they are all full. It is impossible to be allocated to three memory units, which requires the decoding end to access the memory unit more than once.
[0122] On this basis, the present application takes into account the influence of string length resolution on the encoding and decoding of string length information, and proposes a method for binarizing and debinarizing string length information according to string length resolution, which improves the encoding and decoding method of string length information under different string length resolutions. Specifically, when the encoding end performs binarization on the value of string length information, the string length resolution can be used to compress the value first, and then the compressed value (that is, the quotient obtained by dividing the value by the string length resolution) is binarized instead of directly binarizing the value. Accordingly, when the decoding end performs debinarization, the compressed value is obtained by debinarization recovery, and then the value of the string length information is obtained based on the compressed value and the string length resolution (that is, multiplying the compressed value by the string length resolution). In this way, the number of characters required for binary representation can be reduced, thereby reducing the complexity of encoding and decoding, which is conducive to the improvement of encoding and decoding performance.
[0123] like Figure 6 As shown, it shows a simplified block diagram of a communication system provided by an embodiment of the present application. The communication system 600 includes multiple devices, and the devices can communicate with each other through, for example, a network 650. For example, the communication system 600 includes a first device 610 and a second device 620 interconnected through the network 650. Figure 6 In an embodiment, the first device 610 and the second device 620 perform unidirectional data transmission. For example, the first device 610 may encode video data, such as a video picture stream collected by the first device 610, for transmission to the second device 620 via the network 650. The encoded video data is transmitted in the form of one or more encoded video code streams. The second device 620 may receive the encoded video data from the network 650, decode the encoded video data to recover the video data, and display the video picture based on the recovered video data. Unidirectional data transmission is more common in applications such as media services.
[0124] In another embodiment, the communication system 600 includes a third device 630 and a fourth device 640 that perform bidirectional transmission of encoded video data, which may occur, for example, during a video conference. For bidirectional data transmission, each of the third device 630 and the fourth device 640 may encode video data (e.g., a video picture stream collected by the device) for transmission to the other of the third device 630 and the fourth device 640 via the network 650. Each of the third device 630 and the fourth device 640 may also receive encoded video data transmitted by the other of the third device 630 and the fourth device 640, and may decode the encoded video data to recover the video data, and may display the video picture on an accessible display device based on the recovered video data.
[0125] exist Figure 6 In the embodiment of, the first device 610, the second device 620, the third device 630 and the fourth device 640 may be computer devices such as servers, personal computers and smart phones, but the principles disclosed in the present application may not be limited thereto. The embodiments of the present application are applicable to PCs (Personal Computers), mobile phones, tablet computers, media players and / or dedicated video conferencing devices. The network 650 represents any number of networks that transmit encoded video data between the first device 610, the second device 620, the third device 630 and the fourth device 640, including, for example, wired and / or wireless communication networks. The communication network 650 may exchange data in circuit switching and / or packet switching channels. The network may include a telecommunications network, a local area network, a wide area network and / or the Internet. For the purposes of the present application, unless explained below, the architecture and topology of the network 650 may be irrelevant to the operations disclosed in the present application.
[0126] As an example, Figure 7 The video encoder and the video decoder are shown in a streaming environment. The subject matter disclosed in the present application is equally applicable to other video-supported applications, including, for example, video conferencing, digital TV, storing compressed video on digital media including CD (Compact Disc), DVD (Digital Versatile Disc), memory stick, etc.
[0127] The streaming system may include an acquisition subsystem 713, which may include a video source 701 such as a digital camera, which creates an uncompressed video picture stream 702. In an embodiment, the video picture stream 702 includes samples taken by a digital camera. The video picture stream 702 is depicted as a thick line to emphasize the high data volume of the video picture stream compared to the encoded video data 704 (or the encoded video code stream), and the video picture stream 702 can be processed by an electronic device 720, which includes a video encoder 703 coupled to the video source 701. The video encoder 703 may include hardware, software, or a combination of hardware and software to implement or implement various aspects of the disclosed subject matter as described in more detail below. Compared to the video picture stream 702, the encoded video data 704 (or the encoded video code stream 704) is depicted as a thin line to emphasize the lower data volume of the encoded video data 704 (or the encoded video code stream 704), which can be stored on the streaming server 705 for future use. One or more streaming client subsystems, such as Figure 7 , client subsystem 706 and client subsystem 708 in the streaming server 705 can access the streaming server 705 to retrieve the copies 707 and 709 of the encoded video data 704. The client subsystem 706 may include, for example, a video decoder 710 in an electronic device 730. The video decoder 710 decodes the incoming copy 707 of the encoded video data and produces an output video picture stream 711 that can be presented on a display 712 (e.g., a display screen) or another presentation device (not depicted). In some streaming systems, the encoded video data 704, video data 707, and video data 709 (e.g., video bitstreams) may be encoded according to certain video encoding / compression standards.
[0128] It should be noted that the electronic device 720 and the electronic device 730 may include other components (not shown). For example, the electronic device 720 may include a video decoder (not shown), and the electronic device 730 may further include a video encoder (not shown). The video decoder is used to decode the received encoded video data; the video encoder is used to encode the video data.
[0129] It should be noted that the technical solution provided in the embodiments of the present application can be applied to the H.266 / VVC standard, the H.265 / HEVC standard, AVS (such as AVS3) or the next-generation video coding and decoding standard, and the embodiments of the present application are not limited to this.
[0130] Another point that needs to be explained is that the execution subject of each step of the video decoding method provided in the embodiment of the present application can be a decoding end device. The execution subject of each step of the video encoding method provided in the embodiment of the present application can be an encoding end device. In the video decoding process under the ISC mode, the decoding scheme provided in the embodiment of the present application can be adopted to decode and obtain the string length of the current string. In the video encoding process under the ISC mode, the encoding scheme provided in the embodiment of the present application can be adopted to encode the string length of the current string. Both the decoding end device and the encoding end device can be computer devices, which refer to electronic devices with data calculation, processing and storage capabilities, such as PCs, mobile phones, tablet computers, media players, dedicated video conferencing equipment, servers, etc.
[0131] In addition, the method provided in the present application can be used alone or in combination with other methods in any order. The encoder and decoder based on the method provided in the present application can be implemented by one or more processors or one or more integrated circuits. Below, the technical solution of the present application is introduced and explained through several embodiments.
[0132] Please refer to Figure 8 , which shows a flow chart of a video decoding method provided by an embodiment of the present application. The method can be applied to a decoding end device. The method can include the following steps (801-803):
[0133] Step 801, decoding from the code stream to obtain a binary symbol string of string length information of the current string.
[0134] A bitstream is a data stream generated after a video is encoded, which can be represented by a series of binary data 0 and 1. In some standards, a bitstream is also called a bitstream, which is a binary data stream formed by an encoded image.
[0135] The current string refers to the pixel string currently being decoded. A pixel string refers to a pixel sequence consisting of a certain number of pixels. Optionally, a pixel string is an ordered sequence of data consisting of a finite number of binary bits. In the ISC mode, a CU can be divided into several pixel strings. For video decoding, in order to restore the pixel value of each pixel in the pixel string, it is necessary to first determine the string length of each pixel string.
[0136] The string length information refers to information related to the string length of the pixel string in the code stream, which is used to determine the string length of the pixel string. Optionally, the string length information of the current string includes information related to the string length of the current string, which is used to determine the string length of the current string.
[0137] The binary symbol string of the string length information refers to a binary string obtained after binarization of the string length information, and the characters that may appear in the binary symbol string are only 0 and 1.
[0138] Step 802, debinarize the binary symbol string according to the string length resolution of the current string to obtain string length information.
[0139] In an embodiment of the present application, when performing the debinarization process, the influence of the string length resolution on the encoding and decoding of the string length information is taken into account. The string length resolution (String Length Resolution, referred to as SLR) is the minimum string length for dividing the CU into pixel strings, that is, the minimum value allowed by the string length. For example, the string length resolution is 4, indicating that the minimum string length of the pixel string is 4. Optionally, the string length resolution can be represented by N, where N is a positive integer. Optionally, N is an integer greater than 1. When the string length resolution is N, the string length of the pixel string is an integer multiple of N, for example, the string length of the pixel string can be N, 2N, 3N, 4N, 5N, etc., and so on. For example, when the string length resolution is 4, the string length of the pixel string can be 4, 8, 12, 16, 20, etc.
[0140] Optionally, step 802 may include the following two sub-steps:
[0141] 1. Debinarize the binary symbol string to obtain the string length information after compression based on the string length resolution;
[0142] 2. Determine the string length information based on the compressed string length information and the string length resolution.
[0143] For example, when the encoding end performs binarization processing on the value of the string length information, the value may be first compressed using the string length resolution, and then the compressed value (i.e., the quotient obtained by dividing the value by the string length resolution) may be binarized, rather than directly binarizing the value. Accordingly, when the decoding end performs debinarization processing, the compressed value is restored by debinarization, and then the value of the string length information is obtained based on the compressed value and the string length resolution (i.e., the compressed value is multiplied by the string length resolution).
[0144] In addition, in the embodiments of the present application, a variety of methods are provided for debinarizing a binary symbol string to obtain string length information compressed based on string length resolution. For details, please refer to the description in the embodiments below.
[0145] Step 803: determine the string length of the current string according to the string length information.
[0146] The string length of the current string refers to the number of pixels included in the current string.
[0147] In an example, the string length information of the current string includes the string length of the current string.
[0148] In another example, the string length information of the current string includes the number of remaining pixels in the decoding block to which the current string belongs after decoding the current string. Then, the decoding end can obtain the total number of pixels in the decoding block to which the current string belongs, and obtain the number of decoded pixels in the decoding block to which the current string belongs, and then determine the string length of the current string based on the total number of pixels, the number of decoded pixels, and the number of remaining pixels after decoding the current string. Assuming that the total number of pixels is recorded as M, the number of decoded pixels is recorded as M2, and the number of remaining pixels after decoding the current string is recorded as M1, the string length L of the current string = M-M1-M2.
[0149] To sum up, the technical solution provided in the embodiment of the present application, by using the string length resolution as the basis for dividing and encoding and decoding the pixel string, can limit the length of the pixel string in the encoding and decoding block to a multiple of the string length resolution, thereby improving the uniformity of the pixel string, enabling the codec end to perform encoding and decoding under the condition of memory alignment, thereby improving the encoding and decoding efficiency of the pixel string.
[0150] In addition, the present application takes into account the influence of string length resolution on the encoding and decoding of string length information, and proposes a method for binarizing and debinarizing string length information according to string length resolution, which improves the encoding and decoding method of string length information under different string length resolutions. Specifically, when the encoding end performs binarization on the value of string length information, the string length resolution can be used to compress the value first, and then the compressed value (that is, the quotient obtained by dividing the value by the string length resolution) is binarized instead of directly binarizing the value. Accordingly, when the decoding end performs debinarization, the compressed value is obtained by debinarization recovery, and then the value of the string length information is obtained based on the compressed value and the string length resolution (that is, multiplying the compressed value by the string length resolution). In this way, the number of characters required for binary representation can be reduced, thereby reducing the complexity of encoding and decoding, which is conducive to the improvement of encoding and decoding performance.
[0151] Next, the manner in which the decoding end determines the string length resolution of the current string during the decoding process is described. In the embodiment of the present application, the following manners for determining the string length resolution of the current string are provided as examples.
[0152] Method 1: Determine the first preset value as the string length resolution of the current string. The first preset value refers to a preset string length resolution value, for example, the first preset value can be predefined in the protocol. When decoding the current string, the decoding end determines the first preset value as the string length resolution of the current string, without obtaining the string length resolution of the current string from the bit stream.
[0153] Method 2: Decode the string length resolution of the current string from the sequence header of the image sequence to which the current string belongs. In some standards, the above-mentioned image sequence is also called a video sequence, which is the highest-level syntax structure of the coded bitstream and includes one or more consecutive coded images. Optionally, the image sequence starts with the first sequence header, and the sequence end code or video editing code indicates the end of an image sequence. The sequence header between the first sequence header of the image sequence and the first sequence end code or video editing code is a repeated sequence header. Optionally, each sequence header is followed by one or more coded images, and each image should be preceded by an image header. Optionally, the coded images are arranged in the bitstream in a bitstream order, and the bitstream order should be the same as the decoding order. The decoding order may be different from the display order. The sequence header of the above-mentioned image sequence contains some information related to decoding the image sequence. For example, the sequence header of the image sequence can be a special reserved field that defines the bit length and is attached to the front of the data sequence corresponding to the above-mentioned image sequence in the codestream. In this example, the sequence header of the image sequence also includes the string length resolution. Optionally, the string length resolutions of the strings contained in the image sequence to which the current string belongs are the same, and are all string length resolutions decoded from the sequence header of the image sequence. In one example, the decoding end decodes an indication information (such as an index, a syntax element, or other indication information) in the sequence header of the image system, and the indication information indicates the string length resolutions of all strings in the image sequence.
[0154] Method 3: Decode the string length resolution of the current string from the image header of the image to which the current string belongs. The above image refers to a single image frame in the video. In some standards, an image can be a frame or a field. Optionally, the above image is a coded image, and the above coded image is a coded representation of an image. The image header of the above image contains some information related to decoding the image. For example, the image header of the image is a special reserved field that defines the bit length and is attached to the front of the data sequence corresponding to the above image in the code stream. In this example, the image header of the image also includes the string length resolution. Optionally, the string length resolutions of the various strings contained in the image to which the current string belongs are the same, and are all the string length resolutions decoded from the image header of the image. In one example, the decoding end decodes an indication information (such as an index, a syntax element, or other indication information) in the image header of the image, and the indication information indicates the string length resolutions of all strings in the image.
[0155] Mode 4: Decode the string length resolution of the current string from the header of the slice to which the current string belongs. The above-mentioned patch refers to a number of adjacent maximum coding units arranged in a raster scan order. The above-mentioned raster scan refers to mapping a two-dimensional rectangular raster to a one-dimensional raster, where the entrance of the one-dimensional raster starts from the first row of the two-dimensional raster, and then scans the second row, the third row, and so on. The rows in the raster are scanned from left to right. The header of the above-mentioned slice contains some information related to decoding the image. For example, the header of the slice is a special reserved field that defines the bit length and is attached to the front of the data sequence corresponding to the above-mentioned slice in the code stream. In this example, the header of the slice also includes the string length resolution. Optionally, the string length resolutions of each string contained in the slice to which the current string belongs are the same, and are all the string length resolutions decoded from the header of the slice. In one example, the decoding end decodes an indication information (such as an index, a syntax element, or other indication information) in the header of the slice, which indicates the string length resolution of all strings in the slice.
[0156] Method 5: Decode the string length resolution of the current string from the encoding information of the maximum coding unit LCU to which the current string belongs. In some standards, the LCU includes an L*L luminance sample block and a corresponding chrominance sample block, which are obtained by image division. The encoding information of the above LCU contains some information related to decoding the LCU. For example, the encoding information of the above LCU is a special reserved field that defines the bit length and is attached to the front of the data sequence corresponding to the above LCU in the bitstream. An LCU may include multiple CUs. In this example, the encoding information of the above LCU also includes the string length resolution. Optionally, the string length resolutions of each string contained in the LCU to which the current string belongs are the same, and are all string length resolutions decoded from the encoding information of the LCU. In one example, the decoding end decodes an indication information (such as an index, a syntax element, or other indication information) in the encoding information of the LCU, which indicates the string length resolution of all strings in the LCU.
[0157] Method six: Decode the string length resolution of the current string from the encoding information of the coding unit CU to which the current string belongs. The encoding information of the above CU contains some information related to decoding the CU. For example, the encoding information of the above CU is a special reserved field that defines the bit length and is attached to the front of the data sequence corresponding to the above CU in the bitstream. In this example, the encoding information of the above CU also includes the string length resolution. Optionally, the string length resolutions of each string contained in the CU to which the current string belongs are the same, and are all string length resolutions decoded from the encoding information of the CU. In one example, the decoding end decodes an indication information (such as an index, syntax element or other indication information) in the encoding information of the CU, which indicates the string length resolution of all strings in the CU.
[0158] Method seven: Decode the string length resolution of the current string from the encoding information of the current string. The encoding information of the current string contains some information related to decoding the current string. For example, the encoding information of the current string is a special reserved field that defines the bit length and is attached to the front of the data sequence corresponding to the current string in the code stream. In this example, the encoding information of the current string also includes the string length resolution of the current string. In one example, the decoding end decodes an indication information (such as an index, syntax element or other indication information) in the encoding information of the current string, and the indication information indicates the string length resolution of the current string. In this way, the string length resolutions of different strings can be indicated separately in their respective encoding information, which is more flexible.
[0159] Method eight: Determine the string length resolution of the current string according to the size of the decoding block to which the current string belongs. In some standards, the above-mentioned decoding block (block) is an M*N (M columns and N rows) sample value matrix or transform coefficient matrix. Optionally, the decoding block to which the current string belongs may be the CU to which the current string belongs. Optionally, obtain the size of the decoding block to which the current string belongs, wherein the size of the decoding block to which the current string belongs includes the height or width of the decoding block to which the current string belongs. In one example, for a block of size 4x4, the string length resolution N=1; for a block of size 16x16, the string length resolution N=2; for a block with an area (width x height) greater than 128, the string length resolution N=2.
[0160] Method nine: Determine the string length resolution of the current string based on the color component and chroma format corresponding to the current string. The above chroma format refers to the color encoding format used by the pixel. In some standards, the chroma format (chroma_format) is a 2-bit unsigned integer that specifies the format of the chroma component. The above color component refers to the chroma component of the pixel under the chroma format. Optionally, the pixels in the current video are in RGB format or YUV format. In one example, in a video in YUV 4:2:0 format, if the string length resolution N=4 of the luminance component has been determined, then the string length resolution N=2 of the chroma component.
[0161] Method 10: If the number of decoded strings in the CU to which the current string belongs is greater than or equal to the first threshold, the second preset value is determined as the string length resolution of the current string. The above-mentioned first threshold is a preset value, which is the basis for determining the string length resolution of the current string in this method. Optionally, the above-mentioned first threshold can be determined according to the specifications of the CU, and the first thresholds corresponding to CUs of different specifications can be the same or different. The above-mentioned second preset value refers to the value of the preset string length resolution, which is applicable to the case where the number of decoded strings in the CU to which the current string belongs is greater than or equal to the first threshold. The second preset value can be pre-specified in the protocol. In an example, assuming that the number of decoded strings in the current CU is N1, if N1 is greater than or equal to the first threshold, the string length resolution of the current string can be determined to be the second preset value 4. In addition, if the number of decoded strings in the CU to which the current string belongs is less than the first threshold, the string length resolution of the current string can be determined by other methods introduced in the embodiments of the present application, or another preset value different from the second preset value can be determined as the string length resolution of the current string, which is not limited in the embodiments of the present application.
[0162] Method 11: If the number of decoded unmatched pixels in the CU to which the current string belongs is greater than or equal to the second threshold, the third preset value is determined as the string length resolution of the current string. The above-mentioned unmatched pixels refer to pixels that have not been successfully matched, that is, pixels that do not match the pixels at the corresponding position in the reference string of the current string. The above-mentioned second threshold is a preset value, which is the basis for judging the string length resolution of the current string in this method. Optionally, the above-mentioned second threshold can be determined according to the number of decoded unmatched pixels in the CU to which the current string belongs, and the second thresholds corresponding to different numbers of CUs in different CUs can be the same or different. The above-mentioned third preset value refers to the value of the preset string length resolution, which is applicable to the case where the number of decoded unmatched pixels in the CU to which the current string belongs is greater than or equal to the second threshold. The third preset value can be pre-specified in the protocol. In an example, assuming that the number of decoded unmatched pixels in the current CU is N2, if N2 is greater than or equal to the second threshold, it can be judged that the string length resolution of the current string is the third preset value. In addition, if the number of decoded unmatched pixels in the CU to which the current string belongs is less than the second threshold, the string length resolution of the current string can be determined by other methods introduced in the embodiments of the present application, or another preset value different from the third preset value can be determined as the string length resolution of the current string, and the embodiments of the present application are not limited to this.
[0163] Method 12: If the number of undecoded pixels in the CU to which the current string belongs is less than or equal to the third threshold, the fourth preset value is determined as the string length resolution of the current string. The third threshold is a preset value, which is the basis for judging the string length resolution of the current string in this method. Optionally, the third threshold can be determined according to the number of decoded unmatched pixels in the CU to which the current string belongs, and the third thresholds corresponding to different numbers of CUs in different CUs can be the same or different. The fourth preset value refers to a preset value of the string length resolution, which is applicable to the case where the number of undecoded pixels in the CU to which the current string belongs is less than or equal to the third threshold. The fourth preset value can be pre-specified in the protocol. In addition, if the number of undecoded pixels in the CU to which the current string belongs is greater than the third threshold, the string length resolution of the current string can be determined by other methods described in the embodiments of the present application, or another preset value different from the fourth preset value can be determined as the string length resolution of the current string, which is not limited in the embodiments of the present application.
[0164] The following describes a method of performing debinarization processing on the binary symbol string of the string length information of the current string to obtain the string length information compressed based on the string length resolution. In the embodiments of the present application, the following debinarization processing methods are provided as examples.
[0165] Method 1, setting the maximum value of the compressed string length information to max_val, can include the following steps:
[0166] 1. Determine the maximum value of the compressed string length information, and determine multiple value intervals based on the maximum value;
[0167] The above multiple numerical intervals are a series of intervals whose values are integers. Optionally, the above multiple numerical intervals can be recorded as R0, R1, R2, ..., Rn. Among them, the index of the x-th numerical interval Rx is x, and the x-th numerical interval Rx is expressed as [Rx_start, Rx_end), where x is a positive integer. The value of the maximum value max_val satisfies Rn_start≤max_val<Rn_end.
[0168] 2. Decode the compressed string length information from the bitstream to obtain index x;
[0169] In the embodiment of the present application, it is assumed that the index of the compressed string length information obtained by decoding from the code stream is recorded as x, and the index indicates the numerical interval where the value val to be restored is located.
[0170] Optionally, the index of the compressed string length information is obtained by decoding the code stream in a truncated unary code manner.
[0171] 3. According to the numerical interval Rx corresponding to the index x, determine the value of the first part of the compressed string length information as Rx_start;
[0172] In the embodiment of the present application, the first part of the string length information is recorded as val_part1.
[0173] Optionally, if there is only one integer value in the numerical interval Rx, that is, the value of Rx_end-Rx_start is equal to 1, then val=val_part1, and the debinarization process ends.
[0174] Optionally, the index is entropy decoded using CABAC, and each binary bit of the index has a corresponding context model.
[0175] Optionally, a context model of the index of the compressed string length information (ie, val) is determined according to the maximum value of the compressed string length information (ie, the value of max_val), and the context model is used to perform entropy decoding on the index using CABAC. For example, a set of context models is selected according to the numerical interval of max_val.
[0176] 4. According to the maximum value and the value of the first part, calculate the maximum value margin and the number of digits of the maximum value margin;
[0177] Among them, the maximum margin max_val_infix = max_val-Rx_start and the number of bits of the maximum margin n = Ceil(Log(max_val_infix+1)); wherein Ceil() means rounding up, and Log() means taking the logarithm. The number of bits of the maximum margin n refers to the number of bits required to encode the maximum margin in a fixed-length code.
[0178] 5. Determine the first bit length based on the number of bits of the maximum value margin;
[0179] The first bit length len=n-1.
[0180] 6. If the first bit length is less than 1, determine that the value of the second part of the compressed string length information is 0;
[0181] In the embodiment of the present application, the second part of the string length information is recorded as val_part2.
[0182] If the first bit length len<1, val_part2=0 is determined.
[0183] 7. If the first bit length is greater than or equal to 1, decode the data of the first bit length from the code stream, perform debinarization processing on the data of the first bit length in a fixed-length code manner, and obtain the value of the second part of the compressed string length information;
[0184] If the first bit length len ≥ 1, len bits are decoded from the code stream, and the len bits are debinarized according to the fixed-length code to obtain the value of val_part2.
[0185] 8. If the value of the second part satisfies the first condition or the maximum value margin is equal to 0, the target value is set to 0; otherwise, the target value is set to 1;
[0186] Optionally, if val_part2 < 2 n -max_val_infix-1 or max_val_infix=0, the value of the target value k is set to 0; otherwise, the value of k is set to 1.
[0187] 9. If the target value k=0, the value of the third part of the compressed string length information is determined to be 0;
[0188] In the embodiment of the present application, the third part of the string length information is recorded as val_part3.
[0189] 10. If the target value k=1, the second bit length is determined to be 1, data of the second bit length is decoded from the code stream, and the data of the second bit length is debinarized in a fixed-length code manner to obtain the value of the third part of the compressed string length information;
[0190] Assume that the second bit length len=1, decode len bits from the code stream, perform debinarization on the len bits in a fixed-length code manner, and obtain the value of val_part3.
[0191] 11. Calculate the value of the compressed string length information based on the value of the first part, the value of the second part, the value of the third part, the target value, the number of bits of the maximum value margin and the maximum value margin.
[0192] That is, the value of the compressed string length information is calculated based on val_part1, val_part2, val_part3, k, n, and max_val_infix.
[0193] Optionally, the value of the compressed string length information val=val_part1+(val_part2< <k)+val_part3-(2 n -max_val_infix-1)×k; where << is the left shift sign.
[0194] Method 2, setting the maximum value of the compressed string length information to max_val, can include the following steps:
[0195] 1. Determine the maximum value of the compressed string length information and the number of digits of the maximum value;
[0196] The maximum value max_val of the compressed string length information, the number of bits of the maximum value max_val n=Ceil(Log(max_val+1)).
[0197] 2. Determine the third bit length based on the number of bits of the maximum value;
[0198] The third bit length len=n-1.
[0199] 3. If the third bit length is less than 1, determine that the value of the first part of the compressed string length information is 0;
[0200] In the embodiment of the present application, the first part of the string length information is recorded as val_part1.
[0201] If len<1, val_part1=0 is determined.
[0202] 4. If the third bit length is greater than or equal to 1, decode the data of the third bit length from the code stream, perform debinarization processing on the data of the third bit length in a fixed-length code manner, and obtain the value of the first part of the compressed string length information;
[0203] If len ≥ 1, decode len bits from the code stream, debinarize the len bits according to the fixed-length code method, and obtain the value of val_part1.
[0204] 5. Calculate the maximum value margin based on the maximum value and the value of the first part;
[0205] Among them, the maximum margin max_val_infix=max_val-val_part1.
[0206] 6. If the value of the first part satisfies the second condition or the maximum value margin is equal to 0, the target value is set to 0; otherwise, the target value is set to 1;
[0207] If val_part1<2 n -max_val_infix-1 or max_val_infix=0, the value of the target value k is set to 0; otherwise, the value of k is set to 1.
[0208] 7. If the target value k=0, the value of the second part of the compressed string length information is determined to be 0;
[0209] In the embodiment of the present application, the second part of the string length information is recorded as val_part2.
[0210] If k=0, val_part2=0 is determined.
[0211] 8. If the target value k=1, the fourth bit length is determined to be 1, data of the fourth bit length is decoded from the code stream, and the data of the fourth bit length is debinarized according to the fixed-length code to obtain the value of the second part of the compressed string length information;
[0212] Assume that the fourth bit length len=1, decode len bits from the bit stream, perform debinarization on the len bits according to the fixed-length code method, and obtain the value of val_part2;
[0213] 9. Calculate the value of the compressed string length information based on the value of the first part, the value of the second part, the target value, the number of bits of the maximum value, and the maximum value.
[0214] That is, the value of the compressed string length information is calculated according to val_part1, val_part2, k, n and max_val.
[0215] Optionally, the value of the compressed string length information val=(val_part1< <k)+val_part2-(2 n -max_val-1)×k; where << is the left shift sign.
[0216] Method three, debinarize the binary symbol string according to the k-order exponential Golomb code method to obtain the compressed string length information.
[0217] The main encoding format of the K-order exponential Golomb code is the structure of [prefix 0] [1] [bit information]. The entire encoding is completed by calculating the length of the prefix 0 (that is, how many zeros there are in the prefix), the number of 1s, and the bit information. The encoding steps are as follows:
[0218] (1) Express the data to be encoded in binary form, remove the lowest k bits, and then add 1 to get the new value T1. Check how many bits T1 contains, subtract 1 from the value, and the result is the number of prefix 0s;
[0219] (2) After adding the lowest K bits removed in step (1) to T1, we will temporarily call it T2;
[0220] (3) Add a prefix of 0 before T2. The encoding is now complete.
[0221] In addition, the debinarization method of the K-order exponential Golomb code is as follows:
[0222] When parsing the k-order exponential Golomb code, first start from the current position of the bit stream to find the first non-zero bit, and record the number of zero bits found as leadingZeroBits, and then calculate CodeNum based on leadingZeroBits. Pseudocode is described as follows:
[0223] leadingZeroBits = -1;
[0224] for(b=0;!b;leadingZeroBits++)
[0225] b = read_bits(1)
[0226] CodeNum=2 leadingZeroBits+k –2 k +read_bits(leadingZeroBits+k)
[0227] Table 4 gives the structure of 0th, 1st, 2nd and 3rd order exponential Golomb codes. The bit string of the exponential Golomb code is divided into two parts: "prefix" and "suffix". The prefix consists of leadingZeroBits consecutive '0's and a '1'. The suffix consists of leadingZeroBits+k bits, that is, the xi string in the table, and the value of xi is '0' or '1'.
[0228] Table 4k-order exponential Columbus code table
[0229]
[0230]
[0231] Method 4: Debinarize the binary symbol string in a unary code or truncated unary code manner to obtain compressed string length information.
[0232] The encoding rule of the unary code is that for the symbol "x">=0 to be encoded, the encoding is composed of x "1"s and one "0". If the encoding end performs binary processing on the compressed string length information according to the unary code, after determining the value val (val=synElVal) of the compressed string length information, the above table 2 can be queried to obtain the corresponding binary symbol string; accordingly, after the decoding end decodes and obtains the above binary symbol string, the above table 2 can be queried to restore the value val of the compressed string length information.
[0233] Truncated unary code is a variant of unary code, and is used when the maximum value Max of the syntax element to be encoded is known. Here, the maximum value Max is the maximum value max_val of the compressed string length information. Assume that the symbol to be encoded is x: if 0≤x<Max, x is binarized using unary code; if x=Max, the binary string of x binarization consists entirely of 1s, and the length is Max. If the encoder performs binarization processing on the compressed string length information according to the truncated unary code, then after determining the value val (val=synElVal) of the compressed string length information, the above Table 1 can be queried to obtain the corresponding binary symbol string; accordingly, after the decoder decodes and obtains the above binary symbol string, the above Table 1 can be queried to restore the value val of the compressed string length information.
[0234] Method 5: Debinarize the binary symbol string in accordance with the n-bit fixed-length code to obtain the compressed string length information; wherein n is the number of bits of the maximum value of the compressed string length information, and n is a positive integer. For example, n=Ceil(Log(max_val+1)), and max_val represents the maximum value of the compressed string length information.
[0235] If the encoding end performs binarization processing on the compressed string length information in the form of an n-bit fixed-length code, after determining the value val (val=synElVal) of the compressed string length information, the above table 3 can be queried to obtain the corresponding binary symbol string; accordingly, after the decoding end decodes and obtains the above binary symbol string, the above table 3 can be queried to restore the value val of the compressed string length information. Where len is equal to n.
[0236] Method 6: The value of the compressed string length information is determined based on multiple parts. Let the value of the compressed string length information be val, where val is composed of n parts, i.e., val = val_part_1 + val_part_2 + val_part_3 + ... + val_part_n, max_val_n = max_val - val_part_1 + val_part_2 + val_part_3 + ... + val_part_n - 1), where max_val is the maximum value of val. The debinarization method may include the following steps:
[0237] 1. Determine the maximum value of the compressed string length information, and determine multiple value intervals based on the maximum value;
[0238] The above multiple numerical intervals are a series of intervals whose values are integers. Optionally, the above multiple numerical intervals can be recorded as R0, R1, R2, ..., Rn. Among them, the index of the x-th numerical interval Rx is x, and the x-th numerical interval Rx is expressed as [Rx_start, Rx_end), where x is a positive integer. The value of max_val satisfies Rn_start≤max_val<Rn_end.
[0239] 2. Decode the compressed string length information from the bitstream to obtain index x;
[0240] In the embodiment of the present application, it is assumed that the index of the compressed string length information obtained by decoding from the code stream is recorded as x, and the index indicates the numerical interval where the value val to be restored is located.
[0241] For example, the decoding end may decode the compressed string length information from the bit stream in any one of the above-mentioned methods 1 to 5 through the debinarization method to obtain the index.
[0242] 3. According to the numerical interval Rx corresponding to the index x, determine the value of the first part of the compressed string length information as Rx_start;
[0243] 4. Determine the values of the remaining parts of the compressed string length information in sequence;
[0244] For example, the decoding end may determine the values of val_part_2, val_part_3, ..., val_part_n according to any one of the above-mentioned debinarization methods 1 to 5.
[0245] 5. Determine the value of the compressed string length information based on the value of the first part and the value of the remaining parts.
[0246] The value of the compressed string length information val=val_part_1+val_part_2+val_part_3+…+val_part_n.
[0247] In an exemplary embodiment, the decoding end may select a suitable method from a plurality of debinarization processing methods according to actual conditions. The plurality of debinarization processing methods may include the plurality of methods introduced above.
[0248] For example, the decoding end selects a method for debinarizing the binary symbol string from a plurality of debinarization processing methods according to the string length resolution of the current string.
[0249] For another example, the decoding end selects a method for performing debinarization processing on the binary symbol string from a plurality of debinarization processing methods according to the maximum value of the string length information.
[0250] For another example, the decoding end selects a method for debinarizing the binary symbol string from a plurality of debinarization processing methods according to the quotient of the maximum number of remaining pixels of the decoding block to which the current string belongs and the string length resolution of the current string.
[0251] For another example, according to the size of the decoding block to which the current string belongs, a method for performing debinarization processing on the binary symbol string is selected from a plurality of debinarization processing methods.
[0252] The embodiments of the present application provide a variety of binarization / debinarization processing methods. Depending on the size of the value to be binarized, the encoding and decoding complexity and the length of the binary string using different methods will be different accordingly. Through the above method, directly or indirectly based on the string length resolution, a suitable binarization / debinarization processing method can be selected, and the binarization / debinarization processing method with the best encoding and decoding performance can be flexibly selected.
[0253] The following describes several different ways of determining string length information and corresponding ways of determining string length through several examples.
[0254] In one example, the compressed string length information includes the string length code of the current string, denoted as L0. Accordingly, the string length information includes the string length of the current string. The decoding end multiplies the string length code of the current string by the string length resolution to obtain the string length of the current string. In one example, the decoding end decodes the binary symbol string of the string length code L0 of the current string from the code stream, and the decoding end performs a debinarization process on the binary symbol string to restore the string length code L0 of the current string, and then multiplies the string length code L0 of the current string by the string length resolution N to obtain the string length L of the current string, that is, L=L0*N. Among them, the string length code can also be referred to as the string length after resolution compression, that is, the quotient obtained by dividing the true value of the string length by the string length resolution N. In the encoding process, the number of characters required to represent the string length code in a binary form is less than the number of characters required to represent the true value of the string length in a binary form, so it can reduce the complexity of encoding and decoding and improve the encoding and decoding performance.
[0255] In this example, the compressed string length information includes the string length code L0 of the current string. The decoding end can use the inverse binarization processing method introduced in the following embodiment to decode and obtain a numerical value (denoted as val), and the value of L0 is equal to val.
[0256] In addition, in this example, the maximum value of the value val is max_val, the number of remaining undecoded pixels of the decoding block to which the current string belongs is max_val_tmp, and the string length resolution of the current string is N; wherein, max_val_tmp = NumTotalPixel-NumCodedPixel. NumTotalPixel represents the total number of pixels of the decoding block to which the current string belongs, and NumCodedPixel represents the number of decoded pixels of the decoding block to which the current string belongs. Since the current string may be the last string in the current decoding block (or may not be), the value range of the string length L of the current string is [N, max_val_tmp]. After the string length L of the current string is compressed by the string length resolution N (that is, L / N), the value range of the string length code L0 of the current string is [1, max_val_tmp / N]. Therefore, if the compressed string length information includes the string length code L0 of the current string, max_val should be set to an integer value greater than or equal to max_val_tmp / N. In one example, max_val = max_val_tmp / N, which helps to improve the encoding and decoding efficiency.
[0257] In an embodiment of the present application, the number of remaining undecoded pixels is compressed based on the string length resolution and then binarized and encoded into the bitstream. Compared with directly binarizing the true value of the number of remaining undecoded pixels and encoding it into the bitstream, the number of characters can be reduced, thereby reducing the encoding and decoding complexity and improving the encoding and decoding performance.
[0258] In another example, the compressed string length information includes the string length code of the current string minus 1, recorded as L0-1. Accordingly, the string length information includes the string length of the current string. The decoding end subtracts 1 from the string length code of the current string and adds 1 to obtain the string length code L0 of the current string, and then multiplies the string length code L0 of the current string by the string length resolution N to obtain the string length L of the current string, that is, L=L0*N.
[0259] In this example, the compressed string length information includes the string length code of the current string minus 1 (ie, L0-1). The decoding end can use the inverse binarization processing method described in the following embodiment to decode and obtain a numerical value (denoted as val), and the value of L0 is equal to val+1.
[0260] As introduced in the previous example, the minimum value of L0 is 1, so the compressed string length information can also include L0-1, and the value range of L0-1 is [0, max_val_tmp / N-1]. Therefore, if the compressed string length information includes L0-1, max_val should be set to an integer value greater than or equal to max_val_tmp / N-1. In an example, max_val = max_val_tmp / N-1, which helps improve the encoding and decoding efficiency.
[0261] In another example, the compressed string length information includes the encoding of the number of remaining pixels in the decoding block to which the current string belongs after decoding the current string. Accordingly, the string length information includes the number of remaining pixels in the decoding block to which the current string belongs after decoding the current string. The number of remaining pixels in the decoding block to which the current string belongs after decoding the current string refers to the number of undecoded pixels remaining in the decoding block to which the current string belongs after decoding the current string. The encoding of the number of remaining pixels can also be called the number of remaining pixels after resolution compression, that is, the quotient obtained by dividing the true value of the number of remaining pixels by the string length resolution N. The decoding end multiplies the encoding of the number of remaining pixels by the string length resolution to obtain the number of remaining pixels in the decoding block to which the current string belongs after decoding the current string. During the encoding process, the number of characters required to binary represent the encoding of the number of remaining pixels is less than the number of characters required to binary represent the true value of the number of remaining pixels, thereby reducing the complexity of encoding and decoding and improving the encoding and decoding performance.
[0262] Optionally, the above-mentioned remaining pixel number code is stored in the sequence header of the data sequence in the code stream. The above-mentioned data sequence can be the data sequence corresponding to the image to which the current string belongs in the code stream, or the data sequence corresponding to the current string in the code stream, or the data sequence corresponding to the CU to which the current string belongs in the code stream, etc., and the embodiments of the present application do not limit this. In an example, the string length resolution of each string in the decoding block to which the current string belongs is 4. After decoding the current string, the decoding end assumes that the number of undecoded pixels remaining in the decoding block to which the current string belongs is 4, that is, the binary number 100, and its corresponding encoding representation (that is, the remaining pixel number code) is 1. Optionally, the above-mentioned remaining pixel number code is recorded as M0.
[0263] Optionally, the above step 803 may include the following sub-steps (8031-8033):
[0264] Step 8031, obtain the total number of pixels of the decoding block to which the current string belongs.
[0265] Optionally, the total number of pixels of the decoding block is obtained by multiplying the height and width of the decoding block. Optionally, the total number of pixels of the decoding block to which the current string belongs is recorded as M.
[0266] Step 8032, obtaining the number of decoded pixels of the decoding block to which the current string belongs.
[0267] Optionally, the number of decoded pixels can be obtained by accumulating the lengths of decoded pixel strings at the decoding end. Optionally, the number of decoded pixels of the decoding block to which the current string belongs is recorded as M2.
[0268] Step 8033, determine the string length of the current string based on the total number of pixels, the number of decoded pixels, and the number of remaining pixels after decoding the current string.
[0269] Optionally, the decoding end multiplies the remaining pixel number code M0 by the string length resolution N to obtain the remaining pixel number M1 after decoding the current string in the decoding block to which the current string belongs, that is, M1=M0*N.
[0270] Optionally, the number of decoded pixels and the number of remaining pixels are subtracted from the total number of pixels to obtain the string length L of the current string, that is, L=M-M1-M2.
[0271] In this example, the compressed string length information includes the number of remaining pixels encoded M0 after decoding the current string in the decoding block to which the current string belongs. The decoding end can use the inverse binarization processing method introduced in the following embodiment to decode and obtain a numerical value (denoted as val), and the value of M0 is equal to val.
[0272] In addition, in this example, let the maximum value of the value val be max_val, the number of remaining undecoded pixels of the decoding block to which the current string belongs be max_val_tmp, and the string length resolution of the current string be N; wherein, max_val_tmp = NumTotalPixel-NumCodedPixel. NumTotalPixel represents the total number of pixels of the decoding block to which the current string belongs, and NumCodedPixel represents the number of decoded pixels of the decoding block to which the current string belongs. Since the current string may be the last string in the current decoding block (or may not be), the string length L of the current string has a value range of [N, max_val_tmp], so the value range of the number of remaining pixels M1 after decoding the current string is [0, max_val_tmp-N]. After the number of remaining pixels M1 after decoding the current string is compressed by the string length resolution N (that is, M1 / N), the value range of the code M0 of the number of remaining pixels after decoding the current string is [0, max_val_tmp / N-1]. Therefore, if the compressed string length information includes the remaining pixel number code M0 after decoding the current string, max_val should be set to an integer value greater than or equal to max_val_tmp / N-1. In one example, max_val=max_val_tmp / N-1, which helps to improve encoding and decoding efficiency.
[0273] In an embodiment of the present application, the number of remaining pixels after decoding the current string is compressed based on the string length resolution and then binarized and encoded into the bitstream. Compared with directly binarizing the true value of the number of remaining pixels and encoding it into the bitstream, the number of characters can be reduced, thereby reducing the complexity of encoding and decoding and improving the encoding and decoding performance.
[0274] In another example, the compressed string length information includes a first flag, where the first flag is used to indicate whether the current string is the last string in the decoding block to which the current string belongs.
[0275] Optionally, the first flag is a binary variable, represented by a binary digit. Optionally, if the first flag is 0, the current string is the last string in the decoding block to which the current string belongs; if the first flag is 1, the current string is not the last string in the decoding block to which the current string belongs.
[0276] Optionally, if it is determined according to the first flag that the current string is not the last string, the number of pixels remaining in the decoding block to which the current string belongs after decoding the current string is obtained; wherein the string length information also includes the number of pixels remaining in the decoding block to which the current string belongs after decoding the current string; or the string length information also includes the number of pixels remaining in the decoding block to which the current string belongs after decoding the current string minus 1. Afterwards, the number of pixels remaining is multiplied by the string length resolution to obtain the number of pixels remaining in the decoding block to which the current string belongs after decoding the current string.
[0277] Optionally, the above step 803 may include the following sub-steps (803a-803d):
[0278] Step 803a, obtaining the total number of pixels of the decoding block to which the current string belongs.
[0279] Step 803b, obtaining the number of decoded pixels of the decoding block to which the current string belongs.
[0280] Step 803c: if the current string is the last string, subtract the total number of pixels from the number of decoded pixels to obtain the string length of the current string.
[0281] Optionally, the total number of pixels M is subtracted from the number of decoded pixels M2 to obtain the string length L of the current string, ie, L=M-M2.
[0282] Step 803d, if the current string is not the last string, determine the string length of the current string based on the total number of pixels, the number of decoded pixels, and the number of remaining pixels after decoding the current string.
[0283] Optionally, the code after the code of the remaining number of pixels minus 1 is recorded as M0. Optionally, the code after the code of the remaining number of pixels minus 1 is added by 1 and multiplied by the string length resolution to obtain the number of pixels M1 remaining after decoding the current string in the decoding block to which the current string belongs, that is, M1 = (M0 + 1) * N. Optionally, the number of decoded pixels and the number of remaining pixels are subtracted from the total number of pixels to obtain the string length L of the current string, that is, L = M-M1-M2.
[0284] In this example, taking the compressed string length information including the number of remaining pixels after decoding the current string in the decoding block to which the current string belongs as M0-1 as an example, the decoding end can use the inverse binarization processing method introduced in the following embodiment to decode and obtain a numerical value (denoted as val), and the value of M0 is equal to val+1.
[0285] In addition, in this example, the first flag is used to indicate whether the current string is / is not the last string in the current decoding block. If the current string is not the last string, the code stream will contain relevant information about the number of remaining pixels after decoding the current string. Therefore, when the current string is not the last string, the value range of the string length L of the current string is [N, max_val_tmp-N], and the value range of the number of remaining pixels M1 after decoding the current string is [N, max_val_tmp-N]. After the number of remaining pixels M1 after decoding the current string is compressed by the string length resolution N (that is, M1 / N), the value range of the remaining pixel number code M0 after decoding the current string is [1, max_val_tmp / N-1]. The minimum value of M0 is 1, so the compressed string length information can also include M0-1, and the value range of M0-1 is [0, max_val_tmp / N-2]. Therefore, if the compressed string length information includes M0-1, max_val should be set to an integer value greater than or equal to max_val_tmp / N-2. In an example, max_val=max_val_tmp / N-2, which helps to improve encoding and decoding efficiency.
[0286] In an embodiment of the present application, the number of remaining pixels after decoding the current string is compressed based on the string length resolution and then binarized and encoded into the bitstream. Compared with directly binarizing the true value of the number of remaining pixels and encoding it into the bitstream, the number of characters can be reduced, thereby reducing the complexity of encoding and decoding and improving the encoding and decoding performance.
[0287] Please refer to Fig. 9 , which shows a flow chart of a video encoding method provided by an embodiment of the present application. The method can be applied to an encoding end device. The method can include the following steps (901-903):
[0288] Step 901, determine the string length of the current string.
[0289] Step 902: Determine the string length information of the current string based on the string length of the current string, where the string length information includes information related to the string length of the current string.
[0290] In one example, the string length information includes the string length of the current string.
[0291] In another example, the string length information includes the number of remaining pixels in the coding block to which the current string belongs after encoding the current string.
[0292] The encoding end obtains the total number of pixels in the coding block to which the current string belongs, and obtains the number of encoded pixels in the coding block to which the current string belongs; based on the total number of pixels, the number of encoded pixels and the string length of the current string, determines the number of remaining pixels in the coding block to which the current string belongs after encoding the current string.
[0293] Step 903, binarize the string length information according to the string length resolution of the current string to obtain a binary symbol string of the string length information.
[0294] Optionally, the compressed string length information is determined based on the string length information and the string length resolution; the compressed string length information is binarized to obtain a binary symbol string of the string length information.
[0295] The binarization process may be performed in a manner corresponding to the debinarization process described above, which will not be described in detail in this embodiment.
[0296] Optionally, if the string length information includes the string length of the current string, the encoding end may divide the string length of the current string by the string length resolution to obtain the string length code of the current string. Accordingly, the compressed string length information may include the string length code of the current string, or may include the string length code of the current string minus 1.
[0297] Optionally, if the string length information includes the number of remaining pixels in the coding block to which the current string belongs after encoding the current string, the encoding end may divide the number of remaining pixels by the string length resolution to obtain the code for the number of remaining pixels. Accordingly, the compressed string length information may include the code for the number of remaining pixels in the coding block to which the current string belongs after encoding the current string, or may include the code for the number of remaining pixels in the coding block to which the current string belongs after encoding the current string minus 1.
[0298] In the example embodiment, the encoding end may select a suitable binarization processing method:
[0299] For example, the encoding end selects a method for binarizing the string length information from a plurality of binarization processing methods according to the string length resolution of the current string.
[0300] For another example, the encoding end selects a method for binarizing the string length information from a plurality of binarization processing methods according to the maximum value of the string length information.
[0301] For another example, the encoding end selects a method for binarizing the string length information from a plurality of binarization processing methods according to the quotient of the maximum number of remaining pixels of the coding block to which the current string belongs and the string length resolution of the current string.
[0302] For another example, the encoding end selects a method for binarizing the string length information from a plurality of binarization processing methods according to the size of the coding block to which the current string belongs.
[0303] In an exemplary embodiment, the following several ways of determining the string length resolution of the current string are provided.
[0304] Mode 1: The string length resolution of the current string is a first preset value;
[0305] Method 2: The string length resolutions of the strings contained in the image sequence to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the sequence header of the image sequence to which the current string belongs;
[0306] Method 3: The string length resolutions of the strings contained in the image to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the image header of the image to which the current string belongs;
[0307] Mode 4: The string length resolutions of the strings contained in the slice to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the slice header of the slice to which the current string belongs;
[0308] Mode 5: The string length resolutions of the strings contained in the LCU to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the encoding information of the LCU to which the current string belongs;
[0309] Mode 6: The string length resolutions of the strings contained in the coding unit CU to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the coding information of the CU to which the current string belongs;
[0310] Method 7: The string length resolution of the current string is encoded and added to the encoding information of the current string;
[0311] Mode 8: The string length resolution of the current string is determined according to the size of the decoding block to which the current string belongs;
[0312] Mode nine: The string length resolution of the current string is determined according to the color component and chroma format corresponding to the current string;
[0313] Mode 10: If the number of decoded strings in the CU to which the current string belongs is greater than or equal to the first threshold, the string length resolution of the current string is the second preset value;
[0314] Mode 11: If the number of decoded unmatched pixels in the CU to which the current string belongs is greater than or equal to the second threshold, the string length resolution of the current string is the third preset value;
[0315] Mode 12: If the number of undecoded pixels in the CU to which the current string belongs is less than or equal to the third threshold, the string length resolution of the current string is the fourth preset value.
[0316] To sum up, the technical solution provided in the embodiment of the present application, by using the string length resolution as the basis for dividing and encoding and decoding the pixel string, can limit the length of the pixel string in the encoding and decoding block to a multiple of the string length resolution, thereby improving the uniformity of the pixel string, enabling the codec end to perform encoding and decoding under the condition of memory alignment, thereby improving the encoding and decoding efficiency of the pixel string.
[0317] In addition, this application takes into account the impact of string length resolution on the encoding and decoding of string length information, and proposes a method for binarization and debinarization of string length information. This method improves the encoding and decoding method of string length information under different string length resolutions, which is conducive to improving the encoding and decoding performance.
[0318] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0319] Please refer to Fig.10 , which shows a block diagram of a video decoding device provided by an embodiment of the present application. The device has the function of implementing the above-mentioned video decoding method example, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be the computer device introduced above, and can also be set on a computer device. The device 1000 may include: a binary symbol acquisition module 1010, a debinarization processing module 1020 and a string length determination module 1030.
[0320] The binary symbol acquisition module 1010 is used to decode a binary symbol string of string length information of a current string from a code stream, where the string length information includes information related to the string length of the current string.
[0321] The debinarization processing module 1020 is used to perform debinarization processing on the binary symbol string according to the string length resolution of the current string to obtain the string length information.
[0322] The string length determination module 1030 is used to determine the string length of the current string according to the string length information.
[0323] In an exemplary embodiment, the debinarization processing module 1020 includes:
[0324] A debinarization processing unit, used for performing debinarization processing on the binary symbol string to obtain string length information compressed based on the string length resolution;
[0325] The length information determining unit is used to determine the string length information according to the compressed string length information and the string length resolution.
[0326] In an exemplary embodiment, the debinarization processing unit is specifically used to:
[0327] Determine a maximum value of the compressed string length information, and determine a plurality of numerical intervals according to the maximum value, wherein the index of the x-th numerical interval Rx is x, and the x-th numerical interval Rx is represented by [Rx_start, Rx_end), where x is a positive integer;
[0328] Decoding the bitstream to obtain the index x of the compressed string length information;
[0329] According to the numerical interval Rx corresponding to the index x, determining the value of the first part of the compressed string length information as Rx_start;
[0330] Calculate a maximum value margin and a number of bits of the maximum value margin according to the maximum value and the value of the first part;
[0331] Determining a first bit length based on the number of bits of the maximum value remainder;
[0332] If the first bit length is less than 1, determining that the value of the second part of the compressed string length information is 0;
[0333] If the first bit length is greater than or equal to 1, decoding the data of the first bit length from the code stream, performing debinarization processing on the data of the first bit length in a fixed-length code manner, and obtaining a value of the second part of the compressed string length information;
[0334] If the value of the second part satisfies the first condition or the maximum value margin is equal to 0, the target value is set to 0; otherwise, the target value is set to 1;
[0335] If the target value is equal to 0, determining that the value of the third part of the compressed string length information is 0;
[0336] If the target value is equal to 1, determining that the second bit length is 1, decoding the data of the second bit length from the code stream, and performing debinarization processing on the data of the second bit length in a fixed-length code manner to obtain the value of the third part of the compressed string length information;
[0337] The value of the compressed string length information is calculated according to the value of the first part, the value of the second part, the value of the third part, the target value, the number of bits of the maximum value margin, and the maximum value margin.
[0338] In an exemplary embodiment, the debinarization processing unit is also used to determine a context model of an index of the compressed string length information according to a maximum value of the compressed string length information, and the context model is used to perform entropy decoding on the index in a CABAC manner.
[0339] In an exemplary embodiment, the debinarization processing unit is specifically used to:
[0340] Determine a maximum value of the compressed string length information and the number of bits of the maximum value;
[0341] determining a third bit length based on the number of bits of the maximum value;
[0342] If the third bit length is less than 1, determining that the value of the first part of the compressed string length information is 0;
[0343] If the third bit length is greater than or equal to 1, decoding the data of the third bit length from the code stream, performing debinarization processing on the data of the third bit length in a fixed-length code manner, and obtaining a value of the first part of the compressed string length information;
[0344] Calculate a maximum value margin according to the maximum value and the value of the first part;
[0345] If the value of the first part satisfies the second condition or the maximum value margin is equal to 0, the target value is set to 0; otherwise, the target value is set to 1;
[0346] If the target value is equal to 0, determining that the value of the second part of the compressed string length information is 0;
[0347] If the target value is equal to 1, determining that the fourth bit length is 1, decoding the data of the fourth bit length from the code stream, and performing debinarization processing on the data of the fourth bit length in a fixed-length code manner to obtain the value of the second part of the compressed string length information;
[0348] The value of the compressed string length information is calculated according to the value of the first part, the value of the second part, the target value, the number of bits of the maximum value, and the maximum value.
[0349] In an exemplary embodiment, the debinarization processing unit is specifically used to perform debinarization processing on the binary symbol string in a k-order exponential Golomb coding manner to obtain the compressed string length information.
[0350] In an exemplary embodiment, the debinarization processing unit is specifically used to perform debinarization processing on the binary symbol string in a unary code or a truncated unary code manner to obtain the compressed string length information.
[0351] In an exemplary embodiment, the debinarization processing unit is specifically used to debinarize the binary symbol string in accordance with an n-bit fixed-length code to obtain the compressed string length information; wherein n is the maximum number of bits of the compressed string length information, and n is a positive integer.
[0352] In an exemplary embodiment, the value of the compressed string length information is determined based on multiple parts; the debinarization processing unit is specifically used to:
[0353] Determine a maximum value of the compressed string length information, and determine a plurality of numerical intervals according to the maximum value, wherein the index of the x-th numerical interval Rx is x, and the x-th numerical interval Rx is represented by [Rx_start, Rx_end), where x is a positive integer;
[0354] Decoding the bitstream to obtain the index x of the compressed string length information;
[0355] According to the numerical interval Rx corresponding to the index x, determining the value of the first part of the compressed string length information as Rx_start;
[0356] sequentially determining values of the remaining parts of the compressed string length information;
[0357] The value of the compressed string length information is determined according to the value of the first part and the value of the remaining part.
[0358] In an exemplary embodiment, the compressed string length information includes a string length code of the current string;
[0359] The length information determination unit is specifically configured to multiply the string length code of the current string by the string length resolution to obtain the string length of the current string.
[0360] In an exemplary embodiment, the compressed string length information includes the string length code of the current string minus 1;
[0361] The length information determination unit is specifically used to subtract 1 from the string length code of the current string and add 1 to obtain the string length code of the current string; and multiply the string length code of the current string by the string length resolution to obtain the string length of the current string.
[0362] In an exemplary embodiment, the compressed string length information includes a code of the number of remaining pixels in the decoding block to which the current string belongs after decoding the current string;
[0363] The length information determination unit is used to multiply the remaining pixel number code by the string length resolution to obtain the remaining pixel number in the decoding block to which the current string belongs after decoding the current string.
[0364] Accordingly, the string length determination module 1030 is used to obtain the total number of pixels of the decoding block to which the current string belongs; obtain the number of decoded pixels of the decoding block to which the current string belongs; and determine the string length of the current string based on the total number of pixels, the number of decoded pixels and the number of remaining pixels after decoding the current string.
[0365] In an exemplary embodiment, the compressed string length information includes a first flag, and the first flag is used to indicate whether the current string is the last string in the decoding block to which the current string belongs;
[0366] The length information determination unit is used to obtain the code of the number of remaining pixels after decoding the current string in the decoding block to which the current string belongs, if it is determined according to the first flag that the current string is not the last string; wherein the string length information also includes the code of the number of remaining pixels after decoding the current string in the decoding block to which the current string belongs; or, the string length information also includes the code of the number of remaining pixels after decoding the current string in the decoding block to which the current string belongs minus 1; multiply the code of the number of remaining pixels by the string length resolution to obtain the number of remaining pixels in the decoding block to which the current string belongs after decoding the current string.
[0367] Accordingly, the string length determination module 1030 is used to obtain the total number of pixels of the decoding block to which the current string belongs; obtain the number of decoded pixels of the decoding block to which the current string belongs; if the current string is the last string, subtract the total number of pixels from the number of decoded pixels to obtain the string length of the current string; if the current string is not the last string, determine the string length of the current string based on the total number of pixels, the number of decoded pixels and the number of remaining pixels after decoding the current string.
[0368] In an exemplary embodiment, the apparatus 1000 further includes a resolution determination module, configured to:
[0369] Determine a first preset value as a string length resolution of the current string;
[0370] Alternatively, decoding the sequence header of the image sequence to which the current string belongs to obtain the string length resolution of the current string, wherein the string length resolutions of the strings included in the image sequence to which the current string belongs are the same;
[0371] Alternatively, decoding the image header of the image to which the current string belongs to obtain the string length resolution of the current string, wherein the string length resolutions of the strings contained in the image to which the current string belongs are the same;
[0372] Alternatively, decoding from a slice header of a slice to which the current string belongs to obtain a string length resolution of the current string, wherein the string length resolutions of the strings included in the slice to which the current string belongs are the same;
[0373] Alternatively, decoding the encoding information of the maximum coding unit LCU to which the current string belongs to obtain the string length resolution of the current string, wherein the string length resolutions of the strings included in the LCU to which the current string belongs are the same;
[0374] Alternatively, decoding the encoding information of the coding unit CU to which the current string belongs to obtain the string length resolution of the current string, wherein the string length resolutions of the strings included in the coding unit CU to which the current string belongs are the same;
[0375] Alternatively, the string length resolution of the current string is obtained by decoding from the encoding information of the current string.
[0376] In an exemplary embodiment, the apparatus 1000 further includes a mode selection module, configured to:
[0377] According to the string length resolution of the current string, selecting a method for performing debinarization processing on the binary symbol string from a plurality of debinarization processing methods;
[0378] Alternatively, a method of performing debinarization processing on the binary symbol string is selected from a plurality of debinarization processing methods according to the maximum value of the string length information;
[0379] Alternatively, a method of performing debinarization processing on the binary symbol string is selected from a plurality of debinarization processing methods according to the quotient of the maximum number of remaining pixels of the decoding block to which the current string belongs and the string length resolution of the current string;
[0380] Alternatively, a method for performing debinarization processing on the binary symbol string is selected from a plurality of debinarization processing methods according to the size of the decoding block to which the current string belongs.
[0381] Please refer to Fig.11 , which shows a block diagram of a video encoding device provided by an embodiment of the present application. The device has the function of implementing the above-mentioned video encoding method example, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be the computer device introduced above, and can also be set on a computer device. The device 1100 may include: a string length determination module 1110, a length information determination module 1120 and a binarization processing module 1130.
[0382] The string length determination module 1110 is used to determine the string length of the current string.
[0383] The length information determination module 1120 is used to determine the string length information of the current string based on the string length of the current string, where the string length information includes information related to the string length of the current string.
[0384] The binarization processing module 1130 is used to perform binarization processing on the string length information according to the string length resolution of the current string to obtain a binary symbol string of the string length information.
[0385] In an exemplary embodiment, the binarization processing module 1130 includes:
[0386] A length information determination unit, used to determine the compressed string length information according to the string length information and the string length resolution;
[0387] The binarization processing unit is used to perform binarization processing on the compressed string length information to obtain a binary symbol string of the string length information.
[0388] Optionally, the binarization process may adopt a method corresponding to the debinarization process described above, which will not be described in detail in this embodiment.
[0389] Optionally, if the string length information includes the string length of the current string, the length information determination unit may be used to divide the string length of the current string by the string length resolution to obtain the string length code of the current string. Accordingly, the compressed string length information may include the string length code of the current string, or may include the string length code of the current string minus 1.
[0390] Optionally, if the string length information includes the number of remaining pixels in the coding block to which the current string belongs after encoding the current string, the length information determination unit may be used to divide the number of remaining pixels by the string length resolution to obtain the code for the number of remaining pixels. Accordingly, the compressed string length information may include the code for the number of remaining pixels in the coding block to which the current string belongs after encoding the current string, and may also include the code for the number of remaining pixels in the coding block to which the current string belongs after encoding the current string minus 1.
[0391] In an exemplary embodiment, the string length resolution of the current string is determined in any of the following ways:
[0392] Mode 1: The string length resolution of the current string is a first preset value;
[0393] Method 2: The string length resolutions of the strings contained in the image sequence to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the sequence header of the image sequence to which the current string belongs;
[0394] Method 3: The string length resolutions of the strings contained in the image to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the image header of the image to which the current string belongs;
[0395] Mode 4: The string length resolutions of the strings contained in the slice to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the slice header of the slice to which the current string belongs;
[0396] Mode 5: The string length resolutions of the strings contained in the LCU to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the encoding information of the LCU to which the current string belongs;
[0397] Mode 6: The string length resolutions of the strings contained in the coding unit CU to which the current string belongs are the same, and the string length resolution of the current string is encoded and added to the coding information of the CU to which the current string belongs;
[0398] Method 7: The string length resolution of the current string is encoded and added to the encoding information of the current string;
[0399] Mode 8: The string length resolution of the current string is determined according to the size of the decoding block to which the current string belongs;
[0400] Mode nine: The string length resolution of the current string is determined according to the color component and chroma format corresponding to the current string;
[0401] Mode 10: If the number of decoded strings in the CU to which the current string belongs is greater than or equal to the first threshold, the string length resolution of the current string is the second preset value;
[0402] Mode 11: If the number of decoded unmatched pixels in the CU to which the current string belongs is greater than or equal to the second threshold, the string length resolution of the current string is the third preset value;
[0403] Mode 12: If the number of undecoded pixels in the CU to which the current string belongs is less than or equal to the third threshold, the string length resolution of the current string is the fourth preset value.
[0404] In an exemplary embodiment, the apparatus 1100 further includes a mode selection module, configured to:
[0405] According to the string length resolution of the current string, a method for binarizing the string length information is selected from a plurality of binarization processing methods;
[0406] Alternatively, according to the maximum value of the string length information, a method for binarizing the string length information is selected from a plurality of binarization processing methods;
[0407] Alternatively, a method for binarizing the string length information is selected from a plurality of binarization processing methods according to the quotient of the maximum number of remaining pixels of the coding block to which the current string belongs and the string length resolution of the current string;
[0408] Alternatively, according to the size of the coding block to which the current string belongs, a method for binarizing the string length information is selected from a plurality of binarization processing methods.
[0409] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0410] Please refer to Fig.12 , which shows a block diagram of a computer device provided by an embodiment of the present application. The computer device may be the encoding end device described above, or the decoding end device described above. The computer device 120 may include: a processor 121, a memory 122, a communication interface 123, an encoder / decoder 124, and a bus 125.
[0411] The processor 121 includes one or more processing cores. The processor 121 executes various functional applications and information processing by running software programs and modules.
[0412] The memory 122 may be used to store a computer program, and the processor 121 may be used to execute the computer program to implement the above-mentioned video decoding method or the above-mentioned video encoding method.
[0413] The communication interface 123 may be used to communicate with other devices, such as receiving and transmitting audio and video data.
[0414] The encoder / decoder 124 may be used to implement encoding and decoding functions, such as encoding and decoding audio and video data.
[0415] The memory 122 is connected to the processor 121 via a bus 125 .
[0416] In addition, the memory 122 can be implemented by any type of volatile or non-volatile storage device or a combination thereof. The volatile or non-volatile storage device includes but is not limited to: a magnetic disk or an optical disk, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM (Erasable Programmable Read-Only Memory), a SRAM (Static Random-Access Memory), a ROM (Read-Only Memory), a magnetic storage device, a flash memory, and a PROM (Programmable Read-Only Memory).
[0417] Those skilled in the art will understand that Fig.12 The structure shown in the figure does not constitute a limitation on the computer device 120, and the computer device 120 may include more or less components than shown in the figure, or combine some components, or adopt a different component arrangement.
[0418] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set implements the above-mentioned video decoding method when executed by a processor.
[0419] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned video encoding method.
[0420] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned video decoding method.
[0421] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned video encoding method.
[0422] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0423] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A video decoding method, characterized in that: The method comprises: Decoding the bit stream to obtain the binary symbol string of the string length information of the current string; Debinarize the binary symbol string according to the string length resolution of the current string to obtain the string length information; The string length of the current string is determined according to the string length information.
2. The method according to claim 1, characterized in that The debinarization of the binary symbol string according to the string length resolution of the current string to obtain the string length information includes: Debinarizing the binary symbol string to obtain string length information compressed based on the string length resolution; The string length information is determined according to the compressed string length information and the string length resolution.
3. The method according to claim 2, characterized in that The debinarization of the binary symbol string to obtain string length information compressed based on the string length resolution includes: Determine a maximum value of the compressed string length information, and determine multiple value intervals according to the maximum value; Decoding the bitstream to obtain the index x of the compressed string length information, where x is a positive integer; According to the numerical interval Rx corresponding to the index x, determining that the value of the first part of the compressed string length information is the minimum value in the numerical interval Rx; Calculate a maximum value margin and a number of bits of the maximum value margin according to the maximum value and the value of the first part; Determining a first bit length based on the number of bits of the maximum value remainder; If the first bit length is less than 1, determining that the value of the second part of the compressed string length information is 0; If the first bit length is greater than or equal to 1, decoding the data of the first bit length from the code stream, performing a debinarization process on the data of the first bit length, and obtaining a value of the second part of the compressed string length information; If the value of the second part satisfies the first condition or the maximum value margin is equal to 0, the target value is set to 0; otherwise, the target value is set to 1; If the target value is equal to 0, determining that the value of the third part of the compressed string length information is 0; If the target value is equal to 1, determining that the second bit length is 1, decoding the data of the second bit length from the code stream, and performing a debinarization process on the data of the second bit length to obtain the value of the third part of the compressed string length information; The value of the compressed string length information is calculated based on at least one of the value of the first part, the value of the second part, the value of the third part, the target value, the number of bits of the maximum value margin, and the maximum value margin.
4. The method according to claim 3, characterized in that The method further comprises: According to the maximum value of the compressed string length information, a context model of the index of the compressed string length information is determined, and the context model is used to perform entropy decoding on the index.
5. The method according to claim 2, characterized in that: The debinarization of the binary symbol string to obtain string length information compressed based on the string length resolution includes: Determine the maximum value of the compressed string length information and the number of bits of the maximum value; determining a third bit length based on the number of bits of the maximum value; If the third bit length is less than 1, determining that the value of the first part of the compressed string length information is 0; If the third bit length is greater than or equal to 1, decoding the data of the third bit length from the code stream, performing a debinarization process on the data of the third bit length, and obtaining a value of the first part of the compressed string length information; Calculate a maximum value margin according to the maximum value and the value of the first part; If the value of the first part satisfies the second condition or the maximum value margin is equal to 0, the target value is set to 0; otherwise, the target value is set to 1; If the target value is equal to 0, determining that the value of the second part of the compressed string length information is 0; If the target value is equal to 1, determining that the fourth bit length is 1, decoding the data of the fourth bit length from the code stream, and performing a debinarization process on the data of the fourth bit length to obtain the value of the second part of the compressed string length information; The value of the compressed string length information is calculated based on at least one of the value of the first part, the value of the second part, the target value, the number of bits of the maximum value, and the maximum value.
6. The method according to claim 2, characterized in that The debinarization of the binary symbol string to obtain string length information compressed based on the string length resolution includes: The binary symbol string is debinarized in a k-order exponential Golomb code manner to obtain the compressed string length information.
7. The method according to claim 2, characterized in that The debinarization of the binary symbol string to obtain string length information compressed based on the string length resolution includes: The binary symbol string is debinarized in a unary code or a truncated unary code manner to obtain the compressed string length information.
8. The method according to claim 2, characterized in that: The debinarization of the binary symbol string to obtain string length information compressed based on the string length resolution includes: Debinarize the binary symbol string in an n-bit fixed-length code manner to obtain the compressed string length information; Wherein, n is the maximum number of bits of the compressed string length information, and n is a positive integer.
9. The method according to claim 2, characterized in that: The value of the compressed string length information is determined based on a plurality of parts; The debinarization of the binary symbol string to obtain string length information compressed based on the string length resolution includes: Determine a maximum value of the compressed string length information, and determine multiple value intervals according to the maximum value; Decoding the bitstream to obtain the index x of the compressed string length information, where x is a positive integer; According to the numerical interval Rx corresponding to the index x, determining that the value of the first part of the compressed string length information is the minimum value in the numerical interval Rx; Determining the value of the remaining portion of the compressed string length information; The value of the compressed string length information is determined according to at least one of the value of the first part and the value of the remaining part.
10. The method according to any one of claims 2 to 9, characterized in that: The compressed string length information includes the string length code of the current string; The step of determining the string length information according to the compressed string length information and the string length resolution includes: The string length code of the current string is multiplied by the string length resolution to obtain the string length of the current string.
11. The method according to any one of claims 2 to 9, characterized in that: The compressed string length information includes the string length code of the current string minus 1; The step of determining the string length information according to the compressed string length information and the string length resolution includes: Subtract 1 from the string length code of the current string and add 1 to obtain the string length code of the current string; The string length code of the current string is multiplied by the string length resolution to obtain the string length of the current string.
12. The method according to any one of claims 2 to 9, characterized in that: The compressed string length information includes the number of pixels remaining in the decoding block to which the current string belongs after decoding the current string; The step of determining the string length information according to the compressed string length information and the string length resolution includes: Multiplying the remaining pixel number code by the string length resolution to obtain the remaining pixel number after decoding the current string in the decoding block to which the current string belongs; The determining the string length of the current string according to the string length information includes: Obtain the total number of pixels of the decoding block to which the current string belongs; Obtaining the number of decoded pixels of the decoding block to which the current string belongs; The string length of the current string is determined based on the total number of pixels, the number of decoded pixels, and the number of remaining pixels after decoding the current string.
13. The method according to any one of claims 2 to 9, characterized in that: The compressed string length information includes a first flag, and the first flag is used to indicate whether the current string is the last string in the decoding block to which the current string belongs; The step of determining the string length information according to the compressed string length information and the string length resolution includes: If it is determined according to the first flag that the current string is not the last string, then obtaining the number of pixels remaining after decoding the current string in the decoding block to which the current string belongs; wherein the string length information also includes the number of pixels remaining after decoding the current string in the decoding block to which the current string belongs; or, the string length information also includes the number of pixels remaining after decoding the current string in the decoding block to which the current string belongs minus 1; Multiplying the remaining pixel number code by the string length resolution to obtain the remaining pixel number after decoding the current string in the decoding block to which the current string belongs; The determining the string length of the current string according to the string length information includes: Obtain the total number of pixels of the decoding block to which the current string belongs; Obtaining the number of decoded pixels of the decoding block to which the current string belongs; If the current string is the last string, subtract the total number of pixels from the number of decoded pixels to obtain the string length of the current string; If the current string is not the last string, the string length of the current string is determined based on the total number of pixels, the number of decoded pixels, and the number of remaining pixels after decoding the current string.
14. The method according to any one of claims 1 to 13, characterized in that: The method further comprises: Determine a first preset value as a string length resolution of the current string; Alternatively, decoding the sequence header of the image sequence to which the current string belongs to obtain the string length resolution of the current string, wherein the string length resolutions of the strings included in the image sequence to which the current string belongs are the same; Alternatively, decoding the image header of the image to which the current string belongs to obtain the string length resolution of the current string, wherein the string length resolutions of the strings contained in the image to which the current string belongs are the same; Alternatively, decoding from a slice header of a slice to which the current string belongs to obtain a string length resolution of the current string, wherein the string length resolutions of the strings included in the slice to which the current string belongs are the same; Alternatively, decoding the encoding information of the maximum coding unit LCU to which the current string belongs to obtain the string length resolution of the current string, wherein the string length resolutions of the strings included in the LCU to which the current string belongs are the same; Alternatively, decoding the encoding information of the coding unit CU to which the current string belongs to obtain the string length resolution of the current string, wherein the string length resolutions of the strings included in the coding unit CU to which the current string belongs are the same; Alternatively, the string length resolution of the current string is obtained by decoding from the encoding information of the current string.
15. The method according to any one of claims 1 to 14, characterized in that The method further comprises: According to the string length resolution of the current string, selecting a method for performing debinarization processing on the binary symbol string from a plurality of debinarization processing methods; or, According to the maximum value of the string length information, selecting a method for performing debinarization processing on the binary symbol string from a plurality of debinarization processing methods; or, Selecting a method for performing debinarization processing on the binary symbol string from a plurality of debinarization processing methods according to a quotient of a maximum number of remaining pixels of a decoding block to which the current string belongs and a string length resolution of the current string; or, According to the size of the decoding block to which the current string belongs, a method for performing debinarization processing on the binary symbol string is selected from a plurality of debinarization processing methods.
16. A video encoding method, characterized in that: The method comprises: Determine the string length of the current string; Determining string length information of the current string based on the string length of the current string; The string length information is binarized according to the string length resolution of the current string to obtain a binary symbol string of the string length information.
17. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the video decoding method according to any one of claims 1 to 15, or to implement the video encoding method according to claim 16.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one program, and the at least one program is loaded and executed by the processor to implement the video decoding method according to any one of claims 1 to 15, or to implement the video encoding method according to claim 16.
19. A method for processing a video code stream, characterized in that: The video code stream is decoded based on the video decoding method described in any one of claims 1 to 15, or the video code stream is generated based on the video encoding method described in claim 16.