Mercurial > mplayer.hg
annotate mp_image.h @ 4907:08f739d36ae0
Fix a few syntax errors compiling ao_sun.c
author | jkeil |
---|---|
date | Fri, 01 Mar 2002 14:54:05 +0000 |
parents | 9d97874d8691 |
children | 429994672d8c |
rev | line source |
---|---|
4185 | 1 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
2 // set if buffer content shouldn't be modified: |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
3 #define MP_IMGFLAG_PRESERVE 0x01 |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
4 // set if buffer content will be READED for next frame's MC: (I/P mpeg frames) |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
5 #define MP_IMGFLAG_READABLE 0x02 |
4185 | 6 // set if buffer is allocated (used in destination images): |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
7 #define MP_IMGFLAG_ALLOCATED 0x04 |
4185 | 8 // set if it's in video buffer/memory: |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
9 #define MP_IMGFLAG_DIRECT 0x08 |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
10 // codec accept any stride (>=width): |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
11 #define MP_IMGFLAG_ACCEPT_STRIDE 0x10 |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
12 // stride should be aligned to 16-byte (MB) boundary: |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
13 #define MP_IMGFLAG_ALIGNED_STRIDE 0x20 |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
14 // codec uses drawing/rendering callbacks (draw_slice()-like thing, DR method 2) |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
15 #define MP_IMGFLAG_DRAW_CALBACK 0x40 |
4185 | 16 |
17 // set if number of planes > 1 | |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
18 #define MP_IMGFLAG_PLANAR 0x100 |
4185 | 19 // set if it's YUV colorspace |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
20 #define MP_IMGFLAG_YUV 0x200 |
4185 | 21 // set if it's swapped plane/byteorder |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
22 #define MP_IMGFLAG_SWAPPED 0x400 |
4185 | 23 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
24 // 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
|
25 // allocation. so we just export its buffer pointers: |
4186 | 26 #define MP_IMGTYPE_EXPORT 0 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
27 // codec requires a static WO buffer, but it does only partial updates later: |
4186 | 28 #define MP_IMGTYPE_STATIC 1 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
29 // codec just needs some WO memory, where it writes/copies the whole frame to: |
4186 | 30 #define MP_IMGTYPE_TEMP 2 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
31 // I+P type, requires 2+ independent static R/W buffers |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
32 #define MP_IMGTYPE_IP 3 |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
33 // 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
|
34 #define MP_IMGTYPE_IPB 4 |
4186 | 35 |
4185 | 36 typedef struct mp_image_s { |
37 unsigned short flags; | |
4186 | 38 unsigned char type; |
39 unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 | |
4185 | 40 unsigned int imgfmt; |
41 int width,height; // stored dimensions | |
42 int x,y,w,h; // visible dimensions | |
43 unsigned char* planes[3]; | |
44 unsigned int stride[3]; | |
45 int* qscale; | |
46 int qstride; | |
47 } mp_image_t; | |
48 | |
49 #ifdef IMGFMT_YUY2 | |
50 static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ | |
51 mpi->flags&=~(MP_IMGFLAG_PLANAR|MP_IMGFLAG_YUV|MP_IMGFLAG_SWAPPED); | |
4187 | 52 mpi->imgfmt=out_fmt; |
4185 | 53 if( (out_fmt&IMGFMT_RGB_MASK) == IMGFMT_RGB ){ |
4186 | 54 mpi->bpp=((out_fmt&255)+7)&(~7); |
4185 | 55 return; |
56 } | |
57 if( (out_fmt&IMGFMT_BGR_MASK) == IMGFMT_BGR ){ | |
4186 | 58 mpi->bpp=((out_fmt&255)+7)&(~7); |
4185 | 59 mpi->flags|=MP_IMGFLAG_SWAPPED; |
60 return; | |
61 } | |
62 mpi->flags|=MP_IMGFLAG_YUV; | |
63 switch(out_fmt){ | |
64 case IMGFMT_I420: | |
65 case IMGFMT_IYUV: | |
66 mpi->flags|=MP_IMGFLAG_SWAPPED; | |
67 case IMGFMT_YV12: | |
68 mpi->flags|=MP_IMGFLAG_PLANAR; | |
69 mpi->bpp=12; | |
70 return; | |
71 case IMGFMT_UYVY: | |
72 mpi->flags|=MP_IMGFLAG_SWAPPED; | |
73 case IMGFMT_YUY2: | |
74 mpi->bpp=16; | |
75 return; | |
76 } | |
77 printf("mp_image: Unknown out_fmt: 0x%X\n",out_fmt); | |
78 mpi->bpp=0; | |
79 } | |
80 #endif | |
81 | |
82 static inline mp_image_t* new_mp_image(int w,int h){ | |
83 mp_image_t* mpi=malloc(sizeof(mp_image_t)); | |
84 if(!mpi) return NULL; // error! | |
85 memset(mpi,0,sizeof(mp_image_t)); | |
86 mpi->width=mpi->w=w; | |
87 mpi->height=mpi->h=h; | |
88 return mpi; | |
89 } |