Mercurial > mplayer.hg
annotate libmpcodecs/mp_image.h @ 30918:be200e917ae1
Remove unused OPTFLAGS variable from config.mak.
author | diego |
---|---|
date | Thu, 25 Mar 2010 19:53:05 +0000 |
parents | 9fc9d1e788aa |
children | 6e9ece21c004 |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30115
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30115
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30115
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30115
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:
30115
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:
30115
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:
30115
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30115
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30115
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:
30115
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:
30115
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:
30115
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30115
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30115
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:
30115
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:
30115
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:
30115
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30115
diff
changeset
|
18 |
26029 | 19 #ifndef MPLAYER_MP_IMAGE_H |
20 #define MPLAYER_MP_IMAGE_H | |
4185 | 21 |
26147
41652035483c
Add necessary header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
22 #include <stdio.h> |
41652035483c
Add necessary header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
23 #include <stdlib.h> |
41652035483c
Add necessary header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
24 #include <string.h> |
28518 | 25 #include "mp_msg.h" |
26147
41652035483c
Add necessary header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
26 |
6875 | 27 //--------- codec's requirements (filled by the codec/vf) --------- |
28 | |
29 //--- buffer content restrictions: | |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
30 // set if buffer content shouldn't be modified: |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
31 #define MP_IMGFLAG_PRESERVE 0x01 |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
32 // set if buffer content will be READ for next frame's MC: (I/P mpeg frames) |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
33 #define MP_IMGFLAG_READABLE 0x02 |
6875 | 34 |
35 //--- buffer width/stride/plane restrictions: (used for direct rendering) | |
36 // stride _have_to_ be aligned to MB boundary: [for DR restrictions] | |
37 #define MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE 0x4 | |
38 // stride should be aligned to MB boundary: [for buffer allocation] | |
39 #define MP_IMGFLAG_PREFER_ALIGNED_STRIDE 0x8 | |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
40 // codec accept any stride (>=width): |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
41 #define MP_IMGFLAG_ACCEPT_STRIDE 0x10 |
6875 | 42 // codec accept any width (width*bpp=stride -> stride%bpp==0) (>=width): |
4962 | 43 #define MP_IMGFLAG_ACCEPT_WIDTH 0x20 |
6875 | 44 //--- for planar formats only: |
45 // uses only stride[0], and stride[1]=stride[2]=stride[0]>>mpi->chroma_x_shift | |
46 #define MP_IMGFLAG_COMMON_STRIDE 0x40 | |
47 // uses only planes[0], and calculates planes[1,2] from width,height,imgfmt | |
48 #define MP_IMGFLAG_COMMON_PLANE 0x80 | |
4185 | 49 |
6875 | 50 #define MP_IMGFLAGMASK_RESTRICTIONS 0xFF |
51 | |
52 //--------- color info (filled by mp_image_setfmt() ) ----------- | |
4185 | 53 // set if number of planes > 1 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
54 #define MP_IMGFLAG_PLANAR 0x100 |
4185 | 55 // set if it's YUV colorspace |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
56 #define MP_IMGFLAG_YUV 0x200 |
6875 | 57 // set if it's swapped (BGR or YVU) plane/byteorder |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
58 #define MP_IMGFLAG_SWAPPED 0x400 |
30074 | 59 // set if you want memory for palette allocated and managed by vf_get_image etc. |
6875 | 60 #define MP_IMGFLAG_RGB_PALETTE 0x800 |
61 | |
62 #define MP_IMGFLAGMASK_COLORS 0xF00 | |
63 | |
64 // codec uses drawing/rendering callbacks (draw_slice()-like thing, DR method 2) | |
65 // [the codec will set this flag if it supports callbacks, and the vo _may_ | |
66 // clear it in get_image() if draw_slice() not implemented] | |
67 #define MP_IMGFLAG_DRAW_CALLBACK 0x1000 | |
68 // set if it's in video buffer/memory: [set by vo/vf's get_image() !!!] | |
69 #define MP_IMGFLAG_DIRECT 0x2000 | |
70 // set if buffer is allocated (used in destination images): | |
71 #define MP_IMGFLAG_ALLOCATED 0x4000 | |
72 | |
73 // buffer type was printed (do NOT set this flag - it's for INTERNAL USE!!!) | |
74 #define MP_IMGFLAG_TYPE_DISPLAYED 0x8000 | |
4185 | 75 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
76 // codec doesn't support any form of direct rendering - it has own buffer |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
77 // allocation. so we just export its buffer pointers: |
4186 | 78 #define MP_IMGTYPE_EXPORT 0 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
79 // codec requires a static WO buffer, but it does only partial updates later: |
4186 | 80 #define MP_IMGTYPE_STATIC 1 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
81 // codec just needs some WO memory, where it writes/copies the whole frame to: |
4186 | 82 #define MP_IMGTYPE_TEMP 2 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
83 // I+P type, requires 2+ independent static R/W buffers |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
84 #define MP_IMGTYPE_IP 3 |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
85 // I+P+B type, requires 2+ independent static R/W and 1+ temp WO buffers |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
86 #define MP_IMGTYPE_IPB 4 |
28515
134689b7b548
Add MP_IMGTYPE_NUMBERED which gives access to the kind of mp_image_t that
reimar
parents:
26147
diff
changeset
|
87 // Upper 16 bits give desired buffer number, -1 means get next available |
134689b7b548
Add MP_IMGTYPE_NUMBERED which gives access to the kind of mp_image_t that
reimar
parents:
26147
diff
changeset
|
88 #define MP_IMGTYPE_NUMBERED 5 |
4186 | 89 |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
90 #define MP_MAX_PLANES 4 |
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
91 |
10663 | 92 #define MP_IMGFIELD_ORDERED 0x01 |
93 #define MP_IMGFIELD_TOP_FIRST 0x02 | |
94 #define MP_IMGFIELD_REPEAT_FIRST 0x04 | |
95 #define MP_IMGFIELD_TOP 0x08 | |
96 #define MP_IMGFIELD_BOTTOM 0x10 | |
11669
bcf9862f61b2
set top_field first for lavc decoding and add MP_IMGFIELD_INTERLACED
michael
parents:
11386
diff
changeset
|
97 #define MP_IMGFIELD_INTERLACED 0x20 |
10510
73b3e4336cd4
Add mpeg2_flags to mp_image_t, copy flags in vd_libmpeg2.c,
ranma
parents:
10316
diff
changeset
|
98 |
4185 | 99 typedef struct mp_image_s { |
28515
134689b7b548
Add MP_IMGTYPE_NUMBERED which gives access to the kind of mp_image_t that
reimar
parents:
26147
diff
changeset
|
100 unsigned int flags; |
4186 | 101 unsigned char type; |
28515
134689b7b548
Add MP_IMGTYPE_NUMBERED which gives access to the kind of mp_image_t that
reimar
parents:
26147
diff
changeset
|
102 int number; |
4186 | 103 unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 |
4185 | 104 unsigned int imgfmt; |
105 int width,height; // stored dimensions | |
106 int x,y,w,h; // visible dimensions | |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
107 unsigned char* planes[MP_MAX_PLANES]; |
14792
6c12ee26fab9
stride must be signed! otherwise negative stride is broken on 64bit systems
rfelker
parents:
11669
diff
changeset
|
108 int stride[MP_MAX_PLANES]; |
7984
a57c1fc0c2fc
change qscale type to int8 and fix qscale ordering
michael
parents:
7957
diff
changeset
|
109 char * qscale; |
4185 | 110 int qstride; |
7957
31fd09cc9ba2
passing picture_type (might be usefull for postprocessing)
michael
parents:
6911
diff
changeset
|
111 int pict_type; // 0->unknown, 1->I, 2->P, 3->B |
10663 | 112 int fields; |
9925
420640a0f6d0
passing qscale_type around so the pp code can fix the mpeg2 <<1 thing
michael
parents:
9171
diff
changeset
|
113 int qscale_type; // 0->mpeg1/4/h263, 1->mpeg2 |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
114 int num_planes; |
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
115 /* these are only used by planar formats Y,U(Cb),V(Cr) */ |
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
116 int chroma_width; |
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
117 int chroma_height; |
6539
79b536a37e40
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6538
diff
changeset
|
118 int chroma_x_shift; // horizontal |
79b536a37e40
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6538
diff
changeset
|
119 int chroma_y_shift; // vertical |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28518
diff
changeset
|
120 int usage_count; |
6759
415be01747ae
added 'priv' field to mpi - requires for tracking frames with different
arpi
parents:
6707
diff
changeset
|
121 /* for private use by filter or vo driver (to store buffer id or dmpi) */ |
415be01747ae
added 'priv' field to mpi - requires for tracking frames with different
arpi
parents:
6707
diff
changeset
|
122 void* priv; |
4185 | 123 } mp_image_t; |
124 | |
125 #ifdef IMGFMT_YUY2 | |
126 static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ | |
127 mpi->flags&=~(MP_IMGFLAG_PLANAR|MP_IMGFLAG_YUV|MP_IMGFLAG_SWAPPED); | |
4187 | 128 mpi->imgfmt=out_fmt; |
28517
e9174807756c
Cosmetics: handle all special/compressed formats in a single if in mp_image_setfmt
reimar
parents:
28516
diff
changeset
|
129 // compressed formats |
e9174807756c
Cosmetics: handle all special/compressed formats in a single if in mp_image_setfmt
reimar
parents:
28516
diff
changeset
|
130 if(out_fmt == IMGFMT_MPEGPES || |
e9174807756c
Cosmetics: handle all special/compressed formats in a single if in mp_image_setfmt
reimar
parents:
28516
diff
changeset
|
131 out_fmt == IMGFMT_ZRMJPEGNI || out_fmt == IMGFMT_ZRMJPEGIT || out_fmt == IMGFMT_ZRMJPEGIB || |
e9174807756c
Cosmetics: handle all special/compressed formats in a single if in mp_image_setfmt
reimar
parents:
28516
diff
changeset
|
132 IMGFMT_IS_VDPAU(out_fmt) || IMGFMT_IS_XVMC(out_fmt)){ |
10316 | 133 mpi->bpp=0; |
134 return; | |
135 } | |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
136 mpi->num_planes=1; |
6707 | 137 if (IMGFMT_IS_RGB(out_fmt)) { |
9171 | 138 if (IMGFMT_RGB_DEPTH(out_fmt) < 8 && !(out_fmt&128)) |
6707 | 139 mpi->bpp = IMGFMT_RGB_DEPTH(out_fmt); |
140 else | |
141 mpi->bpp=(IMGFMT_RGB_DEPTH(out_fmt)+7)&(~7); | |
4185 | 142 return; |
143 } | |
6707 | 144 if (IMGFMT_IS_BGR(out_fmt)) { |
9171 | 145 if (IMGFMT_BGR_DEPTH(out_fmt) < 8 && !(out_fmt&128)) |
6707 | 146 mpi->bpp = IMGFMT_BGR_DEPTH(out_fmt); |
147 else | |
148 mpi->bpp=(IMGFMT_BGR_DEPTH(out_fmt)+7)&(~7); | |
4185 | 149 mpi->flags|=MP_IMGFLAG_SWAPPED; |
150 return; | |
151 } | |
152 mpi->flags|=MP_IMGFLAG_YUV; | |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
153 mpi->num_planes=3; |
30096
76c25bfa181b
Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents:
30074
diff
changeset
|
154 if (mp_get_chroma_shift(out_fmt, NULL, NULL)) { |
76c25bfa181b
Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents:
30074
diff
changeset
|
155 mpi->flags|=MP_IMGFLAG_PLANAR; |
76c25bfa181b
Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents:
30074
diff
changeset
|
156 mpi->bpp = mp_get_chroma_shift(out_fmt, &mpi->chroma_x_shift, &mpi->chroma_y_shift); |
76c25bfa181b
Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents:
30074
diff
changeset
|
157 mpi->chroma_width = mpi->width >> mpi->chroma_x_shift; |
76c25bfa181b
Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents:
30074
diff
changeset
|
158 mpi->chroma_height = mpi->height >> mpi->chroma_y_shift; |
76c25bfa181b
Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents:
30074
diff
changeset
|
159 } |
4185 | 160 switch(out_fmt){ |
161 case IMGFMT_I420: | |
162 case IMGFMT_IYUV: | |
163 mpi->flags|=MP_IMGFLAG_SWAPPED; | |
164 case IMGFMT_YV12: | |
165 return; | |
30115
ad61464d02a7
Add support for YUV format with alpha and fix the codecs.conf entry for vp6a
reimar
parents:
30110
diff
changeset
|
166 case IMGFMT_420A: |
6525 | 167 case IMGFMT_IF09: |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
168 mpi->num_planes=4; |
6478 | 169 case IMGFMT_YVU9: |
6863 | 170 case IMGFMT_444P: |
171 case IMGFMT_422P: | |
172 case IMGFMT_411P: | |
30098 | 173 case IMGFMT_440P: |
30110 | 174 case IMGFMT_444P16_LE: |
175 case IMGFMT_444P16_BE: | |
176 case IMGFMT_422P16_LE: | |
177 case IMGFMT_422P16_BE: | |
178 case IMGFMT_420P16_LE: | |
179 case IMGFMT_420P16_BE: | |
6863 | 180 return; |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
181 case IMGFMT_Y800: |
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
182 case IMGFMT_Y8: |
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
183 /* they're planar ones, but for easier handling use them as packed */ |
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
184 // mpi->flags|=MP_IMGFLAG_PLANAR; |
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
185 mpi->bpp=8; |
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
186 mpi->num_planes=1; |
6478 | 187 return; |
4185 | 188 case IMGFMT_UYVY: |
189 mpi->flags|=MP_IMGFLAG_SWAPPED; | |
190 case IMGFMT_YUY2: | |
191 mpi->bpp=16; | |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
192 mpi->num_planes=1; |
5144 | 193 return; |
10742
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
194 case IMGFMT_NV12: |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
195 mpi->flags|=MP_IMGFLAG_SWAPPED; |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
196 case IMGFMT_NV21: |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
197 mpi->flags|=MP_IMGFLAG_PLANAR; |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
198 mpi->bpp=12; |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
199 mpi->num_planes=2; |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
200 mpi->chroma_width=(mpi->width>>0); |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
201 mpi->chroma_height=(mpi->height>>1); |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
202 mpi->chroma_x_shift=0; |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
203 mpi->chroma_y_shift=1; |
794b55a44528
basic nv12 and nv21 support by Angelo Cano <angelo_cano@fastmail.fm>
alex
parents:
10663
diff
changeset
|
204 return; |
4185 | 205 } |
28518 | 206 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"mp_image: unknown out_fmt: 0x%X\n",out_fmt); |
4185 | 207 mpi->bpp=0; |
208 } | |
209 #endif | |
210 | |
211 static inline mp_image_t* new_mp_image(int w,int h){ | |
30702 | 212 mp_image_t* mpi = malloc(sizeof(mp_image_t)); |
4185 | 213 if(!mpi) return NULL; // error! |
214 memset(mpi,0,sizeof(mp_image_t)); | |
215 mpi->width=mpi->w=w; | |
216 mpi->height=mpi->h=h; | |
217 return mpi; | |
218 } | |
4933 | 219 |
5737 | 220 static inline void free_mp_image(mp_image_t* mpi){ |
221 if(!mpi) return; | |
222 if(mpi->flags&MP_IMGFLAG_ALLOCATED){ | |
6538
afb4f3c107e7
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6525
diff
changeset
|
223 /* becouse we allocate the whole image in once */ |
5737 | 224 if(mpi->planes[0]) free(mpi->planes[0]); |
30074 | 225 if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) |
226 free(mpi->planes[1]); | |
5737 | 227 } |
228 free(mpi); | |
229 } | |
230 | |
23994
8572d2ef5263
Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
23689
diff
changeset
|
231 mp_image_t* alloc_mpi(int w, int h, unsigned long int fmt); |
30115
ad61464d02a7
Add support for YUV format with alpha and fix the codecs.conf entry for vp6a
reimar
parents:
30110
diff
changeset
|
232 void mp_image_alloc_planes(mp_image_t *mpi); |
23994
8572d2ef5263
Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
23689
diff
changeset
|
233 void copy_mpi(mp_image_t *dmpi, mp_image_t *mpi); |
8572d2ef5263
Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
23689
diff
changeset
|
234 |
26029 | 235 #endif /* MPLAYER_MP_IMAGE_H */ |