We truncated the diff of some files because they were too big.
If you want to see the full diff for every file, click here.
Changes of Revision 6
avidemux3.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Fri Mar 14 2014 - joerg.lorenzen@ki.tng.de
4
+- Update to version 2.6.8
5
+ * Image/export: Proper initialization of Qz for jpeg export
6
+ * UI : Add an override menu to force language
7
+ * tinypy : Add support for os.environ
8
+ * x264 : Improved settings (tobias)
9
+ * Win32 : Fix crash when having an audio problem
10
+ * Win32 : Re-add mp4v2 to installer files
11
+ * Audio/FAAC : Fix channel mapping when source is mono
12
+ * Audio/AMR : Re-enabled AMR
13
+ * Audio/lavc : Fixed encoding for codec not supporting planar (MP2)
14
+ * Audio : Fixed importing MP2 audio detected as MP3
15
+ * Editor : Fix deleting chunks of the video leading to seek errors
16
+ * Editor : Initial copy/paste support
17
+ * Editor/audio: Fix issue when source has more than 4 tracks
18
+ * Editor : Better detection of double fps input files
19
+ * TS/Demux : Brute force eac3 probe
20
+ * TS/Demux : Better initialization, avoid dropping audio
21
+ * MP4/Demux : Fix management of PCM audio
22
+ * Mkv/Demux : Proper re-indexing for mpeg2 in mkv
23
+ * Mp4v2/Mux : Add fast start mode back
24
+ * OpenSolaris : Some fixes by pfelecan
25
+ * Subtitles : Update libass + very simple srt2ssa converter
26
+ * OsX : Enables more optional codecs...
27
+ * avsfilte : Performance Improvements (fahr)
28
+
29
+-------------------------------------------------------------------
30
Wed Mar 12 2014 - joerg.lorenzen@ki.tng.de
31
- update internal ffmpeg to version 1.2.6
32
33
avidemux3.spec
Changed
73
1
2
3
Name: avidemux3
4
Summary: Graphical video editing and transcoding tool
5
-Version: 2.6.7
6
+Version: 2.6.8
7
Release: 1
8
Url: http://www.avidemux.org
9
Source0: avidemux_%{version}.tar.gz
10
11
BuildRequires: pkgconfig(gl)
12
BuildRequires: pkgconfig(glu)
13
BuildRequires: libvdpau-devel
14
+## newer version of libav are not compatible to avidemux
15
+%if 0%{?suse_version} < 1310
16
+BuildRequires: libva-devel
17
+%endif
18
19
# Audio Codecs
20
BuildRequires: liba52-devel
21
22
BuildRequires: gtk3-devel
23
BuildRequires: cairo-devel
24
25
-%if 0%{?suse_version} >= 1230
26
-BuildRequires: libjpeg8-devel
27
-%endif
28
-
29
# Main package requires at least one frontend (cli, gtk or qt4)
30
Requires: avidemux3-frontend = %{version}-%{release}
31
BuildRoot: %{_tmppath}/%{name}-%{version}-build
32
33
%{_libdir}/libADM_coreImage6.so
34
%{_libdir}/libADM_coreImageLoader6.so
35
%{_libdir}/libADM_coreJobs.so
36
+%if 0%{?suse_version} < 1310
37
+%{_libdir}/libADM_coreLibVA6.so
38
+%endif
39
%{_libdir}/libADM_coreMuxer6.so
40
%{_libdir}/libADM_coreScript.so
41
%{_libdir}/libADM_coreSocket6.so
42
%{_libdir}/libADM_coreSqlLight3.so
43
+%{_libdir}/libADM_coreSubtitle.so
44
%{_libdir}/libADM_coreUI6.so
45
%{_libdir}/libADM_coreUtils6.so
46
%{_libdir}/libADM_coreVDPAU6.so
47
48
%dir %{_libdir}/ADM_plugins6/muxers
49
%dir %{_libdir}/ADM_plugins6/pluginSettings
50
%dir %{_libdir}/ADM_plugins6/pluginSettings/x264
51
-%dir %{_libdir}/ADM_plugins6/pluginSettings/x264/2
52
+%dir %{_libdir}/ADM_plugins6/pluginSettings/x264/3
53
%dir %{_libdir}/ADM_plugins6/scriptEngines
54
%dir %{_libdir}/ADM_plugins6/videoDecoders
55
%dir %{_libdir}/ADM_plugins6/videoEncoders
56
57
%{_libdir}/ADM_plugins6/muxers/libADM_mx_mp4.so
58
%{_libdir}/ADM_plugins6/muxers/libADM_mx_mp4v2.so
59
%{_libdir}/ADM_plugins6/muxers/libADM_mx_raw.so
60
-%{_libdir}/ADM_plugins6/pluginSettings/x264/2/ultraFast.json
61
-%{_libdir}/ADM_plugins6/pluginSettings/x264/2/PSP.json
62
-%{_libdir}/ADM_plugins6/pluginSettings/x264/2/veryFast.json
63
-%{_libdir}/ADM_plugins6/pluginSettings/x264/2/fast.json
64
-%{_libdir}/ADM_plugins6/pluginSettings/x264/2/iPhone.json
65
+%{_libdir}/ADM_plugins6/pluginSettings/x264/3/ultraFast.json
66
+%{_libdir}/ADM_plugins6/pluginSettings/x264/3/PSP.json
67
+%{_libdir}/ADM_plugins6/pluginSettings/x264/3/veryFast.json
68
+%{_libdir}/ADM_plugins6/pluginSettings/x264/3/fast.json
69
+%{_libdir}/ADM_plugins6/pluginSettings/x264/3/iPhone.json
70
%{_libdir}/ADM_plugins6/scriptEngines/libADM_script_qt.so
71
%{_libdir}/ADM_plugins6/scriptEngines/libADM_script_spiderMonkey.so
72
%{_libdir}/ADM_plugins6/scriptEngines/libADM_script_tinyPy.so
73
avidemux-package_version.patch
Changed
94
1
2
---- avidemux/qt4/ADM_userInterfaces/ui_support.cpp.orig 2013-10-20 14:25:45.356977519 +0200
3
-+++ avidemux/qt4/ADM_userInterfaces/ui_support.cpp 2013-10-20 14:25:45.362977397 +0200
4
-@@ -84,7 +84,7 @@
5
+--- avidemux/qt4/ADM_userInterfaces/ui_support.cpp.orig 2014-03-14 13:16:11.948145100 +0100
6
++++ avidemux/qt4/ADM_userInterfaces/ui_support.cpp 2014-03-14 13:34:19.661718900 +0100
7
+@@ -95,12 +95,12 @@
8
+ }
9
+ ADM_info("Initializing language %s\n",lang);
10
+ #ifdef __APPLE__
11
+- QString appdir = QCoreApplication::applicationDirPath() + "/../share/avidemux6/i18n/";
12
++ QString appdir = QCoreApplication::applicationDirPath() + "/../share/avidemux3/i18n/";
13
+
14
#elif defined(_WIN32)
15
QString appdir = QCoreApplication::applicationDirPath() + "/i18n/";
16
#else
17
- QString appdir = ADM_getInstallRelativePath("share","avidemux6","i18n");
18
+ QString appdir = ADM_getInstallRelativePath("share","avidemux3","i18n");
19
#endif
20
+ QString languageFile=QString(lang);
21
int nbLoaded=0;
22
- nbLoaded+=loadTranslation(&qtTranslator, appdir + "qt_" + QLocale::system().name());
23
---- avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2_menu.cpp.orig 2013-10-20 14:25:45.375977133 +0200
24
-+++ avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2_menu.cpp 2013-10-20 14:25:45.368977275 +0200
25
+--- avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2_menu.cpp.orig 2014-03-14 13:19:05.743017000 +0100
26
++++ avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2_menu.cpp 2014-03-14 13:34:21.849218900 +0100
27
@@ -143,7 +143,7 @@
28
QString referenceFile = QCoreApplication::applicationDirPath() + "/help/" + ((FileAction*)sender())->filePath();
29
#else
30
31
#endif
32
33
QDesktopServices::openUrl(QUrl("file:///" + referenceFile, QUrl::TolerantMode));
34
---- avidemux_core/ADM_core/src/ADM_fileio.cpp.orig 2013-10-20 14:25:45.919966078 +0200
35
-+++ avidemux_core/ADM_core/src/ADM_fileio.cpp 2013-10-20 14:25:45.898966505 +0200
36
-@@ -465,7 +465,7 @@
37
+--- avidemux_core/ADM_core/src/ADM_fileio.cpp.orig 2014-03-14 13:21:28.788976500 +0100
38
++++ avidemux_core/ADM_core/src/ADM_fileio.cpp 2014-03-14 13:34:24.302343900 +0100
39
+@@ -463,9 +463,9 @@
40
+ else
41
+ ADM_DIR_NAME = "avidemux";
42
#elif defined __HAIKU__
43
- const char *ADM_DIR_NAME = "config/settings/avidemux6";
44
+- const char *ADM_DIR_NAME = "config/settings/avidemux6";
45
++ const char *ADM_DIR_NAME = "config/settings/avidemux3";
46
#else
47
- const char *ADM_DIR_NAME = ".avidemux6";
48
+ const char *ADM_DIR_NAME = ".avidemux3";
49
#endif
50
51
strcat(ADM_basedir, ADM_DIR_NAME);
52
---- avidemux_plugins/ADM_scriptEngines/tinyPy/src/PythonEngine.cpp.orig 2013-10-20 14:25:47.138941310 +0200
53
-+++ avidemux_plugins/ADM_scriptEngines/tinyPy/src/PythonEngine.cpp 2013-10-20 14:25:47.200940050 +0200
54
-@@ -217,7 +217,7 @@
55
+--- avidemux_plugins/ADM_scriptEngines/tinyPy/src/PythonEngine.cpp.orig 2014-03-14 13:23:56.381781900 +0100
56
++++ avidemux_plugins/ADM_scriptEngines/tinyPy/src/PythonEngine.cpp 2014-03-14 13:34:26.489843900 +0100
57
+@@ -260,7 +260,7 @@
58
this->callEventHandlers(IScriptEngine::Information, NULL, -1,
59
(string("Executing ") + string(name) + string("...")).c_str());
60
61
62
63
this->callEventHandlers(IScriptEngine::Information, NULL, -1, "Done");
64
65
---- cmake/se_plugin.cmake.orig 2013-10-20 14:25:48.673910127 +0200
66
-+++ cmake/se_plugin.cmake 2013-10-20 14:25:48.715909274 +0200
67
+--- cmake/se_plugin.cmake.orig 2014-03-14 13:26:16.005888300 +0100
68
++++ cmake/se_plugin.cmake 2014-03-14 13:34:28.724218900 +0100
69
@@ -12,7 +12,7 @@
70
if (WIN32)
71
set(helpDir "${CMAKE_INSTALL_PREFIX}/help/${_engineName}")
72
73
endif (WIN32)
74
75
install(DIRECTORY "${_sourceDirectory}" DESTINATION "${helpDir}")
76
---- cmake/Ts.cmake.orig 2013-10-20 14:25:48.695909680 +0200
77
-+++ cmake/Ts.cmake 2013-10-20 14:25:48.660910391 +0200
78
+--- cmake/Ts.cmake.orig 2014-03-14 13:30:09.942968900 +0100
79
++++ cmake/Ts.cmake 2014-03-14 13:34:30.583593900 +0100
80
@@ -41,7 +41,7 @@
81
IF(WIN32)
82
SET(i18dir "${CMAKE_INSTALL_PREFIX}/${BIN_DIR}/i18n")
83
84
ENDIF(WIN32)
85
INSTALL(FILES ${_files} DESTINATION "${i18dir}")
86
ENDMACRO(INSTALL_I18N _files)
87
---- cmake/sql/update.sh.orig 2013-10-20 14:25:48.671910167 +0200
88
-+++ cmake/sql/update.sh 2013-10-20 14:25:48.672910147 +0200
89
+--- cmake/sql/update.sh.orig 2014-03-14 13:31:34.614843900 +0100
90
++++ cmake/sql/update.sh 2014-03-14 13:34:32.864843900 +0100
91
@@ -1,3 +1,3 @@
92
-sqlite3 ~/.avidemux6/jobs.sql .d > dump
93
+sqlite3 ~/.avidemux3/jobs.sql .d > dump
94
avidemux_2.6.7.tar.gz/addons/avsfilter/avsload.cpp -> avidemux_2.6.8.tar.gz/addons/avsfilter/avsload.cpp
Changed
201
1
2
#define BUF_SIZE (1920L * 1080L * 3L >> 1L)
3
//#define BUF_SIZE 65536
4
5
+bool fget_pitch_data = false;
6
+
7
void test_pipe_speed(int h_read, int h_write,
8
char *copy_buf, int buf_sz, int time_sec)
9
{
10
11
*avsdll = LoadLibrary("avisynth.dll");
12
if(!*avsdll)
13
{
14
- DEBUG_PRINTF("avsloader : failed to load avisynth.dll\n");
15
+ DEBUG_PRINTF_RED("avsloader : failed to load avisynth.dll\n");
16
fflush(stdout);
17
return false;
18
}
19
20
= (IScriptEnvironment*(*)(int)) GetProcAddress(*avsdll, "CreateScriptEnvironment");
21
if(!CreateScriptEnvironment)
22
{
23
- DEBUG_PRINTF("avsloader : failed to load CreateScriptEnvironment()\n");
24
+ DEBUG_PRINTF_RED("avsloader : failed to load CreateScriptEnvironment()\n");
25
fflush(stdout);
26
27
free_lib:
28
29
}
30
catch(AvisynthError err)
31
{
32
- DEBUG_PRINTF("avsloader : avisynth error %s\n", err.msg);
33
+ DEBUG_PRINTF_RED("avsloader : avisynth error %s\n", err.msg);
34
return false;
35
}
36
return true;
37
38
39
if(!res.IsClip())
40
{
41
- DEBUG_PRINTF("avsloader : '%s' didn't return a video clip.\n", infile);
42
+ DEBUG_PRINTF_RED("avsloader : '%s' didn't return a video clip.\n", infile);
43
fflush(stdout);
44
return false;
45
}
46
47
}
48
catch(AvisynthError err)
49
{
50
- DEBUG_PRINTF("avsloader : avisynth error %s\n", err.msg);
51
+ DEBUG_PRINTF_RED("avsloader : avisynth error %s\n", err.msg);
52
return false;
53
}
54
return true;
55
56
57
if(!pipe_dll)
58
{
59
- DEBUG_PRINTF("failed to load %s\n", dllname);
60
+ DEBUG_PRINTF_RED("failed to load %s\n", dllname);
61
fflush(stdout);
62
return false;
63
}
64
65
"SetPipeName");
66
if(!set_pipe_name)
67
{
68
- DEBUG_PRINTF("failed to get SetPipeName\n");
69
+ DEBUG_PRINTF_RED("failed to get SetPipeName\n");
70
fflush(stdout);
71
72
free_lib:
73
74
#define PIPE_LOADER_WRITE 0
75
#define PIPE_FILTER_READ 2
76
77
-/*
78
- void BitBlt(BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height) {
79
- if ( (!height)|| (!row_size)) return;
80
- if (GetCPUFlags() & CPUF_INTEGER_SSE) {
81
- if (height == 1 || (src_pitch == dst_pitch && dst_pitch == row_size)) {
82
- memcpy_amd(dstp, srcp, row_size*height);
83
- } else {
84
- asm_BitBlt_ISSE(dstp,dst_pitch,srcp,src_pitch,row_size,height);
85
- }
86
- return;
87
- }
88
- if (height == 1 || (dst_pitch == src_pitch && src_pitch == row_size)) {
89
- memcpy(dstp, srcp, row_size*height);
90
- } else {
91
- for (int y=height; y>0; --y) {
92
- memcpy(dstp, srcp, row_size);
93
- dstp += dst_pitch;
94
- srcp += src_pitch;
95
- }
96
- }
97
-
98
- */
99
-
100
bool send_bit_blt(int h,
101
const BYTE* srcp, int src_pitch,
102
int row_size, int height, BYTE *data)
103
104
105
if (!load_avisynth(&env, &avsdll))
106
{
107
- DEBUG_PRINTF("avsloader : cannot load avisynth dll\n");
108
+ DEBUG_PRINTF_RED("avsloader : cannot load avisynth dll\n");
109
fflush(stdout);
110
return;
111
}
112
113
114
switch(msg.avs_cmd)
115
{
116
- case LOAD_AVS_SCRIPT:
117
+ case GET_PITCH_DATA:
118
+ fget_pitch_data = true;
119
+ break;
120
+
121
+ case LOAD_AVS_SCRIPT:
122
123
DEBUG_PRINTF("avsloader : try load avisynth.dll and script %s\n",
124
data);
125
126
info.nb_frames = inf.num_frames;
127
info.fps1000 = inf.fps_numerator * 1000 / inf.fps_denominator;
128
info.orgFrame = 0;
129
+ info.encoding = MAGIC_ADV_PROTOCOL_VAL; // set advanced protocol from avsfilter to avsloader
130
131
if (!send_cmd(avs_pipes[PIPE_LOADER_WRITE].hpipe,
132
SET_CLIP_PARAMETER,
133
(void*)&info, sizeof(ADV_Info)))
134
{
135
- DEBUG_PRINTF("avsloader : cannot send avisynth clip param to avsfilter\n");
136
+ DEBUG_PRINTF_RED("avsloader : cannot send avisynth clip param to avsfilter\n");
137
fflush(stdout);
138
return;
139
}
140
141
DEBUG_PRINTF("avsloader : UNLOAD_AVS_LOADER ok\n");
142
terminate = true;
143
break;
144
-
145
+ case GET_FRAME_WITH_PITCH:
146
case GET_FRAME:
147
// avidemux2 avsfilter tell : get frame
148
fd = (FRAME_DATA *)data;
149
150
fflush(stdout);
151
152
fd_copy = *fd;
153
- /*
154
- void BitBlt(BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height) {
155
- if ( (!height)|| (!row_size)) return;
156
- if (GetCPUFlags() & CPUF_INTEGER_SSE) {
157
- if (height == 1 || (src_pitch == dst_pitch && dst_pitch == row_size)) {
158
- memcpy_amd(dstp, srcp, row_size*height);
159
- } else {
160
- asm_BitBlt_ISSE(dstp,dst_pitch,srcp,src_pitch,row_size,height);
161
- }
162
- return;
163
- }
164
- if (height == 1 || (dst_pitch == src_pitch && src_pitch == row_size)) {
165
- memcpy(dstp, srcp, row_size*height);
166
- } else {
167
- for (int y=height; y>0; --y) {
168
- memcpy(dstp, srcp, row_size);
169
- dstp += dst_pitch;
170
- srcp += src_pitch;
171
- }
172
- }
173
- */
174
-#ifdef PREVENT_INTERMEDIATE_BUFFERS
175
- if (!send_cmd_with_specified_size(avs_pipes[PIPE_LOADER_WRITE].hpipe,
176
- PUT_FRAME,
177
- (void*)&fd_copy, sizeof(FRAME_DATA),
178
- frame_sz))
179
+
180
+ if (msg.avs_cmd == GET_FRAME_WITH_PITCH)
181
{
182
- DEBUG_PRINTF("avsloader : error send frame header to avsfilter\n");
183
+ uint32_t pitch_data_sizeY = f->GetPitch(PLANAR_Y) * f->GetHeight(PLANAR_Y);
184
+ uint32_t pitch_data_sizeU = f->GetPitch(PLANAR_U) * f->GetHeight(PLANAR_U);
185
+ uint32_t pitch_data_sizeV = f->GetPitch(PLANAR_V) * f->GetHeight(PLANAR_V);
186
+ uint32_t pitch_data_size = pitch_data_sizeY + pitch_data_sizeU + pitch_data_sizeV;
187
+ DEBUG_PRINTF("avsloader : pitch frame size %lu\n", pitch_data_size);
188
+
189
+ if (!send_cmd_with_specified_size(avs_pipes[PIPE_LOADER_WRITE].hpipe,
190
+ PUT_FRAME_WITH_PITCH,
191
+ (void*)&fd_copy, sizeof(FRAME_DATA), pitch_data_size) ||
192
+ ppwrite(avs_pipes[PIPE_LOADER_WRITE].hpipe, (void*)f->GetReadPtr(PLANAR_Y), pitch_data_sizeY) != pitch_data_sizeY ||
193
+ ppwrite(avs_pipes[PIPE_LOADER_WRITE].hpipe, (void*)f->GetReadPtr(PLANAR_U), pitch_data_sizeU) != pitch_data_sizeU ||
194
+ ppwrite(avs_pipes[PIPE_LOADER_WRITE].hpipe, (void*)f->GetReadPtr(PLANAR_V), pitch_data_sizeV) != pitch_data_sizeV)
195
+ {
196
+ DEBUG_PRINTF_RED("avsloader : error send uncompressed PITCH frame to avsfilter\n");
197
fflush(stdout);
198
+ return;
199
+ }
200
}
201
avidemux_2.6.7.tar.gz/addons/avsfilter/avsload_pipe_binary.tar.bz2 -> avidemux_2.6.8.tar.gz/addons/avsfilter/avsload_pipe_binary.tar.bz2
Changed
avidemux_2.6.7.tar.gz/addons/avsfilter/avspipecomm.h -> avidemux_2.6.8.tar.gz/addons/avsfilter/avspipecomm.h
Changed
40
1
2
GET_FRAME,
3
PUT_FRAME, //4
4
UNLOAD_AVS_SCRIPT,
5
- UNLOAD_AVS_LOADER
6
+ UNLOAD_AVS_LOADER,
7
+ SEND_PITCH_DATA_PIPE_SOURCE,
8
+ SEND_PITCH_DATA_AVSLOADER,
9
+ GET_PITCH_DATA,
10
+ GET_FRAME_WITH_PITCH,
11
+ PUT_FRAME_WITH_PITCH
12
} AVS_CMD;
13
14
typedef struct
15
16
PUT_FRAME - frame and frame_data[] set to corresponding value
17
*/
18
typedef struct
19
-
20
{
21
uint32_t frame;
22
unsigned char frame_data[0];
23
} FRAME_DATA;
24
25
+typedef struct
26
+{
27
+ uint32_t pitchY;
28
+ uint32_t pitchU;
29
+ uint32_t pitchV;
30
+}PITCH_DATA;
31
+
32
bool send_cmd(int hw, AVS_CMD cmd,
33
void *data, int sz);
34
35
36
int ppwrite(int h, void *data, int sz);
37
38
#define PIPE_MAX_TRANSFER_SZ 65536/2
39
+#define MAGIC_ADV_PROTOCOL_VAL 0xADBACEED
40
avidemux_2.6.7.tar.gz/addons/avsfilter/cdebug.cpp -> avidemux_2.6.8.tar.gz/addons/avsfilter/cdebug.cpp
Changed
50
1
2
#include <stdarg.h>
3
#include <time.h>
4
FILE *dbglog = stdout;
5
+
6
+#define RED_TEXT "\033[31m"
7
+#define END_TEXT "\033[0m"
8
+
9
extern "C" void setdbglog (const char *fname)
10
{
11
FILE *out;
12
13
dbglog = out;
14
}
15
16
-extern "C" void dbgprintf (const char *format, ...)
17
+extern "C" void dbgprintf_p (const char *format, va_list args)
18
{
19
time_t t = time(NULL);
20
struct tm *tmp = localtime(&t);
21
- va_list args;
22
- va_start (args, format);
23
if (strcmp(format,"\n"))
24
- fprintf (dbglog,"%02d:%02d:%02d ", tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
25
- vfprintf (dbglog, format, args);
26
+ fprintf (dbglog,"%02d:%02d:%02d ", tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
27
+ if (dbglog == stdout) vprintf (format, args);
28
+ else vfprintf (dbglog, format, args);
29
fflush(dbglog);
30
+}
31
+
32
+extern "C" void dbgprintf (const char *format, ...)
33
+{
34
+ va_list args;
35
+ va_start (args, format);
36
+ dbgprintf_p (format, args);
37
+ va_end (args);
38
+}
39
+
40
+extern "C" void dbgprintf_RED (const char *format, ...)
41
+{
42
+ va_list args;
43
+ va_start (args, format);
44
+ if (dbglog == stdout) {printf(RED_TEXT); fflush(dbglog);}
45
+ dbgprintf_p (format, args);
46
+ if (dbglog == stdout) { printf(END_TEXT); fflush(dbglog);}
47
va_end (args);
48
}
49
#endif
50
avidemux_2.6.7.tar.gz/addons/avsfilter/cdebug.h -> avidemux_2.6.8.tar.gz/addons/avsfilter/cdebug.h
Changed
14
1
2
#define __CDEBUG__
3
#ifdef DEBUGMSG
4
extern "C" void dbgprintf (const char *format, ...);
5
+extern "C" void dbgprintf_RED (const char *format, ...);
6
extern "C" void setdbglog (const char *fname);
7
#define DEBUG_PRINTF dbgprintf
8
+#define DEBUG_PRINTF_RED dbgprintf_RED
9
#else
10
+#define DEBUG_PRINTF_RED
11
#define DEBUG_PRINTF
12
#endif
13
14
avidemux_2.6.7.tar.gz/addons/avsfilter/pipe_source.cpp -> avidemux_2.6.8.tar.gz/addons/avsfilter/pipe_source.cpp
Changed
196
1
2
#include "cdebug.h"
3
4
bool pipe_test(int hr, int hw);
5
+//bool use_adv_protocol = false;
6
+static int refCounter = 0;
7
+
8
int h_read = -1, h_write = -1;
9
-uint32_t frame_sz = 0;
10
+uint32_t frame_sz = 0, frame_sz_pitch = 0;
11
unsigned char *frame_data = NULL;
12
13
#define WAIT_BEFORE_TRY 500
14
15
}
16
if (sz1 != sizeof(uint32_t))
17
{
18
- DEBUG_PRINTF("pipe_source : cannot read test data - read %d\n", sz1);
19
+ DEBUG_PRINTF_RED("pipe_source : cannot read test data - read %d\n", sz1);
20
fflush(stdout);
21
close (h_read);
22
return false;
23
}
24
+
25
if (cb_send_data(hw, (unsigned char*)&test_r1, sz1))
26
{
27
h_write = hw;
28
29
}
30
else
31
{
32
- DEBUG_PRINTF("pipe_source : cannot write test data\n");
33
+ DEBUG_PRINTF_RED("pipe_source : cannot write test data\n");
34
close (h_read);
35
}
36
}
37
38
PIPE_MSG_HEADER msg;
39
ADV_Info ai;
40
41
+ refCounter++;
42
+
43
vi.width = 720;
44
vi.height = 576;
45
vi.fps_numerator = 25;
46
47
vi.num_frames = ai.nb_frames + ai.orgFrame;
48
vi.fps_numerator = ai.fps1000;
49
vi.fps_denominator = 1000;
50
+ if (ai.encoding == MAGIC_ADV_PROTOCOL_VAL)
51
+ {
52
+ PVideoFrame dst;
53
+ PIPE_MSG_HEADER msg = {SEND_PITCH_DATA_PIPE_SOURCE, sizeof(PITCH_DATA)};
54
+ dst = env->NewVideoFrame(vi);
55
+
56
+ PITCH_DATA pd = {dst->GetPitch(PLANAR_Y), dst->GetPitch(PLANAR_U), dst->GetPitch(PLANAR_V)};
57
+ // send SEND_PITCH_DATA to avidemux2/avsfilter
58
+ if (!pcb_send_data(h_write, (unsigned char*)&msg, sizeof(msg)) ||
59
+ !pcb_send_data(h_write, (unsigned char*)&pd, sizeof(pd)))
60
+ DEBUG_PRINTF_RED("pipe_source : error send SEND_PITCH_DATA_PIPE_SOURCE to avsfilter\n");
61
+ else
62
+ DEBUG_PRINTF("pipe_source : send SEND_PITCH_DATA_PIPE_SOURCE ok\n");
63
+
64
+ fflush(stdout);
65
+
66
+ //use_adv_protocol = true;
67
+ frame_sz_pitch = dst->GetPitch(PLANAR_Y) * dst->GetHeight(PLANAR_Y) + dst->GetPitch(PLANAR_U) * dst->GetHeight(PLANAR_U) + dst->GetPitch(PLANAR_V) * dst->GetHeight(PLANAR_V);
68
+ DEBUG_PRINTF("pipe_source : use advanced protocol (%d)\n", frame_sz_pitch);
69
+ delete dst;
70
+ }
71
frame_sz = (vi.width * vi.height * 3) >> 1;
72
- frame_data = (unsigned char*)malloc(frame_sz);
73
+ frame_data = (unsigned char*)malloc(frame_sz_pitch > frame_sz ? frame_sz_pitch : frame_sz);
74
}
75
else
76
- DEBUG_PRINTF("pipe_source : error receive_data with info\n");
77
+ DEBUG_PRINTF_RED("pipe_source : error receive_data with info\n");
78
else
79
- DEBUG_PRINTF("pipe_source : receive_data return wrong header\n");
80
+ DEBUG_PRINTF_RED("pipe_source : receive_data return wrong header\n");
81
else
82
- DEBUG_PRINTF("pipe_source : error receive_data with header\n");
83
+ DEBUG_PRINTF_RED("pipe_source : error receive_data with header\n");
84
}
85
86
87
PipeSource::~PipeSource() {
88
DEBUG_PRINTF("Delete PipeSource\n");
89
fflush(stdout);
90
+ refCounter--;
91
+ if (!refCounter && frame_data) free(frame_data);
92
}
93
94
PVideoFrame __stdcall PipeSource::GetFrame(int n, IScriptEnvironment* env) {
95
96
- PVideoFrame dst;
97
- dst = env->NewVideoFrame(vi);
98
+ PVideoFrame dst;
99
+ dst = env->NewVideoFrame(vi);
100
101
PIPE_MSG_HEADER msg = {GET_FRAME, sizeof(FRAME_DATA)};
102
FRAME_DATA fd = {n};
103
104
DEBUG_PRINTF("pipe_source : invoke GetFrame %d [num_frames %d]\n", n, vi.num_frames);
105
- DEBUG_PRINTF("pipe_source : frame pitch %d\n", dst->GetPitch());
106
+ DEBUG_PRINTF("pipe_source : frame pitch YUV %d %d %d\n", dst->GetPitch(PLANAR_Y), dst->GetPitch(PLANAR_U), dst->GetPitch(PLANAR_V));
107
fflush(stdout);
108
109
// send GET_FRAME to avidemux2/avsfilter
110
if (!pcb_send_data(h_write, (unsigned char*)&msg, sizeof(msg)) ||
111
!pcb_send_data(h_write, (unsigned char*)&fd, sizeof(fd)))
112
{
113
- DEBUG_PRINTF("pipe_source : error send GET_FRAME to avsfilter\n", n);
114
+ DEBUG_PRINTF_RED("pipe_source : error send GET_FRAME to avsfilter\n", n);
115
fflush(stdout);
116
return dst;
117
}
118
119
DEBUG_PRINTF("pipe_source : send GET_FRAME ok\n");
120
fflush(stdout);
121
-
122
+
123
+#define CUR_FRAME_SIZE (msg.avs_cmd == PUT_FRAME ? frame_sz : frame_sz_pitch)
124
+
125
int test_sz = 0;
126
// receive frame from avsfilter
127
if (!receive_cmd(h_read, &msg) ||
128
- msg.avs_cmd != PUT_FRAME ||
129
+ (msg.avs_cmd != PUT_FRAME && msg.avs_cmd != PUT_FRAME_WITH_PITCH) ||
130
ppread(h_read, &fd, sizeof(fd)) != sizeof(fd) ||
131
- fd.frame != n || (frame_sz + sizeof(fd)) != msg.sz ||
132
- (test_sz = ppread(h_read, frame_data, frame_sz)) != frame_sz)
133
+ fd.frame != n || (CUR_FRAME_SIZE + sizeof(fd)) != msg.sz)
134
+ {
135
+ DEBUG_PRINTF_RED("pipe_source : error get frame, par [code %d sz %d frame %d] chk par [frame_sz %d read_sz %d]\n",
136
+ msg.avs_cmd, msg.sz, fd.frame, frame_sz, test_sz);
137
+ fflush(stdout);
138
+ return dst;
139
+ }
140
+
141
+ if (msg.avs_cmd == PUT_FRAME)
142
{
143
- DEBUG_PRINTF("pipe_source : error get frame, par [code %d sz %d frame %d] chk par [frame_sz %d read_sz %d]\n",
144
- msg.avs_cmd, msg.sz, fd.frame, frame_sz, test_sz);
145
+ if ((test_sz = ppread(h_read, frame_data, CUR_FRAME_SIZE)) != CUR_FRAME_SIZE)
146
+ {
147
+ DEBUG_PRINTF_RED("pipe_source : error get frame data, par [frame %d] chk par [frame_sz %d read_sz %d]\n",
148
+ fd.frame, frame_sz, test_sz);
149
fflush(stdout);
150
return dst;
151
+ }
152
+
153
+ // copy Y, U and V with pitch
154
+ env->BitBlt(dst->GetWritePtr(), dst->GetPitch(), frame_data, vi.width, vi.width, vi.height);
155
+ env->BitBlt(dst->GetWritePtr(PLANAR_V), dst->GetPitch(PLANAR_V),
156
+ frame_data + (vi.width * vi.height), vi.width / 2, vi.width / 2, vi.height / 2);
157
+ env->BitBlt(dst->GetWritePtr(PLANAR_U), dst->GetPitch(PLANAR_U),
158
+ frame_data + (vi.width * vi.height) + ((vi.width * vi.height) >> 2),
159
+ vi.width / 2, vi.width / 2, vi.height / 2);
160
}
161
+ else
162
+ {
163
+ uint32_t pitch_data_sizeY = dst->GetPitch(PLANAR_Y) * dst->GetHeight(PLANAR_Y);
164
+ uint32_t pitch_data_sizeU = dst->GetPitch(PLANAR_U) * dst->GetHeight(PLANAR_U);
165
+ uint32_t pitch_data_sizeV = dst->GetPitch(PLANAR_V) * dst->GetHeight(PLANAR_V);
166
+ uint32_t pitch_data_size = pitch_data_sizeY + pitch_data_sizeU + pitch_data_sizeV;
167
168
- // copy Y, U and V with pitch
169
- env->BitBlt(dst->GetWritePtr(), dst->GetPitch(), frame_data, vi.width, vi.width, vi.height);
170
- env->BitBlt(dst->GetWritePtr(PLANAR_V), dst->GetPitch(PLANAR_V),
171
- frame_data + (vi.width * vi.height), vi.width / 2, vi.width / 2, vi.height / 2);
172
- env->BitBlt(dst->GetWritePtr(PLANAR_U), dst->GetPitch(PLANAR_U),
173
- frame_data + (vi.width * vi.height) + ((vi.width * vi.height) >> 2),
174
- vi.width / 2, vi.width / 2, vi.height / 2);
175
+/* DEBUG_PRINTF("pipe_source : PUT_FRAME_WITH_PITCH (%d) Pitch:Height %d:%d\n", CUR_FRAME_SIZE, dst->GetPitch(PLANAR_Y), dst->GetHeight(PLANAR_Y));*/
176
+ if (msg.sz != (pitch_data_size + sizeof(FRAME_DATA)))
177
+ {
178
+ DEBUG_PRINTF_RED("pipe_source : error size of PITCH frame data %d != %d + %d [msg.sz != (pitch_data_size + sizeof(FRAME_DATA))] \n",
179
+ msg.sz, pitch_data_size, sizeof(FRAME_DATA));
180
+ fflush(stdout);
181
+ return dst;
182
+ }
183
+
184
+ if (ppread(h_read, dst->GetWritePtr(PLANAR_Y), pitch_data_sizeY) != pitch_data_sizeY ||
185
+ ppread(h_read, dst->GetWritePtr(PLANAR_U), pitch_data_sizeU) != pitch_data_sizeU ||
186
+ ppread(h_read, dst->GetWritePtr(PLANAR_V), pitch_data_sizeV) != pitch_data_sizeV)
187
+ {
188
+ DEBUG_PRINTF_RED("pipe_source : error get PITCH frame data %d %d %d\n", pitch_data_sizeY, pitch_data_sizeU, pitch_data_sizeV);
189
+ fflush(stdout);
190
+ return dst;
191
+ }
192
+ }
193
194
DEBUG_PRINTF("pipe_source : return frame %d data ok\n", fd.frame);
195
fflush(stdout);
196
avidemux_2.6.8.tar.gz/autononreg/py/environ
Added
2
1
+(directory)
2
avidemux_2.6.8.tar.gz/autononreg/py/environ/env.py
Added
15
1
2
+# check get_folder_content function
3
+# return the list of files with extention ext
4
+# full path is returned !
5
+# i.e. in the example below you will get a list
6
+# /work/samples/avi/foo.avi
7
+# /work/samples/avi/bar.avi
8
+# ...
9
+#
10
+import os
11
+print("environ ")
12
+val=os.environ("foo")
13
+print("val:"+str(val))
14
+print("Done")
15
avidemux_2.6.8.tar.gz/autononreg/py/helpers/pySub1.py
Added
3
1
2
+testSub('/work/subs/fedor.srt')
3
avidemux_2.6.7.tar.gz/avidemux/common/ADM_audioFilter/src/audiocopy.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_audioFilter/src/audiocopy.cpp
Changed
10
1
2
{
3
uint64_t currentClock=clock->getTimeUs();
4
aprintf("Duping clockDts=%d, syncDts=%d\n",currentClock,nextDts);
5
- if( fabs((double)nextDts-(double)currentClock<MIN_SKEW) || (currentClock>nextDts) )
6
+ if( (fabs((double)nextDts-(double)currentClock)<MIN_SKEW) || (currentClock>nextDts) )
7
{
8
aprintf("Close enough..\n");
9
changeState(Flushing);
10
avidemux_2.6.7.tar.gz/avidemux/common/ADM_audioFilter/src/audiofilter_mixer.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_audioFilter/src/audiofilter_mixer.cpp
Changed
9
1
2
3
uint32_t rd = 0;
4
int nbSampleMax=max/_wavHeader.channels;
5
+ if(!nbSampleMax) nbSampleMax=1;
6
uint8_t input_channels = _previous->getInfo()->channels;
7
8
// Fill incoming buffer
9
avidemux_2.6.7.tar.gz/avidemux/common/ADM_audioFilter/src/audiofilter_normalize.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_audioFilter/src/audiofilter_normalize.cpp
Changed
10
1
2
3
#if defined (_WIN32) || defined (__HAIKU__)
4
#define POW10(x) pow(10,x)
5
-#elif defined(ADM_BSD_FAMILY)
6
+#elif defined(ADM_BSD_FAMILY) || defined(__sun__)
7
#define POW10(x) powf(10.0,x)
8
#else
9
#define POW10(x) pow10f(x)
10
avidemux_2.6.7.tar.gz/avidemux/common/ADM_commonUI/DIA_prefs.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_commonUI/DIA_prefs.cpp
Changed
57
1
2
framePP.swallow(&fvzd);
3
framePP.swallow(&fdring);
4
framePP.swallow(&postProcStrength);
5
-
6
+
7
+
8
+// -- select language
9
+ typedef struct { const char *lang;const char *desc;}languageDescriptor;
10
+ uint32_t languageIndex=0;
11
+ languageDescriptor myLanguages[]={
12
+ {"auto","System language"},
13
+ {"en","English"},
14
+ {"fr","Français"},
15
+ {"de","German"},
16
+ {"es","Spanish"},
17
+ {"it","Italian"},
18
+ {"ru","Pyckuu"},
19
+ {"pl","Polish"},
20
+ };
21
+ uint32_t nbLanguages=sizeof(myLanguages)/sizeof(languageDescriptor);
22
+ char *currentLanguage;
23
+ int currentIndex=0;
24
+ if(!prefs->get(DEFAULT_LANGUAGE,¤tLanguage)) currentLanguage="auto";
25
+
26
+ diaMenuEntryDynamic **languagesMenuItems=new diaMenuEntryDynamic *[nbLanguages+1];
27
+ for(int i=0;i<nbLanguages;i++)
28
+ {
29
+ languageDescriptor *lg=myLanguages+i;
30
+ if(!strcmp(lg->lang,currentLanguage))
31
+ currentIndex=i;
32
+ languagesMenuItems[i]=new diaMenuEntryDynamic(i,lg->desc,lg->lang);
33
+ }
34
+ languageIndex=currentIndex;
35
+ diaElemMenuDynamic menuLanguage(&languageIndex,QT_TRANSLATE_NOOP("adm","_Language"), nbLanguages,
36
+ languagesMenuItems,NULL);
37
+//--
38
+
39
+
40
41
/* User Interface */
42
- diaElem *diaUser[]={&useSysTray,&menuMessage};
43
- diaElemTabs tabUser(QT_TRANSLATE_NOOP("adm","User Interface"),2,diaUser);
44
+ diaElem *diaUser[]={&useSysTray,&menuMessage,&menuLanguage};
45
+ diaElemTabs tabUser(QT_TRANSLATE_NOOP("adm","User Interface"),3,diaUser);
46
47
/* Automation */
48
49
50
// Alternate mp3 tag (haali)
51
prefs->set(FEATURES_ALTERNATE_MP3_TAG,balternate_mp3_tag);
52
53
+ prefs->set(DEFAULT_LANGUAGE,myLanguages[languageIndex].lang);
54
55
// Avisynth
56
prefs->set(AVISYNTH_AVISYNTH_DEFAULTPORT,defaultPortAvisynth);
57
avidemux_2.6.7.tar.gz/avidemux/common/ADM_editor/include/ADM_edit.hxx -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_editor/include/ADM_edit.hxx
Changed
31
1
2
return _segments.undo();
3
}
4
uint8_t resetSeg( void );
5
+ bool copyToClipBoard(uint64_t startTime, uint64_t endTime);
6
+ bool pasteFromClipBoard(uint64_t currentTime);
7
bool addFile (const char *name);
8
int appendFile(const char *name);
9
void closeFile(void);
10
11
bool clearAudioTracks(void); /// remove all audio tracks
12
bool addAudioTrack(int poolIndex); /// Add an audio track in the active tracks
13
bool addExternalAudioTrack(const char *fileName); /// Add audio track from a file
14
- void updateDefaultAudioTrack(void);
15
+ void updateDefaultAudioTrack(void);
16
+
17
+ void seekFrame(int count);
18
+ void seekKeyFrame(int count);
19
+ void seekBlackFrame(int count);
20
+public:
21
+ bool setVar(const char *key, const char *value);
22
+ const char *getVar(const char *key);
23
+ bool printEnv(void);
24
25
- void seekFrame(int count);
26
- void seekKeyFrame(int count);
27
- void seekBlackFrame(int count);
28
/********************************* /IEditor **********************************/
29
};
30
#endif
31
avidemux_2.6.7.tar.gz/avidemux/common/ADM_editor/include/ADM_segment.h -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_editor/include/ADM_segment.h
Changed
19
1
2
{
3
protected:
4
ListOfSegments segments;
5
+ ListOfSegments clipboard;
6
std::list <ListOfSegments> undoSegments;
7
ListOfVideos videos;
8
bool updateStartTime(void);
9
10
bool dtsFromPts(uint32_t refVideo,uint64_t pts,uint64_t *dts);
11
12
bool LinearToRefTime(int segNo,uint64_t linear,uint64_t *refTime);
13
+
14
+ bool copyToClipBoard(uint64_t startTime, uint64_t endTime);
15
+ bool pasteFromClipBoard(uint64_t currentTime);
16
};
17
18
#endif
19
avidemux_2.6.7.tar.gz/avidemux/common/ADM_editor/include/IEditor.h -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_editor/include/IEditor.h
Changed
11
1
2
virtual uint32_t getFrameSize(int count) = 0;
3
virtual int setVideoCodecProfile(const char *codec, const char *profile)=0;
4
virtual bool audioSetAudioPoolLanguage(int poolIndex, const char *language)=0;
5
+ // var
6
+ virtual bool setVar(const char *key, const char *value)=0;
7
+ virtual const char *getVar(const char *key)=0;
8
+ virtual bool printEnv(void)=0;
9
};
10
#endif
11
avidemux_2.6.7.tar.gz/avidemux/common/ADM_editor/src/ADM_edAudioPcm.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_editor/src/ADM_edAudioPcm.cpp
Changed
10
1
2
if(!trk->codec->run(packetBuffer, packetBufferSize, dest, &nbOut))
3
{
4
packetBufferSize=0; // consume
5
- ADM_warning(ADM_PRINT_ERROR,"[Composer::getPCMPacket] Track %d:%x : codec failed failed\n",
6
+ ADM_warning("[Composer::getPCMPacket] Track %d:%x : codec failed failed\n",
7
myTrackNumber,trk);
8
return false;
9
}
10
avidemux_2.6.7.tar.gz/avidemux/common/ADM_editor/src/ADM_edAudioTrackExternal.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_editor/src/ADM_edAudioTrackExternal.cpp
Changed
9
1
2
{
3
case WAV_PCM:
4
case WAV_AC3:
5
+ case WAV_MP2:
6
case WAV_MP3:
7
break;
8
default:
9
avidemux_2.6.7.tar.gz/avidemux/common/ADM_editor/src/ADM_edCheckForInvalidPts.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_editor/src/ADM_edCheckForInvalidPts.cpp
Changed
94
1
2
* (at your option) any later version. *
3
* *
4
***************************************************************************/
5
+#include <algorithm>
6
#include "ADM_cpp.h"
7
#include "ADM_default.h"
8
#include "A_functions.h"
9
10
return true;
11
}
12
/**
13
+ * \fn checkTiming
14
+ * @param list
15
+ * @param limit
16
+ * @return
17
+ */
18
+static bool checkTiming(std::vector<uint64_t> &list, uint64_t limit)
19
+{
20
+ int n=list.size();
21
+ int good=0,bad=0;
22
+ for(int i=0;i<n-1;i++)
23
+ {
24
+ if((list[i+1]-list[i])<limit) bad++;
25
+ else good ++;
26
+ }
27
+ ADM_info("\tGood : %d\n",good);
28
+ ADM_info("\tBad : %d\n",bad);
29
+ if(!bad) return true;
30
+ return false;
31
+}
32
+
33
+/**
34
\fn checkForDoubledFps
35
\brief Checks if the DTS increases by half the fps
36
37
38
int totalFrames=hdr->getVideoStreamHeader()->dwLength;
39
int good=0,bad=0,skipped=0;
40
uint64_t dtsCeil= (timeIncrementUs*18)/10;
41
+ std::vector<uint64_t> dtsList,ptsList;
42
ADM_info("Checking for doubled FPS.., time increment ceiling = %d\n",(int)dtsCeil);
43
- for(int i=0;i<totalFrames-1;i++)
44
+ for(int i=0;i<totalFrames;i++)
45
{
46
- uint64_t pts,dts;
47
- uint64_t dts2;
48
+ uint64_t pts,dts;
49
hdr->getPtsDts(i,&pts,&dts);
50
- hdr->getPtsDts(i+1,&pts,&dts2);
51
- if(dts==ADM_NO_PTS || dts2==ADM_NO_PTS)
52
- {
53
- skipped++;
54
- continue;
55
- }
56
- if((dts2-dts)< dtsCeil)
57
- bad++;
58
- else
59
- good++;
60
+
61
+ if(dts!=ADM_NO_PTS)
62
+ dtsList.push_back(dts);
63
+ if(pts!=ADM_NO_PTS)
64
+ ptsList.push_back(pts);
65
}
66
- ADM_info("Out of %d frames, we have :\n",totalFrames);
67
- ADM_info("Bad : %d\n",bad);
68
- ADM_info("Good : %d\n",good);
69
- ADM_info("Skipped : %d\n",skipped);
70
- int total=good+bad+skipped;
71
- if(!total) return false;
72
- if(bad==0 && good*100>40*total)
73
+ std::sort (dtsList.begin(), dtsList.end());
74
+ std::sort (ptsList.begin(), ptsList.end());
75
+ ADM_info("Checking DTS...\n");
76
+ bool okDts=checkTiming(dtsList,dtsCeil);
77
+ ADM_info("Checking PTS...\n");
78
+ bool okPts=checkTiming(ptsList,dtsCeil);
79
+
80
+ if(okDts && okPts)
81
{
82
- ADM_info(" Looks like doubled fps\n");
83
- return true;
84
-
85
+ ADM_info("We can safely halve fps\n");
86
+ }else
87
+ {
88
+ ADM_info("Cannot halve fps\n");
89
}
90
- return false;
91
+ return okDts && okPts;
92
}
93
// EOF
94
avidemux_2.6.7.tar.gz/avidemux/common/ADM_editor/src/ADM_edit.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_editor/src/ADM_edit.cpp
Changed
83
1
2
3
#include <fcntl.h>
4
#include <errno.h>
5
+#include <map>
6
7
#include "fourcc.h"
8
#include "ADM_edit.hxx"
9
10
11
*/
12
#define YOURAUDIO(x) _videos[x].audioTracks[_videos[x].currentAudioStream]
13
+
14
+bool ADM_Composer::copyToClipBoard(uint64_t startTime, uint64_t endTime)
15
+{
16
+ return _segments.copyToClipBoard(startTime,endTime);
17
+
18
+}
19
+bool ADM_Composer::pasteFromClipBoard(uint64_t currentTime)
20
+{
21
+ return _segments.pasteFromClipBoard(currentTime);
22
+
23
+}
24
+
25
/**
26
\fn resetSeg
27
\brief Redo a 1:1 mapping between ref video and segment
28
29
v->_aviheader->getFrameSize(frame,&sz);
30
return sz;
31
}
32
+
33
+static std::map<std::string, std::string> scriptEnv;
34
+
35
+/**
36
+ * \fn setVar
37
+ * @param key
38
+ * @param value
39
+ * @return
40
+ */
41
+bool ADM_Composer::setVar(const char *key, const char *value)
42
+{
43
+ std::map<std::string,std::string>::iterator it;
44
+ it=scriptEnv.find(std::string(key));
45
+ if(scriptEnv.end() !=it)
46
+ {
47
+ scriptEnv.erase(it);
48
+ }
49
+ scriptEnv.insert(std::pair<std::string, std::string>(key,value));
50
+ return true;
51
+}
52
+/**
53
+ * \fn getVar
54
+ * @param key
55
+ * @return
56
+ */
57
+const char *ADM_Composer::getVar(const char *key)
58
+{
59
+ std::map<std::string,std::string>::iterator it;
60
+ it=scriptEnv.find(std::string(key));
61
+ if(scriptEnv.end() !=it)
62
+ {
63
+ return scriptEnv[key].c_str(); // ??
64
+ }
65
+ return NULL;
66
+}
67
+/**
68
+ * \fn printEnv
69
+ * @param
70
+ * @return
71
+ */
72
+bool ADM_Composer::printEnv(void)
73
+{
74
+ std::map<std::string,std::string>::iterator it;
75
+ for(it=scriptEnv.begin();it!=scriptEnv.end();it++)
76
+ {
77
+ printf("%s => %s\n",it->first.c_str(),it->second.c_str());
78
+ }
79
+ return true;
80
+}
81
+
82
// EOF
83
avidemux_2.6.7.tar.gz/avidemux/common/ADM_editor/src/ADM_segment.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_editor/src/ADM_segment.cpp
Changed
151
1
2
#include "ADM_audiocodec/ADM_audiocodec.h"
3
#include "ADM_codec.h"
4
#include "DIA_coreToolkit.h"
5
+#include "ADM_vidMisc.h"
6
+
7
+#if 1
8
+#define aprintf printf
9
+#else
10
+#define aprintf(...) {}
11
+#endif
12
+
13
ADM_EditorSegment::ADM_EditorSegment(void)
14
{
15
}
16
17
bool ADM_EditorSegment::undo(void)
18
{
19
if(undoSegments.empty()) return false;
20
-
21
+ clipboard.clear();
22
segments=undoSegments.back();
23
undoSegments.pop_back();
24
updateStartTime();
25
26
bool ADM_EditorSegment::updateStartTime(void)
27
{
28
int n=segments.size();
29
+ if(!n) return true;
30
+
31
uint64_t t=0;
32
+ t=segments[0]._startTimeUs;
33
for(int i=0;i<n;i++)
34
{
35
segments[i]._startTimeUs=t;
36
37
*/
38
bool ADM_EditorSegment::convertLinearTimeToSeg( uint64_t frameTime, uint32_t *seg, uint64_t *segTime)
39
{
40
+ if(!frameTime && segments.size()) // pick the first one
41
+ {
42
+ ADM_info("Frame time=0, taking first segment \n");
43
+ *seg=0;
44
+ *segTime=0; // ??
45
+ return true;
46
+ }
47
for(int i=0;i<segments.size();i++)
48
{
49
if(segments[i]._startTimeUs<=frameTime && segments[i]._startTimeUs+segments[i]._durationUs>frameTime)
50
51
for(int i=0;i<n;i++)
52
{
53
_SEGMENT *seg=getSegment(i);
54
+ _VIDEOS *vid=this->getRefVideo(seg->_reference);
55
if(seg->_durationUs==0) index=i;
56
+ if(seg->_refStartTimeUs==0 && seg->_durationUs==vid->firstFramePts) index=i;
57
}
58
if(index==-1) break;
59
segments.erase(segments.begin()+index);
60
61
*refTime=(uint64_t )time;
62
return true;
63
}
64
+/**
65
+ * \fn copyToClipBoard
66
+ * \Brief copy the section between startTime and endTime to clipboard
67
+ * @param startTime
68
+ * @param endTime
69
+ * @return
70
+ */
71
+bool ADM_EditorSegment::copyToClipBoard(uint64_t startTime, uint64_t endTime)
72
+{
73
+ ADM_info("Copy to clipboard from %s",ADM_us2plain(startTime));
74
+ ADM_info("to %s\n",ADM_us2plain(endTime));
75
+ uint32_t startSeg,endSeg;
76
+ uint64_t startSegTime,endSegTime;
77
+ convertLinearTimeToSeg( startTime, &startSeg,&startSegTime);
78
+ convertLinearTimeToSeg( endTime, &endSeg,&endSegTime);
79
+ clipboard.clear();
80
+ for(int seg=startSeg;seg<=endSeg;seg++)
81
+ {
82
+ _SEGMENT s=segments[seg];
83
+ aprintf("Adding segment %d to clipboard\n",seg);
84
+ if(s._startTimeUs<=startTime && (s._startTimeUs+s._durationUs)>startTime)
85
+ {
86
+ // need to refine 1st seg
87
+ aprintf("Marker A is here\n");
88
+ uint64_t offset=startTime-s._startTimeUs;
89
+ s._refStartTimeUs+=offset;
90
+ s._durationUs-=offset; // take into account the part we chopped
91
+ }
92
+ if(s._startTimeUs<=endTime && (s._startTimeUs+s._durationUs)>endTime)
93
+ {
94
+ aprintf("Marker B is here\n");
95
+ // need to refine last seg
96
+ uint64_t offset=endTime-s._startTimeUs;
97
+ s._durationUs=offset;
98
+ }
99
+ // TODO refine timing for 1st/last/duration/...
100
+ clipboard.push_back(s);
101
+ }
102
+ return false;
103
+}
104
+/**
105
+ * \fn pasteFromClipBoard
106
+ * \brief instert clipboard at currentTime position
107
+ * @param currentTime
108
+ * @return
109
+ */
110
+bool ADM_EditorSegment::pasteFromClipBoard(uint64_t currentTime)
111
+{
112
+ ADM_info("Pasting from clipboard to %s\n",ADM_us2plain(currentTime));
113
+ uint32_t startSeg;
114
+ uint64_t startSegTime;
115
+ convertLinearTimeToSeg( currentTime, &startSeg,&startSegTime);
116
+ ListOfSegments newSegs;
117
+ int n=segments.size();
118
+ for(int i=0;i<n;i++)
119
+ {
120
+ _SEGMENT s=segments[i];
121
+ if(i==startSeg)
122
+ {
123
+ // insert clipboard
124
+ // Do we need to split it ?
125
+ if(currentTime==s._startTimeUs)
126
+ {
127
+ // nope
128
+ for(int j=0;j<clipboard.size();j++) newSegs.push_back(clipboard[j]);
129
+ }else
130
+ {
131
+ _SEGMENT pre=s,post=s;
132
+ uint64_t offset=currentTime-s._startTimeUs;
133
+ pre._durationUs=offset;
134
+ post._refStartTimeUs+=offset;
135
+ post._durationUs-=offset;
136
+ newSegs.push_back(pre);
137
+ for(int j=0;j<clipboard.size();j++) newSegs.push_back(clipboard[j]);
138
+ newSegs.push_back(post);
139
+ continue;
140
+ }
141
+
142
+ }
143
+ newSegs.push_back(s);
144
+ }
145
+ segments=newSegs;
146
+ updateStartTime();
147
+ return true;
148
+}
149
+
150
//EOF
151
avidemux_2.6.7.tar.gz/avidemux/common/ADM_toolkit/automation.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_toolkit/automation.cpp
Changed
60
1
2
*/
3
uint8_t scriptAddVar(char *var,char *value)
4
{
5
- if(!var || !(*var))
6
- {
7
- printf("Script : Var name invalid\n");
8
- return 0;
9
- }
10
- if(!value || !(*value))
11
- {
12
- printf("Script : value invalid\n");
13
- return 0;
14
- }
15
- myVars[nbVar].name=ADM_strdup(var);
16
- myVars[nbVar].string=ADM_strdup(value);
17
- // check it is a number
18
- uint8_t digit=1;
19
- for(int i=0;i<strlen(value);i++)
20
- {
21
- if(!isdigit(value[i]))
22
- {digit=0;break;}
23
- }
24
- if(digit)
25
- myVars[nbVar].isString=0;
26
- else
27
- myVars[nbVar].isString=1;
28
- nbVar++;
29
+ video_body->setVar(var,value);
30
return 1;
31
32
}
33
34
*/
35
36
37
-char *script_getVar(char *in, int *r)
38
-{
39
-
40
- printf("Get var called with in=[%s]\n",in);
41
- for(uint32_t i=0;i<nbVar;i++)
42
- {
43
- if(myVars[i].name)
44
- {
45
- if(!strcmp(myVars[i].name,in)) // skip the $
46
- {
47
- *r=myVars[i].isString;
48
- return ADM_strdup(myVars[i].string);
49
- }
50
-
51
- }
52
- }
53
- printf("Warning: var [%s] is unknown !\n",in);
54
- return NULL;
55
-
56
-}
57
58
void set_reuse_2pass_log(char *p){
59
prefs->set(FEATURES_REUSE_2PASS_LOG,true);
60
avidemux_2.6.7.tar.gz/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_libva.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_libva.cpp
Changed
17
1
2
_context->hwaccel_context = va_context;
3
nbSurface=0;
4
5
- uint8_t *extraCopy=NULL;
6
+
7
if(extraDataLen)
8
{
9
- extraCopy=(uint8_t *)alloca(extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
10
- memset(extraCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
11
- memcpy(extraCopy,extraData,extraDataLen);
12
- _context->extradata = (uint8_t *) extraCopy;
13
+ _context->extradata = (uint8_t *) _extraDataCopy;
14
_context->extradata_size = (int) extraDataLen;
15
}
16
17
avidemux_2.6.7.tar.gz/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_vdpau.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_vdpau.cpp
Changed
41
1
2
{
3
alive=true;
4
scratch=NULL;
5
- uint8_t *extraCopy=NULL;
6
- if(extraDataLen)
7
- {
8
- extraCopy=(uint8_t *)alloca(extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
9
- memset(extraCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
10
- memcpy(extraCopy,extraData,extraDataLen);
11
- }
12
+
13
_context->opaque = this;
14
_context->get_buffer = ADM_VDPAUgetBuffer;
15
_context->release_buffer = ADM_VDPAUreleaseBuffer;
16
_context->draw_horiz_band = draw;
17
_context->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
18
- _context->extradata = (uint8_t *) extraCopy;
19
+ _context->extradata = (uint8_t *) _extraDataCopy;
20
_context->extradata_size = (int) extraDataLen;
21
_context->get_format = vdpauGetFormat;
22
vdpau=(void *)new vdpauContext;
23
24
}
25
VDPAU->freeQueue.clear();
26
}
27
- ADM_info("[VDPAU] Destroying decoder\n");
28
- if(VDP_STATUS_OK!=admVdpau::decoderDestroy(VDPAU->vdpDecoder))
29
+ if (VDPAU->vdpDecoder) {
30
+ ADM_info("[VDPAU] Destroying decoder\n");
31
+ if(VDP_STATUS_OK!=admVdpau::decoderDestroy(VDPAU->vdpDecoder))
32
ADM_error("Error destroying VDPAU decoder\n");
33
- delete VDPAU;
34
- vdpau=NULL;
35
+ }
36
+ delete VDPAU;
37
+ vdpau=NULL;
38
}
39
/**
40
\fn uncompress
41
avidemux_2.6.7.tar.gz/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_xvba.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_xvba.cpp
Changed
17
1
2
_context->pix_fmt = AV_PIX_FMT_XVBA_VLD;
3
4
5
- uint8_t *extraCopy=NULL;
6
+
7
if(extraDataLen)
8
{
9
- extraCopy=(uint8_t *)alloca(extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
10
- memset(extraCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
11
- memcpy(extraCopy,extraData,extraDataLen);
12
- _context->extradata = (uint8_t *) extraCopy;
13
+ _context->extradata = (uint8_t *) _extraDataCopy;
14
_context->extradata_size = (int) extraDataLen;
15
}
16
17
avidemux_2.6.7.tar.gz/avidemux/common/gui_main.cpp -> avidemux_2.6.8.tar.gz/avidemux/common/gui_main.cpp
Changed
32
1
2
break;
3
}
4
case ACT_Copy:
5
- brokenAct();
6
-// video_body->copyToClipBoard (frameStart,frameEnd);
7
+ {
8
+ uint64_t markA,markB;
9
+ markA=video_body->getMarkerAPts();
10
+ markB=video_body->getMarkerBPts();
11
+ if(markA>markB)
12
+ {
13
+ uint64_t p=markA;
14
+ markA=markB;
15
+ markB=p;
16
+ }
17
+ video_body->copyToClipBoard (markA,markB);
18
break;
19
+ }
20
case ACT_Paste:
21
- brokenAct();
22
+ {
23
+ uint64_t currentPts=video_body->getCurrentFramePts();
24
+ video_body->pasteFromClipBoard(currentPts);
25
+ video_body->getVideoInfo (avifileinfo);
26
+ A_ResetMarkers();
27
+ ReSync ();
28
+ }
29
break;
30
break;
31
32
avidemux_2.6.7.tar.gz/avidemux/qt4/ADM_userInterfaces/ADM_dialog/Q_audioTracks.cpp -> avidemux_2.6.8.tar.gz/avidemux/qt4/ADM_userInterfaces/ADM_dialog/Q_audioTracks.cpp
Changed
14
1
2
bool audioTrackQt4::updateActive(void)
3
{
4
// 1 - check for duplicates
5
- int map[NB_MENU];
6
- memset(map,0,sizeof(map));
7
+ int map[32]; // The size is related to the INPUT number of tracks, not output thx Rickard
8
+ for(int i=0;i<32;i++)
9
+ map[i]=0;
10
+
11
for(int i=0;i<NB_MENU;i++)
12
{
13
if(window->enabled[i]->checkState()==Qt::Checked)
14
avidemux_2.6.7.tar.gz/avidemux/qt4/ADM_userInterfaces/ui_support.cpp -> avidemux_2.6.8.tar.gz/avidemux/qt4/ADM_userInterfaces/ui_support.cpp
Changed
48
1
2
#include "ADM_files.h"
3
#include "DIA_uiTypes.h"
4
#include "ADM_coreTranslator.h"
5
+#include "prefs.h"
6
extern QWidget *QuiMainWindows;
7
8
#define MAX_UNLOADED_MSG_LENGTH 400
9
10
11
void loadTranslator(void)
12
{
13
- printf("\n[Locale] Locale: %s\n", QLocale::system().name().toUtf8().constData());
14
-
15
+
16
+ char *lang=NULL;
17
+ bool autoSelect=true;
18
+ if(prefs->get(DEFAULT_LANGUAGE,&lang))
19
+ {
20
+ if(lang && strlen(lang)>0 && strcmp(lang,"auto"))
21
+ autoSelect=false;
22
+ }
23
+ if(autoSelect)
24
+ {
25
+ ADM_info("Using system language\n");
26
+ lang=ADM_strdup(QLocale::system().name().toUtf8().constData());
27
+ }else
28
+ {
29
+ ADM_info("Language forced \n");
30
+ }
31
+ ADM_info("Initializing language %s\n",lang);
32
#ifdef __APPLE__
33
QString appdir = QCoreApplication::applicationDirPath() + "/../share/avidemux6/i18n/";
34
35
36
#else
37
QString appdir = ADM_getInstallRelativePath("share","avidemux6","i18n");
38
#endif
39
+ QString languageFile=QString(lang);
40
int nbLoaded=0;
41
- nbLoaded+=loadTranslation(&qtTranslator, appdir + "qt_" + QLocale::system().name());
42
- nbLoaded+=loadTranslation(&avidemuxTranslator, appdir + "avidemux_" + QLocale::system().name());
43
+ nbLoaded+=loadTranslation(&qtTranslator, appdir + "qt_" + languageFile);
44
+ nbLoaded+=loadTranslation(&avidemuxTranslator, appdir + "avidemux_" + languageFile);
45
translatorLoaded = true;
46
if(!nbLoaded) // Nothing to translate..
47
return;
48
avidemux_2.6.7.tar.gz/avidemux/winInstaller/Change Log.html -> avidemux_2.6.8.tar.gz/avidemux/winInstaller/Change Log.html
Changed
36
1
2
<body>
3
<div id="inner">
4
<h1>What's New in Avidemux</h1>
5
-<h2>2.6.7</h2>
6
+<h2>2.6.8</h2>
7
+ <ul>
8
+ <li>Image/export: Proper initialization of Qz for jpeg export</li>
9
+ <li>UI : Add an override menu to force language</li>
10
+ <li>tinypy : Add support for os.environ</li>
11
+ <li>x264 : Improved settings (tobias)</li>
12
+ <li>Win32 : Fix crash when having an audio problem</li>
13
+ <li>Win32 : Re-add mp4v2 to installer files</li>
14
+ <li>Audio/FAAC : Fix channel mapping when source is mono</li>
15
+ <li>Audio/AMR : Re-enabled AMR</li>
16
+ <li>Audio/lavc : Fixed encoding for codec not supporting planar (MP2)</li>
17
+ <li>Audio : Fixed importing MP2 audio detected as MP3</li>
18
+ <li>Editor : Fix deleting chunks of the video leading to seek errors</li>
19
+ <li>Editor : Initial copy/paste support</li>
20
+ <li>Editor/audio: Fix issue when source has more than 4 tracks</li>
21
+ <li>Editor : Better detection of double fps input files</li>
22
+ <li>TS/Demux : Brute force eac3 probe</li>
23
+ <li>TS/Demux : Better initialization, avoid dropping audio</li>
24
+ <li>MP4/Demux : Fix management of PCM audio</li>
25
+ <li>Mkv/Demux : Proper re-indexing for mpeg2 in mkv</li>
26
+ <li>Mp4v2/Mux : Add fast start mode back</li>
27
+ <li>OpenSolaris : Some fixes by pfelecan</li>
28
+ <li>Subtitles : Update libass + very simple srt2ssa converter</li>
29
+ <li>OsX : Enables more optional codecs...</li>
30
+ <li>avsfilte : Performance Improvements (fahr)</li>
31
+ </ul>
32
+ <h2>2.6.7</h2>
33
<ul>
34
<li>Windows : Better management of non ascii filename with x264</li>
35
<li>Images : Better support for bmp and jpeg</li>
36
avidemux_2.6.7.tar.gz/avidemux/winInstaller/What's New.html -> avidemux_2.6.8.tar.gz/avidemux/winInstaller/What's New.html
Changed
40
1
2
<div id="inner">
3
<h1>What's New in Avidemux</h1>
4
<ul>
5
- <li>Windows : Better management of non ascii filename with x264</li>
6
- <li>Images : Better support for bmp and jpeg</li>
7
- <li>Auto : Fixed PSP auto script (LJ)</li>
8
- <li>Packages: Better RPM generation (mit)</li>
9
- <li>Audio : Correct handling of 8Bits PCM in mp4/mov</li>
10
- <li>Build : Support for cmake 2.8.12 (2.8.13) (ajschult)</li>
11
- <li>mkv : Fixed seeking in mkv/h264</li>
12
- <li>TS/Audio: Extend support for SBR in AAC/LATM</li>
13
- <li>TS/H264 : Split at NALU boundaries, sometimes it was off by one byte</li>
14
+ <li>Image/export: Proper initialization of Qz for jpeg export</li>
15
+ <li>UI : Add an override menu to force language</li>
16
+ <li>tinypy : Add support for os.environ</li>
17
+ <li>x264 : Improved settings (tobias)</li>
18
+ <li>Win32 : Fix crash when having an audio problem</li>
19
+ <li>Win32 : Re-add mp4v2 to installer files</li>
20
+ <li>Audio/FAAC : Fix channel mapping when source is mono</li>
21
+ <li>Audio/AMR : Re-enabled AMR</li>
22
+ <li>Audio/lavc : Fixed encoding for codec not supporting planar (MP2)</li>
23
+ <li>Audio : Fixed importing MP2 audio detected as MP3</li>
24
+ <li>Editor : Fix deleting chunks of the video leading to seek errors</li>
25
+ <li>Editor : Initial copy/paste support</li>
26
+ <li>Editor/audio: Fix issue when source has more than 4 tracks</li>
27
+ <li>Editor : Better detection of double fps input files</li>
28
+ <li>TS/Demux : Brute force eac3 probe</li>
29
+ <li>TS/Demux : Better initialization, avoid dropping audio</li>
30
+ <li>MP4/Demux : Fix management of PCM audio</li>
31
+ <li>Mkv/Demux : Proper re-indexing for mpeg2 in mkv</li>
32
+ <li>Mp4v2/Mux : Add fast start mode back</li>
33
+ <li>OpenSolaris : Some fixes by pfelecan</li>
34
+ <li>Subtitles : Update libass + very simple srt2ssa converter</li>
35
+ <li>OsX : Enables more optional codecs...</li>
36
+ <li>avsfilte : Performance Improvements (fahr)</li>
37
</ul>
38
<br />
39
</div>
40
avidemux_2.6.7.tar.gz/avidemux/winInstaller/avidemux_cross.nsi -> avidemux_2.6.8.tar.gz/avidemux/winInstaller/avidemux_cross.nsi
Changed
68
1
2
!define EXEDIR "${NSIDIR}/install"
3
4
!define CORE_VERSION "2.6"
5
-!define POINT_RELEASE "7"
6
+!define POINT_RELEASE "8"
7
!define PRODUCT_VERSION "${CORE_VERSION}.${POINT_RELEASE}.${SVN_VERSION}"
8
!define PRODUCT_NAME "Avidemux ${CORE_VERSION}"
9
!define PRODUCT_FULLNAME "Avidemux ${PRODUCT_VERSION} (${BUILD_BITS}-bit Release)"
10
11
SetOutPath $INSTDIR\plugins\audioDecoder
12
${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_ms_adpcm.dll
13
${MementoSectionEnd}
14
- #${MementoSection} "AMR-NB" SecAudDecOpencoreAmrNb
15
- #SectionIn 1 2
16
- #SetOverwrite on
17
- #SetOutPath $INSTDIR\plugins\audioDecoder
18
- #${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_opencore_amrnb.dll
19
- #SetOutPath $INSTDIR
20
- #${File} ${ADM_DIR}/libopencore-amrnb-*.dll
21
- #${MementoSectionEnd}
22
- #${MementoSection} "AMR-WB" SecAudDecOpencoreAmrWb
23
- #SectionIn 1 2
24
- #SetOverwrite on
25
- #SetOutPath $INSTDIR\plugins\audioDecoder
26
- #${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_opencore_amrwb.dll
27
- #SetOutPath $INSTDIR
28
- #${File} ${ADM_DIR}/libopencore-amrwb-*.dll
29
- #${MementoSectionEnd}
30
+ ${MementoSection} "AMR-NB" SecAudDecOpencoreAmrNb
31
+ SectionIn 1 2
32
+ SetOverwrite on
33
+ SetOutPath $INSTDIR\plugins\audioDecoder
34
+ ${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_opencore_amrnb.dll
35
+ SetOutPath $INSTDIR
36
+ ${File} ${ADM_SYSDIR}/libopencore-amrnb-*.dll
37
+ ${MementoSectionEnd}
38
+ ${MementoSection} "AMR-WB" SecAudDecOpencoreAmrWb
39
+ SectionIn 1 2
40
+ SetOverwrite on
41
+ SetOutPath $INSTDIR\plugins\audioDecoder
42
+ ${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_opencore_amrwb.dll
43
+ SetOutPath $INSTDIR
44
+ ${File} ${ADM_SYSDIR}/libopencore-amrwb-*.dll
45
+ ${MementoSectionEnd}
46
${MementoSection} "MP2, MP3 (MAD)" SecAudDecMad
47
SectionIn 1 2
48
SetOverwrite on
49
50
SetOutPath $INSTDIR\plugins\muxers
51
${File} ${ADM_DIR}/plugins/muxers/libADM_mx_mp4.dll
52
${MementoSectionEnd}
53
- #${MementoSection} "MP4 (MP4v2)" SecMuxMp4v2
54
- #SectionIn 1 2
55
- #SetOverwrite on
56
- #SetOutPath $INSTDIR\plugins\muxers
57
- #${File} ${ADM_DIR}/plugins/muxers/libADM_mx_mp4v2.dll
58
- #${MementoSectionEnd}
59
+ ${MementoSection} "MP4 (MP4v2)" SecMuxMp4v2
60
+ SectionIn 1 2
61
+ SetOverwrite on
62
+ SetOutPath $INSTDIR\plugins\muxers
63
+ ${File} ${ADM_DIR}/plugins/muxers/libADM_mx_mp4v2.dll
64
+ ${MementoSectionEnd}
65
${MementoSection} "MPEG-PS" SecMuxLavMpegPs
66
SectionIn 1 2
67
SetOverwrite on
68
avidemux_2.6.7.tar.gz/avidemux/winInstaller/avidemux_cross64.nsi -> avidemux_2.6.8.tar.gz/avidemux/winInstaller/avidemux_cross64.nsi
Changed
10
1
2
!define EXEDIR "${NSIDIR}/install"
3
4
!define CORE_VERSION "2.6"
5
-!define POINT_RELEASE "7"
6
+!define POINT_RELEASE "8"
7
!define PRODUCT_VERSION "${CORE_VERSION}.${POINT_RELEASE}.${SVN_VERSION}"
8
!define PRODUCT_NAME "Avidemux ${CORE_VERSION} - 64bits"
9
!define PRODUCT_FULLNAME "Avidemux ${PRODUCT_VERSION} (${BUILD_BITS}-bit Release)"
10
avidemux_2.6.7.tar.gz/avidemux_core/ADM_core/src/ADM_misc.cpp -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_core/src/ADM_misc.cpp
Changed
15
1
2
uint32_t ms=(uint32_t)(ams/1000);
3
uint32_t hh,mm,ss,mms;
4
if(ams==ADM_NO_PTS)
5
- sprintf(buffer," xx:xx:xx,xxx ");
6
+ sprintf(buffer,"xx:xx:xx,xxx");
7
else
8
{
9
ms2time(ms,&hh,&mm,&ss,&mms);
10
- sprintf(buffer," %02"PRIu32":%02"PRIu32":%02"PRIu32",%03"PRIu32" ",hh,mm,ss,mms);
11
+ sprintf(buffer,"%02"PRIu32":%02"PRIu32":%02"PRIu32",%03"PRIu32,hh,mm,ss,mms);
12
}
13
return buffer;
14
15
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreAudio/src/ADM_audioIdentify.cpp -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreAudio/src/ADM_audioIdentify.cpp
Changed
12
1
2
// fill in info
3
info.frequency=mp2info.samplerate;
4
info.byterate=(mp2info.bitrate>>3)*1000;
5
- if(mp2info.layer==1) info.encoding=WAV_MP2;
6
- else info.encoding=WAV_MP3;
7
+ if(mp2info.layer==3) info.encoding=WAV_MP3;
8
+ else info.encoding=WAV_MP2;
9
switch(mp2info.mode)
10
{
11
case 1: // Joint stereo
12
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreImage/src/ADM_imageSave.cpp -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreImage/src/ADM_imageSave.cpp
Changed
18
1
2
context->time_base.num=1;
3
context->width=_width;
4
context->height=_height;
5
+ context->flags |= CODEC_FLAG_QSCALE;
6
r=avcodec_open(context, codec);
7
if(r<0)
8
{
9
10
// Grab a temp buffer
11
12
// Encode!
13
- context->flags |= CODEC_FLAG_QSCALE;
14
+
15
frame.quality = (int) floor (FF_QP2LAMBDA * 2+ 0.5);
16
17
byteBuffer.setSize(_width*_height*4);
18
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreSubtitles
Added
2
1
+(directory)
2
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreSubtitles/CMakeLists.txt
Added
3
1
2
+ADD_SUBDIRECTORY(src)
3
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreSubtitles/inc
Added
2
1
+(directory)
2
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreSubtitles/inc/ADM_coreSubtitles.h
Added
49
1
2
+/***************************************************************************
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
+ ***************************************************************************/
10
+#pragma once
11
+#include <string>
12
+#include <vector>
13
+typedef std::vector<std::string> ListOfText;
14
+/**
15
+ * \class subtitleTextEntry
16
+ */
17
+class subtitleTextEntry
18
+{
19
+public:
20
+ uint64_t start;
21
+ uint64_t stop;
22
+ ListOfText texts;
23
+};
24
+typedef std::vector<subtitleTextEntry> ListOfSubtitleLines;
25
+/**
26
+ * \class ADM_subtitle
27
+ */
28
+class ADM_subtitle
29
+{
30
+ typedef enum
31
+ {
32
+ SUB_TYPE_NONE,
33
+ SUB_TYPE_SRT,
34
+ SUB_TYPE_SSA
35
+ }ADM_SUBTITLE_TYPE;
36
+protected:
37
+ ADM_SUBTITLE_TYPE _type;
38
+ ListOfSubtitleLines _list;
39
+public:
40
+ ADM_subtitle();
41
+ virtual ~ADM_subtitle();
42
+ bool load(const char *subtitleFile);
43
+ bool dump(void);
44
+ bool saveAsSSA(const char *out);
45
+public:
46
+ bool srt2ssa();
47
+};
48
\ No newline at end of file
49
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreSubtitles/src
Added
2
1
+(directory)
2
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreSubtitles/src/ADM_coreSubtitles.cpp
Added
172
1
2
+/***************************************************************************
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
+ ***************************************************************************/
10
+#include "ADM_default.h"
11
+#include "ADM_coreSubtitles.h"
12
+#include "ADM_vidMisc.h"
13
+
14
+namespace ADM_sub
15
+{
16
+extern bool loadSrt(const char *file,ListOfSubtitleLines &lines);
17
+extern bool srt2ssa(subtitleTextEntry &in,subtitleTextEntry &out);
18
+};
19
+
20
+/**
21
+ *
22
+ * @param subtitleFile
23
+ * @return
24
+ */
25
+ADM_subtitle:: ADM_subtitle()
26
+{
27
+ _type=SUB_TYPE_NONE;
28
+}
29
+/**
30
+ *
31
+ * @param subtitleFile
32
+ * @return
33
+ */
34
+ADM_subtitle::~ADM_subtitle()
35
+{
36
+
37
+}
38
+/**
39
+ *
40
+ * @param subtitleFile
41
+ * @return
42
+ */
43
+bool ADM_subtitle::load(const char *subtitleFile)
44
+{
45
+ int l=strlen(subtitleFile);
46
+ if(l<4)
47
+ {
48
+ ADM_warning("Subtitle file is too short <%s>\n",subtitleFile);
49
+ return false;
50
+ }
51
+ const char *ext=subtitleFile+l-3;
52
+ if(!strcasecmp(ext,"srt"))
53
+ {
54
+ bool r=ADM_sub::loadSrt(subtitleFile,_list);
55
+ if(!r)
56
+ {
57
+ return false;
58
+ }
59
+ _type=SUB_TYPE_SRT;
60
+ return true;
61
+ }
62
+ ADM_warning("Unknown extension <%s>, or not supported\n",ext);
63
+ return false;
64
+}
65
+/**
66
+ * \fn dump
67
+ * @return
68
+ */
69
+bool ADM_subtitle::dump(void)
70
+{
71
+ int n=_list.size();
72
+ for(int i=0;i<n;i++)
73
+ {
74
+ subtitleTextEntry &e=_list[i];
75
+ printf(" %s ->",ADM_us2plain(e.start));
76
+ printf(" %s :",ADM_us2plain(e.stop));
77
+ int m=e.texts.size();
78
+ for(int j=0;j<m;j++)
79
+ printf(" --><%s> \n",e.texts[j].c_str());
80
+ }
81
+ return true;
82
+}
83
+
84
+/**
85
+ */
86
+bool ADM_subtitle::srt2ssa()
87
+{
88
+ ListOfSubtitleLines converted;
89
+ if(_type!=SUB_TYPE_SRT)
90
+ {
91
+ ADM_warning("srt2ssa: Input file is not SRT\n");
92
+ return false;
93
+ }
94
+ int n=_list.size();
95
+ for(int i=0;i<n;i++)
96
+ {
97
+ subtitleTextEntry in,out;
98
+ in=_list[i];
99
+ ADM_sub::srt2ssa(in,out);
100
+ converted.push_back(out);
101
+ }
102
+ _list.clear();
103
+ _list=converted;
104
+ _type=SUB_TYPE_SSA;
105
+ ADM_info("Converted %d entries\n",_list.size());
106
+ return true;
107
+}
108
+static void writeSSAHeader(FILE *f)
109
+{
110
+#define W(x) fprintf(f,x"\n");
111
+W("[Script Info]");
112
+W("Title:");
113
+W("Original Script:");
114
+W("Original Translation:");
115
+W("Original Editing:");
116
+W("Original Timing:");
117
+W("Synch Point:");
118
+W("Script Updated By:");
119
+W("Update Details:");
120
+W("ScriptType: v4.00+");
121
+W("Collisions: Normal");
122
+W("PlayResY:");
123
+W("PlayResX:");
124
+W("PlayDepth:");
125
+W("Timer: 100.0000");
126
+W("WrapStyle:");
127
+W("");
128
+W("[V4+ Styles]");
129
+W("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding");
130
+W("Style: Default,Arial,18,&H00ffffff,&H0000ffff,&H00000000,&H00000000,0,0,0,0,100,100,0,0.00,1,2,2,2,30,30,10,0");
131
+W("");
132
+W("[Events]");
133
+W("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text")
134
+
135
+}
136
+/**
137
+ * \fn saveAsSSA
138
+ */
139
+bool ADM_subtitle::saveAsSSA(const char *out)
140
+{
141
+ ListOfSubtitleLines converted;
142
+ if(_type!=SUB_TYPE_SSA)
143
+ {
144
+ ADM_warning("saveAsSSA: Input file is not SSA\n");
145
+ return false;
146
+ }
147
+ int n=_list.size();
148
+ FILE *file=ADM_fopen(out,"wt");
149
+ if(!file)
150
+ {
151
+ ADM_warning("Cannot create <%s>\n",out);
152
+ return false;
153
+ }
154
+ writeSSAHeader(file);
155
+ for(int i=0;i<n;i++)
156
+ {
157
+ subtitleTextEntry &in=_list[i];
158
+ int m=in.texts.size();
159
+ if(!m) continue;
160
+ fprintf(file,"%s",in.texts[0].c_str());
161
+ for(int j=1;j<m;j++)
162
+ {
163
+ fprintf(file,"\\n%s",in.texts[j].c_str());
164
+ }
165
+ fprintf(file,"\n");
166
+ }
167
+ ADM_info("%s written\n",out);
168
+ fclose(file);
169
+ return true;
170
+}
171
\ No newline at end of file
172
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreSubtitles/src/ADM_subConvert.cpp
Added
92
1
2
+/***************************************************************************
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
+ ***************************************************************************/
10
+/*
11
+ Initial port from MPlayer by Moonz
12
+ Mplayer version is Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
13
+
14
+*/
15
+
16
+
17
+#include "ADM_default.h"
18
+#include "ADM_coreSubtitles.h"
19
+#include "ADM_vidMisc.h"
20
+namespace ADM_sub
21
+{
22
+
23
+
24
+static const char *ADMus2Time(uint64_t ams)
25
+{
26
+static char buffer[256];
27
+uint32_t ms=(uint32_t)(ams/1000);
28
+ uint32_t hh,mm,ss,mms;
29
+ if(ams==ADM_NO_PTS)
30
+ sprintf(buffer,"xx:xx:xx.xxx");
31
+ else
32
+ {
33
+ ms2time(ms,&hh,&mm,&ss,&mms);
34
+ sprintf(buffer,"%01"PRIu32":%02"PRIu32":%02"PRIu32".%03"PRIu32,hh,mm,ss,mms);
35
+ }
36
+ return buffer;
37
+
38
+}
39
+
40
+#ifndef DIR_SEP
41
+# ifdef WIN32
42
+# define DIR_SEP '\\'
43
+# define DEFAULT_FONT_DIR "c:"
44
+# else
45
+# define DIR_SEP '/'
46
+# define DEFAULT_FONT_DIR "/usr/share/fonts/truetype/"
47
+# endif
48
+#endif
49
+//*****************
50
+
51
+
52
+
53
+/**
54
+ * \fn srt2ssa
55
+ * @param in
56
+ * @param out
57
+ * @return
58
+ *
59
+ * Dialogue: 0,0:41:49.86,0:41:56.95,Default,,0000,0000,0000,,Transcript : www.ydy.com/bbs | Benj!\nResynchro : Benj!.
60
+ *
61
+ */
62
+bool srt2ssa(subtitleTextEntry &in,subtitleTextEntry &out)
63
+{
64
+ char buffer[1024];
65
+ char buffer2[1024];
66
+ std::string startTime=std::string(ADMus2Time(in.start));
67
+ std::string endTime=std::string(ADMus2Time(in.stop));
68
+ std::string result;
69
+
70
+ sprintf(buffer,"Dialogue: 0,%s,%s,Default,,0000,0000,0000,,",startTime.c_str(),endTime.c_str());
71
+ int m=in.texts.size();
72
+ if(m)
73
+ {
74
+ strcpy(buffer2,in.texts[0].c_str());
75
+ for(int i=1;i<m;i++)
76
+ {
77
+ strcat(buffer2,"\\n") ;
78
+ strcat(buffer2,in.texts[i].c_str());
79
+ }
80
+
81
+ out.texts.clear();
82
+ strcat(buffer,buffer2);
83
+ out.texts.push_back(std::string(buffer));
84
+ }
85
+ out.start=in.start;
86
+ out.stop=in.stop;
87
+ return true;
88
+}
89
+
90
+} // namespace
91
+
92
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreSubtitles/src/ADM_subLoader.cpp
Added
177
1
2
+/**
3
+ * \author mean fixounet@free.fr
4
+ *
5
+ * \brief loader for .srt format
6
+ * 7
7
+ * 00:00:25,400 --> 00:00:30,800
8
+ * La prison m'a permis de rencontrer beaucoup de personnes
9
+ *
10
+ * @param in
11
+ * @param string
12
+ * @return
13
+ */
14
+/***************************************************************************
15
+ * *
16
+ * This program is free software; you can redistribute it and/or modify *
17
+ * it under the terms of the GNU General Public License as published by *
18
+ * the Free Software Foundation; either version 2 of the License, or *
19
+ * (at your option) any later version. *
20
+ * *
21
+ ***************************************************************************/
22
+#include "ADM_default.h"
23
+#include "ADM_coreSubtitles.h"
24
+
25
+#define HOLD_ON_TIMER (3*1000*1000LL)
26
+
27
+namespace ADM_sub
28
+{
29
+
30
+typedef enum
31
+{
32
+ STATE_IDLE=0,
33
+ STATE_LINENO,
34
+ STATE_TIMING,
35
+ STATE_DATA
36
+}SRT_STATE;
37
+
38
+/**
39
+ * \fn splitSrtTiming
40
+ * @param start
41
+ * @param end
42
+ * @param str
43
+ * @return
44
+ *
45
+ * 00:00:43,800 --> 00:00:48,000
46
+
47
+ */
48
+static uint64_t split2us(const int h2,const int m2,const int s2,const int ms2)
49
+{
50
+ uint64_t r=h2;
51
+ r=(r*60)+m2;
52
+ r=(r*60)+s2;
53
+ r=(r*1000)+ms2;
54
+ r=r*1000;
55
+ return r;
56
+}
57
+/**
58
+ * \fn splitSrtTiming
59
+ * @param str
60
+ * @param start
61
+ * @param end
62
+ * @return
63
+ */
64
+static bool splitSrtTiming(const char *str,uint64_t &start,uint64_t &end )
65
+{
66
+ int h1,h2,m1,m2,s1,s2,ms1,ms2;
67
+ int n=sscanf(str,"%d:%d:%d,%d --> %d:%d:%d,%d",&h1,&m1,&s1,&ms1,&h2,&m2,&s2,&ms2);
68
+ if(n!=8)
69
+ {
70
+ return false;
71
+ }
72
+ start=split2us(h1,m1,s1,ms1);
73
+ end=split2us(h2,m2,s2,ms2);
74
+ return true;
75
+}
76
+
77
+
78
+/**
79
+ * \fn updateTiming
80
+ * \brief srt does not provide 'end display' timeing information, make a guess
81
+ */
82
+static bool updateSrtTiming(ListOfSubtitleLines &lines)
83
+{
84
+ int n=lines.size();
85
+ for(int i=0;i<n-1;i++)
86
+ {
87
+ subtitleTextEntry ¤t=lines.at(i);
88
+ subtitleTextEntry &next=lines.at(i+1);
89
+ uint64_t limit=current.stop;
90
+ if(limit+10000>=next.start) limit=next.start-10000;
91
+ lines.at(i).stop=limit;
92
+ }
93
+ if(n)
94
+ lines[n-1].stop=lines[n-1].start+HOLD_ON_TIMER;
95
+ return true;
96
+
97
+
98
+}
99
+/**
100
+ * \fn loadSrt
101
+ * @param file
102
+ * @param lines
103
+ * @return
104
+ */
105
+bool loadSrt(const char *file,ListOfSubtitleLines &lines)
106
+{
107
+ FILE *fd=ADM_fopen(file,"rt");
108
+ if(!fd)
109
+ {
110
+ ADM_warning("Cannot open subtitle %s\n,file");
111
+ return false;
112
+ }
113
+ bool status=true;
114
+ char buffer[1024];
115
+ SRT_STATE state=STATE_LINENO;
116
+ subtitleTextEntry entry;
117
+ while(1)
118
+ {
119
+ if(!fgets(buffer,1023,fd))
120
+ {
121
+ break;
122
+ }
123
+ int length=strlen(buffer);
124
+ // remove trailing CR/LF
125
+ char *p=buffer+length-1;
126
+ while((*p=='\n' || *p=='\r')&& (p>buffer)) p--;
127
+ p[1]=0;
128
+ length=strlen(buffer);
129
+
130
+ int lineno;
131
+ printf("%d\n",state);
132
+ switch(state)
133
+ {
134
+ case STATE_LINENO:
135
+ if(!length) continue;
136
+ lineno=atoi(buffer);
137
+ state=STATE_TIMING;
138
+ break;
139
+ case STATE_TIMING:
140
+ if(length<2)
141
+ {
142
+ ADM_warning("Inconsistent file\n");
143
+ status=false;
144
+ break;
145
+ }
146
+ uint64_t start,end;
147
+ if(!splitSrtTiming(buffer,start,end))
148
+ {
149
+ ADM_warning("Inconsistent timing line\n");
150
+ status=false;
151
+ break;
152
+ }
153
+ entry.start=start;
154
+ entry.stop=end;
155
+ entry.texts.clear();
156
+ state=STATE_DATA;
157
+ break;
158
+ case STATE_DATA:
159
+ if(length<2)
160
+ {
161
+ lines.push_back(entry);
162
+ entry.texts.clear();
163
+ state=STATE_LINENO;
164
+ }
165
+
166
+ entry.texts.push_back(std::string(buffer));
167
+ break;
168
+ }
169
+ }
170
+ fclose(fd);
171
+ ADM_info("%d entries loaded\n",lines.size());
172
+ //updateSrtTiming(lines);
173
+ return true;
174
+}
175
+}
176
\ No newline at end of file
177
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreSubtitles/src/CMakeLists.txt
Added
9
1
2
+SET(ADM_core_subtitles_SRCS ADM_coreSubtitles.cpp ADM_subLoader.cpp ADM_subConvert.cpp)
3
+INCLUDE_DIRECTORIES(../inc)
4
+
5
+# We force the use of fontconfig
6
+ADM_ADD_SHARED_LIBRARY(ADM_coreSubtitle ${ADM_core_subtitles_SRCS})
7
+TARGET_LINK_LIBRARIES(ADM_coreSubtitle ADM_core6 )
8
+ADM_INSTALL_LIB(ADM_coreSubtitle)
9
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreUtils/include/prefs2_list.h -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreUtils/include/prefs2_list.h
Changed
9
1
2
DEFAULT_POSTPROC_TYPE, //uint32_t
3
DEFAULT_POSTPROC_VALUE, //uint32_t
4
DEFAULT_DOWNMIXING, //uint32_t
5
+DEFAULT_LANGUAGE, //string
6
MPEGSPLIT_AUTOSPLIT, //uint32_t
7
AVISYNTH_AVISYNTH_ALWAYS_ASK, //bool
8
AVISYNTH_AVISYNTH_DEFAULTPORT, //uint32_t
9
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2.conf -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2.conf
Changed
10
1
2
uint32_t:postproc_type, 3, 0, 7
3
uint32_t:postproc_value, 3, 0, 5
4
uint32_t:downmixing, 2, 0, 2
5
-
6
+string:language, ""
7
}
8
#
9
uint32_t:mpegsplit_autosplit, 790, 400, 5000
10
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2.h -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2.h
Changed
9
1
2
uint32_t postproc_type;
3
uint32_t postproc_value;
4
uint32_t downmixing;
5
+ char * language;
6
}Default;
7
uint32_t mpegsplit_autosplit;
8
struct {
9
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2_desc.cpp -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2_desc.cpp
Changed
9
1
2
{"Default.postproc_type",offsetof(my_prefs_struct,Default.postproc_type),"uint32_t",ADM_param_uint32_t},
3
{"Default.postproc_value",offsetof(my_prefs_struct,Default.postproc_value),"uint32_t",ADM_param_uint32_t},
4
{"Default.downmixing",offsetof(my_prefs_struct,Default.downmixing),"uint32_t",ADM_param_uint32_t},
5
+ {"Default.language",offsetof(my_prefs_struct,Default.language),"char *",ADM_param_string},
6
{"mpegsplit_autosplit",offsetof(my_prefs_struct,mpegsplit_autosplit),"uint32_t",ADM_param_uint32_t},
7
{"avisynth.avisynth_always_ask",offsetof(my_prefs_struct,avisynth.avisynth_always_ask),"bool",ADM_param_bool},
8
{"avisynth.avisynth_defaultport",offsetof(my_prefs_struct,avisynth.avisynth_defaultport),"uint32_t",ADM_param_uint32_t},
9
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2_json.cpp -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2_json.cpp
Changed
9
1
2
json.addUint32("postproc_type",key->Default.postproc_type);
3
json.addUint32("postproc_value",key->Default.postproc_value);
4
json.addUint32("downmixing",key->Default.downmixing);
5
+json.addString("language",key->Default.language);
6
json.endNode();
7
json.addUint32("mpegsplit_autosplit",key->mpegsplit_autosplit);
8
json.addNode("avisynth");
9
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2_pref.h -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreUtils/src/prefs2_pref.h
Changed
9
1
2
{ DEFAULT_POSTPROC_TYPE,"Default.postproc_type" ,ADM_param_uint32_t ,"3", 0, 7},
3
{ DEFAULT_POSTPROC_VALUE,"Default.postproc_value" ,ADM_param_uint32_t ,"3", 0, 5},
4
{ DEFAULT_DOWNMIXING,"Default.downmixing" ,ADM_param_uint32_t ,"2", 0, 2},
5
+{ DEFAULT_LANGUAGE,"Default.language" ,ADM_param_string ,"", 0, 0},
6
{ MPEGSPLIT_AUTOSPLIT,"mpegsplit_autosplit" ,ADM_param_uint32_t ,"790", 400, 5000},
7
{ AVISYNTH_AVISYNTH_ALWAYS_ASK,"avisynth.avisynth_always_ask" ,ADM_param_bool ,"0", 0, 1},
8
{ AVISYNTH_AVISYNTH_DEFAULTPORT,"avisynth.avisynth_defaultport" ,ADM_param_uint32_t ,"9999", 1024, 65535},
9
avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreUtils/src/update_prefs.sh
Added
7
1
2
+#!/bin/sh
3
+echo "Updating prefs"
4
+python pref_gen.py prefs2.conf
5
+python ../../../cmake/admSerialization.py prefs2.conf
6
+
7
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreVideoCodec/ADM_hwAccel/ADM_coreLibVA/src/CMakeLists.txt -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreVideoCodec/ADM_hwAccel/ADM_coreLibVA/src/CMakeLists.txt
Changed
7
1
2
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ADM_coreLibVA/include)
3
TARGET_LINK_LIBRARIES(ADM_coreLibVA6 va va-x11)
4
TARGET_LINK_LIBRARIES(ADM_coreLibVA6 ADM_core6 ADM_coreUI6 ADM_coreImage6)
5
+TARGET_LINK_LIBRARIES(ADM_coreLibVA6 "c")
6
ADM_INSTALL_LIB(ADM_coreLibVA6)
7
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreVideoCodec/include/ADM_ffmp43.h -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreVideoCodec/include/ADM_ffmp43.h
Changed
9
1
2
int codecId;
3
uint8_t _refCopy;
4
AVCodecContext *_context;
5
+ uint8_t *_extraDataCopy;
6
AVFrame _frame;
7
uint8_t _allowNull;
8
uint32_t frameType (void);
9
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreVideoCodec/src/ADM_codecFFsimple.cpp -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreVideoCodec/src/ADM_codecFFsimple.cpp
Changed
28
1
2
ADM_assert(c);
3
CodecID id=c->codecId;
4
ADM_assert(id!=CODEC_ID_NONE);
5
- uint8_t *extraCopy=NULL;
6
- if(extraDataLen)
7
- {
8
- extraCopy=(uint8_t *)malloc(extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
9
- memset(extraCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
10
- memcpy(extraCopy,extraData,extraDataLen);
11
- }
12
if(true==c->extraData)
13
{
14
- _context->extradata = (uint8_t *) extraCopy;
15
+ _context->extradata = (uint8_t *) _extraDataCopy;
16
_context->extradata_size = (int) extraDataLen;
17
}
18
if(true==c->refCopy)
19
20
{
21
printf("[lavc] Decoder init: %x video decoder initialized! (%s)\n",fcc,codec->long_name);
22
}
23
- if(extraCopy) free(extraCopy);
24
+
25
}
26
/**
27
\fn admCreateFFSimple
28
avidemux_2.6.7.tar.gz/avidemux_core/ADM_coreVideoCodec/src/ADM_ffmp43.cpp -> avidemux_2.6.8.tar.gz/avidemux_core/ADM_coreVideoCodec/src/ADM_ffmp43.cpp
Changed
145
1
2
printf ("[lavc] Build: %d\n", LIBAVCODEC_BUILD);
3
_context->debug_mv |= FF_SHOW;
4
_context->debug |= FF_DEBUG_VIS_MB_TYPE + FF_DEBUG_VIS_QP;
5
+ _extraDataCopy=NULL;
6
+
7
+ if(extraDataLen)
8
+ {
9
+ _extraDataCopy=new uint8_t[extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE];
10
+ memset(_extraDataCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
11
+ memcpy(_extraDataCopy,extraData,extraDataLen);
12
+ }
13
+
14
15
}
16
17
18
_context=NULL;
19
printf ("[lavc] Destroyed\n");
20
}
21
+ if(_extraDataCopy)
22
+ {
23
+ delete [] _extraDataCopy;
24
+ _extraDataCopy=NULL;
25
+ }
26
}
27
28
/**
29
30
ADM_info ("[lavc] Using %d bytes of extradata for MPEG4 decoder\n", (int)extraDataLen);
31
32
_refCopy = 1; // YUV420 only
33
- uint8_t *extraCopy=NULL;
34
- if(extraDataLen)
35
- {
36
- extraCopy=(uint8_t *)malloc(extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
37
- memset(extraCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
38
- memcpy(extraCopy,extraData,extraDataLen);
39
- }
40
- _context->extradata = extraCopy;
41
+
42
+
43
+ _context->extradata = _extraDataCopy;
44
_context->extradata_size = (int)extraDataLen ;
45
_context->codec_tag=fcc;
46
_context->stream_codec_tag=fcc;
47
decoderMultiThread ();
48
// _context->flags|=FF_DEBUG_VIS_MV;
49
WRAP_Open (CODEC_ID_MPEG4);
50
- if(extraCopy) free(extraCopy);
51
+
52
}
53
bool decoderFFMpeg4::uncompress (ADMCompressedImage * in, ADMImage * out)
54
{
55
56
decoderFFDV::decoderFFDV (uint32_t w, uint32_t h,uint32_t fcc, uint32_t extraDataLen, uint8_t *extraData,uint32_t bpp):
57
decoderFF (w, h,fcc,extraDataLen,extraData,bpp)
58
{
59
- uint8_t *extraCopy=NULL;
60
- if(extraDataLen)
61
- {
62
- extraCopy=(uint8_t *)malloc(extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
63
- memset(extraCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
64
- memcpy(extraCopy,extraData,extraDataLen);
65
- }
66
- _context->extradata = extraCopy;
67
+
68
+
69
+ _context->extradata = _extraDataCopy;
70
_context->extradata_size = (int)extraDataLen ;
71
WRAP_Open (CODEC_ID_DVVIDEO);
72
- if(extraCopy) free(extraCopy);
73
+
74
75
}
76
decoderFFMpeg12::decoderFFMpeg12 (uint32_t w, uint32_t h,uint32_t fcc, uint32_t extraDataLen, uint8_t *extraData,uint32_t bpp):
77
78
decoderFF_ffhuff::decoderFF_ffhuff (uint32_t w, uint32_t h,uint32_t fcc, uint32_t extraDataLen, uint8_t *extraData,uint32_t bpp)
79
:decoderFF (w, h,fcc,extraDataLen,extraData,bpp)
80
{
81
- uint8_t *extraCopy=NULL;
82
- if(extraDataLen)
83
- {
84
- extraCopy=(uint8_t *)malloc(extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
85
- memset(extraCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
86
- memcpy(extraCopy,extraData,extraDataLen);
87
- }
88
- _context->extradata = extraCopy;
89
+
90
+
91
+ _context->extradata = _extraDataCopy;
92
_context->extradata_size = (int)extraDataLen ;
93
_context->bits_per_coded_sample=bpp;
94
ADM_info ("[lavc] FFhuff: We have %d bytes of extra data\n", (int)extraDataLen);
95
WRAP_Open (CODEC_ID_FFVHUFF);
96
- if(extraCopy) free(extraCopy);
97
+
98
99
}
100
decoderFFH264::decoderFFH264 (uint32_t w, uint32_t h,uint32_t fcc, uint32_t extraDataLen, uint8_t *extraData,uint32_t bpp)
101
:decoderFF (w, h,fcc,extraDataLen,extraData,bpp)
102
{
103
- uint8_t *extraCopy=NULL;
104
- if(extraDataLen)
105
- {
106
- extraCopy=(uint8_t *)malloc(extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
107
- memset(extraCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
108
- memcpy(extraCopy,extraData,extraDataLen);
109
- }
110
- _context->extradata = extraCopy;
111
+
112
+ _context->extradata = _extraDataCopy;
113
_refCopy = 1; // YUV420 only
114
_context->extradata_size = (int) extraDataLen;
115
decoderMultiThread ();
116
ADM_info ("[lavc] Initializing H264 decoder with %d extradata\n", (int)extraDataLen);
117
WRAP_Open(CODEC_ID_H264);
118
- if(extraCopy) free(extraCopy);
119
+
120
}
121
//*********************
122
extern "C" {int av_getAVCStreamInfo(AVCodecContext *avctx, uint32_t *nalSize, uint32_t *isAvc);}
123
124
decoderFFhuff::decoderFFhuff (uint32_t w, uint32_t h,uint32_t fcc, uint32_t extraDataLen, uint8_t *extraData,uint32_t bpp):
125
decoderFF (w, h,fcc,extraDataLen,extraData,bpp)
126
{
127
- uint8_t *extraCopy=NULL;
128
- if(extraDataLen)
129
- {
130
- extraCopy=(uint8_t *)malloc(extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
131
- memset(extraCopy,0,extraDataLen+FF_INPUT_BUFFER_PADDING_SIZE);
132
- memcpy(extraCopy,extraData,extraDataLen);
133
- }
134
- _context->extradata = extraCopy;
135
+
136
+ _context->extradata = _extraDataCopy;
137
_context->extradata_size = (int) extraDataLen;
138
_context->bits_per_coded_sample = bpp;
139
WRAP_Open (CODEC_ID_HUFFYUV);
140
- if(extraCopy) free(extraCopy);
141
+
142
}
143
144
//***************
145
avidemux_2.6.7.tar.gz/avidemux_core/CMakeLists.txt -> avidemux_2.6.8.tar.gz/avidemux_core/CMakeLists.txt
Changed
9
1
2
ADD_SUBDIRECTORY(ADM_coreSocket)
3
add_subdirectory(ADM_coreImageLoader)
4
add_subdirectory(ADM_coreScript)
5
+add_subdirectory(ADM_coreSubtitles)
6
7
########################################
8
# Config Summary
9
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_audioEncoders/aften/audioencoder_aften.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_audioEncoders/aften/audioencoder_aften.cpp
Changed
11
1
2
BITRATE(160),
3
BITRATE(192),
4
BITRATE(224),
5
- BITRATE(384)
6
+ BITRATE(384),
7
+ BITRATE(448)
8
};
9
diaElemMenu bitrate(&(config.bitrate), QT_TRANSLATE_NOOP("aften","_Bitrate:"), SZT(bitrateM),bitrateM);
10
11
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_audioEncoders/faac/audioencoder_faac.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_audioEncoders/faac/audioencoder_faac.cpp
Changed
12
1
2
_globalHeader=globalHeader;
3
switch(channels)
4
{
5
- case 1:outputChannelMapping[1] = ADM_CH_FRONT_LEFT;break;
6
+ case 1:
7
+ outputChannelMapping[0] = ADM_CH_MONO;
8
+ break;
9
case 2:
10
outputChannelMapping[0] = ADM_CH_FRONT_LEFT;
11
outputChannelMapping[1] = ADM_CH_FRONT_RIGHT;
12
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp
Changed
83
1
2
CONTEXT->sample_fmt = AV_SAMPLE_FMT_FLTP;
3
ret = avcodec_open2(CONTEXT, codec,NULL);
4
if (ret<0)
5
- {
6
- printError("Init failed",ret);
7
- return 0;
8
+ {
9
+ CONTEXT->sample_fmt=AV_SAMPLE_FMT_S16;
10
+ ret = avcodec_open2(CONTEXT, codec,NULL);
11
+ if (ret<0)
12
+ {
13
+ printError("Init failed",ret);
14
+ return 0;
15
+ }
16
17
}
18
//ADM_info("Frame size : %d, %d\n",CONTEXT->frame_size,_chunk/wavheader.channels);
19
20
CHANNEL_TYPE *f=_incoming->getChannelMapping();
21
CHANNEL_TYPE *o=channelMapping;
22
23
- // reorder and de-interleave
24
- reorderToPlanar(&(tmpbuffer[tmphead]),planarBuffer,nbBlocks,f,o);
25
26
-
27
- int er=avcodec_fill_audio_frame(_frame, channel,
28
+
29
+ int er;
30
+ if( CONTEXT->sample_fmt == AV_SAMPLE_FMT_FLTP)
31
+ {
32
+ // reorder and de-interleave
33
+ reorderToPlanar(&(tmpbuffer[tmphead]),planarBuffer,nbBlocks,f,o);
34
+ er=avcodec_fill_audio_frame(_frame, channel,
35
AV_SAMPLE_FMT_FLTP, (uint8_t *)planarBuffer,
36
count*sizeof(float), 0);
37
+ }else
38
+ {
39
+ dither16(&(tmpbuffer[tmphead]),count,channel);
40
+ er=avcodec_fill_audio_frame(_frame, channel,
41
+ AV_SAMPLE_FMT_S16, (uint8_t *)&(tmpbuffer[tmphead]),
42
+ count*sizeof(uint16_t), 0);
43
+ }
44
if(er<0)
45
{
46
printError("Fill audio",er);
47
48
49
int nbBlocks=count/channel;
50
_frame->nb_samples=nbBlocks;
51
- float *in=i2p(count);
52
- int er=avcodec_fill_audio_frame(_frame, channel,
53
+
54
+
55
+ int er;
56
+ if( CONTEXT->sample_fmt == AV_SAMPLE_FMT_FLTP)
57
+ {
58
+ float *in=i2p(count);
59
+ // reorder and de-interleave
60
+ er=avcodec_fill_audio_frame(_frame, channel,
61
AV_SAMPLE_FMT_FLTP, (uint8_t *)in,
62
count*sizeof(float), 0);
63
+ }else
64
+ { // s16
65
+ dither16(&(tmpbuffer[tmphead]),count,channel);
66
+ er=avcodec_fill_audio_frame(_frame, channel,
67
+ AV_SAMPLE_FMT_S16, (uint8_t *)&(tmpbuffer[tmphead]),
68
+ count*sizeof(uint16_t), 0);
69
+ }
70
if(er<0)
71
{
72
printError("Fill audio",er);
73
74
BITRATE(160),
75
BITRATE(192),
76
BITRATE(224),
77
- BITRATE(384)
78
+ BITRATE(384),
79
+ BITRATE(448)
80
};
81
diaElemMenu bitrate(&(config.bitrate), QT_TR_NOOP("_Bitrate:"), SZT(bitrateM),bitrateM);
82
83
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvEntries.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvEntries.cpp
Changed
10
1
2
3
}
4
5
- _mainaviheader.dwMicroSecPerFrame=(uint32_t)floor(50);;
6
+ _mainaviheader.dwMicroSecPerFrame=(uint32_t)floor(50.0F);;
7
_videostream.fccType=fourCC::get((uint8_t *)"vids");
8
_video_bih.biBitCount=24;
9
_videostream.dwInitialFrames= 0;
10
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvIndexer.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvIndexer.cpp
Changed
72
1
2
parser->seek(tail);
3
return 1;
4
}
5
-
6
+/**
7
+ *
8
+ * @return
9
+ */
10
+static int mkvFindStartCode(uint8_t *& start, uint8_t *end)
11
+{
12
+ uint32_t last=0xffffffff;
13
+ while(start<end)
14
+ {
15
+ last=(last<<8)+*start;
16
+ if((last & 0xFFFFFF00)==0x100)
17
+ {
18
+ int r=start[0];
19
+ start++;
20
+ return r;
21
+ }
22
+ start++;
23
+ }
24
+ return -1;
25
+}
26
/**
27
\fn addVideoEntry
28
\brief add an entry to the video index
29
30
ix.flags=flags;
31
if(Track->index.size()) ix.Dts=ADM_NO_PTS;
32
33
+ }else if(isMpeg12Compatible(_videostream.fccHandler))
34
+ {
35
+
36
+ if(rpt)
37
+ memcpy(readBuffer,_tracks[0].headerRepeat,rpt);
38
+ parser->readBin(readBuffer+rpt,size-3);
39
+ uint8_t *begin=readBuffer;
40
+ uint8_t *end=readBuffer+size-3+rpt;
41
+ uint32_t flags=0;
42
+ while(begin<end)
43
+ {
44
+ int code=mkvFindStartCode(begin,end);
45
+ if(code==-1)
46
+ {
47
+ ADM_warning("[Mpg2InMkv]No startcode found\n");
48
+ break;
49
+ }
50
+ //printf("Startcode found = 0x%x\n",code);
51
+ if(!code) // picture
52
+ {
53
+ int picType=begin[1]>>3;
54
+ begin+=4;
55
+ picType&=7;
56
+ switch(picType)
57
+ {
58
+ case 1: ix.flags=AVI_KEY_FRAME;break;
59
+ case 2: ix.flags=AVI_P_FRAME;break;
60
+ case 4: ix.flags=AVI_P_FRAME;break;
61
+ case 3: ix.flags=AVI_B_FRAME;break;
62
+ default: ADM_warning("[Mpeg2inMkv]Bad pictype : %d\n",picType);
63
+ }
64
+ break;
65
+ }
66
+
67
+ }
68
+
69
}
70
}
71
Track->index.append(ix);
72
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_demuxers/MpegTS/ADM_tsBruteForce.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_demuxers/MpegTS/ADM_tsBruteForce.cpp
Changed
34
1
2
#include "ADM_tsPatPmt.h"
3
4
#include "ADM_a52info.h"
5
+#include "ADM_eac3info.h"
6
#include "ADM_mp3info.h"
7
8
#include "ADM_coreUtils.h"
9
10
uint32_t fq,br,chan,syncoff;
11
uint32_t fq2,br2,chan2,syncoff2;
12
13
- // Is it AC3 ?? No false positive with A52/AC3..
14
+ // Is it EAC3 ??
15
+ ADM_EAC3_INFO eac3,eac32;
16
+ if(ADM_EAC3GetInfo(ptr, len, &syncoff,&eac3))
17
+ {
18
+ ADM_info("Maybe EAC3... \n");
19
+ // Try on 2nd packet...
20
+ if(ADM_EAC3GetInfo(ptr2, len2, &syncoff,&eac32))
21
+ {
22
+ if((eac3.frequency==eac32.frequency) && (eac3.byterate==eac32.byterate) && (eac3.channels==eac32.channels))
23
+ {
24
+ ADM_warning("\tProbably EAC3 : Fq=%d br=%d chan=%d\n",(int)eac3.frequency,(int)eac3.byterate,(int)eac3.channels);
25
+ trackType=ADM_TS_EAC3;
26
+ return true;
27
+ }
28
+ }
29
+ }
30
+ // AC3 maybe ?
31
if( ADM_AC3GetInfo(ptr,len, &fq, &br, &chan,&syncoff))
32
{
33
ADM_info("Maybe AC3... \n");
34
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_demuxers/MpegTS/ADM_tsIndex.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_demuxers/MpegTS/ADM_tsIndex.cpp
Changed
19
1
2
index=NULL;
3
pkt=NULL;
4
audioTracks=NULL;
5
+ beginConsuming=0;
6
ui=createWorking ("Indexing");
7
audioTracks=trk;
8
ticktock.reset();
9
10
11
12
qfprintf(index," %c%c",Type[picUnit->imageType],Structure[pictStruct&3]);
13
- qfprintf(index,":%06"PRIx32,nextConsumed-beginConsuming);
14
+ int32_t delta=(int32_t)(nextConsumed-beginConsuming);
15
+ qfprintf(index,":%06"PRIx32,delta);
16
qfprintf(index,":%"PRId64":%"PRId64,deltaPts,deltaDts);
17
18
beginConsuming=nextConsumed;
19
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_demuxers/MpegTS/dmxTSPacket.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_demuxers/MpegTS/dmxTSPacket.cpp
Changed
9
1
2
oldStartAt=0xfffffff;
3
oldBufferLen=0;
4
pesPacket=new TS_PESpacket(pid);
5
+ consumed=0;
6
eof=false;
7
}
8
/**
9
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_odml_audio.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_odml_audio.cpp
Changed
51
1
2
this->extraDataLen=extraLen;
3
length=0;
4
uint32_t mx=0;
5
+ bool doSplit=false;
6
for(int i=0;i<nbChunk;i++)
7
{
8
length+=idx[i].size;
9
if(idx[i].size>mx) mx=idx[i].size;
10
}
11
12
-
13
+ int bytePerSample=2;
14
+ int maxAllowed=ODML_MAX_AUDIO_CHUNK;
15
if((hdr->encoding==WAV_PCM || hdr->encoding==WAV_LPCM))
16
{
17
// Number of samples in one chunk
18
- int maxAllowed=ODML_MAX_AUDIO_CHUNK;
19
- int bytePerSample=2;
20
+
21
+
22
if(hdr->bitspersample==8) bytePerSample=1;
23
int thirtyMs=(bytePerSample*hdr->channels*hdr->frequency)/40; // ~ 25 ms
24
if(thirtyMs<maxAllowed) maxAllowed=thirtyMs;
25
26
ADM_info("Checking that we dont have block larger than %d bytes, we have %d so far\n",maxAllowed,(int)mx);
27
if( mx>maxAllowed)
28
{
29
+ doSplit=true;
30
+ }
31
+ }
32
+ if(doSplit)
33
+ {
34
ADM_info("Splitting it...\n");
35
// Split the huge chunk into smaller ones
36
audioClock clock(hdr->frequency);
37
38
myIndex.append(current);
39
clock.advanceBySample(size/(bytePerSample*hdr->channels));
40
}
41
- }
42
-
43
}else
44
{ // Duplicate index as is
45
for(int i=0;i<nbChunk;i++)
46
myIndex.append(idx[i]);
47
+ ADM_info("Kept all of them as is (%d)\n",nbChunk);
48
}
49
fd=ADM_fopen(name,"r");
50
ADM_assert(fd);
51
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_odml_odml.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_odml_odml.cpp
Changed
10
1
2
}
3
else
4
{
5
-
6
+ (*index)[count].dts=0;
7
(*index)[count].offset=read32();
8
(*index)[count].offset+=second.base;
9
sizeflag=read32();
10
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_odml_regular.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_odml_regular.cpp
Changed
9
1
2
track[Achunk].offset+=startOfData;
3
track[Achunk].size=len;
4
track[Achunk].intra=flags;
5
+ track[Achunk].dts=0;
6
_audioTracks[nb].totalLen+=len;
7
8
audioSize+=len;
9
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_muxers/muxerMp4v2/muxerMp4v2Config.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_muxers/muxerMp4v2/muxerMp4v2Config.cpp
Changed
24
1
2
{
3
bool optimize=muxerConfig.optimize;
4
bool addItuneMetaData=muxerConfig.add_itunes_metadata;
5
-
6
- //diaElemToggle wOptimize(&optimize,"Optimize for streaming");
7
+
8
+ diaElemToggle wOptimize(&optimize,"Optimize for streaming (SLOW)");
9
diaElemToggle wItunes(&addItuneMetaData,"Add ipod metadata");
10
11
//diaElem *tabs[]={&wOptimize,&wItunes};
12
- diaElem *tabs[]={&wItunes};
13
- if( diaFactoryRun(("MP4V2 Settings"),1,tabs))
14
+ diaElem *tabs[]={&wItunes,&wOptimize};
15
+ if( diaFactoryRun(("MP4V2 Settings"),2,tabs))
16
{
17
- //muxerConfig.optimize=optimize;
18
- muxerConfig.optimize=false;
19
+ muxerConfig.optimize=optimize;
20
+ //muxerConfig.optimize=false;
21
muxerConfig.add_itunes_metadata=addItuneMetaData;
22
return true;
23
}
24
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/include/PythonEngine.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/include/PythonEngine.h
Changed
17
1
2
void registerFunction(const char *group, pyFunc *funcs);
3
void registerFunctions();
4
void registerClass(const char *className, pyRegisterClass classPy, const char *desc);
5
-
6
+ void registerStaticClass(const char *thisClass,pyFunc *funcs,const char *desc);
7
+
8
static tp_obj dumpBuiltin(tp_vm *tp);
9
static tp_obj getFileSize(tp_vm *tp);
10
static tp_obj getFolderContent(tp_vm *tp);
11
static tp_obj basename(tp_vm *tp);
12
static tp_obj dirname(tp_vm *tp);
13
+ static tp_obj pyenviron(tp_vm *tp);
14
15
public:
16
~PythonEngine();
17
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/ADM_pyAvidemux.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/ADM_pyAvidemux.cpp
Changed
42
1
2
{
3
GUI_Info_HIG(ADM_LOG_INFO, one, two);
4
}
5
-/**
6
- \fn pyTestCrash
7
-*/
8
9
-int pyTestCrash(void)
10
-{
11
- int *foobar = NULL;
12
- *foobar = 0; // CRASH!
13
- return true;
14
-}
15
/**
16
- \fn pyTestAssert
17
-*/
18
-
19
-int pyTestAssert(void)
20
+ * \fn pyGetEnv
21
+ * @param editor
22
+ * @param
23
+ * @return
24
+ */
25
+char *pyGetEnv(IEditor *editor,const char *key)
26
{
27
- ADM_assert(0);
28
- return true;
29
+ const char *src="";
30
+ if(editor)
31
+ {
32
+ if(key)
33
+ {
34
+ src=editor->getVar(key);
35
+ if(!src) src="";
36
+ }
37
+ }
38
+ return strdup(src);
39
}
40
+
41
// EOF
42
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/ADM_pyAvidemux.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/ADM_pyAvidemux.h
Changed
11
1
2
/* Misc */
3
int pyTestCrash(void);
4
int pyTestAssert(void);
5
-
6
+int pyTestSub( char *subName);
7
+/* OS */
8
+char *pyGetEnv(IEditor *editor,const char *);
9
#endif
10
// EOF
11
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/ADM_pyTests.cpp
Added
71
1
2
+/***************************************************************************
3
+ \file ADM_pyAvidemux.cpp
4
+ \brief binding between tinyPy and avidemux
5
+ \author mean/gruntster 2011/2012
6
+ ***************************************************************************/
7
+
8
+/***************************************************************************
9
+ * *
10
+ * This program is free software; you can redistribute it and/or modify *
11
+ * it under the terms of the GNU General Public License as published by *
12
+ * the Free Software Foundation; either version 2 of the License, or *
13
+ * (at your option) any later version. *
14
+ * *
15
+ ***************************************************************************/
16
+
17
+#include "ADM_pyAvidemux.h"
18
+#include "ADM_audiodef.h"
19
+#include "ADM_vidMisc.h"
20
+#include "fourcc.h"
21
+#include "DIA_fileSel.h"
22
+#include "DIA_coreToolkit.h"
23
+#include "ADM_coreSubtitles.h"
24
+
25
+/**
26
+ \fn pyTestCrash
27
+*/
28
+
29
+int pyTestCrash(void)
30
+{
31
+ int *foobar = NULL;
32
+ *foobar = 0; // CRASH!
33
+ return true;
34
+}
35
+/**
36
+ \fn pyTestAssert
37
+*/
38
+
39
+int pyTestAssert(void)
40
+{
41
+ ADM_assert(0);
42
+ return true;
43
+}
44
+int pyTestSub( char *subName)
45
+{
46
+ ADM_info("pyTestSub : %s\n",subName);
47
+ ADM_subtitle sub;
48
+ if(!sub.load(subName))
49
+ {
50
+ ADM_warning("Cannot load <%s>\n",subName);
51
+ return -1;
52
+ }
53
+ ADM_info("Dumping : %s\n",subName);
54
+ sub.dump();
55
+
56
+ ADM_info("Converting to ssa: %s\n",subName);
57
+ sub.srt2ssa();
58
+
59
+ ADM_info("Dumping : %s\n",subName);
60
+ sub.dump();
61
+
62
+ ADM_info("Saving : %s\n",subName);
63
+ sub.saveAsSSA("/tmp/foo.ass");
64
+
65
+
66
+ ADM_info("Done : %s\n",subName);
67
+ return 1;
68
+}
69
+
70
+// EOF
71
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/CMakeLists.txt -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/CMakeLists.txt
Changed
20
1
2
PythonScriptWriter.cpp
3
TinyParams.cpp
4
ADM_script_tinyPy.v
5
+ ADM_pyTests.cpp
6
modules/re/init.cpp
7
)
8
9
10
include_directories(../../ADM_coreScript/include)
11
include_directories(${AVIDEMUX_TOP_SOURCE_DIR}/avidemux/common)
12
include_directories(${AVIDEMUX_TOP_SOURCE_DIR}/avidemux/common/ADM_editor/include)
13
+include_directories(${AVIDEMUX_TOP_SOURCE_DIR}/avidemux_core/ADM_coreSubtitles/inc)
14
15
-target_link_libraries(ADM_script_tinyPy ADM_coreScript ADM_coreUtils6 ADM_core6 ADM_coreUI6 m)
16
+target_link_libraries(ADM_script_tinyPy ADM_coreScript ADM_coreUtils6 ADM_core6 ADM_coreUI6 ADM_coreSubtitle m)
17
18
if (NOT APPLE)
19
target_link_libraries(ADM_script_tinyPy -Wl,--version-script,"${CMAKE_CURRENT_SOURCE_DIR}/ADM_script_tinyPy.v")
20
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/PythonEngine.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/PythonEngine.cpp
Changed
108
1
2
#define ADM_PYID_AVIDEMUX 100
3
#define ADM_PYID_EDITOR 101
4
#define ADM_PYID_GUI 102
5
+#define ADM_PYID_OS 103
6
#define ADM_PYID_DIALOGF 200
7
#define ADM_PYID_DF_TOGGLE 201
8
#define ADM_PYID_DF_INTEGER 202
9
10
{"basename", PythonEngine::basename},
11
{"dirname", PythonEngine::dirname},
12
{NULL, NULL}};
13
+
14
+ pyFunc osStaticClassFunctions[] = {{"environ", PythonEngine::pyenviron},
15
+ {NULL, NULL}};
16
+
17
+
18
re_init(_vm);
19
this->registerFunction("addons", addonFunctions);
20
+
21
this->registerClass("Avidemux", initClasspyAdm, "avidemux class");
22
this->registerClass("Editor", initClasspyEditor, "add, remove videos");
23
this->registerClass("Gui", initClasspyGui, "widget, alert boxes,..");
24
25
this->registerClass("DFTimeStamp", initClasspyDFTimeStamp, "UI element : timestamp");
26
this->registerClass("DialogFactory", initClasspyDialogFactory, "UI manager, handle all UI elements");
27
this->registerFunction("test", pyHelpers_functions);
28
+ this->registerStaticClass("os",osStaticClassFunctions,"Access to operating system");
29
}
30
31
void PythonEngine::registerClass(const char *className, pyRegisterClass classPy, const char *desc)
32
33
34
tp_set(_vm, _vm->builtins, tp_string(className), classPy(_vm));
35
}
36
+/**
37
+ *
38
+ * @param vm
39
+ * @return
40
+ */
41
+static tp_obj myCtorpyStatic(tp_vm *vm)
42
+{
43
+ return tp_None;
44
+}
45
+/**
46
+ * \fn registerStaticClass
47
+ */
48
+void PythonEngine::registerStaticClass(const char *thisClass,pyFunc *funcs,const char *desc)
49
+{
50
+ this->callEventHandlers(IScriptEngine::Information, NULL, -1,
51
+ (string("Registering static class ") + string(thisClass)).c_str());
52
+
53
+ tp_obj classObj = tp_dict(_vm);
54
+
55
+ pyClassDescriptor classDesc;
56
+ classDesc.className = string(thisClass);
57
+ classDesc.desc = string(desc);
58
+ _pyClasses.push_back(classDesc);
59
+
60
+ while (funcs->funcName)
61
+ {
62
+ this->callEventHandlers(IScriptEngine::Information, NULL, -1,
63
+ (string("\tRegistering: ") + string(funcs->funcName)).c_str());
64
+
65
+ tp_set(_vm, classObj, tp_string(funcs->funcName), tp_fnc(_vm, funcs->funcCall));
66
67
+ funcs++;
68
+ }
69
+ tp_set(_vm, _vm->modules, tp_string(thisClass), classObj);
70
+
71
+}
72
void PythonEngine::registerFunction(const char *group, pyFunc *funcs)
73
{
74
this->callEventHandlers(IScriptEngine::Information, NULL, -1,
75
76
while (funcs->funcName)
77
{
78
this->callEventHandlers(IScriptEngine::Information, NULL, -1,
79
- (string("Registering: ") + string(funcs->funcName)).c_str());
80
+ (string("\tRegistering: ") + string(funcs->funcName)).c_str());
81
82
tp_set(_vm, _vm->builtins, tp_string(funcs->funcName), tp_fnc(_vm, funcs->funcCall));
83
84
85
{
86
return "";
87
}
88
+/**
89
+ * \fn environ
90
+ * \brief os.environ
91
+ * @param tp
92
+ * @return
93
+ */
94
+tp_obj PythonEngine::pyenviron(tp_vm *tp)
95
+{
96
+ TinyParams pm(tp);
97
+ const char *file = pm.asString();
98
+ const char *defaultRet="";
99
+ char *output=NULL;
100
+ PythonEngine *engine = (PythonEngine*)tp_get(tp, tp->builtins, tp_string("userdata")).data.val;
101
+
102
+
103
+ output=pyGetEnv(engine->editor(),file);
104
+ if(output) defaultRet=output;
105
+ tp_obj v = tp_string_copy(tp,defaultRet,strlen(defaultRet));
106
+ return v;
107
+}
108
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/binding/pyHelpers.admPyFunc -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/binding/pyHelpers.admPyFunc
Changed
8
1
2
# Basic action load, handle seg, getInfo
3
-/* FUNC */ int pyTestAssert:testAssert (void )
4
+/* FUNC */ int pyTestAssert:testAssert (void )
5
/* FUNC */ int pyTestCrash:testCrash (void )
6
-
7
+/* FUNC */ int pyTestSub:testSub (char)
8
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/pyHelpers_gen.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/pyHelpers_gen.cpp
Changed
18
1
2
int r=pyTestCrash();
3
return tp_number(r);
4
}
5
+//int pyTestSub <char>
6
+tp_obj zzpy_testSub(TP)
7
+{
8
+char * p0=(char *)TP_STR().string.val;
9
+int r=pyTestSub(p0);
10
+return tp_number(r);
11
+}
12
pyFunc pyHelpers_functions[]={
13
{"testAssert",zzpy_testAssert},
14
{"testCrash",zzpy_testCrash},
15
+{"testSub",zzpy_testSub},
16
{NULL,NULL}
17
};
18
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/update.make -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_scriptEngines/tinyPy/src/update.make
Changed
8
1
2
OBJS1=pyHelpers_gen.cpp
3
-OBJS=adm_gen.cpp editor_gen.cpp pyDFInteger_gen.cpp pyDFToggle_gen.cpp pyDialogFactory_gen.cpp pyDFMenu_gen.cpp pyDFTimeStamp_gen.cpp GUI_gen.cpp
4
+OBJS=adm_gen.cpp editor_gen.cpp pyDFInteger_gen.cpp pyDFToggle_gen.cpp pyDialogFactory_gen.cpp pyDFMenu_gen.cpp pyDFTimeStamp_gen.cpp GUI_gen.cpp
5
6
%_gen.cpp:binding/%.admPyClass
7
perl ../../../../cmake/admPyClass.pl $< $@
8
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/ADM_x264.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/ADM_x264.h
Changed
21
1
2
3
#define X264_DEFAULT_CONF \
4
{ \
5
+ true, /* bool UseAdvancedConfiguration */ \
6
{ /* General */ \
7
{ \
8
COMPRESS_AQ, /* COMPRESSION_MODE mode */ \
9
10
0*ADM_ENC_CAP_SAME \
11
}, \
12
99, /* Threads : auto */ \
13
+ NULL, /* Preset */ \
14
+ NULL, /* Tuning */ \
15
+ NULL, /* Profile */ \
16
+ false, /* Fast decode */ \
17
+ false, /* Zero latency */ \
18
true /* Fast first pass */ \
19
}, \
20
-1, /* Level */ \
21
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/ADM_x264Setup.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/ADM_x264Setup.cpp
Changed
201
1
2
{
3
ADM_info("=============x264, setting up==============\n");
4
MMSET(param);
5
+
6
x264_param_default( ¶m);
7
param.pf_log=logger;
8
firstIdr=true;
9
image=new ADMImageDefault(getWidth(),getHeight());
10
11
+ // -------------- preset, tune, idc ------------
12
+ if(!x264Settings.useAdvancedConfiguration)
13
+ {
14
+ char tune[200] = {0};
15
+ strcat(tune, x264Settings.general.tuning);
16
+ if(x264Settings.general.fast_decode)
17
+ {
18
+ strcat(tune, ",");
19
+ strcat(tune, "fastdecode");
20
+ }
21
+ if(x264Settings.general.zero_latency)
22
+ {
23
+ strcat(tune, ",");
24
+ strcat(tune, "zero_latency");
25
+ }
26
+ x264_param_default_preset(¶m, x264Settings.general.preset, tune);
27
+ }
28
+ param.i_level_idc=x264Settings.level;
29
30
// Threads..
31
switch(x264Settings.general.threads)
32
33
param.i_height = getHeight();
34
param.i_csp = X264_CSP_I420;
35
param.i_log_level=X264_LOG_INFO; //DEBUG; //INFO;
36
- param.i_level_idc=x264Settings.level;
37
- //Framerate
38
- int n,d;
39
- uint64_t f=source->getInfo()->frameIncrement;
40
- usSecondsToFrac(f,&n,&d);
41
- param.i_fps_num = d;
42
- param.i_fps_den = n;
43
- if(!x264Settings.MaxBFrame) encoderDelay=0;
44
- else
45
- {
46
- if(2>=x264Settings.MaxRefFrames)
47
- {
48
- encoderDelay=f*2*2;
49
- }
50
- else
51
- {
52
- encoderDelay=2*f*(x264Settings.MaxRefFrames-1);
53
- }
54
- }
55
-#define MKPARAM(x,y) {param.x = x264Settings.y;aprintf("[x264] "#x" = %d\n",param.x);}
56
-#define MKPARAMF(x,y) {param.x = (float)x264Settings.y; aprintf("[x264] "#x" = %.2f\n",param.x);}
57
-#define MKPARAMB(x,y) {param.x = x264Settings.y ;aprintf("[x264] "#x" = %s\n",TrueFalse[param.x&1]);}
58
- MKPARAM(i_frame_reference,MaxRefFrames);
59
- MKPARAM(i_keyint_min,MinIdr);
60
- MKPARAM(i_keyint_max,MaxIdr);
61
- MKPARAM(i_scenecut_threshold,i_scenecut_threshold);
62
- MKPARAMB(b_intra_refresh,intra_refresh);
63
- MKPARAM(i_bframe,MaxBFrame);
64
-
65
- MKPARAM(i_bframe_adaptive,i_bframe_adaptive);
66
- MKPARAM(i_bframe_bias,i_bframe_bias);
67
- MKPARAM(i_bframe_pyramid,i_bframe_pyramid);
68
- MKPARAMB(b_deblocking_filter,b_deblocking_filter);
69
- if(param.b_deblocking_filter)
70
- {
71
- MKPARAM(i_deblocking_filter_alphac0,i_deblocking_filter_alphac0);
72
- MKPARAM(i_deblocking_filter_beta,i_deblocking_filter_beta);
73
- }
74
- MKPARAMB(b_cabac,cabac);
75
- MKPARAMB(b_interlaced,interlaced);
76
- MKPARAMB(b_constrained_intra,constrained_intra);
77
- MKPARAMB(b_tff,tff);
78
- MKPARAMB(b_fake_interlaced,fake_interlaced);
79
80
- // -------------- vui------------
81
-#undef MKPARAM
82
-#undef MKPARAMF
83
-#undef MKPARAMB
84
-#define MKPARAM(x,y) {param.vui.x = x264Settings.vui.y;aprintf("[x264] vui."#x" = %d\n",param.vui.x);}
85
-#define MKPARAMF(x,y) {param.vui.x = (float)x264Settings.vui.y; aprintf("[x264] vui."#x" = %.2f\n",param.vui.x);}
86
-#define MKPARAMB(x,y) {param.vui.x = x264Settings.vui.y ;aprintf("[x264] vui."#x" = %s\n",TrueFalse[param.vui.x&1]);}
87
- MKPARAM (i_sar_width,sar_width)
88
- MKPARAM (i_sar_height,sar_height)
89
-
90
- // -------------- analyze------------
91
-#undef MKPARAM
92
-#undef MKPARAMF
93
-#undef MKPARAMB
94
-#define MKPARAM(x,y) {param.analyse.x = x264Settings.analyze.y;aprintf("[x264] analyse."#x" = %d\n",param.analyse.x);}
95
-#define MKPARAMF(x,y) {param.analyse.x = (float)x264Settings.analyze.y; aprintf("[x264] analyse."#x" = %.2f\n",param.analyse.x);}
96
-#define MKPARAMB(x,y) {param.analyse.x = x264Settings.analyze.y ;aprintf("[x264] analyse."#x" = %s\n",TrueFalse[param.analyse.x&1]);}
97
-#define MKFLAGS(fieldout,fieldin,mask) {if(x264Settings.analyze.fieldin) param.analyse.fieldout|=mask;}
98
- MKPARAMB(b_transform_8x8,b_8x8)
99
- MKPARAMB(b_weighted_bipred,weighted_bipred)
100
- MKPARAM (i_weighted_pred,weighted_pred)
101
- MKPARAM (i_direct_mv_pred,direct_mv_pred)
102
- MKPARAM (i_chroma_qp_offset,chroma_offset)
103
-
104
- MKPARAM (i_me_method,me_method)
105
- MKPARAM (i_me_range,me_range)
106
- MKPARAM (i_mv_range,mv_range)
107
- MKPARAM (i_mv_range_thread,mv_range_thread)
108
- MKPARAM (i_subpel_refine,subpel_refine)
109
- MKPARAMB(b_chroma_me,chroma_me)
110
- MKPARAMB(b_mixed_references,mixed_references)
111
- MKPARAM (i_trellis,trellis)
112
- MKPARAMB(b_fast_pskip,fast_pskip)
113
- MKPARAMB(b_dct_decimate,dct_decimate)
114
- MKPARAMB(b_psy,psy)
115
- MKPARAMF(f_psy_rd,psy_rd)
116
- MKPARAMF(f_psy_trellis,psy_trellis)
117
- MKPARAM (i_noise_reduction,noise_reduction)
118
- MKPARAM (i_luma_deadzone[0],inter_luma)
119
- MKPARAM (i_luma_deadzone[1],intra_luma)
120
-
121
- MKFLAGS(inter,b_i4x4,X264_ANALYSE_I4x4)
122
- MKFLAGS(inter,b_i8x8,X264_ANALYSE_I8x8)
123
- MKFLAGS(inter,b_p16x16,X264_ANALYSE_PSUB16x16)
124
- MKFLAGS(inter,b_p8x8,X264_ANALYSE_PSUB8x8)
125
- MKFLAGS(inter,b_b16x16,X264_ANALYSE_BSUB16x16)
126
-
127
- //---------------- ratecontrol -------------------
128
-#undef MKPARAM
129
-#undef MKPARAMF
130
-#undef MKPARAMB
131
-#define MKPARAM(x,y) {param.rc.x = x264Settings.ratecontrol.y;aprintf("[x264] rc."#x" = %d\n",param.rc.x);}
132
-#define MKPARAMF(x,y) {param.rc.x = (float)x264Settings.ratecontrol.y; aprintf("[x264] rc."#x" = %.2f\n",param.rc.x);}
133
-#define MKPARAMB(x,y) {param.rc.x = x264Settings.ratecontrol.y ;aprintf("[x264] rc."#x" = %s\n",TrueFalse[param.rc.x&1]);}
134
-
135
- MKPARAM(i_qp_min,qp_min);
136
- MKPARAM(i_qp_max,qp_max);
137
- MKPARAM(i_qp_step,qp_step);
138
- MKPARAM(f_rate_tolerance,rate_tolerance);
139
- MKPARAM(f_ip_factor,ip_factor);
140
- MKPARAM(f_pb_factor,pb_factor);
141
- MKPARAMB(b_mb_tree,mb_tree);
142
- MKPARAM(i_lookahead,lookahead);
143
- MKPARAM(i_aq_mode,aq_mode);
144
- MKPARAMF(f_aq_strength,aq_strength);
145
- // -------------------------
146
-
147
+ //Framerate
148
+ int n,d;
149
+ uint64_t f=source->getInfo()->frameIncrement;
150
+ usSecondsToFrac(f,&n,&d);
151
+ param.i_fps_num = d;
152
+ param.i_fps_den = n;
153
154
+ // -------------- vui------------
155
+ #undef MKPARAM
156
+ #undef MKPARAMF
157
+ #undef MKPARAMB
158
+ #define MKPARAM(x,y) {param.vui.x = x264Settings.vui.y;aprintf("[x264] vui."#x" = %d\n",param.vui.x);}
159
+ #define MKPARAMF(x,y) {param.vui.x = (float)x264Settings.vui.y; aprintf("[x264] vui."#x" = %.2f\n",param.vui.x);}
160
+ #define MKPARAMB(x,y) {param.vui.x = x264Settings.vui.y ;aprintf("[x264] vui."#x" = %s\n",TrueFalse[param.vui.x&1]);}
161
+ MKPARAM (i_sar_width,sar_width)
162
+ MKPARAM (i_sar_height,sar_height)
163
+
164
+ // -------------- rate control------------
165
switch(x264Settings.general.params.mode)
166
{
167
case COMPRESS_2PASS:
168
169
#warning FIXME
170
#if 0
171
if(x264Settings.)
172
- x264_param_apply_fastfirstpass(&_param);
173
+ x264_param_apply_fastfirstpass(&_param);
174
#endif
175
176
}else
177
178
179
// We do pseudo cfr ...
180
param.b_vfr_input=0;
181
+
182
+ if(x264Settings.useAdvancedConfiguration)
183
+ {
184
+
185
+ #undef MKPARAM
186
+ #undef MKPARAMF
187
+ #undef MKPARAMB
188
+ #define MKPARAM(x,y) {param.x = x264Settings.y;aprintf("[x264] "#x" = %d\n",param.x);}
189
+ #define MKPARAMF(x,y) {param.x = (float)x264Settings.y; aprintf("[x264] "#x" = %.2f\n",param.x);}
190
+ #define MKPARAMB(x,y) {param.x = x264Settings.y ;aprintf("[x264] "#x" = %s\n",TrueFalse[param.x&1]);}
191
+ MKPARAM(i_frame_reference,MaxRefFrames);
192
+ MKPARAM(i_keyint_min,MinIdr);
193
+ MKPARAM(i_keyint_max,MaxIdr);
194
+ MKPARAM(i_scenecut_threshold,i_scenecut_threshold);
195
+ MKPARAMB(b_intra_refresh,intra_refresh);
196
+ MKPARAM(i_bframe,MaxBFrame);
197
+
198
+ MKPARAM(i_bframe_adaptive,i_bframe_adaptive);
199
+ MKPARAM(i_bframe_bias,i_bframe_bias);
200
+ MKPARAM(i_bframe_pyramid,i_bframe_pyramid);
201
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/CMakeLists.txt -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/CMakeLists.txt
Changed
10
1
2
if(DO_SETTINGS)
3
FILE(GLOB json_files ${CMAKE_CURRENT_SOURCE_DIR}/preset/*.json)
4
message(STATUS "Presets found : ${json_files}")
5
- INSTALL_VIDEO_ENCODER_SETTINGS(x264 VERSION 2 FILES ${json_files})
6
+ INSTALL_VIDEO_ENCODER_SETTINGS(x264 VERSION 3 FILES ${json_files})
7
endif(DO_SETTINGS)
8
ELSE(X264_FOUND)
9
MESSAGE(STATUS "x264 disabled.")
10
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/PSP.json -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/PSP.json
Changed
7
1
2
{
3
+ "useAdvancedConfiguration" : true,
4
"general" : {
5
"params" : "CBR=1000",
6
"threads" : 99,
7
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/fast.json -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/fast.json
Changed
7
1
2
{
3
+ "useAdvancedConfiguration" : true,
4
"general" : {
5
"params" : "AQ=14",
6
"threads" : 99,
7
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/iPhone.json -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/iPhone.json
Changed
7
1
2
{
3
+ "useAdvancedConfiguration" : true,
4
"general" : {
5
"params" : "CBR=1000",
6
"threads" : 99,
7
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/ultraFast.json -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/ultraFast.json
Changed
21
1
2
{
3
+ "useAdvancedConfiguration" : true,
4
"general" : {
5
"params" : "AQ=12",
6
"threads" : 99,
7
"fast_first_pass" : true
8
},
9
- "level" : 4294967295,
10
+ "level" : -1,
11
"vui" : {
12
"sar_height" : 1,
13
"sar_width" : 1
14
15
"mb_tree" : false,
16
"lookahead" : 10
17
}
18
-}
19
\ No newline at end of file
20
+}
21
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/veryFast.json -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/preset/veryFast.json
Changed
7
1
2
{
3
+ "useAdvancedConfiguration" : true,
4
"general" : {
5
"params" : "AQ=12",
6
"threads" : 99,
7
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/qt4/Q_x264.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/qt4/Q_x264.cpp
Changed
201
1
2
#include "DIA_coreToolkit.h"
3
#include "ADM_toolkitQt.h"
4
5
-static int pluginVersion=2;
6
+static int pluginVersion=3;
7
8
static x264_encoder myCopy; // ugly...
9
extern bool x264_encoder_jserialize(const char *file, const x264_encoder *key);
10
11
12
};
13
#define NB_IDC sizeof(listOfIdc)/sizeof(idcToken)
14
+static const idcToken listOfThreads[]={
15
+ {0,"Auto"},
16
+ {1,"1"},
17
+ {2,"2"},
18
+ {4,"4"},
19
+};
20
+
21
+#define NB_THREADS sizeof(listOfThreads)/sizeof(idcToken)
22
23
typedef struct
24
{
25
26
};
27
28
#define NB_SAR sizeof(predefinedARs)/sizeof(aspectRatio)
29
+
30
+static const char* listOfPresets[] = { "ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo" };
31
+#define NB_PRESET sizeof(listOfPresets)/sizeof(char*)
32
+
33
+static const char* listOfTunings[] = { "film", "animation", "grain", "stillimage", "psnr", "ssim" };
34
+#define NB_TUNE sizeof(listOfTunings)/sizeof(char*)
35
+
36
+static const char* listOfProfiles[] = { "baseline", "main", "high", "high10", "high422", "high444" };
37
+#define NB_PROFILE sizeof(listOfProfiles)/sizeof(char*)
38
+
39
/**
40
\fn x264_ui
41
\brief hook to enter UI specific dialog
42
43
if (dialog.exec() == QDialog::Accepted)
44
{
45
dialog.download();
46
+ if(settings->general.preset) ADM_dealloc(settings->general.preset);
47
+ settings->general.preset = NULL;
48
+ if(settings->general.tuning) ADM_dealloc(settings->general.tuning);
49
+ settings->general.tuning = NULL;
50
+ if(settings->general.profile) ADM_dealloc(settings->general.profile);
51
+ settings->general.profile = NULL;
52
memcpy(settings,&myCopy,sizeof(myCopy));
53
+ if(myCopy.general.preset) settings->general.preset = ADM_strdup(myCopy.general.preset);
54
+ if(myCopy.general.tuning) settings->general.tuning = ADM_strdup(myCopy.general.tuning);
55
+ if(myCopy.general.profile) settings->general.profile = ADM_strdup(myCopy.general.profile);
56
success = true;
57
}
58
59
60
x264Dialog::x264Dialog(QWidget *parent, void *param) : QDialog(parent)
61
{
62
ui.setupUi(this);
63
+ connect(ui.useAdvancedConfigurationCheckBox, SIGNAL(toggled(bool)), this, SLOT(useAdvancedConfigurationCheckBox_toggled(bool)));
64
connect(ui.encodingModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(encodingModeComboBox_currentIndexChanged(int)));
65
connect(ui.quantiserSlider, SIGNAL(valueChanged(int)), this, SLOT(quantiserSlider_valueChanged(int)));
66
connect(ui.meSlider, SIGNAL(valueChanged(int)), this, SLOT(meSlider_valueChanged(int)));
67
68
connect(ui.maxCrfSlider, SIGNAL(valueChanged(int)), this, SLOT(maxCrfSlider_valueChanged(int)));
69
connect(ui.maxCrfSpinBox, SIGNAL(valueChanged(int)), this, SLOT(maxCrfSpinBox_valueChanged(int)));
70
#endif
71
- memcpy(&myCopy,param,sizeof(myCopy));
72
+ x264_encoder* settings = (x264_encoder*)param;
73
+ if(myCopy.general.preset) ADM_dealloc(myCopy.general.preset);
74
+ myCopy.general.preset = NULL;
75
+ if(myCopy.general.tuning) ADM_dealloc(myCopy.general.tuning);
76
+ myCopy.general.tuning = NULL;
77
+ if(myCopy.general.profile) ADM_dealloc(myCopy.general.profile);
78
+ myCopy.general.profile = NULL;
79
+ memcpy(&myCopy,settings,sizeof(myCopy));
80
+ if(settings->general.preset) myCopy.general.preset = ADM_strdup(settings->general.preset);
81
+ if(settings->general.tuning) myCopy.general.tuning = ADM_strdup(settings->general.tuning);
82
+ if(settings->general.profile) myCopy.general.profile = ADM_strdup(settings->general.profile);
83
+
84
#define ENCODING(x) myCopy.general.params.x
85
lastBitrate = ENCODING(bitrate);
86
lastVideoSize = ENCODING(finalsize);
87
88
idc->addItem(QString(t->idcString));
89
}
90
91
+ QComboBox *threads=ui.comboBoxThreads;
92
+ threads->clear();
93
+ for(int i=0;i<NB_THREADS;i++)
94
+ {
95
+ const idcToken *t=listOfThreads+i;
96
+ threads->addItem(QString(t->idcString));
97
+ }
98
+ QComboBox* presets=ui.presetComboBox;
99
+ presets->clear();
100
+ for(int i=0;i<NB_PRESET;i++)
101
+ {
102
+ presets->addItem(QString(listOfPresets[i]));
103
+ }
104
+
105
+ QComboBox* tunings=ui.tuningComboBox;
106
+ tunings->clear();
107
+ for(int i=0;i<NB_TUNE;i++)
108
+ {
109
+ tunings->addItem(QString(listOfTunings[i]));
110
+ }
111
+
112
+ QComboBox* profiles=ui.profileComboBox;
113
+ profiles->clear();
114
+ for(int i=0;i<NB_PROFILE;i++)
115
+ {
116
+ profiles->addItem(QString(listOfProfiles[i]));
117
+ }
118
+
119
upload();
120
ADM_pluginInstallSystem( std::string("x264"),std::string(".json"),pluginVersion);
121
updatePresetList();
122
123
return true;
124
}
125
126
+bool x264Dialog::toogleAdvancedConfiguration(bool advancedEnabled)
127
+{
128
+ ui.useAdvancedConfigurationCheckBox->setChecked(advancedEnabled);
129
+ ui.presetComboBox->setEnabled(!advancedEnabled);
130
+ ui.tuningComboBox->setEnabled(!advancedEnabled);
131
+ ui.profileComboBox->setEnabled(!advancedEnabled);
132
+ ui.fastDecodeCheckBox->setEnabled(!advancedEnabled);
133
+ ui.zeroLatencyCheckBox->setEnabled(!advancedEnabled);
134
+ ui.tabAdvancedRC->setEnabled(advancedEnabled);
135
+ ui.tabMotion->setEnabled(advancedEnabled);
136
+ ui.tabPartition->setEnabled(advancedEnabled);
137
+ ui.tabFrame->setEnabled(advancedEnabled);
138
+ ui.tabAnalysis->setEnabled(advancedEnabled);
139
+ ui.tabQuantiser->setEnabled(advancedEnabled);
140
+}
141
+
142
/**
143
144
*/
145
146
#define DISABLE(x) ui.x->setEnabled(false);
147
#define MK_MENU(x,y) ui.x->setCurrentIndex(myCopy.y)
148
#define MK_RADIOBUTTON(x) ui.x->setChecked(true);
149
+#define MK_COMBOBOX_STR(x,y,list,count) \
150
+ { \
151
+ QComboBox *combobox=ui.x; \
152
+ for(int i=0;i<count;i++) \
153
+ { \
154
+ const char *p=list[i]; \
155
+ if(myCopy.y && !strcmp(myCopy.y, p)) \
156
+ { \
157
+ combobox->setCurrentIndex(i); \
158
+ } \
159
+ } \
160
+ }
161
bool x264Dialog::upload(void)
162
{
163
-
164
+ toogleAdvancedConfiguration(myCopy.useAdvancedConfiguration);
165
+ MK_CHECKBOX(fastDecodeCheckBox,general.fast_decode);
166
+ MK_CHECKBOX(zeroLatencyCheckBox,general.zero_latency);
167
MK_CHECKBOX(fastFirstPassCheckBox,general.fast_first_pass);
168
MK_CHECKBOX(fastPSkipCheckBox,analyze.fast_pskip);
169
MK_CHECKBOX(weightedPredictCheckBox,analyze.weighted_bipred);
170
171
MK_UINT(minThreadBufferSpinBox,analyze.mv_range_thread);
172
}
173
174
+ // preset
175
+ MK_COMBOBOX_STR(presetComboBox, general.preset, listOfPresets, NB_PRESET);
176
+ MK_COMBOBOX_STR(profileComboBox, general.profile, listOfProfiles, NB_PROFILE);
177
+ MK_COMBOBOX_STR(tuningComboBox, general.tuning, listOfTunings, NB_TUNE);
178
+
179
// udate idc
180
QComboBox *idc=ui.idcLevelComboBox;
181
for(int i=0;i<NB_IDC;i++)
182
183
break;
184
}
185
}
186
-
187
+ // update threads
188
+ QComboBox *threads=ui.comboBoxThreads;
189
+ for(int i=0;i<NB_THREADS;i++)
190
+ {
191
+ const idcToken *t=listOfThreads+i;
192
+ if(myCopy.general.threads==t->idcValue)
193
+ {
194
+ threads->setCurrentIndex(i);
195
+ break;
196
+ }
197
+ }
198
switch(ENCODING(mode))
199
{
200
case COMPRESS_AQ: // CRF
201
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/qt4/Q_x264.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/qt4/Q_x264.h
Changed
19
1
2
public slots:
3
4
private slots:
5
+ void useAdvancedConfigurationCheckBox_toggled(bool checked);
6
void meSpinBox_valueChanged(int value);
7
void meSlider_valueChanged(int value);
8
void encodingModeComboBox_currentIndexChanged(int index);
9
10
11
bool updatePresetList(void);
12
13
-
14
+ bool toogleAdvancedConfiguration(bool advancedEnabled);
15
+
16
#if 0
17
void maxCrfSlider_valueChanged(int value);
18
void maxCrfSpinBox_valueChanged(int value);
19
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/qt4/x264ConfigDialog.ui -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/qt4/x264ConfigDialog.ui
Changed
201
1
2
<rect>
3
<x>0</x>
4
<y>0</y>
5
- <width>607</width>
6
+ <width>567</width>
7
<height>770</height>
8
</rect>
9
</property>
10
11
<item>
12
<widget class="QTabWidget" name="tabWidget">
13
<property name="currentIndex">
14
- <number>5</number>
15
+ <number>0</number>
16
</property>
17
- <widget class="QWidget" name="tab_1">
18
+ <widget class="QWidget" name="tabGeneral">
19
<attribute name="title">
20
<string>General</string>
21
</attribute>
22
- <widget class="QGroupBox" name="groupBox_2">
23
- <property name="geometry">
24
- <rect>
25
- <x>10</x>
26
- <y>10</y>
27
- <width>495</width>
28
- <height>400</height>
29
- </rect>
30
- </property>
31
- <property name="title">
32
- <string>Rate Control</string>
33
- </property>
34
- <layout class="QGridLayout" name="gridLayout_6">
35
- <item row="0" column="0">
36
- <layout class="QGridLayout">
37
- <item row="1" column="0">
38
- <widget class="QLabel" name="targetRateControlLabel1">
39
+ <layout class="QVBoxLayout" name="verticalLayout_5">
40
+ <item>
41
+ <widget class="QGroupBox" name="groupBox_7">
42
+ <property name="title">
43
+ <string>Basic</string>
44
+ </property>
45
+ <layout class="QVBoxLayout" name="verticalLayout_11">
46
+ <item>
47
+ <widget class="QCheckBox" name="useAdvancedConfigurationCheckBox">
48
<property name="text">
49
- <string>Target Video Size:</string>
50
+ <string>Use advanced configuration</string>
51
</property>
52
</widget>
53
</item>
54
- <item row="0" column="1">
55
- <layout class="QHBoxLayout">
56
- <item>
57
- <widget class="QComboBox" name="encodingModeComboBox">
58
- <property name="currentIndex">
59
- <number>3</number>
60
+ <item>
61
+ <layout class="QGridLayout" name="gridLayout_7">
62
+ <item row="2" column="0">
63
+ <widget class="QLabel" name="label_46">
64
+ <property name="text">
65
+ <string>Profile:</string>
66
</property>
67
+ </widget>
68
+ </item>
69
+ <item row="0" column="0">
70
+ <widget class="QLabel" name="label_41">
71
+ <property name="text">
72
+ <string>Preset:</string>
73
+ </property>
74
+ </widget>
75
+ </item>
76
+ <item row="0" column="1">
77
+ <layout class="QHBoxLayout" name="horizontalLayout_11">
78
<item>
79
- <property name="text">
80
- <string>Constant Bitrate (Single Pass)</string>
81
- </property>
82
+ <widget class="QComboBox" name="presetComboBox">
83
+ <property name="currentIndex">
84
+ <number>-1</number>
85
+ </property>
86
+ </widget>
87
</item>
88
<item>
89
- <property name="text">
90
- <string>Constant Quantiser (Single Pass)</string>
91
- </property>
92
+ <spacer name="horizontalSpacer_8">
93
+ <property name="orientation">
94
+ <enum>Qt::Horizontal</enum>
95
+ </property>
96
+ <property name="sizeHint" stdset="0">
97
+ <size>
98
+ <width>0</width>
99
+ <height>0</height>
100
+ </size>
101
+ </property>
102
+ </spacer>
103
</item>
104
+ </layout>
105
+ </item>
106
+ <item row="1" column="1">
107
+ <layout class="QHBoxLayout" name="horizontalLayout_12">
108
<item>
109
- <property name="text">
110
- <string>Constant Rate Factor (Single Pass)</string>
111
- </property>
112
+ <widget class="QComboBox" name="tuningComboBox"/>
113
</item>
114
<item>
115
- <property name="text">
116
- <string>Video Size (Two Pass)</string>
117
- </property>
118
+ <spacer name="horizontalSpacer_9">
119
+ <property name="orientation">
120
+ <enum>Qt::Horizontal</enum>
121
+ </property>
122
+ <property name="sizeHint" stdset="0">
123
+ <size>
124
+ <width>0</width>
125
+ <height>0</height>
126
+ </size>
127
+ </property>
128
+ </spacer>
129
+ </item>
130
+ </layout>
131
+ </item>
132
+ <item row="1" column="0">
133
+ <widget class="QLabel" name="label_45">
134
+ <property name="text">
135
+ <string>Tuning:</string>
136
+ </property>
137
+ </widget>
138
+ </item>
139
+ <item row="3" column="0">
140
+ <widget class="QLabel" name="label_53">
141
+ <property name="text">
142
+ <string>IDC Level:</string>
143
+ </property>
144
+ </widget>
145
+ </item>
146
+ <item row="2" column="1">
147
+ <layout class="QHBoxLayout" name="horizontalLayout_13">
148
+ <item>
149
+ <widget class="QComboBox" name="profileComboBox"/>
150
</item>
151
<item>
152
- <property name="text">
153
- <string>Average Bitrate (Two Pass)</string>
154
- </property>
155
+ <spacer name="horizontalSpacer_10">
156
+ <property name="orientation">
157
+ <enum>Qt::Horizontal</enum>
158
+ </property>
159
+ <property name="sizeHint" stdset="0">
160
+ <size>
161
+ <width>0</width>
162
+ <height>0</height>
163
+ </size>
164
+ </property>
165
+ </spacer>
166
+ </item>
167
+ </layout>
168
+ </item>
169
+ <item row="3" column="1">
170
+ <layout class="QHBoxLayout" name="horizontalLayout_14">
171
+ <item>
172
+ <widget class="QComboBox" name="idcLevelComboBox">
173
+ <property name="currentIndex">
174
+ <number>0</number>
175
+ </property>
176
+ <item>
177
+ <property name="text">
178
+ <string>Auto</string>
179
+ </property>
180
+ </item>
181
+ <item>
182
+ <property name="text">
183
+ <string>1</string>
184
+ </property>
185
+ </item>
186
+ <item>
187
+ <property name="text">
188
+ <string>1.1</string>
189
+ </property>
190
+ </item>
191
+ <item>
192
+ <property name="text">
193
+ <string>1.2</string>
194
+ </property>
195
+ </item>
196
+ <item>
197
+ <property name="text">
198
+ <string>1.3</string>
199
+ </property>
200
+ </item>
201
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/x264_encoder.conf -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/x264_encoder.conf
Changed
19
1
2
x264_encoder{
3
+bool:useAdvancedConfiguration
4
general{
5
video_encode:params;
6
uint32_t:threads;
7
+string:preset;
8
+string:tuning;
9
+string:profile;
10
+bool:fast_decode;
11
+bool:zero_latency;
12
bool:fast_first_pass;
13
}
14
-uint32_t:level
15
+int32_t:level
16
vui{
17
uint32_t:sar_height;
18
uint32_t:sar_width;
19
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/x264_encoder.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/x264_encoder.h
Changed
21
1
2
#ifndef ADM_x264_encoder_CONF_H
3
#define ADM_x264_encoder_CONF_H
4
typedef struct {
5
+bool useAdvancedConfiguration;
6
struct {
7
COMPRES_PARAMS params;
8
uint32_t threads;
9
+ char * preset;
10
+ char * tuning;
11
+ char * profile;
12
+ bool fast_decode;
13
+ bool zero_latency;
14
bool fast_first_pass;
15
}general;
16
-uint32_t level;
17
+int32_t level;
18
struct {
19
uint32_t sar_height;
20
uint32_t sar_width;
21
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/x264_encoder_desc.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/x264_encoder_desc.cpp
Changed
18
1
2
// automatically generated by admSerialization.py, do not edit!
3
extern const ADM_paramList x264_encoder_param[]={
4
+ {"useAdvancedConfiguration",offsetof(x264_encoder,useAdvancedConfiguration),"bool",ADM_param_bool},
5
{"general.params",offsetof(x264_encoder,general.params),"COMPRES_PARAMS",ADM_param_video_encode},
6
{"general.threads",offsetof(x264_encoder,general.threads),"uint32_t",ADM_param_uint32_t},
7
+ {"general.preset",offsetof(x264_encoder,general.preset),"char *",ADM_param_string},
8
+ {"general.tuning",offsetof(x264_encoder,general.tuning),"char *",ADM_param_string},
9
+ {"general.profile",offsetof(x264_encoder,general.profile),"char *",ADM_param_string},
10
+ {"general.fast_decode",offsetof(x264_encoder,general.fast_decode),"bool",ADM_param_bool},
11
+ {"general.zero_latency",offsetof(x264_encoder,general.zero_latency),"bool",ADM_param_bool},
12
{"general.fast_first_pass",offsetof(x264_encoder,general.fast_first_pass),"bool",ADM_param_bool},
13
- {"level",offsetof(x264_encoder,level),"uint32_t",ADM_param_uint32_t},
14
+ {"level",offsetof(x264_encoder,level),"int32_t",ADM_param_int32_t},
15
{"vui.sar_height",offsetof(x264_encoder,vui.sar_height),"uint32_t",ADM_param_uint32_t},
16
{"vui.sar_width",offsetof(x264_encoder,vui.sar_width),"uint32_t",ADM_param_uint32_t},
17
{"MaxRefFrames",offsetof(x264_encoder,MaxRefFrames),"uint32_t",ADM_param_uint32_t},
18
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/x264_encoder_json.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoEncoder/x264/x264_encoder_json.cpp
Changed
30
1
2
#include "x264_encoder.h"
3
bool x264_encoder_jserialize(const char *file, const x264_encoder *key){
4
admJson json;
5
+json.addBool("useAdvancedConfiguration",key->useAdvancedConfiguration);
6
json.addNode("general");
7
json.addCompressParam("params",key->general.params);
8
json.addUint32("threads",key->general.threads);
9
+json.addString("preset",key->general.preset);
10
+json.addString("tuning",key->general.tuning);
11
+json.addString("profile",key->general.profile);
12
+json.addBool("fast_decode",key->general.fast_decode);
13
+json.addBool("zero_latency",key->general.zero_latency);
14
json.addBool("fast_first_pass",key->general.fast_first_pass);
15
json.endNode();
16
-json.addUint32("level",key->level);
17
+json.addInt32("level",key->level);
18
json.addNode("vui");
19
json.addUint32("sar_height",key->vui.sar_height);
20
json.addUint32("sar_width",key->vui.sar_width);
21
22
bool x264_encoder_jdeserialize(const char *file, const ADM_paramList *tmpl,x264_encoder *key){
23
admJsonToCouple json;
24
CONFcouple *c=json.readFromFile(file);
25
-if(!c) {ADM_error("Cannot read json file (%s)\n",file);return false;}
26
+if(!c) {ADM_error("Cannot read json file");return false;}
27
bool r= ADM_paramLoadPartial(c,tmpl,key);
28
delete c;
29
return r;
30
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/Makefile.am -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/Makefile.am
Changed
19
1
2
3
LIBASS_LT_CURRENT = 5
4
LIBASS_LT_REVISION = 0
5
-LIBASS_LT_AGE = 1
6
+LIBASS_LT_AGE = 0
7
8
lib_LTLIBRARIES = libass.la
9
libass_la_SOURCES = ass.c ass_cache.c ass_font.c ass_fontconfig.c ass_render.c \
10
11
ass_drawing.h ass_cache_template.h ass_render.h \
12
ass_parse.c ass_parse.h ass_render_api.c ass_shaper.c \
13
ass_shaper.h ass_strtod.c
14
-libass_la_LDFLAGS = -version-info $(LIBASS_LT_CURRENT):$(LIBASS_LT_REVISION):$(LIBASS_LT_AGE)
15
+libass_la_LDFLAGS = -no-undefined -version-info $(LIBASS_LT_CURRENT):$(LIBASS_LT_REVISION):$(LIBASS_LT_AGE)
16
libass_la_LDFLAGS += -export-symbols $(srcdir)/libass.sym
17
18
assheadersdir = $(includedir)/ass
19
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/Makefile.in -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/Makefile.in
Changed
201
1
2
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
3
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
4
# @configure_input@
5
6
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
7
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
8
-# Inc.
9
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
10
+# Foundation, Inc.
11
# This Makefile.in is free software; the Free Software Foundation
12
# gives unlimited permission to copy and/or distribute it,
13
# with or without modifications, as long as this notice is preserved.
14
15
16
17
VPATH = @srcdir@
18
+am__make_dryrun = \
19
+ { \
20
+ am__dry=no; \
21
+ case $$MAKEFLAGS in \
22
+ *\\[\ \ ]*) \
23
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
24
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
25
+ *) \
26
+ for am__flg in $$MAKEFLAGS; do \
27
+ case $$am__flg in \
28
+ *=*|--*) ;; \
29
+ *n*) am__dry=yes; break;; \
30
+ esac; \
31
+ done;; \
32
+ esac; \
33
+ test $$am__dry = yes; \
34
+ }
35
pkgdatadir = $(datadir)/@PACKAGE@
36
pkgincludedir = $(includedir)/@PACKAGE@
37
pkglibdir = $(libdir)/@PACKAGE@
38
39
am__base_list = \
40
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
41
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
42
+am__uninstall_files_from_dir = { \
43
+ test -z "$$files" \
44
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
45
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
46
+ $(am__cd) "$$dir" && rm -f $$files; }; \
47
+ }
48
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(assheadersdir)"
49
LTLIBRARIES = $(lib_LTLIBRARIES)
50
libass_la_LIBADD =
51
52
ass_library.lo ass_drawing.lo ass_parse.lo ass_render_api.lo \
53
ass_shaper.lo ass_strtod.lo
54
libass_la_OBJECTS = $(am_libass_la_OBJECTS)
55
-AM_V_lt = $(am__v_lt_$(V))
56
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
57
+AM_V_lt = $(am__v_lt_@AM_V@)
58
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
59
am__v_lt_0 = --silent
60
libass_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
61
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
62
63
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
64
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
65
$(AM_CFLAGS) $(CFLAGS)
66
-AM_V_CC = $(am__v_CC_$(V))
67
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
68
+AM_V_CC = $(am__v_CC_@AM_V@)
69
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
70
am__v_CC_0 = @echo " CC " $@;
71
-AM_V_at = $(am__v_at_$(V))
72
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
73
+AM_V_at = $(am__v_at_@AM_V@)
74
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
75
am__v_at_0 = @
76
CCLD = $(CC)
77
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
78
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
79
$(AM_LDFLAGS) $(LDFLAGS) -o $@
80
-AM_V_CCLD = $(am__v_CCLD_$(V))
81
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
82
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
83
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
84
am__v_CCLD_0 = @echo " CCLD " $@;
85
-AM_V_GEN = $(am__v_GEN_$(V))
86
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
87
+AM_V_GEN = $(am__v_GEN_@AM_V@)
88
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
89
am__v_GEN_0 = @echo " GEN " $@;
90
SOURCES = $(libass_la_SOURCES)
91
DIST_SOURCES = $(libass_la_SOURCES)
92
+am__can_run_installinfo = \
93
+ case $$AM_UPDATE_INFO_DIR in \
94
+ n|no|NO) false;; \
95
+ *) (install-info --version) >/dev/null 2>&1;; \
96
+ esac
97
HEADERS = $(dist_assheaders_HEADERS)
98
ETAGS = etags
99
CTAGS = ctags
100
101
CYGPATH_W = @CYGPATH_W@
102
DEFS = @DEFS@
103
DEPDIR = @DEPDIR@
104
+DLLTOOL = @DLLTOOL@
105
DSYMUTIL = @DSYMUTIL@
106
DUMPBIN = @DUMPBIN@
107
ECHO_C = @ECHO_C@
108
109
LN_S = @LN_S@
110
LTLIBOBJS = @LTLIBOBJS@
111
MAKEINFO = @MAKEINFO@
112
+MANIFEST_TOOL = @MANIFEST_TOOL@
113
MKDIR_P = @MKDIR_P@
114
NM = @NM@
115
NMEDIT = @NMEDIT@
116
117
PACKAGE_VERSION = @PACKAGE_VERSION@
118
PATH_SEPARATOR = @PATH_SEPARATOR@
119
PKG_CONFIG = @PKG_CONFIG@
120
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
121
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
122
PKG_LIBS_DEFAULT = @PKG_LIBS_DEFAULT@
123
PKG_LIBS_PRIVATE = @PKG_LIBS_PRIVATE@
124
PKG_REQUIRES_DEFAULT = @PKG_REQUIRES_DEFAULT@
125
126
abs_srcdir = @abs_srcdir@
127
abs_top_builddir = @abs_top_builddir@
128
abs_top_srcdir = @abs_top_srcdir@
129
+ac_ct_AR = @ac_ct_AR@
130
ac_ct_CC = @ac_ct_CC@
131
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
132
am__include = @am__include@
133
134
libexecdir = @libexecdir@
135
localedir = @localedir@
136
localstatedir = @localstatedir@
137
-lt_ECHO = @lt_ECHO@
138
mandir = @mandir@
139
mkdir_p = @mkdir_p@
140
oldincludedir = @oldincludedir@
141
142
AM_CFLAGS = -Wall
143
LIBASS_LT_CURRENT = 5
144
LIBASS_LT_REVISION = 0
145
-LIBASS_LT_AGE = 1
146
+LIBASS_LT_AGE = 0
147
lib_LTLIBRARIES = libass.la
148
libass_la_SOURCES = ass.c ass_cache.c ass_font.c ass_fontconfig.c ass_render.c \
149
ass_utils.c ass_bitmap.c ass_library.c ass_bitmap.h \
150
151
ass_parse.c ass_parse.h ass_render_api.c ass_shaper.c \
152
ass_shaper.h ass_strtod.c
153
154
-libass_la_LDFLAGS = -version-info \
155
+libass_la_LDFLAGS = -no-undefined -version-info \
156
$(LIBASS_LT_CURRENT):$(LIBASS_LT_REVISION):$(LIBASS_LT_AGE) \
157
-export-symbols $(srcdir)/libass.sym
158
assheadersdir = $(includedir)/ass
159
160
$(am__aclocal_m4_deps):
161
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
162
@$(NORMAL_INSTALL)
163
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
164
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
165
list2=; for p in $$list; do \
166
if test -f $$p; then \
167
168
else :; fi; \
169
done; \
170
test -z "$$list2" || { \
171
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
172
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
173
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
174
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
175
}
176
177
echo "rm -f \"$${dir}/so_locations\""; \
178
rm -f "$${dir}/so_locations"; \
179
done
180
-libass.la: $(libass_la_OBJECTS) $(libass_la_DEPENDENCIES)
181
+libass.la: $(libass_la_OBJECTS) $(libass_la_DEPENDENCIES) $(EXTRA_libass_la_DEPENDENCIES)
182
$(AM_V_CCLD)$(libass_la_LINK) -rpath $(libdir) $(libass_la_OBJECTS) $(libass_la_LIBADD) $(LIBS)
183
184
mostlyclean-compile:
185
186
.c.o:
187
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
188
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
189
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
190
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
191
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
192
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
193
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
194
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
195
196
.c.obj:
197
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
198
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
199
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
200
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
201
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/admPackage.txt -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/admPackage.txt
Changed
8
1
2
Name : libass
3
URL : https://code.google.com/p/libass/
4
License : GPL >=2
5
-Version : 0.10.1
6
+Version : 0.10.2
7
8
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass.c -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass.c
Changed
201
1
2
target->name = strdup(token); \
3
ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);
4
5
+#define STARREDSTRVAL(name) \
6
+ } else if (strcasecmp(tname, #name) == 0) { \
7
+ if (target->name != NULL) free(target->name); \
8
+ while (*token == '*') ++token; \
9
+ target->name = strdup(token); \
10
+ ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);
11
+
12
#define COLORVAL(name) \
13
} else if (strcasecmp(tname, #name) == 0) { \
14
target->name = string2color(track->library, token); \
15
16
track->ScaledBorderAndShadow = parse_bool(token);
17
else if (!strcasecmp(*fs, "Kerning"))
18
track->Kerning = parse_bool(token);
19
+ else if (!strcasecmp(*fs, "YCbCr Matrix"))
20
+ track->YCbCrMatrix = parse_ycbcr_matrix(token);
21
22
dt = strrchr(*fs, '.');
23
if (dt) {
24
25
FPVAL(ScaleY)
26
FPVAL(Outline)
27
FPVAL(Shadow)
28
+ FPVAL(Blur)
29
}
30
}
31
}
32
33
NEXT(p, token);
34
35
if (0) { // cool ;)
36
- STRVAL(Name)
37
- if ((strcmp(target->Name, "Default") == 0)
38
- || (strcmp(target->Name, "*Default") == 0))
39
- track->default_style = sid;
40
+ STARREDSTRVAL(Name)
41
+ if (strcmp(target->Name, "Default") == 0)
42
+ track->default_style = sid;
43
STRVAL(FontName)
44
COLORVAL(PrimaryColour)
45
COLORVAL(SecondaryColour)
46
47
INTVAL(Underline)
48
INTVAL(StrikeOut)
49
FPVAL(Spacing)
50
- INTVAL(Angle)
51
+ FPVAL(Angle)
52
INTVAL(BorderStyle)
53
INTVAL(Alignment)
54
if (track->track_type == TRACK_TYPE_ASS)
55
56
track->ScaledBorderAndShadow = parse_bool(str + 22);
57
} else if (!strncmp(str, "Kerning:", 8)) {
58
track->Kerning = parse_bool(str + 8);
59
+ } else if (!strncmp(str, "YCbCr Matrix:", 13)) {
60
+ track->YCbCrMatrix = parse_ycbcr_matrix(str + 13);
61
} else if (!strncmp(str, "Language:", 9)) {
62
char *p = str + 9;
63
while (*p && isspace(*p)) p++;
64
65
{
66
track->parser_priv->state = PST_EVENTS;
67
if (track->track_type == TRACK_TYPE_SSA)
68
- track->event_format = strdup("Format: Marked, Start, End, Style, "
69
+ track->event_format = strdup("Marked, Start, End, Style, "
70
"Name, MarginL, MarginR, MarginV, Effect, Text");
71
else
72
- track->event_format = strdup("Format: Layer, Start, End, Style, "
73
+ track->event_format = strdup("Layer, Start, End, Style, "
74
"Actor, MarginL, MarginR, MarginV, Effect, Text");
75
ass_msg(track->library, MSGL_V,
76
"No event format found, using fallback");
77
78
ass_msg(library, MSGL_V, "Opened iconv descriptor");
79
} else
80
ass_msg(library, MSGL_ERR, "Error opening iconv descriptor");
81
+#ifdef CONFIG_ENCA
82
+ if (cp_tmp != codepage) {
83
+ free((void*)cp_tmp);
84
+ }
85
+#endif
86
}
87
88
{
89
90
oleft += size;
91
} else {
92
ass_msg(library, MSGL_WARN, "Error recoding file");
93
- return NULL;
94
+ free(outbuf);
95
+ outbuf = NULL;
96
+ goto out;
97
}
98
} else if (clear)
99
break;
100
101
outbuf[osize - oleft - 1] = 0;
102
}
103
104
+out:
105
if (icdsc != (iconv_t) (-1)) {
106
(void) iconv_close(icdsc);
107
icdsc = (iconv_t) (-1);
108
109
size_t bufsize, char *codepage)
110
{
111
ASS_Track *track;
112
- int need_free = 0;
113
+ int copied = 0;
114
115
if (!buf)
116
return 0;
117
118
if (!buf)
119
return 0;
120
else
121
- need_free = 1;
122
+ copied = 1;
123
}
124
#endif
125
+ if (!copied) {
126
+ char *newbuf = malloc(bufsize + 1);
127
+ if (!newbuf)
128
+ return 0;
129
+ memcpy(newbuf, buf, bufsize);
130
+ newbuf[bufsize] = '\0';
131
+ buf = newbuf;
132
+ }
133
track = parse_memory(library, buf);
134
- if (need_free)
135
- free(buf);
136
+ free(buf);
137
if (!track)
138
return 0;
139
140
141
long long ass_step_sub(ASS_Track *track, long long now, int movement)
142
{
143
int i;
144
+ ASS_Event *best = NULL;
145
+ long long target = now;
146
+ int direction = movement > 0 ? 1 : -1;
147
148
if (movement == 0)
149
return 0;
150
if (track->n_events == 0)
151
return 0;
152
153
- if (movement < 0)
154
- for (i = 0;
155
- (i < track->n_events)
156
- &&
157
- ((long long) (track->events[i].Start +
158
- track->events[i].Duration) <= now); ++i) {
159
- } else
160
- for (i = track->n_events - 1;
161
- (i >= 0) && ((long long) (track->events[i].Start) > now);
162
- --i) {
163
+ while (movement) {
164
+ ASS_Event *closest = NULL;
165
+ long long closest_time = now;
166
+ for (i = 0; i < track->n_events; i++) {
167
+ if (direction < 0) {
168
+ long long end =
169
+ track->events[i].Start + track->events[i].Duration;
170
+ if (end < target) {
171
+ if (!closest || end > closest_time) {
172
+ closest = &track->events[i];
173
+ closest_time = end;
174
+ }
175
+ }
176
+ } else {
177
+ long long start = track->events[i].Start;
178
+ if (start > target) {
179
+ if (!closest || start < closest_time) {
180
+ closest = &track->events[i];
181
+ closest_time = start;
182
+ }
183
+ }
184
+ }
185
}
186
+ target = closest_time + direction;
187
+ movement -= direction;
188
+ if (closest)
189
+ best = closest;
190
+ }
191
192
- // -1 and n_events are ok
193
- assert(i >= -1);
194
- assert(i <= track->n_events);
195
- i += movement;
196
- if (i < 0)
197
- i = 0;
198
- if (i >= track->n_events)
199
- i = track->n_events - 1;
200
- return ((long long) track->events[i].Start) - now;
201
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass.h
Changed
127
1
2
#include <stdarg.h>
3
#include "ass_types.h"
4
5
-#define LIBASS_VERSION 0x01010000
6
+#define LIBASS_VERSION 0x01020000
7
8
/*
9
* A linked list of images produced by an ass renderer.
10
11
int dst_x, dst_y; // Bitmap placement inside the video frame
12
13
struct ass_image *next; // Next image, or NULL
14
+
15
+ enum {
16
+ IMAGE_TYPE_CHARACTER,
17
+ IMAGE_TYPE_OUTLINE,
18
+ IMAGE_TYPE_SHADOW
19
+ } type;
20
+
21
} ASS_Image;
22
23
/*
24
* Hinting type. (see ass_set_hinting below)
25
*
26
+ * Setting hinting to anything but ASS_HINTING_NONE will put libass in a mode
27
+ * that reduces compatibility with vsfilter and many ASS scripts. The main
28
+ * problem is that hinting conflicts with smooth scaling, which precludes
29
+ * animations and precise positioning.
30
+ *
31
+ * In other words, enabling hinting might break some scripts severely.
32
+ *
33
* FreeType's native hinter is still buggy sometimes and it is recommended
34
* to use the light autohinter, ASS_HINTING_LIGHT, instead. For best
35
* compatibility with problematic fonts, disable hinting.
36
37
38
/**
39
* \brief Set the frame size in pixels, including margins.
40
+ * The renderer will never return images that are outside of the frame area.
41
+ * The value set with this function can influence the pixel aspect ratio used
42
+ * for rendering. If the frame size doesn't equal to the video size, you may
43
+ * have to use ass_set_pixel_aspect().
44
+ * @see ass_set_pixel_aspect()
45
+ * @see ass_set_margins()
46
* \param priv renderer handle
47
* \param w width
48
* \param h height
49
50
void ass_set_frame_size(ASS_Renderer *priv, int w, int h);
51
52
/**
53
+ * \brief Set the source image size in pixels.
54
+ * This is used to calculate the source aspect ratio and the blur scale.
55
+ * The source image size can be reset to default by setting w and h to 0.
56
+ * The value set with this function can influence the pixel aspect ratio used
57
+ * for rendering.
58
+ * @see ass_set_pixel_aspect()
59
+ * \param priv renderer handle
60
+ * \param w width
61
+ * \param h height
62
+ */
63
+void ass_set_storage_size(ASS_Renderer *priv, int w, int h);
64
+
65
+/**
66
* \brief Set shaping level. This is merely a hint, the renderer will use
67
* whatever is available if the request cannot be fulfilled.
68
* \param level shaping level
69
70
71
/**
72
* \brief Set frame margins. These values may be negative if pan-and-scan
73
- * is used.
74
+ * is used. The margins are in pixels. Each value specifies the distance from
75
+ * the video rectangle to the renderer frame. If a given margin value is
76
+ * positive, there will be free space between renderer frame and video area.
77
+ * If a given margin value is negative, the frame is inside the video, i.e.
78
+ * the video has been cropped.
79
+ *
80
+ * The renderer will try to keep subtitles inside the frame area. If possible,
81
+ * text is layout so that it is inside the cropped area. Subtitle events
82
+ * that can't be moved are cropped against the frame area.
83
+ *
84
+ * ass_set_use_margins() can be used to allow libass to render subtitles into
85
+ * the empty areas if margins are positive, i.e. the video area is smaller than
86
+ * the frame. (Traditionally, this has been used to show subtitles in
87
+ * the bottom "black bar" between video bottom screen border when playing 16:9
88
+ * video on a 4:3 screen.)
89
+ *
90
+ * When using this function, it is recommended to calculate and set your own
91
+ * aspect ratio with ass_set_pixel_aspect(), as the defaults won't make any
92
+ * sense.
93
+ * @see ass_set_pixel_aspect()
94
* \param priv renderer handle
95
* \param t top margin
96
* \param b bottom margin
97
98
void ass_set_use_margins(ASS_Renderer *priv, int use);
99
100
/**
101
+ * \brief Set pixel aspect ratio correction.
102
+ * This is the ratio of pixel width to pixel height.
103
+ *
104
+ * Generally, this is (s_w / s_h) / (d_w / d_h), where s_w and s_h is the
105
+ * video storage size, and d_w and d_h is the video display size. (Display
106
+ * and storage size can be different for anamorphic video, such as DVDs.)
107
+ *
108
+ * If the pixel aspect ratio is 0, or if the aspect ratio has never been set
109
+ * by calling this function, libass will calculate a default pixel aspect ratio
110
+ * out of values set with ass_set_frame_size() and ass_set_storage_size(). Note
111
+ * that this is useful only if the frame size corresponds to the video display
112
+ * size. Keep in mind that the margins set with ass_set_margins() are ignored
113
+ * for aspect ratio calculations as well.
114
+ * If the storage size has not been set, a pixel aspect ratio of 1 is assumed.
115
+ * \param priv renderer handle
116
+ * \param par pixel aspect ratio (1.0 means square pixels, 0 means default)
117
+ */
118
+void ass_set_pixel_aspect(ASS_Renderer *priv, double par);
119
+
120
+/**
121
* \brief Set aspect ratio parameters.
122
+ * This calls ass_set_pixel_aspect(priv, dar / sar).
123
+ * @deprecated New code should use ass_set_pixel_aspect().
124
* \param priv renderer handle
125
* \param dar display aspect ratio (DAR), prescaled for output PAR
126
* \param sar storage aspect ratio (SAR)
127
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_bitmap.c -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_bitmap.c
Changed
50
1
2
FT_Library ftlib, FT_Outline *outline, FT_Outline *border,
3
Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s,
4
int be, double blur_radius, FT_Vector shadow_offset,
5
- int border_style)
6
+ int border_style, int border_visible)
7
{
8
blur_radius *= 2;
9
int bbord = be > 0 ? sqrt(2 * be) : 0;
10
11
while (be--) {
12
if (*bm_o)
13
be_blur(*bm_o);
14
- else
15
+ if (!*bm_o || border_style == 3)
16
be_blur(*bm_g);
17
}
18
19
20
if (blur_radius > 0.0) {
21
if (*bm_o)
22
resize_tmp(priv_blur, (*bm_o)->w, (*bm_o)->h);
23
- else
24
+ if (!*bm_o || border_style == 3)
25
resize_tmp(priv_blur, (*bm_g)->w, (*bm_g)->h);
26
generate_tables(priv_blur, blur_radius);
27
if (*bm_o)
28
29
(*bm_o)->w, (*bm_o)->h, (*bm_o)->stride,
30
(int *) priv_blur->gt2, priv_blur->g_r,
31
priv_blur->g_w);
32
- else
33
+ if (!*bm_o || border_style == 3)
34
ass_gauss_blur((*bm_g)->buffer, priv_blur->tmp,
35
(*bm_g)->w, (*bm_g)->h, (*bm_g)->stride,
36
(int *) priv_blur->gt2, priv_blur->g_r,
37
38
if (*bm_o && border_style != 3) {
39
*bm_s = copy_bitmap(*bm_o);
40
fix_outline(*bm_g, *bm_o);
41
- } else if (*bm_o) {
42
+ } else if (*bm_o && border_visible) {
43
*bm_s = copy_bitmap(*bm_o);
44
+ } else if (*bm_o) {
45
+ *bm_s = *bm_o;
46
+ *bm_o = 0;
47
} else
48
*bm_s = copy_bitmap(*bm_g);
49
50
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_bitmap.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_bitmap.h
Changed
16
1
2
* \param bm_o out: pointer to the bitmap of outline (border) glyph is returned here
3
* \param bm_g out: pointer to the bitmap of glyph shadow is returned here
4
* \param be 1 = produces blurred bitmaps, 0 = normal bitmaps
5
+ * \param border_visible whether border is visible if border_style is 3
6
*/
7
int outline_to_bitmap3(ASS_Library *library, ASS_SynthPriv *priv_blur,
8
FT_Library ftlib, FT_Outline *outline, FT_Outline *border,
9
Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s,
10
int be, double blur_radius, FT_Vector shadow_offset,
11
- int border_style);
12
+ int border_style, int border_visible);
13
14
void ass_free_bitmap(Bitmap *bm);
15
16
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_font.c -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_font.c
Changed
40
1
2
// The idea was borrowed from asa (http://asa.diac24.net)
3
if (hori && os2) {
4
int hori_height = hori->Ascender - hori->Descender;
5
- int os2_height = os2->usWinAscent + os2->usWinDescent;
6
+ /* sometimes used for signed values despite unsigned in spec */
7
+ int os2_height = (short)os2->usWinAscent + (short)os2->usWinDescent;
8
if (hori_height && os2_height)
9
mscale = (double) hori_height / os2_height;
10
}
11
12
if (FT_Get_Char_Index(face, ch)) {
13
int y_scale = face->size->metrics.y_scale;
14
if (os2) {
15
- *asc = FT_MulFix(os2->usWinAscent, y_scale);
16
- *desc = FT_MulFix(os2->usWinDescent, y_scale);
17
+ *asc = FT_MulFix((short)os2->usWinAscent, y_scale);
18
+ *desc = FT_MulFix((short)os2->usWinDescent, y_scale);
19
} else {
20
*asc = FT_MulFix(face->ascender, y_scale);
21
*desc = FT_MulFix(-face->descender, y_scale);
22
23
/* "inside" contour but we can't find anything it could be
24
* inside of - assume the font is buggy and it should be
25
* an "outside" contour, and reverse it */
26
- for (j = 0; j < (end + 1 - start) / 2; j++) {
27
- FT_Vector temp = outline->points[start + j];
28
- char temp2 = outline->tags[start + j];
29
- outline->points[start + j] = outline->points[end - j];
30
+ for (j = 0; j < (end - start) / 2; j++) {
31
+ FT_Vector temp = outline->points[start + 1 + j];
32
+ char temp2 = outline->tags[start + 1 + j];
33
+ outline->points[start + 1 + j] = outline->points[end - j];
34
outline->points[end - j] = temp;
35
- outline->tags[start + j] = outline->tags[end - j];
36
+ outline->tags[start + 1 + j] = outline->tags[end - j];
37
outline->tags[end - j] = temp2;
38
}
39
dir ^= 1;
40
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_fontconfig.c -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_fontconfig.c
Changed
40
1
2
rc = FcConfigSubstitute(priv->config, pat, FcMatchPattern);
3
if (!rc)
4
goto error;
5
+ /* Fontconfig defaults include a language setting, which it sets based on
6
+ * some environment variables or defaults to "en". Unset this as we don't
7
+ * know the real language, and because some some attached fonts lack
8
+ * non-ascii characters included in fontconfig's list of characters
9
+ * required for English support and therefore don't match the lang=en
10
+ * criterion.
11
+ */
12
+ FcPatternDel(pat, "lang");
13
14
fsorted = FcFontSort(priv->config, pat, FcTrue, NULL, &result);
15
ffullname = match_fullname(library, priv, family, bold, italic);
16
17
18
if (!treat_family_as_pattern &&
19
!(r_family && strcasecmp((const char *) r_family, family) == 0) &&
20
- !(r_fullname && strcasecmp((const char *) r_fullname, family) == 0))
21
- ass_msg(library, MSGL_WARN,
22
- "fontconfig: Selected font is not the requested one: "
23
- "'%s' != '%s'",
24
- (const char *) (r_fullname ? r_fullname : r_family), family);
25
+ !(r_fullname && strcasecmp((const char *) r_fullname, family) == 0)) {
26
+ char *fallback = (char *) (r_fullname ? r_fullname : r_family);
27
+ if (code) {
28
+ ass_msg(library, MSGL_WARN,
29
+ "fontconfig: cannot find glyph U+%04X in font '%s', falling back to '%s'",
30
+ (unsigned int)code, family, fallback);
31
+ } else {
32
+ ass_msg(library, MSGL_WARN,
33
+ "fontconfig: cannot find font '%s', falling back to '%s'",
34
+ family, fallback);
35
+ }
36
+ }
37
38
result = FcPatternGetString(rpat, FC_STYLE, 0, &r_style);
39
if (result != FcResultMatch)
40
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_parse.c -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_parse.c
Changed
116
1
2
drawing->scale = scale;
3
drawing->scale_x = render_priv->font_scale_x * render_priv->font_scale;
4
drawing->scale_y = render_priv->font_scale;
5
- while (*p != ')' && *p != '}' && p != 0)
6
+ while (*p != ')' && *p != '}' && *p != 0)
7
ass_drawing_add_char(drawing, *p++);
8
skipopt(')');
9
10
11
int x0, y0, x1, y1;
12
int res = 1;
13
char *start = p;
14
- skipopt('(');
15
+ skip('(');
16
res &= mystrtoi(&p, &x0);
17
skipopt(',');
18
res &= mystrtoi(&p, &y0);
19
20
mystrtod(&p, &x2);
21
skip(',');
22
mystrtod(&p, &y2);
23
+ t1 = t2 = 0;
24
if (*p == ',') {
25
skip(',');
26
mystrtoll(&p, &t1);
27
28
"movement6: (%f, %f) -> (%f, %f), (%" PRId64 " .. %"
29
PRId64 ")\n", x1, y1, x2, y2, (int64_t) t1,
30
(int64_t) t2);
31
- } else {
32
+ // VSFilter
33
+ if (t1 > t2) {
34
+ double tmp = t2;
35
+ t2 = t1;
36
+ t1 = tmp;
37
+ }
38
+ }
39
+ if (t1 <= 0 && t2 <= 0) {
40
t1 = 0;
41
t2 = render_priv->state.event->Duration;
42
ass_msg(render_priv->library, MSGL_DBG2,
43
"movement: (%f, %f) -> (%f, %f)", x1, y1, x2, y2);
44
}
45
- skip(')');
46
+ skipopt(')');
47
delta_t = t2 - t1;
48
t = render_priv->time - render_priv->state.event->Start;
49
if (t < t1)
50
51
mystrtod(&p, &v1);
52
skip(',');
53
mystrtod(&p, &v2);
54
- skip(')');
55
+ skipopt(')');
56
ass_msg(render_priv->library, MSGL_DBG2, "pos(%f, %f)", v1, v2);
57
if (render_priv->state.evt_type == EVENT_POSITIONED) {
58
ass_msg(render_priv->library, MSGL_V, "Subtitle has a new \\pos "
59
60
skip(',');
61
mystrtoll(&p, &t4);
62
}
63
- skip(')');
64
+ skipopt(')');
65
if ((render_priv->state.parsed_tags & PARSED_FADE) == 0) {
66
render_priv->state.fade =
67
interpolate_alpha(render_priv->time -
68
69
mystrtoi(&p, &v1);
70
skip(',');
71
mystrtoi(&p, &v2);
72
- skip(')');
73
+ skipopt(')');
74
ass_msg(render_priv->library, MSGL_DBG2, "org(%d, %d)", v1, v2);
75
if (!render_priv->state.have_origin) {
76
render_priv->state.org_x = v1;
77
78
double k;
79
skip('(');
80
for (cnt = 0; cnt < 3; ++cnt) {
81
- if (*p == '\\')
82
+ if (!mystrtod(&p, &v[cnt]))
83
break;
84
- mystrtod(&p, &v[cnt]);
85
skip(',');
86
}
87
if (cnt == 3) {
88
89
assert(delta_t != 0.);
90
k = pow(((double) (t - t1)) / delta_t, v3);
91
}
92
- while (*p == '\\')
93
+ while (*p != ')' && *p != '}' && *p != '\0')
94
p = parse_tag(render_priv, p, k); // maybe k*pwr ? no, specs forbid nested \t's
95
skip_to(')'); // in case there is some unknown tag or a comment
96
- skip(')');
97
+ skipopt(')');
98
} else if (mystrcmp(&p, "clip")) {
99
char *start = p;
100
int x0, y0, x1, y1;
101
int res = 1;
102
- skipopt('(');
103
+ skip('(');
104
res &= mystrtoi(&p, &x0);
105
skipopt(',');
106
res &= mystrtoi(&p, &y0);
107
108
strncpy(style, start, p - start);
109
style[p - start] = '\0';
110
reset_render_context(render_priv,
111
- render_priv->track->styles + lookup_style(render_priv->track, style));
112
+ lookup_style_strict(render_priv->track, style));
113
free(style);
114
} else
115
reset_render_context(render_priv, NULL);
116
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_render.c -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_render.c
Changed
201
1
2
static ASS_Image **render_glyph_i(ASS_Renderer *render_priv,
3
Bitmap *bm, int dst_x, int dst_y,
4
uint32_t color, uint32_t color2, int brk,
5
- ASS_Image **tail)
6
+ ASS_Image **tail, unsigned int type)
7
{
8
int i, j, x0, y0, x1, y1, cx0, cy0, cx1, cy1, sx, sy, zx, zy;
9
Rect r[4];
10
11
lbrk - r[j].x0, r[j].y1 - r[j].y0,
12
bm->stride, dst_x + r[j].x0, dst_y + r[j].y0, color);
13
if (!img) break;
14
+ img->type = type;
15
*tail = img;
16
tail = &img->next;
17
}
18
19
r[j].x1 - lbrk, r[j].y1 - r[j].y0,
20
bm->stride, dst_x + lbrk, dst_y + r[j].y0, color2);
21
if (!img) break;
22
+ img->type = type;
23
*tail = img;
24
tail = &img->next;
25
}
26
27
*/
28
static ASS_Image **
29
render_glyph(ASS_Renderer *render_priv, Bitmap *bm, int dst_x, int dst_y,
30
- uint32_t color, uint32_t color2, int brk, ASS_Image **tail)
31
+ uint32_t color, uint32_t color2, int brk, ASS_Image **tail, unsigned int type)
32
{
33
// Inverse clipping in use?
34
if (render_priv->state.clip_mode)
35
return render_glyph_i(render_priv, bm, dst_x, dst_y, color, color2,
36
- brk, tail);
37
+ brk, tail, type);
38
39
// brk is relative to dst_x
40
// color = color left of brk
41
42
brk - b_x0, b_y1 - b_y0, bm->stride,
43
dst_x + b_x0, dst_y + b_y0, color);
44
if (!img) return tail;
45
+ img->type = type;
46
*tail = img;
47
tail = &img->next;
48
}
49
50
b_x1 - brk, b_y1 - b_y0, bm->stride,
51
dst_x + brk, dst_y + b_y0, color2);
52
if (!img) return tail;
53
+ img->type = type;
54
*tail = img;
55
tail = &img->next;
56
}
57
58
ASS_Drawing *drawing = render_priv->state.clip_drawing;
59
BitmapHashKey key;
60
BitmapHashValue *val;
61
- int error;
62
63
if (!drawing)
64
return;
65
66
67
clip_bm = outline_to_bitmap(render_priv->library,
68
render_priv->ftlibrary, outline, 0);
69
- if (clip_bm == NULL) {
70
- ass_msg(render_priv->library, MSGL_WARN,
71
- "Clip vector rasterization failed: %d. Skipping.", error);
72
- }
73
74
// Add to cache
75
memset(&v, 0, sizeof(v));
76
77
render_priv->state.clip_drawing = 0;
78
}
79
80
+#define IS_SKIP_SYMBOL(x) ((x) == 0 || (x) == '\n' || (x) == '\r')
81
+
82
/**
83
* \brief Convert TextInfo struct to ASS_Image list
84
* Splits glyphs in halves when needed (for \kf karaoke).
85
86
87
for (i = 0; i < text_info->length; ++i) {
88
GlyphInfo *info = text_info->glyphs + i;
89
- if ((info->symbol == 0) || (info->symbol == '\n') || !info->bm_s
90
+ if (IS_SKIP_SYMBOL(info->symbol) || !info->bm_s
91
|| (info->shadow_x == 0 && info->shadow_y == 0) || info->skip)
92
continue;
93
94
95
here_tail = tail;
96
tail =
97
render_glyph(render_priv, bm, pen_x, pen_y, info->c[3], 0,
98
- 1000000, tail);
99
+ 1000000, tail, IMAGE_TYPE_SHADOW);
100
101
if (last_tail && tail != here_tail && ((info->c[3] & 0xff) > 0))
102
render_overlap(render_priv, last_tail, here_tail);
103
104
last_tail = 0;
105
for (i = 0; i < text_info->length; ++i) {
106
GlyphInfo *info = text_info->glyphs + i;
107
- if ((info->symbol == 0) || (info->symbol == '\n') || !info->bm_o
108
+ if (IS_SKIP_SYMBOL(info->symbol) || !info->bm_o
109
|| info->skip)
110
continue;
111
112
113
here_tail = tail;
114
tail =
115
render_glyph(render_priv, bm, pen_x, pen_y, info->c[2],
116
- 0, 1000000, tail);
117
+ 0, 1000000, tail, IMAGE_TYPE_OUTLINE);
118
if (last_tail && tail != here_tail && ((info->c[2] & 0xff) > 0))
119
render_overlap(render_priv, last_tail, here_tail);
120
121
122
123
for (i = 0; i < text_info->length; ++i) {
124
GlyphInfo *info = text_info->glyphs + i;
125
- if ((info->symbol == 0) || (info->symbol == '\n') || !info->bm
126
+ if (IS_SKIP_SYMBOL(info->symbol) || !info->bm
127
|| info->skip)
128
continue;
129
130
131
if (info->effect_timing > (info->bbox.xMax >> 6))
132
tail =
133
render_glyph(render_priv, bm, pen_x, pen_y,
134
- info->c[0], 0, 1000000, tail);
135
+ info->c[0], 0, 1000000, tail, IMAGE_TYPE_CHARACTER);
136
else
137
tail =
138
render_glyph(render_priv, bm, pen_x, pen_y,
139
- info->c[1], 0, 1000000, tail);
140
+ info->c[1], 0, 1000000, tail, IMAGE_TYPE_CHARACTER);
141
} else if (info->effect_type == EF_KARAOKE_KF) {
142
tail =
143
render_glyph(render_priv, bm, pen_x, pen_y, info->c[0],
144
- info->c[1], info->effect_timing, tail);
145
+ info->c[1], info->effect_timing, tail, IMAGE_TYPE_CHARACTER);
146
} else
147
tail =
148
render_glyph(render_priv, bm, pen_x, pen_y, info->c[0],
149
- 0, 1000000, tail);
150
+ 0, 1000000, tail, IMAGE_TYPE_CHARACTER);
151
info = info->next;
152
}
153
}
154
155
render_priv->state.scale_y = style->ScaleY;
156
render_priv->state.hspacing = style->Spacing;
157
render_priv->state.be = 0;
158
- render_priv->state.blur = 0.0;
159
+ render_priv->state.blur = style->Blur;
160
render_priv->state.shadow_x = style->Shadow;
161
render_priv->state.shadow_y = style->Shadow;
162
render_priv->state.frx = render_priv->state.fry = 0.;
163
164
* Replace the outline of a glyph by a contour which makes up a simple
165
* opaque rectangle.
166
*/
167
-static void draw_opaque_box(ASS_Renderer *render_priv, int asc, int desc,
168
- FT_Outline *ol, FT_Vector advance, int sx, int sy)
169
+static void draw_opaque_box(ASS_Renderer *render_priv, GlyphInfo *info,
170
+ int asc, int desc, FT_Outline *ol,
171
+ FT_Vector advance, int sx, int sy)
172
{
173
int i;
174
int adv = advance.x;
175
- double scale_y = render_priv->state.scale_y;
176
- double scale_x = render_priv->state.scale_x;
177
+ double scale_y = info->orig_scale_y;
178
+ double scale_x = info->orig_scale_x;
179
180
// to avoid gaps
181
sx = FFMAX(64, sx);
182
183
184
// Emulate the WTFish behavior of VSFilter, i.e. double-scale
185
// the sizes of the opaque box.
186
- adv += double_to_d6(render_priv->state.hspacing * render_priv->font_scale
187
- * scale_x);
188
+ adv += double_to_d6(info->hspacing * render_priv->font_scale * scale_x);
189
adv *= scale_x;
190
sx *= scale_x;
191
sy *= scale_y;
192
193
v.desc = drawing->desc;
194
key.u.drawing.text = strdup(drawing->text);
195
} else {
196
- // arbitrary, not too small to prevent grid fitting rounding effects
197
- // XXX: this is a rather crude hack
198
- const double ft_size = 256.0;
199
- ass_face_set_size(info->font->faces[info->face_index], ft_size);
200
- ass_font_set_transform(info->font,
201
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_render.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_render.h
Changed
65
1
2
#include FT_STROKER_H
3
#include FT_GLYPH_H
4
#include FT_SYNTHESIS_H
5
+#ifdef CONFIG_HARFBUZZ
6
+#include "hb.h"
7
+#endif
8
9
// XXX: fix the inclusion mess so we can avoid doing this here
10
typedef struct ass_shaper ASS_Shaper;
11
12
typedef struct {
13
int frame_width;
14
int frame_height;
15
+ int storage_width; // width of the source image
16
+ int storage_height; // height of the source image
17
double font_size_coeff; // font size multiplier
18
double line_spacing; // additional line spacing (in frame pixels)
19
double line_position; // vertical position for subtitles, 0-100 (0 = no change)
20
21
int right_margin;
22
int use_margins; // 0 - place all subtitles inside original frame
23
// 1 - use margins for placing toptitles and subtitles
24
- double aspect; // frame aspect ratio, d_width / d_height.
25
- double storage_aspect; // pixel ratio of the source image
26
+ double par; // user defined pixel aspect ratio (0 = unset)
27
ASS_Hinting hinting;
28
ASS_ShapingLevel shaper;
29
30
31
ASS_Font *font;
32
int face_index;
33
int glyph_index;
34
+#ifdef CONFIG_HARFBUZZ
35
+ hb_script_t script;
36
+#else
37
+ int script;
38
+#endif
39
double font_size;
40
ASS_Drawing *drawing;
41
FT_Outline *outline;
42
43
double frx, fry, frz; // rotation
44
double fax, fay; // text shearing
45
double scale_x, scale_y;
46
+ double orig_scale_x, orig_scale_y; // scale_x,y before fix_glyph_scaling
47
int border_style;
48
double border_x, border_y;
49
double hspacing;
50
51
int orig_width; // frame width ( = screen width - margins )
52
int orig_height_nocrop; // frame height ( = screen height - margins + cropheight)
53
int orig_width_nocrop; // frame width ( = screen width - margins + cropwidth)
54
+ int storage_height; // video height before any rescaling
55
+ int storage_width; // video width before any rescaling
56
ASS_Track *track;
57
long long time; // frame's timestamp, ms
58
double font_scale;
59
double font_scale_x; // x scale applied to all glyphs to preserve text aspect ratio
60
double border_scale;
61
+ double blur_scale;
62
63
RenderContext state;
64
TextInfo text_info;
65
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_render_api.c -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_render_api.c
Changed
53
1
2
priv->orig_height_nocrop =
3
settings->frame_height - FFMAX(settings->top_margin, 0) -
4
FFMAX(settings->bottom_margin, 0);
5
+ if (settings->storage_height) {
6
+ priv->storage_width = settings->storage_width;
7
+ priv->storage_height = settings->storage_height;
8
+ } else {
9
+ priv->storage_width = priv->orig_width;
10
+ priv->storage_height = priv->orig_height;
11
+ }
12
}
13
14
void ass_set_frame_size(ASS_Renderer *priv, int w, int h)
15
16
if (priv->settings.frame_width != w || priv->settings.frame_height != h) {
17
priv->settings.frame_width = w;
18
priv->settings.frame_height = h;
19
- if (priv->settings.aspect == 0.) {
20
- priv->settings.aspect = ((double) w) / h;
21
- priv->settings.storage_aspect = ((double) w) / h;
22
- }
23
+ ass_reconfigure(priv);
24
+ }
25
+}
26
+
27
+void ass_set_storage_size(ASS_Renderer *priv, int w, int h)
28
+{
29
+ if (priv->settings.storage_width != w ||
30
+ priv->settings.storage_height != h) {
31
+ priv->settings.storage_width = w;
32
+ priv->settings.storage_height = h;
33
ass_reconfigure(priv);
34
}
35
}
36
37
38
void ass_set_aspect_ratio(ASS_Renderer *priv, double dar, double sar)
39
{
40
- if (priv->settings.aspect != dar || priv->settings.storage_aspect != sar) {
41
- priv->settings.aspect = dar;
42
- priv->settings.storage_aspect = sar;
43
+ ass_set_pixel_aspect(priv, dar / sar);
44
+}
45
+
46
+void ass_set_pixel_aspect(ASS_Renderer *priv, double par)
47
+{
48
+ if (priv->settings.par != par) {
49
+ priv->settings.par = par;
50
ass_reconfigure(priv);
51
}
52
}
53
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_shaper.c -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_shaper.c
Changed
201
1
2
3
#include "config.h"
4
5
-#include <fribidi/fribidi.h>
6
-
7
#include "ass_shaper.h"
8
#include "ass_render.h"
9
#include "ass_font.h"
10
11
return NULL;
12
13
memcpy(&new_val.metrics, &face->glyph->metrics, sizeof(FT_Glyph_Metrics));
14
+
15
+ // if @font rendering is enabled and the glyph should be rotated,
16
+ // make cached_h_advance pick up the right advance later
17
+ if (metrics->vertical && glyph >= VERTICAL_LOWER_BOUND)
18
+ new_val.metrics.horiAdvance = new_val.metrics.vertAdvance;
19
+
20
val = ass_cache_put(metrics->metrics_cache, &metrics->hash_key, &new_val);
21
}
22
23
24
if (!metrics)
25
return 0;
26
27
- if (metrics_priv->vertical && glyph > VERTICAL_LOWER_BOUND)
28
- return metrics->metrics.vertAdvance;
29
-
30
return metrics->metrics.horiAdvance;
31
}
32
33
34
font->faces[info->face_index], NULL);
35
}
36
37
- // XXX: this is a rather crude hack
38
- const double ft_size = 256.0;
39
- ass_face_set_size(font->faces[info->face_index], ft_size);
40
+ ass_face_set_size(font->faces[info->face_index], info->font_size);
41
update_hb_size(hb_fonts[info->face_index], font->faces[info->face_index]);
42
43
// update hash key for cached metrics
44
45
}
46
47
/**
48
+ * \brief Map script to default language.
49
+ *
50
+ * This maps a script to a language, if a script has a representative
51
+ * language it is typically used with. Otherwise, the invalid language
52
+ * is returned.
53
+ *
54
+ * The mapping is similar to Pango's pango-language.c.
55
+ *
56
+ * \param script script tag
57
+ * \return language tag
58
+ */
59
+static hb_language_t script_to_language(hb_script_t script)
60
+{
61
+ switch (script) {
62
+ // Unicode 1.1
63
+ case HB_SCRIPT_ARABIC: return hb_language_from_string("ar", -1); break;
64
+ case HB_SCRIPT_ARMENIAN: return hb_language_from_string("hy", -1); break;
65
+ case HB_SCRIPT_BENGALI: return hb_language_from_string("bn", -1); break;
66
+ case HB_SCRIPT_CANADIAN_ABORIGINAL: return hb_language_from_string("iu", -1); break;
67
+ case HB_SCRIPT_CHEROKEE: return hb_language_from_string("chr", -1); break;
68
+ case HB_SCRIPT_COPTIC: return hb_language_from_string("cop", -1); break;
69
+ case HB_SCRIPT_CYRILLIC: return hb_language_from_string("ru", -1); break;
70
+ case HB_SCRIPT_DEVANAGARI: return hb_language_from_string("hi", -1); break;
71
+ case HB_SCRIPT_GEORGIAN: return hb_language_from_string("ka", -1); break;
72
+ case HB_SCRIPT_GREEK: return hb_language_from_string("el", -1); break;
73
+ case HB_SCRIPT_GUJARATI: return hb_language_from_string("gu", -1); break;
74
+ case HB_SCRIPT_GURMUKHI: return hb_language_from_string("pa", -1); break;
75
+ case HB_SCRIPT_HANGUL: return hb_language_from_string("ko", -1); break;
76
+ case HB_SCRIPT_HEBREW: return hb_language_from_string("he", -1); break;
77
+ case HB_SCRIPT_HIRAGANA: return hb_language_from_string("ja", -1); break;
78
+ case HB_SCRIPT_KANNADA: return hb_language_from_string("kn", -1); break;
79
+ case HB_SCRIPT_KATAKANA: return hb_language_from_string("ja", -1); break;
80
+ case HB_SCRIPT_LAO: return hb_language_from_string("lo", -1); break;
81
+ case HB_SCRIPT_LATIN: return hb_language_from_string("en", -1); break;
82
+ case HB_SCRIPT_MALAYALAM: return hb_language_from_string("ml", -1); break;
83
+ case HB_SCRIPT_MONGOLIAN: return hb_language_from_string("mn", -1); break;
84
+ case HB_SCRIPT_ORIYA: return hb_language_from_string("or", -1); break;
85
+ case HB_SCRIPT_SYRIAC: return hb_language_from_string("syr", -1); break;
86
+ case HB_SCRIPT_TAMIL: return hb_language_from_string("ta", -1); break;
87
+ case HB_SCRIPT_TELUGU: return hb_language_from_string("te", -1); break;
88
+ case HB_SCRIPT_THAI: return hb_language_from_string("th", -1); break;
89
+
90
+ // Unicode 2.0
91
+ case HB_SCRIPT_TIBETAN: return hb_language_from_string("bo", -1); break;
92
+
93
+ // Unicode 3.0
94
+ case HB_SCRIPT_ETHIOPIC: return hb_language_from_string("am", -1); break;
95
+ case HB_SCRIPT_KHMER: return hb_language_from_string("km", -1); break;
96
+ case HB_SCRIPT_MYANMAR: return hb_language_from_string("my", -1); break;
97
+ case HB_SCRIPT_SINHALA: return hb_language_from_string("si", -1); break;
98
+ case HB_SCRIPT_THAANA: return hb_language_from_string("dv", -1); break;
99
+
100
+ // Unicode 3.2
101
+ case HB_SCRIPT_BUHID: return hb_language_from_string("bku", -1); break;
102
+ case HB_SCRIPT_HANUNOO: return hb_language_from_string("hnn", -1); break;
103
+ case HB_SCRIPT_TAGALOG: return hb_language_from_string("tl", -1); break;
104
+ case HB_SCRIPT_TAGBANWA: return hb_language_from_string("tbw", -1); break;
105
+
106
+ // Unicode 4.0
107
+ case HB_SCRIPT_UGARITIC: return hb_language_from_string("uga", -1); break;
108
+
109
+ // Unicode 4.1
110
+ case HB_SCRIPT_BUGINESE: return hb_language_from_string("bug", -1); break;
111
+ case HB_SCRIPT_OLD_PERSIAN: return hb_language_from_string("peo", -1); break;
112
+ case HB_SCRIPT_SYLOTI_NAGRI: return hb_language_from_string("syl", -1); break;
113
+
114
+ // Unicode 5.0
115
+ case HB_SCRIPT_NKO: return hb_language_from_string("nko", -1); break;
116
+
117
+ // no representative language exists
118
+ default: return HB_LANGUAGE_INVALID; break;
119
+ }
120
+}
121
+
122
+/**
123
+ * \brief Determine language to be used for shaping a run.
124
+ *
125
+ * \param shaper shaper instance
126
+ * \param script script tag associated with run
127
+ * \return language tag
128
+ */
129
+static hb_language_t
130
+hb_shaper_get_run_language(ASS_Shaper *shaper, hb_script_t script)
131
+{
132
+ hb_language_t lang;
133
+
134
+ // override set, use it
135
+ if (shaper->language != HB_LANGUAGE_INVALID)
136
+ return shaper->language;
137
+
138
+ // get default language for given script
139
+ lang = script_to_language(script);
140
+
141
+ // no dice, use system default
142
+ if (lang == HB_LANGUAGE_INVALID)
143
+ lang = hb_language_get_default();
144
+
145
+ return lang;
146
+}
147
+
148
+/**
149
* \brief Shape event text with HarfBuzz. Full OpenType shaping.
150
* \param glyphs glyph clusters
151
* \param len number of clusters
152
153
hb_buffer_t *buf;
154
hb_font_t *font;
155
} runs[MAX_RUNS];
156
- const double ft_size = 256.0;
157
158
for (i = 0; i < len && run < MAX_RUNS; i++, run++) {
159
// get length and level of the current run
160
int k = i;
161
int level = glyphs[i].shape_run_id;
162
int direction = shaper->emblevels[k] % 2;
163
+ hb_script_t script = glyphs[i].script;
164
while (i < (len - 1) && level == glyphs[i+1].shape_run_id)
165
i++;
166
runs[run].offset = k;
167
168
hb_buffer_pre_allocate(runs[run].buf, i - k + 1);
169
hb_buffer_set_direction(runs[run].buf, direction ? HB_DIRECTION_RTL :
170
HB_DIRECTION_LTR);
171
- hb_buffer_set_language(runs[run].buf, shaper->language);
172
+ hb_buffer_set_language(runs[run].buf,
173
+ hb_shaper_get_run_language(shaper, script));
174
+ hb_buffer_set_script(runs[run].buf, script);
175
hb_buffer_add_utf32(runs[run].buf, shaper->event_text + k, i - k + 1,
176
0, i - k + 1);
177
hb_shape(runs[run].font, runs[run].buf, shaper->features,
178
179
// set position and advance
180
info->skip = 0;
181
info->glyph_index = glyph_info[j].codepoint;
182
- info->offset.x = pos[j].x_offset * info->scale_x * (info->font_size / ft_size);
183
- info->offset.y = -pos[j].y_offset * info->scale_y * (info->font_size / ft_size);
184
- info->advance.x = pos[j].x_advance * info->scale_x * (info->font_size / ft_size);
185
- info->advance.y = -pos[j].y_advance * info->scale_y * (info->font_size / ft_size);
186
+ info->offset.x = pos[j].x_offset * info->scale_x;
187
+ info->offset.y = -pos[j].y_offset * info->scale_y;
188
+ info->advance.x = pos[j].x_advance * info->scale_x;
189
+ info->advance.y = -pos[j].y_advance * info->scale_y;
190
191
// accumulate advance in the root glyph
192
root->cluster_advance.x += info->advance.x;
193
194
}
195
196
}
197
+
198
+/**
199
+ * \brief Determine script property of all characters. Characters of script
200
+ * common and inherited get their script from their context.
201
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_shaper.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_shaper.h
Changed
10
1
2
3
#include "config.h"
4
5
-#include <fribidi/fribidi.h>
6
+#include <fribidi.h>
7
#include "ass_render.h"
8
9
void ass_shaper_info(ASS_Library *lib);
10
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_types.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_types.h
Changed
99
1
2
double ScaleX;
3
double ScaleY;
4
double Spacing;
5
- int Angle;
6
+ double Angle;
7
int BorderStyle;
8
double Outline;
9
double Shadow;
10
11
int MarginV;
12
int Encoding;
13
int treat_fontname_as_pattern;
14
+ double Blur;
15
} ASS_Style;
16
17
/*
18
19
ASS_RenderPriv *render_priv;
20
} ASS_Event;
21
22
+/**
23
+ * Support for (xy-)vsfilter mangled colors
24
+ *
25
+ * Generally, xy-vsfilter emulates the classic vsfilter behavior of
26
+ * rendering directly into the (usually YCbCr) video. vsfilter is
27
+ * hardcoded to use BT.601(TV) as target colorspace when converting
28
+ * the subtitle RGB color to the video colorspace. This led to major
29
+ * breakage when HDTV video was introduced: HDTV typically uses
30
+ * BT.709(TV), but vsfilter still used BT.601(TV) for conversion.
31
+ *
32
+ * This means classic vsfilter will mangle colors as follows:
33
+ *
34
+ * screen_rgb = bt_709tv_to_rgb(rgb_to_bt601tv(ass_rgb))
35
+ *
36
+ * Or in general:
37
+ *
38
+ * screen_rgb = video_csp_to_rgb(rgb_to_bt601tv(ass_rgb))
39
+ *
40
+ * where video_csp is the colorspace of the video with which the
41
+ * subtitle was muxed.
42
+ *
43
+ * xy-vsfilter did not fix this, but instead introduced explicit
44
+ * rules how colors were mangled by adding a "YCbCr Matrix" header.
45
+ * If this header specifies a real colorspace (like BT.601(TV) etc.),
46
+ * xy-vsfilter behaves exactly like vsfilter, but using the specified
47
+ * colorspace for conversion of ASS input RGB to screen RGB:
48
+ *
49
+ * screen_rgb = video_csp_to_rgb(rgb_to_ycbcr_header_csp(ass_rgb))
50
+ *
51
+ * Further, xy-vsfilter behaves like vsfilter with no changes if the header
52
+ * is missing.
53
+ *
54
+ * The special value "None" means untouched RGB values. Keep in mind that
55
+ * some version of xy-vsfilter are buggy and don't interpret this correctly.
56
+ * It appears some people are advocating that this header value is
57
+ * intended for situations where exact colors do not matter.
58
+ *
59
+ * Note that newer Aegisub versions (the main application to produce ASS
60
+ * subtitle scripts) have an option that tries not to mangle the colors. It
61
+ * is said that if the header is not set to BT.601(TV), the colors are
62
+ * supposed not to be mangled, even if the "YCbCr Matrix" header is not
63
+ * set to "None". In other words, the video colorspace as detected by
64
+ * Aegisub is the same as identified in the file header.
65
+ *
66
+ * In general, misinterpreting this header or not using it will lead to
67
+ * slightly different subtitle colors, which can matter if the subtitle
68
+ * attempts to match solid colored areas in the video.
69
+ *
70
+ * Note that libass doesn't change colors based on this header. It
71
+ * absolutely can't do that, because the video colorspace is required
72
+ * in order to handle this as intended by xy-vsfilter.
73
+ */
74
+typedef enum ASS_YCbCrMatrix {
75
+ YCBCR_DEFAULT = 0, // Header missing
76
+ YCBCR_UNKNOWN, // Header could not be parsed correctly
77
+ YCBCR_NONE, // "None" special value
78
+ YCBCR_BT601_TV,
79
+ YCBCR_BT601_PC,
80
+ YCBCR_BT709_TV,
81
+ YCBCR_BT709_PC,
82
+ YCBCR_SMPTE240M_TV,
83
+ YCBCR_SMPTE240M_PC,
84
+ YCBCR_FCC_TV,
85
+ YCBCR_FCC_PC
86
+} ASS_YCbCrMatrix;
87
+
88
/*
89
* ass track represent either an external script or a matroska subtitle stream
90
* (no real difference between them); it can be used in rendering after the
91
92
int ScaledBorderAndShadow;
93
int Kerning;
94
char *Language;
95
+ ASS_YCbCrMatrix YCbCrMatrix;
96
97
int default_style; // index of default style
98
char *name; // file name in case of external subs, 0 for streams
99
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_utils.c -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_utils.c
Changed
102
1
2
return 0;
3
}
4
5
+int parse_ycbcr_matrix(char *str)
6
+{
7
+ while (*str == ' ' || *str == '\t')
8
+ str++;
9
+ if (*str == '\0')
10
+ return YCBCR_DEFAULT;
11
+
12
+ char *end = str + strlen(str);
13
+ while (end[-1] == ' ' || end[-1] == '\t')
14
+ end--;
15
+
16
+ // Trim a local copy of the input that we know is safe to
17
+ // modify. The buffer is larger than any valid string + NUL,
18
+ // so we can simply chop off the rest of the input.
19
+ char buffer[16];
20
+ size_t n = FFMIN(end - str, sizeof buffer - 1);
21
+ strncpy(buffer, str, n);
22
+ buffer[n] = '\0';
23
+
24
+ if (!strcasecmp(buffer, "none"))
25
+ return YCBCR_NONE;
26
+ if (!strcasecmp(buffer, "tv.601"))
27
+ return YCBCR_BT601_TV;
28
+ if (!strcasecmp(buffer, "pc.601"))
29
+ return YCBCR_BT601_PC;
30
+ if (!strcasecmp(buffer, "tv.709"))
31
+ return YCBCR_BT709_TV;
32
+ if (!strcasecmp(buffer, "pc.709"))
33
+ return YCBCR_BT709_PC;
34
+ if (!strcasecmp(buffer, "tv.240m"))
35
+ return YCBCR_SMPTE240M_TV;
36
+ if (!strcasecmp(buffer, "pc.240m"))
37
+ return YCBCR_SMPTE240M_PC;
38
+ if (!strcasecmp(buffer, "tv.fcc"))
39
+ return YCBCR_FCC_TV;
40
+ if (!strcasecmp(buffer, "pc.fcc"))
41
+ return YCBCR_FCC_PC;
42
+ return YCBCR_UNKNOWN;
43
+}
44
+
45
void ass_msg(ASS_Library *priv, int lvl, char *fmt, ...)
46
{
47
va_list va;
48
49
* \param track track
50
* \param name style name
51
* \return index in track->styles
52
- * Returnes 0 if no styles found => expects at least 1 style.
53
- * Parsing code always adds "Default" style in the end.
54
+ * Returns 0 if no styles found => expects at least 1 style.
55
+ * Parsing code always adds "Default" style in the beginning.
56
*/
57
int lookup_style(ASS_Track *track, char *name)
58
{
59
int i;
60
- if (*name == '*')
61
- ++name; // FIXME: what does '*' really mean ?
62
+ // '*' seem to mean literally nothing;
63
+ // VSFilter removes them as soon as it can
64
+ while (*name == '*')
65
+ ++name;
66
+ // VSFilter then normalizes the case of "Default"
67
+ // (only in contexts where this function is called)
68
+ if (strcasecmp(name, "Default") == 0)
69
+ name = "Default";
70
for (i = track->n_styles - 1; i >= 0; --i) {
71
if (strcmp(track->styles[i].Name, name) == 0)
72
return i;
73
74
ass_msg(track->library, MSGL_WARN,
75
"[%p]: Warning: no style named '%s' found, using '%s'",
76
track, name, track->styles[i].Name);
77
- return i; // use the first style
78
+ return i;
79
+}
80
+
81
+/**
82
+ * \brief find style by name as in \r
83
+ * \param track track
84
+ * \param name style name
85
+ * \return style in track->styles
86
+ * Returns NULL if no style has the given name.
87
+ */
88
+ASS_Style *lookup_style_strict(ASS_Track *track, char *name)
89
+{
90
+ int i;
91
+ for (i = track->n_styles - 1; i >= 0; --i) {
92
+ if (strcmp(track->styles[i].Name, name) == 0)
93
+ return track->styles + i;
94
+ }
95
+ ass_msg(track->library, MSGL_WARN,
96
+ "[%p]: Warning: no style named '%s' found",
97
+ track, name);
98
+ return NULL;
99
}
100
101
#ifdef CONFIG_ENCA
102
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_utils.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/ass_utils.h
Changed
13
1
2
int mystrtod(char **p, double *res);
3
int strtocolor(ASS_Library *library, char **q, uint32_t *res, int hex);
4
char parse_bool(char *str);
5
+int parse_ycbcr_matrix(char *str);
6
unsigned ass_utf8_get_char(char **str);
7
void ass_msg(ASS_Library *priv, int lvl, char *fmt, ...);
8
int lookup_style(ASS_Track *track, char *name);
9
+ASS_Style *lookup_style_strict(ASS_Track *track, char *name);
10
#ifdef CONFIG_ENCA
11
void *ass_guess_buffer_cp(ASS_Library *library, unsigned char *buffer,
12
int buflen, char *preferred_language,
13
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/libass.sym -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_libass/libass.sym
Changed
14
1
2
ass_renderer_init
3
ass_renderer_done
4
ass_set_frame_size
5
+ass_set_storage_size
6
ass_set_margins
7
ass_set_use_margins
8
ass_set_aspect_ratio
9
10
ass_flush_events
11
ass_set_shaper
12
ass_set_line_position
13
+ass_set_pixel_aspect
14
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_vidASS.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/ADM_vidASS.cpp
Changed
123
1
2
3
#include "ass_ssa.h"
4
#include "ass_ssa_desc.cpp"
5
+#include "ADM_coreSubtitles/inc/ADM_coreSubtitles.h"
6
7
extern "C"
8
{
9
10
11
// Add the hook to make it valid plugin
12
DECLARE_VIDEO_FILTER( subAss, // Class
13
- 1,0,0, // Version
14
+ 1,0,1, // Version
15
ADM_UI_ALL, // UI
16
VF_SUBTITLE, // Category
17
"ssa", // internal name (must be uniq!)
18
- QT_TRANSLATE_NOOP("ass","SSA."), // Display name
19
- QT_TRANSLATE_NOOP("ass","Hardcode ass/ssa subtitles using libass.") // Description
20
+ QT_TRANSLATE_NOOP("ass","SSA/ASS/SRT"), // Display name
21
+ QT_TRANSLATE_NOOP("ass","Hardcode ass/ssa/srt subtitles using libass.") // Description
22
);
23
24
25
26
/**
27
\fn ctor
28
*/
29
-subAss::subAss( ADM_coreVideoFilter *in,CONFcouple *setup) : ADM_coreVideoFilter(in,setup)
30
-{
31
- if(!setup || !ADM_paramLoad(setup,ass_ssa_param,¶m))
32
- {
33
- param.font_scale = 1.;
34
- param.line_spacing = param.topMargin = param.bottomMargin = 0;
35
- param.subtitleFile = NULL;
36
- param.fontDirectory = ADM_strdup(DEFAULT_FONT_DIR);
37
- param.extractEmbeddedFonts = 1;
38
+subAss::subAss( ADM_coreVideoFilter *in,CONFcouple *setup) : ADM_coreVideoFilter(in,setup) {
39
+ if (!setup || !ADM_paramLoad(setup, ass_ssa_param, ¶m)) {
40
+ param.font_scale = 1.;
41
+ param.line_spacing = param.topMargin = param.bottomMargin = 0;
42
+ param.subtitleFile = NULL;
43
+ param.fontDirectory = ADM_strdup(DEFAULT_FONT_DIR);
44
+ param.extractEmbeddedFonts = 1;
45
}
46
- src=new ADMImageDefault(in->getInfo()->width,in->getInfo()->height);
47
+ src = new ADMImageDefault(in->getInfo()->width, in->getInfo()->height);
48
49
- /* ASS initialization */
50
- _ass_lib = NULL;
51
- _ass_track = NULL;
52
- _ass_rend = NULL;
53
+ /* ASS initialization */
54
+ _ass_lib = NULL;
55
+ _ass_track = NULL;
56
+ _ass_rend = NULL;
57
58
- if(param.subtitleFile)
59
- {
60
- if(!this->setup())
61
- {
62
- GUI_Error_HIG("Format ?","Are you sure this is an ass file ?");
63
- }
64
+ if (param.subtitleFile) {
65
+ if (!this->setup()) {
66
+ GUI_Error_HIG("Format ?", "Are you sure this is an ass file ?");
67
}
68
+ }
69
}
70
/**
71
\fn dtor
72
73
74
MKME(scale,font_scale);
75
MKME(spacing,line_spacing);
76
+ char newName[2*1024]; // should be a dynamic size..
77
78
diaElemFile file(0,(char **)PX(subtitleFile),QT_TRANSLATE_NOOP("ass","_Subtitle file (ASS/SSA):"), NULL, QT_TRANSLATE_NOOP("ass","Select Subtitle file"));
79
diaElemFloat dSpacing(&spacing,QT_TRANSLATE_NOOP("ass","_Line spacing:"),0.10,10.0);
80
81
diaElemUInteger dBottom(PX(bottomMargin),QT_TRANSLATE_NOOP("ass","Botto_m margin"),0,200);
82
83
diaElem *elems[5]={&file,&dSpacing,&dScale,&dTop,&dBottom};
84
-
85
+again:
86
if( diaFactoryRun(QT_TRANSLATE_NOOP("ass","ASS"),5,elems))
87
{
88
+ char *p=param.subtitleFile;
89
+ int l=strlen(p);
90
+ if(l>3 && !strcasecmp(p+l-4,".srt"))
91
+ {
92
+ if(!GUI_Question("This is a srt file. Convert to SSA ?"))
93
+ {
94
+ goto again;
95
+ }
96
+ ADM_subtitle sub;
97
+ if(!sub.load(p))
98
+ {
99
+ GUI_Error_HIG("Error","Cannot load this srt file.");
100
+ goto again;
101
+ }
102
+ if(false==sub.srt2ssa())
103
+ {
104
+ GUI_Error_HIG("Error","Cannot convert to ssa.");
105
+ goto again;
106
+ }
107
+
108
+ strcpy(newName,p);
109
+ strcpy(newName+l-4,".ssa");
110
+ if(false==sub.saveAsSSA(newName))
111
+ {
112
+ GUI_Error_HIG("Error","Cannot save converted file.");
113
+ goto again;
114
+ }
115
+ // all ok, we can now use the ssa file
116
+ strcpy(p,newName);
117
+ }
118
+
119
+
120
#undef MKME
121
#define MKME(x,y) param.y=(float)x
122
MKME(scale,font_scale);
123
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/CMakeLists.txt -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/ass/CMakeLists.txt
Changed
10
1
2
ADD_VIDEO_FILTER(ADM_vf_ssa ${ADM_vf_ssa_SRCS})
3
4
IF(DO_COMMON)
5
- TARGET_LINK_LIBRARIES(ADM_vf_ssa ADM_libass ${FREETYPE2_LDFLAGS} ${FRIDIBI_LDFLAGS})
6
+ TARGET_LINK_LIBRARIES(ADM_vf_ssa ADM_libass ${FREETYPE2_LDFLAGS} ${FRIDIBI_LDFLAGS} ADM_coreSubtitle)
7
# We force the use of fontconfig
8
ADD_DEFINITIONS("-DUSE_FONTCONFIG")
9
TARGET_LINK_LIBRARIES(ADM_vf_ssa ${FONTCONFIG_LDFLAGS})
10
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/avsfilter/avsfilter.cpp -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/avsfilter/avsfilter.cpp
Changed
201
1
2
#include "avsfilter.h"
3
#include "cdebug.h"
4
5
-#define AVSFILTER_VERSION_INFO "AvsFilter, ver 0.10"
6
+#define AVSFILTER_VERSION_INFO "AvsFilter, ver 0.12"
7
#define NOCOMPILE26
8
9
+bool use_adv_protocol_avsfilter_to_pipesource = false;
10
+bool use_adv_protocol_avsloader_to_avsfilter = false;
11
+
12
static WINE_LOADER *first_loader = NULL;
13
static AVSTerminate term;
14
15
16
17
sz1 = read(hr, &test_r1, sizeof(uint32_t));
18
19
- if (sz1 != sizeof(uint32_t) ||
20
- test_r1 != test_send) return false;
21
+ if (sz1 != sizeof(uint32_t) || (test_r1 != test_send)) return false;
22
23
return true;
24
}
25
26
DEBUG_PRINTF("avsfilter : test pipe to loader ok\n");
27
}
28
else
29
- goto error_pipe_test;
30
+ goto error_pipe_test;
31
}
32
else
33
{
34
35
}
36
37
bool avs_start(FilterInfo *info, FilterInfo *avisynth_info,
38
- char *fname, AVS_PIPES *avs_pipes)
39
+ char *fname, AVS_PIPES *avs_pipes, PITCH_DATA *pd_pipe_source, PITCH_DATA *pd_avsloader)
40
{
41
DEBUG_PRINTF("avsfilter : avs_start()\n");
42
DEBUG_PRINTF("avsfilter : %X %X %s %X\n",
43
44
aii.width = info->width;
45
aii.height = info->height;
46
aii.nb_frames = info->totalDuration / info->frameIncrement;
47
- aii.encoding = 1;
48
+ aii.encoding = MAGIC_ADV_PROTOCOL_VAL;
49
aii.codec = 0;
50
aii.fps1000 = ADM_Fps1000FromUs(info->frameIncrement);
51
aii.orgFrame = 0;
52
53
}
54
55
// get avisynth frame info
56
- PIPE_MSG_HEADER msg;
57
- if (!receive_cmd(avs_pipes[PIPE_LOADER_READ].hpipe,
58
- &msg) ||
59
- msg.avs_cmd != SET_CLIP_PARAMETER ||
60
- !receive_data(avs_pipes[PIPE_LOADER_READ].hpipe,
61
- &msg, &aio))
62
- {
63
- DEBUG_PRINTF_RED("avsfilter : cannot receive avisynth clip parameters\n");
64
- deinit_pipes(avs_pipes, CMD_PIPE_NUM);
65
- return false;
66
- }
67
+ PIPE_MSG_HEADER msg;
68
+ if (!receive_cmd(avs_pipes[PIPE_LOADER_READ].hpipe, &msg))
69
+ {
70
+ DEBUG_PRINTF_RED("avsfilter : cannot receive command (SEND_PITCH_DATA_PIPE_SOURCE, OR SET_CLIP_PARAMETER)\n");
71
+ deinit_pipes(avs_pipes, CMD_PIPE_NUM);
72
+ return false;
73
+ }
74
+
75
+ switch (msg.avs_cmd)
76
+ {
77
+ case SEND_PITCH_DATA_PIPE_SOURCE:
78
+ if (!receive_data(avs_pipes[PIPE_LOADER_READ].hpipe, &msg, pd_pipe_source))
79
+ {
80
+ DEBUG_PRINTF_RED("avsfilter : cannot receive SEND_PITCH_DATA_PIPE_SOURCE\n");
81
+ deinit_pipes(avs_pipes, CMD_PIPE_NUM);
82
+ return false;
83
+ }
84
+ DEBUG_PRINTF("avsfilter : receive SEND_PITCH_DATA_PIPE_SOURCE YUV = %d %d %d\n", pd_pipe_source->pitchY, pd_pipe_source->pitchU, pd_pipe_source->pitchV);
85
+ if (!receive_cmd(avs_pipes[PIPE_LOADER_READ].hpipe, &msg) ||
86
+ msg.avs_cmd != SET_CLIP_PARAMETER)
87
+ {
88
+ DEBUG_PRINTF_RED("avsfilter : cannot receive SET_CLIP_PARAMETER header message\n");
89
+ deinit_pipes(avs_pipes, CMD_PIPE_NUM);
90
+ return false;
91
+ }
92
+ case SET_CLIP_PARAMETER:
93
+ if (!receive_data(avs_pipes[PIPE_LOADER_READ].hpipe, &msg, &aio))
94
+ {
95
+ DEBUG_PRINTF_RED("avsfilter : cannot receive avisynth clip parameters\n");
96
+ deinit_pipes(avs_pipes, CMD_PIPE_NUM);
97
+ return false;
98
+ }
99
+ break;
100
+ default :
101
+ DEBUG_PRINTF_RED("avsfilter : receive unknown command %d\n", msg.avs_cmd);
102
+ deinit_pipes(avs_pipes, CMD_PIPE_NUM);
103
+ return false;
104
+ break;
105
+ }
106
107
DEBUG_PRINTF("avsfilter : receive ADV_Info from avsloader [fps1000 = %d, nb_frames = %d]\n", aio.fps1000, aio.nb_frames);
108
avisynth_info->width = aio.width;
109
avisynth_info->height = aio.height;
110
avisynth_info->frameIncrement = ADM_UsecFromFps1000(aio.fps1000);
111
avisynth_info->totalDuration = aio.nb_frames * avisynth_info->frameIncrement;
112
+ if (aio.encoding == MAGIC_ADV_PROTOCOL_VAL)
113
+ {
114
+ DEBUG_PRINTF("avsfilter : send GET_PITCH_DATA to avsloader\n");
115
+ if (!send_cmd(avs_pipes[PIPE_LOADER_WRITE].hpipe,
116
+ GET_PITCH_DATA, NULL, 0))
117
+ {
118
+ DEBUG_PRINTF_RED("avsfilter : cannot send GET_PITCH_DATA\n");
119
+ deinit_pipes(avs_pipes, CMD_PIPE_NUM);
120
+ return false;
121
+ }
122
+ }
123
124
// correct avisynth_info for span of frames, calculate fps change metrics
125
/* float k_fps;
126
127
#ifdef VERSION_2_5
128
129
DECLARE_VIDEO_FILTER(avsfilter,
130
- 0,0,10,
131
+ 0,0,12,
132
ADM_UI_ALL,
133
VF_MISC,
134
"avsfilter",
135
136
DEBUG_PRINTF("avsfilter : SetParameters !full_exact\n");
137
138
// matched only order (need reload with new script/geometry/etc)
139
- if (!avs_start(&info, &loader->output_info, (char*)newparam->avs_script, loader->avs_pipes))
140
+ if (!avs_start(&info, &loader->output_info, (char*)newparam->avs_script, loader->avs_pipes, &pd_pipe_source, &pd_avsloader))
141
{
142
DEBUG_PRINTF_RED("avsfilter : SetParameters fail avs_start\n");
143
delete_object(loader);
144
145
DEBUG_PRINTF("avsfilter : after constructor info : frameIncrement %lu totalDuration %llu\n",
146
info.frameIncrement, info.totalDuration);
147
148
+ if (_uncompressed->GetPitch(PLANAR_Y) == pd_pipe_source.pitchY &&
149
+ _uncompressed->GetPitch(PLANAR_U) == pd_pipe_source.pitchU &&
150
+ _uncompressed->GetPitch(PLANAR_V) == pd_pipe_source.pitchV)
151
+ {
152
+ use_adv_protocol_avsfilter_to_pipesource = true;
153
+ DEBUG_PRINTF("avsfilter : use_adv_protocol_avsfilter_to_pipesource = true\n");
154
+ }
155
+
156
// vidCache=new VideoCache(16,in);
157
}
158
159
160
DEBUG_PRINTF("avsfilter : getCoupledConf info #2: frameIncrement %lu totalDuration %llu\n",
161
info.frameIncrement, info.totalDuration);
162
return t;
163
-
164
+
165
/* CSET(wine_app);
166
CSET(avs_script);
167
CSET(avs_loader);
168
169
170
// send command to get filtered data
171
if (!send_cmd(wine_loader->avs_pipes[PIPE_LOADER_WRITE].hpipe,
172
- GET_FRAME, (void*)&fd,
173
+ use_adv_protocol_avsloader_to_avsfilter ? GET_FRAME_WITH_PITCH : GET_FRAME, (void*)&fd,
174
sizeof(FRAME_DATA)))
175
{
176
DEBUG_PRINTF_RED("avsfilter : error send GET_FRAME to avsloader\n");
177
178
179
// read all data from avsloader and pipe dll
180
PIPE_MSG_HEADER msg;
181
- while (receive_cmd(wine_loader->avs_pipes[PIPE_LOADER_READ].hpipe,
182
- &msg))
183
+ while (receive_cmd(wine_loader->avs_pipes[PIPE_LOADER_READ].hpipe, &msg))
184
{
185
switch(msg.avs_cmd)
186
{
187
+ case SEND_PITCH_DATA_AVSLOADER:
188
+ DEBUG_PRINTF("avsfilter : receive SEND_PITCH_DATA_AVSLOADER\n");
189
+ if (!receive_data(wine_loader->avs_pipes[PIPE_LOADER_READ].hpipe, &msg, &pd_avsloader))
190
+ {
191
+ DEBUG_PRINTF_RED("avsfilter : cannot get SEND_PITCH_DATA_AVSLOADER\n");
192
+ return 0;
193
+ }
194
+ DEBUG_PRINTF("avsfilter : receive SEND_PITCH_DATA_AVSLOADER YUV = %d %d %d\n", pd_avsloader.pitchY, pd_avsloader.pitchU, pd_avsloader.pitchV);
195
+ if (data->GetPitch(PLANAR_Y) == pd_avsloader.pitchY &&
196
+ data->GetPitch(PLANAR_U) == pd_avsloader.pitchU &&
197
+ data->GetPitch(PLANAR_V) == pd_avsloader.pitchV)
198
+ {
199
+ use_adv_protocol_avsloader_to_avsfilter = true;
200
+ DEBUG_PRINTF("avsfilter : use_adv_protocol_avsloader_to_avsfilter = true\n");
201
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/avsfilter/avsfilter.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/avsfilter/avsfilter.h
Changed
9
1
2
protected:
3
ADM_coreVideoFilter *in;
4
ADMImage *_uncompressed;
5
+ PITCH_DATA pd_pipe_source, pd_avsloader;
6
unsigned char *tmp_buf;
7
char *prefs_name; // pointer to filename with preferences
8
// VideoCache *vidCache;
9
avidemux_2.6.7.tar.gz/avidemux_plugins/ADM_videoFilters6/avsfilter/avspipecomm.h -> avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6/avsfilter/avspipecomm.h
Changed
34
1
2
GET_FRAME,
3
PUT_FRAME, //4
4
UNLOAD_AVS_SCRIPT,
5
- UNLOAD_AVS_LOADER
6
+ UNLOAD_AVS_LOADER,
7
+ SEND_PITCH_DATA_PIPE_SOURCE,
8
+ SEND_PITCH_DATA_AVSLOADER,
9
+ GET_PITCH_DATA,
10
+ GET_FRAME_WITH_PITCH,
11
+ PUT_FRAME_WITH_PITCH
12
} AVS_CMD;
13
14
typedef struct
15
16
unsigned char frame_data[0];
17
} FRAME_DATA;
18
19
+typedef struct
20
+{
21
+ uint32_t pitchY;
22
+ uint32_t pitchU;
23
+ uint32_t pitchV;
24
+}PITCH_DATA;
25
+
26
bool send_cmd(int hw, AVS_CMD cmd,
27
void *data, int sz);
28
29
30
int ppwrite(int h, void *data, int sz);
31
32
#define PIPE_MAX_TRANSFER_SZ 65536/2
33
+#define MAGIC_ADV_PROTOCOL_VAL 0xADBACEED
34
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy
Added
2
1
+(directory)
2
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/CMakeLists.txt
Added
28
1
2
+INCLUDE(vf_plugin)
3
+INCLUDE(vf_plugin_qt4gl)
4
+
5
+
6
+SET(LibGliphy_SRCS
7
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-arc.cc
8
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-arcs.cc
9
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-blob.cc
10
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-extents.cc
11
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-outline.cc
12
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-sdf.cc
13
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-shaders.cc
14
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-arc-bezier.hh
15
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-arcs-bezier.hh
16
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-common.hh
17
+${CMAKE_CURRENT_SOURCE_DIR}/glyphy/glyphy-geometry.hh
18
+)
19
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/glyphy)
20
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/)
21
+
22
+SET(ADM_vf_GlGlyphy_SRCS glGlyphy.cpp ${LibGliphy_SRCS})
23
+
24
+ADD_DEFINITIONS(-DPKGDATADIR="")
25
+
26
+INIT_VIDEO_FILTER_GLQT4(ADM_vf_GlGlyphy "${ADM_vf_GlGlyphy_SRCS}" "" "glGlyphy" )
27
+
28
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glGlyphy.cpp
Added
201
1
2
+/** *************************************************************************
3
+ \fn openGlFragmentSample.cpp
4
+ \brief simple fragment shader
5
+
6
+ That one is performing the same shader 3 times, one time per plane.
7
+
8
+
9
+ copyright : (C) 2011 by mean
10
+
11
+bench : 1280*720, null shader, 20 ms, 95% of it in download texture.
12
+ Download Texture
13
+ RGB2Y=5ms (MMX it)
14
+ toQimage=14 ms <<== TOO SLOW
15
+
16
+ ***************************************************************************/
17
+
18
+/***************************************************************************
19
+ * *
20
+ * This program is free software; you can redistribute it and/or modify *
21
+ * it under the terms of the GNU General Public License as published by *
22
+ * the Free Software Foundation; either version 2 of the License, or *
23
+ * (at your option) any later version. *
24
+ * *
25
+ ***************************************************************************/
26
+#include "ADM_openGL.h"
27
+#define ADM_LEGACY_PROGGY
28
+#include "ADM_default.h"
29
+#include "ADM_coreVideoFilterInternal.h"
30
+#include "T_openGL.h"
31
+#include "T_openGLFilter.h"
32
+#include "glGlyphy.h"
33
+#include "ADM_clock.h"
34
+/**
35
+
36
+*/
37
+
38
+//#define BENCH 1
39
+//#define BENCH_READTEXTURE
40
+
41
+
42
+/**
43
+ \class openGlSample
44
+*/
45
+class openGlSample : public ADM_coreVideoFilterQtGl
46
+{
47
+protected:
48
+protected:
49
+ //bool uploadTexture(ADMImage *image, ADM_PLANE plane);
50
+ bool render(ADMImage *image,ADM_PLANE plane,QGLFramebufferObject *fbo);
51
+ void tinyUploadTex(ADMImage *img, ADM_PLANE plane, GLuint tex,int texNum );
52
+public:
53
+ openGlSample(ADM_coreVideoFilter *previous,CONFcouple *conf);
54
+ ~openGlSample();
55
+
56
+ virtual const char *getConfiguration(void); /// Return current configuration as a human readable string
57
+ virtual bool getNextFrame(uint32_t *fn,ADMImage *image); /// Return the next image
58
+ // virtual FilterInfo *getInfo(void); /// Return picture parameters after this filter
59
+ virtual bool getCoupledConf(CONFcouple **couples) ; /// Return the current filter configuration
60
+ virtual void setCoupledConf(CONFcouple *couples);
61
+ virtual bool configure(void) {return true;} /// Start graphical user interface
62
+};
63
+
64
+// Add the hook to make it valid plugin
65
+DECLARE_VIDEO_FILTER( openGlSample, // Class
66
+ 1,0,0, // Version
67
+ ADM_UI_QT4+ADM_FEATURE_OPENGL, // UI
68
+ VF_OPENGL, // Category
69
+ "glsampleFragment", // internal name (must be uniq!)
70
+ "OpenGl Fragment Shader Sample", // Display name
71
+ "Run a fragment shader." // Description
72
+ );
73
+
74
+// Now implements the interesting parts
75
+/**
76
+ \fn openGlSample
77
+ \brief constructor
78
+*/
79
+openGlSample::openGlSample( ADM_coreVideoFilter *in,CONFcouple *setup) : ADM_coreVideoFilterQtGl(in,setup)
80
+{
81
+UNUSED_ARG(setup);
82
+ widget->makeCurrent();
83
+ fboY->bind();
84
+ printf("Compiling shader \n");
85
+ glProgramY = new QGLShaderProgram(context);
86
+ ADM_assert(glProgramY);
87
+ if ( !glProgramY->addShaderFromSourceCode(QGLShader::Fragment, myShaderY))
88
+ {
89
+ ADM_error("[GL Render] Fragment log: %s\n", glProgramY->log().toUtf8().constData());
90
+ ADM_assert(0);
91
+ }
92
+ if ( !glProgramY->link())
93
+ {
94
+ ADM_error("[GL Render] Link log: %s\n", glProgramY->log().toUtf8().constData());
95
+ ADM_assert(0);
96
+ }
97
+
98
+ if ( !glProgramY->bind())
99
+ {
100
+ ADM_error("[GL Render] Binding FAILED\n");
101
+ ADM_assert(0);
102
+ }
103
+ fboY->release();
104
+//
105
+ fboUV->bind();
106
+ printf("Compiling shader \n");
107
+ glProgramUV = new QGLShaderProgram(context);
108
+ ADM_assert(glProgramUV);
109
+ if ( !glProgramUV->addShaderFromSourceCode(QGLShader::Fragment, myShaderY))
110
+ {
111
+ ADM_error("[GL Render] Fragment log: %s\n", glProgramUV->log().toUtf8().constData());
112
+ ADM_assert(0);
113
+ }
114
+ if ( !glProgramUV->link())
115
+ {
116
+ ADM_error("[GL Render] Link log: %s\n", glProgramUV->log().toUtf8().constData());
117
+ ADM_assert(0);
118
+ }
119
+
120
+ if ( !glProgramUV->bind())
121
+ {
122
+ ADM_error("[GL Render] Binding FAILED\n");
123
+ ADM_assert(0);
124
+ }
125
+ fboUV->release();
126
+ widget->doneCurrent();
127
+
128
+}
129
+/**
130
+ \fn openGlSample
131
+ \brief destructor
132
+*/
133
+openGlSample::~openGlSample()
134
+{
135
+
136
+}
137
+
138
+/**
139
+ \fn getFrame
140
+ \brief Get a processed frame
141
+*/
142
+bool openGlSample::getNextFrame(uint32_t *fn,ADMImage *image)
143
+{
144
+ // since we do nothing, just get the output of previous filter
145
+ if(false==previousFilter->getNextFrame(fn,image))
146
+ {
147
+ ADM_warning("FlipFilter : Cannot get frame\n");
148
+ return false;
149
+ }
150
+ widget->makeCurrent();
151
+ glPushMatrix();
152
+ float angle=*fn;
153
+ angle=angle/40;
154
+
155
+ glProgramUV->setUniformValue("kernelSize", 1); // Do a convolution kernelSize*2+1 pixels
156
+ glProgramUV->setUniformValue("normalization", 4);
157
+ // size is the last one...
158
+ fboY->bind();
159
+ // upload kernel...
160
+
161
+ // here we go
162
+ tinyUploadTex(image,PLANAR_Y,GL_TEXTURE0,0);
163
+ render(image,PLANAR_Y,fboY);
164
+ downloadTexture(image,PLANAR_Y,fboY);
165
+ fboY->release();
166
+
167
+ fboUV->bind();
168
+ tinyUploadTex(image,PLANAR_U,GL_TEXTURE1,1);
169
+ glProgramUV->setUniformValue("myTexture", 1);
170
+ render(image,PLANAR_U,fboUV);
171
+ downloadTexture(image,PLANAR_U,fboUV);
172
+
173
+ tinyUploadTex(image,PLANAR_V,GL_TEXTURE2,2);
174
+ glProgramUV->setUniformValue("myTexture", 2);
175
+ render(image,PLANAR_V,fboUV);
176
+ downloadTexture(image,PLANAR_V,fboUV);
177
+ fboUV->release();
178
+ firstRun=false;
179
+ glPopMatrix();
180
+ widget->doneCurrent();
181
+
182
+ return true;
183
+}
184
+/**
185
+ \fn getCoupledConf
186
+ \brief Return our current configuration as couple name=value
187
+*/
188
+bool openGlSample::getCoupledConf(CONFcouple **couples)
189
+{
190
+ *couples=new CONFcouple(0); // Even if we dont have configuration we must allocate one
191
+ return true;
192
+}
193
+
194
+void openGlSample::setCoupledConf(CONFcouple *couples)
195
+{
196
+}
197
+/**
198
+ \fn getConfiguration
199
+ \brief Return current setting as a string
200
+*/
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glGlyphy.h
Added
31
1
2
+// Invert x & y
3
+static const char *myShaderY =
4
+ "#extension GL_ARB_texture_rectangle: enable\n"
5
+ "uniform sampler2DRect myTexture;\n"
6
+ "uniform int kernelSize;\n"
7
+ "uniform int normalization;\n"
8
+
9
+ "void main(void) {\n"
10
+ " int nx = (int)gl_TexCoord[0].x;\n"
11
+ " int ny = (int)gl_TexCoord[0].y;\n"
12
+ " float t = 0;\n"
13
+ " float mul;\n"
14
+ " int x,y;\n"
15
+ " for(y=-kernelSize;y<=kernelSize;y++)\n"
16
+ " {\n"
17
+ " for(x=-kernelSize;x<=kernelSize;x++)\n"
18
+ " {\n"
19
+ " if(0==x && 0==y){ mul=4;}\n"
20
+ " else if(0==x) {mul=-1;}\n"
21
+ " else if(0==y) {mul=-1;}\n"
22
+ " else {mul=0;}\n"
23
+ " t += mul*texture2DRect(myTexture, vec2(nx+x, ny+y)).r;\n"
24
+ " }\n"
25
+ " }\n"
26
+ " t=t/normalization;\n"
27
+ " t=t+texture2DRect(myTexture, vec2(nx, ny)).r;\n"
28
+ " gl_FragColor = vec4(t, t, t, 1.0);\n"
29
+ "}\n";
30
+
31
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glGlyphy.ui
Added
201
1
2
+<ui version="4.0" >
3
+ <class>resizeDialog</class>
4
+ <widget class="QDialog" name="resizeDialog" >
5
+ <property name="geometry" >
6
+ <rect>
7
+ <x>0</x>
8
+ <y>0</y>
9
+ <width>350</width>
10
+ <height>342</height>
11
+ </rect>
12
+ </property>
13
+ <property name="windowTitle" >
14
+ <string>Resize</string>
15
+ </property>
16
+ <layout class="QVBoxLayout" >
17
+ <property name="margin" >
18
+ <number>9</number>
19
+ </property>
20
+ <property name="spacing" >
21
+ <number>6</number>
22
+ </property>
23
+ <item>
24
+ <widget class="QGroupBox" name="groupBox_2" >
25
+ <property name="title" >
26
+ <string>Aspect Ratio</string>
27
+ </property>
28
+ <layout class="QVBoxLayout" >
29
+ <property name="margin" >
30
+ <number>9</number>
31
+ </property>
32
+ <property name="spacing" >
33
+ <number>6</number>
34
+ </property>
35
+ <item>
36
+ <widget class="QCheckBox" name="lockArCheckBox" >
37
+ <property name="text" >
38
+ <string>Lock Aspect Ratio</string>
39
+ </property>
40
+ <property name="checked" >
41
+ <bool>true</bool>
42
+ </property>
43
+ </widget>
44
+ </item>
45
+ <item>
46
+ <layout class="QHBoxLayout" >
47
+ <property name="margin" >
48
+ <number>0</number>
49
+ </property>
50
+ <property name="spacing" >
51
+ <number>6</number>
52
+ </property>
53
+ <item>
54
+ <widget class="QLabel" name="label_4" >
55
+ <property name="text" >
56
+ <string>Source:</string>
57
+ </property>
58
+ </widget>
59
+ </item>
60
+ <item>
61
+ <widget class="QComboBox" name="comboBoxSource" >
62
+ <item>
63
+ <property name="text" >
64
+ <string>1:1</string>
65
+ </property>
66
+ </item>
67
+ <item>
68
+ <property name="text" >
69
+ <string>4:3</string>
70
+ </property>
71
+ </item>
72
+ <item>
73
+ <property name="text" >
74
+ <string>16:9</string>
75
+ </property>
76
+ </item>
77
+ </widget>
78
+ </item>
79
+ <item>
80
+ <spacer>
81
+ <property name="orientation" >
82
+ <enum>Qt::Horizontal</enum>
83
+ </property>
84
+ <property name="sizeType" >
85
+ <enum>QSizePolicy::Fixed</enum>
86
+ </property>
87
+ <property name="sizeHint" >
88
+ <size>
89
+ <width>30</width>
90
+ <height>20</height>
91
+ </size>
92
+ </property>
93
+ </spacer>
94
+ </item>
95
+ <item>
96
+ <widget class="QLabel" name="label_3" >
97
+ <property name="text" >
98
+ <string>Destination:</string>
99
+ </property>
100
+ </widget>
101
+ </item>
102
+ <item>
103
+ <widget class="QComboBox" name="comboBoxDestination" >
104
+ <item>
105
+ <property name="text" >
106
+ <string>1:1</string>
107
+ </property>
108
+ </item>
109
+ <item>
110
+ <property name="text" >
111
+ <string>4:3</string>
112
+ </property>
113
+ </item>
114
+ <item>
115
+ <property name="text" >
116
+ <string>16:9</string>
117
+ </property>
118
+ </item>
119
+ </widget>
120
+ </item>
121
+ <item>
122
+ <spacer>
123
+ <property name="orientation" >
124
+ <enum>Qt::Horizontal</enum>
125
+ </property>
126
+ <property name="sizeHint" >
127
+ <size>
128
+ <width>40</width>
129
+ <height>20</height>
130
+ </size>
131
+ </property>
132
+ </spacer>
133
+ </item>
134
+ </layout>
135
+ </item>
136
+ </layout>
137
+ </widget>
138
+ </item>
139
+ <item>
140
+ <widget class="QGroupBox" name="groupBox" >
141
+ <property name="title" >
142
+ <string>Resize Dimensions</string>
143
+ </property>
144
+ <layout class="QVBoxLayout" >
145
+ <property name="margin" >
146
+ <number>9</number>
147
+ </property>
148
+ <property name="spacing" >
149
+ <number>6</number>
150
+ </property>
151
+ <item>
152
+ <layout class="QHBoxLayout" >
153
+ <property name="margin" >
154
+ <number>0</number>
155
+ </property>
156
+ <property name="spacing" >
157
+ <number>6</number>
158
+ </property>
159
+ <item>
160
+ <widget class="QLabel" name="label" >
161
+ <property name="text" >
162
+ <string>Width:</string>
163
+ </property>
164
+ </widget>
165
+ </item>
166
+ <item>
167
+ <widget class="QSpinBox" name="spinBoxWidth" >
168
+ <property name="maximum" >
169
+ <number>2900</number>
170
+ </property>
171
+ <property name="minimum" >
172
+ <number>16</number>
173
+ </property>
174
+ <property name="singleStep" >
175
+ <number>2</number>
176
+ </property>
177
+ </widget>
178
+ </item>
179
+ <item>
180
+ <spacer>
181
+ <property name="orientation" >
182
+ <enum>Qt::Horizontal</enum>
183
+ </property>
184
+ <property name="sizeType" >
185
+ <enum>QSizePolicy::Fixed</enum>
186
+ </property>
187
+ <property name="sizeHint" >
188
+ <size>
189
+ <width>30</width>
190
+ <height>20</height>
191
+ </size>
192
+ </property>
193
+ </spacer>
194
+ </item>
195
+ <item>
196
+ <widget class="QLabel" name="label_2" >
197
+ <property name="text" >
198
+ <string>Height:</string>
199
+ </property>
200
+ </widget>
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy
Added
2
1
+(directory)
2
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-arc-bezier.hh
Added
201
1
2
+/*
3
+ * Copyright 2012,2013 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju
18
+ */
19
+
20
+#ifndef GLYPHY_ARC_BEZIER_HH
21
+#define GLYPHY_ARC_BEZIER_HH
22
+
23
+#include "glyphy-common.hh"
24
+#include "glyphy-geometry.hh"
25
+
26
+namespace GLyphy {
27
+namespace ArcBezier {
28
+
29
+using namespace Geometry;
30
+
31
+
32
+class MaxDeviationApproximatorExact
33
+{
34
+ public:
35
+ /* Returns 3 max(abs(d₀ t (1-t)² + d₁ t² (1-t)) for 0≤t≤1. */
36
+ static double approximate_deviation (double d0, double d1)
37
+ {
38
+ double candidates[4] = {0,1};
39
+ unsigned int num_candidates = 2;
40
+ if (d0 == d1)
41
+ candidates[num_candidates++] = .5;
42
+ else {
43
+ double delta = d0*d0 - d0*d1 + d1*d1;
44
+ double t2 = 1. / (3 * (d0 - d1));
45
+ double t0 = (2 * d0 - d1) * t2;
46
+ if (delta == 0)
47
+ candidates[num_candidates++] = t0;
48
+ else if (delta > 0) {
49
+ /* This code can be optimized to avoid the sqrt if the solution
50
+ * is not feasible (ie. lies outside (0,1)). I have implemented
51
+ * that in cairo-spline.c:_cairo_spline_bound(). Can be reused
52
+ * here.
53
+ */
54
+ double t1 = sqrt (delta) * t2;
55
+ candidates[num_candidates++] = t0 - t1;
56
+ candidates[num_candidates++] = t0 + t1;
57
+ }
58
+ }
59
+
60
+ double e = 0;
61
+ for (unsigned int i = 0; i < num_candidates; i++) {
62
+ double t = candidates[i];
63
+ double ee;
64
+ if (t < 0. || t > 1.)
65
+ continue;
66
+ ee = fabs (3 * t * (1-t) * (d0 * (1 - t) + d1 * t));
67
+ e = std::max (e, ee);
68
+ }
69
+
70
+ return e;
71
+ }
72
+};
73
+
74
+
75
+
76
+template <class MaxDeviationApproximator>
77
+class ArcBezierErrorApproximatorBehdad
78
+{
79
+ public:
80
+ static double approximate_bezier_arc_error (const Bezier &b0, const Arc &a)
81
+ {
82
+ assert (b0.p0 == a.p0);
83
+ assert (b0.p3 == a.p1);
84
+
85
+ double ea;
86
+ Bezier b1 = a.approximate_bezier (&ea);
87
+
88
+ assert (b0.p0 == b1.p0);
89
+ assert (b0.p3 == b1.p3);
90
+
91
+ Vector v0 = b1.p1 - b0.p1;
92
+ Vector v1 = b1.p2 - b0.p2;
93
+
94
+ Vector b = (b0.p3 - b0.p0).normalized ();
95
+ v0 = v0.rebase (b);
96
+ v1 = v1.rebase (b);
97
+
98
+ Vector v (MaxDeviationApproximator::approximate_deviation (v0.dx, v1.dx),
99
+ MaxDeviationApproximator::approximate_deviation (v0.dy, v1.dy));
100
+
101
+ /* Edge cases: If d*d is too close too large default to a weak bound. */
102
+ if (a.d * a.d > 1. - 1e-4)
103
+ return ea + v.len ();
104
+
105
+ /* If the wedge doesn't contain control points, default to weak bound. */
106
+ if (!a.wedge_contains_point (b0.p1) || !a.wedge_contains_point (b0.p2))
107
+ return ea + v.len ();
108
+
109
+ /* If straight line, return the max ortho deviation. */
110
+ if (fabs (a.d) < 1e-6)
111
+ return ea + v.dy;
112
+
113
+ /* We made sure that fabs(a.d) < 1 */
114
+ double tan_half_alpha = fabs (tan2atan (a.d));
115
+
116
+ double tan_v = v.dx / v.dy;
117
+
118
+ double eb;
119
+ if (fabs (tan_v) <= tan_half_alpha)
120
+ return ea + v.len ();
121
+
122
+ double c2 = (a.p1 - a.p0).len () * .5;
123
+ double r = a.radius ();
124
+
125
+ eb = Vector (c2 + v.dx, c2 / tan_half_alpha + v.dy).len () - r;
126
+ assert (eb >= 0);
127
+
128
+ return ea + eb;
129
+ }
130
+};
131
+
132
+
133
+
134
+template <class ArcBezierErrorApproximator>
135
+class ArcBezierApproximatorMidpointSimple
136
+{
137
+ public:
138
+ static const Arc approximate_bezier_with_arc (const Bezier &b, double *error)
139
+ {
140
+ Arc a (b.p0, b.p3, b.midpoint (), false);
141
+
142
+ *error = ArcBezierErrorApproximator::approximate_bezier_arc_error (b, a);
143
+
144
+ return a;
145
+ }
146
+};
147
+
148
+template <class ArcBezierErrorApproximator>
149
+class ArcBezierApproximatorMidpointTwoPart
150
+{
151
+ public:
152
+ static const Arc approximate_bezier_with_arc (const Bezier &b, double *error, double mid_t = .5)
153
+ {
154
+ Pair<Bezier > pair = b.split (mid_t);
155
+ Point m = pair.second.p0;
156
+
157
+ Arc a0 (b.p0, m, b.p3, true);
158
+ Arc a1 (m, b.p3, b.p0, true);
159
+
160
+ double e0 = ArcBezierErrorApproximator::approximate_bezier_arc_error (pair.first, a0);
161
+ double e1 = ArcBezierErrorApproximator::approximate_bezier_arc_error (pair.second, a1);
162
+ *error = std::max (e0, e1);
163
+
164
+ return Arc (b.p0, b.p3, m, false);
165
+ }
166
+};
167
+
168
+template <class ArcBezierErrorApproximator>
169
+class ArcBezierApproximatorQuantized
170
+{
171
+ public:
172
+ ArcBezierApproximatorQuantized (double _max_d = GLYPHY_INFINITY, unsigned int _d_bits = 0) :
173
+ max_d (_max_d), d_bits (_d_bits) {};
174
+
175
+ protected:
176
+ double max_d;
177
+ unsigned int d_bits;
178
+
179
+ public:
180
+ const Arc approximate_bezier_with_arc (const Bezier &b, double *error) const
181
+ {
182
+ double mid_t = .5;
183
+ Arc a (b.p0, b.p3, b.point (mid_t), false);
184
+ Arc orig_a = a;
185
+
186
+ if (isfinite (max_d)) {
187
+ assert (max_d >= 0);
188
+ if (fabs (a.d) > max_d)
189
+ a.d = a.d < 0 ? -max_d : max_d;
190
+ }
191
+ if (d_bits && max_d != 0) {
192
+ assert (isfinite (max_d));
193
+ assert (fabs (a.d) <= max_d);
194
+ int mult = (1 << (d_bits - 1)) - 1;
195
+ int id = round (a.d / max_d * mult);
196
+ assert (-mult <= id && id <= mult);
197
+ a.d = id * max_d / mult;
198
+ assert (fabs (a.d) <= max_d);
199
+ }
200
+
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-arc.cc
Added
139
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju, Wojciech Baranowski
18
+ */
19
+
20
+#ifdef HAVE_CONFIG_H
21
+#include <config.h>
22
+#endif
23
+
24
+#include "glyphy-common.hh"
25
+#include "glyphy-geometry.hh"
26
+#include "glyphy-arc-bezier.hh"
27
+
28
+using namespace GLyphy::Geometry;
29
+using namespace GLyphy::ArcBezier;
30
+
31
+
32
+
33
+/*
34
+ * Circular arcs
35
+ */
36
+
37
+
38
+/* Build from a conventional arc representation */
39
+void
40
+glyphy_arc_from_conventional (const glyphy_point_t *center,
41
+ double radius,
42
+ double angle0,
43
+ double angle1,
44
+ glyphy_bool_t negative,
45
+ glyphy_arc_t *arc)
46
+{
47
+ *arc = Arc (*center, radius, angle0, angle1, negative);
48
+};
49
+
50
+/* Convert to a conventional arc representation */
51
+void
52
+glyphy_arc_to_conventional (glyphy_arc_t arc,
53
+ glyphy_point_t *center /* may be NULL */,
54
+ double *radius /* may be NULL */,
55
+ double *angle0 /* may be NULL */,
56
+ double *angle1 /* may be NULL */,
57
+ glyphy_bool_t *negative /* may be NULL */)
58
+{
59
+ Arc a (arc);
60
+ if (radius) *radius = a.radius ();
61
+ if (center || angle0 || angle1) {
62
+ Point c = a.center ();
63
+ if (center) *center = c;
64
+ if (angle0) *angle0 = (a.p0 - c).angle ();
65
+ if (angle1) *angle1 = (a.p1 - c).angle ();
66
+ if (negative) *negative = a.d < 0;
67
+ }
68
+}
69
+
70
+glyphy_bool_t
71
+glyphy_arc_is_a_line (glyphy_arc_t arc)
72
+{
73
+ return arc.d == 0;
74
+}
75
+
76
+void
77
+glyphy_arc_extents (glyphy_arc_t arc,
78
+ glyphy_extents_t *extents)
79
+{
80
+ Arc(arc).extents (*extents);
81
+}
82
+
83
+
84
+/*
85
+ * Approximate single pieces of geometry to/from one arc
86
+ */
87
+
88
+
89
+void
90
+glyphy_arc_from_line (const glyphy_point_t *p0,
91
+ const glyphy_point_t *p1,
92
+ glyphy_arc_t *arc)
93
+{
94
+ *arc = Arc (*p0, *p1, 0);
95
+}
96
+
97
+void
98
+glyphy_arc_from_conic (const glyphy_point_t *p0,
99
+ const glyphy_point_t *p1,
100
+ const glyphy_point_t *p2,
101
+ glyphy_arc_t *arc,
102
+ double *error)
103
+{
104
+ Point p1_ (Point (*p0).lerp (2/3., *p1));
105
+ Point p2_ (Point (*p2).lerp (2/3., *p1));
106
+ glyphy_arc_from_cubic (p0,
107
+ &p1_,
108
+ &p2_,
109
+ p2,
110
+ arc,
111
+ error);
112
+}
113
+
114
+void
115
+glyphy_arc_from_cubic (const glyphy_point_t *p0,
116
+ const glyphy_point_t *p1,
117
+ const glyphy_point_t *p2,
118
+ const glyphy_point_t *p3,
119
+ glyphy_arc_t *arc,
120
+ double *error)
121
+{
122
+ *arc = ArcBezierApproximatorDefault::approximate_bezier_with_arc (Bezier (*p0, *p1, *p2, *p3), error);
123
+}
124
+
125
+void
126
+glyphy_arc_to_cubic (const glyphy_arc_t *arc,
127
+ glyphy_point_t *p0,
128
+ glyphy_point_t *p1,
129
+ glyphy_point_t *p2,
130
+ glyphy_point_t *p3,
131
+ double *error)
132
+{
133
+ Bezier b = Arc (*arc).approximate_bezier (error);
134
+ *p0 = arc->p0;
135
+ *p1 = b.p1;
136
+ *p2 = b.p2;
137
+ *p3 = arc->p1;
138
+}
139
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-arcs-bezier.hh
Added
140
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju
18
+ */
19
+
20
+#ifndef GLYPHY_ARCS_BEZIER_HH
21
+#define GLYPHY_ARCS_BEZIER_HH
22
+
23
+#include "glyphy-common.hh"
24
+#include "glyphy-geometry.hh"
25
+#include "glyphy-arc-bezier.hh"
26
+
27
+namespace GLyphy {
28
+namespace ArcsBezier {
29
+
30
+using namespace Geometry;
31
+using namespace ArcBezier;
32
+
33
+template <class ArcBezierApproximator>
34
+class ArcsBezierApproximatorSpringSystem
35
+{
36
+ static inline void calc_arcs (const Bezier &b,
37
+ const std::vector<double> &t,
38
+ const ArcBezierApproximator &appx,
39
+ std::vector<double> &e,
40
+ std::vector<Arc > &arcs,
41
+ double &max_e, double &min_e)
42
+ {
43
+ unsigned int n = t.size () - 1;
44
+ e.resize (n);
45
+ arcs.clear ();
46
+ max_e = 0;
47
+ min_e = GLYPHY_INFINITY;
48
+ for (unsigned int i = 0; i < n; i++)
49
+ {
50
+ Bezier segment = b.segment (t[i], t[i + 1]);
51
+ arcs.push_back (appx.approximate_bezier_with_arc (segment, &e[i]));
52
+
53
+ max_e = std::max (max_e, e[i]);
54
+ min_e = std::min (min_e, e[i]);
55
+ }
56
+ }
57
+
58
+ static inline void jiggle (const Bezier &b,
59
+ const ArcBezierApproximator &appx,
60
+ std::vector<double> &t,
61
+ std::vector<double> &e,
62
+ std::vector<Arc > &arcs,
63
+ double &max_e, double &min_e,
64
+ double tolerance,
65
+ unsigned int &n_jiggle)
66
+ {
67
+ unsigned int n = t.size () - 1;
68
+ //fprintf (stderr, "candidate n %d max_e %g min_e %g\n", n, max_e, min_e);
69
+ unsigned int max_jiggle = log2 (n) + 1;
70
+ unsigned int s;
71
+ for (s = 0; s < max_jiggle; s++)
72
+ {
73
+ double total = 0;
74
+ for (unsigned int i = 0; i < n; i++) {
75
+ double l = t[i + 1] - t[i];
76
+ double k_inv = l * pow (e[i], -.3);
77
+ total += k_inv;
78
+ e[i] = k_inv;
79
+ }
80
+ for (unsigned int i = 0; i < n; i++) {
81
+ double k_inv = e[i];
82
+ double l = k_inv / total;
83
+ t[i + 1] = t[i] + l;
84
+ }
85
+ t[n] = 1.0; // Do this to get real 1.0, not .9999999999999998!
86
+
87
+ calc_arcs (b, t, appx, e, arcs, max_e, min_e);
88
+
89
+ //fprintf (stderr, "n %d jiggle %d max_e %g min_e %g\n", n, s, max_e, min_e);
90
+
91
+ n_jiggle++;
92
+ if (max_e < tolerance || (2 * min_e - max_e > tolerance))
93
+ break;
94
+ }
95
+ //if (s == max_jiggle) fprintf (stderr, "JIGGLE OVERFLOW n %d s %d\n", n, s);
96
+ }
97
+
98
+ public:
99
+ static void approximate_bezier_with_arcs (const Bezier &b,
100
+ double tolerance,
101
+ const ArcBezierApproximator &appx,
102
+ std::vector<Arc> &arcs,
103
+ double *perror,
104
+ unsigned int max_segments = 100)
105
+ {
106
+ std::vector<double> t;
107
+ std::vector<double> e;
108
+ double max_e, min_e;
109
+ unsigned int n_jiggle = 0;
110
+
111
+ /* Technically speaking we can bsearch for n. */
112
+ for (unsigned int n = 1; n <= max_segments; n++)
113
+ {
114
+ t.resize (n + 1);
115
+ for (unsigned int i = 0; i < n; i++)
116
+ t[i] = double (i) / n;
117
+ t[n] = 1.0; // Do this out of the loop to get real 1.0, not .9999999999999998!
118
+
119
+ calc_arcs (b, t, appx, e, arcs, max_e, min_e);
120
+
121
+ for (unsigned int i = 0; i < n; i++)
122
+ if (e[i] <= tolerance) {
123
+ jiggle (b, appx, t, e, arcs, max_e, min_e, tolerance, n_jiggle);
124
+ break;
125
+ }
126
+
127
+ if (max_e <= tolerance)
128
+ break;
129
+ }
130
+ if (perror)
131
+ *perror = max_e;
132
+ //fprintf (stderr, "n_jiggle %d\n", n_jiggle);
133
+ }
134
+};
135
+
136
+} /* namespace ArcsBezier */
137
+} /* namespace GLyphy */
138
+
139
+#endif /* GLYPHY_ARCS_BEZIER_HH */
140
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-arcs.cc
Added
201
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju, Wojciech Baranowski
18
+ */
19
+
20
+#ifdef HAVE_CONFIG_H
21
+#include <config.h>
22
+#endif
23
+
24
+#include "glyphy-common.hh"
25
+#include "glyphy-geometry.hh"
26
+#include "glyphy-arcs-bezier.hh"
27
+
28
+using namespace GLyphy::Geometry;
29
+using namespace GLyphy::ArcsBezier;
30
+
31
+
32
+
33
+/*
34
+ * Approximate outlines with multiple arcs
35
+ */
36
+
37
+
38
+struct glyphy_arc_accumulator_t {
39
+ unsigned int refcount;
40
+
41
+ double tolerance;
42
+ double max_d;
43
+ unsigned int d_bits;
44
+ glyphy_arc_endpoint_accumulator_callback_t callback;
45
+ void *user_data;
46
+
47
+ glyphy_point_t start_point;
48
+ glyphy_point_t current_point;
49
+ bool need_moveto;
50
+ unsigned int num_endpoints;
51
+ double max_error;
52
+ glyphy_bool_t success;
53
+};
54
+
55
+
56
+glyphy_arc_accumulator_t *
57
+glyphy_arc_accumulator_create (void)
58
+{
59
+ glyphy_arc_accumulator_t *acc = (glyphy_arc_accumulator_t *) calloc (1, sizeof (glyphy_arc_accumulator_t));
60
+ acc->refcount = 1;
61
+
62
+ acc->tolerance = 5e-4;
63
+ acc->max_d = GLYPHY_MAX_D;
64
+ acc->d_bits = 8;
65
+ acc->callback = NULL;
66
+ acc->user_data = NULL;
67
+
68
+ glyphy_arc_accumulator_reset (acc);
69
+
70
+ return acc;
71
+}
72
+
73
+void
74
+glyphy_arc_accumulator_reset (glyphy_arc_accumulator_t *acc)
75
+{
76
+ acc->start_point = acc->current_point = Point (0, 0);
77
+ acc->need_moveto = true;
78
+ acc->num_endpoints = 0;
79
+ acc->max_error = 0;
80
+ acc->success = true;
81
+}
82
+
83
+void
84
+glyphy_arc_accumulator_destroy (glyphy_arc_accumulator_t *acc)
85
+{
86
+ if (!acc || --acc->refcount)
87
+ return;
88
+
89
+ free (acc);
90
+}
91
+
92
+glyphy_arc_accumulator_t *
93
+glyphy_arc_accumulator_reference (glyphy_arc_accumulator_t *acc)
94
+{
95
+ if (acc)
96
+ acc->refcount++;
97
+ return acc;
98
+}
99
+
100
+
101
+/* Configure acc */
102
+
103
+void
104
+glyphy_arc_accumulator_set_tolerance (glyphy_arc_accumulator_t *acc,
105
+ double tolerance)
106
+{
107
+ acc->tolerance = tolerance;
108
+}
109
+
110
+double
111
+glyphy_arc_accumulator_get_tolerance (glyphy_arc_accumulator_t *acc)
112
+{
113
+ return acc->tolerance;
114
+}
115
+
116
+void
117
+glyphy_arc_accumulator_set_callback (glyphy_arc_accumulator_t *acc,
118
+ glyphy_arc_endpoint_accumulator_callback_t callback,
119
+ void *user_data)
120
+{
121
+ acc->callback = callback;
122
+ acc->user_data = user_data;
123
+}
124
+
125
+void
126
+glyphy_arc_accumulator_get_callback (glyphy_arc_accumulator_t *acc,
127
+ glyphy_arc_endpoint_accumulator_callback_t *callback,
128
+ void **user_data)
129
+{
130
+ *callback = acc->callback;
131
+ *user_data = acc->user_data;
132
+}
133
+
134
+void
135
+glyphy_arc_accumulator_set_d_metrics (glyphy_arc_accumulator_t *acc,
136
+ double max_d,
137
+ double d_bits)
138
+{
139
+ acc->max_d = max_d;
140
+ acc->d_bits = d_bits;
141
+}
142
+
143
+void
144
+glyphy_arc_accumulator_get_d_metrics (glyphy_arc_accumulator_t *acc,
145
+ double *max_d,
146
+ double *d_bits)
147
+{
148
+ *max_d = acc->max_d;
149
+ *d_bits = acc->d_bits;
150
+}
151
+
152
+
153
+/* Accumulation results */
154
+
155
+unsigned int
156
+glyphy_arc_accumulator_get_num_endpoints (glyphy_arc_accumulator_t *acc)
157
+{
158
+ return acc->num_endpoints;
159
+}
160
+
161
+double
162
+glyphy_arc_accumulator_get_error (glyphy_arc_accumulator_t *acc)
163
+{
164
+ return acc->max_error;
165
+}
166
+
167
+glyphy_bool_t
168
+glyphy_arc_accumulator_successful (glyphy_arc_accumulator_t *acc)
169
+{
170
+ return acc->success;
171
+}
172
+
173
+
174
+/* Accumulate */
175
+
176
+static void
177
+emit (glyphy_arc_accumulator_t *acc, const Point &p, double d)
178
+{
179
+ glyphy_arc_endpoint_t endpoint = {p, d};
180
+ acc->success = acc->success && acc->callback (&endpoint, acc->user_data);
181
+ if (acc->success) {
182
+ acc->num_endpoints++;
183
+ acc->current_point = p;
184
+ }
185
+}
186
+
187
+static void
188
+accumulate (glyphy_arc_accumulator_t *acc, const Point &p, double d)
189
+{
190
+ if (Point (acc->current_point) == p)
191
+ return;
192
+ if (d == GLYPHY_INFINITY) {
193
+ /* Emit moveto lazily, for cleaner outlines */
194
+ acc->need_moveto = true;
195
+ acc->current_point = p;
196
+ return;
197
+ }
198
+ if (acc->need_moveto) {
199
+ emit (acc, acc->current_point, GLYPHY_INFINITY);
200
+ if (acc->success) {
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-blob.cc
Added
201
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju, Wojciech Baranowski
18
+ */
19
+
20
+#ifdef HAVE_CONFIG_H
21
+#include <config.h>
22
+#endif
23
+
24
+#include "glyphy-common.hh"
25
+#include "glyphy-geometry.hh"
26
+
27
+#define GRID_SIZE 24
28
+
29
+using namespace GLyphy::Geometry;
30
+
31
+
32
+#define UPPER_BITS(v,bits,total_bits) ((v) >> ((total_bits) - (bits)))
33
+#define LOWER_BITS(v,bits,total_bits) ((v) & ((1 << (bits)) - 1))
34
+
35
+#define MAX_X 4095
36
+#define MAX_Y 4095
37
+
38
+static inline glyphy_rgba_t
39
+arc_endpoint_encode (unsigned int ix, unsigned int iy, double d)
40
+{
41
+ glyphy_rgba_t v;
42
+
43
+ /* 12 bits for each of x and y, 8 bits for d */
44
+ assert (ix <= MAX_X);
45
+ assert (iy <= MAX_Y);
46
+ unsigned int id;
47
+ if (isinf (d))
48
+ id = 0;
49
+ else {
50
+ assert (fabs (d) <= GLYPHY_MAX_D);
51
+ id = 128 + lround (d * 127 / GLYPHY_MAX_D);
52
+ }
53
+ assert (id < 256);
54
+
55
+ v.r = id;
56
+ v.g = LOWER_BITS (ix, 8, 12);
57
+ v.b = LOWER_BITS (iy, 8, 12);
58
+ v.a = ((ix >> 8) << 4) | (iy >> 8);
59
+ return v;
60
+}
61
+
62
+static inline glyphy_rgba_t
63
+arc_list_encode (unsigned int offset, unsigned int num_points, int side)
64
+{
65
+ glyphy_rgba_t v;
66
+ v.r = 0; // unused for arc-list encoding
67
+ v.g = UPPER_BITS (offset, 8, 16);
68
+ v.b = LOWER_BITS (offset, 8, 16);
69
+ v.a = LOWER_BITS (num_points, 8, 8);
70
+ if (side < 0 && !num_points)
71
+ v.a = 255;
72
+ return v;
73
+}
74
+
75
+static inline glyphy_rgba_t
76
+line_encode (const Line &line)
77
+{
78
+ Line l = line.normalized ();
79
+ double angle = l.n.angle ();
80
+ double distance = l.c;
81
+
82
+ int ia = lround (-angle / M_PI * 0x7FFF);
83
+ unsigned int ua = ia + 0x8000;
84
+ assert (0 == (ua & ~0xFFFF));
85
+
86
+ int id = lround (distance * 0x1FFF);
87
+ unsigned int ud = id + 0x4000;
88
+ assert (0 == (ud & ~0x7FFF));
89
+
90
+ /* Marker for line-encoded */
91
+ ud |= 0x8000;
92
+
93
+ glyphy_rgba_t v;
94
+ v.r = ud >> 8;
95
+ v.g = ud & 0xFF;
96
+ v.b = ua >> 8;
97
+ v.a = ua & 0xFF;
98
+ return v;
99
+}
100
+
101
+
102
+/* Given a cell, fills the vector closest_arcs with arcs that may be closest to some point in the cell.
103
+ * Uses idea that all close arcs to cell must be ~close to center of cell.
104
+ */
105
+static void
106
+closest_arcs_to_cell (Point c0, Point c1, /* corners */
107
+ double faraway,
108
+ const glyphy_arc_endpoint_t *endpoints,
109
+ unsigned int num_endpoints,
110
+ std::vector<glyphy_arc_endpoint_t> &near_endpoints,
111
+ int *side)
112
+{
113
+ // Find distance between cell center
114
+ Point c = c0.midpoint (c1);
115
+ double min_dist = glyphy_sdf_from_arc_list (endpoints, num_endpoints, &c, NULL);
116
+
117
+ *side = min_dist >= 0 ? +1 : -1;
118
+ min_dist = fabs (min_dist);
119
+ std::vector<Arc> near_arcs;
120
+
121
+ // If d is the distance from the center of the square to the nearest arc, then
122
+ // all nearest arcs to the square must be at most almost [d + half_diagonal] from the center.
123
+ double half_diagonal = (c - c0).len ();
124
+ double radius_squared = pow (min_dist + half_diagonal, 2);
125
+ if (min_dist - half_diagonal <= faraway) {
126
+ Point p0 (0, 0);
127
+ for (unsigned int i = 0; i < num_endpoints; i++) {
128
+ const glyphy_arc_endpoint_t &endpoint = endpoints[i];
129
+ if (endpoint.d == GLYPHY_INFINITY) {
130
+ p0 = endpoint.p;
131
+ continue;
132
+ }
133
+ Arc arc (p0, endpoint.p, endpoint.d);
134
+ p0 = endpoint.p;
135
+
136
+ if (arc.squared_distance_to_point (c) <= radius_squared)
137
+ near_arcs.push_back (arc);
138
+ }
139
+ }
140
+
141
+ Point p1 = Point (0, 0);
142
+ for (unsigned i = 0; i < near_arcs.size (); i++)
143
+ {
144
+ Arc arc = near_arcs[i];
145
+
146
+ if (i == 0 || p1 != arc.p0) {
147
+ glyphy_arc_endpoint_t endpoint = {arc.p0, GLYPHY_INFINITY};
148
+ near_endpoints.push_back (endpoint);
149
+ p1 = arc.p0;
150
+ }
151
+
152
+ glyphy_arc_endpoint_t endpoint = {arc.p1, arc.d};
153
+ near_endpoints.push_back (endpoint);
154
+ p1 = arc.p1;
155
+ }
156
+}
157
+
158
+
159
+glyphy_bool_t
160
+glyphy_arc_list_encode_blob (const glyphy_arc_endpoint_t *endpoints,
161
+ unsigned int num_endpoints,
162
+ glyphy_rgba_t *blob,
163
+ unsigned int blob_size,
164
+ double faraway,
165
+ double avg_fetch_desired,
166
+ double *avg_fetch_achieved,
167
+ unsigned int *output_len,
168
+ unsigned int *nominal_width, /* 8bit */
169
+ unsigned int *nominal_height, /* 8bit */
170
+ glyphy_extents_t *pextents)
171
+{
172
+ glyphy_extents_t extents;
173
+ glyphy_extents_clear (&extents);
174
+
175
+ glyphy_arc_list_extents (endpoints, num_endpoints, &extents);
176
+
177
+ if (glyphy_extents_is_empty (&extents)) {
178
+ *pextents = extents;
179
+ if (!blob_size)
180
+ return false;
181
+ *blob = arc_list_encode (0, 0, +1);
182
+ *avg_fetch_achieved = 1;
183
+ *output_len = 1;
184
+ *nominal_width = *nominal_height = 1;
185
+ return true;
186
+ }
187
+
188
+ /* Add antialiasing padding */
189
+ extents.min_x -= faraway;
190
+ extents.min_y -= faraway;
191
+ extents.max_x += faraway;
192
+ extents.max_y += faraway;
193
+
194
+ double glyph_width = extents.max_x - extents.min_x;
195
+ double glyph_height = extents.max_y - extents.min_y;
196
+ double unit = std::max (glyph_width, glyph_height);
197
+
198
+ unsigned int grid_w = GRID_SIZE;
199
+ unsigned int grid_h = GRID_SIZE;
200
+
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-common-glsl.h
Added
201
1
2
+static const char *glyphy_common_glsl =
3
+"/*\n"
4
+" * Copyright 2012 Google, Inc. All Rights Reserved.\n"
5
+" *\n"
6
+" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
7
+" * you may not use this file except in compliance with the License.\n"
8
+" * You may obtain a copy of the License at\n"
9
+" *\n"
10
+" * http://www.apache.org/licenses/LICENSE-2.0\n"
11
+" *\n"
12
+" * Unless required by applicable law or agreed to in writing, software\n"
13
+" * distributed under the License is distributed on an \"AS IS\" BASIS,\n"
14
+" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
15
+" * See the License for the specific language governing permissions and\n"
16
+" * limitations under the License.\n"
17
+" *\n"
18
+" * Google Author(s): Behdad Esfahbod, Maysum Panju\n"
19
+" */\n"
20
+"\n"
21
+"\n"
22
+"#ifndef GLYPHY_INFINITY\n"
23
+"# define GLYPHY_INFINITY 1e9\n"
24
+"#endif\n"
25
+"#ifndef GLYPHY_EPSILON\n"
26
+"# define GLYPHY_EPSILON 1e-5\n"
27
+"#endif\n"
28
+"\n"
29
+"#ifndef GLYPHY_RGBA\n"
30
+"# ifdef GLYPHY_BGRA\n"
31
+"# define GLYPHY_RGBA(v) glyphy_bgra (v)\n"
32
+"# else\n"
33
+"# define GLYPHY_RGBA(v) glyphy_rgba (v)\n"
34
+"# endif\n"
35
+"#endif\n"
36
+"\n"
37
+"vec4\n"
38
+"glyphy_rgba (const vec4 v)\n"
39
+"{\n"
40
+" return v.rgba;\n"
41
+"}\n"
42
+"\n"
43
+"vec4\n"
44
+"glyphy_bgra (const vec4 v)\n"
45
+"{\n"
46
+" return v.bgra;\n"
47
+"}\n"
48
+"\n"
49
+"\n"
50
+"struct glyphy_arc_t {\n"
51
+" vec2 p0;\n"
52
+" vec2 p1;\n"
53
+" float d;\n"
54
+"};\n"
55
+"\n"
56
+"struct glyphy_arc_endpoint_t {\n"
57
+" /* Second arc endpoint */\n"
58
+" vec2 p;\n"
59
+" /* Infinity if this endpoint does not form an arc with the previous\n"
60
+" * endpoint. Ie. a \"move_to\". Test with glyphy_isinf().\n"
61
+" * Arc depth otherwise. */\n"
62
+" float d;\n"
63
+"};\n"
64
+"\n"
65
+"struct glyphy_arc_list_t {\n"
66
+" /* Number of endpoints in the list.\n"
67
+" * Will be zero if we're far away inside or outside, in which case side is set.\n"
68
+" * Will be -1 if this arc-list encodes a single line, in which case line_* are set. */\n"
69
+" int num_endpoints;\n"
70
+"\n"
71
+" /* If num_endpoints is zero, this specifies whether we are inside (-1)\n"
72
+" * or outside (+1). Otherwise we're unsure (0). */\n"
73
+" int side;\n"
74
+" /* Offset to the arc-endpoints from the beginning of the glyph blob */\n"
75
+" int offset;\n"
76
+"\n"
77
+" /* A single line is all we care about. It's right here. */\n"
78
+" float line_angle;\n"
79
+" float line_distance; /* From nominal glyph center */\n"
80
+"};\n"
81
+"\n"
82
+"bool\n"
83
+"glyphy_isinf (const float v)\n"
84
+"{\n"
85
+" return abs (v) >= GLYPHY_INFINITY * .5;\n"
86
+"}\n"
87
+"\n"
88
+"bool\n"
89
+"glyphy_iszero (const float v)\n"
90
+"{\n"
91
+" return abs (v) <= GLYPHY_EPSILON * 2.;\n"
92
+"}\n"
93
+"\n"
94
+"vec2\n"
95
+"glyphy_ortho (const vec2 v)\n"
96
+"{\n"
97
+" return vec2 (-v.y, v.x);\n"
98
+"}\n"
99
+"\n"
100
+"int\n"
101
+"glyphy_float_to_byte (const float v)\n"
102
+"{\n"
103
+" return int (v * (256. - GLYPHY_EPSILON));\n"
104
+"}\n"
105
+"\n"
106
+"ivec4\n"
107
+"glyphy_vec4_to_bytes (const vec4 v)\n"
108
+"{\n"
109
+" return ivec4 (v * (256. - GLYPHY_EPSILON));\n"
110
+"}\n"
111
+"\n"
112
+"ivec2\n"
113
+"glyphy_float_to_two_nimbles (const float v)\n"
114
+"{\n"
115
+" int f = glyphy_float_to_byte (v);\n"
116
+" return ivec2 (f / 16, int(mod (float(f), 16.)));\n"
117
+"}\n"
118
+"\n"
119
+"/* returns tan (2 * atan (d)) */\n"
120
+"float\n"
121
+"glyphy_tan2atan (const float d)\n"
122
+"{\n"
123
+" return 2. * d / (1. - d * d);\n"
124
+"}\n"
125
+"\n"
126
+"glyphy_arc_endpoint_t\n"
127
+"glyphy_arc_endpoint_decode (const vec4 v, const ivec2 nominal_size)\n"
128
+"{\n"
129
+" vec2 p = (vec2 (glyphy_float_to_two_nimbles (v.a)) + v.gb) / 16.;\n"
130
+" float d = v.r;\n"
131
+" if (d == 0.)\n"
132
+" d = GLYPHY_INFINITY;\n"
133
+" else\n"
134
+"#define GLYPHY_MAX_D .5\n"
135
+" d = float(glyphy_float_to_byte (d) - 128) * GLYPHY_MAX_D / 127.;\n"
136
+"#undef GLYPHY_MAX_D\n"
137
+" return glyphy_arc_endpoint_t (p * vec2(nominal_size), d);\n"
138
+"}\n"
139
+"\n"
140
+"vec2\n"
141
+"glyphy_arc_center (const glyphy_arc_t a)\n"
142
+"{\n"
143
+" return mix (a.p0, a.p1, .5) +\n"
144
+" glyphy_ortho (a.p1 - a.p0) / (2. * glyphy_tan2atan (a.d));\n"
145
+"}\n"
146
+"\n"
147
+"bool\n"
148
+"glyphy_arc_wedge_contains (const glyphy_arc_t a, const vec2 p)\n"
149
+"{\n"
150
+" float d2 = glyphy_tan2atan (a.d);\n"
151
+" return dot (p - a.p0, (a.p1 - a.p0) * mat2(1, d2, -d2, 1)) >= 0. &&\n"
152
+" dot (p - a.p1, (a.p1 - a.p0) * mat2(1, -d2, d2, 1)) <= 0.;\n"
153
+"}\n"
154
+"\n"
155
+"float\n"
156
+"glyphy_arc_wedge_signed_dist_shallow (const glyphy_arc_t a, const vec2 p)\n"
157
+"{\n"
158
+" vec2 v = normalize (a.p1 - a.p0);\n"
159
+" float line_d = dot (p - a.p0, glyphy_ortho (v));\n"
160
+" if (a.d == 0.)\n"
161
+" return line_d;\n"
162
+"\n"
163
+" float d0 = dot ((p - a.p0), v);\n"
164
+" if (d0 < 0.)\n"
165
+" return sign (line_d) * distance (p, a.p0);\n"
166
+" float d1 = dot ((a.p1 - p), v);\n"
167
+" if (d1 < 0.)\n"
168
+" return sign (line_d) * distance (p, a.p1);\n"
169
+" float r = 2. * a.d * (d0 * d1) / (d0 + d1);\n"
170
+" if (r * line_d > 0.)\n"
171
+" return sign (line_d) * min (abs (line_d + r), min (distance (p, a.p0), distance (p, a.p1)));\n"
172
+" return line_d + r;\n"
173
+"}\n"
174
+"\n"
175
+"float\n"
176
+"glyphy_arc_wedge_signed_dist (const glyphy_arc_t a, const vec2 p)\n"
177
+"{\n"
178
+" if (abs (a.d) <= .03)\n"
179
+" return glyphy_arc_wedge_signed_dist_shallow (a, p);\n"
180
+" vec2 c = glyphy_arc_center (a);\n"
181
+" return sign (a.d) * (distance (a.p0, c) - distance (p, c));\n"
182
+"}\n"
183
+"\n"
184
+"float\n"
185
+"glyphy_arc_extended_dist (const glyphy_arc_t a, const vec2 p)\n"
186
+"{\n"
187
+" /* Note: this doesn't handle points inside the wedge. */\n"
188
+" vec2 m = mix (a.p0, a.p1, .5);\n"
189
+" float d2 = glyphy_tan2atan (a.d);\n"
190
+" if (dot (p - m, a.p1 - m) < 0.)\n"
191
+" return dot (p - a.p0, normalize ((a.p1 - a.p0) * mat2(+d2, -1, +1, +d2)));\n"
192
+" else\n"
193
+" return dot (p - a.p1, normalize ((a.p1 - a.p0) * mat2(-d2, -1, +1, -d2)));\n"
194
+"}\n"
195
+"\n"
196
+"int\n"
197
+"glyphy_arc_list_offset (const vec2 p, const ivec2 nominal_size)\n"
198
+"{\n"
199
+" ivec2 cell = ivec2 (clamp (floor (p), vec2 (0.,0.), vec2(nominal_size - 1)));\n"
200
+" return cell.y * nominal_size.x + cell.x;\n"
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-common.glsl
Added
201
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju
18
+ */
19
+
20
+
21
+#ifndef GLYPHY_INFINITY
22
+# define GLYPHY_INFINITY 1e9
23
+#endif
24
+#ifndef GLYPHY_EPSILON
25
+# define GLYPHY_EPSILON 1e-5
26
+#endif
27
+
28
+#ifndef GLYPHY_RGBA
29
+# ifdef GLYPHY_BGRA
30
+# define GLYPHY_RGBA(v) glyphy_bgra (v)
31
+# else
32
+# define GLYPHY_RGBA(v) glyphy_rgba (v)
33
+# endif
34
+#endif
35
+
36
+vec4
37
+glyphy_rgba (const vec4 v)
38
+{
39
+ return v.rgba;
40
+}
41
+
42
+vec4
43
+glyphy_bgra (const vec4 v)
44
+{
45
+ return v.bgra;
46
+}
47
+
48
+
49
+struct glyphy_arc_t {
50
+ vec2 p0;
51
+ vec2 p1;
52
+ float d;
53
+};
54
+
55
+struct glyphy_arc_endpoint_t {
56
+ /* Second arc endpoint */
57
+ vec2 p;
58
+ /* Infinity if this endpoint does not form an arc with the previous
59
+ * endpoint. Ie. a "move_to". Test with glyphy_isinf().
60
+ * Arc depth otherwise. */
61
+ float d;
62
+};
63
+
64
+struct glyphy_arc_list_t {
65
+ /* Number of endpoints in the list.
66
+ * Will be zero if we're far away inside or outside, in which case side is set.
67
+ * Will be -1 if this arc-list encodes a single line, in which case line_* are set. */
68
+ int num_endpoints;
69
+
70
+ /* If num_endpoints is zero, this specifies whether we are inside (-1)
71
+ * or outside (+1). Otherwise we're unsure (0). */
72
+ int side;
73
+ /* Offset to the arc-endpoints from the beginning of the glyph blob */
74
+ int offset;
75
+
76
+ /* A single line is all we care about. It's right here. */
77
+ float line_angle;
78
+ float line_distance; /* From nominal glyph center */
79
+};
80
+
81
+bool
82
+glyphy_isinf (const float v)
83
+{
84
+ return abs (v) >= GLYPHY_INFINITY * .5;
85
+}
86
+
87
+bool
88
+glyphy_iszero (const float v)
89
+{
90
+ return abs (v) <= GLYPHY_EPSILON * 2.;
91
+}
92
+
93
+vec2
94
+glyphy_ortho (const vec2 v)
95
+{
96
+ return vec2 (-v.y, v.x);
97
+}
98
+
99
+int
100
+glyphy_float_to_byte (const float v)
101
+{
102
+ return int (v * (256. - GLYPHY_EPSILON));
103
+}
104
+
105
+ivec4
106
+glyphy_vec4_to_bytes (const vec4 v)
107
+{
108
+ return ivec4 (v * (256. - GLYPHY_EPSILON));
109
+}
110
+
111
+ivec2
112
+glyphy_float_to_two_nimbles (const float v)
113
+{
114
+ int f = glyphy_float_to_byte (v);
115
+ return ivec2 (f / 16, int(mod (float(f), 16.)));
116
+}
117
+
118
+/* returns tan (2 * atan (d)) */
119
+float
120
+glyphy_tan2atan (const float d)
121
+{
122
+ return 2. * d / (1. - d * d);
123
+}
124
+
125
+glyphy_arc_endpoint_t
126
+glyphy_arc_endpoint_decode (const vec4 v, const ivec2 nominal_size)
127
+{
128
+ vec2 p = (vec2 (glyphy_float_to_two_nimbles (v.a)) + v.gb) / 16.;
129
+ float d = v.r;
130
+ if (d == 0.)
131
+ d = GLYPHY_INFINITY;
132
+ else
133
+#define GLYPHY_MAX_D .5
134
+ d = float(glyphy_float_to_byte (d) - 128) * GLYPHY_MAX_D / 127.;
135
+#undef GLYPHY_MAX_D
136
+ return glyphy_arc_endpoint_t (p * vec2(nominal_size), d);
137
+}
138
+
139
+vec2
140
+glyphy_arc_center (const glyphy_arc_t a)
141
+{
142
+ return mix (a.p0, a.p1, .5) +
143
+ glyphy_ortho (a.p1 - a.p0) / (2. * glyphy_tan2atan (a.d));
144
+}
145
+
146
+bool
147
+glyphy_arc_wedge_contains (const glyphy_arc_t a, const vec2 p)
148
+{
149
+ float d2 = glyphy_tan2atan (a.d);
150
+ return dot (p - a.p0, (a.p1 - a.p0) * mat2(1, d2, -d2, 1)) >= 0. &&
151
+ dot (p - a.p1, (a.p1 - a.p0) * mat2(1, -d2, d2, 1)) <= 0.;
152
+}
153
+
154
+float
155
+glyphy_arc_wedge_signed_dist_shallow (const glyphy_arc_t a, const vec2 p)
156
+{
157
+ vec2 v = normalize (a.p1 - a.p0);
158
+ float line_d = dot (p - a.p0, glyphy_ortho (v));
159
+ if (a.d == 0.)
160
+ return line_d;
161
+
162
+ float d0 = dot ((p - a.p0), v);
163
+ if (d0 < 0.)
164
+ return sign (line_d) * distance (p, a.p0);
165
+ float d1 = dot ((a.p1 - p), v);
166
+ if (d1 < 0.)
167
+ return sign (line_d) * distance (p, a.p1);
168
+ float r = 2. * a.d * (d0 * d1) / (d0 + d1);
169
+ if (r * line_d > 0.)
170
+ return sign (line_d) * min (abs (line_d + r), min (distance (p, a.p0), distance (p, a.p1)));
171
+ return line_d + r;
172
+}
173
+
174
+float
175
+glyphy_arc_wedge_signed_dist (const glyphy_arc_t a, const vec2 p)
176
+{
177
+ if (abs (a.d) <= .03)
178
+ return glyphy_arc_wedge_signed_dist_shallow (a, p);
179
+ vec2 c = glyphy_arc_center (a);
180
+ return sign (a.d) * (distance (a.p0, c) - distance (p, c));
181
+}
182
+
183
+float
184
+glyphy_arc_extended_dist (const glyphy_arc_t a, const vec2 p)
185
+{
186
+ /* Note: this doesn't handle points inside the wedge. */
187
+ vec2 m = mix (a.p0, a.p1, .5);
188
+ float d2 = glyphy_tan2atan (a.d);
189
+ if (dot (p - m, a.p1 - m) < 0.)
190
+ return dot (p - a.p0, normalize ((a.p1 - a.p0) * mat2(+d2, -1, +1, +d2)));
191
+ else
192
+ return dot (p - a.p1, normalize ((a.p1 - a.p0) * mat2(-d2, -1, +1, -d2)));
193
+}
194
+
195
+int
196
+glyphy_arc_list_offset (const vec2 p, const ivec2 nominal_size)
197
+{
198
+ ivec2 cell = ivec2 (clamp (floor (p), vec2 (0.,0.), vec2(nominal_size - 1)));
199
+ return cell.y * nominal_size.x + cell.x;
200
+}
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-common.hh
Added
61
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju
18
+ */
19
+
20
+#ifndef GLYPHY_COMMON_HH
21
+#define GLYPHY_COMMON_HH
22
+
23
+#include <glyphy.h>
24
+
25
+#include <math.h>
26
+#include <string.h>
27
+#include <assert.h>
28
+#include <stdio.h>
29
+#include <vector>
30
+#include <algorithm>
31
+
32
+#ifndef GLYPHY_EPSILON
33
+# define GLYPHY_EPSILON 1e-5
34
+#endif
35
+#ifndef GLYPHY_INFINITY
36
+# define GLYPHY_INFINITY INFINITY
37
+#endif
38
+
39
+
40
+static inline bool
41
+iszero (double v)
42
+{
43
+ return fabs (v) < 2 * GLYPHY_EPSILON;
44
+}
45
+
46
+
47
+#define GLYPHY_MAX_D .5
48
+
49
+#undef ARRAY_LENGTH
50
+#define ARRAY_LENGTH(__array) ((signed int) (sizeof (__array) / sizeof (__array[0])))
51
+
52
+#define _ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
53
+#define _ASSERT_STATIC0(_line, _cond) _ASSERT_STATIC1 (_line, (_cond))
54
+#define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond))
55
+
56
+#ifdef __ANDROID__
57
+#define log2(x) (log(x) / log(2.0))
58
+#endif
59
+
60
+#endif /* GLYPHY_COMMON_HH */
61
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-extents.cc
Added
91
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod
18
+ */
19
+
20
+#ifdef HAVE_CONFIG_H
21
+#include <config.h>
22
+#endif
23
+
24
+#include "glyphy-common.hh"
25
+
26
+
27
+void
28
+glyphy_extents_clear (glyphy_extents_t *extents)
29
+{
30
+ extents->min_x = GLYPHY_INFINITY;
31
+ extents->min_y = GLYPHY_INFINITY;
32
+ extents->max_x = -GLYPHY_INFINITY;
33
+ extents->max_y = -GLYPHY_INFINITY;
34
+}
35
+
36
+glyphy_bool_t
37
+glyphy_extents_is_empty (const glyphy_extents_t *extents)
38
+{
39
+ return isinf (extents->min_x);
40
+}
41
+
42
+void
43
+glyphy_extents_add (glyphy_extents_t *extents,
44
+ const glyphy_point_t *p)
45
+{
46
+ if (glyphy_extents_is_empty (extents)) {
47
+ extents->min_x = extents->max_x = p->x;
48
+ extents->min_y = extents->max_y = p->y;
49
+ return;
50
+ }
51
+ extents->min_x = std::min (extents->min_x, p->x);
52
+ extents->min_y = std::min (extents->min_y, p->y);
53
+ extents->max_x = std::max (extents->max_x, p->x);
54
+ extents->max_y = std::max (extents->max_y, p->y);
55
+}
56
+
57
+void
58
+glyphy_extents_extend (glyphy_extents_t *extents,
59
+ const glyphy_extents_t *other)
60
+{
61
+ if (glyphy_extents_is_empty (other))
62
+ return;
63
+ if (glyphy_extents_is_empty (extents)) {
64
+ *extents = *other;
65
+ return;
66
+ }
67
+ extents->min_x = std::min (extents->min_x, other->min_x);
68
+ extents->min_y = std::min (extents->min_y, other->min_y);
69
+ extents->max_x = std::max (extents->max_x, other->max_x);
70
+ extents->max_y = std::max (extents->max_y, other->max_y);
71
+}
72
+
73
+glyphy_bool_t
74
+glyphy_extents_includes (const glyphy_extents_t *extents,
75
+ const glyphy_point_t *p)
76
+{
77
+ return extents->min_x <= p->x && p->x <= extents->max_x &&
78
+ extents->min_y <= p->y && p->y <= extents->max_y;
79
+}
80
+
81
+void
82
+glyphy_extents_scale (glyphy_extents_t *extents,
83
+ double x_scale,
84
+ double y_scale)
85
+{
86
+ extents->min_x *= x_scale;
87
+ extents->max_x *= x_scale;
88
+ extents->min_y *= y_scale;
89
+ extents->max_y *= y_scale;
90
+}
91
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-freetype.h
Added
95
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju
18
+ */
19
+
20
+/* Intentionally doesn't have include guards */
21
+
22
+#include "glyphy.h"
23
+
24
+#include <ft2build.h>
25
+#include FT_FREETYPE_H
26
+#include FT_OUTLINE_H
27
+
28
+
29
+
30
+#ifndef GLYPHY_FREETYPE_PREFIX
31
+#define GLYPHY_FREETYPE_PREFIX glyphy_freetype_
32
+#endif
33
+
34
+#ifndef glyphy_freetype
35
+#define glyphy_freetype(name) GLYPHY_PASTE (GLYPHY_FREETYPE_PREFIX, name)
36
+#endif
37
+
38
+
39
+
40
+static int
41
+glyphy_freetype(move_to) (FT_Vector *to,
42
+ glyphy_arc_accumulator_t *acc)
43
+{
44
+ glyphy_point_t p1 = {to->x, to->y};
45
+ glyphy_arc_accumulator_close_path (acc);
46
+ glyphy_arc_accumulator_move_to (acc, &p1);
47
+ return glyphy_arc_accumulator_successful (acc) ? FT_Err_Ok : FT_Err_Out_Of_Memory;
48
+}
49
+
50
+static int
51
+glyphy_freetype(line_to) (FT_Vector *to,
52
+ glyphy_arc_accumulator_t *acc)
53
+{
54
+ glyphy_point_t p1 = {to->x, to->y};
55
+ glyphy_arc_accumulator_line_to (acc, &p1);
56
+ return glyphy_arc_accumulator_successful (acc) ? FT_Err_Ok : FT_Err_Out_Of_Memory;
57
+}
58
+
59
+static int
60
+glyphy_freetype(conic_to) (FT_Vector *control, FT_Vector *to,
61
+ glyphy_arc_accumulator_t *acc)
62
+{
63
+ glyphy_point_t p1 = {control->x, control->y};
64
+ glyphy_point_t p2 = {to->x, to->y};
65
+ glyphy_arc_accumulator_conic_to (acc, &p1, &p2);
66
+ return glyphy_arc_accumulator_successful (acc) ? FT_Err_Ok : FT_Err_Out_Of_Memory;
67
+}
68
+
69
+static int
70
+glyphy_freetype(cubic_to) (FT_Vector *control1, FT_Vector *control2, FT_Vector *to,
71
+ glyphy_arc_accumulator_t *acc)
72
+{
73
+ glyphy_point_t p1 = {control1->x, control1->y};
74
+ glyphy_point_t p2 = {control2->x, control2->y};
75
+ glyphy_point_t p3 = {to->x, to->y};
76
+ glyphy_arc_accumulator_cubic_to (acc, &p1, &p2, &p3);
77
+ return glyphy_arc_accumulator_successful (acc) ? FT_Err_Ok : FT_Err_Out_Of_Memory;
78
+}
79
+
80
+static FT_Error
81
+glyphy_freetype(outline_decompose) (const FT_Outline *outline,
82
+ glyphy_arc_accumulator_t *acc)
83
+{
84
+ const FT_Outline_Funcs outline_funcs = {
85
+ (FT_Outline_MoveToFunc) glyphy_freetype(move_to),
86
+ (FT_Outline_LineToFunc) glyphy_freetype(line_to),
87
+ (FT_Outline_ConicToFunc) glyphy_freetype(conic_to),
88
+ (FT_Outline_CubicToFunc) glyphy_freetype(cubic_to),
89
+ 0, /* shift */
90
+ 0, /* delta */
91
+ };
92
+
93
+ return FT_Outline_Decompose ((FT_Outline *) outline, &outline_funcs, acc);
94
+}
95
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-geometry.hh
Added
201
1
2
+/*
3
+ * Copyright 2012,2013 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju
18
+ */
19
+
20
+#ifndef GLYPHY_GEOMETRY_HH
21
+#define GLYPHY_GEOMETRY_HH
22
+
23
+#include "glyphy-common.hh"
24
+
25
+namespace GLyphy {
26
+namespace Geometry {
27
+
28
+template <typename Type> struct Pair;
29
+struct Vector;
30
+struct SignedVector;
31
+struct Point;
32
+struct Line;
33
+struct Segment;
34
+struct Arc;
35
+struct Bezier;
36
+
37
+/* returns tan (2 * atan (d)) */
38
+inline double tan2atan (double d) { return 2 * d / (1 - d*d); }
39
+
40
+/* returns sin (2 * atan (d)) */
41
+inline double sin2atan (double d) { return 2 * d / (1 + d*d); }
42
+
43
+/* returns cos (2 * atan (d)) */
44
+inline double cos2atan (double d) { return (1 - d*d) / (1 + d*d); }
45
+
46
+template <typename Type>
47
+struct Pair {
48
+ typedef Type ElementType;
49
+
50
+ inline Pair (const Type &first_, const Type &second_) : first (first_), second (second_) {}
51
+
52
+ Type first, second;
53
+};
54
+
55
+struct Point : glyphy_point_t {
56
+ inline Point (double x_, double y_) { x = x_; y = y_; }
57
+ inline explicit Point (const Vector &v);
58
+ inline Point (const glyphy_point_t &p) { *(glyphy_point_t *)this = p; }
59
+
60
+ inline bool operator == (const Point &p) const;
61
+ inline bool operator != (const Point &p) const;
62
+ inline Point& operator+= (const Vector &v);
63
+ inline Point& operator-= (const Vector &v);
64
+ inline const Point operator+ (const Vector &v) const;
65
+ inline const Point operator- (const Vector &v) const;
66
+ inline const Vector operator- (const Point &p) const;
67
+ inline const Point midpoint (const Point &p) const;
68
+ inline const Line bisector (const Point &p) const;
69
+ inline double distance_to_point (const Point &p) const; /* distance to point! */
70
+ inline double squared_distance_to_point (const Point &p) const; /* square of distance to point! */
71
+
72
+ inline bool is_finite (void) const;
73
+ inline const Point lerp (const double &a, const Point &p) const;
74
+};
75
+
76
+struct Vector {
77
+ inline Vector (double dx_, double dy_) : dx (dx_), dy (dy_) {}
78
+ inline explicit Vector (const Point &p) : dx (p.x), dy (p.y) {}
79
+
80
+ inline bool operator == (const Vector &v) const;
81
+ inline bool operator != (const Vector &v) const;
82
+ inline const Vector operator+ (void) const;
83
+ inline const Vector operator- (void) const;
84
+ inline Vector& operator+= (const Vector &v);
85
+ inline Vector& operator-= (const Vector &v);
86
+ inline Vector& operator*= (const double &s);
87
+ inline Vector& operator/= (const double &s);
88
+ inline const Vector operator+ (const Vector &v) const;
89
+ inline const Vector operator- (const Vector &v) const;
90
+ inline const Vector operator* (const double &s) const;
91
+ inline const Vector operator/ (const double &s) const;
92
+ inline double operator* (const Vector &v) const; /* dot product */
93
+ inline const Point operator+ (const Point &p) const;
94
+
95
+ inline bool is_nonzero (void) const;
96
+ inline double len (void) const;
97
+ inline double len2 (void) const;
98
+ inline const Vector normalized (void) const;
99
+ inline const Vector ortho (void) const;
100
+ inline const Vector normal (void) const; /* ortho().normalized() */
101
+ inline double angle (void) const;
102
+
103
+ inline const Vector rebase (const Vector &bx, const Vector &by) const;
104
+ inline const Vector rebase (const Vector &bx) const;
105
+
106
+ double dx, dy;
107
+};
108
+
109
+struct SignedVector : Vector {
110
+ inline SignedVector (const Vector &v, bool negative_) : Vector (v), negative (negative_) {}
111
+
112
+ inline bool operator == (const SignedVector &v) const;
113
+ inline bool operator != (const SignedVector &v) const;
114
+ inline const SignedVector operator- (void) const;
115
+
116
+ bool negative;
117
+};
118
+
119
+struct Line {
120
+ inline Line (double a_, double b_, double c_) : n (a_, b_), c (c_) {}
121
+ inline Line (Vector n_, double c_) : n (n_), c (c_) {}
122
+ inline Line (const Point &p0, const Point &p1) :
123
+ n ((p1 - p0).ortho ()), c (n * Vector (p0)) {}
124
+
125
+ inline const Point operator+ (const Line &l) const; /* line intersection! */
126
+ inline const SignedVector operator- (const Point &p) const; /* shortest vector from point to line */
127
+
128
+
129
+ inline const Line normalized (void) const;
130
+ inline const Vector normal (void) const;
131
+
132
+ Vector n; /* line normal */
133
+ double c; /* n.dx*x + n.dy*y = c */
134
+};
135
+
136
+struct Segment {
137
+ inline Segment (const Point &p0_, const Point &p1_) :
138
+ p0 (p0_), p1 (p1_) {}
139
+
140
+ inline const SignedVector operator- (const Point &p) const; /* shortest vector from point to ***line*** */
141
+ inline double distance_to_point (const Point &p) const; /* shortest distance from point to segment */
142
+ inline double squared_distance_to_point (const Point &p) const; /* shortest distance squared from point to segment */
143
+ inline bool contains_in_span (const Point &p) const; /* is p in the stripe formed by sliding this segment? */
144
+ inline double max_distance_to_arc (const Arc &a) const;
145
+
146
+
147
+ Point p0;
148
+ Point p1;
149
+};
150
+
151
+
152
+
153
+struct Arc {
154
+ inline Arc (const Point &p0_, const Point &p1_, const Point &pm, bool complement) :
155
+ p0 (p0_), p1 (p1_),
156
+ d (p0_ == pm || p1_ == pm ? 0 :
157
+ tan (((p1_-pm).angle () - (p0_-pm).angle ()) / 2 - (complement ? 0 : M_PI_2))) {}
158
+ inline Arc (const Point &p0_, const Point &p1_, const double &d_) :
159
+ p0 (p0_), p1 (p1_), d (d_) {}
160
+ inline Arc (const Point ¢er, double radius, const double &a0, const double &a1, bool complement) :
161
+ p0 (center + Vector (cos(a0),sin(a0)) * radius),
162
+ p1 (center + Vector (cos(a1),sin(a1)) * radius),
163
+ d (tan ((a1 - a0) / 4 - (complement ? 0 : M_PI_2))) {}
164
+ inline Arc (const glyphy_arc_t &a) : p0 (a.p0), p1 (a.p1), d (a.d) {}
165
+ inline operator glyphy_arc_t (void) const { glyphy_arc_t a = {p0, p1, d}; return a; }
166
+
167
+ inline bool operator == (const Arc &a) const;
168
+ inline bool operator != (const Arc &a) const;
169
+ inline const SignedVector operator- (const Point &p) const; /* shortest vector from point to arc */
170
+
171
+ inline double radius (void) const;
172
+ inline const Point center (void) const;
173
+ inline const Pair<Vector> tangents (void) const;
174
+
175
+ inline Bezier approximate_bezier (double *error) const;
176
+
177
+ inline bool wedge_contains_point (const Point &p) const;
178
+ inline double distance_to_point (const Point &p) const;
179
+ inline double squared_distance_to_point (const Point &p) const;
180
+ inline double extended_dist (const Point &p) const;
181
+
182
+ inline void extents (glyphy_extents_t &extents) const;
183
+
184
+ Point p0, p1;
185
+ double d; /* Depth */
186
+};
187
+
188
+struct Bezier {
189
+ inline Bezier (const Point &p0_, const Point &p1_,
190
+ const Point &p2_, const Point &p3_) :
191
+ p0 (p0_), p1 (p1_), p2 (p2_), p3 (p3_) {}
192
+
193
+ inline const Point point (const double &t) const;
194
+ inline const Point midpoint (void) const;
195
+ inline const Vector tangent (const double &t) const;
196
+ inline const Vector d_tangent (const double &t) const;
197
+ inline double curvature (const double &t) const;
198
+ inline const Pair<Bezier> split (const double &t) const;
199
+ inline const Pair<Bezier> halve (void) const;
200
+ inline const Bezier segment (const double &t0, const double &t1) const;
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-outline.cc
Added
201
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod
18
+ */
19
+
20
+#ifdef HAVE_CONFIG_H
21
+#include <config.h>
22
+#endif
23
+
24
+#include "glyphy-common.hh"
25
+#include "glyphy-geometry.hh"
26
+
27
+using namespace GLyphy::Geometry;
28
+
29
+
30
+void
31
+glyphy_outline_reverse (glyphy_arc_endpoint_t *endpoints,
32
+ unsigned int num_endpoints)
33
+{
34
+ if (!num_endpoints)
35
+ return;
36
+
37
+ // Shift the d's first
38
+ double d0 = endpoints[0].d;
39
+ for (unsigned int i = 0; i < num_endpoints - 1; i++)
40
+ endpoints[i].d = endpoints[i + 1].d == GLYPHY_INFINITY ? GLYPHY_INFINITY : -endpoints[i + 1].d;
41
+ endpoints[num_endpoints - 1].d = d0;
42
+
43
+ // Reverse
44
+ for (unsigned int i = 0, j = num_endpoints - 1; i < j; i++, j--) {
45
+ glyphy_arc_endpoint_t t = endpoints[i];
46
+ endpoints[i] = endpoints[j];
47
+ endpoints[j] = t;
48
+ }
49
+}
50
+
51
+
52
+static bool
53
+winding (const glyphy_arc_endpoint_t *endpoints,
54
+ unsigned int num_endpoints)
55
+{
56
+ /*
57
+ * Algorithm:
58
+ *
59
+ * - Find the lowest-x part of the contour,
60
+ * - If the point is an endpoint:
61
+ * o compare the angle of the incoming and outgoing edges of that point
62
+ * to find out whether it's CW or CCW,
63
+ * - Otherwise, compare the y of the two endpoints of the arc with lowest-x point.
64
+ *
65
+ * Note:
66
+ *
67
+ * We can use a simpler algorithm here: Act as if arcs are lines, then use the
68
+ * triangle method to calculate the signed area of the contour and get the sign.
69
+ * It should work for all cases we care about. The only case failing would be
70
+ * that of two endpoints and two arcs. But we can even special-case that.
71
+ */
72
+
73
+ unsigned int corner = 1;
74
+ for (unsigned int i = 2; i < num_endpoints; i++)
75
+ if (endpoints[i].p.x < endpoints[corner].p.x ||
76
+ (endpoints[i].p.x == endpoints[corner].p.x &&
77
+ endpoints[i].p.y < endpoints[corner].p.y))
78
+ corner = i;
79
+
80
+ double min_x = endpoints[corner].p.x;
81
+ int winner = -1;
82
+ Point p0 (0, 0);
83
+ for (unsigned int i = 0; i < num_endpoints; i++) {
84
+ const glyphy_arc_endpoint_t &endpoint = endpoints[i];
85
+ if (endpoint.d == GLYPHY_INFINITY || endpoint.d == 0 /* arcs only, not lines */) {
86
+ p0 = endpoint.p;
87
+ continue;
88
+ }
89
+ Arc arc (p0, endpoint.p, endpoint.d);
90
+ p0 = endpoint.p;
91
+
92
+ Point c = arc.center ();
93
+ double r = arc.radius ();
94
+ if (c.x - r < min_x && arc.wedge_contains_point (c - Vector (r, 0))) {
95
+ min_x = c.x - r;
96
+ winner = i;
97
+ }
98
+ }
99
+
100
+ if (winner == -1)
101
+ {
102
+ // Corner is lowest-x. Find the tangents of the two arcs connected to the
103
+ // corner and compare the tangent angles to get contour direction.
104
+ const glyphy_arc_endpoint_t ethis = endpoints[corner];
105
+ const glyphy_arc_endpoint_t eprev = endpoints[corner - 1];
106
+ const glyphy_arc_endpoint_t enext = endpoints[corner < num_endpoints - 1 ? corner + 1 : 1];
107
+ double in = (-Arc (eprev.p, ethis.p, ethis.d).tangents ().second).angle ();
108
+ double out = (+Arc (ethis.p, enext.p, enext.d).tangents ().first ).angle ();
109
+ return out > in;
110
+ }
111
+ else
112
+ {
113
+ // Easy.
114
+ return endpoints[winner].d < 0;
115
+ }
116
+
117
+ return false;
118
+}
119
+
120
+
121
+static int
122
+categorize (double v, double ref)
123
+{
124
+ return v < ref - GLYPHY_EPSILON ? -1 : v > ref + GLYPHY_EPSILON ? +1 : 0;
125
+}
126
+
127
+static bool
128
+is_zero (double v)
129
+{
130
+ return fabs (v) < GLYPHY_EPSILON;
131
+}
132
+
133
+static bool
134
+even_odd (const glyphy_arc_endpoint_t *c_endpoints,
135
+ unsigned int num_c_endpoints,
136
+ const glyphy_arc_endpoint_t *endpoints,
137
+ unsigned int num_endpoints)
138
+{
139
+ /*
140
+ * Algorithm:
141
+ *
142
+ * - For a point on the contour, draw a halfline in a direction
143
+ * (eg. decreasing x) to infinity,
144
+ * - Count how many times it crosses all other contours,
145
+ * - Pay special attention to points falling exactly on the halfline,
146
+ * specifically, they count as +.5 or -.5, depending the direction
147
+ * of crossing.
148
+ *
149
+ * All this counting is extremely tricky:
150
+ *
151
+ * - Floating point equality cannot be relied on here,
152
+ * - Lots of arc analysis needed,
153
+ * - Without having a point that we know falls /inside/ the contour,
154
+ * there are legitimate cases that we simply cannot handle using
155
+ * this algorithm. For example, imagine the following glyph shape:
156
+ *
157
+ * +---------+
158
+ * | +-----+ |
159
+ * | \ / |
160
+ * | \ / |
161
+ * +----o----+
162
+ *
163
+ * If the glyph is defined as two outlines, and when analysing the
164
+ * inner outline we happen to pick the point denoted by 'o' for
165
+ * analysis, there simply is no way to differentiate this case from
166
+ * the following case:
167
+ *
168
+ * +---------+
169
+ * | |
170
+ * | |
171
+ * | |
172
+ * +----o----+
173
+ * / \
174
+ * / \
175
+ * +-----+
176
+ *
177
+ * However, in one, the triangle should be filled in, and in the other
178
+ * filled out.
179
+ *
180
+ * One way to work around this may be to do the analysis for all endpoints
181
+ * on the outline and take majority. But even that can fail in more
182
+ * extreme yet legitimate cases, such as this one:
183
+ *
184
+ * +--+--+
185
+ * | / \ |
186
+ * |/ \|
187
+ * + +
188
+ * |\ /|
189
+ * | \ / |
190
+ * +--o--+
191
+ *
192
+ * The only correct algorithm I can think of requires a point that falls
193
+ * fully inside the outline. While we can try finding such a point (not
194
+ * dissimilar to the winding algorithm), it's beyond what I'm willing to
195
+ * implement right now.
196
+ */
197
+
198
+ const Point p = c_endpoints[0].p;
199
+
200
+ double count = 0;
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-sdf-glsl.h
Added
155
1
2
+static const char *glyphy_sdf_glsl =
3
+"/*\n"
4
+" * Copyright 2012 Google, Inc. All Rights Reserved.\n"
5
+" *\n"
6
+" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
7
+" * you may not use this file except in compliance with the License.\n"
8
+" * You may obtain a copy of the License at\n"
9
+" *\n"
10
+" * http://www.apache.org/licenses/LICENSE-2.0\n"
11
+" *\n"
12
+" * Unless required by applicable law or agreed to in writing, software\n"
13
+" * distributed under the License is distributed on an \"AS IS\" BASIS,\n"
14
+" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
15
+" * See the License for the specific language governing permissions and\n"
16
+" * limitations under the License.\n"
17
+" *\n"
18
+" * Google Author(s): Behdad Esfahbod, Maysum Panju\n"
19
+" */\n"
20
+"\n"
21
+"#ifndef GLYPHY_TEXTURE1D_FUNC\n"
22
+"#define GLYPHY_TEXTURE1D_FUNC glyphy_texture1D_func\n"
23
+"#endif\n"
24
+"#ifndef GLYPHY_TEXTURE1D_EXTRA_DECLS\n"
25
+"#define GLYPHY_TEXTURE1D_EXTRA_DECLS\n"
26
+"#endif\n"
27
+"#ifndef GLYPHY_TEXTURE1D_EXTRA_ARGS\n"
28
+"#define GLYPHY_TEXTURE1D_EXTRA_ARGS\n"
29
+"#endif\n"
30
+"\n"
31
+"#ifndef GLYPHY_SDF_TEXTURE1D_FUNC\n"
32
+"#define GLYPHY_SDF_TEXTURE1D_FUNC GLYPHY_TEXTURE1D_FUNC\n"
33
+"#endif\n"
34
+"#ifndef GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS\n"
35
+"#define GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS GLYPHY_TEXTURE1D_EXTRA_DECLS\n"
36
+"#endif\n"
37
+"#ifndef GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS\n"
38
+"#define GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS GLYPHY_TEXTURE1D_EXTRA_ARGS\n"
39
+"#endif\n"
40
+"#ifndef GLYPHY_SDF_TEXTURE1D\n"
41
+"#define GLYPHY_SDF_TEXTURE1D(offset) GLYPHY_RGBA(GLYPHY_SDF_TEXTURE1D_FUNC (offset GLYPHY_TEXTURE1D_EXTRA_ARGS))\n"
42
+"#endif\n"
43
+"\n"
44
+"#ifndef GLYPHY_MAX_NUM_ENDPOINTS\n"
45
+"#define GLYPHY_MAX_NUM_ENDPOINTS 32\n"
46
+"#endif\n"
47
+"\n"
48
+"glyphy_arc_list_t\n"
49
+"glyphy_arc_list (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)\n"
50
+"{\n"
51
+" int cell_offset = glyphy_arc_list_offset (p, nominal_size);\n"
52
+" vec4 arc_list_data = GLYPHY_SDF_TEXTURE1D (cell_offset);\n"
53
+" return glyphy_arc_list_decode (arc_list_data, nominal_size);\n"
54
+"}\n"
55
+"\n"
56
+"float\n"
57
+"glyphy_sdf (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)\n"
58
+"{\n"
59
+" glyphy_arc_list_t arc_list = glyphy_arc_list (p, nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS);\n"
60
+"\n"
61
+" /* Short-circuits */\n"
62
+" if (arc_list.num_endpoints == 0) {\n"
63
+" /* far-away cell */\n"
64
+" return GLYPHY_INFINITY * float(arc_list.side);\n"
65
+" } if (arc_list.num_endpoints == -1) {\n"
66
+" /* single-line */\n"
67
+" float angle = arc_list.line_angle;\n"
68
+" vec2 n = vec2 (cos (angle), sin (angle));\n"
69
+" return dot (p - (vec2(nominal_size) * .5), n) - arc_list.line_distance;\n"
70
+" }\n"
71
+"\n"
72
+" float side = float(arc_list.side);\n"
73
+" float min_dist = GLYPHY_INFINITY;\n"
74
+" glyphy_arc_t closest_arc;\n"
75
+"\n"
76
+" glyphy_arc_endpoint_t endpoint_prev, endpoint;\n"
77
+" endpoint_prev = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset), nominal_size);\n"
78
+" for (int i = 1; i < GLYPHY_MAX_NUM_ENDPOINTS; i++)\n"
79
+" {\n"
80
+" if (i >= arc_list.num_endpoints) {\n"
81
+" break;\n"
82
+" }\n"
83
+" endpoint = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset + i), nominal_size);\n"
84
+" glyphy_arc_t a = glyphy_arc_t (endpoint_prev.p, endpoint.p, endpoint.d);\n"
85
+" endpoint_prev = endpoint;\n"
86
+" if (glyphy_isinf (a.d)) continue;\n"
87
+"\n"
88
+" if (glyphy_arc_wedge_contains (a, p))\n"
89
+" {\n"
90
+" float sdist = glyphy_arc_wedge_signed_dist (a, p);\n"
91
+" float udist = abs (sdist) * (1. - GLYPHY_EPSILON);\n"
92
+" if (udist <= min_dist) {\n"
93
+" min_dist = udist;\n"
94
+" side = sdist <= 0. ? -1. : +1.;\n"
95
+" }\n"
96
+" } else {\n"
97
+" float udist = min (distance (p, a.p0), distance (p, a.p1));\n"
98
+" if (udist < min_dist) {\n"
99
+" min_dist = udist;\n"
100
+" side = 0.; /* unsure */\n"
101
+" closest_arc = a;\n"
102
+" } else if (side == 0. && udist == min_dist) {\n"
103
+" /* If this new distance is the same as the current minimum,\n"
104
+" * compare extended distances. Take the sign from the arc\n"
105
+" * with larger extended distance. */\n"
106
+" float old_ext_dist = glyphy_arc_extended_dist (closest_arc, p);\n"
107
+" float new_ext_dist = glyphy_arc_extended_dist (a, p);\n"
108
+"\n"
109
+" float ext_dist = abs (new_ext_dist) <= abs (old_ext_dist) ?\n"
110
+" old_ext_dist : new_ext_dist;\n"
111
+"\n"
112
+"#ifdef GLYPHY_SDF_PSEUDO_DISTANCE\n"
113
+" /* For emboldening and stuff: */\n"
114
+" min_dist = abs (ext_dist);\n"
115
+"#endif\n"
116
+" side = sign (ext_dist);\n"
117
+" }\n"
118
+" }\n"
119
+" }\n"
120
+"\n"
121
+" if (side == 0.) {\n"
122
+" // Technically speaking this should not happen, but it does. So try to fix it.\n"
123
+" float ext_dist = glyphy_arc_extended_dist (closest_arc, p);\n"
124
+" side = sign (ext_dist);\n"
125
+" }\n"
126
+"\n"
127
+" return min_dist * side;\n"
128
+"}\n"
129
+"\n"
130
+"float\n"
131
+"glyphy_point_dist (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)\n"
132
+"{\n"
133
+" glyphy_arc_list_t arc_list = glyphy_arc_list (p, nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS);\n"
134
+"\n"
135
+" float side = float(arc_list.side);\n"
136
+" float min_dist = GLYPHY_INFINITY;\n"
137
+"\n"
138
+" if (arc_list.num_endpoints == 0)\n"
139
+" return min_dist;\n"
140
+"\n"
141
+" glyphy_arc_endpoint_t endpoint_prev, endpoint;\n"
142
+" endpoint_prev = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset), nominal_size);\n"
143
+" for (int i = 1; i < GLYPHY_MAX_NUM_ENDPOINTS; i++)\n"
144
+" {\n"
145
+" if (i >= arc_list.num_endpoints) {\n"
146
+" break;\n"
147
+" }\n"
148
+" endpoint = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset + i), nominal_size);\n"
149
+" if (glyphy_isinf (endpoint.d)) continue;\n"
150
+" min_dist = min (min_dist, distance (p, endpoint.p));\n"
151
+" }\n"
152
+" return min_dist;\n"
153
+"}\n"
154
+;
155
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-sdf.cc
Added
93
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju, Wojciech Baranowski
18
+ */
19
+
20
+#ifdef HAVE_CONFIG_H
21
+#include <config.h>
22
+#endif
23
+
24
+#include "glyphy-common.hh"
25
+#include "glyphy-geometry.hh"
26
+
27
+using namespace GLyphy::Geometry;
28
+
29
+/*
30
+ * TODO
31
+ *
32
+ * Sync this with the shader sdf
33
+ */
34
+
35
+double
36
+glyphy_sdf_from_arc_list (const glyphy_arc_endpoint_t *endpoints,
37
+ unsigned int num_endpoints,
38
+ const glyphy_point_t *p,
39
+ glyphy_point_t *closest_p /* may be NULL; TBD not implemented yet */)
40
+{
41
+ Point c = *p;
42
+ Point p0 (0, 0);
43
+ Arc closest_arc (p0, p0, 0);
44
+ double min_dist = GLYPHY_INFINITY;
45
+ int side = 0;
46
+ for (unsigned int i = 0; i < num_endpoints; i++) {
47
+ const glyphy_arc_endpoint_t &endpoint = endpoints[i];
48
+ if (endpoint.d == GLYPHY_INFINITY) {
49
+ p0 = endpoint.p;
50
+ continue;
51
+ }
52
+ Arc arc (p0, endpoint.p, endpoint.d);
53
+ p0 = endpoint.p;
54
+
55
+ if (arc.wedge_contains_point (c)) {
56
+ double sdist = arc.distance_to_point (c); /* TODO This distance has the wrong sign. Fix */
57
+ double udist = fabs (sdist) * (1 - GLYPHY_EPSILON);
58
+ if (udist <= min_dist) {
59
+ min_dist = udist;
60
+ side = sdist >= 0 ? -1 : +1;
61
+ }
62
+ } else {
63
+ double udist = std::min ((arc.p0 - c).len (), (arc.p1 - c).len ());
64
+ if (udist < min_dist) {
65
+ min_dist = udist;
66
+ side = 0; /* unsure */
67
+ closest_arc = arc;
68
+ } else if (side == 0 && udist == min_dist) {
69
+ /* If this new distance is the same as the current minimum,
70
+ * compare extended distances. Take the sign from the arc
71
+ * with larger extended distance. */
72
+ double old_ext_dist = closest_arc.extended_dist (c);
73
+ double new_ext_dist = arc.extended_dist (c);
74
+
75
+ double ext_dist = fabs (new_ext_dist) <= fabs (old_ext_dist) ?
76
+ old_ext_dist : new_ext_dist;
77
+
78
+ /* For emboldening and stuff: */
79
+ // min_dist = fabs (ext_dist);
80
+ side = ext_dist >= 0 ? +1 : -1;
81
+ }
82
+ }
83
+ }
84
+
85
+ if (side == 0) {
86
+ // Technically speaking this should not happen, but it does. So try to fix it.
87
+ double ext_dist = closest_arc.extended_dist (c);
88
+ side = ext_dist >= 0 ? +1 : -1;
89
+ }
90
+
91
+ return side * min_dist;
92
+}
93
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-sdf.glsl
Added
153
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju
18
+ */
19
+
20
+#ifndef GLYPHY_TEXTURE1D_FUNC
21
+#define GLYPHY_TEXTURE1D_FUNC glyphy_texture1D_func
22
+#endif
23
+#ifndef GLYPHY_TEXTURE1D_EXTRA_DECLS
24
+#define GLYPHY_TEXTURE1D_EXTRA_DECLS
25
+#endif
26
+#ifndef GLYPHY_TEXTURE1D_EXTRA_ARGS
27
+#define GLYPHY_TEXTURE1D_EXTRA_ARGS
28
+#endif
29
+
30
+#ifndef GLYPHY_SDF_TEXTURE1D_FUNC
31
+#define GLYPHY_SDF_TEXTURE1D_FUNC GLYPHY_TEXTURE1D_FUNC
32
+#endif
33
+#ifndef GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS
34
+#define GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS GLYPHY_TEXTURE1D_EXTRA_DECLS
35
+#endif
36
+#ifndef GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS
37
+#define GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS GLYPHY_TEXTURE1D_EXTRA_ARGS
38
+#endif
39
+#ifndef GLYPHY_SDF_TEXTURE1D
40
+#define GLYPHY_SDF_TEXTURE1D(offset) GLYPHY_RGBA(GLYPHY_SDF_TEXTURE1D_FUNC (offset GLYPHY_TEXTURE1D_EXTRA_ARGS))
41
+#endif
42
+
43
+#ifndef GLYPHY_MAX_NUM_ENDPOINTS
44
+#define GLYPHY_MAX_NUM_ENDPOINTS 32
45
+#endif
46
+
47
+glyphy_arc_list_t
48
+glyphy_arc_list (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)
49
+{
50
+ int cell_offset = glyphy_arc_list_offset (p, nominal_size);
51
+ vec4 arc_list_data = GLYPHY_SDF_TEXTURE1D (cell_offset);
52
+ return glyphy_arc_list_decode (arc_list_data, nominal_size);
53
+}
54
+
55
+float
56
+glyphy_sdf (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)
57
+{
58
+ glyphy_arc_list_t arc_list = glyphy_arc_list (p, nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS);
59
+
60
+ /* Short-circuits */
61
+ if (arc_list.num_endpoints == 0) {
62
+ /* far-away cell */
63
+ return GLYPHY_INFINITY * float(arc_list.side);
64
+ } if (arc_list.num_endpoints == -1) {
65
+ /* single-line */
66
+ float angle = arc_list.line_angle;
67
+ vec2 n = vec2 (cos (angle), sin (angle));
68
+ return dot (p - (vec2(nominal_size) * .5), n) - arc_list.line_distance;
69
+ }
70
+
71
+ float side = float(arc_list.side);
72
+ float min_dist = GLYPHY_INFINITY;
73
+ glyphy_arc_t closest_arc;
74
+
75
+ glyphy_arc_endpoint_t endpoint_prev, endpoint;
76
+ endpoint_prev = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset), nominal_size);
77
+ for (int i = 1; i < GLYPHY_MAX_NUM_ENDPOINTS; i++)
78
+ {
79
+ if (i >= arc_list.num_endpoints) {
80
+ break;
81
+ }
82
+ endpoint = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset + i), nominal_size);
83
+ glyphy_arc_t a = glyphy_arc_t (endpoint_prev.p, endpoint.p, endpoint.d);
84
+ endpoint_prev = endpoint;
85
+ if (glyphy_isinf (a.d)) continue;
86
+
87
+ if (glyphy_arc_wedge_contains (a, p))
88
+ {
89
+ float sdist = glyphy_arc_wedge_signed_dist (a, p);
90
+ float udist = abs (sdist) * (1. - GLYPHY_EPSILON);
91
+ if (udist <= min_dist) {
92
+ min_dist = udist;
93
+ side = sdist <= 0. ? -1. : +1.;
94
+ }
95
+ } else {
96
+ float udist = min (distance (p, a.p0), distance (p, a.p1));
97
+ if (udist < min_dist) {
98
+ min_dist = udist;
99
+ side = 0.; /* unsure */
100
+ closest_arc = a;
101
+ } else if (side == 0. && udist == min_dist) {
102
+ /* If this new distance is the same as the current minimum,
103
+ * compare extended distances. Take the sign from the arc
104
+ * with larger extended distance. */
105
+ float old_ext_dist = glyphy_arc_extended_dist (closest_arc, p);
106
+ float new_ext_dist = glyphy_arc_extended_dist (a, p);
107
+
108
+ float ext_dist = abs (new_ext_dist) <= abs (old_ext_dist) ?
109
+ old_ext_dist : new_ext_dist;
110
+
111
+#ifdef GLYPHY_SDF_PSEUDO_DISTANCE
112
+ /* For emboldening and stuff: */
113
+ min_dist = abs (ext_dist);
114
+#endif
115
+ side = sign (ext_dist);
116
+ }
117
+ }
118
+ }
119
+
120
+ if (side == 0.) {
121
+ // Technically speaking this should not happen, but it does. So try to fix it.
122
+ float ext_dist = glyphy_arc_extended_dist (closest_arc, p);
123
+ side = sign (ext_dist);
124
+ }
125
+
126
+ return min_dist * side;
127
+}
128
+
129
+float
130
+glyphy_point_dist (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)
131
+{
132
+ glyphy_arc_list_t arc_list = glyphy_arc_list (p, nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS);
133
+
134
+ float side = float(arc_list.side);
135
+ float min_dist = GLYPHY_INFINITY;
136
+
137
+ if (arc_list.num_endpoints == 0)
138
+ return min_dist;
139
+
140
+ glyphy_arc_endpoint_t endpoint_prev, endpoint;
141
+ endpoint_prev = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset), nominal_size);
142
+ for (int i = 1; i < GLYPHY_MAX_NUM_ENDPOINTS; i++)
143
+ {
144
+ if (i >= arc_list.num_endpoints) {
145
+ break;
146
+ }
147
+ endpoint = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset + i), nominal_size);
148
+ if (glyphy_isinf (endpoint.d)) continue;
149
+ min_dist = min (min_dist, distance (p, endpoint.p));
150
+ }
151
+ return min_dist;
152
+}
153
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy-shaders.cc
Added
41
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju, Wojciech Baranowski
18
+ */
19
+
20
+#ifdef HAVE_CONFIG_H
21
+#include <config.h>
22
+#endif
23
+
24
+#include "glyphy-common.hh"
25
+
26
+/*
27
+ * Shader source code
28
+ */
29
+
30
+/* TODO path separator */
31
+#define SHADER_PATH(File) PKGDATADIR "/" File
32
+
33
+#include "glyphy-common-glsl.h"
34
+#include "glyphy-sdf-glsl.h"
35
+
36
+const char * glyphy_common_shader_source (void) { return glyphy_common_glsl; }
37
+const char * glyphy_sdf_shader_source (void) { return glyphy_sdf_glsl; }
38
+
39
+const char * glyphy_common_shader_source_path (void) { return SHADER_PATH ("glyphy-common.glsl"); }
40
+const char * glyphy_sdf_shader_source_path (void) { return SHADER_PATH ("glyphy-sdf.glsl"); }
41
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/glyphy.h
Added
201
1
2
+/*
3
+ * Copyright 2012 Google, Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * Google Author(s): Behdad Esfahbod, Maysum Panju
18
+ */
19
+
20
+#ifndef GLYPHY_H
21
+#define GLYPHY_H
22
+
23
+
24
+#ifdef __cplusplus
25
+extern "C" {
26
+#endif
27
+
28
+
29
+#define GLYPHY_PASTE_ARGS(prefix, name) prefix ## name
30
+#define GLYPHY_PASTE(prefix, name) GLYPHY_PASTE_ARGS (prefix, name)
31
+
32
+
33
+
34
+typedef int glyphy_bool_t;
35
+
36
+
37
+typedef struct {
38
+ double x;
39
+ double y;
40
+} glyphy_point_t;
41
+
42
+
43
+
44
+/*
45
+ * Geometry extents
46
+ */
47
+
48
+typedef struct {
49
+ double min_x;
50
+ double min_y;
51
+ double max_x;
52
+ double max_y;
53
+} glyphy_extents_t;
54
+
55
+void
56
+glyphy_extents_clear (glyphy_extents_t *extents);
57
+
58
+glyphy_bool_t
59
+glyphy_extents_is_empty (const glyphy_extents_t *extents);
60
+
61
+void
62
+glyphy_extents_add (glyphy_extents_t *extents,
63
+ const glyphy_point_t *p);
64
+
65
+void
66
+glyphy_extents_extend (glyphy_extents_t *extents,
67
+ const glyphy_extents_t *other);
68
+
69
+glyphy_bool_t
70
+glyphy_extents_includes (const glyphy_extents_t *extents,
71
+ const glyphy_point_t *p);
72
+
73
+void
74
+glyphy_extents_scale (glyphy_extents_t *extents,
75
+ double x_scale,
76
+ double y_scale);
77
+
78
+
79
+
80
+/*
81
+ * Circular arcs
82
+ */
83
+
84
+
85
+typedef struct {
86
+ glyphy_point_t p0;
87
+ glyphy_point_t p1;
88
+ double d;
89
+} glyphy_arc_t;
90
+
91
+
92
+/* Build from a conventional arc representation */
93
+void
94
+glyphy_arc_from_conventional (const glyphy_point_t *center,
95
+ double radius,
96
+ double angle0,
97
+ double angle1,
98
+ glyphy_bool_t negative,
99
+ glyphy_arc_t *arc);
100
+
101
+/* Convert to a conventional arc representation */
102
+void
103
+glyphy_arc_to_conventional (glyphy_arc_t arc,
104
+ glyphy_point_t *center /* may be NULL */,
105
+ double *radius /* may be NULL */,
106
+ double *angle0 /* may be NULL */,
107
+ double *angle1 /* may be NULL */,
108
+ glyphy_bool_t *negative /* may be NULL */);
109
+
110
+glyphy_bool_t
111
+glyphy_arc_is_a_line (glyphy_arc_t arc);
112
+
113
+void
114
+glyphy_arc_extents (glyphy_arc_t arc,
115
+ glyphy_extents_t *extents);
116
+
117
+
118
+
119
+/*
120
+ * Approximate single pieces of geometry to/from one arc
121
+ */
122
+
123
+
124
+void
125
+glyphy_arc_from_line (const glyphy_point_t *p0,
126
+ const glyphy_point_t *p1,
127
+ glyphy_arc_t *arc);
128
+
129
+void
130
+glyphy_arc_from_conic (const glyphy_point_t *p0,
131
+ const glyphy_point_t *p1,
132
+ const glyphy_point_t *p2,
133
+ glyphy_arc_t *arc,
134
+ double *error);
135
+
136
+void
137
+glyphy_arc_from_cubic (const glyphy_point_t *p0,
138
+ const glyphy_point_t *p1,
139
+ const glyphy_point_t *p2,
140
+ const glyphy_point_t *p3,
141
+ glyphy_arc_t *arc,
142
+ double *error);
143
+
144
+void
145
+glyphy_arc_to_cubic (const glyphy_arc_t *arc,
146
+ glyphy_point_t *p0,
147
+ glyphy_point_t *p1,
148
+ glyphy_point_t *p2,
149
+ glyphy_point_t *p3,
150
+ double *error);
151
+
152
+
153
+
154
+/*
155
+ * Approximate outlines with multiple arcs
156
+ */
157
+
158
+
159
+typedef struct {
160
+ glyphy_point_t p;
161
+ double d;
162
+} glyphy_arc_endpoint_t;
163
+
164
+typedef glyphy_bool_t (*glyphy_arc_endpoint_accumulator_callback_t) (glyphy_arc_endpoint_t *endpoint,
165
+ void *user_data);
166
+
167
+
168
+typedef struct glyphy_arc_accumulator_t glyphy_arc_accumulator_t;
169
+
170
+glyphy_arc_accumulator_t *
171
+glyphy_arc_accumulator_create (void);
172
+
173
+void
174
+glyphy_arc_accumulator_destroy (glyphy_arc_accumulator_t *acc);
175
+
176
+glyphy_arc_accumulator_t *
177
+glyphy_arc_accumulator_reference (glyphy_arc_accumulator_t *acc);
178
+
179
+
180
+void
181
+glyphy_arc_accumulator_reset (glyphy_arc_accumulator_t *acc);
182
+
183
+
184
+/* Configure accumulator */
185
+
186
+void
187
+glyphy_arc_accumulator_set_tolerance (glyphy_arc_accumulator_t *acc,
188
+ double tolerance);
189
+
190
+double
191
+glyphy_arc_accumulator_get_tolerance (glyphy_arc_accumulator_t *acc);
192
+
193
+void
194
+glyphy_arc_accumulator_set_callback (glyphy_arc_accumulator_t *acc,
195
+ glyphy_arc_endpoint_accumulator_callback_t callback,
196
+ void *user_data);
197
+
198
+void
199
+glyphy_arc_accumulator_get_callback (glyphy_arc_accumulator_t *acc,
200
+ glyphy_arc_endpoint_accumulator_callback_t *callback,
201
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/stringize
Added
19
1
2
+#!/bin/sh
3
+
4
+if test "$#" = 0; then
5
+ echo "Usage: $0 DECL-SPEC FILE..."
6
+ exit 1
7
+fi
8
+decl="$1"
9
+shift
10
+
11
+echo "$decl ="
12
+sed '
13
+s/\\/\\\\/g;
14
+s/"/\\"/g;
15
+s/^/"/;
16
+s/$/\\n"/;
17
+' "$@"
18
+echo ";"
19
avidemux_2.6.8.tar.gz/avidemux_plugins/ADM_videoFilters6_openGl/glGlyphy/glyphy/update.make
Added
17
1
2
+SHADERS = \
3
+ glyphy-common.glsl \
4
+ glyphy-sdf.glsl \
5
+ $(NULL)
6
+SHADERHEADERS = $(patsubst %.glsl,%-glsl.h, $(SHADERS))
7
+
8
+
9
+%-glsl.h: %.glsl stringize
10
+ $(AM_V_GEN) ./stringize "static const char *`echo "$<" | \
11
+ sed 's@.*/@@;s/[-.]/_/g'`" < "$<" > "$@.tmp" && \
12
+ mv "$@.tmp" "$@" || ($(RM) "$@.tmp"; false)
13
+
14
+
15
+all: $(SHADERHEADERS)
16
+
17
avidemux_2.6.7.tar.gz/cmake/admConfigHelper.cmake -> avidemux_2.6.8.tar.gz/cmake/admConfigHelper.cmake
Changed
12
1
2
ENDIF (NOT ${headerFile} STREQUAL "")
3
4
IF (_proceed AND NOT ${ARGV2} STREQUAL "")
5
+ # On Mac, search firts in port libs, else we might use an older lib coming from the system (e.g. iconv)
6
+ IF(APPLE)
7
+ FIND_LIBRARY(${prefix}_LIBRARY_DIR ${ARGV2} PATHS /opt/local/lib NO_DEFAULT_PATH) # needed for port stuff
8
+ ENDIF(APPLE)
9
FIND_LIBRARY(${prefix}_LIBRARY_DIR ${ARGV2})
10
MARK_AS_ADVANCED(${prefix}_LIBRARY_DIR)
11
12
avidemux_2.6.7.tar.gz/cmake/admPyFunc.pl -> avidemux_2.6.8.tar.gz/cmake/admPyFunc.pl
Changed
15
1
2
{
3
my $num=shift;
4
my $type=shift;
5
- print OUTPUT "$type p".$num."=";
6
+ my $extra="";
7
+ if($type=~m/^char/)
8
+ {
9
+ $extra="*";
10
+ }
11
+ print OUTPUT "$type $extra p".$num."=";
12
print OUTPUT castFrom($type);
13
print OUTPUT ";\n";
14
}
15
avidemux_2.6.7.tar.gz/cmake/avidemuxVersion.cmake -> avidemux_2.6.8.tar.gz/cmake/avidemuxVersion.cmake
Changed
10
1
2
SET(RELEASE 1)
3
SET(CPACK_PACKAGE_VERSION_MAJOR "2")
4
SET(CPACK_PACKAGE_VERSION_MINOR "6")
5
-SET(CPACK_PACKAGE_VERSION_PATCH "7")
6
+SET(CPACK_PACKAGE_VERSION_PATCH "8")
7
SET(AVIDEMUX_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
8
IF(NOT RELEASE)
9
SET(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${ADM_SUBVERSION}")
10