summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Jager <t.jager@gmx.de>2012-06-25 22:25:23 +0300
committerTorsten Jager <t.jager@gmx.de>2012-06-25 22:25:23 +0300
commit94010a9d0e5cddcbb4973ec3c654826c91094b24 (patch)
treeab19ce77914f2630582ab4f0f7dd1008825dfe4d
parent6282546e5a492bbba815c2f11e87ef90a04b3fd6 (diff)
downloadxine-lib-94010a9d0e5cddcbb4973ec3c654826c91094b24.tar.gz
xine-lib-94010a9d0e5cddcbb4973ec3c654826c91094b24.tar.bz2
Added 5:4 line scaling function (720 -> 1024)
-rw-r--r--src/video_out/yuv2rgb.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c
index 7aea37be7..cb5a990a1 100644
--- a/src/video_out/yuv2rgb.c
+++ b/src/video_out/yuv2rgb.c
@@ -1248,6 +1248,42 @@ static void scale_line_1_2 (uint8_t *source, uint8_t *dest,
xine_profiler_stop_count(prof_scale_line);
}
+/* Interpolate 4 output pixels from 5 source pixels (1280x720 -> 1024x576). */
+/* * * * * * */
+/* * * * * */
+
+static void scale_line_5_4 (uint8_t *source, uint8_t *dest, int width, int step) {
+ int p1, p2, p3, p4, p5;
+
+ xine_profiler_start_count(prof_scale_line);
+
+ while ((width -= 4) >= 0) {
+ *dest++ = *source++;
+ p1 = *source++;
+ p2 = *source++;
+ *dest++ = p1 + ((p2 - p1) >> 2);
+ p3 = *source++;
+ p4 = *source++;
+ /* the middle pixel loses most sharpness, so do that one cubic */
+ p5 = (9 * (p2 + p3) - p1 - p4) >> 4;
+ *dest++ = p5 & 0x100 ? ~(p5 >> 9) : p5;
+ *dest++ = p4 + ((p3 - p4) >> 2);
+ }
+
+ if ((width += 4) <= 0) goto done;
+ *dest++ = *source++;
+ if (--width <= 0) goto done;
+ p1 = *source++;
+ p2 = *source++;
+ *dest++ = p1 + ((p2 - p1) >> 2);
+ if (--width <= 0) goto done;
+ p1 = *source;
+ *dest++ = (p1 + p2) >> 1;
+ done:
+
+ xine_profiler_stop_count(prof_scale_line);
+}
+
/*
* Scale line with no horizontal scaling. For NTSC mpeg2 dvd input in
@@ -1279,6 +1315,7 @@ static scale_line_func_t find_scale_line_func(int step) {
{ 3, 4, scale_line_3_4, "svcd 4:3(ntsc)" },
{ 1, 2, scale_line_1_2, "2*zoom" },
{ 1, 1, scale_line_1_1, "non-scaled" },
+ { 5, 4, scale_line_5_4, "hd720p, fullscreen(1024x576)" },
};
size_t i;
#ifdef LOG