40 #define OFFSET(x) offsetof(VPPContext, x) 
   41 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) 
   44 #define ENH_FILTERS_COUNT (5) 
   85     { 
"deinterlace", 
"deinterlace mode: 0=off, 1=bob, 2=advanced", 
OFFSET(deinterlace), 
AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, MFX_DEINTERLACING_ADVANCED, .flags = 
FLAGS, 
"deinterlace" },
 
   86     { 
"bob",         
"Bob deinterlace mode.",                      0,                   
AV_OPT_TYPE_CONST,    { .i64 = MFX_DEINTERLACING_BOB },            .flags = 
FLAGS, 
"deinterlace" },
 
   87     { 
"advanced",    
"Advanced deinterlace mode. ",                0,                   
AV_OPT_TYPE_CONST,    { .i64 = MFX_DEINTERLACING_ADVANCED },       .flags = 
FLAGS, 
"deinterlace" },
 
  136 #define PASS_EXPR(e, s) {\ 
  137     ret = av_expr_parse(&e, s, var_names, NULL, NULL, NULL, NULL, 0, ctx); \ 
  139         av_log(ctx, AV_LOG_ERROR, "Error when passing '%s'.\n", s);\ 
  143 #define CALC_EXPR(e, v, i) {\ 
  144     i = v = av_expr_eval(e, var_values, NULL); \ 
  281                                      MFX_DEINTERLACING_BOB : MFX_DEINTERLACING_ADVANCED;
 
  287         memset(&vpp->
frc_conf, 0, 
sizeof(mfxExtVPPFrameRateConversion));
 
  288         vpp->
frc_conf.Header.BufferId = MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION;
 
  289         vpp->
frc_conf.Header.BufferSz = 
sizeof(mfxExtVPPFrameRateConversion);
 
  290         vpp->
frc_conf.Algorithm = MFX_FRCALGM_DISTRIBUTED_TIMESTAMP;
 
  296         memset(&vpp->
denoise_conf, 0, 
sizeof(mfxExtVPPDenoise));
 
  297         vpp->
denoise_conf.Header.BufferId = MFX_EXTBUFF_VPP_DENOISE;
 
  298         vpp->
denoise_conf.Header.BufferSz = 
sizeof(mfxExtVPPDenoise);
 
  305         memset(&vpp->
detail_conf, 0, 
sizeof(mfxExtVPPDetail));
 
  306         vpp->
detail_conf.Header.BufferId  = MFX_EXTBUFF_VPP_DETAIL;
 
  307         vpp->
detail_conf.Header.BufferSz  = 
sizeof(mfxExtVPPDetail);
 
  314         memset(&vpp->
procamp_conf, 0, 
sizeof(mfxExtVPPProcAmp));
 
  315         vpp->
procamp_conf.Header.BufferId  = MFX_EXTBUFF_VPP_PROCAMP;
 
  316         vpp->
procamp_conf.Header.BufferSz  = 
sizeof(mfxExtVPPProcAmp);
 
  326         vpp->
detail || vpp->
procamp || inlink->
w != outlink->
w || inlink->
h != outlink->
h)
 
  427     .priv_class    = &vpp_class,
 
#define ENH_FILTERS_COUNT
 
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
 
This structure describes decoded (raw) audio or video data. 
 
static int config_output(AVFilterLink *outlink)
 
#define LIBAVUTIL_VERSION_INT
 
Main libavfilter public API header. 
 
int h
agreed upon image height 
 
static int config_input(AVFilterLink *inlink)
 
const char * av_default_item_name(void *ptr)
Return the context name. 
 
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
 
const char * name
Pad name. 
 
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
 
AVFilterLink ** inputs
array of pointers to input links 
 
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter. 
 
mfxExtVPPProcAmp procamp_conf
 
#define CALC_EXPR(e, v, i)
 
int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *param)
 
static av_cold int uninit(AVCodecContext *avctx)
 
static int eval_expr(AVFilterContext *ctx)
 
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user). 
 
#define AV_LOG_VERBOSE
Detailed information. 
 
mfxExtVPPDetail detail_conf
 
A filter pad used for either input or output. 
 
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers. 
 
A link between two filters. 
 
mfxExtVPPDeinterlacing deinterlace_conf
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
 
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists. 
 
static int query_formats(AVFilterContext *ctx)
 
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g. 
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
 
void * priv
private data for use by the filter 
 
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
 
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
 
simple assert() macros that are a bit more flexible than ISO C assert(). 
 
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively. 
 
static const char *const var_names[]
 
static enum AVPixelFormat in_pix_fmts[]
 
static const AVFilterPad vpp_outputs[]
 
int(* filter_frame)(AVFilterLink *outlink, AVFrame *frame)
 
int w
agreed upon image width 
 
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames...
 
AVFilterContext * src
source filter 
 
static const AVFilterPad inputs[]
 
static const AVFilterPad outputs[]
 
Libavcodec external API header. 
 
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse(). 
 
int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref)
 
static const AVFilterPad vpp_inputs[]
 
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr 
 
static const AVClass vpp_class
 
Describe the class of an AVClass context structure. 
 
int ff_qsvvpp_free(QSVVPPContext **vpp)
 
Rational number (pair of numerator and denominator). 
 
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure. 
 
const char * name
Filter name. 
 
AVFilterLink ** outputs
array of pointers to output links 
 
mfxExtVPPFrameRateConversion frc_conf
 
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational. 
 
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals. 
 
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) 
 
mfxExtVPPDenoise denoise_conf
 
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer. 
 
static enum AVPixelFormat out_pix_fmts[]
 
static const AVOption options[]
 
static av_cold void vpp_uninit(AVFilterContext *ctx)
 
AVFilterContext * dst
dest filter 
 
enum AVPixelFormat out_sw_format
 
Intel Quick Sync Video VPP base function. 
 
AVPixelFormat
Pixel format. 
 
#define AV_NOPTS_VALUE
Undefined timestamp value. 
 
AVFilterFormats * out_formats
 
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_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),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){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) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;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)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) 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);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=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){intplanes=out->planar?out->ch_count:1;unsignedm=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){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
 
simple arithmetic expression evaluator