32 #define AVSC_NO_DECLSPEC
38 #define AVISYNTH_LIB "avisynth"
41 #define AVISYNTH_NAME "libavisynth"
42 #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF
47 #define PCM(format) (AV_CODEC_ID_PCM_ ## format ## BE)
49 #define PCM(format) (AV_CODEC_ID_PCM_ ## format ## LE)
52 #include <avisynth/avisynth_c.h>
56 #define AVSC_DECLARE_FUNC(name) name ## _func name
79 #undef AVSC_DECLARE_FUNC
83 AVS_ScriptEnvironment *
env;
85 const AVS_VideoInfo *
vi;
108 AVS_PLANAR_V, AVS_PLANAR_A };
110 AVS_PLANAR_R, AVS_PLANAR_A };
128 #define LOAD_AVS_FUNC(name, continue_on_fail) \
129 avs_library.name = (name ## _func) \
130 dlsym(avs_library.library, #name); \
131 if (!continue_on_fail && !avs_library.name) \
206 while (prev->
next != avs)
247 avs->
vi->fps_denominator };
261 if (avs_is_field_based(avs->
vi)) {
262 if (avs_is_tff(avs->
vi)) {
265 else if (avs_is_bff(avs->
vi)) {
270 switch (avs->
vi->pixel_type) {
272 case AVS_CS_YUV444P10:
276 case AVS_CS_YUV422P10:
280 case AVS_CS_YUV420P10:
284 case AVS_CS_YUV444P12:
288 case AVS_CS_YUV422P12:
292 case AVS_CS_YUV420P12:
296 case AVS_CS_YUV444P14:
300 case AVS_CS_YUV422P14:
304 case AVS_CS_YUV420P14:
308 case AVS_CS_YUV444P16:
312 case AVS_CS_YUV422P16:
316 case AVS_CS_YUV420P16:
333 case AVS_CS_YUVA444P10:
337 case AVS_CS_YUVA422P10:
341 case AVS_CS_YUVA420P10:
345 case AVS_CS_YUVA422P12:
349 case AVS_CS_YUVA444P16:
353 case AVS_CS_YUVA422P16:
357 case AVS_CS_YUVA420P16:
475 "unknown AviSynth colorspace %d\n", avs->
vi->pixel_type);
518 switch (avs->
vi->sample_type) {
519 case AVS_SAMPLE_INT8:
522 case AVS_SAMPLE_INT16:
525 case AVS_SAMPLE_INT24:
528 case AVS_SAMPLE_INT32:
531 case AVS_SAMPLE_FLOAT:
536 "unknown AviSynth sample type %d\n", avs->
vi->sample_type);
550 if (avs_has_video(avs->
vi)) {
558 if (avs_has_audio(avs->
vi)) {
575 char filename_ansi[MAX_PATH * 4];
576 wchar_t filename_wc[MAX_PATH * 4];
584 MultiByteToWideChar(CP_UTF8, 0,
s->url, -1, filename_wc, MAX_PATH * 4);
585 WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi,
587 arg = avs_new_value_string(filename_ansi);
589 arg = avs_new_value_string(
s->url);
592 if (avs_is_error(
val)) {
597 if (!avs_is_clip(
val)) {
612 "AviSynth version is too old. Please upgrade to either AviSynth 2.6 >= RC1 or AviSynth+ >= r1718.\n");
652 AVS_VideoFrame *
frame;
653 unsigned char *dst_p;
654 const unsigned char *src_p;
655 int n,
i, plane, rowsize, planeheight, pitch,
bits, ret;
705 src_p = src_p + (planeheight - 1) * pitch;
710 rowsize, planeheight);
711 dst_p += rowsize * planeheight;
730 fps.
num = avs->
vi->fps_numerator;
731 fps.
den = avs->
vi->fps_denominator;
732 samplerate.
num = avs->
vi->audio_samples_per_second;
735 if (avs_has_video(avs->
vi)) {
761 pkt->
size = avs_bytes_per_channel_sample(avs->
vi) *
762 samples * avs->
vi->nchannels;
853 avs->
vi->fps_denominator };
854 samplerate = (
AVRational) { avs->
vi->audio_samples_per_second, 1 };
856 st =
s->streams[stream_index];
859 if ((timestamp >= avs->
vi->num_frames) ||
860 (timestamp > INT_MAX) ||
864 if (avs_has_audio(avs->
vi))
867 if ((timestamp >= avs->
vi->num_audio_samples) || (timestamp < 0))
870 if (avs_has_video(avs->
vi)) {
static double val(void *priv, double ch)
Macro definitions for various function/variable attributes.
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1<< 16)) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&HAVE_MMX) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out->ch+ch,(const uint8_t **) in->ch+ch, off *(out-> planar
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static av_cold int avisynth_context_create(AVFormatContext *s)
static const int avs_planes_yuv[3]
static int avisynth_create_stream(AVFormatContext *s)
static av_cold int avisynth_load_library(void)
static int avisynth_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
static const int avs_planes_rgb[3]
#define LOAD_AVS_FUNC(name, continue_on_fail)
static av_cold int avisynth_read_header(AVFormatContext *s)
static void avisynth_next_stream(AVFormatContext *s, AVStream **st, AVPacket *pkt, int *discard)
static const int avs_planes_grey[1]
static av_cold void avisynth_atexit_handler(void)
AVInputFormat ff_avisynth_demuxer
static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, int discard)
static AviSynthContext * avs_ctx_list
static av_cold void avisynth_context_destroy(AviSynthContext *avs)
static int avs_atexit_called
static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
static const int avs_planes_yuva[4]
static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st)
static av_cold int avisynth_read_close(AVFormatContext *s)
static AviSynthLibrary avs_library
static int avisynth_open_file(AVFormatContext *s)
static const int avs_planes_rgba[4]
static const int avs_planes_packed[1]
static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt, int discard)
#define flags(name, subs,...)
static int read_header(FFV1Context *f)
@ AVDISCARD_ALL
discard all
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AVERROR_EOF
End of file.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
common internal api header.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_GBRPF32
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_GRAYF32
#define AV_PIX_FMT_YUV420P14
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
#define AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_BGRA64
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRAPF32
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
enum AVFieldOrder field_order
Video only.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
Audio only.
This structure stores compressed data.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Rational number (pair of numerator and denominator).
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int64_t nb_frames
number of frames in this stream if known or 0
int64_t duration
Decoding: duration of the stream, in stream time base.
int id
Format-specific stream ID.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
AVRational avg_frame_rate
Average framerate.
AVS_ScriptEnvironment * env
struct AviSynthContext * next
AVSC_DECLARE_FUNC(avs_bits_per_pixel)
AVSC_DECLARE_FUNC(avs_get_video_info)
AVSC_DECLARE_FUNC(avs_get_read_ptr_p)
AVSC_DECLARE_FUNC(avs_is_planar_rgb)
AVSC_DECLARE_FUNC(avs_get_frame)
AVSC_DECLARE_FUNC(avs_release_video_frame)
AVSC_DECLARE_FUNC(avs_get_height_p)
AVSC_DECLARE_FUNC(avs_clip_get_error)
AVSC_DECLARE_FUNC(avs_release_value)
AVSC_DECLARE_FUNC(avs_get_version)
AVSC_DECLARE_FUNC(avs_take_clip)
AVSC_DECLARE_FUNC(avs_is_planar_rgba)
AVSC_DECLARE_FUNC(avs_delete_script_environment)
AVSC_DECLARE_FUNC(avs_get_error)
AVSC_DECLARE_FUNC(avs_create_script_environment)
AVSC_DECLARE_FUNC(avs_invoke)
AVSC_DECLARE_FUNC(avs_get_audio)
AVSC_DECLARE_FUNC(avs_get_pitch_p)
AVSC_DECLARE_FUNC(avs_is_color_space)
AVSC_DECLARE_FUNC(avs_bit_blt)
AVSC_DECLARE_FUNC(avs_release_clip)
AVSC_DECLARE_FUNC(avs_get_row_size_p)
static void error(const char *err)