CN112165618B - Video coding method, device, equipment and computer readable storage medium - Google Patents

Video coding method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN112165618B
CN112165618B CN202011036182.XA CN202011036182A CN112165618B CN 112165618 B CN112165618 B CN 112165618B CN 202011036182 A CN202011036182 A CN 202011036182A CN 112165618 B CN112165618 B CN 112165618B
Authority
CN
China
Prior art keywords
level
group
picture group
coding
pictures
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
CN202011036182.XA
Other languages
Chinese (zh)
Other versions
CN112165618A (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.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology 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 Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202011036182.XA priority Critical patent/CN112165618B/en
Publication of CN112165618A publication Critical patent/CN112165618A/en
Application granted granted Critical
Publication of CN112165618B publication Critical patent/CN112165618B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • H04N19/147Data rate or code amount at the encoder output according to rate distortion criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/177Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a group of pictures [GOP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/30Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using hierarchical techniques, e.g. scalability
    • H04N19/33Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using hierarchical techniques, e.g. scalability in the spatial domain
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction

Abstract

The invention discloses a video coding method, a video coding device, video coding equipment and a computer readable storage medium. The method comprises the following steps: acquiring a first picture group to be coded; acquiring a basic quantization parameter corresponding to a first picture group and acquiring a level coefficient corresponding to each level in the first picture group; determining an additional quantization parameter corresponding to each layer in the first picture group according to the basic quantization parameter corresponding to the first picture group and the layer coefficient corresponding to each layer in the first picture group; and for each layer in the first picture group, performing video coding processing on the video image in the layer according to the base quantization parameter corresponding to the first picture group and the additional quantization parameter corresponding to the layer. The invention enables the additional quantization parameter to be matched with the basic quantization parameter, avoids the situation that the additional quantization parameter and the basic quantization parameter are not in the same order of magnitude, ensures that the picture groups adopting different basic quantization parameters can achieve the same coding quality, and has stable coding quality.

Description

Video coding method, device, equipment and computer readable storage medium
Technical Field
The present invention relates to the field of video processing technologies, and in particular, to a video encoding method, apparatus, device, and computer-readable storage medium.
Background
Before transmitting video data or storing video data, video encoding processing needs to be performed on video images in the video data. The video encoding processing means converting a file in an original video format into a binary file by a video compression technique.
In performing video encoding processing, consecutive multi-frame video images in video data are sequentially divided into a plurality of GOPs (groups of Pictures), and each GOP is sequentially encoded. Each GOP is a group of consecutive video pictures. When encoding GOP, the GOP is layered according to the reference relation between the video images, the video images in each layer are encoded from the lowest layer and layer by layer upwards, and different QPs are adopted for each layer. QP (quantization parameter) is one of encoding parameters used in encoding. The larger the QP value is, the more the encoded video image is distorted, and the lower the code rate of the encoded video data is. The smaller the QP value, the less the distortion of the encoded video image and the higher the bitrate of the encoded video data. In general, a higher layer video picture in a GOP needs to be encoded with reference to a lower layer video picture, while a frame picture of the highest layer needs not to be encoded with reference to other frame pictures. That is, in the GOP, the importance of video images gradually decreases from a low hierarchy level to a high hierarchy level. Based on the characteristics, when the GOP is coded, the QP adopted by the bottom level is usually smaller than the QP adopted by the high level, so that the low-level video image distortion is less, the high-level video image distortion is more, and the condition that the overall image quality of the video data is too low due to the excessive distortion of the bottom-level video image is avoided.
Currently, the QP includes a base QP and an additional QP. The base QP is an adjustable value set according to requirements. The additional QP is a fixed value that corresponds to each level such that the QP is progressively larger from a lower level to a higher level by adjusting the QP size corresponding to the level by the additional QP. In this setting, although it can be ensured that the QP used in the lower layer is smaller than the QP used in the higher layer, there is no connection between the base QP and the additional QP, and no matter whether the value of the base QP is large or small, in the GOPs using different base QPs, the same additional QP is used in the same layer, so that the final encoding effect is not stable enough.
For example: the additional QPs used for layer 0 in different GOPs are all 1 and the additional QP used for layer 1 in different GOPs are all 2. When encoding the first video data, if the base QP is 5, then the QP of the 0 th layer is 6(5+1 ═ 6), the QP of the 1 st layer is 7(5+2 ═ 7), and when encoding the second video data, if the base QP is 49, then the QP of the 0 th layer is 50(49+1 ═ 50), and the QP of the 1 st layer is 51(49+2 ═ 51).
Disclosure of Invention
Embodiments of the present invention mainly aim to provide a video encoding method, apparatus, device and computer readable storage medium, so as to solve the problem in the prior art that there is no connection between a basic QP and an additional QP, so that a final encoding effect is not stable enough.
In view of the above technical problems, the embodiments of the present invention are solved by the following technical solutions:
the embodiment of the invention provides a video coding method, which comprises the following steps: acquiring a first picture group to be coded; acquiring a basic quantization parameter corresponding to the first picture group and acquiring a level coefficient corresponding to each level in the first picture group; determining an additional quantization parameter corresponding to each level in the first picture group according to the base quantization parameter corresponding to the first picture group and the level coefficient corresponding to each level in the first picture group; and for each layer in the first picture group, performing video coding processing on the video images in the layer according to the base quantization parameter corresponding to the first picture group and the additional quantization parameter corresponding to the layer.
Before the obtaining of the level coefficient corresponding to each level in the first picture group, the method further includes: inquiring video coding information corresponding to the second picture group; wherein the second group of pictures is a previously encoded group of pictures of the first group of pictures, and the second group of pictures and the first group of pictures belong to the same video data; determining a coding characteristic coefficient corresponding to the second picture group according to the inquired video coding information corresponding to the second picture group; and determining a level coefficient corresponding to each level in the first picture group according to the coding feature coefficient corresponding to the second picture group and the configuration information corresponding to the first picture group.
Wherein the video coding information corresponding to the second group of pictures includes: a coding mode adopted by each coding unit in each frame of video image belonging to the second group of pictures; wherein the types of the encoding modes include: an intra-frame prediction encoding mode and an inter-frame prediction encoding mode; determining the coding feature coefficient corresponding to the second picture group according to the queried video coding information corresponding to the second picture group, including: determining the ratio of the cumulative area of the first type coding unit to the cumulative area of the second type coding unit according to the video coding information corresponding to the second picture group; the first type of coding unit is a coding unit adopting an inter-frame prediction coding mode; the second type of coding unit is a coding unit adopting an intra-frame prediction coding mode; and determining the coding feature coefficient corresponding to the second picture group according to the ratio of the accumulated area of the first type coding unit to the accumulated area of the second type coding unit.
Wherein the video coding information corresponding to the second group of pictures includes: coding cost corresponding to each coding unit in each frame of video image belonging to the second picture group; the coding cost corresponding to each coding unit is an inter-frame prediction coding cost or an intra-frame prediction coding cost; determining the coding feature coefficient corresponding to the second picture group according to the queried video coding information corresponding to the second picture group, including: determining the ratio of the accumulated cost corresponding to the third type of coding unit to the accumulated cost corresponding to the fourth type of coding unit according to the video coding information corresponding to the second picture group; the third type of coding unit is a coding unit corresponding to intra-frame prediction coding cost; the fourth type of coding unit is a coding unit corresponding to the interframe prediction coding cost; and determining the coding characteristic coefficient corresponding to the second picture group according to the ratio of the accumulated cost corresponding to the third type of coding unit to the accumulated cost corresponding to the fourth type of coding unit.
The configuration information corresponding to the first group of pictures includes: a total number of levels of the first group of pictures, an initial quantization constant and an initial offset corresponding to the first group of pictures; determining a level coefficient corresponding to each level in the first picture group according to the coding feature coefficient corresponding to the second picture group and the configuration information corresponding to the first picture group, including: for each level, determining a level coefficient corresponding to the level according to the coding feature coefficient corresponding to the second picture group, the total number of levels of the first picture group, the initial quantization constant and the initial offset corresponding to the first picture group, and the corresponding level number of the level in the first picture group.
Wherein the determining the level coefficients corresponding to the levels according to the coding feature coefficients corresponding to the second picture group, the total number of levels of the first picture group, the initial quantization constant and the initial offset corresponding to the first picture group, and the number of levels corresponding to the levels in the first picture group comprises: determining a level coefficient corresponding to the level by adopting the following formula:
Figure BDA0002705151220000041
δ new =δ ori ×ratio;
Figure BDA0002705151220000042
wherein, the first and the second end of the pipe are connected with each other,
Figure BDA0002705151220000043
representing a level coefficient corresponding to the level; delta new Representing a quantization constant corresponding to the first group of pictures; level represents the corresponding level number of the level in the first picture group; beta is a new Representing the offset corresponding to the first picture group; delta ori Representing an initial quantization constant corresponding to the first group of pictures; the ratio represents a coding characteristic coefficient corresponding to the second picture group; n represents a total number of levels of the first group of pictures; beta is a ori And indicating the initial offset corresponding to the first picture group.
Wherein, for each level in the first group of pictures, performing video coding processing on the video images in the level according to the base quantization parameter corresponding to the first group of pictures and the additional quantization parameter corresponding to the level comprises: determining a quantization parameter corresponding to the level according to a basic quantization parameter corresponding to the first picture group and an additional quantization parameter corresponding to the level; performing video coding processing on the video images in the hierarchy according to the quantization parameters corresponding to the hierarchy; wherein the difference between the first quantization parameter sum and the second quantization parameter sum is smaller than a preset difference threshold; the first quantization parameter sum is the sum of quantization parameters respectively corresponding to all levels in the first picture group; the second quantization parameter sum is the sum of quantization parameters respectively corresponding to all levels in the second group of pictures.
Wherein, still include: and under the condition that video coding information corresponding to a second picture group is not inquired, determining the coding characteristic coefficient corresponding to the second picture group to be a preset numerical value.
An embodiment of the present invention further provides a video encoding apparatus, including: the first acquisition module is used for acquiring a first picture group to be coded; a second obtaining module, configured to obtain a basic quantization parameter corresponding to the first picture group and obtain a level coefficient corresponding to each level in the first picture group; a parameter determining module, configured to determine an additional quantization parameter corresponding to each level in the first picture group according to a base quantization parameter corresponding to the first picture group and a level coefficient corresponding to each level in the first picture group; and the video coding module is used for executing video coding processing on the video images in the levels according to the basic quantization parameter corresponding to the first picture group and the additional quantization parameter corresponding to the levels for each level in the first picture group.
An embodiment of the present invention further provides a video encoding device, where the video encoding device includes: memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the video encoding method of any of the above.
An embodiment of the present invention further provides a computer-readable storage medium, where a video coding program is stored on the computer-readable storage medium, and when the video coding program is executed by a processor, the video coding program implements the steps of the video coding method according to any one of the above items.
The embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, the additional quantization parameter corresponding to each hierarchy is determined according to the basic quantization parameter corresponding to the first picture group and the hierarchy coefficient corresponding to each hierarchy, so that the additional quantization parameter is matched with the basic quantization parameter, the situation that the additional quantization parameter and the basic quantization parameter are not in the same order of magnitude does not occur, the picture groups adopting different basic quantization parameters can achieve the same coding quality, and the coding quality has stability when the video coding method of the embodiment of the invention is applied.
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 flowchart of a video encoding method according to an embodiment of the present invention;
FIG. 2 is a flowchart of the steps for determining the level coefficients according to one embodiment of the present invention;
fig. 3 is a detailed flowchart of a video encoding method according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a first group of pictures according to an embodiment of the present invention;
fig. 5 is a structural diagram of a video encoding apparatus according to an embodiment of the present invention;
fig. 6 is a block diagram of a video encoding apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings and specific embodiments.
According to an embodiment of the present invention, there is provided a video encoding method. The execution subject of the embodiment of the invention is a video encoder. The embodiment of the invention can be applied to the following coding standards at least: h.264, h.265, and AV 1. Among them, h.264 is also called AVC (Advanced Video Coding). H.265 is also known as HEVC (High Efficiency Video Coding).
Fig. 1 is a flow chart of a video encoding method according to an embodiment of the invention.
In step S110, a first group of pictures to be encoded is obtained.
The first group of pictures is a group of pictures (GOP) divided in the video data.
Step S120, obtaining a basic quantization parameter corresponding to the first picture set and obtaining a level coefficient corresponding to each level in the first picture set.
The base quantization parameter is an encoding parameter used in encoding. The same underlying quantization parameter is used for the same video data. That is, each group of pictures divided from the same video data uses the same basic quantization parameter.
The hierarchical coefficient refers to the ratio of the additional quantization parameter to the base quantization parameter.
In the present embodiment, the level coefficient is a value set in advance for each level, or a value determined from video coding information in the second group of pictures. The second group of pictures is a previously coded group of pictures of said first group of pictures and the second group of pictures and the first group of pictures belong to the same video data.
Further, hierarchical coefficient information may be set for a group of pictures of the same structure. The hierarchical coefficient information includes a hierarchical coefficient corresponding to each hierarchy.
How to determine the level coefficient corresponding to each level in the first picture group according to the video coding information in the second picture group will be described later, and details are not repeated here.
Step S130, determining an additional quantization parameter corresponding to each level in the first picture group according to the basic quantization parameter corresponding to the first picture group and the level coefficient corresponding to each level in the first picture group.
And for each level, taking the product of the basic quantization parameter and the level coefficient corresponding to the level as the additional quantization parameter corresponding to the level. Wherein the additional quantization parameter is a positive integer.
Further, since the additional quantization parameter is a positive integer, in a case where the product of the base quantization parameter and the hierarchical coefficient is not a positive integer, it is necessary to process the product. For example: the product is rounded up and rounded.
Further, the level coefficients corresponding to the lower levels are smaller than the level coefficients corresponding to the higher levels.
Step S140, for each layer in the first group of pictures, performing video coding processing on the video images in the layer according to the base quantization parameter corresponding to the first group of pictures and the additional quantization parameter corresponding to the layer.
For each layer in the first picture group, determining a quantization parameter corresponding to the layer according to a base quantization parameter corresponding to the first picture group and an additional quantization parameter corresponding to the layer; and performing video coding processing on the video images in the hierarchy according to the quantization parameters corresponding to the hierarchy.
Performing a video encoding process on a video image in each level layer by layer upward from a lowest level of the first group of pictures; wherein, when performing video coding processing for each level, the video coding processing is performed using the quantization parameter corresponding to the level. And the quantization parameter corresponding to the lower level is smaller than the quantization parameter corresponding to the higher level.
In this embodiment, in order to ensure uniform coding effect of different groups of pictures in the same video data, it is required to ensure that the difference between the first quantization parameter sum and the second quantization parameter sum is smaller than a preset difference threshold. Wherein, the first quantization parameter sum is the sum of quantization parameters respectively corresponding to all levels in the first picture group; the second quantization parameter sum is the sum of quantization parameters corresponding to all levels in the second group of pictures. The difference threshold is an empirical value or a value obtained through experiments. Further, the first quantization parameter sum may be equal to the second quantization parameter sum.
Further, in order to achieve the effect that the first quantization parameter sum is similar to the second quantization parameter sum, when the level coefficient corresponding to each level is set, it is required to ensure that the difference between the level coefficient sum of all levels in the first picture group and the level coefficient sum of all levels in the second picture group is smaller than a preset threshold. Namely: the sum of the level coefficients of the first group of pictures substantially coincides with the sum of the level coefficients of the second group of pictures.
Further, in order to achieve the effect that the first quantization parameter sum is similar to the second quantization parameter sum, when determining the level coefficients respectively corresponding to each level in the first picture group according to the video coding information corresponding to the second picture group, the value of the level coefficients needs to be adjusted by a formula, so that the difference between the level coefficients of all levels in the first picture group and the level coefficients of all levels in the second picture group is smaller than a preset threshold.
In the embodiment of the present invention, the additional quantization parameter corresponding to each level is determined according to the basic quantization parameter corresponding to the first picture group and the level coefficient corresponding to each level, so that the additional quantization parameter matches with the basic quantization parameter, the basic quantization parameter is larger, the additional quantization parameter is also a larger numerical value, the basic quantization parameter is smaller, the additional quantization parameter is also a smaller numerical value, and the situation that the additional quantization parameter and the basic quantization parameter are not in the same order of magnitude does not occur, thereby ensuring that picture groups (video data) using different basic quantization parameters can achieve the same coding quality, and ensuring that the coding quality has stability when the video coding method of the present embodiment is applied.
The following describes a process of determining a level coefficient corresponding to each level in a first group of pictures according to video coding information of a second group of pictures.
FIG. 2 is a flowchart illustrating the steps of determining the level coefficients according to an embodiment of the present invention.
Step S210, inquiring video coding information corresponding to the second picture group; wherein the second group of pictures is a previously encoded group of pictures of the first group of pictures, and the second group of pictures and the first group of pictures belong to the same video data.
The first group of pictures is the group of pictures currently temporally coded.
The second group of pictures is a picture in which encoding is completed before the first group of pictures and the encoding completion time is closest to the current time.
Video coding information corresponding to the second group of pictures, comprising: a Coding mode adopted by each CU (Coding Unit) in each frame of video images belonging to the second group of pictures; wherein the types of the encoding modes include: an intra-prediction encoding mode and an inter-prediction encoding mode. And/or the video coding information corresponding to the second group of pictures comprises: coding cost corresponding to each coding unit in each frame of video image belonging to the second picture group; and the coding cost corresponding to each coding unit is an inter-frame prediction coding cost or an intra-frame prediction coding cost.
The coding unit is the most basic unit in the coding process.
The intra prediction encoding mode refers to prediction encoding using already encoded pixels within the current frame.
The inter-frame prediction encoding mode refers to performing prediction encoding using pixels of other frames that have already been encoded.
The coding cost, also called rate distortion cost (RDcost), is an index for measuring the code rate and distortion rate.
The inter prediction coding cost refers to a coding cost generated when the optimal coding mode of the coding unit is an inter prediction mode.
The intra-prediction coding cost refers to a coding cost generated when the optimal coding mode of the coding unit is an inter-prediction mode.
Further, the video data may be divided into a plurality of groups of pictures, each group of pictures including a plurality of frames of consecutive video images. Each frame of the video image may be divided into a plurality of coding units. The area of each coding unit can be determined according to requirements. For example: the coding unit is 64 × 64 pixels, and the coding unit is 32 × 32 pixels.
The categories of the video images are divided in a reference manner and include: i frames (intra-frame predictive coded frames), P frames (forward predictive coded frames), B frames (bidirectional predictive coded frames). In an I-frame, all coding units have only intra-prediction coding mode. In the P frame and the B frame, each coding unit may select an intra prediction coding mode or an inter prediction coding mode. And for the P frame and the B frame, when the coding unit is coded, calculating the coding cost of all coding modes for the current coding unit, comparing the coding cost of each coding mode, and selecting the coding mode with the minimum coding cost as the optimal coding mode of the coding unit.
Step S220, determining a coding feature coefficient corresponding to the second picture group according to the queried video coding information corresponding to the second picture group.
And the coding characteristic coefficient is the coding characteristic of the intra-frame prediction coding and the inter-frame prediction coding of all the video images in the second picture group. Further, the encoding characteristic coefficient may reflect a content reference of each frame of the video image in the second group of pictures. The manner how to determine the coding feature coefficients corresponding to the second group of pictures will be described later, and therefore, will not be described herein again.
In the embodiment of the present invention, in a case where video coding information corresponding to a second picture group is not queried, it is determined that a coding feature coefficient corresponding to the second picture group is a preset numerical value. The preset value may be an empirical value or an experimental value. For example: the preset value may be 1. Of course, in the case where video coding information corresponding to the second group of pictures is not found, the calculation of the additional quantization parameter may be performed using the level coefficient set for each level.
Step S230, determining a level coefficient corresponding to each level in the first picture group according to the coding feature coefficient corresponding to the second picture group and the configuration information corresponding to the first picture group.
The configuration information corresponding to the first frame group comprises: a total number of levels of the first group of pictures, an initial quantization constant and an initial offset corresponding to the first group of pictures. Further, the same initial quantization constant and initial offset may be used for the same video data. That is, the initial quantization constants of different groups of pictures in the same video data are the same, and the initial offsets are the same.
For each layer in the first picture group, determining the layer coefficient corresponding to the layer according to the coding feature coefficient corresponding to the second picture group, the total number of layers of the first picture group, the initial quantization constant and the initial offset corresponding to the first picture group and the corresponding layer number of the layer in the first picture group.
Further, according to the coding feature coefficient corresponding to the second picture group and the initial quantization constant corresponding to the first picture group, determining a quantization constant corresponding to the first picture group; determining the offset corresponding to the first picture group according to the coding feature coefficient corresponding to the second picture group, the total number of the layers of the first picture group, the initial quantization constant corresponding to the first picture group and the initial offset; and determining the level coefficient corresponding to the level of the current level coefficient to be determined according to the level number of the level of the current level coefficient to be determined in the first picture group, the quantization constant and the offset corresponding to the first picture group.
Specifically, the level coefficient corresponding to the level is determined by the following formula:
Figure BDA0002705151220000101
δ new =δ ori ×ratio;
Figure BDA0002705151220000102
wherein the content of the first and second substances,
Figure BDA0002705151220000103
representing a level coefficient corresponding to the level; delta new Representing a quantization constant corresponding to the first group of pictures; level represents the number of levels corresponding to the level in the first frame group; beta is a new Representing the offset corresponding to the first picture group; delta ori Representing an initial quantization constant corresponding to the first group of pictures; the ratio represents a coding characteristic coefficient corresponding to the second picture group; n represents a total number of levels of the first group of pictures; beta is a ori Indicating an initial offset corresponding to the first group of pictures.
In this embodiment, β new The form of the equation (b) may ensure that the first quantization parameter sum is equal to the second quantization parameter sum. Further, when the first group of pictures is the first group of pictures in the video data, the coding characteristic coefficient corresponding to the previous group of pictures cannot be determined according to the video coding information of the previous group of pictures, and at this time, the coding characteristic coefficient corresponding to the previous group of pictures can be set to be a preset value. For example: the coding feature coefficient is set to 1. Thus, the offset corresponding to the first group of pictures is an initial offset, and the quantization constant corresponding to the first group of pictures is an initial quantization constant. In this case, the sum of the level coefficients of the respective levels of the first group of pictures is made equal to the sum of the level coefficients of the respective levels of the first group of pictures in the video data, i.e., the sum of the level coefficients of the respective levels of the first group of pictures in the video data
Figure BDA0002705151220000104
Further deducing to obtain beta new The formula (2).
The above formula is substituted into an equation to derive, specifically as follows:
Figure BDA0002705151220000105
nnew ×(level+1)+β new )=∑ nori ×(level+1)+β ori );
nori ×ratio×(level+1)+β new )=∑ nori ×(level+1)+β ori );
δ ori ×ratio×∑ n (level+1)+β new ×n=δ ori ×∑ n (level+1)+β ori ×n;
Figure BDA0002705151220000111
Figure BDA0002705151220000112
in the embodiment of the invention, according to the video coding information of the second picture group, the level coefficient corresponding to each level in the first picture group is adjusted, so that the level coefficient corresponding to each level is a change value, the change of the level coefficient corresponding to each level is adaptive to the actual change situation of the video content, and the coding quality is further optimized.
Two ways of determining the coding feature coefficient corresponding to the second group of pictures are provided below, but those skilled in the art should understand that the following two ways are only used for illustrating the embodiments of the present invention and are not used to limit the embodiments of the present invention.
In a first aspect, video coding information corresponding to a second group of pictures includes: a coding mode adopted by each coding unit in each frame of video image belonging to the second group of pictures; wherein the types of the encoding modes include: an intra-prediction encoding mode and an inter-prediction encoding mode.
When the coding characteristic coefficient corresponding to the second picture group is determined, determining the ratio of the accumulated area of the first type coding unit to the accumulated area of the second type coding unit according to the video coding information corresponding to the second picture group; the first type of coding unit is a coding unit adopting an inter-frame prediction coding mode; the second type of coding unit is a coding unit adopting an intra-frame prediction coding mode; and determining the coding characteristic coefficient corresponding to the second picture group according to the ratio of the accumulated area of the first type coding unit to the accumulated area of the second type coding unit.
In this embodiment, the area of the coding unit is the number of pixels included in the coding unit.
In the present embodiment, when determining the cumulative area, the following steps need to be performed on consecutive video images of multiple frames in the second group of pictures:
in step S1, video coding information of the video images in the second group of pictures is sequentially read.
In step S2, the coding mode used by each coding unit in the current video image is sequentially read in the video coding information.
Step S3, determining whether the coding mode of the current coding unit is an inter-prediction coding mode or an intra-prediction coding mode; when the coding mode is an inter-frame prediction coding mode, accumulating the area of the coding unit into the accumulated area corresponding to the inter-frame prediction coding mode; and when the coding mode is the intra-frame prediction coding mode, accumulating the area of the coding unit into the accumulated area corresponding to the intra-frame prediction coding mode.
Step S4, judging whether the coding modes of the coding units in the current video image are all read; if so, performing step S1 until the video coding information of all the video images in the second group of pictures is read; if not, step S2 is performed.
In a second aspect, the video coding information corresponding to the second group of pictures includes: coding cost corresponding to each coding unit in each frame of video image belonging to the second picture group; and the coding cost corresponding to each coding unit is an inter-frame prediction coding cost or an intra-frame prediction coding cost.
When the coding characteristic coefficient corresponding to the second picture group is determined, determining the ratio of the accumulated cost corresponding to the third type coding unit and the accumulated cost corresponding to the fourth type coding unit according to the video coding information corresponding to the second picture group; the third type of coding unit is a coding unit corresponding to intra-frame prediction coding cost; the fourth type of coding unit is a coding unit corresponding to the interframe prediction coding cost; and determining the coding characteristic coefficient corresponding to the second picture group according to the ratio of the accumulated cost corresponding to the third type of coding unit to the accumulated cost corresponding to the fourth type of coding unit.
In this embodiment, when the coding cost is accumulated, the following steps need to be performed on consecutive multi-frame video images in the second group of pictures:
in step S1, video coding information of the video images in the second group of pictures is sequentially read.
In step S2, in the video coding information, the coding cost corresponding to each coding unit in the current video image is sequentially read.
In step S3, it is determined whether the coding cost corresponding to the current coding unit is an intra-frame prediction coding cost or an inter-frame prediction coding cost. When the coding cost is the intra-frame prediction coding cost, accumulating the intra-frame prediction coding cost into the accumulated cost corresponding to the third type of coding unit; and when the coding cost is the inter-frame prediction coding cost, accumulating the inter-frame prediction coding cost into the accumulated cost corresponding to the fourth type coding unit.
Step S4, judging whether the coding modes of the coding units in the current video image are all read; if so, performing step S1 until the video coding information of all the video images in the second group of pictures is read; if not, step S2 is executed.
A more specific embodiment is provided below to further describe the video encoding method of the present invention. In an embodiment, the coding feature coefficient ratio corresponding to the first group of pictures in the video data is 1. Fig. 3 is a detailed flowchart of a video encoding method according to an embodiment of the invention.
In step S310, a first group of pictures is sequentially acquired in the video data.
The video data may be a real-time video data stream.
Step S320, determining whether the first group of pictures is a first group of pictures in the video data by querying video coding information corresponding to the second group of pictures; if yes, go to step S330; if not, step S340 is performed.
In the embodiment, the video encoder records video coding information of each picture group in a preset coding information table in the process of coding the picture group; if the video coding information corresponding to the second picture group can be inquired in the video coding information table, the first picture group is not the first picture group; if the video coding information corresponding to the second picture group is not searched in the video coding information table, the first picture group is the first picture group.
Step S330, determining a level coefficient corresponding to each level according to an initial quantization constant and an initial offset corresponding to the first picture group and a corresponding level number of each level in the first picture group, and determining a quantization parameter corresponding to each level according to the level coefficient corresponding to each level and a basic quantization parameter corresponding to the first picture group.
Determining a level coefficient corresponding to the current level by the following formula:
δ level =δ ori ×(level+1)+β ori
wherein, delta level Representing a level coefficient corresponding to the current level; delta ori An initial quantization constant corresponding to the first group of pictures; level represents the corresponding level number of the current level in the first picture group; beta is a ori Indicating an initial offset corresponding to the first group of pictures. Since ratio is 1, δ new =δ ori ,β new =β ori
Determining a quantization parameter corresponding to the current level by the following formula:
deltaQP level =round(QP base ×δ level );
QP level =QP base +deltaQP level
wherein, deltaQP level An additional quantization parameter representing a correspondence of the current level; QP base Representing a base quantization parameter; round denotes the pair QP base ×δ level The value of (a) is rounded off.
For example: as shown in fig. 4, the first group of pictures includes three levels (Temporal layers), i.e., a 0 th Layer, a 1 st Layer and a 2 nd Layer, for 0 to 4 frames of video images, and then the coefficients of the three levels respectively correspond to the three levels:
δ 0 =0.03×(0+1)+0=0.03,QP 0 =20+round(20×0.03)=21;
δ 1 =0.03×(1+1)+0=0.06,QP 1 =20+round(20×0.06)=21;
δ 2 =0.03×(2+1)+0=0.09,QP 2 =20+round(20×0.09)=22;
wherein subscript 0 represents level 0, subscript 1 represents level 1, and subscript 2 represents level 2.
Step S340, determining a coding feature coefficient corresponding to a second picture group according to video coding information corresponding to the second picture group.
In this embodiment, the scaling factor is calculated using the statistical information of the intra and inter prediction coding modes in the previous GOP. Specifically, the method comprises the following steps: the coding mode of each CU of all frames in the previous GOP may be determined to be an inter-frame prediction coding mode or an intra-frame prediction coding mode, then, areas of CUs corresponding to the inter-frame prediction coding mode are accumulated, areas of CUs corresponding to the intra-frame prediction coding mode are accumulated, a ratio between the accumulated area corresponding to the intra-frame prediction coding mode and the accumulated area corresponding to the inter-frame prediction coding mode is determined, and a coding feature coefficient corresponding to the previous GOP is determined according to the ratio. Or determining the coding cost of each CU of all frames in the previous GOP, accumulating the inter-frame prediction coding cost and the intra-frame prediction coding cost respectively, and determining the ratio of the accumulated value of the inter-frame prediction coding cost to the accumulated value of the intra-frame prediction coding cost; and determining the coding characteristic coefficient corresponding to the previous GOP according to the ratio of the accumulative value of the inter-frame prediction coding cost to the accumulative value of the intra-frame prediction coding cost.
When determining the coding feature coefficient according to the accumulated area is taken as an example, the coding feature coefficient corresponding to the previous GOP may be determined by the following formula:
Figure BDA0002705151220000141
Figure BDA0002705151220000142
wherein, ratio is equal to [0.5,2 ]];
Wherein R is GOP Indicating a ratio between an accumulated area corresponding to an intra prediction encoding mode and an accumulated area corresponding to an inter prediction encoding mode in a previous GOP (second group of pictures); area inter Represents the previous oneThe cumulative area of CUs of inter-frame prediction coding modes in the GOPs; area intra Represents the cumulative area of a CU of an intra prediction encoding mode in the previous GOP; the ratio represents a coding characteristic coefficient corresponding to a previous GOP; r base Representing a preset first reference scale.
R GOP Are integers. If R is GOP Includes a fractional part, the fractional part is rounded to an integer part to obtain R GOP Determination of value, using R GOP The determined value is subjected to the subsequent calculation.
R base Either empirical or experimental. For example: the first base ratio is 1.4.
The two extremes of the threshold range for ratio may be empirical or experimental. The calculated value of ratio may be greater than the maximum end of the threshold range or less than the minimum end of the threshold range, and when the calculated value of ratio is greater than the maximum end of the threshold range, the value of ratio is determined as the maximum end, and when the calculated value of ratio is less than the minimum end of the threshold range, the value of ratio is determined as the minimum end. When ratio is used subsequently, the determined value of ratio is used.
For example: presetting a reference proportion R base 1.4; the previous GOP includes two CUs 64 × 64 and 32 × 32, where the number of intra prediction coding modes adopted by 64 × 64 CUs is 10, the number of inter prediction coding modes adopted by 32 × 32 CUs is 50, the number of intra prediction coding modes adopted by 32 × 32 CUs is 100, and the number of inter prediction coding modes is 200, and further, the ratio corresponding to the previous GOP can be calculated:
Area intra =64×64×10+32×32×100=143360;
Area inter =64×64×50+32×32×200=409600;
Figure BDA0002705151220000151
Figure BDA0002705151220000152
when the coding feature coefficient is determined according to the coding cost, after a ratio of an accumulated value of inter-frame predictive coding costs to an accumulated value of intra-frame predictive coding costs is determined, the ratio is divided by a preset second reference proportion to obtain the coding feature coefficient.
Step S350, determining a level coefficient corresponding to each level according to the coding feature coefficient corresponding to the second picture group, the total number of levels of the first picture group, the initial quantization constant and the initial offset corresponding to the first picture group, and the number of levels corresponding to each level in the first picture group, and determining a quantization parameter corresponding to each level according to the level coefficient corresponding to each level and the basic quantization parameter corresponding to the first picture group.
For each level, determining a level coefficient corresponding to the level by adopting the following formula:
Figure BDA0002705151220000161
δ new =δ ori ×ratio;
Figure BDA0002705151220000162
wherein the content of the first and second substances,
Figure BDA0002705151220000163
representing a level coefficient corresponding to the level; delta new Representing a quantization constant corresponding to the first group of pictures; level represents the number of levels corresponding to the level in the first frame group; beta is a new Representing the offset corresponding to the first picture group; delta ori Representing an initial quantization constant corresponding to the first group of pictures; the ratio represents a coding characteristic coefficient corresponding to the second picture group; n represents a total number of levels of the first group of pictures; beta is a ori Indicating an initial offset corresponding to the first group of pictures.
Determining a quantization parameter corresponding to the current level by the following formula:
deltaQP level =round(QP base ×δ level );
QP level =QP base +deltaQP level
wherein, deltaQP level An additional quantization parameter representing a correspondence of the current level; QP base Representing a base quantization parameter; round denotes the pair QP base ×δ level The value of (a) is rounded off.
For example: presetting a basic quantization parameter as 20; the initial quantization parameter is 0.03 and the initial offset is 0; ratio of the previous GOP is 2; the current GOP (first group of pictures) includes three levels, and the level coefficients and quantization parameters corresponding to the three levels are:
Figure BDA0002705151220000164
Figure BDA0002705151220000165
Figure BDA0002705151220000166
Figure BDA0002705151220000167
and updating the level coefficient corresponding to each level in the current GOP according to the ratio of the previous GOP, so that the level coefficient used in the current encoding can consider the encoding reference characteristic of the previous GOP.
In step S360, a video encoding process is performed on the video image in each level of the first picture group according to the level coefficient corresponding to each level in the first picture group and a preset basic quantization parameter.
Step S370, judging whether all the picture groups in the video data are acquired; if yes, ending the process; if not, the process goes to step S310 to obtain the next first group of pictures.
In the embodiment of the invention, in the coding hierarchy of the picture groups, the quantization parameter allocation of each layer is combined with the actual coding scene, namely, each GOP is combined with the coding reference condition (coding characteristic coefficient) of the previous GOP, so that the coding efficiency is better.
In the present embodiment, the ratio is proportional to the level coefficient, and the level coefficient is proportional to the additional quantization parameter. For video data with strong coding reference relation (such as still pictures), an inter-frame prediction coding mode tends to be selected, so that the ratio of CUs in the inter-frame prediction coding mode is larger, the ratio of the cumulative value of inter-frame prediction coding costs to the cumulative value of intra-frame prediction coding costs is larger (such as larger than 1), and the ratio is larger, so that the additional quantization parameter gradient between GOP layers can be properly increased through the embodiment of the invention; for video data with weak reference relationship (such as pictures with severe scene change), an intra-frame prediction coding mode is prone to be selected, so that the proportion of CUs in the intra-frame prediction coding mode is large, the cumulative value of inter-frame prediction coding costs is larger than the cumulative value of intra-frame prediction coding costs and smaller (such as less than 1), and the ratio is smaller, so that the additional quantization parameter gradient between GOP layers can be reduced through the embodiment of the invention.
The embodiment of the invention also provides a video coding device. The video encoding apparatus may be provided in a video encoder. Fig. 5 is a block diagram of a video encoding apparatus according to an embodiment of the present invention.
The video encoding device includes: a first obtaining module 510, a second obtaining module 520, a parameter determining module 530 and a video encoding module 540.
A first obtaining module 510 is configured to obtain a first group of pictures to be encoded.
A second obtaining module 520, configured to obtain a basic quantization parameter corresponding to the first group of pictures and obtain a level coefficient corresponding to each level in the first group of pictures.
A parameter determining module 530, configured to determine an additional quantization parameter corresponding to each level in the first picture group according to the base quantization parameter corresponding to the first picture group and the level coefficient corresponding to each level in the first picture group.
A video encoding module 540, configured to perform, for each level in the first group of pictures, a video encoding process on video images in the level according to the base quantization parameter corresponding to the first group of pictures and the additional quantization parameter corresponding to the level.
The functions of the apparatus according to the embodiment of the present invention have been described in the foregoing method embodiments, so that reference may be made to the relevant descriptions in the foregoing embodiments for those parts that are not described in detail in the foregoing description, and further description is not repeated here.
The present embodiment provides a video encoding apparatus. Fig. 6 is a block diagram of a video encoding apparatus according to an embodiment of the present invention.
In this embodiment, the video encoding apparatus includes, but is not limited to: a processor 610, a memory 620.
The processor 610 is configured to execute a video encoding program stored in the memory 620 to implement the video encoding method described above.
Specifically, the processor 610 is configured to execute a video encoding program stored in the memory 620 to implement the following steps: acquiring a first picture group to be coded; acquiring a basic quantization parameter corresponding to the first picture group and acquiring a level coefficient corresponding to each level in the first picture group; determining an additional quantization parameter corresponding to each level in the first picture group according to the base quantization parameter corresponding to the first picture group and the level coefficient corresponding to each level in the first picture group; and for each layer in the first picture group, performing video coding processing on the video images in the layer according to the base quantization parameter corresponding to the first picture group and the additional quantization parameter corresponding to the layer.
Before the obtaining of the level coefficient corresponding to each level in the first picture group, the method further includes: inquiring video coding information corresponding to the second picture group; wherein the second group of pictures is a previously encoded group of pictures of the first group of pictures, and the second group of pictures and the first group of pictures belong to the same video data; determining a coding characteristic coefficient corresponding to the second picture group according to the inquired video coding information corresponding to the second picture group; and determining a level coefficient corresponding to each level in the first picture group according to the coding feature coefficient corresponding to the second picture group and the configuration information corresponding to the first picture group.
Wherein the video coding information corresponding to the second group of pictures includes: a coding mode adopted by each coding unit in each frame of video image belonging to the second group of pictures; wherein the types of the encoding modes include: an intra-frame prediction encoding mode and an inter-frame prediction encoding mode; determining the coding feature coefficient corresponding to the second picture group according to the queried video coding information corresponding to the second picture group, including: determining the ratio of the cumulative area of the first type coding unit to the cumulative area of the second type coding unit according to the video coding information corresponding to the second picture group; the first type of coding unit is a coding unit adopting an inter-frame prediction coding mode; the second type of coding unit is a coding unit adopting an intra-frame prediction coding mode; and determining the coding feature coefficient corresponding to the second picture group according to the ratio of the accumulated area of the first type coding unit to the accumulated area of the second type coding unit.
Wherein the video coding information corresponding to the second group of pictures includes: coding cost corresponding to each coding unit in each frame of video image belonging to the second picture group; the coding cost corresponding to each coding unit is an inter-frame prediction coding cost or an intra-frame prediction coding cost; determining the coding characteristic coefficient corresponding to the second picture group according to the queried video coding information corresponding to the second picture group, including: determining the ratio of the accumulated cost corresponding to the third type of coding unit to the accumulated cost corresponding to the fourth type of coding unit according to the video coding information corresponding to the second picture group; the third type of coding unit is a coding unit corresponding to intra-frame prediction coding cost; the fourth type of coding unit is a coding unit corresponding to the interframe prediction coding cost; and determining the coding characteristic coefficient corresponding to the second picture group according to the ratio of the accumulated cost corresponding to the third type of coding unit to the accumulated cost corresponding to the fourth type of coding unit.
The configuration information corresponding to the first group of pictures includes: a total number of levels of the first group of pictures, an initial quantization constant and an initial offset corresponding to the first group of pictures; determining a level coefficient corresponding to each level in the first picture group according to the coding feature coefficient corresponding to the second picture group and the configuration information corresponding to the first picture group, including: for each layer, determining the layer coefficient corresponding to the layer according to the coding feature coefficient corresponding to the second picture group, the total number of layers of the first picture group, the initial quantization constant and the initial offset corresponding to the first picture group and the corresponding layer number of the layer in the first picture group.
Wherein the determining the level coefficients corresponding to the levels according to the coding feature coefficients corresponding to the second picture group, the total number of levels of the first picture group, the initial quantization constant and the initial offset corresponding to the first picture group, and the number of levels corresponding to the levels in the first picture group comprises: determining a level coefficient corresponding to the level by adopting the following formula:
Figure BDA0002705151220000191
δ new =δ ori ×ratio;
Figure BDA0002705151220000192
wherein the content of the first and second substances,
Figure BDA0002705151220000201
representing level coefficients corresponding to the levels; delta new Representing a quantization constant corresponding to the first group of pictures; level represents theA corresponding number of levels in the first group of pictures; beta is a new Representing the offset corresponding to the first picture group; delta ori Representing an initial quantization constant corresponding to the first group of pictures; the ratio represents a coding characteristic coefficient corresponding to the second picture group; n represents a total number of levels of the first group of pictures; beta is a ori And indicating the initial offset corresponding to the first picture group.
Wherein, for each level in the first group of pictures, performing video coding processing on the video images in the level according to the base quantization parameter corresponding to the first group of pictures and the additional quantization parameter corresponding to the level comprises: determining a quantization parameter corresponding to the level according to a basic quantization parameter corresponding to the first picture group and an additional quantization parameter corresponding to the level; performing video coding processing on the video images in the hierarchy according to the quantization parameters corresponding to the hierarchy; wherein the difference between the first quantization parameter sum and the second quantization parameter sum is smaller than a preset difference threshold; the first quantization parameter sum is the sum of quantization parameters respectively corresponding to all levels in the first picture group; the second quantization parameter sum is the sum of quantization parameters respectively corresponding to all levels in the second group of pictures.
Wherein, still include: and under the condition that video coding information corresponding to a second picture group is not inquired, determining the coding characteristic coefficient corresponding to the second picture group to be a preset numerical value.
The embodiment of the invention also provides a computer readable storage medium. The computer-readable storage medium herein stores one or more programs. Among other things, computer-readable storage media may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the computer readable storage medium are executable by one or more processors to implement the video encoding method described above. Since the video encoding method has been described in detail above, it is not described herein in detail.
The above description is only an example of the present invention, and is not intended to limit the present invention, and it is obvious to those skilled in the art that various modifications and variations can be made in the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (10)

