Mercurial > mplayer.hg
annotate libmpcodecs/vf_1bpp.c @ 33191:32238139a2ff
Hacks to allow compilation to go further.
author | reimar |
---|---|
date | Fri, 22 Apr 2011 06:19:14 +0000 |
parents | 92f88bb315c5 |
children |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
19 #include <stdio.h> |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
20 #include <stdlib.h> |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
21 #include <string.h> |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
22 #include <inttypes.h> |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
23 |
17012 | 24 #include "config.h" |
25 #include "mp_msg.h" | |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
26 |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
27 #include "img_format.h" |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
28 #include "mp_image.h" |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
29 #include "vf.h" |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
30 |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
31 //===========================================================================// |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
32 |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
18746
diff
changeset
|
33 static const unsigned int bgr_list[]={ |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
34 IMGFMT_Y800, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
35 IMGFMT_Y8, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
36 IMGFMT_BGR8, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
37 IMGFMT_RGB8, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
38 |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
39 IMGFMT_YVU9, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
40 IMGFMT_411P, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
41 IMGFMT_YV12, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
42 IMGFMT_I420, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
43 IMGFMT_IYUV, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
44 IMGFMT_422P, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
45 IMGFMT_444P, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
24969
diff
changeset
|
46 |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
47 IMGFMT_YUY2, |
31082
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30642
diff
changeset
|
48 IMGFMT_BGR12, |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30642
diff
changeset
|
49 IMGFMT_RGB12, |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
50 IMGFMT_BGR15, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
51 IMGFMT_RGB15, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
52 IMGFMT_BGR16, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
53 IMGFMT_RGB16, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
54 |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
55 IMGFMT_BGR32, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
56 IMGFMT_RGB32, |
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 // IMGFMT_BGR24, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
59 // IMGFMT_RGB24, |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
60 0 |
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 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
63 static unsigned int find_best(struct vf_instance *vf){ |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
64 unsigned int best=0; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
65 int ret; |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
18746
diff
changeset
|
66 const unsigned int* p=bgr_list; |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
67 while(*p){ |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
68 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
|
69 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
|
70 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
|
71 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
|
72 ++p; |
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 best; |
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 //===========================================================================// |
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 struct vf_priv_s { |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
80 unsigned int fmt; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
81 }; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
82 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
83 static int config(struct vf_instance *vf, |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
84 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
|
85 unsigned int flags, unsigned int outfmt){ |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
86 if (!vf->priv->fmt) |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
87 vf->priv->fmt=find_best(vf); |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
88 if(!vf->priv->fmt){ |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
89 // no matching fmt, so force one... |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
90 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
|
91 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
|
92 else return 0; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
93 } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
94 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
|
95 } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
96 |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
18746
diff
changeset
|
97 static const int bittab[8]={128,64,32,16,8,4,2,1}; |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
98 |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
99 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
|
100 int y; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
101 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
|
102 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
|
103 switch(bpp){ |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
104 case 1: { |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
105 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
|
106 int x; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
107 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
|
108 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
|
109 break; } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
110 case 2: { |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
111 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
|
112 int x; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
113 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
|
114 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
|
115 break; } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
116 case 4: { |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
117 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
|
118 int x; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
119 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
|
120 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
|
121 break; } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
122 } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
123 } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
124 } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
125 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
126 static int put_image(struct vf_instance *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
|
127 mp_image_t *dmpi; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
24969
diff
changeset
|
128 |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
129 // hope we'll get DR buffer: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
130 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
|
131 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
|
132 mpi->w, mpi->h); |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
133 |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
134 switch(dmpi->imgfmt){ |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
135 case IMGFMT_Y800: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
136 case IMGFMT_Y8: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
137 case IMGFMT_BGR8: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
138 case IMGFMT_RGB8: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
139 convert(mpi,dmpi,0,255,1); |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
140 break; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
141 case IMGFMT_YVU9: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
142 case IMGFMT_411P: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
143 case IMGFMT_YV12: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
144 case IMGFMT_I420: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
145 case IMGFMT_IYUV: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
146 case IMGFMT_422P: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
147 case IMGFMT_444P: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
148 convert(mpi,dmpi,0,255,1); |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
149 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
|
150 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
|
151 break; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
152 case IMGFMT_YUY2: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
153 convert(mpi,dmpi,0x8000,0x80ff,2); |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
154 break; |
31082
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30642
diff
changeset
|
155 case IMGFMT_BGR12: |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30642
diff
changeset
|
156 case IMGFMT_RGB12: |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30642
diff
changeset
|
157 convert(mpi,dmpi,0,0x0fff,2); |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30642
diff
changeset
|
158 break; |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
159 case IMGFMT_BGR15: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
160 case IMGFMT_RGB15: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
161 convert(mpi,dmpi,0,0x7fff,2); |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
162 break; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
163 case IMGFMT_BGR16: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
164 case IMGFMT_RGB16: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
165 convert(mpi,dmpi,0,0xffff,2); |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
166 break; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
167 case IMGFMT_BGR32: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
168 case IMGFMT_RGB32: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
169 convert(mpi,dmpi,0,0x00ffffff,4); |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
170 break; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
171 default: |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
172 mp_msg(MSGT_VFILTER,MSGL_ERR,"Unhandled format: 0x%X\n",dmpi->imgfmt); |
7848 | 173 return 0; |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
174 } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
175 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
176 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
|
177 } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
178 |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
179 //===========================================================================// |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
180 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
181 static int query_format(struct vf_instance *vf, unsigned int fmt){ |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
182 int best; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
183 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
|
184 best=find_best(vf); |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
185 if(!best) return 0; // no match |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
186 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
|
187 } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
188 |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30421
diff
changeset
|
189 static int vf_open(vf_instance_t *vf, char *args){ |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
190 vf->config=config; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
191 vf->put_image=put_image; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
192 vf->query_format=query_format; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
193 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
|
194 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
|
195 return 1; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
196 } |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
197 |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
18746
diff
changeset
|
198 const vf_info_t vf_info_1bpp = { |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
199 "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
|
200 "1bpp", |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
201 "A'rpi", |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
202 "", |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30421
diff
changeset
|
203 vf_open, |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8123
diff
changeset
|
204 NULL |
7755
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
205 }; |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
206 |
7637b72ef1f9
new filter: 1bpp - converts 1bpp image to yuv/rgb 8/16/32 bpp
arpi
parents:
diff
changeset
|
207 //===========================================================================// |