Bit-inverted Gray Coded Bit-plane Matching for Low Complexity
Motion Estimation
Changryoul Choi and Jechang Jeong
Department of Electronics and Computer Engineering, Hanyang University, Seoul, Korea
Keywords: Block Matching, Motion Estimation, Bit-Plane Matching.
Abstract: In this paper, a bit-inverted Gray coded bit-plane matching algorithm is proposed for low complexity
motion estimation. Unlike the typical Gray coded bit-plane matching algorithms, the proposed algorithm
uses bit-inverted Gray codes for transforming image frames and a corresponding extended matching
criterion to enhance the motion estimation accuracy. Experimental results show that the proposed algorithm
outperforms other bit-plane matching based motion estimation algorithms while preserving the binary
matching characteristic.
1 INTRODUCTION
Motion estimation (ME) plays a key role in reducing
the total video data efficiently by exploiting the
correlation among neighbouring frames. The block
matching algorithm (BMA) is the most popular and
is deployed in many video compression standards
due to its simplicity and effectiveness. Although the
full search BMA (FSBMA) can find an optimal
motion vector according to some matching criterion
such as the sum of the absolute differences (SAD) or
the sum of the squared differences (SSD), it is not
suitable for real time applications due to the heavy
computational complexity. Therefore, many
techniques have been proposed to relieve the high
computational complexity of the FSBMA in the
literature (Li and Salari, 1995, Choi and Jeong,
2009). Among these techniques, there proposed
some algorithms that use different matching
criterion instead of the classical SAD or SSD to
make the faster computation of the matching
criterion itself exploiting the bit-wise operations.
These algorithms are called as bit-plane matching
(BPM) based ME. The advantages of these
techniques over the matching algorithms using the
classical SAD or SSD are two-fold: fast computation
of the matching criterion and reduced memory
bandwidth in the interim of ME process.
Natarajan et al. first proposed the one-bit
transform (1BT) based ME, where the reference
frames and the current frames are transformed into
one-bit representations by comparing the original
image frame with filtered output (Natarajan et al,
1997). A two-bit transform (2BT) based ME was
proposed to enhance the ME accuracy of the 1BT-
based ME algorithms (Erturk and Erturk, 2005). The
2BT-based ME shows some improvement especially
in small block sizes. Gullu proposed to use a two-bit
constraint mask according to the difference between
a pixel and its 1BT threshold value (Gullu, 2011).
Although this algorithm, weighted constrained 1BT
(WC1BT), shows some improvement in terms of the
ME accuracy, the binary matching characteristic
doesn’t hold due to a two-bit constraint mask.
Ko. et al. proposed Gray-coded BPM based ME
(Ko et al, 1999), which is also called truncated Gray-
coded BPM (TGCBPM) (Celebi et al, 2009). And its
variation weightless TGCBPM (WTGCBPM)
(Celebi et al, 2010) were also proposed. Both
TGCBPM and WTGCBPM use Gray-code mapping
as transforming image frames into bit-planes, which
is very simple compared to other bit-plane
transformation algorithms using complex filtering
operations. Let the gray-level of the pixel at location
(i, j) be represented as follows:
1210
12 10
(, ) 2 2 2 2
KK
KK
f
ij a a a a



(1)
where a
k
(0 k K-1) takes on either 0 or 1. Then
the corresponding Gray-code representation is given
by
11KK
g
a
1
,0 2
kk k
gaa kK

(2)
where
denotes the Boolean XOR operation and
230
Choi C. and Jeong J..
Bit-inverted Gray Coded Bit-plane Matching for Low Complexity Motion Estimation.
DOI: 10.5220/0005323902300234
In Proceedings of the 5th International Conference on Pervasive and Embedded Computing and Communication Systems (PECCS-2015), pages
230-234
ISBN: 978-989-758-084-0
Copyright
c
2015 SCITEPRESS (Science and Technology Publications, Lda.)
a
k
is the k-th bit representation. After this
transformation, TGCBPM and WTGCBPM use
respective number of non-matching points (NNMP)
as matching criteria which are given as:
,
11 1
1
00
(,)
2{(,) ( , )}
TGCBPM NTB
NN K
kNTB t t
kk
ijkNTB
NNMP m n
g
ij g i mj n





(3
)
,
11 1
1
00
(,)
(, ) ( , )
WTGCBPM NTB
NN K
tt
kk
ijkNTB
NNMP m n
ij g i mj n




