1 /*****************************************************************************
2 * video_yuv.c: YUV transformation functions
3 * These functions set up YUV tables for colorspace conversion
4 *****************************************************************************
5 * Copyright (C) 1999, 2000 VideoLAN
6 * $Id: video_yuv.c,v 1.47 2001/03/21 13:42:35 sam Exp $
8 * Authors: Vincent Seguin <seguin@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public
21 * License along with this program; if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 02111-1307, USA.
24 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
31 #include <math.h> /* exp(), pow() */
32 #include <errno.h> /* ENOMEM */
33 #include <stdlib.h> /* free() */
34 #include <string.h> /* strerror() */
43 #include "video_output.h"
44 #include "video_yuv.h"
50 /*****************************************************************************
51 * vout_InitYUV: allocate and initialize translation tables
52 *****************************************************************************
53 * This function will allocate memory to store translation tables, depending
54 * on the screen depth.
55 *****************************************************************************/
56 int vout_InitYUV( vout_thread_t *p_vout )
58 /* Choose the best module */
59 p_vout->yuv.p_module = module_Need( p_main->p_bank,
60 MODULE_CAPABILITY_YUV, NULL );
62 if( p_vout->yuv.p_module == NULL )
64 intf_ErrMsg( "vout error: no suitable yuv module" );
68 #define yuv_functions p_vout->yuv.p_module->p_functions->yuv.functions.yuv
69 p_vout->yuv.pf_init = yuv_functions.pf_init;
70 p_vout->yuv.pf_reset = yuv_functions.pf_reset;
71 p_vout->yuv.pf_end = yuv_functions.pf_end;
74 return( p_vout->yuv.pf_init( p_vout ) );
77 /*****************************************************************************
78 * vout_ResetYUV: re-initialize translation tables
79 *****************************************************************************
80 * This function will initialize the tables allocated by vout_InitYUV and
81 * set functions pointers.
82 *****************************************************************************/
83 int vout_ResetYUV( vout_thread_t *p_vout )
85 p_vout->yuv.pf_end( p_vout );
86 return( p_vout->yuv.pf_init( p_vout ) );
89 /*****************************************************************************
90 * vout_EndYUV: destroy translation tables
91 *****************************************************************************
92 * Free memory allocated by vout_InitYUV
93 *****************************************************************************/
94 void vout_EndYUV( vout_thread_t *p_vout )
96 p_vout->yuv.pf_end( p_vout );
97 module_Unneed( p_main->p_bank, p_vout->yuv.p_module );