~ubuntu-branches/ubuntu/natty/vlc/natty

« back to all changes in this revision

Viewing changes to modules/video_chroma/i420_rgb.c

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-06-25 01:09:16 UTC
  • mfrom: (1.1.30 upstream)
  • Revision ID: james.westby@ubuntu.com-20100625010916-asxhep2mutg6g6pd
Tags: 1.1.0-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - build and install the libx264 plugin
  - add Xb-Npp header to vlc package
  - Add apport hook to include more vlc dependencies in bug reports
* Drop xulrunner patches.
* Drop 502_xulrunner_191.diff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * i420_rgb.c : YUV to bitmap RGB conversion module for vlc
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2000, 2001, 2004, 2008 the VideoLAN team
5
 
 * $Id: 1d56f9d5f1ce8e44ec03bd7dfbe6a8a7014b5e72 $
 
5
 * $Id: cfaeb734a5679c1d6f0d73cf46406ef2f7004415 $
6
6
 *
7
7
 * Authors: Sam Hocevar <sam@zoy.org>
8
8
 *          Damien Fouilleul <damienf@videolan.org>
35
35
#include <vlc_common.h>
36
36
#include <vlc_plugin.h>
37
37
#include <vlc_filter.h>
38
 
#include <vlc_vout.h>
39
38
 
40
39
#include "i420_rgb.h"
41
40
#if defined (MODULE_NAME_IS_i420_rgb)
42
41
#   include "i420_rgb_c.h"
 
42
    static picture_t *I420_RGB8_Filter         ( filter_t *, picture_t * );
 
43
//    static picture_t *I420_RGB16_dither_Filter ( filter_t *, picture_t * );
 
44
    static picture_t *I420_RGB16_Filter        ( filter_t *, picture_t * );
 
45
    static picture_t *I420_RGB32_Filter        ( filter_t *, picture_t * );
 
46
#else
 
47
    static picture_t *I420_R5G5B5_Filter       ( filter_t *, picture_t * );
 
48
    static picture_t *I420_R5G6B5_Filter       ( filter_t *, picture_t * );
 
49
    static picture_t *I420_A8R8G8B8_Filter     ( filter_t *, picture_t * );
 
50
    static picture_t *I420_R8G8B8A8_Filter     ( filter_t *, picture_t * );
 
51
    static picture_t *I420_B8G8R8A8_Filter     ( filter_t *, picture_t * );
 
52
    static picture_t *I420_A8B8G8R8_Filter     ( filter_t *, picture_t * );
43
53
#endif
44
54
 
45
55
/*****************************************************************************
77
87
    set_description( N_( "MMX I420,IYUV,YV12 to "
78
88
                        "RV15,RV16,RV24,RV32 conversions") )
79
89
    set_capability( "video filter2", 100 )
80
 
    add_requirement( MMX )
81
90
#elif defined (MODULE_NAME_IS_i420_rgb_sse2)
82
91
    set_description( N_( "SSE2 I420,IYUV,YV12 to "
83
92
                        "RV15,RV16,RV24,RV32 conversions") )
84
93
    set_capability( "video filter2", 120 )
85
 
    add_requirement( SSE2 )
86
94
#endif
87
95
    set_callbacks( Activate, Deactivate )
88
96
vlc_module_end ()
107
115
 
108
116
    switch( p_filter->fmt_in.video.i_chroma )
109
117
    {
110
 
        case VLC_FOURCC('Y','V','1','2'):
111
 
        case VLC_FOURCC('I','4','2','0'):
112
 
        case VLC_FOURCC('I','Y','U','V'):
 
118
        case VLC_CODEC_YV12:
 
119
        case VLC_CODEC_I420:
113
120
            switch( p_filter->fmt_out.video.i_chroma )
114
121
            {
115
122
#if defined (MODULE_NAME_IS_i420_rgb)
116
 
                case VLC_FOURCC('R','G','B','2'):
 
123
                case VLC_CODEC_RGB8:
117
124
                    p_filter->pf_video_filter = I420_RGB8_Filter;
118
125
                    break;
119
126
#endif
120
 
                case VLC_FOURCC('R','V','1','5'):
121
 
                case VLC_FOURCC('R','V','1','6'):
 
127
                case VLC_CODEC_RGB15:
 
128
                case VLC_CODEC_RGB16:
122
129
#if ! defined (MODULE_NAME_IS_i420_rgb)
123
130
                    /* If we don't have support for the bitmasks, bail out */
