annotate postproc/yuv2rgb_mlib.c @ 8045:c34100c609ee

10l
author michael
date Sat, 02 Nov 2002 16:55:23 +0000
parents e7635c03910f
children 7bbe4bce6293
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>
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
29
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
30 static void mlib_YUV2ARGB420_32(uint8_t* image, uint8_t* py,
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
31 uint8_t* pu, uint8_t* pv,
6492
e7635c03910f sync with mplayer xp
arpi
parents: 2744
diff changeset
32 unsigned h_size, unsigned v_size,
e7635c03910f sync with mplayer xp
arpi
parents: 2744
diff changeset
33 unsigned rgb_stride, unsigned y_stride, unsigned uv_stride)
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
34 {
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
35 mlib_VideoColorYUV2ARGB420(image, py, pu, pv, h_size,
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
36 v_size, rgb_stride, y_stride, uv_stride);
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
37 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
38
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
39 static void mlib_YUV2ABGR420_32(uint8_t* image, uint8_t* py,
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
40 uint8_t* pu, uint8_t* pv,
6492
e7635c03910f sync with mplayer xp
arpi
parents: 2744
diff changeset
41 unsigned h_size, unsigned v_size,
e7635c03910f sync with mplayer xp
arpi
parents: 2744
diff changeset
42 unsigned rgb_stride, unsigned y_stride, unsigned uv_stride)
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
43 {
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
44 mlib_VideoColorYUV2ABGR420(image, py, pu, pv, h_size,
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
45 v_size, rgb_stride, y_stride, uv_stride);
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
46 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
47
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
48 static void mlib_YUV2RGB420_24(uint8_t* image, uint8_t* py,
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
49 uint8_t* pu, uint8_t* pv,
6492
e7635c03910f sync with mplayer xp
arpi
parents: 2744
diff changeset
50 unsigned h_size, unsigned v_size,
e7635c03910f sync with mplayer xp
arpi
parents: 2744
diff changeset
51 unsigned rgb_stride, unsigned y_stride, unsigned uv_stride)
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
52 {
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
53 mlib_VideoColorYUV2RGB420(image, py, pu, pv, h_size,
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
54 v_size, rgb_stride, y_stride, uv_stride);
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
55 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
56
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
57
6492
e7635c03910f sync with mplayer xp
arpi
parents: 2744
diff changeset
58 yuv2rgb_fun yuv2rgb_init_mlib(unsigned bpp, int mode)
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
59 {
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
60
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
61 if( bpp == 24 )
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
62 {
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
63 if( mode == MODE_RGB )
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
64 return mlib_YUV2RGB420_24;
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
65 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
66
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
67 if( bpp == 32 )
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
68 {
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
69 if( mode == MODE_RGB )
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
70 return mlib_YUV2ARGB420_32;
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
71 else if( mode == MODE_BGR )
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
72 return mlib_YUV2ABGR420_32;
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
73 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
74
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
75 return NULL;
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
76 }
ae79207a3055 Move yuv2rgb to postprocess
nick
parents:
diff changeset
77