Disclosure of Invention
Embodiments of the present application provide a video decoding method, a video encoding method, an apparatus, a medium, and an electronic device, so that the decoding efficiency and the encoding efficiency of a video frame encoding block can be improved at least to a certain extent.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of an embodiment of the present application, there is provided a video decoding method including: acquiring coded data corresponding to a video frame to be decoded, wherein the coded data comprise coding results obtained by respectively coding a DC coefficient and an AC coefficient in a video frame coding block; decoding processing is carried out on the basis of the encoding result of the DC coefficient to obtain the DC coefficient; determining whether a non-zero coefficient is included in the AC coefficients according to the value of the DC coefficient; and decoding the coding result of the AC coefficient according to whether the AC coefficient contains a nonzero coefficient or not to obtain the AC coefficient.
According to an aspect of an embodiment of the present application, there is provided a video encoding method, including: determining a DC coefficient and an AC coefficient contained in a video frame coding block; encoding the DC coefficient; encoding a syntax element indicating whether the AC coefficient includes a non-zero coefficient according to a value of the DC coefficient; and coding the AC coefficient according to the value of the syntax element.
According to an aspect of an embodiment of the present application, there is provided a video decoding apparatus including: the device comprises an acquisition unit, a decoding unit and a decoding unit, wherein the acquisition unit is used for acquiring coded data corresponding to a video frame to be decoded, and the coded data comprise coding results obtained by respectively coding a DC coefficient and an AC coefficient in a video frame coding block; a first decoding unit, configured to perform decoding processing based on an encoding result of the DC coefficient to obtain the DC coefficient; a determining unit, configured to determine whether a non-zero coefficient is included in the AC coefficient according to a value of the DC coefficient; and the second decoding unit is used for decoding the coding result of the AC coefficient according to whether the AC coefficient contains a nonzero coefficient or not to obtain the AC coefficient.
In some embodiments of the present application, based on the foregoing scheme, the first decoding unit is configured to: and decoding according to the context of the DC coefficient to obtain the value of the DC coefficient, wherein the value of the DC coefficient is obtained through binarization processing.
In some embodiments of the present application, based on the foregoing scheme, the first decoding unit is further configured to: determining a context of a DC coefficient in the video frame coding block according to values of DC coefficients of neighboring blocks of the video frame coding block.
In some embodiments of the present application, based on the foregoing scheme, the first decoding unit is configured to: determining a reference variable to be 0 if a value of a DC coefficient of a predetermined number of valid neighboring blocks among valid neighboring blocks of the video frame coding block is 0, the valid neighboring blocks being neighboring blocks having edge overlap with the video frame coding block; if the number of the effective adjacent blocks of which the DC coefficient value is 0 in the effective adjacent blocks of the video frame coding block is less than or equal to the preset number, selecting the maximum value and the minimum value of the non-zero DC coefficient from the effective adjacent blocks of the video frame coding block, and determining the value of the reference variable according to the maximum value and the minimum value; determining a context of a DC coefficient in the video frame coding block based on the value of the reference variable.
In some embodiments of the present application, based on the foregoing scheme, the determining unit is configured to: and if the value of the DC coefficient is 0, determining that the AC coefficient contains a non-zero coefficient, wherein if the value of the DC coefficient is 0, omitting an encoding process of a syntax element for indicating whether the AC coefficient contains the non-zero coefficient when encoding the video frame encoding block.
In some embodiments of the present application, based on the foregoing scheme, the determining unit is configured to: and if the value of the DC coefficient is 1, decoding according to the context of the syntax element to obtain the value of the syntax element, and determining whether the AC coefficient comprises a nonzero coefficient according to the value of the syntax element.
In some embodiments of the present application, based on the foregoing scheme, the determining unit is further configured to: determining a context of the syntax element as a function of a value of the DC coefficient and a size of the video frame encoding block.
In some embodiments of the present application, based on the foregoing scheme, the second decoding unit is configured to: if the AC coefficients do not contain non-zero coefficients, decoding all AC coefficients contained in the video frame coding block into 0, wherein the video frame coding block omits the coding process of the AC coefficients during coding; and if the AC coefficient contains a nonzero coefficient, decoding according to the scanning sequence during encoding to obtain the value of the AC coefficient contained in the video frame encoding block.
According to an aspect of an embodiment of the present application, there is provided a video encoding apparatus including: a determining unit for determining a DC coefficient and an AC coefficient contained in a video frame coding block; and the coding unit is used for coding the DC coefficient, coding a syntax element for indicating whether the AC coefficient contains a nonzero coefficient according to the value of the DC coefficient, and coding the AC coefficient according to the value of the syntax element.
In some embodiments of the present application, based on the foregoing scheme, the encoding unit is configured to: if the value of the DC coefficient is 0, omitting the encoding process of the syntax element; and if the value of the DC coefficient is not 0, determining the value of the syntax element according to the condition of the nonzero coefficient contained in the AC coefficient, and encoding the syntax element according to the context of the AC coefficient.
In some embodiments of the present application, based on the foregoing scheme, the encoding unit is configured to: omitting an encoding process for the AC coefficient if a value of the syntax element indicates that the AC coefficient does not include a non-zero coefficient; and if the value of the syntax element indicates that the AC coefficients contain nonzero coefficients, sequentially coding the AC coefficients contained in the video frame coding blocks according to a scanning sequence.
According to an aspect of embodiments of the present application, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a video decoding method or a video encoding method as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic device including: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a video decoding method or a video encoding method as described in the above embodiments.
In the technical solutions provided in some embodiments of the present application, a DC coefficient and an AC coefficient included in a video frame coding block are determined, then the DC coefficient is subjected to coding processing, a syntax element indicating whether the AC coefficient includes a non-zero coefficient is subjected to coding processing according to a value of the DC coefficient, and the AC coefficient is subjected to coding processing according to a value of the syntax element, so that the DC coefficient and the AC coefficient in the video frame coding block can be separated and subjected to coding processing respectively, and further more reasonable coding processing can be performed on characteristics of the DC coefficient and the AC coefficient, which is beneficial to improving coding efficiency. Meanwhile, because the value of the DC coefficient can be directly obtained according to the coding of the DC coefficient, it is not necessary to perform coding processing on a syntax element for indicating whether the DC coefficient includes a non-zero coefficient, and it can also be inferred whether the AC coefficient includes a non-zero coefficient (for example, if the value of the DC coefficient is 0, the AC coefficient must include a non-zero coefficient), and further it is possible to select whether to perform coding processing on the syntax element for indicating whether the AC coefficient includes a non-zero coefficient, and it is also not necessary to perform coding on the DC coefficient by run (run represents the number of consecutive zero coefficients before the non-zero coefficient) and last _ flag (last _ flag is used for representing whether the non-zero coefficient is the last non-zero coefficient in the current coding block), so that some unnecessary information coding can be saved, and the coding efficiency is improved.
In the technical solutions provided in some embodiments of the present application, encoded data including an encoding result of a DC coefficient and an AC coefficient is obtained, then the DC coefficient is obtained by performing decoding processing based on the encoding result of the DC coefficient, whether the AC coefficient includes a non-zero coefficient is determined according to a value of the DC coefficient, and the AC coefficient is obtained by performing decoding processing on the encoding result of the AC coefficient according to whether the AC coefficient includes a non-zero coefficient, so that the DC coefficient and the AC coefficient in a video frame encoding block can be separated, and further more reasonable decoding processing can be performed on characteristics of the DC coefficient and the AC coefficient, which is beneficial to improving decoding efficiency. Meanwhile, because the value of the DC coefficient can be directly obtained according to the coding of the DC coefficient, the decoding processing of a syntax element for indicating whether the DC coefficient contains a nonzero coefficient is not needed, and run and last _ flag decoding of the DC coefficient is also not needed, so that the decoding efficiency can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The technical terms in the present application will first be briefly described below:
syntax elements: information representing the codestream that needs to be encoded and transmitted in video coding.
Entropy coding: a data compression method is a key technology for realizing information compression in a video coding process, and entropy coding is carried out on the basis of an entropy principle without losing any information in the coding process.
run-level coding: run length coding, a type of coefficient coding. Wherein run represents the number of continuous zero coefficients before the non-zero coefficient; level represents the magnitude of the non-zero coefficient.
Context (buffer): in the process of entropy coding, each syntax element reads and writes information in the corresponding buffer for calculation and updating.
last _ flag: is a coefficient-coded syntax element used to indicate whether the current non-zero coefficient is the last non-zero coefficient in the current coding block. The 0 coefficients after the last non-zero coefficient can be skipped without transmitting the code stream, and the decoding end can decode the rest 0 coefficients through the position of the last non-zero coefficient.
And (3) quantification: refers to the process of mapping a continuous value (or a large number of possible discrete values) of a signal to a finite number of discrete amplitudes, which is a many-to-one mapping. In the video encoding process, after the residual signal is subjected to Discrete Cosine Transform (DCT for short), the Transform coefficient generally has a large range, so that the quantization of the Transform coefficient can effectively reduce the signal value space, and further obtain a better compression rate.
DC coefficient: the Direct Current (Direct Current) component after transform quantization of the residual coefficient is a position of the top left corner of the video frame coding block, and if x represents width (width) and y represents height (height), the position coordinate of DC is (0, 0).
AC coefficient: and (3) Alternating Current (Alternating Current) components after the residual coefficients are subjected to transform quantization, wherein all coefficients except the DC coefficient in the video frame coding block are AC coefficients.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied.
As shown in fig. 1, the system architecture 100 includes a plurality of end devices that may communicate with each other over, for example, a network 150. For example, the system architecture 100 may 100 include a first end device 110 and a second end device 120 interconnected by a network 150. In the embodiment of fig. 1, the first terminal device 110 and the second terminal device 120 perform unidirectional data transmission. For example, the first end device 110 may encode video data (e.g., a video picture stream captured by the end device 110) for transmission over the network 150 to the second end device 120. The encoded video data is transmitted in the form of one or more encoded video streams. The second terminal device 120 may receive the encoded video data from the network 150, decode the encoded video data to restore the video data, and display a video picture according to the restored video data.
In one embodiment of the present application, system architecture 100 may include a third end device 130 and a fourth end device 140 that perform bi-directional transmission of encoded video data, which may occur, for example, during a video conference. For bi-directional data transmission, each of third end device 130 and fourth end device 140 may encode video data (e.g., a stream of video pictures captured by the end device) for transmission over network 150 to the other of third end device 130 and fourth end device 140. Each of third terminal device 130 and fourth terminal device 140 may also receive encoded video data transmitted by the other of third terminal device 130 and fourth terminal device 140, and may decode the encoded video data to recover the video data, and may display video pictures on an accessible display device according to the recovered video data.
In the embodiment of fig. 1, the first terminal device 110, the second terminal device 120, the third terminal device 130, and the fourth terminal device 140 may be a server, a personal computer, and a smart phone, but the principles disclosed herein may not be limited thereto. Embodiments disclosed herein are applicable to laptop computers, tablet computers, media players, and/or dedicated video conferencing equipment. Network 150 represents any number of networks that communicate encoded video data between first end device 110, second end device 120, third end device 130, and fourth end device 140, including, for example, wired and/or wireless communication networks. The communication network 150 may exchange data in circuit-switched and/or packet-switched channels. The network may include a telecommunications network, a local area network, a wide area network, and/or the internet. For purposes of this application, the architecture and topology of the network 150 may be immaterial to the operation of the present disclosure, unless explained below.
In one embodiment of the present application, fig. 2 illustrates the placement of video encoding devices and video decoding devices in a streaming environment. The subject matter disclosed herein is equally applicable to other video-enabled applications including, for example, video conferencing, digital TV, storing compressed video on digital media including CDs, DVDs, memory sticks, and the like.
The streaming system may include an acquisition subsystem 213, and the acquisition subsystem 213 may include a video source 201, such as a digital camera, that creates an uncompressed video picture stream 202. In an embodiment, the video picture stream 202 includes samples taken by a digital camera. The video picture stream 202 is depicted as a thick line to emphasize a high data amount video picture stream compared to the encoded video data 204 (or the encoded video codestream 204), the video picture stream 202 can be processed by an electronic device 220, the electronic device 220 comprising a video encoding device 203 coupled to a video source 201. The video encoding device 203 may comprise hardware, software, or a combination of hardware and software to implement or embody aspects of the disclosed subject matter as described in greater detail below. The encoded video data 204 (or encoded video codestream 204) is depicted as a thin line compared to the video picture stream 202 to emphasize the lower data amount of the encoded video data 204 (or encoded video codestream 204), which may be stored on the streaming server 205 for future use. One or more streaming client subsystems, such as client subsystem 206 and client subsystem 208 in fig. 2, may access streaming server 205 to retrieve copies 207 and 209 of encoded video data 204. Client subsystem 206 may include, for example, video decoding device 210 in electronic device 230. Video decoding device 210 decodes incoming copies 207 of the encoded video data and generates an output video picture stream 211 that may be presented on a display 212 (e.g., a display screen) or another presentation device. In some streaming systems, encoded video data 204, video data 207, and video data 209 (e.g., video streams) may be encoded according to certain video encoding/compression standards. Examples of such standards include ITU-T H.265. In an embodiment, the Video Coding standard under development is informally referred to as next generation Video Coding (VVC), and the present application may be used in the context of the VVC standard.
It should be noted that electronic devices 220 and 230 may include other components not shown in the figures. For example, electronic device 220 may include a video decoding device not shown, and electronic device 230 may also include a video encoding device not shown.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
fig. 3 shows a flow chart of a video encoding method according to an embodiment of the present application, which may be performed by the video encoding apparatus described in the foregoing embodiments. Referring to fig. 3, the video encoding method at least includes steps S310 to S340, which are described in detail as follows:
in step S310, the DC coefficient and the AC coefficient contained in the video frame encoding block are determined.
In one embodiment of the present application, the DC coefficient is a position of the uppermost left corner of the video frame coding block, and the AC coefficients are all coefficients except the DC coefficient in the video frame coding block, so that the DC coefficient and the AC coefficient contained in the video frame coding block can be determined accordingly.
In step S320, the DC coefficient is subjected to encoding processing.
In one embodiment of the present application, the DC coefficient may be subjected to an encoding process according to a value of the DC coefficient and a context of the DC coefficient. Since the encoding of the DC coefficient can directly determine the value of the DC coefficient, there is no need to perform encoding processing on a syntax element indicating whether the DC coefficient contains a non-zero coefficient, saving unnecessary information encoding.
In step S330, a syntax element indicating whether the AC coefficient includes a non-zero coefficient is subjected to encoding processing according to the value of the DC coefficient.
In one embodiment of the present application, if the DC coefficient has a value of 0, the AC coefficient must be non-zero, since all video frame coding blocks must include at least one non-zero coefficient when entropy coding is performed, and therefore the coding process for the syntax element indicating whether the AC coefficient includes a non-zero coefficient can be omitted to reduce the amount of information to be coded. If the value of the DC coefficient is not 0, it is necessary to determine a condition of a non-zero coefficient included in the AC coefficient, then determine a value of a syntax element indicating whether the AC coefficient includes a non-zero coefficient according to the condition of the non-zero coefficient included in the AC coefficient, and then perform encoding processing on the syntax element indicating whether the AC coefficient includes a non-zero coefficient according to a context of the AC coefficient.
As shown with continued reference to fig. 3, in step S340, the AC coefficient is subjected to encoding processing according to a value of a syntax element indicating whether the AC coefficient includes a non-zero coefficient.
In one embodiment of the present application, the encoding process for the AC coefficients may be omitted if the value of the syntax element used to indicate whether the AC coefficients contain non-zero coefficients indicates that the AC coefficients do not contain non-zero coefficients. And if the value of the syntax element used for indicating whether the AC coefficient comprises the nonzero coefficient indicates that the AC coefficient comprises the nonzero coefficient, sequentially encoding the AC coefficients contained in the video frame encoding blocks according to the scanning order.
It should be noted that the execution sequence of each step shown in fig. 3 is only an illustration, and in other embodiments of the present application, the execution sequence of step S320, step S330, and step S340 may be adjusted according to actual needs, for example, step S320, step S330, and step S340 are executed simultaneously.
The technical solution of the embodiment shown in fig. 3 enables the DC coefficient and the AC coefficient in the video frame coding block to be separated and respectively subjected to coding processing, and further more reasonable coding processing can be performed for the characteristics of the DC coefficient and the AC coefficient, which is beneficial to improving coding efficiency. Meanwhile, because the value of the DC coefficient can be directly obtained according to the coding of the DC coefficient, it is not necessary to perform coding processing on a syntax element for indicating whether the DC coefficient includes a non-zero coefficient, and it can also be inferred whether the AC coefficient includes a non-zero coefficient (for example, if the value of the DC coefficient is 0, the AC coefficient must include a non-zero coefficient), and further it can be selected whether to perform coding processing on the syntax element for indicating whether the AC coefficient includes a non-zero coefficient, and furthermore, run and last _ flag coding on the DC coefficient is not necessary, so that some unnecessary information coding can be saved, and the coding efficiency is improved.
Fig. 4 shows a flowchart of a video decoding method according to an embodiment of the present application, which can be performed by the video decoding apparatus described in the foregoing embodiments. Referring to fig. 4, the video decoding method at least includes steps S410 to S440, which are described in detail as follows:
in step S410, encoded data corresponding to a video frame to be decoded is obtained, where the encoded data includes encoding results obtained by encoding a DC coefficient and an AC coefficient in a video frame encoding block respectively.
In step S420, a decoding process is performed based on the encoding result of the DC coefficient to obtain the DC coefficient.
In an embodiment of the present application, a decoding process may be performed according to a context of the DC coefficient to obtain a value of the DC coefficient, where the value of the DC coefficient is obtained through a binarization process, that is, the value of the DC coefficient is 0 or 1.
In one embodiment of the present application, a context for a DC coefficient in a video frame coding block may be determined from values of DC coefficients of neighboring blocks of the video frame coding block. For example, if the DC coefficient of a predetermined number of valid neighboring blocks among valid neighboring blocks of a video frame coding block has a value of 0, the reference variable is determined to be 0, and the valid neighboring blocks are neighboring blocks having edge overlap with the video frame coding block; if the number of the effective adjacent blocks of which the DC coefficient value is 0 in the effective adjacent blocks of the video frame coding block is less than or equal to the preset number, selecting the maximum value and the minimum value of the non-zero DC coefficient from the effective adjacent blocks of the video frame coding block, and determining the value of a reference variable according to the maximum value and the minimum value; the context of the DC coefficient in a coded block of a video frame may then be determined based on the value of the reference variable.
In step S430, it is determined whether a non-zero coefficient is included in the AC coefficients according to the value of the DC coefficient.
In one embodiment of the present application, if the value of the DC coefficient is 0, it is determined that the AC coefficient includes a non-zero coefficient. In this case, the encoding process for syntax elements indicating whether non-zero coefficients are included in the AC coefficients may be omitted when encoding blocks of video frames.
In an embodiment of the present application, if the value of the DC coefficient is 1, decoding processing may be performed according to a context of a syntax element indicating whether the AC coefficient includes a non-zero coefficient, to obtain a value of the syntax element, and determine whether the AC coefficient includes the non-zero coefficient according to the value of the syntax element. For example, if the value of the syntax element is 1, it is determined that the AC coefficient includes a non-zero coefficient; if the value of the syntax element is 0, it is determined that the AC coefficients do not include non-zero coefficients.
In one embodiment of the present application, a context for a syntax element indicating whether a non-zero coefficient is included in an AC coefficient may be determined based on the value of the DC coefficient and the size of the video frame encoding block.
Continuing to refer to fig. 4, in step S440, the AC coefficient is obtained by performing decoding processing on the encoding result of the AC coefficient according to whether the AC coefficient includes a nonzero coefficient.
In one embodiment of the present application, if the AC coefficients do not include non-zero coefficients, all the AC coefficients included in the video frame coding block may be decoded to 0, in which case the video frame coding block may omit the encoding process for the AC coefficients when encoding. If the AC coefficient contains non-zero coefficient, the decoding process can be carried out according to the scanning sequence during the coding to obtain the value of the AC coefficient contained in the video frame coding block.
The technical scheme of the embodiment shown in fig. 4 enables the DC coefficient and the AC coefficient in the video frame coding block to be separated, and further more reasonable decoding processing can be performed according to the characteristics of the DC coefficient and the AC coefficient, which is beneficial to improving the decoding efficiency. Meanwhile, because the value of the DC coefficient can be directly obtained according to the coding of the DC coefficient, the decoding processing of a syntax element for indicating whether the DC coefficient contains a nonzero coefficient is not needed, and run and last _ flag decoding of the DC coefficient is also not needed, so that the decoding efficiency can be improved.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
in one embodiment of the present application, the DC coefficients and AC coefficients contained in the video frame coding blocks can be separated, i.e., the DC coefficients and AC coefficients are divided into different bands, where band0 contains only DC coefficients and band1 contains all AC coefficients except DC coefficients.
In one embodiment of the present application, after separating the DC coefficient and the AC coefficient, syntax elements DC _ level and AC _ band _ flag may be defined. Wherein DC _ level represents the magnitude of the DC coefficient; the AC _ band _ flag indicates whether the band1 in which the AC coefficient is located includes a non-zero coefficient, that is, all coefficients in the band1 can be traversed, if the band1 includes a non-zero coefficient, the value of the syntax element AC _ band _ flag is 1, otherwise, the value of the syntax element AC _ band _ flag is 0.
Since band0 contains only one DC coefficient, the encoding of this coefficient can directly know its own value, and therefore no additional syntax element indicating whether band0 contains non-zero coefficients needs to be encoded at the time of encoding. Once the value of the DC coefficient is known to be 0, it can be concluded that the AC _ band _ flag must be non-zero, so some extra bit representation can be saved, i.e. when the DC coefficient is 0, there is no need to encode the AC _ band _ flag. Meanwhile, band0 with the DC coefficient is not used for coding run and last _ flag. Furthermore, since DC coefficients and AC coefficients are of essentially different significance, it is reasonable to encode them separately, and more reasonable contexts can also be designed for DC coefficients alone.
In one embodiment of the present application, for band0, i.e., DC band, run and last _ flag in the band need not be encoded when encoding, and the value of the DC coefficient may be encoded based on its context.
For the band1, that is, the AC band, if the DC _ level value is not 0 during encoding, it is necessary to determine the value of the AC _ band _ flag according to the condition of the non-zero coefficient included in the band1, and then encode the value of the AC _ band _ flag. Meanwhile, if the value of the AC _ band _ flag is 1, the coefficients in the band1 need to be encoded according to the scanning order, that is, the run value, the level value, and the last _ flag of the non-zero coefficient in the band1 need to be encoded; if the AC _ band _ flag has a value of 0, the encoding process of band1 may be omitted.
In an embodiment of the present application, in decoding, for the band0, the value of the DC coefficient may be decoded based on the video frame code stream and the context of the DC coefficient, so as to obtain the value of DC _ level.
For band1, during decoding, if the DC _ level value is not 0, performing decoding processing according to the video frame code stream and the context of the AC _ band _ flag to obtain the value of the AC _ band _ flag; if the value of DC _ level is 0, it may be determined that the value of AC _ band _ flag is 1. If the value of the AC _ band _ flag is 1, decoding the band1 according to the scanning sequence during encoding, namely decoding to obtain a run value, a level value and a last _ flag of a non-zero coefficient in the band 1; if the value of AC _ band _ flag is 0, all coefficients in band1 can be decoded to 0.
In the embodiments of the present application, since syntax elements DC _ level and AC _ band _ flag are introduced, the embodiments of the present application also propose context design for DC _ level and AC _ band _ flag.
In an embodiment of the present application, the DC _ Level may be binarized, for example, by using a binary code method typical in AVS (Audio Video coding Standard), or by using another binarization method. For the context design of DC _ level, the context design may be designed by referring to the DC _ level values of several already encoded \ decoded encoding blocks in adjacent blocks around the current encoding block.
For example, it is assumed that DC _ level has 24 contexts, and each of the contexts includes 12 in terms of luma (luminance) and chroma (chrominance). Let preLevel be the value of DC _ level estimated from the neighboring blocks of the current coding block, and an effective neighboring block is a block with an edge overlap with the current coding block, for example, the current coding block shown in fig. 5 has 5 effective neighboring blocks.
In one embodiment of the present application, if DC _ Level of more than half of the valid neighboring blocks of the current coding block is 0, then preLevel is 0; if the number of blocks with a DC _ Level of 0 in the effective adjacent blocks of the current coding block is not more than half, the maximum value and the minimum value can be selected from the non-zero DC _ levels in the effective adjacent blocks, then the average value of the maximum value and the minimum value is calculated and rounded down to obtain a preLevel. After deriving preLevel, the context for DC _ Level can be determined by the following equation:
ctx_index_start=min(preLevel,5)*2+(ch_type==luma)?0:12。
wherein ctx _ index _ start is an integer variable, and ch _ type represents a scanned channel type; ctx _ index _ start represents the context index number of DC _ Level.
In one embodiment of the application, the AC _ band _ flag is mainly referenced to DC _ level and coding block size, which in one example may have 4 contexts, each containing 2 in luma and chroma. The context of the AC _ band _ flag is designed as follows:
offset=(DC_Level!=0)&&(width*height>64)?0:1;
ctx_index=offset+(ch_type==luma)?0:2。
wherein, offset and ctx _ index are integer variables, and ch _ type represents the scanned channel type; ctx _ index represents a context index number of AC _ band _ flag; width and height represent the width and height of the coding block, respectively.
In an embodiment of the present application, the context design of DC _ Level may refer to information of a number of coded/decoded coding blocks in neighboring blocks around a current coding block, and may also be designed by using the number of nonzero coefficients in the neighboring blocks.
In the technical solution in the above embodiment of the present application, since the DC coefficient has a unique statistical characteristic, which is a direct current component of the coefficient and contains most of information of the whole block, performing syntax element design alone is beneficial to improving compression efficiency; meanwhile, the DC coefficient is independently coded, so that whether the AC coefficient contains a nonzero coefficient can be implied, run coding and last _ flag coding of the DC coefficient can be saved, and the code rate is greatly saved; in addition, the AC _ band _ flag may not be encoded at any time, and may be estimated by the value of the DC coefficient, so that unnecessary encoding information may be saved, which is advantageous to improve encoding efficiency.
Embodiments of the apparatus of the present application are described below, which may be used to perform the methods of the above-described embodiments of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method described above in the present application.
Fig. 6 shows a block diagram of a video decoding apparatus according to an embodiment of the present application.
Referring to fig. 6, a video decoding apparatus 600 according to an embodiment of the present application includes: an acquisition unit 602, a first decoding unit 604, a determination unit 606, and a second decoding unit 608.
The acquiring unit 602 is configured to acquire encoded data corresponding to a video frame to be decoded, where the encoded data includes encoding results obtained by encoding a DC coefficient and an AC coefficient in a video frame encoding block respectively; the first decoding unit 604 is configured to perform decoding processing based on an encoding result of the DC coefficient to obtain the DC coefficient; the determining unit 606 is configured to determine whether the AC coefficients include a non-zero coefficient according to the value of the DC coefficient; the second decoding unit 608 is configured to perform decoding processing on the encoding result of the AC coefficient according to whether the AC coefficient includes a nonzero coefficient, so as to obtain the AC coefficient.
In some embodiments of the present application, based on the foregoing scheme, the first decoding unit 604 is configured to: and decoding according to the context of the DC coefficient to obtain the value of the DC coefficient, wherein the value of the DC coefficient is obtained through binarization processing.
In some embodiments of the present application, based on the foregoing scheme, the first decoding unit 604 is further configured to: determining a context of a DC coefficient in the video frame coding block according to values of DC coefficients of neighboring blocks of the video frame coding block.
In some embodiments of the present application, based on the foregoing scheme, the first decoding unit 604 is configured to: determining a reference variable to be 0 if a value of a DC coefficient of a predetermined number of valid neighboring blocks among valid neighboring blocks of the video frame coding block is 0, the valid neighboring blocks being neighboring blocks having edge overlap with the video frame coding block; if the number of the effective adjacent blocks of which the DC coefficient value is 0 in the effective adjacent blocks of the video frame coding block is less than or equal to the preset number, selecting the maximum value and the minimum value of the non-zero DC coefficient from the effective adjacent blocks of the video frame coding block, and determining the value of the reference variable according to the maximum value and the minimum value; determining a context of a DC coefficient in the video frame coding block based on the value of the reference variable.
In some embodiments of the present application, based on the foregoing scheme, the determining unit 606 is configured to: and if the value of the DC coefficient is 0, determining that the AC coefficient contains a non-zero coefficient, wherein if the value of the DC coefficient is 0, omitting an encoding process of a syntax element for indicating whether the AC coefficient contains the non-zero coefficient when encoding the video frame encoding block.
In some embodiments of the present application, based on the foregoing scheme, the determining unit 606 is configured to: and if the value of the DC coefficient is 1, decoding according to the context of the syntax element to obtain the value of the syntax element, and determining whether the AC coefficient comprises a nonzero coefficient according to the value of the syntax element.
In some embodiments of the present application, based on the foregoing scheme, the determining unit 606 is further configured to: determining a context of the syntax element as a function of a value of the DC coefficient and a size of the video frame encoding block.
In some embodiments of the present application, based on the foregoing scheme, the second decoding unit 608 is configured to: if the AC coefficients do not contain non-zero coefficients, decoding all AC coefficients contained in the video frame coding block into 0, wherein the video frame coding block omits the coding process of the AC coefficients during coding; and if the AC coefficient contains a nonzero coefficient, decoding according to the scanning sequence during encoding to obtain the value of the AC coefficient contained in the video frame encoding block.
Fig. 7 shows a block diagram of a video encoding apparatus according to an embodiment of the present application.
Referring to fig. 7, a video encoding apparatus 700 according to an embodiment of the present application includes: a determination unit 702 and an encoding unit 704.
Wherein the determining unit 702 is configured to determine a DC coefficient and an AC coefficient contained in a video frame coding block; the encoding unit 704 is configured to perform encoding processing on the DC coefficient, perform encoding processing on a syntax element indicating whether the AC coefficient includes a non-zero coefficient according to a value of the DC coefficient, and perform encoding processing on the AC coefficient according to a value of the syntax element.
In some embodiments of the present application, based on the foregoing scheme, the encoding unit 704 is configured to: if the value of the DC coefficient is 0, omitting the encoding process of the syntax element; and if the value of the DC coefficient is not 0, determining the value of the syntax element according to the condition of the nonzero coefficient contained in the AC coefficient, and encoding the syntax element according to the context of the AC coefficient.
In some embodiments of the present application, based on the foregoing scheme, the encoding unit 704 is configured to: omitting an encoding process for the AC coefficient if a value of the syntax element indicates that the AC coefficient does not include a non-zero coefficient; and if the value of the syntax element indicates that the AC coefficients contain nonzero coefficients, sequentially coding the AC coefficients contained in the video frame coding blocks according to a scanning sequence.
FIG. 8 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 800 of the electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 8, a computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for system operation are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An Input/Output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method illustrated by the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. When the computer program is executed by the Central Processing Unit (CPU)801, various functions defined in the system of the present application are executed.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with a computer program embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.