Commit 9ac8c0ec authored by Pierre Baillet's avatar Pierre Baillet

A few new things:

	. The interface part:
			. created intf_AssignKey, intf_getKey and intf_AssignNormalKeys
			these new function are a first abstraction of the the key handling system.			It makes use of a new structure in the interface : p_keys.

			. AssignNormalKeys is commonly used in all the interface plugins.
			AssignKey is used to allow the SDL interface to react nicely.

			. Now the plugin struct element psz_filename is filled (and freed
				at the end of the program).

	. the SDL plugin:
			works but does only display a green screen for now. so don't use it !

	. Please try and compile the client on your box with this version.
		I've tried a few output plugin but not all.
parent c45d7219
......@@ -29,7 +29,7 @@ prefix=@prefix@
PROGRAM_OPTIONS = $(SYS) $(ARCH)
ifeq ($(DEBUG),1)
PROGRAM_OPTIONS += DEBUG
DEFINE += -DDEBUG
DEFINE += -DDEBUG -g
endif
# PROGRAM_BUILD is a complete identification of the build
......@@ -293,7 +293,10 @@ PLUGIN_GGI = plugins/ggi/ggi.o \
PLUGIN_SDL = plugins/sdl/sdl.o \
plugins/sdl/intf_sdl.o \
plugins/sdl/vout_sdl.o
plugins/sdl/vout_sdl.o \
plugins/sdl/video_yuv.o \
plugins/sdl/video_yuvall.o
PLUGIN_GLIDE = plugins/glide/glide.o \
plugins/glide/intf_glide.o \
......@@ -322,6 +325,7 @@ PLUGIN_YUV = plugins/yuv/yuv.o \
plugins/yuv/video_yuv24.o \
plugins/yuv/video_yuv32.o
PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
plugins/yuvmmx/video_yuv.o \
plugins/yuvmmx/video_yuv8.o \
......@@ -512,7 +516,7 @@ else
ld -shared -o $@ $^
endif
$(PLUGIN_YUV): %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
lib/yuvmmx.so: $(PLUGIN_YUVMMX)
ifeq ($(SYS),beos)
......
......@@ -26,7 +26,7 @@ ac_help="$ac_help
ac_help="$ac_help
--enable-ggi GGI support (default disabled)"
ac_help="$ac_help
--enable-sdl SDL support (default disabled)"
--enable-sdl SDL support (default disabled)"
ac_help="$ac_help
--enable-glide Glide (3dfx) support (default disabled)"
ac_help="$ac_help
......
......@@ -94,7 +94,7 @@ AC_ARG_ENABLE(ggi,
[ --enable-ggi GGI support (default disabled)],
[if test x$enable_ggi = xyes; then PLUGINS=${PLUGINS}"ggi "; fi])
AC_ARG_ENABLE(sdl,
[ --enable-sdl SDL support (default disabled)],
[ --enable-sdl SDL support (default disabled)],
[if test x$enable_sdl = xyes; then PLUGINS=${PLUGINS}"sdl "; fi])
AC_ARG_ENABLE(glide,
[ --enable-glide Glide (3dfx) support (default disabled)],
......
......@@ -48,6 +48,15 @@ typedef int ( intf_sys_create_t ) ( p_intf_thread_t p_intf );
typedef void ( intf_sys_destroy_t ) ( p_intf_thread_t p_intf );
typedef void ( intf_sys_manage_t ) ( p_intf_thread_t p_intf );
typedef struct _key
{
int received_key;
int forwarded_key;
struct _key * next;
} intf_key;
typedef intf_key * p_intf_key;
typedef struct intf_thread_s
{
boolean_t b_die; /* `die' flag */
......@@ -55,7 +64,8 @@ typedef struct intf_thread_s
/* Specific interfaces */
p_intf_console_t p_console; /* console */
p_intf_sys_t p_sys; /* system interface */
p_intf_key p_keys;
/* Plugin */
intf_sys_create_t * p_sys_create; /* create interface thread */
intf_sys_manage_t * p_sys_manage; /* main loop */
......@@ -83,3 +93,9 @@ void intf_Destroy ( intf_thread_t * p_intf );
int intf_SelectChannel ( intf_thread_t * p_intf, int i_channel );
int intf_ProcessKey ( intf_thread_t * p_intf, int i_key );
void intf_AssignKey( intf_thread_t *p_intf, int r_key, int f_key);
int intf_getKey( intf_thread_t *p_intf, int r_key);
void intf_AssignNormalKeys( intf_thread_t *p_intf);
......@@ -158,6 +158,11 @@ int intf_BeCreate( intf_thread_t *p_intf )
return( 1 );
}
}
/* Bind normal keys. */
intf_AssignNormalKeys( p_intf );
return( 0 );
}
......
......@@ -189,7 +189,10 @@ int intf_FBCreate( intf_thread_t *p_intf )
return( 1 );
}
}
/* bind keys */
intf_AssignNormalKeys( p_intf );
return( 0 );
}
......
......@@ -106,7 +106,11 @@ int intf_GGICreate( intf_thread_t *p_intf )
free( p_intf->p_sys );
return( 1 );
}
/* Assign basic keys */
intf_AssignNormalKeys( p_intf );
return( 0 );
}
......
......@@ -75,6 +75,10 @@ int intf_GlideCreate( intf_thread_t *p_intf )
return( 1 );
}
}
/* bind keys */
intf_AssignNormalKeys( p_intf );
return( 0 );
}
......
......@@ -136,6 +136,10 @@ int intf_GnomeCreate( intf_thread_t *p_intf )
vlc_thread_create( &p_intf->p_sys->p_gnome->thread_id, "gnome",
(void *)GnomeThread, p_intf->p_sys->p_gnome );
/* create basic key bindings */
intf_AssignNormalKeys( p_intf );
/* Disable screen saver and return */
p_intf->p_sys->i_ss_count = 1;
GnomeDisableScreenSaver( p_intf );
......
......@@ -142,7 +142,11 @@ int intf_MGACreate( intf_thread_t *p_intf )
}
p_intf->p_sys->b_mouse = 1;
/* bind keys */
intf_AssignNormalKeys( p_intf );
/* Disable screen saver and return */
p_intf->p_sys->i_ss_count = 1;
X11DisableScreenSaver( p_intf );
......
......@@ -57,6 +57,9 @@ typedef struct intf_sys_s
} intf_sys_t;
/* local prototype */
void intf_SDL_Keymap( intf_thread_t * p_intf );
/*****************************************************************************
* intf_SDLCreate: initialize and create SDL interface
......@@ -94,7 +97,7 @@ int intf_SDLCreate( intf_thread_t *p_intf )
free( p_intf->p_sys );
return( 1 );
}
intf_SDL_Keymap( p_intf );
return( 0 );
}
......@@ -131,11 +134,14 @@ void intf_SDLManage( intf_thread_t *p_intf )
SDL_Event event; /* SDL event */
Uint8 i_key;
while ( SDL_PollEvent(&event) ) {
while ( SDL_PollEvent(&event) )
{
i_key = event.key.keysym.sym; /* forward it */
intf_ErrMsgImm("key :%c:\n",(char) i_key);
switch (event.type) {
case SDL_KEYDOWN: /* if a key is pressed */
i_key = event.key.keysym.sym; /* forward it */
if( intf_ProcessKey( p_intf, (char ) i_key ) )
{
intf_DbgMsg( "unhandled key '%c' (%i)\n",
......@@ -151,3 +157,30 @@ void intf_SDLManage( intf_thread_t *p_intf )
}
}
void intf_SDL_Keymap(intf_thread_t * p_intf )
{
intf_AssignKey(p_intf, SDLK_q, 'Q');
intf_AssignKey(p_intf, SDLK_ESCAPE, 'Q');
/* intf_AssignKey(p_intf,3,'Q'); */
intf_AssignKey(p_intf, SDLK_0, '0');
intf_AssignKey(p_intf, SDLK_1, '1');
intf_AssignKey(p_intf, SDLK_2, '2');
intf_AssignKey(p_intf, SDLK_3, '3');
intf_AssignKey(p_intf, SDLK_4, '4');
intf_AssignKey(p_intf, SDLK_5, '5');
intf_AssignKey(p_intf, SDLK_6, '6');
intf_AssignKey(p_intf, SDLK_7, '7');
intf_AssignKey(p_intf, SDLK_8, '8');
intf_AssignKey(p_intf, SDLK_9, '9');
intf_AssignKey(p_intf, SDLK_PLUS, '+');
intf_AssignKey(p_intf, SDLK_MINUS, '-');
intf_AssignKey(p_intf, SDLK_m, 'M');
/* intf_AssignKey(p_intf,'M','M'); */
intf_AssignKey(p_intf, SDLK_g, 'g');
/* intf_AssignKey(p_intf,'G','G'); */
intf_AssignKey(p_intf, SDLK_c, 'c');
intf_AssignKey(p_intf, SDLK_SPACE, ' ');
intf_AssignKey(p_intf, 'i', 'i');
intf_AssignKey(p_intf, SDLK_s, 's');
}
......@@ -4,7 +4,9 @@
* Copyright (C) 2000 VideoLAN
*
* Authors:
*
* . Initial plugin code by Samuel Hocevar <sam@via.ecp.fr>
* . Modified to use the SDL by Pierre Baillet <octplane@via.ecp.fr>
*
* 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
......@@ -44,6 +46,7 @@
*****************************************************************************/
static void vout_GetPlugin( p_vout_thread_t p_vout );
static void intf_GetPlugin( p_intf_thread_t p_intf );
static void yuv_GetPlugin( p_vout_thread_t p_vout );
/* Video output */
int vout_SDLCreate ( vout_thread_t *p_vout, char *psz_display,
......@@ -56,6 +59,13 @@ void vout_SDLDisplay ( p_vout_thread_t p_vout );
void vout_SDLSetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/* YUV transformations */
int yuv_CInit ( p_vout_thread_t p_vout );
int yuv_CReset ( p_vout_thread_t p_vout );
void yuv_CEnd ( p_vout_thread_t p_vout );
/* Interface */
int intf_SDLCreate ( p_intf_thread_t p_intf );
void intf_SDLDestroy ( p_intf_thread_t p_intf );
......@@ -68,19 +78,29 @@ plugin_info_t * GetConfig( void )
{
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
p_info->psz_name = "SDL";
p_info->psz_name = "SDL (video yuv conversion?, audio?)";
p_info->psz_version = VERSION;
p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
p_info->aout_GetPlugin = NULL;
p_info->vout_GetPlugin = vout_GetPlugin;
p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL;
/* TODO: before doing this, we have to know if the videoCard is capable of
* hardware YUV -> display acceleration....
*/
p_info->yuv_GetPlugin = (void *) yuv_GetPlugin;
/* if the SDL libraries are there, assume we can enter the
* initialization part at least, even if we fail afterwards */
p_info->i_score = 0x100;
p_info->i_score = 0x50;
/* If this plugin was requested, score it higher */
if( TestMethod( VOUT_METHOD_VAR, "sdl" ) )
{
......@@ -111,3 +131,11 @@ static void intf_GetPlugin( p_intf_thread_t p_intf )
p_intf->p_sys_manage = intf_SDLManage;
}
static void yuv_GetPlugin( p_vout_thread_t p_vout )
{
p_vout->p_yuv_init = yuv_CInit;
p_vout->p_yuv_reset = yuv_CReset;
p_vout->p_yuv_end = yuv_CEnd;
}
/*****************************************************************************
* video_yuv.c: YUV transformation functions
* Provides functions to perform the YUV conversion. The functions provided here
* are a complete and portable C implementation, and may be replaced in certain
* case by optimized functions.
*****************************************************************************
* 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"
/*****************************************************************************
* vout_InitYUV: allocate and initialize translations tables
*****************************************************************************
* This function will allocate memory to store translation tables, depending
* of the screen depth.
*****************************************************************************/
int yuv_CInit( vout_thread_t *p_vout )
{
/* Initialize tables */
SetSDLYUV( p_vout );
return( 0 );
}
/*****************************************************************************
* yuv_CEnd: destroy translations tables
*****************************************************************************
* Free memory allocated by yuv_CCreate.
*****************************************************************************/
void yuv_CEnd( vout_thread_t *p_vout )
{
free( p_vout->yuv.p_base );
free( p_vout->yuv.p_buffer );
free( p_vout->yuv.p_offset );
}
/*****************************************************************************
* yuv_CReset: re-initialize translations tables
*****************************************************************************
* This function will initialize the tables allocated by vout_CreateTables and
* set functions pointers.
*****************************************************************************/
int yuv_CReset( vout_thread_t *p_vout )
{
yuv_CEnd( p_vout );
return( yuv_CInit( p_vout ) );
}
/* following functions are local */
/*****************************************************************************
* SetYUV: compute tables and set function pointers
+ *****************************************************************************/
void SetSDLYUV( vout_thread_t *p_vout )
{
/*
* Set functions pointers
*/
if( p_vout->b_grayscale )
{
/* Grayscale */
switch( p_vout->i_bytes_per_pixel )
{
case 1:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) Convert8;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) Convert8;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) Convert8;
break;
case 2:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) Convert16;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) Convert16;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) Convert16;
break;
case 3:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) Convert24;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) Convert24;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) Convert24;
break;
case 4:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) Convert32;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) Convert32;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) Convert32;
break;
}
}
else
{
/* Color */
switch( p_vout->i_bytes_per_pixel )
{
case 1:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertRGB8;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertRGB8;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertRGB8;
break;
case 2:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertRGB16;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertRGB16;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertRGB16;
break;
case 3:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertRGB24;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertRGB24;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertRGB24;
break;
case 4:
p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertRGB32;
p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertRGB32;
p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertRGB32;
break;
}
}
}
/*****************************************************************************
* video_yuv.h: YUV transformation functions
* Provides functions to perform the YUV conversion. The functions provided here
* are a complete and portable C implementation, and may be replaced in certain
* case by optimized functions.
*****************************************************************************
* 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.
*****************************************************************************/
/*****************************************************************************
* Constants
*****************************************************************************/
/* Margins and offsets in conversion tables - Margins are used in case a RGB
* RGB conversion would give a value outside the 0-255 range. Offsets have been
* calculated to avoid using the same cache line for 2 tables. conversion tables
* are 2*MARGIN + 256 long and stores pixels.*/
#define RED_MARGIN 178
#define GREEN_MARGIN 135
#define BLUE_MARGIN 224
#define RED_OFFSET 1501 /* 1323 to 1935 */
#define GREEN_OFFSET 135 /* 0 to 526 */
#define BLUE_OFFSET 818 /* 594 to 1298 */
#define RGB_TABLE_SIZE 1935 /* total table size */
#define GRAY_MARGIN 384
#define GRAY_TABLE_SIZE 1024 /* total table size */
#define PALETTE_TABLE_SIZE 2176 /* YUV -> 8bpp palette lookup table */
/* macros used for YUV pixel conversions */
#define SHIFT 20
#define U_GREEN_COEF ((int)(-0.391 * (1<<SHIFT) / 1.164))
#define U_BLUE_COEF ((int)(2.018 * (1<<SHIFT) / 1.164))
#define V_RED_COEF ((int)(1.596 * (1<<SHIFT) / 1.164))
#define V_GREEN_COEF ((int)(-0.813 * (1<<SHIFT) / 1.164))
/* argument lists for YUV functions */
#define YUV_ARGS( word_size ) p_vout_thread_t p_vout, word_size *p_pic, \
yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, \
int i_pic_width, int i_pic_height, int i_pic_line_width, \
int i_matrix_coefficients
#define YUV_ARGS_8BPP YUV_ARGS( u8 )
#define YUV_ARGS_16BPP YUV_ARGS( u16 )
#define YUV_ARGS_24BPP YUV_ARGS( u32 )
#define YUV_ARGS_32BPP YUV_ARGS( u32 )
/*****************************************************************************
* Local prototypes
*****************************************************************************/
void SetGammaTable ( int *pi_table, double f_gamma );
void SetYUV ( vout_thread_t *p_vout );
void SetOffset ( int i_width, int i_height, int i_pic_width,
int i_pic_height, boolean_t *pb_h_scaling,
int *pi_v_scaling, int *p_offset,
boolean_t b_double );
void Convert8 ( YUV_ARGS_8BPP );
void ConvertRGB8 ( YUV_ARGS_8BPP );
void Convert16 ( YUV_ARGS_16BPP );
void ConvertRGB16 ( YUV_ARGS_16BPP );
void Convert24 ( YUV_ARGS_24BPP );
void ConvertRGB24 ( YUV_ARGS_24BPP );
void Convert32 ( YUV_ARGS_32BPP );
void ConvertRGB32 ( YUV_ARGS_32BPP );
/*****************************************************************************
* video_yuv_macros_truecolor.h: YUV transformation macros for truecolor
*****************************************************************************
* 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.
*****************************************************************************/
/*****************************************************************************
* CONVERT_YUV_PIXEL, CONVERT_Y_PIXEL: pixel conversion blocks
*****************************************************************************
* These conversion routines are used by YUV conversion functions.
* conversion are made from p_y, p_u, p_v, which are modified, to p_buffer,
* which is also modified.
*****************************************************************************/
#define CONVERT_Y_PIXEL( BPP ) \
/* Only Y sample is present */ \
p_ybase = p_yuv + *p_y++; \
*p_buffer++ = p_ybase[RED_OFFSET-((V_RED_COEF*128)>>SHIFT) + i_red] | \
p_ybase[GREEN_OFFSET-(((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) \
+ i_green ] | p_ybase[BLUE_OFFSET-((U_BLUE_COEF*128)>>SHIFT) + i_blue];
#define CONVERT_YUV_PIXEL( BPP ) \
/* Y, U and V samples are present */ \
i_uval = *p_u++; \
i_vval = *p_v++; \
i_red = (V_RED_COEF * i_vval) >> SHIFT; \
i_green = (U_GREEN_COEF * i_uval + V_GREEN_COEF * i_vval) >> SHIFT; \
i_blue = (U_BLUE_COEF * i_uval) >> SHIFT; \
CONVERT_Y_PIXEL( BPP ) \
/*****************************************************************************
* SCALE_WIDTH: scale a line horizontally
*****************************************************************************
* This macro scales a line using rendering buffer and offset array. It works
* for 1, 2 and 4 Bpp.
*****************************************************************************/
#define SCALE_WIDTH \
if( b_horizontal_scaling ) \
{ \
/* Horizontal scaling, conversion has been done to buffer. \
* Rewind buffer and offset, then copy and scale line */ \
p_buffer = p_buffer_start; \
p_offset = p_offset_start; \
for( i_x = i_pic_width / 16; i_x--; ) \
{ \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \
} \
p_pic += i_pic_line_width; \
} \
else \
{ \
/* No scaling, conversion has been done directly in picture memory. \
* Increment of picture pointer to end of line is still needed */ \
p_pic += i_pic_width + i_pic_line_width; \
} \
/*****************************************************************************
* SCALE_HEIGHT: handle vertical scaling
*****************************************************************************
* This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or
* 444 for RGB conversion, or 400 for gray conversion. It works for 1, 2, 3
* and 4 Bpp.
*****************************************************************************/
#define SCALE_HEIGHT( CHROMA, BPP ) \
/* If line is odd, rewind 4:2:0 U and V samples */ \
if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) ) \
{ \
p_u -= i_chroma_width; \
p_v -= i_chroma_width; \
} \
\
/* \
* Handle vertical scaling. The current line can be copied or next one \
* can be ignored. \
*/ \
switch( i_vertical_scaling ) \
{ \
case -1: /* vertical scaling factor is < 1 */ \
while( (i_scale_count -= i_pic_height) > 0 ) \
{ \
/* Height reduction: skip next source line */ \
p_y += i_width; \
i_y++; \
if( (CHROMA == 420) || (CHROMA == 422) ) \
{ \
if( i_y & 0x1 ) \
{ \
p_u += i_chroma_width; \
p_v += i_chroma_width; \
} \
} \
else if( CHROMA == 444 ) \
{ \
p_u += i_width; \
p_v += i_width; \
} \
} \
i_scale_count += i_height; \
break; \
case 1: /* vertical scaling factor is > 1 */ \
while( (i_scale_count -= i_height) > 0 ) \
{ \
/* Height increment: copy previous picture line */ \
for( i_x = i_pic_width / 16; i_x--; ) \
{ \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
if( BPP > 1 ) /* 2, 3, 4 Bpp */ \
{ \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
} \
if( BPP > 2 ) /* 3, 4 Bpp */ \
{ \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
*(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ ); \
} \
if( BPP > 3 ) /* 4 Bpp */ \