[Mplayer-cvslog] CVS: main/libmpcodecs vf_rgbtest.c, NONE, 1.1 vf.c, 1.99, 1.100 Makefile, 1.120, 1.121
Michael Niedermayer CVS
michael at mplayerhq.hu
Fri Jan 30 18:38:18 CET 2004
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv18095
Modified Files:
vf.c Makefile
Added Files:
vf_rgbtest.c
Log Message:
rgb test pattern generator, so we could change everything to match alex's definition of rgb/bgr
--- NEW FILE ---
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "../config.h"
#include "../mp_msg.h"
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
#include "../libvo/fastmemcpy.h"
//===========================================================================//
struct vf_priv_s {
unsigned int fmt;
};
static unsigned int getfmt(unsigned int outfmt){
switch(outfmt){
case IMGFMT_RGB15:
case IMGFMT_RGB16:
case IMGFMT_RGB24:
case IMGFMT_RGB32:
case IMGFMT_BGR15:
case IMGFMT_BGR16:
case IMGFMT_BGR24:
case IMGFMT_BGR32:
return outfmt;
}
return 0;
}
static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int b, int fmt){
switch(fmt){
case IMGFMT_RGB15: ((uint16_t*)(buf + y*stride))[x]= ((r>>3)<<10) | ((g>>3)<<5) | (b>>3);
break;
case IMGFMT_BGR15: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<10) | ((g>>3)<<5) | (r>>3);
break;
case IMGFMT_RGB16: ((uint16_t*)(buf + y*stride))[x]= ((r>>3)<<11) | ((g>>2)<<5) | (b>>3);
break;
case IMGFMT_BGR16: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<11) | ((g>>2)<<5) | (r>>3);
break;
/* case IMGFMT_RGB32_ME: ((uint32_t*)(buf + y*stride))[x]= (r<<16) | (g<<8) | b;
break;
case IMGFMT_BGR32_ME: ((uint32_t*)(buf + y*stride))[x]= (b<<16) | (g<<8) | r;
break;*/
case IMGFMT_RGB24:
buf[3*x + y*stride + 0]= r;
buf[3*x + y*stride + 1]= g;
buf[3*x + y*stride + 2]= b;
break;
case IMGFMT_BGR24:
buf[3*x + y*stride + 0]= b;
buf[3*x + y*stride + 1]= g;
buf[3*x + y*stride + 2]= r;
break;
case IMGFMT_RGB32:
buf[4*x + y*stride + 0]= r;
buf[4*x + y*stride + 1]= g;
buf[4*x + y*stride + 2]= b;
break;
case IMGFMT_BGR32:
buf[4*x + y*stride + 0]= b;
buf[4*x + y*stride + 1]= g;
buf[4*x + y*stride + 2]= r;
break;
/* case IMGFMT_ARGB32:
buf[4*x + y*stride + 1]= r;
buf[4*x + y*stride + 2]= g;
buf[4*x + y*stride + 3]= b;
break;
case IMGFMT_ABGR32:
buf[4*x + y*stride + 1]= b;
buf[4*x + y*stride + 2]= g;
buf[4*x + y*stride + 3]= r;
break;*/
}
}
static int config(struct vf_instance_s* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
vf->priv->fmt=getfmt(outfmt);
mp_msg(MSGT_VFILTER,MSGL_V,"rgb test format:%s\n", vo_format_name(outfmt));
return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
}
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
mp_image_t *dmpi;
int x, y;
// hope we'll get DR buffer:
dmpi=vf_get_image(vf->next,vf->priv->fmt,
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->w, mpi->h);
for(y=0; y<mpi->h; y++){
for(x=0; x<mpi->w; x++){
int c= 256*x/mpi->w;
int r=0,g=0,b=0;
if(3*y<mpi->h) r=c;
else if(3*y<2*mpi->h) g=c;
else b=c;
put_pixel(dmpi->planes[0], x, y, dmpi->stride[0], r, g, b, vf->priv->fmt);
}
}
return vf_next_put_image(vf,dmpi);
}
//===========================================================================//
static int query_format(struct vf_instance_s* vf, unsigned int outfmt){
unsigned int fmt=getfmt(outfmt);
if(!fmt) return 0;
return vf_next_query_format(vf,fmt) & (~VFCAP_CSP_SUPPORTED_BY_HW);
}
static int open(vf_instance_t *vf, char* args){
vf->config=config;
vf->put_image=put_image;
vf->query_format=query_format;
vf->priv=malloc(sizeof(struct vf_priv_s));
return 1;
}
vf_info_t vf_info_rgbtest = {
"rgbtest",
"rgbtest",
"Michael Niedermayer",
"",
open,
NULL
};
//===========================================================================//
Index: vf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- vf.c 29 Jan 2004 09:50:17 -0000 1.99
+++ vf.c 30 Jan 2004 17:38:15 -0000 1.100
@@ -84,6 +84,7 @@
extern vf_info_t vf_info_spp;
extern vf_info_t vf_info_yuvcsp;
extern vf_info_t vf_info_kerndeint;
+extern vf_info_t vf_info_rgbtest;
// list of available filters:
static vf_info_t* filter_list[]={
@@ -159,6 +160,7 @@
#endif
&vf_info_yuvcsp,
&vf_info_kerndeint,
+ &vf_info_rgbtest,
NULL
};
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/Makefile,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- Makefile 29 Jan 2004 09:50:17 -0000 1.120
+++ Makefile 30 Jan 2004 17:38:15 -0000 1.121
@@ -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 vf_filmdint.c vf_kerndeint.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 vf_kerndeint.c vf_rgbtest.c
ifeq ($(HAVE_FFPOSTPROCESS),yes)
VFILTER_SRCS += vf_pp.c
endif
More information about the MPlayer-cvslog
mailing list