1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*****************************************************************************
* video_yuv.c: YUV transformation functions
* These functions set up YUV tables for colorspace conversion
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <math.h> /* exp(), pow() */
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "video.h"
#include "video_output.h"
#include "video_yuv.h"
#include "intf_msg.h"
#include "main.h"
/*****************************************************************************
* vout_InitYUV: allocate and initialize translations tables
*****************************************************************************
* This function will allocate memory to store translation tables, depending
* of the screen depth.
*****************************************************************************/
int vout_InitYUV( vout_thread_t *p_vout )
{
typedef void ( yuv_getplugin_t ) ( vout_thread_t * p_vout );
int i_index;
/* Get a suitable YUV plugin */
for( i_index = 0 ; i_index < p_main->p_bank->i_plugin_count ; i_index++ )
{
/* If there's a plugin in p_info ... */
if( p_main->p_bank->p_info[ i_index ] != NULL )
{
/* ... and if this plugin provides the functions we want ... */
if( p_main->p_bank->p_info[ i_index ]->yuv_GetPlugin != NULL )
{
/* ... then get these functions */
( (yuv_getplugin_t *)
p_main->p_bank->p_info[ i_index ]->yuv_GetPlugin )( p_vout );
}
}
}
return p_vout->p_yuv_init( p_vout );
}
/*****************************************************************************
* vout_ResetYUV: re-initialize translations tables
*****************************************************************************
* This function will initialize the tables allocated by vout_InitYUV and
* set functions pointers.
*****************************************************************************/
int vout_ResetYUV( vout_thread_t *p_vout )
{
p_vout->p_yuv_end( p_vout );
return( p_vout->p_yuv_init( p_vout ) );
}
/*****************************************************************************
* vout_EndYUV: destroy translations tables
*****************************************************************************
* Free memory allocated by vout_InitYUV
*****************************************************************************/
void vout_EndYUV( vout_thread_t *p_vout )
{
p_vout->p_yuv_end( p_vout );
}