[Mplayer-cvslog] CVS: main/libmpcodecs vf_filmdint.c,NONE,1.1 cmmx.h,NONE,1.1 Makefile,1.116,1.117 vf.c,1.96,1.97

Alex Beregszaszi alex at mplayerhq.hu
Mon Dec 8 23:57:49 CET 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv23721/libmpcodecs

Modified Files:
	Makefile vf.c 
Added Files:
	vf_filmdint.c cmmx.h 
Log Message:
Yet another inverse telecine filter by Zoltan Hidvegi <mplayer at hzoli.2y.net>. Also heavily MMX centric.

--- NEW FILE ---
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>

#include "../config.h"
#include "../mp_msg.h"
#include "../cpudetect.h"

#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
#include "cmmx.h"

#include "../libvo/fastmemcpy.h"

#define NUM_STORED 4

[...1404 lines suppressed...]
    p->mmx2 = 0;
#endif
#ifndef HAVE_3DNOW
    p->mmx2 &= 1;
#endif
    p->thres.odd  = p->thres.even;
    p->thres.temp = p->thres.noise;
    p->diff_time = 0;
    p->merge_time = 0;
    return 1;
}

vf_info_t vf_info_filmdint = {
    "Advanced inverse telecine filer",
    "filmdint",
    "Zoltan Hidvegi",
    "",
    open,
    NULL
};

--- NEW FILE ---
/*
 * x86 MMX and MMX2 packed byte operations in portable C.
 * Extra instructions: pdiffub, pcmpzb, psumbw, pcmpgtub
 * Author: Zoltan Hidvegi
 */

#ifndef __CMMX_H
#define __CMMX_H

typedef unsigned long cmmx_t;

#define ONE_BYTES (~(cmmx_t)0 / 255)
#define SIGN_BITS (ONE_BYTES << 7)
#define LOWBW_MASK (~(cmmx_t)0 / 257)

static inline cmmx_t
paddb(cmmx_t a, cmmx_t b)
{
    return ((a & ~SIGN_BITS) + (b & ~SIGN_BITS)) ^ ((a^b) & SIGN_BITS);
}

static inline cmmx_t
psubb(cmmx_t a, cmmx_t b)
{
    return ((a | SIGN_BITS) - (b & ~SIGN_BITS)) ^ (~(a^b) & SIGN_BITS);
}

static inline cmmx_t
paddusb(cmmx_t a, cmmx_t b)
{
    cmmx_t s = (a & ~SIGN_BITS) + (b & ~SIGN_BITS);
    cmmx_t abs = (a | b) & SIGN_BITS;
    cmmx_t c = abs & (s | (a & b));
    return s | abs | (abs - (c >> 7));
}

static inline cmmx_t
paddusb_s(cmmx_t a, cmmx_t b)
{
    cmmx_t sum = a+b;
    cmmx_t ov = sum & SIGN_BITS;
    return sum + (sum ^ (ov - (ov>>7)));
}

static inline cmmx_t
psubusb(cmmx_t a, cmmx_t b)
{
    cmmx_t s = (a | SIGN_BITS) - (b & ~SIGN_BITS);
    cmmx_t anb = a & ~b;
    cmmx_t c = (anb | (s & ~(a^b))) & SIGN_BITS;
    return s & ((c & anb) | (c - (c >> 7)));
}

static inline cmmx_t
psubusb_s(cmmx_t a, cmmx_t b)
{
    cmmx_t d = (a|SIGN_BITS) - b;
    cmmx_t m = d & SIGN_BITS;
    return d & (m - (m>>7));
}

static inline cmmx_t
pcmpgtub(cmmx_t b, cmmx_t a)
{
    cmmx_t s = (a | SIGN_BITS) - (b & ~SIGN_BITS);
    cmmx_t ret = ((~a & b) | (~s & ~(a ^ b))) & SIGN_BITS;
    return ret | (ret - (ret >> 7));
}

static inline cmmx_t
pdiffub(cmmx_t a, cmmx_t b)
{
    cmmx_t xs = (~a ^ b) & SIGN_BITS;
    cmmx_t s = ((a | SIGN_BITS) - (b & ~SIGN_BITS)) ^ xs;
    cmmx_t gt = ((~a & b) | (s & xs)) & SIGN_BITS;
    cmmx_t gt7 = gt >> 7;
    return (s ^ gt ^ (gt - gt7)) + gt7;
}

static inline cmmx_t
pdiffub_s(cmmx_t a, cmmx_t b)
{
    cmmx_t d = (a|SIGN_BITS) - b;
    cmmx_t g = (~d & SIGN_BITS) >> 7;
    return (d ^ (SIGN_BITS-g)) + g;
}

static inline cmmx_t
pmaxub(cmmx_t a, cmmx_t b)
{
    return psubusb(a,b) + b;
}

static inline cmmx_t
pminub(cmmx_t a, cmmx_t b)
{
    return paddusb(a,~b) - ~b;
}

static inline cmmx_t
pminub_s(cmmx_t a, cmmx_t b)
{
    cmmx_t d = (a|SIGN_BITS) - b;
    cmmx_t m = ~SIGN_BITS + ((d&SIGN_BITS)>>7);
    return ((d&m) + b) & ~SIGN_BITS;
}

static inline cmmx_t
pavgb(cmmx_t a, cmmx_t b)
{
    cmmx_t ao = a & ONE_BYTES;
    cmmx_t bo = b & ONE_BYTES;
    return ((a^ao)>>1) + ((b^bo)>>1) + (ao|bo);
}

