Video encoding method and video decoding method, video encoding apparatus and video decoding apparatus, computer readable medium, and electronic device
By determining the transform mode for chroma blocks based on luma block modes using explicit and implicit flags, the method addresses the inflexibility of single DCT kernels, enhancing video encoding and decoding efficiency.
Patent Information
- Application Number
- US19/750513
- Authority / Receiving Office
- US · United States
- Patent Type
- Applications(United States)
- Current Assignee / Owner
- Priority Date
- 2024-03-14
- Filing Date
- 2026-07-22
- Publication Date
- 2026-11-26
AI Technical Summary
Existing video encoding technologies face challenges in adapting to diverse residual characteristics due to the use of a single discrete cosine transform (DCT) kernel, leading to reduced flexibility and efficiency in transform mode selection for chroma blocks.
Determine the transform mode for a chroma block based on the transform mode for a luma block, using both explicit and implicit flags in the bitstream information, to improve selection flexibility and enhance encoding and decoding efficiency.
This approach enhances the adaptability of transform modes for chroma blocks, reducing the encoding index flag amount and improving overall video encoding and decoding efficiency.
Smart Images

Figure US20260379991A1-D00000_ABST
Abstract
Description
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application is a continuation application of PCT Patent Application No. PCT / CN2025 / 076945, entitled “VIDEO ENCODING METHOD AND VIDEO DECODING METHOD, VIDEO ENCODING APPARATUS AND VIDEO DECODING APPARATUS, COMPUTER READABLE MEDIUM, AND ELECTRONIC DEVICE” filed on Feb. 12, 2025, which claims priority to Chinese Patent Application No. 2024102971545, entitled “VIDEO ENCODING METHOD AND VIDEO DECODING METHOD, VIDEO ENCODING APPARATUS AND VIDEO DECODING APPARATUS, COMPUTER READABLE MEDIUM, AND ELECTRONIC DEVICE” filed with the China National Intellectual Property Administration on Mar. 14, 2024, both of which are incorporated by reference in their entirety.FIELD OF THE TECHNOLOGY
[0002] This application relates to the field of computer and communication technologies, and in particular, to a video encoding method and a video decoding method, a video encoding apparatus and a video decoding apparatus, a computer readable medium, and an electronic device.BACKGROUND OF THE DISCLOSURE
[0003] In a video encoding process, an encoder side usually needs to perform transform, quantization, and entropy encoding on residual data between original video data and predicted video data, and transmits the residual data to a decoder side. In addition, correlations of some residuals are weak, and therefore a transform process may be skipped. Because of diversity of the residual data, a single discrete cosine transform (DCT) transform kernel cannot adapt to all residual characteristics. Therefore, for one residual block, a plurality of DCT transform kernels or discrete sine transform (DST) transform kernels may need to be selected as a transform matrix combination.SUMMARY
[0004] Embodiments of this application provide a video encoding method and a video decoding method, a video encoding apparatus and a video decoding apparatus, a computer readable medium, and an electronic device, to improve selection flexibility of a transform mode for a chroma block, and facilitate improvement of video encoding and decoding efficiency.
[0005] Other features and advantages of this application become clear through the following detailed descriptions or are partially learned through practice of this application.
[0006] According to an aspect of the embodiments of this application, a video decoding method is provided, including: decoding a video bitstream to obtain bitstream information; determining a quantization coefficient block corresponding to a luma block; determining an implicit export flag based on a sum of at least two quantization coefficients in a specified region in the quantization coefficient block; determining a transform mode for the luma block based on the implicit export flag; determining a transform mode for a chroma block based on the transform mode for the luma block; and performing inverse transform on an inverse quantization result of the luma block based on the transform mode for the luma block, and performing inverse transform on an inverse quantization result of the chroma block based on the transform mode for the chroma block.
[0007] According to an aspect of the embodiments of this application, a non-transitory computer readable medium is provided, having a video bitstream stored therein. An electronic device is configured to perform the aforementioned video decoding method on the video bitstream.
[0008] According to an aspect of the embodiments of this application, an electronic device is provided, including: one or more processors; and a storage apparatus, configured to store one or more computer programs, the one or more computer programs, when executed by the one or more processors, causing the electronic device to implement the video decoding method according to the foregoing embodiments.
[0009] According to an aspect of the embodiments of this application, a computer program product is provided, including a computer program, the computer program being stored in a computer readable storage medium. A processor of an electronic device reads the computer program from the computer readable storage medium and executes the computer program, to cause the electronic device to perform the video encoding method or the video decoding method provided in the foregoing embodiments.
[0010] According to still another aspect of the embodiments of this application, a method for storing or transmitting a video bitstream is provided, the video bitstream being generated by the video encoding method or being decoded by the video decoding method.
[0011] In the technical solutions provided in some embodiments of this application, a transform mode for a chroma block is determined based on a transform mode for a luma block after the transform mode for the luma block is determined, then inverse transform is performed on an inverse quantization result corresponding to the luma block based on the transform mode for the luma block, and inverse transform is performed on an inverse quantization result corresponding to the chroma block based on the transform mode for the chroma block, so that the transform mode for the chroma block may be determined based on the transform mode for the luma block without using only a fixed and single transform mode, thereby improving selection flexibility of the transform mode for the chroma block, and facilitating improvement of video encoding and decoding efficiency.
[0012] The foregoing general descriptions and the following detailed descriptions are merely exemplary and explanatory, and cannot limit this application.BRIEF DESCRIPTION OF THE DRAWINGS
[0013] FIG. 1 is a schematic diagram of an exemplary system architecture to which technical solutions in embodiments of this application can be applied.
[0014] FIG. 2 is a schematic diagram of a placement manner of a video encoding apparatus and a video decoding apparatus in a streaming transmission system.
[0015] FIG. 3 is a basic flowchart of a video encoder.
[0016] FIG. 4 is a scan region marked by using an SRCC technology.
[0017] FIG. 5 is a schematic diagram of an order of scanning a marked scan region.
[0018] FIG. 6 is a schematic diagram of a transform combination in a sub-block transform technology.
[0019] FIG. 7 is a flowchart of a video decoding method according to some embodiments of this application.
[0020] FIG. 8 is a schematic diagram of a partitioning manner for a specified region according to some embodiments of this application.
[0021] FIG. 9 is a schematic diagram of a partitioning manner for a specified region according to some embodiments of this application.
[0022] FIG. 10 is a schematic diagram of a partitioning manner for a specified region according to some embodiments of this application.
[0023] FIG. 11 is a flowchart of a video encoding method according to some embodiments of this application.
[0024] FIG. 12 is a block diagram of a video decoding apparatus according to some embodiments of this application.
[0025] FIG. 13 is a block diagram of a video encoding apparatus according to some embodiments of this application.
[0026] FIG. 14 is a schematic diagram of a structure of a computer system applicable to implement an electronic device according to an embodiment of this application.DESCRIPTION OF EMBODIMENTS
[0027] Exemplary implementations are described more comprehensively below with reference to the accompanying drawings. However, the exemplary implementations may be implemented in various forms, and are not to be understood as being limited to these examples. Instead, the implementations are provided to make this application more thorough and complete, and fully convey the idea of the exemplary implementations to a person skilled in the art.
[0028] In addition, the features, structures or characteristics described in this application may be combined in one or more embodiments in any appropriate manner. The following descriptions have many specific details, so that embodiments of this application can be fully understood. However, a person skilled in the art is to be aware that technical solutions of this application may be implemented without using all detailed features in the embodiments, one or more specific details may be omitted, or other methods, elements, apparatuses, operations, or the like may be used.
[0029] In the embodiments of this application, the term “module” or “unit” refers to a computer program having a predetermined function or a part of a computer program, and works together with other relevant parts to achieve a predetermined objective, and may be completely or partially implemented by using software, hardware (for example, a processing circuit or a memory), or a combination thereof. Similarly, one processor (or a plurality of processors or memories) may be configured to implement one or more modules or units. In addition, each module or unit may be a part of an overall module or unit including a function of the module or the unit.
[0030] Block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. To be specific, these functional entities may be implemented in a software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor apparatuses and / or microcontroller apparatuses.
[0031] Flowcharts shown in the accompanying drawings are merely exemplary descriptions, do not necessarily include all content and operations / steps, and are not necessarily performed in the described sequences either. For example, some operations / steps may be further divided, while some operations / steps may be combined or partially combined. Therefore, an actual performing sequence may change based on an actual situation.
[0032] “A plurality of” mentioned in this specification means two or more. “And / or” describes an association relationship between associated objects and represents that three relationships may exist. For example, A and / or B may represent the following three cases: only A exists, both A and B exist, and only B exists. The character “ / ” indicates an “or” relationship between the associated objects.
[0033] FIG. 1 is a schematic diagram of an exemplary system architecture to which technical solutions in embodiments of this application can be applied.
[0034] As shown in FIG. 1, a system architecture 100 includes a plurality of terminal apparatuses. The plurality of terminal apparatuses may communicate with each other through, for example, a network 150. For example, the system architecture 100 may include a first terminal apparatus 110 and a second terminal apparatus 120 that are interconnected through the network 150. In the embodiment shown in FIG. 1, the first terminal apparatus 110 and the second terminal apparatus 120 perform unidirectional data transmission.
[0035] For example, the first terminal apparatus 110 may encode video data (for example, a video picture stream acquired by the terminal apparatus 110) to transmit the video data to the second terminal apparatus 120 through the network 150. The encoded video data is transmitted in a form of one or more encoded video bitstreams. The second terminal apparatus 120 may receive the encoded video data from the network 150, decode the encoded video data to restore the video data, and display video pictures based on the restored video data.
[0036] In some embodiments of this application, the system architecture 100 may include a third terminal apparatus 130 and a fourth terminal apparatus 140 that perform bidirectional transmission of the encoded video data. The bidirectional transmission, for example, may occur during a video conference. For the bidirectional data transmission, one of the third terminal apparatus 130 and the fourth terminal apparatus 140 may encode video data (for example, a video picture stream acquired by the terminal apparatus) to transmit the encode video data to the other one of the third terminal apparatus 130 and the fourth terminal apparatus 140 through the network 150. One of the third terminal apparatus 130 and the fourth terminal apparatus 140 may further receive the encoded video data transmitted by the other one of the third terminal apparatus 130 and the fourth terminal apparatus 140, decode the encoded video data to restore the video data, and display video pictures on an accessible display apparatus based on the restored video data.
[0037] In the embodiment of FIG. 1, the first terminal apparatus 110, the second terminal apparatus 120, the third terminal apparatus 130, and the fourth terminal apparatus 140 may be servers, personal computers, and smartphones, but the principles disclosed in this application are not limited thereto. The embodiments disclosed in this application are applicable to a laptop computer, a tablet computer, a media player, and / or a dedicated video conference device. The network 150 represents any quantity of networks for transmitting the encoded video data between the first terminal apparatus 110, the second terminal apparatus 120, the third terminal apparatus 130, and the fourth terminal apparatus 140, and includes, for example, a wired and / or wireless communication network. The communication network 150 may exchange data in a circuit switching and / or packet-switching channel. The network may include a telecommunication network, a local area network, a wide area network, and / or the Internet.
[0038] In some embodiments of this application, FIG. 2 shows a placement manner of a video encoding apparatus and a video decoding apparatus 200 in a streaming transmission environment. The subject disclosed in this application may be equally applicable to other applications supporting a video, including, for example, a video conference, a digital television (TV), and a compressed video stored on a digital medium including a CD, a DVD, a storage stick, and the like.
[0039] A streaming system may include an acquisition subsystem 213. The acquisition subsystem 213 may include a video source 201 like a digital camera. The video source creates an uncompressed video picture stream 202. In this embodiment, the video picture stream 202 includes samples captured by the digital camera. Compared with encoded video data 204 (or an encoded video bitstream 204), the video picture stream 202 is depicted as a bold line to emphasize a video picture stream with a high data volume. The video picture stream 202 may be processed by an electronic apparatus 220. The electronic apparatus 220 includes a video encoding apparatus 203 coupled to the video source 201. The video encoding apparatus 203 may include hardware, software, or a combination of software and hardware, to implement or perform aspects of the disclosed subject described in more detail below. Compared with the video picture stream 202, the encoded video data 204 (or the encoded video bitstream 204) is depicted as a thin line to emphasize the encoded video data 204 (or the encoded video bitstream 204) with a low data volume, which may be stored on a streaming transmission server 205 for future use. One or more streaming transmission client subsystems, for example, a client subsystem 206 and a client subsystem 208 in FIG. 2, may access the streaming transmission server 205 to retrieve a copy 207 and a copy 209 of the encoded video data 204. The client subsystem 206 may include, for example, a video decoding apparatus 210 in an electronic apparatus 230. The video decoding apparatus 210 decodes the input copy 207 of the encoded video data, and generates an outputted video picture stream 211 that may be displayed on a display 212 (for example, a display screen) or another display apparatus. In some streaming transmission systems, the encoded video data 204, video data 207, and video data 209 (for example, a video bitstream) may be encoded based on some video encoding / compression standards.
[0040] The electronic device 220 and the electronic device 230 may include other components not shown in the figure. For example, the electronic apparatus 220 may include a video decoding apparatus, and the electronic apparatus 230 may further include a video encoding apparatus.
[0041] In some embodiments of this application, international video coding standards like high efficiency video coding (HEVC) and versatile video coding (VVC) and the Chinese national video coding standard like an audio video coding standard (AVS) are used as examples. After a video frame image is input, the video frame image is partitioned into a plurality of non-overlapping processing units based on a block size, and a similar compression operation is performed on each processing unit. The processing unit is referred to as a coding tree unit (CTU) or a largest coding unit (LCU). The CTU may be further partitioned more finely into one or more basic coding units (CU). The CU is a most basic element in a coding process.
[0042] The following describes some concepts during coding of the CU.
[0043] Predictive coding: The predictive coding includes manners such as intraframe prediction and interframe prediction. After an original video signal is predicted by using a selected reconstructed video signal, a residual video signal is obtained. An encoder side needs to determine a predictive coding mode to be selected for a current CU, and inform a decoder side. The intraframe prediction refers to the fact that a predicted signal comes from a coded reconstructed region in the same image; and the interframe prediction refers to that a predicted signal comes from a coded image (referred to as a reference image) that is different from a current image.
[0044] Transform & Quantization: The residual video signal is transformed into a transform domain through a transform operation such as discrete Fourier transform (DFT) or discrete cosine transform (DCT), to generate a transform coefficient. A lossy quantization operation is further performed on the transform coefficient, which loses a specific amount of information, so that a quantized signal is conductive to compressed expression. In some video coding standards, more than one transform mode may be selected. Therefore, the encoder side also needs to select one of the transform modes for the current CU, and inform the decoder side. Fineness of quantization is determined by a quantization parameter (QP). A larger QP indicates that coefficients within a larger value range are quantized to the same output, which usually causes larger distortion and a lower bit rate. On the contrary, a smaller QP indicates that coefficients within a smaller value range are quantized to the same output, which usually causes smaller distortion and a higher bit rate.
[0045] Entropy coding or statistical coding: Statistical compression coding is performed on the quantized signal in the transform domain based on a frequency of occurrence of each value, and finally a binarized (0 or 1) compressed bit stream is outputted. In addition, entropy coding also needs to be performed on other information generated through coding, for example, a selected coding mode and motion vector data, to reduce the bit rate. Statistical coding is a lossless coding mode that can effectively reduce a bit rate required to express the same signal. A common statistical coding mode includes variable length coding (VLC) or context adaptive binary arithmetic coding (CABAC).
[0046] A process of CABAC includes 3 operations: binarization, context modeling, and binary arithmetic coding. After binarization is performed on an input syntactic element, binary data may be coded in a normal coding mode and a bypass coding mode. The bypass coding mode does not need to assign a specific probability model to each binary bit, and an input binary bit bin value is directly coded by using a simple bypass coder to accelerate an entire coding and decoding process. In general, different syntax elements are not completely independent, and the same syntax element has a memory property. Therefore, according to a conditional entropy theory, using other coded syntax elements for conditional coding can further improve coding performance compared with independent coding or memoryless coding. Such coded symbolic information that is used as a condition is referred to as a context. In a regular coding mode, binary bits of a syntax element sequentially enter a context modeler. The coder assigns a proper probability model for each input binary bit based on a value of a previously coded syntax element or binary bit. This process is referred to as context modeling. A context model corresponding to a syntax element may be located based on a context index increment (ctxIdxInc) and a context index start (ctxIdxStart). After the bin value and the assigned probability model are input together into a binary arithmetic coder for coding, the context model needs to be updated based on the bin value. This is an adaptive process during coding.
[0047] Loop Filtering: a reconstructed image is obtained by performing operations of inverse quantization, inverse transform, and predictive compensation on a transformed and quantized signal. The reconstructed image has some information different from that in an original image as a result of quantization, that is, the reconstructed image may cause distortion. Therefore, a filtering operation may be performed on the reconstructed image. For example, filters such as a deblocking filter (DB), a sample adaptive offset (SAO) filter, or an adaptive loop filter (ALF) are used so that a degree of distortion caused by quantization may be effectively reduced. Because the filtered reconstructed images are to be used as a reference for a subsequently coded image to predict a future image signal, the foregoing filtering operation is alternatively referred to as loop filtering, namely, a filtering operation in a coding loop.
[0048] In some embodiments of this application, FIG. 3 is a basic flowchart of a video encoder. In this procedure, intraframe prediction is used as an example for description. A difference operation is performed on an original image signal Sk[x, y] and a predicted image signal ŝk[x, y] to obtain a residual signal uk[x, y]. Transform and quantization are performed on the residual signal uk[x, y] to obtain a quantization coefficient. The quantization coefficient is subjected to entropy coding to obtain an encoded bit stream, and is subjected to inverse quantization and inverse transform to obtain a reconstructed residual signal u′k[x, y]. The predicted image signal ŝk[x, y] is superimposed with the reconstructed residual signal u′k[x, y] to generate an image signalsk⋆[x,y].The image signalsk⋆[x,y]is input to an intraframe mode determining module and an intraframe prediction module for intraframe prediction processing, and is output as a reconstructed image signal s′k[x, y] through loop filtering. The reconstructed image signal s′k[x, y] may be used as a reference image for a next frame for motion estimation and motion compensation prediction. Then, a predicted image signal ŝk[x, y] of the next frame is obtained based on a motion compensation prediction result s′r[x+mx, y+my] and an intraframe prediction result f(s*k[x, y]). The foregoing process is repeated until encoding is completed.In addition, in a quantization coefficient block (or referred to as a quantization coefficient matrix) obtained by performing transform and quantization on the residual signal, non-zero coefficients are concentrated in left and upper regions of the block, and coefficients in right and lower regions of the block are usually 0. Therefore, an SRCC technology is introduced. A size SRx×SRy of an upper-left region of non-zero coefficients included in each quantization coefficient block (of which a size is W×H) may be marked by using the SRCC technology, where SRx is a horizontal coordinate of a rightmost non-zero coefficient in the quantization coefficient block, SRy is a vertical coordinate of a lowest non-zero coefficient in the quantization coefficient block, and 1≤SRx≤W, 1≤SRy≤H, while all coefficients outside the region are 0. In the SRCC technology, a quantization coefficient region that needs to be scanned is determined in a quantization coefficient block by using (SRx, SRy). As shown in FIG. 4, only quantization coefficients in the scan region marked by (SRx, SRy) need to be encoded. As shown in FIG. 5, an encoding scanning order may be scanning from a lower-right corner to an upper-left corner according to a reverse character “Z”.Based on the foregoing encoding process, on a decoder side, for each CU, after a compressed bitstream (namely, a bit stream) is obtained, entropy decoding is performed to obtain various mode information and quantization coefficients. Then, inverse quantization and inverse transform are performed on the quantization coefficient to obtain a residual signal. Moreover, a predicted signal corresponding to the CU may be obtained based on known encoding mode information. Then the residual signal and the predicted signal may be added together to obtain a reconstructed signal. Then operations like loop filtering are performed on the reconstructed signal to generate a final output signal.In the foregoing encoding and decoding process, transform performed on the residual signal causes energy of the residual signal to be concentrated in fewer low-frequency coefficients, that is, most coefficient values are small. Then, after processing by a subsequent quantization module, the small coefficient values become zero, which reduces a price of encoding the residual signal. However, because of diversity of residual distribution, single DCT transform cannot adapt to all residual characteristics. Therefore, transform kernels such as DST7 and DCT8 are introduced into a transform process, and horizontal transform and vertical transform may be performed on the residual signal by using different transform kernels. An adaptive multiple core transform (AMT) technology is used as an example. Transform combinations selected for performing transform on a residual signal are as follows: (DCT2, DCT2), (DCT8, DCT8), (DCT8, DST7), (DST7, DCT8), and (DST7, DST7).
[0052] In addition, for an interframe coding mode, a sub-block transform (SBT) technology is also mentioned in AVS3. In SBT, eight sub-block partitioning results exist, and transform encoding is only performed on a gray part (a non-zero residual sub-block) in a sub-block, while a white part (a zero residual sub-block) is forcibly cleared. For selection of a transform combination of the sub-block, when a width or a height of a non-zero residual sub-block is 64, transform kernels for horizontal and vertical transform of the non-zero residual sub-block are both DCT2. In other cases, selection for the horizontal and vertical transform is shown in FIG. 6. In FIG. 6, horizontal transform and vertical transform encoding are performed on the gray part in the sub-block based on a marked transform mode, and the white part is forcibly cleared. w1 in FIG. 6 may be ½ of w (width), or may be ¼ of w; and h1 may be ½ of h, or may be ¼ of h.
[0053] In addition, in some solutions, transform is skipped in a residual encoding process of the gray part, and quantization and coefficient encoding are directly performed.
[0054] A specific transform combination for the residual signal need be determined on an encoder side through rate-distortion optimization (RDO). In addition, correlations of some residuals are weak, and therefore a transform process may be skipped. Because of diversity of residual data, a single DCT transform kernel cannot adapt to all residual characteristics. Therefore, for one residual block, a plurality of DCT transform kernels or DST transform kernels may need to be selected as a transform matrix combination. In this case, although adaptability of the transform matrix combination to the residual block is improved, an encoding amount of a transform mode index is increased, leading to low encoding efficiency. In addition, in the related technology, only DCT2 can be used for transform of a chroma block, which not only has poor flexibility, but also reduces encoding efficiency.
[0055] Based on the foregoing problem, an embodiment of this application provides a new video encoding and decoding method. On one hand, a transform mode for a chroma block may be determined based on a transform mode for a luma block without using only a fixed and single transform mode, so that selection flexibility of the transform mode for the chroma block can be improved, thereby improving video encoding and decoding efficiency. On the other hand, the transform mode for the luma block may be determined in an implicit manner, so that an encoding amount of an index flag may be reduced when more transform modes are indicated, thereby further improving video encoding efficiency.
[0056] Implementation details of the technical solutions in the embodiments of this application are described in detail below.
[0057] FIG. 7 is a flowchart of a video decoding method according to some embodiments of this application. The video decoding method may be performed by a device having a computing function, for example, may be performed by a terminal device or a server. As shown in FIG. 7, the video decoding method includes at least operation S710 to operation S730. A detailed description is as follows.
[0058] Operation S710: Decode a video bitstream to obtain bitstream information, and determine a transform mode for a luma block based on the bitstream information obtained through decoding.
[0059] In some embodiments of this application, a video includes a video image frame sequence, and the video image frame sequence includes a series of images. Each of the images may be further partitioned into slices. Each of the slices may be further partitioned into a series of LCUs (or CTUs). An LCU includes a plurality of CUs. The video image frame is encoded by using a block as a unit during encoding. In some new video coding standards, for example, in the H.264 standard, a macroblock (MB) is provided. The macroblock may be further partitioned into a plurality of prediction blocks that may be configured for predictive encoding. In the HEVC standard, basic concepts such as a coding unit (CU), a prediction unit (PU), and a transform unit (TU) are used, various block units are defined in terms of function, and a brand-new tree-based structure is used for description. For example, the CU may be partitioned into smaller CUs based on a quadtree, and the smaller CUs may further be partitioned, to form a quadtree structure. In this embodiment of this application, the luma block may be a CU or a block smaller than the CU, for example, the smaller blocks obtained by partitioning the CU.
[0060] The luma block focuses on luminance information of an image and includes a main visual feature of the image. A chroma block focuses on color information of the image and describes a color difference of different pixels in the image. The chroma block is closely correlated to the luma block, and a partitioning manner thereof is usually determined by a corresponding luma block. For example, if the luma block is partitioned into 8×16, and a corresponding chroma block is partitioned into 4×8. The chroma block is half of the luma block in both vertical and horizontal dimensions. This is because human eyes have higher sensitivity to the luminance information than chrominance information.
[0061] In some embodiments of this application, the transform mode for the luma block may be determined based on an explicit flag included in the bitstream information. For example, a correspondence between a value of the explicit flag and the transform mode may be preset, and then the transform mode for the luma block is determined based on the explicit flag included in the bitstream information.
[0062] In some embodiments, the explicit flag may occupy one or more bits. For example, if the explicit flag occupies one bit, when a bit value is 1, it may be determined that the transform mode is (DCT2, DCT2); or when a bit value is 0, it may be determined that the transform mode is (DST7, DST7). Alternatively, when a bit value is 1, it may be determined that the transform mode is (DCT2, DCT2); or when a bit value is 0, it may be determined that a transform skip mode or the like is used.
[0063] A 1st transform kernel in the transform mode indicates a transform kernel configured for horizontal transform, and a 2nd transform kernel indicates a transform kernel configured for vertical transform. For example, a transform mode (DCT8, DST7) indicates that horizontal transform is performed by using DCT8, and vertical transform is performed by using DST7.
[0064] If the explicit flag occupies a plurality of bits, the transform mode for the luma block may be determined based on a combination of the plurality of bits. An example in which the explicit flag occupies two bits is used for description.
[0065] As shown in Table 1, a correspondence between the explicit flag with two bits and the transform mode may be as follows:TABLE 1Bit 1 of the explicit flagBit 2 of the explicit flagTransform mode10(DST7, DST7)1(DCT8, DST7)0—(DCT2, DCT2)
[0066] In Table 1, a case in which the bit 1 is “0” and the bit 2 is “-” indicates that when a value of the bit 1 is 0, the transform mode is (DCT2, DCT2) regardless of a value of the bit 2. The values of the bit 1 and the bit 2 in Table 1 and corresponding transform modes are merely examples, and there may be other manners in other embodiments of this application, as shown in Table 2 and Table 3.TABLE 2Bit 1 of the explicit flagBit 2 of the explicit flagTransform mode0—SBT10(DST7, DST7)1(DCT2, DCT2)
[0067] In Table 2, a case in which the bit 1 is “0” and the bit 2 is “-” indicates that when a value of the bit 1 is 0, the transform mode is SBT regardless of a value of the bit 2.TABLE 3Bit 1 of the explicit flagBit 2 of the explicit flagTransform mode0—SBT10TS1(DCT2, DCT2)
[0068] In Table 3, a case in which the bit 1 is “0” and the bit 2 is “-” indicates that when a value of the bit 1 is 0, the transform mode is SBT regardless of a value of the bit 2. “TS” in Table 3 represents a transform skip mode, that is, a transform process is skipped during encoding, and an inverse transform process needs to be skipped during decoding.
[0069] The correspondence between the explicit flag with two bits and the transform mode listed in Table 1 to Table 3 is merely an example. In another embodiment of this application, the correspondence may be set based on an actual requirement, and the transform mode for the luma block may alternatively be indicated by using an explicit flag with more bits.
[0070] In some embodiments of this application, in addition to determining the transform mode for the luma block based on the explicit flag included in the bitstream information, a quantization coefficient block corresponding to the luma block may alternatively be determined based on the bitstream information, a value of an implicit export flag is exported or determined based on one quantization coefficient or a sum of at least two quantization coefficients in a specified region in the quantization coefficient block, and the transform mode for the luma block is determined based on the value of the implicit export flag.
[0071] When the transform mode for the luma block is determined based on the implicit export flag, the transform mode for the luma block may be determined based on the implicit export flag alone, or may be determined with reference to the implicit export flag and the explicit flag included in the bitstream information. The following separately provides descriptions.
[0072] In some embodiments of this application, if the transform mode for the luma block is determined based on the implicit export flag alone, the implicit export flag may occupy one or more bits. In this case, a transform mode corresponding to the implicit export flag may be selected as the transform mode for the luma block based on a correspondence between the implicit export flag and the transform mode (if the implicit export flag includes a plurality of bits, the correspondence is a correspondence between different arrangements and combinations of the plurality of bits and the transform mode).
[0073] For example, if the implicit export flag occupies one bit, when a bit value is 1, it may be determined that the transform mode is (DCT2, DCT2); or when a bit value is 0, it may be determined that the transform mode is (DST7, DST7). Alternatively, when a bit value is 1, it may be determined that the transform mode is (DCT2, DCT2); or when a bit value is 0, it may be determined that a transform skip mode or the like is used.
[0074] If the implicit export flag occupies a plurality of bits, the transform mode for the luma block may be determined based on a combination of the plurality of bits. An example in which the implicit export flag occupies two bits is used for description below.
[0075] As shown in Table 4, a correspondence between the implicit export flag with two bits and the transform mode may be as follows:TABLE 4Bit 1 of the implicitBit 2 of the implicitexport flagexport flagTransform mode10(DST7, DST7)1(DCT8, DST7)0—(DCT2, DCT2)
[0076] In Table 4, a case in which the bit 1 is “0” and the bit 2 is “-” indicates that when a value of the bit 1 is 0, the transform mode is (DCT2, DCT2) regardless of a value of the bit 2. The values of the bit 1 and the bit 2 in Table 4 and corresponding transform modes are merely examples, and there may be other manners in other embodiments of this application, as shown in Table 5 and Table 6.TABLE 5Bit 1 of the implicitBit 2 of the implicitexport flagexport flagTransform mode0—SBT10(DST7, DST7)1(DCT2, DCT2)
[0077] In Table 5, a case in which the bit 1 is “0” and the bit 2 is “-” indicates that when a value of the bit 1 is 0, the transform mode is SBT regardless of a value of the bit 2.TABLE 6Bit 1 of the implicitBit 2 of the implicitexport flagexport flagTransform mode0—SBT10TS1(DCT2, DCT2)
[0078] In Table 6, a case in which the bit 1 is “0” and the bit 2 is “-” indicates that when a value of the bit 1 is 0, the transform mode is SBT regardless of a value of the bit 2. “TS” in Table 6 represents a transform skip mode, that is, a transform process is skipped during encoding, and an inverse transform process needs to be skipped during decoding.
[0079] The correspondence between the implicit export flag with two bits and the transform mode listed in Table 4 to Table 6 is merely an example. In another embodiment of this application, the correspondence may be set based on an actual requirement, and the transform mode for the luma block may alternatively be indicated by using an implicit export flag with more bits.
[0080] In some embodiments of this application, if the transform mode for the luma block is determined with reference to the implicit export flag and the explicit flag included in the bitstream information, the implicit export flag may occupy one or more bits, and the explicit flag included in the bitstream information may occupy one or more bits.
[0081] In some embodiments, when the transform mode for the luma block is determined based on the implicit export flag and the explicit flag in the bitstream information, the implicit export flag and the explicit flag may be combined based on a set arrangement combination, to generate a combination index, and then a transform mode corresponding to the combination index is selected as the transform mode for the luma block based on a correspondence between a value of the combination index and the transform mode.
[0082] In some embodiments, if both the implicit export flag and the explicit flag are of one bit, the set arrangement combination may be the explicit flag followed by the implicit export flag, or may be the implicit export flag followed by the explicit flag. That is, the combination index may be in a manner of “the explicit flag+the implicit export flag”, or may be in a manner of “the implicit export flag+the explicit flag”.
[0083] In some embodiments, if the implicit export flag occupies one bit and the explicit flag occupies two bits, the set arrangement combination may be the two bits of the explicit flag followed by the one bit of the implicit export flag, may be the one bit of the implicit export flag followed by the two bits of the explicit flag, or may be that the one bit of the implicit export flag is located between the two bits of the explicit flag. That is, the combination index may be in a manner of “a bit 1 of the explicit flag+a bit 2 of the explicit flag+the implicit export flag”, may be in a manner of “the implicit export flag+a bit 1 of the explicit flag+a bit 2 of the explicit flag”, or may be in a manner of “a bit 1 of the explicit flag+the implicit export flag+a bit 2 of the explicit flag”.
[0084] Similarly, if the implicit export flag has more bits, or the explicit flag has more bits, these bits may be combined based on the set arrangement combination.
[0085] In some embodiments, the correspondence between a value of the combination index and the transform mode in the foregoing embodiments may be preset based on the value of the combination index and a set transform mode. In some embodiments, the set transform mode includes at least one of the following: a transform matrix combination configured for performing horizontal transform and vertical transform, a SBT mode, and a transform skip mode. The transform skip mode is a (TS, TS) mode, that is, both horizontal transform and vertical transform are in TS modes.
[0086] In some embodiments, a transform kernel configured for the horizontal transform and a transform kernel configured for the vertical transform in the transform matrix combination may be selected from the following: a DCT2 transform kernel, a DCT5 transform kernel, a DCT8 transform kernel, a DST1 transform kernel, a DST7 transform kernel, and transform skip. For example, the transform matrix combination may be (DCT2, DCT2), (DCT8, DCT8), (DCT8, DST7), (DST7, DCT8), (DST7, DST7), (DCT2, TS), (TS, DCT2), or the like. A 1st transform kernel in the transformation matrix combination indicates the transform kernel configured for horizontal transform, and a 2nd transform kernel indicates the transform kernel configured for vertical transform. For example, the transformation matrix combination (DCT8, DST7) indicates that horizontal transform is performed by using DCT8, and vertical transform is performed by using DST7.
[0087] A specific example is used for description below. Assuming that there is an implicit export flag with one bit and an explicit flag with one bit, a correspondence between a combination index formed by the implicit export flag with one bit and the explicit flag with one bit and the transform mode may be as follows, as shown in Table 7:TABLE 7Bit 1 of the implicit exportflagBit 1 of the explicit flagTransform mode0—(DCT2, DCT2)10(DST7, DST7)11(DST7, DCT8)
[0088] In Table 7, a case in which the bit 1 of the implicit export flag is “0” and the bit 1 of the explicit flag is “-” indicates that when a value of the bit 1 of the implicit export flag is 0, the transform mode is (DCT2, DCT2) regardless of a value of the bit 1 of the explicit flag. The values of the bit 1 of the implicit export flag and the bit 1 of the explicit flag in Table 7 and corresponding transform modes are merely examples, and there may be other manners in other embodiments of this application, as shown in Table 8:TABLE 8Bit 1 of the implicit exportflagBit 1 of the explicit flagTransform mode0—(DCT2, DCT2)10(DST7, DST7)11(DCT8, DST7)
[0089] Assuming that there is an implicit export flag with one bit and an explicit flag with two bits, a correspondence between a combination index formed by the implicit export flag with one bit and the explicit flag with two bits and the transform mode may be as follows, as shown in Table 9:TABLE 9Bit 1 of the implicitBit 1 of theBit 2 of theexport flagexplicit flagexplicit flagTransform mode0——(DCT2, DCT2)11—(DST7, DST7)101(DST7, DCT8)100(DCT8, DST7)
[0090] In Table 9, a case in which the bit 1 of the implicit export flag is “0”, and the bit 1 and the bit 2 of the explicit flag each are “-” indicates that when a value of the bit 1 of the implicit export flag is 0, the transform mode is (DCT2, DCT2) regardless of values of the bit 1 and the bit 2 of the explicit flag. In Table 9, a case in which the bit 1 of the implicit export flag is “1”, the bit 1 of the explicit flag is “1”, and the bit 2 of the explicit flag is “-” indicates that when a value of the bit 1 of the implicit export flag is 1 and a value of the bit 1 of the explicit flag is 1, the transform mode is (DST7, DST7) regardless of a value of the bit 2 of the explicit flag.
[0091] The correspondence between the combination index and the transform mode listed in Table 7 to Table 9 is merely an example. In another embodiment of this application, the correspondence may be set based on an actual requirement, and the transform mode for the luma block may alternatively be indicated by using more bits.
[0092] In some embodiments of this application, when determining the value of the implicit export flag based on the quantization coefficient or the sum of the at least two quantization coefficients in the specified region in the quantization coefficient block corresponding to the luma block, the value of the implicit export flag may be determined based on parity of the quantization coefficient or the sum of the at least two quantization coefficients; or the value of the implicit export flag may be determined based on a remainder that is of the quantization coefficient or the sum of the at least two quantization coefficients and that is with respect to a set value.
[0093] In some embodiments, if the value of the implicit export flag is determined based on the parity, the value of the implicit export flag may be determined as 1 when the quantization coefficient or the sum of the at least two quantization coefficients is an odd number; and the value of the implicit export flag may be determined as 0 when the quantization coefficient or the sum of the at least two quantization coefficients is an even number. Certainly, if the quantization coefficient or the sum of the at least two quantization coefficients is an odd number, the value of the implicit export flag may alternatively be 0, and if the quantization coefficient or the sum of the at least two quantization coefficients is an even number, the value of the implicit export flag may be 1.
[0094] In some embodiments, if the value of the implicit export flag is determined based on the remainder that is of the quantization coefficient or the sum of the at least two quantization coefficients and that is with respect to the set value, the remainder that is of the quantization coefficient or the sum of the at least two quantization coefficients and that is with respect to the set value may be calculated, and then the value of the implicit export flag may be determined based on the remainder. In the technical solutions of this embodiment, the value of the implicit export flag is determined based on the remainder that is of the quantization coefficient or the sum of the at least two quantization coefficients and that is with respect to the set value, so that values of the implicit export flag may be more than two. For example, the set value may be 3. In this case, a remainder with respect to 3 may be 0, 1, and 2. Each remainder may correspond to a value of the implicit export flag. For example, the remainder may be directly used as the value of the implicit export flag.
[0095] In some embodiments, the at least two quantization coefficients may include all quantization coefficients in the specified region or some quantization coefficients in the specified region, and the sum of the at least two quantization coefficients may be calculated by using any one of the following methods.
[0096] When the at least two quantization coefficients include all the quantization coefficients in the specified region, a sum of values of all the quantization coefficients in the specified region may be calculated, and the sum of the values may be used as the sum of the at least two quantization coefficients. Alternatively, a sum of absolute values of all the quantization coefficients in the specified region may be calculated, and the obtained sum of the absolute values may be used as the sum of the at least two quantization coefficients. Alternatively,
[0097] when the at least two quantization coefficients include quantization coefficients of which values are odd numbers in the specified region, a sum of the quantization coefficients of which values are odd numbers in the specified region may be calculated, and the obtained sum of the values may be used as the sum of the at least two quantization coefficients. Alternatively, a sum of absolute values of the quantization coefficients of which the values are odd numbers in the specified region may be calculated, and the sum of the absolute values may be used as the sum of the at least two quantization coefficients. Alternatively,
[0098] when the at least two quantization coefficients include quantization coefficients of which values are even numbers or non-zero even numbers in the specified region, a sum of values of the quantization coefficients of which values are even numbers or non-zero even numbers in the specified region may be calculated, and the sum of the values may be used as the sum of the at least two quantization coefficients. Alternatively, a sum of absolute values of the quantization coefficients of which values are even numbers or non-zero even numbers in the specified region may be calculated, and the obtained sum of the absolute values may be used as the sum of the at least two quantization coefficients.
[0099] In some embodiments of this application, before calculating the at least two quantization coefficients, linear mapping may be performed on values of the at least two quantization coefficients, and then a sum of values or absolute values of the at least two quantization coefficients after the linear mapping may be calculated.
[0100] In some embodiments of this application, the foregoing linear mapping may be converting the value of the quantization coefficient of which the value is an odd number in the specified region into a first value, and converting the value of the quantization coefficient of which the value is an even number into a second value, one of the first value and the second value being an odd number, and the other being an even number. For example, the value of the quantization coefficient of which the value is an odd number in the specified region is converted into 1, and the value of the quantization coefficient of which the value is an even number is converted into 0; or the value of the quantization coefficient of which the value is an odd number in the specified region is converted into 0, and the value of the quantization coefficient of which the value is an even number is converted into 1; or the value of the quantization coefficient of which the value is an odd number in the specified region is converted into 3, and the value of the quantization coefficient of which the value is an even number is converted into 2; or the value of the quantization coefficient of which the value is an odd number in the specified region is converted into 2, and the value of the quantization coefficient of which the value is an even number is converted into 3.
[0101] In some embodiments of this application, the foregoing linear mapping may be converting a value of a quantization coefficient of which a value is non-zero in the specified region into a third value, and converting a value of a quantization coefficient of which a value is zero into a fourth value, one of the third value and the fourth value being an odd number, and the other being an even number. For example, the value of the quantization coefficient of which the value is non-zero in the specified region is converted into 1, and the value of the quantization coefficient of which the value is zero is converted into 0; or the value of the quantization coefficient of which the value is non-zero in the specified region is converted into 0, and the value of the quantization coefficient of which the value is zero is converted into 1; or the value of the quantization coefficient of which the value is non-zero in the specified region is converted into 3, and the value of the quantization coefficient of which the value is zero is converted into 2; or the value of the quantization coefficient of which the value is non-zero in the specified region is converted into 2, and the value of the quantization coefficient of which the value is zero is converted into 3.
[0102] In some embodiments of this application, the foregoing linear mapping may be converting the value of the quantization coefficient of which the value is an odd number in the specified region into a first value, the first value being an odd number. For example, the value of the quantization coefficient of which the value is an odd number in the specified region is converted into 1 or 3.
[0103] In some embodiments of this application, the foregoing linear mapping may be reducing values of quantization coefficients in the specified region by a fifth value. For example, the values of the quantization coefficients in the specified region are all reduced by 1, or reduced by 2.
[0104] In some embodiments of this application, the foregoing linear mapping may be increasing values of quantization coefficients in the specified region by a value. For example, the values of the quantization coefficients in the specified region are all increased by 1, or increased by 2.
[0105] In some embodiments of this application, the foregoing linear mapping may be multiplying values of quantization coefficients in the specified region by a non-zero sixth value. For example, the values of the quantization coefficients in the specified region are all multiplied by 1, or multiplied by 2. In some embodiments, the sixth value may be a non-zero even number, for example, 2, 4, and 6.
[0106] In some embodiments of this application, the foregoing linear mapping may be dividing values of quantization coefficients in the specified region by a non-zero value. For example, the values of the quantization coefficients in the specified region are all divided by 1, or divided by 2. In some embodiments, the value may be a non-zero even number, for example, 2, 4, and 6.
[0107] In some embodiments of this application, the foregoing linear mapping may be converting values of quantization coefficients in the specified region into opposite numbers.
[0108] In conclusion, in this embodiment of this application, the quantization coefficients in the specified region may be summed in the following manner:
[0109] 1. direct summation on the values of all quantization coefficients in the specified region;
[0110] 2. summation on the absolute values of all quantization coefficients in the specified region;
[0111] 3. direct summation on the values of the quantization coefficients of which the values are odd numbers in the specified region;
[0112] 4. direct summation on the absolute values of the quantization coefficients of which the values are odd numbers in the specified region;
[0113] 5. direct summation on the values of the quantization coefficients of which the values are even numbers or non-zero even numbers in the specified region;
[0114] 6. direct summation on the absolute values of the quantization coefficients of which the values are even numbers or non-zero even numbers in the specified region;
[0115] 7. summation on all converted values in the specified region after performing value conversion on the values of the quantization coefficients based on the parity of the quantization coefficients in the specified region;
[0116] 8. summation on absolute values of all converted values in the specified region after performing value conversion on the values of the quantization coefficients based on the parity of the quantization coefficients in the specified region;
[0117] 9. summation on all converted values in the specified region after performing value conversion on the quantization coefficients of which the values are odd numbers based on the parity of the quantization coefficients in the specified region;
[0118] 10. summation on absolute values of all converted values in the specified region after performing value conversion on the quantization coefficients of which the values are odd numbers based on the parity of the quantization coefficients in the specified region;
[0119] 11. summation on all converted values in the specified region after performing value conversion based on the quantization coefficients of which the values are non-zero or zero in the specified region;
[0120] 12. summation on absolute values of all converted values in the specified region after performing value conversion based on the quantization coefficients of which the values are non-zero or zero in the specified region;
[0121] 13. summation on all converted values in the specified region after performing value conversion on all quantization coefficients in the specified region, for example, increasing, reducing, or multiplying the quantization coefficients by a non-zero multiple, diving the quantization coefficients by a non-zero multiple, or calculating the opposite numbers; or
[0122] 14. summation on absolute values of all converted values in the specified region after performing value conversion on all quantization coefficients in the specified region, for example, increasing, reducing, or multiplying the quantization coefficients by a non-zero multiple, diving the quantization coefficients by a non-zero multiple, or calculating the opposite numbers.
[0123] Certainly, there may be another manner. For example, summation is performed on only converted odd numbers or even numbers after performing value conversion on the quantization coefficients in the specified region in the foregoing conversion manner in 7 and 8 or 13 and 14.
[0124] In some embodiments of this application, the foregoing specified region may be an entire region in the quantization coefficient block.
[0125] In some embodiments of this application, the foregoing specified region may be one or more specified positions in the quantization coefficient block.
[0126] In some embodiments of this application, the foregoing specified region may be at least one specified row in the quantization coefficient block. As shown in FIG. 8, assuming that the quantization coefficient block is a 4×4 coefficient block, and each block represents a quantization coefficient, a gray region in one row may be used as the specified region as shown in (a) in FIG. 8, or a gray region in two rows may be used as the specified region as shown in (b) in FIG. 8. In some embodiments, the at least one row may be an upper row in the quantization coefficient block.
[0127] In some embodiments of this application, the foregoing specified region may be at least one specified column in the quantization coefficient block. As shown in FIG. 8, it is assumed that the quantization coefficient block is a 4×4 coefficient block, and each block represents a quantization coefficient. Therefore, as shown in (c) in FIG. 8, a gray region in one column may be used as the specified region; or as shown in (d) in FIG. 8, a gray region in two columns may be used as the specified region. In some embodiments, the at least one column may be a left column in the quantization coefficient block.
[0128] In some embodiments of this application, the foregoing specified region may be at least one specified row and at least one specified column in the quantization coefficient block. As shown in FIG. 9, it is assumed that the quantization coefficient block is a 4×4 coefficient block, and each block represents a quantization coefficient. Therefore, as shown in (a) in FIG. 9, one lower row and one right column (that is, a gray region therein) may be used as the specified region; or as shown in (b) in FIG. 9, two lower rows and two right columns (that is, a gray area therein) may be used as the specified region; or as shown in (c) in FIG. 9, one upper row and one left column (that is, a gray region therein) may be used as the specified region; or as shown in (d) in FIG. 9, two upper rows and two left columns (that is, a gray region therein) may be used as the specified region.
[0129] In some embodiments of this application, the foregoing specified region may be a position located at least one oblique line in the quantization coefficient block. As shown in FIG. 10, it is assumed that the quantization coefficient block is a 4×4 coefficient block, and each block represents a quantization coefficient. Therefore, as shown in (a) and (b) in FIG. 10, a position in one oblique line may be used as the specified region; or as shown in (c) and (d) in FIG. 10, a position in two oblique lines may be used as the specified region.
[0130] In some embodiments of this application, the foregoing specified region may be an SRCC region in the quantization coefficient block. The SRCC region is a scan region marked by using an SRCC technology.
[0131] In some embodiments of this application, the foregoing specified region may be one or more specified positions in the SRCC region. In some embodiments, the one or more specified positions in the SRCC region may include: first N positions in a scanning order or middle N positions in the scanning order, or, certainly, may be last N positions in the scanning order, or the like, N being a non-zero natural number.
[0132] In some embodiments of this application, the foregoing specified region may be at least one specified row in the SRCC region. As shown in FIG. 8, it is assumed that the SRCC region is a 4×4 coefficient block, and each block represents a quantization coefficient. Therefore, as shown in (a) in FIG. 8, a gray region in one row may be used as the specified region; or as shown in (b) in FIG. 8, a gray region in two rows may be used as the specified region. In some embodiments, the at least one row may be an upper row in the quantization coefficient block.
[0133] In some embodiments of this application, the foregoing specified region may be at least one specified column in the SRCC region. As shown in FIG. 8, it is assumed that the SRCC region is a 4×4 coefficient block, and each block represents a quantization coefficient. Therefore, as shown in (a) in FIG. 8, a gray region in one column may be used as the specified region; or as shown in (d) in FIG. 8, a gray region in two columns may be used as the specified region. In some embodiments, the at least one column may be a left column in the quantization coefficient block.
[0134] In some embodiments of this application, the foregoing specified region may be at least one specified row and at least one specified column in the SRCC region. As shown in FIG. 9, it is assumed that the SRCC region is a 4×4 coefficient block, and each block represents a quantization coefficient. Therefore, as shown in (a) in FIG. 9, one lower row and one right column (that is, a gray region therein) may be used as the specified region; or as shown in (b) in FIG. 9, two lower rows and two right columns (that is, a gray area therein) may be used as the specified region; or as shown in (c) in FIG. 9, one upper row and one left column (that is, a gray region therein) may be used as the specified region; or as shown in (d) in FIG. 9, two upper rows and two left columns (that is, a gray region therein) may be used as the specified region.
[0135] In some embodiments of this application, the foregoing specified region may be a position located at least one oblique line in the SRCC region. As shown inFIG. 10, it is assumed that the SRCC region is a 4×4 coefficient block, and each block represents a quantization coefficient. Therefore, as shown in (a) and (b) in FIG. 10, a position in one oblique line may be used as the specified region; or as shown in (c) and (d) in FIG. 10, a position in two oblique lines may be used as the specified region.
[0136] In another embodiment of this application, the region partitioning manners in the foregoing embodiments may alternatively be combined, to use a combined region as the specified region.
[0137] In some embodiments of this application, the foregoing specified region may be one or more coefficient group regions in the scanning order in the SRCC region. If the specified region is a plurality of coefficient group regions in the SRCC area, the plurality of coefficient group regions may be consecutive coefficient group regions, or may be inconsecutive coefficient group regions. The coefficient group region in the SRCC region is a region formed by a plurality of coefficients arranged in the scanning order, for example, may be a region formed by consecutive 16 coefficients or 8 coefficients in the scanning order.
[0138] In some embodiments, if the specified region does not exist in the quantization coefficient block, the implicit export flag may be exported based on a quantization coefficient in another set region in the quantization coefficient block. The another set region is a region different from the specified region. The another set region may also be determined with reference to the manner of determining the specified region in the foregoing embodiments.
[0139] In some embodiments, when statistics are performed on the quantization coefficients in the quantization coefficient block corresponding to the luma block, if the specified region does not exist in the quantization coefficient block, the transform mode for the luma block may be determined by using the explicit flag in the bitstream information. In other words, if the specified region does not exist, the transform mode for the luma block may be determined by directly using the explicit flag with no need to determine the implicit export flag.
[0140] Based on the technical solutions in the foregoing embodiments, in some embodiments of this application, whether the implicit export flag needs to be exported based on the quantization coefficient for a corresponding luma block may be determined in at least one of the following manners, that is the method further includes: determining whether to export the implicit export flag, an operation of exporting a value of an implicit export flag based on one quantization coefficient or a sum of at least two quantization coefficients that are in a specified region in the quantization coefficient block being performed when it is determined that at least one of the following conditions is met:
[0141] a value of an index identifier included in a sequence header of the video bitstream indicates use of the implicit export flag;
[0142] a value of an index identifier included in an image header of the video bitstream indicates use of the implicit export flag;
[0143] a value of an index identifier included in a slice header of the video bitstream indicates use of the implicit export flag;
[0144] a value of an index identifier included in a largest coding unit (LCU) header of the video bitstream indicates use of the implicit export flag; and
[0145] a size of the luma block meets a preset threshold.
[0146] Specifically, whether the implicit export flag needs to be exported based on the quantization coefficient for the corresponding luma block may be determined in the following manners:
[0147] 1. The index identifier in the sequence header is used for indication. For example, if the index identifier in the sequence header is 1 (the value is merely an example), it indicates that the implicit export flag needs to be exported based on the quantization coefficient for all luma blocks corresponding to the video image frame sequence. Then, based on the technical solutions in the foregoing embodiments, a quantization coefficient in a quantization coefficient block obtained by decoding the luma block may be calculated, and the implicit export flag may be exported based on a calculation result of the quantization coefficient.
[0148] 2. The index identifier in the image header is used for indication. For example, if the index identifier in the image header is 1 (the value is merely an example), it indicates that the implicit export flag needs to be exported based on the quantization coefficient for all luma blocks corresponding to the video image frame. Then, based on the technical solutions in the foregoing embodiments, a quantization coefficient in a quantization coefficient block obtained by decoding the luma block may be calculated, and the implicit export flag may be exported based on a calculation result of the quantization coefficient.
[0149] 3. The index identifier in the slice header is used for indication. For example, if the index identifier in the slice header is 1 (the value is merely an example), it indicates that the implicit export flag needs to be exported based on the quantization coefficient for all luma blocks corresponding to the slice. Then, based on the technical solutions in the foregoing embodiments, a quantization coefficient in a quantization coefficient block obtained by decoding the luma block may be calculated, and the implicit export flag may be exported based on a calculation result of the quantization coefficient.
[0150] 4. The index identifier in the LCU header is used for indication. For example, if the index identifier in the LCU header is 1 (the value is merely an example), it indicates that the implicit export flag needs to be exported based on the quantization coefficient for all luma blocks corresponding to the LCU. Then, based on the technical solutions in the foregoing embodiments, a quantization coefficient in a quantization coefficient block obtained by decoding the luma block may be calculated, and the implicit export flag may be exported based on a calculation result of the quantization coefficient.
[0151] 5. The size of the luma block is used for indication. For example, if a size of a luma block is less than the set value, it indicates that the implicit export flag needs to be exported based on the quantization coefficient for the luma block. Then, based on the technical solutions in the foregoing embodiments, a quantization coefficient in a quantization coefficient block obtained by decoding the luma block may be calculated, and the implicit export flag may be exported based on a calculation result of the quantization coefficient.
[0152] 6. Two or more of the foregoing manner 1 to manner 5 are used for indication.
[0153] For example, the index identifier in the sequence header, the index identifier in the image header, and the size of the luma block may be used together for indication. Specifically, if the index identifier in the sequence header is 1 (the value id merely an example), the index identifier in the image header is 1 (the value is merely an example), and the size of the luma block is less than a set size, it indicates that the implicit export flag needs to be exported based on the quantization coefficient for the luma block. Then, based on the technical solutions in the foregoing embodiments, a quantization coefficient in a quantization coefficient block obtained by decoding the luma block may be calculated, and the implicit export flag may be exported based on a calculation result of the quantization coefficient.
[0154] Still as shown in FIG. 7, operation S720: Determine a transform mode for a chroma block based on the transform mode for the luma block.
[0155] In some embodiments, the transform mode for the luma block may be used as the transform mode for the chroma block. For example, if (DCT8, DCT8) is used for the luma block, (DCT8, DCT8) is also used for the chroma block. Alternatively, a correspondence between transform mode for the luma block and the transform mode for the chroma block may be set in advance. In this way, the transform mode for the chroma block is determined based on the correspondence after the transform mode for the luma block is determined. For example, when (DCT8, DCT8) is used for the luma block, and if it is set in advance that (DCT8, DCT8) for the luma block is in correspondence with (DST7, DST7) for the chroma block, it may be determined that (DST7, DST7) is used for the chroma block. A specific transform mode in this embodiment is merely an example, and another correspondence may be set based on an actual requirement in another embodiment of this application.
[0156] In some embodiments, when at least one of the following conditions is met, the transform mode for the chroma block may be determined based on the transform mode for the luma block (for example, when the at least one of the following conditions is met, the transform mode for the luma block is used as the transform mode for the chroma block):
[0157] the luma block and the chroma block have the same prediction mode; and
[0158] an encoding mode other than a specified encoding mode is used for the luma block and the chroma block, the specified encoding mode including at least one of the following encoding modes: an SAWP mode, an AWP mode, GPM, and SGPM.
[0159] The prediction mode in the foregoing embodiments may be an intraframe prediction mode, an interframe prediction mode, an intraframe block copy mode, or the like. That the luma block and the chroma block have the same prediction mode, for example, may be understood as that the luma block and the chroma block have the same intraframe prediction angle, or the luma block and the chroma block have the same motion vector.
[0160] In some embodiments, if the foregoing conditions are not met, inverse transform may be performed on the chroma block by using a specified transform mode. The specified transform mode, for example, may be (DCT2, DCT2), or another transform mode.
[0161] Still as shown in FIG. 7, operation S730: Perform inverse transform on an inverse quantization result corresponding to the luma block based on the transform mode for the luma block, and perform inverse transform on an inverse quantization result corresponding to the chroma block based on the transform mode for the chroma block. For this process, reference may be made to relevant descriptions in the foregoing embodiments, and details are not described herein again.
[0162] According to the technical solutions in the foregoing embodiments of this application, on one hand, a transform mode for a chroma block may be determined based on a transform mode for a luma block without using only a fixed and single transform mode, so that selection flexibility of the transform mode for the chroma block can be improved, thereby improving video encoding and decoding efficiency. On the other hand, the transform mode for the luma block may be determined in an implicit exporting manner, so that an encoding amount of an index flag may be reduced when more transform modes are indicated, thereby further improving video encoding efficiency.
[0163] FIG. 11 is a flowchart of a video encoding method according to some embodiments of this application. The video encoding method may be performed by a device having a computing function, for example, may be performed by a terminal device or a server. As shown in FIG. 11, the video encoding method includes at least operation S1110 to operation S1130. A detailed description is as follows.
[0164] Operation S1110: Determine a transform mode for a luma block, and determine a transform mode for a chroma block based on the transform mode for the luma block.
[0165] Operation S1120: Perform transform on residual data corresponding to the to-be-encoded luma block based on the transform mode for the luma block, and perform transform on residual data corresponding to the to-be-encoded chroma block based on the transform mode for the chroma block.
[0166] Operation S1130: Perform quantization on the transformed residual data, and encoding a quantization coefficient block obtained through quantization, to obtain an encoded bitstream.
[0167] A processing process on an encoder side is similar to a processing process on a decoder side, and specifically, reference may be made to the foregoing processing process on the decoder side. Details are not described herein again.
[0168] The following describes apparatus embodiments of this application, which may be configured for performing the method in the foregoing embodiments of this application. For details not disclosed in the apparatus embodiments of this application, refer to the foregoing method embodiments of this application.
[0169] FIG. 12 is a block diagram of a video decoding apparatus according to some embodiments of this application. The video decoding apparatus may be disposed in a device having a computing function, for example, may be disposed in a terminal device or a server.
[0170] As shown in FIG. 12, a video decoding apparatus 1200 according to some embodiments of this application includes: a decoding unit 1202, a determining unit 1204, and a processing unit 1206.
[0171] The decoding unit 1202 is configured to decode a video bitstream to obtain bitstream information, and determine a transform mode for a luma block based on the bitstream information obtained through decoding; the determining unit 1204 is configured to determine a transform mode for a chroma block based on the transform mode for the luma block; and the processing unit 1206 is configured to perform inverse transform on an inverse quantization result corresponding to the luma block based on the transform mode for the luma block, and perform inverse transform on an inverse quantization result corresponding to the chroma block based on the transform mode for the chroma block.
[0172] In some embodiments of this application, based on the foregoing solutions, the determining unit 1204 is configured to use the transform mode for the luma block as the transform mode for the chroma block.
[0173] In some embodiments of this application, based on the foregoing solutions, the determining unit 1204 is configured to use the transform mode for the luma block as the transform mode for the chroma block if it is determined, based on the bitstream information, that at least one of the following conditions is met:
[0174] the luma block and the chroma block have the same prediction mode; and
[0175] an encoding mode other than a specified encoding mode is used for the luma block and the chroma block, the specified encoding mode including at least one of the following encoding modes: an SAWP mode, an AWP mode, GPM, and SGPM.
[0176] In some embodiments of this application, based on the foregoing solutions, the decoding unit 1202 is further configured to determine a quantization coefficient block corresponding to the luma block, and export a value of an implicit export flag based on one quantization coefficient or a sum of at least two quantization coefficients that are in a specified region in the quantization coefficient block; and determine the transform mode for the luma block based on a value of the implicit export flag.
[0177] In some embodiments of this application, based on the foregoing solutions, the decoding unit 1202 is further configured to export the value of the implicit export flag based on parity of the quantization coefficient or the sum of the at least two quantization coefficients, or export the value of the implicit export flag based on a remainder that is of the quantization coefficient or the sum of the at least two quantization coefficients and that is with respect to a set value.
[0178] In some embodiments of this application, based on the foregoing solutions,
[0179] when the at least two quantization coefficients include all quantization coefficients in the specified region, the sum of the at least two quantization coefficients includes: a sum of values or absolute values of all the quantization coefficients in the specified region;
[0180] when the at least two quantization coefficients include quantization coefficients of which values are odd numbers in the specified region, the sum of the at least two quantization coefficients includes: a sum of values or absolute values of the quantization coefficients of which the values are odd numbers in the specified region; or
[0181] when the at least two quantization coefficients include quantization coefficients of which values are even numbers or non-zero even numbers in the specified region, the sum of the at least two quantization coefficients includes: a sum of values or absolute values of the quantization coefficients of which the values are even numbers or non-zero even numbers in the specified region.
[0182] In some embodiments of this application, based on the foregoing solutions, the decoding unit 1202 is further configured to perform linear mapping on values of the at least two quantization coefficients, the sum of the at least two quantization coefficients including a sum of values or absolute values of the at least two quantization coefficients after the linear mapping, and the linear mapping including any one of the following:
[0183] converting a value of the quantization coefficient of which the value is an odd number into a first value, and converting a value of the quantization coefficient of which the value is an even number into a second value, one of the first value and the second value being an odd number, and the other being an even number; or
[0184] converting a value of a quantization coefficient of which a value is non-zero into a third value, and converting a value of a quantization coefficient of which a value is zero into a fourth value, one of the third value and the fourth value being an odd number, and the other being an even number; or
[0185] reducing or increasing the values of the at least two quantization coefficients by a fifth value; or
[0186] multiplying or dividing the values of the at least two quantization coefficients by a non-zero sixth value; and
[0187] multiplying or dividing the values of the at least two quantization coefficients by a non-zero even number.
[0188] In some embodiments of this application, based on the foregoing solutions, the specified region includes at least one of the following regions:
[0189] an entire region in the quantization coefficient block;
[0190] one or more specified positions in the quantization coefficient block;
[0191] at least one specified row in the quantization coefficient block;
[0192] at least one specified column in the quantization coefficient block;
[0193] at least one specified row and at least one specified column in the quantization coefficient block;
[0194] a position located on at least one oblique line in the quantization coefficient block;
[0195] a scan region coefficient coding (SRCC) region in the quantization coefficient block;
[0196] one or more specified positions in the SRCC region;
[0197] at least one specified row in the SRCC region;
[0198] at least one specified column in the SRCC region;
[0199] at least one specified row and at least one specified column in the SRCC region;
[0200] a position located on at least one oblique line in the SRCC region; and
[0201] one or more coefficient group regions in a scanning order in the SRCC region.
[0202] In some embodiments of this application, based on the foregoing solutions, the one or more specified positions in the SRCC region include: first N positions in a scanning order or middle N positions in the scanning order, N being a non-zero natural number.
[0203] In some embodiments of this application, based on the foregoing solutions, the decoding unit 1202 is further configured to select, based on a correspondence between the value of the implicit export flag and a transform mode, a transform mode corresponding to the value of the implicit export flag as the transform mode for the luma block.
[0204] In some embodiments of this application, based on the foregoing solutions, the decoding unit 1202 is further configured to determine the transform mode for the luma block based on the value of the implicit export flag and a value of an explicit flag in the bitstream information.
[0205] In some embodiments of this application, based on the foregoing solutions, the decoding unit 1202 is further configured to combine the implicit export flag and the explicit flag based on a set arrangement combination, to generate a combination index transform; and select a transform mode corresponding to the combination index as the transform mode for the luma block based on a correspondence between a value of the index and the transform mode.
[0206] In some embodiments of this application, based on the foregoing solutions, the correspondence between the value of the index and the transform mode is preset based on a value of the combination index and a set transform mode, the set transform mode including at least one of the following: a transform matrix combination configured for performing horizontal transform and vertical transform, a sub-block transform (SBT) mode, and a transform skip mode.
[0207] In some embodiments of this application, based on the foregoing solutions, a transform kernel configured for the horizontal transform and a transform kernel configured for the vertical transform in the transform matrix combination are selected from the following: a discrete cosine transform DCT2 transform kernel, a DCT5 transform kernel, a DCT8 transform kernel, a discrete sine transform DST1 transform kernel, a DST7 transform kernel, and transform skip.
[0208] In some embodiments of this application, based on the foregoing solutions, the decoding unit 1202 is further configured to export, if the specified region does not exist in the quantization coefficient block, the value of the implicit export flag based on a quantization coefficient in another set region in the quantization coefficient block; or determine the transform mode for the luma block by using an explicit flag in the bitstream information.
[0209] In some embodiments of this application, based on the foregoing solutions, the decoding unit 1202 is further configured to determine whether to export the implicit export flag, an operation of exporting a value of an implicit export flag based on one quantization coefficient or a sum of at least two quantization coefficients that are in a specified region in the quantization coefficient block being performed when it is determined that at least one of the following conditions is met:
[0210] a value of an index identifier included in a sequence header of the video bitstream indicates use of the implicit export flag;
[0211] a value of an index identifier included in an image header of the video bitstream indicates use of the implicit export flag;
[0212] a value of an index identifier included in a slice header of the video bitstream indicates use of the implicit export flag;
[0213] a value of an index identifier included in a largest coding unit (LCU) header of the video bitstream indicates use of the implicit export flag; and
[0214] a size of the luma block meets a preset threshold.
[0215] FIG. 13 is a block diagram of a video encoding apparatus according to some embodiments of this application. The video encoding apparatus may be disposed in a device having a computing function, for example, may be disposed in a terminal device or a server.
[0216] As shown in FIG. 13, a video encoding apparatus 1300 according to some embodiments of this application includes: a determining unit 1302, a transform unit 1304, and an encoding unit 1306.
[0217] The determining unit 1302 is configured to determine a transform mode for a luma block, and determine a transform mode for a chroma block based on the transform mode for the luma block; the transform unit 1304 is configured to perform transform on residual data corresponding to the to-be-encoded luma block based on the transform mode for the luma block, and perform transform on residual data corresponding to the to-be-encoded chroma block based on the transform mode for the chroma block; and the encoding unit 1306 is configured to perform quantization on the transformed residual data, and encode a quantization coefficient block obtained through quantization, to obtain an encoded bitstream.
[0218] FIG. 14 is a schematic diagram of a structure of a computer system applicable to implement an electronic device according to an embodiment of this application. The electronic device may be the video encoding apparatus or the video decoding apparatus in the foregoing embodiments.
[0219] A computer system 1400 of the electronic device shown in FIG. 14 is merely an example, and does not constitute any limitation on functions and use ranges of the embodiments of this application.
[0220] As shown in FIG. 14, the computer system 1400 may include a central processing unit (CPU) 1401, which may perform various suitable actions and processing based on a program stored in a read-only memory (ROM) 1402 or a program loaded from a storage part 1408 into a random access memory (RAM) 1403, for example, perform the method in the foregoing embodiments. The RAM 1403 further has various programs and data required for system operation stored therein. The CPU 1401, the ROM 1402, and the RAM 1403 are connected to each other by a bus 1404. An input / output (I / O) interface 1405 is further connected to the bus 1404.
[0221] The following components may be connected to the I / O interface 1405: an input part 1406 including a keyboard, a mouse, or the like; an output part 1407 including a cathode ray tube (CRT), a liquid crystal display (LCD), a speaker, or the like; the storage part 1408 including a hard disk or the like; and a communication part 1409 including a network interface card such as a local area network (LAN) card or a modem. The communication part 1409 performs communication processing through a network, for example, the Internet. A drive 1410 is further connected to the I / O interface 1405 based on a requirement. A removable medium 1411 such as a magnetic disk, an optical disc, a magneto-optical disk, or a semiconductor memory is installed on the drive 1410 based on a requirement, so that a computer program read therefrom is installed into the storage part 1408 based on a requirement.
[0222] Particularly, according to an embodiment of this application, the processes described in the foregoing with reference to the flowcharts may be implemented as a computer software program. For example, this embodiment of this application includes a computer program product, which includes a computer program carried on a computer-readable medium, the computer program being configured to perform the method shown in the flowcharts. In this embodiment, the computer program may be uploaded and installed from the network through the communication part 1409, and / or be installed from the removable medium 1411. When the computer program is executed by the central processing unit (CPU) 1401, the various functions limited in the system of this application are performed.
[0223] The computer-readable medium shown in this embodiment of this application may be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. A more specific example of the computer-readable storage medium may include but is not limited to: an electrical connection having one or more wires, a portable computer magnetic 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 compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In this application, the computer-readable storage medium may be any tangible medium that includes or stores the computer a program. The program may be used by or used in combination with an instruction execution system, apparatus, or device. In this application, the computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier, the data signal carrying a computer-readable computer program. The data signal propagated in such a way may have a plurality of forms, including but not limited to an electromagnetic signal, an optical signal, or any appropriate combination thereof. The computer-readable signal medium may further be any computer-readable medium in addition to the computer-readable storage medium. The computer-readable medium may send, propagate, or transmit the program that is used by or used in combination with the instruction execution system, apparatus, or device. The computer program included in the computer-readable medium may be transmitted by using any suitable medium, including but not limited to: a wireless medium, a wire, or the like, or any suitable combination thereof.
[0224] The flowcharts and block diagrams in the accompanying drawings illustrate system architectures, functions, and operations that may be implemented by a system, a method, and a computer program product according to various embodiments of this application. Each block in a flowchart or a block diagram may represent a module, a program segment, or a part of code. The module, the program segment, or the part of code includes one or more executable instructions for implementing specified logic functions. In some implementations used as substitutes, functions annotated in boxes may alternatively occur in a sequence different from that annotated in the accompanying drawings. For example, two blocks shown in succession may be actually performed in parallel, and sometimes may be performed in a reverse sequence, which is determined by an involved function. Each block in a flowchart or a block diagram and combinations of the blocks in the flowcharts or the block diagrams may be implemented by a dedicated hardware-based system that perform a specified function or operation, or may be implemented by a combination of dedicated hardware and a computer program.
[0225] An involved unit described in the embodiments of this application may be implemented by software or by hardware, and may be alternatively disposed in a processor. Names of these units do not constitute a limitation on the units in a specific situation.
[0226] In another aspect, this application further provides a computer-readable medium. The computer-readable medium may be included in the electronic device described in the foregoing embodiments, or may exist alone without being assembled into the electronic device. The computer-readable medium carries one or more computer programs. When executed by the electronic device, the one or more computer programs cause the electronic device to implement the method according to the foregoing embodiments.
[0227] Although several modules or units of a device for performing actions are mentioned in the foregoing detailed descriptions, such division is not compulsory. Actually, according to the embodiments of this application, features and functions of two or more modules or units described above may be specified in one module or unit. On the contrary, features and functions of one module or unit described above may be further divided to be specified by a plurality of modules or units.
[0228] According to the descriptions of the foregoing implementations, a person skilled in the art may easily understand that the exemplary implementations described herein may be implemented through software, or may be implemented by combining software and necessary hardware. Therefore, the technical solutions according to the implementations of this application may be implemented in a form of a software product. The software product may be stored in a non-volatile storage medium (which may be a CD-ROM, a USB flash drive, a removable hard disk, or the like) or on a network, and include several instructions for instructing an electronic device to perform the method according to the implementations of this application.
[0229] For example, the electronic device may be the video decoding apparatus, and then the video decoding apparatus may perform the video decoding method shown in FIG. 7. For another example, the electronic device may be the video encoding apparatus, and the video encoding apparatus may perform the video encoding method shown in FIG. 11.
[0230] After considering the specification and practicing the implementations of the present disclosure, a person skilled in the art may easily conceive of other implementations of this application. This application is intended to cover any variations, uses, or adaptive changes of this application. These variations, uses, or adaptive changes follow the general principles of this application and include common general knowledge or customary technical means in the art that are not disclosed in this application.
[0231] This application is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope of this application. The scope of this application is limited only by the appended claims.
Claims
1. A video decoding method performed by an electronic device, the method comprising:decoding a video bitstream to obtain bitstream information;determining a quantization coefficient block corresponding to a luma block;determining an implicit export flag based on a sum of at least two quantization coefficients in a specified region in the quantization coefficient block;determining a transform mode for the luma block based on the implicit export flag;determining a transform mode for a chroma block based on the transform mode for the luma block; andperforming inverse transform on an inverse quantization result of the luma block based on the transform mode for the luma block, and performing inverse transform on an inverse quantization result of the chroma block based on the transform mode for the chroma block.
2. The method according to claim 1, wherein the determining a transform mode for a chroma block based on the transform mode for the luma block comprises:using the transform mode for the luma block as the transform mode for the chroma block.
3. The method according to claim 2, wherein the using the transform mode for the luma block as the transform mode for the chroma block comprises:using the transform mode for the luma block as the transform mode for the chroma block when at least one of the following conditions is met:the luma block and the chroma block have the same prediction mode; andan encoding mode other than a specified encoding mode is used for the luma block and the chroma block, the specified encoding mode comprising at least one of the following encoding modes: a spatial angular weighted prediction (SAWP) mode, an angular weighted prediction (AWP) mode, a geometric prediction mode (GPM), and a spatial geometric prediction mode (SGPM).
4. The method according to claim 1, wherein the exporting an implicit export flag based on a sum of at least two quantization coefficients in a specified region in the quantization coefficient block comprises:determining the implicit export flag based on parity of the sum of the at least two quantization coefficients; ordetermining the implicit export flag based on a remainder of the sum of the at least two quantization coefficients with respect to a preset value.
5. The method according to claim 4, whereinwhen the at least two quantization coefficients comprise all quantization coefficients in the specified region, the sum of the at least two quantization coefficients comprises: a sum of values or absolute values of all the quantization coefficients in the specified region;when the at least two quantization coefficients comprise quantization coefficients of which values are odd numbers in the specified region, the sum of the at least two quantization coefficients comprises: a sum of values or absolute values of the quantization coefficients of which the values are odd numbers in the specified region; orwhen the at least two quantization coefficients comprise quantization coefficients of which values are even numbers or non-zero even numbers in the specified region, the sum of the at least two quantization coefficients comprises: a sum of values or absolute values of the quantization coefficients of which the values are even numbers or non-zero even numbers in the specified region.
6. The method according to claim 4, further comprising:performing linear mapping on values of the at least two quantization coefficients, the sum of the at least two quantization coefficients comprising a sum of values or absolute values of the at least two quantization coefficients after the linear mapping, and the linear mapping comprising any one of the following:converting a value of the quantization coefficient of which the value is an odd number into a first value, and converting the value of the quantization coefficient of which the value is an even number into a second value, one of the first value and the second value being an odd number, and the other being an even number;converting a value of a quantization coefficient of which a value is non-zero into a third value, and converting a value of a quantization coefficient of which a value is zero into a fourth value, one of the third value and the fourth value being an odd number, and the other being an even number;reducing or increasing the values of the at least two quantization coefficients by a fifth value;multiplying or dividing the values of the at least two quantization coefficients by a non-zero sixth value; andmultiplying or dividing the values of the at least two quantization coefficients by a non-zero even number.
7. The method according to claim 1, wherein the specified region comprises at least one of the following regions:an entire region in the quantization coefficient block;one or more specified positions in the quantization coefficient block;at least one specified row in the quantization coefficient block;at least one specified column in the quantization coefficient block;at least one specified row and at least one specified column in the quantization coefficient block;a position located on at least one oblique line in the quantization coefficient block;a scan region coefficient coding (SRCC) region in the quantization coefficient block;one or more specified positions in the SRCC region;at least one specified row in the SRCC region;at least one specified column in the SRCC region;at least one specified row and at least one specified column in the SRCC region;a position located on at least one oblique line in the SRCC region; andone or more coefficient group regions in a scanning order in the SRCC region.
8. The method according to claim 7, wherein the one or more specified positions in the SRCC region comprise: first N positions in the scanning order or middle N positions in the scanning order, N being a non-zero natural number.
9. The method according to claim 1, wherein the determining the transform mode for the luma block based on the implicit export flag comprises:selecting, based on a correspondence between implicit export flags and transform modes, a transform mode corresponding to the implicit export flag as the transform mode for the luma block; ordetermining the transform mode for the luma block based on the implicit export flag and an explicit flag in the bitstream information.
10. The method according to claim 9, wherein the determining the transform mode for the luma block based on the implicit export flag and an explicit flag in the bitstream information comprises:combining the implicit export flag and the explicit flag based on a set arrangement combination, to generate a combination index; andselecting, based on a correspondence between combination indexes and transform modes, a transform mode corresponding to the combination index as the transform mode for the luma block.
11. The method according to claim 1, further comprising:when the specified region does not exist in the quantization coefficient block: determining the implicit export flag based on a quantization coefficient in another set region in the quantization coefficient block or determining the transform mode for the luma block by using an explicit flag in the bitstream information.
12. The method according to claim 1, wherein the exporting an implicit export flag based on a sum of at least two quantization coefficients in a specified region in the quantization coefficient block is performed when at least one of the following conditions is met:a value of an index identifier comprised in a sequence header of the video bitstream indicates use of the implicit export flag;a value of an index identifier comprised in an image header of the video bitstream indicates use of the implicit export flag;a value of an index identifier comprised in a slice header of the video bitstream indicates use of the implicit export flag;a value of an index identifier comprised in a largest coding unit (LCU) header of the video bitstream indicates use of the implicit export flag; anda size of the luma block meets a preset threshold.
13. An electronic device, comprising:one or more processors; anda memory, configured to store one or more computer programs, the one or more computer programs, when executed by the one or more processors, causing the electronic device to implement a video decoding method including:decoding a video bitstream to obtain bitstream information;determining a quantization coefficient block corresponding to a luma block;determining an implicit export flag based on a sum of at least two quantization coefficients in a specified region in the quantization coefficient block;determining a transform mode for the luma block based on the implicit export flag;determining a transform mode for a chroma block based on the transform mode for the luma block; andperforming inverse transform on an inverse quantization result of the luma block based on the transform mode for the luma block, and performing inverse transform on an inverse quantization result of the chroma block based on the transform mode for the chroma block.
14. The electronic device according to claim 13, wherein the determining a transform mode for a chroma block based on the transform mode for the luma block comprises:using the transform mode for the luma block as the transform mode for the chroma block.
15. The electronic device according to claim 14, wherein the using the transform mode for the luma block as the transform mode for the chroma block comprises:using the transform mode for the luma block as the transform mode for the chroma block when at least one of the following conditions is met:the luma block and the chroma block have the same prediction mode; andan encoding mode other than a specified encoding mode is used for the luma block and the chroma block, the specified encoding mode comprising at least one of the following encoding modes: a spatial angular weighted prediction (SAWP) mode, an angular weighted prediction (AWP) mode, a geometric prediction mode (GPM), and a spatial geometric prediction mode (SGPM).
16. The electronic device according to claim 13, wherein the determining an implicit export flag based on a sum of at least two quantization coefficients in a specified region in the quantization coefficient block comprises:determining the implicit export flag based on parity of the sum of the at least two quantization coefficients; ordetermining the implicit export flag based on a remainder of the sum of the at least two quantization coefficients with respect to a preset value.
17. The electronic device according to claim 16, whereinwhen the at least two quantization coefficients comprise all quantization coefficients in the specified region, the sum of the at least two quantization coefficients comprises: a sum of values or absolute values of all the quantization coefficients in the specified region;when the at least two quantization coefficients comprise quantization coefficients of which values are odd numbers in the specified region, the sum of the at least two quantization coefficients comprises: a sum of values or absolute values of the quantization coefficients of which the values are odd numbers in the specified region; orwhen the at least two quantization coefficients comprise quantization coefficients of which values are even numbers or non-zero even numbers in the specified region, the sum of the at least two quantization coefficients comprises: a sum of values or absolute values of the quantization coefficients of which the values are even numbers or non-zero even numbers in the specified region.
18. The electronic device according to claim 13, wherein the determining the transform mode for the luma block based on the implicit export flag comprises:selecting, based on a correspondence between implicit export flags and transform modes, a transform mode corresponding to the implicit export flag as the transform mode for the luma block; ordetermining the transform mode for the luma block based on the implicit export flag and an explicit flag in the bitstream information.
19. The electronic device according to claim 13, wherein the determining an implicit export flag based on a sum of at least two quantization coefficients in a specified region in the quantization coefficient block is performed when at least one of the following conditions is met:a value of an index identifier comprised in a sequence header of the video bitstream indicates use of the implicit export flag;a value of an index identifier comprised in an image header of the video bitstream indicates use of the implicit export flag;a value of an index identifier comprised in a slice header of the video bitstream indicates use of the implicit export flag;a value of an index identifier comprised in a largest coding unit (LCU) header of the video bitstream indicates use of the implicit export flag; anda size of the luma block meets a preset threshold.
20. A non-transitory computer readable medium storing a video bitstream, wherein an electronic device is configured to perform a video decoding method on the video bitstream, the method including:decoding the video bitstream to obtain bitstream information;determining a quantization coefficient block corresponding to a luma block;determining an implicit export flag based on a sum of at least two quantization coefficients in a specified region in the quantization coefficient block;determining a transform mode for the luma block based on the implicit export flag;determining a transform mode for a chroma block based on the transform mode for the luma block; andperforming inverse transform on an inverse quantization result of the luma block based on the transform mode for the luma block, and performing inverse transform on an inverse quantization result of the chroma block based on the transform mode for the chroma block.
