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

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

Info

Publication number
CN110677691B
CN110677691B CN201910927973.2A CN201910927973A CN110677691B CN 110677691 B CN110677691 B CN 110677691B CN 201910927973 A CN201910927973 A CN 201910927973A CN 110677691 B CN110677691 B CN 110677691B
Authority
CN
China
Prior art keywords
resolution
preset threshold
target
determining
equal
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
CN201910927973.2A
Other languages
Chinese (zh)
Other versions
CN110677691A (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 CN201910927973.2A priority Critical patent/CN110677691B/en
Publication of CN110677691A publication Critical patent/CN110677691A/en
Application granted granted Critical
Publication of CN110677691B publication Critical patent/CN110677691B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/23418Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234309Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by transcoding between formats or standards, e.g. from MPEG-2 to MPEG-4 or from Quicktime to Realvideo
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234363Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by altering the spatial resolution, e.g. for clients with a lower screen resolution
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/266Channel or content management, e.g. generation and management of keys and entitlement messages in a conditional access system, merging a VOD unicast channel into a multicast channel
    • H04N21/2662Controlling the complexity of the video stream, e.g. by scaling the resolution or bitrate of the video stream based on the client capabilities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/44008Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics in the video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • H04N21/440218Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by transcoding between formats or standards, e.g. from MPEG-2 to MPEG-4
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • H04N21/440263Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by altering the spatial resolution, e.g. for displaying on a connected PDA
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/45Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
    • H04N21/462Content or additional data management, e.g. creating a master electronic program guide from data received from the Internet and a Head-end, controlling the complexity of a video stream by scaling the resolution or bit-rate based on the client capabilities
    • H04N21/4621Controlling the complexity of the content stream or additional data, e.g. lowering the resolution or bit-rate of the video stream for a mobile client with a small screen

Abstract

The invention discloses a video encoding method, a video decoding method, a video encoding device, a video decoding device, a storage medium and an electronic device. Wherein, the method comprises the following steps: acquiring image gradient information of a block to be coded in a current video frame, wherein the image gradient information comprises a horizontal gradient value of each pixel and/or a vertical gradient value of each pixel in the block to be coded; determining a target resolution for coding the block to be coded according to the image gradient information; and coding the block to be coded according to the target resolution. The invention solves the technical problem of poor video quality caused by relatively large coding distortion of different blocks in one frame of a video by adopting the same resolution in the existing video coding process.

Description

Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
Technical Field
The present invention relates to the field of computers, and in particular, to a video encoding method, a video decoding method, a video encoding device, a video decoding device, a storage medium, and an electronic device.
Background
With the development of digital media technology and computer technology, video is applied to various fields, such as mobile communication, network monitoring, network television, and the like. With the improvement of hardware performance and screen resolution, the demand of users for high-definition video is increasingly strong.
If different blocks in a frame of a video are encoded by adopting high resolution, under the condition that the transmission bandwidth is small, the peak signal-to-noise ratio PSNR1 corresponding to the different blocks in the frame of the video encoded by adopting high resolution is lower than the peak signal-to-noise ratio PSNR2 corresponding to the different blocks in the frame of the video encoded by adopting low resolution, that is, the peak signal-to-noise ratio PSNR1 corresponding to the different blocks in the frame of the video encoded by adopting high resolution is relatively small when the transmission bandwidth is small, and the distortion is relatively large.
Similarly, if different blocks in a frame of the video are encoded with low resolution, the peak signal-to-noise ratio PSNR3 corresponding to the low resolution encoding of different blocks in a frame of the video is lower than the peak signal-to-noise ratio PSNR4 corresponding to the high resolution encoding of different blocks in a frame of the video when the transmission bandwidth is large, that is, the peak signal-to-noise ratio PSNR3 corresponding to the low resolution encoding of different blocks in a frame of the video is relatively small and the distortion is relatively large when the transmission bandwidth is large.
Under the condition of limited moving bandwidth, the problem of poor video quality caused by relatively large scene distortion may occur when different blocks in a video frame are encoded by using the same resolution in the prior art.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
Embodiments of the present invention provide a video encoding method and apparatus, a video decoding method and apparatus, a storage medium, and an electronic apparatus, so as to at least solve the technical problem of poor video quality caused by relatively large coding distortion when different blocks in a frame of a video are coded with the same resolution in the existing video encoding process.
According to an aspect of the embodiments of the present invention, there is also provided a video decoding method, including:
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 a target resolution adopted by the target block to be decoded during encoding, the target resolution is determined according to image gradient information of a block to be coded corresponding to the target block to be decoded, and the image gradient information comprises a horizontal gradient value of each pixel and a vertical gradient value of each pixel in the block to be coded;
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 embodiments of the present invention, there is also provided a video encoding method, including:
acquiring image gradient information of a block to be coded in a current video frame, wherein the image gradient information comprises a horizontal gradient value of each pixel and/or a vertical gradient value of each pixel in the block to be coded;
determining a target resolution for coding the block to be coded according to the image gradient information;
and coding the block to be coded according to the target resolution.
According to another aspect of the embodiments of the present invention, there is also provided a video decoding apparatus, including:
a first obtaining module, configured to obtain a target flag bit corresponding to a target block to be decoded from a current video frame, where the target flag bit is used to indicate a target resolution that is adopted by the target block to be decoded when encoding is performed, the target resolution is a resolution that is determined according to image gradient information of a block to be coded that corresponds to the target block to be decoded, and the image gradient information includes a horizontal gradient value of each pixel and a vertical gradient value of each pixel in the block to be coded;
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 embodiments of the present invention, there is also provided a video encoding apparatus, including:
a third obtaining module, configured to obtain image gradient information of a block to be coded in a current video frame, where the image gradient information includes a horizontal gradient value of each pixel and/or a vertical gradient value of each pixel in the block to be coded;
a determining module, configured to determine, according to the image gradient information, a target resolution for encoding the block to be encoded;
and the coding module is used for coding the block to be coded according to the target resolution.
According to still another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned video encoding method or the above-mentioned video decoding method when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the video encoding method or the video decoding method through the computer program.
In the embodiment of the invention, the target resolution of the current block to be coded is decided according to the image gradient information of the block to be coded, the block to be coded is coded according to the target resolution, and different resolutions are adopted for coding different blocks, so that the coding distortion is relatively small, the video quality is improved, and the technical problem of poor video quality caused by relatively large coding distortion of different blocks in one frame of a video in the existing video coding process is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a diagram illustrating an exemplary embodiment of a video encoding method and a video decoding method;
FIG. 2 is a diagram illustrating an internal structure of the terminal of FIG. 1 according to one embodiment;
FIG. 3 is a diagram illustrating the internal structure of the server of FIG. 1 in one embodiment;
fig. 4 is a flowchart of a video encoding method according to an embodiment of the present invention;
FIG. 5 is a first diagram illustrating video encoding according to an embodiment of the present invention;
FIG. 6 is a second diagram of video encoding according to an embodiment of the present invention;
fig. 7 is a flowchart of a video decoding method according to an embodiment of the present invention;
fig. 8 is a block diagram of a video decoding apparatus according to an embodiment of the present invention;
fig. 9 is a block diagram of a video encoding apparatus according to an embodiment of the present invention;
fig. 10 is a block diagram of a video encoding apparatus according to a preferred embodiment of the present invention;
FIG. 11 is a first schematic structural diagram of an alternative electronic device according to an embodiment of the invention;
fig. 12 is a schematic structural diagram of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order to make those skilled in the art better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a diagram illustrating an application environment in which a video encoding method and a video decoding method are executed according to an embodiment. As shown in fig. 1, the application environment includes a terminal 110 and a server 120, wherein the terminal 110 and the server 120 communicate via a network.
The terminal 110 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, and the like. The video encoding method and the video decoding method may be completed in the terminal 110 or the server 120, and the terminal 110 may perform adaptive resolution encoding on a video frame to be encoded by using the video encoding method and then transmit the encoded video frame to the server 120, or may receive encoded data of 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 bitstream when it is stored, where the video encoding method is performed at the server, and if the server 120 needs to decode the bitstream, where the video decoding method is performed at the server.
In one embodiment, the internal structure of the terminal 110 in fig. 1 is as shown in fig. 2, and the terminal 110 includes a processor, a graphic processing unit, a storage medium, a memory, a network interface, a display screen, and an input device, which are connected through a system bus. The storage medium of the terminal 110 stores an operating system, and further includes a video encoding apparatus and/or a video decoding apparatus, which are used to implement a video encoding method and/or a video decoding method suitable for the terminal. The processor is used to provide computational and control capabilities that support the operation of the entire terminal 110. The graphic processing unit in the terminal 110 is configured to provide at least a rendering capability of a display interface, the memory provides an environment for the operation of the video encoding device and/or the video decoding device in the storage medium, and the network interface is configured to perform network communication with the server 120. The display screen is used for displaying an application interface and the like, such as decoding video, and the input device is used for receiving commands or data input by a user. For a terminal 110 with a touch screen, the display screen and input device may be a touch screen. The structure shown in fig. 2 is a block diagram of only a part of the structure related to the present application, and does not constitute a limitation of the terminal to which the present application is applied, and a specific terminal or server may include more or less components than those shown in the figure, or combine some components, or have different arrangements of components.
In one embodiment, the internal structure of the server 120 in fig. 1 is shown in fig. 3, and the server 120 includes a processor, a storage medium, a memory, and a network interface connected by a system bus. The storage medium of the server 120 stores an operating system, a database, a video encoding device and/or a video decoding device, wherein the database is used for storing data, and the video encoding device and/or the video decoding device are used for implementing a video encoding method and/or a video decoding method suitable for the server 120. The processors of the server 120 are used to provide computing and control capabilities that support the operation of the entire server 120. The memory of the server 120 provides an environment for the operation of the video encoding device and/or the video decoding device in the storage medium. The network interface of the server 120 is used for communication with the external terminal 110 through a network connection. The configurations shown in fig. 2 and 3 are block diagrams of only a portion of the configurations associated with the present application and do not constitute a limitation on the terminal to which the present application is applied, and a particular terminal or server may include more or fewer components than shown, or combine certain components, or have a different arrangement of components.
An embodiment of the present invention provides a video encoding method, which is exemplified by a terminal or a server applied in the above application environment, and fig. 4 is a flowchart of the video encoding method according to the embodiment of the present invention, as shown in fig. 4, including the following steps:
step S402, obtaining image gradient information of a block to be coded in a current video frame, wherein the image gradient information comprises a horizontal gradient value of each pixel and/or a vertical gradient value of each pixel in the block to be coded;
specifically, the current video frame may be a video frame acquired in real time for instant messaging, or may be a video frame corresponding to a stored video.
Step S404, determining a target resolution for coding the block to be coded according to the image gradient information;
in the step S404, the encoding mode of the current encoding block can be determined by determining the target resolution, and may be a full sampling mode or a down-sampling mode according to the difference of the target resolution. The downsampling mode refers to downsampling a video frame to be coded (namely the current video frame) and then coding, the downsampling algorithm can be customized according to needs, and comprises vertical downsampling, horizontal downsampling, vertical and horizontal downsampling, the downsampling can be carried out by adopting algorithms such as direct averaging, a filter, bicubic Interpolation, bilinear Interpolation and the like, and the full sampling mode refers to directly coding the video frame to be coded.
Specifically, the down-sampling algorithm can be customized as required, and comprises vertical down-sampling, horizontal down-sampling, vertical and horizontal down-sampling. Parameters of sampling in a specific direction can be customized as required, in a specific embodiment, horizontal 1/3 down-sampling is performed on a video frame to be coded, the width of a sampled image is half of that of an original video frame, vertical 1/3 down-sampling is performed on the video frame to be coded, and the height of the sampled image is half of that of the original video frame; in another specific embodiment, the video frame to be encoded is horizontally 1/2 downsampled, the width of the sampled image is half of the original video frame, and the video frame to be encoded is vertically 1/2 downsampled, the height of the sampled image is half of the original video frame. If the current coding mode is the full sampling mode, the video frame to be coded does not need to be sampled and is directly used as the current coding video frame. If the width and height of the down-sampled image are not integral multiple of the maximum coding block, the image needs to be pixel-expanded to integral multiple of the maximum coding block.
Step S406, encoding the block to be encoded according to the target resolution.
Through the steps S402 to S406, the target resolution of the current block to be coded is decided according to the image gradient information of the block to be coded, the block to be coded is coded according to the target resolution, and different coding blocks are coded with different resolutions, so that the coding distortion is relatively small, the video quality is improved, and further, the technical problem of poor video quality caused by relatively large coding distortion of different blocks in one frame of a video due to the same resolution in the existing video coding process is solved.
In an optional embodiment, the step S404 may specifically include:
determining the target resolution as a first resolution under the condition that the texture complexity of the block to be coded, which is represented by the image gradient information, is less than a first preset threshold; correspondingly, the texture complexity of the block to be coded, which is represented by the image gradient information, is smaller than a preset threshold value when the weighted sum of the horizontal gradient value and/or the vertical gradient value is smaller than the preset threshold value, or when the average value of the horizontal gradient value and/or the vertical gradient value is smaller than the preset threshold value;
and when the texture complexity of the block to be encoded represented by the image gradient information is greater than or equal to the first preset threshold, determining that the target resolution is a second resolution, and correspondingly, when the weighted sum of the horizontal gradient value and/or the vertical gradient value is greater than or equal to a preset threshold, or when the average value of the horizontal gradient value and/or the vertical gradient value is greater than or equal to a preset threshold, determining the texture complexity of the block to be encoded represented by the image gradient information.
In the embodiment of the present invention, the first resolution is greater than the second resolution, and the first resolution may be a preset full resolution.
In another optional embodiment, the step S404 may further include:
s4041, determining the target resolution according to the weighted sum of the horizontal gradient value and/or the vertical gradient value; or
S4042, determining the target resolution according to the horizontal gradient value and/or the average of the vertical gradient values.
In an embodiment of the present invention, step S4041 may specifically include:
determining the target resolution as a first resolution when the weighted sum of the horizontal gradient values is less than a first preset threshold and determining the target resolution as a second resolution when the weighted sum of the horizontal gradient values is greater than or equal to the first preset threshold in the case that the image gradient information includes the horizontal gradient values, wherein the first resolution is greater than the second resolution;
determining the target resolution as the first resolution when the weighted sum of the vertical gradient values is less than a second preset threshold and determining the target resolution as the second resolution when the weighted sum of the vertical gradient values is greater than or equal to the second preset threshold, in the case that the image gradient information includes the vertical gradient value;
and determining the target resolution as the first resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is less than a third preset threshold, and determining the target resolution as the second resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the third preset threshold.
Further, the second resolution may be divided into a plurality of levels of resolution, for example, the second resolution includes: third resolution, fourth resolution, fifth resolution, sixth resolution, etc. correspondingly, should be when the weighted sum of this horizontal gradient value is greater than or equal to this first preset threshold, confirm this target resolution is the second resolution, include: determining the target resolution as a third resolution when the weighted sum of the horizontal gradient values is greater than or equal to the first preset threshold and less than a fourth preset threshold; determining the target resolution as a fourth resolution when the weighted sum of the horizontal gradient values is greater than or equal to the fourth preset threshold and less than a fifth preset threshold; determining the target resolution as a fifth resolution under the condition that the weighted sum of the horizontal gradient values is greater than or equal to the fifth preset threshold and is less than a sixth preset threshold; determining the target resolution as a sixth resolution in the case that the weighted sum of the horizontal gradient values is greater than or equal to the sixth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
when the weighted sum of the vertical gradient values is greater than or equal to the second preset threshold, determining the target resolution as the second resolution includes: determining the target resolution as a third resolution when the weighted sum of the horizontal gradient values is greater than or equal to the second preset threshold and less than a seventh preset threshold; determining the target resolution as a fourth resolution when the weighted sum of the horizontal gradient values is greater than or equal to the seventh preset threshold and less than an eighth preset threshold; determining the target resolution as a fifth resolution under the condition that the weighted sum of the horizontal gradient values is greater than or equal to the eighth preset threshold and is less than a ninth preset threshold; determining the target resolution as a sixth resolution under the condition that the weighted sum of the horizontal gradient values is greater than or equal to the ninth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the third preset threshold, determining the target resolution as the second resolution includes: determining the target resolution as a third resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the third preset threshold and less than a tenth preset threshold; determining the target resolution as a fourth resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the tenth preset threshold and less than the eleventh preset threshold; determining the target resolution as a fifth resolution under the condition that the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the eleventh preset threshold and is less than the twelfth preset threshold; and under the condition that the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the twelfth preset threshold, determining that the target resolution is the sixth resolution, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
For a current block to be coded in a video, if the weighted sum of the horizontal gradient values is less than a first preset threshold value, the interframe motion of the current block is complex, and the current block is coded by adopting high resolution, namely, the first resolution. If the fourth preset threshold > the weighted sum of the horizontal gradient values > is equal to the first preset threshold, it indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 3/4 samples with high resolution, that is, the third resolution may be 3/4 samples with high resolution; if the fifth preset threshold > the weighted sum of the horizontal gradient values > is equal to the fourth preset threshold, it indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 2/3 samples with high resolution, that is, the fourth resolution may be 2/3 samples with high resolution; if the sixth preset threshold > the weighted sum of the horizontal gradient values > is equal to the fifth preset threshold, it indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 1/2 samples with high resolution width and height, that is, the fifth resolution may be 1/2 samples with first resolution width and height; the weighted sum of the horizontal gradient values > is equal to the sixth preset threshold, which indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 1/3 samples with high resolution, i.e. the sixth resolution may be 1/3 samples with high resolution, and so on.
For the case that the image gradient information includes a vertical gradient value, or a horizontal gradient value and a vertical gradient value, the description is omitted as similar to the case that the image gradient information includes a horizontal gradient value.
In an embodiment of the present invention, the first preset threshold, the second preset threshold, the third preset threshold, the fourth preset threshold, the fifth preset threshold, the sixth preset threshold, the seventh preset threshold, the eighth preset threshold, the ninth preset threshold, the tenth preset threshold, the eleventh preset threshold, and the twelfth preset threshold are positively correlated to the number of pixels of the block to be coded.
In an embodiment of the present invention, step S4042 may specifically include:
determining the target resolution as a first resolution when the average value of the horizontal gradient values is less than or equal to a thirteenth preset threshold and determining the target resolution as a second resolution when the average value of the horizontal gradient values is less than or equal to the thirteenth preset threshold, wherein the first resolution is less than the second resolution, in the case that the image gradient information includes the horizontal gradient values;
determining the target resolution as the first resolution when the image gradient information includes the vertical gradient value and an average value of the vertical gradient values is less than or equal to a fourteenth preset threshold, and determining the target resolution as the second resolution when the average value of the vertical gradient values is less than or equal to the fourteenth preset threshold;
and under the condition that the image gradient information comprises the horizontal gradient value and the vertical gradient value, determining the target resolution as the first resolution when the average value of the horizontal gradient value and the vertical gradient value is less than a fifteenth preset threshold, and determining the target resolution as the second resolution when the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the fifteenth preset threshold.
In an embodiment of the present invention, when the average of the horizontal gradient values is greater than or equal to the thirteenth preset threshold, determining that the target resolution is the second resolution includes: determining the target resolution as a third resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the thirteenth preset threshold and less than a sixteenth preset threshold; determining the target resolution as a fourth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the sixteenth preset threshold and is less than a seventeenth preset threshold; determining the target resolution as a fifth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the seventeenth preset threshold and less than the eighteenth preset threshold; determining the target resolution as a sixth resolution when the average of the horizontal gradient values is greater than or equal to the sixth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
when the average value of the vertical gradient values is greater than or equal to the fourteenth preset threshold, determining that the target resolution is the second resolution includes: determining the target resolution as a third resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the fourteenth preset threshold and is less than a nineteenth preset threshold; determining the target resolution as a fourth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the nineteenth preset threshold and is less than the twentieth preset threshold; determining the target resolution as a fifth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the twentieth preset threshold and is less than the twenty-first preset threshold; determining the target resolution as a sixth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the twenty-first preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
when the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the fifteenth preset threshold, determining that the target resolution is the second resolution comprises: determining the target resolution as a third resolution when an average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the fifteenth preset threshold and less than a twenty-second preset threshold; determining the target resolution as a fourth resolution under the condition that the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the twenty-second preset threshold and less than the twenty-third preset threshold; determining the target resolution as a fifth resolution under the condition that the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to a twenty-third preset threshold and less than a twenty-fourth preset threshold; and under the condition that the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the twenty-fourth preset threshold, determining that the target resolution is a sixth resolution, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
For a current block to be coded in a video, if the average value of the horizontal gradient values is less than a thirteenth preset threshold value, the motion between frames of the current block is complex, and the current block is coded by adopting high resolution, namely, the first resolution is used for coding. If the sixteenth preset threshold > is the average value of the horizontal gradient values > -is the thirteenth preset threshold, it indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 3/4 samples with high resolution, that is, the third resolution may be 3/4 samples with high resolution; if the seventeenth preset threshold > the average value of the horizontal gradient values > -sixteenth preset threshold, it indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 2/3 samples with high resolution, that is, the fourth resolution may be 2/3 of the first resolution; if the eighteenth preset threshold > the average value of the horizontal gradient values > is the seventeenth preset threshold, it indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 1/2 samples with high resolution, that is, the fifth resolution may be 1/2 of the first resolution; if the average value > of the horizontal gradient values is seventeenth preset threshold, it indicates that the intra texture of the current coding block is complex, and the current coding block is coded by using 1/3 samples with high resolution, that is, the sixth resolution may be 1/3 samples with high resolution, and so on.
For the case that the image gradient information includes a vertical gradient value, or a horizontal gradient value and a vertical gradient value, the description is omitted as similar to the case that the image gradient information includes a horizontal gradient value.
In an embodiment of the present invention, the thirteenth preset threshold, the fourteenth preset threshold, the fifteenth preset threshold, the sixteenth preset threshold, the seventeenth preset threshold, the eighteenth preset threshold, the nineteenth preset threshold, the twentieth preset threshold, the twenty-first preset threshold, the twenty-second preset threshold, the twenty-third preset threshold, and the twenty-fourth preset threshold may be preset, and are positively correlated to the number of pixels of the block to be coded.
In the video coding process of the embodiment of the invention, different resolution ratios are adaptively adopted for coding different blocks in one frame in a video, and the resolution ratio used by each coding block is determined by the gradient information of the current coding block, so that the decoding end can know the resolution ratio used by different blocks in the video frame during coding, and the decoding is rapidly completed.
In the embodiment of the present invention, the flag bit directly carries the target Resolution, where the first Resolution, the second Resolution, the third Resolution, the fourth Resolution, the fifth Resolution, and the sixth Resolution may be represented by 3 bits, for example, 000 represents the first Resolution, 001 represents the second Resolution, 010 represents the third Resolution, 011 represents the fourth Resolution, 100 represents the fifth Resolution, and 101 represents the sixth Resolution, the flag bit may be an Adaptive Resolution flag bit, and the name may be Adaptive Resolution.
In the embodiment of the present invention, the target resolution for decision may also be indicated by, but not limited to, the following flag bits (hereinafter, syntax elements):
a) obtaining a syntax element corresponding to each of the plurality of regions, wherein the syntax element is used for indicating a resolution adopted for decoding each region, and a plurality of resolutions adopted for decoding the plurality of regions include at least two different resolutions;
b) acquiring a first syntax element corresponding to each of the plurality of regions, wherein the first syntax element is used for indicating a relationship between a first resolution and a second resolution, the first resolution is a resolution used for encoding each region, the second resolution is a resolution used for encoding a reference region corresponding to each region in a reference video frame of the video frame to be decoded, and the plurality of resolutions used for encoding the plurality of regions include 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 small or the transmission bandwidth is large, the corresponding peak signal-to-noise ratio is relatively large, and the distortion is relatively small, so that the peak signal-to-noise ratio can be changed in a small range, and the peak signal-to-noise ratio is relatively large, and the technical effect of avoiding large fluctuation of the peak signal-to-noise ratio for encoding and decoding videos is realized.
The decision process of the coding resolution used by the coding block according to the embodiment of the present invention will be specifically described below.
In a first method, for a current coding block to be coded in a video, a horizontal gradient value of each row of pixels and/or a vertical gradient value of each column of pixels are obtained based on a pixel point, a weighted sum of the horizontal gradient values, or a weighted sum of the vertical gradient values, or a weighted sum of the horizontal gradient values and the vertical gradient values is determined, and the obtained weighted sum is compared with a threshold 1 (corresponding to the first preset threshold, the second preset threshold and/or the third preset threshold). If the weighted sum > is equal to the threshold value 1, the pixel distribution of the current coding block is uneven, the texture complexity is high, and the current coding block is coded by adopting low resolution; if the weighted sum is less than the threshold value 1, the pixel distribution of the current coding block is more uniform, the texture complexity is lower, and the current coding block is coded by adopting high resolution. The threshold value 1 is determined according to the size of the current coding block, and the size of the threshold value 1 is positively correlated with the size of the current coding block.
In the second mode, for a current coding block to be coded in the video, a horizontal gradient value of each row of pixels and/or a vertical gradient value of each column of pixels are obtained based on a pixel point, an average value of the horizontal gradient values, or an average value of the vertical gradient values, or an average value of the horizontal gradient values and the vertical gradient values is determined, and the obtained average value is compared with a threshold 2 (corresponding to the thirteenth preset threshold, the fourteenth preset threshold and/or the fifteenth preset threshold). If the average value > is equal to the threshold value 2, the pixel distribution of the current coding block is uneven, the texture complexity is high, and the current coding block is coded by adopting low resolution; if the average value is less than the threshold value 2, the pixel distribution of the current coding block is more uniform, the texture complexity is lower, and the current coding block is coded by adopting high resolution.
Fig. 5 is a schematic diagram of video encoding according to an embodiment of the present invention, as shown in fig. 5, in the video encoding process according to the embodiment of the present invention, the encoding resolution adopted by different blocks in one frame of the video is self-analyzed by using information of the current encoding block, so that the purpose that the corresponding peak signal-to-noise ratio is relatively large and distortion is relatively small in either the case that the bandwidth of transmission is relatively small (for example, smaller than the bandwidth threshold Th shown in fig. 5) or the case that the bandwidth of transmission is relatively large (for example, larger than the bandwidth threshold Th shown in fig. 5) can be achieved.
In addition, because the coding resolution adopted by the decision is adaptive to different blocks in one frame of the video, the corresponding resolution does not need to be selected according to the intersections (fig. 6 is a schematic diagram two of video coding according to an embodiment of the present invention, as shown by the intersections in fig. 6) corresponding to different types of videos or different frames of the same video or different blocks in the same frame when the frames in the video are coded, and the coding complexity is reduced.
In the video coding process of the embodiment of the invention, the coding resolution adopted by the gradient information self-adaptive decision of the current coding block is utilized for different blocks in one frame in the video, so that the peak signal-to-noise ratio is relatively high under the whole bandwidth, and the distortion is small. In addition, when different blocks in one frame of the video are coded, the corresponding resolution does not need to be selected according to the intersections corresponding to different types of videos or different frames of the same video or different blocks in the same frame, and the coding complexity is reduced.
An embodiment of the present invention provides a video decoding method, which is exemplified by a terminal or a server applied in the above application environment, and fig. 7 is a flowchart of the video decoding method according to the embodiment of the present invention, as shown in fig. 7, including the following steps:
step S702, acquiring a target flag bit corresponding to a target block to be decoded from a current video frame, wherein the target flag bit is used for indicating a target resolution adopted by the target block to be decoded when encoding, the target resolution is a resolution determined according to image gradient information of a block to be encoded corresponding to the target block to be decoded, and the image gradient information includes a horizontal gradient value of each pixel and a vertical gradient value of each pixel in the block to be encoded;
specifically, each block to be decoded in the current video frame corresponds to a flag bit for indicating a resolution adopted in encoding, and the flag bit is obtained by obtaining a flag bit corresponding to a preset position in the current video frame, obtaining a target resolution used by an encoding block corresponding to a target block to be decoded in an encoding process through the flag bit, and determining whether the current decoding mode is a full resolution mode or a down-sampling mode according to the target resolution, wherein the current decoding mode is the same as the current encoding mode.
Step S704, obtaining the target resolution indicated by the target flag bit;
step S706, decoding the target block to be decoded by using the target resolution.
Through the steps S702 to S706, the decoding side obtains the target resolution through the flag bit, and decodes the block to be decoded according to the target resolution, thereby solving the technical problem that in the existing video encoding process, different blocks in one frame of a video are encoded by using the same resolution, and the decoding process is performed by using the same resolution, so that the distortion in the video transmission process is relatively large, and the video quality is poor.
In the embodiment of the invention, at least one pair of blocks to be decoded to be reconstructed is determined from a current video frame, wherein each pair of blocks to be decoded in the at least one block to be decoded comprises a first block to be decoded with a first resolution and a second block to be decoded with a second resolution, and the first block to be decoded and the second block to be decoded are adjacent blocks to be decoded;
adjusting the first resolution of the first block to be decoded to a target resolution, and adjusting the second resolution of the second block to be decoded to the target resolution;
determining a first edge pixel point set from the first block to be decoded and determining a second edge pixel point set from the second block to be decoded, wherein the position of the first edge pixel point set is adjacent to the position of the second edge pixel point set;
and filtering the first edge pixel point set to obtain a filtered first edge pixel point set, and filtering the second edge pixel point set to obtain a filtered second edge pixel point set, wherein the filtered first edge pixel point set is matched with the filtered second edge pixel point set.
And a first difference value between the pixel value of the ith pixel point in the first edge pixel point set after filtering and the pixel value of the jth pixel point corresponding to the ith pixel point in the second edge pixel point set after filtering is smaller than a second difference value between the pixel value of the ith pixel point in the first edge pixel point set and the pixel value of the jth pixel point in the second edge pixel point set, i is a positive integer and is less than or equal to the total number of the pixel points in the first edge pixel point set, and j is a positive integer and is less than or equal to the total number of the pixel points in the second edge pixel point set.
Wherein adjusting to the target resolution comprises:
1) in the case that the target resolution is equal to the first resolution, adjusting the second resolution to the first resolution;
2) adjusting the first resolution to the second resolution in a case where the target resolution is equal to the second resolution;
3) in the case where the target resolution is equal to the third resolution, the first resolution is adjusted to the third resolution, and the second resolution is adjusted to the third resolution, wherein the third resolution is different from the first resolution and different from the second resolution.
By adjusting the resolution of the block to be decoded and performing edge filtering on the edge pixel point set determined in the block to be decoded, the occurrence of obvious seams in the video can be avoided in the reconstruction process, so that the content in the video can be accurately restored, and the technical problem of video distortion caused by inconsistent resolution is solved.
In an embodiment of the present invention, the step S704 specifically includes: the target resolution represented by the target flag is obtained from a predetermined resolution set.
In the embodiment of the present invention, when the texture complexity of the block to be coded, which is represented by the image gradient information, is less than a first preset threshold, the target resolution is a first resolution; when the texture complexity of the block to be encoded represented by the image gradient information is greater than or equal to the first preset threshold, the target resolution is a second resolution, wherein the first resolution is greater than the second resolution. Correspondingly, the texture complexity of the block to be coded, which is represented by the image gradient information, is smaller than a preset threshold value when the weighted sum of the horizontal gradient value and/or the vertical gradient value is smaller than the preset threshold value, or when the average value of the horizontal gradient value and/or the vertical gradient value is smaller than the preset threshold value; and if the weighted sum of the horizontal gradient value and/or the vertical gradient value is greater than or equal to a preset threshold, or if the average of the horizontal gradient value and/or the vertical gradient value is greater than or equal to a preset threshold, the texture complexity of the block to be encoded represented by the image gradient information.
In this embodiment of the present invention, the step S706 specifically includes: and decoding the target block to be decoded into a block with 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 indicate a target resolution that the target block to be decoded adopts when encoding, and each block to be decoded in the current video frame corresponds to a flag bit used to indicate a resolution that the block to be decoded adopts when encoding;
a second obtaining module 84, configured to obtain the target resolution indicated by the target flag;
and a decoding module 86, configured to decode the target block to be decoded by using the target resolution.
Optionally, the second obtaining module 84 is further configured to
The target resolution represented by the target flag is obtained from a predetermined resolution set.
Optionally, when the texture complexity of the block to be coded, which is represented by the image gradient information, is less than a first preset threshold, the target resolution is a first resolution;
when the texture complexity of the block to be encoded represented by the image gradient information is greater than or equal to the first preset threshold, the target resolution is a second resolution, wherein the first resolution is greater than the second resolution.
Optionally, the decoding module 86 is further configured to
And decoding the target block to be decoded into a block with 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 image gradient information of a block to be coded in a current video frame, where the image gradient information includes a horizontal gradient value of each pixel and/or a vertical gradient value of each pixel in the block to be coded;
a determining module 94, configured to determine a target resolution for encoding the block to be encoded according to the image gradient information;
and an encoding module 96, configured to encode the block to be encoded according to the target resolution.
Optionally, the determining module 94 is further configured to
Determining the target resolution as a first resolution under the condition that the texture complexity of the block to be coded, which is represented by the image gradient information, is less than a first preset threshold;
and determining the target resolution as a second resolution under the condition that the texture complexity of the block to be coded, which is represented by the image gradient information, is greater than or equal to the first preset threshold, wherein the first resolution is greater 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 as shown in fig. 10, the determining module 94 includes:
a first determining sub-module 102 for determining the target resolution based on a weighted sum of the horizontal gradient values and/or the vertical gradient values; or
A second determination submodule 104 for determining the target resolution based on the horizontal gradient value and/or an average of the vertical gradient values.
Optionally, the first determining sub-module 102 includes:
a first determining unit, configured to determine the target resolution as a first resolution when a weighted sum of the horizontal gradient values is smaller than a first preset threshold and determine the target resolution as a second resolution when the weighted sum of the horizontal gradient values is greater than or equal to the first preset threshold, where the first resolution is greater than the second resolution, if the image gradient information includes the horizontal gradient values;
a second determining unit configured to determine the target resolution as the first resolution when a weighted sum of the vertical gradient values is less than a second preset threshold and determine the target resolution as the second resolution when the weighted sum of the vertical gradient values is greater than or equal to the second preset threshold, in a case where the image gradient information includes the vertical gradient value;
a third determining unit, configured to determine the target resolution as the first resolution when a weighted sum of the horizontal gradient value and the vertical gradient value is less than a third preset threshold value and determine the target resolution as the second resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the third preset threshold value, in a case where the image gradient information includes the horizontal gradient value and the vertical gradient value.
Optionally, the first determining unit is further configured to determine the target resolution as a third resolution when the weighted sum of the horizontal gradient values is greater than or equal to the first preset threshold and smaller than a fourth preset threshold; determining the target resolution as a fourth resolution when the weighted sum of the horizontal gradient values is greater than or equal to the fourth preset threshold and less than a fifth preset threshold; determining the target resolution as a fifth resolution under the condition that the weighted sum of the horizontal gradient values is greater than or equal to the fifth preset threshold and less than a sixth preset threshold; determining the target resolution as a sixth resolution in the case that the weighted sum of the horizontal gradient values is greater than or equal to the sixth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
the second determining unit is further configured to determine the target resolution as a third resolution when the weighted sum of the horizontal gradient values is greater than or equal to the second preset threshold and less than a seventh preset threshold; determining the target resolution as a fourth resolution when the weighted sum of the horizontal gradient values is greater than or equal to the seventh preset threshold and less than an eighth preset threshold; determining the target resolution as a fifth resolution under the condition that the weighted sum of the horizontal gradient values is greater than or equal to the eighth preset threshold and is less than a ninth preset threshold; determining the target resolution as a sixth resolution in case that the weighted sum of the horizontal gradient values is greater than or equal to the ninth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
the third determining unit is further configured to determine that the target resolution is a third resolution when a weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to a third preset threshold and is less than a tenth preset threshold; determining the target resolution as a fourth resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the tenth preset threshold and less than the eleventh preset threshold; determining the target resolution as a fifth resolution under the condition that the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the eleventh preset threshold and is less than the twelfth preset threshold; determining the target resolution as a sixth resolution if the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the twelfth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
Optionally, the first preset threshold, the second preset threshold, the third preset threshold, the fourth preset threshold, the fifth preset threshold, the sixth preset threshold, the seventh preset threshold, the eighth preset threshold, the ninth preset threshold, the tenth preset threshold, the eleventh preset threshold, and the twelfth 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 the target resolution as a first resolution when the average value of the horizontal gradient values is less than or equal to a thirteenth preset threshold and determine the target resolution as a second resolution when the average value of the horizontal gradient values is less than or equal to the thirteenth preset threshold, where the first resolution is less than the second resolution, if the image gradient information includes the horizontal gradient values;
a fifth determining unit, configured to determine the target resolution as the first resolution when the average value of the vertical gradient values is less than or equal to a fourteenth preset threshold value and determine the target resolution as the second resolution when the average value of the vertical gradient values is less than or equal to the fourteenth preset threshold value, in a case where the image gradient information includes the vertical gradient values;
a sixth determining unit, configured to determine the target resolution as the first resolution when an average value of the horizontal gradient value and the vertical gradient value is less than a fifteenth preset threshold value and determine the target resolution as the second resolution when the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the fifteenth preset threshold value, if the image gradient information includes the horizontal gradient value and the vertical gradient value.
Optionally, the fourth determining unit is further configured to determine that the target resolution is a third resolution when the average of the horizontal gradient values is greater than or equal to the thirteenth preset threshold and is less than a sixteenth preset threshold; determining the target resolution as a fourth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the sixteenth preset threshold and is less than a seventeenth preset threshold; determining the target resolution as a fifth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the seventeenth preset threshold and less than the eighteenth preset threshold; determining the target resolution as a sixth resolution in the case that the average of the horizontal gradient values is greater than or equal to the sixth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
the fifth determining unit is further configured to determine the target resolution as a third resolution when the average of the horizontal gradient values is greater than or equal to the fourteenth preset threshold and less than a nineteenth preset threshold; determining the target resolution as a fourth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the nineteenth preset threshold and is less than the twentieth preset threshold; determining the target resolution as a fifth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the twentieth preset threshold and is less than the twenty-first preset threshold; determining the target resolution as a sixth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to the twenty-first preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
the sixth determining unit is further configured to determine that the target resolution is a third resolution when an average of the horizontal gradient value and the vertical gradient value is greater than or equal to the fifteenth preset threshold and is less than a twenty-second preset threshold; determining the target resolution as a fourth resolution under the condition that the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the twenty-second preset threshold and less than the twenty-third preset threshold; determining the target resolution as a fifth resolution under the condition that the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the twenty-third preset threshold and less than the twenty-fourth preset threshold; and under the condition that the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the twenty-fourth preset threshold, determining that the target resolution is a sixth resolution, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
Optionally, the thirteenth preset threshold, the fourteenth preset threshold, the fifteenth preset threshold, the sixteenth preset threshold, the seventeenth preset threshold, the eighteenth preset threshold, the nineteenth preset threshold, the twentieth preset threshold, the twenty-first preset threshold, the twenty-second preset threshold, the twenty-third preset threshold, and the twenty-fourth preset threshold are positively correlated with the number of pixels of the block to be encoded.
According to yet another aspect of the embodiments of the present invention, there is further provided an electronic device for implementing the above-mentioned video decoding method, as shown in fig. 11, the electronic device includes a memory 1102 and a processor 1104, the memory 1102 stores therein a computer program, and the processor 1104 is configured to execute the steps in any one of the above-mentioned method embodiments through the computer program.
Optionally, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s11, obtaining a target flag corresponding to a target block to be decoded from a current video frame, where the target flag is used to indicate a target resolution adopted by the target block to be decoded when encoding, the target resolution is a resolution determined according to image gradient information of a block to be coded corresponding to the target block to be decoded, and the image gradient information includes a horizontal gradient value of each pixel and a vertical gradient value of each pixel in the block to be coded;
s12, acquiring the target resolution represented by the target flag bit;
and S13, decoding the target block to be decoded by adopting the target resolution.
Alternatively, it can be understood by those skilled in the art that the structure shown in fig. 11 is only an illustration, and the electronic device may also be a terminal device such as a smart phone (e.g., an android Mobile phone, an iOS Mobile phone, etc.), a tablet computer, a palm computer, a Mobile Internet device (M id), a PAD, and the like. Fig. 11 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 11, or have a different configuration than shown in FIG. 11.
The memory 1102 may be used to store software programs and modules, such as program instructions/modules corresponding to the video decoding method and apparatus in the embodiments of the present invention, and the processor 1104 executes various functional applications and data processing by operating the software programs and modules stored in the memory 1102, that is, implements the video decoding method described above. The memory 1102 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1102 can further include memory located remotely from the processor 1104 and such remote memory can be coupled to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1102 may specifically, but not limited to, be used for information such as an encryption key (including a first encryption key, a second encryption key, etc.) and a decryption key (including a first decryption key, a second decryption key, etc.). As an example, as shown in fig. 11, the memory 1102 may include, but is not limited to, the first obtaining module 82, the second obtaining module 84, and the decoding module 86 in the video decoding apparatus. In addition, the video decoding apparatus may further include, but is not limited to, other module units in the first video decoding apparatus, which is not described in detail in this example.
Optionally, the transmitting device 1106 is used for receiving or transmitting data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1106 includes a Network adapter (NIC) that can be connected to a router via a Network cable to communicate with the internet or a local area Network. In one example, the transmission device 1106 is a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In addition, the electronic device further includes: a display 1108 for displaying the media resources; and a connection bus 1110 for connecting the respective module parts in the above-described electronic apparatus.
According to yet another aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the video coding method, as shown in fig. 12, the electronic device includes a memory 1102 and a processor 1104, the memory 1102 stores therein a computer program, and the processor 1104 is configured to execute the steps in any one of the above method embodiments through the computer program.
Optionally, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s21, acquiring image gradient information of a block to be coded in a current video frame, wherein the image gradient information comprises a horizontal gradient value and/or a vertical gradient value of each pixel in the block to be coded;
s22, determining the target resolution for coding the block to be coded according to the image gradient information;
and S23, encoding the block to be encoded according to the target resolution.
Alternatively, it can be understood by those skilled in the art that the structure shown in fig. 12 is only an illustration, and the electronic device may also be a terminal device such as a smart phone (e.g., an android Mobile phone, an iOS Mobile phone, etc.), a tablet computer, a palm computer, a Mobile Internet device (M id), a PAD, etc. Fig. 12 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 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 method and apparatus in the embodiments of the present invention, and the processor 1104 executes various functional applications and data processing by operating the software programs and modules stored in the memory 1102, so as to implement the video encoding method. The memory 1102 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1102 can further include memory located remotely from the processor 1104 and such remote memory can be coupled to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1102 may be specifically, but not limited to, used for information such as an encryption key (including a first encryption key, a second encryption key, etc.) and a decryption key (including a first decryption key, a second decryption key, etc.). As an example, as shown in fig. 12, the memory 1102 may include, but is not limited to, the third obtaining module 92, the determining module 94, and the encoding module 96 of the video encoding apparatus. In addition, the video encoding apparatus may further include, but is not limited to, other module units in the first video encoding apparatus, which is not described in detail in this example.
Optionally, the transmission device 1106 is used for receiving or transmitting data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1106 includes a Network adapter (NIC) that can be connected to a router via a Network cable to communicate with the internet or a local area Network. In one example, the transmitting device 1106 is a Radio Frequency (RF) module used for communicating with the internet in a wireless manner.
In addition, the electronic device further includes: a display 1108 for displaying the media assets; and a connection bus 1110 for connecting the respective module parts in the above-described electronic apparatus.
According to a further aspect of an embodiment of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the steps in any of the above-mentioned method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s11, obtaining a target flag corresponding to a target block to be decoded from a current video frame, where the target flag is used to indicate a target resolution adopted by the target block to be decoded when encoding, the target resolution is a resolution determined according to image gradient information of a block to be coded corresponding to the target block to be decoded, and the image gradient information includes a horizontal gradient value of each pixel and a vertical gradient value of each pixel in the block to be coded;
s12, obtaining the target resolution represented by the target flag bit;
and S13, decoding the target block to be decoded by adopting the target resolution.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
According to a further aspect of embodiments of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s21, acquiring image gradient information of a block to be coded in a current video frame, wherein the image gradient information comprises a horizontal gradient value and/or a vertical gradient value of each pixel in the block to be coded;
s22, determining the target resolution for coding the block to be coded according to the image gradient information;
and S23, encoding the block to be encoded according to the target resolution.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the various methods in the foregoing embodiments may be implemented by a program instructing hardware related to the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed coupling or direct coupling or communication connection between each other may be an indirect coupling or communication connection through some interfaces, units or modules, and may be electrical or in other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (16)

