CN110611819B - Coding method for improving quality of B frame in H.264 - Google Patents

Coding method for improving quality of B frame in H.264 Download PDF

Info

Publication number
CN110611819B
CN110611819B CN201910705407.7A CN201910705407A CN110611819B CN 110611819 B CN110611819 B CN 110611819B CN 201910705407 A CN201910705407 A CN 201910705407A CN 110611819 B CN110611819 B CN 110611819B
Authority
CN
China
Prior art keywords
mode
skip
rdcost
ssd
coding distortion
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
CN201910705407.7A
Other languages
Chinese (zh)
Other versions
CN110611819A (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.)
Hangzhou Arcvideo Technology Co ltd
Original Assignee
Hangzhou Arcvideo Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Arcvideo Technology Co ltd filed Critical Hangzhou Arcvideo Technology Co ltd
Priority to CN201910705407.7A priority Critical patent/CN110611819B/en
Publication of CN110611819A publication Critical patent/CN110611819A/en
Application granted granted Critical
Publication of CN110611819B publication Critical patent/CN110611819B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/109Selection of coding mode or of prediction mode among a plurality of temporal predictive coding modes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • H04N19/147Data rate or code amount at the encoder output according to rate distortion criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • 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
    • H04N19/51Motion estimation or motion compensation
    • H04N19/577Motion compensation with bidirectional frame interpolation, i.e. using B-pictures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression
    • H04N19/86Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression involving reduction of coding artifacts, e.g. of blockiness

Landscapes

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

Abstract

The invention discloses an encoding method for improving the quality of a B frame in H.264. The method specifically comprises the following steps: obtaining the RDcost of SKIP, DIRECT, INTER16x16 and INTRA16x 16; judging that the RDcost of the SKIP is minimum, the RDcost of the DIRECT is smaller than the RDcost of the INTER16x16, and meanwhile, the coding distortion of the SKIP and the coding distortion of the INTRA16x16 mode meet requirements, selecting the SKIP as the optimal mode of the current macroblock, otherwise, obtaining the RDcosts of the INTERSub16x16, the INTRA8x8 and the INTRA4x 4; and judging that the RDcost of the SKIP is minimum, and the coding distortion of the SKIP and the coding distortion of the optimal INTRA meet the requirements, selecting the SKIP as the optimal mode of the current macro block, otherwise, selecting the mode with the minimum RDcost except the SKIP as the optimal mode. The invention has the beneficial effects that: the result of macro block mode selection is reasonable, the blocking effect is reduced, and the video quality is improved under low code rate.

Description

