CN110636293B - Video encoding and decoding methods and devices, storage medium and electronic device - Google Patents

Video encoding and decoding methods and devices, storage medium and electronic device Download PDF

Info

Publication number
CN110636293B
CN110636293B CN201910927967.7A CN201910927967A CN110636293B CN 110636293 B CN110636293 B CN 110636293B CN 201910927967 A CN201910927967 A CN 201910927967A CN 110636293 B CN110636293 B CN 110636293B
Authority
CN
China
Prior art keywords
resolution
block
frame
preset threshold
coded
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
CN201910927967.7A
Other languages
Chinese (zh)
Other versions
CN110636293A (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 CN201910927967.7A priority Critical patent/CN110636293B/en
Publication of CN110636293A publication Critical patent/CN110636293A/en
Application granted granted Critical
Publication of CN110636293B publication Critical patent/CN110636293B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/157Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
    • H04N19/159Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/59Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving spatial sub-sampling or interpolation, e.g. alteration of picture size or resolution

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 and decoding method and device, a storage medium and an electronic device. Wherein the method comprises the following steps: acquiring coding cost information of a block to be coded in a current video frame, wherein the coding cost information comprises cost information obtained by carrying out intra-frame predictive coding on the block to be coded and cost information obtained by carrying out inter-frame predictive coding on the block to be coded; determining a target resolution for encoding the block to be encoded according to the encoding cost information; and encoding the block to be encoded by adopting the target resolution. The invention solves the technical problem of poor video quality caused by relatively large coding distortion by adopting the same resolution for different blocks in one frame of video in the existing video coding process.

Description

Video encoding and decoding methods and devices, storage medium and electronic device
Technical Field
The present invention relates to the field of computers, and in particular, to a video encoding method and apparatus, a video decoding method and apparatus, a storage medium, and an electronic apparatus.
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, etc. With the improvement of hardware performance and screen resolution, the demand of users for high-definition video is increasing.
If the high resolution is used for encoding the different blocks in the frame of the video, the peak signal-to-noise ratio PSNR1 corresponding to encoding the different blocks in the frame of the video with the high resolution is lower than the peak signal-to-noise ratio PSNR2 corresponding to encoding the different blocks in the frame of the video with the low resolution, that is, the peak signal-to-noise ratio PSNR1 corresponding to encoding with the high resolution is relatively smaller when the transmission bandwidth is smaller, and the distortion is relatively larger.
Similarly, if low resolution coding is used for all the different blocks in one frame of the video, the peak signal-to-noise ratio PSNR3 corresponding to the low resolution coding is lower for the different blocks in one frame of the video than the peak signal-to-noise ratio PSNR4 corresponding to the high resolution coding for the different blocks in one frame of the video when the transmission bandwidth is relatively large, that is, the peak signal-to-noise ratio PSNR3 when the low resolution coding is used for the different blocks in one frame of the video is relatively small and the distortion is relatively large.
Under the condition of limited moving bandwidth, the existing method for encoding different blocks in a video frame by adopting the same resolution ratio can have the problem that certain scene distortions are relatively large, so that the video quality is poor.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a video coding and decoding method and device, a storage medium and an electronic device, which at least solve the technical problem that in the existing video coding process, different blocks in a frame of video adopt the same resolution to carry out coding distortion relatively more, so that the video quality is poor.
According to an aspect of the embodiment of the present invention, there is also provided a video decoding method, including:
obtaining a target zone bit corresponding to a target block to be decoded from a current video frame, wherein the target zone bit is used for representing target resolution adopted by the target block to be decoded in encoding;
acquiring the target resolution represented by the target zone bit;
and decoding the target block to be decoded by adopting the target resolution.
According to another aspect of the embodiment of the present invention, there is also provided a video encoding method, including:
acquiring coding cost information of a block to be coded in a current video frame, wherein the coding cost information comprises cost information obtained by carrying out intra-frame predictive coding on the block to be coded and cost information obtained by carrying out inter-frame predictive coding on the block to be coded;
Determining a target resolution for encoding the block to be encoded according to the encoding cost information;
and encoding the block to be encoded by adopting the target resolution.
According to another aspect of the embodiment of the present invention, there is also provided a video decoding apparatus including:
the first acquisition module is used for acquiring a target zone bit corresponding to a target block to be decoded from a current video frame, wherein the target zone bit is used for representing target resolution adopted by the target block to be decoded in encoding;
the second acquisition module is used for acquiring the target resolution represented by the target zone bit;
and the decoding module is used for decoding the target block to be decoded by adopting the target resolution.
According to another aspect of the embodiment of the present invention, there is also provided a video encoding apparatus including:
the third acquisition module is used for acquiring coding cost information of a block to be coded in a current video frame, wherein the coding cost information comprises cost information obtained by carrying out intra-frame predictive coding on the block to be coded and cost information obtained by carrying out inter-frame predictive coding on the block to be coded;
the determining module is used for determining a target resolution for encoding the block to be encoded according to the encoding cost information;
And the encoding module is used for encoding the block to be encoded by adopting the target resolution.
According to a further aspect of embodiments of the present invention, there is also provided a computer-readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the above video encoding method or the above video decoding method when run.
According to still 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 on 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 encoded is decided through the encoding cost information, the block to be encoded is encoded according to the target resolution, and different encoding blocks are encoded by adopting different resolutions, so that the encoding distortion is relatively smaller, the video quality is improved, and the technical problem that the video quality is poor due to the fact that the same resolution is adopted for encoding distortion for different blocks in one frame of video in the existing video encoding 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 embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 is a diagram of an application environment for a video encoding method and a video decoding method in one embodiment;
FIG. 2 is an internal block diagram of the terminal of FIG. 1 in one embodiment;
FIG. 3 is an internal block diagram 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 schematic diagram I of video encoding according to an embodiment of the present invention;
FIG. 6 is a schematic diagram II 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 schematic diagram of an alternative electronic device according to an embodiment of the invention;
fig. 12 is a schematic diagram of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise 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 an application environment diagram of the video encoding method and the video decoding method in one 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 through 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, where the terminal 110 may perform adaptive resolution encoding on the video frame to be encoded by using the video encoding method and then send the encoded video frame to the server 120, or may receive encoded data with adaptive resolution from the server 120 and perform decoding by using the video decoding method and then generate a decoded video frame. The server 120 may transcode the code stream when it is stored, where the video encoding method is completed at the server, and if the server 120 needs to decode the code stream, the video decoding method is completed 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 connected through a system bus. The storage medium of the terminal 110 stores an operating system, and further includes a video encoding device and/or a video decoding device for implementing a video encoding method and/or a video decoding method suitable for the terminal. The processor is operative to provide computing and control capabilities supporting the operation of the entire terminal 110. The graphics processing unit in the terminal 110 is configured to provide at least rendering capabilities of a display interface, and the memory provides an environment for operation of the video encoding device and/or the video decoding device in the storage medium, and the network interface is configured to communicate with the server 120 over a network. The display screen is used to display an application interface or the like, such as decoding video, and the input device is used to receive commands or data or the like entered by the user. For a terminal 110 with a touch screen, the display screen and the input device may be a touch screen. The architecture shown in fig. 2 is merely a block diagram of a portion of the architecture in connection with the present application and is not intended to limit the terminals to which the present application is applied, and a particular terminal or server may include more or fewer components than shown, or may combine certain components, or may have a different arrangement of components.
In one embodiment, the internal architecture of the server 120 of FIG. 1 is as shown in FIG. 3, the server 120 comprising a processor, storage medium, memory, and 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, where the database is used to store data, and the video encoding device and/or the video decoding device is used to implement a video encoding method and/or a video decoding method suitable for the server 120. The processor of the server 120 is configured 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 structures shown in fig. 2 and 3 are merely block diagrams of partial structures related to the present application and do not constitute limitations of terminals to which the present application is applied, and a specific terminal or server may include more or less components than those shown in the drawings, or may combine some components, or have different arrangements of components.
An embodiment of the present invention provides a video encoding method, which is illustrated 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 an embodiment of the present invention, as shown in fig. 4, and includes the following steps:
step S402, obtaining coding cost information of a block to be coded in a current video frame, wherein the coding cost information comprises cost information obtained by carrying out intra-frame predictive coding on the block to be coded and cost information obtained by carrying out inter-frame predictive coding on the block to be coded;
specifically, the current video frame, i.e. the video frame to be encoded, may be a video frame acquired in real time, used for instant messaging, or may be a video frame corresponding to a stored video.
In an alternative embodiment, S402 may be specifically implemented by the following manner:
performing intra-frame predictive coding on the Block to be coded to obtain an intra-frame coding cost value Block_Icost, and performing unidirectional inter-frame predictive coding on the Block to be coded to obtain a unidirectional inter-frame coding cost value Block_Pcost, wherein the coding cost information comprises the intra-frame coding cost value Block_Icost and the unidirectional inter-frame coding cost value Block_Pcost; or alternatively
And carrying out intra-frame predictive coding on the Block to be coded to obtain an intra-frame coding cost value Block_Icost, carrying out unidirectional inter-frame predictive coding on the Block to be coded to obtain a unidirectional inter-frame coding cost value Block_Pcost, and carrying out bidirectional inter-frame predictive coding on the Block to be coded to obtain a bidirectional inter-frame coding cost value Block_Bct, wherein the coding cost information comprises the intra-frame coding cost value Block_Icost, the unidirectional inter-frame coding cost value Block_Pcost and the bidirectional inter-frame coding cost value Block_Bct.
Specifically, the intra-frame or inter-frame prediction precoding cost analysis of the block to be coded is performed, and the specific process comprises the following steps:
downsampling a block to be coded: the original resolution is not downsampled, or 2:1 downsampling with the original resolution is performed, but other ratios of downsampling may be performed.
And carrying out intra-frame or inter-frame predictive coding on the block to be coded after downsampling, and recording the intra-frame coding cost or inter-frame coding cost of the block to be coded. The coding cost is calculated in a plurality of modes, and one coding cost calculation method is that the coding cost is equal to the sum of absolute values of prediction residuals of all pixels of the coding block; another coding cost calculation formula is: cost=d+λr, where cost is the coding cost, D represents the distortion degree of the image coding block corresponding to the coding unit, D may be represented by the sum of absolute values of differences between the reconstructed image and the original image encoded by all pixels of the current block, λ is a lagrangian coefficient, and R represents the number of bits occupied by the image coding block corresponding to the coding unit.
The intra-coding cost value or inter-coding cost value of the current coding block is calculated and respectively marked as Icost and Pcost.
Step S404, determining a target resolution for encoding the block to be encoded according to the encoding cost information;
Step S406, the target resolution is adopted to code the block to be coded.
In the process of step S406, the target resolution may be carried by the flag bit, that is, the flag bit is set in the encoded data obtained by encoding, so that the decoding end may obtain the target resolution adopted during encoding according to the flag bit, thereby implementing decoding.
Through the steps S402 to S406, the encoding side decides the target resolution of the current block to be encoded through the encoding cost information, and encodes the block to be encoded according to the target resolution, thereby solving the technical problem that in the existing video encoding process, encoding distortion is relatively large by adopting the same resolution for different blocks in a frame of video, resulting in poor video quality.
In an alternative embodiment, the step S404 may specifically include:
under the condition that the encoding cost information indicates that the intra-frame texture of the block to be encoded is complex, determining the target resolution as a first resolution; specifically, in the pre-analysis of the Block to be encoded, when the intra-frame coding cost Block_Icost is greater than the inter-frame coding cost Block_Pcost of which a times is greater than the intra-frame coding cost Block_Icost, the intra-frame texture is determined to be complex; the corresponding first ratio is smaller than a first preset threshold value or the second ratio is smaller than a fifth preset threshold value, so that the intra-frame texture of the current coding block is complex, and the current coding block is coded by adopting low resolution;
Under the condition that the coding cost information indicates that the inter-frame motion of the Block to be coded is complex, determining that the target resolution is the second resolution, specifically, when the intra-frame coding cost Block_Icost is smaller than or equal to a times of the inter-frame coding cost Block_Pcost, determining that the inter-frame motion is complex, and if the corresponding first ratio is larger than or equal to a first preset threshold or the second ratio is larger than or equal to a fifth preset threshold, indicating that the inter-frame motion of the current coding Block is complex, and coding the current coding Block by adopting high resolution.
In the embodiment of the invention, the first resolution is smaller than the second resolution, and the second resolution can be a preset full resolution.
In another optional embodiment, the step S404 may specifically further include:
s4041, determining the target resolution according to the intra-frame coding cost value Block_Icost of the Block to be coded and the unidirectional inter-frame coding cost value Block_Pcost of the Block to be coded, wherein the coding cost information comprises the intra-frame coding cost value obtained by performing intra-frame predictive coding on the Block to be coded and the unidirectional inter-frame coding cost value obtained by performing unidirectional inter-frame predictive coding on the Block to be coded; or alternatively
S4042, determining the target resolution according to the intra-frame coding cost value Block_Icost of the Block to be coded, the unidirectional inter-frame coding cost value Block_Pcost of the Block to be coded and the bidirectional inter-frame coding cost value Block_Bcost of the Block to be coded, wherein the coding cost information comprises the intra-frame coding cost value obtained by carrying out intra-frame predictive coding on the Block to be coded, the unidirectional inter-frame coding cost value obtained by carrying out unidirectional inter-frame predictive coding on the Block to be coded and the bidirectional inter-frame coding cost value obtained by carrying out bidirectional inter-frame predictive coding on the Block to be coded.
In an alternative embodiment, the step S4041 may specifically include:
determining a first ratio of the intra-coded cost value to the unidirectional inter-coded cost value;
determining the target resolution as a first resolution under the condition that the first ratio is smaller than a first preset threshold;
and determining the target resolution as a second resolution under the condition that the first ratio is greater than or equal to the first preset threshold, wherein the first resolution is smaller than the second resolution.
Further, the first resolution may be further divided into a plurality of levels of resolution, for example, the first resolution includes: the determining that the target resolution is the first resolution may include:
Determining the target resolution as a third resolution when the second preset threshold is greater than or equal to the first threshold and is less than the first preset threshold;
determining the target resolution as a fourth resolution when the third preset threshold is greater than or equal to the first ratio and smaller than the second preset threshold;
determining that the target resolution is a fifth resolution when the fourth preset threshold is greater than or equal to the first ratio and less than the third preset threshold;
determining that the target resolution is a sixth resolution if the first ratio is less than the fourth preset threshold, wherein the third resolution < the fourth resolution < the fifth resolution < the sixth resolution < the first resolution, the first resolution comprising: the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
For a current block to be coded in the video, if the first ratio is smaller than a first preset threshold value, the intra-frame motion of the current coding block is more complex, and the current coding block is coded with low resolution, namely, the first resolution is used for coding. If the second preset threshold value= < the first ratio value < the first preset threshold value, the intra-frame texture of the current coding block is complex, and the current coding block is coded by adopting 1/3 of the width and height samples with high resolution, namely the third resolution can be 1/3 of the width and height of the second resolution; if the third preset threshold value= < the first ratio value < the second preset threshold value, the intra-frame texture of the current coding block is complex, and the current coding block is coded by adopting 1/2 sampling with high resolution width and height, namely the fourth resolution can be 1/2 of the width and height of the second resolution; if the fourth preset threshold value= < the first ratio value < the third preset threshold value, the intra-frame texture of the current coding block is complex, and the current coding block is coded by adopting high-resolution wide-high 2/3 sampling, namely the fifth resolution can be 2/3 of the wide-high of the second resolution; the first ratio < the fourth preset threshold value indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 3/4 of the high-resolution width and height samples, i.e. the sixth resolution may be 3/4 of the high-resolution width and height of the second resolution, etc.
In the 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 the number of pixels of the block to be encoded, and the first preset threshold, the second preset threshold, the third preset threshold, and the fourth preset threshold may be preset.
In an alternative embodiment, the step S4042 may specifically further include:
determining a second ratio of the intra-coded cost value to the inter-coded cost value, wherein the inter-coded cost value is a sum of the unidirectional inter-coded cost value and the bidirectional inter-coded cost value;
determining the target resolution as the first resolution under the condition that the second ratio is smaller than a fifth preset threshold value;
and determining the target resolution as a second resolution when the second ratio is greater than or equal to the fifth preset threshold, wherein the first resolution is smaller than the second resolution.
Further, the first resolution may be further divided into a plurality of levels of resolution, for example, the first resolution includes: the determining that the target resolution is the first resolution may specifically include:
Determining the target resolution as a third resolution when the sixth preset threshold is greater than or equal to the second ratio being less than the fifth preset threshold;
determining the target resolution as a fourth resolution when the seventh preset threshold is greater than or equal to the second ratio being less than the sixth preset threshold;
determining the target resolution as a fifth resolution when the eighth preset threshold is greater than or equal to the second ratio being less than the seventh preset threshold;
determining the target resolution as a sixth resolution if the second ratio is less than the eighth preset threshold, wherein the third resolution < the fourth resolution < the fifth resolution < the sixth resolution < the first resolution, the first resolution comprising: the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
For a current block to be coded in the video, if the second ratio is smaller than the first preset threshold value, the intra-frame motion of the current coding block is more complex, and the current coding block is coded by adopting low resolution, namely the first resolution. If the sixth preset threshold value= < the second ratio value < the fifth preset threshold value, the intra-frame texture of the current coding block is more complex, and the current coding block is coded by adopting 1/3 of the width and height samples with high resolution, i.e. the third resolution can be 1/3 of the width and height of the second resolution; if the seventh preset threshold value= < the second ratio value < the sixth preset threshold value, the intra-frame texture of the current coding block is more complex, and the current coding block is coded by adopting 1/2 sampling with high resolution width and height, namely the fourth resolution can be 1/2 of the width and height of the second resolution; if the eighth preset threshold value= < the second ratio value < the seventh preset threshold value, the intra-frame texture of the current coding block is complex, and the current coding block is coded by adopting high-resolution wide-high 2/3 sampling, namely the fifth resolution can be 2/3 of the second resolution wide-high; the second ratio < the eighth preset threshold value indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 3/4 of the high-resolution width and height samples, i.e. the sixth resolution may be 3/4 of the high-resolution width and height of the second resolution, etc.
In the 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 to the number of pixels of the block to be encoded, and the fifth preset threshold, the sixth preset threshold, the seventh preset threshold, and the eighth preset threshold may be preset.
In the video coding process of the embodiment of the invention, different resolutions are adopted for coding different blocks in a frame in video in a self-adaptive manner, and the resolution used by each coding block is determined by coding cost value information of the current coding block, so that the resolution used by different blocks in the video frame in coding can be known at a decoding end, and decoding can be completed quickly.
In the embodiment of the present invention, the target resolution may be directly carried by the flag bit, 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, and the flag bit may be an adaptive resolution flag bit, and the name may be Adaptive Resolution.
In the embodiment of the present invention, the target resolution determined for the decision may be further indicated by, but not limited to, the following identification bits (hereinafter, syntax elements):
a) Obtaining a syntax element corresponding to each region in the plurality of regions, wherein the syntax element is used for indicating a resolution adopted for decoding each region, and the plurality of resolutions adopted for decoding the plurality of regions comprise at least two different resolutions;
b) Acquiring a first syntax element corresponding to each region in the plurality of regions, wherein the first syntax element is used for indicating a relation between a first resolution and a second resolution, the first resolution is a resolution adopted for encoding each region, the second resolution is a resolution of a reference region corresponding to each region in a reference video frame for encoding the video frame to be decoded, and the plurality of resolutions adopted for encoding the plurality of regions comprise at least two different resolutions; and determining a first resolution corresponding to each region according to the first syntax element and the second resolution.
Therefore, under the condition that the transmission bandwidth is smaller or the transmission bandwidth is larger, the corresponding peak signal-to-noise ratio is relatively larger and the distortion is relatively smaller, so that the peak signal-to-noise ratio can be ensured to be changed within a smaller range, and the peak signal-to-noise ratio is relatively larger, and the technical effect of avoiding the larger fluctuation of the peak signal-to-noise ratio for encoding and decoding video is realized.
The decision process of the coding resolution used by the coding block of the present invention will be described in detail below.
In a first mode, for a current coding Block to be coded in a video, a block_icost and a block_pcost corresponding to the current coding Block are obtained, and a value r (corresponding to the first ratio) of the block_icost/the block_pcost is determined. If r > = threshold, the intra texture representing the current coding block is more complex, and the current coding block is coded with low resolution; if r < threshold, the inter-frame motion representing the current encoded block is more complex, and the current encoded block is encoded with high resolution.
In a second mode, for a current coding Block to be coded in the video, a corresponding block_icost, block_pcost and block_bcost are obtained, and a value R (corresponding to the second ratio) of block_icost/(block_pcost+block_bcost) is determined. If R > =threshold, the intra texture representing the current coding block is more complex, and the current coding block is coded with low resolution; if R < threshold, the inter-frame motion representing the current encoded block is more complex, and the current encoded block is encoded with high resolution.
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 according to an embodiment of the present invention, the coding resolution adopted by the information of the current coding block is self-analyzed for different blocks in a frame of the video, so that the purposes of relatively large peak signal-to-noise ratio and relatively small distortion can be achieved, both in the case that the bandwidth of transmission is relatively small (for example, smaller than the bandwidth threshold Th shown in fig. 5) and in the case that the bandwidth of transmission is relatively large (for example, larger than the bandwidth threshold Th shown in fig. 5).
In addition, since the coding resolution is adopted for the adaptive decision of different blocks in one frame in the video, the corresponding resolution does not need to be selected according to the different types of video or the different frames of the same video or the intersection points corresponding to the different blocks in the same frame when the frames in the video are coded (fig. 6 is a schematic diagram II of video coding according to an embodiment of the invention, as shown by the intersection points in fig. 6), and the coding complexity is reduced.
In the video coding process of the embodiment of the invention, the coding resolution adopted by the information self-adaptive decision of the current coding block is utilized for different blocks in one frame in the video, so that the relatively high peak signal-to-noise ratio and the low distortion are realized under the whole bandwidth. In addition, when different blocks in one frame in the video are coded, the corresponding resolution is not required to be selected according to different types of videos or different frames of the same video or the intersection points corresponding to different blocks in the same frame, so that the coding complexity is reduced.
An embodiment of the present invention provides a video decoding method, which is illustrated 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, and includes the following steps:
Step S702, a target zone bit corresponding to a target block to be decoded is obtained from a current video frame, wherein the target zone bit is used for representing target resolution adopted by the target block to be decoded in encoding;
each block to be decoded in the current frequency frame corresponds to a flag bit for representing resolution adopted in encoding;
specifically, the target resolution of the coding block corresponding to the target block to be decoded in the coding process can be obtained through the flag bit by acquiring the flag bit corresponding to the preset position in the video frame to be decoded, and whether the current decoding mode is a full resolution mode or a downsampling mode can be judged according to the target resolution, wherein the current decoding mode is the same as the current coding mode.
Step S704, obtaining the target resolution represented by the target zone bit;
in step S706, the target block to be decoded is decoded using the target resolution.
Through the steps S702 to S706, the decoding side obtains the target resolution through the flag bit, decodes the block to be decoded according to the target resolution, and solves the technical problem that in the existing video encoding process, different blocks in one frame of the video are encoded with the same resolution, and in the decoding process, the same resolution is used for decoding, so that distortion is relatively large in the video transmission process, and the video quality is poor.
In the embodiment of the invention, at least one to-be-reconstructed block is determined from a current video frame, wherein each to-be-decoded block in the at least one to-be-decoded block comprises a first to-be-decoded block with a first resolution and a second to-be-decoded block with a second resolution, and the first to-be-decoded block and the second to-be-decoded block are adjacent to each other in position;
adjusting the first resolution of the first block to be decoded to be the target resolution, and adjusting the second resolution of the second block to be decoded to be the target resolution;
determining a first edge pixel point set from a first block to be decoded, and determining a second edge pixel point set from a 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;
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.
The first difference value between the pixel value of the ith pixel point in the filtered first edge pixel point set and the pixel value of the jth pixel point corresponding to the ith pixel point in the filtered second edge pixel point set is smaller than the 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 smaller than or equal to the total number of the pixel points in the first edge pixel point set, j is a positive integer and is smaller 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 the case where the target resolution is equal to the first resolution;
2) Adjusting the first resolution to the second resolution in the 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.
The resolution of the block to be decoded is adjusted, and the edge pixel point set determined in the block to be decoded is subjected to edge filtering treatment, so that obvious joints in a video can be avoided in the reconstruction process, the content in the video is ensured to be accurately restored, and the technical problem of video distortion caused by inconsistent resolution is solved.
In the embodiment of the present invention, the step S704 may specifically include: the target resolution represented by the target zone bit is obtained from a preset resolution set, the decoding end negotiates the resolutions of different levels in the resolution set with the encoding end in advance, and when the encoding end informs the decoding end of the target resolution used for encoding through the zone bit, the decoding end can obtain the target resolution from the resolution combination according to the indication of the zone bit.
In the embodiment of the present invention, the target resolution is a resolution determined according to coding cost information of a block to be coded corresponding to the target block to be decoded, where the coding cost information includes cost information obtained by performing intra-frame predictive coding on the block to be coded and cost information obtained by performing inter-frame predictive coding on the block to be coded.
In the embodiment of the present invention, the step S706 may specifically include: and decoding the target block to be decoded into a block with the resolution of the target resolution.
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, from a current video frame, a target flag bit corresponding to a target block to be decoded, where the target flag bit is used to represent a target resolution adopted by the target block to be decoded when encoding the target block;
a second obtaining module 84, configured to obtain the target resolution represented by the target flag bit;
a decoding module 86, configured to decode the target block to be decoded using the target resolution.
Optionally, the second obtaining module 84 is further configured to
The target resolution represented by the target flag bit is obtained from a predetermined set of resolutions.
Optionally, the target resolution is a resolution obtained by determining coding cost information of a block to be coded corresponding to the target block to be decoded, where the coding cost information includes cost information obtained by performing intra-frame prediction coding on the block to be coded and cost information obtained by performing inter-frame prediction coding on the block to be coded.
Optionally, the decoding module 86 is further configured to
And decoding the target block to be decoded into a block with the resolution of the target resolution.
An embodiment of the present invention further provides a video encoding apparatus, and fig. 9 is a block diagram of a video encoding apparatus according to an embodiment of the present invention, as shown in fig. 9, including:
a third obtaining module 92, configured to obtain encoding cost information of a block to be encoded in a current video frame, where the encoding cost information includes cost information obtained by performing intra-frame prediction encoding on the block to be encoded and cost information obtained by performing inter-frame prediction encoding on the block to be encoded;
a determining module 94, configured to determine a target resolution for encoding the block to be encoded according to the encoding cost information;
An encoding module 96, configured to encode the block to be encoded using the target resolution.
In an alternative embodiment, the determining module 94 is also configured to
Under the condition that the encoding cost information indicates that the intra-frame texture of the block to be encoded is complex, determining the target resolution as a first resolution;
and under the condition that the coding cost information indicates that the inter-frame motion of the block to be coded is complex, determining the target resolution as a second resolution, wherein the first resolution is smaller than the second resolution.
In another alternative embodiment, fig. 10 is a block diagram of a video encoding apparatus according to a preferred embodiment of the present invention, and the determining module 94 includes:
a first determining sub-module 102, configured to determine the target resolution according to an intra-frame coding cost value block_icost of the Block to be encoded and a unidirectional inter-frame coding cost value block_pcost of the Block to be encoded, where the coding cost information includes the intra-frame coding cost value block_icost obtained by performing intra-frame prediction encoding on the Block to be encoded and the unidirectional inter-frame coding cost value block_pcost obtained by performing unidirectional inter-frame prediction encoding on the Block to be encoded; or alternatively
The second determining sub-module 104 is configured to determine the target resolution according to an intra-frame coding cost value block_icost of the Block to be encoded, a unidirectional inter-frame coding cost value block_pcost of the Block to be encoded, and a bidirectional inter-frame coding cost value block_bcost of the Block to be encoded, where the coding cost information includes the intra-frame coding cost value block_icost obtained by performing intra-frame prediction coding on the Block to be encoded, the unidirectional inter-frame coding cost value block_pcost obtained by performing unidirectional inter-frame prediction coding on the Block to be encoded, and the bidirectional inter-frame coding cost value block_bcost obtained by performing bidirectional inter-frame prediction coding on the Block to be encoded.
Optionally, the first determining submodule 102 includes:
a first determining unit, configured to determine a first ratio of the intra-frame coding cost value block_icost to the unidirectional inter-frame coding cost value block_pcost;
a second determining unit, configured to determine that the target resolution is the first resolution if the first ratio is smaller than a first preset threshold;
and a third determining unit, configured to determine, when the first ratio is greater than or equal to the first preset threshold, that the target resolution is a second resolution, where the first resolution is smaller than the second resolution.
Optionally, the third determining unit is further configured to
Determining the target resolution as a third resolution when the second preset threshold is greater than or equal to the first threshold and is less than the first preset threshold;
determining the target resolution as a fourth resolution when the third preset threshold is greater than or equal to the first ratio and smaller than the second preset threshold;
determining that the target resolution is a fifth resolution when the fourth preset threshold is greater than or equal to the first ratio and less than the third preset threshold;
determining that the target resolution is a sixth resolution if the first ratio is less than the fourth preset threshold, wherein the third resolution < the fourth resolution < the fifth resolution < the sixth resolution < the first resolution, the first resolution comprising: the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
Optionally, the first preset threshold, the second preset threshold, the third preset threshold, and the fourth preset threshold are positively correlated to the number of pixels of the block to be encoded.
Optionally, the second determining submodule 104 includes:
a fourth determining unit, configured to determine a second ratio of the intra-frame coding cost value block_icost to an inter-frame coding cost value, where the inter-frame coding cost value is a sum of the unidirectional inter-frame coding cost value block_pcost and the bidirectional inter-frame coding cost value block_bcost;
a fifth determining unit, configured to determine that the target resolution is the first resolution if the second ratio is smaller than a fifth preset threshold;
a sixth determining unit, configured to determine, when the second ratio is greater than or equal to the fifth preset threshold, that the target resolution is a second resolution, where the first resolution is smaller than the second resolution.
Optionally, the sixth determining unit is further configured to
Determining the target resolution as a third resolution when the sixth preset threshold is greater than or equal to the second ratio being less than the fifth preset threshold;
determining the target resolution as a fourth resolution when the seventh preset threshold is greater than or equal to the second ratio being less than the sixth preset threshold;
Determining the target resolution as a fifth resolution when the eighth preset threshold is greater than or equal to the second ratio being less than the seventh preset threshold;
determining the target resolution as a sixth resolution if the second ratio is less than the eighth preset threshold, wherein the third resolution < the fourth resolution < the fifth resolution < the sixth resolution < the first resolution, the first resolution comprising: the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
Optionally, the fifth preset threshold, the sixth preset threshold, the seventh preset threshold, and the eighth preset threshold are positively correlated to the number of pixels of the block to be encoded.
Optionally, the third obtaining module 92 includes:
the first prediction coding sub-module is used for carrying out intra-frame prediction coding on the Block to be coded to obtain an intra-frame coding cost value Block_Icost, and carrying out unidirectional inter-frame prediction coding on the Block to be coded to obtain a unidirectional inter-frame coding cost value Block_Pcost, wherein the coding cost information comprises the intra-frame coding cost value Block_Icost and the unidirectional inter-frame coding cost value Block_Pcost; or alternatively
And the second prediction coding sub-module is used for carrying out intra-frame prediction coding on the Block to be coded to obtain an intra-frame coding cost value Block_Icost, carrying out unidirectional inter-frame prediction coding on the Block to be coded to obtain a unidirectional inter-frame coding cost value Block_Pcost, and carrying out bidirectional inter-frame prediction coding on the Block to be coded to obtain a bidirectional inter-frame coding cost value Block_Bcap, wherein the coding cost information comprises the intra-frame coding cost value Block_Icost, the unidirectional inter-frame coding cost value Block_Pcost and the bidirectional inter-frame coding cost value Block_Bcap.
Optionally, the apparatus further comprises: the setting module is used for setting a flag bit in encoded data obtained by encoding the block to be encoded by adopting the target resolution, wherein the flag bit is used for carrying the target resolution.
An embodiment of the present invention further provides an electronic device for implementing the video decoding method described above, as shown in fig. 11, the electronic device including a memory 1102 and a processor 1104, the memory 1102 storing a computer program, the processor 1104 being configured to execute the steps of any of the method embodiments described above by means of the computer program.
Alternatively, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s11, acquiring a target zone bit corresponding to a target block to be decoded from a current video frame, wherein the target zone bit is used for representing target resolution adopted by the target block to be decoded in encoding;
s12, acquiring the target resolution represented by the target zone bit;
s13, decoding the target block to be decoded by adopting the target resolution.
Alternatively, it will be understood by those skilled in the art that the structure shown in fig. 11 is only schematic, and the electronic device may also be a smart phone (such as android mobile phone, iOS mobile phone, etc.), a tablet computer, a palmtop computer, a mobile internet device (Mobile Internet Devices, M identifier), a PAD, etc. Fig. 11 is not limited to 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. 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 video decoding method and apparatus in the embodiments of the present invention, and the processor 1104 executes the software programs and modules stored in the memory 1102 to perform various functional applications and data processing, i.e., implement the video decoding method described above. 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, memory 1102 may further include memory located remotely from processor 1104, which may be connected 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 specifically, but not limited to, 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, the second obtaining module 84, and the decoding module 86 in the video decoding apparatus. In addition, other module units in the video decoding apparatus one may be included, but are not limited to, and are not described in detail in this example.
Optionally, the transmission device 1106 is used to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 1106 includes a network adapter (Network Interface Controller, NIC) that may be connected to other network devices and routers 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 for communicating wirelessly with the internet.
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 embodiments of the present invention there is also provided an electronic device for implementing the video encoding method described above, as shown in fig. 10, the electronic device comprising a memory 1102 and a processor 1104, the memory 1102 having stored therein a computer program, the processor 1104 being arranged to perform the steps of any of the method embodiments described above by means of the computer program.
Alternatively, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s21, obtaining coding cost information of a block to be coded in a current video frame, wherein the coding cost information comprises cost information obtained by carrying out intra-frame predictive coding on the block to be coded and cost information obtained by carrying out inter-frame predictive coding on the block to be coded;
s22, determining a target resolution for encoding the block to be encoded according to the encoding cost information;
s23, the target resolution is adopted to code the block to be coded.
Alternatively, it will be understood by those skilled in the art that the structure shown in fig. 12 is only schematic, and the electronic device may also be a smart phone (such as android mobile phone, iOS mobile phone, etc.), a tablet computer, a palmtop computer, a mobile internet device (Mobile Internet Devices, M identifier), a PAD, etc. Fig. 12 is not limited to 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 used to store software programs and modules, such as program instructions/modules corresponding to the video encoding methods and apparatuses in the embodiments of the present invention, and the processor 1104 executes the software programs and modules stored in the memory 1102 to perform various functional applications and data processing, i.e., implement the video encoding methods described above. 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, memory 1102 may further include memory located remotely from processor 1104, which may be connected 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 specifically, but not limited to, 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 third obtaining module 92, the determining module 94, and the encoding module 96 in the video encoding apparatus. In addition, other module units in the video encoding apparatus one may be included, but are not limited to, and are not described in detail in this example.
Optionally, the transmission device 1106 is used to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 1106 includes a network adapter (Network Interface Controller, NIC) that may be connected to other network devices and routers 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 for communicating wirelessly with the internet.
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 embodiments of the present invention, there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
Alternatively, in the present embodiment, the above-described storage medium may be configured to store a computer program for performing the steps of:
s11, acquiring a target zone bit corresponding to a target block to be decoded from a current frequency frame, wherein the target zone bit is used for representing target resolution adopted by the target block to be decoded in encoding;
S12, acquiring the target resolution represented by the target zone bit;
s13, decoding the target block to be decoded by adopting the target resolution.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
According to a further aspect of embodiments of the present invention, there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
Alternatively, in the present embodiment, the above-described storage medium may be configured to store a computer program for performing the steps of:
s21, obtaining coding cost information of a block to be coded in a current video frame, wherein the coding cost information comprises cost information obtained by carrying out intra-frame predictive coding on the block to be coded and cost information obtained by carrying out inter-frame predictive coding on the block to be coded;
S22, determining a target resolution for encoding the block to be encoded according to the encoding cost information;
s23, the target resolution is adopted to code the block to be coded.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the method described in the embodiments of the present invention.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In 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 exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown 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 may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (17)

