From d34041569e71fc9bd772354e94dc9d16061072a5 Mon Sep 17 00:00:00 2001 From: arpi_esp Date: Sat, 24 Feb 2001 20:28:24 +0000 Subject: Initial revision git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2 b3059339-0415-0410-9bf9-f77b7e298cf2 --- drivers/mga_vid_test.c | 221 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 drivers/mga_vid_test.c (limited to 'drivers/mga_vid_test.c') diff --git a/drivers/mga_vid_test.c b/drivers/mga_vid_test.c new file mode 100644 index 0000000000..c1057a9cf7 --- /dev/null +++ b/drivers/mga_vid_test.c @@ -0,0 +1,221 @@ +/* + * + * mga_vid_test.c + * + * Aaron Holtzman + * Sept 1999 + * + * This software has been released under the terms of the GNU Public + * license. See http://www.gnu.org/copyleft/gpl.html for details. + */ + +//#include +#include +#include +#include +#include +#include +#include +#include "mga_vid.h" + +mga_vid_config_t config; +uint8_t *mga_vid_base; +uint32_t is_g400; + +#define SRC_IMAGE_WIDTH 256 +#define SRC_IMAGE_HEIGHT 256 + +uint8_t y_image[SRC_IMAGE_WIDTH * SRC_IMAGE_HEIGHT]; +uint8_t cr_image[SRC_IMAGE_WIDTH * SRC_IMAGE_HEIGHT]; +uint8_t cb_image[SRC_IMAGE_WIDTH * SRC_IMAGE_HEIGHT]; + + +void +write_frame_g200(uint8_t *y,uint8_t *cr, uint8_t *cb) +{ + uint8_t *dest; + uint32_t bespitch,h,w; + + dest = mga_vid_base; + bespitch = (config.src_width + 31) & ~31; + + for(h=0; h < config.src_height; h++) + { + memcpy(dest, y, config.src_width); + y += config.src_width; + dest += bespitch; + } + + for(h=0; h < config.src_height/2; h++) + { + for(w=0; w < config.src_width/2; w++) + { + *dest++ = *cb++; + *dest++ = *cr++; + } + dest += bespitch - config.src_width; + } +} + +void +write_frame_g400(uint8_t *y,uint8_t *cr, uint8_t *cb) +{ + uint8_t *dest; + uint32_t bespitch,h; + + dest = mga_vid_base; + bespitch = (config.src_width + 31) & ~31; + + for(h=0; h < config.src_height; h++) + { + memcpy(dest, y, config.src_width); + y += config.src_width; + dest += bespitch; + } + + for(h=0; h < config.src_height/2; h++) + { + memcpy(dest, cb, config.src_width/2); + cb += config.src_width/2; + dest += bespitch/2; + } + + for(h=0; h < config.src_height/2; h++) + { + memcpy(dest, cr, config.src_width/2); + cr += config.src_width/2; + dest += bespitch/2; + } +} + +void write_frame(uint8_t *y,uint8_t *cr, uint8_t *cb) +{ + if(is_g400) + write_frame_g400(y,cr,cb); + else + write_frame_g200(y,cr,cb); +} + +void +draw_cool_pattern(void) +{ + int i,x,y; + + i = 0; + for (y=0; y