# A Simple and High Performing Rate Control Initialization Method for H.264 AVC Coding Based on Motion Vector Map and Spatial Complexity at Low Bitrate

Authors: Yalin Wu; Sun-Woo Ko
Journal: Mathematical Problems in Engineering
 (2014)

---

## Abstract

The temporal complexity of  video sequences can be characterized by motion vector map which consists of motion vectors of each macroblock (MB). In order to obtain the optimal initial QP (quantization parameter) for the various video sequences which have different spatial and temporal complexities, this paper proposes a simple and high performance initial QP determining method based on motion vector map and temporal complexity to decide an initial QP in given target bit rate. The proposed algorithm produces the reconstructed video sequences with outstanding and stable quality. For any video sequences, the initial QP can be easily determined from matrices by target bit rate and mapped spatial complexity using proposed mapping method. Experimental results show that the proposed algorithm can show more outstanding objective and subjective performance than other conventional determining methods.


---

## Body

## 1. Introduction

In the last decade, multimedia data has been applied to communication, security, entertainment, and military. Because multimedia data has the problem of large amount of data, it can be hardly stored and transmitted. Video coding can effectively solve the problem. With the development of terminal equipment and communication networks, the video coding standards have been continually established as MPEG-1 [1], MPEG-2 [2], MPEG-4 [3], H.261 [4], H.262, H.263 [5], H.264 [6], and H.265 [7]. Especially, H.264/AVC can be applied for extensive areas such as DVD and VOD over cable and bit streaming video at low bit rate with high quality.In multimedia communication and transmission, rate control (RC) algorithm plays a crucial role. H.264/AVC includes an RC [8] which can be used to achieve optimal subjective quality given transmission bandwidth limit by regulating the encoding parameters. In RC, the optimal QP has been determined for every frame of video sequence. The large amount of encoded and good perceptual quality can be obtained by reducing the QP. In contrast, the QP increment can reduce the encoded bits and perceptual quality. The mean absolute difference (MAD) of residual MB can be used to determine the QP for MB. However, the chicken-and-egg dilemma [6] occurs in the process of determining QP. In JVT-G012 [9], the scheme of one-pass RC uses a linear MAD prediction model to solve the chicken-and-egg dilemma. According to the efficiency and simplicity of JVT-G012, the scheme of JVT-G012 has been widely applied in H.264 software and hardware. The algorithm of JVT-G012 includes the process of initialization for RC. In this process, the initial QP is determined for IDR picture in a video sequence. Therefore, the optimal MAD of IDR can be calculated using initial QP. The MAD of next frame is predictable using optimal MAD of IDR. The process of initial QP determination is an important part in RC. The value of initial QP can influence the RC performance. Conventionally, the value of initial QP can be determined according to the number of bits per pixel (BPP) which depends on the target bit rate, frame rate, and image size in JVT-G012. Although the scheme of BPP is easy to implement, it is very rough and imprecise. Generally, video sequence is two-element data which includes spatial and temporal components. According to information theory, the relatively large number of bits is used to represent the video sequence which has highly complicated spatial and temporal features. In contrast, relatively small amount of bits can encode the low complex video sequence. In the situation of the restricted target bits, a large initial QP is expected for highly complicated video sequence. In spite of reducing the image quality, it is in the limited data range. For the low complex video sequence, a small initial QP is assigned; not only the target bits can be fulfilled but the excellent image quality can be also obtained. Using this idea, it is very important that the scheme of RC initialization is used to consider spatial and temporal complexities of video sequence. In order to complete this target, Wang and Kwong [10] and Wu and Kim [11] proposed the schemes which used the characteristics of video sequences as well as BPP to determine the initial QP. However, their methods do not consider quality balance of reconstructed video sequence and the provided parameters cannot apply any video sequence. The criterion of selecting the sample video sequences has not been provided. In addition, the algorithm of determining optimal initial QP has not been explained either. Moreover, Hu et al. [12] proposed a scheme of computing the initial QP for spatial scalable video coding (SVC). However, this scheme is only applicable to the SVC standard.In order to solve the existing problems, we propose a simple and high performance method to determine an initial QP in given target bit rate. To obtain the initial QP for any video sequences, it is very important to measure the spatial and temporal complexities of the video sequences. In H.264/AVC [6] standard, the motion vector is proposed as a measure of temporal complexities of video sequences. Primarily, temporal complexities of ten video sequences are analyzed using motion vector and 4 video sequences are screened out as the samples. And then, the spatial complexities of samples are calculated using the rate of number of complex MBs, which are determined by variance of MB, in the IDR. In this paper, an algorithm for determining optimal initial QP is proposed for producing the reconstructed video sequences with high and stable qualities at the encoding bits which are very close to target bit rates within the range of 0.4 to 1.0 Mbps. Subsequently, optimal initial QPs of 4 samples constitute two-dimensional matrices basis of spatial complexity and target bit rate. Moreover, we propose a mapping method to determine the spatial complexity of tested video sequences by the two-dimensional matrices. For any tested video sequence, its optimal initial QP can be chosen from the built matrix using its mapped spatial complexity and target bit rate. Section 2 presents the related method of initialization process of RC. Section 3 interprets the evolution process of proposed method. The results of experiment are shown in Section 4. Finally, Section 5 shows the conclusion of this study.


## 2. Related Method of Initialization Algorithm of Rate Control

