1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * This file is part of openfx-supportext <https://github.com/devernay/openfx-supportext>,
4  * Copyright (C) 2013-2018 INRIA
5  *
6  * openfx-supportext 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; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * openfx-supportext 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 General Public License
17  * along with openfx-supportext.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
18  * ***** END LICENSE BLOCK ***** */
19 
20 /*
21  * OFX Resolution helper
22  */
23 
24 #ifndef IO_ofxsResolution_h
25 #define IO_ofxsResolution_h
26 
27 #define kParamFormatPCVideo        "PC_Video"
28 #define kParamFormatPCVideoLabel   "PC_Video 640x480"
29 #define kParamFormatNTSC           "NTSC"
30 #define kParamFormatNTSCLabel      "NTSC 720x486 0.91"
31 #define kParamFormatPAL            "PAL"
32 #define kParamFormatPALLabel       "PAL 720x576 1.09"
33 #define kParamFormatNTSC169        "NTSC_16:9"
34 #define kParamFormatNTSC169Label   "NTSC_16:9 720x486 1.21"
35 #define kParamFormatPAL169         "PAL_16:9"
36 #define kParamFormatPAL169Label    "PAL_16:9 720x576 1.46"
37 #define kParamFormatHD720          "HD_720"
38 #define kParamFormatHD720Label     "HD_720 1280x1720"
39 #define kParamFormatHD             "HD"
40 #define kParamFormatHDLabel        "HD 1920x1080"
41 #define kParamFormatUHD4K          "UHD_4K"
42 #define kParamFormatUHD4KLabel     "UHD_4K 3840x2160"
43 #define kParamFormat1kSuper35      "1K_Super35(full-ap)"
44 #define kParamFormat1kSuper35Label "1K_Super35(full-ap) 1024x778"
45 #define kParamFormat1kCinemascope  "1K_Cinemascope"
46 #define kParamFormat1kCinemascopeLabel "1K_Cinemascope 914x778 2"
47 #define kParamFormat2kSuper35      "2K_Super35(full-ap)"
48 #define kParamFormat2kSuper35Label "2K_Super35(full-ap) 2048x1556"
49 #define kParamFormat2kCinemascope  "2K_Cinemascope"
50 #define kParamFormat2kCinemascopeLabel "2K_Cinemascope 1828x1556 2"
51 #define kParamFormat2kDCP          "2K_DCP"
52 #define kParamFormat2kDCPLabel     "2K_DCP 2048x1080"
53 #define kParamFormat4kSuper35      "4K_Super35(full-ap)"
54 #define kParamFormat4kSuper35Label "4K_Super35(full-ap) 4096x3112"
55 #define kParamFormat4kCinemascope  "4K_Cinemascope"
56 #define kParamFormat4kCinemascopeLabel  "4K_Cinemascope 3656x3112 2"
57 #define kParamFormat4kDCP          "4K_DCP"
58 #define kParamFormat4kDCPLabel     "4K_DCP 4096x2160"
59 #define kParamFormatSquare256      "square_256"
60 #define kParamFormatSquare256Label "square_256 256x256"
61 #define kParamFormatSquare512      "square_512"
62 #define kParamFormatSquare512Label "square_512 512x512"
63 #define kParamFormatSquare1k       "square_1K"
64 #define kParamFormatSquare1kLabel  "square_1K 1024x1024"
65 #define kParamFormatSquare2k       "square_2K"
66 #define kParamFormatSquare2kLabel  "square_2K 2048x2048"
67 
68 namespace OFX {
69 enum EParamFormat
70 {
71     eParamFormatPCVideo,
72     eParamFormatNTSC,
73     eParamFormatPAL,
74     eParamFormatNTSC169,
75     eParamFormatPAL169,
76     eParamFormatHD720,
77     eParamFormatHD,
78     eParamFormatUHD4K,
79     eParamFormat1kSuper35,
80     eParamFormat1kCinemascope,
81     eParamFormat2kSuper35,
82     eParamFormat2kCinemascope,
83     eParamFormat2kDCP,
84     eParamFormat4kSuper35,
85     eParamFormat4kCinemascope,
86     eParamFormat4kDCP,
87     eParamFormatSquare256,
88     eParamFormatSquare512,
89     eParamFormatSquare1k,
90     eParamFormatSquare2k,
91     eParamFormatCount
92 };
93 
94 inline void
getFormatResolution(const EParamFormat format,int * width,int * height,double * par)95 getFormatResolution(const EParamFormat format,
96                     int *width,
97                     int *height,
98                     double *par)
99 {
100     switch (format) {
101     case eParamFormatPCVideo:
102         *width =  640; *height =  480; *par = 1.; break;
103     case eParamFormatNTSC:
104         *width =  720; *height =  486; *par = 0.91; break;
105     case eParamFormatPAL:
106         *width =  720; *height =  576; *par = 1.09; break;
107     case eParamFormatNTSC169:
108         *width =  720; *height =  486; *par = 1.21; break;
109     case eParamFormatPAL169:
110         *width =  720; *height =  576; *par = 1.46; break;
111     case eParamFormatHD720:
112         *width = 1280; *height =  720; *par = 1.; break;
113     case eParamFormatHD:
114         *width = 1920; *height = 1080; *par = 1.; break;
115     case eParamFormatUHD4K:
116         *width = 3840; *height = 2160; *par = 1.; break;
117     case eParamFormat1kSuper35:
118         *width = 1024; *height =  778; *par = 1.; break;
119     case eParamFormat1kCinemascope:
120         *width =  914; *height =  778; *par = 2.; break;
121     case eParamFormat2kSuper35:
122         *width = 2048; *height = 1556; *par = 1.; break;
123     case eParamFormat2kCinemascope:
124         *width = 1828; *height = 1556; *par = 2.; break;
125     case eParamFormat2kDCP:
126         *width = 2048; *height = 1080; *par = 1.; break;
127     case eParamFormat4kSuper35:
128         *width = 4096; *height = 3112; *par = 1.; break;
129     case eParamFormat4kCinemascope:
130         *width = 3656; *height = 3112; *par = 2.; break;
131     case eParamFormat4kDCP:
132         *width = 4096; *height = 2160; *par = 1.; break;
133     case eParamFormatSquare256:
134         *width =  256; *height =  256; *par = 1.; break;
135     case eParamFormatSquare512:
136         *width =  512; *height =  512; *par = 1.; break;
137     case eParamFormatSquare1k:
138         *width = 1024; *height = 1024; *par = 1.; break;
139     case eParamFormatSquare2k:
140         *width = 2048; *height = 2048; *par = 1.; break;
141     default:
142         break;
143     }
144 }
145 } // namespace OFX
146 
147 #endif // ifndef IO_ofxsResolution_h
148 
149