[Mplayer-cvslog] CVS: main/libmpcodecs vf_rectangle.c,NONE,1.1 Makefile,1.50,1.51 vf.c,1.38,1.39

Kim Minh Kaplan CVS kmkaplan at mplayerhq.hu
Sat Jul 27 13:40:27 CEST 2002


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

Modified Files:
	Makefile vf.c 
Added Files:
	vf_rectangle.c 
Log Message:
New plugin to test crop parameters.  Arguments are the same as for the
crop plugin.


--- NEW FILE ---
#include <stdio.h>
#include <stdlib.h>
#include "mp_image.h"
#include "vf.h"

struct vf_priv_s {
    int x, y, w, h;
};

static void
put_image(struct vf_instance_s* vf, mp_image_t* mpi){
    mp_image_t* dmpi;
    int x, y, w, h;
    unsigned int bpp, count;
    unsigned char *p1, *p2;
    dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP, 0, mpi->w, mpi->h);
    bpp = dmpi->bpp / 8;
    memcpy(dmpi->planes[0], mpi->planes[0], dmpi->stride[0] * bpp * mpi->height);
    memcpy(dmpi->planes[1], mpi->planes[1], dmpi->stride[1] * mpi->chroma_height);
    memcpy(dmpi->planes[2], mpi->planes[2], dmpi->stride[2] * mpi->chroma_height);

    /* Draw the rectangle */
    x = vf->priv->x;
    if (x < 0)
	x = 0;
    y = vf->priv->y;
    if (y < 0)
	y = 0;
    w = vf->priv->w;
    if (w < 0)
	w = dmpi->w - x;
    h = vf->priv->h;
    if (h < 0)
	h = dmpi->h - y;
    count = w * bpp;
    p1 = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp;
    if (h == 1)
	while (count--) {
	    *p1 = 0xff - *p1;
	    ++p1;
	}
    else {
	p2 = p1 + (h - 1) * dmpi->stride[0];
	while (count--) {
	    *p1 = 0xff - *p1;
	    ++p1;
	    *p2 = 0xff - *p2;
	    ++p2;
	}
    }
    count = h;
    p1 = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp;
    if (w == 1)
	while (count--) {
	    int i = bpp;
	    while (i--)
		p1[i] ^= 0xff;
	    p1 += dmpi->stride[0];
	}
    else {
	p2 = p1 + (w - 1) * bpp;
	while (count--) {
	    int i = bpp;
	    while (i--) {
		p1[i] = 0xff - p1[i];
		p2[i] = 0xff - p2[i];
	    }
	    p1 += dmpi->stride[0];
	    p2 += dmpi->stride[0];
	}
    }
    vf_next_put_image(vf, dmpi);
}

static int
open(vf_instance_t* vf, char* args) {
    vf->put_image = put_image;
    vf->priv = malloc(sizeof(struct vf_priv_s));
    vf->priv->x = -1;
    vf->priv->y = -1;
    vf->priv->w = -1;
    vf->priv->h = -1;
    if (args)
	sscanf(args, "%d:%d:%d:%d", 
	       &vf->priv->w, &vf->priv->h, &vf->priv->x, &vf->priv->y);
    printf("Crop: %d x %d, %d ; %d\n",
	   vf->priv->w, vf->priv->h, vf->priv->x, vf->priv->y);
    return 1;
}

vf_info_t vf_info_rectangle = {
    "draw rectangle",
    "rectangle",
    "Kim Minh Kaplan",
    "",
    open
};

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/Makefile,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- Makefile	12 Jul 2002 04:03:51 -0000	1.50
+++ Makefile	27 Jul 2002 11:40:15 -0000	1.51
@@ -6,7 +6,7 @@
 
 AUDIO_SRCS=dec_audio.c ad.c ad_a52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c ad_msgsm.c ad_faad.c ad_vorbis.c ad_libmad.c ad_real.c
 VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_real.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c vd_mpegpes.c vd_svq1.c vd_xvid.c
-VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.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
+VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.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
 ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c
 NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/cyuv.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c native/svq1.c
 

Index: vf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- vf.c	11 Jul 2002 19:16:30 -0000	1.38
+++ vf.c	27 Jul 2002 11:40:15 -0000	1.39
@@ -14,6 +14,7 @@
 #include "vf.h"
 
 extern vf_info_t vf_info_vo;
+extern vf_info_t vf_info_rectangle;
 extern vf_info_t vf_info_crop;
 extern vf_info_t vf_info_expand;
 extern vf_info_t vf_info_pp;
@@ -39,6 +40,7 @@
 
 // list of available filters:
 static vf_info_t* filter_list[]={
+    &vf_info_rectangle,
     &vf_info_crop,
     &vf_info_expand,
     &vf_info_pp,




More information about the MPlayer-cvslog mailing list