In this section, we review some initialization methods of RC which are used to decide initial QPs in the recent literatures. The method of JVT-G012 that can automatically conclude the value of initial QP for the IDR is the most traditional and coarse method. The advantages of JVT-G012 are easy implementation and low computational complexity. In the case of the poor performance hardware of terminal equipment, JVT-G012 is being of extensive usage. Various versions of the reference software of H.264  [7, 13] have adopted JVT-G012. The disadvantage of JVT-G012 is being not accurate enough. The method of JVT-G012 uses only BPP to determine an initial QP as follows:
(1)
JVTQP
=
{
35
,
BPP
≥
J
1
,
25
,
J
1
<
BPP
≤
J
2
,
20
,
J
2
<
BPP
≤
J
3
,
10
,
BPP
>
J
3
,
(2)
BPP
=
BR
FR
×
VS
,
where JVTQP is calculated by the initial QP of initialization process of RC. BPP, which is the bits per pixel, is computed using BR, FR, and VS which represent the target bit rate, the frame rate, and the size of frame in (2). J
1, J
2, and J
3 are thresholds. For QCIF video sequences, the thresholds are given as 0.1, 0.3, and 0.6. For CIF video sequences, the thresholds are recommended to be 0.6, 1.4 and 2.4 in JM9.3 [10].In the method of Wang, the value ofinitial
QP is computed on the basis of BPP and spatial feature. The spatial feature can be computed using entropy information and the dc mode of INTRA 16
×
16 of the IDR.Consider(3)
Entropy
=
-
∑
i
=
0
L
-
1
p
(
i
)
log
2
[
p
(
i
)
]
,
MC
=
∑
k
=
1
N
∑
t
=
0
15
∑
j
=
0
15
|
M
k
(
t
,
j
)
-
M
dc
k
|
1000
×
N
,
where L
-
1 is maximum gray level value of pixel, p
(
i
) is the probability of gray level i, N is the number of MBs in IDR, M
k
(
t
,
j
) is used to denote the pixel value at (
i
,
j
) of the kth MB, and M
dc
k is used to denote the predicted compensation value computed from the dc mode of INTRA 16
×
16. Finally,  the initial QP can be calculated by (4). Figure 1 shows the relationship of the best initial QP and BPP by News, Foreman, and Mobile. And then (5) can be computed by this relationship:
(4)
initial
QP
=
F
1
(
BPP
)
+
F
2
(
Entropy
,
MC
)
,
(5)
F
1
(
BPP
)
=
{
c
1
·
BPP
+
c
2
,
BPP
≥
0.4
,
c
3
·
BPP
+
c
4
,
0.4
>
BPP
≥
0.2
,
c
5
·
BPP
2
+
c
6
·
BPP
+
c
7
,
0.2
≥
BPP
,
(6)
F
2
=
max
{
t
1
Entropy
2
+
t
2
Entropy
+
t
3
,
e
1
MC
2
+
e
2
MC
+
e
3
}
,
where θ
=
{
c
1
,
c
2
,
c
3
,
c
4
,
c
5
,
c
6
,
c
7
,
t
1
,
t
2
,
t
3
,
e
1
,
e
2
,
e
3
} can be defined as θ
=
{
-
15.21,25
,
-
30.41,31,462.47
,
-
189.86
,
44.60
,
-
15.25
,
241.81
,
-
944.42
,
-
0.76,13.59
,
-
49.18
} for CIF video sequences. At QCIF video sequences, θ
=
{
-
12.67,24
,
-
25.34,29,546.59
,
-
221.55,46.41
,
14.25, -
184.76
,
595.95,0.67
,
-
7.23,18.50
}. The value of initial
QP is computed using (4).Figure 1
Relationship between the best initial QP and BPP according to News, Foreman, and Mobile.In the scheme of Wu,initial
QP is calculated on the basis of BPP, the MAD value of the IDR, and the average MAD value of the 2nd, 3rd, and 4th frames which are encoded using intermode as follows:
(7)
initial QP
=
F
1
(
BPP
)
+
F
3
(
MAD
I
,
MAD
AP
)
,
(8)
F
3
(
MAD
I
,
MAD
AP
)
=
p
1
·
[
a
·
MAD
I
+
(
1
-
a
)
·
MAD
AP
]
2
+
p
2
·
[
a
·
MAD
I
+
(
1
-
a
)
·
MAD
AP
]
+
p
3
,
where the value of a is 0.05 and θ
=
{
c
1
,
c
2
,
c
3
,
c
4
,
c
5
,
c
6
,
c
7
,
p
1
,
p
2
,
p
3
} can be determined as θ
=
{
-
15.21
,
25
,
-
30.41,31
,
462.47
,
-
189.86
,
44.60
,
-
0.78
,
8.48
,
-
10.90
} for CIF video sequences and θ
=
{
-
12.67,24
,
-
25.34,29
,
546.59
,
-
221.55
,
46.41,0.36
,
1.30
,
-
2.78
} for the size of QCIF. The value of initial
QP is computed using (7).The parameters used in the method of Wang and Wu are calculated using three types of tested video sequences. In Wu and Wang, the extracting method of sample video sequences has not been shown. It is difficult to say that they can represent the various spatial and temporal complexities video sequences. Moreover, Wang and Wu have not taken into account the quality consistency of recovered video sequences. Furthermore, the scheme of the best initial QP determination is not explained.


## 3. Proposed Initialization Algorithm of Rate Control

### 3.1. Spatial and Temporal Complexities

In the video sequence, the content of adjacent frames has not any significant difference. In order to save amount of bits, only difference is encoded. For finding difference, most video coding standards support the method named motion estimation (ME) [6]. ME is used to investigate the 16
×
16 at the objective region in reference frames that closely matches the current MB. ME is improved by H.264/AVC such as variable block size, multiple reference frames, and optimization algorithm. Figure 2 shows the process of ME. Motion vectors are used to compress video by storing the changes to an image from one frame to the next. Figure 3 shows motion vector.Figure 2
The process of ME.Figure 3
Motion vector map.By the number and magnitude of the motion vectors, the temporal complexity of video sequences can be measured and predicted. In H.264/AVC, most frames are encoded using intermode [4–6]. For the video coding performance, the temporal complexity is more important than spatial complexity.Figure4 shows the result of motion vector maps for ten different types of sample video sequences [14]. In Figure 4, the ten video sequences can be simply divided into two categories. The Bus, Flower, and Mobile video sequences are classified as complex case. On the contrary, Foreman, Waterfall, Silent, Paris, Bridge-far, Mother-daughter, and News video sequences are relatively simple case. Complexity means that the number of motion vectors is high and vice versa. In complex videos, Mobile video is captured by fixed camera and its motion vectors exist in each MB. Flower video shows the movement of the objects located at the lower part of the video while Bus video has the movement on the all-region. In simple videos, Waterfall is a typical case which applies the zoom-out photography technology and Foreman, which is classic interview type, has motion vectors in the middle of the image. Moreover, News, Paris, Mother-daughter, and Silent are also interview style video sequences. According to their motion vectors, various types of video sequences have different patterns. The patterns can be used to distinct typical video sequences. We use 4 video sequences which are Mobile, Flower, Waterfall, and Foreman as the sample video sequence to analyse any video sequences because they have distinctive features.Motion vectors obtained from ten video sequences.
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)In proposed initialization algorithm of RC, the value of initial QP is computed based on the spatial and temporal complexities at the given target bit rate. As the sample video sequences are selected, the calculating method of spatial complexity of sample video sequences must be provided.In H. 264, the smallest encoding unit is MB. MB includes two INTRA prediction modes which are INTRA16
×
16 [4] and INTRA 4
×
4 [4]. Figure 5 shows the INTRA prediction modes. In Figure 5(a), the INTRA 4
×
4 has 9 prediction modes. In Figure 5(b), the INTRA 16
×
16 has 4 prediction modes.INTRA prediction modes.
(a)
INTRA4
×
4 mode
(b)
INTRA16
×
16 modeGenerally, the INTRA16
×
16 mode is used in the MBs which are in the homogeneous regions of image. However, the INTRA 4
×
4 mode is used in the MBs which are in the object and edge parts of image [4]. In Figure 6, the nonhomogeneous MBs have the same value of pixels. The INTRA 16
×
16 mode is used to process the homogeneous MBs. The reasons to use INTRA 16
×
16 blocks are to save the computing time and to maintain the image quality. The INTRA 4
×
4 mode is used to process the non-homogeneous MBs which have the different pixel values. The reason to use INTRA 4
×
4 blocks is to maintain the quality.Figure 6
Type of MBs.Since the variance of an MB, which includes 256 pixels, is the equal of the total information of the DC and AC coefficients of the MB, the spatial complexity of the MB can be estimated using variance [15].Consider(9)
MB
var
=
1
256
(
∑
i
=
0
15
∑
j
=
0
15
[
Y
(
i
,
j
)
]
2
-
[
∑
i
=
0
15
∑
j
=
0
15
Y
(
i
,
j
)
]
2
)
,
where the variance of MB is computed by MBvar and Y
(
i
,
j
) is value of the pixel which is luminance signal at (
i
,
j
). An MB is classified to be of high or low complexity by threshold of variance as follows:
(10)
MB
Complexity
=
{
high
,
MB
var
>
T
,
low
,
MB
var
≤
T
,
where T is the threshold value defined as 92735 [15]. Figure 7 shows the classification process of MB according to the value of variance. The spatial complexity of the IDR is measured according to the proportion of the number of complex MBs as follows:
(11)
Frame
complex
=
MB
Complex
MB
Frame
×
100
(
%
)
,
where the Framecomplex is the rate of the number of complex MBs in the IDR. MBComplex is the number of the complex MBs of IDR and MBFrame is the total number of the MBs of IDR.Figure 7
Classification process of MB.The Framecomplex can be  a measure of the spatial complexity.


### 3.2. Proposed Algorithm for Determining the Optimal Initial QP

According to the given target bit rate, the value of initial QP is directly related to the performance of encoding at the H.264/AVC. The performance of encoding can be evaluated using the quality of reconstructed video sequences and total bits. In other words, the objectives are to satisfy target bit rate to ensure the best quality of reconstructed video sequences. And also the stability of reconstructed video sequences is a very important quality measure in multimedia broadcasting and transmission. Thus the optimal initial QP algorithm has the following properties: (1) maximizing PSNR(peak signal-to-noise ratio) that means the best quality of reconstructed video sequences, (2) maximizing stability that is defined as the differences of QPs, and (3) minimizing total real bits under satisfying the target bit rate.To find out the optimal initial QP, all potential 52 initial QPs are calculated. For each initial QP, the results which include PSNR, real bits of prior 60 frames, and the differences of QPs in a group of pictures (GOP) are recorded at the given target bit rate. So an initial QP, which produces the maximum PSNR and the minimum of real bits under satisfying target bit rate and minimum differences of QPs, is the optimal initial QP. Since the numeric value of real bits is much larger than PSNR and differences of QPs and also PSNR, real bits, and differences of QPs have different dimensions, PSNR, real bits, and differences of QPs are  normalized as follows:
(12)
PSNR
initial QP
¯
=
(
PSNR
Initial QP
-
MIN
Initial QP
=
0
,
…
,
51
(
PSNR
Initial QP
)
)
×
(
MAX
Initial QP
=
0
,
…
,
51
(
PSNR
Initial QP
)
-
MIN
Initial QP
=
0
,
…
,
51
(
PSNR
Initial QP
)
)
-
1
,
Initial QP
=
0
,
…
,
51
,
(13)
BIT
Initial QP
¯
=
(
BIT
Initial QP
-
MIN
Initial QP
=
0
,
…
,
51
(
BIT
Initial QP
)
)
×
(
MAX
Initial QP
=
0
,
…
,
51
(
BIT
Initial QP
)
-
MIN
Initial QP
=
0
,
…
,
51
(
BIT
Initial QP
)
)
-
1
,
Initial QP
=
0
,
…
,
51
,
(14)
D
QP
Initial QP
¯
=
(
D
QP
Initial QP
-
MIN
Initial QP
=
0
,
…
,
51
(
D
QP
Initial QP
)
)
×
(
MAX
Initial QP
=
0
,
…
,
51
(
D
QP
Initial QP
)
-
MIN
Initial QP
=
0
,
…
,
51
(
D
QP
Initial QP
)
)
-
1
,
Initial QP
=
0
,
…
,
51
,
where PSNR
Initial QP
¯, BIT
Initial QP
¯, and D
QP
Initial QP
¯ represent the values of normalized PSNR, real bits, and differences of QPs, respectively. PSNRInitial QP, BITInitial QP, and D
QP
Initial QP are actual unnormalized values. The optimal initial QP is calculated as follow:
(15)
Optimal
Initial QP
=
argmin
Initial QP
=
0
,
…
,
51
(
α
(
1
-
PSNR
Initial QP
¯
)
+
β
BIT
Initial QP
¯
+
γ
DQP
Initial QP
¯
)
,
where Optimal
Initial
QP is the optimal initial QP, 0
≤
α, β
,
γ
≤
1, and α
+
β
+
γ
=
1.  In our research, the values of α
,
β
,
γ are set to 1
/
3.


### 3.3. Mapping Method of  Spatial Complexity for Generalization

For the video sequences which have the similar complexity, the initial QPs should be similar. A mapping method of spatial complexity is proposed for any tested video sequence. The spatial complexities of selected sample video sequences can be calculated using (11), according to the given target bit rate. For any video sequence, its spatial complexity is computed using (11) too. The spatial complexity of a video sequence can be mapped by selecting the nearest matching spatial complexity from a set of sample proportion spaces as follows:
(16)
Difference
i
=
|
SSC
i
-
TSC
|
,
for
i
=
1,2
,
…
,
4
,
where Difference
i is the absolute value of difference between the spatial complexity of ith sample video and a tested one. SSC
i is the ith spatial complexity among 4 sample video sequences. TSC is the spatial complexity of the tested video sequence.LetMapping Sample denote the sample video that has minimum Difference
i, i
=
1
,
…
,
4.In Table1, MSC is the spatial complexity of sample video. Type 1, Type 2, Type 3, and Type 4 are 4 sample video sequences, which are Waterfall, Foreman, Flower, and Mobile, respectively. Table 1 shows that Mobile has the highest spatial complexity and Waterfall has the lowest spatial complexity, which is in agreement with Figure 4. In addition, Table 1 includes 4 groups of the optimal initial QPs which are 4 affiliated sample video sequences at low bit rate, respectively. The initial QP of a test video sequence can be determined by only selecting an element from Table 1 based on Mapping Sample and given target bit rate.Table 1
Lookup table for proposed initial QP.
Bit rate
(MSC) Video
(32%)Type 1
(44%)Type 2
(53%)Type 3
(90%)Type 4
0.4 (Mbps)
30
38
42
45
0.5 (Mbps)
33
32
39
42
0.6 (Mbps)
30
30
36
40
0.7 (Mbps)
28
27
35
36
0.8 (Mbps)
28
25
37
37
0.9 (Mbps)
25
24
34
33
1.0 (Mbps)
25
23
35
32


## 3.1. Spatial and Temporal Complexities

In the video sequence, the content of adjacent frames has not any significant difference. In order to save amount of bits, only difference is encoded. For finding difference, most video coding standards support the method named motion estimation (ME) [6]. ME is used to investigate the 16
×
16 at the objective region in reference frames that closely matches the current MB. ME is improved by H.264/AVC such as variable block size, multiple reference frames, and optimization algorithm. Figure 2 shows the process of ME. Motion vectors are used to compress video by storing the changes to an image from one frame to the next. Figure 3 shows motion vector.Figure 2
The process of ME.Figure 3
Motion vector map.By the number and magnitude of the motion vectors, the temporal complexity of video sequences can be measured and predicted. In H.264/AVC, most frames are encoded using intermode [4–6]. For the video coding performance, the temporal complexity is more important than spatial complexity.Figure4 shows the result of motion vector maps for ten different types of sample video sequences [14]. In Figure 4, the ten video sequences can be simply divided into two categories. The Bus, Flower, and Mobile video sequences are classified as complex case. On the contrary, Foreman, Waterfall, Silent, Paris, Bridge-far, Mother-daughter, and News video sequences are relatively simple case. Complexity means that the number of motion vectors is high and vice versa. In complex videos, Mobile video is captured by fixed camera and its motion vectors exist in each MB. Flower video shows the movement of the objects located at the lower part of the video while Bus video has the movement on the all-region. In simple videos, Waterfall is a typical case which applies the zoom-out photography technology and Foreman, which is classic interview type, has motion vectors in the middle of the image. Moreover, News, Paris, Mother-daughter, and Silent are also interview style video sequences. According to their motion vectors, various types of video sequences have different patterns. The patterns can be used to distinct typical video sequences. We use 4 video sequences which are Mobile, Flower, Waterfall, and Foreman as the sample video sequence to analyse any video sequences because they have distinctive features.Motion vectors obtained from ten video sequences.
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)In proposed initialization algorithm of RC, the value of initial QP is computed based on the spatial and temporal complexities at the given target bit rate. As the sample video sequences are selected, the calculating method of spatial complexity of sample video sequences must be provided.In H. 264, the smallest encoding unit is MB. MB includes two INTRA prediction modes which are INTRA16
×
16 [4] and INTRA 4
×
4 [4]. Figure 5 shows the INTRA prediction modes. In Figure 5(a), the INTRA 4
×
4 has 9 prediction modes. In Figure 5(b), the INTRA 16
×
16 has 4 prediction modes.INTRA prediction modes.
(a)
INTRA4
×
4 mode
(b)
INTRA16
×
16 modeGenerally, the INTRA16
×
16 mode is used in the MBs which are in the homogeneous regions of image. However, the INTRA 4
×
4 mode is used in the MBs which are in the object and edge parts of image [4]. In Figure 6, the nonhomogeneous MBs have the same value of pixels. The INTRA 16
×
16 mode is used to process the homogeneous MBs. The reasons to use INTRA 16
×
16 blocks are to save the computing time and to maintain the image quality. The INTRA 4
×
4 mode is used to process the non-homogeneous MBs which have the different pixel values. The reason to use INTRA 4
×
4 blocks is to maintain the quality.Figure 6
Type of MBs.Since the variance of an MB, which includes 256 pixels, is the equal of the total information of the DC and AC coefficients of the MB, the spatial complexity of the MB can be estimated using variance [15].Consider(9)
MB
var
=
1
256
(
∑
i
=
0
15
∑
j
=
0
15
[
Y
(
i
,
j
)
]
2
-
[
∑
i
=
0
15
∑
j
=
0
15
Y
(
i
,
j
)
]
2
)
,
where the variance of MB is computed by MBvar and Y
(
i
,
j
) is value of the pixel which is luminance signal at (
i
,
j
). An MB is classified to be of high or low complexity by threshold of variance as follows:
(10)
MB
Complexity
=
{
high
,
MB
var
>
T
,
low
,
MB
var
≤
T
,
where T is the threshold value defined as 92735 [15]. Figure 7 shows the classification process of MB according to the value of variance. The spatial complexity of the IDR is measured according to the proportion of the number of complex MBs as follows:
(11)
Frame
complex
=
MB
Complex
MB
Frame
×
100
(
%
)
,
where the Framecomplex is the rate of the number of complex MBs in the IDR. MBComplex is the number of the complex MBs of IDR and MBFrame is the total number of the MBs of IDR.Figure 7
Classification process of MB.The Framecomplex can be  a measure of the spatial complexity.


## 3.2. Proposed Algorithm for Determining the Optimal Initial QP

According to the given target bit rate, the value of initial QP is directly related to the performance of encoding at the H.264/AVC. The performance of encoding can be evaluated using the quality of reconstructed video sequences and total bits. In other words, the objectives are to satisfy target bit rate to ensure the best quality of reconstructed video sequences. And also the stability of reconstructed video sequences is a very important quality measure in multimedia broadcasting and transmission. Thus the optimal initial QP algorithm has the following properties: (1) maximizing PSNR(peak signal-to-noise ratio) that means the best quality of reconstructed video sequences, (2) maximizing stability that is defined as the differences of QPs, and (3) minimizing total real bits under satisfying the target bit rate.To find out the optimal initial QP, all potential 52 initial QPs are calculated. For each initial QP, the results which include PSNR, real bits of prior 60 frames, and the differences of QPs in a group of pictures (GOP) are recorded at the given target bit rate. So an initial QP, which produces the maximum PSNR and the minimum of real bits under satisfying target bit rate and minimum differences of QPs, is the optimal initial QP. Since the numeric value of real bits is much larger than PSNR and differences of QPs and also PSNR, real bits, and differences of QPs have different dimensions, PSNR, real bits, and differences of QPs are  normalized as follows:
(12)
PSNR
initial QP
¯
=
(
PSNR
Initial QP
-
MIN
Initial QP
=
0
,
…
,
51
(
PSNR
Initial QP
)
)
×
(
MAX
Initial QP
=
0
,
…
,
51
(
PSNR
Initial QP
)
-
MIN
Initial QP
=
0
,
…
,
51
(
PSNR
Initial QP
)
)
-
1
,
Initial QP
=
0
,
…
,
51
,
(13)
BIT
Initial QP
¯
=
(
BIT
Initial QP
-
MIN
Initial QP
=
0
,
…
,
51
(
BIT
Initial QP
)
)
×
(
MAX
Initial QP
=
0
,
…
,
51
(
BIT
Initial QP
)
-
MIN
Initial QP
=
0
,
…
,
51
(
BIT
Initial QP
)
)
-
1
,
Initial QP
=
0
,
…
,
51
,
(14)
D
QP
Initial QP
¯
=
(
D
QP
Initial QP
-
MIN
Initial QP
=
0
,
…
,
51
(
D
QP
Initial QP
)
)
×
(
MAX
Initial QP
=
0
,
…
,
51
(
D
QP
Initial QP
)
-
MIN
Initial QP
=
0
,
…
,
51
(
D
QP
Initial QP
)
)
-
1
,
Initial QP
=
0
,
…
,
51
,
where PSNR
Initial QP
¯, BIT
Initial QP
¯, and D
QP
Initial QP
¯ represent the values of normalized PSNR, real bits, and differences of QPs, respectively. PSNRInitial QP, BITInitial QP, and D
QP
Initial QP are actual unnormalized values. The optimal initial QP is calculated as follow:
(15)
Optimal
Initial QP
=
argmin
Initial QP
=
0
,
…
,
51
(
α
(
1
-
PSNR
Initial QP
¯
)
+
β
BIT
Initial QP
¯
+
γ
DQP
Initial QP
¯
)
,
where Optimal
Initial
QP is the optimal initial QP, 0
≤
α, β
,
γ
≤
1, and α
+
β
+
γ
=
1.  In our research, the values of α
,
β
,
γ are set to 1
/
3.


## 3.3. Mapping Method of  Spatial Complexity for Generalization

For the video sequences which have the similar complexity, the initial QPs should be similar. A mapping method of spatial complexity is proposed for any tested video sequence. The spatial complexities of selected sample video sequences can be calculated using (11), according to the given target bit rate. For any video sequence, its spatial complexity is computed using (11) too. The spatial complexity of a video sequence can be mapped by selecting the nearest matching spatial complexity from a set of sample proportion spaces as follows:
(16)
Difference
i
=
|
SSC
i
-
TSC
|
,
for
i
=
1,2
,
…
,
4
,
where Difference
i is the absolute value of difference between the spatial complexity of ith sample video and a tested one. SSC
i is the ith spatial complexity among 4 sample video sequences. TSC is the spatial complexity of the tested video sequence.LetMapping Sample denote the sample video that has minimum Difference
i, i
=
1
,
…
,
4.In Table1, MSC is the spatial complexity of sample video. Type 1, Type 2, Type 3, and Type 4 are 4 sample video sequences, which are Waterfall, Foreman, Flower, and Mobile, respectively. Table 1 shows that Mobile has the highest spatial complexity and Waterfall has the lowest spatial complexity, which is in agreement with Figure 4. In addition, Table 1 includes 4 groups of the optimal initial QPs which are 4 affiliated sample video sequences at low bit rate, respectively. The initial QP of a test video sequence can be determined by only selecting an element from Table 1 based on Mapping Sample and given target bit rate.Table 1
Lookup table for proposed initial QP.
Bit rate
(MSC) Video
(32%)Type 1
(44%)Type 2
(53%)Type 3
(90%)Type 4
0.4 (Mbps)
30
38
42
45
0.5 (Mbps)
33
32
39
42
0.6 (Mbps)
30
30
36
40
0.7 (Mbps)
28
27
35
36
0.8 (Mbps)
28
25
37
37
0.9 (Mbps)
25
24
34
33
1.0 (Mbps)
25
23
35
32


## 4. Experimental Results

The proposed algorithm and existing methods, which are JVT-G012 and Wu, are implemented on JM9.3 [13] which is the reference software for H.264. In addition, the experiment uses 7 various CIF (352
×
288) standard video sequences that are Waterfall, Foreman, Flower, Mobile, Bus, City, and Stefen, respectively. In the standard video sequences, Waterfall, Foreman, Flower, and Mobile are selected samples, and Bus, City, and Stefen are used to tested generalized quality of proposed algorithm. According to the proposed scheme which is the spatial complexity calculation and mapping, Mobile is the Mapping Sample of Stefen and Bus and City are correspondent to Flower and Foreman, respectively. The experimental conditions are as follows.(a)
The system platform is Intel (R) Core(TM)2 Duo CPU E7400 2.80 GHZ, 2.00 GB RAM, and the OS is Microsoft Windows XP professional 2002 Service Pack 3.
(b)
JM 9.3 is implemented at the Visual Studio 6.0.
(c)
The profile baselines are used; one GOP has 15 frames which includes that the 1st frame is encoded by intra and others are encoded as interframes; the B-picture is not adopted. The item of “Rate Control Enable” is enabled, the item of “Initial QP” is set to 0, and the target bit rates are limited to range that is from 0.4 to 1.0 (units: Mbps).
(d)
The proposed initial QP is determined using Table1.
(e)
As for the standard video sequence, the number of frames is 60, the frame rate is 30.


### 4.1. Objective Evaluation

The three methods which are proposed algorithm, JVT-G012, and Wu are compared in terms of PSNR and the difference of real bits. These indicators of performance can be quantized as follows:(17)
PSNR
=
10
log
10
(
2
n
-
1
)
2
MSE
,
where MSE
=
∑
x
=
0
X
-
1
∑
Y
=
0
Y
-
1
(
p
^
(
x
,
y
)
-
p
(
x
,
y
)
)
2 and p
^ is the pixel value of the reconstructed video sequence. p is the original pixel value.Consider(18)
Δ
R
=
R
JVT
-
R
b
JVT
&
TEST
,
where R
JVT is the real bits of the JVT-G012 and R
b
JVT
&
TEST is the real bits of the algorithms which are proposed method, Wu, and JVT-G012.Table2 shows that the simulation results for the average PSNR and the total Δ
R, which can be calculated at the range of the target bit from 0.4 to 1.0 Mbps for each video sequence, are indicated by PSNRAverage and Δ
R
total, respectively.Table 2
Comparison of coding performance.
(a)
PSN
R
Average (db)
Video sequence
JVT-G012
Wu
Proposed
Waterfall
36.04
35.83
36.12
Foreman
37.78
37.68
37.81
Flower
29.11
29.14
29.16
Mobile
28.12
28.28
28.37
Bus
30.12
30.18
30.24
City
34.72
34.63
34.75
Stefen
31.48
31.46
31.59
Average
32.48
32.46
32.58
(b)
Δ
R
total (bit)
Video sequence
JVT-G012
Wu
Proposed
Waterfall
0
−2288
14048
Foreman
0
−2272
2152
Flower
0
62336
69072
Mobile
0
128888
154184
Bus
0
5944
5456
City
0
−1576
−1904
Stefen
0
−1096
24
Total
0
189936
243032In Table2(a), the proposed method obtains more better quality performance than JVT-G012 and Wu, although improvement is not obvious. However, Δ
R
total shows that the proposed algorithm has quite prominent bit rate performance. The proposed method reduces 243032 bits than JVT-G012 in total although each PSNRAverage is similar. This illustrates that the reconstructed video of proposed method has minimum actual total bits at the same or similar quality in almost all of simulations except City.One of the important quality measures of a video is that the quality of each frame should be uniform. The existing methods have not involved this issue. The  proposed method has solved this issue by selecting initial QP according to the highest and stablest quality as well as the lowest actual bits in (15). In Table 3, the quality of each frame shows an example of extreme changes. According to the JVT-G012, the value of initial QP is 25 at the target bit rate 0.7 Mbps. The maximum QP is 51 which can generate abominable quality and the minimum QP is 25 which can generate good quality. So the difference between the maximum and minimum of QPs in GOP can be a good measure for the stability of video quality. Figure 8 shows this stability performance for proposed method, Wu, and JVT-G012. In Figure 8, the proposed method obtains the lower difference of QPs than others in all the cases.Table 3
Reconstructed video with extremely changing quality.
Frame number
Bit/frame
QP
Frame PSNR
0
291952
25
38.084
1
95904
25
36.900
2
42176
31
34.305
3
24272
32
32.891
4
17208
34
32.058
5
12504
36
30.613
6
10280
38
30.614
7
8848
40
29.980
8
7776
42
29.338
9
7184
44
28.591
10
6408
46
27.687
11
5720
48
26.682
12
4976
50
25.367
13
4856
51
24.405
14
5432
51
24.615Stability performances.
(a)
Flower
(b)
Bus
(c)
Foreman
(d)
Mobile
(e)
Stefen
(f)
WaterfallIn fact, PSNR can objectively and effectively assess quality of one frame. However, PSNR is not a perfect measure to evaluate the qualities of video sequences which have multiple frames. In Table3, although the average PSNR is good, the quality of reconstructed video sequences is very low because the change of frame quality is very high. Extremely high fluctuation of the frame qualities means not only the repetition of fuzzy and vivid images but also video broken phenomenon. So in order to evaluate video sequences, average PSNR and stability should be considered simultaneously in a GOP.The quality of video sequences that have high complexity is very sensitive to the value of initial QP at low bit rate. For a given target bit, low initial QP can lead the large bits  assignment to the first frame and insufficient  bits to the other frames in a GOP to maintain qualities. Therefore, the stability of a reconstructed video sequence is a very important quality performance. Proposed optimal initial QP is determined under consideration of stability in (15). In Figure 8, the proposed method shows better results for all test video sequences at low bitrate. Especially, in high complexity video sequences, the proposed method guarantees excellent results.


### 4.2. Subjective Evaluation

General video user evaluates video sequences by just looking but not by calculating PSNR or stability. This implies the importance of subjective evaluation. Frankly speaking the relationship between the results of objective evaluation and subjective one is not known. Therefore, it is not easy to convert the difference of objective evaluation results to the differences in subjective evaluation.In this part, three methods, proposed method, JVT-G012, and Wu, are subjectively evaluated using the objective evaluation results, that is, the maximum and minimum QPs at 0.4 Mbps target bitrate. The Mobile sample video sequence is tested. Figure9 shows result of this situation.Result of subjective evolution.
(a)
Minimum QP of GOP based on JVT-G012
(b)
Maximum QP of GOP based on JVT-G012
(c)
Minimum QP of GOP based on Wu
(d)
Maximum QP of GOP based on Wu
(e)
Minimum QP of GOP based on proposed method
(f)
Maximum QP of GOP based on proposed methodThe average PSNRs of the proposed method, JVT-G012, and Wu are very similar at objective assessment, which are 25.22, 25.03, and 24.83, respectively.Although Figures9(a) and 9(c) show better quality than Figure 9(e), all objects in Figure 9(e) are vividly identified at minimum QPs. Although Figures 9(b) and 9(d) are very fuzzy and some details of frame are lost, the quality of Figure 9(f) is excellent compared with Figures 9(b) and 9(d).In subjective evaluation, we can see also the importance of stability from the gaps in Figures9(a), 9(b), 9(c), 9(d), 9(e), and 9(f), respectively.


## 4.1. Objective Evaluation

The three methods which are proposed algorithm, JVT-G012, and Wu are compared in terms of PSNR and the difference of real bits. These indicators of performance can be quantized as follows:(17)
PSNR
=
10
log
10
(
2
n
-
1
)
2
MSE
,
where MSE
=
∑
x
=
0
X
-
1
∑
Y
=
0
Y
-
1
(
p
^
(
x
,
y
)
-
p
(
x
,
y
)
)
2 and p
^ is the pixel value of the reconstructed video sequence. p is the original pixel value.Consider(18)
Δ
R
=
R
JVT
-
R
b
JVT
&
TEST
,
where R
JVT is the real bits of the JVT-G012 and R
b
JVT
&
TEST is the real bits of the algorithms which are proposed method, Wu, and JVT-G012.Table2 shows that the simulation results for the average PSNR and the total Δ
R, which can be calculated at the range of the target bit from 0.4 to 1.0 Mbps for each video sequence, are indicated by PSNRAverage and Δ
R
total, respectively.Table 2
Comparison of coding performance.
(a)
PSN
R
Average (db)
Video sequence
JVT-G012
Wu
Proposed
Waterfall
36.04
35.83
36.12
Foreman
37.78
37.68
37.81
Flower
29.11
29.14
29.16
Mobile
28.12
28.28
28.37
Bus
30.12
30.18
30.24
City
34.72
34.63
34.75
Stefen
31.48
31.46
31.59
Average
32.48
32.46
32.58
(b)
Δ
R
total (bit)
Video sequence
JVT-G012
Wu
Proposed
Waterfall
0
−2288
14048
Foreman
0
−2272
2152
Flower
0
62336
69072
Mobile
0
128888
154184
Bus
0
5944
5456
City
0
−1576
−1904
Stefen
0
−1096
24
Total
0
189936
243032In Table2(a), the proposed method obtains more better quality performance than JVT-G012 and Wu, although improvement is not obvious. However, Δ
R
total shows that the proposed algorithm has quite prominent bit rate performance. The proposed method reduces 243032 bits than JVT-G012 in total although each PSNRAverage is similar. This illustrates that the reconstructed video of proposed method has minimum actual total bits at the same or similar quality in almost all of simulations except City.One of the important quality measures of a video is that the quality of each frame should be uniform. The existing methods have not involved this issue. The  proposed method has solved this issue by selecting initial QP according to the highest and stablest quality as well as the lowest actual bits in (15). In Table 3, the quality of each frame shows an example of extreme changes. According to the JVT-G012, the value of initial QP is 25 at the target bit rate 0.7 Mbps. The maximum QP is 51 which can generate abominable quality and the minimum QP is 25 which can generate good quality. So the difference between the maximum and minimum of QPs in GOP can be a good measure for the stability of video quality. Figure 8 shows this stability performance for proposed method, Wu, and JVT-G012. In Figure 8, the proposed method obtains the lower difference of QPs than others in all the cases.Table 3
Reconstructed video with extremely changing quality.
Frame number
Bit/frame
QP
Frame PSNR
0
291952
25
38.084
1
95904
25
36.900
2
42176
31
34.305
3
24272
32
32.891
4
17208
34
32.058
5
12504
36
30.613
6
10280
38
30.614
7
8848
40
29.980
8
7776
42
29.338
9
7184
44
28.591
10
6408
46
27.687
11
5720
48
26.682
12
4976
50
25.367
13
4856
51
24.405
14
5432
51
24.615Stability performances.
(a)
Flower
(b)
Bus
(c)
Foreman
(d)
Mobile
(e)
Stefen
(f)
WaterfallIn fact, PSNR can objectively and effectively assess quality of one frame. However, PSNR is not a perfect measure to evaluate the qualities of video sequences which have multiple frames. In Table3, although the average PSNR is good, the quality of reconstructed video sequences is very low because the change of frame quality is very high. Extremely high fluctuation of the frame qualities means not only the repetition of fuzzy and vivid images but also video broken phenomenon. So in order to evaluate video sequences, average PSNR and stability should be considered simultaneously in a GOP.The quality of video sequences that have high complexity is very sensitive to the value of initial QP at low bit rate. For a given target bit, low initial QP can lead the large bits  assignment to the first frame and insufficient  bits to the other frames in a GOP to maintain qualities. Therefore, the stability of a reconstructed video sequence is a very important quality performance. Proposed optimal initial QP is determined under consideration of stability in (15). In Figure 8, the proposed method shows better results for all test video sequences at low bitrate. Especially, in high complexity video sequences, the proposed method guarantees excellent results.


## 4.2. Subjective Evaluation

General video user evaluates video sequences by just looking but not by calculating PSNR or stability. This implies the importance of subjective evaluation. Frankly speaking the relationship between the results of objective evaluation and subjective one is not known. Therefore, it is not easy to convert the difference of objective evaluation results to the differences in subjective evaluation.In this part, three methods, proposed method, JVT-G012, and Wu, are subjectively evaluated using the objective evaluation results, that is, the maximum and minimum QPs at 0.4 Mbps target bitrate. The Mobile sample video sequence is tested. Figure9 shows result of this situation.Result of subjective evolution.
(a)
Minimum QP of GOP based on JVT-G012
(b)
Maximum QP of GOP based on JVT-G012
(c)
Minimum QP of GOP based on Wu
(d)
Maximum QP of GOP based on Wu
(e)
Minimum QP of GOP based on proposed method
(f)
Maximum QP of GOP based on proposed methodThe average PSNRs of the proposed method, JVT-G012, and Wu are very similar at objective assessment, which are 25.22, 25.03, and 24.83, respectively.Although Figures9(a) and 9(c) show better quality than Figure 9(e), all objects in Figure 9(e) are vividly identified at minimum QPs. Although Figures 9(b) and 9(d) are very fuzzy and some details of frame are lost, the quality of Figure 9(f) is excellent compared with Figures 9(b) and 9(d).In subjective evaluation, we can see also the importance of stability from the gaps in Figures9(a), 9(b), 9(c), 9(d), 9(e), and 9(f), respectively.


## 5. Conclusions

In order to obtain the optimal initial QP for the various video sequences which have different spatial and temporal complexities, we  propose a simple and high performance initial QP determining method based on motion vector map and temporal complexity to decide an initial QP in given target bit rate. Four sample video sequences are selected according to the temporal complexity which is measured using motion vectors map, and the spatial complexities of four sample video sequences are computed according to proposed method. For any video sequences, the initial QP can be easily determined from matrices by target bit rate and mapped spatial complexity using proposed mapping method. Experimental results show that the proposed algorithm can obtain more outstanding objective and subjective performance than other conventional determining methods. In the future, one of the further research areas will be the development of quantitative measure for the temporal complexity. The study on temporal complexity will provide a hint to explain or to solve the exceptional case for H.264 AVC coding.



---

*Source: 595383-2014-01-08.xml*