GCC Code Coverage Report


Directory: avs_core/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 4
Functions: 0.0% 0 / 0 / 2
Branches: 0.0% 0 / 0 / 4

filters/fps.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 #ifndef __FPS_H__
35 #define __FPS_H__
36
37 #include <stdint.h>
38 #include <avisynth.h>
39 #include "../core/internal.h"
40
41 /********************************************************************
42 ********************************************************************/
43
44 AVSValue __cdecl ContinuedCreate(AVSValue args, void* key, IScriptEnvironment* env);
45
46 void FloatToFPS(const char *name, float n, unsigned &num, unsigned &den, IScriptEnvironment* env);
47
48 void PresetToFPS(const char *name, const char *p, unsigned &num, unsigned &den, IScriptEnvironment* env);
49
50 class AssumeScaledFPS : public NonCachedGenericVideoFilter
51 /**
52 * Class to change the framerate without changing the frame count
53 **/
54 {
55 public:
56 AssumeScaledFPS(PClip _child, int multiplier, int divisor, bool sync_audio, IScriptEnvironment* env);
57 static AVSValue __cdecl Create(AVSValue args, void*, IScriptEnvironment* env);
58 };
59
60
61 class AssumeFPS : public NonCachedGenericVideoFilter
62 /**
63 * Class to change the framerate without changing the frame count
64 **/
65 {
66 public:
67 AssumeFPS(PClip _child, unsigned numerator, unsigned denominator, bool sync_audio, IScriptEnvironment* env);
68 static AVSValue __cdecl Create(AVSValue args, void*, IScriptEnvironment* env);
69 static AVSValue __cdecl CreateFloat(AVSValue args, void*, IScriptEnvironment* env);
70 static AVSValue __cdecl CreatePreset(AVSValue args, void*, IScriptEnvironment* env);
71 static AVSValue __cdecl CreateFromClip(AVSValue args, void*, IScriptEnvironment* env);
72 };
73
74
75 class ChangeFPS : public GenericVideoFilter
76 /**
77 * Class to change the framerate, deleting or adding frames as necessary
78 **/
79 {
80 public:
81 ChangeFPS(PClip _child, unsigned new_numerator, unsigned new_denominator, bool linear, IScriptEnvironment* env);
82 PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override;
83 bool __stdcall GetParity(int n) override;
84
85 int __stdcall SetCacheHints(int cachehints, int frame_range) override {
86 AVS_UNUSED(frame_range);
87 //todo: not really sure if it has to be serialized or can do with multiple instances
88 return cachehints == CACHE_GET_MTMODE ? MT_SERIALIZED : 0;
89 }
90
91 static AVSValue __cdecl Create(AVSValue args, void*, IScriptEnvironment* env);
92 static AVSValue __cdecl CreateFloat(AVSValue args, void*, IScriptEnvironment* env);
93 static AVSValue __cdecl CreatePreset(AVSValue args, void*, IScriptEnvironment* env);
94 static AVSValue __cdecl CreateFromClip(AVSValue args, void*, IScriptEnvironment* env);
95
96 private:
97 int64_t a, b;
98 bool linear;
99 int lastframe;
100 };
101
102
103
104 class ConvertFPS : public GenericVideoFilter
105 /**
106 * Class to change the framerate, attempting to smooth the transitions
107 **/
108 {
109 public:
110 ConvertFPS( PClip _child, unsigned new_numerator, unsigned new_denominator, int _zone,
111 int _vbi, IScriptEnvironment* env );
112 PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) override;
113 bool __stdcall GetParity(int n) override;
114
115 int __stdcall SetCacheHints(int cachehints, int frame_range) override {
116 AVS_UNUSED(frame_range);
117 return cachehints == CACHE_GET_MTMODE ? MT_NICE_FILTER : 0;
118 }
119
120 static AVSValue __cdecl Create(AVSValue args, void*, IScriptEnvironment* env);
121 static AVSValue __cdecl CreateFloat(AVSValue args, void*, IScriptEnvironment* env);
122 static AVSValue __cdecl CreatePreset(AVSValue args, void*, IScriptEnvironment* env);
123 static AVSValue __cdecl CreateFromClip(AVSValue args, void*, IScriptEnvironment* env);
124
125 private:
126 int64_t fa, fb;
127 int zone;
128 //Variables used in switch mode only
129 int vbi; //Vertical Blanking Interval (lines)
130 int lps; //Lines per source frame
131 };
132
133
134 #endif // __FPS_H_
135