where K represents the pixel-depth and NTB is the
number of truncated bits, the motion block size is
NN, and –s m, n s is the search range. The kth
most significant bit of the Gray-coded image pixel
frame of time t is represented as g
t
k
(i, j). Compared
with the previous BPM based ME algorithms,
TGCBPM and WTGCBPM based ME show
significant gains in terms of the ME accuracy.
Since all the matching criteria of BPMs try to
replace the SAD or SSD with the bitwise operations
for reduction of computational complexity, their
output must be similar to the SAD or SSD in order
to find a more accurate motion vector. Therefore, if
one can find a matching criterion (using only the
bitwise operations) whose output is similar to the
SAD or SSD between two image bit-planes, its ME
accuracy increases substantially. In this paper, a
transformation method which is a slight
modification of the typical Gray-code mapping is
proposed. And together with a transformation
method, a corresponding extended bitwise
operation-only matching criterion shows similar
characteristics with the output of the SSD.
Experimental results demonstrate that the proposed
algorithm outperforms other BPM based ME
algorithms while preserving the binary matching
characteristic.
The rest of this paper is organized as follows: In
Section II, the proposed algorithm is presented.
Experimental results and analyses are given in
Section III. Finally, Section IV provides conclusions.
2 PROPOSED ALGORITHM
Since the Gray-coded BPMs use only some of the
first most significant bits of pixels, they are very
similar to the quantized frame based ME except the
way of handling the quantized pixels and the
matching criterion (Choi and Jeong, 2013). For
example, when 2 bit-planes are used, their symbols
for respective matching criteria are in Table 1.
Table 1: Symbols for the quantized frame based ME and
the Gray-coded BPM based ME when using 2 bit-planes.
Quantized Symbol Quantized Frame Gray Coded
0
00
00
1
01
01
2
10
11
3
11
10
Note that the Gray-coded BPM based ME uses one
of the metrics of (3) and the quantized frame based
ME uses the metric of SAD. The metric distribution
of Gray-coded BPMs in terms of the absolute
difference between two quantized symbols is in
Table 2.
Table 2: Metric distributions of TGCBPM and
WTGCBPM when using 2 bit-planes.
Absolute Difference TGCBPM WTGCBPM
0 0 0
1 1 or 2 1
2 3 2
3 2 1
For TGCBPM, when two Gray-coded symbols
are (00, 01) or (11, 10), their distances are 1. And
when two symbols are (01, 11), their distance is 2.
Note that when the absolute difference between two
quantized symbols is k (0 k 3), its expected true
absolute difference between two pixels is 64k
(when the pixel bit-depth is 8). That is, the actual
distortion between two pixels in terms of the SAD is
proportional to the absolute difference between these
quantized symbols. Therefore, it would be better for
a matching criterion if the absolute difference
between two quantized symbols be small, its
matching criterion output be small, and vice versa.
To this end, the Gray coded bit-planes are inverted
as follows:
~, 1
kk
hgNTBkK

(4)
where K represents the pixel-depth, ~ represents the
Boolean NOT operation, NTB is the number of
truncated bits and g
k
is the k-th Gray bit
representation. Note that when NTB = 6, this code
allocation is that of the typical 2BT. And note also
that this inversion process does not violate the
property of the typical Gray codes that consecutive
codewords differ only in one bit position no matter
what NTB is. A corresponding matching criterion of
the bit-inverted Gray coded BPM (BGCBPM) is
proposed as follows:
Bit-invertedGrayCodedBit-planeMatchingforLowComplexityMotionEstimation
231
11 1
1
,1
00
(,) (,) ( , )
NN K
tt
gram k k
ijkNTB
NNMP m n h i j h i m j n




,2
11
1
211
00
(,)
2 [ (, ) { (, ) ( , )}]
gram
NN
KNTB t t t
KKK
ij
NNMP m n
hijhijhimjn






,3
11
11
211
00
(,)
2 [ (, ) { (, ) ( , )}]
gram
NN
KNTB t t t
KKK
ij
NNMP m n
hijhijhimjn






