1
|
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, const uint8_t* py,
|
|
38 const uint8_t* pu, const uint8_t* pv,
|
|
39 const uint32_t h_size, const uint32_t v_size,
|
|
40 const uint32_t rgb_stride, const uint32_t y_stride,
|
|
41 const uint32_t uv_stride)
|
|
42 {
|
|
43 mlib_VideoColorYUV2ARGB420(image, py, pu, pv, h_size,
|
|
44 v_size, rgb_stride, y_stride, uv_stride);
|
|
45 }
|
|
46
|
|
47 static void mlib_YUV2ABGR420_32(uint8_t* image, const uint8_t* py,
|
|
48 const uint8_t* pu, const uint8_t* pv,
|
|
49 const uint32_t h_size, const uint32_t v_size,
|
|
50 const uint32_t rgb_stride, const uint32_t y_stride,
|
|
51 const uint32_t uv_stride)
|
|
52 {
|
|
53 mlib_VideoColorYUV2ABGR420(image, py, pu, pv, h_size,
|
|
54 v_size, rgb_stride, y_stride, uv_stride);
|
|
55 }
|
|
56
|
|
57 static void mlib_YUV2RGB420_24(uint8_t* image, const uint8_t* py,
|
|
58 const uint8_t* pu, const uint8_t* pv,
|
|
59 const uint32_t h_size, const uint32_t v_size,
|
|
60 const uint32_t rgb_stride, const uint32_t y_stride,
|
|
61 const uint32_t uv_stride)
|
|
62 {
|
|
63 mlib_VideoColorYUV2RGB420(image, py, pu, pv, h_size,
|
|
64 v_size, rgb_stride, y_stride, uv_stride);
|
|
65 }
|
|
66
|
|
67
|
|
68 yuv2rgb_fun yuv2rgb_init_mlib(int bpp, int mode)
|
|
69 {
|
|
70
|
|
71 if( bpp == 24 )
|
|
72 {
|
|
73 if( mode == MODE_RGB )
|
|
74 return mlib_YUV2RGB420_24;
|
|
75 }
|
|
76
|
|
77 if( bpp == 32 )
|
|
78 {
|
|
79 if( mode == MODE_RGB )
|
|
80 return mlib_YUV2ARGB420_32;
|
|
81 else if( mode == MODE_BGR )
|
|
82 return mlib_YUV2ABGR420_32;
|
|
83 }
|
|
84
|
|
85 return NULL;
|
|
86 }
|
|
87
|