1. A video decoding method, comprising:
obtaining a target flag bit corresponding to a target Block to be decoded from a current video frame, wherein the target flag bit is determined according to coding cost information and is used for encoding the Block to be encoded to obtain a target resolution adopted when the target Block to be decoded is obtained, determining a first ratio of an intra-frame coding cost value Block_Icost of the Block to be encoded to a unidirectional inter-frame coding cost value Block_Pcost of the Block to be encoded, and determining the target resolution to be the first resolution under the condition that the first ratio is smaller than a first preset threshold value, and the method comprises the following steps: determining that the target resolution is a third resolution in the case of a second preset threshold= < the first ratio < the first preset threshold; in the case where a third preset threshold value= < the first ratio value < the second preset threshold value, determining the target resolution as a fourth resolution; in the case where a fourth preset threshold value= < the first ratio value < the third preset threshold value, determining the target resolution as a fifth resolution; determining that the target resolution is a sixth resolution if the first ratio is less than the fourth preset threshold, wherein the third resolution is less than the fourth resolution and the fifth resolution is less than the sixth resolution and the first resolution is less than the first resolution, and the first resolution comprises: the third resolution, the fourth resolution, the fifth resolution and the sixth resolution, wherein the coding cost information includes the intra-frame coding cost value block_icost obtained by performing intra-frame prediction coding on the Block to be coded, and the unidirectional inter-frame coding cost value block_pcost obtained by performing unidirectional inter-frame prediction coding on the Block to be coded, and a first comparison result is used for indicating a magnitude relation between the first ratio and the first preset threshold, and the first preset threshold is a preset resolution threshold; or alternatively
Determining the target resolution according to a second ratio of the intra-frame coding cost value block_Icost and the inter-frame coding cost value of the Block to be coded and a second comparison result with a fifth preset threshold, wherein the coding cost information comprises the intra-frame coding cost value block_Icost obtained by carrying out intra-frame prediction coding on the Block to be coded, the unidirectional inter-frame coding cost value block_Pcost obtained by carrying out unidirectional inter-frame prediction coding on the Block to be coded and a bidirectional inter-frame coding cost value block_Bct obtained by carrying out bidirectional inter-frame prediction coding on the Block to be coded, and the inter-frame coding cost value is the sum of the unidirectional inter-frame coding cost value block_Pcost and the bidirectional inter-frame coding cost value block_Bct;
acquiring the target resolution represented by the target zone bit;
and decoding the target block to be decoded by adopting the target resolution.
2. The method of claim 1, wherein the obtaining the target resolution represented by the target flag bit comprises:
And acquiring the target resolution represented by the target zone bit from a preset resolution set.
3. The method according to claim 1, wherein the target resolution is a resolution determined from coding cost information of a block to be coded corresponding to the target block to be decoded, wherein the coding cost information includes cost information obtained by intra-prediction coding the block to be coded and cost information obtained by inter-prediction coding the block to be coded.
4. The method of claim 1, wherein decoding the target block to be decoded using the target resolution comprises:
and decoding the target block to be decoded into a block with the resolution of the target resolution.
5. A video encoding method, comprising:
acquiring coding cost information of a block to be coded in a current video frame, wherein the coding cost information comprises cost information obtained by carrying out intra-frame predictive coding on the block to be coded and cost information obtained by carrying out inter-frame predictive coding on the block to be coded;
determining a first ratio of the intra-frame coding cost value block_icost of the Block to be coded to the unidirectional inter-frame coding cost value block_pcost of the Block to be coded, and determining that the target resolution is the first resolution if the first ratio is smaller than a first preset threshold value, including: determining that the target resolution is a third resolution in the case of a second preset threshold= < the first ratio < the first preset threshold; in the case where a third preset threshold value= < the first ratio value < the second preset threshold value, determining the target resolution as a fourth resolution; in the case where a fourth preset threshold value= < the first ratio value < the third preset threshold value, determining the target resolution as a fifth resolution; determining that the target resolution is a sixth resolution if the first ratio is less than the fourth preset threshold, wherein the third resolution is less than the fourth resolution and the fifth resolution is less than the sixth resolution and the first resolution is less than the first resolution, and the first resolution comprises: the third resolution, the fourth resolution, the fifth resolution and the sixth resolution, wherein the coding cost information includes the intra-frame coding cost value block_icost obtained by performing intra-frame prediction coding on the Block to be coded, and the unidirectional inter-frame coding cost value block_pcost obtained by performing unidirectional inter-frame prediction coding on the Block to be coded, and a first comparison result is used for indicating a magnitude relation between the first ratio and the first preset threshold; or alternatively
Determining the target resolution according to a second ratio of the intra-frame coding cost value block_Icost and the inter-frame coding cost value of the Block to be coded and a second comparison result with a fifth preset threshold, wherein the coding cost information comprises the intra-frame coding cost value block_Icost obtained by carrying out intra-frame prediction coding on the Block to be coded, the unidirectional inter-frame coding cost value block_Pcost obtained by carrying out unidirectional inter-frame prediction coding on the Block to be coded and a bidirectional inter-frame coding cost value block_Bct obtained by carrying out bidirectional inter-frame prediction coding on the Block to be coded, and the inter-frame coding cost value is the sum of the unidirectional inter-frame coding cost value block_Pcost and the bidirectional inter-frame coding cost value block_Bct;
and adopting the target resolution to code the block to be coded.
6. The method of claim 5, wherein determining a target resolution for encoding the block to be encoded based on the encoding cost information comprises:
under the condition that the encoding cost information indicates that the intra-frame texture of the block to be encoded is complex, determining the target resolution as a first resolution;
And under the condition that the coding cost information indicates that the inter-frame motion of the block to be coded is complex, determining the target resolution as a second resolution, wherein the first resolution is smaller than the second resolution.
7. The method of claim 5, wherein determining the target resolution from an intra-coded cost value of the block to be encoded and a uni-directional inter-coded cost value of the block to be encoded comprises:
and determining the target resolution as a second resolution under the condition that the first ratio is greater than or equal to the first preset threshold, wherein the first resolution is smaller than the second resolution.
8. The method of claim 5, wherein the first preset threshold, the second preset threshold, the third preset threshold, the fourth preset threshold are positively correlated with the number of pixels of the block to be encoded.
9. The method of claim 5, wherein the determining the target resolution according to the intra-coding cost value block_icost of the Block to be coded, the uni-directional inter-coding cost value block_pcost of the Block to be coded, and the bi-directional inter-coding cost value block_bcost of the Block to be coded comprises:
Determining a second ratio of the intra-frame coding cost value Block_Icost to an inter-frame coding cost value, wherein the inter-frame coding cost value is the sum of the unidirectional inter-frame coding cost value Block_Pcost and the bidirectional inter-frame coding cost value Block_Bcost;
determining the target resolution as a first resolution under the condition that the second ratio is smaller than a fifth preset threshold;
and determining the target resolution as a second resolution when the second ratio is greater than or equal to the fifth preset threshold, wherein the first resolution is smaller than the second resolution.
10. The method of claim 9, wherein determining the target resolution as the first resolution if the second ratio is less than a fifth preset threshold comprises:
determining that the target resolution is a third resolution when a sixth preset threshold is greater than or equal to the second ratio being less than the fifth preset threshold;
determining that the target resolution is a fourth resolution when a seventh preset threshold is greater than or equal to the second ratio being less than the sixth preset threshold;
determining that the target resolution is a fifth resolution when an eighth preset threshold is greater than or equal to the second ratio being less than the seventh preset threshold;
Determining that the target resolution is a sixth resolution if the second ratio is less than the eighth preset threshold, wherein the third resolution < the fourth resolution < the fifth resolution < the sixth resolution < the first resolution, the first resolution comprising: the third resolution, the fourth resolution, the fifth resolution, and the sixth resolution.
11. The method of claim 10, wherein the fifth preset threshold, the sixth preset threshold, the seventh preset threshold, the eighth preset threshold are positively correlated with the number of pixels of the block to be encoded.
12. The method according to claim 5, wherein obtaining coding cost information of a block to be coded in a current coded video frame comprises:
performing intra-frame predictive coding on the Block to be coded to obtain an intra-frame coding cost value Block_Icost, and performing unidirectional inter-frame predictive coding on the Block to be coded to obtain a unidirectional inter-frame coding cost value Block_Pcost, wherein the coding cost information comprises the intra-frame coding cost value Block_Icost and the unidirectional inter-frame coding cost value Block_Pcost; or alternatively
And carrying out intra-frame predictive coding on the Block to be coded to obtain an intra-frame coding cost value Block_Icost, carrying out unidirectional inter-frame predictive coding on the Block to be coded to obtain a unidirectional inter-frame coding cost value Block_Pcost, and carrying out bidirectional inter-frame predictive coding on the Block to be coded to obtain a bidirectional inter-frame coding cost value Block_Bct, wherein the coding cost information comprises the intra-frame coding cost value Block_Icost, the unidirectional inter-frame coding cost value Block_Pcost and the bidirectional inter-frame coding cost value Block_Bct.
13. The method of claim 5, wherein the method further comprises:
and setting a flag bit in encoded data obtained by encoding the block to be encoded by adopting the target resolution, wherein the flag bit is used for carrying the target resolution.
14. A video decoding apparatus, comprising:
the first obtaining module is configured to obtain a target flag bit corresponding to a target Block to be decoded from a current decoded video frame, where the target flag bit is determined according to coding cost information, and is used to determine a target resolution adopted when the target Block to be decoded is obtained by coding a Block to be coded, determine a first ratio of an intra-frame coding cost value block_icost of the Block to be coded to a unidirectional inter-frame coding cost value block_pcost of the Block to be coded, and determine that the target resolution is the first resolution when the first ratio is smaller than a first preset threshold, where the determining includes: determining that the target resolution is a third resolution in the case of a second preset threshold= < the first ratio < the first preset threshold; in the case where a third preset threshold value= < the first ratio value < the second preset threshold value, determining the target resolution as a fourth resolution; in the case where a fourth preset threshold value= < the first ratio value < the third preset threshold value, determining the target resolution as a fifth resolution; determining that the target resolution is a sixth resolution if the first ratio is less than the fourth preset threshold, wherein the third resolution is less than the fourth resolution and the fifth resolution is less than the sixth resolution and the first resolution is less than the first resolution, and the first resolution comprises: the third resolution, the fourth resolution, the fifth resolution and the sixth resolution, wherein the coding cost information includes the intra-frame coding cost value block_icost obtained by performing intra-frame prediction coding on the Block to be coded, and the unidirectional inter-frame coding cost value block_pcost obtained by performing unidirectional inter-frame prediction coding on the Block to be coded, and a first comparison result is used for indicating a magnitude relation between the first ratio and the first preset threshold, and the first preset threshold is a preset resolution threshold; or alternatively
Determining the target resolution according to a second ratio of the intra-frame coding cost value block_Icost and the inter-frame coding cost value of the Block to be coded and a second comparison result with a fifth preset threshold, wherein the coding cost information comprises the intra-frame coding cost value block_Icost obtained by carrying out intra-frame prediction coding on the Block to be coded, the unidirectional inter-frame coding cost value block_Pcost obtained by carrying out unidirectional inter-frame prediction coding on the Block to be coded and a bidirectional inter-frame coding cost value block_Bct obtained by carrying out bidirectional inter-frame prediction coding on the Block to be coded, and the inter-frame coding cost value is the sum of the unidirectional inter-frame coding cost value block_Pcost and the bidirectional inter-frame coding cost value block_Bct;
the second acquisition module is used for acquiring the target resolution represented by the target zone bit;
and the decoding module is used for decoding the target block to be decoded by adopting the target resolution.
15. A video encoding apparatus, comprising:
The third acquisition module is used for acquiring coding cost information of a block to be coded in a current coded video frame, wherein the coding cost information comprises cost information obtained by carrying out intra-frame predictive coding on the block to be coded and cost information obtained by carrying out inter-frame predictive coding on the block to be coded;
a determining module, configured to determine a first ratio of an intra-frame coding cost value block_icost of the Block to be encoded to a unidirectional inter-frame coding cost value block_pcost of the Block to be encoded, and determine that the target resolution is the first resolution when the first ratio is smaller than a first preset threshold, where the determining module includes: determining that the target resolution is a third resolution in the case of a second preset threshold= < the first ratio < the first preset threshold; in the case where a third preset threshold value= < the first ratio value < the second preset threshold value, determining the target resolution as a fourth resolution; in the case where a fourth preset threshold value= < the first ratio value < the third preset threshold value, determining the target resolution as a fifth resolution; determining that the target resolution is a sixth resolution if the first ratio is less than the fourth preset threshold, wherein the third resolution is less than the fourth resolution and the fifth resolution is less than the sixth resolution and the first resolution is less than the first resolution, and the first resolution comprises: the third resolution, the fourth resolution, the fifth resolution and the sixth resolution, wherein the coding cost information includes the intra-frame coding cost value block_icost obtained by performing intra-frame prediction coding on the Block to be coded, and the unidirectional inter-frame coding cost value block_pcost obtained by performing unidirectional inter-frame prediction coding on the Block to be coded, and a first comparison result is used for indicating a magnitude relation between the first ratio and the first preset threshold; or alternatively
Determining the target resolution according to a second ratio of the intra-frame coding cost value block_Icost and the inter-frame coding cost value of the Block to be coded and a second comparison result with a fifth preset threshold, wherein the coding cost information comprises the intra-frame coding cost value block_Icost obtained by carrying out intra-frame prediction coding on the Block to be coded, the unidirectional inter-frame coding cost value block_Pcost obtained by carrying out unidirectional inter-frame prediction coding on the Block to be coded and a bidirectional inter-frame coding cost value block_Bct obtained by carrying out bidirectional inter-frame prediction coding on the Block to be coded, and the inter-frame coding cost value is the sum of the unidirectional inter-frame coding cost value block_Pcost and the bidirectional inter-frame coding cost value block_Bct;
and the encoding module is used for encoding the block to be encoded by adopting the target resolution.
16. A computer readable storage medium comprising a stored program, wherein the program when run performs the method of any one of the preceding claims 1 to 4 or 5 to 13.
17. 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 according to any of the claims 1-4 or 5-13 by means of the computer program.
CN201910927967.7A 2019-09-27 2019-09-27 Video encoding and decoding methods and devices, storage medium and electronic device Active CN110636293B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910927967.7A CN110636293B (en) 2019-09-27 2019-09-27 Video encoding and decoding methods and devices, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910927967.7A CN110636293B (en) 2019-09-27 2019-09-27 Video encoding and decoding methods and devices, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN110636293A CN110636293A (en) 2019-12-31
CN110636293B true CN110636293B (en) 2024-03-15

