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