Coding method for improving quality of B frame in H.264
Technical Field
The invention relates to the technical field related to video coding, in particular to a coding method for improving the quality of a B frame in H.264.
Background
H.264 is a highly compressed digital video coding and decoding standard commonly proposed by the international organization for standardization (ISO) and the International Telecommunication Union (ITU), and is characterized by high compression efficiency, strong fault-tolerant capability and low coding delay, and the coding standard is widely applied to video monitoring systems, network video live broadcast, multimedia information storage and other aspects at present.
The video image data has strong relativity, the data of a plurality of adjacent pixels in a frame of image are similar or identical, which is spatial redundancy, the data between adjacent frames in the video also have a plurality of similarities or repetitions, which is temporal redundancy, the coding compression removes the redundant information in the data, the intra-frame coding technology can remove the spatial redundancy, and the inter-frame coding technology can remove the temporal redundancy.
The inter-frame coding divides the current frame image into several macro blocks by using the correlation existing between adjacent frames, and tries to search out the corresponding matching block of each macro block in the adjacent frames to predict the pixel value of the macro block in the current frame. In order to improve the accuracy of current macroblock prediction and the coding compression rate, an h.264 encoder selects a mode by using a lagrangian rate-distortion optimization method, taking a B frame as an example, the h.264 encoder sequentially finds the rate-distortion cost RDcost of a SKIP mode, a DIRECT mode, INTER (INTER16x16, INTER16x8, INTER8x16, INTER8x8) mode, and INTRA (INTRA 16x16, INTRA8x8, and INTRA4x 4) mode, and selects the mode with the minimum RDcost as an optimal prediction mode, wherein the RDcost is calculated as:
RD cost=λ·R+SSD
wherein λ is Lagrange factor, R represents coding rate, and SSD represents coding distortion. The mode selection method based on Lagrange rate distortion optimization can analyze the bit number and coding distortion generated by each mode, so that the optimal mode can be selected.
In each mode, the SKIP mode adopts a time domain/space domain predicted motion vector to obtain a matching block so as to obtain a pixel predicted value of a current macro block, and the SKIP mode does not encode a pixel residual error and a motion vector residual error and is mainly characterized in that the encoding code rate is small but the distortion is large; the DIRECT mode carries out pixel residual error coding on the basis of the SKIP mode, so compared with the SKIP mode, the DIRECT mode has small coding distortion and large coding code rate; in the INTER mode, a more accurate motion vector is searched out through motion estimation to obtain a matching block, and a pixel residual error and a motion vector residual error can be coded, wherein the coding distortion of the INTER mode is smaller than that of SKIP/DIRECT generally; the INTRA-frame prediction mode is used for predicting the pixel value of the current macroblock, and is characterized by consuming a large amount of code rate but having small coding distortion, and when a matching block cannot be found, the INTRA-frame prediction mode can be used for reconstructing the pixel value of the current macroblock better.
x264 is an open-source H.264 video encoder, which adopts the techniques of scene change detection, adaptive B frame selection, interframe parallel coding, instruction set optimization, macroblock mode fast decision and the like, so that the H.264 encoder can better meet the requirements of fast and real-time coding. When a fast macroblock mode decision is made for a B frame, firstly, the RDcost of three modes including SKIP, DIRECT and INTER16x16 is obtained, and if the RDcost of the SKIP mode is minimum and the RDcost of the DIRECT mode is smaller than the RDcost of the INTER16x16 mode, the SKIP mode is determined to be the final mode of the current macroblock in advance and other modes are not analyzed, otherwise, the INTER16x16 (INTER16x8, INTER8x16 and INTER8x8) mode and the INTER mode are continuously analyzed, and the mode with the minimum RDcost is selected as the final mode.
In a complex scene with low code rate, the conventional x264 mode selection method is easy to give up an INTER mode because a proper matching block cannot be found, and the SKIP mode is finally selected because the SKIP mode is smaller than the RDcost of the INTRA mode. The unreasonable SKIP mode can cause the macro block coding distortion to be overlarge or discontinuous with the texture of the surrounding macro blocks, thereby causing the block effect and reducing the subjective quality.
Disclosure of Invention
The invention provides an encoding method for improving the quality of B frames in H.264, which improves the subjective quality and overcomes the defects in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme:
an encoding method for improving the quality of a B frame in H.264 specifically comprises the following steps:
(1) sequentially obtaining RDcost of 4 modes including SKIP, DIRECT, INTER16x16 and INTRA16x 16;
(2) judging whether the RDcost of the SKIP mode is minimum, and the RDcost of the DIRECT mode is smaller than the RDcost of the INTER16x16 mode, and if the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA16x16 of the INTRA16x16 mode meet the requirements, selecting the SKIP mode as the optimal mode of the current macroblock, and if not, executing the step (3);
(3) sequentially obtaining the RDcost of INTERSub16x16, INTRA8x8 and INTRA4x4 modes;
(4) and judging whether the RDcost of the SKIP mode is minimum or not, if so, selecting the SKIP mode as the optimal mode of the current macro block, and if so, selecting the mode with the minimum RDcost except the SKIP as the optimal mode, and if not, selecting the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA of the optimal INTRA mode to meet the requirements.
The invention analyzes the INTRA16x16 mode in advance, judges whether the coding distortion of the current macro block is too large by comparing the SSD of the SKIP mode and the SSD of the INTRA16x16 mode, and if so, other modes need to be continuously analyzed, thereby reducing the blocking effect caused by that the SKIP mode is quickly selected because a reasonable matching block cannot be found; after analyzing INTRA8x8 and INTRA4x4, by comparing SSD of SKIP mode and INTRA optimum mode, judging whether coding distortion of current macro block is too large if SKIP mode is adopted, if so, abandoning SKIP mode, thereby reducing blocking effect caused by that coding distortion of SKIP mode is larger but RDcost is smaller. By optimizing the macroblock mode selection of x264, the method ensures that the result of the macroblock mode selection is more reasonable, reduces the block effect and greatly improves the video quality under low code rate.
Preferably, in step (2), the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA16x16 of the INTRA16x16 mode satisfy the following condition:
SSD_SKIP<a*SSD_INTRA16×16
wherein: a is a constant, and the value range of a is [1,10 ].
Preferably, in step (4), the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA of the optimal INTRA mode satisfy the following condition:
SSD_SKIP<b*SSD_INTRA
wherein: b is a constant, and the value range of b is [1,10 ].
The invention has the beneficial effects that: by optimizing the macroblock mode selection of x264, the result of macroblock mode selection is more reasonable, the blocking effect is reduced, and the video quality under low code rate is greatly improved.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Detailed Description
The invention is further described with reference to the following figures and detailed description.
In the embodiment shown in fig. 1, an encoding method for improving the quality of a B frame in h.264 specifically includes the following steps:
(1) sequentially obtaining RDcost of 4 modes including SKIP, DIRECT, INTER16x16 and INTRA16x 16;
(2) judging whether the RDcost of the SKIP mode is minimum, and the RDcost of the DIRECT mode is smaller than the RDcost of the INTER16x16 mode, and if the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA16x16 of the INTRA16x16 mode meet the requirements, selecting the SKIP mode as the optimal mode of the current macroblock, and if not, executing the step (3);
wherein: coding distortion SSD _ SKIP for SKIP mode and SSD _ INTRA16x16 for INTRA16x16 mode satisfy the following conditions:
SSD_SKIP<a*SSD_INTRA16×16
wherein: a is a constant, and the value range of a is [1,10 ];
(3) sequentially obtaining the RDcost of INTERSub16x16, INTRA8x8 and INTRA4x4 modes;
(4) judging whether the RDcost of the SKIP mode is minimum or not, if so, selecting the SKIP mode as the optimal mode of the current macro block, and if so, selecting the mode with the minimum RDcost except the SKIP as the optimal mode, and if not, selecting the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA of the optimal INTRA mode to meet the requirements;
wherein: the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA of the optimal INTRA mode meet the following conditions:
SSD_SKIP<b*SSD_INTRA
wherein: b is a constant, and the value range of b is [1,10 ].
The invention analyzes the INTRA16x16 mode in advance, judges whether the coding distortion of the current macro block is too large by comparing the SSD of the SKIP mode and the SSD of the INTRA16x16 mode, and if so, other modes need to be continuously analyzed, thereby reducing the blocking effect caused by that the SKIP mode is quickly selected because a reasonable matching block cannot be found; after analyzing INTRA8x8 and INTRA4x4, by comparing SSD of SKIP mode and INTRA optimum mode, judging whether coding distortion of current macro block is too large if SKIP mode is adopted, if so, abandoning SKIP mode, thereby reducing blocking effect caused by that coding distortion of SKIP mode is larger but RDcost is smaller.
The existing x264 mode selection method adopts a lagrangian rate-distortion optimization-based method to obtain a macro block mode with the minimum rate-distortion cost, but the selected mode can not necessarily lead the subjective perception quality to be optimal. In a complex scene with low code rate, an INTER mode is abandoned easily because a proper matching block cannot be found, and a SKIP mode is selected finally because the SKIP mode is smaller than the RDcost of the INTRA mode. The unreasonable SKIP mode can cause the macro block coding distortion to be overlarge or discontinuous with the texture of the surrounding macro blocks, thereby causing the block effect and reducing the subjective quality. By optimizing the macroblock mode selection of x264, the method ensures that the result of the macroblock mode selection is more reasonable, reduces the block effect and greatly improves the video quality under low code rate.
Wherein, the influence of a and b on the inventive result is as follows:
a b video subjective quality Coding performance
3 3 Good taste -1.5%
2 3 Is very good -1.7%
2 1.5 Is very good -3.2%
The final result shows that the blocking effect of the H.264 video encoder in a complex scene under a low code rate can be obviously reduced, the subjective quality is obviously improved, and the performance is reduced within 3.2%.

