b320fb00306e1d9b79cc9c81d7e8aab7f200e8c0
Stefan Schuermans continue implementing confi...

Stefan Schuermans authored 7 years ago

1) /*
2)  * EtherPix simulator
3)  *
4)  * Copyright 2017 Stefan Schuermans <stefan schuermans info>
5)  *
6)  * This program is free software: you can redistribute it and/or modify
7)  * it under the terms of the GNU General Public License as published by
8)  * the Free Software Foundation, version 3 of the License.
9)  *
10)  *
11)  * This program is distributed in the hope that it will be useful,
12)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14)  * GNU General Public License for more details.
15)  *
16)  * You should have received a copy of the GNU Lesser General Public License
17)  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18)  */
19) 
20) #ifndef MAPPING_H
21) #define MAPPING_H
22) 
Stefan Schuermans implement mapping table

Stefan Schuermans authored 7 years ago

23) #include <stdint.h>
24) 
Stefan Schuermans continue implementing confi...

Stefan Schuermans authored 7 years ago

25) /// mapping of input values to LED output values for a color channel
26) class Mapping
27) {
28) public:
29)   /// color channel number
30)   enum Channel {
31)     Red,
32)     Green,
33)     Blue,
34)     ChannelCount
35)   };
36) 
37) public:
38)   /// default constructor
39)   Mapping();
40) 
41)   /// constructor based on parameters
42)   Mapping(double base, double factor, double gamma);
43) 
Stefan Schuermans implement mapping table

Stefan Schuermans authored 7 years ago

44)   /// map display value to video value
45)   uint8_t display2video(uint8_t display) const
46)   {
47)     return m_display2video[display];
48)   }
49) 
50) protected:
51)   /// update internal mapping table based on parameters
52)   void update();
53) 
Stefan Schuermans continue implementing confi...

Stefan Schuermans authored 7 years ago

54) protected:
55)    /// parameters of mapping: display := base + factor * video ** (1.0 / gamma)
56)    //@{
57)    double m_base;
58)    double m_factor;
59)    double m_gamma;
60)    //@}
Stefan Schuermans implement mapping table

Stefan Schuermans authored 7 years ago

61)    /** mapping table from display values (from IPv4/UDP)
62)                      to video values (to show on screen) */
63)    uint8_t m_display2video[256];