CN110536134B - Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus - Google Patents

Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus Download PDF

Info

Publication number
CN110536134B
CN110536134B CN201910927079.5A CN201910927079A CN110536134B CN 110536134 B CN110536134 B CN 110536134B CN 201910927079 A CN201910927079 A CN 201910927079A CN 110536134 B CN110536134 B CN 110536134B
Authority
CN
China
Prior art keywords
resolution
preset threshold
block
decoded
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910927079.5A
Other languages
Chinese (zh)
Other versions
CN110536134A (en
Inventor
高欣玮
毛煦楠
谷沉沉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910927079.5A priority Critical patent/CN110536134B/en
Publication of CN110536134A publication Critical patent/CN110536134A/en
Application granted granted Critical
Publication of CN110536134B publication Critical patent/CN110536134B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a video encoding method, a video decoding method, a video encoding device, a video decoding device, a storage medium and an electronic device. The video coding method comprises the following steps: obtaining a quantization parameter QP of a reference block of a block to be coded in a video frame to be coded, wherein the reference block is a coded block which is referred by the block to be coded in the video frame to be coded; determining a target resolution for coding the block to be coded according to the quantization parameter QP; and coding the block to be coded according to the target resolution. The invention solves the technical problem of poor video quality caused by relatively large coding distortion of different blocks in one frame of a video by adopting the same resolution in the existing video coding process.

Description

Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
Technical Field
The present invention relates to the field of computers, and in particular, to a video encoding method, a video decoding method, a video encoding device, a video decoding device, a storage medium, and an electronic device.
Background
With the development of digital media technology and computer technology, video is applied to various fields, such as mobile communication, network monitoring, network television, and the like. With the improvement of hardware performance and screen resolution, the demand of users for high-definition video is increasingly strong.
If different blocks in a frame of a video are all encoded by adopting high resolution, under the condition that the transmission bandwidth is small, the peak signal-to-noise ratio PSNR1 corresponding to the different blocks in the frame of the video encoded by adopting high resolution is lower than the peak signal-to-noise ratio PSNR2 corresponding to the different blocks in the frame of the video encoded by adopting low resolution, that is, the peak signal-to-noise ratio PSNR1 is relatively small when the transmission bandwidth is small and the distortion is relatively large when the different blocks in the frame of the video are encoded by adopting high resolution.
Similarly, if different blocks in a frame of the video are encoded with low resolution, the peak signal-to-noise ratio PSNR3 corresponding to the low-resolution encoding of the different blocks in the frame of the video is lower than the peak signal-to-noise ratio PSNR4 corresponding to the high-resolution encoding of the different blocks in the frame of the video when the transmission bandwidth is large, that is, the peak signal-to-noise ratio PSNR3 corresponding to the low-resolution encoding of the different blocks in the frame of the video is relatively small when the transmission bandwidth is large, and the distortion is relatively large.
Under the condition of limited moving bandwidth, the existing method for encoding different blocks in a frame of a video by using the same resolution ratio may have the problem that certain scenes are relatively large in distortion, so that the video quality is poor.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
Embodiments of the present invention provide a video encoding method and apparatus, a video decoding method and apparatus, a storage medium, and an electronic apparatus, so as to at least solve the technical problem of poor video quality caused by relatively large coding distortion when different blocks in a frame of a video are coded with the same resolution in the existing video encoding process.
According to an aspect of the embodiments of the present invention, there is also provided a video decoding method, including:
obtaining a quantization parameter QP of a reference block of a block to be decoded in a video frame to be decoded, wherein the reference block is a decoded block referred to by the block to be decoded in the video frame to be decoded;
determining a target resolution for decoding the block to be decoded according to the quantization parameter QP, wherein the target resolution is a first resolution under the condition that the quantization parameter QP is less than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
According to another aspect of the embodiments of the present invention, there is also provided a video encoding method, including:
obtaining a quantization parameter QP of a reference block of a block to be coded in a video frame to be coded, wherein the reference block is a coded block which is referred by the block to be coded in the video frame to be coded;
determining a target resolution for encoding the block to be encoded according to the quantization parameter QP, wherein the target resolution is a first resolution when the quantization parameter QP is smaller than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
According to another aspect of the embodiments of the present invention, there is also provided a video decoding apparatus, including:
a first obtaining module, configured to obtain a quantization parameter QP of a reference block of a block to be decoded in a video frame to be decoded, where the reference block is a decoded block referred to by the block to be decoded in the video frame to be decoded;
a first determining module, configured to determine, according to the quantization parameter QP, a target resolution for decoding the block to be decoded, where the target resolution is a first resolution when the quantization parameter QP is smaller than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
According to another aspect of the embodiments of the present invention, there is also provided a video encoding processing apparatus, including:
a second obtaining module, configured to obtain a quantization parameter QP of a reference block of a block to be coded in a video frame to be coded, where the reference block is a coded block referred to by the block to be coded in the video frame to be coded;
a second determining module, configured to determine, according to the quantization parameter QP, a target resolution for encoding the block to be encoded, where the target resolution is the first resolution when the quantization parameter QP is smaller than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
According to yet another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned video encoding method or the above-mentioned video decoding method when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the video encoding method or the video decoding method through the computer program.
In the embodiment of the invention, the target resolution of the current block to be coded is decided by the quantization parameter QP of the reference block of the block to be coded in the video frame to be coded, the block to be coded is coded according to the target resolution, and different resolutions are adopted for coding different blocks, so that the coding distortion is relatively small, the video quality is improved, and the technical problem of poor video quality caused by relatively large coding distortion of different blocks in one frame of a video by adopting the same resolution in the existing video coding process is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention and do not constitute a limitation of the invention. In the drawings:
FIG. 1 is a diagram illustrating an exemplary embodiment of a video encoding method and a video decoding method;
FIG. 2 is a diagram illustrating an internal structure of the terminal of FIG. 1 according to one embodiment;
FIG. 3 is a diagram illustrating the internal structure of the server of FIG. 1 in one embodiment;
fig. 4 is a flowchart of a video encoding method according to an embodiment of the present invention;
FIG. 5 is a first schematic diagram of video encoding according to an embodiment of the present invention;
FIG. 6 is a second diagram of video encoding according to an embodiment of the present invention;
fig. 7 is a flowchart of a video decoding method according to an embodiment of the present invention;
fig. 8 is a block diagram of a video decoding apparatus according to an embodiment of the present invention;
fig. 9 is a block diagram of a video encoding apparatus according to an embodiment of the present invention;
fig. 10 is a block diagram of a video encoding apparatus according to a preferred embodiment of the present invention;
FIG. 11 is a first schematic structural diagram of an alternative electronic device according to an embodiment of the invention;
fig. 12 is a schematic structural diagram of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order to make those skilled in the art better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a diagram illustrating an application environment in which a video encoding method and a video decoding method are executed according to an embodiment. As shown in fig. 1, the application environment includes a terminal 110 and a server 120, wherein the terminal 110 and the server 120 communicate via a network.
The terminal 110 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, and the like. The video encoding method and the video decoding method may be completed in the terminal 110 or the server 120, and the terminal 110 may perform adaptive resolution encoding on a video frame to be encoded by using the video encoding method and then transmit the encoded video frame to the server 120, or may receive encoded data of the adaptive resolution from the server 120 and perform decoding by using the video decoding method to generate a decoded video frame. The server 120 may transcode the stored codestream, where the video encoding method is done at the server, and if the server 120 needs to decode the codestream, the video decoding method is done at the server.
In one embodiment, the internal structure of the terminal 110 in fig. 1 is as shown in fig. 2, and the terminal 110 includes a processor, a graphic processing unit, a storage medium, a memory, a network interface, a display screen, and an input device, which are connected through a system bus. The storage medium of the terminal 110 stores an operating system, and further includes a video encoding apparatus and/or a video decoding apparatus, which are used to implement a video encoding method and/or a video decoding method suitable for the terminal. The processor is used to provide computational and control capabilities that support the operation of the entire terminal 110. The graphic processing unit in the terminal 110 is configured to provide at least a rendering capability of a display interface, the memory provides an environment for the operation of the video encoding device and/or the video decoding device in the storage medium, and the network interface is configured to perform network communication with the server 120. The display screen is used for displaying an application interface and the like, such as decoding video, and the input device is used for receiving commands or data input by a user. For a terminal 110 with a touch screen, the display screen and input device may be a touch screen. The structure shown in fig. 2 is a block diagram of only a part of the structure related to the present application, and does not constitute a limitation of the terminal to which the present application is applied, and a specific terminal or server may include more or less components than those shown in the figure, or combine some components, or have different arrangements of components.
In one embodiment, the internal structure of the server 120 in fig. 1 is shown in fig. 3, and the server 120 includes a processor, a storage medium, a memory, and a network interface connected by a system bus. The storage medium of the server 120 stores an operating system, a database, a video encoding device and/or a video decoding device, wherein the database is used for storing data, and the video encoding device and/or the video decoding device are used for implementing a video encoding method and/or a video decoding method suitable for the server 120. The processor of the server 120 is used to provide computing and control capabilities to support the operation of the entire server 120. The memory of the server 120 provides an environment for the operation of the video encoding device and/or the video decoding device in the storage medium. The network interface of the server 120 is used for communication with the external terminal 110 through a network connection. The configurations shown in fig. 2 and 3 are block diagrams of only a portion of the configurations associated with the present application and do not constitute a limitation on the terminal to which the present application is applied, and a particular terminal or server may include more or fewer components than shown, or combine certain components, or have a different arrangement of components.
An embodiment of the present invention provides a video encoding method, which is exemplified by a terminal or a server applied in the above application environment, and fig. 4 is a flowchart of the video encoding method according to the embodiment of the present invention, as shown in fig. 4, including the following steps:
step S402, obtaining a quantization parameter QP of a reference block of a block to be coded in a video frame to be coded, wherein the reference block is a coded block referred to by the block to be coded in the video frame to be coded;
step S404, determining a target resolution for coding the block to be coded according to the quantization parameter QP; wherein, when the quantization parameter QP of the encoded block is smaller than a first preset threshold, the target resolution is a first resolution; the target resolution is a second resolution when the quantization parameter QP of the encoded block is greater than or equal to the first predetermined threshold, wherein the first resolution is greater than the second resolution.
After determining the target resolution, the block to be encoded may be encoded according to the target resolution.
Through the steps S402 to S404, the target resolution of the current block to be coded is decided by the quantization parameter QP of the reference block of the block to be coded in the video frame to be coded, the block to be coded can be coded according to the target resolution, and different coding blocks are coded with different resolutions, so that the coding distortion is relatively small, the video quality is improved, and the technical problem of poor video quality caused by relatively large coding distortion for different blocks in one frame of a video in the existing video coding process is solved.
In this embodiment of the present invention, the reference block may be one encoded block or may be multiple encoded blocks, and the step S404 specifically includes:
s4041, in case that the reference block is an encoded block, determining the target resolution according to the quantization parameter QP of the encoded block; the block to be coded is the t-th block in the video frame to be coded, the reference block is the coded t-k-th block, the QP of the t-k-th block is calculated, and the target resolution can be determined according to the QP of the t-k-th block.
S4042, when the reference block includes a plurality of encoded blocks, determining the target resolution according to the weighted average of the quantization parameters QP of the plurality of encoded blocks, specifically, calculating the QP of each encoded block in the reference block, and determining the weighted average of the QPs of all encoded blocks in the reference block, so as to determine the target resolution.
In an embodiment of the present invention, step S4041 may specifically include:
determining the target resolution as a first resolution under the condition that the quantization parameter QP of the one coded block is smaller than a first preset threshold;
in the case that the quantization parameter QP of the one encoded block is greater than or equal to the first preset threshold, the target resolution is determined to be the second resolution, where the first resolution is greater than the second resolution, where the first preset threshold may be preset according to specific situations, for example, the first preset threshold may be set to any number of 30-35, and for example, the first preset threshold may be set to 32.
In an embodiment of the present invention, the second resolution may be further divided into a plurality of levels of resolutions, for example, the second resolution includes: the third resolution, the fourth resolution, the fifth resolution, the sixth resolution, and the like, for example, the third resolution is 3/4 of the width of the first resolution, the fourth resolution is 2/3 of the width of the first resolution, the fifth resolution is 1/2 of the width of the first resolution, and the sixth resolution is 1/3 of the width of the first resolution, where in the case that the first ratio is greater than or equal to the first preset threshold, the determining that the target resolution is the second resolution includes:
determining the target resolution as a third resolution when the quantization parameter QP of the one encoded block is greater than or equal to the first preset threshold and less than a second preset threshold; the second preset threshold may be set in advance, for example, the second preset threshold may be set to 36, and when the QP of one encoded block is greater than or equal to 32 and less than 37, the target resolution may be determined to be 3/4 of the width and height of the first resolution.
Determining the target resolution as a fourth resolution under the condition that the quantization parameter QP of the one coded block is greater than or equal to the second preset threshold and smaller than a third preset threshold; the third preset threshold may be preset, for example, the second preset threshold may be set to 40, and when the QP of one encoded block is greater than or equal to 37 and less than 42, it may be determined that the target resolution is 2/3 of the width and height of the first resolution.
Determining the target resolution as a fifth resolution under the condition that the quantization parameter QP of the coded block is greater than or equal to the third preset threshold and smaller than a fourth preset threshold; the fourth preset threshold may be preset, for example, the second preset threshold may be set to 44, and when the QP of one encoded block is greater than or equal to 42 and less than 47, the target resolution may be determined to be 1/2 of the width and height of the first resolution.
In the case that the quantization parameter QP of the one encoded block is greater than or equal to the fourth preset threshold, the target resolution is determined to be the sixth resolution, and when the QP of the one encoded block is greater than or equal to 47, the target resolution may be determined to be 1/3 of the width and height of the first resolution, and it can be seen that the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
In an embodiment of the present invention, the first preset threshold, the second preset threshold, and the third preset threshold, and the fourth preset threshold is positively correlated to a maximum resolution in a preset resolution set, for example, the first preset threshold may be set to 32, the second preset threshold is set to 37, the third preset threshold is set to 42, and the fourth preset threshold is set to 47, where the resolution set includes the first resolution, the second resolution, the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
In an embodiment of the present invention, step S4042 may specifically include:
determining the target resolution as a first resolution under the condition that the weighted average of the quantization parameters QP of the plurality of encoded blocks is smaller than a fifth preset threshold;
when the weighted average of the quantization parameters QP of the multiple encoded blocks is greater than or equal to the fifth preset threshold, determining the target resolution as the second resolution, where the first resolution is greater than the second resolution, where the fifth preset threshold may be the same as or different from the first preset threshold, and may be preset according to specific situations, for example, the fifth preset threshold may be set to any number from 30 to 35, and for example, the fifth preset threshold may be set to 35.
In an embodiment of the present invention, the second resolution may be further divided into a plurality of levels of resolutions, for example, the second resolution includes: a third resolution, a fourth resolution, a fifth resolution, a sixth resolution, and the like, for example, the third resolution is 3/4 of the width of the first resolution, the fourth resolution is 2/3 of the width of the first resolution, the fifth resolution is 1/2 of the width of the first resolution, and the sixth resolution is 1/3 of the width of the first resolution, and correspondingly, in the case that the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the fifth preset threshold, determining that the target resolution is the second resolution includes:
determining the target resolution as a third resolution when the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the fifth preset threshold and less than a sixth preset threshold; the sixth preset threshold may be preset, for example, the sixth preset threshold may be set to 40, and when the weighted sum of QPs of the multiple coded blocks is greater than or equal to 35 and less than 40, the target resolution may be determined to be 3/4 of the width and height of the first resolution.
Determining the target resolution as a fourth resolution when the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the sixth preset threshold and less than a seventh preset threshold; wherein, the seventh preset threshold may be preset, for example, the seventh preset threshold may be set to 45, and when the weighted sum of QPs of the plurality of encoded blocks is greater than or equal to 40 and less than 45, the target resolution may be determined to be 2/3 of the width and height of the first resolution.
Determining the target resolution as a fifth resolution when the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the seventh preset threshold and less than an eighth preset threshold; the eighth preset threshold may be preset, for example, the eighth preset threshold may be set to 50, and when the weighted sum of QPs of the multiple encoded blocks is greater than or equal to 45 and less than 50, the target resolution may be determined to be 1/2 of the width and height of the first resolution.
The target resolution is determined to be the sixth resolution in a case that the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the eighth preset threshold, and the target resolution may be determined to be 1/3 of the sixth resolution when the weighted sum of the QP of the plurality of encoded blocks is greater than or equal to 50, where the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
In an embodiment of the present invention, the fifth pre-collection threshold, the sixth pre-set threshold, and the seventh pre-set threshold, the eighth pre-set threshold is positively correlated with a maximum resolution in a predetermined resolution set, for example, the fifth pre-set threshold is set to 35, the sixth pre-set threshold is set to 40, the seventh pre-set threshold is set to 45, and the eighth pre-set threshold is set to 50, where the resolution set includes the first resolution, the second resolution, the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
In the embodiment of the present invention, in a case where the reference block includes a plurality of encoded blocks, the plurality of encoded blocks are consecutive encoded blocks, or discontinuous encoded blocks.
In the embodiment of the present invention, the flag bit directly carries the target Resolution, where the first Resolution, the second Resolution, the third Resolution, the fourth Resolution, the fifth Resolution, and the sixth Resolution may be represented by 3 bits, for example, 000 represents the first Resolution, 001 represents the second Resolution, 010 represents the third Resolution, 011 represents the fourth Resolution, 100 represents the fifth Resolution, and 101 represents the sixth Resolution, the flag bit may be an Adaptive Resolution flag bit, and the name may be Adaptive Resolution.
In the video coding process of the embodiment of the invention, different blocks in a frame in a video are coded by adopting corresponding resolution in a self-adaptive manner, the information (QP) of the neighborhood coded block is utilized to decide whether the resolution adopted by the current block is high resolution or low resolution, and the decoding resolution of the current block can be determined at a decoding end according to the same decision rule, so that the decoding is completed quickly.
The decision process of the coding resolution used by the coding block of the present invention will be described in detail below.
For a current coding block t to be coded in a video, referring to the relation between the QP value of 1 coding block which is adjacent to the current coding block t and has finished coding or the weighted average value of the QPs of a plurality of coding blocks (continuous or discontinuous) and a threshold value, and selecting the corresponding resolution for the t-th coding block to code.
In the first mode, when the t-th coding block in the video is coded, the QP value of the t-k coding block which is coded in the neighborhood is obtained. If the QP value is larger than the preset threshold value, the coding quality is poor, and therefore the t-th coding block is coded by selecting low resolution; if the QP value is less than the predetermined threshold, it indicates that the coding quality is good, so that the t-th coding block is selected to be coded with high resolution.
In the second mode, when the t-th coding block in the video is coded, the weighted mean value of the QPs of the plurality of coding blocks which are coded in the neighborhood is obtained. If the weighted average value of the QP is greater than the preset threshold value, the coding quality is poor, and therefore the t-th coding block is coded by selecting low resolution; if the weighted mean of the QP is less than the predetermined threshold, it indicates that the coding quality is good, and therefore the t-th coding block is selected to be coded with high resolution.
The predetermined threshold is determined according to the type of the encoded block, the resolution, and other factors.
Fig. 5 is a schematic diagram of video coding according to an embodiment of the present invention, as shown in fig. 5, in the video coding process of the present invention, the coding resolution adopted by different blocks in one frame in the video is self-analyzed by using information of a current coding block, which can achieve the purpose that the corresponding peak signal-to-noise ratio is relatively large and distortion is relatively small both in the case that the bandwidth ratio of transmission is small (for example, smaller than the bandwidth threshold Th shown in fig. 5) and in the case that the bandwidth ratio of transmission is large (for example, larger than the bandwidth threshold Th shown in fig. 5).
In addition, because the coding resolution adopted by the decision is adaptive to different blocks in one frame of the video, the corresponding resolution does not need to be selected according to the intersections (fig. 6 is a schematic diagram two of video coding according to an embodiment of the present invention, as shown by the intersections in fig. 6) corresponding to different types of videos or different frames of the same video or different blocks in the same frame when the frames in the video are coded, and the coding complexity is reduced.
An embodiment of the present invention provides a video decoding method, which is exemplified by a terminal or a server applied in the above application environment, and fig. 7 is a flowchart of the video decoding method according to the embodiment of the present invention, as shown in fig. 7, including the following steps:
step S702, obtaining a quantization parameter QP of a reference block of a block to be decoded in a video frame to be decoded, wherein the reference block is a decoded block referred to by the block to be decoded in the video frame to be decoded;
the reference block in the embodiment of the present invention may be a decoded block adjacent to the block to be decoded, or may be a decoded block that is not adjacent, the interval between the block to be decoded and the reference block is not greater than n pixels, the reference block is located in front of the coding time sequence of the current block to be decoded, or located in front of the decoding time sequence of the current block to be decoded, that is, the decoded block or the decoded block of the preamble.
Step S704, determining a target resolution for decoding the block to be decoded according to the quantization parameter QP, where the target resolution is a first resolution when the quantization parameter QP is smaller than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
After the target resolution is determined, the block to be decoded may be decoded according to the target resolution.
Through the steps S702 to S706, the decoding side determines the target resolution by using the quantization parameter QP of the reference block of the block to be decoded in the video frame to be decoded, and since the target resolution is determined in the same manner as the encoding side, the determined target resolution is the same as the resolution used in encoding, and the block to be decoded can be decoded according to the determined target resolution, thereby solving the technical problem that in the existing video encoding process, different blocks in one frame of a video are encoded by using the same resolution, and the decoding process is performed by using the same resolution, so that the distortion in the video transmission process is relatively large, and the video quality is poor.
In the embodiment of the invention, at least one pair of blocks to be decoded to be reconstructed is determined from a current video frame, wherein each pair of blocks to be decoded in the at least one block to be decoded comprises a first block to be decoded with a first resolution and a second block to be decoded with a second resolution, and the first block to be decoded and the second block to be decoded are adjacent blocks to be decoded;
adjusting the first resolution of the first block to be decoded to a target resolution, and adjusting the second resolution of the second block to be decoded to the target resolution;
determining a first edge pixel point set from the first block to be decoded and determining a second edge pixel point set from the second block to be decoded, wherein the position of the first edge pixel point set is adjacent to the position of the second edge pixel point set;
and filtering the first edge pixel point set to obtain a filtered first edge pixel point set, and filtering the second edge pixel point set to obtain a filtered second edge pixel point set, wherein the filtered first edge pixel point set is matched with the filtered second edge pixel point set.
And a first difference value between the pixel value of the ith pixel point in the first edge pixel point set after filtering and the pixel value of the jth pixel point corresponding to the ith pixel point in the second edge pixel point set after filtering is smaller than a second difference value between the pixel value of the ith pixel point in the first edge pixel point set and the pixel value of the jth pixel point in the second edge pixel point set, i is a positive integer and is less than or equal to the total number of the pixel points in the first edge pixel point set, and j is a positive integer and is less than or equal to the total number of the pixel points in the second edge pixel point set.
Wherein adjusting to the target resolution comprises:
1) Adjusting the second resolution to the first resolution in a case where the target resolution is equal to the first resolution;
2) Adjusting the first resolution to the second resolution in a case where the target resolution is equal to the second resolution;
3) In the case where the target resolution is equal to the third resolution, the first resolution is adjusted to the third resolution, and the second resolution is adjusted to the third resolution, wherein the third resolution is different from the first resolution and different from the second resolution.
By adjusting the resolution of the block to be decoded and performing edge filtering on the edge pixel point set determined in the block to be decoded, obvious seams can be avoided in the video in the reconstruction process, so that the content in the video can be accurately restored, and the technical problem of video distortion caused by inconsistent resolution is solved.
In an embodiment of the present invention, the step S704 specifically includes:
s7041, in a case where the reference block is a decoded block, determining the target resolution according to a quantization parameter QP of the decoded block; the block to be decoded is the t-th block in the video frame to be decoded, the reference block is the decoded t-k block, the QP of the t-k block is calculated, and the target resolution can be determined according to the QP of the t-k block.
S7042, when the reference block is a plurality of decoded blocks, determining the target resolution according to the weighted average of the quantization parameters QP of the plurality of decoded blocks, specifically, calculating the QP of each decoded block in the reference block, and determining the weighted average of the QPs of all decoded blocks in the reference block, so as to determine the target resolution.
In an embodiment of the present invention, the reference block may be one decoded block or a plurality of decoded blocks, and the step S7041 may specifically include:
determining the target resolution as a first resolution in case the quantization parameter QP of the one decoded block is smaller than a first preset threshold;
in the case that the quantization parameter QP of the decoded block is greater than or equal to the first preset threshold, the target resolution is determined to be the second resolution, where the first resolution is greater than the second resolution, where the first preset threshold may be preset according to specific situations, for example, the first preset threshold may be set to any number of 30-35, and for example, the first preset threshold may be set to 32.
Further, the second resolution may be divided into a plurality of levels of resolution, for example, the second resolution includes: a third resolution, a fourth resolution, a fifth resolution, a sixth resolution, and the like, for example, the third resolution is 3/4 of the width of the first resolution, the fourth resolution is 2/3 of the width of the first resolution, the fifth resolution is 1/2 of the width of the first resolution, and the sixth resolution is 1/3 of the width of the first resolution, and correspondingly, in the case that the quantization parameter QP of the decoded block is greater than or equal to the first preset threshold, determining that the target resolution is the second resolution includes:
determining the target resolution as a third resolution when the quantization parameter QP of the decoded block is greater than or equal to the first preset threshold and less than a second preset threshold; the second preset threshold may be preset, for example, the second preset threshold may be set to 36, and when the QP of one decoded block is greater than or equal to 32 and less than 37, the target resolution may be determined to be 3/4 of the width and height of the first resolution.
Determining the target resolution as a fourth resolution when the quantization parameter QP of the decoded block is greater than or equal to the second preset threshold and less than a third preset threshold; the third preset threshold may be preset, for example, the second preset threshold may be set to 40, and when the QP of one decoded block is greater than or equal to 37 and less than 42, it may be determined that the target resolution is 2/3 of the width and height of the first resolution.
Determining the target resolution as a fifth resolution when the quantization parameter QP of the decoded block is greater than or equal to the third preset threshold and less than a fourth preset threshold; the fourth preset threshold may be preset, for example, the second preset threshold may be set to 44, and when the QP of one decoded block is greater than or equal to 42 and less than 47, the target resolution may be determined to be 1/2 of the width and height of the first resolution.
In the case that the quantization parameter QP of the decoded block is greater than or equal to the fourth preset threshold, the target resolution is determined to be the sixth resolution, and in the case that the QP of the decoded block is greater than or equal to 47, the target resolution may be determined to be 1/3 of the width and height of the first resolution, and it can be seen that the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
For a current block to be decoded in a video, if a quantization parameter QP of a decoded block is less than a first preset threshold, it indicates that inter-frame motion of the current decoded block is complex, and the current decoded block is encoded by using a high resolution, that is, the current decoded block is encoded by using the first resolution. If the second preset threshold > quantization parameter QP > = the first preset threshold of one decoded block, it indicates that the intra texture of the current decoded block is complex, and the current decoded block is encoded by using high-resolution width-height 3/4 samples, that is, the third resolution may be 3/4 of the width-height of the first resolution; if the third preset threshold > quantization parameter QP > = the second preset threshold of one decoded block, it indicates that the intra texture of the current decoded block is complex, and the current decoded block is encoded by using high-resolution 2/3 samples of width and height, that is, the fourth resolution may be 2/3 of the width and height of the first resolution; if the fourth preset threshold > quantization parameter QP > = the third preset threshold of one decoded block, it indicates that the intra-frame texture of the current decoded block is complex, and the current decoded block is encoded by using high-resolution width-height 1/2 samples, that is, the fifth resolution may be 1/2 of the width-height of the first resolution; the quantization parameter QP > = the fourth preset threshold for one decoded block, which means that the intra texture of the current decoded block is complex, and the current decoded block is encoded by using high-resolution width-height 1/3 samples, i.e. the sixth resolution may be 1/3 of the width-height of the first resolution, and so on.
In an embodiment of the present invention, the first preset threshold, the second preset threshold, the third preset threshold, and the fourth preset threshold are positively correlated to a maximum resolution in a predetermined resolution set, for example, the first preset threshold may be set to 32, the second preset threshold is set to 37, the third preset threshold is set to 42, and the fourth preset threshold is set to 47, where the resolution set includes the first resolution, the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
In an embodiment of the present invention, the step S7042 may specifically include:
determining the target resolution as a first resolution in case that the weighted average of the quantization parameters QP of the plurality of decoded blocks is less than a fifth preset threshold;
when the weighted average of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the fifth preset threshold, determining that the target resolution is the second resolution, where the first resolution is greater than the second resolution, where the fifth preset threshold may be the same as or different from the first preset threshold, and may be preset according to specific situations, for example, the fifth preset threshold may be set to any number from 30 to 35, and for example, the fifth preset threshold may be set to 35.
Further, the second resolution may be divided into a plurality of levels of resolution, for example, the second resolution includes: a third resolution, a fourth resolution, a fifth resolution, a sixth resolution, and the like, for example, the third resolution is 3/4 of the width of the first resolution, the fourth resolution is 2/3 of the width of the first resolution, the fifth resolution is 1/2 of the width of the first resolution, and the sixth resolution is 1/3 of the width of the first resolution, and correspondingly, in the case that the weighted average of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the fifth preset threshold, determining that the target resolution is the second resolution includes:
determining the target resolution as a third resolution when the weighted average of the quantization parameters QP of the decoded blocks is greater than or equal to the fifth preset threshold and less than a sixth preset threshold; the sixth preset threshold may be preset, for example, the sixth preset threshold may be set to 40, and when the weighted sum of QPs of the plurality of decoded blocks is greater than or equal to 35 and less than 40, the target resolution may be determined to be 3/4 of the width and height of the first resolution.
Determining the target resolution as a fourth resolution when the weighted average of the quantization parameters QP of the decoded blocks is greater than or equal to the sixth preset threshold and less than a seventh preset threshold; wherein, the seventh preset threshold may be preset, for example, the seventh preset threshold may be set to 45, and when the weighted sum of QPs of the plurality of decoded blocks is greater than or equal to 40 and less than 45, the target resolution may be determined to be 2/3 of the width and height of the first resolution.
Determining the target resolution as a fifth resolution when the weighted average of the quantization parameters QP of the decoded blocks is greater than or equal to the seventh preset threshold and less than an eighth preset threshold; the eighth preset threshold may be preset, for example, the eighth preset threshold may be set to 50, and when the weighted sum of QPs of the plurality of decoded blocks is greater than or equal to 45 and less than 50, the target resolution may be determined to be 1/2 of the width and height of the first resolution.
The target resolution is determined to be the sixth resolution in a case where the weighted average of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the eighth preset threshold, and the target resolution may be determined to be 1/3 of the sixth resolution when the weighted sum of the QPs of the plurality of decoded blocks is greater than or equal to 50, where the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
For a current block to be decoded in a video, if a weighted mean of quantization parameters QP of a plurality of decoded blocks is less than a first preset threshold, it indicates that inter-frame motion of the current decoded block is complex, and the current decoded block is encoded by using a high resolution, that is, the current decoded block is encoded by using the first resolution. If the second preset threshold > is the weighted mean of the quantization parameters QP of the plurality of decoded blocks > = the first preset threshold, it indicates that the intra texture of the current decoded block is complex, and the current decoded block is encoded by using high-resolution width and height 3/4 samples, that is, the third resolution may be 3/4 of the width and height of the first resolution; if the third preset threshold > the weighted mean of the quantization parameters QP of the plurality of decoded blocks > = the second preset threshold, it indicates that the intra texture of the current decoded block is complex, and the current decoded block is encoded by using high-resolution 2/3 samples of width and height, that is, the fourth resolution may be 2/3 of the width and height of the first resolution; if the fourth preset threshold > the weighted mean value of the quantization parameters QP of the plurality of decoded blocks > = the third preset threshold, it indicates that the intra texture of the current decoded block is complex, and the current decoded block is encoded by using high-resolution 1/2 samples of width and height, that is, the fifth resolution may be 1/2 of the width and height of the first resolution; the weighted mean > = the fourth preset threshold of the quantization parameters QP of a plurality of decoded blocks, which means that the intra texture of the current decoded block is complex, and the current decoded block is encoded by using high-resolution 1/3 samples of width and height, i.e. the sixth resolution may be 1/3 of the width and height of the first resolution, and so on.
In an embodiment of the present invention, the fifth preset threshold, the sixth preset threshold, the seventh preset threshold, and the eighth preset threshold are positively correlated with a maximum resolution in a predetermined resolution set, for example, the fifth preset threshold is set to 35, the sixth preset threshold is set to 40, the seventh preset threshold is set to 45, and the eighth preset threshold is set to 50, where the resolution set includes the first resolution, the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
In the embodiment of the present invention, in the case where the reference block includes a plurality of decoded blocks, the plurality of decoded blocks are consecutive decoded blocks, or discontinuous decoded blocks.
An embodiment of the present invention further provides a video decoding apparatus, and fig. 8 is a block diagram of a video decoding apparatus according to an embodiment of the present invention, as shown in fig. 8, including:
a first obtaining module 82, configured to obtain a quantization parameter QP of a reference block of a block to be decoded in a video frame to be decoded, where the reference block is a decoded block referred to by the block to be decoded in the video frame to be decoded;
a first determining module 84, configured to determine a target resolution for decoding the block to be decoded according to the quantization parameter QP, where the target resolution is a first resolution when the quantization parameter QP is smaller than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
Fig. 9 is a block diagram of a video decoding apparatus according to a preferred embodiment of the present invention, and as shown in fig. 9, the first determining module 84 includes:
a first determining sub-module 92, configured to determine the target resolution according to the quantization parameter QP of one decoded block if the reference block is the one decoded block;
a second determining sub-module 94 for determining the target resolution according to a weighted average of quantization parameters QP of the plurality of decoded blocks in case the reference block is a plurality of decoded blocks.
Optionally, the first determining submodule 92 includes:
a first determining unit, configured to determine the target resolution as a first resolution if the quantization parameter QP of the one decoded block is smaller than a first preset threshold;
a second determining unit, configured to determine the target resolution as a second resolution if the quantization parameter QP of the decoded block is greater than or equal to the first preset threshold, where the first resolution is greater than the second resolution.
Optionally, the second determination unit is further used for
Determining the target resolution as a third resolution when the quantization parameter QP of the decoded block is greater than or equal to the first preset threshold and less than a second preset threshold;
determining the target resolution as a fourth resolution when the quantization parameter QP of the decoded block is greater than or equal to the second preset threshold and less than a third preset threshold;
determining the target resolution as a fifth resolution under the condition that the quantization parameter QP of the decoded block is greater than or equal to the third preset threshold and less than a fourth preset threshold;
determining the target resolution to be a sixth resolution in case the quantization parameter QP of the one decoded block is greater than or equal to the fourth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
Optionally, the first preset threshold, the second preset threshold, the third preset threshold, and the fourth preset threshold are positively correlated with a maximum resolution in a predetermined resolution set, where the resolution set includes the first resolution, the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
Optionally, the second determining submodule 94 includes:
a third determining unit, configured to determine the target resolution as the first resolution if a weighted average of the quantization parameters QP of the multiple decoded blocks is smaller than a fifth preset threshold;
a fourth determining unit, configured to determine the target resolution as a second resolution if the weighted average of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the fifth preset threshold, where the first resolution is greater than the second resolution.
Optionally, the fourth determination unit is further configured to
Determining the target resolution as a third resolution when the weighted average of the quantization parameters QP of the decoded blocks is greater than or equal to the fifth preset threshold and less than a sixth preset threshold;
determining the target resolution as a fourth resolution when the weighted average of the quantization parameters QP of the decoded blocks is greater than or equal to the sixth preset threshold and less than a seventh preset threshold;
determining the target resolution as a fifth resolution when the weighted average of the quantization parameters QP of the decoded blocks is greater than or equal to the seventh preset threshold and less than an eighth preset threshold;
determining the target resolution as a sixth resolution in case that the weighted average of the quantization parameters QP of the decoded blocks is greater than or equal to the eighth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
Optionally, the fifth preset threshold, the sixth preset threshold, the seventh preset threshold, and the eighth preset threshold are positively correlated with a maximum resolution in a predetermined resolution set, where the resolution set includes the first resolution, the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
Optionally, in a case where the reference block includes a plurality of decoded blocks, the plurality of decoded blocks are a continuous plurality of decoded blocks, or a discontinuous plurality of decoded blocks.
An embodiment of the present invention further provides a video encoding apparatus, and fig. 10 is a block diagram of a video encoding apparatus according to an embodiment of the present invention, as shown in fig. 10, including:
a second obtaining module 102, configured to obtain a quantization parameter QP of a reference block of a block to be coded in a video frame to be coded, where the reference block is a coded block referred to by the block to be coded in the video frame to be coded;
a second determining module 104, configured to determine, according to the quantization parameter QP, a target resolution for encoding the block to be encoded, where the target resolution is a first resolution when the quantization parameter QP is smaller than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
Optionally, the second determining module 104 includes:
a third determining sub-module, configured to determine, when the reference block is an encoded block, that the target resolution is the first resolution when a quantization parameter QP of the encoded block is smaller than the first preset threshold; determining the target resolution as a second resolution in the case that the quantization parameter QP of the one encoded block is greater than or equal to the first preset threshold;
and a fourth determining sub-module, configured to determine the target resolution according to a weighted average of quantization parameters QP of the plurality of encoded blocks when the reference block includes the plurality of encoded blocks.
Optionally, the third determining sub-module includes:
a fifth determining unit, configured to determine the target resolution as the first resolution if the quantization parameter QP of the one encoded block is smaller than a first preset threshold;
a sixth determining unit, configured to determine the target resolution as a second resolution if the quantization parameter QP of the one encoded block is greater than or equal to the first preset threshold, where the first resolution is greater than the second resolution.
Optionally, the sixth determining unit is further configured to
Determining the target resolution as a third resolution when the quantization parameter QP of the one encoded block is greater than or equal to the first preset threshold and less than a second preset threshold;
determining the target resolution as a fourth resolution under the condition that the quantization parameter QP of the one coded block is greater than or equal to the second preset threshold and less than a third preset threshold;
determining the target resolution as a fifth resolution under the condition that the quantization parameter QP of the coded block is greater than or equal to the third preset threshold and less than a fourth preset threshold;
determining the target resolution to be a sixth resolution in case the quantization parameter QP of the one encoded block is greater than or equal to the fourth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
Optionally, the first pre-receiving threshold, the second pre-setting threshold, the third pre-setting threshold, and the fourth pre-setting threshold are positively correlated with a maximum resolution in a pre-determined resolution set, where the resolution set includes the first resolution, the second resolution, the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
Optionally, the fourth determining sub-module includes:
a seventh determining unit, configured to determine the target resolution as the first resolution if the weighted average of the quantization parameters QP of the multiple encoded blocks is smaller than a fifth preset threshold;
an eighth determining unit, configured to determine the target resolution as a second resolution if the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the fifth preset threshold, where the first resolution is greater than the second resolution.
Optionally, the eighth determining unit is further configured to
Determining the target resolution as a third resolution when the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the fifth preset threshold and less than a sixth preset threshold;
determining the target resolution as a fourth resolution when the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the sixth preset threshold and less than a seventh preset threshold;
determining the target resolution as a fifth resolution when the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the seventh preset threshold and less than an eighth preset threshold;
determining the target resolution to be a sixth resolution in case that the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the eighth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
Optionally, the fifth pre-receiving threshold, the sixth pre-setting threshold, the seventh pre-setting threshold, and the eighth pre-setting threshold are positively correlated with a maximum resolution in a predetermined resolution set, where the resolution set includes the first resolution, the second resolution, the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
Optionally, in a case that the reference block includes a plurality of encoded blocks, the plurality of encoded blocks are consecutive encoded blocks, or discontinuous encoded blocks.
An embodiment of the present invention further provides an electronic device for implementing the video decoding method, as shown in fig. 11, the electronic device includes a memory 1102 and a processor 1104, the memory 1102 stores a computer program, and the processor 1104 is configured to execute the steps in any one of the method embodiments by the computer program.
Optionally, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s11, obtaining a quantization parameter QP of a reference block of a block to be decoded in a video frame to be decoded, wherein the reference block is a decoded block referred to by the block to be decoded in the video frame to be decoded;
s12, determining a target resolution for decoding the block to be decoded according to the quantization parameter QP, wherein the target resolution is a first resolution under the condition that the quantization parameter QP is less than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
Alternatively, it can be understood by those skilled in the art that the structure shown in fig. 11 is only an illustration, and the electronic device may also be a terminal device such as a smart phone (e.g., an android Mobile phone, an iOS Mobile phone, etc.), a tablet computer, a palm computer, a Mobile Internet device (M id), a PAD, and the like. Fig. 11 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 11, or have a different configuration than shown in FIG. 11.
The memory 1102 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for acquiring a media resource in the embodiment of the present invention, and the processor 1104 executes various functional applications and data processing by running the software programs and modules stored in the memory 1102, so as to implement the above-mentioned method for acquiring a media resource. The memory 1102 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1102 can further include memory located remotely from the processor 1104 and such remote memory can be coupled to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1102 may be specifically, but not limited to, used for information such as an encryption key (including a first encryption key, a second encryption key, etc.) and a decryption key (including a first decryption key, a second decryption key, etc.). As an example, as shown in fig. 11, the memory 1102 may include, but is not limited to, the first obtaining module 82 and the first determining module 84 in the video decoding apparatus. In addition, the video decoding apparatus may further include, but is not limited to, other module units in the first video decoding apparatus, which is not described in detail in this example.
Optionally, the transmitting device 1106 is used for receiving or transmitting data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1106 includes a Network adapter (NIC) that can be connected to a router via a Network cable to communicate with the internet or a local area Network. In one example, the transmission device 1106 is a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In addition, the electronic device further includes: a display 1108 for displaying the media assets; and a connection bus 1110 for connecting the respective module parts in the above-described electronic apparatus.
According to yet another aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the video coding method, as shown in fig. 10, the electronic device includes a memory 1102 and a processor 1104, the memory 1102 stores therein a computer program, and the processor 1104 is configured to execute the steps in any one of the method embodiments through the computer program.
Optionally, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s21, obtaining a quantization parameter QP of a reference block of a block to be coded in a video frame to be coded, wherein the reference block is a coded block referred to by the block to be coded in the video frame to be coded;
s22, determining a target resolution for encoding the block to be encoded according to the quantization parameter QP, wherein the target resolution is a first resolution under the condition that the quantization parameter QP is less than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
Alternatively, it can be understood by those skilled in the art that the structure shown in fig. 12 is only an illustration, and the electronic device may also be a terminal device such as a smart phone (e.g., an android Mobile phone, an iOS Mobile phone, etc.), a tablet computer, a palm computer, a Mobile Internet device (M id), a PAD, etc. Fig. 12 is a diagram illustrating the structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 12, or have a different configuration than shown in FIG. 12.
The memory 1102 may be configured to store software programs and modules, such as program instructions/modules corresponding to the video encoding method and apparatus in the embodiments of the present invention, and the processor 1104 executes various functional applications and data processing by running the software programs and modules stored in the memory 1102, that is, implements the above-mentioned method for acquiring a media resource. The memory 1102 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1102 can further include memory located remotely from the processor 1104 and such remote memory can be coupled to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1102 may be specifically, but not limited to, used for information such as an encryption key (including a first encryption key, a second encryption key, etc.) and a decryption key (including a first decryption key, a second decryption key, etc.). As an example, as shown in fig. 12, the memory 1102 may include, but is not limited to, the second obtaining module 102 and the second determining module 104 of the video encoding apparatus. In addition, the video encoding apparatus may further include, but is not limited to, other module units in the first video encoding apparatus, which is not described in detail in this example.
Optionally, the transmitting device 1106 is used for receiving or transmitting data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1106 includes a Network adapter (NIC) that can be connected to a router via a Network cable to communicate with the internet or a local area Network. In one example, the transmitting device 1106 is a Radio Frequency (RF) module used for communicating with the internet in a wireless manner.
In addition, the electronic device further includes: a display 1108 for displaying the media assets; and a connection bus 1110 for connecting the respective module parts in the above-described electronic apparatus.
According to a further aspect of an embodiment of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s11, obtaining a quantization parameter QP of a reference block of a block to be decoded in a video frame to be decoded, wherein the reference block is a decoded block referred to by the block to be decoded in the video frame to be decoded;
s12, determining a target resolution for decoding the block to be decoded according to the quantization parameter QP, wherein the target resolution is a first resolution under the condition that the quantization parameter QP is less than a first preset threshold; the target resolution is a second resolution when the quantization parameter QP is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, read-Only memories (ROMs), random Access Memories (RAMs), magnetic or optical disks, and the like.
According to a further aspect of an embodiment of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the steps in any of the above-mentioned method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s21, obtaining a quantization parameter QP of a reference block of a block to be coded in a video frame to be coded, wherein the reference block is a coded block referred by the block to be coded in the video frame to be coded;
s22, determining a target resolution for encoding the block to be encoded according to the quantization parameter QP, wherein the target resolution is a first resolution under the condition that the quantization parameter QP is less than a first preset threshold; when the quantization parameter QP is greater than or equal to the first preset threshold, the target resolution is a second resolution, where the first resolution is greater than the second resolution.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, read-Only memories (ROMs), random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the description of each embodiment has its own emphasis, and reference may be made to the related description of other embodiments for parts that are not described in detail in a certain embodiment.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (14)

