annotate libmpcodecs/vf_1bpp.c @ 23185:3d2aedade36f

dvdnav:// depends on our fork of libdvdnav
author nicodvb
date Tue, 01 May 2007 20:02:05 +0000
parents 497ebe3ecc2b
children c2b7ba444ade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7755
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
1 #include <stdio.h>
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
2 #include <stdlib.h>
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
3 #include <string.h>
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
4 #include <inttypes.h>
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
5
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 9593
diff changeset
6 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 9593
diff changeset
7 #include "mp_msg.h"
7755
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
8
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
9 #include "img_format.h"
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
10 #include "mp_image.h"
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
11 #include "vf.h"
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
12
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
13 //===========================================================================//
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
14
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
15 static unsigned int bgr_list[]={
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
16 IMGFMT_Y800,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
17 IMGFMT_Y8,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
18 IMGFMT_BGR8,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
19 IMGFMT_RGB8,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
20
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
21 IMGFMT_YVU9,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
22 IMGFMT_411P,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
23 IMGFMT_YV12,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
24 IMGFMT_I420,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
25 IMGFMT_IYUV,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
26 IMGFMT_422P,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
27 IMGFMT_444P,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
28
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
29 IMGFMT_YUY2,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
30 IMGFMT_BGR15,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
31 IMGFMT_RGB15,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
32 IMGFMT_BGR16,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
33 IMGFMT_RGB16,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
34
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
35 IMGFMT_BGR32,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
36 IMGFMT_RGB32,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
37
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
38 // IMGFMT_BGR24,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
39 // IMGFMT_RGB24,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
40 0
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
41 };
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
42
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
43 static unsigned int find_best(struct vf_instance_s* vf){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
44 unsigned int best=0;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
45 int ret;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
46 unsigned int* p=bgr_list;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
47 while(*p){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
48 ret=vf->next->query_format(vf->next,*p);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
49 mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
50 if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ best=*p; break;} // no conversion -> bingo!
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
51 if(ret&VFCAP_CSP_SUPPORTED && !best) best=*p; // best with conversion
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
52 ++p;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
53 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
54 return best;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
55 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
56
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
57 //===========================================================================//
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
58
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
59 struct vf_priv_s {
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
60 unsigned int fmt;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
61 };
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
62
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
63 static int config(struct vf_instance_s* vf,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
64 int width, int height, int d_width, int d_height,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
65 unsigned int flags, unsigned int outfmt){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
66 if (!vf->priv->fmt)
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
67 vf->priv->fmt=find_best(vf);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
68 if(!vf->priv->fmt){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
69 // no matching fmt, so force one...
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
70 if(outfmt==IMGFMT_RGB8) vf->priv->fmt=IMGFMT_RGB32;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
71 else if(outfmt==IMGFMT_BGR8) vf->priv->fmt=IMGFMT_BGR32;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
72 else return 0;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
73 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
74 return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
75 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
76
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
77 static int bittab[8]={128,64,32,16,8,4,2,1};
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
78
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
79 static void convert(mp_image_t *mpi, mp_image_t *dmpi, int value0, int value1,int bpp){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
80 int y;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
81 for(y=0;y<mpi->h;y++){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
82 unsigned char* src=mpi->planes[0]+mpi->stride[0]*y;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
83 switch(bpp){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
84 case 1: {
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
85 unsigned char* dst=dmpi->planes[0]+dmpi->stride[0]*y;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
86 int x;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
87 for(x=0;x<mpi->w;x++)
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
88 dst[x]=(src[x>>3]&bittab[x&7]) ? value1 : value0;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
89 break; }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
90 case 2: {
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
91 uint16_t* dst=(uint16_t*)(dmpi->planes[0]+dmpi->stride[0]*y);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
92 int x;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
93 for(x=0;x<mpi->w;x++)
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
94 dst[x]=(src[x>>3]&bittab[x&7]) ? value1 : value0;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
95 break; }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
96 case 4: {
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
97 uint32_t* dst=(uint32_t*)(dmpi->planes[0]+dmpi->stride[0]*y);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
98 int x;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
99 for(x=0;x<mpi->w;x++)
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
100 dst[x]=(src[x>>3]&bittab[x&7]) ? value1 : value0;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
101 break; }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
102 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
103 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
104 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
105
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
106 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
7755
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
107 mp_image_t *dmpi;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
108
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
109 // hope we'll get DR buffer:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
110 dmpi=vf_get_image(vf->next,vf->priv->fmt,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
111 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
112 mpi->w, mpi->h);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
113
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
114 switch(dmpi->imgfmt){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
115 case IMGFMT_Y800:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
116 case IMGFMT_Y8:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
117 case IMGFMT_BGR8:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
118 case IMGFMT_RGB8:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
119 convert(mpi,dmpi,0,255,1);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
120 break;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
121 case IMGFMT_YVU9:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
122 case IMGFMT_411P:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
123 case IMGFMT_YV12:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
124 case IMGFMT_I420:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
125 case IMGFMT_IYUV:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
126 case IMGFMT_422P:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
127 case IMGFMT_444P:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
128 convert(mpi,dmpi,0,255,1);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
129 memset(dmpi->planes[1],128,dmpi->stride[1]*dmpi->chroma_height);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
130 memset(dmpi->planes[2],128,dmpi->stride[2]*dmpi->chroma_height);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
131 break;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
132 case IMGFMT_YUY2:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
133 convert(mpi,dmpi,0x8000,0x80ff,2);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
134 break;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
135 case IMGFMT_BGR15:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
136 case IMGFMT_RGB15:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
137 convert(mpi,dmpi,0,0x7fff,2);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
138 break;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
139 case IMGFMT_BGR16:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
140 case IMGFMT_RGB16:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
141 convert(mpi,dmpi,0,0xffff,2);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
142 break;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
143 case IMGFMT_BGR32:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
144 case IMGFMT_RGB32:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
145 convert(mpi,dmpi,0,0x00ffffff,4);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
146 break;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
147 default:
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
148 mp_msg(MSGT_VFILTER,MSGL_ERR,"Unhandled format: 0x%X\n",dmpi->imgfmt);
7848
3c1d30a1afc0 compiler warning fixes by Dominik
arpi
parents: 7755
diff changeset
149 return 0;
7755
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
150 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
151
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
152 return vf_next_put_image(vf,dmpi, pts);
7755
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
153 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
154
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
155 //===========================================================================//
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
156
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
157 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
158 int best;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
159 if(fmt!=IMGFMT_RGB1 && fmt!=IMGFMT_BGR1) return 0;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
160 best=find_best(vf);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
161 if(!best) return 0; // no match
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
162 return vf->next->query_format(vf->next,best);
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
163 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
164
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
165 static int open(vf_instance_t *vf, char* args){
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
166 vf->config=config;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
167 vf->put_image=put_image;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
168 vf->query_format=query_format;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
169 vf->priv=malloc(sizeof(struct vf_priv_s));
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
170 memset(vf->priv, 0, sizeof(struct vf_priv_s));
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
171 return 1;
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
172 }
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
173
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
174 vf_info_t vf_info_1bpp = {
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
175 "1bpp bitmap -> YUV/BGR 8/15/16/32 conversion",
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
176 "1bpp",
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
177 "A'rpi",
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
178 "",
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 8123
diff changeset
179 open,
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 8123
diff changeset
180 NULL
7755
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
181 };
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
182
7637b72ef1f9 new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff changeset
183 //===========================================================================//