Family

ID=68973443

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910927967.7A Active CN110636293B (en) 2019-09-27 2019-09-27 Video encoding and decoding methods and devices, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN110636293B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113938690B (en) * 2021-12-03 2023-10-31 北京达佳互联信息技术有限公司 Video encoding method, video encoding device, electronic equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6370192B1 (en) * 1997-11-20 2002-04-09 Hitachi America, Ltd. Methods and apparatus for decoding different portions of a video image at different resolutions
WO2011145836A2 (en) * 2010-05-17 2011-11-24 에스케이텔레콤 주식회사 Image coding/decoding device using coding block in which intra block and inter block are mixed, and method thereof
KR20120079561A (en) * 2011-01-05 2012-07-13 에스케이 텔레콤주식회사 Apparatus and method for intra prediction encoding/decoding based on selective multi-path predictions
CN102595108A (en) * 2011-01-05 2012-07-18 中兴通讯股份有限公司 Method and device for coding syntactic element
CN107155107A (en) * 2017-03-21 2017-09-12 腾讯科技(深圳)有限公司 Method for video coding and device, video encoding/decoding method and device
CN108391127A (en) * 2018-04-27 2018-08-10 腾讯科技(深圳)有限公司 Method for video coding, device, storage medium and equipment
CN109495746A (en) * 2018-11-07 2019-03-19 建湖云飞数据科技有限公司 A kind of method for video coding based on motion vector adjustment
KR20190033403A (en) * 2017-09-21 2019-03-29 에스케이텔레콤 주식회사 Video Encoding and Decoding using Resolution Enhancement Scheme
CN109889829A (en) * 2019-01-23 2019-06-14 北方工业大学 The point self-adapted compensation of the quick sample product of 360 degree of videos
CN110049321A (en) * 2018-01-16 2019-07-23 腾讯科技(深圳)有限公司 Method for video coding, device, equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9699457B2 (en) * 2011-10-11 2017-07-04 Qualcomm Incorporated Most probable transform for intra prediction coding
US10200707B2 (en) * 2015-10-29 2019-02-05 Microsoft Technology Licensing, Llc Video bit stream decoding
CN105898308A (en) * 2015-12-18 2016-08-24 乐视云计算有限公司 Resolution-variable coding mode prediction method and device

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6370192B1 (en) * 1997-11-20 2002-04-09 Hitachi America, Ltd. Methods and apparatus for decoding different portions of a video image at different resolutions
WO2011145836A2 (en) * 2010-05-17 2011-11-24 에스케이텔레콤 주식회사 Image coding/decoding device using coding block in which intra block and inter block are mixed, and method thereof
KR20120079561A (en) * 2011-01-05 2012-07-13 에스케이 텔레콤주식회사 Apparatus and method for intra prediction encoding/decoding based on selective multi-path predictions
CN102595108A (en) * 2011-01-05 2012-07-18 中兴通讯股份有限公司 Method and device for coding syntactic element
CN107155107A (en) * 2017-03-21 2017-09-12 腾讯科技(深圳)有限公司 Method for video coding and device, video encoding/decoding method and device
WO2018171447A1 (en) * 2017-03-21 2018-09-27 腾讯科技(深圳)有限公司 Video encoding method, video decoding method, computer device and storage medium
KR20190033403A (en) * 2017-09-21 2019-03-29 에스케이텔레콤 주식회사 Video Encoding and Decoding using Resolution Enhancement Scheme
CN110049321A (en) * 2018-01-16 2019-07-23 腾讯科技(深圳)有限公司 Method for video coding, device, equipment and storage medium
WO2019140952A1 (en) * 2018-01-16 2019-07-25 腾讯科技(深圳)有限公司 Video encoding method, device, apparatus and storage medium
CN108391127A (en) * 2018-04-27 2018-08-10 腾讯科技(深圳)有限公司 Method for video coding, device, storage medium and equipment
CN109495746A (en) * 2018-11-07 2019-03-19 建湖云飞数据科技有限公司 A kind of method for video coding based on motion vector adjustment
CN109889829A (en) * 2019-01-23 2019-06-14 北方工业大学 The point self-adapted compensation of the quick sample product of 360 degree of videos

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
AHG8: Summary of Resolution Adaptivity related proposals;Stephan Wenger等;《Joint Video Experts Team (JVET) of ITU-T SG 16 WP 3 and ISO/IEC JTC 1/SC 29/WG 11 15th Meeting: Gothenburg, SE, 3–12 July 2019, JVET-O1040v2》;全文 *