1. A video decoding method, comprising:
obtaining a quantization parameter QP of a reference block of a block to be decoded in a video frame to be decoded, wherein the reference block is a decoded block referred to by the block to be decoded in the video frame to be decoded;
when the reference block is a plurality of decoded blocks, determining a target resolution as a first resolution when a weighted mean of Quantization Parameters (QPs) of the plurality of decoded blocks is smaller than a fifth preset threshold, wherein the target resolution is used for decoding the block to be decoded;
determining the target resolution to be a second resolution if the weighted mean of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the fifth preset threshold, wherein the first resolution is greater than the second resolution.
2. The method of claim 1, wherein after obtaining the quantization parameter QP of the reference block of the block to be decoded in the video frame to be decoded, the method further comprises:
when the reference block is a decoded block, determining the target resolution to be a first resolution under the condition that the quantization parameter QP of the decoded block is less than a first preset threshold; determining the target resolution to be a second resolution if the quantization parameter QP of the one decoded block is greater than or equal to the first preset threshold.
3. The method according to claim 2, wherein determining the target resolution as a second resolution in case the quantization parameter QP of the one decoded block is greater than or equal to the first preset threshold comprises:
determining the target resolution as a third resolution if the quantization parameter QP of the decoded block is greater than or equal to the first preset threshold and less than a second preset threshold;
determining the target resolution as a fourth resolution if the quantization parameter QP of the decoded block is greater than or equal to the second preset threshold and less than a third preset threshold;
determining the target resolution as a fifth resolution if the quantization parameter QP of the decoded block is greater than or equal to the third preset threshold and less than a fourth preset threshold;
determining the target resolution to be a sixth resolution in case the quantization parameter QP of the one decoded block is greater than or equal to the fourth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
4. The method according to claim 3, wherein the first preset threshold, the second preset threshold, the third preset threshold, and the fourth preset threshold are positively correlated to a maximum resolution in a predetermined resolution set, respectively, wherein the resolution set includes the first resolution, the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
5. The method according to claim 1, wherein said determining the target resolution as the second resolution in case the weighted average of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the fifth preset threshold comprises:
determining the target resolution as a third resolution when the weighted average of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the fifth preset threshold and less than a sixth preset threshold;
determining the target resolution as a fourth resolution if the weighted average of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the sixth preset threshold and less than a seventh preset threshold;
determining the target resolution to be a fifth resolution if the weighted mean of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the seventh preset threshold and less than an eighth preset threshold;
determining the target resolution to be a sixth resolution in case the weighted mean of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the eighth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
6. The method according to claim 5, wherein the fifth preset threshold, the sixth preset threshold, the seventh preset threshold and the eighth preset threshold are positively correlated to a maximum resolution in a predetermined resolution set, respectively, wherein the resolution set comprises the first resolution, the third resolution, the fourth resolution, the fifth resolution and the sixth resolution.
7. A video encoding method, comprising:
the method comprises the steps of obtaining a quantization parameter QP of a reference block of a block to be coded in a video frame to be coded, wherein the reference block is a coded block referred to by the block to be coded in the video frame to be coded;
when the reference block is a plurality of encoded blocks, determining a target resolution as a first resolution under the condition that the weighted average of quantization parameters QP of the encoded blocks is smaller than a fifth preset threshold, wherein the target resolution is used for encoding the to-be-encoded blocks;
determining the target resolution to be a second resolution if the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the fifth preset threshold, wherein the first resolution is greater than the second resolution.
8. The method according to claim 7, wherein after obtaining the quantization parameter QP of the reference block of the block to be encoded in the video frame to be encoded, the method further comprises:
when the reference block is an encoded block, determining the target resolution as a first resolution under the condition that the quantization parameter QP of the encoded block is smaller than a first preset threshold; determining the target resolution to be a second resolution if the quantization parameter QP of the one encoded block is greater than or equal to the first preset threshold.
9. The method according to claim 8, wherein said determining the target resolution as the second resolution in case that the quantization parameter QP of the one encoded block is greater than or equal to the first preset threshold comprises:
determining the target resolution as a third resolution when the quantization parameter QP of the one encoded block is greater than or equal to the first preset threshold and less than a second preset threshold;
determining the target resolution as a fourth resolution when the quantization parameter QP of the one encoded block is greater than or equal to the second preset threshold and less than a third preset threshold;
determining the target resolution as a fifth resolution when the quantization parameter QP of the encoded block is greater than or equal to the third preset threshold and less than a fourth preset threshold;
determining the target resolution to be a sixth resolution in case the quantization parameter QP of the one encoded block is greater than or equal to the fourth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
10. The method according to claim 7, wherein said determining the target resolution as the second resolution in case that the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the fifth preset threshold comprises:
determining the target resolution as a third resolution when the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the fifth preset threshold and less than a sixth preset threshold;
determining the target resolution as a fourth resolution when the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the sixth preset threshold and less than a seventh preset threshold;
determining the target resolution as a fifth resolution when the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the seventh preset threshold and less than an eighth preset threshold;
determining the target resolution to be a sixth resolution in case the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the eighth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
11. A video decoding apparatus, comprising:
the video decoding method comprises a first obtaining module, a second obtaining module and a third obtaining module, wherein the first obtaining module is used for obtaining a quantization parameter QP of a reference block of a block to be decoded in a video frame to be decoded, and the reference block is a decoded block referred by the block to be decoded in the video frame to be decoded;
a first determining module, configured to determine, when the reference block is a plurality of decoded blocks, a target resolution as a first resolution when a weighted average of quantization parameters QP of the plurality of decoded blocks is smaller than a fifth preset threshold, where the target resolution is used for decoding the block to be decoded; determining the target resolution to be a second resolution if the weighted mean of the quantization parameters QP of the plurality of decoded blocks is greater than or equal to the fifth preset threshold, wherein the first resolution is greater than the second resolution.
12. A video encoding apparatus, comprising:
a second obtaining module, configured to obtain a quantization parameter QP of a reference block of a block to be coded in a video frame to be coded, where the reference block is a coded block referred to by the block to be coded in the video frame to be coded;
a second determining module, configured to determine a target resolution as a first resolution when the reference block is a plurality of encoded blocks and a weighted average of quantization parameters QP of the plurality of encoded blocks is smaller than a fifth preset threshold, where the target resolution is used to encode the block to be encoded; determining the target resolution to be a second resolution if the weighted average of the quantization parameters QP of the plurality of encoded blocks is greater than or equal to the fifth preset threshold, wherein the first resolution is greater than the second resolution.
13. A computer-readable storage medium comprising a stored program, wherein the program when executed by the computer performs the method of any of claims 1 to 6 or 7 to 10.
14. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 6 or 7 to 10 by means of the computer program.
CN201910927079.5A 2019-09-27 2019-09-27 Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus Active CN110536134B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910927079.5A CN110536134B (en) 2019-09-27 2019-09-27 Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910927079.5A CN110536134B (en) 2019-09-27 2019-09-27 Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus

