summaryrefslogtreecommitdiffstats
path: root/extra/xbmc
diff options
context:
space:
mode:
authorsibel <lesibel@free.fr>2010-09-08 08:33:17 +0200
committersibel <lesibel@free.fr>2010-09-08 08:33:17 +0200
commitd8e3600056b92f1f4da3580c7f91b9f624acef23 (patch)
tree2addb573f491656c9c1440cc99b8b22b52a21a51 /extra/xbmc
parentc2de2bedd5c9d28cf52f75fd27aa02aa4685baff (diff)
downloadnutyx-pakxe-d8e3600056b92f1f4da3580c7f91b9f624acef23.tar.gz
nutyx-pakxe-d8e3600056b92f1f4da3580c7f91b9f624acef23.tar.bz2
nutyx-pakxe-d8e3600056b92f1f4da3580c7f91b9f624acef23.tar.xz
nutyx-pakxe-d8e3600056b92f1f4da3580c7f91b9f624acef23.zip
Ajustement de make de libcaptury
Diffstat (limited to 'extra/xbmc')
-rw-r--r--extra/xbmc/.directory3
-rw-r--r--extra/xbmc/.md5sum6
-rw-r--r--extra/xbmc/FEH.sh24
-rw-r--r--extra/xbmc/Pkgfile71
-rw-r--r--extra/xbmc/libpng14.patch89
-rw-r--r--extra/xbmc/use_cdio_system_headers_on_non_win32.patch130
-rw-r--r--extra/xbmc/xbmc-9.11-TexturePacker-parallel-build.patch13
-rw-r--r--extra/xbmc/xbmc-9.11-jpeg-speedup.patch18
-rw-r--r--extra/xbmc/xbmc-9.11-shader-upscalers.patch887
-rw-r--r--extra/xbmc/xbmc-9.11-wavpack.patch44
-rw-r--r--extra/xbmc/xbmc.install11
11 files changed, 1296 insertions, 0 deletions
diff --git a/extra/xbmc/.directory b/extra/xbmc/.directory
new file mode 100644
index 000000000..c73c9619b
--- /dev/null
+++ b/extra/xbmc/.directory
@@ -0,0 +1,3 @@
+[Dolphin]
+Timestamp=2010,9,6,16,36,59
+ViewMode=1
diff --git a/extra/xbmc/.md5sum b/extra/xbmc/.md5sum
new file mode 100644
index 000000000..3ce3dd5e6
--- /dev/null
+++ b/extra/xbmc/.md5sum
@@ -0,0 +1,6 @@
+c3e2ab79b9965f1a4a048275d5f222c4 FEH.sh
+3f93cfc8aa21723ca3246dc5f9122177 libpng14.patch
+7b7403cdde791330b5ab70697d2054f2 use_cdio_system_headers_on_non_win32.patch
+4b9f89e5ade45142dfb001fbc563b5a6 xbmc-9.11-TexturePacker-parallel-build.patch
+062c5f61cd3bb27de66c861fd2c79de1 xbmc-9.11-wavpack.patch
+9a68ac1e2f44a54cc3803fcdb1265767 xbmc-9.11.tar.gz
diff --git a/extra/xbmc/FEH.sh b/extra/xbmc/FEH.sh
new file mode 100644
index 000000000..e040a7862
--- /dev/null
+++ b/extra/xbmc/FEH.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+RETVAL=0
+
+if [[ -z $(glxinfo | grep "direct rendering.*Yes" | uniq) ]]; then
+ echo "XBMC needs hardware accelerated OpenGL rendering."
+ echo "Install an appropriate graphics driver."
+ echo
+ echo "Please consult XBMC Wiki for supported hardware"
+ echo "http://xbmc.org/wiki/?title=Supported_hardware"
+ echo
+ RETVAL=1
+fi
+
+if [[ -z $(xdpyinfo | grep "depth of root.*24" | uniq) ]]; then
+ echo "XBMC cannot run unless the"
+ echo "screen color depth is atleast 24 bit."
+ echo
+ echo "Please reconfigure your screen."
+ RETVAL=1
+fi
+
+exit ${RETVAL}
+
diff --git a/extra/xbmc/Pkgfile b/extra/xbmc/Pkgfile
new file mode 100644
index 000000000..85794bc34
--- /dev/null
+++ b/extra/xbmc/Pkgfile
@@ -0,0 +1,71 @@
+# Description: Media Center
+# URL: http://xbmc.org
+# Maintainer: NutyX core team
+# Packager: lesibel at free dot fr
+# Depends on: xscreensaver, cmake, boost, gperf, nasm, libvdpau, unzip, zip, unrar, devicekit-power, bzip2, curl, enca, faac, faad2, liba52, alsa-lib, flac, freetype, fontconfig, fribidi, glew, dbus, hal, jasper, libcdio, libgl, libmad, libmms, libjpeg, libogg, libmpeg2, libvorbis, mysqlclient, libsamplerate, xorg-libxinerama, xorg-libxrandr, xorg-libxtst, xorg-xdpyinfo, mesa3d, lzo, sdl_image, sdl_mixer, sdl-sound, tiff, ffmpeg, samba3, wavpack
+
+
+name=xbmc
+version=9.11
+release=1
+
+source=(http://freefr.dl.sourceforge.net/project/xbmc/XBMC%20Source%20Code/Camelot%20-%209.11/xbmc-9.11.tar.gz
+ use_cdio_system_headers_on_non_win32.patch
+ FEH.sh
+ libpng14.patch
+ xbmc-9.11-wavpack.patch
+ xbmc-9.11-TexturePacker-parallel-build.patch)
+
+build() {
+ cd $SRC/$name-$version
+
+ patch -Np1 -i $SRC/use_cdio_system_headers_on_non_win32.patch
+ patch -Np1 -i $SRC/libpng14.patch
+ patch -Np1 -i $SRC/xbmc-9.11-TexturePacker-parallel-build.patch
+ patch -Np1 -i $SRC/xbmc-9.11-wavpack.patch
+
+ sed -i -e 's:/usr/bin/lsb_release -d:cat /etc/nutyx-version:' xbmc/utils/SystemInfo.cpp
+ sed -i 's: ftell64: dll_ftell64:' xbmc/cores/DllLoader/exports/wrapper.c
+ sed -i 's|cinfo.scale_denom = GetJpegScale();|cinfo.scale_denom = GetJpegScale(); cinfo.scale_num = 1;|' xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp
+
+ export SVN_REV="-ARCH"
+
+ ./bootstrap
+
+ ./configure --prefix=/usr \
+ --enable-vdpau \
+ --disable-pulse \
+ --disable-external-liba52 \
+ --disable-external-libdts \
+ --enable-external-libmpeg2 \
+ --enable-external-libogg \
+ --enable-external-libwavpack \
+ --disable-external-libass \
+ --disable-external-ffmpeg \
+ --disable-external-python \
+ --disable-debug
+
+ make
+ make prefix=$PKG/usr install
+
+ sed -i -e 's/\/usr\/share\/xbmc/\/opt\/xbmc/' $PKG/usr/bin/xbmc
+
+ # License(s)
+ install -dm755 $PKG/usr/share/licenses/$name
+
+ for licensef in LICENSE.GPL README.linux copying.txt; do
+ mv $PKG/usr/share/xbmc/${licensef} \
+ $PKG/usr/share/licenses/$name
+ done
+
+ rm -r $PKG/usr/share/xsessions
+
+ sed -i "s#Exec=xbmc#Exec=/usr/bin/xbmc#" $PKG/usr/share/applications/xbmc.desktop
+
+ mkdir $PKG/opt/
+ mv $PKG/usr/share/xbmc $PKG/opt
+
+ rm -r $PKG/opt/xbmc/skin/PM3.HD
+
+ find $PKG -type f -exec strip {} \; >/dev/null 2>/dev/null
+}
diff --git a/extra/xbmc/libpng14.patch b/extra/xbmc/libpng14.patch
new file mode 100644
index 000000000..d3b236329
--- /dev/null
+++ b/extra/xbmc/libpng14.patch
@@ -0,0 +1,89 @@
+diff -Nur xbmc-9.11.orig/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp xbmc-9.11/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+--- xbmc-9.11.orig/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp 2008-07-18 23:40:53.000000000 +0300
++++ xbmc-9.11/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp 2010-01-20 21:55:11.000000000 +0200
+@@ -142,9 +142,9 @@
+ if (info_ptr->num_trans!=0){ //palette transparency
+ if (info_ptr->num_trans==1){
+ if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
+- info.nBkgndIndex = info_ptr->trans_values.index;
++ info.nBkgndIndex = info_ptr->trans_color.index;
+ } else{
+- info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
++ info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
+ }
+ }
+ if (info_ptr->num_trans>1){
+@@ -152,7 +152,7 @@
+ if (pal){
+ DWORD ip;
+ for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
+- pal[ip].rgbReserved=info_ptr->trans[ip];
++ pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
+ for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
+ pal[ip].rgbReserved=255;
+ }
+@@ -166,9 +166,9 @@
+ int num_trans;
+ png_color_16 *image_background;
+ if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
+- info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_values.red>>nshift);
+- info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
+- info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_values.blue>>nshift);
++ info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_color.red>>nshift);
++ info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
++ info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_color.blue>>nshift);
+ info.nBkgndColor.rgbReserved = 0;
+ info.nBkgndIndex = 0;
+ }
+@@ -417,12 +417,12 @@
+ if (info.nBkgndIndex >= 0){
+ info_ptr->num_trans = 1;
+ info_ptr->valid |= PNG_INFO_tRNS;
+- info_ptr->trans = trans;
+- info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
+- info_ptr->trans_values.red = tc.rgbRed;
+- info_ptr->trans_values.green = tc.rgbGreen;
+- info_ptr->trans_values.blue = tc.rgbBlue;
+- info_ptr->trans_values.gray = info_ptr->trans_values.index;
++ info_ptr->trans_alpha = trans;
++ info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
++ info_ptr->trans_color.red = tc.rgbRed;
++ info_ptr->trans_color.green = tc.rgbGreen;
++ info_ptr->trans_color.blue = tc.rgbBlue;
++ info_ptr->trans_color.gray = info_ptr->trans_color.index;
+
+ // the transparency indexes start from 0 for non grayscale palette
+ if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
+@@ -443,7 +443,7 @@
+ trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
+ info_ptr->num_trans = (WORD)nc;
+ info_ptr->valid |= PNG_INFO_tRNS;
+- info_ptr->trans = trans;
++ info_ptr->trans_alpha = trans;
+ }
+
+ // copy the palette colors
+diff -Nur xbmc-9.11.orig/xbmc/screensavers/rsxs-0.9/src/pngimage.cc xbmc-9.11/xbmc/screensavers/rsxs-0.9/src/pngimage.cc
+--- xbmc-9.11.orig/xbmc/screensavers/rsxs-0.9/src/pngimage.cc 2008-07-30 23:35:38.000000000 +0300
++++ xbmc-9.11/xbmc/screensavers/rsxs-0.9/src/pngimage.cc 2010-01-20 22:21:01.000000000 +0200
+@@ -65,7 +65,7 @@
+ (png_get_color_type(png, pngInfo) == PNG_COLOR_TYPE_GRAY) &&
+ png_get_bit_depth(png, pngInfo) < 8
+ )
+- png_set_gray_1_2_4_to_8(png);
++ png_set_expand_gray_1_2_4_to_8(png);
+ if (png_get_valid(png, pngInfo, PNG_INFO_tRNS))
+ png_set_tRNS_to_alpha(png);
+ if (fullColor)
+diff -Nur xbmc-9.11.orig/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c xbmc-9.11/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c
+--- xbmc-9.11.orig/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c 2008-08-04 05:05:51.000000000 +0300
++++ xbmc-9.11/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c 2010-01-20 22:16:23.000000000 +0200
+@@ -94,7 +94,7 @@
+ png_set_palette_to_rgb (png_ptr);
+
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+- png_set_gray_1_2_4_to_8 (png_ptr);
++ png_set_expand_gray_1_2_4_to_8 (png_ptr);
+ else if (color_type == PNG_COLOR_TYPE_GRAY ||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ png_set_gray_to_rgb (png_ptr);
diff --git a/extra/xbmc/use_cdio_system_headers_on_non_win32.patch b/extra/xbmc/use_cdio_system_headers_on_non_win32.patch
new file mode 100644
index 000000000..71f388591
--- /dev/null
+++ b/extra/xbmc/use_cdio_system_headers_on_non_win32.patch
@@ -0,0 +1,130 @@
+diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
+index 9097519..9b6418d 100644
+--- a/xbmc/Application.cpp
++++ b/xbmc/Application.cpp
+@@ -236,7 +236,11 @@
+ #endif
+
+ #ifdef HAS_DVD_DRIVE
++#ifdef _WIN32
+ #include "lib/libcdio/logging.h"
++#else
++#include <cdio/logging.h>
++#endif
+ #endif
+
+ #ifdef HAS_HAL
+diff --git a/xbmc/FileSystem/Makefile b/xbmc/FileSystem/Makefile
+index 782d57a..1e524ed 100644
+--- a/xbmc/FileSystem/Makefile
++++ b/xbmc/FileSystem/Makefile
+@@ -1,5 +1,4 @@
+-INCLUDES=-I. -I../ -I../cores -I../linux -I../../guilib -I../lib/UnrarXLib -I../utils -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+-INCLUDES+=-I../lib/libcdio/libcdio/include
++INCLUDES=-I. -I../ -I../cores -I../linux -I../../guilib -I../lib/UnrarXLib -I../utils -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I../lib
+
+ CXXFLAGS+=-D__STDC_FORMAT_MACROS \
+
+diff --git a/xbmc/FileSystem/cdioSupport.cpp b/xbmc/FileSystem/cdioSupport.cpp
+index 00e5fdd..21a0b67 100644
+--- a/xbmc/FileSystem/cdioSupport.cpp
++++ b/xbmc/FileSystem/cdioSupport.cpp
+@@ -26,7 +26,7 @@
+ #include "cdioSupport.h"
+ #include "utils/SingleLock.h"
+ #include "utils/log.h"
+-#ifndef _LINUX
++#ifdef _WIN32
+ #include "lib/libcdio/logging.h"
+ #include "lib/libcdio/util.h"
+ #include "lib/libcdio/mmc.h"
+diff --git a/xbmc/FileSystem/iso9660.cpp b/xbmc/FileSystem/iso9660.cpp
+index 6e1633f..58fbc50 100644
+--- a/xbmc/FileSystem/iso9660.cpp
++++ b/xbmc/FileSystem/iso9660.cpp
+@@ -44,7 +44,7 @@ ISO9660
+ #include "utils/CharsetConverter.h"
+
+ #include "DetectDVDType.h" // for MODE2_DATA_SIZE etc.
+-#ifdef _LINUX
++#ifndef _WIN32
+ #include <cdio/bytesex.h>
+ #else
+ #include "lib/libcdio/bytesex.h" // for from_723 & from_733
+diff --git a/xbmc/Makefile b/xbmc/Makefile
+index abfbdcb..f55381a 100644
+--- a/xbmc/Makefile
++++ b/xbmc/Makefile
+@@ -8,8 +8,6 @@ INCLUDES+=-Ilib/libUPnP/Platinum/Source/Core \
+ -Ilib/libUPnP/Neptune/Source/System/Posix \
+ -Ilib/libUPnP/Neptune/Source/Core
+
+-INCLUDES+=-Ilib/libcdio/libcdio/include
+-
+ SRCS=Application.cpp \
+ CueDocument.cpp \
+ GUISettings.cpp \
+diff --git a/xbmc/cdrip/CDDAReader.cpp b/xbmc/cdrip/CDDAReader.cpp
+index c8b37b2..e3e9c0b 100644
+--- a/xbmc/cdrip/CDDAReader.cpp
++++ b/xbmc/cdrip/CDDAReader.cpp
+@@ -24,7 +24,11 @@
+ #ifdef HAS_CDDA_RIPPER
+
+ #include "CDDAReader.h"
++#ifdef _WIN32
+ #include "lib/libcdio/cdio.h"
++#else
++#include <cdio/cdio.h>
++#endif
+ #include "utils/log.h"
+
+ #define SECTOR_COUNT 52
+diff --git a/xbmc/cores/paplayer/AC3CDDACodec.cpp b/xbmc/cores/paplayer/AC3CDDACodec.cpp
+index 20cded7..f2a077a 100644
+--- a/xbmc/cores/paplayer/AC3CDDACodec.cpp
++++ b/xbmc/cores/paplayer/AC3CDDACodec.cpp
+@@ -22,7 +22,11 @@
+ #include "system.h"
+ #include "AC3CDDACodec.h"
+ #ifdef HAS_AC3_CDDA_CODEC
++#ifdef _WIN32
+ #include "lib/libcdio/sector.h"
++#else
++#include <cdio/sector.h>
++#endif
+
+ AC3CDDACodec::AC3CDDACodec() : AC3Codec()
+ {
+diff --git a/xbmc/cores/paplayer/CDDAcodec.cpp b/xbmc/cores/paplayer/CDDAcodec.cpp
+index ca8f1be..42460dc 100644
+--- a/xbmc/cores/paplayer/CDDAcodec.cpp
++++ b/xbmc/cores/paplayer/CDDAcodec.cpp
+@@ -20,7 +20,11 @@
+ */
+
+ #include "CDDAcodec.h"
++#ifdef _WIN32
+ #include "lib/libcdio/sector.h"
++#else
++#include <cdio/sector.h>
++#endif
+
+ #define SECTOR_COUNT 55 // max. sectors that can be read at once
+ #define MAX_BUFFER_SIZE 2*SECTOR_COUNT*CDIO_CD_FRAMESIZE_RAW
+diff --git a/xbmc/cores/paplayer/DTSCDDACodec.cpp b/xbmc/cores/paplayer/DTSCDDACodec.cpp
+index e64cc2e..9bc46c6 100644
+--- a/xbmc/cores/paplayer/DTSCDDACodec.cpp
++++ b/xbmc/cores/paplayer/DTSCDDACodec.cpp
+@@ -22,7 +22,11 @@
+ #include "system.h"
+ #include "DTSCDDACodec.h"
+ #ifdef HAS_DTS_CODEC
++#ifdef _WIN32
+ #include "lib/libcdio/sector.h"
++#else
++#include <cdio/sector.h>
++#endif
+
+ DTSCDDACodec::DTSCDDACodec() : DTSCodec()
+ {
diff --git a/extra/xbmc/xbmc-9.11-TexturePacker-parallel-build.patch b/extra/xbmc/xbmc-9.11-TexturePacker-parallel-build.patch
new file mode 100644
index 000000000..f6bc030ee
--- /dev/null
+++ b/extra/xbmc/xbmc-9.11-TexturePacker-parallel-build.patch
@@ -0,0 +1,13 @@
+http://trac.xbmc.org/ticket/9275
+
+--- xbmc/Makefile.in
++++ xbmc/Makefile.in
+@@ -501,7 +501,7 @@ else
+ $(MAKE) -C tools/XBMCTex/
+ endif
+
+-tools/TexturePacker/TexturePacker:
++tools/TexturePacker/TexturePacker: guilib/guilib.a xbmc/lib/libsquish/libsquish-@ARCH@.a
+ $(MAKE) -C tools/TexturePacker/
+
+ install-bin: xbmc.bin # developement convenience target
diff --git a/extra/xbmc/xbmc-9.11-jpeg-speedup.patch b/extra/xbmc/xbmc-9.11-jpeg-speedup.patch
new file mode 100644
index 000000000..63cadbf51
--- /dev/null
+++ b/extra/xbmc/xbmc-9.11-jpeg-speedup.patch
@@ -0,0 +1,18 @@
+fix from upstream
+http://bugs.gentoo.org/300909
+
+r26689 | jmarshallnz | 2010-01-11 14:30:08 -0500 (Mon, 11 Jan 2010) | 2 lines
+fixed: Ticket #7810 - high cpu load during loading of images with libjpeg7, thanks to akawaka.
+
+Index: xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp
+===================================================================
+--- xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp (revision 26688)
++++ xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp (revision 26689)
+@@ -220,6 +220,7 @@ bool CxImageJPG::Decode(CxFile * hFile)
+
+ // Set the scale <ignacio>
+ cinfo.scale_denom = GetJpegScale();
++ cinfo.scale_num = 1;
+
+ // Borrowed the idea from GIF implementation <ignacio>
+ if (info.nEscape == -1) {
diff --git a/extra/xbmc/xbmc-9.11-shader-upscalers.patch b/extra/xbmc/xbmc-9.11-shader-upscalers.patch
new file mode 100644
index 000000000..d4feaa47f
--- /dev/null
+++ b/extra/xbmc/xbmc-9.11-shader-upscalers.patch
@@ -0,0 +1,887 @@
+http://bugs.gentoo.org/306661
+
+backport shader based upscalers from svn trunk
+
+--- language/English/strings.xml
++++ language/English/strings.xml
+@@ -1554,16 +1554,17 @@
+ <string id="16304">Lanczos2</string>
+ <string id="16305">Lanczos3</string>
+ <string id="16306">Sinc8</string>
+-
+ <string id="16307">Bicubic (software)</string>
+ <string id="16308">Lanczos (software)</string>
+ <string id="16309">Sinc (software)</string>
+-
+ <string id="16310">(VDPAU)Temporal</string>
+ <string id="16311">(VDPAU)Temporal/Spatial</string>
+ <string id="16312">(VDPAU)Noise Reduction</string>
+ <string id="16313">(VDPAU)Sharpness</string>
+ <string id="16314">Inverse Telecine</string>
++ <string id="16315">Lanczos3 optimized</string>
++ <string id="16316">Auto</string>
++
+ <string id="17500">Display sleep timeout</string>
+
+ <string id="19000">Switch to channel</string>
+--- system/shaders/convolution-6x6.glsl
++++ system/shaders/convolution-6x6.glsl
+@@ -0,0 +1,69 @@
++uniform sampler2D img;
++uniform float stepx;
++uniform float stepy;
++
++#if (HAS_FLOAT_TEXTURE)
++uniform sampler1D kernelTex;
++
++vec3 weight(float pos)
++{
++ return texture1D(kernelTex, pos).rgb;
++}
++#else
++uniform sampler2D kernelTex;
++
++vec3 weight(float pos)
++{
++ //row 0 contains the high byte, row 1 contains the low byte
++ return ((texture2D(kernelTex, vec2(pos, 0.0)) * 256.0 + texture2D(kernelTex, vec2(pos, 1.0)))).rgb / 128.5 - 1.0;
++}
++#endif
++
++vec3 pixel(float xpos, float ypos)
++{
++ return texture2D(img, vec2(xpos, ypos)).rgb;
++}
++
++vec3 line (float ypos, vec3 xpos1, vec3 xpos2, vec3 linetaps1, vec3 linetaps2)
++{
++ vec3 pixels;
++
++ pixels = pixel(xpos1.r, ypos) * linetaps1.r;
++ pixels += pixel(xpos1.g, ypos) * linetaps2.r;
++ pixels += pixel(xpos1.b, ypos) * linetaps1.g;
++ pixels += pixel(xpos2.r, ypos) * linetaps2.g;
++ pixels += pixel(xpos2.g, ypos) * linetaps1.b;
++ pixels += pixel(xpos2.b, ypos) * linetaps2.b;
++
++ return pixels;
++}
++
++void main()
++{
++ float xf = fract(gl_TexCoord[0].x / stepx);
++ float yf = fract(gl_TexCoord[0].y / stepy);
++
++ vec3 linetaps1 = weight((1.0 - xf) / 2.0);
++ vec3 linetaps2 = weight((1.0 - xf) / 2.0 + 0.5);
++ vec3 columntaps1 = weight((1.0 - yf) / 2.0);
++ vec3 columntaps2 = weight((1.0 - yf) / 2.0 + 0.5);
++
++ vec3 xpos1 = vec3(
++ (-1.5 - xf) * stepx + gl_TexCoord[0].x,
++ (-0.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 0.5 - xf) * stepx + gl_TexCoord[0].x);
++ vec3 xpos2 = vec3(
++ ( 1.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 2.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 3.5 - xf) * stepx + gl_TexCoord[0].x);
++
++ gl_FragColor.rgb = line((-1.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.r;
++ gl_FragColor.rgb += line((-0.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.r;
++ gl_FragColor.rgb += line(( 0.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.g;
++ gl_FragColor.rgb += line(( 1.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.g;
++ gl_FragColor.rgb += line(( 2.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.b;
++ gl_FragColor.rgb += line(( 3.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.b;
++
++ gl_FragColor.a = gl_Color.a;
++}
++
+--- system/shaders/bicubic.glsl
++++ system/shaders/bicubic.glsl
+@@ -0,0 +1,47 @@
++uniform sampler2D img;
++uniform float stepx;
++uniform float stepy;
++uniform sampler2D kernelTex;
++
++vec4 cubicFilter(float xValue, vec4 c0, vec4 c1, vec4 c2, vec4 c3)
++{
++ vec4 h = texture2D(kernelTex, vec2(xValue, 0.5));
++ vec4 r = c0 * h.r;
++ r += c1 * h.g;
++ r += c2 * h.b;
++ r += c3 * h.a;
++ return r;
++}
++
++void main()
++{
++ vec2 f = vec2(gl_TexCoord[0].x / stepx , gl_TexCoord[0].y / stepy);
++ f = fract(f);
++ vec4 t0 = cubicFilter(f.x,
++ texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, -stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(0.0, -stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(stepx, -stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, -stepy)));
++
++ vec4 t1 = cubicFilter(f.x,
++ texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 0.0)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(0.0, 0.0)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 0.0)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 0.0)));
++
++ vec4 t2 = cubicFilter(f.x,
++ texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(0.0, stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(stepx, stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, stepy)));
++
++ vec4 t3 = cubicFilter(f.x,
++ texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 2.0*stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(0, 2.0*stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 2.0*stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 2.0*stepy)));
++
++ gl_FragColor = cubicFilter(f.y, t0, t1, t2, t3);
++ gl_FragColor.a = gl_Color.a;
++}
++
+--- system/shaders/convolution-4x4.glsl
++++ system/shaders/convolution-4x4.glsl
+@@ -0,0 +1,60 @@
++uniform sampler2D img;
++uniform float stepx;
++uniform float stepy;
++
++#if (HAS_FLOAT_TEXTURE)
++uniform sampler1D kernelTex;
++
++vec4 weight(float pos)
++{
++ return texture1D(kernelTex, pos);
++}
++#else
++uniform sampler2D kernelTex;
++
++vec4 weight(float pos)
++{
++ //row 0 contains the high byte, row 1 contains the low byte
++ return (texture2D(kernelTex, vec2(pos, 0.0)) * 256.0 + texture2D(kernelTex, vec2(pos, 1.0))) / 128.5 - 1.0;
++}
++#endif
++
++vec3 pixel(float xpos, float ypos)
++{
++ return texture2D(img, vec2(xpos, ypos)).rgb;
++}
++
++vec3 line (float ypos, vec4 xpos, vec4 linetaps)
++{
++ vec3 pixels;
++
++ pixels = pixel(xpos.r, ypos) * linetaps.r;
++ pixels += pixel(xpos.g, ypos) * linetaps.g;
++ pixels += pixel(xpos.b, ypos) * linetaps.b;
++ pixels += pixel(xpos.a, ypos) * linetaps.a;
++
++ return pixels;
++}
++
++void main()
++{
++ float xf = fract(gl_TexCoord[0].x / stepx);
++ float yf = fract(gl_TexCoord[0].y / stepy);
++
++ vec4 linetaps = weight(1.0 - xf);
++ vec4 columntaps = weight(1.0 - yf);
++
++ vec4 xpos = vec4(
++ (-0.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 0.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 1.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 2.5 - xf) * stepx + gl_TexCoord[0].x);
++
++ gl_FragColor.rgb = line((-0.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.r;
++ gl_FragColor.rgb += line(( 0.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.g;
++ gl_FragColor.rgb += line(( 1.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.b;
++ gl_FragColor.rgb += line(( 2.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.a;
++
++ gl_FragColor.a = gl_Color.a;
++}
++
+--- xbmc/settings/VideoSettings.h
++++ xbmc/settings/VideoSettings.h
+@@ -51,9 +51,10 @@
+ {
+ VS_SCALINGMETHOD_NEAREST=0,
+ VS_SCALINGMETHOD_LINEAR,
+-
++
+ VS_SCALINGMETHOD_CUBIC,
+ VS_SCALINGMETHOD_LANCZOS2,
++ VS_SCALINGMETHOD_LANCZOS3_FAST,
+ VS_SCALINGMETHOD_LANCZOS3,
+ VS_SCALINGMETHOD_SINC8,
+ VS_SCALINGMETHOD_NEDI,
+@@ -61,7 +62,9 @@
+ VS_SCALINGMETHOD_BICUBIC_SOFTWARE,
+ VS_SCALINGMETHOD_LANCZOS_SOFTWARE,
+ VS_SCALINGMETHOD_SINC_SOFTWARE,
+- VS_SCALINGMETHOD_VDPAU_HARDWARE
++ VS_SCALINGMETHOD_VDPAU_HARDWARE,
++
++ VS_SCALINGMETHOD_AUTO
+ };
+
+ class CVideoSettings
+--- xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp
++++ xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp
+@@ -21,6 +21,7 @@
+ #include "system.h"
+ #include "VideoFilterShader.h"
+ #include "utils/log.h"
++#include "ConvolutionKernels.h"
+
+ #include <string>
+ #include <math.h>
+@@ -63,60 +64,13 @@
+
+ BicubicFilterShader::BicubicFilterShader(float B, float C)
+ {
+- string shaderf =
+- "uniform sampler2D img;"
+- "uniform float stepx;"
+- "uniform float stepy;"
+- "uniform sampler2D kernelTex;"
+-
+- "vec4 cubicFilter(float xValue, vec4 c0, vec4 c1, vec4 c2, vec4 c3)"
+- "{"
+- " vec4 h = texture2D(kernelTex, vec2(xValue, 0.5));"
+- " vec4 r = c0 * h.r;"
+- " r += c1 * h.g;"
+- " r += c2 * h.b;"
+- " r += c3 * h.a;"
+- " return r;"
+- "}"
+- ""
+- "void main()"
+- "{"
+- "vec2 f = vec2(gl_TexCoord[0].x / stepx , gl_TexCoord[0].y / stepy);"
+- "f = fract(f);"
+- "vec4 t0 = cubicFilter(f.x,"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, -stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(0.0, -stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, -stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, -stepy)));"
+- ""
+- "vec4 t1 = cubicFilter(f.x,"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 0.0)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(0.0, 0.0)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 0.0)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 0.0)));"
+- ""
+- "vec4 t2 = cubicFilter(f.x,"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(0.0, stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, stepy)));"
+- ""
+- "vec4 t3 = cubicFilter(f.x,"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 2.0*stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(0, 2.0*stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 2.0*stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 2.0*stepy)));"
+-
+- "gl_FragColor = cubicFilter(f.y, t0, t1, t2, t3) ;"
+- "gl_FragColor.a = gl_Color.a;"
+- "}";
+- PixelShader()->SetSource(shaderf);
++ PixelShader()->LoadSource("bicubic.glsl");
+ m_kernelTex1 = 0;
+ m_B = B;
+ m_C = C;
+- if (B<=0)
++ if (B<0)
+ m_B=1.0f/3.0f;
+- if (C<=0)
++ if (C<0)
+ m_C=1.0f/3.0f;
+ }
+
+@@ -209,8 +163,8 @@
+ glBindTexture(GL_TEXTURE_2D, m_kernelTex1);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, size, 1, 0, GL_RGBA, GL_FLOAT, img);
+
+ glActiveTexture(GL_TEXTURE0);
+@@ -254,4 +208,110 @@
+ return val;
+ }
+
++ConvolutionFilterShader::ConvolutionFilterShader(ESCALINGMETHOD method)
++{
++ m_method = method;
++ m_kernelTex1 = 0;
++
++ string shadername;
++ string defines;
++
++ if (m_method == VS_SCALINGMETHOD_CUBIC ||
++ m_method == VS_SCALINGMETHOD_LANCZOS2 ||
++ m_method == VS_SCALINGMETHOD_LANCZOS3_FAST)
++ shadername = "convolution-4x4.glsl";
++ else if (m_method == VS_SCALINGMETHOD_LANCZOS3)
++ shadername = "convolution-6x6.glsl";
++
++ m_floattex = glewIsSupported("GL_ARB_texture_float");
++
++ if (m_floattex)
++ defines = "#define HAS_FLOAT_TEXTURE 1\n";
++ else
++ defines = "#define HAS_FLOAT_TEXTURE 0\n";
++
++ CLog::Log(LOGDEBUG, "GL: ConvolutionFilterShader: using %s defines: %s", shadername.c_str(), defines.c_str());
++ PixelShader()->LoadSource(shadername, defines);
++}
++
++void ConvolutionFilterShader::OnCompiledAndLinked()
++{
++ // obtain shader attribute handles on successfull compilation
++ m_hSourceTex = glGetUniformLocation(ProgramHandle(), "img");
++ m_hStepX = glGetUniformLocation(ProgramHandle(), "stepx");
++ m_hStepY = glGetUniformLocation(ProgramHandle(), "stepy");
++ m_hKernTex = glGetUniformLocation(ProgramHandle(), "kernelTex");
++
++ CConvolutionKernel kernel(m_method, 256);
++
++ if (m_kernelTex1)
++ {
++ glDeleteTextures(1, &m_kernelTex1);
++ m_kernelTex1 = 0;
++ }
++
++ glGenTextures(1, &m_kernelTex1);
++
++ if ((m_kernelTex1<=0))
++ {
++ CLog::Log(LOGERROR, "GL: ConvolutionFilterShader: Error creating kernel texture");
++ return;
++ }
++
++ glActiveTexture(GL_TEXTURE2);
++
++ //if float textures are supported, we can load the kernel as a 1d float texture
++ //if not, we load it as a 2d texture with 2 rows, where row 0 contains the high byte
++ //and row 1 contains the low byte, which can be converted in the shader
++ if (m_floattex)
++ {
++ glBindTexture(GL_TEXTURE_1D, m_kernelTex1);
++ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
++ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
++ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
++ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
++ glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA16F_ARB, kernel.GetSize(), 0, GL_RGBA, GL_FLOAT, kernel.GetFloatPixels());
++ }
++ else
++ {
++ glBindTexture(GL_TEXTURE_2D, m_kernelTex1);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
++ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kernel.GetSize(), 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, kernel.GetIntFractPixels());
++ }
++
++ glActiveTexture(GL_TEXTURE0);
++
++ VerifyGLState();
++}
++
++bool ConvolutionFilterShader::OnEnabled()
++{
++ // set shader attributes once enabled
++ glActiveTexture(GL_TEXTURE2);
++
++ if (m_floattex)
++ glBindTexture(GL_TEXTURE_1D, m_kernelTex1);
++ else
++ glBindTexture(GL_TEXTURE_2D, m_kernelTex1);
++
++ glActiveTexture(GL_TEXTURE0);
++ glUniform1i(m_hSourceTex, m_sourceTexUnit);
++ glUniform1i(m_hKernTex, 2);
++ glUniform1f(m_hStepX, m_stepX);
++ glUniform1f(m_hStepY, m_stepY);
++ VerifyGLState();
++ return true;
++}
++
++void ConvolutionFilterShader::Free()
++{
++ if (m_kernelTex1)
++ glDeleteTextures(1, &m_kernelTex1);
++ m_kernelTex1 = 0;
++ BaseVideoFilterShader::Free();
++}
++
+ #endif
+--- xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.cpp
++++ xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.cpp
+@@ -0,0 +1,226 @@
++/*
++ * Copyright (C) 2005-2008 Team XBMC
++ * http://www.xbmc.org
++ *
++ * This Program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This Program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with XBMC; see the file COPYING. If not, write to
++ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
++ * http://www.gnu.org/copyleft/gpl.html
++ *
++ */
++#ifdef _WIN32
++ #define _USE_MATH_DEFINES
++#endif
++
++#include "ConvolutionKernels.h"
++#include "MathUtils.h"
++
++#define SINC(x) (sin(M_PI * (x)) / (M_PI * (x)))
++
++CConvolutionKernel::CConvolutionKernel(ESCALINGMETHOD method, int size)
++{
++ m_size = size;
++ m_floatpixels = new float[m_size * 4];
++
++ if (method == VS_SCALINGMETHOD_LANCZOS2)
++ Lanczos2();
++ else if (method == VS_SCALINGMETHOD_LANCZOS3_FAST)
++ Lanczos3Fast();
++ else if (method == VS_SCALINGMETHOD_LANCZOS3)
++ Lanczos3();
++ else if (method == VS_SCALINGMETHOD_CUBIC)
++ Bicubic(1.0 / 3.0, 1.0 / 3.0);
++
++ ToIntFract();
++}
++
++CConvolutionKernel::~CConvolutionKernel()
++{
++ delete [] m_floatpixels;
++ delete [] m_intfractpixels;
++}
++
++//generate a lanczos2 kernel which can be loaded with RGBA format
++//each value of RGBA has one tap, so a shader can load 4 taps with a single pixel lookup
++void CConvolutionKernel::Lanczos2()
++{
++ for (int i = 0; i < m_size; i++)
++ {
++ double x = (double)i / (double)m_size;
++
++ //generate taps
++ for (int j = 0; j < 4; j++)
++ m_floatpixels[i * 4 + j] = (float)LanczosWeight(x + (double)(j - 2), 2.0);
++
++ //any collection of 4 taps added together needs to be exactly 1.0
++ //for lanczos this is not always the case, so we take each collection of 4 taps
++ //and divide those taps by the sum of the taps
++ float weight = 0.0;
++ for (int j = 0; j < 4; j++)
++ weight += m_floatpixels[i * 4 + j];
++
++ for (int j = 0; j < 4; j++)
++ m_floatpixels[i * 4 + j] /= weight;
++ }
++}
++
++//generate a lanczos3 kernel which can be loaded with RGBA format
++//each value of RGBA has one tap, so a shader can load 4 taps with a single pixel lookup
++//the two outer lobes of the lanczos3 kernel are added to the two lobes one step to the middle
++//this basically looks the same as lanczos3, but the kernel only has 4 taps,
++//so it can use the 4x4 convolution shader which is twice as fast as the 6x6 one
++void CConvolutionKernel::Lanczos3Fast()
++{
++ for (int i = 0; i < m_size; i++)
++ {
++ double a = 3.0;
++ double x = (double)i / (double)m_size;
++
++ //generate taps
++ m_floatpixels[i * 4 + 0] = (float)(LanczosWeight(x - 2.0, a) + LanczosWeight(x - 3.0, a));
++ m_floatpixels[i * 4 + 1] = (float) LanczosWeight(x - 1.0, a);
++ m_floatpixels[i * 4 + 2] = (float) LanczosWeight(x , a);
++ m_floatpixels[i * 4 + 3] = (float)(LanczosWeight(x + 1.0, a) + LanczosWeight(x + 2.0, a));
++
++ //any collection of 4 taps added together needs to be exactly 1.0
++ //for lanczos this is not always the case, so we take each collection of 4 taps
++ //and divide those taps by the sum of the taps
++ float weight = 0.0;
++ for (int j = 0; j < 4; j++)
++ weight += m_floatpixels[i * 4 + j];
++
++ for (int j = 0; j < 4; j++)
++ m_floatpixels[i * 4 + j] /= weight;
++ }
++}
++
++//generate a lanczos3 kernel which can be loaded with RGBA format
++//each value of RGB has one tap, so a shader can load 3 taps with a single pixel lookup
++void CConvolutionKernel::Lanczos3()
++{
++ for (int i = 0; i < m_size; i++)
++ {
++ double x = (double)i / (double)m_size;
++
++ //generate taps
++ for (int j = 0; j < 3; j++)
++ m_floatpixels[i * 4 + j] = (float)LanczosWeight(x * 2.0 + (double)(j * 2 - 3), 3.0);
++
++ m_floatpixels[i * 4 + 3] = 0.0;
++ }
++
++ //any collection of 6 taps added together needs to be exactly 1.0
++ //for lanczos this is not always the case, so we take each collection of 6 taps
++ //and divide those taps by the sum of the taps
++ for (int i = 0; i < m_size / 2; i++)
++ {
++ float weight = 0.0;
++ for (int j = 0; j < 3; j++)
++ {
++ weight += m_floatpixels[i * 4 + j];
++ weight += m_floatpixels[(i + m_size / 2) * 4 + j];
++ }
++ for (int j = 0; j < 3; j++)
++ {
++ m_floatpixels[i * 4 + j] /= weight;
++ m_floatpixels[(i + m_size / 2) * 4 + j] /= weight;
++ }
++ }
++}
++
++//generate a bicubic kernel which can be loaded with RGBA format
++//each value of RGBA has one tap, so a shader can load 4 taps with a single pixel lookup
++void CConvolutionKernel::Bicubic(double B, double C)
++{
++ for (int i = 0; i < m_size; i++)
++ {
++ double x = (double)i / (double)m_size;
++
++ //generate taps
++ for (int j = 0; j < 4; j++)
++ m_floatpixels[i * 4 + j] = (float)BicubicWeight(x + (double)(j - 2), B, C);
++ }
++}
++
++double CConvolutionKernel::LanczosWeight(double x, double radius)
++{
++ double ax = fabs(x);
++
++ if (ax == 0.0)
++ return 1.0;
++ else if (ax < radius)
++ return SINC(ax) * SINC(ax / radius);
++ else
++ return 0.0;
++}
++
++double CConvolutionKernel::BicubicWeight(double x, double B, double C)
++{
++ double ax = fabs(x);
++
++ if (ax<1.0)
++ {
++ return ((12 - 9*B - 6*C) * ax * ax * ax +
++ (-18 + 12*B + 6*C) * ax * ax +
++ (6 - 2*B))/6;
++ }
++ else if (ax<2.0)
++ {
++ return ((-B - 6*C) * ax * ax * ax +
++ (6*B + 30*C) * ax * ax + (-12*B - 48*C) *
++ ax + (8*B + 24*C)) / 6;
++ }
++ else
++ {
++ return 0.0;
++ }
++}
++
++
++//convert float to high byte/low byte, so the kernel can be loaded into an 8 bit texture
++//with height 2 and converted back to real float in the shader
++//it only works when the kernel texture uses nearest neighbour, but there's almost no difference
++//between that and linear interpolation
++void CConvolutionKernel::ToIntFract()
++{
++ m_intfractpixels = new uint8_t[m_size * 8];
++
++ for (int i = 0; i < m_size * 4; i++)
++ {
++ int value = MathUtils::round_int((m_floatpixels[i] + 1.0) / 2.0 * 65535.0);
++ if (value < 0)
++ value = 0;
++ else if (value > 65535)
++ value = 65535;
++
++ int integer = value / 256;
++ int fract = value % 256;
++
++ m_intfractpixels[i] = (uint8_t)integer;
++ m_intfractpixels[i + m_size * 4] = (uint8_t)fract;
++ }
++
++#if 0
++ for (int i = 0; i < 4; i++)
++ {
++ for (int j = 0; j < m_size; j++)
++ {
++ printf("%i %f %f\n",
++ i * m_size + j,
++ ((double)m_intfractpixels[j * 4 + i] + (double)m_intfractpixels[j * 4 + i + m_size * 4] / 255.0) / 255.0 * 2.0 - 1.0,
++ m_floatpixels[j * 4 + i]);
++ }
++ }
++#endif
++}
++
+--- xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h
++++ xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h
+@@ -4,6 +4,7 @@
+ #ifdef HAS_GL
+
+ #include "../../../../guilib/Shader.h"
++#include "../../../settings/VideoSettings.h"
+
+ using namespace Shaders;
+
+@@ -35,7 +36,7 @@
+ class BicubicFilterShader : public BaseVideoFilterShader
+ {
+ public:
+- BicubicFilterShader(float B=0.0f, float C=0.0f);
++ BicubicFilterShader(float B=-1.0f, float C=-1.0f);
+ void OnCompiledAndLinked();
+ bool OnEnabled();
+ void Free();
+@@ -55,6 +56,25 @@
+ float m_C;
+ };
+
++ class ConvolutionFilterShader : public BaseVideoFilterShader
++ {
++ public:
++ ConvolutionFilterShader(ESCALINGMETHOD method);
++ void OnCompiledAndLinked();
++ bool OnEnabled();
++ void Free();
++
++ protected:
++ // kernel textures
++ GLuint m_kernelTex1;
++
++ // shader handles to kernel textures
++ GLint m_hKernTex;
++
++ ESCALINGMETHOD m_method;
++ bool m_floattex; //if float textures are supported
++ };
++
+ } // end namespace
+
+ #endif
+--- xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.h
++++ xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.h
+@@ -0,0 +1,55 @@
++/*
++ * Copyright (C) 2005-2008 Team XBMC
++ * http://www.xbmc.org
++ *
++ * This Program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This Program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with XBMC; see the file COPYING. If not, write to
++ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
++ * http://www.gnu.org/copyleft/gpl.html
++ *
++ */
++
++#ifndef CONVOLUTIONKERNELS
++#define CONVOLUTIONKERNELS
++
++#include "system.h"
++#include "../../../settings/VideoSettings.h"
++
++class CConvolutionKernel
++{
++ public:
++ CConvolutionKernel(ESCALINGMETHOD method, int size);
++ ~CConvolutionKernel();
++
++ int GetSize() { return m_size; }
++ float* GetFloatPixels() { return m_floatpixels; }
++ uint8_t* GetIntFractPixels() { return m_intfractpixels; }
++
++ private:
++
++ void Lanczos2();
++ void Lanczos3Fast();
++ void Lanczos3();
++ void Bicubic(double B, double C);
++
++ double LanczosWeight(double x, double radius);
++ double BicubicWeight(double x, double B, double C);
++
++ void ToIntFract();
++
++ int m_size;
++ float* m_floatpixels;
++ uint8_t* m_intfractpixels;
++};
++
++#endif //CONVOLUTIONKERNELS
+--- xbmc/cores/VideoRenderers/VideoShaders/Makefile
++++ xbmc/cores/VideoRenderers/VideoShaders/Makefile
+@@ -1,5 +1,5 @@
+ INCLUDES=-I. -I.. -I../../ -I../../../ -I../../../linux -I../../../../guilib
+-SRCS=YUV2RGBShader.cpp VideoFilterShader.cpp
++SRCS=YUV2RGBShader.cpp VideoFilterShader.cpp ConvolutionKernels.cpp
+
+ LIB=VideoShaders.a
+
+--- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
++++ xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
+@@ -886,6 +886,19 @@
+
+ VerifyGLState();
+
++ if (m_scalingMethod == VS_SCALINGMETHOD_AUTO)
++ {
++ bool scaleSD = (int)m_sourceWidth < m_upscalingWidth && (int)m_sourceHeight < m_upscalingHeight &&
++ m_sourceHeight < 720 && m_sourceWidth < 1280;
++
++ if (Supports(VS_SCALINGMETHOD_VDPAU_HARDWARE))
++ m_scalingMethod = VS_SCALINGMETHOD_VDPAU_HARDWARE;
++ else if (Supports(VS_SCALINGMETHOD_LANCZOS3_FAST) && scaleSD)
++ m_scalingMethod = VS_SCALINGMETHOD_LANCZOS3_FAST;
++ else
++ m_scalingMethod = VS_SCALINGMETHOD_LINEAR;
++ }
++
+ switch (m_scalingMethod)
+ {
+ case VS_SCALINGMETHOD_NEAREST:
+@@ -898,13 +911,10 @@
+ m_renderQuality = RQ_SINGLEPASS;
+ return;
+
++ case VS_SCALINGMETHOD_LANCZOS2:
++ case VS_SCALINGMETHOD_LANCZOS3_FAST:
++ case VS_SCALINGMETHOD_LANCZOS3:
+ case VS_SCALINGMETHOD_CUBIC:
+- if(!glewIsSupported("GL_ARB_texture_float"))
+- {
+- CLog::Log(LOGERROR, "GL: hardware doesn't support GL_ARB_texture_float");
+- break;
+- }
+-
+ if (!m_fbo.Initialize())
+ {
+ CLog::Log(LOGERROR, "GL: Error initializing FBO");
+@@ -917,7 +927,7 @@
+ break;
+ }
+
+- m_pVideoFilterShader = new BicubicFilterShader(0.3f, 0.3f);
++ m_pVideoFilterShader = new ConvolutionFilterShader(m_scalingMethod);
+ if (!m_pVideoFilterShader->CompileAndLink())
+ {
+ CLog::Log(LOGERROR, "GL: Error compiling and linking video filter shader");
+@@ -928,8 +938,6 @@
+ m_renderQuality = RQ_MULTIPASS;
+ return;
+
+- case VS_SCALINGMETHOD_LANCZOS2:
+- case VS_SCALINGMETHOD_LANCZOS3:
+ case VS_SCALINGMETHOD_SINC8:
+ case VS_SCALINGMETHOD_NEDI:
+ CLog::Log(LOGERROR, "GL: TODO: This scaler has not yet been implemented");
+@@ -1895,16 +1903,19 @@
+ bool CLinuxRendererGL::Supports(ESCALINGMETHOD method)
+ {
+ if(method == VS_SCALINGMETHOD_NEAREST
+- || method == VS_SCALINGMETHOD_LINEAR)
++ || method == VS_SCALINGMETHOD_LINEAR
++ || method == VS_SCALINGMETHOD_AUTO)
+ return true;
+
+-
+- if(method == VS_SCALINGMETHOD_CUBIC
+- && glewIsSupported("GL_ARB_texture_float")
+- && glewIsSupported("GL_EXT_framebuffer_object")
+- && m_renderMethod == RENDER_GLSL)
+- return true;
+-
++ if(method == VS_SCALINGMETHOD_CUBIC
++ || method == VS_SCALINGMETHOD_LANCZOS2
++ || method == VS_SCALINGMETHOD_LANCZOS3_FAST
++ || method == VS_SCALINGMETHOD_LANCZOS3)
++ {
++ if (glewIsSupported("GL_EXT_framebuffer_object") && (m_renderMethod & RENDER_GLSL))
++ return true;
++ }
++
+ if (g_advancedSettings.m_videoHighQualityScaling != SOFTWARE_UPSCALING_DISABLED)
+ {
+ if(method == VS_SCALINGMETHOD_BICUBIC_SOFTWARE
+--- xbmc/GUIDialogVideoSettings.cpp
++++ xbmc/GUIDialogVideoSettings.cpp
+@@ -103,6 +103,7 @@
+ entries.push_back(make_pair(VS_SCALINGMETHOD_LINEAR , 16302));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_CUBIC , 16303));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS2 , 16304));
++ entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS3_FAST , 16315));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS3 , 16305));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_SINC8 , 16306));
+ // entries.push_back(make_pair(VS_SCALINGMETHOD_NEDI , ?????));
+@@ -110,6 +111,7 @@
+ entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS_SOFTWARE , 16308));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_SINC_SOFTWARE , 16309));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_VDPAU_HARDWARE , 13120));
++ entries.push_back(make_pair(VS_SCALINGMETHOD_AUTO , 16316));
+
+ /* remove unsupported methods */
+ for(vector<pair<int, int> >::iterator it = entries.begin(); it != entries.end();)
+--- xbmc/Settings.cpp
++++ xbmc/Settings.cpp
+@@ -772,7 +772,7 @@
+ GetInteger(pElement, "interlacemethod", interlaceMethod, VS_INTERLACEMETHOD_NONE, VS_INTERLACEMETHOD_NONE, VS_INTERLACEMETHOD_INVERSE_TELECINE);
+ m_stSettings.m_defaultVideoSettings.m_InterlaceMethod = (EINTERLACEMETHOD)interlaceMethod;
+ int scalingMethod;
+- GetInteger(pElement, "scalingmethod", scalingMethod, VS_SCALINGMETHOD_LINEAR, VS_SCALINGMETHOD_NEAREST, VS_SCALINGMETHOD_CUBIC);
++ GetInteger(pElement, "scalingmethod", scalingMethod, VS_SCALINGMETHOD_LINEAR, VS_SCALINGMETHOD_NEAREST, VS_SCALINGMETHOD_AUTO);
+ m_stSettings.m_defaultVideoSettings.m_ScalingMethod = (ESCALINGMETHOD)scalingMethod;
+
+ GetInteger(pElement, "viewmode", m_stSettings.m_defaultVideoSettings.m_ViewMode, VIEW_MODE_NORMAL, VIEW_MODE_NORMAL, VIEW_MODE_CUSTOM);
diff --git a/extra/xbmc/xbmc-9.11-wavpack.patch b/extra/xbmc/xbmc-9.11-wavpack.patch
new file mode 100644
index 000000000..4ef0d147f
--- /dev/null
+++ b/extra/xbmc/xbmc-9.11-wavpack.patch
@@ -0,0 +1,44 @@
+fix from upstream trunk
+
+http://xbmc.org/trac/ticket/8185
+
+Index: trunk/xbmc/cores/paplayer/DllWAVPack.h
+===================================================================
+--- trunk/xbmc/cores/paplayer/DllWAVPack.h (revision 22927)
++++ trunk/xbmc/cores/paplayer/DllWAVPack.h (revision 25321)
+@@ -58,7 +58,7 @@
+ virtual int WavpackGetReducedChannels (WavpackContext *wpc)=0;
+ virtual int WavpackGetFloatNormExp (WavpackContext *wpc)=0;
+- virtual int WavpackGetMD5Sum (WavpackContext *wpc, uchar data [16])=0;
++ virtual int WavpackGetMD5Sum (WavpackContext *wpc, unsigned char data [16])=0;
+ virtual uint32_t WavpackGetWrapperBytes (WavpackContext *wpc)=0;
+- virtual uchar *WavpackGetWrapperData (WavpackContext *wpc)=0;
++ virtual unsigned char *WavpackGetWrapperData (WavpackContext *wpc)=0;
+ virtual void WavpackFreeWrapper (WavpackContext *wpc)=0;
+ virtual void WavpackSeekTrailingWrapper (WavpackContext *wpc)=0;
+@@ -77,5 +77,5 @@
+ virtual int WavpackSetConfiguration (WavpackContext *wpc, WavpackConfig *config, uint32_t total_samples)=0;
+ virtual int WavpackAddWrapper (WavpackContext *wpc, void *data, uint32_t bcount)=0;
+- virtual int WavpackStoreMD5Sum (WavpackContext *wpc, uchar data [16])=0;
++ virtual int WavpackStoreMD5Sum (WavpackContext *wpc, unsigned char data [16])=0;
+ virtual int WavpackPackInit (WavpackContext *wpc)=0;
+ virtual int WavpackPackSamples (WavpackContext *wpc, int32_t *sample_buffer, uint32_t sample_count)=0;
+@@ -133,9 +133,9 @@
+ virtual int WavpackGetFloatNormExp (WavpackContext *wpc)
+ { return ::WavpackGetFloatNormExp (wpc); }
+- virtual int WavpackGetMD5Sum (WavpackContext *wpc, uchar data [16])
++ virtual int WavpackGetMD5Sum (WavpackContext *wpc, unsigned char data [16])
+ { return ::WavpackGetMD5Sum (wpc, data); }
+ virtual uint32_t WavpackGetWrapperBytes (WavpackContext *wpc)
+ { return ::WavpackGetWrapperBytes (wpc); }
+- virtual uchar *WavpackGetWrapperData (WavpackContext *wpc)
++ virtual unsigned char *WavpackGetWrapperData (WavpackContext *wpc)
+ { return ::WavpackGetWrapperData (wpc); }
+ virtual void WavpackFreeWrapper (WavpackContext *wpc)
+@@ -171,5 +171,5 @@
+ virtual int WavpackAddWrapper (WavpackContext *wpc, void *data, uint32_t bcount)
+ { return ::WavpackAddWrapper (wpc, data, bcount); }
+- virtual int WavpackStoreMD5Sum (WavpackContext *wpc, uchar data [16])
++ virtual int WavpackStoreMD5Sum (WavpackContext *wpc, unsigned char data [16])
+ { return ::WavpackStoreMD5Sum (wpc, data); }
+ virtual int WavpackPackInit (WavpackContext *wpc)
diff --git a/extra/xbmc/xbmc.install b/extra/xbmc/xbmc.install
new file mode 100644
index 000000000..1b31c026f
--- /dev/null
+++ b/extra/xbmc/xbmc.install
@@ -0,0 +1,11 @@
+post_install() {
+ echo ">> If XBMC won't start, but just segfaults, double check your X.Org config"
+ echo ">> so that your display depth is at least 24-bit. Eg: change "
+ echo ">> \"DefaultDepth 16\" under the \"Screen\" section so it says 24 instead"
+ echo ">> of 16."
+ echo " "
+ echo ">> PM3.HD skin got removed"
+ echo ">> xbmc basedir is now /opt/xbmc !!!"
+ echo ">> keep above in mind for your skins"
+ /bin/true
+}