annotate postproc/yuv2rgb_mlib.c @ 14311:f0d7cd1174d6

happy new year
author diego
date Sun, 02 Jan 2005 23:07:11 +0000
parents 77ed12a4f0b1
children 08cac43f1e38
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
1 /*
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
2 * yuv2rgb_mlib.c, Software YUV to RGB coverter using mediaLib
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
3 *
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
4 * Copyright (C) 2000, Håkan Hjort <d95hjort@dtek.chalmers.se>
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
5 * All Rights Reserved.
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
6 *
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
7 * This file is part of mpeg2dec, a free MPEG-2 video decoder
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
8 *
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
9 * mpeg2dec is free software; you can redistribute it and/or modify
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
11 * the Free Software Foundation; either version 2, or (at your option)
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
12 * any later version.
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
13 *
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
14 * mpeg2dec is distributed in the hope that it will be useful,
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
17 * GNU General Public License for more details.
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
18 *
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
20 * along with GNU Make; see the file COPYING. If not, write to
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
22 *
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
23 */
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
24
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
25 #include <mlib_types.h>
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
26 #include <mlib_status.h>
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
27 #include <mlib_sys.h>
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
28 #include <mlib_video.h>
9476
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
29 #include <inttypes.h>
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
30 #include <stdlib.h>
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
31 #include <assert.h>
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
32
9476
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
33 #include "../libvo/img_format.h" //FIXME try to reduce dependency of such stuff
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
34 #include "swscale.h"
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
35
9499
bc5b87370cd1 cleanup
michael
parents: 9494
diff changeset
36 static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
9476
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
37 int srcSliceH, uint8_t* dst[], int dstStride[]){
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
38 if(c->srcFormat == IMGFMT_422P){
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
39 srcStride[1] *= 2;
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
40 srcStride[2] *= 2;
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
41 }
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
42
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
43 assert(srcStride[1] == srcStride[2]);
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
44
11037
77ed12a4f0b1 Fixed the brokeness and also bgr32 should work now. Patch by Ken Mandelberg <km@mathcs.emory.edu>
alex
parents: 9499
diff changeset
45 mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
77ed12a4f0b1 Fixed the brokeness and also bgr32 should work now. Patch by Ken Mandelberg <km@mathcs.emory.edu>
alex
parents: 9499
diff changeset
46 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
9494
543ab3909b78 sws_ prefix, more seperation between internal & external swscaler API
michael
parents: 9476
diff changeset
47 return srcSliceH;
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
48 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
49
9499
bc5b87370cd1 cleanup
michael
parents: 9494
diff changeset
50 static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
9476
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
51 int srcSliceH, uint8_t* dst[], int dstStride[]){
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
52 if(c->srcFormat == IMGFMT_422P){
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
53 srcStride[1] *= 2;
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
54 srcStride[2] *= 2;
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
55 }
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
56
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
57 assert(srcStride[1] == srcStride[2]);
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
58
11037
77ed12a4f0b1 Fixed the brokeness and also bgr32 should work now. Patch by Ken Mandelberg <km@mathcs.emory.edu>
alex
parents: 9499
diff changeset
59 mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
77ed12a4f0b1 Fixed the brokeness and also bgr32 should work now. Patch by Ken Mandelberg <km@mathcs.emory.edu>
alex
parents: 9499
diff changeset
60 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
9494
543ab3909b78 sws_ prefix, more seperation between internal & external swscaler API
michael
parents: 9476
diff changeset
61 return srcSliceH;
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
62 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
63
9499
bc5b87370cd1 cleanup
michael
parents: 9494
diff changeset
64 static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
9476
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
65 int srcSliceH, uint8_t* dst[], int dstStride[]){
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
66 if(c->srcFormat == IMGFMT_422P){
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
67 srcStride[1] *= 2;
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
68 srcStride[2] *= 2;
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
69 }
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
70
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
71 assert(srcStride[1] == srcStride[2]);
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
72
11037
77ed12a4f0b1 Fixed the brokeness and also bgr32 should work now. Patch by Ken Mandelberg <km@mathcs.emory.edu>
alex
parents: 9499
diff changeset
73 mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
77ed12a4f0b1 Fixed the brokeness and also bgr32 should work now. Patch by Ken Mandelberg <km@mathcs.emory.edu>
alex
parents: 9499
diff changeset
74 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
9494
543ab3909b78 sws_ prefix, more seperation between internal & external swscaler API
michael
parents: 9476
diff changeset
75 return srcSliceH;
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
76 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
77
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
78
9476
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
79 SwsFunc yuv2rgb_init_mlib(SwsContext *c)
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
80 {
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
81 switch(c->dstFormat){
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
82 case IMGFMT_RGB24: return mlib_YUV2RGB420_24;
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
83 case IMGFMT_RGB32: return mlib_YUV2ARGB420_32;
11037
77ed12a4f0b1 Fixed the brokeness and also bgr32 should work now. Patch by Ken Mandelberg <km@mathcs.emory.edu>
alex
parents: 9499
diff changeset
84 case IMGFMT_BGR32: return mlib_YUV2ABGR420_32;
9476
eff727517e6b yuv2rgb brightness/contrast/saturation/different colorspaces support finished
michael
parents: 9392
diff changeset
85 default: return NULL;
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
86 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
87 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
88