Publications (2)

Publication Number Publication Date
CN110536134A CN110536134A (en) 2019-12-03
CN110536134B true CN110536134B (en) 2022-11-04

Family

ID=68670661

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910927079.5A Active CN110536134B (en) 2019-09-27 2019-09-27 Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus

Country Status (1)

Country Link
CN (1) CN110536134B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108391127A (en) * 2018-04-27 2018-08-10 腾讯科技(深圳)有限公司 Method for video coding, device, storage medium and equipment
CN108769681A (en) * 2018-06-20 2018-11-06 腾讯科技(深圳)有限公司 Video coding, coding/decoding method, device, computer equipment and storage medium
CN108810545A (en) * 2018-07-04 2018-11-13 中南大学 Method for video encoding, device, computer-readable medium and electronic equipment
CN109151470A (en) * 2017-06-28 2019-01-04 腾讯科技(深圳)有限公司 Code distinguishability control method and terminal
CN109302608A (en) * 2017-07-25 2019-02-01 华为技术有限公司 Image processing method, equipment and system
CN109618159A (en) * 2018-11-06 2019-04-12 建湖云飞数据科技有限公司 A kind of self-adaptive encoding method based on resolution ratio corresponding relationship
CN109819253A (en) * 2017-11-21 2019-05-28 腾讯科技(深圳)有限公司 Method for video coding, device, computer equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101360235B (en) * 2007-08-03 2011-09-14 上海中科计算技术研究所 Video image pre-processing method
US9661328B2 (en) * 2013-03-15 2017-05-23 Arris Enterprises, Inc. Method of bit allocation for image and video compression using perceptual guidance
EP3145201A1 (en) * 2015-09-17 2017-03-22 Harmonic Inc. Video processing with dynamic resolution changes

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109151470A (en) * 2017-06-28 2019-01-04 腾讯科技(深圳)有限公司 Code distinguishability control method and terminal
CN109302608A (en) * 2017-07-25 2019-02-01 华为技术有限公司 Image processing method, equipment and system
CN109819253A (en) * 2017-11-21 2019-05-28 腾讯科技(深圳)有限公司 Method for video coding, device, computer equipment and storage medium
CN108391127A (en) * 2018-04-27 2018-08-10 腾讯科技(深圳)有限公司 Method for video coding, device, storage medium and equipment
CN108769681A (en) * 2018-06-20 2018-11-06 腾讯科技(深圳)有限公司 Video coding, coding/decoding method, device, computer equipment and storage medium
CN108810545A (en) * 2018-07-04 2018-11-13 中南大学 Method for video encoding, device, computer-readable medium and electronic equipment
CN109618159A (en) * 2018-11-06 2019-04-12 建湖云飞数据科技有限公司 A kind of self-adaptive encoding method based on resolution ratio corresponding relationship

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
易清明 ; 谢志煌 ; 石敏.一种HEVC帧内编码快速决策组合算法.《小型微型计算机系统》.2019, *

