Video encoding and decoding method, device, computer readable medium and electronic device
By segmenting the coefficients in the coded block of the video image frame in video encoding, the encoding redundancy problem caused by sparse residual data in video encoding is solved, and more efficient video compression performance is achieved.
Patent Information
- Application Number
- CN202110194838.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-21
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-02-21
AI Technical Summary
During the video encoding process, since the numerical distribution of residual data is relatively sparse, unnecessary encoding redundancy is present in the encoding and decoding process, thereby reducing the compression performance of the video.
In the encoding block of the video image frame, the coefficients to be decoded are processed in segmentation according to the scanning order of the SRCC scanning area, and the all-zero flag of the coefficient segment is decoded, and the valid flag of each coefficient in the coefficient segment is determined according to its value, or the valid flag of each coefficient segment is assigned to zero.
Reduces encoding redundancy, improves the encoding efficiency of coefficient encoding, and thus improves video compression performance.
Smart Images

Figure CN114979641B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a video encoding and decoding method, a video encoding and decoding device, a computer-readable medium, and an electronic device. Background Art
[0002] In the video encoding process, the encoder usually needs to transform, quantize and entropy encode the residual data between the original video data and the predicted video data before sending it to the decoder. Since the numerical distribution of the residual data is relatively sparse, when encoding and decoding the residual data, it is necessary to encode and decode the flag indicating whether each coefficient is a zero coefficient, so there will be some unnecessary coding redundancy, resulting in the widespread problem of low coding efficiency, which affects the compression performance of the video. Summary of the invention
[0003] The purpose of the present application is to provide a video encoding and decoding method, a video encoding and decoding device, a computer-readable medium and an electronic device, which can at least to some extent overcome the technical problem of low video encoding and decoding efficiency existing in the related art.
[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0005] According to one aspect of an embodiment of the present application, a video decoding method is provided, the method comprising: in a coding block of a video image frame, segmenting coefficients to be decoded according to a scanning order of an SRCC scanning area to obtain coefficient segments consisting of multiple coefficients; decoding a coefficient segmentation all-zero flag of the coefficient segment to obtain a value of the coefficient segmentation all-zero flag, the coefficient segmentation all-zero flag being used to indicate whether all coefficients in the coefficient segment are zero; if the value of the coefficient segmentation all-zero flag is a preset first value, then decoding the valid flags of each coefficient in the coefficient segment in turn according to a scanning order, the valid flag being used to indicate whether the coefficient is a non-zero coefficient; if the value of the coefficient segmentation all-zero flag is a preset second value, then assigning the valid flags of each coefficient in the coefficient segment to zero.
[0006] According to one aspect of an embodiment of the present application, a video decoding device is provided, the device comprising: a coefficient segmentation module, configured to segment coefficients to be decoded in a coding block of a video image frame according to a scanning order of an SRCC scanning area to obtain coefficient segments consisting of multiple coefficients; a first decoding module, configured to decode a coefficient segmentation all-zero flag of the coefficient segmentation to obtain a value of the coefficient segmentation all-zero flag, the coefficient segmentation all-zero flag being used to indicate whether all coefficients in the coefficient segmentation are zero; a second decoding module, configured to, if the value of the coefficient segmentation all-zero flag is a preset first value, decode the valid flags of each coefficient in the coefficient segment in sequence according to a scanning order, the valid flag being used to indicate whether the coefficient is a non-zero coefficient; a coefficient assignment module, configured to, if the value of the coefficient segmentation all-zero flag is a preset second value, assign the valid flags of each coefficient in the coefficient segment to zero.
[0007] In some embodiments of the present application, based on the above technical solution, the first decoding module includes: a mode determination unit, configured to determine whether the decoding method of the coefficient segmented all-zero flag is bypass decoding or conventional decoding; a bypass decoding unit, configured to decode the coefficient absolute value threshold flag through a bypass decoding engine if it is determined that the decoding method of the coefficient segmented all-zero flag is bypass decoding; a conventional decoding unit, configured to decode the coefficient segmented all-zero flag through a conventional decoding engine based on a context model if it is determined that the decoding method of the coefficient segmented all-zero flag is conventional decoding.
[0008] In some embodiments of the present application, based on the above technical solution, the conventional decoding unit includes: an incremental determination subunit, configured to obtain a model selection method corresponding to the SRCC scanning area, and determine the context index increment according to the model selection method; a model selection subunit, configured to select a context model corresponding to the coefficient segmented all-zero flag according to the context index increment; an arithmetic decoding subunit, configured to perform arithmetically decoding on the coefficient segmented all-zero flag through a conventional decoding engine based on the selected context model.
[0009] In some embodiments of the present application, based on the above technical solution, the incremental determination subunit is also configured as: if the model selection method is the first mode, the context index increment is assigned according to the shape of the SRCC scanning area; if the model selection method is the second mode, the context index increment is assigned according to the area of the SRCC scanning area; if the model selection method is the third mode, the context index increment is assigned according to a preset first numerical value.
[0010] In some embodiments of the present application, based on the above technical solution, the increment determination subunit is also configured to: obtain the area width and area height of the SRCC scanning area; assign an initial value of the context index increment according to the numerical size relationship between the area width and the area height; assign an initial value increment of the context index increment according to the numerical proportional relationship between the area width and the area height; assign the context index increment according to the initial value and the initial value increment.
[0011] In some embodiments of the present application, based on the above technical solution, the increment determination subunit is also configured as: if the area width and the area height are numerically equal, a preset second numerical value is assigned as the initial value of the context index increment; if the area width is smaller than the area height, a preset third numerical value is assigned as the initial value of the context index increment; if the area width is greater than the area height, a preset fourth numerical value is assigned as the initial value of the context index increment.
[0012] In some embodiments of the present application, based on the above technical solution, the increment determination subunit is also configured to: calculate the numerical ratio between the larger value and the smaller value of the area width and the area height; compare the numerical ratio with a plurality of preset ratio thresholds to assign an initial value increment to the context index increment according to the comparison result.
[0013] In some embodiments of the present application, based on the above technical solution, the incremental determination subunit is also configured as: if the area width is numerically equal to the area height, then the context index increment is assigned with the initial value; if the area width is numerically unequal to the area height, then the context index increment is assigned with the sum of the initial value and the initial value increment.
[0014] In some embodiments of the present application, based on the above technical solution, the incremental determination subunit is also configured to: obtain the area width and area height of the SRCC scanning area; determine the area area of the SRCC scanning area according to the area width and the area height; compare the area area with multiple preset area thresholds to assign an incremental value to the context index according to the comparison result.
[0015] In some embodiments of the present application, based on the above technical solution, the video decoding device also includes: a condition determination module, configured to determine whether a preset decoding skip condition is met; a decoding skip module, configured to skip the decoding step of the coefficient segmented all-zero flag if the decoding skip condition is met, and use a preset second numerical value as the value of the coefficient segmented all-zero flag.
[0016] In some embodiments of the present application, based on the above technical solution, the decoding skip condition includes at least one of the following conditions: the number of coefficients in the coefficient segment is less than a preset number threshold; the area ratio of the SRCC scanning area in the coding block is less than a preset ratio threshold.
[0017] In some embodiments of the present application, based on the above technical solution, the coefficient segmentation module includes: a length acquisition unit, configured to obtain the coefficient segment length, and the coefficient segment length is used to represent the maximum number of coefficients contained in the coefficient segment; a coefficient segmentation unit, configured to determine the continuous coefficients to be decoded in sequence according to the scanning order of the SRCC scanning area, and group the coefficients whose number is equal to or less than the coefficient segment length into a coefficient segment.
[0018] In some embodiments of the present application, based on the above technical solution, the coefficient segment length is a constant determined according to the maximum conversion unit size or a dynamic parameter determined according to the attribute information of the coding block.
[0019] In some embodiments of the present application, based on the above technical solution, the attribute information of the coding block includes at least one of the following information: the size of the current conversion unit, the shape of the current conversion unit, the coordinates of the SRCC scanning area, and the number of coefficients in the SRCC scanning area.
[0020] In some embodiments of the present application, based on the above technical solution, the method is applied to coding blocks that meet preset coding conditions, and the coding blocks of the preset coding conditions include: coding blocks in transform skip mode; or, coding blocks with a picture-level intra-frame prediction transform skip allow flag value of 1; or, coding blocks with a picture-level inter-frame prediction transform skip allow flag value of 1; or, coding blocks with both the picture-level intra-frame prediction transform skip allow flag value and the picture-level inter-frame prediction transform skip allow flag value of 1; or, all coding blocks.
[0021] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the video decoding method in the above technical solution is implemented.
[0022] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the video decoding method in the above technical solution by executing the executable instructions.
[0023] 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 video decoding method in the above technical solution.
[0024] In the technical solution provided in the embodiment of the present application, based on the scanning order when encoding and decoding the coefficients in the SRCC scanning area, according to the distribution characteristics of the coefficients in the SRCC scanning area, a method for segmented SRCC coefficient encoding is proposed. For the coefficients in a continuous scanning order, a syntax element is used to indicate whether these coefficients are all zero, thereby reducing coding redundancy, helping to improve the coding efficiency of coefficient coding, and further improving video compression performance.
[0025] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0027] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.
[0028] Figure 2 A schematic diagram showing the placement of a video encoding device and a video decoding device in a streaming transmission system.
[0029] Figure 3 A basic flow chart of a video encoder is shown.
[0030] Figure 4 The scan area marked by the SRCC technique is shown.
[0031] Figure 5 A schematic diagram showing the sequence of scanning the marked scanning area is shown.
[0032] Figure 6 A flowchart showing the steps of a video decoding method in one embodiment of the present application is shown.
[0033] Figure 7A flowchart showing the steps of decoding the coefficient segmented all-zero flag by conventional decoding in one embodiment of the present application.
[0034] Figure 8 A flowchart of the steps of determining a context index increment based on a first mode in one embodiment of the present application is shown.
[0035] Fig. 9 A flowchart of the steps of determining a context index increment based on a second mode in one embodiment of the present application is shown.
[0036] Fig.10 A flowchart of the steps of a video encoding method in one embodiment of the present application is shown.
[0037] Fig.11 A structural block diagram of a video encoding device provided in an embodiment of the present application is shown.
[0038] Fig.12 The structure block diagram of the video decoding device provided by the embodiment of the present application is shown.
[0039] Fig.13 The structure block diagram of a computer system suitable for implementing an electronic device of an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0040] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0041] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0042] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0043] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0044] It should be noted that the "multiple" 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 before and after are in an "or" relationship.
[0045] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.
[0046] like Figure 1 As shown, the system architecture 100 includes a plurality of terminal devices, which can communicate with each other through, for example, a network 150. For example, the system architecture 100 may include a first terminal device 110 and a second terminal device 120 interconnected through the network 150. Figure 1 In the embodiment of the present invention, the first terminal device 110 and the second terminal device 120 perform unidirectional data transmission.
[0047] For example, the first terminal device 110 may encode video data (e.g., a video picture stream captured by the terminal device 110) for transmission to the second terminal device 120 via the network 150. The encoded video data is transmitted in the form of one or more encoded video code streams. The second terminal device 120 may receive the encoded video data from the network 150, decode the encoded video data to restore the video data, and display the video picture based on the restored video data.
[0048] In one embodiment of the present application, the system architecture 100 may include a third terminal device 130 and a fourth terminal device 140 that perform bidirectional transmission of encoded video data, which may occur during a video conference, for example. For bidirectional data transmission, each of the third terminal device 130 and the fourth terminal device 140 may encode video data (e.g., a video picture stream collected by the terminal device) to transmit to the other terminal device of the third terminal device 130 and the fourth terminal device 140 through the network 150. Each of the third terminal device 130 and the fourth terminal device 140 may also receive the encoded video data transmitted by the other terminal device of the third terminal device 130 and the fourth terminal device 140, and may decode the encoded video data to restore the video data, and may display the video picture on an accessible display device according to the restored video data.
[0049] exist Figure 1 In the embodiment of the present invention, the first terminal device 110, the second terminal device 120, the third terminal device 130 and the fourth terminal device 140 may be servers, personal computers and smart phones, but the principles disclosed in the present application may not be limited thereto. The embodiments disclosed in the present application are applicable to laptop computers, tablet computers, media players and / or dedicated video conferencing equipment. The network 150 represents any number of networks that transmit encoded video data between the first terminal device 110, the second terminal device 120, the third terminal device 130 and the fourth terminal device 140, including, for example, wired and / or wireless communication networks. The communication network 150 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 purpose of the present application, unless explained below, the architecture and topology of the network 150 may be irrelevant to the operation disclosed in the present application.
[0050] In one embodiment of the present application, Figure 2 The placement of the video encoding device and the video decoding device in the streaming environment is shown. The subject matter disclosed in the present application can be equally applicable to other video-supported applications, including, for example, video conferencing, digital TV (television), storing compressed video on digital media including CD, DVD, memory stick, etc.
[0051] The streaming system may include an acquisition subsystem 213, which may include a video source 201 such as a digital camera, which creates an uncompressed video picture stream 202. In an embodiment, the video picture stream 202 includes samples taken by a digital camera. The video picture stream 202 is depicted as a thick line to emphasize the high data volume of the video picture stream compared to the encoded video data 204 (or the encoded video code stream 204), and the video picture stream 202 can be processed by an electronic device 220, which includes a video encoding device 203 coupled to the video source 201. The video encoding device 203 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 202, the encoded video data 204 (or the encoded video code stream 204) is depicted as a thin line to emphasize the lower data volume of the encoded video data 204 (or the encoded video code stream 204), which can be stored on the streaming server 205 for future use. One or more streaming client subsystems, such as Figure 2The client subsystem 206 and the client subsystem 208 in the streaming server 205 can access the streaming server 205 to retrieve the copy 207 and the copy 209 of the encoded video data 204. The client subsystem 206 may include, for example, a video decoding device 210 in the electronic device 230. The video decoding device 210 decodes the incoming copy 207 of the encoded video data and generates an output video picture stream 211 that can be presented on a display 212 (e.g., a display screen) or another presentation device. In some streaming systems, the encoded video data 204, the video data 207, and the video data 209 (e.g., a video bitstream) may be encoded according to certain video encoding / compression standards. Examples of these standards include ITU-T H.265. In an embodiment, the video coding standard under development is informally referred to as Versatile Video Coding (VVC), and the present application may be used in the context of the VVC standard.
[0052] It should be noted that the electronic device 220 and the electronic device 230 may include other components not shown in the figure. For example, the electronic device 220 may include a video decoding device, and the electronic device 230 may also include a video encoding device.
[0053] In one embodiment of the present application, taking the international video coding standards HEVC (High Efficiency Video Coding), VVC (Versatile Video Coding), and China's national video coding standard AVS as examples, after a video frame image is input, the video frame image will be divided into several non-overlapping processing units according to a block size, and each processing unit will perform similar compression operations. This processing unit is called CTU (Coding Tree Unit), or LCU (Largest Coding Unit). CTU can continue to be divided more finely to obtain one or more basic coding units CU, which is the most basic element in a coding link. The following introduces some concepts when encoding CU:
[0054] Predictive Coding: Predictive coding 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 decide which predictive coding mode to choose for the current CU and inform the decoder. Intra-frame prediction means that the predicted signal comes from the encoded and reconstructed area in the same image; inter-frame prediction means that the predicted signal comes from other images that have been encoded and different from the current image (called reference images).
[0055] Transform & Quantization: After the residual video signal is transformed by DFT (Discrete Fourier Transform), DCT (Discrete Cosine Transform), etc., the signal is converted into the transform domain, which is called the transform coefficient. The transform coefficient is further subjected to lossy quantization operation, which loses a certain amount of information, making the quantized signal conducive to compression expression. In some video coding standards, there may be more than one transform method to choose from, so the encoder also needs to select one of the transform methods for the current CU and inform the decoder. The degree of quantization is usually determined by the quantization parameter (QP). A larger QP 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.
[0056] 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 coding mode, motion vector data, etc., which also need 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).
[0057] The context-based adaptive binary arithmetic coding (CABAC) process mainly includes three steps: binarization, context modeling and binary arithmetic coding. After the input syntax elements are binarized, the binary data can be encoded through the conventional coding mode and the bypass coding mode. In the bypass coding mode, there is no need to assign a specific probability model to each binary bit. The input binary bit bin value is directly encoded with a simple bypass encoder to speed up the entire encoding and decoding. In general, different syntax elements are not completely independent, and the same syntax element itself has a certain memory. Therefore, according to the conditional entropy theory, conditional encoding using other encoded syntax elements can further improve the encoding performance compared to independent encoding or memoryless encoding. These encoded symbol information used as conditions are called context. In the conventional coding mode, the binary bits of the syntax elements enter the context modeler sequentially. The encoder assigns a suitable probability model to each input binary bit according to the value of the previously encoded syntax element or binary bit. This process is called context modeling. The context model corresponding to the syntax element can be located through ctxIdxInc (contextindex increment) and ctxIdxStart (context index Start). After the bin value and the assigned probability model are sent to the binary arithmetic encoder for encoding, the context model needs to be updated according to the bin value, which is the adaptive process in encoding.
[0058] Loop Filtering: The changed and quantized signal will be reconstructed through inverse quantization, inverse transformation and prediction compensation operations to obtain a reconstructed image. Compared with the original image, due to the influence of quantization, some information of the reconstructed image is different from the original image, that is, the reconstructed image will produce distortion. Therefore, the reconstructed image can be filtered, such as deblocking filter (DB), SAO (Sample Adaptive Offset) or ALF (Adaptive Loop Filter) and other filters, which can effectively reduce the degree of distortion caused by quantization. Since these filtered reconstructed images will be used as a reference for subsequent encoded images to predict future image signals, the above filtering operation is also called loop filtering, that is, filtering operation within the encoding loop.
[0059] In one embodiment of the present application, Figure 3The basic flow chart of a video encoder is shown in FIG. 1 , in which intra-frame prediction is used as an example for explanation. In which the original image signal s k [x,y] and predicted image signal Perform difference operation to obtain the residual signal u k [x,y], residual signal u k [x,y] is transformed and quantized to obtain the quantized coefficients. The quantized coefficients are entropy coded to obtain the encoded bit stream, and the reconstructed residual signal u' is obtained by inverse quantization and inverse transformation. k [x,y], predicted image signal and reconstructed residual signal u' k [x,y] superposition generates image signal Image signal On the one hand, it is input to the intra-frame mode decision module and the intra-frame prediction module for intra-frame prediction processing, and on the other hand, the reconstructed image signal s' is output through loop filtering k [x,y], reconstructed image signal s' k [x,y] can be used as the reference image for the next frame for motion estimation and motion compensation prediction. Then based on the result of motion compensation prediction s' r [x+m x ,y+m y ] and intra prediction results Get the predicted image signal of the next frame And continue to repeat the above process until the encoding is completed.
[0060] Based on the above encoding process, at the decoding end, for each CU, after obtaining the compressed code stream (i.e., bit stream), entropy decoding is performed to obtain various mode information and quantization coefficients. The quantization coefficients are then 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, and then the residual signal and the prediction signal are added to obtain the reconstructed signal. The reconstructed signal is then subjected to loop filtering and other operations to generate the final output signal.
[0061] In the above encoding and decoding process, the transformation processing of the residual signal makes the energy of the residual signal concentrated in fewer low-frequency coefficients, that is, most of the coefficient values are small. Then after the subsequent quantization module, the smaller coefficient values will become zero values, which greatly reduces the cost of encoding the residual signal. However, due to the diversity of residual distribution, a single DCT transform cannot adapt to all residual characteristics. Therefore, transform cores such as DST7 and DCT8 are introduced into the transformation processing process, and different transform cores can be used for the horizontal and vertical transforms of the residual signal. Taking AMT (Adaptive multiple core transform) technology as an example, the transform combinations that may be selected for transform processing of a residual signal are as follows: (DCT2, DCT2), (DCT8, DCT8), (DCT8, DST7), (DST7, DCT8) and (DST7, DST7). For the specific selection of the transform combination for the residual signal, it is necessary to use RDO (Rate-Distortion Optimization) at the encoding end to make a decision. In addition, when the residual distribution correlation in the residual block is weak, the residual signal can be directly quantized without going through the transformation process, that is, transformation skipping. Whether the current residual block belongs to the transformation skipping mode can be identified by explicit coding and implicit derivation.
[0062] Since the non-zero coefficients in the quantized coefficient block of the residual signal after transformation and quantization are more likely to be concentrated in the left and upper areas of the block, while the right and lower areas of the block are often 0, the Scan Region based Coefficient Coding (SRCC) technology can be used. Through the SRCC technology, the size of the upper left area of the non-zero coefficients contained in each quantized coefficient block (size W×H) can be marked as (SRx+1)×(SRy+1), where SRx is the horizontal coordinate of the rightmost non-zero coefficient in the quantized coefficient block, SRy is the vertical coordinate of the bottom non-zero coefficient in the quantized coefficient block, and the coordinates of the upper left corner starting point are (0,0), 1≤SRx+1≤W, 1≤SRy+1≤H, and the coefficients outside this area are all 0. The SRCC technology uses (SRx, SRy) to determine the quantized coefficient area that needs to be scanned in a quantized coefficient block, such as Figure 4 As shown, only the quantized coefficients in the scan area marked by (SRx, SRy) need to be encoded, and the encoding scanning order is as follows Figure 5 As shown, it can be a reverse Z-shaped scan from the lower right corner to the upper left corner.
[0063] The coefficients to be encoded in the SRCC scanning area are encoded in a layered manner. Specifically, first, the coordinates of the SRCC scanning area are encoded. Then, within the SRCC scanning area, based on the scanning order, the flag (significant flag) indicating whether the coefficient at the current position is 0 is encoded one by one. At the same time, the position of the non-zero coefficients is recorded and the number of non-zero coefficients is counted. If the number of non-zero coefficients is greater than 0, the absolute value and sign of the non-zero coefficient at the corresponding position need to be encoded.
[0064] Considering that the boundary of the SRCC scanning area mainly depends on the position of the rightmost and bottommost non-zero coefficients in the current block, there may be many zero coefficients in the SRCC scanning area. Therefore, in the SRCC scanning order, there may be multiple consecutive zero coefficients. In particular, for example, in the transform skip mode, since there is no transform process, the residual coefficient energy is not concentrated, and the distribution of non-zero coefficients may be relatively sparse. In the current AVS3 standard, all positions in the SRCC scanning area need to encode significant flags to indicate whether the position is a zero coefficient, which will cause some unnecessary redundancy.
[0065] The present invention is based on the scanning order of coefficients in the SRCC scanning area when encoding and decoding, and according to the distribution characteristics of the coefficients in the SRCC scanning area, a method for segmented SRCC coefficient encoding is proposed. For the coefficients in a continuous scanning order, a syntax element is used to indicate whether these coefficients are all zero, so as to reduce coding redundancy, help improve the coding efficiency of coefficient coding, and further improve video compression performance.
[0066] It should be noted that the coefficient coding method proposed in the present application is not limited to the application in the coefficient coding in the transform skip mode. It can also be used in the coefficient coding in other coding modes, for example, in the coefficient coding of all blocks; for example, when the value of the image-level intra-frame prediction transform skip enable flag is 1; for example, when the value of the image-level inter-frame prediction transform skip enable flag is 1; for example, when the value of the image-level intra-frame prediction transform skip enable flag and the value of the image-level inter-frame prediction transform skip enable flag are both 1, etc.
[0067] The embodiment of the present application can determine whether the coding block adopts the transform skip mode by explicit coding or implicit derivation. Among them, explicit coding is to decode the flag used to indicate whether the coding block adopts the transform skip mode before decoding the absolute value of the coefficient, so as to clarify whether the current coding block needs to skip the transformation process based on the decoding result of the flag. Implicit derivation (i.e., Implicit Selection of Transform Skip) is to perform statistics on the coefficient decoding results in the absence of a corresponding flag, and then determine whether to skip the transformation process based on the statistical results. For example, all coefficients can be decoded first, the number of all non-zero coefficients and the number of even coefficients among all coefficients (including zero coefficients) can be calculated, and then based on the parity of the number of non-zero coefficients or the parity of the number of even coefficients among all coefficients, it can be implicitly deduced whether the current coding block adopts transform skipping (for example, when the number of non-zero coefficients is odd, it is determined that the current coding block adopts transform skipping; and when the number of non-zero coefficients is even, it is determined that the current coding block does not adopt transform skipping. For example, when the number of even coefficients among all coefficients is even, it is determined that the current coding block adopts transform skipping; and when the number of even coefficients among all coefficients is odd, it is determined that the current coding block does not adopt transform skipping).
[0068] The picture-level intra prediction transform skip enable flag and the picture-level inter prediction transform skip enable flag are flags used to control whether implicit transform skipping can be used in intra / inter frames. In the embodiments of the present application, the syntax elements related to transform skip mode are explained as follows.
[0069] Implicit transformation skip enable flag ist_skip_enable_flag:
[0070] A binary variable. A value of '1' indicates that implicit transform skipping can be used; a value of '0' indicates that implicit transform skipping should not be used. The value of the variable IstSkipEnableFlag can be obtained by decoding the syntax element ist_skip_enable_flag. If the syntax element ist_skip_enable_flag does not exist in the bitstream, IstSkipEnableFlag can be assigned a value of 0.
[0071] Inter-frame transform skip enable flag inter_transform_skip_enable_flag:
[0072] Binary variable. A value of '1' indicates that inter-transform skipping can be used; a value of '0' indicates that inter-transform skipping should not be used. The value of the variable InterTransformSkipEnableFlag can be obtained by decoding the syntax element inter_transform_skip_enable_flag. If the syntax element inter_transform_skip_enable_flag does not exist in the bitstream, InterTransformSkipEnableFlag can be assigned a value of 0.
[0073] Picture level intra prediction transform skip enable flag picture_ist_skip_enable_flag:
[0074] Binary variable. A value of '1' indicates that the luma intra prediction residual block and luma coding block copied intra prediction residual block of the current image can use the transform skip method; a value of '0' indicates that the luma intra prediction residual block and luma coding block copied intra prediction residual block of the current image should not use the transform skip method. The value of the variable PictureIstSkipEnableFlag can be obtained by decoding the syntax element picture_ist_skip_enable_flag. If the syntax element picture_ist_skip_enable_flag does not exist in the bitstream, PictureIstSkipEnableFlag can be assigned a value of 0.
[0075] Picture-level inter-frame prediction transform skipping enable flag picture_inter_trasform_skip_flag:
[0076] Binary variable. The value of '1' indicates that the luma inter-frame prediction residual block of the current image can use the transform skip method; the value of '0' indicates that the luma inter-frame prediction residual block of the current image should not use the transform skip method. The value of PictureInterSkipEnableFlag can be obtained by decoding the syntax element picture_inter_transform_skip_flag. If the syntax element picture_inter_transform_skip_flag does not exist in the bitstream, PictureInterSkipEnableFlag can be assigned a value of 0.
[0077] The implementation details of the technical solution of the embodiment of the present application are elaborated in detail below in combination with specific application scenarios.
[0078] Figure 6The flowchart of the steps of a video decoding method in one embodiment of the present application is shown. The video decoding method can be executed by a device with a computing and processing function, such as a terminal device or a server. Figure 6 As shown, the video decoding method may mainly include the following steps S610 to S640.
[0079] Step S610: In the coding block of the video image frame, the coefficients to be decoded are segmented according to the scanning order of the scanning area-based coefficient coding SRCC scanning area to obtain coefficient segments consisting of multiple coefficients.
[0080] In one embodiment of the present application, a video image frame sequence includes a series of images, each of which can be further divided into slices, which can be further divided into a series of LCUs (or CTUs), and the LCU contains several CUs. When encoding, the video image frame is encoded in blocks. In some new video coding standards, such as the H.264 standard, there are macroblocks (MB), which can be further divided into multiple prediction blocks (prediction) that can be used for predictive coding. In the HEVC standard, basic concepts such as coding units CU, prediction units (PU) and transform units (TU) are used to functionally divide various block units and describe them using a new tree-based structure. For example, CU can be divided into smaller CUs according to a quadtree, and the smaller CU can be further divided to form a quadtree structure. The coding block in the embodiment of the present application can be a CU, or a smaller block than a CU, such as a smaller block obtained by dividing a CU.
[0081] Step S620: Decode the coefficient segment all-zero flag of the coefficient segment to obtain the value of the coefficient segment all-zero flag, where the coefficient segment all-zero flag is used to indicate whether all coefficients in the coefficient segment are zero.
[0082] In one embodiment of the present application, the method for decoding the coefficient segment all-zero flag coef_part_all_zero_flag may include: determining that the decoding method of the coefficient segment all-zero flag is bypass decoding (bypass) or conventional decoding (CABAC); if it is determined that the decoding method of the coefficient segment all-zero flag is bypass decoding, then decoding the coefficient absolute value threshold flag through the bypass decoding engine; if it is determined that the decoding method of the coefficient segment all-zero flag is conventional decoding, then decoding the coefficient segment all-zero flag through a conventional decoding engine based on a context model.
[0083] In the embodiment of the present application, the coefficient segment all-zero flags corresponding to different coefficient segments can choose the same decoding method or different decoding methods.
[0084] Step S630: If the value of the coefficient segment all-zero flag is a preset first value, the valid flag of each coefficient in the coefficient segment is decoded in sequence according to the scanning order, and the valid flag is used to indicate whether the coefficient is a non-zero coefficient.
[0085] The preset first value may be, for example, 0. When the decoded coefficient segment all-zero flag has a value of 0, it indicates that the coefficients in the corresponding coefficient segment are not all zero coefficients, but there are a number of non-zero coefficients. At this time, the significant flags of the coefficients in the coefficient segment may be decoded in sequence according to the scanning order to determine whether each coefficient is a non-zero coefficient. In one embodiment of the present application, if the decoded significant flag of a coefficient is 0, it indicates that the coefficient is a zero coefficient; if the decoded significant flag of a coefficient is 1, it indicates that the coefficient is a non-zero coefficient.
[0086] Step S640: If the value of the coefficient segment all-zero flag is a preset second value, then the decoding of the valid flag is skipped, and the valid flags of the coefficients in the coefficient segment are all assigned a value of zero.
[0087] The preset second value may be, for example, 1. When the decoded coefficient segment all-zero flag has a value of 1, it indicates that all coefficients in the corresponding coefficient segment are zero coefficients. In this case, there is no need to decode the significant flag of each coefficient, but the significant flag of all coefficients in the corresponding coefficient segment may be directly assigned a value of 0.
[0088] After decoding or assigning a value to the significant flag, it can be determined that each coefficient in the coding block is a zero coefficient or a non-zero coefficient. For a non-zero coefficient, the corresponding syntax element can be further decoded to obtain the coefficient absolute value and sign of the non-zero coefficient.
[0089] In the video decoding method provided in the embodiment of the present application, based on the scanning order when encoding and decoding the coefficients in the SRCC area, some coefficients in a continuous scanning order are organized into a coefficient segment according to the distribution characteristics of the coefficients in the SRCC area, and a syntax element is used to indicate whether the coefficients in the coefficient segment are all zero coefficients, thereby reducing coding redundancy, helping to improve the coding efficiency of coefficient coding, and further improving video compression performance.
[0090] In one embodiment of the present application, the method for segmenting the coefficients to be decoded according to the scanning order of the SRCC scanning area may include: obtaining a coefficient segment length, where the coefficient segment length is used to represent the maximum number of coefficients included in a coefficient segment; sequentially determining consecutive coefficients to be decoded according to the scanning order of the SRCC scanning area, and forming a coefficient segment with the number of coefficients equal to or less than the coefficient segment length.
[0091] In one embodiment of the present application, the coefficient segment length CUT_NUM is a constant determined according to the maximum transform unit size or a dynamic parameter determined according to the attribute information of the coding block. Among them, the attribute information of the coding block may include at least one of the following information: the size of the current transform unit, the shape of the current transform unit, the coordinates of the SRCC scanning area, and the number of coefficients in the SRCC scanning area.
[0092] In an embodiment of the present application, according to the maximum TU size set by the codec, the coefficient segment length CUT_NUM can be directly set as a constant not exceeding the maximum TU size in the codec. For example, when the maximum TU size is 64*64, CUT_NUM = 16.
[0093] In an embodiment of the present application, the coefficient segment length CUT_NUM can also be dynamically set according to factors such as the current TU size, the current TU shape, the SRCC scanning area coordinates, and the number of SRCC coefficients. In short, there are various ways to set the value of CUT_NUM, not limited to the foregoing examples.
[0094] In an embodiment of the present application, it can be set that the number of coefficients in each coefficient segment is group_coef_num = CUT_NUM. Optionally, when num_coef % CUT_NUM!= 0, that is, when the total number of coefficients in the SRCC scanning area is not an integer multiple of CUT_NUM, after segmented coding, there will be a coefficient segment with the number of coefficients less than CUT_NUM, that is, the number of coefficients in this coefficient segment is group_coef_num = num_coef % CUT_NUM (group_coef_num < CUT_NUM). In an embodiment of the present application, these coefficients can be placed at a specific position in the SRCC scanning area, for example, the first segment at the beginning of the scanning order.
[0095] In one embodiment of the present application, the bypass decoding or the conventional decoding method can be selected to decode the coefficient segment all-zero flag. Among them, the conventional decoding method needs to allocate a suitable probability model for each input binary bit according to the previously decoded syntax elements or the values of the binary bits, that is, allocate a context model for the coefficient segment all-zero flag to be decoded.
[0096] Figure 7A flowchart of steps for decoding the coefficient segment all-zero flag by conventional decoding in one embodiment of the present application is shown. Based on the above embodiment, the method for decoding the coefficient segment all-zero flag by a conventional decoding engine based on a context model can mainly include the following steps S710 to S730.
[0097] Step S710: Obtain a model selection method corresponding to the SRCC scanning area, and determine a context index increment according to the model selection method.
[0098] In the embodiment of the present application, a fixed model selection method can be pre-set in the encoder and decoder, or a mode can be dynamically selected from multiple available model selection methods according to the current coding block. For multiple coding blocks in a video image frame, the same model selection method can be used, or different model selection methods can be used.
[0099] Step S720: Select the context model corresponding to the coefficient segmentation all-zero flag according to the context index increment.
[0100] The context model corresponding to the syntax element can be located by the context index increment ctxIdxInc and the context start index ctxIdxStart. Different probability models can be assigned to the coefficient segmentation all-zero flag based on different values of the context index increment ctxIdxInc.
[0101] Step S730: Based on the selected context model, the coefficient segment all-zero flag is arithmetically decoded by a conventional decoding engine.
[0102] The selected context model and the coefficient segment zero flag to be decoded are loaded into a conventional decoding engine, and the coefficient segment zero flag can be decoded by the conventional decoding engine to obtain the corresponding flag value. The conventional decoding engine in the embodiment of the present application can be a binary arithmetic decoder based on CABAC technology.
[0103] In one embodiment of the present application, the selectable model selection method may include three modes. If the model selection method is the first mode, the context index increment is assigned according to the shape of the SRCC scanning area; if the model selection method is the second mode, the context index increment is assigned according to the area of the SRCC scanning area; if the model selection method is the third mode, the context index increment is assigned according to a preset first value.
[0104] Figure 8 A flowchart of the steps of determining the context index increment based on the first mode in one embodiment of the present application is shown. Figure 8As shown, based on the above embodiments, the method for assigning values to the context index increment according to the shape of the SRCC scan region may include the following steps S810 to S840.
[0105] Step S810: Obtain the region width and region height of the SRCC scan region.
[0106] In one embodiment of the present application, the SRCC scan region may be a rectangular region as shown in Figure 4 . After decoding to obtain the right-end abscissa scan_region_x and the lower-end ordinate scan_region_y of the SRCC scan region in the current coding block, the region width of the SRCC scan region can be determined as sr_width = scan_region_x + 1, and the region height can be determined as sr_height = scan_region_y + 1.
[0107] Step S820: Assign a value to the initial value of the context index increment according to the numerical size relationship between the region width and the region height.
[0108] In one embodiment of the present application, by comparing the numerical sizes between the region width and the region height, different preset values can be used to assign a value to the initial value of the context index increment. If the region width and the region height are equal, the preset second value is used to assign a value to the initial value of the context index increment; if the region width is less than the region height, the preset third value is used to assign a value to the initial value of the context index increment; if the region width is greater than the region height, the preset fourth value is used to assign a value to the initial value of the context index increment.
[0109] For example, the second value can be taken as 1, the third value can be taken as 2, and the fourth value can be taken as 5. On this basis, the method logic for assigning a value to the initial value of the context index increment is: ctxIdxInc = ((sr_width == sr_height)? 1 : (sr_width < sr_height? 2 : 5)). That is: if the region width sr_width and the region height sr_height are equal, the initial value ctxIdxInc of the context index increment is assigned as 1; if the region width sr_width is less than the region height sr_height, the initial value ctxIdxInc of the context index increment is assigned as 2; if the region width sr_width is greater than the region height sr_height, the initial value ctxIdxInc of the context index increment is assigned as 5.
[0110] Step S830: Assign an increment value to the initial value of the context index increment according to the numerical ratio relationship between the region width and the region height.
[0111] In one embodiment of the present application, a method for assigning an initial value increment of a context index increment may include: calculating a numerical ratio ratio between a larger value and a smaller value of a region width and a region height; comparing the numerical ratio with a plurality of preset ratio thresholds, and assigning an initial value increment delta of the context index increment according to the comparison result. In the embodiment of the present application, the initial value of the context index increment may be negatively correlated with the numerical ratio ratio. For example, let ratio = (sr_width) = (ratio)<sr_height)?(sr_height / sr_width):(sr_width / sr_height),delta=(ratio> =3)? 0:((ratio>=2)?1:2). In an embodiment of the present application, when the region width sr_width is less than the region height sr_height, the ratio obtained by dividing the larger value sr_height by the smaller value sr_width is used as the numerical ratio ratio; when the region height sr_height is less than (or equal to) the region width sr_width, the ratio obtained by dividing the larger value sr_width by the smaller value sr_height is used as the numerical ratio ratio. Take two preset ratio thresholds as 2 and 3. If the numerical ratio ratio is greater than or equal to 3, the initial value increment delta of the context index increment is assigned to 0; if the numerical ratio ratio is less than 3 and greater than or equal to 2, the initial value increment delta of the context index increment is assigned to 1; if the numerical ratio ratio is less than 2, the initial value increment delta of the context index increment is assigned to 2. The various numerical values involved in the embodiments of the present application are only examples. In specific application scenarios, other numerical values can be selected, and the embodiments of the present application do not make special limitations on this.
[0112] Step S840: Incrementally assign a value to the context index according to the initial value and the initial value increment.
[0113] In one embodiment of the present application, if the region width and the region height are equal in value, the context index increment is assigned with the initial value, that is, ctxIdxInc+=0; if the region width and the region height are not equal in value, the context index increment ctxIdxInc is assigned with the sum of the initial value and the initial value increment delta, that is, ctxIdxInc+=delta.
[0114] Fig. 9 A flowchart of the steps of determining the context index increment based on the second mode in one embodiment of the present application is shown. Fig. 9 As shown, based on the above embodiments, the method for assigning a context index increment according to the area of the SRCC scan region may include the following steps S910 to S930.
[0115] Step S910: Acquire the area width and area height of the SRCC scanning area.
[0116] In one embodiment of the present application, the SRCC scanning area may be as follows: Figure 4 For the rectangular area shown in , after decoding to obtain the right end horizontal coordinate scan_region_x and the lower end vertical coordinate scan_region_y of the SRCC scan area in the current coding block, it can be determined that the area width of the SRCC scan area is sr_width=scan_region_x+1, and the area height is sr_height=scan_region_y+1.
[0117] Step S920: Determine the area of the SRCC scanning region according to the region width and the region height.
[0118] When the SRCC scanning area is a rectangular area, its area sr_area is equal to the product of the area width sr_width and the area height sr_height, that is, sr_area=sr_width*sr_height.
[0119] Step S930: Compare the area of the region with a plurality of preset area thresholds to assign an incremental value to the context index according to the comparison result.
[0120] In one embodiment of the present application, the value of the context index increment may be positively correlated with the area of the SRCC scan area. For example, three area thresholds are taken as 16, 32, and 64, ctxIdxInc=(sr_area<16)?0:((sr_area<32)?1:(sr_area<64)?2:3). When the area sr_area is less than 16, the context index increment ctxIdxInc is assigned a value of 0; when the area sr_area is greater than or equal to 16 and less than 32, the context index increment ctxIdxInc is assigned a value of 1; when the area sr_area is greater than or equal to 32 and less than 64, the context index increment ctxIdxInc is assigned a value of 2; when the area sr_area is greater than or equal to 64, the context index increment ctxIdxInc is assigned a value of 3. The various numerical values involved in the embodiments of the present application are only examples. In specific application scenarios, other numerical values can be selected, and the embodiments of the present application do not make any special limitations on this.
[0121] In one embodiment of the present application, when the context index increment is determined using the third mode, the context index increment may be directly assigned a preset first value, so that a single context model may be determined. For example, the first value is 0 (this value is only used for example), and the context index increment ctxIdxInc may be set to 0, that is, without adding any increment, the corresponding context model is directly located using the context start index ctxIdxStart.
[0122] In the technical solution provided in the embodiment of the present application, the coefficient segmentation all-zero flag of each coefficient segment can be selectively decoded. After the SRCC scanning area of the coding block is segmented, a plurality of coefficient segments can be obtained. Thereafter, the coefficient segmentation all-zero flag can be decoded for all coefficient segments, or the coefficient segmentation all-zero flag can be decoded for only a part of the coefficient segments.
[0123] In one embodiment of the present application, before decoding the coefficient segment all-zero flag of the coefficient segment, it can be determined whether a preset decoding skip condition is met; if the decoding skip condition is met, the decoding step of the coefficient segment all-zero flag is skipped, and a preset second value is used as the value of the coefficient segment all-zero flag. For example, the second value is 1, that is, it is assumed that the coefficient segment that has not been decoded for the coefficient segment all-zero flag is an all-zero coefficient segment composed of zero coefficients.
[0124] In one embodiment of the present application, the decoding skip condition includes at least one of the following conditions: the number of coefficients in the coefficient segment is less than a preset number threshold; the area ratio of the SRCC scan area in the coding block is less than a preset ratio threshold.
[0125] In an optional implementation, when the number of coefficients in a coefficient segment is less than a preset number threshold, the step of decoding the coefficient segment all-zero flag of the coefficient segment is skipped, and the preset first value is used as the value of the coefficient segment all-zero flag. For example, taking the coefficient segment length CUT_NUM in the above embodiment as the number threshold, when the number of coefficients group_coef_num of a coefficient segment is less than the number threshold, there is no need to decode the coefficient segment all-zero flag coef_part_all_zero_flag of the coefficient segment, and coef_part_all_zero_flag=0 is set, indicating that all coefficients in the coefficient segment need to decode the significant flag of each coefficient in turn in the scanning order, and then determine whether each coefficient is a non-zero coefficient.
[0126] In an optional implementation, when the area ratio of the SRCC scanning area in the coding block is less than a preset ratio threshold, the step of decoding the coefficient segment all-zero flag of the coefficient segment is skipped, and the preset first value is used as the value of the coefficient segment all-zero flag. For example, let sr_area_per = (sr_width*sr_height) / (width*height), where width and height are the length and width of the current coding block, respectively, and sr_area_per is the area ratio of the SRCC scanning area in the coding block. When the area ratio sr_area_per corresponding to a coefficient segment is less than the set ratio threshold, there is no need to decode the coef_part_all_zero_flag of the coefficient segment, and let coef_part_all_zero_flag = 0, indicating that all coefficients in the coefficient segment need to decode the significant flag of each coefficient in turn in the scanning order, and then determine whether each coefficient is a non-zero coefficient.
[0127] In an optional embodiment, when the number of coefficients in a coefficient segment is less than a preset number threshold, and when the area ratio of the SRCC scan area in the coding block is less than a preset ratio threshold, the step of decoding the coefficient segment all-zero flag of the coefficient segment is skipped, and the preset first numerical value is used as the value of the coefficient segment all-zero flag.
[0128] In one embodiment of the present application, if there is a specific coefficient segment whose number of coefficients is less than the coefficient segment length, the specific coefficient segment is located at a specific position of the SRCC scan area. For example, the specific position may be a mid-scan start position or a scan end position of the SRCC scan area. Accordingly, the specific coefficient segment may be the first coefficient segment or the last coefficient segment in the scan order.
[0129] The above embodiments introduce a decoding scheme for segmented decoding of coefficients in the SRCC scanning area from the perspective of the decoding side, while the encoding side may use an encoding scheme corresponding to each of the above embodiments. Fig.10 The flowchart of the steps of the video encoding method in one embodiment of the present application is shown. The video encoding method can be executed by a device with a computing and processing function, such as a terminal device or a server. Fig.10 As shown, the video encoding method may mainly include the following steps S1010 to S1040.
[0130] Step S1010: in a coding block of a video image frame, segmenting the coefficients to be coded according to a scanning order of a scanning area-based coefficient coding SRCC scanning area to obtain a coefficient segment consisting of a plurality of coefficients;
[0131] Step S1020: determining the value of the coefficient segment all-zero flag according to whether all coefficients in the coefficient segment are zero, and encoding the coefficient segment all-zero flag;
[0132] Step S1030: if the value of the coefficient segment all-zero flag is a preset first value, then encode the valid flag of each coefficient in each coefficient segment in sequence according to the scanning order, where the valid flag is used to indicate whether the coefficient is a non-zero coefficient;
[0133] Step S1040: If the value of the coefficient segment all-zero flag is a preset second value, skip encoding the valid flags of each coefficient in the coefficient segment.
[0134] In an embodiment of the present application, if the value of the coefficient segment all-zero flag is a preset second value, it means that all coefficients in the coefficient segment are zero coefficients, and there is no need to encode the valid flags of each coefficient in the coefficient segment.
[0135] The relevant content details of the video encoding method in the embodiment of the present application correspond to the video decoding method in the above embodiment, and will not be repeated here.
[0136] Based on the above embodiments, the present invention is based on the scanning order when encoding and decoding the coefficients in the SRCC area, and according to the distribution characteristics of the coefficients in the SRCC area, a method for segmented SRCC coefficient encoding is proposed. For the coefficients in a continuous scanning order, a syntax element is used to indicate whether these coefficients are all zero, so as to reduce coding redundancy, help improve the coding efficiency of coefficient coding, and further improve video compression performance. It should be noted that the above embodiments use the decoding end as an example to illustrate the SRCC coefficient encoding and decoding method provided in the embodiments of the present application, but the relevant technical solutions can also be applied to the encoding end, and the present application is not limited to this.
[0137] It should be noted that although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0138] The following introduces an apparatus embodiment of the present application, which can be used to execute the video decoding method in the above-mentioned embodiment of the present application. Fig.11 FIG. 4 shows a structural block diagram of a video decoding device provided in an embodiment of the present application. Fig.11 As shown, the video decoding device 1100 may mainly include:
[0139] The coefficient segmentation module 1110 is configured to segment the coefficients to be decoded in the coding block of the video image frame according to the scanning order of the SRCC scanning area to obtain coefficient segments composed of multiple coefficients; the first decoding module 1120 is configured to decode the coefficient segmentation all-zero flag of the coefficient segmentation to obtain the value of the coefficient segmentation all-zero flag, and the coefficient segmentation all-zero flag is used to indicate whether all the coefficients in the coefficient segment are zero; the second decoding module 1130 is configured to, if the value of the coefficient segmentation all-zero flag is a preset first value, decode the valid flags of each coefficient in the coefficient segment in sequence according to the scanning order, and the valid flags are used to indicate whether the coefficient is a non-zero coefficient; the coefficient assignment module 1140 is configured to, if the value of the coefficient segmentation all-zero flag is a preset second value, assign the valid flags of each coefficient in the coefficient segment to zero.
[0140] In some embodiments of the present application, based on the above embodiments, the first decoding module 1120 includes: a mode determination unit, configured to determine whether the decoding method of the coefficient segmented all-zero flag is bypass decoding or conventional decoding; a bypass decoding unit, configured to decode the coefficient absolute value threshold flag through a bypass decoding engine if it is determined that the decoding method of the coefficient segmented all-zero flag is bypass decoding; and a conventional decoding unit, configured to decode the coefficient segmented all-zero flag through a conventional decoding engine based on a context model if it is determined that the decoding method of the coefficient segmented all-zero flag is conventional decoding.
[0141] In some embodiments of the present application, based on the above embodiments, the conventional decoding unit includes: an incremental determination subunit, configured to obtain a model selection method corresponding to the SRCC scanning area, and determine a context index increment according to the model selection method; a model selection subunit, configured to select a context model corresponding to the coefficient segmented all-zero flag according to the context index increment; an arithmetic decoding subunit, configured to perform arithmetically decoding on the coefficient segmented all-zero flag through a conventional decoding engine based on the selected context model.
[0142] In some embodiments of the present application, based on the above embodiments, the incremental determination subunit is further configured as: if the model selection method is the first mode, the context index increment is assigned according to the shape of the SRCC scanning area; if the model selection method is the second mode, the context index increment is assigned according to the area of the SRCC scanning area; if the model selection method is the third mode, the context index increment is assigned according to a preset first numerical value.
[0143] In some embodiments of the present application, based on the above embodiments, the increment determination subunit is also configured to: obtain the area width and area height of the SRCC scanning area; assign an initial value of the context index increment according to the numerical size relationship between the area width and the area height; assign an initial value increment of the context index increment according to the numerical proportional relationship between the area width and the area height; assign the context index increment according to the initial value and the initial value increment.
[0144] In some embodiments of the present application, based on the above embodiments, the increment determination subunit is also configured as: if the area width and the area height are numerically equal, a preset second numerical value is assigned as the initial value of the context index increment; if the area width is smaller than the area height, a preset third numerical value is assigned as the initial value of the context index increment; if the area width is greater than the area height, a preset fourth numerical value is assigned as the initial value of the context index increment.
[0145] In some embodiments of the present application, based on the above embodiments, the increment determination subunit is also configured to: calculate the numerical ratio between the larger value and the smaller value of the area width and the area height; compare the numerical ratio with a plurality of preset ratio thresholds to assign an initial value increment to the context index increment according to the comparison result.
[0146] In some embodiments of the present application, based on the above embodiments, the incremental determination subunit is also configured as: if the area width is equal to the area height numerical value, then the context index increment is assigned with the initial value; if the area width is not equal to the area height numerical value, then the context index increment is assigned with the sum of the initial value and the initial value increment.
[0147] In some embodiments of the present application, based on the above embodiments, the incremental determination subunit is also configured to: obtain the area width and area height of the SRCC scanning area; determine the area area of the SRCC scanning area based on the area width and the area height; compare the area area with multiple preset area thresholds to assign an incremental value to the context index based on the comparison result.
[0148] In some embodiments of the present application, based on the above embodiments, the video decoding device 1100 also includes: a condition determination module, configured to determine whether a preset decoding skip condition is met; a decoding skip module, configured to skip the decoding step of the coefficient segmented all-zero flag if the decoding skip condition is met, and use a preset first numerical value as the value of the coefficient segmented all-zero flag.
[0149] In some embodiments of the present application, based on the above embodiments, the decoding skip condition includes at least one of the following conditions: the number of coefficients in the coefficient segment is less than a preset number threshold; the area ratio of the SRCC scanning area in the coding block is less than a preset ratio threshold.
[0150] In some embodiments of the present application, based on the above embodiments, the coefficient segmentation module 1010 includes: a length acquisition unit, configured to obtain the coefficient segment length, and the coefficient segment length is used to represent the maximum number of coefficients contained in the coefficient segment; a coefficient segmentation unit, configured to determine the continuous coefficients to be decoded in sequence according to the scanning order of the SRCC scanning area, and group the coefficients whose number is equal to or less than the coefficient segment length into a coefficient segment.
[0151] In some embodiments of the present application, based on the above embodiments, the coefficient segment length is a constant determined according to the maximum conversion unit size or a dynamic parameter determined according to the attribute information of the coding block.
[0152] In some embodiments of the present application, based on the above embodiments, the attribute information of the coding block includes at least one of the following information: the size of the current conversion unit, the shape of the current conversion unit, the coordinates of the SRCC scanning area, and the number of coefficients in the SRCC scanning area.
[0153] In some embodiments of the present application, based on the above embodiments, the method is applied to coding blocks that meet preset coding conditions, and the coding blocks of the preset coding conditions include: coding blocks in transform skip mode; or, coding blocks with a picture-level intra-frame prediction transform skip allow flag value of 1; or, coding blocks with a picture-level inter-frame prediction transform skip allow flag value of 1; or, coding blocks with both the picture-level intra-frame prediction transform skip allow flag value and the picture-level inter-frame prediction transform skip allow flag value of 1; or, all coding blocks.
[0154] Fig.12 FIG. 2 shows a structural block diagram of a video encoding device in one embodiment of the present application. Fig.12 As shown, the video encoding device 1200 may mainly include:
[0155] The coefficient segmentation module 1210 is configured to segment the coefficients to be encoded in the coding block of the video image frame according to the scanning order of the coefficient coding SRCC scanning area based on the scanning area, and obtain a coefficient segment composed of multiple coefficients;
[0156] The first encoding module 1220 is configured to determine a value of the coefficient segment all-zero flag according to whether all coefficients in the coefficient segment are zero, and encode the coefficient segment all-zero flag;
[0157] The second encoding module 1230 is configured to, if the value of the coefficient segment all-zero flag is a preset first value, encode the valid flag of each coefficient in each coefficient segment in sequence according to the scanning order, wherein the valid flag is used to indicate whether the coefficient is a non-zero coefficient;
[0158] The encoding skip module 1240 is configured to skip encoding the valid flags of each coefficient in the coefficient segment if the value of the coefficient segment all-zero flag is a preset second value.
[0159] The specific details of the video decoding device provided in each embodiment of the present application have been described in detail in the corresponding method embodiments and will not be repeated here.
[0160] Fig.13 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.
[0161] It should be noted that Fig.13 The computer system 1300 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0162] like Fig.13 As shown, the computer system 1300 includes a central processing unit 1301 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 1302 (ROM) or the program loaded from the storage part 1308 to the random access memory 1303 (RAM). Various programs and data required for system operation are also stored in the random access memory 1303. The central processing unit 1301, the read-only memory 1302 and the random access memory 1303 are connected to each other through a bus 1304. The input / output interface 1305 (Input / Output interface, i.e., I / O interface) is also connected to the bus 1304.
[0163] The following components are connected to the input / output interface 1305: an input section 1306 including a keyboard, a mouse, etc.; an output section 1307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a LAN card, a modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the input / output interface 1305 as needed. A removable medium 1313, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1310 as needed so that a computer program read therefrom is installed into the storage section 1308 as needed.
[0164] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1309, and / or installed from the removable medium 1313. When the computer program is executed by the central processor 1301, various functions defined in the system of the present application are executed.
[0165] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0166] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0167] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0168] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0169] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.
[0170] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A video decoding method, characterized in that: include: In a coding block of a video image frame, coefficients to be decoded are segmented according to a scanning order of a scanning area based on a coefficient coding SRCC scanning area to obtain a coefficient segment consisting of a plurality of coefficients; Decoding a coefficient segment all-zero flag of the coefficient segment to obtain a value of the coefficient segment all-zero flag, wherein the coefficient segment all-zero flag is used to indicate whether all coefficients in the coefficient segment are zero; If the value of the coefficient segment all-zero flag is a preset first value, then decoding the valid flag of each coefficient in the coefficient segment in sequence according to the scanning order, the valid flag being used to indicate whether the coefficient is a non-zero coefficient; If the value of the coefficient segment all-zero flag is a preset second value, the decoding of the valid flag is skipped, and the valid flags of the coefficients in the coefficient segment are all assigned a value of zero.
2. The video decoding method according to claim 1, characterized in that: The coefficients to be decoded are processed in segments according to the scanning order of the SRCC scanning area, including: Obtaining a coefficient segment length, where the coefficient segment length is used to represent a maximum number of coefficients included in the coefficient segment; The continuous coefficients to be decoded are determined in sequence according to the scanning order of the SRCC scanning area, and the coefficients whose number is equal to or less than the coefficient segment length are grouped into a coefficient segment.
3. The video decoding method according to claim 2, characterized in that: The coefficient segment length is a constant determined according to a maximum transform unit size or a dynamic parameter determined according to property information of the coding block.
4. The video decoding method according to claim 3, characterized in that: The attribute information of the coding block includes at least one of the following information: a size of a current conversion unit, a shape of the current conversion unit, a coordinate of a SRCC scanning area, and a number of coefficients in the SRCC scanning area.
5. The video decoding method according to claim 1, characterized in that: Decoding the coefficient segment all-zero flag of the coefficient segment, comprising: Determine whether the decoding method of the coefficient segmented all-zero flag is bypass decoding or conventional decoding; If it is determined that the decoding method of the coefficient segmented all-zero flag is bypass decoding, the coefficient absolute value threshold flag is decoded by a bypass decoding engine; If it is determined that the decoding method of the coefficient segment all-zero flag is conventional decoding, the coefficient segment all-zero flag is decoded by a conventional decoding engine based on a context model.
6. The video decoding method according to claim 5, characterized in that: The coefficient segment all-zero flag is decoded by a conventional decoding engine based on a context model, including: Acquire a model selection method corresponding to the SRCC scanning area, and determine a context index increment according to the model selection method; Selecting a context model corresponding to the coefficient piecewise all-zero flag according to the context index increment; Based on the selected context model, the coefficient piecewise all-zero flag is arithmetically decoded by a conventional decoding engine.
7. The video decoding method according to claim 6, characterized in that: Determining the context index increment according to the model selection method includes: If the model selection mode is the first mode, the context index is incrementally assigned a value according to the shape of the SRCC scanning area; If the model selection mode is the second mode, the context index is incrementally assigned a value according to the area of the SRCC scanning area; If the model selection method is the third mode, the context index is incrementally assigned a value according to a preset first value.
8. The video decoding method according to claim 7, characterized in that: Incrementally assigning a value to the context index according to the shape of the SRCC scan area includes: Obtaining the area width and area height of the SRCC scanning area; Assigning an initial value of the context index increment according to a numerical relationship between the region width and the region height; Assigning an initial value increment of the context index increment according to a numerical proportional relationship between the region width and the region height; The context index is incrementally assigned a value according to the initial value and the initial value increment.
9. The video decoding method according to claim 8, characterized in that: Assigning an initial value of the context index increment according to a numerical relationship between the region width and the region height includes: If the region width and the region height are equal in value, assigning a preset second value as the initial value of the context index increment; If the region width is smaller than the region height, assigning a preset third value as an initial value of the context index increment; If the region width is greater than the region height, a preset fourth value is assigned as the initial value of the context index increment.
10. The video decoding method according to claim 8, characterized in that: Assigning an initial value increment of the context index increment according to a numerical proportional relationship between the region width and the region height, including: Calculate the numerical ratio between the larger value and the smaller value of the area width and the area height; The numerical ratio is compared with a plurality of preset ratio thresholds to assign an initial value increment of the context index increment according to the comparison result.
11. The video decoding method according to claim 8, characterized in that: Incrementally assigning a value to the context index according to the initial value and the initial value increment includes: If the region width is equal to the region height, the context index is incrementally assigned with the initial value; If the region width and the region height are not equal in value, the context index increment is assigned a value that is a sum of the initial value and the initial value increment.
12. The video decoding method according to claim 7, characterized in that: Incrementally assigning a value to the context index according to the area of the SRCC scan area includes: Obtaining the area width and area height of the SRCC scanning area; Determine the area of the SRCC scanning area according to the area width and the area height; The area of the region is compared with a plurality of preset area thresholds to assign an incremental value to the context index according to the comparison result.
13. The video decoding method according to any one of claims 1 to 12, characterized in that: Before decoding the coefficient segment all-zero flag of the coefficient segment, the method further includes: Determining whether a preset decoding skip condition is met; If the decoding skip condition is met, the decoding step of the coefficient segmented all-zero flag is skipped, and the preset second value is used as the value of the coefficient segmented all-zero flag.
14. The video decoding method according to claim 13, characterized in that: The decoding skipping condition includes at least one of the following conditions: The number of coefficients in the coefficient segment is less than a preset number threshold; The area ratio of the SRCC scanning area in the coding block is less than a preset ratio threshold.
15. The video decoding method according to any one of claims 1 to 12, characterized in that: If there is a specific coefficient segment whose number of coefficients is less than the coefficient segment length, the specific coefficient segment is located at a specific position of the SRCC scanning area.
16. The video decoding method according to claim 15, characterized in that: The particular coefficient segment is the first coefficient segment or the last coefficient segment in the scanning order.
17. The video decoding method according to any one of claims 1 to 12, characterized in that: The method is applied to a coding block that meets a preset coding condition, and the coding block that meets the preset coding condition includes: Transform skip mode coding blocks; Alternatively, the picture-level intra-frame prediction transform skips the coding blocks whose flag value is 1; Alternatively, the picture-level inter-frame prediction transform skips the coding blocks whose flag value is 1; Or, a coding block whose values of the picture-level intra-frame prediction transform skip enable flag and the picture-level inter-frame prediction transform skip enable flag are both 1; Or, all encoding blocks.
18. A video encoding method, characterized in that: include: In a coding block of a video image frame, a coefficient to be coded is segmented according to a scanning order of a scanning area based on a coefficient coding SRCC scanning area, so as to obtain a coefficient segment composed of a plurality of coefficients; Determining a value of the coefficient segment all-zero flag according to whether all coefficients in the coefficient segment are zero, and encoding the coefficient segment all-zero flag; If the value of the coefficient segment all-zero flag is a preset first value, then encoding the valid flag of each coefficient in each coefficient segment in sequence according to the scanning order, wherein the valid flag is used to indicate whether the coefficient is a non-zero coefficient; If the value of the coefficient segment all-zero flag is a preset second value, the encoding of the valid flags of each coefficient in the coefficient segment is skipped.
19. A video decoding device, characterized in that: include: A coefficient segmentation module is configured to segment coefficients to be decoded in a coding block of a video image frame according to a scanning order of an SRCC scanning area to obtain a coefficient segment consisting of a plurality of coefficients; A first decoding module is configured to decode a coefficient segment all-zero flag of the coefficient segment to obtain a value of the coefficient segment all-zero flag, wherein the coefficient segment all-zero flag is used to indicate whether all coefficients in the coefficient segment are zero; A second decoding module is configured to decode the valid flag of each coefficient in the coefficient segment in sequence according to a scanning order if the value of the coefficient segment all-zero flag is a preset first value, wherein the valid flag is used to indicate whether the coefficient is a non-zero coefficient; The coefficient assignment module is configured to skip decoding the valid flag if the value of the coefficient segment all-zero flag is a preset second value, and assign the valid flags of each coefficient in the coefficient segment to zero.
20. A video encoding device, characterized in that: include: The coefficient segmentation module is configured to segment the coefficients to be encoded in the coding block of the video image frame according to the scanning order of the coefficient coding SRCC scanning area based on the scanning area, so as to obtain a coefficient segment composed of a plurality of coefficients; A first encoding module is configured to determine a value of the coefficient segment all-zero flag according to whether all coefficients in the coefficient segment are zero, and encode the coefficient segment all-zero flag; A second encoding module is configured to, if the value of the coefficient segment all-zero flag is a preset first value, encode the valid flag of each coefficient in each coefficient segment in sequence according to the scanning order, wherein the valid flag is used to indicate whether the coefficient is a non-zero coefficient; The encoding skip module is configured to skip encoding the valid flags of each coefficient in the coefficient segment if the value of the coefficient segment all-zero flag is a preset second value.
21. A computer readable medium having a computer program stored thereon, wherein the computer program implements the method according to any one of claims 1 to 18 when executed by a processor.
22. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 18 by executing the executable instructions.
23. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 18 is implemented.
Citation Information
Patent Citations
Multi-level significance map scanning
CN103124349A
Decoding method, encoding method and device
CN110708552A
Multi-level significance maps for encoding and decoding
US20130107969A1