1. A video encoding method, comprising:
acquiring a first picture group to be coded;
acquiring a basic quantization parameter corresponding to the first picture group and acquiring a level coefficient corresponding to each level in the first picture group;
determining an additional quantization parameter corresponding to each level in the first picture group according to the base quantization parameter corresponding to the first picture group and the level coefficient corresponding to each level in the first picture group;
for each level in the first group of pictures, performing video coding processing on video images in the level according to a base quantization parameter corresponding to the first group of pictures and an additional quantization parameter corresponding to the level;
before the obtaining of the level coefficient corresponding to each level in the first picture group, the method further includes:
inquiring video coding information corresponding to the second picture group; wherein the second group of pictures is a previously encoded group of pictures of the first group of pictures, and the second group of pictures and the first group of pictures belong to the same video data;
determining a coding characteristic coefficient corresponding to the second picture group according to the inquired video coding information corresponding to the second picture group;
and determining a level coefficient corresponding to each level in the first picture group according to the coding feature coefficient corresponding to the second picture group and the configuration information corresponding to the first picture group.
2. The method of claim 1,
the video coding information corresponding to the second group of pictures includes: a coding mode adopted by each coding unit in each frame of video image belonging to the second group of pictures; wherein the types of the encoding modes include: an intra-frame prediction encoding mode and an inter-frame prediction encoding mode;
determining the coding feature coefficient corresponding to the second picture group according to the queried video coding information corresponding to the second picture group, including:
determining the ratio of the cumulative area of the first type coding unit to the cumulative area of the second type coding unit according to the video coding information corresponding to the second picture group; the first type of coding unit is a coding unit adopting an inter-frame prediction coding mode; the second type of coding unit is a coding unit adopting an intra-frame prediction coding mode;
and determining the coding feature coefficient corresponding to the second picture group according to the ratio of the accumulated area of the first type coding unit to the accumulated area of the second type coding unit.
3. The method of claim 1,
the video coding information corresponding to the second group of pictures includes: coding cost corresponding to each coding unit in each frame of video image belonging to the second picture group; the coding cost corresponding to each coding unit is an inter-frame prediction coding cost or an intra-frame prediction coding cost;
determining the coding feature coefficient corresponding to the second picture group according to the queried video coding information corresponding to the second picture group, including:
determining the ratio of the accumulated cost corresponding to the third type of coding unit to the accumulated cost corresponding to the fourth type of coding unit according to the video coding information corresponding to the second picture group; the third type of coding unit is a coding unit corresponding to intra-frame prediction coding cost; the fourth type of coding unit is a coding unit corresponding to the interframe prediction coding cost;
and determining the coding characteristic coefficient corresponding to the second picture group according to the ratio of the accumulated cost corresponding to the third type of coding unit to the accumulated cost corresponding to the fourth type of coding unit.
4. The method of claim 1,
the configuration information corresponding to the first picture group comprises: a total number of levels of the first group of pictures, an initial quantization constant and an initial offset corresponding to the first group of pictures;
determining a level coefficient corresponding to each level in the first picture group according to the coding feature coefficient corresponding to the second picture group and the configuration information corresponding to the first picture group, including:
for each level, determining a level coefficient corresponding to the level according to the coding feature coefficient corresponding to the second picture group, the total number of levels of the first picture group, the initial quantization constant and the initial offset corresponding to the first picture group, and the corresponding level number of the level in the first picture group.
5. The method of claim 4, wherein the determining the level coefficients corresponding to the levels according to the coded feature coefficients corresponding to the second group of pictures, the total number of levels of the first group of pictures, the initial quantization constant and the initial offset corresponding to the first group of pictures, and the corresponding number of levels of the levels in the first group of pictures comprises:
determining a level coefficient corresponding to the level by adopting the following formula:
Figure FDA0003594915980000031
δ new =δ ori ×ratio;
Figure FDA0003594915980000032
wherein the content of the first and second substances,
Figure FDA0003594915980000033
representing a level coefficient corresponding to the level; delta new Representing a quantization constant corresponding to the first group of pictures; level represents the corresponding level number of the level in the first picture group; beta is a new Representing the offset corresponding to the first picture group; delta ori Representing an initial quantization constant corresponding to the first group of pictures; the ratio represents a coding characteristic coefficient corresponding to the second picture group; n represents a total number of levels of the first group of pictures; beta is a ori And indicating the initial offset corresponding to the first picture group.
6. The method according to claim 5, wherein said performing, for each level in the first group of pictures, a video coding process on the video images in the level according to the base quantization parameter corresponding to the first group of pictures and the additional quantization parameter corresponding to the level comprises:
determining a quantization parameter corresponding to the level according to a basic quantization parameter corresponding to the first picture group and an additional quantization parameter corresponding to the level;
performing video coding processing on the video images in the hierarchy according to the quantization parameters corresponding to the hierarchy; wherein the content of the first and second substances,
the difference between the first quantization parameter sum and the second quantization parameter sum is smaller than a preset difference threshold; the first quantization parameter sum is the sum of quantization parameters respectively corresponding to all levels in the first picture group; the second quantization parameter sum is the sum of quantization parameters respectively corresponding to all levels in the second group of pictures.
7. The method of any one of claims 1-6, further comprising:
and under the condition that video coding information corresponding to a second picture group is not inquired, determining the coding characteristic coefficient corresponding to the second picture group to be a preset numerical value.
8. A video encoding apparatus, comprising:
the first acquisition module is used for acquiring a first picture group to be coded;
a second obtaining module, configured to obtain a basic quantization parameter corresponding to the first picture group and obtain a level coefficient corresponding to each level in the first picture group;
a parameter determining module, configured to determine an additional quantization parameter corresponding to each level in the first picture group according to a base quantization parameter corresponding to the first picture group and a level coefficient corresponding to each level in the first picture group; before the obtaining of the level coefficient corresponding to each level in the first picture group, the method further includes: inquiring video coding information corresponding to the second picture group; wherein the second group of pictures is a previously encoded group of pictures of the first group of pictures, and the second group of pictures and the first group of pictures belong to the same video data; determining a coding characteristic coefficient corresponding to the second picture group according to the inquired video coding information corresponding to the second picture group; determining a level coefficient corresponding to each level in the first picture group according to the coding feature coefficient corresponding to the second picture group and the configuration information corresponding to the first picture group;
and the video coding module is used for executing video coding processing on the video images in the levels according to the base quantization parameter corresponding to the first picture group and the additional quantization parameter corresponding to the levels for each level in the first picture group.
9. A video encoding device, characterized in that the video encoding device comprises: memory, processor and computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the video encoding method according to any one of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a video encoding program which, when executed by a processor, implements the steps of the video encoding method according to any one of claims 1 to 7.
CN202011036182.XA 2020-09-27 2020-09-27 Video coding method, device, equipment and computer readable storage medium Active CN112165618B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011036182.XA CN112165618B (en) 2020-09-27 2020-09-27 Video coding method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011036182.XA CN112165618B (en) 2020-09-27 2020-09-27 Video coding method, device, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112165618A CN112165618A (en) 2021-01-01
CN112165618B true CN112165618B (en) 2022-08-16

