Mercurial > mplayer.hg
annotate mp_image.h @ 4933:429994672d8c
're-include' possibility
author | nick |
---|---|
date | Sun, 03 Mar 2002 18:47:29 +0000 |
parents | 9d97874d8691 |
children | 993f274191ff |
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 |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
14 // stride should be aligned to 16-byte (MB) boundary: |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
15 #define MP_IMGFLAG_ALIGNED_STRIDE 0x20 |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
16 // 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
|
17 #define MP_IMGFLAG_DRAW_CALBACK 0x40 |
4185 | 18 |
19 // set if number of planes > 1 | |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
20 #define MP_IMGFLAG_PLANAR 0x100 |
4185 | 21 // set if it's YUV colorspace |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
22 #define MP_IMGFLAG_YUV 0x200 |
4185 | 23 // set if it's swapped plane/byteorder |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
24 #define MP_IMGFLAG_SWAPPED 0x400 |
4185 | 25 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
26 // 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
|
27 // allocation. so we just export its buffer pointers: |
4186 | 28 #define MP_IMGTYPE_EXPORT 0 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
29 // codec requires a static WO buffer, but it does only partial updates later: |
4186 | 30 #define MP_IMGTYPE_STATIC 1 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
31 // codec just needs some WO memory, where it writes/copies the whole frame to: |
4186 | 32 #define MP_IMGTYPE_TEMP 2 |
4877
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
33 // I+P type, requires 2+ independent static R/W buffers |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
34 #define MP_IMGTYPE_IP 3 |
9d97874d8691
new flags added for direct rendering (libmpcodecs core)
arpi
parents:
4187
diff
changeset
|
35 // 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
|
36 #define MP_IMGTYPE_IPB 4 |
4186 | 37 |
4185 | 38 typedef struct mp_image_s { |
39 unsigned short flags; | |
4186 | 40 unsigned char type; |
41 unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 | |
4185 | 42 unsigned int imgfmt; |
43 int width,height; // stored dimensions | |
44 int x,y,w,h; // visible dimensions | |
45 unsigned char* planes[3]; | |
46 unsigned int stride[3]; | |
47 int* qscale; | |
48 int qstride; | |
49 } mp_image_t; | |
50 | |
51 #ifdef IMGFMT_YUY2 | |
52 static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ | |
53 mpi->flags&=~(MP_IMGFLAG_PLANAR|MP_IMGFLAG_YUV|MP_IMGFLAG_SWAPPED); | |
4187 | 54 mpi->imgfmt=out_fmt; |
4185 | 55 if( (out_fmt&IMGFMT_RGB_MASK) == IMGFMT_RGB ){ |
4186 | 56 mpi->bpp=((out_fmt&255)+7)&(~7); |
4185 | 57 return; |
58 } | |
59 if( (out_fmt&IMGFMT_BGR_MASK) == IMGFMT_BGR ){ | |
4186 | 60 mpi->bpp=((out_fmt&255)+7)&(~7); |
4185 | 61 mpi->flags|=MP_IMGFLAG_SWAPPED; |
62 return; | |
63 } | |
64 mpi->flags|=MP_IMGFLAG_YUV; | |
65 switch(out_fmt){ | |
66 case IMGFMT_I420: | |
67 case IMGFMT_IYUV: | |
68 mpi->flags|=MP_IMGFLAG_SWAPPED; | |
69 case IMGFMT_YV12: | |
70 mpi->flags|=MP_IMGFLAG_PLANAR; | |
71 mpi->bpp=12; | |
72 return; | |
73 case IMGFMT_UYVY: | |
74 mpi->flags|=MP_IMGFLAG_SWAPPED; | |
75 case IMGFMT_YUY2: | |
76 mpi->bpp=16; | |
77 return; | |
78 } | |
79 printf("mp_image: Unknown out_fmt: 0x%X\n",out_fmt); | |
80 mpi->bpp=0; | |
81 } | |
82 #endif | |
83 | |
84 static inline mp_image_t* new_mp_image(int w,int h){ | |
85 mp_image_t* mpi=malloc(sizeof(mp_image_t)); | |
86 if(!mpi) return NULL; // error! | |
87 memset(mpi,0,sizeof(mp_image_t)); | |
88 mpi->width=mpi->w=w; | |
89 mpi->height=mpi->h=h; | |
90 return mpi; | |
91 } | |
4933 | 92 |
93 #endif |