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