Claims (1)

1. A coding method for improving the quality of a B frame in H.264 is characterized by comprising the following steps:
(1) sequentially obtaining RDcost of 4 modes including SKIP, DIRECT, INTER16x16 and INTRA16x 16;
(2) judging whether the RDcost of the SKIP mode is minimum, and the RDcost of the DIRECT mode is smaller than the RDcost of the INTER16x16 mode, and if the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA16x16 of the INTRA16x16 mode meet the requirements, selecting the SKIP mode as the optimal mode of the current macroblock, and if not, executing the step (3); coding distortion SSD _ SKIP for SKIP mode and SSD _ INTRA16x16 for INTRA16x16 mode satisfy the following conditions:
SSD_SKIP<a*SSD_INTRA16×16
wherein: a is a constant, and the value range of a is [1,10 ];
(3) sequentially obtaining the RDcost of INTERSub16x16, INTRA8x8 and INTRA4x4 modes;
(4) judging whether the RDcost of the SKIP mode is minimum or not, if so, selecting the SKIP mode as the optimal mode of the current macro block, and if so, selecting the mode with the minimum RDcost except the SKIP as the optimal mode, and if not, selecting the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA of the optimal INTRA mode to meet the requirements; the coding distortion SSD _ SKIP of the SKIP mode and the coding distortion SSD _ INTRA of the optimal INTRA mode meet the following conditions:
SSD_SKIP<b*SSD_INTRA
wherein: b is a constant, and the value range of b is [1,10 ].
CN201910705407.7A 2019-08-01 2019-08-01 Coding method for improving quality of B frame in H.264 Active CN110611819B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910705407.7A CN110611819B (en) 2019-08-01 2019-08-01 Coding method for improving quality of B frame in H.264

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910705407.7A CN110611819B (en) 2019-08-01 2019-08-01 Coding method for improving quality of B frame in H.264

