9
#include "img_format.h"
13
#include "libvo/fastmemcpy.h"
15
//===========================================================================//
21
static unsigned int getfmt(unsigned int outfmt){
38
static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int b, int fmt){
40
case IMGFMT_BGR15: ((uint16_t*)(buf + y*stride))[x]= ((r>>3)<<10) | ((g>>3)<<5) | (b>>3);
42
case IMGFMT_RGB15: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<10) | ((g>>3)<<5) | (r>>3);
44
case IMGFMT_BGR16: ((uint16_t*)(buf + y*stride))[x]= ((r>>3)<<11) | ((g>>2)<<5) | (b>>3);
46
case IMGFMT_RGB16: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<11) | ((g>>2)<<5) | (r>>3);
49
buf[3*x + y*stride + 0]= r;
50
buf[3*x + y*stride + 1]= g;
51
buf[3*x + y*stride + 2]= b;
54
buf[3*x + y*stride + 0]= b;
55
buf[3*x + y*stride + 1]= g;
56
buf[3*x + y*stride + 2]= r;
59
buf[4*x + y*stride + 0]= r;
60
buf[4*x + y*stride + 1]= g;
61
buf[4*x + y*stride + 2]= b;
64
buf[4*x + y*stride + 0]= b;
65
buf[4*x + y*stride + 1]= g;
66
buf[4*x + y*stride + 2]= r;
69
buf[4*x + y*stride + 1]= r;
70
buf[4*x + y*stride + 2]= g;
71
buf[4*x + y*stride + 3]= b;
74
buf[4*x + y*stride + 1]= b;
75
buf[4*x + y*stride + 2]= g;
76
buf[4*x + y*stride + 3]= r;
81
static int config(struct vf_instance_s* vf,
82
int width, int height, int d_width, int d_height,
83
unsigned int flags, unsigned int outfmt){
84
vf->priv->fmt=getfmt(outfmt);
85
mp_msg(MSGT_VFILTER,MSGL_V,"rgb test format:%s\n", vo_format_name(outfmt));
86
return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
89
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
93
// hope we'll get DR buffer:
94
dmpi=vf_get_image(vf->next,vf->priv->fmt,
95
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
98
for(y=0; y<mpi->h; y++){
99
for(x=0; x<mpi->w; x++){
104
else if(3*y<2*mpi->h) g=c;
107
put_pixel(dmpi->planes[0], x, y, dmpi->stride[0], r, g, b, vf->priv->fmt);
111
return vf_next_put_image(vf,dmpi);
114
//===========================================================================//
116
static int query_format(struct vf_instance_s* vf, unsigned int outfmt){
117
unsigned int fmt=getfmt(outfmt);
119
return vf_next_query_format(vf,fmt) & (~VFCAP_CSP_SUPPORTED_BY_HW);
122
static int open(vf_instance_t *vf, char* args){
124
vf->put_image=put_image;
125
vf->query_format=query_format;
126
vf->priv=malloc(sizeof(struct vf_priv_s));
130
vf_info_t vf_info_rgbtest = {
133
"Michael Niedermayer",
139
//===========================================================================//