Family

ID=73860932

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011036182.XA Active CN112165618B (en) 2020-09-27 2020-09-27 Video coding method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112165618B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104954793A (en) * 2015-06-18 2015-09-30 电子科技大学 GOP-level QP-Offset setting method
US20180176567A1 (en) * 2015-06-03 2018-06-21 Nec Corporation Moving image coding device, moving image coding method and recording medium for storing moving image coding program
CN109618156A (en) * 2018-11-13 2019-04-12 建湖云飞数据科技有限公司 A kind of video frequency coding rate method of adjustment
CN109819253A (en) * 2017-11-21 2019-05-28 腾讯科技(深圳)有限公司 Method for video coding, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180176567A1 (en) * 2015-06-03 2018-06-21 Nec Corporation Moving image coding device, moving image coding method and recording medium for storing moving image coding program
CN104954793A (en) * 2015-06-18 2015-09-30 电子科技大学 GOP-level QP-Offset setting method
CN109819253A (en) * 2017-11-21 2019-05-28 腾讯科技(深圳)有限公司 Method for video coding, device, computer equipment and storage medium
CN109618156A (en) * 2018-11-13 2019-04-12 建湖云飞数据科技有限公司 A kind of video frequency coding rate method of adjustment

Also Published As

Publication number Publication date
CN112165618A (en) 2021-01-01

