2732
|
1 /*
|
|
2 * yuv2rgb_mlib.c, Software YUV to RGB coverter using mediaLib
|
|
3 *
|
|
4 * Copyright (C) 2000, Håkan Hjort <d95hjort@dtek.chalmers.se>
|
|
5 * All Rights Reserved.
|
|
6 *
|
|
7 * This file is part of mpeg2dec, a free MPEG-2 video decoder
|
|
8 *
|
|
9 * mpeg2dec is free software; you can redistribute it and/or modify
|
|
10 * it under the terms of the GNU General Public License as published by
|
|
11 * the Free Software Foundation; either version 2, or (at your option)
|
|
12 * any later version.
|
|
13 *
|
|
14 * mpeg2dec is distributed in the hope that it will be useful,
|
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 * GNU General Public License for more details.
|
|
18 *
|
|
19 * You should have received a copy of the GNU General Public License
|
|
20 * along with GNU Make; see the file COPYING. If not, write to
|
|
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
22 *
|
|
23 */
|
|
24
|
|
25 #include <stdio.h>
|
|
26 #include <stdlib.h>
|
|
27
|
|
28 #include "config.h"
|
|
29 #include "video_out.h"
|
|
30 #include "yuv2rgb.h"
|
|
31
|
|
32 #include <mlib_types.h>
|
|
33 #include <mlib_status.h>
|
|
34 #include <mlib_sys.h>
|
|
35 #include <mlib_video.h>
|
|
36
|
|
37 static void mlib_YUV2ARGB420_32(uint8_t* image, uint8_t* py,
|
|
38 uint8_t* pu, uint8_t* pv,
|
|
39 int h_size, int v_size,
|
|
40 int rgb_stride, int y_stride, int uv_stride)
|
|
41 {
|
|
42 mlib_VideoColorYUV2ARGB420(image, py, pu, pv, h_size,
|
|
43 v_size, rgb_stride, y_stride, uv_stride);
|
|
44 }
|
|
45
|
|
46 static void mlib_YUV2ABGR420_32(uint8_t* image, uint8_t* py,
|
|
47 uint8_t* pu, uint8_t* pv,
|
|
48 int h_size, int v_size,
|
|
49 int rgb_stride, int y_stride, int uv_stride)
|
|
50 {
|
|
51 mlib_VideoColorYUV2ABGR420(image, py, pu, pv, h_size,
|
|
52 v_size, rgb_stride, y_stride, uv_stride);
|
|
53 }
|
|
54
|
|
55 static void mlib_YUV2RGB420_24(uint8_t* image, uint8_t* py,
|
|
56 uint8_t* pu, uint8_t* pv,
|
|
57 int h_size, int v_size,
|
|
58 int rgb_stride, int y_stride, int uv_stride)
|
|
59 {
|
|
60 mlib_VideoColorYUV2RGB420(image, py, pu, pv, h_size,
|
|
61 v_size, rgb_stride, y_stride, uv_stride);
|
|
62 }
|
|
63
|
|
64
|
|
65 yuv2rgb_fun yuv2rgb_init_mlib(int bpp, int mode)
|
|
66 {
|
|
67
|
|
68 if( bpp == 24 )
|
|
69 {
|
|
70 if( mode == MODE_RGB )
|
|
71 return mlib_YUV2RGB420_24;
|
|
72 }
|
|
73
|
|
74 if( bpp == 32 )
|
|
75 {
|
|
76 if( mode == MODE_RGB )
|
|
77 return mlib_YUV2ARGB420_32;
|
|
78 else if( mode == MODE_BGR )
|
|
79 return mlib_YUV2ABGR420_32;
|
|
80 }
|
|
81
|
|
82 return NULL;
|
|
83 }
|
|
84
|