Add colour space auto guess option to UI.
[xy_vsfilter.git] / src / subpic / color_conv_table.h
blob428c65faf7c582252725200edae9dc7b40c1540f
1 /************************************************************************/
2 /* author: xy */
3 /* date: 20110914 */
4 /* description: color table for yuv rgb convertion, */
5 /* support both bt.601 and bt.709 */
6 /************************************************************************/
7 #ifndef __COLOR_CONV_TABLE_H_53D078BB_BBA1_441B_9728_67E29A1CB521__
8 #define __COLOR_CONV_TABLE_H_53D078BB_BBA1_441B_9728_67E29A1CB521__
10 struct ColorConvTable
12 enum YUV_Type
14 NONE,
15 BT601,
16 BT709,
19 static const ColorConvTable* GetColorConvTable(const YUV_Type& yuv_type);
20 static void DestroyColorConvTable(const YUV_Type& yuv_type);
21 static YUV_Type SetDefaultYUVType(const YUV_Type& yuv_type) { return s_default_yuv_type = yuv_type; }
22 static YUV_Type GetDefaultYUVType() { return s_default_yuv_type; };
23 static const ColorConvTable* GetDefaultColorConvTable() { return GetColorConvTable(s_default_yuv_type); }
25 YUV_Type yuv_type;
27 unsigned char Clip_base[256*3];
28 const unsigned char* Clip;
30 int c2y_cyb;
31 int c2y_cyg;
32 int c2y_cyr;
33 int c2y_cu;
34 int c2y_cv;
36 int c2y_yb[256];
37 int c2y_yg[256];
38 int c2y_yr[256];
40 int y2c_cbu;
41 int y2c_cgu;
42 int y2c_cgv;
43 int y2c_crv;
44 int y2c_bu[256];
45 int y2c_gu[256];
46 int y2c_gv[256];
47 int y2c_rv[256];
49 int cy_cy;
50 int cy_cy2;
52 private:
53 ColorConvTable(){}
55 bool InitColorConvTable(const YUV_Type& yuv_type);
57 void InitBT601ColorConvTable();
59 void InitBT709ColorConvTable();
61 void ColorConvInit();
63 static ColorConvTable* s_color_table_bt601;
64 static ColorConvTable* s_color_table_bt709;
65 static YUV_Type s_default_yuv_type;
68 #endif // end of __COLOR_CONV_TABLE_H_53D078BB_BBA1_441B_9728_67E29A1CB521__