1. A video decoding method, comprising:
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 a target resolution adopted by the target block to be decoded during encoding, the target resolution is determined according to image gradient information of a block to be coded corresponding to the target block to be decoded, and the image gradient information comprises a horizontal gradient value of each pixel and a vertical gradient value of each pixel in the block to be coded;
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 obtaining the target resolution represented by the target flag comprises:
and acquiring the target resolution represented by the target zone bit from a preset resolution set.
3. The method of claim 1,
under the condition that the texture complexity of the block to be coded, which is represented by the image gradient information, is less than a first preset threshold, the target resolution is a first resolution;
and when the texture complexity of the block to be coded represented by the image gradient information is greater than or equal to the first preset threshold, the target resolution is a second resolution, wherein the first resolution is greater than the second resolution.
4. The method of claim 1, wherein the decoding the target block to be decoded at the target resolution comprises:
and decoding the target block to be decoded into a block with the target resolution.
5. A video encoding method, comprising:
acquiring image gradient information of a block to be coded in a current video frame, wherein the image gradient information comprises a horizontal gradient value of each pixel and/or a vertical gradient value of each pixel in the block to be coded;
determining a target resolution for encoding the block to be encoded according to the image gradient information, including: determining the target resolution as a first resolution under the condition that the texture complexity of the block to be coded, which is represented by the image gradient information, is less than a first preset threshold; determining the target resolution as a second resolution when the texture complexity of the block to be coded represented by the image gradient information is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution;
and coding the block to be coded according to the target resolution.
6. The method of claim 5, wherein the determining a target resolution for encoding the block to be encoded according to the image gradient information comprises:
determining the target resolution from a weighted sum of the horizontal gradient values and/or the vertical gradient values; or alternatively
Determining the target resolution according to the horizontal gradient value and/or the average value of the vertical gradient values.
7. The method of claim 6, wherein said determining the target resolution from a weighted sum of the horizontal gradient values and/or the vertical gradient values comprises:
determining the target resolution as a first resolution when the weighted sum of the horizontal gradient values is less than a first preset threshold and determining the target resolution as a second resolution when the weighted sum of the horizontal gradient values is greater than or equal to the first preset threshold, in the case that the image gradient information includes the horizontal gradient values;
determining the target resolution as the first resolution when the weighted sum of the vertical gradient values is less than a second preset threshold value and determining the target resolution as the second resolution when the weighted sum of the vertical gradient values is greater than or equal to the second preset threshold value, in the case that the image gradient information includes the vertical gradient values;
determining the target resolution as the first resolution when a weighted sum of the horizontal gradient value and the vertical gradient value is less than a third preset threshold and determining the target resolution as the second resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the third preset threshold, in a case where the image gradient information includes the horizontal gradient value and the vertical gradient value;
wherein the first resolution is greater than the second resolution.
8. The method of claim 7,
when the weighted sum of the horizontal gradient values is greater than or equal to the first preset threshold, determining that the target resolution is a second resolution includes: determining the target resolution as a third resolution when the weighted sum of the horizontal gradient values is greater than or equal to the first preset threshold and less than a fourth preset threshold; determining the target resolution as a fourth resolution when the weighted sum of the horizontal gradient values is greater than or equal to a fourth preset threshold and less than a fifth preset threshold; determining the target resolution as a fifth resolution under the condition that the weighted sum of the horizontal gradient values is greater than or equal to a fifth preset threshold and is less than a sixth preset threshold; determining the target resolution as a sixth resolution in case the weighted sum of the horizontal gradient values is greater than or equal to the sixth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
when the weighted sum of the vertical gradient values is greater than or equal to the second preset threshold, determining that the target resolution is the second resolution comprises: determining the target resolution as a third resolution when the weighted sum of the horizontal gradient values is greater than or equal to the second preset threshold and less than a seventh preset threshold; determining the target resolution as a fourth resolution when the weighted sum of the horizontal gradient values is greater than or equal to the seventh preset threshold and less than an eighth preset threshold; determining the target resolution as a fifth resolution under the condition that the weighted sum of the horizontal gradient values is greater than or equal to the eighth preset threshold and is less than a ninth preset threshold; determining the target resolution to be a sixth resolution in case the weighted sum of the horizontal gradient values is greater than or equal to the ninth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the third preset threshold, determining the target resolution as the second resolution includes: determining the target resolution as a third resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the third preset threshold and less than a tenth preset threshold; determining the target resolution as a fourth resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the tenth preset threshold and less than an eleventh preset threshold; determining the target resolution as a fifth resolution when the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to an eleventh preset threshold and less than a twelfth preset threshold; determining that the target resolution is a sixth resolution if the weighted sum of the horizontal gradient value and the vertical gradient value is greater than or equal to the twelfth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
9. The method according to claim 8, wherein the first preset threshold, the second preset threshold, the third preset threshold, the fourth preset threshold, the fifth preset threshold, the sixth preset threshold, the seventh preset threshold, the eighth preset threshold, the ninth preset threshold, the tenth preset threshold, the eleventh preset threshold, and the twelfth preset threshold are positively correlated with the number of pixels of the block to be encoded.
10. The method of claim 6, wherein determining the target resolution from the average of the horizontal gradient values and/or vertical gradient values comprises:
determining the target resolution as a first resolution when the average value of the horizontal gradient values is less than or equal to a thirteenth preset threshold value and determining the target resolution as a second resolution when the average value of the horizontal gradient values is less than or equal to the thirteenth preset threshold value, in the case that the image gradient information includes the horizontal gradient values, wherein the first resolution is less than the second resolution;
determining the target resolution as the first resolution when the average value of the vertical gradient values is less than or equal to a fourteenth preset threshold value and determining the target resolution as the second resolution when the average value of the vertical gradient values is less than or equal to the fourteenth preset threshold value, in a case where the image gradient information includes the vertical gradient values;
determining the target resolution as the first resolution when the image gradient information includes the horizontal gradient value and the vertical gradient value and an average value of the horizontal gradient value and the vertical gradient value is less than a fifteenth preset threshold, and determining the target resolution as the second resolution when the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to the fifteenth preset threshold.
11. The method of claim 10,
when the average value of the horizontal gradient values is greater than or equal to the thirteenth preset threshold, determining that the target resolution is the second resolution includes: determining the target resolution as a third resolution when the average value of the horizontal gradient values is greater than or equal to a thirteenth preset threshold and less than a sixteenth preset threshold; determining the target resolution as a fourth resolution when the average value of the horizontal gradient values is greater than or equal to the sixteenth preset threshold and less than a seventeenth preset threshold; determining the target resolution as a fifth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to a seventeenth preset threshold and less than an eighteenth preset threshold; determining the target resolution to be a sixth resolution in the case that the average of the horizontal gradient values is greater than or equal to a sixth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
when the average value of the vertical gradient values is greater than or equal to the fourteenth preset threshold, determining that the target resolution is the second resolution comprises: determining the target resolution as a third resolution when the average value of the horizontal gradient values is greater than or equal to the fourteenth preset threshold and less than a nineteenth preset threshold; determining the target resolution as a fourth resolution when the average value of the horizontal gradient values is greater than or equal to the nineteenth preset threshold and less than a twentieth preset threshold; determining the target resolution to be a fifth resolution under the condition that the average value of the horizontal gradient values is greater than or equal to a twentieth preset threshold and is less than a twenty-first preset threshold; determining the target resolution to be a sixth resolution in the case that the average of the horizontal gradient values is greater than or equal to the twenty-first preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution;
when the average of the horizontal gradient value and the vertical gradient value is greater than or equal to the fifteenth preset threshold, determining that the target resolution is the second resolution comprises: determining the target resolution as a third resolution when an average value of the horizontal gradient value and the vertical gradient value is greater than or equal to a fifteenth preset threshold and less than a twenty-second preset threshold; determining the target resolution as a fourth resolution when the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to a twenty-second preset threshold and less than a twenty-third preset threshold; determining the target resolution to be a fifth resolution under the condition that the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to a twenty-third preset threshold and smaller than a twenty-fourth preset threshold; determining that the target resolution is a sixth resolution under the condition that the average value of the horizontal gradient value and the vertical gradient value is greater than or equal to a twenty-fourth preset threshold, wherein the first resolution > the third resolution > the fourth resolution > the fifth resolution > the sixth resolution.
12. The method according to claim 11, wherein the thirteenth preset threshold, the fourteenth preset threshold, the fifteenth preset threshold, the sixteenth preset threshold, the seventeenth preset threshold, the eighteenth preset threshold, the nineteenth preset threshold, the twentieth preset threshold, the twenty-first preset threshold, the twenty-second preset threshold, the twenty-third preset threshold, and the twenty-fourth preset threshold are positively correlated with the number of pixels of the block to be coded.
13. A video decoding apparatus, comprising:
a first obtaining module, configured to obtain a target flag bit corresponding to a target block to be decoded from a current video frame, where the target flag bit is used to indicate a target resolution adopted by the target block to be decoded when encoding, the target resolution is a resolution determined according to image gradient information of a block to be coded corresponding to the target block to be decoded, and the image gradient information includes a horizontal gradient value of each pixel and a vertical gradient value of each pixel in the block to be coded;
a second obtaining module, configured to obtain the target resolution indicated by the target flag;
and the decoding module is used for decoding the target block to be decoded by adopting the target resolution.
14. A video encoding apparatus, comprising:
a third obtaining module, configured to obtain image gradient information of a block to be coded in a current video frame, where the image gradient information includes a horizontal gradient value of each pixel and/or a vertical gradient value of each pixel in the block to be coded;
a determining module, configured to determine a target resolution for encoding the block to be encoded according to the image gradient information, including: determining the target resolution as a first resolution under the condition that the texture complexity of the block to be coded, which is represented by the image gradient information, is less than a first preset threshold; determining the target resolution as a second resolution when the texture complexity of the block to be coded represented by the image gradient information is greater than or equal to the first preset threshold, wherein the first resolution is greater than the second resolution;
and the coding module is used for coding the block to be coded according to the target resolution.
15. A computer-readable storage medium comprising a stored program, wherein the program when executed performs the method of any of claims 1 to 4 or 5 to 12.
16. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 4 or 5 to 12 by means of the computer program.
CN201910927973.2A 2019-09-27 2019-09-27 Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus Active CN110677691B (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN110677691A CN110677691A (en) 2020-01-10
CN110677691B true CN110677691B (en) 2022-09-13

Family

ID=69079648

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN110677691B (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2908007A1 (en) * 2006-10-31 2008-05-02 Thomson Licensing Sas Image sequence i.e. video, encoding method for video compression field, involves pre-selecting intra-encoding modes of macro-block with directions that correspond to gradient activities with minimal value to determine encoding mode
CN101635843B (en) * 2008-07-23 2011-05-11 北京大学 Method and system for extracting, seeking and comparing visual patterns based on frame-to-frame variation characteristics
CN104219522B (en) * 2013-06-04 2018-02-16 北京大学 Bit rate control method and device in a kind of encoding video pictures

Also Published As

Publication number Publication date
CN110677691A (en) 2020-01-10

Similar Documents

Publication Publication Date Title
WO2019015389A1 (en) Method and device for chroma prediction
CN110636312B (en) Video encoding and decoding method and device and storage medium
CN108600783B (en) Frame rate adjusting method and device and terminal equipment
CN108063946B (en) Image encoding method and apparatus, storage medium, and electronic apparatus
CN110636294A (en) Video decoding method and device, and video encoding method and device
CN108810610B (en) Screen sharing method and device
CN110545433B (en) Video encoding and decoding method and device and storage medium
US20190141332A1 (en) Use of synthetic frames in video coding
CN110519607B (en) Video decoding method and device, and video encoding method and device
CN110572673B (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
CN110677676B (en) Video encoding method and apparatus, video decoding method and apparatus, and storage medium
CN110677653B (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
CN110677691B (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
CN110636293A (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
CN110582022B (en) Video encoding and decoding method and device and storage medium
CN115829836A (en) Image processing method and device, electronic equipment and model training method
CN110677690B (en) Video processing method and device and storage medium
CN110536134B (en) Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
CN110677721B (en) Video encoding and decoding method and device and storage medium
CN114222127A (en) Video coding method, video decoding method and device
CN110572654B (en) Video encoding and decoding methods and devices, storage medium and electronic device
CN114157868A (en) Video frame coding mode screening method and device and electronic equipment

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: 40018332

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