GCC Code Coverage Report


Directory: avs_core/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 66.7% 8 / 0 / 12
Functions: 75.0% 3 / 0 / 4
Branches: 25.0% 5 / 0 / 20

filters/planeswap.h
Line Branch Exec Source
1 // Avisynth v2.5. Copyright 2002 Ben Rudiak-Gould et al.
2 // http://avisynth.nl
3
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
17 // http://www.gnu.org/copyleft/gpl.html .
18 //
19 // Linking Avisynth statically or dynamically with other modules is making a
20 // combined work based on Avisynth. Thus, the terms and conditions of the GNU
21 // General Public License cover the whole combination.
22 //
23 // As a special exception, the copyright holders of Avisynth give you
24 // permission to link Avisynth with independent modules that communicate with
25 // Avisynth solely through the interfaces defined in avisynth.h, regardless of the license
26 // terms of these independent modules, and to copy and distribute the
27 // resulting combined work under terms of your choice, provided that
28 // every copy of the combined work is accompanied by a complete copy of
29 // the source code of Avisynth (the version of Avisynth used to produce the
30 // combined work), being distributed under the terms of the GNU General
31 // Public License plus this exception. An independent module is a module
32 // which is not derived from or based on Avisynth, such as 3rd-party filters,
33 // import and export plugins, or graphical user interfaces.
34
35
36 // Avisynth filter: Plane Swap
37 // by Klaus Post
38
39
40
41 #ifndef __Planeswap_H__
42 #define __Planeswap_H__
43
44 #include <avisynth.h>
45
46
47 /****************************************************
48 ****************************************************/
49
50 class SwapUV : public GenericVideoFilter
51 /**
52 * SwapUVs planar channels
53 **/
54 {
55 public:
56 SwapUV(PClip _child, IScriptEnvironment* env);
57 PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override;
58
59 2 int __stdcall SetCacheHints(int cachehints, int frame_range) override {
60 AVS_UNUSED(frame_range);
61
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 13 taken 2 times.
2 if (cachehints == CACHE_GET_DEV_TYPE) {
62 return (vi.IsPlanar() && (child->GetVersion() >= 5)) ? child->SetCacheHints(CACHE_GET_DEV_TYPE, 0) : 0;
63 }
64
1/2
✓ Branch 13 → 14 taken 2 times.
✗ Branch 13 → 15 not taken.
2 return cachehints == CACHE_GET_MTMODE ? MT_NICE_FILTER : 0;
65 }
66
67 static AVSValue __cdecl CreateSwapUV(AVSValue args, void* user_data, IScriptEnvironment* env);
68
69 };
70
71
72 class SwapUVToY : public GenericVideoFilter
73 /**
74 * SwapUVToYs planar channels
75 **/
76 {
77 public:
78 SwapUVToY(PClip _child, int _mode, IScriptEnvironment* env);
79 PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override;
80
81 2 int __stdcall SetCacheHints(int cachehints, int frame_range) override {
82 AVS_UNUSED(frame_range);
83
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 13 taken 2 times.
2 if (cachehints == CACHE_GET_DEV_TYPE) {
84 return (!vi.IsYUY2() && (child->GetVersion() >= 5)) ? child->SetCacheHints(CACHE_GET_DEV_TYPE, 0) : 0;
85 }
86
1/2
✓ Branch 13 → 14 taken 2 times.
✗ Branch 13 → 15 not taken.
2 return cachehints == CACHE_GET_MTMODE ? MT_NICE_FILTER : 0;
87 }
88
89 static AVSValue __cdecl CreateUToY(AVSValue args, void* user_data, IScriptEnvironment* env);
90 static AVSValue __cdecl CreateVToY(AVSValue args, void* user_data, IScriptEnvironment* env);
91 static AVSValue __cdecl CreateYToY8(AVSValue args, void* user_data, IScriptEnvironment* env);
92 static AVSValue __cdecl CreateUToY8(AVSValue args, void* user_data, IScriptEnvironment* env);
93 static AVSValue __cdecl CreateVToY8(AVSValue args, void* user_data, IScriptEnvironment* env);
94 static AVSValue __cdecl CreateAnyToY8(AVSValue args, void* user_data, IScriptEnvironment* env);
95 static AVSValue __cdecl CreatePlaneToY8(AVSValue args, void* user_data, IScriptEnvironment* env);
96
97 enum {UToY=1, VToY, UToY8, VToY8, YUY2UToY8, YUY2VToY8, AToY8, RToY8, GToY8, BToY8, YToY8};
98
99 private:
100 int mode;
101 };
102
103
104 class SwapYToUV : public GenericVideoFilter
105 /**
106 * SwapYToYUVs planar channels
107 **/
108 {
109 public:
110 SwapYToUV(PClip _child, PClip _clip, PClip _clipY, PClip _clipA, IScriptEnvironment* env);
111 PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override;
112
113 int __stdcall SetCacheHints(int cachehints, int frame_range) override {
114 AVS_UNUSED(frame_range);
115 return cachehints == CACHE_GET_MTMODE ? MT_NICE_FILTER : 0;
116 }
117
118 static AVSValue __cdecl CreateYToUV(AVSValue args, void* user_data, IScriptEnvironment* env);
119 static AVSValue __cdecl CreateYToYUV(AVSValue args, void* user_data, IScriptEnvironment* env);
120 static AVSValue __cdecl CreateYToYUVA(AVSValue args, void* user_data, IScriptEnvironment* env);
121
122
123 private:
124 PClip clip, clipY, clipA;
125 };
126
127 class CombinePlanes : public GenericVideoFilter
128 /**
129 * SwapYToYUVs planar channels
130 **/
131 {
132 public:
133 CombinePlanes(PClip _child, PClip _clip2, PClip _clip3, PClip _clip4, PClip _sample, const char *_target_planes_str, const char *_source_planes_str, const char *_pixel_type, IScriptEnvironment* env);
134 PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override;
135
136 2 int __stdcall SetCacheHints(int cachehints, int frame_range) override {
137 AVS_UNUSED(frame_range);
138
1/2
✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 4 not taken.
2 return cachehints == CACHE_GET_MTMODE ? MT_NICE_FILTER : 0;
139 }
140
141 static AVSValue __cdecl CreateCombinePlanes(AVSValue args, void* user_data, IScriptEnvironment* env);
142
143
144 private:
145 PClip clips[4];
146 int pixelsize;
147 int bits_per_pixel;
148 int planecount;
149 char planes[4];
150 int source_planes[4];
151 int target_planes[4];
152 };
153
154 #endif // __Planeswap_H__
155