annotate libswscale/yuv2rgb_mlib.c @ 23724:72cff1657307

Remove unnecessary flip for RGB in v4l1. Patch was provided and tested by Trent Piepho xyzzy at speakeasy dot org.
author voroshil
date Sun, 08 Jul 2007 13:30:33 +0000
parents ebc55c913d73
children 0396f6a6d0d1
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 /*
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2 * yuv2rgb_mlib.c, Software YUV to RGB coverter using mediaLib
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
3 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
4 * Copyright (C) 2000, Håkan Hjort <d95hjort@dtek.chalmers.se>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
5 * All Rights Reserved.
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
6 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
7 * This file is part of mpeg2dec, a free MPEG-2 video decoder
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
8 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
9 * mpeg2dec is free software; you can redistribute it and/or modify
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
11 * the Free Software Foundation; either version 2, or (at your option)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
12 * any later version.
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
13 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
14 * mpeg2dec is distributed in the hope that it will be useful,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
17 * GNU General Public License for more details.
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
18 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
21976
8aac0a59f9c7 Fix license headers and FSF postal address.
diego
parents: 19872
diff changeset
20 * along with mpeg2dec; if not, write to the Free Software
8aac0a59f9c7 Fix license headers and FSF postal address.
diego
parents: 19872
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
22 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
23
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
24 #include <mlib_types.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
25 #include <mlib_status.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
26 #include <mlib_sys.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
27 #include <mlib_video.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
28 #include <inttypes.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
29 #include <stdlib.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
30 #include <assert.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
31
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
32 #include "swscale.h"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
33
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
34 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
35 int srcSliceH, uint8_t* dst[], int dstStride[]){
19872
8e50cba9fe03 Remove the dependency of libswscale on img_format.h
lucabe
parents: 19431
diff changeset
36 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
37 srcStride[1] *= 2;
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
38 srcStride[2] *= 2;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
39 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
40
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
41 assert(srcStride[1] == srcStride[2]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
42
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
43 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
44 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
45 return srcSliceH;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
46 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
47
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
48 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
49 int srcSliceH, uint8_t* dst[], int dstStride[]){
19872
8e50cba9fe03 Remove the dependency of libswscale on img_format.h
lucabe
parents: 19431
diff changeset
50 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
51 srcStride[1] *= 2;
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
52 srcStride[2] *= 2;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
53 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
54
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
55 assert(srcStride[1] == srcStride[2]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
56
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
57 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
58 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
59 return srcSliceH;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
60 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
61
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
62 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
63 int srcSliceH, uint8_t* dst[], int dstStride[]){
19872
8e50cba9fe03 Remove the dependency of libswscale on img_format.h
lucabe
parents: 19431
diff changeset
64 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
65 srcStride[1] *= 2;
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
66 srcStride[2] *= 2;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
67 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
68
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
69 assert(srcStride[1] == srcStride[2]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
70
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
71 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
72 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
73 return srcSliceH;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
74 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
75
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
76
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 21976
diff changeset
77 SwsFunc yuv2rgb_init_mlib(SwsContext *c)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
78 {
23157
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
79 switch(c->dstFormat){
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
80 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
81 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
82 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
83 default: return NULL;
ebc55c913d73 cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
84 }
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
85 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
86