X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_chroma%2Fi420_rgb.c;h=1d56f9d5f1ce8e44ec03bd7dfbe6a8a7014b5e72;hb=e1a78b744b324b4dec1e8f5f2c41c95c5b00433a;hp=e92035040913fa7531a1f4b4363e431fe8fb70ad;hpb=5e4dc54cffa6708234ea25496e9704f2895a6f3a;p=vlc diff --git a/modules/video_chroma/i420_rgb.c b/modules/video_chroma/i420_rgb.c index e920350409..1d56f9d5f1 100644 --- a/modules/video_chroma/i420_rgb.c +++ b/modules/video_chroma/i420_rgb.c @@ -1,7 +1,7 @@ /***************************************************************************** * i420_rgb.c : YUV to bitmap RGB conversion module for vlc ***************************************************************************** - * Copyright (C) 2000, 2001, 2004 the VideoLAN team + * Copyright (C) 2000, 2001, 2004, 2008 the VideoLAN team * $Id$ * * Authors: Sam Hocevar @@ -25,11 +25,16 @@ /***************************************************************************** * Preamble *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include /* exp(), pow() */ -#include /* strerror() */ -#include /* malloc(), free() */ -#include +#include +#include +#include #include #include "i420_rgb.h" @@ -40,13 +45,13 @@ /***************************************************************************** * RGB2PIXEL: assemble RGB components to a pixel value, returns a uint32_t *****************************************************************************/ -#define RGB2PIXEL( p_vout, i_r, i_g, i_b ) \ - (((((uint32_t)i_r) >> p_vout->output.i_rrshift) \ - << p_vout->output.i_lrshift) \ - | ((((uint32_t)i_g) >> p_vout->output.i_rgshift) \ - << p_vout->output.i_lgshift) \ - | ((((uint32_t)i_b) >> p_vout->output.i_rbshift) \ - << p_vout->output.i_lbshift)) +#define RGB2PIXEL( p_filter, i_r, i_g, i_b ) \ + (((((uint32_t)i_r) >> p_filter->fmt_out.video.i_rrshift) \ + << p_filter->fmt_out.video.i_lrshift) \ + | ((((uint32_t)i_g) >> p_filter->fmt_out.video.i_rgshift) \ + << p_filter->fmt_out.video.i_lgshift) \ + | ((((uint32_t)i_b) >> p_filter->fmt_out.video.i_rbshift) \ + << p_filter->fmt_out.video.i_lbshift)) /***************************************************************************** * Local and extern prototypes. @@ -56,31 +61,31 @@ static void Deactivate ( vlc_object_t * ); #if defined (MODULE_NAME_IS_i420_rgb) static void SetGammaTable ( int *pi_table, double f_gamma ); -static void SetYUV ( vout_thread_t * ); -static void Set8bppPalette ( vout_thread_t *, uint8_t * ); +static void SetYUV ( filter_t * ); +static void Set8bppPalette ( filter_t *, uint8_t * ); #endif /***************************************************************************** * Module descriptor. *****************************************************************************/ -vlc_module_begin(); +vlc_module_begin () #if defined (MODULE_NAME_IS_i420_rgb) - set_description( _("I420,IYUV,YV12 to " - "RGB2,RV15,RV16,RV24,RV32 conversions") ); - set_capability( "chroma", 80 ); + set_description( N_("I420,IYUV,YV12 to " + "RGB2,RV15,RV16,RV24,RV32 conversions") ) + set_capability( "video filter2", 80 ) #elif defined (MODULE_NAME_IS_i420_rgb_mmx) - set_description( _( "MMX I420,IYUV,YV12 to " - "RV15,RV16,RV24,RV32 conversions") ); - set_capability( "chroma", 100 ); - add_requirement( MMX ); + set_description( N_( "MMX I420,IYUV,YV12 to " + "RV15,RV16,RV24,RV32 conversions") ) + set_capability( "video filter2", 100 ) + add_requirement( MMX ) #elif defined (MODULE_NAME_IS_i420_rgb_sse2) - set_description( _( "SSE2 I420,IYUV,YV12 to " - "RV15,RV16,RV24,RV32 conversions") ); - set_capability( "chroma", 120 ); - add_requirement( SSE2 ); + set_description( N_( "SSE2 I420,IYUV,YV12 to " + "RV15,RV16,RV24,RV32 conversions") ) + set_capability( "video filter2", 120 ) + add_requirement( SSE2 ) #endif - set_callbacks( Activate, Deactivate ); -vlc_module_end(); + set_callbacks( Activate, Deactivate ) +vlc_module_end () /***************************************************************************** * Activate: allocate a chroma function @@ -89,53 +94,54 @@ vlc_module_end(); *****************************************************************************/ static int Activate( vlc_object_t *p_this ) { - vout_thread_t *p_vout = (vout_thread_t *)p_this; + filter_t *p_filter = (filter_t *)p_this; #if defined (MODULE_NAME_IS_i420_rgb) size_t i_tables_size; #endif - if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 ) + if( p_filter->fmt_out.video.i_width & 1 + || p_filter->fmt_out.video.i_height & 1 ) { - return -1; + return VLC_EGENERIC; } - switch( p_vout->render.i_chroma ) + switch( p_filter->fmt_in.video.i_chroma ) { case VLC_FOURCC('Y','V','1','2'): case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','Y','U','V'): - switch( p_vout->output.i_chroma ) + switch( p_filter->fmt_out.video.i_chroma ) { #if defined (MODULE_NAME_IS_i420_rgb) case VLC_FOURCC('R','G','B','2'): - p_vout->chroma.pf_convert = E_(I420_RGB8); + p_filter->pf_video_filter = I420_RGB8_Filter; break; #endif case VLC_FOURCC('R','V','1','5'): case VLC_FOURCC('R','V','1','6'): #if ! defined (MODULE_NAME_IS_i420_rgb) /* If we don't have support for the bitmasks, bail out */ - if( ( p_vout->output.i_rmask == 0x7c00 - && p_vout->output.i_gmask == 0x03e0 - && p_vout->output.i_bmask == 0x001f ) ) + if( ( p_filter->fmt_out.video.i_rmask == 0x7c00 + && p_filter->fmt_out.video.i_gmask == 0x03e0 + && p_filter->fmt_out.video.i_bmask == 0x001f ) ) { /* R5G5B6 pixel format */ msg_Dbg(p_this, "RGB pixel format is R5G5B5"); - p_vout->chroma.pf_convert = E_(I420_R5G5B5); + p_filter->pf_video_filter = I420_R5G5B5_Filter; } - else if( ( p_vout->output.i_rmask == 0xf800 - && p_vout->output.i_gmask == 0x07e0 - && p_vout->output.i_bmask == 0x001f ) ) + else if( ( p_filter->fmt_out.video.i_rmask == 0xf800 + && p_filter->fmt_out.video.i_gmask == 0x07e0 + && p_filter->fmt_out.video.i_bmask == 0x001f ) ) { /* R5G6B5 pixel format */ msg_Dbg(p_this, "RGB pixel format is R5G6B5"); - p_vout->chroma.pf_convert = E_(I420_R5G6B5); + p_filter->pf_video_filter = I420_R5G6B5_Filter; } else - return -1; + return VLC_EGENERIC; #else // generic C chroma converter */ - p_vout->chroma.pf_convert = E_(I420_RGB16); + p_filter->pf_video_filter = I420_RGB16_Filter; #endif break; @@ -147,103 +153,103 @@ static int Activate( vlc_object_t *p_this ) case VLC_FOURCC('R','V','3','2'): #if ! defined (MODULE_NAME_IS_i420_rgb) /* If we don't have support for the bitmasks, bail out */ - if( p_vout->output.i_rmask == 0x00ff0000 - && p_vout->output.i_gmask == 0x0000ff00 - && p_vout->output.i_bmask == 0x000000ff ) + if( p_filter->fmt_out.video.i_rmask == 0x00ff0000 + && p_filter->fmt_out.video.i_gmask == 0x0000ff00 + && p_filter->fmt_out.video.i_bmask == 0x000000ff ) { /* A8R8G8B8 pixel format */ msg_Dbg(p_this, "RGB pixel format is A8R8G8B8"); - p_vout->chroma.pf_convert = E_(I420_A8R8G8B8); + p_filter->pf_video_filter = I420_A8R8G8B8_Filter; } - else if( p_vout->output.i_rmask == 0xff000000 - && p_vout->output.i_gmask == 0x00ff0000 - && p_vout->output.i_bmask == 0x0000ff00 ) + else if( p_filter->fmt_out.video.i_rmask == 0xff000000 + && p_filter->fmt_out.video.i_gmask == 0x00ff0000 + && p_filter->fmt_out.video.i_bmask == 0x0000ff00 ) { /* R8G8B8A8 pixel format */ msg_Dbg(p_this, "RGB pixel format is R8G8B8A8"); - p_vout->chroma.pf_convert = E_(I420_R8G8B8A8); + p_filter->pf_video_filter = I420_R8G8B8A8_Filter; } - else if( p_vout->output.i_rmask == 0x0000ff00 - && p_vout->output.i_gmask == 0x00ff0000 - && p_vout->output.i_bmask == 0xff000000 ) + else if( p_filter->fmt_out.video.i_rmask == 0x0000ff00 + && p_filter->fmt_out.video.i_gmask == 0x00ff0000 + && p_filter->fmt_out.video.i_bmask == 0xff000000 ) { /* B8G8R8A8 pixel format */ msg_Dbg(p_this, "RGB pixel format is B8G8R8A8"); - p_vout->chroma.pf_convert = E_(I420_B8G8R8A8); + p_filter->pf_video_filter = I420_B8G8R8A8_Filter; } - else if( p_vout->output.i_rmask == 0x000000ff - && p_vout->output.i_gmask == 0x0000ff00 - && p_vout->output.i_bmask == 0x00ff0000 ) + else if( p_filter->fmt_out.video.i_rmask == 0x000000ff + && p_filter->fmt_out.video.i_gmask == 0x0000ff00 + && p_filter->fmt_out.video.i_bmask == 0x00ff0000 ) { /* A8B8G8R8 pixel format */ msg_Dbg(p_this, "RGB pixel format is A8B8G8R8"); - p_vout->chroma.pf_convert = E_(I420_A8B8G8R8); + p_filter->pf_video_filter = I420_A8B8G8R8_Filter; } else - return -1; + return VLC_EGENERIC; #else /* generic C chroma converter */ - p_vout->chroma.pf_convert = E_(I420_RGB32); + p_filter->pf_video_filter = I420_RGB32_Filter; #endif break; default: - return -1; + return VLC_EGENERIC; } break; default: - return -1; + return VLC_EGENERIC; } - p_vout->chroma.p_sys = malloc( sizeof( chroma_sys_t ) ); - if( p_vout->chroma.p_sys == NULL ) + p_filter->p_sys = malloc( sizeof( filter_sys_t ) ); + if( p_filter->p_sys == NULL ) { - return -1; + return VLC_EGENERIC; } - switch( p_vout->output.i_chroma ) + switch( p_filter->fmt_out.video.i_chroma ) { #if defined (MODULE_NAME_IS_i420_rgb) case VLC_FOURCC('R','G','B','2'): - p_vout->chroma.p_sys->p_buffer = malloc( VOUT_MAX_WIDTH ); + p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH ); break; #endif case VLC_FOURCC('R','V','1','5'): case VLC_FOURCC('R','V','1','6'): - p_vout->chroma.p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 2 ); + p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 2 ); break; case VLC_FOURCC('R','V','2','4'): case VLC_FOURCC('R','V','3','2'): - p_vout->chroma.p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 4 ); + p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 4 ); break; default: - p_vout->chroma.p_sys->p_buffer = NULL; + p_filter->p_sys->p_buffer = NULL; break; } - if( p_vout->chroma.p_sys->p_buffer == NULL ) + if( p_filter->p_sys->p_buffer == NULL ) { - free( p_vout->chroma.p_sys ); - return -1; + free( p_filter->p_sys ); + return VLC_EGENERIC; } - p_vout->chroma.p_sys->p_offset = malloc( p_vout->output.i_width - * ( ( p_vout->output.i_chroma + p_filter->p_sys->p_offset = malloc( p_filter->fmt_out.video.i_width + * ( ( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('R','G','B','2') ) ? 2 : 1 ) * sizeof( int ) ); - if( p_vout->chroma.p_sys->p_offset == NULL ) + if( p_filter->p_sys->p_offset == NULL ) { - free( p_vout->chroma.p_sys->p_buffer ); - free( p_vout->chroma.p_sys ); - return -1; + free( p_filter->p_sys->p_buffer ); + free( p_filter->p_sys ); + return VLC_EGENERIC; } #if defined (MODULE_NAME_IS_i420_rgb) - switch( p_vout->output.i_chroma ) + switch( p_filter->fmt_out.video.i_chroma ) { case VLC_FOURCC('R','G','B','2'): i_tables_size = sizeof( uint8_t ) * PALETTE_TABLE_SIZE; @@ -257,16 +263,16 @@ static int Activate( vlc_object_t *p_this ) break; } - p_vout->chroma.p_sys->p_base = malloc( i_tables_size ); - if( p_vout->chroma.p_sys->p_base == NULL ) + p_filter->p_sys->p_base = malloc( i_tables_size ); + if( p_filter->p_sys->p_base == NULL ) { - free( p_vout->chroma.p_sys->p_offset ); - free( p_vout->chroma.p_sys->p_buffer ); - free( p_vout->chroma.p_sys ); + free( p_filter->p_sys->p_offset ); + free( p_filter->p_sys->p_buffer ); + free( p_filter->p_sys ); return -1; } - SetYUV( p_vout ); + SetYUV( p_filter ); #endif return 0; @@ -279,16 +285,29 @@ static int Activate( vlc_object_t *p_this ) *****************************************************************************/ static void Deactivate( vlc_object_t *p_this ) { - vout_thread_t *p_vout = (vout_thread_t *)p_this; + filter_t *p_filter = (filter_t *)p_this; #if defined (MODULE_NAME_IS_i420_rgb) - free( p_vout->chroma.p_sys->p_base ); + free( p_filter->p_sys->p_base ); #endif - free( p_vout->chroma.p_sys->p_offset ); - free( p_vout->chroma.p_sys->p_buffer ); - free( p_vout->chroma.p_sys ); + free( p_filter->p_sys->p_offset ); + free( p_filter->p_sys->p_buffer ); + free( p_filter->p_sys ); } +#if defined (MODULE_NAME_IS_i420_rgb) +VIDEO_FILTER_WRAPPER( I420_RGB8 ) +VIDEO_FILTER_WRAPPER( I420_RGB16 ) +VIDEO_FILTER_WRAPPER( I420_RGB32 ) +#else +VIDEO_FILTER_WRAPPER( I420_R5G5B5 ) +VIDEO_FILTER_WRAPPER( I420_R5G6B5 ) +VIDEO_FILTER_WRAPPER( I420_A8R8G8B8 ) +VIDEO_FILTER_WRAPPER( I420_R8G8B8A8 ) +VIDEO_FILTER_WRAPPER( I420_B8G8R8A8 ) +VIDEO_FILTER_WRAPPER( I420_A8B8G8R8 ) +#endif + #if defined (MODULE_NAME_IS_i420_rgb) /***************************************************************************** * SetGammaTable: return intensity table transformed by gamma curve. @@ -312,7 +331,7 @@ static void SetGammaTable( int *pi_table, double f_gamma ) /***************************************************************************** * SetYUV: compute tables and set function pointers *****************************************************************************/ -static void SetYUV( vout_thread_t *p_vout ) +static void SetYUV( filter_t *p_filter ) { int pi_gamma[256]; /* gamma table */ volatile int i_index; /* index in tables */ @@ -320,84 +339,84 @@ static void SetYUV( vout_thread_t *p_vout ) * optimization bug */ /* Build gamma table */ - SetGammaTable( pi_gamma, p_vout->f_gamma ); + SetGammaTable( pi_gamma, 0 ); //p_filter/*FIXME wasn't used anywhere anyway*/->f_gamma ); /* * Set pointers and build YUV tables */ /* Color: build red, green and blue tables */ - switch( p_vout->output.i_chroma ) + switch( p_filter->fmt_out.video.i_chroma ) { case VLC_FOURCC('R','G','B','2'): - p_vout->chroma.p_sys->p_rgb8 = (uint8_t *)p_vout->chroma.p_sys->p_base; - Set8bppPalette( p_vout, p_vout->chroma.p_sys->p_rgb8 ); + p_filter->p_sys->p_rgb8 = (uint8_t *)p_filter->p_sys->p_base; + Set8bppPalette( p_filter, p_filter->p_sys->p_rgb8 ); break; case VLC_FOURCC('R','V','1','5'): case VLC_FOURCC('R','V','1','6'): - p_vout->chroma.p_sys->p_rgb16 = (uint16_t *)p_vout->chroma.p_sys->p_base; + p_filter->p_sys->p_rgb16 = (uint16_t *)p_filter->p_sys->p_base; for( i_index = 0; i_index < RED_MARGIN; i_index++ ) { - p_vout->chroma.p_sys->p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 ); - p_vout->chroma.p_sys->p_rgb16[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 ); + p_filter->p_sys->p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_filter, pi_gamma[0], 0, 0 ); + p_filter->p_sys->p_rgb16[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_filter, pi_gamma[255], 0, 0 ); } for( i_index = 0; i_index < GREEN_MARGIN; i_index++ ) { - p_vout->chroma.p_sys->p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 ); - p_vout->chroma.p_sys->p_rgb16[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 ); + p_filter->p_sys->p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[0], 0 ); + p_filter->p_sys->p_rgb16[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[255], 0 ); } for( i_index = 0; i_index < BLUE_MARGIN; i_index++ ) { - p_vout->chroma.p_sys->p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] ); - p_vout->chroma.p_sys->p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] ); + p_filter->p_sys->p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[0] ); + p_filter->p_sys->p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[255] ); } for( i_index = 0; i_index < 256; i_index++ ) { - p_vout->chroma.p_sys->p_rgb16[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 ); - p_vout->chroma.p_sys->p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 ); - p_vout->chroma.p_sys->p_rgb16[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] ); + p_filter->p_sys->p_rgb16[RED_OFFSET + i_index] = RGB2PIXEL( p_filter, pi_gamma[ i_index ], 0, 0 ); + p_filter->p_sys->p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[ i_index ], 0 ); + p_filter->p_sys->p_rgb16[BLUE_OFFSET + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[ i_index ] ); } break; case VLC_FOURCC('R','V','2','4'): case VLC_FOURCC('R','V','3','2'): - p_vout->chroma.p_sys->p_rgb32 = (uint32_t *)p_vout->chroma.p_sys->p_base; + p_filter->p_sys->p_rgb32 = (uint32_t *)p_filter->p_sys->p_base; for( i_index = 0; i_index < RED_MARGIN; i_index++ ) { - p_vout->chroma.p_sys->p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 ); - p_vout->chroma.p_sys->p_rgb32[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 ); + p_filter->p_sys->p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_filter, pi_gamma[0], 0, 0 ); + p_filter->p_sys->p_rgb32[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_filter, pi_gamma[255], 0, 0 ); } for( i_index = 0; i_index < GREEN_MARGIN; i_index++ ) { - p_vout->chroma.p_sys->p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 ); - p_vout->chroma.p_sys->p_rgb32[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 ); + p_filter->p_sys->p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[0], 0 ); + p_filter->p_sys->p_rgb32[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[255], 0 ); } for( i_index = 0; i_index < BLUE_MARGIN; i_index++ ) { - p_vout->chroma.p_sys->p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] ); - p_vout->chroma.p_sys->p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] ); + p_filter->p_sys->p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[0] ); + p_filter->p_sys->p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[255] ); } for( i_index = 0; i_index < 256; i_index++ ) { - p_vout->chroma.p_sys->p_rgb32[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 ); - p_vout->chroma.p_sys->p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 ); - p_vout->chroma.p_sys->p_rgb32[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] ); + p_filter->p_sys->p_rgb32[RED_OFFSET + i_index] = RGB2PIXEL( p_filter, pi_gamma[ i_index ], 0, 0 ); + p_filter->p_sys->p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[ i_index ], 0 ); + p_filter->p_sys->p_rgb32[BLUE_OFFSET + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[ i_index ] ); } break; } } -static void Set8bppPalette( vout_thread_t *p_vout, uint8_t *p_rgb8 ) +static void Set8bppPalette( filter_t *p_filter, uint8_t *p_rgb8 ) { #define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 ) int y,u,v; int r,g,b; int i = 0, j = 0; - uint16_t *p_cmap_r=p_vout->chroma.p_sys->p_rgb_r; - uint16_t *p_cmap_g=p_vout->chroma.p_sys->p_rgb_g; - uint16_t *p_cmap_b=p_vout->chroma.p_sys->p_rgb_b; + uint16_t *p_cmap_r = p_filter->p_sys->p_rgb_r; + uint16_t *p_cmap_g = p_filter->p_sys->p_rgb_g; + uint16_t *p_cmap_b = p_filter->p_sys->p_rgb_b; unsigned char p_lookup[PALETTE_TABLE_SIZE]; @@ -420,7 +439,7 @@ static void Set8bppPalette( vout_thread_t *p_vout, uint8_t *p_rgb8 ) * fscked up my code */ if( j == 256 ) { - msg_Err( p_vout, "no colors left in palette" ); + msg_Err( p_filter, "no colors left in palette" ); break; } @@ -430,9 +449,9 @@ static void Set8bppPalette( vout_thread_t *p_vout, uint8_t *p_rgb8 ) p_cmap_b[ j ] = CLIP( b ); #if 0 - printf("+++Alloc RGB cmap %d (%d, %d, %d)\n", j, - p_cmap_r[ j ] >>8, p_cmap_g[ j ] >>8, - p_cmap_b[ j ] >>8); + printf("+++Alloc RGB cmap %d (%d, %d, %d)\n", j, + p_cmap_r[ j ] >>8, p_cmap_g[ j ] >>8, + p_cmap_b[ j ] >>8); #endif /* Allocate color */ @@ -450,7 +469,8 @@ static void Set8bppPalette( vout_thread_t *p_vout, uint8_t *p_rgb8 ) } /* The colors have been allocated, we can set the palette */ - p_vout->output.pf_setpalette( p_vout, p_cmap_r, p_cmap_g, p_cmap_b ); + /* FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME + p_filter->fmt_out.video.pf_setpalette( p_filter, p_cmap_r, p_cmap_g, p_cmap_b );*/ #if 0 /* There will eventually be a way to know which colors