MEASURING POWER CONSUMPTION FOR IMAGE PROCESSING ON ANDROID SMARTPHONE

The energy consumption of smartphones can be undert aken in multiple levels of hardware and software. Generally, there are two approaches in measuring po wer consumption of a smartphone application which are the measurement-based and estimation-based meth ods. The goal of this study is to compare the two power consumption measuring approaches in quantifyi g the power consumed by image processing applications in Android smartphone. For measurement -based approach, a simple wattmeter is designed whereas for the estimation-based approach, an Andro id application called the PowerTutor will be utilized. The wattmeter and PowerTutor will measure the power consumption of eight image processing methods running on modified Android libr ary with self-implemented algorithm called the CamTest . According to t-test analysis that has been conduct ed, he p values of all of the image processing methods show that there are no significa t differences between the wattmeter and the PowerTutor application (p>0.01). Even though measur ement-based method is more accurate than estimation-based method in term of measuring power consumption, PowerTutor application proved it provides accurate, real-time power consumption esti mation for Android platform smartphones. Application developers still can use PowerTutor as an option to determine the impact of software design on power consumption.


INTRODUCTION
The mobile phones have become an indispensable and inseparable object in human life. There are 3.3 billion active mobile phones in the world (Lefebvre, 2009). It is common for individuals to own more than one. The increasing dependency upon mobile phone to perform a lot of functions more capability than conventional handsets make mobile phone itself has evolved into an entirely new device that we know as smartphone.
The growth of the smartphone industry has led these devices to keep improving their function such as high resolution camera with flash, bigger screens and support the thousands of application. Since the Open Handset Alliance released the Google Android SDK on November 12, 2007 (OHA), the conception of the Android platform is attracting more programmers to develop Android application. Android application developers also prefer to interface built-in device such as sensors, Wi-Fi, Bluetooth, camera and others into their application.
Application that uses camera usually related to image processing filters such as Gaussian, median, mean, Laplacian, Sobel and others (Genser et al., 2009). Image processing applications usually drain more power than other application because it process pixel by pixel of the image with heavy mathematical computation. Besides, image processing also use more memory and time consuming.
Power consumption of the smartphone can be measured using two approaches which are the measurement-base and estimation based approaches. To

AJAS
compare those two power consumption measuring approaches, two tools have been chosen to represent each of the approaches. The tools are the custom made wattmeter and the power meter application called PowerTutor (Zhang et al., 2010). In order to measure the power accurately, the wattmeter is designed to measure even very minimal power consumption of eight image processing methods running on modified Android smartphone platform (Anuar et al., 2011). The measurement from the wattmeter will be compared with the measurement from the PowerTutor.
According to (Genser et al., 2009), software application power profiling can be categorized into measurement-based and estimation-based methods. Measurement-based methods are performed by measuring actual physical measurements. This method give high accuracy compared to other method but requires external measurement tool. On the contrary, power profiling by estimation methods is usually based on power modeling. Compared to the measurementbased method, these techniques are usually less accurate but more portable and provide better flexibility.
Measurement-based methods: In (Rice and Hay, 2010;Joshua and Lin, 2010), the power profiling tool for smartphone applications is introduced. These methods obtain the value of power using Joule's law (Equation 1): The system applied series circuit combination where the current is the same at any point in the circuit. Measurement resistor is placed between power supply and the load. This resistor value should be as small as possible to reduce voltage drop crossing the measurement resistor. Since the resistance value is fixed and the voltage drop across the resistor is obtained using differential amplifier connected to microcontroller for later analysis. After the value of voltage and resistance are known, by using Ohm's law (Equation 2): The current value will be easily calculated. Multiplying the current with the voltage drop across the resistor gives the power dissipated.
An oscilloscope measurement-based profiling technique is proposed by Texas Instrument (TI) in (TI, 2002). The current drawn by a DSP system is profiled and results are viewed on a host computer in TI's software development environment.

Estimation-Based Methods
Energy profiling by means of estimation techniques can be divided into (i) simulation-based and (ii) hardwareaccelerated approaches (Genser et al., 2009). Simulationbased power estimation executes programs on simulators to acquire circuit activity information. Power values are obtained using this information. In hardware-accelerated power estimation approaches, power information is derived from power models, which are implemented in hardware.
Early estimation-based method models focused on estimating the power consumption of individual components, using the corresponding performance counters (Pathak et al., 2011) (CPU, memory and of the entire system), e.g., (Tiwari et al., 1996;Bellosa, 2000;Rawson, 2004). These models do not relate the power consumption of the system with the applications. Recent estimation-based power models tried to estimate the power consumption of application running on desktops (Zeng et al., 2002), sensor nodes (Shnayder et al., 2004), virtual machines (Kansal et al., 2010) and more recently, mobile phones (Zhang et al., 2010).

The Custom Wattmeter
In order to measure power consumption of the smartphone, a device was built to analyze current flowing into the smartphone. This device uses external power supply only for the voltage supplier for the entire device but for the phone it will use its own battery as power supply to maintain the actual current and voltage. Four 0.1Ω measurement resistor in parallel (to get 0.025Ω) are inserted between a battery terminal and its connector on the phone. This is done by replacing the battery of the smartphone with copper tape.
The measurement resistor surely will increase the circuit resistance and its power consumption but the increases are typically less than 1% of the total power. The circuit schematic is shown in Fig. 1. The wattmeter hardware to measure power consumption of the smartphone is shown in Fig. 2. The hardware consists of a LCD display to show the power consumption value, a microcontroller to calculate of the measured power consumption and the power measuring circuits. The Analog to Digital Converter (ADC) of the microcontroller will read the voltage and the current from the power circuits and convert it into power in Watts unit.
Android platform should always positively recognize a battery's presence through the buffer surges. On most smartphone, the battery contains a tiny, undocumented, microcontroller attached between two pins between V+ and V-on the battery (Joshua and Lin, 2010).  This microcontroller stores some state-of-charge information and can be functioned as thermometer to read temperature from the battery. Without this microcontroller's presence, the smartphone system will unable to boot and if the microcontroller is removed from an actively running system, the smartphone will shut down immediately. The battery should be handled carefully so that it will not disturb the entire power consumption measuring system and shut the smartphone system down.

