[0001] This application claims priority to Chinese Patent Application No.
201310430799.3, filed with the Chinese Patent Office on September 18, 2013 and entitled "INTER-FRAME
PREDICTIVE CODING METHOD AND CODER", which is incorporated herein by reference in
its entirety.
TECHNICAL FIELD
[0002] The present invention relates to the field of picture processing technologies, and
in particular, to an inter-frame predictive coding method and a coder.
BACKGROUND
[0003] High Efficiency Video Coding (High Efficiency Video Coding, HEVC) is a new-generation
video coding standard after H.264. HEVC still uses a hybrid coding framework of H.264,
such as intra-frame prediction and inter-frame prediction, residual two-dimensional
transform, loop filtering, and entropy coding. However, in this hybrid coding framework,
a lot of technology innovations are further made in HEVC, where typical innovative
technologies include:
- (1) a quadtree block based splitting structure, where a coding tree unit (Coding Tree
Unit, CTU), a coding unit (Coding Unit, CU), a prediction unit (Prediction Unit, PU),
and a transform unit (Transform Unit, TU) are used to describe an entire coding process.
The CTU is a maximum coding unit in HEVC; the CTU may be subsplit into CUs, where
the CUs are similar to macroblocks or sub-macroblocks in H.264, and each CU is a 2Nx2N
pixel block (N is a power of 2); and pixel block sizes of the PU and TU are 4x4;
- (2) up to 35 intra-frame prediction modes included in an official standard HEVC test
model (HM);
- (3) an advanced motion estimation technology, such as an advanced motion vector prediction
(AMVP) technology and a motion merge (merge) technology;
- (4) an adaptive loop filter technology, for example, using a sample adaptive offset
(SAO) filter; and
- (5) a semantic-based entropy coding technology, for example, an entropy coding technology
using adaptive binary arithmetic coding (CABAC).
[0004] In comparison with H.264, HEVC has the foregoing innovative technologies. Therefore,
in comparison with using H.264 for coding, using HEVC for coding may achieve double
compression efficiency, that is, in a case in which same video picture quality is
ensured, a bit rate of a video stream is reduced by 50%.
[0005] While improving coding efficiency, HEVC also inevitably increases coding complexity.
A feasible manner for reducing HEVC coding complexity is to optimize an inter-frame
predictive coding process in HEVC. However, currently only a single optimization manner
of inter-frame predictive coding is available, and it is necessary to find more types
of optimization manners.
SUMMARY
[0006] The present invention provides an inter-frame predictive coding method and a coder,
to solve a problem existing in the prior art that only a single optimization manner
of inter-frame predictive coding is available.
[0007] According to a first aspect, an inter-frame predictive coding method is provided,
where the method includes:
sequentially performing inter-frame predictive coding on frames in each group of pictures,
where a process of performing inter-frame predictive coding on frames in any group
of pictures is as follows:
for any coding tree unit CTU in a to-be-coded reference B frame in a current group
of pictures, determining a first maximum depth of a CTU from a GPB frame or P frame
that is the closest to the to-be-coded reference B frame in the current group of pictures
and of which inter-frame predictive coding is completed, where the determined CTU
and the CTU in the to-be-coded reference B frame are in a same position in their respective
frames; and
when inter-frame predictive coding is performed on the CTU in the to-be-coded reference
B frame, that a splitting depth of the CTU does not exceed the first maximum depth.
[0008] With reference to the first aspect, in a first possible implementation manner, the
method further includes:
if the first maximum depth is equal to a preset maximum depth, skipping a mode decision
process with a depth of 0 when inter-frame predictive coding is performed on the CTU
in the to-be-coded reference B frame.
[0009] With reference to the first aspect or the first possible implementation manner of
the first aspect, in a second possible implementation manner, the method further includes:
when inter-frame predictive coding is performed on the CTU in the to-be-coded reference
B frame, in a mode decision process of the CTU with any depth, skipping mode operations
of an inter-frame Nx2N mode and an inter-frame 2NxN mode, and performing mode operations
of other modes by using a sum of absolute differences SAD algorithm.
[0010] With reference to the first aspect, the first possible implementation manner of the
first aspect, or the second possible implementation manner of the first aspect, in
a third possible implementation manner, the method further includes:
for any CTU in a to-be-coded non-reference B frame in the current group of pictures,
determining a second maximum depth of a CTU from a reference B frame that is the closest
to the to-be-coded non-reference B frame in the current group of pictures and of which
inter-frame predictive coding is completed, where the determined CTU and the CTU in
the to-be-coded non-reference B frame are in a same position in their respective frames;
and
when inter-frame predictive coding is performed on the CTU in the to-be-coded non-reference
B frame, that a splitting depth of the CTU does not exceed the second maximum depth.
[0011] With reference to the third possible implementation manner of the first aspect, in
a fourth possible implementation manner, the method further includes:
if the second maximum depth is equal to the preset maximum depth or the preset maximum
depth minus 1, skipping a mode decision process with a depth of 0 when inter-frame
predictive coding is performed on the CTU in the to-be-coded non-reference B frame.
[0012] With reference to the third possible implementation manner of the first aspect or
the fourth possible implementation manner of the first aspect, in a fifth possible
implementation manner, the method further includes:
when inter-frame predictive coding is performed on the CTU in the to-be-coded non-reference
B frame, in a mode decision process of the CTU with any depth, skipping mode operations
of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and performing mode operations
of other modes by using the SAD algorithm.
[0013] With reference to the first aspect, the first possible implementation manner of the
first aspect, the second possible implementation manner of the first aspect, the third
possible implementation manner of the first aspect, the fourth possible implementation
manner of the first aspect, or the fifth possible implementation manner of the first
aspect, in a sixth possible implementation manner, the method further includes:
if a GPB frame of which inter-frame predictive coding is completed exists in the current
group of pictures, for any CTU in a to-be-coded GPB frame in the current group of
pictures, determining a third maximum depth of a CTU from the GPB frame of which inter-frame
predictive coding is completed, where the determined CTU and the CTU in the to-be-coded
GPB frame are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded GPB frame, that a splitting
depth of the CTU does not exceed the third maximum depth; or
if no GPB frame of which inter-frame predictive coding is completed exists in the
current group of pictures, for any CTU in a to-be-coded GPB frame in the current group
of pictures, determining a fourth maximum depth of a CTU from a GPB frame in a previous
group of pictures, where the determined CTU and the CTU in the to-be-coded GPB frame
in the current group of pictures are in a same position in their respective frames;
and when inter-frame predictive coding is performed on the CTU in the to-be-coded
GPB frame, that a splitting depth of the CTU does not exceed the fourth maximum depth.
[0014] With reference to the sixth possible implementation manner of the first aspect, in
a seventh possible implementation manner, the method further includes:
if the third maximum depth or the fourth maximum depth is equal to the preset maximum
depth, skipping a mode decision process with a depth of 0 when inter-frame predictive
coding is performed on the CTU in the to-be-coded GPB frame.
[0015] With reference to the sixth possible implementation manner of the first aspect or
the seventh possible implementation manner of the first aspect, in an eighth possible
implementation manner, the method further includes:
when inter-frame predictive coding is performed on the CTU in the to-be-coded GPB
frame, in mode decisions of the CTU with depths of 0 to the preset maximum depth minus
1, skipping mode operations of the inter-frame Nx2N mode and the inter-frame 2NxN
mode, and performing a mode operation on the CTU by using a sum of absolute transformed
differences SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skipping
mode operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and performing
a mode operation on the CTU by using an SATD algorithm.
[0016] With reference to the first aspect, the first possible implementation manner of the
first aspect, the second possible implementation manner of the first aspect, the third
possible implementation manner of the first aspect, the fourth possible implementation
manner of the first aspect, or the fifth possible implementation manner of the first
aspect, in a ninth possible implementation manner, the method further includes:
if a P frame of which inter-frame predictive coding is completed exists in the current
group of pictures, for any CTU in a to-be-coded P frame in the current group of pictures,
determining a fifth maximum depth of a CTU from the P frame of which inter-frame predictive
coding is completed, where the determined CTU and the CTU in the to-be-coded P frame
are in a same position in their respective frames; and when inter-frame predictive
coding is performed on the CTU in the to-be-coded P frame, that a splitting depth
of the CTU does not exceed the fifth maximum depth; or
if no P frame of which inter-frame predictive coding is completed exists in the current
group of pictures, for any CTU in a to-be-coded P frame in the current group of pictures,
determining a sixth maximum depth of a CTU from a P frame in a previous group of pictures,
where the determined CTU and the CTU in the to-be-coded P frame in the current group
of pictures are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded P frame, that a splitting
depth of the CTU does not exceed the sixth maximum depth.
[0017] With reference to the ninth possible implementation manner of the first aspect, in
a tenth possible implementation manner, the method further includes:
if the fifth maximum depth or the sixth maximum depth is equal to the preset maximum
depth, skipping a mode decision process with a depth of 0 when inter-frame predictive
coding is performed on the CTU in the to-be-coded P frame.
[0018] With reference to the ninth possible implementation manner of the first aspect or
the tenth possible implementation manner of the first aspect, in an eleventh possible
implementation manner, the method further includes:
when inter-frame predictive coding is performed on the CTU in the to-be-coded P frame,
in mode decisions of the CTU with depths of 0 to the preset maximum depth minus 1,
skipping mode operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode,
and performing a mode operation on the CTU by using an SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skipping
mode operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and performing
a mode operation on the CTU by using an SATD algorithm.
[0019] According to a second aspect, a coder is provided, where the coder includes:
a group of pictures reading module, configured to sequentially read groups of pictures;
and
a coding module, configured to perform the following inter-frame predictive coding
on frames in any group of pictures:
for any CTU in a to-be-coded reference B frame in a current group of pictures, determining
a first maximum depth of a CTU from a GPB frame or P frame that is the closest to
the to-be-coded reference B frame in the current group of pictures and of which inter-frame
predictive coding is completed, where the determined CTU and the CTU in the to-be-coded
reference B frame are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded reference B frame, that
a splitting depth of the CTU does not exceed the first maximum depth.
[0020] With reference to the second aspect, in a first possible implementation manner,
the coding module is further configured to: if the first maximum depth is equal to
a preset maximum depth, skip a mode decision process with a depth of 0 when inter-frame
predictive coding is performed on the CTU in the to-be-coded reference B frame.
[0021] With reference to the second aspect or the first possible implementation manner of
the second aspect, in a second possible implementation manner,
the coding module is further configured to: when inter-frame predictive coding is
performed on the CTU in the to-be-coded reference B frame, in a mode decision process
of the CTU with any depth, skip mode operations of an inter-frame Nx2N mode and an
inter-frame 2NxN mode, and perform mode operations of other modes by using a sum of
absolute differences SAD algorithm.
[0022] With reference to the second aspect, the first possible implementation manner of
the second aspect, or the second possible implementation manner of the second aspect,
in a third possible implementation manner,
the coding module is further configured to: for any CTU in a to-be-coded non-reference
B frame in the current group of pictures, determine a second maximum depth of a CTU
from a reference B frame that is the closest to the to-be-coded non-reference B frame
in the current group of pictures and of which inter-frame predictive coding is completed,
where the determined CTU and the CTU in the to-be-coded non-reference B frame are
in a same position in their respective frames; and
when inter-frame predictive coding is performed on the CTU in the to-be-coded non-reference
B frame, that a splitting depth of the CTU does not exceed the second maximum depth.
[0023] With reference to the third possible implementation manner of the second aspect,
in a fourth possible implementation manner,
the coding module is further configured to: if the second maximum depth is equal to
the preset maximum depth or the preset maximum depth minus 1, skip a mode decision
process with a depth of 0 when inter-frame predictive coding is performed on the CTU
in the to-be-coded non-reference B frame.
[0024] With reference to the third possible implementation manner of the second aspect or
the fourth possible implementation manner of the second aspect, in a fifth possible
implementation manner,
the coding module is configured to: when inter-frame predictive coding is performed
on the CTU in the to-be-coded non-reference B frame, in a mode decision process of
the CTU with any depth, skip mode operations of the inter-frame Nx2N mode and the
inter-frame 2NxN mode, and perform mode operations of other modes by using the SAD
algorithm.
[0025] With reference to the second aspect, the first possible implementation manner of
the second aspect, the second possible implementation manner of the second aspect,
the third possible implementation manner of the second aspect, the fourth possible
implementation manner of the second aspect, or the fifth possible implementation manner
of the second aspect, in a sixth possible implementation manner,
the coding module is further configured to: if a GPB frame of which inter-frame predictive
coding is completed exists in the current group of pictures, for any CTU in a to-be-coded
GPB frame in the current group of pictures, determine a third maximum depth of a CTU
from the GPB frame of which inter-frame predictive coding is completed, where the
determined CTU and the CTU in the to-be-coded GPB frame are in a same position in
their respective frames; and when inter-frame predictive coding is performed on the
CTU in the to-be-coded GPB frame, that a splitting depth of the CTU does not exceed
the third maximum depth; or
if no GPB frame of which inter-frame predictive coding is completed exists in the
current group of pictures, for any CTU in a to-be-coded GPB frame in the current group
of pictures, determine a fourth maximum depth of a CTU from a GPB frame in a previous
group of pictures, where the determined CTU and the CTU in the to-be-coded GPB frame
in the current group of pictures are in a same position in their respective frames;
and when inter-frame predictive coding is performed on the CTU in the to-be-coded
GPB frame, that a splitting depth of the CTU does not exceed the fourth maximum depth.
[0026] With reference to the sixth possible implementation manner of the second aspect,
in a seventh possible implementation manner,
the coding module is further configured to: if the third maximum depth or the fourth
maximum depth is equal to the preset maximum depth, skip a mode decision process with
a depth of 0 when inter-frame predictive coding is performed on the CTU in the to-be-coded
GPB frame.
[0027] With reference to the sixth possible implementation manner of the second aspect or
the seventh possible implementation manner of the second aspect, in an eighth possible
implementation manner,
the coding module is further configured to: when inter-frame predictive coding is
performed on the CTU in the to-be-coded GPB frame, in mode decisions of the CTU with
depths of 0 to the preset maximum depth minus 1, skip mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode, and perform a mode operation on the CTU by
using a sum of absolute transformed differences SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skip mode
operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform
a mode operation on the CTU by using an SATD algorithm.
[0028] With reference to the second aspect, the first possible implementation manner of
the second aspect, the second possible implementation manner of the second aspect,
the third possible implementation manner of the second aspect, the fourth possible
implementation manner of the second aspect, or the fifth possible implementation manner
of the second aspect, in a ninth possible implementation manner,
the coding module is further configured to: if a P frame of which inter-frame predictive
coding is completed exists in the current group of pictures, for any CTU in a to-be-coded
P frame in the current group of pictures, determine a fifth maximum depth of a CTU
from the P frame of which inter-frame predictive coding is completed, where the determined
CTU and the CTU in the to-be-coded P frame are in a same position in their respective
frames; and when inter-frame predictive coding is performed on the CTU in the to-be-coded
P frame, that a splitting depth of the CTU does not exceed the fifth maximum depth;
or
if no P frame of which inter-frame predictive coding is completed exists in the current
group of pictures, for any CTU in a to-be-coded P frame in the current group of pictures,
determine a sixth maximum depth of a CTU from a P frame in a previous group of pictures,
where the determined CTU and the CTU in the to-be-coded P frame in the current group
of pictures are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded P frame, that a splitting
depth of the CTU does not exceed the sixth maximum depth.
[0029] With reference to the ninth possible implementation manner of the second aspect,
in a tenth possible implementation manner,
the coding module is further configured to: if the fifth maximum depth or the sixth
maximum depth is equal to the preset maximum depth, skip a mode decision process with
a depth of 0 when inter-frame predictive coding is performed on the CTU in the to-be-coded
P frame.
[0030] With reference to the ninth possible implementation manner of the second aspect or
the tenth possible implementation manner of the second aspect, in an eleventh possible
implementation manner,
the coding module is further configured to: when inter-frame predictive coding is
performed on the CTU in the to-be-coded P frame, in mode decisions of the CTU with
depths of 0 to the preset maximum depth minus 1, skip mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode, and perform a mode operation on the CTU by
using an SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skip mode
operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform
a mode operation on the CTU by using an SATD algorithm.
[0031] According to a third aspect, a coder is provided, where the coder includes:
an interface, configured to sequentially read groups of pictures;
a processor, configured to perform the following inter-frame predictive coding on
frames in any group of pictures:
for any CTU in a to-be-coded reference B frame in a current group of pictures, determining
a first maximum depth of a CTU from a GPB frame or P frame that is the closest to
the to-be-coded reference B frame in the current group of pictures and of which inter-frame
predictive coding is completed, where the determined CTU and the CTU in the to-be-coded
reference B frame are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded reference B frame, that
a splitting depth of the CTU does not exceed the first maximum depth; and
a memory, configured to store a maximum depth of each CTU in the GPB frame or P frame
that is in the group of pictures and of which inter-frame predictive coding is completed.
[0032] With reference to the third aspect, in a first possible implementation manner,
the processor is further configured to: if the first maximum depth is equal to a preset
maximum depth, skip a mode decision process with a depth of 0 when inter-frame predictive
coding is performed on the CTU in the to-be-coded reference B frame; and
the memory is further configured to store the preset maximum depth.
[0033] With reference to the third aspect or the first possible implementation manner of
the third aspect, in a second possible implementation manner,
the processor is further configured to: when inter-frame predictive coding is performed
on the CTU in the to-be-coded reference B frame, in a mode decision process of the
CTU with any depth, skip mode operations of an inter-frame Nx2N mode and an inter-frame
2NxN mode, and perform mode operations of other modes by using a sum of absolute differences
SAD algorithm; and
the memory is further configured to store multiple types of mode operation information.
[0034] With reference to the third aspect, the first possible implementation manner of the
third aspect, or the second possible implementation manner of the third aspect, in
a third possible implementation manner,
the processor is further configured to: for any CTU in a to-be-coded non-reference
B frame in the current group of pictures, determine a second maximum depth of a CTU
from a reference B frame that is the closest to the to-be-coded non-reference B frame
in the current group of pictures and of which inter-frame predictive coding is completed,
where the determined CTU and the CTU in the to-be-coded non-reference B frame are
in a same position in their respective frames; and
when inter-frame predictive coding is performed on the CTU in the to-be-coded non-reference
B frame, that a splitting depth of the CTU does not exceed the second maximum depth;
and
the memory is further configured to store a maximum depth of each CTU in a reference
B frame that is in the group of pictures and of which inter-frame predictive coding
is completed.
[0035] With reference to the third possible implementation manner of the third aspect, in
a fourth possible implementation manner,
the processor is further configured to: if the second maximum depth is equal to the
preset maximum depth or the preset maximum depth minus 1, skip a mode decision process
with a depth of 0 when inter-frame predictive coding is performed on the CTU in the
to-be-coded non-reference B frame; because a quantity of decisions performed on the
non-reference B frame is reduced, an inter-frame predictive coding process of the
non-reference B frame may be simplified, and an inter-frame predictive coding time
is shortened.
[0036] With reference to the third possible implementation manner of the third aspect or
the fourth possible implementation manner of the third aspect, in a fifth possible
implementation manner,
the processor is configured to: when inter-frame predictive coding is performed on
the CTU in the to-be-coded non-reference B frame, in a mode decision process of the
CTU with any depth, skip mode operations of the inter-frame Nx2N mode and the inter-frame
2NxN mode, and perform mode operations of other modes by using the SAD algorithm;
because mode operations of the non-reference B frame are reduced, the inter-frame
predictive coding process of the non-reference B frame may be simplified, and the
inter-frame predictive coding time is shortened.
[0037] With reference to the third aspect, the first possible implementation manner of the
third aspect, the second possible implementation manner of the third aspect, the third
possible implementation manner of the third aspect, the fourth possible implementation
manner of the third aspect, or the fifth possible implementation manner of the third
aspect, in a sixth possible implementation manner,
the processor is further configured to: if a GPB frame of which inter-frame predictive
coding is completed exists in the current group of pictures, for any CTU in a to-be-coded
GPB frame in the current group of pictures, determine a third maximum depth of a CTU
from the GPB frame of which inter-frame predictive coding is completed, where the
determined CTU and the CTU in the to-be-coded GPB frame are in a same position in
their respective frames; and when inter-frame predictive coding is performed on the
CTU in the to-be-coded GPB frame, that a splitting depth of the CTU does not exceed
the third maximum depth; or
if no GPB frame of which inter-frame predictive coding is completed exists in the
current group of pictures, for any CTU in a to-be-coded GPB frame in the current group
of pictures, determine a fourth maximum depth of a CTU from a GPB frame in a previous
group of pictures, where the determined CTU and the CTU in the to-be-coded GPB frame
in the current group of pictures are in a same position in their respective frames;
and when inter-frame predictive coding is performed on the CTU in to-be-coded the
GPB frame, that a splitting depth of the CTU does not exceed the fourth maximum depth.
[0038] With reference to the sixth possible implementation manner of the third aspect, in
a seventh possible implementation manner,
the processor is further configured to: if the third maximum depth or the fourth maximum
depth is equal to the preset maximum depth, skip a mode decision process with a depth
of 0 when inter-frame predictive coding is performed on the CTU in the to-be-coded
GPB frame; because a quantity of decisions performed on the GPB frame is reduced,
the inter-frame predictive coding process of the GPB frame may be simplified, and
the inter-frame predictive coding time is shortened.
[0039] With reference to the sixth possible implementation manner of the third aspect or
the seventh possible implementation manner of the third aspect, in an eighth possible
implementation manner,
the processor is further configured to: when inter-frame predictive coding is performed
on the CTU in the to-be-coded GPB frame, in mode decisions of the CTU with depths
of 0 to the preset maximum depth minus 1, skip mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode, and perform a mode operation on the CTU by
using a sum of absolute transformed differences SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skip mode
operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform
mode operations on the CTU by using an SATD algorithm; because mode operations of
the GPB frame are reduced, the inter-frame predictive coding process of the GPB frame
may be simplified, and the inter-frame predictive coding time is shortened.
[0040] With reference to the third aspect, the first possible implementation manner of the
third aspect, the second possible implementation manner of the third aspect, the third
possible implementation manner of the third aspect, the fourth possible implementation
manner of the third aspect, or the fifth possible implementation manner of the third
aspect, in a ninth possible implementation manner,
the processor is further configured to: if a P frame of which inter-frame predictive
coding is completed exists in the current group of pictures, for any CTU in a to-be-coded
P frame in the current group of pictures, determine a fifth maximum depth of a CTU
from the P frame of which inter-frame predictive coding is completed, where the determined
CTU and the CTU in the to-be-coded P frame are in a same position in their respective
frames; and when inter-frame predictive coding is performed on the CTU in the to-be-coded
P frame, that a splitting depth of the CTU does not exceed the fifth maximum depth;
or
if no P frame of which inter-frame predictive coding is completed exists in the current
group of pictures, for any CTU in a to-be-coded P frame in the current group of pictures,
determine a sixth maximum depth of a CTU from a P frame in a previous group of pictures,
where the determined CTU and the CTU in the to-be-coded P frame in the current group
of pictures are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded P frame, that a splitting
depth of the CTU does not exceed the sixth maximum depth.
[0041] With reference to the ninth possible implementation manner of the third aspect, in
a tenth possible implementation manner,
the processor is further configured to: if the fifth maximum depth or the sixth maximum
depth is equal to the preset maximum depth, skip a mode decision process with a depth
of 0 when inter-frame predictive coding is performed on the CTU in the to-be-coded
P frame; because a quantity of decisions performed on the P frame is reduced, the
inter-frame predictive coding process of the P frame may be simplified, and the inter-frame
predictive coding time is shortened.
[0042] With reference to the ninth possible implementation manner of the third aspect or
the tenth possible implementation manner of the third aspect, in an eleventh possible
implementation manner,
the processor is further configured to: when inter-frame predictive coding is performed
on the CTU in the to-be-coded P frame, in mode decisions of the CTU with depths of
0 to the preset maximum depth minus 1, skip mode operations of the inter-frame Nx2N
mode and the inter-frame 2NxN mode, and perform a mode operation on the CTU by using
an SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skip mode
operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform
a mode operation on the CTU by using an SATD algorithm; because mode operations of
the P frame are reduced, the inter-frame predictive coding process of the P frame
may be simplified, and the inter-frame predictive coding time is shortened.
[0043] According to a solution of the present invention, inter-frame predictive coding is
sequentially performed on frames in multiple groups of pictures by using a group of
pictures as a unit; when inter-frame predictive coding is performed on a reference
B frame in any group of pictures, a correlation between the reference B frame and
a GPB frame in the same group of pictures is used, so that a splitting depth of a
CTU in the reference B frame does not exceed a maximum depth of a CTU in a same position
in the GPB frame; and when the maximum depth of the CTU in the same position in the
GPB frame is smaller, a quantity of mode decisions performed on the CTU in the reference
B frame may be relatively small, so that an objective of reducing complexity of an
inter-frame predictive coding process of the reference B frame is achieved.
BRIEF DESCRIPTION OF DRAWINGS
[0044] To describe the technical solutions in the embodiments of the present invention more
clearly, the following briefly introduces the accompanying drawings required for describing
the embodiments. Apparently, the accompanying drawings in the following description
show merely some embodiments of the present invention, and a person of ordinary skill
in the art may still derive other drawings from these accompanying drawings without
creative efforts.
FIG. 1 is a schematic diagram of splitting of a CTU whose pixel block is 64x64;
FIG. 2 is a schematic diagram of splitting of a CTU whose pixel block is 128x128;
FIG. 3(a), FIG. 3(b), and FIG. 3(c) are schematic diagrams of steps of an inter-frame
predictive coding method according to Embodiment 1 of the present invention;
FIG. 4 is a schematic structural diagram of a coder according to Embodiment 3 of the
present invention; and
FIG. 5 is a schematic structural diagram of a coder according to Embodiment 4 of the
present invention.
DESCRIPTION OF EMBODIMENTS
[0045] To make the objectives, technical solutions, and advantages of the present invention
clearer, the following further describes the present invention in detail with reference
to the accompanying drawings. Apparently, the described embodiments are merely some
but not all of the embodiments of the present invention. All other embodiments obtained
by a person of ordinary skill in the art based on the embodiments of the present invention
without creative efforts shall fall within the protection scope of the present invention.
[0046] In a conventional inter-frame predictive coding process performed on a frame in an
HM manner, a CTU may be split by using the CTU as a unit, and a mode decision is performed
on a CU, obtained by splitting, with each depth.
[0047] For example, refer to FIG. 1. A CTU whose pixel block is 64x64 is used as an example.
Because the CTU may also be considered as a special CU, the CTU in this case is not
split, and a depth corresponding to the CTU whose pixel block is 64x64 (namely, the
CTU) is 0. A process of performing a mode decision on the CTU with a depth of 0 is
as follows:
[0048] First, mode operations of eight modes are performed on the CTU whose pixel block
is 64x64.
[0049] The eight modes are respectively a skip prediction mode (SKIP mode), an inter-frame
2Nx2N mode (an inter-frame 64x64 mode in this case), an inter-frame NxN mode (an inter-frame
32x32 mode in this case), an inter-frame Nx2N mode (an inter-frame 32x64 mode in this
case), an inter-frame 2NxN mode (an inter-frame 64x32 mode in this case), an intra-frame
2Nx2N mode (an intra-frame 64x64 mode in this case), an intra-frame NxN mode (an intra-frame
32x32 mode in this case), and an intra-frame pulse code (Pulse Code Modulation, PCM)
mode.
[0050] Then, cost values obtained after the operations of the eight modes are compared,
and a mode with a minimum cost value is determined, and thereby a mode decision is
completed. The foregoing is a manner of performing a mode decision by using eight
modes. Certainly, the eight modes may not be used, but instead, other modes are selected
to perform a mode decision.
[0051] After the mode decision is completed, the mode with the minimum cost value may be
determined according to a decision result, to perform inter-frame predictive coding
on the 64x64 CU.
[0052] Then, the 64x64 CTU is split into four 32x32 CUs (a depth corresponding to the 32x32
CUs is 1), and a mode decision process and an inter-frame predictive coding process
with a depth of 1 are performed again on each 32x32 CU according to mode operation
results of the eight modes, and so on, until the CTU is split into 8x8 CUs (a depth
corresponding to the 8x8 CUs is 3), and a mode decision process and an inter-frame
predictive coding process with a depth of 3 are performed again on each 8x8 CU according
to the mode operation results of the eight modes. In this case, inter-frame predictive
coding of the CTU is completed.
[0053] As may be seen from FIG. 1, a maximum depth of the CTU is 3, and the maximum depth
of the CTU refers to a depth corresponding to a minimum CU that is finally included
in the CTU after the inter-frame predictive coding is completed. In FIG. 1, the CTU
is split from 64x64, and when an 8x8 CU is obtained by splitting, a depth corresponding
to the CU is 3, and therefore, a maximum depth of the CTU that includes the 8x8 CU
is 3.
[0054] In addition to a CTU splitting process shown in FIG. 1, if a CTU is not a 64x64 pixel
block, but a pixel block of another size, for example, a 128x128 pixel block, if a
minimum CU that is finally included in the CTU after inter-frame predictive coding
is completed is still an 8x8 CU, a depth corresponding to the 8x8 CU is 4, that is,
a maximum depth of the CTU is 4.
[0055] Regardless of a specific splitting process of the CTU, the maximum depth of the CTU
is a depth corresponding to a minimum CU that is finally included in the CTU after
the inter-frame predictive coding is completed. Using a case shown in FIG. 2 as an
example, first, a mode decision process and an inter-frame predictive coding process
with a depth of 0 are performed on a 128x128 CTU; then the 128x128 CTU is split into
four 64x64 CUs, and assuming that after a mode decision process with a depth of 1
is performed on the four 64x64 CUs separately, it is determined that three 64x64 CUs
of the four 64x64 CUs are not further split, but one remaining CU needs to be further
split, the remaining 64x64 CU is split into four 32x32 CUs; assuming that after a
mode decision process with a depth of 2 is performed on the four 32x32 CUs separately,
it is determined that three 32x32 CUs of the four 32x32 CUs are not further split,
but one remaining CU needs to be further split, the remaining 32x32 CU is split into
four 16x16 CUs; assuming that after a mode decision process with a depth of 3 is performed
on the four 16x16 CUs separately, it is determined that none of the four 16x16 CUs
is further split, the inter-frame predictive coding process of the CTU is completed.
In this case, a minimum CU included in the CTU is a 16x16 CU, and a depth corresponding
to the minimum CU is 3, and therefore, a maximum depth of the CTU is also 3.
[0056] In view of the foregoing conventional inter-frame predictive coding process, an embodiment
of the present invention provides a new inter-frame predictive coding solution to
optimize the foregoing inter-frame predictive coding process. Inter-frame predictive
coding is sequentially performed on frames in multiple groups of pictures by using
a group of pictures (Group of Pictures, GOP) as a unit; when inter-frame predictive
coding is performed on a reference B frame in any group of pictures, a correlation
between the reference B frame and a GPB frame in the same group of pictures is used,
so that a splitting depth of a CTU in the reference B frame does not exceed a maximum
depth of a CTU in a same position in the GPB frame; and when the maximum depth of
the CTU in the same position in the GPB frame is smaller, a quantity of mode decisions
performed on the CTU in the reference B frame may be relatively small, so that an
objective of reducing complexity of an inter-frame predictive coding process of the
reference B frame is achieved.
[0057] A GOP involved in each embodiment of the present invention may be a 4-frame GOP (namely,
a GOP including 4 frames), an 8-frame GOP (namely, a GOP including 8 frames), a 16-frame
GOP (namely, a GOP including 16 frames), or the like, and a quantity of frames included
in the GOP may be user-defined and configured according to a requirement.
[0058] The frames in the GOP include a B frame, and further include a generalized P/B (Generalized
P and B, GPB) frame or a P frame.
[0059] Using a GOP that includes a GPB frame and a B frame as an example, a quantity of
GPB frames included in the GOP may be configured by using a configuration file, and
may be one, or may be more than one. When inter-frame predictive coding is performed
on a frame in a GOP, first, inter-frame predictive coding is performed on a GPB frame.
If a same GOP includes multiple GPB frames, inter-frame predictive coding may be performed
on one GPB frame first, and then inter-frame predictive coding may be performed on
other GPB frames, or inter-frame predictive coding may not be performed on other GPB
frames immediately, but instead, inter-frame predictive coding is performed on a B
frame in the same GOP. In the embodiments of the present invention, after inter-frame
predictive coding is performed on a first GPB frame, an order of performing inter-frame
predictive coding on other frames is not limited.
[0060] A case in which a GOP includes a P frame and a B frame is similar to a case in which
a GOP includes a GPB frame and a B frame, and is not further described herein.
[0061] Before a GOP is read, multiple B frames in the GOP are classified into reference
B frames and non-reference B frames, where the reference B frames are classified according
to configuration information in a configuration file, and the reference B frames may
be used as reference frames for the non-reference B frames. After the reference B
frames are obtained by means of classification, Flag values in the reference B frames
may be set to 1, so that after reading a GOP, a coder distinguishes a reference B
frame from a non-reference B frame in B frames according to Flag values in the B frames.
[0062] In the following, the solution of the present invention is described in detail by
using a specific embodiment, and certainly, the present invention is not limited to
the following embodiment.
[0063] Because a GOP may include a GPB frame or may include a P frame, but regardless of
whether the GOP includes a GPB frame or a P frame, inter-frame predictive coding manners
of the GPB frame and the P frame are similar, the following embodiments are described
by using a GOP that includes a GPB frame, a reference B frame, and a non-reference
B frame as an example.
Embodiment 1
[0064] As shown in FIG. 3(a), FIG. 3(a) is a schematic diagram of steps of an inter-frame
predictive coding method in Embodiment 1 of the present invention, and the method
includes the following steps:
Step 101: Read a GOP.
Step 102: For any CTU in a to-be-coded reference B frame in the read GOP, sequentially
execute the following steps.
In step 102, the reference B frame in the GOP may be determined by identifying a Flag
value in a B frame.
Step 103: Determine whether a CTU of which inter-frame predictive coding is not performed
exists in the to-be-coded reference B frame; if a CTU of which inter-frame predictive
coding is not performed exists in the to-be-coded reference B frame, execute step
104; if a CTU of which inter-frame predictive coding is not performed does not exist
in the to-be-coded reference B frame, execute step 106.
Step 104: Determine a CTU from a GPB frame that is the closest to the to-be-coded
reference B frame in the current GOP and of which inter-frame predictive coding is
completed, and determine a first maximum depth of the CTU.
[0065] The CTU determined from the GPB frame and the CTU in the to-be-coded reference B
frame are in a same position in their respective frames.
[0066] In the solution of Embodiment 1, if a GOP includes only one GPB frame, inter-frame
predictive coding needs to be performed on the GPB frame first. Therefore, in step
103, a CTU and a first maximum depth of the CTU may be determined from the GPB frame.
If a GOP includes multiple GPB frames, in step 103, if at least one GPB frame of which
inter-frame predictive coding is completed exists in the same GOP, a GPB frame that
is the closest to a to-be-coded reference B frame may be determined from the at least
one GPB frame, and then a CTU and a first maximum depth of the CTU are determined
from the determined GPB frame.
Step 105: When inter-frame predictive coding is performed on the CTU in the to-be-coded
reference B frame, that a splitting depth of the CTU does not exceed the first maximum
depth, and after the inter-frame predictive coding of the CTU is completed, go to
step 103.
[0067] Assuming that the first maximum depth is 2 and the CTU in the to-be-coded reference
B frame is a 64x64 pixel block, when inter-frame predictive coding is performed on
the CTU in the to-be-coded reference B frame, first, a mode decision is performed
on the 64x64 CTU, inter-frame predictive coding is performed on the 64x64 CTU in a
mode with a minimum cost value according to a mode decision result, and whether the
64x64 CTU needs to be further split is determined. An optional determining manner
is as follows: After the mode decision is performed on the 64x64 CTU, whether the
mode with the minimum cost value is a SKIP mode is determined; if it is determined
that the mode with the minimum cost value is the SKIP mode, the 64x64 CTU may not
be further split, and an inter-frame predictive coding process of the CTU is completed,
and in this case, a maximum depth of the CTU is 0; if it is determined that the mode
with the minimum cost value is not the SKIP mode, the CTU needs to be split into four
32x32 CUs, and after a mode decision and inter-frame predictive coding are performed
on each 32x32 CU, whether to perform further splitting is determined in the foregoing
determining manner, and so on. However, for a 16x16 CU (in this case, a depth corresponding
to the CU is 2), after the mode decision and inter-frame predictive coding are completed,
whether to perform further splitting does not need to be determined, and splitting
of the CTU is terminated directly.
[0068] Optionally, when a mode decision is performed on a CU with each depth (including
a CTU with a depth of 0), several mode operation processes may be skipped in some
cases. For example, when a mode decision is performed on a 64x64 CTU, first, a mode
operation of the SKIP mode is performed; if a cost value obtained after the mode operation
of the SKIP mode is less than 1.5 times of an average cost value, when further mode
operations are performed on the 64x64 CTU, mode operations of an inter-frame 2Nx2N
mode, an inter-frame NxN mode, an intra-frame 2Nx2N mode, and an intra-frame NxN mode
may be skipped (that is, when the mode decision is performed, the mode operations
of the inter-frame 2Nx2N mode, the inter-frame NxN mode, the intra-frame 2Nx2N mode,
and the intra-frame NxN mode are not performed), so that an objective of reducing
a quantity of mode operations is achieved. In a frame being coded in which CTUs of
which inter-frame predictive coding is performed are located, when mode decisions
with a depth of 0 are performed on CTUs of which inter-frame predictive coding is
completed, if modes with minimum cost values are the SKIP mode, the average cost value
is an average value of these minimum cost values.
[0069] By using the solution of step 101 to step 105, an objective of optimizing inter-frame
predictive coding of the reference B frame may be achieved, and complexity of an inter-frame
predictive coding process of the reference B frame is reduced, that is, complexity
of an entire HEVC coding process is reduced.
[0070] Preferably, in addition to the optimization of the inter-frame predictive coding
of the reference B frame, inter-frame predictive coding of a non-reference B frame
in the GOP may also be optimized. In the optimization of the inter-frame predictive
coding of the non-reference B frame, reference needs to be made to an inter-frame
predictive coding result of a reference B frame that is highly correlated with the
non-reference B frame. Therefore, after the inter-frame predictive coding of the reference
B frame is completed in step 103 to step 105, the following steps of performing inter-frame
predictive coding on the non-reference B frame may be further included.
Step 106: For any CTU in a to-be-coded non-reference B frame in the read GOP, sequentially
execute the following steps.
Step 107: Determine whether a CTU of which inter-frame predictive coding is not performed
exists in the to-be-coded non-reference B frame; if a CTU of which inter-frame predictive
coding is not performed exists in the to-be-coded non-reference B frame, execute step
108; if a CTU of which inter-frame predictive coding is not performed does not exist
in the to-be-coded non-reference B frame, when inter-frame predictive coding of all
frames in the currently read GOP is completed, continue to read a next GOP, or when
a frame of which inter-frame predictive coding is not completed exists in the currently
read GOP, continue to perform inter-frame predictive coding according to the solution
of Embodiment 1.
Step 108: Determine a CTU from a reference B frame that is the closest to the to-be-coded
non-reference B frame in the current GOP and of which inter-frame predictive coding
is completed, and determine a second maximum depth of the CTU.
[0071] The CTU determined from the reference B frame and the CTU in the to-be-coded non-reference
B frame are in a same position in their respective frames.
Step 109: When inter-frame predictive coding is performed on the CTU in the to-be-coded
non-reference B frame, that a splitting depth of the CTU does not exceed the second
maximum depth, and after the inter-frame predictive coding of the CTU is completed,
go to step 107.
[0072] By using the solution of step 106 to step 109, an objective of optimizing the inter-frame
predictive coding of the non-reference B frame may be achieved, and complexity of
an inter-frame predictive coding process of the non-reference B frame is reduced,
and the complexity of the entire HEVC coding process is further reduced.
[0073] Preferably, in the solution of Embodiment 1 of the present invention, inter-frame
predictive coding of a GPB frame in the GOP may also be optimized. If there is only
one GPB frame in the GOP, a to-be-coded GPB frame should be a first frame on which
inter-frame predictive coding is performed, that is, inter-frame predictive coding
is performed after step 101 and before step 102. If there are multiple GPB frames
in the GOP, one of the GPB frames should be a first frame on which inter-frame predictive
coding is performed, and an order of performing inter-frame predictive coding on other
GPB frames may be determined according to a configuration of a configuration file.
In Embodiment 1 of the present invention, a case in which a to-be-coded GPB frame
is not a first frame on which inter-frame predictive coding is performed and a case
in which a to-be-coded GPB frame is a first frame on which inter-frame predictive
coding is performed in a GOP are described separately.
- 1. Assuming that a to-be-coded GPB frame is not a first frame on which inter-frame
predictive coding is performed in a GOP, that is, a GPB frame of which inter-frame
predictive coding is completed exists in the current GOP, an inter-frame predictive
coding process of the to-be-coded GPB frame is shown in FIG. 3(b), and includes the
following steps:
Step A1: Determine a to-be-coded GPB frame; determine whether a CTU of which inter-frame
predictive coding is not performed exists in the to-be-coded GPB frame; if a CTU of
which inter-frame predictive coding is not performed exists in the to-be-coded GPB
frame, execute step A2; if a CTU of which inter-frame predictive coding is not performed
does not exist in the to-be-coded GPB frame, execute step 102.
It should be noted that, because the to-be-coded GPB frame is not the first GPB frame
in the GOP, the to-be-coded GPB frame may be coded after the first GPB frame, or may
be coded after a reference B frame or a non-reference B frame. An order of coding
a non-first GPB frame is not limited in Embodiment 1 of the present invention.
In addition, after the inter-frame predictive coding of the non-first GPB frame is
completed, if a frame of which inter-frame predictive coding is not performed still
exists in the current GOP, inter-frame predictive coding of the frame may continue
to be performed on the frame according to the solution of Embodiment 1 of the present
invention. Step A1 is described by using an example in which inter-frame predictive
coding is performed on a reference B frame after inter-frame predictive coding of
a non-first GPB frame is completed. After the inter-frame predictive coding of the
non-first GPB frame is completed, if inter-frame predictive coding of all frames in
the current GOP is completed, a next GOP may continue to be read.
Step A2: Determine a CTU and a third maximum depth of the CTU from a GPB frame that
is in the current GOP and of which inter-frame predictive coding is completed.
Assuming that before inter-frame predictive coding is performed on the to-be-coded
GPB frame, at least one GPB frame of which inter-frame predictive coding is completed
exists in the same GOP, in step A2, a CTU and a third maximum depth of the CTU are
determined from any GPB frame in the at least one GPB frame. Optionally, a CTU of
a first GPB frame and a third maximum depth of the CTU may be determined from GPB
frames of which inter-frame predictive coding is completed.
Step A3: When inter-frame predictive coding is performed on the CTU in the to-be-coded
GPB frame, that a splitting depth of the CTU does not exceed the third maximum depth,
and after the inter-frame predictive coding of the CTU is completed, go to step A1.
- 2. Assuming that a to-be-coded GPB frame is a first to-be-coded frame in a GOP, that
is, no GPB frame of which inter-frame predictive coding is completed exists in the
current GOP, an inter-frame predictive coding process of the to-be-coded GPB frame
is shown in FIG. 3(c), and includes the following steps:
Step B1: Determine a to-be-coded GPB frame; determine whether a CTU of which inter-frame
predictive coding is not performed exists in the to-be-coded GPB frame; if yes, execute
step B2; otherwise, execute step 102.
It should be noted that, because the to-be-coded GPB frame is a first frame on which
an inter-frame predictive coding operation is performed in the GOP, after the inter-frame
predictive coding of the to-be-coded GPB frame is completed, inter-frame predictive
coding may be performed on a reference B frame; if a GPB frame of which inter-frame
predictive coding is not performed still exists in the GOP, after the inter-frame
predictive coding of the to-be-coded GPB frame is completed, an inter-frame predictive
coding operation may be performed on other GPB frames in the GOP. Step B1 is described
by using an example in which inter-frame predictive coding is performed on a reference
B frame.
Step B2: Determine a CTU and a fourth maximum depth of the CTU from a GPB frame in
a previous GOP.
Preferably, if there are multiple GPB frames in the previous GOP, the CTU determined
in step B2 is a CTU in a first GPB frame in the previous GOP. A reason for doing this
is as follows: When a coder reads a previous GOP, a finally read frame is a GPB frame,
but when inter-frame predictive coding is performed, a finally read GPB frame is a
first frame on which inter-frame predictive coding is performed. When inter-frame
predictive coding is performed on the to-be-coded GPB frame in the currently read
GOP, viewed from an order of frames in a video stream, in the previous GOP, a GPB
frame that is the closest to the to-be-coded GPB frame is the finally read GPB frame
in the previous GOP (namely, the first GPB frame on which inter-frame predictive coding
is performed in the previous GOP). Therefore, when inter-frame predictive coding is
performed on the CTU in the to-be-coded GPB frame, reference is made to a CTU in a
same position in the first GPB frame on which inter-frame predictive coding is performed
and that has a highest correlation in the previous GOP.
Step B3: When inter-frame predictive coding is performed on the CTU in the to-be-coded
GPB frame, that a splitting depth of the CTU does not exceed the fourth maximum depth,
and after the inter-frame predictive coding of the CTU is completed, go to step B1.
[0074] By using the solutions of step A1 to step A3 and step B1 to step B3, an objective
of optimizing the inter-frame predictive coding of the GPB frame may be achieved,
and complexity of an inter-frame predictive coding process of the GPB frame is reduced,
and the complexity of the entire HEVC coding process is further reduced.
[0075] In addition, if the GOP includes a P frame other than a GPB frame, a process of optimizing
inter-frame predictive coding of the P frame is also as shown in the solutions of
step A1 to step A3 and step B1 to step B3, and is specifically:
if a P frame of which inter-frame predictive coding is completed exists in the current
group of pictures, for any CTU in a to-be-coded P frame in the current group of pictures,
determining a fifth maximum depth of a CTU from the P frame of which inter-frame predictive
coding is completed, where the determined CTU and the CTU in the to-be-coded P frame
are in a same position in their respective frames; and when inter-frame predictive
coding is performed on the CTU in the to-be-coded P frame, that a splitting depth
of the CTU does not exceed the fifth maximum depth; or
if no P frame of which inter-frame predictive coding is completed exists in the current
group of pictures, for any CTU in a to-be-coded P frame in the current group of pictures,
determining a sixth maximum depth of a CTU from a P frame in the previous group of
pictures, where the determined CTU and the CTU in the to-be-coded P frame in the current
group of pictures are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded P frame, that a splitting
depth of the CTU does not exceed the sixth maximum depth.
[0076] It should be noted that the first maximum depth, the second maximum depth, the third
maximum depth, the fourth maximum depth, the fifth maximum depth, and the sixth maximum
depth in Embodiment 1 of the present invention do not have a necessarily same or different
association relationship, and that "the first" to "the sixth" are used to distinguish
between maximum depths of different CTUs.
[0077] In the solution of Embodiment 1 of the present invention, when inter-frame predictive
coding is performed on a GPB frame, a correlation with a first GPB frame in a same
GOP or a GPB frame in a previous GOP is used; when inter-frame predictive coding is
performed on a reference B frame, a correlation with a GPB frame in a same GOP is
used; when inter-frame predictive coding is performed on a non-reference B frame,
a correlation with a reference B frame in a same GOP is used. The inter-frame predictive
coding optimized by using the solution of Embodiment 1 of the present invention, in
comparison with conventional inter-frame predictive coding performed on a frame in
an HM manner of HEVC, may shorten a coding time by 57.36% based on the following emulation
conditions in a case in which an overall performance loss is 0.3%.
[0078] The emulation conditions are: five GOPs including frames whose resolutions are 1080p,
four GOPs including frames whose resolutions are WVGA (800*480), four GOPs including
frames whose resolutions are WQVGA (480*272), four GOPs including frames whose resolutions
are 720p, four GOPs including frames whose resolutions are 4CIF (704*576), and four
GOPs including frames whose resolutions are QVGA (240*320). These 25 GOPs are coded
by using the inter-frame predictive coding method in Embodiment 1 of the present invention,
and inter-frame predictive coding is performed by using the HM manner of HEVC.
[0079] In the following, the solution of Embodiment 1 of the present invention is described
in detail by using a specific embodiment.
Embodiment 2
[0080] Assuming that in Embodiment 2 of the present invention, inter-frame predictive coding
is performed on frames in three 4-frame GOPs, where each GOP includes one GPB frame,
one reference B frame, and two non-reference B frames, before inter-frame predictive
coding is performed, first, an I frame is coded, and then each GOP is read sequentially,
and inter-frame predictive coding is performed on frames in the read GOP. A specific
process is as follows:
Step 1: Read a first GOP.
Step 2: Perform coding on a GPB frame in the first GOP, where a specific coding mode
is as follows:
Inter-frame predictive coding is performed sequentially on each CTU in the GPB frame.
A CTU (which may be called a CTU_GPB frame_first GOP) in the GPB frame is used as an example for description. An inter-frame predictive
coding manner of another CTU in the GPB frame is the same as processing of the CTU_GPB frame_first GOP·
[0081] Using a CTU
_GPB frame_first GOP that is a 64x64 pixel block as an example, first, by using a relatively complex sum
of absolute transformed differences (Sum of Absolute Transformed Difference, SATD)
algorithm, mode operations of eight modes are performed on the CTU
_GPB frame_first GOP whose pixel block is 64x64, and a mode decision is performed by using cost values
of mode operation results, and further, inter-frame predictive coding is performed
on the 64x64 CTU
_GPB frame_first GOP in a mode determined according to a decision result. Then, the 64x64 CTU
_GPB frame_first GOP is split into four 32x32 CUs, and a mode decision and inter-frame predictive coding
are performed in the foregoing manner, and so on, until the inter-frame predictive
coding of the CTU
_GPB frame_first GOP is completed.
[0082] Preferably, when mode decisions with depths of 0 to (a preset maximum depth minus
1) are performed on the CTU
_GPB frame_first GOP, mode operations of an inter-frame Nx2N mode and an inter-frame 2NxN mode may be
skipped, and mode decisions are performed by using remaining modes; when a mode decision
with a depth of the preset maximum depth is performed on the CTU
_GPB frame_first GOP, mode operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode are not
skipped. An objective of doing this is as follows: When the mode decisions with the
depths of 0 to (the preset maximum depth minus 1) are performed on the CTU
_GPB frame_first GOP, even if the mode operations of the inter-frame Nx2N mode and the inter-frame 2NxN
mode are skipped, a frame performance loss is not great, but complexity of the inter-frame
predictive coding of the CTU
_GPB frame_first GOP may be reduced effectively; however, when the mode decision with the depth of the
preset maximum depth is performed on the CTU
_GPB frame_first GOP, if the mode operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode
are skipped, a problem of an excessive picture detail loss is caused, and therefore
those mode operations are preferably not skipped.
[0083] The preset maximum depth may be configured by a coder, for example, the preset maximum
depth is configured to 3; or it may be a maximum depth that is calculated by a coder
according to a size of a configured CTU. For example, if the configured CTU is a 64x64
pixel block, when an 8x8 CU is obtained by splitting the CTU, a depth corresponding
to the CU is 3, and in this case, a maximum depth preset for the CTU is 3. For another
example, if the configured CTU is a 128x128 pixel block, when an 8x8 CU is obtained
by splitting the CTU, a depth corresponding to the CU is 4, and in this case, a maximum
depth preset for the CTU is 4.
[0084] Because the frame on which inter-frame predictive coding is performed in step 2 is
a first GPB frame in the first GOP, and no previous frame may be used as a reference
frame for the GPB frame, inter-frame predictive coding may be performed on the GPB
frame in the first GOP in a conventional manner.
Step 3: Perform coding on a reference B frame in the first GOP, where a specific coding
manner is as follows:
[0085] Inter-frame predictive coding is performed on each CTU in the reference B frame.
A CTU (which may be called a CTU_
reference B frame) in the reference B frame is used as an example for description. An inter-frame predictive
coding manner of another CTU in the reference B frame is the same as processing of
the CTU
_reference B frame.
- (1) Determine a CTU from a GPB frame in the first GOP according to a position of a
CTU_reference B frame in a reference B frame, where the CTU is called a CTU_GPB frame_first GOP, and the determined CTU_GPB frame_first GOP and the CTU_reference B frame are in a same position in their respective frames.
- (2) Determine a maximum depth d1 of the CTU_GPB frame_first GOP.
The maximum depth d1 of the CTU_GPB frame_first GOP may be determined after inter-frame predictive coding is performed on the CTU_GPB frame_first GOP in step 2.
- (3) When inter-frame predictive coding is performed on the CTU_reference B frame, perform a mode operation with each depth by using a simple sum of absolute differences
(Sum of Absolute Difference, SAD) algorithm, perform a mode decision by using a cost
value of a mode operation result, and perform inter-frame predictive coding, where
a splitting depth of the CTU_reterenfe B frame does not exceed the maximum depth d1.
[0086] For example, if the maximum depth d1 is 2, and the CTU
_reference B frame is a 64x64 pixel block, when inter-frame predictive coding is performed on the CTU
_reference B frame, first, a mode decision and inter-frame predictive coding are performed on the 64x64
CTU
_reference B frame; then four 32x32 CUs are obtained by splitting the CTU
_reference B frame, and a mode decision and inter-frame predictive coding are performed on the 32x32
CUs separately; and then the 32x32 CU is further split, and a mode decision and inter-frame
predictive coding are performed on each 16x16 CU that is obtained by splitting. In
this case, a minimum CU in the CTU
_reference B frame is a 16x16 CU, and a depth corresponding to the 16x16 CU reaches 2, which is equal
to the maximum depth d1. Therefore, the 16x16 CU is not further split, and the inter-frame
predictive coding process of the CTU
_reference B frame is completed.
[0087] Certainly, in the foregoing mode decision process in each step, if it is determined
that a mode with a minimum cost value is a SKIP mode, even if a 16x16 CU is not obtained
by splitting, further splitting may not be performed, and the inter-frame predictive
coding process of the CTU_
reference B frame is completed.
[0088] By making reference to a correlation between a reference B frame and a GPB frame
in a same GOP, when inter-frame predictive coding is performed on a CTU in the reference
B frame, a quantity of mode decisions may be reduced, and complexity of an inter-frame
predictive coding process is reduced.
[0089] Preferably, if the maximum depth d1 is equal to the preset maximum depth, when inter-frame
predictive coding is performed on the CTU
_reference B frame, a mode decision process with a depth of 0 may be skipped, that is, a mode decision
and inter-frame predictive coding are not performed on the 64x64 CTU
_reference B frame, but instead, the 64x64 CTU
_reference B frame is first split into four 32x32 CUs. An advantage of doing this is as follows: Because
the maximum splitting depth d1 of the CTU
_GPB frame_first GOP is equal to the preset maximum depth, a maximum splitting depth of a CTU
_reterenfe B frame highly correlated with the CTU
_GPB frame_first GOP is also great, for example, equal to the preset maximum depth or equal to (the preset
maximum depth minus 1). In this case, even if the mode decision process with the depth
of 0 is skipped, little influence is caused to performance of the reference B frame,
and complexity of an inter-frame predictive coding process may be reduced effectively.
[0090] Preferably, when inter-frame predictive coding is performed on the CTU
_reference B frame, for a CTU
_reference B frame with any depth, when a mode decision is performed, mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode may be skipped, and a mode decision is performed
by using the remaining modes. An advantage of doing this is as follows: Because B
frames (including a reference B frame and a non-reference B frame) are highly tolerable
to a performance loss, to reduce complexity of inter-frame predictive coding as much
as possible, the mode operations of the inter-frame Nx2N mode and the inter-frame
2NxN mode may be skipped.
Step 4: Perform coding on a non-reference B frame in the first GOP, where a specific
coding manner is as follows:
[0091] Inter-frame predictive coding is performed on each CTU in the non-reference B frame.
A CTU (which may be called a CTU
_non-reference B frame) in the non-reference B frame is used as an example for description. An inter-frame
predictive coding manner of another CU in the non-reference B frame is the same as
processing of the CTU
_non-reference B frame.
- (1) According to a position of a CTU_non-reference B frame in a non-reference B frame determine a CTU that is in a same position in a reference
B frame in the first GOP as the CTU_non-reference B frame, assuming that the CTU is a CTU_reference B frame.
- (2) Determine a maximum depth d2 of the CTU_reference B frame.
The maximum depth d2 of the CTU_reference B frame may be determined when inter-frame predictive coding is performed on the reference
B frame in step 3.
- (3) When inter-frame predictive coding is performed on the CTU_non-reference B frame, perform a mode operation with each depth by using a SAD algorithm, perform a mode
decision by using a cost value of a mode operation result, and perform inter-frame
predictive coding, where a splitting depth of the CTU_non-reference B frame does not exceed the maximum depth d2.
[0092] Preferably, if the maximum depth d2 is equal to the preset maximum depth or equal
to (the preset maximum depth minus 1), when inter-frame predictive coding is performed
on the CTU
_non-reference B frame, a mode decision process with a depth of 0 may be skipped. An advantage of doing
this is as follows: Because the maximum depth d2 of the CTU
_reference B frame is equal to the preset maximum depth or equal to (the preset maximum depth minus
1), a maximum depth of a CTU
_non-reference B frame highly correlated with the CTU
_reference B frame is also great, for example, equal to the preset maximum depth or equal to (the preset
maximum depth minus 1). In this case, even if the mode decision with the depth of
0 is skipped, little influence is caused to performance of the non-reference B frame,
and complexity of an inter-frame predictive coding process may be reduced effectively.
[0093] In addition, in step 3, the mode decision process of the CTU
_reference B frame with the depth of 0 is skipped only when the maximum depth d1 is equal to the preset
maximum depth; however, in step 4, the mode decision process of the CTU
_non-reference B frame with the depth of 0 may be skipped when the maximum depth d2 is equal to the preset
maximum depth or equal to (the preset maximum depth minus 1). Because the CTU
_reference B frame is a reference CTU for the CTU
_non-reference B frame in the same GOP, a coding requirement on the CTU
_reference B frame is higher than that on the CTU
_non-reference B frame. When the maximum depth d1 is equal to the preset maximum depth, even if the mode
decision process of the CTU
_reference B frame with the depth of 0 is skipped, little influence is caused to the performance of
the reference B frame. However, when the maximum depth d1 is equal to the preset maximum
depth minus 1, if the mode decision of the CTU
_reference B frame with the depth of 0 is still skipped, particular influence may be caused to the performance
of the reference B frame, and further, influence is caused to a subsequent inter-frame
coding process of the CTU
_non-reference B frame. However, the CTU
_non-reference B frame may not become a reference CTU for other CTUs. Therefore, even if the maximum depth
d2 is equal to the preset maximum depth minus 1, the mode decision with the depth
of 0 may also be skipped in an inter-frame predictive coding process of the CTU
_non-reference B frame.
Step 5: After the coding of each frame in the first GOP is completed, read a second
GOP.
Step 6: Perform coding on a GPB frame in the second GOP, where a specific coding mode
is as follows:
- (1) According to a position of a CTU (which is called a CTU_GPB frame_second GOP) in a GPB frame in the second GOP, determine a CTU_GPB frame_first GOP that is in a same position in a GPB frame in the first GOP as the CTU_GPB frame_second GOP.
- (2) Determine a maximum depth d3 of the CTU_GPB frame_first GOP.
The maximum depth d3 of the CTU_GPB frame_first GOP may be determined when inter-frame predictive coding is performed on the GPB frame
in the first GOP in step 2.
It should be noted that reference is made to the GPB frame in the first GOP when inter-frame
predictive coding is performed on the GPB frame in the second GOP, and that reference
is also made to the GPB frame in the first GOP when inter-frame predictive coding
is performed on the reference B frame in the first GOP. Therefore, the maximum depth
d1 and the maximum depth d3 in this embodiment are the same.
- (3) When inter-frame predictive coding is performed on the CTU_GPB frame_first GOP, perform a mode operation with each depth by using a SAD algorithm, perform a mode
decision by using a cost value of a mode operation result, and perform inter-frame
predictive coding, where a maximum depth of the CTU_GPB frame_first GOP does not exceed the maximum depth d3.
[0094] Preferably, if the maximum depth d3 is equal to the preset maximum depth, when inter-frame
predictive coding is performed on the CTU
_GPB frame_first GOP, a mode decision process with a depth of 0 may be skipped. An advantage of doing
this is as follows: When the maximum depth d3 of the CTU
_GPB frame_first GOP is equal to the preset maximum depth, a maximum depth of a CTU
_GPB frame_first GOP highly correlated with the CTU
_GPB frame_first GOP is also great, for example, equal to the preset maximum depth or equal to (the preset
maximum depth minus 1). In this case, even if the mode decision process with the depth
of 0 is skipped, little influence is caused to performance of the GPB frame in the
second GOP, and complexity of an inter-frame predictive coding process may be reduced
effectively.
[0095] Preferably, when inter-frame predictive coding is performed on the CTU
_GPB frame_second GOP, in a mode decision process of the CTU
_GPB frame_second GOP with depths of 0 to (the preset maximum depth minus 1), mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode may be skipped; in a mode decision process
of the CTU
_GPB frame_first GOP with the depth of the preset maximum depth, mode operations of the inter-frame Nx2N
mode and the inter-frame 2NxN mode are not skipped. An advantage of doing this is
as follows: In the mode decision process with the depths of 0 to (the preset maximum
depth minus 1), even if mode operations of the inter-frame Nx2N mode and the inter-frame
2NxN mode are skipped, a performance loss of the GPB frame is not great, but complexity
of inter-frame predictive coding may be reduced effectively. However, in the mode
decision process of the CTU
_GPB frame_first GOP with the depth of the preset maximum depth, if mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode are skipped, a problem of an excessive detail
loss of the GPB frame is caused, and therefore those mode operations are preferably
not skipped.
[0096] Then, inter-frame predictive coding continues to be performed on a reference B frame
and a non-reference B frame in the second GOP according to the same manners in step
3 and step 4. Then, a third GOP may be read, and processed according to the inter-frame
predictive coding manner of each frame in the second GOP.
[0097] In Embodiment 2, the solution of the present invention is described by using three
GOPs as an example. In a case in which there are n (n is greater than 3) GOPs, processing
is the same as processing of the three GOPs, and is not further described herein.
[0098] On a basis of Embodiment 1, further optimization is made in the solution of Embodiment
2 of the present invention: When inter-frame predictive coding is performed on a GPB
frame, in mode decisions with depths of 0 to (a preset maximum depth minus 1) that
are performed on a CTU in the GPB frame by using an SATD algorithm, mode operations
of an inter-frame Nx2N mode and an inter-frame 2NxN mode are skipped; in a mode decision
of the CTU with a depth of the preset maximum depth, mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode are not skipped; when a depth of a CTU in
a reference GPB frame is equal to the preset maximum depth, a mode decision process
with a depth of 0 is skipped. When inter-frame predictive coding is performed on a
reference B frame, in mode decisions with all depths that are performed on a CTU in
the reference B frame by using the SAD algorithm, mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode are skipped; when a depth of the CTU in the
reference GPB frame is equal to the preset maximum depth, a mode decision process
with a depth of 0 is skipped. When inter-frame predictive coding is performed on a
non-reference B frame, in mode decisions with all depths that are performed on a CTU
in the non-reference B frame by using the SAD algorithm, mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode are skipped; when a maximum depth of the CTU
in the reference B frame is equal to the preset maximum depth or equal to (the preset
maximum depth minus 1), a mode decision process with a depth of 0 is skipped.
[0099] The inter-frame predictive coding optimized by using the solution of Embodiment 2
of the present invention, in comparison with conventional inter-frame predictive coding
performed in an HM manner of HEVC, may shorten a coding time by 77.27% based on the
emulation conditions involved in Embodiment 1 in a case in which an overall performance
loss is 3.1 %.
Embodiment 3
[0100] In Embodiment 3 of the present invention, a coder pertaining to a same invention
conception as Embodiment 1 and Embodiment 2 is described. As shown in FIG. 4, the
coder includes a group of pictures reading module 11 and a coding module 12, where:
the group of pictures reading module 11 is configured to sequentially read groups
of pictures; and
the coding module 12 is configured to perform the following inter-frame predictive
coding on frames in any group of pictures:
for any CTU in a to-be-coded reference B frame in a current group of pictures, determining
a first maximum depth of a CTU from a GPB frame or P frame that is the closest to
the to-be-coded reference B frame in the current group of pictures and of which inter-frame
predictive coding is completed, where the determined CTU and the CTU in the to-be-coded
reference B frame are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded reference B frame, that
a splitting depth of the CTU does not exceed the first maximum depth.
[0101] Further, the coding module 12 is further configured to: if the first maximum depth
is equal to a preset maximum depth, skip a mode decision process with a depth of 0
when inter-frame predictive coding is performed on the CTU in the to-be-coded reference
B frame; because a quantity of decisions performed on the reference B frame is reduced,
an inter-frame predictive coding process of the reference B frame may be simplified,
and an inter-frame predictive coding time is shortened.
[0102] Further, the coding module 12 is further configured to: when inter-frame predictive
coding is performed on the CTU in the to-be-coded reference B frame, in a mode decision
process of the CTU with any depth, skip mode operations of an inter-frame Nx2N mode
and an inter-frame 2NxN mode, and perform mode operations of other modes by using
a sum of absolute differences SAD algorithm; because mode operations of the reference
B frame are reduced, the inter-frame predictive coding process of the reference B
frame may be simplified, and the inter-frame predictive coding time is shortened.
[0103] Further, the coding module 12 is further configured to: for any CTU in a to-be-coded
non-reference B frame in the current group of pictures, determine a second maximum
depth of a CTU from a reference B frame that is the closest to the to-be-coded non-reference
B frame in the current group of pictures and of which inter-frame predictive coding
is completed, where the determined CTU and the CTU in the to-be-coded non-reference
B frame are in a same position in their respective frames; and
when inter-frame predictive coding is performed on the CTU in the to-be-coded non-reference
B frame, that a splitting depth of the CTU does not exceed the second maximum depth.
[0104] Further, the coding module 12 is further configured to: if the second maximum depth
is equal to the preset maximum depth or the preset maximum depth minus 1, skip a mode
decision process with a depth of 0 when inter-frame predictive coding is performed
on the CTU in the to-be-coded non-reference B frame; because a quantity of decisions
performed on the non-reference B frame is reduced, an inter-frame predictive coding
process of the non-reference B frame may be simplified, and an inter-frame predictive
coding time is shortened.
[0105] Further, the coding module 12 is configured to: when inter-frame predictive coding
is performed on the CTU in the to-be-coded non-reference B frame, in a mode decision
process of the CTU with any depth, skip mode operations of the inter-frame Nx2N mode
and the inter-frame 2NxN mode, and perform mode operations of other modes by using
the SAD algorithm; because mode operations of the non-reference B frame are reduced,
the inter-frame predictive coding process of the non-reference B frame may be simplified,
and the inter-frame predictive coding time is shortened.
[0106] Further, the coding module 12 is further configured to: if a GPB frame of which inter-frame
predictive coding is completed exists in the current group of pictures, for any CTU
in a to-be-coded GPB frame in the current group of pictures, determine a third maximum
depth of a CTU from the GPB frame of which inter-frame predictive coding is completed,
where the determined CTU and the CTU in the to-be-coded GPB frame are in a same position
in their respective frames; and when inter-frame predictive coding is performed on
the CTU in the to-be-coded GPB frame, that a splitting depth of the CTU does not exceed
the third maximum depth; or
if no GPB frame of which inter-frame predictive coding is completed exists in the
current group of pictures, for any CTU in a to-be-coded GPB frame in the current group
of pictures, determine a fourth maximum depth of a CTU from a GPB frame in a previous
group of pictures, where the determined CTU and the CTU in the to-be-coded GPB frame
in the current group of pictures are in a same position in their respective frames;
and when inter-frame predictive coding is performed on the CTU in the to-be-coded
GPB frame, that a splitting depth of the CTU does not exceed the fourth maximum depth.
[0107] Further, the coding module 12 is further configured to: if the third maximum depth
or the fourth maximum depth is equal to the preset maximum depth, skip a mode decision
process with a depth of 0 when inter-frame predictive coding is performed on the CTU
in the to-be-coded GPB frame; because a quantity of decisions performed on the GPB
frame is reduced, an inter-frame predictive coding process of the GPB frame may be
simplified, and an inter-frame predictive coding time is shortened.
[0108] Further, the coding module 12 is further configured to: when inter-frame predictive
coding is performed on the CTU in the to-be-coded GPB frame, in mode decisions of
the CTU with depths of 0 to the preset maximum depth minus 1, skip mode operations
of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform a mode operation
on the CTU by using a sum of absolute transformed differences SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skip mode
operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform
a mode operation on the CTU by using an SATD algorithm; because mode operations of
the GPB frame are reduced, the inter-frame predictive coding process of the GPB frame
may be simplified, and the inter-frame predictive coding time is shortened.
[0109] Further, the coding module 12 is further configured to: if a P frame of which inter-frame
predictive coding is completed exists in the current group of pictures, for any CTU
in a to-be-coded P frame in the current group of pictures, determine a fifth maximum
depth of a CTU from the P frame of which inter-frame predictive coding is completed,
where the determined CTU and the CTU in the P frame are in a same position in their
respective frames; and when inter-frame predictive coding is performed on the CTU
in the to-be-coded P frame, that a splitting depth of the CTU does not exceed the
fifth maximum depth; or
if no P frame of which inter-frame predictive coding is completed exists in the current
group of pictures, for any CTU in a to-be-coded P frame in the current group of pictures,
determine a sixth maximum depth of a CTU from a P frame in a previous group of pictures,
where the determined CTU and the CTU in the to-be-coded P frame in the current group
of pictures are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded P frame, that a splitting
depth of the CTU does not exceed the sixth maximum depth.
[0110] Further, the coding module 12 is further configured to: if the fifth maximum depth
or the sixth maximum depth is equal to the preset maximum depth, skip a mode decision
process with a depth of 0 when inter-frame predictive coding is performed on the CTU
in the to-be-coded P frame; because a quantity of decisions performed on the P frame
is reduced, an inter-frame predictive coding process of the P frame may be simplified,
and an inter-frame predictive coding time is shortened.
[0111] Further, the coding module 12 is further configured to: when inter-frame predictive
coding is performed on the CTU in the to-be-coded P frame, in mode decisions of the
CTU with depths of 0 to the preset maximum depth minus 1, skip mode operations of
the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform a mode operation
on the CTU by using an SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skip mode
operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform
a mode operation on the CTU by using an SATD algorithm; because mode operations of
the P frame are reduced, the inter-frame predictive coding process of the P frame
may be simplified, and the inter-frame predictive coding time is shortened.
Embodiment 4
[0112] In Embodiment 4 of the present invention, another coder pertaining to a same invention
conception as Embodiment 1 and Embodiment 2 is described. As shown in FIG. 5, the
coder includes an interface 21, a memory 22, and a processor 23, where:
the interface 21 is configured to sequentially read groups of pictures;
the processor 23 is configured to perform the following inter-frame predictive coding
on frames in any group of pictures:
for any CTU in a to-be-coded reference B frame in a current group of pictures, determining
a first maximum depth of a CTU from a GPB frame or P frame that is the closest to
the to-be-coded reference B frame in the current group of pictures and of which inter-frame
predictive coding is completed, where the determined CTU and the CTU in the to-be-coded
reference B frame are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded reference B frame, that
a splitting depth of the CTU does not exceed the first maximum depth; and
the memory 22 is configured to store a maximum depth of each CTU in the GPB frame
or P frame that is in the group of pictures and of which inter-frame predictive coding
is completed.
[0113] Further, the processor 23 is further configured to: if the first maximum depth is
equal to a preset maximum depth, skip a mode decision process with a depth of 0 when
inter-frame predictive coding is performed on the CTU in the to-be-coded reference
B frame; and
the memory 22 is further configured to store the preset maximum depth.
[0114] Because a quantity of decisions performed on the reference B frame is reduced, an
inter-frame predictive coding process of the reference B frame may be simplified,
and an inter-frame predictive coding time is shortened.
[0115] Further, the processor 23 is further configured to: when inter-frame predictive coding
is performed on the CTU in the to-be-coded reference B frame, in a mode decision process
of the CTU with any depth, skip mode operations of an inter-frame Nx2N mode and an
inter-frame 2NxN mode, and perform mode operations of other modes by using a sum of
absolute differences SAD algorithm; and
the memory 22 is further configured to store multiple types of mode operation information.
[0116] Because mode operations of the reference B frame are reduced, the inter-frame predictive
coding process of the reference B frame may be simplified, and the inter-frame predictive
coding time is shortened.
[0117] Further, the processor 23 is further configured to: for any CTU in a to-be-coded
non-reference B frame in the current group of pictures, determine a second maximum
depth of a CTU from a reference B frame that is the closest to the to-be-coded non-reference
B frame in the current group of pictures and of which inter-frame predictive coding
is completed, where the determined CTU and the CTU in the to-be-coded non-reference
B frame are in a same position in their respective frames; and
when inter-frame predictive coding is performed on the CTU in the to-be-coded non-reference
B frame, that a splitting depth of the CTU does not exceed the second maximum depth.
[0118] The memory 22 is further configured to store a maximum depth of each CTU in a reference
B frame that is in the group of pictures and of which inter-frame predictive coding
is completed.
[0119] Further, the processor 23 is further configured to: if the second maximum depth is
equal to the preset maximum depth or the preset maximum depth minus 1, skip a mode
decision process with a depth of 0 when inter-frame predictive coding is performed
on the CTU in the to-be-coded non-reference B frame; because a quantity of decisions
performed on the non-reference B frame is reduced, an inter-frame predictive coding
process of the non-reference B frame may be simplified, and an inter-frame predictive
coding time is shortened.
[0120] Further, the processor 23 is configured to: when inter-frame predictive coding is
performed on the CTU in the to-be-coded non-reference B frame, in a mode decision
process of the CTU with any depth, skip mode operations of the inter-frame Nx2N mode
and the inter-frame 2NxN mode, and perform mode operations of other modes by using
the SAD algorithm; because mode operations of the non-reference B frame are reduced,
the inter-frame predictive coding process of the non-reference B frame may be simplified,
and the inter-frame predictive coding time is shortened.
[0121] Further, the processor 23 is further configured to: if a GPB frame of which inter-frame
predictive coding is completed exists in the current group of pictures, for any CTU
in a to-be-coded GPB frame in the current group of pictures, determine a third maximum
depth of a CTU from the GPB frame of which inter-frame predictive coding is completed,
where the determined CTU and the CTU in the to-be-coded GPB frame are in a same position
in their respective frames; and when inter-frame predictive coding is performed on
the CTU in the to-be-coded GPB frame, that a splitting depth of the CTU does not exceed
the third maximum depth; or
if no GPB frame of which inter-frame predictive coding is completed exists in the
current group of pictures, for any CTU in a to-be-coded GPB frame in the current group
of pictures, determine a fourth maximum depth of a CTU from a GPB frame in a previous
group of pictures, where the determined CTU and the CTU in the to-be-coded GPB frame
in the current group of pictures are in a same position in their respective frames;
and when inter-frame predictive coding is performed on the CTU in the to-be-coded
GPB frame, that a splitting depth of the CTU does not exceed the fourth maximum depth.
[0122] Further, the processor 23 is further configured to: if the third maximum depth or
the fourth maximum depth is equal to the preset maximum depth, skip a mode decision
process with a depth of 0 when inter-frame predictive coding is performed on the CTU
in the to-be-coded GPB frame; because a quantity of decisions performed on the GPB
frame is reduced, an inter-frame predictive coding process of the GPB frame may be
simplified, and an inter-frame predictive coding time is shortened.
[0123] Further, the processor 23 is further configured to: when inter-frame predictive coding
is performed on the CTU in the to-be-coded GPB frame, in mode decisions of the CTU
with depths of 0 to the preset maximum depth minus 1, skip mode operations of the
inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform a mode operation
on the CTU by using a sum of absolute transformed differences SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skip mode
operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform
a mode operation on the CTU by using an SATD algorithm; because mode operations of
the GPB frame are reduced, the inter-frame predictive coding process of the GPB frame
may be simplified, and the inter-frame predictive coding time is shortened.
[0124] Further, the processor 23 is further configured to: if a P frame of which inter-frame
predictive coding is completed exists in the current group of pictures, for any CTU
in a to-be-coded P frame in the current group of pictures, determine a fifth maximum
depth of a CTU from the P frame of which inter-frame predictive coding is completed,
where the determined CTU and the CTU in the to-be-coded P frame are in a same position
in their respective frames; and when inter-frame predictive coding is performed on
the CTU in the to-be-coded P frame, that a splitting depth of the CTU does not exceed
the fifth maximum depth; or
if no P frame of which inter-frame predictive coding is completed exists in the current
group of pictures, for any CTU in a to-be-coded P frame in the current group of pictures,
determine a sixth maximum depth of a CTU from a P frame in a previous group of pictures,
where the determined CTU and the CTU in the to-be-coded P frame in the current group
of pictures are in a same position in their respective frames; and when inter-frame
predictive coding is performed on the CTU in the to-be-coded P frame, that a splitting
depth of the CTU does not exceed the sixth maximum depth.
[0125] Further, the processor 23 is further configured to: if the fifth maximum depth or
the sixth maximum depth is equal to the preset maximum depth, skip a mode decision
process with a depth of 0 when inter-frame predictive coding is performed on the CTU
in the to-be-coded P frame; because a quantity of decisions performed on the P frame
is reduced, an inter-frame predictive coding process of the P frame may be simplified,
and an inter-frame predictive coding time is shortened.
[0126] Further, the processor 23 is further configured to: when inter-frame predictive coding
is performed on the CTU in the to-be-coded P frame, in mode decisions of the CTU with
depths of 0 to the preset maximum depth minus 1, skip mode operations of the inter-frame
Nx2N mode and the inter-frame 2NxN mode, and perform a mode operation on the CTU by
using an SATD algorithm; or
in a mode decision of the CTU with a depth of the preset maximum depth, not skip mode
operations of the inter-frame Nx2N mode and the inter-frame 2NxN mode, and perform
a mode operation on the CTU by using an SATD algorithm; because mode operations of
the P frame are reduced, the inter-frame predictive coding process of the P frame
may be simplified, and the inter-frame predictive coding time is shortened.
[0127] A person skilled in the art should understand that the embodiments of the present
invention may be provided as a method, a system, or a computer program product. The
present invention may use a form of a computer program product that is implemented
on one or more computer-usable storage media (including but not limited to a disk
memory, a CD-ROM, an optical memory, and the like) that include computer-usable program
code.
[0128] The present invention is described with reference to the flowcharts and/or block
diagrams of the method, the device (system), and the computer program product according
to the embodiments of the present invention. It should be understood that computer
program instructions may be used to implement each process and/or each block in the
flowcharts and/or the block diagrams and a combination of a process and/or a block
in the flowcharts and/or the block diagrams. These computer program instructions may
be provided for a general-purpose computer, a dedicated computer, an embedded processor,
or a processor of any other programmable data processing device to generate a machine,
so that the instructions executed by a computer or a processor of any other programmable
data processing device generate an apparatus for implementing a specific function
in one or more processes in the flowcharts and/or in one or more blocks in the block
diagrams.
[0129] These computer program instructions may also be stored in a computer readable memory
that can instruct the computer or any other programmable data processing device to
work in a specific manner, so that the instructions stored in the computer readable
memory generate an artifact that includes an instruction apparatus. The instruction
apparatus implements a specific function in one or more processes in the flowcharts
and/or in one or more blocks in the block diagrams.
[0130] These computer program instructions may also be loaded onto a computer or another
programmable data processing device, so that a series of operations and steps are
performed on the computer or the another programmable device, thereby generating computer-implemented
processing. Therefore, the instructions executed on the computer or the another programmable
device provide steps for implementing a specific function in one or more processes
in the flowcharts and/or in one or more blocks in the block diagrams.
[0131] According to definitions in this specification, computer-readable media do not include
computer-readable transitory media (transitory media), such as modulated data signals
and carriers.
[0132] Although some preferred embodiments of the present invention have been described,
persons skilled in the art can make changes and modifications to these embodiments
once they learn the basic inventive concept. Therefore, the following claims are intended
to be construed as to cover the preferred embodiments and all changes and modifications
falling within the scope of the present invention.
[0133] Obviously, a person skilled in the art can make various modifications and variations
to the present invention without departing from the spirit and scope of the present
invention. The present invention is intended to cover these modifications and variations
provided that they fall within the scope of protection defined by the following claims
and their equivalent technologies.