FFmpeg  4.0
avxsynth_c.h
Go to the documentation of this file.
1 // Avisynth C Interface Version 0.20
2 // Copyright 2003 Kevin Atkinson
3 
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 // MA 02110-1301 USA, or visit
18 // http://www.gnu.org/copyleft/gpl.html .
19 //
20 // As a special exception, I give you permission to link to the
21 // Avisynth C interface with independent modules that communicate with
22 // the Avisynth C interface solely through the interfaces defined in
23 // avisynth_c.h, regardless of the license terms of these independent
24 // modules, and to copy and distribute the resulting combined work
25 // under terms of your choice, provided that every copy of the
26 // combined work is accompanied by a complete copy of the source code
27 // of the Avisynth C interface and Avisynth itself (with the version
28 // used to produce the combined work), being distributed under the
29 // terms of the GNU General Public License plus this exception. An
30 // independent module is a module which is not derived from or based
31 // on Avisynth C Interface, such as 3rd-party filters, import and
32 // export plugins, or graphical user interfaces.
33 
34 #ifndef __AVXSYNTH_C__
35 #define __AVXSYNTH_C__
36 
38 #include <stdarg.h>
39 
40 #ifdef __cplusplus
41 # define EXTERN_C extern "C"
42 #else
43 # define EXTERN_C
44 #endif
45 
46 #define AVSC_USE_STDCALL 1
47 
48 #ifndef AVSC_USE_STDCALL
49 # define AVSC_CC __cdecl
50 #else
51 # define AVSC_CC __stdcall
52 #endif
53 
54 #define AVSC_INLINE static __inline
55 
56 #ifdef AVISYNTH_C_EXPORTS
57 # define AVSC_EXPORT EXTERN_C
58 # define AVSC_API(ret, name) EXTERN_C __declspec(dllexport) ret AVSC_CC name
59 #else
60 # define AVSC_EXPORT EXTERN_C __declspec(dllexport)
61 # ifndef AVSC_NO_DECLSPEC
62 # define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name
63 # else
64 # define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func)
65 # endif
66 #endif
67 
68 #ifdef __GNUC__
69 typedef long long int INT64;
70 #else
71 typedef __int64 INT64;
72 #endif
73 
74 
75 /////////////////////////////////////////////////////////////////////
76 //
77 // Constants
78 //
79 
80 #ifndef __AVXSYNTH_H__
82 #endif
83 
84 enum {AVS_SAMPLE_INT8 = 1<<0,
89 
90 enum {AVS_PLANAR_Y=1<<0,
97 
98  // Colorspace properties.
99 enum {AVS_CS_BGR = 1<<28,
100  AVS_CS_YUV = 1<<29,
102  AVS_CS_PLANAR = 1<<31};
103 
104  // Specific colorformats
105 enum {
110  AVS_CS_YV12 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar
111  AVS_CS_I420 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar
112  AVS_CS_IYUV = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR // same as above
113 };
114 
115 enum {
116  AVS_IT_BFF = 1<<0,
117  AVS_IT_TFF = 1<<1,
119 
120 enum {
131 
132 enum { //SUBTYPES
137 
138 enum {
145 };
146 
147 #define AVS_FRAME_ALIGN 16
148 
149 typedef struct AVS_Clip AVS_Clip;
151 
152 /////////////////////////////////////////////////////////////////////
153 //
154 // AVS_VideoInfo
155 //
156 
157 // AVS_VideoInfo is layed out identicly to VideoInfo
158 typedef struct AVS_VideoInfo {
159  int width, height; // width=0 means no video
160  unsigned fps_numerator, fps_denominator;
161  int num_frames;
162 
163  int pixel_type;
164 
165  int audio_samples_per_second; // 0 means no audio
166  int sample_type;
168  int nchannels;
169 
170  // Imagetype properties
171 
172  int image_type;
173 } AVS_VideoInfo;
174 
175 // useful functions of the above
177  { return (p->width!=0); }
178 
180  { return (p->audio_samples_per_second!=0); }
181 
183  { return !!(p->pixel_type&AVS_CS_BGR); }
184 
186  { return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties
187 
189  { return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; }
190 
192  { return !!(p->pixel_type&AVS_CS_YUV ); }
193 
195  { return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; }
196 
198  { return ((p->pixel_type & AVS_CS_YV12) == AVS_CS_YV12)||((p->pixel_type & AVS_CS_I420) == AVS_CS_I420); }
199 
201  { return ((p->pixel_type & c_space) == c_space); }
202 
203 AVSC_INLINE int avs_is_property(const AVS_VideoInfo * p, int property)
204  { return ((p->pixel_type & property)==property ); }
205 
207  { return !!(p->pixel_type & AVS_CS_PLANAR); }
208 
210  { return !!(p->image_type & AVS_IT_FIELDBASED); }
211 
213  { return ((p->image_type & AVS_IT_FIELDBASED)&&(p->image_type & (AVS_IT_BFF | AVS_IT_TFF))); }
214 
216  { return !!(p->image_type & AVS_IT_BFF); }
217 
219  { return !!(p->image_type & AVS_IT_TFF); }
220 
222 {
223  switch (p->pixel_type) {
224  case AVS_CS_BGR24: return 24;
225  case AVS_CS_BGR32: return 32;
226  case AVS_CS_YUY2: return 16;
227  case AVS_CS_YV12:
228  case AVS_CS_I420: return 12;
229  default: return 0;
230  }
231 }
233  { return pixels * (avs_bits_per_pixel(p)>>3); } // Will work on planar images, but will return only luma planes
234 
236  { return avs_bytes_from_pixels(p,p->width); } // Also only returns first plane on planar images
237 
239  { if (avs_is_planar(vi)) {int p = vi->height * ((avs_row_size(vi)+3) & ~3); p+=p>>1; return p; } return vi->height * ((avs_row_size(vi)+3) & ~3); }
240 
242  { return p->audio_samples_per_second; }
243 
244 
246 {
247  switch (p->sample_type) {
248  case AVS_SAMPLE_INT8: return sizeof(signed char);
249  case AVS_SAMPLE_INT16: return sizeof(signed short);
250  case AVS_SAMPLE_INT24: return 3;
251  case AVS_SAMPLE_INT32: return sizeof(signed int);
252  case AVS_SAMPLE_FLOAT: return sizeof(float);
253  default: return 0;
254  }
255 }
257  { return p->nchannels*avs_bytes_per_channel_sample(p);}
258 
260  { return ((INT64)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); }
261 
263  { return (int)(samples * (INT64)p->fps_numerator / (INT64)p->fps_denominator / (INT64)p->audio_samples_per_second); }
264 
266  { return bytes / avs_bytes_per_audio_sample(p); }
267 
269  { return samples * avs_bytes_per_audio_sample(p); }
270 
272  { return p->nchannels; }
273 
275  { return p->sample_type;}
276 
277 // useful mutator
279  { p->image_type|=property; }
280 
282  { p->image_type&=~property; }
283 
284 AVSC_INLINE void avs_set_field_based(AVS_VideoInfo * p, int isfieldbased)
285  { if (isfieldbased) p->image_type|=AVS_IT_FIELDBASED; else p->image_type&=~AVS_IT_FIELDBASED; }
286 
287 AVSC_INLINE void avs_set_fps(AVS_VideoInfo * p, unsigned numerator, unsigned denominator)
288 {
289  unsigned x=numerator, y=denominator;
290  while (y) { // find gcd
291  unsigned t = x%y; x = y; y = t;
292  }
293  p->fps_numerator = numerator/x;
294  p->fps_denominator = denominator/x;
295 }
296 
298 {
299  return (x->pixel_type == y->pixel_type)
300  || (avs_is_yv12(x) && avs_is_yv12(y));
301 }
302 
303 /////////////////////////////////////////////////////////////////////
304 //
305 // AVS_VideoFrame
306 //
307 
308 // VideoFrameBuffer holds information about a memory block which is used
309 // for video data. For efficiency, instances of this class are not deleted
310 // when the refcount reaches zero; instead they're stored in a linked list
311 // to be reused. The instances are deleted when the corresponding AVS
312 // file is closed.
313 
314 // AVS_VideoFrameBuffer is layed out identicly to VideoFrameBuffer
315 // DO NOT USE THIS STRUCTURE DIRECTLY
316 typedef struct AVS_VideoFrameBuffer {
317  unsigned char * data;
318  int data_size;
319  // sequence_number is incremented every time the buffer is changed, so
320  // that stale views can tell they're no longer valid.
322 
323  long refcount;
325 
326 // VideoFrame holds a "window" into a VideoFrameBuffer.
327 
328 // AVS_VideoFrame is layed out identicly to IVideoFrame
329 // DO NOT USE THIS STRUCTURE DIRECTLY
330 typedef struct AVS_VideoFrame {
331  int refcount;
332  AVS_VideoFrameBuffer * vfb;
333  int offset, pitch, row_size, height, offsetU, offsetV, pitchUV; // U&V offsets are from top of picture.
335 
336 // Access functions for AVS_VideoFrame
338  return p->pitch;}
339 
341  switch (plane) {
342  case AVS_PLANAR_U: case AVS_PLANAR_V: return p->pitchUV;}
343  return p->pitch;}
344 
346  return p->row_size; }
347 
349  int r;
350  switch (plane) {
351  case AVS_PLANAR_U: case AVS_PLANAR_V:
352  if (p->pitchUV) return p->row_size>>1;
353  else return 0;
355  if (p->pitchUV) {
356  r = ((p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)) )>>1; // Aligned rowsize
357  if (r < p->pitchUV)
358  return r;
359  return p->row_size>>1;
360  } else return 0;
362  r = (p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize
363  if (r <= p->pitch)
364  return r;
365  return p->row_size;
366  }
367  return p->row_size;
368 }
369 
371  return p->height;}
372 
374  switch (plane) {
375  case AVS_PLANAR_U: case AVS_PLANAR_V:
376  if (p->pitchUV) return p->height>>1;
377  return 0;
378  }
379  return p->height;}
380 
381 AVSC_INLINE const unsigned char* avs_get_read_ptr(const AVS_VideoFrame * p) {
382  return p->vfb->data + p->offset;}
383 
384 AVSC_INLINE const unsigned char* avs_get_read_ptr_p(const AVS_VideoFrame * p, int plane)
385 {
386  switch (plane) {
387  case AVS_PLANAR_U: return p->vfb->data + p->offsetU;
388  case AVS_PLANAR_V: return p->vfb->data + p->offsetV;
389  default: return p->vfb->data + p->offset;}
390 }
391 
393  return (p->refcount == 1 && p->vfb->refcount == 1);}
394 
396 {
397  if (avs_is_writable(p)) {
398  ++p->vfb->sequence_number;
399  return p->vfb->data + p->offset;
400  } else
401  return 0;
402 }
403 
404 AVSC_INLINE unsigned char* avs_get_write_ptr_p(const AVS_VideoFrame * p, int plane)
405 {
406  if (plane==AVS_PLANAR_Y && avs_is_writable(p)) {
407  ++p->vfb->sequence_number;
408  return p->vfb->data + p->offset;
409  } else if (plane==AVS_PLANAR_Y) {
410  return 0;
411  } else {
412  switch (plane) {
413  case AVS_PLANAR_U: return p->vfb->data + p->offsetU;
414  case AVS_PLANAR_V: return p->vfb->data + p->offsetV;
415  default: return p->vfb->data + p->offset;
416  }
417  }
418 }
419 
420 #if defined __cplusplus
421 extern "C"
422 {
423 #endif // __cplusplus
424 AVSC_API(void, avs_release_video_frame)(AVS_VideoFrame *);
425 // makes a shallow copy of a video frame
426 AVSC_API(AVS_VideoFrame *, avs_copy_video_frame)(AVS_VideoFrame *);
427 #if defined __cplusplus
428 }
429 #endif // __cplusplus
430 
431 #ifndef AVSC_NO_DECLSPEC
433  {avs_release_video_frame(f);}
435  {return avs_copy_video_frame(f);}
436 #endif
437 
438 /////////////////////////////////////////////////////////////////////
439 //
440 // AVS_Value
441 //
442 
443 // Treat AVS_Value as a fat pointer. That is use avs_copy_value
444 // and avs_release_value appropiaty as you would if AVS_Value was
445 // a pointer.
446 
447 // To maintain source code compatibility with future versions of the
448 // avisynth_c API don't use the AVS_Value directly. Use the helper
449 // functions below.
450 
451 // AVS_Value is layed out identicly to AVSValue
452 typedef struct AVS_Value AVS_Value;
453 struct AVS_Value {
454  short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong
455  // for some function e'rror
456  short array_size;
457  union {
458  void * clip; // do not use directly, use avs_take_clip
459  char boolean;
460  int integer;
461  INT64 integer64; // match addition of __int64 to avxplugin.h
462  float floating_pt;
463  const char * string;
464  const AVS_Value * array;
465  } d;
466 };
467 
468 // AVS_Value should be initilized with avs_void.
469 // Should also set to avs_void after the value is released
470 // with avs_copy_value. Consider it the equalvent of setting
471 // a pointer to NULL
472 static const AVS_Value avs_void = {'v'};
473 
474 AVSC_API(void, avs_copy_value)(AVS_Value * dest, AVS_Value src);
475 AVSC_API(void, avs_release_value)(AVS_Value);
476 
477 AVSC_INLINE int avs_defined(AVS_Value v) { return v.type != 'v'; }
478 AVSC_INLINE int avs_is_clip(AVS_Value v) { return v.type == 'c'; }
479 AVSC_INLINE int avs_is_bool(AVS_Value v) { return v.type == 'b'; }
480 AVSC_INLINE int avs_is_int(AVS_Value v) { return v.type == 'i'; }
481 AVSC_INLINE int avs_is_float(AVS_Value v) { return v.type == 'f' || v.type == 'i'; }
482 AVSC_INLINE int avs_is_string(AVS_Value v) { return v.type == 's'; }
483 AVSC_INLINE int avs_is_array(AVS_Value v) { return v.type == 'a'; }
484 AVSC_INLINE int avs_is_error(AVS_Value v) { return v.type == 'e'; }
485 
486 #if defined __cplusplus
487 extern "C"
488 {
489 #endif // __cplusplus
490 AVSC_API(AVS_Clip *, avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *);
491 AVSC_API(void, avs_set_to_clip)(AVS_Value *, AVS_Clip *);
492 #if defined __cplusplus
493 }
494 #endif // __cplusplus
495 
496 AVSC_INLINE int avs_as_bool(AVS_Value v)
497  { return v.d.boolean; }
498 AVSC_INLINE int avs_as_int(AVS_Value v)
499  { return v.d.integer; }
500 AVSC_INLINE const char * avs_as_string(AVS_Value v)
501  { return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; }
502 AVSC_INLINE double avs_as_float(AVS_Value v)
503  { return avs_is_int(v) ? v.d.integer : v.d.floating_pt; }
504 AVSC_INLINE const char * avs_as_error(AVS_Value v)
505  { return avs_is_error(v) ? v.d.string : 0; }
506 AVSC_INLINE const AVS_Value * avs_as_array(AVS_Value v)
507  { return v.d.array; }
508 AVSC_INLINE int avs_array_size(AVS_Value v)
509  { return avs_is_array(v) ? v.array_size : 1; }
510 AVSC_INLINE AVS_Value avs_array_elt(AVS_Value v, int index)
511  { return avs_is_array(v) ? v.d.array[index] : v; }
512 
513 // only use these functions on am AVS_Value that does not already have
514 // an active value. Remember, treat AVS_Value as a fat pointer.
516  { AVS_Value v = {0}; v.type = 'b'; v.d.boolean = v0 == 0 ? 0 : 1; return v; }
518  { AVS_Value v = {0}; v.type = 'i'; v.d.integer = v0; return v; }
519 AVSC_INLINE AVS_Value avs_new_value_string(const char * v0)
520  { AVS_Value v = {0}; v.type = 's'; v.d.string = v0; return v; }
522  { AVS_Value v = {0}; v.type = 'f'; v.d.floating_pt = v0; return v;}
523 AVSC_INLINE AVS_Value avs_new_value_error(const char * v0)
524  { AVS_Value v = {0}; v.type = 'e'; v.d.string = v0; return v; }
525 #ifndef AVSC_NO_DECLSPEC
527  { AVS_Value v = {0}; avs_set_to_clip(&v, v0); return v; }
528 #endif
529 AVSC_INLINE AVS_Value avs_new_value_array(AVS_Value * v0, int size)
530  { AVS_Value v = {0}; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; }
531 
532 /////////////////////////////////////////////////////////////////////
533 //
534 // AVS_Clip
535 //
536 #if defined __cplusplus
537 extern "C"
538 {
539 #endif // __cplusplus
540 AVSC_API(void, avs_release_clip)(AVS_Clip *);
541 AVSC_API(AVS_Clip *, avs_copy_clip)(AVS_Clip *);
542 
543 AVSC_API(const char *, avs_clip_get_error)(AVS_Clip *); // return 0 if no error
544 
545 AVSC_API(const AVS_VideoInfo *, avs_get_video_info)(AVS_Clip *);
546 
547 AVSC_API(int, avs_get_version)(AVS_Clip *);
548 
549 AVSC_API(AVS_VideoFrame *, avs_get_frame)(AVS_Clip *, int n);
550 // The returned video frame must be released with avs_release_video_frame
551 
552 AVSC_API(int, avs_get_parity)(AVS_Clip *, int n);
553 // return field parity if field_based, else parity of first field in frame
554 
555 AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf,
557 // start and count are in samples
558 
559 AVSC_API(int, avs_set_cache_hints)(AVS_Clip *,
560  int cachehints, size_t frame_range);
561 #if defined __cplusplus
562 }
563 #endif // __cplusplus
564 
565 // This is the callback type used by avs_add_function
566 typedef AVS_Value (AVSC_CC * AVS_ApplyFunc)
567  (AVS_ScriptEnvironment *, AVS_Value args, void * user_data);
568 
569 typedef struct AVS_FilterInfo AVS_FilterInfo;
570 struct AVS_FilterInfo
571 {
572  // these members should not be modified outside of the AVS_ApplyFunc callback
573  AVS_Clip * child;
575  AVS_ScriptEnvironment * env;
577  int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n);
578  int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf,
580  int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints,
581  int frame_range);
582  void (AVSC_CC * free_filter)(AVS_FilterInfo *);
583 
584  // Should be set when ever there is an error to report.
585  // It is cleared before any of the above methods are called
586  const char * error;
587  // this is to store whatever and may be modified at will
588  void * user_data;
589 };
590 
591 // Create a new filter
592 // fi is set to point to the AVS_FilterInfo so that you can
593 // modify it once it is initilized.
594 // store_child should generally be set to true. If it is not
595 // set than ALL methods (the function pointers) must be defined
596 // If it is set than you do not need to worry about freeing the child
597 // clip.
598 #if defined __cplusplus
599 extern "C"
600 {
601 #endif // __cplusplus
602 AVSC_API(AVS_Clip *, avs_new_c_filter)(AVS_ScriptEnvironment * e,
604  AVS_Value child, int store_child);
605 #if defined __cplusplus
606 }
607 #endif // __cplusplus
608 
609 
610 /////////////////////////////////////////////////////////////////////
611 //
612 // AVS_ScriptEnvironment
613 //
614 
615 // For GetCPUFlags. These are backwards-compatible with those in VirtualDub.
616 enum {
617  /* slowest CPU to support extension */
618  AVS_CPU_FORCE = 0x01, // N/A
619  AVS_CPU_FPU = 0x02, // 386/486DX
620  AVS_CPU_MMX = 0x04, // P55C, K6, PII
621  AVS_CPU_INTEGER_SSE = 0x08, // PIII, Athlon
622  AVS_CPU_SSE = 0x10, // PIII, Athlon XP/MP
623  AVS_CPU_SSE2 = 0x20, // PIV, Hammer
624  AVS_CPU_3DNOW = 0x40, // K6-2
625  AVS_CPU_3DNOW_EXT = 0x80, // Athlon
626  AVS_CPU_X86_64 = 0xA0, // Hammer (note: equiv. to 3DNow + SSE2,
627  // which only Hammer will have anyway)
628 };
629 
630 #if defined __cplusplus
631 extern "C"
632 {
633 #endif // __cplusplus
634 AVSC_API(const char *, avs_get_error)(AVS_ScriptEnvironment *); // return 0 if no error
635 
636 AVSC_API(long, avs_get_cpu_flags)(AVS_ScriptEnvironment *);
637 AVSC_API(int, avs_check_version)(AVS_ScriptEnvironment *, int version);
638 
639 AVSC_API(char *, avs_save_string)(AVS_ScriptEnvironment *, const char* s, int length);
640 AVSC_API(char *, avs_sprintf)(AVS_ScriptEnvironment *, const char * fmt, ...);
641 
642 AVSC_API(char *, avs_vsprintf)(AVS_ScriptEnvironment *, const char * fmt, va_list val);
643  // note: val is really a va_list; I hope everyone typedefs va_list to a pointer
644 
645 AVSC_API(int, avs_add_function)(AVS_ScriptEnvironment *,
646  const char * name, const char * params,
647  AVS_ApplyFunc apply, void * user_data);
648 
649 AVSC_API(int, avs_function_exists)(AVS_ScriptEnvironment *, const char * name);
650 
651 AVSC_API(AVS_Value, avs_invoke)(AVS_ScriptEnvironment *, const char * name,
652  AVS_Value args, const char** arg_names);
653 // The returned value must be be released with avs_release_value
654 
655 AVSC_API(AVS_Value, avs_get_var)(AVS_ScriptEnvironment *, const char* name);
656 // The returned value must be be released with avs_release_value
657 
658 AVSC_API(int, avs_set_var)(AVS_ScriptEnvironment *, const char* name, AVS_Value val);
659 
660 AVSC_API(int, avs_set_global_var)(AVS_ScriptEnvironment *, const char* name, const AVS_Value val);
661 
662 //void avs_push_context(AVS_ScriptEnvironment *, int level=0);
663 //void avs_pop_context(AVS_ScriptEnvironment *);
664 
665 AVSC_API(AVS_VideoFrame *, avs_new_video_frame_a)(AVS_ScriptEnvironment *,
666  const AVS_VideoInfo * vi, int align);
667 // align should be at least 16
668 #if defined __cplusplus
669 }
670 #endif // __cplusplus
671 
672 #ifndef AVSC_NO_DECLSPEC
675  const AVS_VideoInfo * vi)
676  {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);}
677 
680  const AVS_VideoInfo * vi)
681  {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);}
682 #endif
683 
684 #if defined __cplusplus
685 extern "C"
686 {
687 #endif // __cplusplus
688 AVSC_API(int, avs_make_writable)(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf);
689 
690 AVSC_API(void, avs_bit_blt)(AVS_ScriptEnvironment *, unsigned char* dstp, int dst_pitch, const unsigned char* srcp, int src_pitch, int row_size, int height);
691 
693 AVSC_API(void, avs_at_exit)(AVS_ScriptEnvironment *, AVS_ShutdownFunc function, void * user_data);
694 
696 // The returned video frame must be be released
697 
698 AVSC_API(int, avs_set_memory_max)(AVS_ScriptEnvironment *, int mem);
699 
700 AVSC_API(int, avs_set_working_dir)(AVS_ScriptEnvironment *, const char * newdir);
701 
702 // avisynth.dll exports this; it's a way to use it as a library, without
703 // writing an AVS script or without going through AVIFile.
704 AVSC_API(AVS_ScriptEnvironment *, avs_create_script_environment)(int version);
705 #if defined __cplusplus
706 }
707 #endif // __cplusplus
708 
709 // this symbol is the entry point for the plugin and must
710 // be defined
713 
714 
715 #if defined __cplusplus
716 extern "C"
717 {
718 #endif // __cplusplus
719 AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *);
720 
721 
723 // The returned video frame must be be released
724 #if defined __cplusplus
725 }
726 #endif // __cplusplus
727 
728 #endif //__AVXSYNTH_C__
int plane
Definition: avisynth_c.h:422
int mem
Definition: avxsynth_c.h:698
int size
AVSC_INLINE int avs_is_string(AVS_Value v)
Definition: avxsynth_c.h:482
volatile long sequence_number
Definition: avisynth_c.h:523
AVSC_INLINE int avs_is_rgb(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:182
AVSC_INLINE int avs_array_size(AVS_Value v)
Definition: avxsynth_c.h:508
AVSC_INLINE AVS_Value avs_new_value_clip(AVS_Clip *v0)
Definition: avxsynth_c.h:526
AVSC_INLINE int avs_is_array(AVS_Value v)
Definition: avxsynth_c.h:483
short array_size
Definition: avisynth_c.h:602
AVSC_INLINE int avs_samples_per_second(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:241
AVS_FilterInfo AVS_Value child
Definition: avxsynth_c.h:603
AVSC_INLINE int avs_is_bool(AVS_Value v)
Definition: avxsynth_c.h:479
AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo *p, INT64 samples)
Definition: avxsynth_c.h:262
const char const char AVS_ApplyFunc void * user_data
Definition: avxsynth_c.h:646
const char * newdir
Definition: avxsynth_c.h:700
AVSC_INLINE int avs_bytes_from_pixels(const AVS_VideoInfo *p, int pixels)
Definition: avxsynth_c.h:232
AVSC_INLINE AVS_Value avs_array_elt(AVS_Value v, int index)
Definition: avxsynth_c.h:510
AVSC_INLINE int avs_sample_type(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:274
char boolean
Definition: avisynth_c.h:605
AVSC_INLINE INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo *p, INT64 samples)
Definition: avxsynth_c.h:268
#define AVSC_CC
Definition: avxsynth_c.h:51
AVSC_INLINE AVS_Value avs_new_value_float(float v0)
Definition: avxsynth_c.h:521
AVSC_INLINE INT64 avs_audio_samples_from_frames(const AVS_VideoInfo *p, INT64 frames)
Definition: avxsynth_c.h:259
void INT64 start
Definition: avxsynth_c.h:555
const char * string
Definition: avisynth_c.h:608
long long int INT64
Definition: types.h:46
const char * s
Definition: avxsynth_c.h:639
AVSC_INLINE int avs_is_planar(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:206
AVSC_INLINE int avs_bmp_size(const AVS_VideoInfo *vi)
Definition: avxsynth_c.h:238
AVSC_INLINE void avs_set_property(AVS_VideoInfo *p, int property)
Definition: avxsynth_c.h:278
INT64 integer64
Definition: avxsynth_c.h:461
short type
Definition: avisynth_c.h:600
#define AVSC_INLINE
Definition: avxsynth_c.h:54
AVSC_INLINE int avs_has_audio(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:179
AVSC_INLINE int avs_is_rgb24(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:185
const char AVS_Value const char ** arg_names
Definition: avxsynth_c.h:651
const char const char va_list val
Definition: avxsynth_c.h:642
AVSC_INLINE int avs_has_video(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:176
const AVS_Value * array
Definition: avisynth_c.h:609
const char * name
Definition: avxsynth_c.h:646
AVSC_INLINE AVS_Value avs_new_value_string(const char *v0)
Definition: avxsynth_c.h:519
volatile long refcount
Definition: avisynth_c.h:533
volatile long refcount
Definition: avisynth_c.h:525
AVS_VideoFrame int int int int new_height
Definition: avxsynth_c.h:695
int n
Definition: avxsynth_c.h:549
AVSC_INLINE void avs_set_fps(AVS_VideoInfo *p, unsigned numerator, unsigned denominator)
Definition: avxsynth_c.h:287
AVSC_INLINE int avs_get_pitch_p(const AVS_VideoFrame *p, int plane)
Definition: avxsynth_c.h:340
unsigned char * dstp
Definition: avxsynth_c.h:690
AVSC_INLINE AVS_Value avs_new_value_int(int v0)
Definition: avxsynth_c.h:517
#define AVSC_API(ret, name)
Definition: avxsynth_c.h:62
INT64 num_audio_samples
Definition: avisynth_c.h:326
AVSC_INLINE const unsigned char * avs_get_read_ptr(const AVS_VideoFrame *p)
Definition: avxsynth_c.h:381
const char * r
Definition: vf_curves.c:111
AVSC_INLINE int avs_get_row_size(const AVS_VideoFrame *p)
Definition: avxsynth_c.h:345
const AVS_VideoInfo int align
Definition: avxsynth_c.h:666
struct AVS_Clip AVS_Clip
Definition: avisynth_c.h:308
AVSC_INLINE int avs_is_property(const AVS_VideoInfo *p, int property)
Definition: avxsynth_c.h:203
AVSC_INLINE int avs_is_parity_known(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:212
AVSC_INLINE int avs_is_color_space(const AVS_VideoInfo *p, int c_space)
Definition: avxsynth_c.h:200
static const uint8_t offset[127][2]
Definition: vf_spp.c:92
void * buf
Definition: avxsynth_c.h:555
AVS_VideoFrame int int int int int rel_offsetU
Definition: avxsynth_c.h:722
AVSC_INLINE int avs_get_pitch(const AVS_VideoFrame *p)
Definition: avxsynth_c.h:337
static int get_frame(AVFilterContext *ctx, int is_second)
Definition: vf_nnedi.c:689
unsigned fps_numerator
Definition: avisynth_c.h:319
AVS_VideoFrame ** pvf
Definition: avxsynth_c.h:688
int64_t __int64
AVSC_INLINE int avs_as_int(AVS_Value v)
Definition: avxsynth_c.h:498
AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:271
AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:245
AVSC_INLINE int avs_get_height(const AVS_VideoFrame *p)
Definition: avxsynth_c.h:370
AVSC_INLINE unsigned char * avs_get_write_ptr_p(const AVS_VideoFrame *p, int plane)
Definition: avxsynth_c.h:404
AVSC_INLINE int avs_is_int(AVS_Value v)
Definition: avxsynth_c.h:480
union AVS_Value::@10 d
AVS_ScriptEnvironment AVS_Clip *AVSC_INLINE int avs_as_bool(AVS_Value v)
Definition: avxsynth_c.h:496
AVS_VideoFrame int int int new_row_size
Definition: avxsynth_c.h:695
AVS_FilterInfo ** fi
Definition: avxsynth_c.h:603
AVSC_INLINE void avs_release_frame(AVS_VideoFrame *f)
Definition: avxsynth_c.h:432
int frames
Definition: movenc.c:65
static void error(const char *err)
AVSC_INLINE int avs_is_float(AVS_Value v)
Definition: avxsynth_c.h:481
const AVS_VideoInfo * vi
Definition: avxsynth_c.h:666
AVSC_INLINE int avs_bits_per_pixel(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:221
AVS_VideoFrame int int new_pitch
Definition: avxsynth_c.h:695
const char const char * params
Definition: avxsynth_c.h:646
AVSC_EXPORT const char *AVSC_CC avisynth_c_plugin_init(AVS_ScriptEnvironment *env)
const char * fmt
Definition: avxsynth_c.h:640
AVSC_INLINE const unsigned char * avs_get_read_ptr_p(const AVS_VideoFrame *p, int plane)
Definition: avxsynth_c.h:384
typedef void(RENAME(mix_any_func_type))
AVSC_INLINE int avs_is_yv12(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:197
AVSC_INLINE const char * avs_as_error(AVS_Value v)
Definition: avxsynth_c.h:504
AVSC_INLINE int avs_defined(AVS_Value v)
Definition: avxsynth_c.h:477
int index
Definition: gxfenc.c:89
AVSC_INLINE AVS_Value avs_new_value_bool(int v0)
Definition: avxsynth_c.h:515
AVSC_INLINE int avs_is_clip(AVS_Value v)
Definition: avxsynth_c.h:478
AVS_VideoFrame int int int int int int int new_pitchUV
Definition: avxsynth_c.h:722
cl_device_type type
unsigned char int const unsigned char * srcp
Definition: avxsynth_c.h:690
AVS_Value(AVSC_CC * AVS_ApplyFunc)(AVS_ScriptEnvironment *, AVS_Value args, void *user_data)
Definition: avxsynth_c.h:567
int size_t frame_range
Definition: avxsynth_c.h:560
AVSC_INLINE int avs_is_yuy2(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:194
AVS_VideoFrameBuffer * vfb
Definition: avisynth_c.h:534
void INT64 INT64 count
Definition: avxsynth_c.h:555
const char int length
Definition: avxsynth_c.h:639
const char AVS_Value args
Definition: avxsynth_c.h:651
const char const char AVS_ApplyFunc apply
Definition: avxsynth_c.h:646
AVS_FilterInfo AVS_Value int store_child
Definition: avxsynth_c.h:603
AVSC_INLINE int avs_is_bff(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:215
#define v0
Definition: regdef.h:26
struct AVS_ScriptEnvironment AVS_ScriptEnvironment
Definition: avisynth_c.h:309
int
static double clip(void *opaque, double val)
Clip value val in the minval - maxval range.
Definition: vf_lut.c:162
float floating_pt
Definition: avisynth_c.h:607
AVSC_INLINE AVS_VideoFrame * avs_new_video_frame(AVS_ScriptEnvironment *env, const AVS_VideoInfo *vi)
Definition: avxsynth_c.h:674
AVSC_INLINE int avs_is_same_colorspace(AVS_VideoInfo *x, AVS_VideoInfo *y)
Definition: avxsynth_c.h:297
AVSC_INLINE double avs_as_float(AVS_Value v)
Definition: avxsynth_c.h:502
int cachehints
Definition: avxsynth_c.h:560
AVSC_INLINE const char * avs_as_string(AVS_Value v)
Definition: avxsynth_c.h:500
int integer
Definition: avisynth_c.h:606
AVSC_INLINE int avs_is_field_based(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:209
AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:256
AVSC_INLINE int avs_is_rgb32(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:188
AVSC_INLINE int avs_get_height_p(const AVS_VideoFrame *p, int plane)
Definition: avxsynth_c.h:373
int pixels
Definition: avisynth_c.h:429
AVS_Value src
Definition: avxsynth_c.h:474
AVSC_INLINE AVS_Value avs_new_value_array(AVS_Value *v0, int size)
Definition: avxsynth_c.h:529
AVS_VideoFrame int int int int int int rel_offsetV
Definition: avxsynth_c.h:722
AVSC_INLINE AVS_VideoFrame * avs_copy_frame(AVS_VideoFrame *f)
Definition: avxsynth_c.h:434
int c_space
Definition: avisynth_c.h:408
AVSC_INLINE AVS_Value avs_new_value_error(const char *v0)
Definition: avxsynth_c.h:523
AVSC_INLINE const AVS_Value * avs_as_array(AVS_Value v)
Definition: avxsynth_c.h:506
AVSC_INLINE int avs_row_size(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:235
AVSC_INLINE int avs_is_error(AVS_Value v)
Definition: avxsynth_c.h:484
unsigned fps_denominator
Definition: avisynth_c.h:319
AVSC_INLINE int avs_is_tff(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:218
AVSC_INLINE void avs_set_field_based(AVS_VideoInfo *p, int isfieldbased)
Definition: avxsynth_c.h:284
static const AVS_Value avs_void
Definition: avxsynth_c.h:472
unsigned char * data
Definition: avxsynth_c.h:317
AVS_VideoFrame int rel_offset
Definition: avxsynth_c.h:695
int version
Definition: avxsynth_c.h:637
int integer
AVSC_INLINE INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo *p, INT64 bytes)
Definition: avxsynth_c.h:265
#define AVSC_EXPORT
Definition: avxsynth_c.h:60
long long int INT64
Definition: avxsynth_c.h:69
static int array[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:106
unsigned char int const unsigned char int src_pitch
Definition: avxsynth_c.h:690
AVSC_INLINE int avs_get_row_size_p(const AVS_VideoFrame *p, int plane)
Definition: avxsynth_c.h:348
AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo *p)
Definition: avxsynth_c.h:191
void(AVSC_CC * AVS_ShutdownFunc)(void *user_data, AVS_ScriptEnvironment *env)
Definition: avxsynth_c.h:692
AVSC_INLINE void avs_clear_property(AVS_VideoInfo *p, int property)
Definition: avxsynth_c.h:281
unsigned char int const unsigned char int int row_size
Definition: avxsynth_c.h:690
AVSC_INLINE AVS_VideoFrame * avs_new_frame(AVS_ScriptEnvironment *env, const AVS_VideoInfo *vi)
Definition: avxsynth_c.h:679
AVSC_INLINE unsigned char * avs_get_write_ptr(const AVS_VideoFrame *p)
Definition: avxsynth_c.h:395
unsigned char int dst_pitch
Definition: avxsynth_c.h:690
#define AVS_FRAME_ALIGN
Definition: avxsynth_c.h:147
AVSC_INLINE int avs_is_writable(const AVS_VideoFrame *p)
Definition: avxsynth_c.h:392
int audio_samples_per_second
Definition: avisynth_c.h:324