The image processing methods
There are eight image processing methods that are tested in the experiment. Each of the methods will be executed on each frame of displayed by the smartphone's camera. Table 1 shows the brief description the eight image processing methods. The input format from the Android smartphone camera is in usually in the YUV color space. So it needs to be converted to RGB color space for video processing in standard color space. For video processing in grayscale, the luma (Y) is mapped to 0~255 scale. For RGB processing, all the channels in YUV color space are used to convert from the YUV space into the RGB space. And lastly, for the threshold, median, Gaussian, mean, Laplacian and Sobel image processing, the resulting grayscale fram from the grayscale processing method is utilized.
The YUV to RGB conversion formula is calculated using (Equation 3): For image thresholding each pixel is thresholded against a constant number T. If the pixel value larger than T, the pixel value will set to 1, otherwise the pixel value will be set to 0. The image thresholding can be calculated using the following formula (Equation 4): where, f(x, y) is original frame and g(x, y) is thresholded frame. In order to remove the noise from the frame using median filter, each 3×3 window of the original frame is processed by calculating the median value of the whole pixels in 3×3 window. This median value is then will be the new pixel value on the median filtered frame.

AJAS
For video blurring image processing, each frame is convolved using a 3×3 mask. For Gaussian blurring, the frame will be convolved with the 3×3 mask as shown in Fig. 3a. For mean filter, the frame will be convolved with 3×3 mask as shown in Fig. 3b. For edge detection, each frame is convolved using a 3×3 mask. For Laplacian, the frame will be convolved with the 3×3 mask as shown in Fig. 3c. The sobel edge detection uses two 3×3 masks which are convolved in the vertical and horizontal directions of the frame. The two 3×3 masks are as shown in Fig. 4. Figure 5 shows the image processing methods using CamTest application. Those images were captured in real-time using Xperia Ray Android smartphone camera at the same position for the eight different methods as explained previously.

RESULTS
The experiment is done on Xperia Ray smartphone that is powered by 1 GHz Scorpion processor running with Android 4.0 Ice Cream Sandwich Operating System (OS). An Android application is developed using the CamTest library to run the eight image processing methods. The application will run any of the eight image processing methods to each 3264×2448 pixels frame detected by the 8 mega pixels camera.
While the smartphone is running the image processing task, simultaneously, the wattmeter and the PowerTutor application will measure the power consumption of the smartphone. Before that, we need to measure the power consumption of the smartphone before running the image processing application and labeled as the system power. Each of the power measured after running the image processing application will be subtracted with the system power in order to obtain the image processing power consumption.
For each image processing method, the power consumed by the image processing application is recorded for 60 sec. Then the average power in 1 sec. value is recorded. The process is iterated 30 times and the mean of the 30 average power consumption per second is recorded for graphical display. The same procedures are conducted with the wattmeter and the PowerTutor.
To measure the differences between the wattmeter and the PowerTutor, the t-test is executed. As explained before, each power measurement for each image processing method using different power consumption measuring method is iterated 30 times. Those 30 readings will be treated as samples for each image processing method class using different power consumption measuring approaches. These samples are then use in the t-test experiment.   Figure 6 shows the mean of the 30 average power consumption in 1 sec. of the eight image processing method measured by from the wattmeter and from the PowerTutor application.
As it can be seen, the PowerTutor is slightly higher than the wattmeter for moss of the cases but there are also case where wattmeter measured higher power consumption than the PoweTutor.
To determine whether two samples are likely to have come from the similar source that have same mean, the ttest have been performed. Table 2 shows the p values for those eight image processing methods. Since all p values are greater than 0.01, measurement value from wattmeter is not significantly different compared to the measurement value from PowerTutor.

DISCUSSION
From the average power consumption per second measurement, it can be seen that we are unable to make any decision which power consumption measuring approaches is better since the reading of the power consumption is quite similar for both of the approaches. As explained earlier in the introduction section, the measurement-based approach is the most accurate since it measures the power directly from the source.
However, the t-test confirms that there are no significant differences between the power consumption measured by the wattmeter or the PowerTutor in measuring the power consumption of image processing tasks.
This shows that the PowerTutor application can be an alternative method in measuring the power of the applications that are running in the Android smartphone especially image or video related application that consumes much power of displaying or processing the large data.

CONCLUSION
This experiment provides typical values and is useful information for smartphone users and developers. The application developers can benefit from knowing the detail behind these measurements. This study also described the measurement framework and how it can be used to create fine-grained understanding of energy consumption. This work has an easily replicable design by which application developers can measure the impact that their application has on a system battery life on their own without have to buy expensive machine to measure their application power consumption. The system has been designed can effectively help future Android developers especially to optimize power consumption and enhance battery performance.

AJAS
Even though measurement-based method is more accurate than estimation-based method in term of measuring power consumption, PowerTutor application has proved it can provide accurate, real-time power consumption estimation for Android platform smart phones. Application developers still can use PowerTutor as an option to determine the impact of software design on power consumption.