From 8ced51bcba2796ad5066503d47f84ae921dbd0f3 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Fri, 14 Dec 2012 09:09:27 -0600
Subject: projectx: 0.91

---
 abs/extra/projectx/IDCTFast.patch | 86 +++++++++++++++++++++++++++++++++++++++
 abs/extra/projectx/PKGBUILD       | 57 ++++++++++++++++++++++++++
 abs/extra/projectx/projectx       | 10 +++++
 3 files changed, 153 insertions(+)
 create mode 100644 abs/extra/projectx/IDCTFast.patch
 create mode 100644 abs/extra/projectx/PKGBUILD
 create mode 100644 abs/extra/projectx/projectx

diff --git a/abs/extra/projectx/IDCTFast.patch b/abs/extra/projectx/IDCTFast.patch
new file mode 100644
index 0000000..70487bf
--- /dev/null
+++ b/abs/extra/projectx/IDCTFast.patch
@@ -0,0 +1,86 @@
+diff -ru Project-X_0.91.0//noguisources.lst Project-X_0.91.0.new/noguisources.lst
+--- Project-X_0.91.0//noguisources.lst	2011-03-27 15:48:48.000000000 +0200
++++ Project-X_0.91.0.new/noguisources.lst	2011-04-09 16:54:28.886676016 +0200
+@@ -67,6 +67,7 @@
+ src/net/sourceforge/dvb/projectx/video/IDCTRefNative.java
+ src/net/sourceforge/dvb/projectx/video/IDCTSseNative.java
+ src/net/sourceforge/dvb/projectx/video/MpvDecoder.java
++src/net/sourceforge/dvb/projectx/video/IDCTFast.java
+ src/net/sourceforge/dvb/projectx/video/Preview.java
+ src/net/sourceforge/dvb/projectx/video/PreviewObject.java
+ src/net/sourceforge/dvb/projectx/video/Video.java
+Binary files Project-X_0.91.0//ProjectX.jar and Project-X_0.91.0.new/ProjectX.jar differ
+diff -ru Project-X_0.91.0//sources.lst Project-X_0.91.0.new/sources.lst
+--- Project-X_0.91.0//sources.lst	2011-03-27 15:02:42.000000000 +0200
++++ Project-X_0.91.0.new/sources.lst	2011-04-09 16:54:12.916676017 +0200
+@@ -67,6 +67,7 @@
+ src/net/sourceforge/dvb/projectx/video/IDCTRefNative.java
+ src/net/sourceforge/dvb/projectx/video/IDCTSseNative.java
+ src/net/sourceforge/dvb/projectx/video/MpvDecoder.java
++src/net/sourceforge/dvb/projectx/video/IDCTFast.java
+ src/net/sourceforge/dvb/projectx/video/Preview.java
+ src/net/sourceforge/dvb/projectx/video/PreviewObject.java
+ src/net/sourceforge/dvb/projectx/video/Video.java
+diff -ru Project-X_0.91.0//src/net/sourceforge/dvb/projectx/video/MpvDecoder.java Project-X_0.91.0.new/src/net/sourceforge/dvb/projectx/video/MpvDecoder.java
+--- Project-X_0.91.0//src/net/sourceforge/dvb/projectx/video/MpvDecoder.java	2011-03-27 15:01:38.000000000 +0200
++++ Project-X_0.91.0.new/src/net/sourceforge/dvb/projectx/video/MpvDecoder.java	2011-04-09 16:51:16.936676017 +0200
+@@ -74,6 +74,7 @@
+ 
+ 	private IDCTRefNative idct;
+ 	private IDCTSseNative idctsse;
++	private IDCTFast      idctfast;
+ 
+ 	private int preview_horizontal_size = 512;
+ 	private int preview_vertical_size = 288;
+@@ -133,14 +134,20 @@
+ 	public MpvDecoder()
+ 	{
+ 		Arrays.fill(pixels2, 0xFF505050);
++		idctfast = new IDCTFast();
+ 
+ 		idct = new IDCTRefNative();
+ 		idctsse = new IDCTSseNative();
++		if (IDCTFast.isLibraryLoaded())
++		    idctfast.init();
++		
+ 
+ 		if (IDCTRefNative.isLibraryLoaded())
+ 			idct.init();
+ 
+-		if (IDCTRefNative.isLibraryLoaded() || IDCTSseNative.isLibraryLoaded())
++               if (IDCTFast.isLibraryLoaded()
++                   || IDCTRefNative.isLibraryLoaded()
++                   || IDCTSseNative.isLibraryLoaded())
+ 			acceleration = true;
+ 	}
+ 
+@@ -2394,7 +2401,21 @@
+ 			//form_predictions(bx, by, macroblock_type, motion_type, PMV, motion_vertical_field_select, dmvector);
+ 
+ 
+-		if (IDCTSseNative.isLibraryLoaded() && isAccelerated())
++       if (IDCTFast.isLibraryLoaded() && isAccelerated())
++       {
++               /* copy or add block data into picture */
++               for (comp=0; comp<block_count; comp++)
++               {
++                       /* ISO/IEC 13818-2 section Annex A: inverse DCT */
++                       idctfast.referenceIDCT(block[comp]);
++ 
++                       /* ISO/IEC 13818-2 section 7.6.8: Adding prediction and coefficient data */
++                       Add_Block(comp, bx, by, dct_type, (macroblock_type[0] & MACROBLOCK_INTRA)==0);
++               }
++       }
++ 
++ 
++       else if (IDCTSseNative.isLibraryLoaded() && isAccelerated())
+ 		{
+ 			/* copy or add block data into picture */
+ 			for (comp=0; comp<block_count; comp++)
+@@ -3913,4 +3934,4 @@
+ ///
+ 
+ 
+-}
+\ No newline at end of file
++}
diff --git a/abs/extra/projectx/PKGBUILD b/abs/extra/projectx/PKGBUILD
new file mode 100644
index 0000000..758df7c
--- /dev/null
+++ b/abs/extra/projectx/PKGBUILD
@@ -0,0 +1,57 @@
+# Contributer: Sebastian Sareyko <public@nooms.de>
+#
+# It is possible to choose the idct implementation
+# Available are:
+# 
+# none               use ProjectX Java implementation
+# idct               the C implementation of the source from ProjectX
+# idct-ffmpeg        taken from the ffmpeg Project
+# idct-mjpeg         taken from MJPEGTOOLS 1.8.0
+# idct-mjpeg-mmx     taken from MJPEGTOOLS 1.8.0
+#
+_idct=idct-mjpeg-mmx
+
+pkgname=projectx
+pkgver=0.91.0
+pkgrel=5
+license=('GPL')
+arch=('i686' 'x86_64')
+pkgdesc="DVB demux tool for repairing and analyzing different stream types"
+makedepends=('java-environment')
+depends=('java-runtime')
+url="http://sourceforge.net/projects/project-x"
+source=(http://downloads.sourceforge.net/sourceforge/project-x/ProjectX_$pkgver.zip \
+        IDCTFast.patch
+	projectx)
+
+md5sums=('5cf7bb227abe2c16d34e8e9c84915291'
+         '364022b37a55643fd8ec8d042827c3c9'
+         '0bb5dfb7683babb91f7fc996f5de7f2d')
+build() {
+    cd ${srcdir}
+    cd Project-X_0.91.0/
+    if [ ${_idct} != "none" ]; then
+       patch -p1 < ${srcdir}/IDCTFast.patch
+       unzip lib/Linux/ProjectX_Source_0.90.4-portable.zip
+       cp ProjectX_Source_0.90.4/src/net/sourceforge/dvb/projectx/video/IDCTFast.java src/net/sourceforge/dvb/projectx/video/
+    fi
+    sh ./build.sh
+    if [ ${_idct} != "none" ]; then
+       cd ProjectX_Source_0.90.4/lib/PORTABLE/
+       make clean
+       make PROJECTX_HOME=${srcdir}/Project-X_0.91.0 IDCT=${_idct} CPLAT="$CFLAGS -fPIC"
+       cd ${srcdir}/Project-X_0.91.0
+    fi
+    install -D -m0755 $startdir/projectx $startdir/pkg/usr/bin/projectx
+    install -D -m0644 ProjectX.jar $startdir/pkg/opt/projectx/ProjectX.jar
+    if [ ${_idct} != "none" ]; then
+       install -D -m0644 ProjectX_Source_0.90.4/lib/PORTABLE/libidctfast.so \
+            $startdir/pkg/opt/projectx/lib/libidctfast.so
+    fi
+    install -D -m0644 lib/commons-net-1.3.0.jar \
+             $startdir/pkg/opt/projectx/lib/commons-net-1.3.0.jar
+    install -D -m0644 lib/jakarta-oro-2.0.8.jar \
+             $startdir/pkg/opt/projectx/lib/jakarta-oro-2.0.8.jar
+    sed -i -e 's#Exec=java -jar /usr/share/projectx/ProjectX.jar#Exec=/usr/bin/projectx#' projectx.desktop
+    install -D -m0644 projectx.desktop $startdir/pkg/usr/share/applications/projectx.desktop
+}
diff --git a/abs/extra/projectx/projectx b/abs/extra/projectx/projectx
new file mode 100644
index 0000000..1418831
--- /dev/null
+++ b/abs/extra/projectx/projectx
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ ! -d ~/.projectx ] ; then
+        mkdir ~/.projectx
+fi
+
+if [ "$#" -eq 0 ] ; then
+	cd ~/.projectx 
+fi
+java -Djava.library.path=/opt/projectx/lib -jar /opt/projectx/ProjectX.jar "$@"
-- 
cgit v0.12