124
131
                    if( ( p_filter->fmt_out.video.i_rmask == 0x7c00
147
154
 
148
155
#if 0
149
156
                /* Hmmm, is there only X11 using 32bits per pixel for RV24 ? */
150
 
                case VLC_FOURCC('R','V','2','4'):
 
157
                case VLC_CODEC_RGB24:
151
158
#endif
152
159
 
153
 
                case VLC_FOURCC('R','V','3','2'):
 
160
                case VLC_CODEC_RGB32:
154
161
#if ! defined (MODULE_NAME_IS_i420_rgb)
155
162
                    /* If we don't have support for the bitmasks, bail out */
156
163
                    if( p_filter->fmt_out.video.i_rmask == 0x00ff0000
211
218
    switch( p_filter->fmt_out.video.i_chroma )
212
219
    {
213
220
#if defined (MODULE_NAME_IS_i420_rgb)
214
 
        case VLC_FOURCC('R','G','B','2'):
 
221
        case VLC_CODEC_RGB8:
215
222
            p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH );
216
223
            break;
217
224
#endif
218
225
 
219
 
        case VLC_FOURCC('R','V','1','5'):
220
 
        case VLC_FOURCC('R','V','1','6'):
 
226
        case VLC_CODEC_RGB15:
 
227
        case VLC_CODEC_RGB16:
221
228
            p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 2 );
222
229
            break;
223
230
 
224
 
        case VLC_FOURCC('R','V','2','4'):
225
 
        case VLC_FOURCC('R','V','3','2'):
 
231
        case VLC_CODEC_RGB24:
 
232
        case VLC_CODEC_RGB32:
226
233
            p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 4 );
227
234
            break;
228
235
 
239
246
 
240
247
    p_filter->p_sys->p_offset = malloc( p_filter->fmt_out.video.i_width
241
248
                    * ( ( p_filter->fmt_out.video.i_chroma
242
 
                           == VLC_FOURCC('R','G','B','2') ) ? 2 : 1 )
 
249
                           == VLC_CODEC_RGB8 ) ? 2 : 1 )
243
250
                    * sizeof( int ) );
244
251
    if( p_filter->p_sys->p_offset == NULL )
245
252
    {
251
258
#if defined (MODULE_NAME_IS_i420_rgb)
252
259
    switch( p_filter->fmt_out.video.i_chroma )
253
260
    {
254
 
    case VLC_FOURCC('R','G','B','2'):
 
261
    case VLC_CODEC_RGB8:
255
262
        i_tables_size = sizeof( uint8_t ) * PALETTE_TABLE_SIZE;
256
263
        break;
257
 
    case VLC_FOURCC('R','V','1','5'):
258
 
    case VLC_FOURCC('R','V','1','6'):
 
264
    case VLC_CODEC_RGB15:
 
265
    case VLC_CODEC_RGB16:
259
266
        i_tables_size = sizeof( uint16_t ) * RGB_TABLE_SIZE;
260
267
        break;
261
268
    default: /* RV24, RV32 */
298
305
#if defined (MODULE_NAME_IS_i420_rgb)
299
306
VIDEO_FILTER_WRAPPER( I420_RGB8 )
300
307
VIDEO_FILTER_WRAPPER( I420_RGB16 )
 
308
//VIDEO_FILTER_WRAPPER( I420_RGB16_dither )
301
309
VIDEO_FILTER_WRAPPER( I420_RGB32 )
302
310
#else
303
311
VIDEO_FILTER_WRAPPER( I420_R5G5B5 )
348
356
    /* Color: build red, green and blue tables */
349
357
    switch( p_filter->fmt_out.video.i_chroma )
350
358
    {
351
 
    case VLC_FOURCC('R','G','B','2'):
 
359
    case VLC_CODEC_RGB8:
352
360
        p_filter->p_sys->p_rgb8 = (uint8_t *)p_filter->p_sys->p_base;
353
361
        Set8bppPalette( p_filter, p_filter->p_sys->p_rgb8 );
354
362
        break;
355
363
 
356
 
    case VLC_FOURCC('R','V','1','5'):
357
 
    case VLC_FOURCC('R','V','1','6'):
 
364
    case VLC_CODEC_RGB15:
 
365
    case VLC_CODEC_RGB16:
358
366
        p_filter->p_sys->p_rgb16 = (uint16_t *)p_filter->p_sys->p_base;
359
367
        for( i_index = 0; i_index < RED_MARGIN; i_index++ )
360
368
        {
379
387
        }
380
388
        break;
381
389
 
382
 
    case VLC_FOURCC('R','V','2','4'):
383
 
    case VLC_FOURCC('R','V','3','2'):
 
390
    case VLC_CODEC_RGB24:
 
391
    case VLC_CODEC_RGB32:
384
392
        p_filter->p_sys->p_rgb32 = (uint32_t *)p_filter->p_sys->p_base;
385
393
        for( i_index = 0; i_index < RED_MARGIN; i_index++ )
386
394
        {