Also Published As

Publication number Publication date
CN110536134A (en) 2019-12-03

Similar Documents

Publication Publication Date Title
CN110636312B (en) Video encoding and decoding method and device and storage medium
CN110545433B (en) Video encoding and decoding method and device and storage medium
CN110636294A (en) Video decoding method and device, and video encoding method and device
CN110519607B (en) Video decoding method and device, and video encoding method and device
CN110650357B (en) Video decoding method and device
CN110572673A (en) Video encoding and decoding method and device, storage medium and electronic device
CN110662071B (en) Video decoding method and device, storage medium and electronic device
WO2021057479A1 (en) Video coding method, video decoding method, and related devices
CN110572672A (en) Video encoding and decoding method and device, storage medium and electronic device
CN110677676A (en) Video encoding method and apparatus, video decoding method and apparatus, and storage medium
CN110582022B (en) Video encoding and decoding method and device and storage medium
CN110536134B (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
CN110677721B (en) Video encoding and decoding method and device and storage medium
CN110636293A (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
CN114157868B (en) Video frame coding mode screening method and device and electronic equipment
CN110572654B (en) Video encoding and decoding methods and devices, storage medium and electronic device
CN110677690B (en) Video processing method and device and storage medium
CN110677691B (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
CN114222127A (en) Video coding method, video decoding method and device
CN110572653A (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
CN110572677B (en) Video encoding and decoding method and device, storage medium and electronic device
CN110545431A (en) video decoding method and device and video encoding method and device
CN110677692A (en) Video decoding method and device and video encoding method and device
CN112887726B (en) Image processing method and apparatus, storage medium, and electronic device
CN110572674A (en) Video encoding and decoding method and device, storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant