GCC Code Coverage Report


Directory: avs_core/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 73.0% 384 / 0 / 526
Functions: 72.1% 158 / 0 / 219
Branches: 57.4% 339 / 0 / 591

core/interface.cpp
Line Branch Exec Source
1 // Avisynth v2.5. Copyright 2002, 2005 Ben Rudiak-Gould et al.
2 // Avisynth v2.6. Copyright 2006 Klaus Post.
3 // Avisynth v2.6. Copyright 2009 Ian Brabham.
4 // http://avisynth.nl
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; either version 2 of the License, or
9 // (at your option) any later version.
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 General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
19 // http://www.gnu.org/copyleft/gpl.html .
20 //
21 // Linking Avisynth statically or dynamically with other modules is making a
22 // combined work based on Avisynth. Thus, the terms and conditions of the GNU
23 // General Public License cover the whole combination.
24 //
25 // As a special exception, the copyright holders of Avisynth give you
26 // permission to link Avisynth with independent modules that communicate with
27 // Avisynth solely through the interfaces defined in avisynth.h, regardless of the license
28 // terms of these independent modules, and to copy and distribute the
29 // resulting combined work under terms of your choice, provided that
30 // every copy of the combined work is accompanied by a complete copy of
31 // the source code of Avisynth (the version of Avisynth used to produce the
32 // combined work), being distributed under the terms of the GNU General
33 // Public License plus this exception. An independent module is a module
34 // which is not derived from or based on Avisynth, such as 3rd-party filters,
35 // import and export plugins, or graphical user interfaces.
36
37
38 /* Maintenance notes :-
39 *
40 * All the code here was formally baked into the avisynth.h interface.
41 *
42 * Whenever you modify any code here please keep and mark the original
43 * code with a block comment beginning with the word "Baked"
44 *
45 * Be mindful with changes you do make that previous 2.5 plugins will
46 * still have the original code active. This may require other defensive
47 * or mitigating code elsewhere.
48 */
49
50 #include <avisynth.h>
51
52 #ifdef AVS_WINDOWS
53 #include <avs/win.h>
54 #else
55 #include <avs/posix.h>
56 #endif
57 #include "InternalEnvironment.h"
58 #include "DeviceManager.h"
59 #include "AVSMap.h"
60 #include "function.h"
61 #include "assert.h"
62
63 /**********************************************************************/
64
65 // struct VideoInfo
66
67 // useful functions of the above
68 28 bool VideoInfo::HasVideo() const { return (width!=0); }
69 847 bool VideoInfo::HasAudio() const { return (audio_samples_per_second!=0); }
70 1140 bool VideoInfo::IsRGB() const { return !!(pixel_type&CS_BGR); }
71
4/4
✓ Branch 2 → 3 taken 50 times.
✓ Branch 2 → 5 taken 106 times.
✓ Branch 3 → 4 taken 28 times.
✓ Branch 3 → 5 taken 22 times.
156 bool VideoInfo::IsRGB24() const { return ((pixel_type & CS_BGR24) == CS_BGR24) && ((pixel_type & CS_Sample_Bits_Mask) == CS_Sample_Bits_8); } // Clear out additional properties
72
4/4
✓ Branch 2 → 3 taken 30 times.
✓ Branch 2 → 5 taken 285 times.
✓ Branch 3 → 4 taken 23 times.
✓ Branch 3 → 5 taken 7 times.
315 bool VideoInfo::IsRGB32() const { return ((pixel_type & CS_BGR32) == CS_BGR32) && ((pixel_type & CS_Sample_Bits_Mask) == CS_Sample_Bits_8); }
73 3173 bool VideoInfo::IsYUV() const { return !!(pixel_type&CS_YUV ); }
74 5260 bool VideoInfo::IsYUY2() const { return (pixel_type & CS_YUY2) == CS_YUY2; }
75
76 bool VideoInfo::IsYV24() const { return (pixel_type & CS_PLANAR_MASK) == (CS_YV24 & CS_PLANAR_FILTER); }
77 1 bool VideoInfo::IsYV16() const { return (pixel_type & CS_PLANAR_MASK) == (CS_YV16 & CS_PLANAR_FILTER); }
78 17 bool VideoInfo::IsYV12() const { return (pixel_type & CS_PLANAR_MASK) == (CS_YV12 & CS_PLANAR_FILTER); }
79 7 bool VideoInfo::IsY8() const { return (pixel_type & CS_PLANAR_MASK) == (CS_Y8 & CS_PLANAR_FILTER); }
80
81 11983 bool VideoInfo::IsYV411() const { return (pixel_type & CS_PLANAR_MASK) == (CS_YV411 & CS_PLANAR_FILTER); }
82 //bool VideoInfo::IsYUV9() const { return (pixel_type & CS_PLANAR_MASK) == (CS_YUV9 & CS_PLANAR_FILTER); }
83
84 /* Baked ********************
85 bool VideoInfo::IsColorSpace(int c_space) const { return ((pixel_type & c_space) == c_space); }
86 Baked ********************/
87 bool VideoInfo::IsColorSpace(int c_space) const {
88 // This function will check if the colorspace (VideoInfo.pixel_type) is the same as given c_space (or more general it checks for a Colorspace property (see avisynth.h)).
89 // So it's not only for exact colorspace comparison but checking properties also.
90 return IsPlanar() ? ((pixel_type & CS_PLANAR_MASK) == (c_space & CS_PLANAR_FILTER)) :
91 // support exact individual flag checking
92 c_space == CS_YUVA ? ((c_space & CS_YUVA) == CS_YUVA) :
93 c_space == CS_BGR ? ((c_space & CS_BGR) == CS_BGR) :
94 c_space == CS_YUV ? ((c_space & CS_YUV) == CS_YUV) :
95 c_space == CS_INTERLEAVED ? ((c_space & CS_INTERLEAVED) == CS_INTERLEAVED) :
96 // RGB got sample bits:
97 // In order to work: RGB64.IsColorSpace(RGB32) => false, or else we get true (RGB64 & RGB32 == RGB32)
98 // Simple ((pixel_type & c_space) == c_space) would not work, does not take into account bit depth
99 ( ((pixel_type & ~CS_Sample_Bits_Mask & c_space) == (c_space & ~CS_Sample_Bits_Mask)) &&
100 ((pixel_type & CS_Sample_Bits_Mask) == (c_space & CS_Sample_Bits_Mask)) );
101 }
102
103 bool VideoInfo::Is(int property) const { return ((image_type & property)==property ); }
104 11274 bool VideoInfo::IsPlanar() const { return !!(pixel_type & CS_PLANAR); }
105 85 bool VideoInfo::IsFieldBased() const { return !!(image_type & IT_FIELDBASED); }
106 bool VideoInfo::IsParityKnown() const { return ((image_type & IT_FIELDBASED)&&(image_type & (IT_BFF|IT_TFF))); }
107 4 bool VideoInfo::IsBFF() const { return !!(image_type & IT_BFF); }
108 4 bool VideoInfo::IsTFF() const { return !!(image_type & IT_TFF); }
109
110 /* Baked ********************
111 bool VideoInfo::IsVPlaneFirst() const {return ((pixel_type & CS_YV12) == CS_YV12); } // Don't use this
112 int VideoInfo::BytesFromPixels(int pixels) const { return pixels * (BitsPerPixel()>>3); } // Will not work on planar images, but will return only luma planes
113 int VideoInfo::RowSize() const { return BytesFromPixels(width); } // Also only returns first plane on planar images
114 int VideoInfo::BMPSize() const { if (IsPlanar()) {int p = height * ((RowSize()+3) & ~3); p+=p>>1; return p; } return height * ((RowSize()+3) & ~3); }
115 int64_t VideoInfo::AudioSamplesFromFrames(int64_t frames) const { return (fps_numerator && HasVideo()) ? ((int64_t)(frames) * audio_samples_per_second * fps_denominator / fps_numerator) : 0; }
116 Baked ********************/
117
3/4
✓ Branch 2 → 3 taken 12 times.
✗ Branch 2 → 6 not taken.
✓ Branch 4 → 5 taken 11 times.
✓ Branch 4 → 6 taken 1 time.
12 int64_t VideoInfo::AudioSamplesFromFrames(int frames) const { return (fps_numerator && HasVideo()) ? ((int64_t)(frames) * audio_samples_per_second * fps_denominator / fps_numerator) : 0; }
118
2/4
✓ Branch 2 → 3 taken 5 times.
✗ Branch 2 → 6 not taken.
✓ Branch 4 → 5 taken 5 times.
✗ Branch 4 → 6 not taken.
5 int VideoInfo::FramesFromAudioSamples(int64_t samples) const { return (fps_denominator && HasAudio()) ? (int)((samples * fps_numerator)/((int64_t)fps_denominator * audio_samples_per_second)) : 0; }
119
1/2
✓ Branch 3 → 4 taken 4 times.
✗ Branch 3 → 6 not taken.
4 int64_t VideoInfo::AudioSamplesFromBytes(int64_t bytes) const { return HasAudio() ? bytes / BytesPerAudioSample() : 0; }
120 266 int64_t VideoInfo::BytesFromAudioSamples(int64_t samples) const { return samples * BytesPerAudioSample(); }
121
2/2
✓ Branch 3 → 4 taken 57 times.
✓ Branch 3 → 5 taken 1 time.
58 int VideoInfo::AudioChannels() const { return HasAudio() ? nchannels : 0; }
122 62 int VideoInfo::SampleType() const{ return sample_type;}
123 14 bool VideoInfo::IsSampleType(int testtype) const{ return !!(sample_type&testtype);}
124 12 int VideoInfo::SamplesPerSecond() const { return audio_samples_per_second; }
125 325 int VideoInfo::BytesPerAudioSample() const { return nchannels*BytesPerChannelSample();}
126
2/2
✓ Branch 2 → 3 taken 17 times.
✓ Branch 2 → 4 taken 13 times.
30 void VideoInfo::SetFieldBased(bool isfieldbased) { if (isfieldbased) image_type|=IT_FIELDBASED; else image_type&=~IT_FIELDBASED; }
127 17 void VideoInfo::Set(int property) { image_type|=property; }
128 17 void VideoInfo::Clear(int property) { image_type&=~property; }
129
130 /* Baked ********************
131 int VideoInfo::BitsPerPixel() const {
132 switch (pixel_type) {
133 case CS_BGR24:
134 return 24;
135 case CS_BGR32:
136 return 32;
137 case CS_YUY2:
138 return 16;
139 case CS_YV12:
140 case CS_I420:
141 return 12;
142 default:
143 return 0;
144 }
145 }
146 Baked ********************/
147
148 333 int VideoInfo::BytesPerChannelSample() const {
149
3/6
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 116 times.
✗ Branch 2 → 5 not taken.
✗ Branch 2 → 6 not taken.
✓ Branch 2 → 7 taken 211 times.
✓ Branch 2 → 8 taken 6 times.
333 switch (sample_type) {
150 case SAMPLE_INT8:
151 return sizeof(unsigned char);
152 116 case SAMPLE_INT16:
153 116 return sizeof(signed short);
154 case SAMPLE_INT24:
155 return 3;
156 case SAMPLE_INT32:
157 return sizeof(signed int);
158 211 case SAMPLE_FLOAT:
159 211 return sizeof(SFLOAT);
160 6 default:
161 _ASSERTE("Audio sample type not recognized!");
162 6 return 0;
163 }
164 }
165
166 944 bool VideoInfo::IsVPlaneFirst() const {
167
4/6
✓ Branch 3 → 4 taken 944 times.
✗ Branch 3 → 8 not taken.
✓ Branch 5 → 6 taken 944 times.
✗ Branch 5 → 8 not taken.
✓ Branch 6 → 7 taken 790 times.
✓ Branch 6 → 8 taken 154 times.
944 return (NumComponents() > 1) && IsPlanar() && (pixel_type & (CS_VPlaneFirst | CS_UPlaneFirst)) == CS_VPlaneFirst; // Shouldn't use this
168 }
169
170 2356 int VideoInfo::BytesFromPixels(int pixels) const {
171 2356 const int componentSizes[8] = {1,2,4,0,0,2,2,2};
172
6/8
✓ Branch 2 → 3 taken 2356 times.
✗ Branch 2 → 12 not taken.
✓ Branch 3 → 4 taken 2105 times.
✓ Branch 3 → 7 taken 251 times.
✓ Branch 5 → 6 taken 1920 times.
✓ Branch 5 → 7 taken 185 times.
✓ Branch 7 → 8 taken 436 times.
✗ Branch 7 → 12 not taken.
4712 return (NumComponents() > 1) && IsPlanar() ? pixels * componentSizes[(pixel_type>>CS_Shift_Sample_Bits) & 7] : pixels * (BitsPerPixel()>>3);
173 // For planar images, will return luma plane
174 }
175
176 2300 int VideoInfo::RowSize(int plane) const {
177 2300 const int rowsize = BytesFromPixels(width);
178
3/8
✓ Branch 3 → 4 taken 790 times.
✗ Branch 3 → 16 not taken.
✗ Branch 3 → 28 not taken.
✓ Branch 3 → 29 taken 308 times.
✗ Branch 3 → 38 not taken.
✗ Branch 3 → 45 not taken.
✗ Branch 3 → 52 not taken.
✓ Branch 3 → 59 taken 1202 times.
2300 switch (plane) {
179 790 case PLANAR_U: case PLANAR_V:
180
4/8
✓ Branch 5 → 6 taken 790 times.
✗ Branch 5 → 14 not taken.
✓ Branch 7 → 8 taken 790 times.
✗ Branch 7 → 14 not taken.
✓ Branch 9 → 10 taken 790 times.
✗ Branch 9 → 14 not taken.
✓ Branch 11 → 12 taken 790 times.
✗ Branch 11 → 14 not taken.
790 return ((NumComponents() > 1) && IsPlanar() && !IsPlanarRGB() && !IsPlanarRGBA()) ? rowsize>>GetPlaneWidthSubsampling(plane) : 0;
181
182 case PLANAR_U_ALIGNED: case PLANAR_V_ALIGNED:
183 return ((NumComponents() > 1) && IsPlanar() && !IsPlanarRGB() && !IsPlanarRGBA()) ? ((rowsize>>GetPlaneWidthSubsampling(plane))+FRAME_ALIGN-1)&(~(FRAME_ALIGN-1)) : 0; // Aligned rowsize
184
185 case PLANAR_Y_ALIGNED:
186 return (rowsize+FRAME_ALIGN-1)&(~(FRAME_ALIGN-1)); // Aligned rowsize
187
188 308 case PLANAR_R: case PLANAR_G: case PLANAR_B:
189
4/6
✓ Branch 30 → 31 taken 308 times.
✗ Branch 30 → 36 not taken.
✓ Branch 32 → 33 taken 108 times.
✓ Branch 32 → 35 taken 200 times.
✓ Branch 34 → 35 taken 108 times.
✗ Branch 34 → 36 not taken.
308 return ((NumComponents() > 1) && (IsPlanarRGB() || IsPlanarRGBA())) ? rowsize : 0;
190
191 case PLANAR_R_ALIGNED: case PLANAR_G_ALIGNED: case PLANAR_B_ALIGNED:
192 return IsPlanarRGB() || IsPlanarRGBA() ? (rowsize+FRAME_ALIGN-1)&(~(FRAME_ALIGN-1)) : 0; // Aligned rowsize
193
194 case PLANAR_A:
195 return ((NumComponents() == 4) && IsPlanar()) ? rowsize : 0;
196
197 case PLANAR_A_ALIGNED:
198 return ((NumComponents() == 4) && IsPlanar()) ? (rowsize+FRAME_ALIGN-1)&(~(FRAME_ALIGN-1)) : 0; // Aligned rowsize
199
200 }
201 1202 return rowsize;
202 }
203
204 int VideoInfo::BMPSize() const {
205 if ((NumComponents() > 1) && IsPlanar()) {
206 if (IsPlanarRGB() || IsPlanarRGBA()) {
207 return ((RowSize(PLANAR_G) + 3) & ~3) * height * NumComponents(); // does it make sense for planar rgb?
208 }
209 // Y plane
210 const int Ybytes = ((RowSize(PLANAR_Y)+3) & ~3) * height;
211 const int UVbytes = Ybytes >> (GetPlaneWidthSubsampling(PLANAR_U)+GetPlaneHeightSubsampling(PLANAR_U));
212 return Ybytes + UVbytes*2;
213 }
214 return height * ((RowSize()+3) & ~3);
215 }
216
217 2603 int VideoInfo::GetPlaneWidthSubsampling(int plane) const { // Subsampling in bitshifts!
218
10/10
✓ Branch 2 → 3 taken 2403 times.
✓ Branch 2 → 7 taken 200 times.
✓ Branch 3 → 4 taken 2372 times.
✓ Branch 3 → 7 taken 31 times.
✓ Branch 4 → 5 taken 2341 times.
✓ Branch 4 → 7 taken 31 times.
✓ Branch 5 → 6 taken 2298 times.
✓ Branch 5 → 7 taken 43 times.
✓ Branch 6 → 7 taken 23 times.
✓ Branch 6 → 8 taken 2275 times.
2603 if (plane == PLANAR_Y || plane == PLANAR_R || plane == PLANAR_G || plane == PLANAR_B || plane == PLANAR_A) // No subsampling
219 328 return 0;
220
1/2
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 13 taken 2275 times.
2275 if (NumComponents() == 1)
221 throw AvisynthError("Filter error: GetPlaneWidthSubsampling not available on greyscale pixel type.");
222
3/4
✓ Branch 13 → 14 taken 210 times.
✓ Branch 13 → 15 taken 2065 times.
✓ Branch 14 → 15 taken 210 times.
✗ Branch 14 → 24 not taken.
2275 if (plane == PLANAR_U || plane == PLANAR_V) {
223
1/2
✗ Branch 16 → 17 not taken.
✓ Branch 16 → 18 taken 2275 times.
2275 if (IsYUY2())
224 return 1;
225
1/2
✓ Branch 19 → 20 taken 2275 times.
✗ Branch 19 → 21 not taken.
2275 else if (IsPlanar())
226 2275 return ((pixel_type>>CS_Shift_Sub_Width)+1) & 3;
227 else
228 throw AvisynthError("Filter error: GetPlaneWidthSubsampling called with unsupported pixel type.");
229 }
230 throw AvisynthError("Filter error: GetPlaneWidthSubsampling called with unsupported plane.");
231 }
232
233 2606 int VideoInfo::GetPlaneHeightSubsampling(int plane) const { // Subsampling in bitshifts!
234
10/10
✓ Branch 2 → 3 taken 2406 times.
✓ Branch 2 → 7 taken 200 times.
✓ Branch 3 → 4 taken 2375 times.
✓ Branch 3 → 7 taken 31 times.
✓ Branch 4 → 5 taken 2344 times.
✓ Branch 4 → 7 taken 31 times.
✓ Branch 5 → 6 taken 2301 times.
✓ Branch 5 → 7 taken 43 times.
✓ Branch 6 → 7 taken 23 times.
✓ Branch 6 → 8 taken 2278 times.
2606 if (plane == PLANAR_Y || plane == PLANAR_R || plane == PLANAR_G || plane == PLANAR_B || plane == PLANAR_A) // No subsampling
235 328 return 0;
236
1/2
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 13 taken 2278 times.
2278 if (NumComponents() == 1)
237 throw AvisynthError("Filter error: GetPlaneHeightSubsampling not available on greyscale pixel type.");
238
3/4
✓ Branch 13 → 14 taken 212 times.
✓ Branch 13 → 15 taken 2066 times.
✓ Branch 14 → 15 taken 212 times.
✗ Branch 14 → 24 not taken.
2278 if (plane == PLANAR_U || plane == PLANAR_V) {
239
1/2
✗ Branch 16 → 17 not taken.
✓ Branch 16 → 18 taken 2278 times.
2278 if (IsYUY2())
240 return 0;
241
1/2
✓ Branch 19 → 20 taken 2278 times.
✗ Branch 19 → 21 not taken.
2278 else if (IsPlanar())
242 2278 return ((pixel_type>>CS_Shift_Sub_Height)+1) & 3;
243 else
244 throw AvisynthError("Filter error: GetPlaneHeightSubsampling called with unsupported pixel type.");
245 }
246 throw AvisynthError("Filter error: GetPlaneHeightSubsampling called with unsupported plane.");
247 }
248
249 439 int VideoInfo::BitsPerPixel() const {
250 // Lookup Interleaved, calculate PLANAR's
251 // Remark:
252 // - total bitsize for interleaved/packed types, e.g. RGB48 = 48 = 3x16
253 // - byte size corrected with U-V subsampling factor for Planar YUV/YUVA
254 // - external softwares may use it for calculating buffer size
255 // - use BitsPerComponent instead for returning the pixel component format 8/10/12/14/16/32 bits
256
8/9
✓ Branch 2 → 3 taken 41 times.
✓ Branch 2 → 4 taken 35 times.
✓ Branch 2 → 5 taken 71 times.
✓ Branch 2 → 6 taken 224 times.
✓ Branch 2 → 7 taken 16 times.
✓ Branch 2 → 8 taken 11 times.
✓ Branch 2 → 9 taken 14 times.
✓ Branch 2 → 10 taken 27 times.
✗ Branch 2 → 11 not taken.
439 switch (pixel_type) {
257 41 case CS_BGR24:
258 41 return 24;
259 35 case CS_BGR32:
260 35 return 32;
261 71 case CS_YUY2:
262 71 return 16;
263 224 case CS_Y8:
264 224 return 8;
265 16 case CS_Y10:
266 case CS_Y12:
267 case CS_Y14:
268 case CS_Y16: // AVS16
269 16 return 16;
270 11 case CS_Y32:
271 11 return 32;
272 14 case CS_BGR48:
273 14 return 48;
274 27 case CS_BGR64:
275 27 return 64;
276 }
277 if (IsPlanar()) {
278 const int componentSizes[8] = {1,2,4,0,0,2,2,2};
279 const int S = (IsYUV() || IsYUVA()) ? GetPlaneWidthSubsampling(PLANAR_U) + GetPlaneHeightSubsampling(PLANAR_U) : 0; // planar RGBA: no subsampling
280 const int fullSizePlaneCount = IsYUVA() || IsPlanarRGBA() ? 2 : 1; // alpha plane is always full size
281 return (((fullSizePlaneCount << S) + 2) * (componentSizes[(pixel_type >> CS_Shift_Sample_Bits) & 7]) * 8) >> S;
282 }
283 return 0;
284 }
285
286 // useful mutator
287 4 void VideoInfo::SetFPS(unsigned numerator, unsigned denominator) {
288
2/4
✓ Branch 2 → 3 taken 4 times.
✗ Branch 2 → 4 not taken.
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 4 times.
4 if ((numerator == 0) || (denominator == 0)) {
289 fps_numerator = 0;
290 fps_denominator = 1;
291 }
292 else {
293 4 unsigned x=numerator, y=denominator;
294
2/2
✓ Branch 7 → 6 taken 9 times.
✓ Branch 7 → 8 taken 4 times.
13 while (y) { // find gcd
295 9 unsigned t = x%y; x = y; y = t;
296 }
297 4 fps_numerator = numerator/x;
298 4 fps_denominator = denominator/x;
299 }
300 4 }
301
302 // Range protected multiply-divide of FPS
303 67 void VideoInfo::MulDivFPS(unsigned multiplier, unsigned divisor) {
304 67 uint64_t numerator = UInt32x32To64(fps_numerator, multiplier);
305 67 uint64_t denominator = UInt32x32To64(fps_denominator, divisor);
306
307 67 uint64_t x=numerator, y=denominator;
308
2/2
✓ Branch 4 → 3 taken 75 times.
✓ Branch 4 → 5 taken 67 times.
142 while (y) { // find gcd
309 75 uint64_t t = x%y; x = y; y = t;
310 }
311 67 numerator /= x; // normalize
312 67 denominator /= x;
313
314 67 uint64_t temp = numerator | denominator; // Just looking top bit
315 67 unsigned u = 0;
316
2/2
✓ Branch 7 → 6 taken 1 time.
✓ Branch 7 → 8 taken 67 times.
68 while (temp & 0xffffffff80000000) { // or perhaps > 16777216*2
317 1 temp = Int64ShrlMod32(temp, 1);
318 1 u++;
319 }
320
2/2
✓ Branch 8 → 9 taken 1 time.
✓ Branch 8 → 10 taken 66 times.
67 if (u) { // Scale to fit
321 1 const unsigned round = 1 << (u-1);
322 1 SetFPS( (unsigned)Int64ShrlMod32(numerator + round, u),
323 1 (unsigned)Int64ShrlMod32(denominator + round, u) );
324 }
325 else {
326 66 fps_numerator = (unsigned)numerator;
327 66 fps_denominator = (unsigned)denominator;
328 }
329 67 }
330
331 // Test for same colorspace
332 49 bool VideoInfo::IsSameColorspace(const VideoInfo& vi) const {
333
2/2
✓ Branch 2 → 3 taken 44 times.
✓ Branch 2 → 4 taken 5 times.
49 if (vi.pixel_type == pixel_type) return TRUE;
334
2/6
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 9 taken 5 times.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 12 taken 5 times.
5 if (IsYV12() && vi.IsYV12()) return TRUE;
335 5 return FALSE;
336 }
337
338 11153 int VideoInfo::NumComponents() const {
339
340
3/4
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 743 times.
✓ Branch 2 → 5 taken 63 times.
✓ Branch 2 → 6 taken 10347 times.
11153 switch (pixel_type) {
341 case CS_UNKNOWN:
342 return 0;
343 743 case CS_RAW32:
344 case CS_Y8:
345 case CS_Y10:
346 case CS_Y12:
347 case CS_Y14:
348 case CS_Y16:
349 case CS_Y32:
350 743 return 1;
351 63 case CS_BGR32:
352 case CS_BGR64:
353 63 return 4; // these are not planar but return the count
354 10347 default:
355
4/4
✓ Branch 7 → 8 taken 9071 times.
✓ Branch 7 → 10 taken 1276 times.
✓ Branch 9 → 10 taken 439 times.
✓ Branch 9 → 11 taken 8632 times.
10347 return (IsYUVA() || IsPlanarRGBA()) ? 4 : 3;
356 // 3: YUV, planar RGB, 24/48 bit RGB
357 // 4: YUVA and PlanarRGBA
358 }
359 }
360
361 626 int VideoInfo::ComponentSize() const {
362 // occupied bytes per one pixel component
363
2/2
✓ Branch 3 → 4 taken 577 times.
✓ Branch 3 → 5 taken 49 times.
626 if(IsPlanar()) {
364 577 const int componentSizes[8] = {1,2,4,0,0,2,2,2};
365 577 return componentSizes[(pixel_type >> CS_Shift_Sample_Bits) & 7];
366 }
367
2/4
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
✓ Branch 5 → 8 taken 16 times.
✓ Branch 5 → 9 taken 33 times.
49 switch (pixel_type) {
368 case CS_UNKNOWN:
369 return 0;
370 case CS_RAW32:
371 return 4;
372 16 case CS_BGR48:
373 case CS_BGR64:
374 16 return 2;
375 33 default: // YUY2, packed 8 bit BGRs
376 33 return 1;
377 }
378 }
379
380 1150 int VideoInfo::BitsPerComponent() const {
381 // unlike BitsPerPixel, this returns the real
382 // component size as 8/10/12/14/16/32 bit
383
2/2
✓ Branch 2 → 3 taken 11 times.
✓ Branch 2 → 4 taken 1139 times.
1150 if (pixel_type == CS_YUY2)
384 11 return 8;
385
1/2
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 1139 times.
1139 else if (pixel_type == CS_RAW32)
386 return 32;
387 // planar YUV/RGB and packed RGB
388 1139 const int componentBitSizes[8] = {8,16,32,0,0,10,12,14};
389 1139 return componentBitSizes[(pixel_type >> CS_Shift_Sample_Bits) & 7];
390 }
391
392 // bit-depth independent helper functions instead of 8 bit specific IsYV24/16/12/8
393
2/2
✓ Branch 2 → 3 taken 61 times.
✓ Branch 2 → 4 taken 167 times.
289 bool VideoInfo::Is444() const { return ((pixel_type & CS_PLANAR_MASK & ~CS_Sample_Bits_Mask) == (CS_GENERIC_YUV444 & CS_PLANAR_FILTER)) ||
394
2/2
✓ Branch 3 → 4 taken 13 times.
✓ Branch 3 → 5 taken 48 times.
289 ((pixel_type & CS_PLANAR_MASK & ~CS_Sample_Bits_Mask) == (CS_GENERIC_YUVA444 & CS_PLANAR_FILTER)) ; }
395
2/2
✓ Branch 2 → 3 taken 284 times.
✓ Branch 2 → 4 taken 5404 times.
5972 bool VideoInfo::Is422() const { return ((pixel_type & CS_PLANAR_MASK & ~CS_Sample_Bits_Mask) == (CS_GENERIC_YUV422 & CS_PLANAR_FILTER)) ||
396
1/2
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 284 times.
5972 ((pixel_type & CS_PLANAR_MASK & ~CS_Sample_Bits_Mask) == (CS_GENERIC_YUVA422 & CS_PLANAR_FILTER)); }
397
2/2
✓ Branch 2 → 3 taken 5707 times.
✓ Branch 2 → 4 taken 6569 times.
17983 bool VideoInfo::Is420() const { return ((pixel_type & CS_PLANAR_MASK & ~CS_Sample_Bits_Mask) == (CS_GENERIC_YUV420 & CS_PLANAR_FILTER)) ||
398
2/2
✓ Branch 3 → 4 taken 37 times.
✓ Branch 3 → 5 taken 5670 times.
17983 ((pixel_type & CS_PLANAR_MASK & ~CS_Sample_Bits_Mask) == (CS_GENERIC_YUVA420 & CS_PLANAR_FILTER)); }
399 651 bool VideoInfo::IsY() const { return (pixel_type & CS_PLANAR_MASK & ~CS_Sample_Bits_Mask) == (CS_GENERIC_Y & CS_PLANAR_FILTER); }
400
4/4
✓ Branch 2 → 3 taken 26 times.
✓ Branch 2 → 5 taken 115 times.
✓ Branch 3 → 4 taken 21 times.
✓ Branch 3 → 5 taken 5 times.
141 bool VideoInfo::IsRGB48() const { return ((pixel_type & CS_BGR24) == CS_BGR24) && ((pixel_type & CS_Sample_Bits_Mask) == CS_Sample_Bits_16); } // Clear out additional properties
401
3/4
✓ Branch 2 → 3 taken 7 times.
✓ Branch 2 → 5 taken 285 times.
✓ Branch 3 → 4 taken 7 times.
✗ Branch 3 → 5 not taken.
292 bool VideoInfo::IsRGB64() const { return ((pixel_type & CS_BGR32) == CS_BGR32) && ((pixel_type & CS_Sample_Bits_Mask) == CS_Sample_Bits_16); }
402 14167 bool VideoInfo::IsYUVA() const { return !!(pixel_type&CS_YUVA ); }
403
6/6
✓ Branch 2 → 3 taken 3312 times.
✓ Branch 2 → 6 taken 172 times.
✓ Branch 3 → 4 taken 551 times.
✓ Branch 3 → 6 taken 2761 times.
✓ Branch 4 → 5 taken 428 times.
✓ Branch 4 → 6 taken 123 times.
3484 bool VideoInfo::IsPlanarRGB() const { return !!(pixel_type&CS_PLANAR) && !!(pixel_type&CS_BGR) && !!(pixel_type&CS_RGB_TYPE); }
404
6/6
✓ Branch 2 → 3 taken 12764 times.
✓ Branch 2 → 6 taken 332 times.
✓ Branch 3 → 4 taken 1737 times.
✓ Branch 3 → 6 taken 11027 times.
✓ Branch 4 → 5 taken 754 times.
✓ Branch 4 → 6 taken 983 times.
13096 bool VideoInfo::IsPlanarRGBA() const { return !!(pixel_type&CS_PLANAR) && !!(pixel_type&CS_BGR) && !!(pixel_type&CS_RGBA_TYPE); }
405 12 bool VideoInfo::IsChannelMaskKnown() const { return !!(image_type & IT_HAS_CHANNELMASK); }
406 // Re-maps and stores channel mask into image_type, sets the 'has channel mask' flag as well
407 41 void VideoInfo::SetChannelMask(bool isChannelMaskKnown, unsigned int dwChannelMask)
408 {
409
2/2
✓ Branch 2 → 3 taken 4 times.
✓ Branch 2 → 4 taken 37 times.
41 if (isChannelMaskKnown) image_type |= IT_HAS_CHANNELMASK; else image_type &= ~IT_HAS_CHANNELMASK;
410
2/2
✓ Branch 5 → 6 taken 37 times.
✓ Branch 5 → 7 taken 4 times.
41 if (!isChannelMaskKnown) dwChannelMask = 0;
411
1/2
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 41 times.
41 if (dwChannelMask & AvsChannelMask::MASK_SPEAKER_ALL) // special mapping due to lack of bits in image_type
412 dwChannelMask = AvsImageTypeFlags::IT_SPEAKER_ALL;
413 else {
414 41 dwChannelMask &= AvsChannelMask::MASK_SPEAKER_DEFINED;
415 41 dwChannelMask <<= 4;
416 }
417 41 image_type &= ~AvsImageTypeFlags::IT_SPEAKER_BITS_MASK;
418 41 image_type |= dwChannelMask;
419 41 }
420
421 6 unsigned int VideoInfo::GetChannelMask() const
422 {
423 // returns zero if not defined
424
2/2
✓ Branch 3 → 4 taken 2 times.
✓ Branch 3 → 5 taken 4 times.
6 if (!IsChannelMaskKnown()) return 0;
425 4 unsigned int dwChannelMask = image_type & AvsImageTypeFlags::IT_SPEAKER_BITS_MASK;
426 // returns the original SPEAKER_ALL constant
427
1/2
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 4 times.
4 if (dwChannelMask == AvsImageTypeFlags::IT_SPEAKER_ALL)
428 return AvsChannelMask::MASK_SPEAKER_ALL;
429 // other SPEAKER bits were simply shifted by 4 bits
430 4 return dwChannelMask >> 4;
431 }
432
433
434 // end struct VideoInfo
435
436 /**********************************************************************/
437
438 // class VideoFrameBuffer
439
440 32124 const BYTE* VideoFrameBuffer::GetReadPtr() const { return data; }
441 /* Baked ********************
442 BYTE* VideoFrameBuffer::GetWritePtr() { ++sequence_number; return data; }
443 Baked ********************/
444 14958 BYTE* VideoFrameBuffer::GetWritePtr() { InterlockedIncrement(&sequence_number); return data; }
445 130 int VideoFrameBuffer::GetDataSize() const { return data_size; }
446 int VideoFrameBuffer::GetSequenceNumber() const { return sequence_number; }
447 11978 int VideoFrameBuffer::GetRefcount() const { return refcount; }
448
449 // end class VideoFrameBuffer
450
451 /**********************************************************************/
452
453 // class VideoFrame
454
455 /* Baked ********************
456 void VideoFrame::AddRef() { InterlockedIncrement((int *)&refcount); }
457 void VideoFrame::Release() { if (refcount==1) InterlockedDecrement(&vfb->refcount); InterlockedDecrement((int *)&refcount); }
458
459 int VideoFrame::GetPitch() const { return pitch; }
460 int VideoFrame::GetPitch(int plane) const { switch (plane) {case PLANAR_U: case PLANAR_V: return pitchUV;} return pitch; }
461 int VideoFrame::GetRowSize() const { return row_size; }
462
463 int VideoFrame::GetRowSize(int plane) const {
464 switch (plane) {
465 case PLANAR_U: case PLANAR_V: if (pitchUV) return row_size>>1; else return 0;
466 case PLANAR_U_ALIGNED: case PLANAR_V_ALIGNED:
467 if (pitchUV) {
468 int r = ((row_size+FRAME_ALIGN-1)&(~(FRAME_ALIGN-1)) )>>1; // Aligned rowsize
469 if (r<=pitchUV)
470 return r;
471 return row_size>>1;
472 } else return 0;
473 case PLANAR_Y_ALIGNED:
474 int r = (row_size+FRAME_ALIGN-1)&(~(FRAME_ALIGN-1)); // Aligned rowsize
475 if (r<=pitch)
476 return r;
477 return row_size;
478 }
479 return row_size; }
480
481 int VideoFrame::GetHeight() const { return height; }
482 int VideoFrame::GetHeight(int plane) const { switch (plane) {case PLANAR_U: case PLANAR_V: if (pitchUV) return height>>1; return 0;} return height; }
483
484 // generally you shouldn't use these three
485 VideoFrameBuffer* VideoFrame::GetFrameBuffer() const { return vfb; }
486 int VideoFrame::GetOffset() const { return offset; }
487 int VideoFrame::GetOffset(int plane) const { switch (plane) {case PLANAR_U: return offsetU;case PLANAR_V: return offsetV;default: return offset;}; }
488
489 const BYTE* VideoFrame::GetReadPtr() const { return vfb->GetReadPtr() + offset; }
490 const BYTE* VideoFrame::GetReadPtr(int plane) const { return vfb->GetReadPtr() + GetOffset(plane); }
491
492 bool VideoFrame::IsWritable() const { return (refcount == 1 && vfb->refcount == 1); }
493
494 BYTE* VideoFrame::GetWritePtr() const {
495 if (vfb->GetRefcount()>1) {
496 _ASSERT(FALSE);
497 //throw AvisynthError("Internal Error - refcount was more than one!");
498 }
499 return IsWritable() ? (vfb->GetWritePtr() + offset) : 0;
500 }
501 Baked ********************/
502
503 7509 void VideoFrame::AddRef() { InterlockedIncrement(&refcount); }
504 9077 void VideoFrame::Release() {
505 9077 VideoFrameBuffer* _vfb = vfb;
506
507
2/2
✓ Branch 2 → 3 taken 1617 times.
✓ Branch 2 → 4 taken 7460 times.
9077 if (!InterlockedDecrement(&refcount)) {
508 // Do NOT touch 'properties' here. The FrameRegistry (under memory_mutex) is the
509 // sole owner: it clears the AVSMap contents for reuse (winner frames) or deletes
510 // it entirely (discarded frames). Freeing or clearing here without that lock would
511 // race with concurrent FrameRegistry access.
512 #ifdef ALTERNATIVE_VFB_TIMESTAMP
513 if (!InterlockedDecrement(&_vfb->refcount)) {
514 // all VideoFrameBuffer instances are actually VFBStorage, which has way mode admin fields
515 VFBHelper::UpdateVFBFreeTimestamp(_vfb);
516 }
517 #else
518 1617 InterlockedDecrement(&_vfb->refcount);
519 #endif
520 }
521 9077 }
522
523
3/3
✓ Branch 2 → 3 taken 16544 times.
✓ Branch 2 → 4 taken 1584 times.
✓ Branch 2 → 5 taken 17864 times.
35992 int VideoFrame::GetPitch(int plane) const { switch (plane) { case PLANAR_U: case PLANAR_V: return pitchUV; case PLANAR_A: return pitchA; } return pitch; }
524
525 14691 int VideoFrame::GetRowSize(int plane) const {
526
6/6
✓ Branch 2 → 3 taken 7912 times.
✓ Branch 2 → 6 taken 15 times.
✓ Branch 2 → 11 taken 91 times.
✓ Branch 2 → 14 taken 698 times.
✓ Branch 2 → 17 taken 6 times.
✓ Branch 2 → 22 taken 5969 times.
14691 switch (plane) {
527
2/2
✓ Branch 3 → 4 taken 7472 times.
✓ Branch 3 → 5 taken 440 times.
7912 case PLANAR_U: case PLANAR_V: if (pitchUV) return row_sizeUV; else return 0;
528 15 case PLANAR_U_ALIGNED: case PLANAR_V_ALIGNED:
529
1/2
✓ Branch 6 → 7 taken 15 times.
✗ Branch 6 → 10 not taken.
15 if (pitchUV) {
530 15 const int r = (row_sizeUV+FRAME_ALIGN-1)&(~(FRAME_ALIGN-1)); // Aligned rowsize
531
1/2
✓ Branch 7 → 8 taken 15 times.
✗ Branch 7 → 9 not taken.
15 if (r<=pitchUV)
532 15 return r;
533 return row_sizeUV;
534 }
535 else return 0;
536 91 case PLANAR_ALIGNED: case PLANAR_Y_ALIGNED:
537 case PLANAR_R_ALIGNED: case PLANAR_G_ALIGNED: case PLANAR_B_ALIGNED:
538 {
539 91 const int r = (row_size+FRAME_ALIGN-1)&(~(FRAME_ALIGN-1)); // Aligned rowsize
540
1/2
✓ Branch 11 → 12 taken 91 times.
✗ Branch 11 → 13 not taken.
91 if (r<=pitch)
541 91 return r;
542 return row_size;
543 }
544 698 case PLANAR_A:
545
2/2
✓ Branch 14 → 15 taken 627 times.
✓ Branch 14 → 16 taken 71 times.
698 if (pitchA) return row_sizeA; else return 0;
546 6 case PLANAR_A_ALIGNED:
547
1/2
✓ Branch 17 → 18 taken 6 times.
✗ Branch 17 → 21 not taken.
6 if(pitchA) {
548 6 const int r = (row_sizeA+FRAME_ALIGN-1)&(~(FRAME_ALIGN-1)); // Aligned rowsize
549
1/2
✓ Branch 18 → 19 taken 6 times.
✗ Branch 18 → 20 not taken.
6 if (r<=pitchA)
550 6 return r;
551 return row_sizeA;
552 }
553 else return 0;
554 }
555 5969 return row_size; // PLANAR_Y, PLANAR_G, PLANAR_B, PLANAR_R
556 }
557
558 16436 int VideoFrame::GetHeight(int plane) const {
559
3/3
✓ Branch 2 → 3 taken 7302 times.
✓ Branch 2 → 6 taken 730 times.
✓ Branch 2 → 9 taken 8404 times.
16436 switch (plane) {
560
2/2
✓ Branch 3 → 4 taken 6850 times.
✓ Branch 3 → 5 taken 452 times.
7302 case PLANAR_U: case PLANAR_V: if (pitchUV) return heightUV; return 0;
561
2/2
✓ Branch 6 → 7 taken 660 times.
✓ Branch 6 → 8 taken 70 times.
730 case PLANAR_A: if (pitchA) return height; return 0;
562 }
563 8404 return height;
564 }
565
566 int VideoFrame::GetPixelType() const { return pixel_type; }
567 2 void VideoFrame::AmendPixelType(int new_pixel_type) { pixel_type = new_pixel_type; }
568
569 // Generally you should not be using these two
570 576 VideoFrameBuffer* VideoFrame::GetFrameBuffer() const { return vfb; }
571 55996 int VideoFrame::GetOffset(int plane) const {
572
4/4
✓ Branch 2 → 3 taken 13682 times.
✓ Branch 2 → 4 taken 13464 times.
✓ Branch 2 → 5 taken 2401 times.
✓ Branch 2 → 6 taken 26449 times.
55996 switch (plane) {
573 13682 case PLANAR_U: case PLANAR_B: return offsetU; // G is first. Then B,R order like U,V
574 13464 case PLANAR_V: case PLANAR_R: return offsetV;
575 2401 case PLANAR_A: return offsetA;
576 26449 default: return offset; // PLANAR Y, PLANAR_G
577 };
578 }
579
580 32124 const BYTE* VideoFrame::GetReadPtr(int plane) const { return vfb->GetReadPtr() + GetOffset(plane); }
581
582 196 bool VideoFrame::IsWritable() const {
583
5/6
✓ Branch 2 → 3 taken 6 times.
✓ Branch 2 → 5 taken 190 times.
✓ Branch 3 → 4 taken 6 times.
✗ Branch 3 → 5 not taken.
✓ Branch 6 → 7 taken 6 times.
✓ Branch 6 → 9 taken 190 times.
196 if (refcount == 1 && vfb->refcount == 1) {
584 6 vfb->GetWritePtr(); // Bump sequence number
585 6 return true;
586 }
587 190 return false;
588 }
589
590 bool VideoFrame::IsPropertyWritable() const {
591 return (refcount == 1);
592 }
593
594 23704 BYTE* VideoFrame::GetWritePtr(int plane) const {
595
6/6
✓ Branch 2 → 3 taken 18222 times.
✓ Branch 2 → 5 taken 5482 times.
✓ Branch 3 → 4 taken 12744 times.
✓ Branch 3 → 5 taken 5478 times.
✓ Branch 4 → 5 taken 1018 times.
✓ Branch 4 → 15 taken 11726 times.
23704 if (!plane || plane == PLANAR_Y || plane == PLANAR_G) { // planar RGB order GBR
596
1/2
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 11978 times.
11978 if (vfb->GetRefcount()>1) {
597 _ASSERT(FALSE);
598 // throw AvisynthError("Internal Error - refcount was more than one!");
599 }
600
2/4
✓ Branch 8 → 9 taken 11978 times.
✗ Branch 8 → 13 not taken.
✓ Branch 9 → 10 taken 11978 times.
✗ Branch 9 → 13 not taken.
11978 return (refcount == 1 && vfb->refcount == 1) ? vfb->GetWritePtr() + GetOffset(plane) : 0;
601 }
602 11726 return vfb->data + GetOffset(plane);
603 }
604
605 824 AVSMap& VideoFrame::getProperties() {
606 824 return *properties;
607 }
608
609 316 const AVSMap& VideoFrame::getConstProperties() {
610 316 return *properties;
611 }
612
613 624 void VideoFrame::setProperties(const AVSMap& properties) {
614 624 *(this->properties) = properties;
615 624 }
616
617 PDevice VideoFrame::GetDevice() const {
618 return vfb->device;
619 }
620
621 484 int VideoFrame::CheckMemory() const {
622 #ifdef _DEBUG
623 if (vfb->data && vfb->device->device_type == DEV_TYPE_CPU) {
624 // check buffer overrun
625 int *pInt = (int *)(vfb->data + vfb->data_size);
626 if (pInt[0] != 0xDEADBEEF ||
627 pInt[1] != 0xDEADBEEF ||
628 pInt[2] != 0xDEADBEEF ||
629 pInt[3] != 0xDEADBEEF)
630 {
631 return 1;
632 }
633 return 0;
634 }
635 #endif
636 484 return -1;
637 }
638
639 /* Baked ********************
640 VideoFrame::~VideoFrame() { InterlockedDecrement(&vfb->refcount); }
641 Baked ********************/
642 1568 VideoFrame::~VideoFrame() { DESTRUCTOR(); }
643 1568 void VideoFrame::DESTRUCTOR() {
644 1568 Release();
645 // finally destroyed when removed from FrameRegistry
646
1/2
✓ Branch 3 → 4 taken 1568 times.
✗ Branch 3 → 8 not taken.
1568 if (properties) {
647
1/2
✓ Branch 4 → 5 taken 1568 times.
✗ Branch 4 → 7 not taken.
1568 delete properties;
648 1568 properties = nullptr;
649 }
650 1568 }
651
652 // end class VideoFrame
653
654 /**********************************************************************/
655
656 // class IClip
657
658 /* Baked ********************
659 void IClip::AddRef() { InterlockedIncrement((int *)&refcnt); }
660 void IClip::Release() { InterlockedDecrement((int *)&refcnt); if (!refcnt) delete this; }
661 Baked ********************/
662 5398 void IClip::AddRef() { InterlockedIncrement(&refcnt); }
663
3/4
✓ Branch 2 → 3 taken 1061 times.
✓ Branch 2 → 5 taken 4337 times.
✓ Branch 3 → 4 taken 1061 times.
✗ Branch 3 → 5 not taken.
5398 void IClip::Release() { if (!InterlockedDecrement(&refcnt)) delete this; }
664
665 // end class IClip
666
667 /**********************************************************************/
668
669 // class PClip
670
671
1/2
✓ Branch 2 → 3 taken 206 times.
✗ Branch 2 → 4 not taken.
206 IClip* PClip::GetPointerWithAddRef() const { if (p) p->AddRef(); return p; }
672
673 4464 void PClip::Init(IClip* x) {
674
2/2
✓ Branch 2 → 3 taken 4229 times.
✓ Branch 2 → 4 taken 235 times.
4464 if (x) x->AddRef();
675 4464 p=x;
676 4464 }
677
678 960 void PClip::Set(IClip* x) {
679
2/2
✓ Branch 2 → 3 taken 491 times.
✓ Branch 2 → 4 taken 469 times.
960 if (x) x->AddRef();
680
2/2
✓ Branch 4 → 5 taken 194 times.
✓ Branch 4 → 6 taken 766 times.
960 if (p) p->Release();
681 960 p=x;
682 960 }
683
684 850 PClip::PClip() { CONSTRUCTOR0(); }
685 850 void PClip::CONSTRUCTOR0() { p = 0; }
686
687 3166 PClip::PClip(const PClip& x) { CONSTRUCTOR1(x); }
688 3166 void PClip::CONSTRUCTOR1(const PClip& x) { Init(x.p); }
689
690 1298 PClip::PClip(IClip* x) { CONSTRUCTOR2(x); }
691 1298 void PClip::CONSTRUCTOR2(IClip* x) { Init(x); }
692
693 559 void PClip::operator=(IClip* x) { OPERATOR_ASSIGN0(x); }
694 559 void PClip::OPERATOR_ASSIGN0(IClip* x) { Set(x); }
695
696 401 void PClip::operator=(const PClip& x) { OPERATOR_ASSIGN1(x); }
697 401 void PClip::OPERATOR_ASSIGN1(const PClip& x) { Set(x.p); }
698
699 5314 PClip::~PClip() { DESTRUCTOR(); }
700
2/2
✓ Branch 2 → 3 taken 4526 times.
✓ Branch 2 → 4 taken 788 times.
5314 void PClip::DESTRUCTOR() { if (p) p->Release(); }
701
702 // end class PClip
703
704 /**********************************************************************/
705
706 // class PVideoFrame
707
708 5570 void PVideoFrame::Init(VideoFrame* x) {
709
2/2
✓ Branch 2 → 3 taken 5563 times.
✓ Branch 2 → 4 taken 7 times.
5570 if (x) x->AddRef();
710 5570 p=x;
711 5570 }
712
713 1946 void PVideoFrame::Set(VideoFrame* x) {
714
1/2
✓ Branch 2 → 3 taken 1946 times.
✗ Branch 2 → 4 not taken.
1946 if (x) x->AddRef();
715
2/2
✓ Branch 4 → 5 taken 244 times.
✓ Branch 4 → 6 taken 1702 times.
1946 if (p) p->Release();
716 1946 p=x;
717 1946 }
718
719 1770 PVideoFrame::PVideoFrame() { CONSTRUCTOR0(); }
720 1770 void PVideoFrame::CONSTRUCTOR0() { p = 0; }
721
722 3946 PVideoFrame::PVideoFrame(const PVideoFrame& x) { CONSTRUCTOR1(x); }
723 3946 void PVideoFrame::CONSTRUCTOR1(const PVideoFrame& x) { Init(x.p); }
724
725 1624 PVideoFrame::PVideoFrame(VideoFrame* x) { CONSTRUCTOR2(x); }
726 1624 void PVideoFrame::CONSTRUCTOR2(VideoFrame* x) { Init(x); }
727
728 void PVideoFrame::operator=(VideoFrame* x) { OPERATOR_ASSIGN0(x); }
729 void PVideoFrame::OPERATOR_ASSIGN0(VideoFrame* x) { Set(x); }
730
731 1946 void PVideoFrame::operator=(const PVideoFrame& x) { OPERATOR_ASSIGN1(x); }
732 1946 void PVideoFrame::OPERATOR_ASSIGN1(const PVideoFrame& x) { Set(x.p); }
733
734 7340 PVideoFrame::~PVideoFrame() { DESTRUCTOR(); }
735
2/2
✓ Branch 2 → 3 taken 7265 times.
✓ Branch 2 → 4 taken 75 times.
7340 void PVideoFrame::DESTRUCTOR() { if (p) p->Release(); }
736
737
738 // end class PVideoFrame
739
740 /**********************************************************************/
741
742 // class AVSValue
743
744 12366 AVSValue::AVSValue() { CONSTRUCTOR0(); }
745 12366 void AVSValue::CONSTRUCTOR0() { type = 'v'; array_size = 0; clip = NULL; }
746
747 21 AVSValue::AVSValue(IClip* c) { CONSTRUCTOR1(c); }
748
1/2
✓ Branch 2 → 3 taken 21 times.
✗ Branch 2 → 4 not taken.
21 void AVSValue::CONSTRUCTOR1(IClip* c) { type = 'c'; array_size = 0; clip = c; if (c) c->AddRef(); }
749
750 206 AVSValue::AVSValue(const PClip& c) { CONSTRUCTOR2(c); }
751 206 void AVSValue::CONSTRUCTOR2(const PClip& c) { type = 'c'; array_size = 0; clip = c.GetPointerWithAddRef(); }
752
753 2869 AVSValue::AVSValue(bool b) { CONSTRUCTOR3(b); }
754 2869 void AVSValue::CONSTRUCTOR3(bool b) { type = 'b'; array_size = 0; clip = NULL; boolean = b; }
755
756 9175 AVSValue::AVSValue(int i) { CONSTRUCTOR4(i); }
757 9175 void AVSValue::CONSTRUCTOR4(int i) { type = 'i'; array_size = 0; clip = NULL; integer = i; }
758
759 248 AVSValue::AVSValue(float f) { CONSTRUCTOR5(f); }
760 248 void AVSValue::CONSTRUCTOR5(float f) { type = 'f'; array_size = 0; clip = NULL; floating_pt = f; }
761
762 36 AVSValue::AVSValue(double f) { CONSTRUCTOR6(f); }
763 36 void AVSValue::CONSTRUCTOR6(double f)
764 {
765 36 type = 'd'; array_size = 0; clip = NULL;
766 #if UINTPTR_MAX >= 0xffffffffffffffff
767 // pre-v11: floating_pt = float(f);
768 36 double_pt = f; // v11: real 64 bit double!
769 #else
770 double_pt_ptr = new double;
771 *double_pt_ptr = f;
772 #endif
773 36 }
774
775 366188 AVSValue::AVSValue(const char* s) { CONSTRUCTOR7(s); }
776 366188 void AVSValue::CONSTRUCTOR7(const char* s) { type = 's'; array_size = 0; string = s; }
777
778 /* Baked ********************
779 AVSValue::AVSValue(const AVSValue* a, int size) { type = 'a'; array = a; array_size = size; }
780 Baked ********************/
781 AVSValue::AVSValue(const AVSValue& a, int size) { CONSTRUCTOR8(&a, size); }
782 132 AVSValue::AVSValue(const AVSValue* a, int size) { CONSTRUCTOR8(a, size); }
783 132 void AVSValue::CONSTRUCTOR8(const AVSValue* a, int size)
784 {
785 132 type = 'a';
786 132 array_size = (short)size;
787
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 132 times.
132 if (a == nullptr)
788 size = 0;
789
5/18
✓ Branch 4 → 5 taken 132 times.
✗ Branch 4 → 6 not taken.
✓ Branch 9 → 10 taken 1147 times.
✗ Branch 9 → 22 not taken.
✓ Branch 11 → 9 taken 1147 times.
✓ Branch 11 → 12 taken 132 times.
✗ Branch 12 → 13 not taken.
✓ Branch 12 → 17 taken 132 times.
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 15 not taken.
✗ Branch 22 → 23 not taken.
✗ Branch 22 → 26 not taken.
✗ Branch 24 → 25 not taken.
✗ Branch 24 → 26 not taken.
✗ Branch 27 → 28 not taken.
✗ Branch 27 → 32 not taken.
✗ Branch 28 → 29 not taken.
✗ Branch 28 → 30 not taken.
1279 array = new AVSValue[size]; // even for size = 0 a valid ptr is given
790
2/2
✓ Branch 20 → 18 taken 1147 times.
✓ Branch 20 → 21 taken 132 times.
1279 for (int i = 0; i < size; i++) {
791 1147 const_cast<AVSValue*>(array)[i].Assign(&a[i], true); // init from source
792 }
793 132 }
794
795 729686 AVSValue::AVSValue(const AVSValue& v) { CONSTRUCTOR9(v); }
796 729686 void AVSValue::CONSTRUCTOR9(const AVSValue& v) { Assign(&v, true); }
797
798 // from compatibility interface
799 AVSValue::AVSValue(const AVSValue& v, bool no_deep_arrays) { CONSTRUCTOR10(v, no_deep_arrays); }
800 void AVSValue::CONSTRUCTOR10(const AVSValue& v, bool no_deep_arrays) { Assign2(&v, true, no_deep_arrays); }
801
802 AVSValue::AVSValue(const PFunction& n) { CONSTRUCTOR11(n); }
803 void AVSValue::CONSTRUCTOR11(const PFunction& n) { type = 'n'; array_size = 0; function = n.GetPointerWithAddRef(); }
804
805 AVSValue::AVSValue(int64_t l) { CONSTRUCTOR12(l); }
806 void AVSValue::CONSTRUCTOR12(int64_t l) { type = 'l'; array_size = 0; clip = NULL;
807 #if UINTPTR_MAX >= 0xffffffffffffffff
808 longlong = l;
809 #else
810 longlong_ptr = new int64_t;
811 *longlong_ptr = l;
812 #endif
813 }
814
815 1120927 AVSValue::~AVSValue() { DESTRUCTOR(); }
816 1120927 void AVSValue::DESTRUCTOR()
817 {
818
5/6
✓ Branch 3 → 4 taken 664 times.
✓ Branch 3 → 6 taken 1120263 times.
✓ Branch 4 → 5 taken 664 times.
✗ Branch 4 → 6 not taken.
✓ Branch 7 → 8 taken 664 times.
✓ Branch 7 → 9 taken 1120263 times.
1120927 if (IsClip() && clip)
819 664 clip->Release();
820
2/6
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 13 taken 1120927 times.
✗ Branch 11 → 12 not taken.
✗ Branch 11 → 13 not taken.
✗ Branch 14 → 15 not taken.
✓ Branch 14 → 16 taken 1120927 times.
1120927 if (IsFunction() && function)
821 function->Release();
822 #if !(UINTPTR_MAX >= 0xffffffffffffffff)
823 // 32-bit systems support 64-bit data through dynamic allocation.
824 if (type == 'l' && longlong_ptr) {
825 delete longlong_ptr;
826 longlong_ptr = nullptr;
827 }
828 else if (type == 'd' && double_pt_ptr) {
829 delete double_pt_ptr;
830 double_pt_ptr = nullptr;
831 }
832 #endif
833
5/6
✓ Branch 17 → 18 taken 155 times.
✓ Branch 17 → 20 taken 1120772 times.
✓ Branch 18 → 19 taken 155 times.
✗ Branch 18 → 20 not taken.
✓ Branch 21 → 22 taken 155 times.
✓ Branch 21 → 28 taken 1120772 times.
1120927 if (IsArray() && array) {
834
3/4
✓ Branch 22 → 23 taken 155 times.
✗ Branch 22 → 27 not taken.
✓ Branch 24 → 25 taken 1244 times.
✓ Branch 24 → 26 taken 155 times.
1399 delete[] array; // calls AVSValue destructors for all elements
835 155 array = nullptr;
836 }
837 1120927 }
838
839 void AVSValue::MarkArrayAsNonDeepCopy()
840 {
841 // Convert AVSValue content to a neutral 'v' type
842 // to prevent destructor from freeing up the allocated array
843 // and its elements.
844 // Set just before releasing AVSValue.
845 if (type == 'a')
846 {
847 type = 'v';
848 array_size = 0;
849 array = nullptr;
850 }
851 }
852
853 385571 AVSValue& AVSValue::operator=(const AVSValue& v) { return OPERATOR_ASSIGN(v); }
854 385571 AVSValue& AVSValue::OPERATOR_ASSIGN(const AVSValue& v) { Assign(&v, false); return *this; }
855
856 // pre-v11: Transparently allow 'int' to be treated as 'float'.
857 // No int<->bool conversions.
858 // v11 64 bit value changes:
859 // - 'long' is int64_t.
860 // - IsInt returns true for both 'long' and 'int'
861 // - IsLong returns true only for exact 64-bit integer type
862 // - Transparently allow 'long' and 'int' to be treated as 'float' or 'double'
863 // - IsFloat returns true for both 'float' and 'double' (old IsFloat + 'double').
864 // - new IsFloatfStrict returns true only for 32-bit floating-point numbers.
865 // - new IsLongStrict returns true only for exact 64-bit integer types.
866
867 // Note: Exact type check is available GetType() with returns AvsValueType enum
868 3030 bool AVSValue::Defined() const { return type != 'v'; }
869 2623569 bool AVSValue::IsClip() const { return type == 'c'; }
870 599 bool AVSValue::IsBool() const { return type == 'b'; }
871
3/4
✓ Branch 2 → 3 taken 18 times.
✓ Branch 2 → 4 taken 189 times.
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 18 times.
207 bool AVSValue::IsInt() const { return type == 'i' || type == 'l'; }
872 bool AVSValue::IsLongStrict() const { return type == 'l'; }
873
7/8
✓ Branch 2 → 3 taken 381 times.
✓ Branch 2 → 6 taken 64 times.
✓ Branch 3 → 4 taken 164 times.
✓ Branch 3 → 6 taken 217 times.
✓ Branch 4 → 5 taken 157 times.
✓ Branch 4 → 6 taken 7 times.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 157 times.
445 bool AVSValue::IsFloat() const { return type == 'd' || type == 'f' || type == 'i' || type == 'l'; }
874 bool AVSValue::IsFloatfStrict() const { return type == 'f'; }
875 5882 bool AVSValue::IsString() const { return type == 's'; }
876 2625871 bool AVSValue::IsArray() const { return type == 'a'; }
877 2622999 bool AVSValue::IsFunction() const { return type == 'n'; }
878
879
2/4
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 194 times.
✓ Branch 6 → 7 taken 194 times.
✗ Branch 6 → 8 not taken.
194 PClip AVSValue::AsClip() const { _ASSERTE(IsClip()); return IsClip()?clip:0; }
880
881
1/2
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 9 times.
9 bool AVSValue::AsBool1() const { _ASSERTE(IsBool()); return boolean; }
882 9 bool AVSValue::AsBool() const { return AsBool1(); }
883
884 29 int AVSValue::AsInt1() const {
885
1/2
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 29 times.
29 _ASSERTE(IsInt());
886 // simple typecast, no saturation
887 #if UINTPTR_MAX >= 0xffffffffffffffff
888
1/2
✓ Branch 5 → 6 taken 29 times.
✗ Branch 5 → 7 not taken.
29 return type == 'i' ? integer : (int)longlong;
889 #else
890 return type == 'i' ? integer : (int)*longlong_ptr;
891 #endif
892 }
893
894 29 int AVSValue::AsInt() const { return AsInt1(); }
895
896 int64_t AVSValue::AsLong1() const {
897 _ASSERTE(IsInt());
898 #if UINTPTR_MAX >= 0xffffffffffffffff
899 return type == 'i' ? integer : longlong;
900 #else
901 return type == 'i' ? integer : *longlong_ptr;
902 #endif
903 }
904 int64_t AVSValue::AsLong() const { return AsLong1(); }
905
906
2/4
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 34 times.
✓ Branch 6 → 7 taken 34 times.
✗ Branch 6 → 8 not taken.
34 const char* AVSValue::AsString1() const { _ASSERTE(IsString()); return IsString()?string:0; }
907 34 const char* AVSValue::AsString() const { return AVSValue::AsString1(); }
908
909 30 double AVSValue::AsFloat1() const {
910 #if UINTPTR_MAX >= 0xffffffffffffffff
911
6/8
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 30 times.
✓ Branch 5 → 6 taken 3 times.
✓ Branch 5 → 7 taken 27 times.
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 27 times.
✓ Branch 9 → 10 taken 14 times.
✓ Branch 9 → 11 taken 13 times.
30 _ASSERTE(IsFloat()); return type == 'i' ? (double)integer : type == 'l' ? (double)longlong : type == 'f' ? (double)floating_pt : double_pt;
912 #else
913 _ASSERTE(IsFloat()); return type == 'i' ? (double)integer : type == 'l' ? (double)*longlong_ptr : type == 'f' ? (double)floating_pt : *double_pt_ptr;
914 #endif
915 }
916
917 30 double AVSValue::AsFloat() const { return AsFloat1(); }
918
919 float AVSValue::AsFloatf() const {
920 #if UINTPTR_MAX >= 0xffffffffffffffff
921 _ASSERTE(IsFloat()); return type == 'i' ? (float)integer : type == 'l' ? (float)longlong : type == 'f' ? floating_pt : (float)double_pt;
922 #else
923 _ASSERTE(IsFloat()); return type == 'i' ? (float)integer : type == 'l' ? (float)*longlong_ptr : type == 'f' ? floating_pt : (float)*double_pt_ptr;
924 #endif
925 }
926
927
5/6
✓ Branch 3 → 4 taken 18 times.
✓ Branch 3 → 7 taken 272 times.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 18 times.
✓ Branch 8 → 9 taken 272 times.
✓ Branch 8 → 10 taken 18 times.
290 bool AVSValue::AsBool2(bool def) const { _ASSERTE(IsBool()||!Defined()); return IsBool() ? boolean : def; }
928 290 bool AVSValue::AsBool(bool def) const { return AsBool2(def); }
929
930 164 int AVSValue::AsInt2(int def) const {
931
3/4
✓ Branch 3 → 4 taken 14 times.
✓ Branch 3 → 7 taken 150 times.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 14 times.
164 _ASSERTE(IsInt()||!Defined());
932 #if UINTPTR_MAX >= 0xffffffffffffffff
933
3/4
✓ Branch 7 → 8 taken 150 times.
✓ Branch 7 → 9 taken 14 times.
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 11 taken 14 times.
164 return type == 'i' ? integer : type == 'l' ? (int)longlong : def;
934 #else
935 return type == 'i' ? integer : type == 'l' ? (int)*longlong_ptr : def;
936 #endif
937 }
938
939 164 int AVSValue::AsInt(int def) const { return AsInt2(def); }
940 int64_t AVSValue::AsLong2(int64_t def) const {
941 _ASSERTE(IsInt() || !Defined());
942 #if UINTPTR_MAX >= 0xffffffffffffffff
943 return type == 'i' ? integer : type == 'l' ? longlong : def;
944 #else
945 return type == 'i' ? integer : type == 'l' ? *longlong_ptr : def;
946 #endif
947 }
948
949 int64_t AVSValue::AsLong(int64_t def) const {
950 return AsLong2(def);
951 }
952
953 239 double AVSValue::AsDblDef(double def) const {
954
3/4
✓ Branch 3 → 4 taken 146 times.
✓ Branch 3 → 7 taken 93 times.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 146 times.
239 _ASSERTE(IsFloat()||!Defined());
955 #if UINTPTR_MAX >= 0xffffffffffffffff
956
7/8
✓ Branch 7 → 8 taken 1 time.
✓ Branch 7 → 9 taken 238 times.
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 11 taken 238 times.
✓ Branch 11 → 12 taken 65 times.
✓ Branch 11 → 13 taken 173 times.
✓ Branch 13 → 14 taken 27 times.
✓ Branch 13 → 15 taken 146 times.
239 return type == 'i' ? (double)integer : type == 'l' ? (double)longlong : type == 'f' ? (double)floating_pt : type == 'd' ? double_pt : def;
957 #else
958 return type == 'i' ? (double)integer : type == 'l' ? (double)*longlong_ptr : type == 'f' ? (double)floating_pt : type == 'd' ? *double_pt_ptr : def;
959 #endif
960 }
961
962 165 double AVSValue::AsFloat2(float def) const {
963
3/4
✓ Branch 3 → 4 taken 10 times.
✓ Branch 3 → 7 taken 155 times.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 10 times.
165 _ASSERTE(IsFloat()||!Defined());
964 #if UINTPTR_MAX >= 0xffffffffffffffff
965
7/8
✓ Branch 7 → 8 taken 3 times.
✓ Branch 7 → 9 taken 162 times.
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 11 taken 162 times.
✓ Branch 11 → 12 taken 138 times.
✓ Branch 11 → 13 taken 24 times.
✓ Branch 13 → 14 taken 14 times.
✓ Branch 13 → 15 taken 10 times.
165 return type == 'i' ? integer : type == 'l' ? (double)longlong : type == 'f' ? (double)floating_pt : type == 'd' ? double_pt : (double)def;
966 #else
967 return type == 'i' ? integer : type == 'l' ? (double)*longlong_ptr : type == 'f' ? (double)floating_pt : type == 'd' ? *double_pt_ptr : (double)def;
968 #endif
969 }
970
971 156 double AVSValue::AsFloat(float def) const { return AsFloat2(def); }
972 9 float AVSValue::AsFloatf(float def) const { return float( AsFloat2(def) ); }
973
974
5/6
✓ Branch 3 → 4 taken 2646 times.
✓ Branch 3 → 7 taken 253 times.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 2646 times.
✓ Branch 8 → 9 taken 253 times.
✓ Branch 8 → 10 taken 2646 times.
2899 const char* AVSValue::AsString2(const char* def) const { _ASSERTE(IsString()||!Defined()); return IsString() ? string : def; }
975 2899 const char* AVSValue::AsString(const char* def) const { return AVSValue::AsString2(def); }
976
977 PFunction AVSValue::AsFunction() const { _ASSERTE(IsFunction()); return IsFunction() ? function : 0; }
978
979
2/4
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 68 times.
✓ Branch 6 → 7 taken 68 times.
✗ Branch 6 → 8 not taken.
68 int AVSValue::ArraySize() const { _ASSERTE(IsArray()) ; return IsArray() ? array_size : 1; }
980
981 1314 const AVSValue& AVSValue::operator[](int index) const { return OPERATOR_INDEX(index); }
982 1314 const AVSValue& AVSValue::OPERATOR_INDEX(int index) const {
983
3/6
✓ Branch 3 → 4 taken 1314 times.
✗ Branch 3 → 7 not taken.
✓ Branch 4 → 5 taken 1314 times.
✗ Branch 4 → 7 not taken.
✓ Branch 5 → 6 taken 1314 times.
✗ Branch 5 → 7 not taken.
1314 _ASSERTE(IsArray() && index>=0 && index<array_size);
984
3/6
✓ Branch 9 → 10 taken 1314 times.
✗ Branch 9 → 13 not taken.
✓ Branch 10 → 11 taken 1314 times.
✗ Branch 10 → 13 not taken.
✓ Branch 11 → 12 taken 1314 times.
✗ Branch 11 → 13 not taken.
1314 return (IsArray() && index>=0 && index<array_size) ? array[index] : *this;
985 }
986
987 // This Assign can deep-copy array elements
988 // For compatibility interface, we use Assign2 through CONSTRUCTOR10
989 1116501 void AVSValue::Assign(const AVSValue* src, bool init) {
990 1116501 Assign2(src, init, false);
991 1116501 }
992
993 1116501 void AVSValue::Assign2(const AVSValue* src, bool init, bool no_deep_arrays) {
994
5/6
✓ Branch 3 → 4 taken 451 times.
✓ Branch 3 → 6 taken 1116050 times.
✓ Branch 4 → 5 taken 451 times.
✗ Branch 4 → 6 not taken.
✓ Branch 7 → 8 taken 451 times.
✓ Branch 7 → 9 taken 1116050 times.
1116501 if (src->IsClip() && src->clip)
995 451 src->clip->AddRef();
996
2/6
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 13 taken 1116501 times.
✗ Branch 11 → 12 not taken.
✗ Branch 11 → 13 not taken.
✗ Branch 14 → 15 not taken.
✓ Branch 14 → 16 taken 1116501 times.
1116501 if (src->IsFunction() && src->function)
997 src->function->AddRef();
998
999 // The left side of the assignment ("this") will be overwritten by "src",
1000 // so it should be released or freed if necessary.
1001 // The relevant properties must be released/dereferenced at the end:
1002 // clip, array, function, double_pt_ptr and longlong_ptr
1003 // Since they share the same pointer, saving (void*)clip would do it;
1004
5/6
✓ Branch 16 → 17 taken 385571 times.
✓ Branch 16 → 21 taken 730930 times.
✓ Branch 18 → 19 taken 14 times.
✓ Branch 18 → 21 taken 385557 times.
✓ Branch 19 → 20 taken 14 times.
✗ Branch 19 → 21 not taken.
1116501 const bool shouldReleaseClip = !init && IsClip() && clip;
1005
3/6
✓ Branch 22 → 23 taken 385571 times.
✓ Branch 22 → 27 taken 730930 times.
✗ Branch 24 → 25 not taken.
✓ Branch 24 → 27 taken 385571 times.
✗ Branch 25 → 26 not taken.
✗ Branch 25 → 27 not taken.
1116501 const bool shouldReleaseFunction = !init && IsFunction() && function;
1006
3/8
✓ Branch 28 → 29 taken 385571 times.
✓ Branch 28 → 34 taken 730930 times.
✗ Branch 30 → 31 not taken.
✓ Branch 30 → 34 taken 385571 times.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 34 not taken.
✗ Branch 32 → 33 not taken.
✗ Branch 32 → 34 not taken.
1116501 const bool shouldReleaseArray = !init && IsArray() && array && !no_deep_arrays;
1007 #if !(UINTPTR_MAX >= 0xffffffffffffffff)
1008 const bool shouldReleaseDouble = !init && type == 'd' && double_pt_ptr;
1009 const bool shouldReleaseLong = !init && type == 'l' && longlong_ptr;
1010 #endif
1011 1116501 void* prev_pointer_to_release = (void*)clip;
1012
1013 // common fields
1014 1116501 this->type = src->type;
1015 1116501 this->array_size = src->array_size;
1016
1017 // no_deep_arrays: compatibility for AVS2.5: don't free or deep copy array elements!
1018
5/6
✓ Branch 36 → 37 taken 23 times.
✓ Branch 36 → 39 taken 1116478 times.
✓ Branch 37 → 38 taken 23 times.
✗ Branch 37 → 39 not taken.
✓ Branch 40 → 41 taken 23 times.
✓ Branch 40 → 59 taken 1116478 times.
1116501 if (src->IsArray() && !no_deep_arrays)
1019 {
1020 // Delay releasing the previous array to avoid the args = args[0] case.
1021 // If an existing array were freed before this point, it would break the
1022 // value = value[x] case where the source value[x] is not an array.
1023 // Even for size == 0, this returns a valid pointer.
1024
5/18
✓ Branch 41 → 42 taken 23 times.
✗ Branch 41 → 43 not taken.
✓ Branch 46 → 47 taken 97 times.
✗ Branch 46 → 71 not taken.
✓ Branch 48 → 46 taken 97 times.
✓ Branch 48 → 49 taken 23 times.
✗ Branch 49 → 50 not taken.
✓ Branch 49 → 54 taken 23 times.
✗ Branch 50 → 51 not taken.
✗ Branch 50 → 52 not taken.
✗ Branch 71 → 72 not taken.
✗ Branch 71 → 75 not taken.
✗ Branch 73 → 74 not taken.
✗ Branch 73 → 75 not taken.
✗ Branch 76 → 77 not taken.
✗ Branch 76 → 81 not taken.
✗ Branch 77 → 78 not taken.
✗ Branch 77 → 79 not taken.
120 AVSValue* tmp = new AVSValue[array_size];
1025
2/2
✓ Branch 57 → 55 taken 97 times.
✓ Branch 57 → 58 taken 23 times.
120 for (int i = 0; i < array_size; i++)
1026 97 tmp[i].Assign(&src->array[i], true); // init from source
1027 23 array = tmp;
1028 }
1029 #if !(UINTPTR_MAX >= 0xffffffffffffffff)
1030 // 32 bit Avisynth: new 64 bit types are specially treated
1031 else if (this->type == 'l') {
1032 const uint64_t l = *src->longlong_ptr;
1033 this->longlong_ptr = new int64_t;
1034 *this->longlong_ptr = l;
1035 }
1036 else if (this->type == 'd') {
1037 const double d = *src->double_pt_ptr;
1038 this->double_pt_ptr = new double;
1039 *this->double_pt_ptr = d;
1040 }
1041 #endif
1042 else {
1043 1116478 this->clip = (IClip*)((void*)src->clip);
1044 // "clip" is the largest member of the union, making sure we copy everything
1045 }
1046
1047
2/2
✓ Branch 60 → 61 taken 14 times.
✓ Branch 60 → 62 taken 1116487 times.
1116501 if (shouldReleaseClip)
1048 14 ((IClip*)prev_pointer_to_release)->Release();
1049
1/2
✗ Branch 62 → 63 not taken.
✓ Branch 62 → 64 taken 1116501 times.
1116501 if (shouldReleaseFunction)
1050 ((IFunction*)prev_pointer_to_release)->Release();
1051
1/2
✗ Branch 64 → 65 not taken.
✓ Branch 64 → 70 taken 1116501 times.
1116501 if (shouldReleaseArray)
1052 delete[](AVSValue*)(prev_pointer_to_release);
1053 // deallocates former array memory + calls destructor of AVSValue elements
1054 #if !(UINTPTR_MAX >= 0xffffffffffffffff)
1055 if (shouldReleaseDouble)
1056 delete (double*)prev_pointer_to_release;
1057 else if (shouldReleaseLong)
1058 delete (int64_t*)prev_pointer_to_release;
1059 #endif
1060 1116501 }
1061
1062 AvsValueType AVSValue::GetType() const { return (AvsValueType)type; }
1063
1064 // end class AVSValue
1065
1066 /**********************************************************************/
1067
1068 PFunction::PFunction() { CONSTRUCTOR0(); }
1069 void PFunction::CONSTRUCTOR0() { Init(0); }
1070
1071 PFunction::PFunction(IFunction* p) { CONSTRUCTOR1(p); }
1072 void PFunction::CONSTRUCTOR1(IFunction* p) { Init(p); }
1073
1074 PFunction::PFunction(const PFunction& p) { CONSTRUCTOR2(p); }
1075 void PFunction::CONSTRUCTOR2(const PFunction& p) { Init(p.e); }
1076
1077 PFunction& PFunction::operator=(IFunction* p) { return OPERATOR_ASSIGN0(p); }
1078 PFunction& PFunction::OPERATOR_ASSIGN0(IFunction* p) { Set(p); return *this; }
1079
1080 PFunction& PFunction::operator=(const PFunction& p) { return OPERATOR_ASSIGN1(p); }
1081 PFunction& PFunction::OPERATOR_ASSIGN1(const PFunction& p) { Set(p.e); return *this; }
1082
1083 PFunction::~PFunction() { DESTRUCTOR(); }
1084 void PFunction::DESTRUCTOR() { if (e) e->Release(); }
1085
1086 IFunction * PFunction::GetPointerWithAddRef() const { if (e) e->AddRef(); return e; }
1087 void PFunction::Init(IFunction* p) { e = p; if (e) e->AddRef(); }
1088 void PFunction::Set(IFunction* p) { if (p) p->AddRef(); if (e) e->Release(); e = p; }
1089
1090 PDevice::PDevice() { CONSTRUCTOR0(); }
1091 void PDevice::CONSTRUCTOR0() { e = 0; }
1092
1093 PDevice::PDevice(Device* p) { CONSTRUCTOR1(p); }
1094 void PDevice::CONSTRUCTOR1(Device* p) { e = p; }
1095
1096 PDevice::PDevice(const PDevice& p) { CONSTRUCTOR2(p); }
1097 void PDevice::CONSTRUCTOR2(const PDevice& p) { e = p.e; }
1098
1099 PDevice& PDevice::operator=(Device* p) { return OPERATOR_ASSIGN0(p); }
1100 PDevice& PDevice::OPERATOR_ASSIGN0(Device* p) { e = p; return *this; }
1101
1102 PDevice& PDevice::operator=(const PDevice& p) { return OPERATOR_ASSIGN1(p); }
1103 PDevice& PDevice::OPERATOR_ASSIGN1(const PDevice& p) { e = p.e; return *this; }
1104
1105 PDevice::~PDevice() { }
1106 void PDevice::DESTRUCTOR() { }
1107
1108 AvsDeviceType PDevice::GetType() const { return e ? e->device_type : DEV_TYPE_NONE; }
1109 int PDevice::GetId() const { return e ? e->device_id : -1; }
1110 int PDevice::GetIndex() const { return e ? e->device_index : -1; }
1111 const char* PDevice::GetName() const { return e ? e->GetName() : nullptr; }
1112
1113 INeoEnv* __stdcall GetAvsEnv(IScriptEnvironment* env) { return static_cast<InternalEnvironment*>(env); }
1114
1115 PNeoEnv::PNeoEnv(IScriptEnvironment* env) : p(static_cast<InternalEnvironment*>(env)) { }
1116 PNeoEnv::operator IScriptEnvironment2* () { return static_cast<InternalEnvironment*>(p); }
1117
1118 /**********************************************************************/
1119
1120 static const AVS_Linkage avs_linkage = { // struct AVS_Linkage {
1121
1122 sizeof(AVS_Linkage), // int Size;
1123
1124 /***************************************************************************************************************/
1125 // struct VideoInfo
1126 &VideoInfo::HasVideo, // bool (VideoInfo::*HasVideo)() const;
1127 &VideoInfo::HasAudio, // bool (VideoInfo::*HasAudio)() const;
1128 &VideoInfo::IsRGB, // bool (VideoInfo::*IsRGB)() const;
1129 &VideoInfo::IsRGB24, // bool (VideoInfo::*IsRGB24)() const;
1130 &VideoInfo::IsRGB32, // bool (VideoInfo::*IsRGB32)() const;
1131 &VideoInfo::IsYUV, // bool (VideoInfo::*IsYUV)() const;
1132 &VideoInfo::IsYUY2, // bool (VideoInfo::*IsYUY2)() const;
1133 &VideoInfo::IsYV24, // bool (VideoInfo::*IsYV24)() const;
1134 &VideoInfo::IsYV16, // bool (VideoInfo::*IsYV16)() const;
1135 &VideoInfo::IsYV12, // bool (VideoInfo::*IsYV12)() const;
1136 &VideoInfo::IsYV411, // bool (VideoInfo::*IsYV411)() const;
1137 &VideoInfo::IsY8, // bool (VideoInfo::*IsY8)() const;
1138 &VideoInfo::IsColorSpace, // bool (VideoInfo::*IsColorSpace)(int c_space) const;
1139 &VideoInfo::Is, // bool (VideoInfo::*Is)(int property) const;
1140 &VideoInfo::IsPlanar, // bool (VideoInfo::*IsPlanar)() const;
1141 &VideoInfo::IsFieldBased, // bool (VideoInfo::*IsFieldBased)() const;
1142 &VideoInfo::IsParityKnown, // bool (VideoInfo::*IsParityKnown)() const;
1143 &VideoInfo::IsBFF, // bool (VideoInfo::*IsBFF)() const;
1144 &VideoInfo::IsTFF, // bool (VideoInfo::*IsTFF)() const;
1145 &VideoInfo::IsVPlaneFirst, // bool (VideoInfo::*IsVPlaneFirst)() const;
1146 &VideoInfo::BytesFromPixels, // int (VideoInfo::*BytesFromPixels)(int pixels) const;
1147 &VideoInfo::RowSize, // int (VideoInfo::*RowSize)(int plane) const;
1148 &VideoInfo::BMPSize, // int (VideoInfo::*BMPSize)() const;
1149 &VideoInfo::AudioSamplesFromFrames, // int64_t (VideoInfo::*AudioSamplesFromFrames)(int frames) const;
1150 &VideoInfo::FramesFromAudioSamples, // int (VideoInfo::*FramesFromAudioSamples)(int64_t samples) const;
1151 &VideoInfo::AudioSamplesFromBytes, // int64_t (VideoInfo::*AudioSamplesFromBytes)(int64_t bytes) const;
1152 &VideoInfo::BytesFromAudioSamples, // int64_t (VideoInfo::*BytesFromAudioSamples)(int64_t samples) const;
1153 &VideoInfo::AudioChannels, // int (VideoInfo::*AudioChannels)() const;
1154 &VideoInfo::SampleType, // int (VideoInfo::*SampleType)() const;
1155 &VideoInfo::IsSampleType, // bool (VideoInfo::*IsSampleType)(int testtype) const;
1156 &VideoInfo::SamplesPerSecond, // int (VideoInfo::*SamplesPerSecond)() const;
1157 &VideoInfo::BytesPerAudioSample, // int (VideoInfo::*BytesPerAudioSample)() const;
1158 &VideoInfo::SetFieldBased, // void (VideoInfo::*SetFieldBased)(bool isfieldbased);
1159 &VideoInfo::Set, // void (VideoInfo::*Set)(int property);
1160 &VideoInfo::Clear, // void (VideoInfo::*Clear)(int property);
1161 &VideoInfo::GetPlaneWidthSubsampling, // int (VideoInfo::*GetPlaneWidthSubsampling)(int plane) const;
1162 &VideoInfo::GetPlaneHeightSubsampling, // int (VideoInfo::*GetPlaneHeightSubsampling)(int plane) const;
1163 &VideoInfo::BitsPerPixel, // int (VideoInfo::*BitsPerPixel)() const;
1164 &VideoInfo::BytesPerChannelSample, // int (VideoInfo::*BytesPerChannelSample)() const;
1165 &VideoInfo::SetFPS, // void (VideoInfo::*SetFPS)(unsigned numerator, unsigned denominator)
1166 &VideoInfo::MulDivFPS, // void (VideoInfo::*MulDivFPS)(unsigned multiplier, unsigned divisor)
1167 &VideoInfo::IsSameColorspace, // bool (VideoInfo::*IsSameColorspace)(const VideoInfo& vi) const;
1168 // end struct VideoInfo
1169 /***************************************************************************************************************/
1170 // class VideoFrameBuffer
1171 &VideoFrameBuffer::GetReadPtr, // const BYTE* (VideoFrameBuffer::*VFBGetReadPtr)() const;
1172 &VideoFrameBuffer::GetWritePtr, // BYTE* (VideoFrameBuffer::*VFBGetWritePtr)();
1173 &VideoFrameBuffer::GetDataSize, // int (VideoFrameBuffer::*GetDataSize)() const;
1174 &VideoFrameBuffer::GetSequenceNumber, // int (VideoFrameBuffer::*GetSequenceNumber)() const;
1175 &VideoFrameBuffer::GetRefcount, // int (VideoFrameBuffer::*GetRefcount)() const;
1176 // end class VideoFrameBuffer
1177 /***************************************************************************************************************/
1178 // class VideoFrame
1179 &VideoFrame::GetPitch, // int (VideoFrame::*GetPitch)(int plane) const;
1180 &VideoFrame::GetRowSize, // int (VideoFrame::*GetRowSize)(int plane) const;
1181 &VideoFrame::GetHeight, // int (VideoFrame::*GetHeight)(int plane) const;
1182 &VideoFrame::GetFrameBuffer, // VideoFrameBuffer* (VideoFrame::*GetFrameBuffer)() const;
1183 &VideoFrame::GetOffset, // int (VideoFrame::*GetOffset)(int plane) const;
1184 &VideoFrame::GetReadPtr, // const BYTE* (VideoFrame::*VFGetReadPtr)(int plane) const;
1185 &VideoFrame::IsWritable, // bool (VideoFrame::*IsWritable)() const;
1186 &VideoFrame::GetWritePtr, // BYTE* (VideoFrame::*VFGetWritePtr)(int plane) const;
1187 &VideoFrame::DESTRUCTOR, // void (VideoFrame::*VideoFrame_DESTRUCTOR)();
1188 // end class VideoFrame
1189 /***************************************************************************************************************/
1190 // class IClip
1191 // /* nothing */
1192 // end class IClip
1193 /***************************************************************************************************************/
1194 // class PClip
1195 &PClip::CONSTRUCTOR0, // void (PClip::*PClip_CONSTRUCTOR0)();
1196 &PClip::CONSTRUCTOR1, // void (PClip::*PClip_CONSTRUCTOR1)(const PClip& x);
1197 &PClip::CONSTRUCTOR2, // void (PClip::*PClip_CONSTRUCTOR2)(IClip* x);
1198 &PClip::OPERATOR_ASSIGN0, // void (PClip::*PClip_OPERATOR_ASSIGN0)(IClip* x);
1199 &PClip::OPERATOR_ASSIGN1, // void (PClip::*PClip_OPERATOR_ASSIGN1)(const PClip& x);
1200 &PClip::DESTRUCTOR, // void (PClip::*PClip_DESTRUCTOR)();
1201 // end class PClip
1202 /***************************************************************************************************************/
1203 // class PVideoFrame
1204 &PVideoFrame::CONSTRUCTOR0, // void (PVideoFrame::*PVideoFrame_CONSTRUCTOR0)();
1205 &PVideoFrame::CONSTRUCTOR1, // void (PVideoFrame::*PVideoFrame_CONSTRUCTOR1)(const PVideoFrame& x);
1206 &PVideoFrame::CONSTRUCTOR2, // void (PVideoFrame::*PVideoFrame_CONSTRUCTOR2)(VideoFrame* x);
1207 &PVideoFrame::OPERATOR_ASSIGN0, // void (PVideoFrame::*PVideoFrame_OPERATOR_ASSIGN0(VideoFrame* x);
1208 &PVideoFrame::OPERATOR_ASSIGN1, // void (PVideoFrame::*PVideoFrame_OPERATOR_ASSIGN1(const PVideoFrame& x);
1209 &PVideoFrame::DESTRUCTOR, // void (PVideoFrame::*PVideoFrame_DESTRUCTOR)();
1210 // end class PVideoFrame
1211 /***************************************************************************************************************/
1212 // class AVSValue
1213 &AVSValue::CONSTRUCTOR0, // void (AVSValue::*AVSValue_CONSTRUCTOR0)();
1214 &AVSValue::CONSTRUCTOR1, // void (AVSValue::*AVSValue_CONSTRUCTOR1)(IClip* c);
1215 &AVSValue::CONSTRUCTOR2, // void (AVSValue::*AVSValue_CONSTRUCTOR2)(const PClip& c);
1216 &AVSValue::CONSTRUCTOR3, // void (AVSValue::*AVSValue_CONSTRUCTOR3)(bool b);
1217 &AVSValue::CONSTRUCTOR4, // void (AVSValue::*AVSValue_CONSTRUCTOR4)(int i);
1218 &AVSValue::CONSTRUCTOR5, // void (AVSValue::*AVSValue_CONSTRUCTOR5)(float f);
1219 &AVSValue::CONSTRUCTOR6, // void (AVSValue::*AVSValue_CONSTRUCTOR6)(double f);
1220 &AVSValue::CONSTRUCTOR7, // void (AVSValue::*AVSValue_CONSTRUCTOR7)(const char* s);
1221 &AVSValue::CONSTRUCTOR8, // void (AVSValue::*AVSValue_CONSTRUCTOR8)(const AVSValue* a, int
1222 &AVSValue::CONSTRUCTOR9, // void (AVSValue::*AVSValue_CONSTRUCTOR9)(const AVSValue& v);
1223 &AVSValue::DESTRUCTOR, // void (AVSValue::*AVSValue_DESTRUCTOR)();
1224 &AVSValue::OPERATOR_ASSIGN, // AVSValue& (AVSValue::*AVSValue_OPERATOR_ASSIGN)(const AVSValue& v);
1225 &AVSValue::OPERATOR_INDEX, // const AVSValue& (AVSValue::*AVSValue_OPERATOR_INDEX)(int index) const;
1226 &AVSValue::Defined, // bool (AVSValue::*Defined)() const;
1227 &AVSValue::IsClip, // bool (AVSValue::*IsClip)() const;
1228 &AVSValue::IsBool, // bool (AVSValue::*IsBool)() const;
1229 &AVSValue::IsInt, // bool (AVSValue::*IsInt)() const;
1230 &AVSValue::IsFloat, // bool (AVSValue::*IsFloat)() const;
1231 &AVSValue::IsString, // bool (AVSValue::*IsString)() const;
1232 &AVSValue::IsArray, // bool (AVSValue::*IsArray)() const;
1233 &AVSValue::AsClip, // PClip (AVSValue::*AsClip)() const;
1234 &AVSValue::AsBool1, // bool (AVSValue::*AsBool1)() const;
1235 &AVSValue::AsInt1, // int (AVSValue::*AsInt1)() const;
1236 &AVSValue::AsString1, // const char* (AVSValue::*AsString1)() const;
1237 &AVSValue::AsFloat1, // double (AVSValue::*AsFloat1)() const; // AsDouble1
1238 &AVSValue::AsBool2, // bool (AVSValue::*AsBool2)(bool def) const;
1239 &AVSValue::AsInt2, // int (AVSValue::*AsInt2)(int def) const;
1240 &AVSValue::AsDblDef, // double (AVSValue::*AsDblDef)(double def) const; // AsDouble2
1241 &AVSValue::AsFloat2, // double (AVSValue::*AsFloat2)(float def) const;
1242 &AVSValue::AsString2, // const char* (AVSValue::*AsString2)(const char* def) const;
1243 &AVSValue::ArraySize, // int (AVSValue::*ArraySize)() const;
1244 &AVSValue::IsLongStrict, // bool (AVSValue::*IsLongStrict)() const; // v11
1245 &AVSValue::IsFloatfStrict, // bool (AVSValue::*IsFloatfStrict() const; // v11
1246 &AVSValue::AsLong1, // int64_t (AVSValue::*AsLong1)() const; // v11
1247 &AVSValue::AsLong2, // int64_t (AVSValue::*AsLong2)(int64_t def) const; // v11
1248 &AVSValue::CONSTRUCTOR12, // void (AVSValue::*AVSValue_CONSTRUCTOR12)(int64_ l); // v11
1249 // end class AVSValue
1250 /**********************************************************************/
1251 // a single { nullptr } initializes the whole placeholder array
1252 { nullptr }, // void (VideoInfo::* reserved[27])(); // reserved for AVS classic
1253 /**********************************************************************/
1254 // AviSynth+ additions
1255 &VideoInfo::NumComponents, // int (VideoInfo::*NumChannels)() const;
1256 &VideoInfo::ComponentSize, // int (VideoInfo::*ComponentSize)() const;
1257 &VideoInfo::BitsPerComponent, // int (VideoInfo::*BitsPerComponent)() const;
1258 &VideoInfo::Is444, // bool (VideoInfo::*Is444)() const;
1259 &VideoInfo::Is422, // bool (VideoInfo::*Is422)() const;
1260 &VideoInfo::Is420, // bool (VideoInfo::*Is420)() const;
1261 &VideoInfo::IsY, // bool (VideoInfo::*IsY)() const;
1262 &VideoInfo::IsRGB48, // bool (VideoInfo::*IsRGB48)() const;
1263 &VideoInfo::IsRGB64, // bool (VideoInfo::*IsRGB64)() const;
1264 &VideoInfo::IsYUVA, // bool (VideoInfo::*IsYUVA)() const;
1265 &VideoInfo::IsPlanarRGB, // bool (VideoInfo::*IsPlanarRGB)() const;
1266 &VideoInfo::IsPlanarRGBA, // bool (VideoInfo::*IsPlanarRGBA)() const;
1267 /**********************************************************************/
1268 // Frame properties
1269 &VideoFrame::getProperties, // AVSMap& (VideoFrame::* getProperties)();
1270 &VideoFrame::getConstProperties, // const AVSMap& (VideoFrame::* getConstProperties)();
1271 &VideoFrame::setProperties, // void (VideoFrame::* setProperties)(const AVSMap& properties);
1272
1273 // PFunction (Neo)
1274 &AVSValue::CONSTRUCTOR11,
1275 &AVSValue::IsFunction,
1276 &PFunction::CONSTRUCTOR0,
1277 &PFunction::CONSTRUCTOR1,
1278 &PFunction::CONSTRUCTOR2,
1279 &PFunction::OPERATOR_ASSIGN0,
1280 &PFunction::OPERATOR_ASSIGN1,
1281 &PFunction::DESTRUCTOR,
1282 // end PFunction
1283
1284 // VideoFrame extras (Neo)
1285 &VideoFrame::CheckMemory,
1286 &VideoFrame::GetDevice,
1287
1288 // class PDevice (Neo)
1289 &PDevice::CONSTRUCTOR0,
1290 &PDevice::CONSTRUCTOR1,
1291 &PDevice::CONSTRUCTOR2,
1292 &PDevice::OPERATOR_ASSIGN0,
1293 &PDevice::OPERATOR_ASSIGN1,
1294 &PDevice::DESTRUCTOR,
1295 &PDevice::GetType,
1296 &PDevice::GetId,
1297 &PDevice::GetIndex,
1298 &PDevice::GetName,
1299 // end class PDevice
1300
1301 // V9
1302 &VideoFrame::IsPropertyWritable,
1303
1304 // V10
1305 &VideoFrame::GetPixelType, // int (VideoFrame::*VideoFrame_GetPixelType)() const;
1306 &VideoFrame::AmendPixelType, // void (VideoFrame::*VideoFrame_AmendPixelType)();
1307 &VideoFrameBuffer::DESTRUCTOR, // void (VideoFrameBuffer::*VideoFrameBuffer_DESTRUCTOR)();
1308 &AVSValue::GetType, // AvsValueType (AVSValue::*AVSValue_GetType)() const;
1309
1310 // V10.1
1311 &VideoInfo::IsChannelMaskKnown, // bool (VideoInfo::*IsChannelMaskKnown)() const;
1312 &VideoInfo::SetChannelMask, // void (VideoInfo::*SetChannelMask)();
1313 &VideoInfo::GetChannelMask, // int (VideoInfo::*GetChannelMask)() const;
1314
1315 // a single { nullptr } initializes the whole placeholder array
1316 { nullptr }, // void (VideoInfo::* reserved2[64 - 31])(); // Reserve pointer space for Avisynth+
1317
1318 /**********************************************************************/
1319 // AviSynth Neo additions
1320 &GetAvsEnv
1321 // Most Neo linkage entries are moved to standard avs+ place.
1322 // frame property logic has been replaced entirely
1323
1324 // this part should be identical with struct AVS_Linkage in avisynth.h
1325
1326 /**********************************************************************/
1327 }; // }
1328
1329 extern __declspec(dllexport) const AVS_Linkage* const AVS_linkage = &avs_linkage;
1330
1331
1332 /**********************************************************************/
1333 // in UserPlugin.cpp
1334 #if 0
1335
1336 #include "avisynth.h"
1337
1338 /* New 2.6 requirment!!! */
1339 // Declare and initialise server pointers static storage.
1340 const AVS_Linkage *AVS_linkage = 0;
1341
1342 /* New 2.6 requirment!!! */
1343 // DLL entry point called from LoadPlugin() to setup a user plugin.
1344 extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {
1345
1346 /* New 2.6 requirment!!! */
1347 // Save the server pointers.
1348 AVS_linkage = vectors;
1349
1350 // Add the name of our function
1351 env->AddFunction("Plugin", "c", Create_Plugin, 0);
1352
1353 // Return plugin text identifier.
1354 return "Plugin";
1355 }
1356
1357 #endif
1358 /**********************************************************************/
1359
1360