static inline cmmx_t
pavgb_s(cmmx_t a, cmmx_t b)
{
    return ((a+b+ONE_BYTES)>>1) & ~SIGN_BITS;
}

static inline cmmx_t
p31avgb(cmmx_t a, cmmx_t b)
{
    cmmx_t ao = a & (3*ONE_BYTES);
    cmmx_t bo = b & (3*ONE_BYTES);
    return 3*((a^ao)>>2) + ((b^bo)>>2) +
	(((3*ao+bo+2*ONE_BYTES)>>2) & (3*ONE_BYTES));
}

static inline cmmx_t
p31avgb_s(cmmx_t a, cmmx_t b)
{
    cmmx_t avg = ((a+b)>>1) & ~SIGN_BITS;
    return pavgb_s(avg, a);
}

static inline unsigned long
psumbw(cmmx_t a)
{
    cmmx_t t = (a & LOWBW_MASK) + ((a>>8) & LOWBW_MASK);
    unsigned long ret =
	(unsigned long)t + (unsigned long)(t >> (4*sizeof(cmmx_t)));
    if (sizeof(cmmx_t) > 4)
	ret += ret >> 16;
    return ret & 0xffff;
}

static inline unsigned long
psumbw_s(cmmx_t a)
{
    unsigned long ret =
	(unsigned long)a + (unsigned long)(a >> (4*sizeof(cmmx_t)));
    if (sizeof(cmmx_t) <= 4)
	return (ret & 0xff) + ((ret>>8) & 0xff);
    ret = (ret & 0xff00ff) + ((ret>>8) & 0xff00ff);
    ret += ret >> 16;
    return ret & 0xffff;
}

static inline unsigned long
psadbw(cmmx_t a, cmmx_t b)
{
    return psumbw(pdiffub(a,b));
}

static inline unsigned long
psadbw_s(cmmx_t a, cmmx_t b)
{
    return psumbw_s(pdiffub_s(a,b));
}

static inline cmmx_t
pcmpzb(cmmx_t a)
{
    cmmx_t ret = (((a | SIGN_BITS) - ONE_BYTES) | a) & SIGN_BITS;
    return ~(ret | (ret - (ret >> 7)));
}

static inline cmmx_t
pcmpeqb(cmmx_t a, cmmx_t b)
{
    return pcmpzb(a ^ b);
}

#endif

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/Makefile,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- Makefile	8 Dec 2003 12:44:10 -0000	1.116
+++ Makefile	8 Dec 2003 22:57:21 -0000	1.117
@@ -14,7 +14,7 @@
 VIDEO_SRCS_OPT=vd_realvid.c vd_ffmpeg.c vd_dshow.c vd_dmo.c vd_vfw.c vd_vfwex.c vd_odivx.c vd_divx4.c vd_zrmjpeg.c vd_xanim.c vd_xvid.c vd_xvid4.c vd_libdv.c vd_qtvideo.c vd_theora.c
 VIDEO_SRCS=dec_video.c vd.c $(VIDEO_SRCS_NAT) $(VIDEO_SRCS_LIB) $(VIDEO_SRCS_OPT)
 
-VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_lavcdeint.c vf_eq.c vf_eq2.c vf_halfpack.c vf_dint.c vf_1bpp.c vf_bmovl.c vf_2xsai.c vf_unsharp.c vf_swapuv.c vf_il.c vf_boxblur.c vf_sab.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_field.c vf_denoise3d.c vf_hqdn3d.c vf_detc.c vf_telecine.c vf_tfields.c vf_ivtc.c vf_ilpack.c vf_dsize.c vf_decimate.c vf_softpulldown.c vf_tinterlace.c vf_pullup.c pullup.c vf_framestep.c vf_tile.c vf_delogo.c vf_fil.c vf_hue.c vf_spp.c vf_yuvcsp.c
+VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_lavcdeint.c vf_eq.c vf_eq2.c vf_halfpack.c vf_dint.c vf_1bpp.c vf_bmovl.c vf_2xsai.c vf_unsharp.c vf_swapuv.c vf_il.c vf_boxblur.c vf_sab.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_field.c vf_denoise3d.c vf_hqdn3d.c vf_detc.c vf_telecine.c vf_tfields.c vf_ivtc.c vf_ilpack.c vf_dsize.c vf_decimate.c vf_softpulldown.c vf_tinterlace.c vf_pullup.c pullup.c vf_framestep.c vf_tile.c vf_delogo.c vf_fil.c vf_hue.c vf_spp.c vf_yuvcsp.c vf_filmdint.c
 ifeq ($(HAVE_FFPOSTPROCESS),yes)
 VFILTER_SRCS += vf_pp.c
 endif

Index: vf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- vf.c	29 Nov 2003 19:34:26 -0000	1.96
+++ vf.c	8 Dec 2003 22:57:21 -0000	1.97
@@ -75,6 +75,7 @@
 extern vf_info_t vf_info_decimate;
 extern vf_info_t vf_info_softpulldown;
 extern vf_info_t vf_info_pullup;
+extern vf_info_t vf_info_filmdint;
 extern vf_info_t vf_info_framestep;
 extern vf_info_t vf_info_tile;
 extern vf_info_t vf_info_delogo;
@@ -143,6 +144,7 @@
     &vf_info_decimate,
     &vf_info_softpulldown,
     &vf_info_pullup,
+    &vf_info_filmdint,
     &vf_info_framestep,
     &vf_info_tile,
     &vf_info_delogo,



More information about the MPlayer-cvslog mailing list