8d206cf46c8f221b4316b934350181656c19b7c3
[imagesqueeze.git] / src / main / java / eu / svjatoslav / imagesqueeze / codec / ColorStats.java
1 /*
2  * Imagesqueeze - Image codec optimized for photos.
3  * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public License
7  * as published by the Free Software Foundation.
8  */
9
10 package eu.svjatoslav.imagesqueeze.codec;
11
12 public class ColorStats {
13
14         int ySum;
15         int uSum;
16         int vSum;
17
18         int pixelCount;
19
20         public ColorStats() {
21                 reset();
22         }
23
24         public int getAverageU() {
25                 return uSum / pixelCount;
26         }
27
28         public int getAverageV() {
29                 return vSum / pixelCount;
30         }
31
32         public int getAverageY() {
33                 return ySum / pixelCount;
34         }
35
36         public void reset() {
37                 ySum = 0;
38                 uSum = 0;
39                 vSum = 0;
40                 pixelCount = 0;
41         }
42
43 }