Mercurial > mplayer.hg
annotate libswscale/yuv2rgb_mlib.c @ 27608:2351f5586fe7
add windows NUL info
author | compn |
---|---|
date | Fri, 19 Sep 2008 18:20:31 +0000 |
parents | 65b8334df960 |
children | 75586eb0750d |
rev | line source |
---|---|
23129 | 1 /* |
27158 | 2 * software YUV to RGB converter using mediaLib |
3 * | |
23776
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
4 * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at> |
18861 | 5 * |
23776
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
6 * This file is part of FFmpeg. |
18861 | 7 * |
23776
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
18861 | 12 * |
23776
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
16 * Lesser General Public License for more details. |
18861 | 17 * |
23776
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
703a889707df
This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents:
23760
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
18861 | 21 */ |
22 | |
23 #include <mlib_types.h> | |
24 #include <mlib_status.h> | |
25 #include <mlib_sys.h> | |
26 #include <mlib_video.h> | |
27 #include <inttypes.h> | |
28 #include <stdlib.h> | |
29 #include <assert.h> | |
30 | |
31 #include "swscale.h" | |
32 | |
23129 | 33 static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
34 int srcSliceH, uint8_t* dst[], int dstStride[]){ |
19872
8e50cba9fe03
Remove the dependency of libswscale on img_format.h
lucabe
parents:
19431
diff
changeset
|
35 if(c->srcFormat == PIX_FMT_YUV422P){ |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
36 srcStride[1] *= 2; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
37 srcStride[2] *= 2; |
18861 | 38 } |
23129 | 39 |
18861 | 40 assert(srcStride[1] == srcStride[2]); |
23129 | 41 |
18861 | 42 mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW, |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
43 srcSliceH, dstStride[0], srcStride[0], srcStride[1]); |
18861 | 44 return srcSliceH; |
45 } | |
46 | |
23129 | 47 static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
48 int srcSliceH, uint8_t* dst[], int dstStride[]){ |
19872
8e50cba9fe03
Remove the dependency of libswscale on img_format.h
lucabe
parents:
19431
diff
changeset
|
49 if(c->srcFormat == PIX_FMT_YUV422P){ |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
50 srcStride[1] *= 2; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
51 srcStride[2] *= 2; |
18861 | 52 } |
23129 | 53 |
18861 | 54 assert(srcStride[1] == srcStride[2]); |
23129 | 55 |
18861 | 56 mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW, |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
57 srcSliceH, dstStride[0], srcStride[0], srcStride[1]); |
18861 | 58 return srcSliceH; |
59 } | |
60 | |
23129 | 61 static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
62 int srcSliceH, uint8_t* dst[], int dstStride[]){ |
19872
8e50cba9fe03
Remove the dependency of libswscale on img_format.h
lucabe
parents:
19431
diff
changeset
|
63 if(c->srcFormat == PIX_FMT_YUV422P){ |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
64 srcStride[1] *= 2; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
65 srcStride[2] *= 2; |
18861 | 66 } |
23129 | 67 |
18861 | 68 assert(srcStride[1] == srcStride[2]); |
23129 | 69 |
18861 | 70 mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW, |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
71 srcSliceH, dstStride[0], srcStride[0], srcStride[1]); |
18861 | 72 return srcSliceH; |
73 } | |
74 | |
75 | |
23129 | 76 SwsFunc yuv2rgb_init_mlib(SwsContext *c) |
18861 | 77 { |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
78 switch(c->dstFormat){ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
79 case PIX_FMT_RGB24: return mlib_YUV2RGB420_24; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
80 case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
81 case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
82 default: return NULL; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
83 } |
18861 | 84 } |
85 |