annotate libswscale/yuv2rgb_mlib.c @ 27018:d8e2eb33be6b

add missing <application> tag around MPlayer, patch by Cedric Viou
author gpoirier
date Wed, 11 Jun 2008 20:25:09 +0000
parents 703a889707df
children 65b8334df960
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
1 /*
23760
diego
parents: 23732
diff changeset
2 * yuv2rgb_mlib.c, Software YUV to RGB converter using mediaLib
23776
703a889707df This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents: 23760
diff changeset
3 * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
4 *
23776
703a889707df This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents: 23760
diff changeset
5 * This file is part of FFmpeg.
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
6 *
23776
703a889707df This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents: 23760
diff changeset
7 * 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
8 * 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
9 * 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
10 * version 2.1 of the License, or (at your option) any later version.
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
11 *
23776
703a889707df This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents: 23760
diff changeset
12 * 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
13 * 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
14 * 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
15 * Lesser General Public License for more details.
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
16 *
23776
703a889707df This was rewritten by Michael, switch copyrights to him and license to LGPL.
diego
parents: 23760
diff changeset
17 * 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
18 * 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
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
20 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
21
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
22 #include <mlib_types.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
23 #include <mlib_status.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
24 #include <mlib_sys.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
25 #include <mlib_video.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
26 #include <inttypes.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
27 #include <stdlib.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
28 #include <assert.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
29
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
30 #include "swscale.h"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
31
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
32 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
33 int srcSliceH, uint8_t* dst[], int dstStride[]){
19872
8e50cba9fe03 Remove the dependency of libswscale on img_format.h
lucabe
parents: 19431
diff changeset
34 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
35 srcStride[1] *= 2;
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
36 srcStride[2] *= 2;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
37 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
38
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
39 assert(srcStride[1] == srcStride[2]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
40
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
41 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
42 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
43 return srcSliceH;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
44 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
45
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
46 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
47 int srcSliceH, uint8_t* dst[], int dstStride[]){
19872
8e50cba9fe03 Remove the dependency of libswscale on img_format.h
lucabe
parents: 19431
diff changeset
48 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
49 srcStride[1] *= 2;
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
50 srcStride[2] *= 2;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
51 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
52
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
53 assert(srcStride[1] == srcStride[2]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
54
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
55 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
56 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
57 return srcSliceH;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
58 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
59
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
60 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
61 int srcSliceH, uint8_t* dst[], int dstStride[]){
19872
8e50cba9fe03 Remove the dependency of libswscale on img_format.h
lucabe
parents: 19431
diff changeset
62 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
63 srcStride[1] *= 2;
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
64 srcStride[2] *= 2;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
65 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
66
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
67 assert(srcStride[1] == srcStride[2]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
68
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
69 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
70 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
71 return srcSliceH;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
72 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
73
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
74
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
75 SwsFunc yuv2rgb_init_mlib(SwsContext *c)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
76 {
23157
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
77 switch(c->dstFormat){
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
78 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
79 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
80 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
81 default: return NULL;
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
82 }
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
83 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
84