Publications (2)

Publication Number Publication Date
CN110611819A CN110611819A (en) 2019-12-24
CN110611819B true CN110611819B (en) 2021-07-27

Family

ID=68889759

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910705407.7A Active CN110611819B (en) 2019-08-01 2019-08-01 Coding method for improving quality of B frame in H.264

Country Status (1)

Country Link
CN (1) CN110611819B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106534849A (en) * 2016-12-30 2017-03-22 杭州当虹科技有限公司 Fast HEVC interframe coding method

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7317759B1 (en) * 2002-02-28 2008-01-08 Carnegie Mellon University System and methods for video compression mode decisions
US7843995B2 (en) * 2005-12-19 2010-11-30 Seiko Epson Corporation Temporal and spatial analysis of a video macroblock
CN101527851B (en) * 2009-04-10 2010-08-11 清华大学深圳研究生院 Fast selecting method of P frame pattern in H. 264
US9426473B2 (en) * 2013-02-01 2016-08-23 Qualcomm Incorporated Mode decision simplification for intra prediction
CN106464880B (en) * 2014-06-26 2019-05-10 华为技术有限公司 Method and apparatus for reducing the calculated load in high efficiency Video coding
CN109379594B (en) * 2018-10-31 2022-07-19 北京佳讯飞鸿电气股份有限公司 Video coding compression method, device, equipment and medium
CN109547798B (en) * 2018-12-17 2020-09-18 杭州当虹科技股份有限公司 Rapid HEVC inter-frame mode selection method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106534849A (en) * 2016-12-30 2017-03-22 杭州当虹科技有限公司 Fast HEVC interframe coding method

Also Published As

Publication number Publication date
CN110611819A (en) 2019-12-24

Similar Documents

Publication Publication Date Title
CN103997646B (en) Fast intra-mode prediction mode selecting method in a kind of HD video coding
CN109688414B (en) VVC intra-frame coding unit candidate prediction mode reduction and block division early termination method
JP5785285B2 (en) Dynamic selection of motion prediction search range and extended motion vector range
US20170085892A1 (en) Visual perception characteristics-combining hierarchical video coding method
US8311097B2 (en) Image processing method for adaptive spatial-temporal resolution frame
US8320455B2 (en) System and method to process motion vectors of video data
JP5897218B2 (en) Video encoding method and video encoding apparatus using this method
US10356441B2 (en) Method and apparatus for detecting quality defects in a video bitstream
CN102065298B (en) High-performance macroblock coding implementation method
CN108989802B (en) HEVC video stream quality estimation method and system by utilizing inter-frame relation
CN103873861A (en) Coding mode selection method for HEVC (high efficiency video coding)
CN103384325A (en) Quick inter-frame prediction mode selection method for AVS-M video coding
CN107071497B (en) Low-complexity video coding method based on space-time correlation
CN106550237B (en) Monitoring video compression method
US20150350686A1 (en) Preencoder assisted video encoding
CN104601992B (en) SKIP mode quick selecting methods based on Bayesian Smallest Risk decision
CN103384326A (en) Quick intra-frame prediction mode selection method for AVS-M video coding
CN103533355A (en) Quick coding method for HEVC (high efficiency video coding)
CN108989818B (en) Image coding parameter adjusting method and device
CN117156133B (en) Inter-frame prediction mode selection method and device for video coding
CN1457196A (en) Video encoding method based on prediction time and space domain conerent movement vectors
CN110913215B (en) Method and device for selecting prediction mode and readable storage medium
CN110446042B (en) Coding method for improving P frame quality in H.264
CN109547798B (en) Rapid HEVC inter-frame mode selection method
CN110611819B (en) Coding method for improving quality of B frame in H.264

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