-
Notifications
You must be signed in to change notification settings - Fork 2
/
TIPicView.h
99 lines (77 loc) · 3.14 KB
/
TIPicView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// TIPicView.h : main header file for the TIPICVIEW application
//
#if !defined(AFX_TIPICVIEW_H__F4725884_9A29_4492_AE12_0E3B106C2738__INCLUDED_)
#define AFX_TIPICVIEW_H__F4725884_9A29_4492_AE12_0E3B106C2738__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
typedef unsigned int UINT32;
typedef unsigned char uchar;
typedef unsigned long ulong;
typedef unsigned long slong;
typedef short sshort;
typedef char schar;
#define XOFFSET 250
#define DPIFIX(xx) MulDiv((xx), dpi, 96)
#pragma pack(push)
#pragma pack(1)
// this structure is assumed in quantize_new where it's accessed as unsigned chars, be careful
typedef struct tagMYRGBQUAD {
// mine is RGB instead of BGR
BYTE rgbRed;
BYTE rgbGreen;
BYTE rgbBlue;
BYTE rgbReserved;
} MYRGBQUAD;
#pragma pack(pop)
// change between float or double here
// for all that effort, though, float is NOT faster than double
//typedef double double;
// we manually wrap the Win10 function GetDpiForWindow()
UINT WINAPI GetDpiForWindow(_In_ HWND hWnd);
/////////////////////////////////////////////////////////////////////////////
// CTIPicViewApp:
// See TIPicView.cpp for the implementation of this class
//
class CTIPicViewApp : public CWinApp
{
public:
CTIPicViewApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTIPicViewApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
void loadSettings();
void saveSettings();
//{{AFX_MSG(CTIPicViewApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
void debug(wchar_t *s, ...);
// This macro basically reduces to 4 bits of accuracy, but rounds up and shifts back to the 8-bit RGB range (so high nibble only)
// I think this is causing a lot of my streaking...
// so for now, we are working in true color, which is great, but we are generating truecolor palettes when
// the chip can only do 12-bit color. So we'll get loss of detail and banding that we really should be
// dithering. But when we do this correction in the palette, it sometimes results in different palette selection.
// So.. do we do this after the palette selection but before the dither?
//#define MakeRoundedRGB(x) ((((((int)(x)<256-8)?(x)+8:(x))>>4)<<4)+8)
#define MakeRoundedRGB(x) (x)
#define MakeTrulyRoundedRGB(x) ((((((int)(x)<256-8)?(x)+8:(x))>>4)<<4)+8)
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
double yuvdist(double r1, double g1, double b1, double r2, double g2, double b2);
double yuvpaldist(double r1, double g1, double b1, int nCol);
void makeYUV(double r, double g, double b, double &y, double &u, double &v);
void makeY(double r, double g, double b, double &y);
void buildlookup();
#endif // !defined(AFX_TIPICVIEW_H__F4725884_9A29_4492_AE12_0E3B106C2738__INCLUDED_)