From 96c5d5b482017932c8c585de0cbbf334a12f1ecd Mon Sep 17 00:00:00 2001 From: Juergen Keil Date: Tue, 25 Sep 2001 18:39:36 +0000 Subject: one of the optimized scale_line functions was not used at 1024x768 resolution, when switching into/out of fullscreen mode. CVS patchset: 693 CVS date: 2001/09/25 18:39:36 --- src/video_out/video_out_xshm.c | 17 ++----- src/video_out/yuv2rgb.c | 100 +++++++++++------------------------------ 2 files changed, 31 insertions(+), 86 deletions(-) diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 6291e44f1..250852521 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.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_xshm.c,v 1.38 2001/09/24 09:09:43 jkeil Exp $ + * $Id: video_out_xshm.c,v 1.39 2001/09/25 18:39:36 jkeil Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -515,17 +515,8 @@ static void xshm_calc_output_size (xshm_driver_t *this) { ideal_height *= this->output_scale_factor; } - /* - * HACK: make sure our special DVD optimized version of - * scale_line is used. - */ - if (this->delivered_width == 720 && ideal_width == 1024 - && this->delivered_height == 576 && ideal_height == 576) { - ideal_width = 1008; - } else { - /* yuv2rgb_mmx prefers "width%8 == 0" */ - ideal_width &= ~7; - } + /* yuv2rgb_mmx prefers "width%8 == 0" */ + ideal_width &= ~7; this->calc_dest_size (ideal_width, ideal_height, &dest_width, &dest_height); @@ -897,7 +888,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, */ log_scale = log(this->output_scale_factor) / log(1.2); int_scale = rint(log_scale); - if (fabs(log_scale - int_scale) < 0.02) + if (fabs(log_scale - int_scale) < 0.03) this->output_scale_factor = pow(1.2, int_scale); } printf("video_out_xshm: output_scale %f\n", this->output_scale_factor); diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index 436d7d98c..12aa0f1ea 100644 --- a/src/video_out/yuv2rgb.c +++ b/src/video_out/yuv2rgb.c @@ -22,7 +22,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: yuv2rgb.c,v 1.18 2001/09/23 15:14:01 jkeil Exp $ + * $Id: yuv2rgb.c,v 1.19 2001/09/25 18:39:36 jkeil Exp $ */ #include "config.h" @@ -211,70 +211,11 @@ static void scale_line_fast (uint8_t *source, uint8_t *dest, } #endif -/* - * Interpolates 7 output pixels from 5 source pixels using shifts. - * Useful for scaling an mpeg2 dvd input source to 16:9 format - * (720 x 576 ==> 1008 x 576) - * - * Interpolated source pixels are at n*5/7 (n=0..6): - * 0.0, 0.71428, 1.42857, 2.14285, 2.85714, 3.57142, 4.28571 - * - * We use: - * 0.0 source[0] - * 0.71428 => 3/4 (0.75) (1*source[0] + 3*source[1]) >> 2 - * 1.42857 => 1+3/8 (1.375) (5*source[1] + 3*source[2]) >> 3 - * 2.14285 => 2+1/8 (2.125) (7*source[2] + 1*source[3]) >> 3 - * 2.85714 => 2+7/8 (2.875) (1*source[2] + 7*source[3]) >> 3 - * 3.57142 => 3+5/8 (3.625) (3*source[3] + 5*source[4]) >> 3 - * 4.28571 => 4+1/4 (4.25) (3*source[4] + 1*source[5]) >> 2 - */ -static void scale_line_5_7 (uint8_t *source, uint8_t *dest, - int width, int step) { - - int p1, p2; - - profiler_start_count(prof_scale_line); - - p1 = source[0]; - while ((width -= 7) >= 0) { - dest[0] = p1; - p2 = source[1]; - dest[1] = (1*p1 + 3*p2) >> 2; - p1 = source[2]; - dest[2] = (5*p2 + 3*p1) >> 3; - p2 = source[3]; - dest[3] = (7*p1 + 1*p2) >> 3; - dest[4] = (1*p1 + 7*p2) >> 3; - p1 = source[4]; - dest[5] = (3*p2 + 5*p1) >> 3; - p2 = source[5]; - dest[6] = (3*p1 + 1*p2) >> 2; - source += 5; - dest += 7; - p1 = p2; - } - - if ((width += 7) <= 0) goto done; - *dest++ = source[0]; - if (--width <= 0) goto done; - *dest++ = (1*source[0] + 3*source[1]) >> 2; - if (--width <= 0) goto done; - *dest++ = (5*source[1] + 3*source[2]) >> 3; - if (--width <= 0) goto done; - *dest++ = (7*source[2] + 1*source[3]) >> 3; - if (--width <= 0) goto done; - *dest++ = (1*source[2] + 7*source[3]) >> 3; - if (--width <= 0) goto done; - *dest++ = (3*source[3] + 5*source[4]) >> 3; -done: - - profiler_stop_count(prof_scale_line); -} - /* * Interpolates 16 output pixels from 15 source pixels using shifts. - * Useful for scaling an mpeg2 dvd input source to 4:3 format + * Useful for scaling a PAL mpeg2 dvd input source to 4:3 format on + * a monitor using square pixels. * (720 x 576 ==> 768 x 576) */ static void scale_line_15_16 (uint8_t *source, uint8_t *dest, @@ -357,8 +298,10 @@ static void scale_line_15_16 (uint8_t *source, uint8_t *dest, /* * Interpolates 64 output pixels from 45 source pixels using shifts. - * Useful for scaling an mpeg2 dvd input source to 1024x768 fullscreen - * (720 x 576 ==> 1024 x XXX) + * Useful for scaling a PAL mpeg2 dvd input source to 1024x768 + * fullscreen resolution, or to 16:9 format on a monitor using square + * pixels. + * (720 x 576 ==> 1024 x 576) */ static void scale_line_45_64 (uint8_t *source, uint8_t *dest, int width, int step) { @@ -616,7 +559,7 @@ static void scale_line_45_64 (uint8_t *source, uint8_t *dest, /* * Interpolates 16 output pixels from 9 source pixels using shifts. - * Useful for scaling an mpeg2 dvd input source to 1280x1024 fullscreen + * Useful for scaling a PAL mpeg2 dvd input source to 1280x1024 fullscreen * (720 x 576 ==> 1280 x XXX) */ static void scale_line_9_16 (uint8_t *source, uint8_t *dest, @@ -722,28 +665,39 @@ static void scale_line_1_2 (uint8_t *source, uint8_t *dest, } +/* Scale line with no scaling. */ + +static void scale_line_1_1 (uint8_t *source, uint8_t *dest, + int width, int step) { + + profiler_start_count(prof_scale_line); + memcpy(dest, source, width); + profiler_stop_count(prof_scale_line); +} + + static scale_line_func_t find_scale_line_func(int step) { #if 1 - if (abs(step - 5*32768/7) < 10) { - printf("yuv2rgb: using dvd 16:9 optimized scale_line\n"); - return scale_line_5_7; - } - if (abs(step - 15*32768/16) < 10) { + if (step == 15*32768/16) { printf("yuv2rgb: using dvd 4:3 optimized scale_line\n"); return scale_line_15_16; } - if (abs(step - 45*32768/64) < 10) { + if (step == 45*32768/64) { printf("yuv2rgb: using dvd fullscreen(1024x768) optimized scale_line\n"); return scale_line_45_64; } - if (abs(step - 9*32768/16) < 10) { + if (step == 9*32768/16) { printf("yuv2rgb: using dvd fullscreen(1280x1024) optimized scale_line\n"); return scale_line_9_16; } - if (abs(step - 1*32768/2) < 10) { + if (step == 1*32768/2) { printf("yuv2rgb: using optimized 2*zoom scale_line\n"); return scale_line_1_2; } + if (step == 1*32768/1) { + printf("yuv2rgb: using non-scaled scale_line\n"); + return scale_line_1_1; + } printf("yuv2rgb: using generic scale_line with interpolation\n"); return scale_line_gen; #else -- cgit v1.2.3