CN109379594B - Video coding compression method, device, equipment and medium - Google Patents

Video coding compression method, device, equipment and medium Download PDF

Info

Publication number
CN109379594B
CN109379594B CN201811284900.8A CN201811284900A CN109379594B CN 109379594 B CN109379594 B CN 109379594B CN 201811284900 A CN201811284900 A CN 201811284900A CN 109379594 B CN109379594 B CN 109379594B
Authority
CN
China
Prior art keywords
coding unit
frame image
target coding
current frame
image
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
CN201811284900.8A
Other languages
Chinese (zh)
Other versions
CN109379594A (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 Jiaxun Feihong Electrical Co Ltd
Original Assignee
Beijing Jiaxun Feihong Electrical 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 Jiaxun Feihong Electrical Co Ltd filed Critical Beijing Jiaxun Feihong Electrical Co Ltd
Priority to CN201811284900.8A priority Critical patent/CN109379594B/en
Publication of CN109379594A publication Critical patent/CN109379594A/en
Application granted granted Critical
Publication of CN109379594B publication Critical patent/CN109379594B/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/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • 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/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

Landscapes

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

Abstract

The invention discloses a video coding compression method, a device, equipment and a medium. The method comprises the following steps: determining a binary differential image of the current frame image relative to the previous frame image according to the current frame image and the previous frame image of the current frame image; determining whether the current frame image has an interested area according to the binary difference image; the interested region is a region where the current frame image is different from the previous frame image; if the current frame image is determined to have the region of interest, determining all target coding units of the current frame image, and determining the inter-frame prediction mode of each target coding unit according to the position relation between the target coding unit and the region of interest aiming at each target coding unit; and determining the coded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image. The method provided by the invention reduces the calculation complexity and the coding time.

Description

Video coding compression method, device, equipment and medium
Technical Field
The embodiment of the invention relates to the technical field of data compression, in particular to a video coding compression method, a device, equipment and a medium.
Background
Video Coding Experts Group (VCEG) of the International Telecommunication union Telecommunication standards branch (ITU-T for ITU Coding Standardization Sector) and the Moving Picture Experts Group (MPEG) of the International Organization for Standardization (ISO) form a Video Coding collaboration Group (JCT-VC), and a new generation of High performance Video Coding standard (HEVC) is established. As a recent video coding standard, it has a more flexible coding structure than the video coding standard that has been mainstream before. HEVC divides an image frame into Coding tree units, which can be decomposed into several Square Coding Units (CUs) according to a quadtree structure, where a Coding depth is a depth of a Coding Unit recursion in the quadtree structure, a Coding size is a size of an image block of the Coding Unit, each CU at each Coding depth has a corresponding Prediction mode (PU, Prediction Unit), the PU is a basic Unit for performing intra Prediction, and the PU can be divided into a SKIP mode (SKIP/merge), a Square partition (Square partition) mode, a Symmetric partition (SMP) mode, an Asymmetric partition (AMP) mode, and an intra Prediction (intra mode) mode according to a division form.
At present, an HEVC encoder calls functions of inter prediction modes such as SKIP/merge, Square, SMP, AMP, and intra modes from top to bottom for each CU with different depths until the coding depth reaches 3, calculates Rate Distortion Cost (RD-Cost) for each inter prediction mode one by one, and finally finds a prediction unit with the minimum Rate Distortion Cost as the best PU prediction mode of the current CU. However, the above-mentioned process of traversal calculation of HEVC coding makes the calculation complexity for calculating PU very high, and video compression requires a large amount of coding time.
Disclosure of Invention
The invention provides a video coding compression method, a device, equipment and a medium, which are used for realizing high-efficiency video coding compression.
In a first aspect, an embodiment of the present invention provides a video coding compression method, where the method includes:
determining a binary differential image of the current frame image relative to a previous frame image according to the current frame image and the previous frame image of the current frame image;
determining whether the current frame image has an interested region according to the binary difference image; the region of interest is a region where the current frame image is different from the previous frame image;
if the current frame image is determined to have the region of interest, determining all target coding units of the current frame image, and determining an inter-frame prediction mode of each target coding unit according to the position relation between the target coding unit and the region of interest aiming at each target coding unit;
and determining the coded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image.
In a second aspect, an embodiment of the present invention further provides a video coding compression apparatus, where the apparatus includes:
a binary differential image determining module, configured to determine a binary differential image of a current frame image relative to a previous frame image according to the current frame image and the previous frame image of the current frame image;
the interested region determining module is used for determining whether the current frame image has an interested region according to the binary difference image; the region of interest is a region where the current frame image is different from the previous frame image;
a first inter-frame prediction mode determining module, configured to determine all target coding units of the current frame image if it is determined that the region of interest exists in the current frame image, and determine, for each target coding unit, an inter-frame prediction mode of each target coding unit according to a positional relationship between the target coding unit and the region of interest;
and the encoding module is used for determining encoded data corresponding to the current frame image according to the inter-frame prediction mode of each target encoding unit, the quantization parameter corresponding to each target encoding unit and the current frame image.
In a third aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a video encoding compression method as in any one of the embodiments of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the video coding compression method described in any one of the embodiments.
Determining a binary differential image of a current frame image relative to a previous frame image according to the current frame image and the previous frame image of the current frame image; determining whether the current frame image has an interested area according to the binary differential image; the interested region is a region where the current frame image is different from the previous frame image; if the current frame image is determined to have the region of interest, determining all target coding units of the current frame image, and determining the inter-frame prediction mode of each target coding unit according to the position relation between the target coding unit and the region of interest for each target coding unit; and determining the coded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image. The problem of high time complexity caused by the fact that all inter-frame prediction modes are recursively performed by each coding unit in the traditional video compression coding process is solved, and the coding time of a compressed video is reduced.
Drawings
Fig. 1 is a flowchart of a video encoding and compressing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of inter prediction modes;
FIG. 3 is a flowchart of a video encoding and compressing method according to a second embodiment of the present invention;
fig. 4 is a flowchart of a video coding compression method according to a third embodiment of the present invention;
FIG. 5 is a schematic diagram of a video encoding and compressing apparatus according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of an apparatus according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some structures related to the present invention are shown in the drawings, not all of them.
Example one
Fig. 1 is a flowchart of a video coding compression method according to an embodiment of the present invention, where the video coding compression method provided in this embodiment is an improved method for the HEVC standard. The present embodiment is applicable to the case of video coding compression, and the method may be executed by a video coding compression apparatus, and specifically includes the following steps:
step 101, determining a binary difference image of a current frame image relative to a previous frame image according to the current frame image and the previous frame image of the current frame image.
The current frame image may be an image frame of a video to be encoded and compressed, and the previous frame image of the current frame image may be a key frame according to prediction; the pixel value can be a specific value of three components of red, green and blue three primary colors of a pixel point corresponding to a pixel point of the current frame image, and can also be brightness information of the pixel point, and can be a gray value, the pixel value is in a range of 0-255, 0 represents the darkest brightness, and 255 represents the brightest brightness. The binary differential image may be generated by comparing pixel values of corresponding positions of the two images, and if the two images are the same, setting the gray value of the pixel point at the corresponding position to 0, and if the two images are different, setting the gray value of the corresponding pixel point to 255 to form the image.
Specifically, pixel values of positions in a current frame image and a previous frame image of the current frame image are respectively obtained, the pixel values of pixel points with the same position in the two frame images are sequentially compared, if the pixel values of corresponding positions are the same, the gray value of the pixel point at the corresponding position in the binary differential image is set to be 0, if the pixel values of corresponding positions are different, the gray value of the pixel point at the corresponding position in the binary differential image is set to be 255, and after comparison of all the pixel points in the two frame images is finished, the binary differential image composed of the pixel points with the gray value of 255 or 0 is obtained.
In a preferred embodiment, a current frame image and a current frame previous frame image are obtained, respectively, a current frame image pixel value f (x, y, i) and a current frame previous frame pixel value f (x, y, i-1), then a binary differential image pixel value DF (x, y, i, i-1), where x and y may be horizontal and vertical coordinates in coordinate positions of a current frame image and a previous frame image, respectively, i represents a frame number of the current frame image in the video, a pixel value DF (x, y, i, i-1) of the binary differential image is f (x, y, i) -f (x, y, i-1), and if the calculated DF value is greater than a set threshold, setting the gray value corresponding to the DF value as 255, if the calculated DF value is less than or equal to a set threshold value, the gradation value corresponding to the DF value is set to 0, wherein the set threshold is preferably 15 (change to "15"); and when the gray value of each pixel point in the binary differential image is set, obtaining a binary differential image of the current frame image and the previous frame image of the current frame.
Step 102, determining whether the current frame image has an interested area according to the binary difference image; the region of interest is a region where the current frame image is different from the previous frame image.
The region of interest may be a region where human eyes have strong perceptibility to an image, and includes a motion region, a texture complex region, a human face and the like. The two-value difference image can show the changed areas in the two images, and the two-value difference image can help to obtain the interested area.
In specific implementation, whether pixel points with the gray value not being 0 exist in the binary differential image is judged according to the generated binary differential image, if pixel points with the gray value not being 0 exist in the binary differential image, it is indicated that a region different from a previous frame image of a current frame exists in the current frame image, and the different region is an interested region of the current frame image. In other words, when a pixel point with a gray value of 255 exists in the binary differential image, it is determined that the current frame image has the region of interest.
Step 103, if it is determined that the region of interest exists in the current frame image, determining all target coding units of the current frame image, and determining an inter-frame prediction mode of each target coding unit according to the position relationship between the target coding unit and the region of interest for each target coding unit.
The target coding unit may be a square image block divided according to a preset coding depth and a coding size in the current frame image. The relation of the object coding unit to the region of interest may comprise being located not of interest, being located at an edge of the region of interest, being located inside the region of interest, etc. The inter prediction mode may be in the form of a target coding unit partition.
Fig. 2 is a schematic diagram of an inter prediction mode. Exemplarily, the size of the divided CU in fig. 2 is 2N × 2N. Wherein N is the number of pixel points. As shown in FIG. 2, Square, SMP, AMP have their corresponding partitioning schemes.
As shown in fig. 2, Square may be a pattern of Square partitions of a CU, which is partitioned to form PUs. In the Square mode, the PU formed by dividing the CU may be one image block PART _2N × 2N with a size of 2N × 2N, or four image blocks PART _ N × N with sizes of N × N.
As shown in fig. 2, SMP may be a mode of symmetrically dividing CU. The PU formed after the division may be two image blocks PART _2N × N with a size of 2N × N, or two image blocks PART _ N × 2N with a size of N × 2N.
As shown in fig. 2, the AMP may be a pattern that asymmetrically divides the CU. The divided PUs may be image blocks with sizes of 2N × N/2 and 2N × 3N/2, respectively. Depending on the division direction, the PU may be in the form shown by the image block PART _ nL × 2N, the image block PART _ nR × 2N, the image block PART _2N × nU, or the image block PART _2N × nD in fig. 2.
In addition, SKIP/merge and intra modes are not shown in FIG. 2, and SKIP/merge does not inter-predict a CU; intra modes are the division of a CU into smaller coded-size CUs, and inter prediction is performed again.
Specifically, in this embodiment, a current frame image is divided according to the current HEVC standard to form coding units of different sizes and different coding depths. Wherein the coding depth may be 0, 1, 2 and 3, and the coding size may be 64 × 64, 32 × 32, 16 × 16 and 8 × 8. More specifically, the current frame image is divided into a plurality of coding units with the size of 64 × 64; dividing coding units with the coding size of 64 x 64 into 4 coding units with the size of 32 x 32; dividing coding units with the coding size of 32 x 32 into 4 coding units with the size of 16 x 16; for a coding unit with a coding size of 16 × 16, it is divided into 4 coding units with a size of 8 × 8. All coding units with the size of 64 x 64 have the corresponding coding depth of 0; all coding units with the size of 32 x 32 have the corresponding coding depth of 1; all coding units with the size of 16 × 16 have the corresponding coding depth of 2; all coding units with size 8 × 8 have a corresponding coding depth of 3. The size 64 × 64 indicates that 64 pixels are included in the coding unit in both the horizontal direction and the vertical direction.
If a region formed by pixel points with the gray value of 0 exists in the binary differential image corresponding to the current frame image, in one implementation manner, all coding units with the sizes of 16 × 16 and 8 × 8 in the coding unit of the current frame image are determined as a target coding unit of the current frame image. And determining the position relation of each coding unit and a region formed by pixel points with pixel values not being 0 in the binary differential image aiming at each target coding unit, and judging the inter-frame prediction mode corresponding to the target coding unit according to the position relation. Specifically, how to determine the inter-frame prediction mode of each target coding unit according to the position relationship between the target coding unit and the region of interest will be described in detail in the third embodiment.
And step 104, determining the coded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image.
The quantization parameter may be a parameter reflecting image quality, and the smaller the quantization parameter is, the clearer the image quality of the target coding unit corresponding to the quantization parameter is.
Specifically, the current frame image may be encoded according to the prediction mode of each coding unit in the target coding frame, the set quantization parameter, and the current frame image, where the quantization parameter may be a preset value, and in a preferred embodiment, the quantization parameter is set to 28; the encoding operation may include generating a data frame using the target encoding unit and the inter-frame prediction mode corresponding thereto, subtracting the data frame from a reference frame to obtain a residual matrix, where the reference frame may be a video image frame selected empirically or a video image frame selected according to a threshold time, and performing Discrete Cosine Transform (DCT) on the residual matrix to obtain a Transform coefficient matrix; and quantizing the calculated transformation coefficient matrix by using the quantization parameter to generate a quantization matrix, and finally entropy coding the quantization matrix to finally obtain the compressed coding data of the video.
According to the technical scheme of the embodiment, a binary differential image of a current frame image relative to a previous frame image is determined according to the current frame image and the previous frame image of the current frame image; determining whether the current frame image has an interested area according to the binary differential image; the interested region is a region where the current frame image is different from the previous frame image; if the current frame image is determined to have the region of interest, determining all target coding units of the current frame image, and determining the inter-frame prediction mode of each target coding unit according to the position relation between the target coding unit and the region of interest for each target coding unit; the method and the device have the advantages that the coded data corresponding to the current frame image are determined according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image, the inter-frame prediction mode of the target coding unit is determined according to the position relation between the target coding unit and the interested region when the inter-frame prediction mode of the target coding unit is determined, and compared with the current mode of determining the inter-frame prediction mode of the coding unit in an enumeration mode, the calculation complexity is reduced. The problem that in the traditional video coding compression process, all the inter-frame prediction modes are required to be performed recursively for each coding unit is solved, the computational complexity of video coding compression is reduced, and the coding time of compressed video is shortened.
Example two
Fig. 3 is a flowchart of a video coding compression method according to a second embodiment of the present invention. This embodiment is an alternative to the above-described embodiment, and referring to fig. 3, the video coding compression method provided by the embodiment of the present invention includes:
step 201, when the pixel values of a first pixel point of the current frame image and a pixel point at a corresponding position of the previous frame image are the same, determining that the gray value of the first pixel point in the binary differential image is 0; and when the pixel values of the second pixel point of the current frame image and the pixel point at the corresponding position of the previous frame image are different, determining that the gray value of the second pixel point in the binary differential image is 255.
The pixel point may be the smallest color unit in the current frame image. Specifically, pixel values of pixel points of a current frame image and a previous frame image are obtained, and if the pixel values of the pixel points at corresponding positions in the two frame images are the same, a gray value of a first pixel point corresponding to the positions of the two frame images in the binary differential image is set to be 0; and if the pixel values of the pixel points at the corresponding positions in the two frames of images are different, setting the gray value of a second pixel point corresponding to the positions of the two frames of images in the binary differential image as 255. The pixel point with the coordinate value of (2, 8) in the current frame image corresponds to the pixel point at the corresponding position in the previous frame image, and the pixel point with the coordinate value of (2, 8) in the previous frame image is referred to.
Step 202, when a pixel point with a gray value of 255 exists in the binary differential image, determining that the current frame image has the region of interest; the region of interest is a region where the current frame image is different from the previous frame image.
Step 203, if it is determined that the current frame image has the region of interest, determining all coding units with the sizes of 16 × 16 and 8 × 8 in the coding units of the current frame image as target coding units of the current frame image.
The size may be the number of pixels contained in the target coding unit in the horizontal and vertical directions.
Specifically, if a region with a gray value of 255 exists in the binary differential image corresponding to the current frame image, an interested region exists in the current frame image, and the interested region may be a region formed by pixels with a gray value of 255 in the binary differential image. Segmenting a region of interest in the current frame image by using coding sizes 16 × 16 and 8 × 8; and the non-interested region is segmented by using the coding sizes 64 x 64 and 32 x 32, and finally all corresponding target coding units of the current frame image are determined.
And 204, aiming at each target coding unit, determining the inter-frame prediction mode of each target coding unit according to the position relation between the target coding unit and the region of interest.
Step 205, determining the encoded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit, and the current frame image.
According to the technical scheme of the embodiment of the invention, the gray value of a first pixel point in a binary differential image is determined to be 0 when the pixel value of the first pixel point of a current frame image is the same as the pixel value of the pixel point at the corresponding position of a previous frame image; when the pixel values of a second pixel point of the current frame image and a pixel point at a corresponding position of the previous frame image are different, determining the gray value of the second pixel point in the binary differential image to be 255; when a pixel point with the gray value of 255 exists in the binary differential image, determining that the current frame image has an interested area; the interested region is a region where the current frame image is different from the previous frame image; if the current frame image is determined to have the region of interest, determining all coding units with the sizes of 16 × 16 and 8 × 8 in the coding units of the current frame image as target coding units of the current frame image; aiming at each target coding unit, determining an inter-frame prediction mode of each target coding unit according to the position relation between the target coding unit and the interested region; and determining the coded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image. The pixel values of the binary difference image are changed into 0 and 255, so that the region of interest of the image is more obvious, the data processing is convenient, and in the current frame image, only the coding unit with smaller size is used as the target coding unit, thereby further reducing the computational complexity of coding compression and improving the video coding quality.
On the basis of the above embodiment, before determining, for each target coding unit, the inter prediction mode of each target coding unit according to the positional relationship between the target coding unit and the region of interest, the video coding compression method further includes:
and when the ratio of the number of the pixels with the gray value of 255 to the total number of the pixels of the binary differential image in the binary differential image is greater than a preset threshold, determining that the motion mode of the current frame image is that the background and the foreground both move.
The foreground may be a person, an animal, an object, or the like serving as a subject in the current frame image, the background may be a scene used for supporting the subject, and the motion mode may be a motion mode of the background and the foreground in the image, and may include a motion mode in which the foreground and the background are both moving, a motion mode in which the foreground and the background are both stationary, a motion mode in which the foreground and the background are both moving, a motion mode in which the background are both stationary, and the like.
Specifically, the ratio of the pixel point with the gray value of 255 in the binary differential image corresponding to the current frame image to all the pixel points in the binary differential image may be obtained, then the ratio is compared with a preset threshold, and if the ratio is greater than the preset threshold, the motion mode of the current frame image is determined to be that both the background and the foreground are in a motion state. The preset threshold is preferably 30%.
And when the ratio of the number of the pixels with the gray value of 255 to the total number of the pixels of the binary differential image in the binary differential image is less than or equal to the preset threshold, determining that the motion mode of the current frame image is background static and foreground motion.
Specifically, the ratio of the number of pixels with a gray value of 255 in the binary differential image corresponding to the current frame image to the total pixels in the binary differential image may be obtained, then the ratio is compared with a preset threshold, and if the ratio is less than or equal to the preset threshold, the motion mode of the current frame image is determined as that the background is in a static state and the foreground is in a motion state. The preset threshold is preferably 30%.
Correspondingly, the determining the inter-frame prediction mode of each target coding unit according to the position relationship between the target coding unit and the region of interest includes:
and determining the inter-frame prediction mode of each target coding unit and the adjusted quantization parameter corresponding to each target coding unit according to the motion mode of the current frame image and the position relation between the target coding unit and the interested region.
The position relationship between the target coding unit and the region of interest may include an internal position in the region of interest, an edge position in the region of interest, a region of no interest, and the like; inter prediction modes may include SKIP/merge, Square, SMP, AMP, and intra modes, among others.
Specifically, the inter-frame prediction mode of the target coding unit and the manner of adjusting the quantization parameter may be determined according to the motion mode of the foreground and the background in the current frame image and the position relationship between the target coding unit and the region of interest, for example, if the target coding unit is located in the internal position of the region of interest and the motion mode is foreground motion and background is static, the inter-frame prediction mode of the target coding unit may be Square and SMP, and is reduced by 3 on the basis of the quantization parameter, so that the image corresponding to the target coding unit is clearer.
EXAMPLE III
Fig. 4 is a flowchart of a video coding compression method according to a third embodiment of the present invention. This embodiment is another alternative on the basis of the above embodiment, and referring to fig. 4, the video coding compression method provided by the embodiment of the present invention includes:
step 301, when the pixel values of the first pixel point of the current frame image and the pixel point of the corresponding position of the previous frame image are the same, determining that the gray value of the first pixel point in the binary differential image is 0; and when the pixel values of the second pixel point of the current frame image and the pixel point at the corresponding position of the previous frame image are different, determining the gray value of the second pixel point in the binary differential image to be 255.
Step 302, when a pixel point with a gray value of 255 exists in the binary differential image, determining that the current frame image has the region of interest; the region of interest is a region where the current frame image is different from the previous frame image.
Step 303, if it is determined that the region of interest exists in the current frame image, determining all coding units with sizes of 16 × 16 and 8 × 8 in the coding units of the current frame image as target coding units of the current frame image, and determining an inter-frame prediction mode of each target coding unit according to a positional relationship between the target coding units and the region of interest for each target coding unit.
Step 304, if it is determined that the region of interest does not exist in the current frame image, determining all coding units with the sizes of 64 × 64 and 32 × 32 in the coding units of the current frame image as target coding units of the current frame image; determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a sixth candidate inter-frame prediction mode (changed to a 'prediction mode') set, wherein the adjusted quantization parameter corresponding to the target coding unit is the quantization parameter corresponding to the target coding unit plus two; wherein the sixth set of candidate inter prediction modes comprises: SKIP/merge and Square.
Specifically, if there is no region with a grayscale value of 255 in the binary differential image corresponding to the current frame image, there is no region of interest in the current frame image. Dividing the current frame image by using the coding sizes 64 × 64 and 32 × 32 to generate target coding units of the coding sizes 64 × 64 and 32 × 32, and finally obtaining all target coding units of the current frame image; and enabling the corresponding target coding unit to calculate the rate distortion cost by using the SKIP/merge and Square in the candidate inter-frame prediction mode set, selecting the candidate inter-frame prediction mode with the minimum rate distortion cost calculation result as the inter-frame prediction mode, and meanwhile, adding 2 on the basis of the initial quantization parameter of the target coding unit as the quantization parameter adjusted by the target coding unit to enable the code rate of the corresponding target coding unit to be smaller, wherein the set formed by the SKIP/merge and the Square can be a sixth candidate inter-frame prediction mode set.
In an alternative embodiment, before determining the inter prediction mode of each target coding unit in step 304, the motion mode of the current frame image may also be determined. Then, in step 304, determining the inter-frame prediction mode of each target coding unit according to the position relationship between the target coding unit and the region of interest may specifically be: and determining the inter-frame prediction mode of each target coding unit and the adjusted quantization parameter corresponding to each target coding unit according to the motion mode of the current frame image and the position relation between the target coding unit and the interested region. In this implementation, the determining the inter-frame prediction mode of each target coding unit and the adjusted quantization parameter corresponding to each target coding unit according to the motion mode of the current frame image and the position relationship between the target coding unit and the region of interest in step 304 specifically includes the following steps:
step 3041, if the motion mode of the current frame image is that the background and the foreground both move, then:
when the target coding unit comprises a pixel point with the same gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in the first candidate inter-frame prediction mode set, and subtracting one from the quantization parameter corresponding to the target coding unit by the adjusted quantization parameter corresponding to the target coding unit; wherein the first set of candidate inter prediction modes comprises: SMP, AMP and intra modes;
when the target coding unit does not include a pixel point with the same gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a second candidate inter-frame prediction mode set, and adding one to the quantization parameter corresponding to the target coding unit after adjustment; wherein the second set of candidate inter prediction modes comprises: SKIP/merge, Square, and SMP.
The candidate inter prediction mode set may be a set of all inter prediction mode combinations corresponding to the target coding unit, and may include any combination of inter prediction modes such as SKIP/merge, Square, SMP, AMP, and intra modes, for example, SKIP/merge, Square set, SKIP/merge, SMP set, intra modes set, SKIP/merge, Square, SMP set, SKIP/merge, SMP, AMP set, and SKIP/merge, Square, AMP set, intra modes set, and the like.
Specifically, if it is determined that both the foreground and the background are in motion, there are the following two scenes.
In the first scenario, the positions of all the pixels in each target coding unit are obtained, and if there are pixels in a certain target coding unit that have the same positions as the pixels in the region of interest (i.e., the region formed by the pixels with the gray value of 255) in the binary differential image corresponding to the current frame image, for the target coding unit, rate distortion costs are respectively calculated for the target coding unit by using a symmetric partition mode SMP, an asymmetric partition mode AMP, and an intra-frame prediction mode, where the calculation formula may be J ═ dfd (motion) + kMotionRMV(Motion), where DFD (Motion) represents the Motion-compensated prediction error in different Motion modes, RMV(Motion) represents the number of coded bits of inter prediction mode related information, which may include a Motion vector, a picture index, a reference queue index, and the like of the inter prediction mode, kMotionIs a Lagrange factor; and selecting a candidate interframe prediction mode with the minimum rate distortion cost calculation result as the interframe prediction mode of the target coding unit, and subtracting one from the quantization parameter of the corresponding target coding unit on the basis of the initial quantization parameter of the target coding unit to be used as the adjusted quantization parameter of the target coding unit.
And in the second scenario, positions of all pixel points in each target coding unit are obtained, if pixel points with the same positions as pixel points of an interest region in a binary differential image corresponding to a current frame image do not exist in one target coding unit, rate distortion cost is calculated by using SKIP/merge, Square and SMP in a candidate interframe prediction mode set aiming at the target coding unit, the candidate interframe prediction mode with the minimum rate distortion cost calculation result is selected as an interframe prediction mode, and the quantization parameter of the corresponding target coding unit is added by one on the basis of the initial quantization parameter of the corresponding target coding unit and is used as the adjusted quantization parameter of the target coding unit.
The quantization parameter before all target coding units are adjusted, i.e. the initial quantization parameter, may be empirically set to a certain value, and the preferred value is 28.
Step 3042, if the motion mode of the current frame image is background still and foreground motion:
when the target coding unit comprises pixel points with the same gray value as 255 in the binary differential image and the coding units around the target coding unit do not comprise pixel points with the same gray value as 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a third candidate inter-frame prediction mode set, and subtracting one from the quantization parameter corresponding to the target coding unit after the adjustment; wherein the third set of candidate inter prediction modes comprises: AMP and intra modes;
when the target coding unit comprises pixel points with the same positions as the pixel points with the gray value of 255 in the binary differential image and the coding units around the target coding unit also comprise pixel points with the same positions as the pixel points with the gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a fourth candidate inter-frame prediction mode set, and subtracting three from the quantization parameter corresponding to the target coding unit by the adjusted quantization parameter corresponding to the target coding unit; wherein the fourth set of candidate inter prediction modes comprises: square and SMP;
when the target coding unit does not include a pixel point with the same gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a fifth candidate inter-frame prediction mode set, and adding two to the quantization parameter corresponding to the target coding unit after adjustment; wherein the fifth set of candidate inter prediction modes comprises: SKIP mode SKIP/merge and Square split mode Square.
In a specific implementation, if it is determined that the foreground is in a moving state and the background is in a static state, there are the following three scenarios.
The first scenario is: acquiring the positions of all pixel points in each target coding unit, if pixel points with the same positions as the pixel points in the interest region in the binary differential image corresponding to the current frame image exist in one target coding unit, and the pixel points with the same positions as the pixel points in the interest region in the binary differential image do not exist in the coding units around the target coding unit, calculating the rate distortion cost by using an asymmetric division mode AMP and an intra-frame prediction mode for the target coding unit, wherein the set of the AMP and the intra-frame prediction mode is a third candidate inter-frame prediction mode set, selecting the candidate inter-frame prediction mode with the minimum rate distortion cost calculation result as an inter-frame prediction mode, and subtracting one from the quantization parameter of the corresponding target coding unit on the basis of the initial quantization parameter of the target coding unit to be used as the adjusted quantization parameter of the target coding unit, wherein, the coding units around the target coding unit can be coding units to the left, upper right, lower right and lower left of the target coding unit;
the second scenario is as follows: the method comprises the steps of obtaining the positions of all pixel points in each target coding unit, if pixel points with the gray value of 255 exist in a binary differential image region of a corresponding position of a certain target coding unit and coding units around the target coding unit, calculating rate distortion cost by the target coding unit by using a Square and an SMP interframe prediction mode respectively, selecting the interframe prediction mode with the minimum rate distortion cost value as the interframe prediction mode, and subtracting three from the initial quantization parameter of the corresponding target coding unit to serve as the adjusted quantization parameter of the target coding unit. The set of Square and SMP may be a fourth candidate inter prediction mode set, wherein the coding units around the target coding unit may be coding units to the left, top right, bottom below and left of the target coding unit;
the third scenario is: the method comprises the steps of obtaining the positions of all pixel points in each target coding unit, if no pixel point with the gray value of 255 exists in a binary differential image corresponding to the positions of all the pixel points of one target coding unit, calculating rate distortion cost by using SKIP/merge and Square, selecting an inter-frame prediction mode with the minimum rate distortion cost as an inter-frame prediction mode, and adding two to a basic value of a quantization parameter corresponding to the target coding unit, wherein the basic value of the target coding unit can be preferably 28 according to experience. The set of SKIP/merge and Square may be a fifth set of candidate inter prediction modes.
It should be noted that, in this embodiment, the positions of all the pixel points in the target encoding unit refer to the positions of all the pixel points of the target encoding unit in the current frame image. The initial quantization parameter of the target coding unit and the base value of the quantization parameter both refer to the quantization parameter of the target coding unit determined according to the current HEVC standard.
And 305, determining the coded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image.
According to the technical scheme of the embodiment of the invention, the gray value of the first pixel point in the binary differential image is determined to be 0 when the pixel value of the first pixel point of the current frame image is the same as the pixel value of the pixel point at the corresponding position of the previous frame image; when the pixel values of the second pixel point of the current frame image and the pixel point at the corresponding position of the previous frame image are different, determining the gray value of the second pixel point in the binary differential image to be 255; when a pixel point with the gray value of 255 exists in the binary differential image, determining that the current frame image has the region of interest; the interested region is a region where the current frame image is different from the previous frame image; if the current frame image is determined to have the region of interest, determining all coding units with the sizes of 16 × 16 and 8 × 8 in the coding units of the current frame image as target coding units of the current frame image; aiming at each target coding unit, determining an inter-frame prediction mode of each target coding unit according to the position relation between the target coding unit and the interested region; if the current frame image is determined to have no region of interest, determining all coding units with the sizes of 64 × 64 and 32 × 32 as target coding units of the current frame image; determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in the sixth candidate inter-frame prediction mode set, wherein the adjusted quantization parameter corresponding to the target coding unit is the quantization parameter corresponding to the target coding unit plus two; wherein the sixth set of candidate inter prediction modes comprises: skipping a SKIP/merge mode and a Square partitioning mode Square; determining coded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image; the target coding units with different coding sizes are adopted for judging whether the image has the interested region or not, the coding units with the larger sizes of 64 x 64 and 32 x 32 are used for the image without the interested region, the coding speed is improved, the coding units with the smaller sizes of 16 x 16 and 8 x 8 are used for the image with the interested region, and meanwhile, the definition of the current frame image is ensured by adjusting the quantization parameters of the target coding units, so that the video coding efficiency is improved, the image definition is ensured, and the experience degree of a user watching the video is enhanced.
In order to further improve the image quality of the region of interest image, the method further comprises:
the value range of the adjusted quantization parameter corresponding to the target coding unit is as follows:
Figure BDA0001848815180000171
QP ═ max {0, min { QP,51} }, where QP denotes an adjusted quantization parameter corresponding to the target coding unit,
Figure BDA0001848815180000172
representing 4 frames around the target coding unitAn average value of the adjusted quantization parameter corresponding to the encoded coding unit.
Wherein the surrounding 4 coded units may be coded units that are coded to the left, above and above right of the target coded unit.
Specifically, the quantization parameters adjusted after each target coding unit determines the inter prediction mode are different, which may cause a difference between the quantization parameters of a certain coding unit and the surrounding coding units to be too large, resulting in a blocking effect and reducing the user's experience of watching video, therefore, the quantization parameter of the target coding unit may be compared with the average value of the quantization parameters of the surrounding four coding units, if the difference is greater than or less than the average value of the quantization parameters of the surrounding coding units, the quantization parameter of the target coding unit may be adjusted, the difference between the quantization parameter of the target coding unit and the surrounding coding units is reduced, if the quantization parameter is too small, the quantization parameter is increased, and if the quantization parameter is too large, the quantization parameter is reduced, wherein the increment of the increased or reduced quantization parameter is preferably 2, and finally the range of the quantization parameter adjusted by the target coding unit needs to satisfy 0-51.
Example four
Fig. 5 is a schematic diagram of a video encoding and compressing apparatus according to a fourth embodiment of the present invention, which is capable of executing a video encoding and compressing method according to any embodiment of the present invention, and has corresponding functional modules and beneficial effects. Referring to fig. 5, an embodiment of the present invention provides a video encoding and compressing apparatus, including: a binary differential image determining module 401, a region of interest determining module 402, a first inter prediction mode determining module 403, and an encoding module 404.
The binary differential image determining module 401 is configured to determine, according to a current frame image and a previous frame image of the current frame image, a binary differential image of the current frame image relative to the previous frame image.
A region-of-interest determining module 402, configured to determine whether a region of interest exists in the current frame image according to the binary difference image; the region of interest is a region where the current frame image is different from the previous frame image.
A first inter-frame prediction mode determining module 403, configured to determine all target coding units of the current frame image if it is determined that the region of interest exists in the current frame image, and determine, for each target coding unit, an inter-frame prediction mode of each target coding unit according to a positional relationship between the target coding unit and the region of interest.
The encoding module 404 is configured to determine encoded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit, and the current frame image.
According to the technical scheme of the embodiment of the invention, a binary differential image determining module is arranged and used for determining a binary differential image of a current frame image relative to a previous frame image according to the current frame image and the previous frame image of the current frame image, and an interested region determining module is used for determining whether the current frame image has an interested region according to the binary differential image; the image coding device comprises a current frame image, a first inter-frame prediction mode determining module, a coding module and a second inter-frame prediction mode determining module, wherein the region of interest is a region where the current frame image is different from a previous frame image, the first inter-frame prediction mode determining module is used for determining all target coding units of the current frame image if the current frame image is determined to have the region of interest, and for each target coding unit, the inter-frame prediction mode of each target coding unit is determined according to the position relation between the target coding unit and the region of interest, and the coding module is used for determining coded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, quantization parameters corresponding to each target coding unit and the current frame image. The problem that in the traditional video coding compression process, all the inter-frame prediction modes are required to be performed recursively for each coding unit is solved, the computational complexity of video coding compression is reduced, and the coding time of compressed video is shortened.
Further, the first inter prediction mode determination module includes: the target coding unit determines a sub-module.
And the target coding unit determining submodule is used for determining all coding units with the sizes of 16 × 16 and 8 × 8 in the coding unit of the current frame image as the target coding unit of the current frame image if the current frame image is determined to have the region of interest.
Further, in an implementation manner, the binary difference image determining module further includes a gray value setting sub-module. The gray value setting submodule is used for determining that the gray value of a first pixel point in the binary differential image is 0 when the pixel value of the first pixel point of the current frame image is the same as the pixel value of the pixel point at the corresponding position of the previous frame image; and when the pixel values of the second pixel point of the current frame image and the pixel point at the corresponding position of the previous frame image are different, determining the gray value of the second pixel point in the binary differential image to be 255.
Based on this implementation, the region-of-interest determining module 402 is specifically configured to determine that the region of interest exists in the current frame image when a pixel point with a gray value of 255 exists in the binary difference image.
In this implementation, the video coding and compression apparatus provided in the foregoing embodiment further includes a motion mode determining module. In particular, the motion pattern determination module is to: when the ratio of the number of the pixels with the gray value of 255 to the total number of the pixels of the binary differential image in the binary differential image is greater than a preset threshold, determining that the motion mode of the current frame image is that the background and the foreground both move; and when the ratio of the number of the pixels with the gray value of 255 to the total number of the pixels of the binary differential image in the binary differential image is less than or equal to the preset threshold, determining that the motion mode of the current frame image is background static and foreground motion.
Based on this implementation, the first inter-prediction mode determining module 403 specifically includes an inter-prediction mode determining sub-module in terms of determining the inter-prediction mode of each target coding unit according to the position relationship between the target coding unit and the region of interest.
Optionally, the inter-frame prediction mode determining sub-module is specifically configured to determine, according to the motion mode of the current frame image and the positional relationship between the target coding unit and the region of interest, the inter-frame prediction mode of each target coding unit and the adjusted quantization parameter corresponding to each target coding unit.
Specifically, the inter prediction mode determination sub-module specifically includes: a foreground moving background moving sub-module and a foreground moving background static sub-module.
A foreground moving background moving sub-module, configured to, if the moving mode of the current frame image is that both the background and the foreground are moving:
when the target coding unit comprises a pixel point with the same gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in the first candidate inter-frame prediction mode set, and subtracting one from the quantization parameter corresponding to the target coding unit by the adjusted quantization parameter corresponding to the target coding unit; wherein the first set of candidate inter prediction modes comprises: SMP, AMP and intra modes;
when the target coding unit does not include a pixel point with the same gray value as 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a second candidate inter-frame prediction mode set, and adding one to the quantization parameter corresponding to the target coding unit by using the adjusted quantization parameter corresponding to the target coding unit; wherein the second set of candidate inter prediction modes comprises: SKIP/merge, Square, and SMP.
A foreground moving background static submodule, configured to, if the motion mode of the current frame image is background static and foreground moving:
when the target coding unit comprises pixel points with the same gray value as 255 in the binary differential image and the coding units around the target coding unit do not comprise pixel points with the same gray value as 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a third candidate inter-frame prediction mode set, and subtracting one from the quantization parameter corresponding to the target coding unit after the adjustment; wherein the third set of candidate inter prediction modes comprises: AMP and intra modes;
when the target coding unit comprises pixel points with the same positions as the pixel points with the gray value of 255 in the binary differential image and the coding units around the target coding unit also comprise pixel points with the same positions as the pixel points with the gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a fourth candidate inter-frame prediction mode set, and subtracting three from the quantization parameter corresponding to the target coding unit by the adjusted quantization parameter corresponding to the target coding unit; wherein the fourth set of candidate inter prediction modes comprises: square and SMP;
when the target coding unit does not include a pixel point with the same gray value as 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a fifth candidate inter-frame prediction mode set, and adding two to the quantization parameter corresponding to the target coding unit according to the adjusted quantization parameter corresponding to the target coding unit; wherein the fifth set of candidate inter prediction modes comprises: SKIP/merge and Square.
Further, in this implementation manner, the video encoding and compressing apparatus provided in the foregoing embodiment further includes: a second inter prediction mode determination module.
The second inter prediction mode determination module is specifically configured to: if the current frame image is determined not to have the region of interest, determining all coding units with the sizes of 64 × 64 and 32 × 32 in the coding units of the current frame image as target coding units of the current frame image; and determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a sixth candidate inter-frame prediction mode set, wherein the adjusted quantization parameter corresponding to the target coding unit is the quantization parameter corresponding to the target coding unit plus two. Wherein the sixth set of candidate inter prediction modes comprises: SKIP/merge mode and Square mode.
Further, in this implementation manner, the value range of the adjusted quantization parameter corresponding to the target coding unit is:
Figure BDA0001848815180000211
QP ═ max {0, min { QP,51} }, wherein QP represents the adjusted quantization parameter corresponding to the target coding unit,
Figure BDA0001848815180000212
and the average value of the adjusted quantization parameters corresponding to 4 coded coding units around the target coding unit is represented.
EXAMPLE five
Fig. 6 is a schematic structural diagram of an apparatus according to a fifth embodiment of the present invention, as shown in fig. 6, the apparatus includes a processor 70, a storage device 71, an input device 72, and an output device 73; the number of processors 70 in the device may be one or more, and one processor 70 is taken as an example in fig. 6; the processor 70, the storage means 71, the input means 72 and the output means 73 of the device may be connected by a bus or other means, as exemplified by the bus connection in fig. 6.
The storage device 71, which is a computer-readable storage medium, may be used to store software programs, computer-executable programs, and modules, such as program modules corresponding to the video encoding compression method in the embodiment of the present invention (for example, a binary differential image determination module 401, a region-of-interest determination module 402, a first inter-frame prediction mode determination module 403, and an encoding module 404 in the video encoding compression device). The processor 70 executes various functional applications of the device and data processing by running software modules stored in the storage device 71, that is, implements the video encoding and compressing method described above.
The storage device 71 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the storage 71 may include high speed random access storage and may also include non-volatile storage, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the storage 71 may further include storage remotely located from the processor 70, which may be connected to the device over 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 input device 72 may be used to receive entered numeric or character information and to generate key signal inputs relating to user settings and function controls of the apparatus. The output device 73 may include a display device such as a display screen.
EXAMPLE six
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for video coding compression, the method including:
determining a binary differential image of the current frame image relative to a previous frame image according to the current frame image and the previous frame image of the current frame image;
determining whether the current frame image has an interested region according to the binary difference image; the region of interest is a region where the current frame image is different from the previous frame image;
if the region of interest exists in the current frame image, determining all target coding units of the current frame image, and determining an inter-frame prediction mode of each target coding unit according to the position relation between the target coding unit and the region of interest for each target coding unit;
and determining the coded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the operations of the method described above, and may also perform related operations in the video compression method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the video compression method, the included units and modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be implemented; in addition, the specific names of the functional modules are only for convenience of distinguishing from each other and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (7)

1. A method of video coding compression, comprising:
determining a binary differential image of the current frame image relative to a previous frame image according to the current frame image and the previous frame image of the current frame image;
determining whether the current frame image has an interested region according to the binary difference image; the region of interest is a region where the current frame image is different from the previous frame image;
if the current frame image is determined to have the region of interest, determining all target coding units of the current frame image, and determining an inter-frame prediction mode of each target coding unit according to the position relation between the target coding unit and the region of interest aiming at each target coding unit;
determining encoded data corresponding to the current frame image according to the inter-frame prediction mode of each target coding unit, the quantization parameter corresponding to each target coding unit and the current frame image;
the determining a binary difference image of the current frame image relative to the previous frame image according to the current frame image and the previous frame image of the current frame image includes:
when the pixel values of a first pixel point of the current frame image and a pixel point at the corresponding position of the previous frame image are the same, determining that the gray value of the first pixel point in the binary differential image is 0;
when the pixel values of the second pixel point of the current frame image and the pixel point at the corresponding position of the previous frame image are different, determining the gray value of the second pixel point in the binary differential image to be 255;
correspondingly, determining whether the current frame image has the region of interest according to the binary difference image comprises the following steps:
when a pixel point with the gray value of 255 exists in the binary differential image, determining that the current frame image has the region of interest;
before the determining, for each target coding unit, the inter prediction mode of each target coding unit according to the positional relationship between the target coding unit and the region of interest, the method further includes:
when the ratio of the number of the pixels with the gray value of 255 to the total number of the pixels of the binary differential image in the binary differential image is greater than a preset threshold, determining that the motion mode of the current frame image is that the background and the foreground both move;
when the ratio of the number of the pixels with the gray value of 255 to the total number of the pixels of the binary differential image in the binary differential image is less than or equal to the preset threshold, determining that the motion mode of the current frame image is background static and foreground motion;
correspondingly, the determining the inter-frame prediction mode of each target coding unit according to the position relationship between the target coding unit and the region of interest includes:
determining an inter-frame prediction mode of each target coding unit and an adjusted quantization parameter corresponding to each target coding unit according to the motion mode of the current frame image and the position relation between the target coding unit and the region of interest;
after determining whether the region of interest exists in the current frame image according to the binary differential image, the method further comprises:
if the current frame image is determined not to have the region of interest, determining all coding units with the sizes of 64 × 64 and 32 × 32 in the coding units of the current frame image as target coding units of the current frame image;
determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a sixth candidate inter-frame prediction mode set, wherein the adjusted quantization parameter corresponding to the target coding unit is the quantization parameter corresponding to the target coding unit plus two; wherein the sixth set of candidate inter prediction modes comprises: SKIP/merge mode and Square mode.
2. The method according to claim 1, wherein determining all target coding units of the current frame image if it is determined that the region of interest exists in the current frame image comprises:
if the current frame image is determined to have the region of interest, determining all coding units with the sizes of 16 × 16 and 8 × 8 in the coding units of the current frame image as target coding units of the current frame image.
3. The method according to claim 1, wherein determining the inter prediction mode of each target coding unit and the adjusted quantization parameter corresponding to each target coding unit according to the motion mode of the current frame image and the position relationship between the target coding unit and the region of interest comprises:
if the motion mode of the current frame image is that the background and the foreground both move, then:
when the target coding unit comprises a pixel point with the same gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in the first candidate inter-frame prediction mode set, and subtracting one from the quantization parameter corresponding to the target coding unit by the adjusted quantization parameter corresponding to the target coding unit; wherein the first set of candidate inter prediction modes comprises: a symmetric split SMP mode, an asymmetric split AMP mode, and an intra prediction modes;
when the target coding unit does not include a pixel point with the same gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a second candidate inter-frame prediction mode set, and adding one to the quantization parameter corresponding to the target coding unit after adjustment; wherein the second set of candidate inter prediction modes comprises: skipping a SKIP/merge mode, a Square split Square mode and an SMP mode;
if the motion mode of the current frame image is background still and foreground motion, then:
when the target coding unit comprises pixel points with the same positions as the pixel points with the gray value of 255 in the binary differential image and the coding units around the target coding unit do not comprise the pixel points with the same positions as the pixel points with the gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a third candidate inter-frame prediction mode set, and subtracting one from the quantization parameter corresponding to the target coding unit by the adjusted quantization parameter corresponding to the target coding unit; wherein the third set of candidate inter prediction modes comprises: AMP mode and intra modes;
when the target coding unit comprises pixel points with the same positions as the pixel points with the gray value of 255 in the binary differential image and the coding units around the target coding unit also comprise pixel points with the same positions as the pixel points with the gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a fourth candidate inter-frame prediction mode set, and subtracting three from the quantization parameter corresponding to the target coding unit by the adjusted quantization parameter corresponding to the target coding unit; wherein the fourth set of candidate inter prediction modes comprises: a Square mode and an SMP mode;
when the target coding unit does not include a pixel point with the same gray value of 255 in the binary differential image, determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a fifth candidate inter-frame prediction mode set, and adding two to the quantization parameter corresponding to the target coding unit after adjustment; wherein the fifth set of candidate inter prediction modes comprises: SKIP/merge mode and Square mode.
4. The method according to claim 1 or 3, wherein the range of values of the adjusted quantization parameter corresponding to the target coding unit is:
Figure FDA0003582198040000041
QP ═ max {0, min { QP,51} }, where QP denotes an adjusted quantization parameter corresponding to the target coding unit,
Figure FDA0003582198040000042
and the average value of the adjusted quantization parameters corresponding to 4 coded coding units around the target coding unit is represented.
5. A video encoding compression apparatus, comprising:
a binary differential image determining module, configured to determine a binary differential image of a current frame image relative to a previous frame image according to the current frame image and the previous frame image of the current frame image;
the interested region determining module is used for determining whether the current frame image has an interested region according to the binary difference image; the region of interest is a region where the current frame image is different from the previous frame image;
a first inter-frame prediction mode determining module, configured to determine all target coding units of the current frame image if it is determined that the region of interest exists in the current frame image, and determine, for each target coding unit, an inter-frame prediction mode of each target coding unit according to a positional relationship between the target coding unit and the region of interest;
the encoding module is used for determining encoded data corresponding to the current frame image according to the inter-frame prediction mode of each target encoding unit, the quantization parameter corresponding to each target encoding unit and the current frame image;
the binary differential image determining module also comprises a gray value setting submodule;
the gray value setting submodule is used for determining that the gray value of a first pixel point in the binary differential image is 0 when the pixel value of the first pixel point of the current frame image is the same as the pixel value of the pixel point at the corresponding position of the previous frame image; when the pixel values of the second pixel point of the current frame image and the pixel point at the corresponding position of the previous frame image are different, determining the gray value of the second pixel point in the binary differential image to be 255;
the region-of-interest determining module is specifically configured to determine that the current frame image has the region of interest when a pixel point with a gray value of 255 exists in the binary differential image;
the motion pattern determination module is to: when the ratio of the number of the pixels with the gray value of 255 to the total number of the pixels of the binary differential image in the binary differential image is greater than a preset threshold, determining that the motion mode of the current frame image is that the background and the foreground both move; when the ratio of the number of the pixels with the gray value of 255 to the total number of the pixels of the binary differential image in the binary differential image is less than or equal to the preset threshold, determining that the motion mode of the current frame image is background static and foreground motion;
the first inter-frame prediction mode determining module specifically includes an inter-frame prediction mode determining sub-module in terms of determining the inter-frame prediction mode of each target coding unit according to the position relationship between the target coding unit and the region of interest;
the inter-frame prediction mode determining sub-module is specifically configured to determine, according to the motion mode of the current frame image and the positional relationship between the target coding units and the region of interest, the inter-frame prediction mode of each target coding unit and the adjusted quantization parameter corresponding to each target coding unit;
the second inter prediction mode determination module is specifically configured to: if the current frame image is determined not to have the region of interest, determining all coding units with the sizes of 64 × 64 and 32 × 32 in the coding units of the current frame image as target coding units of the current frame image; determining that the inter-frame prediction mode of the target coding unit is the inter-frame prediction mode with the minimum rate distortion cost in a sixth candidate inter-frame prediction mode set, wherein the adjusted quantization parameter corresponding to the target coding unit is the quantization parameter corresponding to the target coding unit plus two; wherein the sixth set of candidate inter prediction modes comprises: SKIP/merge mode and Square mode.
6. An electronic device, characterized in that the device comprises:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the video encoding compression method of any one of claims 1-4.
7. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out a video coding compression method according to any one of claims 1 to 4.
CN201811284900.8A 2018-10-31 2018-10-31 Video coding compression method, device, equipment and medium Active CN109379594B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811284900.8A CN109379594B (en) 2018-10-31 2018-10-31 Video coding compression method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811284900.8A CN109379594B (en) 2018-10-31 2018-10-31 Video coding compression method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN109379594A CN109379594A (en) 2019-02-22
CN109379594B true CN109379594B (en) 2022-07-19

Family

ID=65390500

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811284900.8A Active CN109379594B (en) 2018-10-31 2018-10-31 Video coding compression method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN109379594B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110072103A (en) * 2019-03-15 2019-07-30 西安电子科技大学 Video Fast Compression method, HD video system, 4K video system based on ROI
CN110611819B (en) * 2019-08-01 2021-07-27 杭州当虹科技股份有限公司 Coding method for improving quality of B frame in H.264
CN110610150B (en) * 2019-09-05 2022-10-11 北京佳讯飞鸿电气股份有限公司 Tracking method, device, computing equipment and medium of target moving object
CN110519597B (en) * 2019-09-05 2022-05-10 北京佳讯飞鸿电气股份有限公司 HEVC-based encoding method and device, computing equipment and medium
CN110728700B (en) * 2019-09-25 2022-07-19 北京佳讯飞鸿电气股份有限公司 Moving target tracking method and device, computer equipment and storage medium
CN113301342B (en) * 2021-05-13 2022-07-22 广州方硅信息技术有限公司 Video coding method, network live broadcasting method, device and terminal equipment
CN117132669A (en) * 2022-10-10 2023-11-28 深圳市Tcl云创科技有限公司 Image frame sequence processing method, device, computer equipment and storage medium
CN117596394B (en) * 2024-01-18 2024-05-24 之江实验室 Depth map inter-frame compression method with self-adaptive precision

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1750658A (en) * 2004-09-14 2006-03-22 华为技术有限公司 Selecting method for predicting mode between frames
CN101090498A (en) * 2007-07-19 2007-12-19 华为技术有限公司 Device and method for motion detection of image
CN101159873A (en) * 2007-11-16 2008-04-09 中国科学院计算技术研究所 Inter-frame mode selecting method
CN103679745A (en) * 2012-09-17 2014-03-26 浙江大华技术股份有限公司 Moving target detection method and device
CN104113754A (en) * 2014-07-17 2014-10-22 四川大学 Method for high-performance video interframe coding based on time domain relevance and transcoder thereof

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7003035B2 (en) * 2002-01-25 2006-02-21 Microsoft Corporation Video coding methods and apparatuses
US20090317062A1 (en) * 2008-06-24 2009-12-24 Samsung Electronics Co., Ltd. Image processing method and apparatus
CN103618900B (en) * 2013-11-21 2016-08-17 北京工业大学 Video area-of-interest exacting method based on coding information
TWI571831B (en) * 2014-01-28 2017-02-21 瑞昱半導體股份有限公司 A device and method using an overdrive function to do smoothing processing of video data
CN107580217A (en) * 2017-08-31 2018-01-12 郑州云海信息技术有限公司 Coding method and its device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1750658A (en) * 2004-09-14 2006-03-22 华为技术有限公司 Selecting method for predicting mode between frames
CN101090498A (en) * 2007-07-19 2007-12-19 华为技术有限公司 Device and method for motion detection of image
CN101159873A (en) * 2007-11-16 2008-04-09 中国科学院计算技术研究所 Inter-frame mode selecting method
CN103679745A (en) * 2012-09-17 2014-03-26 浙江大华技术股份有限公司 Moving target detection method and device
CN104113754A (en) * 2014-07-17 2014-10-22 四川大学 Method for high-performance video interframe coding based on time domain relevance and transcoder thereof

Also Published As

Publication number Publication date
CN109379594A (en) 2019-02-22

Similar Documents

Publication Publication Date Title
CN109379594B (en) Video coding compression method, device, equipment and medium
US10694179B2 (en) Video coding using hybrid intra prediction
US11265543B2 (en) Method, device, and recording medium storing bit stream, for encoding/decoding image
CA2997462C (en) Image encoding and decoding using pixel adaptive offset process
EP3120556B1 (en) Encoder-side decisions for screen content encoding
WO2020262396A1 (en) Systems and methods for reducing a reconstruction error in video coding based on a cross-component correlation
US8204136B2 (en) Image encoding apparatus
JP2015164346A (en) Image decoding device, image decoding method, image encoding device, image encoding method and data structure of encoded data
US20200021850A1 (en) Video data decoding method, decoding apparatus, encoding method, and encoding apparatus
CN112889286B (en) Method and apparatus for mode-dependent and size-dependent block-level limiting of position-dependent prediction combinations
US9832465B2 (en) Image encoding device and image decoding device
WO2017121549A1 (en) Frequency based prediction
JP6373008B2 (en) Image encoding device, image decoding device, image encoding method, and image decoding method
WO2021070427A1 (en) Systems and methods for reducing a reconstruction error in video coding based on a cross-component correlation
CN109889838A (en) A kind of HEVC fast encoding method based on ROI region
CN112954365A (en) HEVC interframe motion estimation pixel search improvement method
JP7147145B2 (en) Video encoding device, video encoding method, and video encoding program
JP2013098713A (en) Video encoding device, video decoding device, video encoding method, and video decoding method
Hwang Enhanced Coding Tools and Algorithms for Screen Content Video: A Review: A Review
CN116418991A (en) Processing method and device, video decoding method, video encoding method and device
CN116156187A (en) Image processing method, device, electronic equipment and storage medium
JP2022130439A (en) Image processing device and method for performing efficient deblocking
Lei et al. Fast Mode Decision Algorithm for Coding Depth Maps in 3D High-Efficiency Video Coding.
CN116647683A (en) Quantization processing method and device
JP2009033245A (en) Image encoding device, image encoding method, and program

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