1 /*
2  * yuv2rgb_private.h
3  *
4  * Copyright (C) 2001-2018 the xine project
5  * This file is part of xine, a free video player.
6  *
7  * based on work from mpeg2dec:
8  * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
9  *
10  * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
11  *
12  * mpeg2dec is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * mpeg2dec is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
25  */
26 
27 #ifndef YUV2RGB_PRIVATE_H
28 #define YUV2RGB_PRIVATE_H
29 
30 #include <inttypes.h>
31 
32 #ifdef HAVE_MLIB
33 #include <mlib_video.h>
34 #endif
35 
36 #include "yuv2rgb.h"
37 
38 typedef struct yuv2rgb_impl_s yuv2rgb_impl_t;
39 typedef struct yuv2rgb_factory_impl_s yuv2rgb_factory_impl_t;
40 
41 typedef void (*scale_line_func_t) (const uint8_t *restrict source,
42                                    uint8_t       *restrict dest,
43                                    int width, int step);
44 
45 struct yuv2rgb_impl_s {
46 
47   yuv2rgb_t         intf;
48 
49   int               source_width, source_height;
50   int               y_stride, uv_stride;
51   int               dest_width, dest_height;
52   int               rgb_stride;
53   int               slice_height, slice_offset;
54   int               step_dx, step_dy;
55   int               do_scale, swapped;
56 
57   uint8_t          *y_buffer;
58   uint8_t          *u_buffer;
59   uint8_t          *v_buffer;
60 
61   void * const     *table_rV;
62   void * const     *table_gU;
63   const int        *table_gV;
64   void * const     *table_bU;
65   const void       *table_mmx;
66 
67   const uint8_t    *cmap;
68   scale_line_func_t scale_line;
69 
70 #ifdef HAVE_MLIB
71   uint8_t          *mlib_buffer;
72   uint8_t          *mlib_resize_buffer;
73   mlib_filter      mlib_filter_type;
74 #endif
75 };
76 
77 struct yuv2rgb_factory_impl_s {
78 
79   yuv2rgb_factory_t intf;
80 
81   int      mode;
82   int      swapped;
83   const uint8_t *cmap;
84 
85   void    *table_base;
86   void    *table_rV[256];
87   void    *table_gU[256];
88   int      table_gV[256];
89   void    *table_bU[256];
90   void    *table_mmx;
91 
92   /* preselected functions for mode/swap/hardware */
93   yuv2rgb_fun_t               yuv2rgb_fun;
94   yuy22rgb_fun_t              yuy22rgb_fun;
95   yuv2rgb_single_pixel_fun_t  yuv2rgb_single_pixel_fun;
96 };
97 
98 void mmx_yuv2rgb_set_csc_levels(yuv2rgb_factory_t *this,
99                                 int brightness, int contrast, int saturation,
100                                 int colormatrix);
101 void yuv2rgb_init_mmxext (yuv2rgb_factory_impl_t *this);
102 void yuv2rgb_init_mmx (yuv2rgb_factory_impl_t *this);
103 void yuv2rgb_init_mlib (yuv2rgb_factory_impl_t *this);
104 
105 
106 #endif /* YUV2RGB_PRIVATE_H */
107