Also Published As

Publication number Publication date
CN110636293A (en) 2019-12-31

Similar Documents

Publication Publication Date Title
CN108848376B (en) Video encoding method, video decoding method, video encoding device, video decoding device and computer equipment
CN108848380B (en) Video encoding and decoding method, device, computer device and storage medium
CN108924553B (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, computer device, and storage medium
CN110636312B (en) Video encoding and decoding method and device and storage medium
EP3813371B1 (en) Video encoding/decoding method and apparatus, computer device, and storage medium
CN108848377B (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, computer device, and storage medium
KR20120082994A (en) Motion vector coding and decoding method and apparatus
CN110545433B (en) Video encoding and decoding method and device and storage medium
CN110572673B (en) Video encoding and decoding method and device, storage medium and electronic device
CN110519607B (en) Video decoding method and device, and video encoding method and device
CN110636293B (en) Video encoding and decoding methods and devices, storage medium and electronic device
CN110582022B (en) Video encoding and decoding method and device and storage medium
CN110572672B (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
CN110572677B (en) Video encoding and decoding method and device, storage medium and electronic device
CN110677653B (en) Video encoding and decoding method and device and storage medium
CN112351278A (en) Video encoding method and device and video decoding method and device
CN110677721B (en) Video encoding and decoding method and device and storage medium
CN114222127A (en) Video coding method, video decoding method and device
CN110677676B (en) Video encoding method and apparatus, video decoding method and apparatus, and storage medium
CN110572653B (en) Video encoding and decoding methods and devices, storage medium and electronic device
CN110677692B (en) Video decoding method and device and video encoding method and device
CN110545431B (en) Video decoding method and device, video encoding method and device
CN110572654B (en) Video encoding and decoding methods and devices, storage medium and electronic device
CN110536134B (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40018638

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant