]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_mp.c
MAINTAINER: add libavfilter section and add myself to yadif & mandelbrot
[ffmpeg] / libavfilter / vf_mp.c
index 7dd8a64df81c976b688e49a40769b8d21733f626..6541f6d3f96f180780c1781224276e3d934f9311 100644 (file)
@@ -41,6 +41,7 @@
 
 
 //FIXME maybe link the orig in
+//XXX: identical pix_fmt must be following with each others
 static const struct {
     int fmt;
     enum PixelFormat pix_fmt;
@@ -119,92 +120,82 @@ static const struct {
 };
 
 //copied from vf.c
-extern const vf_info_t vf_info_vo;
-extern const vf_info_t vf_info_rectangle;
+extern const vf_info_t vf_info_1bpp;
+extern const vf_info_t vf_info_2xsai;
+extern const vf_info_t vf_info_ass;
 extern const vf_info_t vf_info_bmovl;
 extern const vf_info_t vf_info_crop;
-extern const vf_info_t vf_info_expand;
-extern const vf_info_t vf_info_pp;
-extern const vf_info_t vf_info_scale;
-extern const vf_info_t vf_info_format;
-extern const vf_info_t vf_info_noformat;
-extern const vf_info_t vf_info_flip;
-extern const vf_info_t vf_info_rotate;
-extern const vf_info_t vf_info_mirror;
-extern const vf_info_t vf_info_palette;
-extern const vf_info_t vf_info_lavc;
-extern const vf_info_t vf_info_zrmjpeg;
+extern const vf_info_t vf_info_decimate;
+extern const vf_info_t vf_info_denoise3d;
+extern const vf_info_t vf_info_detc;
+extern const vf_info_t vf_info_dint;
+extern const vf_info_t vf_info_divtc;
+extern const vf_info_t vf_info_down3dright;
+extern const vf_info_t vf_info_dsize;
 extern const vf_info_t vf_info_dvbscale;
-extern const vf_info_t vf_info_cropdetect;
-extern const vf_info_t vf_info_test;
-extern const vf_info_t vf_info_noise;
-extern const vf_info_t vf_info_yvu9;
-extern const vf_info_t vf_info_lavcdeint;
-extern const vf_info_t vf_info_eq;
 extern const vf_info_t vf_info_eq2;
-extern const vf_info_t vf_info_gradfun;
+extern const vf_info_t vf_info_eq;
+extern const vf_info_t vf_info_expand;
+extern const vf_info_t vf_info_field;
+extern const vf_info_t vf_info_fil;
+extern const vf_info_t vf_info_filmdint;
+extern const vf_info_t vf_info_fixpts;
+extern const vf_info_t vf_info_flip;
+extern const vf_info_t vf_info_format;
+extern const vf_info_t vf_info_framestep;
+extern const vf_info_t vf_info_fspp;
+extern const vf_info_t vf_info_geq;
 extern const vf_info_t vf_info_halfpack;
-extern const vf_info_t vf_info_dint;
-extern const vf_info_t vf_info_1bpp;
-extern const vf_info_t vf_info_2xsai;
-extern const vf_info_t vf_info_unsharp;
-extern const vf_info_t vf_info_swapuv;
+extern const vf_info_t vf_info_harddup;
+extern const vf_info_t vf_info_hqdn3d;
+extern const vf_info_t vf_info_hue;
 extern const vf_info_t vf_info_il;
-extern const vf_info_t vf_info_fil;
-extern const vf_info_t vf_info_boxblur;
+extern const vf_info_t vf_info_ilpack;
+extern const vf_info_t vf_info_ivtc;
+extern const vf_info_t vf_info_kerndeint;
+extern const vf_info_t vf_info_lavc;
+extern const vf_info_t vf_info_lavcdeint;
+extern const vf_info_t vf_info_mcdeint;
+extern const vf_info_t vf_info_mirror;
+extern const vf_info_t vf_info_noformat;
+extern const vf_info_t vf_info_noise;
+extern const vf_info_t vf_info_ow;
+extern const vf_info_t vf_info_palette;
+extern const vf_info_t vf_info_perspective;
+extern const vf_info_t vf_info_phase;
+extern const vf_info_t vf_info_pp7;
+extern const vf_info_t vf_info_pp;
+extern const vf_info_t vf_info_pullup;
+extern const vf_info_t vf_info_qp;
+extern const vf_info_t vf_info_rectangle;
+extern const vf_info_t vf_info_remove_logo;
+extern const vf_info_t vf_info_rotate;
 extern const vf_info_t vf_info_sab;
+extern const vf_info_t vf_info_scale;
+extern const vf_info_t vf_info_screenshot;
 extern const vf_info_t vf_info_smartblur;
-extern const vf_info_t vf_info_perspective;
-extern const vf_info_t vf_info_down3dright;
-extern const vf_info_t vf_info_field;
-extern const vf_info_t vf_info_denoise3d;
-extern const vf_info_t vf_info_hqdn3d;
-extern const vf_info_t vf_info_detc;
+extern const vf_info_t vf_info_softpulldown;
+extern const vf_info_t vf_info_softskip;
+extern const vf_info_t vf_info_spp;
+extern const vf_info_t vf_info_stereo3d;
+extern const vf_info_t vf_info_swapuv;
 extern const vf_info_t vf_info_telecine;
-extern const vf_info_t vf_info_tinterlace;
+extern const vf_info_t vf_info_test;
 extern const vf_info_t vf_info_tfields;
-extern const vf_info_t vf_info_ivtc;
-extern const vf_info_t vf_info_ilpack;
-extern const vf_info_t vf_info_dsize;
-extern const vf_info_t vf_info_decimate;
-extern const vf_info_t vf_info_softpulldown;
-extern const vf_info_t vf_info_pullup;
-extern const vf_info_t vf_info_filmdint;
-extern const vf_info_t vf_info_framestep;
 extern const vf_info_t vf_info_tile;
-extern const vf_info_t vf_info_delogo;
-extern const vf_info_t vf_info_remove_logo;
-extern const vf_info_t vf_info_hue;
-extern const vf_info_t vf_info_spp;
+extern const vf_info_t vf_info_tinterlace;
+extern const vf_info_t vf_info_unsharp;
 extern const vf_info_t vf_info_uspp;
-extern const vf_info_t vf_info_fspp;
-extern const vf_info_t vf_info_pp7;
-extern const vf_info_t vf_info_yuvcsp;
-extern const vf_info_t vf_info_kerndeint;
-extern const vf_info_t vf_info_rgbtest;
-extern const vf_info_t vf_info_qp;
-extern const vf_info_t vf_info_phase;
-extern const vf_info_t vf_info_divtc;
-extern const vf_info_t vf_info_harddup;
-extern const vf_info_t vf_info_softskip;
-extern const vf_info_t vf_info_screenshot;
-extern const vf_info_t vf_info_ass;
-extern const vf_info_t vf_info_mcdeint;
+extern const vf_info_t vf_info_vo;
 extern const vf_info_t vf_info_yadif;
-extern const vf_info_t vf_info_blackframe;
-extern const vf_info_t vf_info_geq;
-extern const vf_info_t vf_info_ow;
-extern const vf_info_t vf_info_fixpts;
-extern const vf_info_t vf_info_stereo3d;
+extern const vf_info_t vf_info_yuvcsp;
+extern const vf_info_t vf_info_yvu9;
+extern const vf_info_t vf_info_zrmjpeg;
 
 
 static const vf_info_t* const filters[]={
     &vf_info_2xsai,
-    &vf_info_blackframe,
-    &vf_info_boxblur,
-    &vf_info_cropdetect,
     &vf_info_decimate,
-    &vf_info_delogo,
     &vf_info_denoise3d,
     &vf_info_detc,
     &vf_info_dint,
@@ -220,7 +211,6 @@ static const vf_info_t* const filters[]={
     &vf_info_framestep,
     &vf_info_fspp,
     &vf_info_geq,
-    &vf_info_gradfun,
     &vf_info_harddup,
     &vf_info_hqdn3d,
     &vf_info_hue,
@@ -240,7 +230,6 @@ static const vf_info_t* const filters[]={
     &vf_info_qp,
     &vf_info_rectangle,
     &vf_info_remove_logo,
-    &vf_info_rgbtest,
     &vf_info_rotate,
     &vf_info_sab,
     &vf_info_screenshot,
@@ -248,9 +237,9 @@ static const vf_info_t* const filters[]={
     &vf_info_softpulldown,
     &vf_info_softskip,
     &vf_info_spp,
+    &vf_info_stereo3d,
     &vf_info_swapuv,
     &vf_info_telecine,
-    &vf_info_test,
     &vf_info_tile,
     &vf_info_tinterlace,
     &vf_info_unsharp,
@@ -277,7 +266,6 @@ lavcdeint
 noformat
 pp
 scale
-stereo3d
 tfields
 vo
 yadif
@@ -287,10 +275,6 @@ zrmjpeg
 CpuCaps gCpuCaps; //FIXME initialize this so optims work
 
 
-int get_sws_cpuflags(void){
-    return 0;
-}
-
 static void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam)
 {
         static int firstTime=1;
@@ -459,7 +443,7 @@ unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned
 }
 
 mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h){
-    MPContext *m= ((uint8_t*)vf) - offsetof(MPContext, next_vf);
+    MPContext *m= (MPContext*)(((uint8_t*)vf) - offsetof(MPContext, next_vf));
   mp_image_t* mpi=NULL;
   int w2;
   int number = mp_imgtype >> 16;
@@ -631,7 +615,7 @@ int vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts){
         goto fail;
 
     picref->buf = pic;
-    picref->buf->please_use_av_free= av_free;
+    picref->buf->please_use_av_free= (void*)av_free;
     if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))
         goto fail;
 
@@ -789,18 +773,22 @@ static int query_formats(AVFilterContext *ctx)
 {
     AVFilterFormats *avfmts=NULL;
     MPContext *m = ctx->priv;
+    enum PixelFormat lastpixfmt = PIX_FMT_NONE;
     int i;
 
     for(i=0; conversion_map[i].fmt; i++){
         av_log(ctx, AV_LOG_DEBUG, "query: %X\n", conversion_map[i].fmt);
         if(m->vf.query_format(&m->vf, conversion_map[i].fmt)){
             av_log(ctx, AV_LOG_DEBUG, "supported,adding\n");
-            avfilter_add_format(&avfmts, conversion_map[i].pix_fmt);
+            if (conversion_map[i].pix_fmt != lastpixfmt) {
+                avfilter_add_format(&avfmts, conversion_map[i].pix_fmt);
+                lastpixfmt = conversion_map[i].pix_fmt;
+            }
         }
     }
 
     //We assume all allowed input formats are also allowed output formats
-    avfilter_set_common_formats(ctx, avfmts);
+    avfilter_set_common_pixel_formats(ctx, avfmts);
     return 0;
 }
 
@@ -886,7 +874,7 @@ static void end_frame(AVFilterLink *inlink)
     }
     free_mp_image(mpi);
 
-//    avfilter_unref_buffer(inpic);
+    avfilter_unref_buffer(inpic);
 }
 
 AVFilter avfilter_vf_mp = {
@@ -896,7 +884,7 @@ AVFilter avfilter_vf_mp = {
     .priv_size = sizeof(MPContext),
     .query_formats = query_formats,
 
-    .inputs    = (AVFilterPad[]) {{ .name            = "default",
+    .inputs    = (const AVFilterPad[]) {{ .name      = "default",
                                     .type            = AVMEDIA_TYPE_VIDEO,
                                     .start_frame     = start_frame,
                                     .draw_slice      = null_draw_slice,
@@ -904,7 +892,7 @@ AVFilter avfilter_vf_mp = {
                                     .config_props    = config_inprops,
                                     .min_perms       = AV_PERM_READ, },
                                   { .name = NULL}},
-    .outputs   = (AVFilterPad[]) {{ .name            = "default",
+    .outputs   = (const AVFilterPad[]) {{ .name      = "default",
                                     .type            = AVMEDIA_TYPE_VIDEO,
                                     .request_frame   = request_frame,
                                     .config_props    = config_outprops, },