Similar Documents

Publication Publication Date Title
US9369720B2 (en) Image coding apparatus and image coding method
CN109862359B (en) Code rate control method and device based on layered B frame and electronic equipment
KR101277363B1 (en) Method and apparatus for determining in picture signal encoding the bit allocation for groups of pixel blocks in a picture
TW416218B (en) Method and apparatus for performing adaptive encoding rate control of a video information stream including 3:2 pull-down video information
TWI702827B (en) Video coding method/apparatus and corresponding non-transitory computer-readable medium
JP2006519565A (en) Video encoding
JPH118855A (en) Digital video signal encoding device and its method
JP5133290B2 (en) Video encoding apparatus and decoding apparatus
JP5770476B2 (en) Method and apparatus for accurate rate control in video coding
JP3960451B2 (en) Scene characteristic detection type moving picture coding apparatus
JP2007525921A (en) Video encoding method and apparatus
CN108200431B (en) Bit allocation method for video coding code rate control frame layer
EP3545677A1 (en) Methods and apparatuses for encoding and decoding video based on perceptual metric classification
JP4221655B2 (en) Encoding apparatus, encoding method, program, and recording medium
CN112188208A (en) Macro block level code rate control method and related device
TWI247546B (en) A video encoding method which carries out the encoding of P frame or B frame by utilizing I frame
CN108989818B (en) Image coding parameter adjusting method and device
US9736485B2 (en) Encoding apparatus, encoding method, and image capture apparatus
CN112165618B (en) Video coding method, device, equipment and computer readable storage medium
CN101151905A (en) Method for locally adjusting a quantization step
JP4958825B2 (en) Moving picture coding apparatus, control method therefor, and computer program
JP4401341B2 (en) Encoding method
JPH07203430A (en) Image coding device
JP4362793B2 (en) Video encoding apparatus and method
CN112866696A (en) 4K, 8K and 16K ultra-high-definition video coding optimization control method and device

Legal Events

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