diff options
-rw-r--r-- | misc/Makefile.am | 4 | ||||
-rw-r--r-- | misc/xine-logoconv.c | 78 | ||||
-rw-r--r-- | misc/xine_logo.yv12.gz | bin | 0 -> 29869 bytes | |||
-rw-r--r-- | misc/xine_logo.zyuy2 | bin | 39431 -> 0 bytes | |||
-rw-r--r-- | src/xine-engine/video_out.c | 143 |
5 files changed, 147 insertions, 78 deletions
diff --git a/misc/Makefile.am b/misc/Makefile.am index 73dfd9844..b8712a15d 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -2,10 +2,10 @@ SUBDIRS = fonts EXTRA_DIST = autogen.sh upload.pl SlackBuild.in SlackBuild build_rpms.sh \ xine-lib.spec.in xine-lib.spec \ - xine_logo.png xine_logo.zyuy2 xine-fontconv.c + xine_logo.png xine_logo.yv12.gz xine-fontconv.c datadir = $(XINE_SKINDIR) -data_DATA = xine_logo.png xine_logo.zyuy2 +data_DATA = xine_logo.png xine_logo.yv12.gz bin_SCRIPTS = xine-config diff --git a/misc/xine-logoconv.c b/misc/xine-logoconv.c index 8f0d31e88..9965f7b5f 100644 --- a/misc/xine-logoconv.c +++ b/misc/xine-logoconv.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2002 the xine project * - * This file is part of xine, a unix video player. + * This file is part of xine, a free video player. * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,7 +75,7 @@ static void save_image (char *oldname, ImlibImage *img) { if (extension) *extension = 0; - snprintf (filename, 1023, "%s.zyuy2", oldname); + snprintf (filename, 1023, "%s.yv12.gz", oldname); if (!(fp = gzopen (filename ,"w"))) { printf ("failed to create file '%s'\n", filename); @@ -89,7 +89,7 @@ static void save_image (char *oldname, ImlibImage *img) { wr16 (fp, h); /* - * convert yuv to yuy2 + * convert yuv to yv12 */ for (py=0; py<h; py++) { @@ -121,10 +121,38 @@ static void save_image (char *oldname, ImlibImage *img) { cv = v + 128.0; gzwrite (fp, &cy, 1); - if ((px-1) % 2) - gzwrite (fp, &cv, 1); - else - gzwrite (fp, &cu, 1); + } + } + + for (py=0; py<h; py+=2) { + printf ("."); + for (px=0; px<w; px+=2) { + + double r, g, b; + double y, u, v; + unsigned char cy,cu,cv; + +#ifdef WORDS_BIGENDIAN + r = img->rgb_data[(px+py*w)*3]; + g = img->rgb_data[(px+py*w)*3+1]; + b = img->rgb_data[(px+py*w)*3+2]; +#else + r = img->rgb_data[(px+py*w)*3+2]; + g = img->rgb_data[(px+py*w)*3+1]; + b = img->rgb_data[(px+py*w)*3]; +#endif + + y = (LUMARED*r) + (LUMAGREEN*g) + (LUMABLUE*b); + // u = (b-y) / (2 - 2*LUMABLUE); + // v = (r-y) / (2 - 2*LUMABLUE); + u = (b-y) / (2 - 2*LUMABLUE); + v = (r-y) / (2 - 2*LUMABLUE); + + cy = y; + cu = u + 128.0; + cv = v + 128.0; + + gzwrite (fp, &cu, 1); /* printf ("%f %f %f => %f %f %f\n",r,g,b,y,u,v); @@ -133,6 +161,42 @@ static void save_image (char *oldname, ImlibImage *img) { } } + for (py=0; py<h; py+=2) { + printf ("."); + for (px=0; px<w; px+=2) { + + double r, g, b; + double y, u, v; + unsigned char cy,cu,cv; + +#ifdef WORDS_BIGENDIAN + r = img->rgb_data[(px+py*w)*3]; + g = img->rgb_data[(px+py*w)*3+1]; + b = img->rgb_data[(px+py*w)*3+2]; +#else + r = img->rgb_data[(px+py*w)*3+2]; + g = img->rgb_data[(px+py*w)*3+1]; + b = img->rgb_data[(px+py*w)*3]; +#endif + + y = (LUMARED*r) + (LUMAGREEN*g) + (LUMABLUE*b); + // u = (b-y) / (2 - 2*LUMABLUE); + // v = (r-y) / (2 - 2*LUMABLUE); + u = (b-y) / (2 - 2*LUMABLUE); + v = (r-y) / (2 - 2*LUMABLUE); + + cy = y; + cu = u + 128.0; + cv = v + 128.0; + + gzwrite (fp, &cv, 1); + + /* + printf ("%f %f %f => %f %f %f\n",r,g,b,y,u,v); + */ + + } + } printf ("\ndone.\n"); gzclose(fp); } diff --git a/misc/xine_logo.yv12.gz b/misc/xine_logo.yv12.gz Binary files differnew file mode 100644 index 000000000..a5a56cf61 --- /dev/null +++ b/misc/xine_logo.yv12.gz diff --git a/misc/xine_logo.zyuy2 b/misc/xine_logo.zyuy2 Binary files differdeleted file mode 100644 index 90e052d72..000000000 --- a/misc/xine_logo.zyuy2 +++ /dev/null diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 40b98ad93..a3bd2f592 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out.c,v 1.94 2002/04/29 23:32:00 jcdutton Exp $ + * $Id: video_out.c,v 1.95 2002/05/01 20:38:19 guenter Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -77,7 +77,7 @@ typedef struct { char *logo_pathname; pthread_mutex_t logo_mutex; int logo_w, logo_h; - uint8_t *logo_yuy2; + uint8_t *logo_yv12; video_overlay_instance_t *overlay_source; int overlay_enabled; @@ -96,66 +96,6 @@ struct img_buf_fifo_s { pthread_cond_t not_empty; } ; -/* - * Logo related functions + config callback. - */ -static uint16_t gzread_i16(gzFile *fp) { - uint16_t ret; - ret = gzgetc(fp) << 8 ; - ret |= gzgetc(fp); - return ret; -} - -static int _load_logo_file(vos_t *this) { - gzFile *fp; - int retval = 0; - - pthread_mutex_lock(&this->logo_mutex); - - if((fp = gzopen (this->logo_pathname, "rb")) != NULL) { - - if(this->logo_yuy2) - free (this->logo_yuy2); - - this->logo_w = gzread_i16 (fp); - this->logo_h = gzread_i16 (fp); -#ifdef LOG - printf ("video_out: loading logo %d x %d pixels, yuy2\n", - this->logo_w, this->logo_h); -#endif - - this->logo_yuy2 = malloc (this->logo_w * this->logo_h *2); - - gzread (fp, this->logo_yuy2, this->logo_w * this->logo_h *2); - gzclose (fp); - - this->backup_is_logo = 0; - - retval = 1; - } - - pthread_mutex_unlock(&this->logo_mutex); - return retval; -} - -static void _logo_change_cb(void *data, cfg_entry_t *cfg) { - vos_t *this = (vos_t *) data; - char default_logo[2048]; - - this->logo_pathname = cfg->str_value; - - if(!_load_logo_file(this)) { -#ifdef LOG - printf("_load_logo_file() failed, reload default\n"); -#endif - snprintf(default_logo, 2048, "%s/xine_logo.zyuy2", XINE_SKINDIR); - cfg->config->update_string(cfg->config, cfg->key, default_logo); - } -} -/* - * End of logo. - */ - static img_buf_fifo_t *vo_new_img_buf_queue () { img_buf_fifo_t *queue; @@ -483,12 +423,12 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) { pthread_mutex_lock(&this->logo_mutex); this->img_backup = vo_get_frame (&this->vo, this->logo_w, this->logo_h, - 42, IMGFMT_YUY2, VO_BOTH_FIELDS); + 42, IMGFMT_YV12, VO_BOTH_FIELDS); this->img_backup->duration = 3000; - xine_fast_memcpy(this->img_backup->base[0], this->logo_yuy2, - this->logo_w*this->logo_h*2); + xine_fast_memcpy(this->img_backup->base[0], this->logo_yv12, + this->logo_w*this->logo_h*3/2); pthread_mutex_unlock(&this->logo_mutex); this->backup_is_logo = 1; @@ -872,8 +812,8 @@ static void vo_exit (vo_instance_t *this_gen) { free (this->display_img_buf_queue); pthread_mutex_lock(&this->logo_mutex); - if(this->logo_yuy2) - free(this->logo_yuy2); + if (this->logo_yv12) + free (this->logo_yv12); pthread_mutex_unlock(&this->logo_mutex); pthread_mutex_destroy(&this->logo_mutex); @@ -899,6 +839,66 @@ static void vo_enable_overlay (vo_instance_t *this_gen, int overlay_enabled) { this->overlay_enabled = overlay_enabled; } +/* + * Logo related functions + config callback. + */ +static uint16_t gzread_i16(gzFile *fp) { + uint16_t ret; + ret = gzgetc(fp) << 8 ; + ret |= gzgetc(fp); + return ret; +} + +static int _load_logo_file(vos_t *this) { + gzFile *fp; + int retval = 0; + + pthread_mutex_lock(&this->logo_mutex); + + if ((fp = gzopen (this->logo_pathname, "rb")) != NULL) { + + if (this->logo_yv12) + free (this->logo_yv12); + + this->logo_w = gzread_i16 (fp); + this->logo_h = gzread_i16 (fp); +#ifdef LOG + printf ("video_out: loading logo %d x %d pixels, yv12\n", + this->logo_w, this->logo_h); +#endif + + this->logo_yv12 = malloc (this->logo_w * this->logo_h *3/2); + + gzread (fp, this->logo_yv12, this->logo_w * this->logo_h *3/2); + gzclose (fp); + + this->backup_is_logo = 0; + + retval = 1; + } + + pthread_mutex_unlock(&this->logo_mutex); + return retval; +} + +#ifdef LOGO_CONFIG_OPTION +static void _logo_change_cb(void *data, cfg_entry_t *cfg) { + vos_t *this = (vos_t *) data; + char default_logo[2048]; + + this->logo_pathname = cfg->str_value; + + if(!_load_logo_file(this)) { +#ifdef LOG + printf("_load_logo_file() failed, reload default\n"); +#endif + snprintf(default_logo, 2048, "%s/xine_logo.yv12.gz", XINE_SKINDIR); + cfg->config->update_string(cfg->config, cfg->key, default_logo); + } +} + +#endif + vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) { vos_t *this; @@ -973,12 +973,17 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) { pthread_mutex_init(&this->logo_mutex, NULL); - snprintf(default_logo, 2048, "%s/xine_logo.zyuy2", XINE_SKINDIR); +#ifdef LOGO_CONFIG_OPTION + snprintf(default_logo, 2048, "%s/xine_logo.yv12.gz", XINE_SKINDIR); this->logo_pathname = config->register_string(config, "video.logo_file", default_logo, "logo displayed in video output window", NULL, _logo_change_cb, (void *) this); - +#else + this->logo_pathname = malloc (2048); + snprintf (this->logo_pathname, 2048, "%s/xine_logo.yv12.gz", XINE_SKINDIR); +#endif + _load_logo_file(this); } |