3
,
1
(,) (,)
BGCBPM gram i
i
NNMP m n NNMP m n
(5
)
where • denotes the Boolean AND operation, K
represents the pixel-depth, NTB is the number of
truncated bits, the motion block size is NN, and –s
m, n s is the search range. The kth most
significant bit of the bit-inverted Gray-coded image
frame of time t is represented as h
t
k
(i, j). Note that
this matching criterion is a generalized version of
(Choi and Jeong, 2013) by allowing the number of
bit-planes from 2 to (K-NTB).
To check whether the proposed bit-inversion of
Gray coded bit-planes and the corresponding
matching criterion reflect the properties of the
discussed above, the metric distributions of
BGCBPM in terms of the absolute difference are
calculated. Table 3 and Table 4 show the results
when 2 bit-planes and 3 bit-planes are used.
Table 3: Metric distributions of BGCBPM when using 2
bit-planes.
Absolute Difference BGCBPM
0 0
1 1
2 6
3 9
Table 4: Metric distributions of BGCBPM when using 3
bit-planes.
Absolute Difference BGCBPM
0 0
1 1
2 2
3 1 or 11
4 10
5 11 or 17
6 18
7 17
When using 2 bit-planes, the proposed matching
criterion of BGCBPM gives a small value when the
absolute difference is small and gives relatively
large value in the opposite case. Since these values
are much bigger than their absolute differences, the
proposed algorithm can prune out the bad motion
vectors effectively. Unlike the metric distributions of
2 bit-planes, those of 3 bit-planes show some
multiple metric outputs (when absolute difference is
3 or 5) and some metric output gives relatively small
value when their absolute difference is large (when
the absolute difference is 3). However, as can be
seen from the tables, these cases are relatively rare
and the metric distributions clearly show the
tendency that the proposed matching criterion of
BGCBPM gives a small value when the absolute
difference is small and vice versa.
Note that from (5), it appears that transforming
the image frames into bit-inverted Gray codes
requires (K-NTB) Boolean NOT operations more for
each pixel compared with the typical Gray-coded
BPMs. However, since the output of the XOR
operation between two binary vectors x and y is the
same as that of the XOR operation between ~x and
~y (where ~ means the component-wise NOT
operation), the following identity is easily derived:
(, ) (~ ,~ )
HH
wwxy x y
(6)
where w
H
denotes the Hamming weight. Therefore,
the bit-planes which only the Boolean XOR
operations are involved with need not to be inverted.
Table 5: Computational complexity comparison of
transformations (per pixel).
TGCBPM WTGCBPM WC1BT BGCBPM
XOR K-NTB-1 K-NTB-1 - K-NTB-1
NOT - - - 1
Shift - - 1 -
Addition - - 16 -
Subtraction - - 1 -
Comparison - - 8 -
Table 6: Computational complexity comparison of
matching (per pixel).
TGCBPM WTGCBPM WC1BT BGCBPM
XOR
N
N
(K-NTB)
N
N
(K-NTB)
NN
N
N
(K-NTB)
AND - - -
2N
N
Shift (K-NTB-1) - - 2
Addition
N
N
(K-NTB)
N
N
(K-NTB)
NN
3NN
K-NTB)+3
Compari-
son
- -
NN
-
Multipli
-cation
- -
NN
-
PECCS2015-5thInternationalConferenceonPervasiveandEmbeddedComputingandCommunicationSystems
232
Only the (K-2)th Gray coded bit needs to be inverted,
since only this bit-plane is involved with the
Boolean AND operation in (5). The total operations
of BGCBPM required for transformation of image
frames and for matching compared with other
recently proposed BPMs are in Table 5 and Table 6.
3 EXPERIMENTAL RESULTS
To demonstrate the superiority of the proposed
algorithm, several experiments were carried out by
comparing the ME accuracy of other BPM ME
algorithms including WC1BT, TGCBPM,
WTGCBPM, and the FSBMA using the measure of
SAD. For WC1BT, the thresholds were set to T
1
=
10, T
2
= 30, T
3
= 50. The first 100 frames of 17 CIF
(352 288) sequences are used as test sequences.
All the searching processes were in spiral order.
Table 7 shows the average peak-to-peak signal to
noise ratio (PSNR) results of the proposed
BGCBPM algorithm with varying NTBs compared
with other BPM based ME algorithms when the
motion block size is 1616 and the search range is
±16. We highlighted the PSNR values showing the
best performance (except the FSBMA) in each
sequence. The PSNR performances of the proposed
algorithm with varying NTBs clearly show that the
extension of the number of bit-planes from 2 to (K-
NTB) enhances the ME accuracy. And compared
with other BPM based ME algorithms, the proposed
BGCBPM shows the best ME accuracy in terms of
the PSNR. Compared with the recently proposed
WC1BT, although they use multiplications in
matching calculations and non-binary matching
characteristic, their PSNR performances are worse
than that of the proposed algorithm. And the PSNR
difference between the proposed BGCBPM and the
FSBMA is only 0.26dB, which is very small.
4 CONCLUSIONS
In this paper, a bit-inverted Gray coded BPM
algorithm is proposed for low complexity motion
estimation. Since the Gray-coded BPMs use only
some of the first most significant bits of pixels, they
are very similar to the quantized frame based ME
and the actual distortion between two pixels in terms
of the SAD is proportional to the absolute difference
between these quantized symbols. To incorporate
these facts into a BPM based ME, a transformation
method which is a slight modification of the typical
Gray-code mapping is proposed. And together with
a transformation method, a corresponding extended
bitwise operation-only matching criterion shows
Table 7: Average PSNR performance comparison of the algorithms when the motion block size is 1616.
WC1BT
TGCBPM
(NTB=5)
WTGCBPM
(NTB=5)
BGCBPM
(NTB=6)
BGCBPM
(NTB=5)
BGCBPM
(NTB=4)
FSBMA
stefan 25.42 25.47 25.46 25.60 25.71 25.68 25.75
football 23.36 23.68 23.55 23.59 23.95 23.87 24.00
akiyo 42.66 42.37 42.56 42.09 42.61 42.70 42.84
foreman 32.43 32.51 32.68 31.99 32.83 33.11 33.43
mobile 23.77 23.78 23.68 23.81 23.87 23.86 23.92
hall 34.09 33.81 33.84 33.16 34.03 33.95 34.34
coastguard 29.40 29.37 29.40 28.09 29.49 29.54 29.62
container 38.27 37.66 37.66 37.67 37.70 37.99 38.33
bus 24.48 24.66 24.53 24.62 24.84 24.84 24.90
dancer 30.07 30.96 30.77 30.48 31.16 31.66 32.14
mother 39.55 39.25 39.48 37.48 39.49 39.76 40.12
tempete 27.38 27.51 27.46 27.44 27.61 27.61 27.70
table tennis.
28.27 28.18 28.37 28.32 28.62 28.71 28.87
flower 25.88 25.93 25.92 25.84 25.98 25.98 26.03
children 28.72 28.93 28.68 29.04 29.17 29.11 29.24
paris 30.50 30.52 30.48 30.49 30.67 30.65 30.71
news 36.68 36.92 36.89 36.79 37.04 37.07 37.33
Average 30.64 30.68 30.67 30.38 30.87 30.95 31.13
Bit-invertedGrayCodedBit-planeMatchingforLowComplexityMotionEstimation
233
similar characteristics with the output of the SSD.
Experimental results show that the proposed
algorithm outperforms other BPM based ME
algorithms while preserving the binary matching
characteristic.
ACKNOWLEDGEMENTS
This research was supported by the MSIP (Ministry
of Science, ICT & Future Planning), Korea, under
the "Establishing IT Research Infrastructure
Projects" supervised by NIPA (National IT Industry
Promotion Agency) (I2221-14-1005).
REFERENCES
Li, W., Salari, E., “Successive elimination algorithm for
motion estimation,” IEEE Trans. Image Process., vol.
4, no.1, pp. 105-107, Jan. 1995.
Choi, C., Jeong, J., “New sorting-based partial distortion
elimination algorithm for fast optimal motion
estimation,” IEEE Trans. Consumer Electron., vol. 55,
no. 4, pp. 2335-2340, Nov. 2009.
Natarajan, B., et al, “Low-complexity block-based motion
estimation via one-bit transforms,” IEEE Trans.
Circuits Syst. Video Technol., vol. 7, no. 5, pp. 702-
706, Aug. 1997.
Erturk, A., Erturk, S., “Two-bit transform for binary block
motion estimation,” IEEE Trans. Circuits Syst. Video
Technol., vol. 15, no. 7, pp. 938-946, July 2005.
Celebi, A., et al, “Truncated Gray-coded bit-plane
matching based motion estimation method and its
hardware architecture,” IEEE Trans. Consumer
Electron., vol. 55, no. 3, pp. 1530-1536, Aug. 2009.
Celebi, A., et al, “Bit plane matching based variable block
size motion estimation method and its hardware
architecture,” IEEE Trans. Consumer Electron., vol.
56, no. 3, pp. 1625-1633, Aug. 2010.
Choi, C., Jeong, J., “Enhanced two-bit transform based
motion estimation via extension of matching
criterion,” IEEE Trans. Consumer Electron, vol. 56,
no. 3, pp. 1883-1889, Aug. 2010.
Gullu, M., “Weighted constrained one-bit transform based
fast block motion estimation,” IEEE Trans. Consumer
Electron., vol. 57, no. 2, pp. 751-755, May 2011.
Ko, S.-J., et al, “Fast digital image stabilizer based on
Gray-coded bit-plane matching,” IEEE Trans.
Consumer Electron., vol. 45, no. 3, pp. 598-603, Aug.
1999.
Baek, Y., et al, “An efficient block matching criterion for
motion estimation and its VLSI architecture,” IEEE
Trans. Consumer Electron., vol. 42, no. 4, pp. 885-
892, Nov. 1996.
Choi, C., Jeong, J., “Constrained two-bit transform for low
complexity motion estimation,” International
Conference on Consumer Electronics, ICCE 2013, Las
Vegas, USA, Jan. 2013.
PECCS2015-5thInternationalConferenceonPervasiveandEmbeddedComputingandCommunicationSystems
234