filters/transform.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 | #ifndef __Transform_H__ | ||
| 36 | #define __Transform_H__ | ||
| 37 | |||
| 38 | #include <avisynth.h> | ||
| 39 | |||
| 40 | |||
| 41 | /******************************************************************** | ||
| 42 | ********************************************************************/ | ||
| 43 | |||
| 44 | |||
| 45 | class FlipVertical : public GenericVideoFilter | ||
| 46 | /** | ||
| 47 | * Class to vertically flip a video | ||
| 48 | **/ | ||
| 49 | { | ||
| 50 | public: | ||
| 51 |
2/4✓ Branch 2 → 3 taken 5 times.
✗ Branch 2 → 8 not taken.
✓ Branch 3 → 4 taken 5 times.
✗ Branch 3 → 6 not taken.
|
5 | FlipVertical(PClip _child) : GenericVideoFilter(_child) {} |
| 52 | PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override; | ||
| 53 | |||
| 54 | 1 | int __stdcall SetCacheHints(int cachehints, int frame_range) override { | |
| 55 | AVS_UNUSED(frame_range); | ||
| 56 |
1/2✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 4 not taken.
|
1 | return cachehints == CACHE_GET_MTMODE ? MT_NICE_FILTER : 0; |
| 57 | } | ||
| 58 | |||
| 59 | static AVSValue __cdecl Create(AVSValue args, void*, IScriptEnvironment* env); | ||
| 60 | }; | ||
| 61 | |||
| 62 | |||
| 63 | class FlipHorizontal : public GenericVideoFilter | ||
| 64 | /** | ||
| 65 | * Class to Horizontally flip a video | ||
| 66 | **/ | ||
| 67 | { | ||
| 68 | public: | ||
| 69 |
2/4✓ Branch 2 → 3 taken 7 times.
✗ Branch 2 → 8 not taken.
✓ Branch 3 → 4 taken 7 times.
✗ Branch 3 → 6 not taken.
|
7 | FlipHorizontal(PClip _child) : GenericVideoFilter(_child) {} |
| 70 | PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override; | ||
| 71 | |||
| 72 | 2 | int __stdcall SetCacheHints(int cachehints, int frame_range) override { | |
| 73 | AVS_UNUSED(frame_range); | ||
| 74 |
1/2✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 4 not taken.
|
2 | return cachehints == CACHE_GET_MTMODE ? MT_NICE_FILTER : 0; |
| 75 | } | ||
| 76 | |||
| 77 | static AVSValue __cdecl Create(AVSValue args, void*, IScriptEnvironment* env); | ||
| 78 | }; | ||
| 79 | |||
| 80 | |||
| 81 | class Crop : public GenericVideoFilter | ||
| 82 | /** | ||
| 83 | * Class to crop a video | ||
| 84 | **/ | ||
| 85 | { | ||
| 86 | public: | ||
| 87 | Crop(int _left, int _top, int _width, int _height, bool _align, PClip _child, IScriptEnvironment* env); | ||
| 88 | PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override; | ||
| 89 | |||
| 90 | int __stdcall SetCacheHints(int cachehints, int frame_range) override; | ||
| 91 | |||
| 92 | static AVSValue __cdecl Create(AVSValue args, void*, IScriptEnvironment* env); | ||
| 93 | |||
| 94 | private: | ||
| 95 | /*const*/ int left_bytes, top, align; | ||
| 96 | int xsub, ysub; | ||
| 97 | bool isRGBPfamily; | ||
| 98 | bool hasAlpha; | ||
| 99 | }; | ||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | class AddBorders : public GenericVideoFilter | ||
| 104 | /** | ||
| 105 | * Class to add borders to a video | ||
| 106 | **/ | ||
| 107 | { | ||
| 108 | public: | ||
| 109 | AddBorders(int _left, int _top, int _right, int _bot, int _clr, bool _force_color_as_yuv, PClip _child, IScriptEnvironment* env); | ||
| 110 | PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override; | ||
| 111 | |||
| 112 | 1 | int __stdcall SetCacheHints(int cachehints, int frame_range) override { | |
| 113 | AVS_UNUSED(frame_range); | ||
| 114 |
1/2✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 4 not taken.
|
1 | return cachehints == CACHE_GET_MTMODE ? MT_NICE_FILTER : 0; |
| 115 | } | ||
| 116 | |||
| 117 | static AVSValue __cdecl Create(AVSValue args, void*, IScriptEnvironment* env); | ||
| 118 | |||
| 119 | private: | ||
| 120 | /*const*/ int left, top, right, bot, clr; | ||
| 121 | int xsub, ysub; | ||
| 122 | bool force_color_as_yuv; | ||
| 123 | }; | ||
| 124 | |||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | |||
| 129 | |||
| 130 | /**** Factory methods ****/ | ||
| 131 | |||
| 132 | AVSValue __cdecl Create_Letterbox(AVSValue args, void*, IScriptEnvironment* env); | ||
| 133 | AVSValue __cdecl Create_CropBottom(AVSValue args, void*, IScriptEnvironment* env); | ||
| 134 | |||
| 135 | |||
| 136 | |||
| 137 | #endif // __Transform_H__ | ||
| 138 |