Commit afd56ce5 authored by Rocky Bernstein's avatar Rocky Bernstein

render.c: RV24 blending

all: more code cleanup and perhaps slightly better bigendian handling though
     more common routines/includes.
parent 55645776
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Common SVCD and VCD subtitle routines. * Common SVCD and VCD subtitle routines.
***************************************************************************** *****************************************************************************
* Copyright (C) 2003, 2004 VideoLAN * Copyright (C) 2003, 2004 VideoLAN
* $Id: common.c,v 1.9 2004/01/23 10:19:37 rocky Exp $ * $Id: common.c,v 1.10 2004/01/29 11:50:21 rocky Exp $
* *
* Author: Rocky Bernstein <rocky@panix.com> * Author: Rocky Bernstein <rocky@panix.com>
* based on code from: * based on code from:
...@@ -510,7 +510,6 @@ void VCDSubDumpImage( uint8_t *p_image, uint32_t i_height, uint32_t i_width ) ...@@ -510,7 +510,6 @@ void VCDSubDumpImage( uint8_t *p_image, uint32_t i_height, uint32_t i_width )
#ifdef HAVE_LIBPNG #ifdef HAVE_LIBPNG
#define BYTES_PER_RGB 3
#define PALETTE_SIZE 4 #define PALETTE_SIZE 4
/* Note the below assumes the above is a power of 2 */ /* Note the below assumes the above is a power of 2 */
#define PALETTE_SIZE_MASK (PALETTE_SIZE-1) #define PALETTE_SIZE_MASK (PALETTE_SIZE-1)
...@@ -529,11 +528,11 @@ VCDSubDumpPNG( uint8_t *p_image, decoder_t *p_dec, ...@@ -529,11 +528,11 @@ VCDSubDumpPNG( uint8_t *p_image, decoder_t *p_dec,
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t *p = p_image; uint8_t *p = p_image;
uint8_t *image_data = malloc(BYTES_PER_RGB * i_height * i_width ); uint8_t *image_data = malloc(RGB_SIZE * i_height * i_width );
uint8_t *q = image_data; uint8_t *q = image_data;
unsigned int i_row; /* scanline row number */ unsigned int i_row; /* scanline row number */
unsigned int i_column; /* scanline column number */ unsigned int i_column; /* scanline column number */
uint8_t rgb_palette[PALETTE_SIZE * BYTES_PER_RGB]; uint8_t rgb_palette[PALETTE_SIZE * RGB_SIZE];
int i; int i;
dbg_print( (DECODE_DBG_CALL), "%s", filename); dbg_print( (DECODE_DBG_CALL), "%s", filename);
...@@ -543,14 +542,14 @@ VCDSubDumpPNG( uint8_t *p_image, decoder_t *p_dec, ...@@ -543,14 +542,14 @@ VCDSubDumpPNG( uint8_t *p_image, decoder_t *p_dec,
/* Convert palette YUV into RGB. */ /* Convert palette YUV into RGB. */
for (i=0; i<PALETTE_SIZE; i++) { for (i=0; i<PALETTE_SIZE; i++) {
ogt_yuvt_t *p_yuv = &(p_sys->p_palette[i]); ogt_yuvt_t *p_yuv = &(p_sys->p_palette[i]);
uint8_t *p_rgb_out = &(rgb_palette[i*BYTES_PER_RGB]); uint8_t *p_rgb_out = &(rgb_palette[i*RGB_SIZE]);
yuv2rgb( p_yuv, p_rgb_out ); yuv2rgb( p_yuv, p_rgb_out );
} }
/* Convert palette entries into linear RGB array. */ /* Convert palette entries into linear RGB array. */
for ( i_row=0; i_row < i_height; i_row ++ ) { for ( i_row=0; i_row < i_height; i_row ++ ) {
for ( i_column=0; i_column<i_width; i_column++ ) { for ( i_column=0; i_column<i_width; i_column++ ) {
uint8_t *p_rgb = &rgb_palette[ ((*p)&PALETTE_SIZE_MASK)*BYTES_PER_RGB ]; uint8_t *p_rgb = &rgb_palette[ ((*p)&PALETTE_SIZE_MASK)*RGB_SIZE ];
*q++ = p_rgb[0]; *q++ = p_rgb[0];
*q++ = p_rgb[1]; *q++ = p_rgb[1];
*q++ = p_rgb[2]; *q++ = p_rgb[2];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Common pixel/chroma manipulation routines. * Common pixel/chroma manipulation routines.
***************************************************************************** *****************************************************************************
* Copyright (C) 2003, 2004 VideoLAN * Copyright (C) 2003, 2004 VideoLAN
* $Id: pixmap.h,v 1.2 2004/01/16 13:32:37 rocky Exp $ * $Id: pixmap.h,v 1.3 2004/01/29 11:50:22 rocky Exp $
* *
* Author: Rocky Bernstein * Author: Rocky Bernstein
* *
...@@ -57,10 +57,37 @@ yuv2rgb(ogt_yuvt_t *p_yuv, uint8_t *p_rgb_out ) ...@@ -57,10 +57,37 @@ yuv2rgb(ogt_yuvt_t *p_yuv, uint8_t *p_rgb_out )
i_green = clip_8_bit( i_green ); i_green = clip_8_bit( i_green );
i_blue = clip_8_bit( i_blue ); i_blue = clip_8_bit( i_blue );
#ifdef WORDS_BIGENDIAN
*p_rgb_out++ = i_red; *p_rgb_out++ = i_red;
*p_rgb_out++ = i_green; *p_rgb_out++ = i_green;
*p_rgb_out++ = i_blue; *p_rgb_out++ = i_blue;
#else
*p_rgb_out++ = i_blue;
*p_rgb_out++ = i_green;
*p_rgb_out++ = i_red;
#endif
} }
#define GREEN_PIXEL 1
#ifdef WORDS_BIGENDIAN
#define RED_PIXEL 0
#define BLUE_PIXEL 2
#else
#define BLUE_PIXEL 2
#define RED_PIXEL 0
#endif
static inline void
put_rgb24_pixel(uint8_t *rgb, uint8_t *p_pixel)
{
#ifdef WORDS_BIGENDIAN
*p_pixel++;
#endif
*p_pixel++ = rgb[RED_PIXEL];
*p_pixel++ = rgb[GREEN_PIXEL];
*p_pixel++ = rgb[BLUE_PIXEL];
}
#endif /* PIXMAP_H */ #endif /* PIXMAP_H */
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* subtitle.h : Common SVCD and CVD subtitles header * subtitle.h : Common SVCD and CVD subtitles header
***************************************************************************** *****************************************************************************
* Copyright (C) 2003,2004 VideoLAN * Copyright (C) 2003,2004 VideoLAN
* $Id: subtitle.h,v 1.13 2004/01/25 19:27:09 rocky Exp $ * $Id: subtitle.h,v 1.14 2004/01/29 11:50:22 rocky Exp $
* *
* Author: Rocky Bernstein * Author: Rocky Bernstein
* based on code from: * based on code from:
...@@ -115,12 +115,17 @@ typedef enum { ...@@ -115,12 +115,17 @@ typedef enum {
SUBTITLE_BLOCK_COMPLETE SUBTITLE_BLOCK_COMPLETE
} packet_state_t; } packet_state_t;
/* The storage used by one pixel */ /* The byte storage of an RGB pixel. */
#define RGB_SIZE 3
/* The byte storage used by one pixel */
#define PIXEL_SIZE 4 #define PIXEL_SIZE 4
/* Size in bytes of YUV portion above. */ /* Size in bytes of YUV portion above. */
#define YUV_SIZE 3 #define YUV_SIZE 3
/* Transparency plane. NOTE: see vlc_video.h for V_PLANE */ /* Transparency plane. NOTE: see vlc_video.h for V_PLANE */
#define T_PLANE V_PLANE+1 #define T_PLANE V_PLANE+1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment