summaryrefslogtreecommitdiff
path: root/multimedia/libmpeg3
diff options
context:
space:
mode:
Diffstat (limited to 'multimedia/libmpeg3')
-rw-r--r--multimedia/libmpeg3/DESCR12
-rw-r--r--multimedia/libmpeg3/Makefile64
-rw-r--r--multimedia/libmpeg3/PLIST27
-rw-r--r--multimedia/libmpeg3/buildlink3.mk20
-rw-r--r--multimedia/libmpeg3/distinfo12
-rw-r--r--multimedia/libmpeg3/patches/patch-aa22
-rw-r--r--multimedia/libmpeg3/patches/patch-ab13
-rw-r--r--multimedia/libmpeg3/patches/patch-ac19
-rw-r--r--multimedia/libmpeg3/patches/patch-ad22
-rw-r--r--multimedia/libmpeg3/patches/patch-ae55
-rw-r--r--multimedia/libmpeg3/patches/patch-af22
-rw-r--r--multimedia/libmpeg3/patches/patch-ag45
-rw-r--r--multimedia/libmpeg3/patches/patch-ah310
13 files changed, 643 insertions, 0 deletions
diff --git a/multimedia/libmpeg3/DESCR b/multimedia/libmpeg3/DESCR
new file mode 100644
index 00000000000..ca31a820815
--- /dev/null
+++ b/multimedia/libmpeg3/DESCR
@@ -0,0 +1,12 @@
+Libmpeg3 decodes
+ MPEG-1 Layer II Audio
+ MPEG-1 Layer III Audio
+ MPEG-2 Layer III Audio
+ MPEG-1 program streams
+ MPEG-2 program streams
+ MPEG-2 transport streams
+ AC3 Audio
+ MPEG-2 Video
+ MPEG-1 Video
+ IFO files
+ VOB files
diff --git a/multimedia/libmpeg3/Makefile b/multimedia/libmpeg3/Makefile
new file mode 100644
index 00000000000..b5cc6eb3bdb
--- /dev/null
+++ b/multimedia/libmpeg3/Makefile
@@ -0,0 +1,64 @@
+# $NetBSD: Makefile,v 1.1 2004/06/26 18:00:21 grant Exp $
+#
+
+DISTNAME= libmpeg3-1.3
+PKGREVISION= 4
+CATEGORIES= devel audio graphics multimedia
+MASTER_SITES= http://heroines.sourceforge.net/
+
+MAINTAINER= tech-pkg@NetBSD.org
+HOMEPAGE= http://heroines.sourceforge.net/libmpeg3.php3
+COMMENT= MPEG decoding library
+
+.if (${MACHINE_ARCH} == "i386")
+BUILD_DEPENDS+= nasm-[0-9]*:../../devel/nasm
+.else
+CONFIGURE_ARGS+= --no-mmx --no-css
+.endif
+
+USE_BUILDLINK3= yes
+HAS_CONFIGURE= yes
+USE_GNU_TOOLS+= make
+
+ONLY_FOR_COMPILER= gcc
+
+PTHREAD_OPTS+= require
+
+post-configure:
+ ${ECHO} "CFLAGS+=-O2" >>${WRKSRC}/global_config
+ ${ECHO} "CFLAGS+=-I${BUILDLINK_DIR}/include" >>${WRKSRC}/global_config
+ ${ECHO} "CFLAGS+=-D_FILE_OFFSET_BITS=64" >>${WRKSRC}/global_config
+
+INSTHDRS= bitstream.h libmpeg3.h mpeg3atrack.h mpeg3css.h \
+ mpeg3demux.h mpeg3io.h mpeg3private.h \
+ mpeg3private.inc mpeg3title.h mpeg3vtrack.h timecode.h
+AINSTHDRS= ac3.h mpeg3audio.h
+VINSTHDRS= idct.h mpeg3video.h slice.h
+INSTBINS= mpeg3cat mpeg3toc mpeg3split
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/work/dump ${PREFIX}/bin/mpeg3dump
+ for f in ${INSTBINS}; do \
+ ${INSTALL_PROGRAM} ${WRKSRC}/work/$$f ${PREFIX}/bin; \
+ done
+ ${INSTALL_DATA_DIR} ${PREFIX}/include/mpeg3
+ for f in ${INSTHDRS}; do \
+ ${INSTALL_DATA} ${WRKSRC}/$$f ${PREFIX}/include/mpeg3; \
+ done
+ ${INSTALL_DATA_DIR} ${PREFIX}/include/mpeg3/audio
+ for f in ${AINSTHDRS}; do \
+ ${INSTALL_DATA} ${WRKSRC}/audio/$$f \
+ ${PREFIX}/include/mpeg3/audio; \
+ done
+ ${INSTALL_DATA_DIR} ${PREFIX}/include/mpeg3/video
+ for f in ${VINSTHDRS}; do \
+ ${INSTALL_DATA} ${WRKSRC}/video/$$f \
+ ${PREFIX}/include/mpeg3/video; \
+ done
+ ${INSTALL_DATA} ${WRKSRC}/work/libmpeg3.a ${PREFIX}/lib
+ ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/html/libmpeg3
+ ${INSTALL_DATA} ${WRKSRC}/docs/index.html \
+ ${PREFIX}/share/doc/html/libmpeg3
+
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/multimedia/libmpeg3/PLIST b/multimedia/libmpeg3/PLIST
new file mode 100644
index 00000000000..99fa16ab8f6
--- /dev/null
+++ b/multimedia/libmpeg3/PLIST
@@ -0,0 +1,27 @@
+@comment $NetBSD: PLIST,v 1.1 2004/06/26 18:00:21 grant Exp $
+include/mpeg3/libmpeg3.h
+bin/mpeg3dump
+bin/mpeg3cat
+bin/mpeg3toc
+bin/mpeg3split
+include/mpeg3/bitstream.h
+include/mpeg3/mpeg3atrack.h
+include/mpeg3/mpeg3css.h
+include/mpeg3/mpeg3demux.h
+include/mpeg3/mpeg3io.h
+include/mpeg3/mpeg3private.h
+include/mpeg3/mpeg3private.inc
+include/mpeg3/mpeg3title.h
+include/mpeg3/mpeg3vtrack.h
+include/mpeg3/timecode.h
+include/mpeg3/audio/ac3.h
+include/mpeg3/audio/mpeg3audio.h
+include/mpeg3/video/idct.h
+include/mpeg3/video/mpeg3video.h
+include/mpeg3/video/slice.h
+lib/libmpeg3.a
+share/doc/html/libmpeg3/index.html
+@dirrm include/mpeg3/audio
+@dirrm include/mpeg3/video
+@dirrm include/mpeg3
+@dirrm share/doc/html/libmpeg3
diff --git a/multimedia/libmpeg3/buildlink3.mk b/multimedia/libmpeg3/buildlink3.mk
new file mode 100644
index 00000000000..10aaf508dd5
--- /dev/null
+++ b/multimedia/libmpeg3/buildlink3.mk
@@ -0,0 +1,20 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBMPEG3_BUILDLINK3_MK:= ${LIBMPEG3_BUILDLINK3_MK}+
+
+.if !empty(BUILDLINK_DEPTH:M+)
+BUILDLINK_DEPENDS+= libmpeg3
+.endif
+
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nlibmpeg3}
+BUILDLINK_PACKAGES+= libmpeg3
+
+.if !empty(LIBMPEG3_BUILDLINK3_MK:M+)
+BUILDLINK_DEPENDS.libmpeg3+= libmpeg3>=1.3nb4
+BUILDLINK_PKGSRCDIR.libmpeg3?= ../../multimedia/libmpeg3
+.endif # LIBMPEG3_BUILDLINK3_MK
+
+.include "../../mk/pthread.buildlink3.mk"
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/multimedia/libmpeg3/distinfo b/multimedia/libmpeg3/distinfo
new file mode 100644
index 00000000000..cbf0204a06a
--- /dev/null
+++ b/multimedia/libmpeg3/distinfo
@@ -0,0 +1,12 @@
+$NetBSD: distinfo,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+SHA1 (libmpeg3-1.3.tar.gz) = e7e8b03ab45d5593558b0d19e31f0694cfdfa2b5
+Size (libmpeg3-1.3.tar.gz) = 154062 bytes
+SHA1 (patch-aa) = a5665a330234b964aca00a5c4c6f00a9f1bd11ff
+SHA1 (patch-ab) = 844cfcbd99269f1f0b4bef76e0a8567522070707
+SHA1 (patch-ac) = fa32047a70936d0ab81100a4f4b3b0ccdcd3a708
+SHA1 (patch-ad) = 86edf9af264370bf89050b02e956b5bacc86881e
+SHA1 (patch-ae) = 55cf13476c59da1844fb4bc2bff7b50a78a6a4f1
+SHA1 (patch-af) = 7e62a236ee0a7398c1b1a3e994261ebb9be50bae
+SHA1 (patch-ag) = bf321ac689b82889ca1a2bb8a96cb6e387280f32
+SHA1 (patch-ah) = 58ffda3df9be3b089de362451ddf249a74fac5be
diff --git a/multimedia/libmpeg3/patches/patch-aa b/multimedia/libmpeg3/patches/patch-aa
new file mode 100644
index 00000000000..d697c21a9e6
--- /dev/null
+++ b/multimedia/libmpeg3/patches/patch-aa
@@ -0,0 +1,22 @@
+$NetBSD: patch-aa,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+--- Makefile.orig Sun May 20 05:05:26 2001
++++ Makefile Tue Jul 31 17:34:17 2001
+@@ -2,7 +2,7 @@
+
+ CFLAGS +=
+
+-OBJDIR = $(shell uname --machine)
++OBJDIR = work
+
+ $(shell sh -c 'if ! test -d $(OBJDIR)\; then \
+ mkdir $(OBJDIR)\; \
+@@ -69,7 +69,7 @@
+
+ OUTPUT = $(OBJDIR)/libmpeg3.a
+ UTILS = $(OBJDIR)/dump $(OBJDIR)/mpeg3cat $(OBJDIR)/mpeg3toc $(OBJDIR)/mpeg3split
+-LIBS = -lm -lpthread
++LIBS = -L${LOCALBASE}/lib -Wl,-R${LOCALBASE}/lib -lm -lpthread
+
+ all: $(OUTPUT) util
+
diff --git a/multimedia/libmpeg3/patches/patch-ab b/multimedia/libmpeg3/patches/patch-ab
new file mode 100644
index 00000000000..1a3e8b09b94
--- /dev/null
+++ b/multimedia/libmpeg3/patches/patch-ab
@@ -0,0 +1,13 @@
+$NetBSD: patch-ab,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+--- mpeg3css.c.orig Tue Jul 31 17:16:17 2001
++++ mpeg3css.c Tue Jul 31 17:16:44 2001
+@@ -45,7 +45,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+-#include <linux/cdrom.h>
++#include <sys/dvdio.h>
+
+ #ifndef FIBMAP
+ #define FIBMAP _IO(0x00,1) /* bmap access */
diff --git a/multimedia/libmpeg3/patches/patch-ac b/multimedia/libmpeg3/patches/patch-ac
new file mode 100644
index 00000000000..987729d8d3a
--- /dev/null
+++ b/multimedia/libmpeg3/patches/patch-ac
@@ -0,0 +1,19 @@
+$NetBSD: patch-ac,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+--- mpeg3ifo.c.orig Tue Jul 31 17:18:25 2001
++++ mpeg3ifo.c Tue Jul 31 17:18:56 2001
+@@ -1,9 +1,13 @@
+-#include <byteswap.h>
+ #include <dirent.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/types.h>
++
++#include <sys/endian.h>
++#include <machine/bswap.h>
++#define bswap_16(x) bswap16(x)
++#define bswap_32(x) bswap32(x)
+
+ #include "ifo.h"
+ #include "mpeg3private.h"
diff --git a/multimedia/libmpeg3/patches/patch-ad b/multimedia/libmpeg3/patches/patch-ad
new file mode 100644
index 00000000000..549eb529364
--- /dev/null
+++ b/multimedia/libmpeg3/patches/patch-ad
@@ -0,0 +1,22 @@
+$NetBSD: patch-ad,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+--- ifo.h.orig Tue Jul 31 17:19:54 2001
++++ ifo.h Tue Jul 31 17:20:47 2001
+@@ -193,7 +193,7 @@
+ u_char *data[10];
+
+ int fd; // file descriptor
+- __off64_t pos; // offset of ifo file on device
++ off_t pos; // offset of ifo file on device
+ } ifo_t;
+
+
+@@ -221,7 +221,7 @@
+ * Prototypes
+ */
+
+-ifo_t *ifoOpen (int fd, __off64_t pos);
++ifo_t *ifoOpen (int fd, off_t pos);
+ int ifoClose (ifo_t *ifo);
+
+ u_int ifoGetVOBStart (ifo_t *ifo);
diff --git a/multimedia/libmpeg3/patches/patch-ae b/multimedia/libmpeg3/patches/patch-ae
new file mode 100644
index 00000000000..945eb272c37
--- /dev/null
+++ b/multimedia/libmpeg3/patches/patch-ae
@@ -0,0 +1,55 @@
+$NetBSD: patch-ae,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+--- mpeg3io.c.orig 2001-05-20 13:05:26.000000000 +1000
++++ mpeg3io.c 2004-05-04 23:48:36.000000000 +1000
+@@ -1,11 +1,17 @@
+ #include "mpeg3private.h"
+ #include "mpeg3protos.h"
+
+-#include <mntent.h>
+-#include <sys/stat.h>
++#include <sys/param.h>
++#include <sys/mount.h>
+ #include <stdlib.h>
+ #include <string.h>
+
++#ifdef __NetBSD__
++# if __NetBSD_Version__ >= 200040000 /* 2.0D */
++# define statfs statvfs
++# endif
++#endif
++
+ mpeg3_fs_t* mpeg3_new_fs(char *path)
+ {
+ mpeg3_fs_t *fs = calloc(1, sizeof(mpeg3_fs_t));
+@@ -88,27 +94,15 @@
+
+ int mpeg3io_device(char *path, char *device)
+ {
+- struct stat file_st, device_st;
+- struct mntent *mnt;
+- FILE *fp;
++ struct statfs file_st;
+
+- if(stat(path, &file_st) < 0)
++ if(statfs(path, &file_st) < 0)
+ {
+ perror("mpeg3io_device");
+ return 1;
+ }
+
+- fp = setmntent(MOUNTED, "r");
+- while(fp && (mnt = getmntent(fp)))
+- {
+- if(stat(mnt->mnt_fsname, &device_st) < 0) continue;
+- if(device_st.st_rdev == file_st.st_dev)
+- {
+- strncpy(device, mnt->mnt_fsname, MPEG3_STRLEN);
+- break;
+- }
+- }
+- endmntent(fp);
++ strncpy(device, file_st.f_mntfromname, MPEG3_STRLEN);
+
+ return 0;
+ }
diff --git a/multimedia/libmpeg3/patches/patch-af b/multimedia/libmpeg3/patches/patch-af
new file mode 100644
index 00000000000..e890d31e5a9
--- /dev/null
+++ b/multimedia/libmpeg3/patches/patch-af
@@ -0,0 +1,22 @@
+$NetBSD: patch-af,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+--- video/reconstruct.c.orig Tue Jul 31 17:23:42 2001
++++ video/reconstruct.c Tue Jul 31 17:24:52 2001
+@@ -572,7 +572,7 @@
+ }
+ }
+
+-static inline void recv(unsigned char *s, unsigned char *d, int lx, int lx2, int h)
++static inline void xxrecv(unsigned char *s, unsigned char *d, int lx, int lx2, int h)
+ {
+ unsigned char *dp,*sp,*sp2;
+ int j;
+@@ -971,7 +971,7 @@
+ case 0x0: recc(s, d, lx2, h); break;
+ case 0x7: recva(s, d, lx, lx2, h); break;
+ case 0x6: recvac(s, d, lx, lx2, h); break;
+- case 0x5: recv(s, d, lx, lx2, h); break;
++ case 0x5: xxrecv(s, d, lx, lx2, h); break;
+ case 0x4: recvc(s, d, lx, lx2, h); break;
+ case 0x9: rech(s, d, lx2, h); break;
+ case 0x8: rechc(s, d, lx2, h); break;
diff --git a/multimedia/libmpeg3/patches/patch-ag b/multimedia/libmpeg3/patches/patch-ag
new file mode 100644
index 00000000000..2a0f30fefb0
--- /dev/null
+++ b/multimedia/libmpeg3/patches/patch-ag
@@ -0,0 +1,45 @@
+$NetBSD: patch-ag,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+--- video/mmxtest.c.orig Tue Jul 31 19:37:07 2001
++++ video/mmxtest.c Tue Jul 31 19:41:16 2001
+@@ -5,39 +5,9 @@
+
+ int mpeg3_mmx_test()
+ {
+- int result = 0;
+- FILE *proc;
+- char string[MPEG3_STRLEN];
+-
+
+ #ifdef HAVE_MMX
+- if(!(proc = fopen(MPEG3_PROC_CPUINFO, "r")))
+- {
+- fprintf(stderr, "mpeg3_mmx_test: failed to open /proc/cpuinfo\n");
+- return 0;
+- }
+-
+- while(!feof(proc))
+- {
+- fgets(string, MPEG3_STRLEN, proc);
+-/* Got the flags line */
+- if(!strncasecmp(string, "flags", 5))
+- {
+- char *needle;
+- needle = strstr(string, "mmx");
+- if(!needle)
+- {
+- fclose(proc);
+- return 0;
+- }
+- if(!strncasecmp(needle, "mmx", 3))
+- {
+- fclose(proc);
+- return 1;
+- }
+- }
+- }
+- fclose(proc);
++ return (1);
+ #endif
+
+ return 0;
diff --git a/multimedia/libmpeg3/patches/patch-ah b/multimedia/libmpeg3/patches/patch-ah
new file mode 100644
index 00000000000..12035bb0083
--- /dev/null
+++ b/multimedia/libmpeg3/patches/patch-ah
@@ -0,0 +1,310 @@
+$NetBSD: patch-ah,v 1.1 2004/06/26 18:00:21 grant Exp $
+
+--- video/output.c.orig 2001-05-20 13:05:26.000000000 +1000
++++ video/output.c 2003-07-29 00:53:45.000000000 +1000
+@@ -207,50 +207,50 @@
+ );
+ }
+
+-static unsigned long long mpeg3_MMX_U_80 = 0x0000008000800000;
+-static unsigned long long mpeg3_MMX_V_80 = 0x0000000000800080;
+-static long long mpeg3_MMX_U_COEF = 0x00000058ffd30000;
+-static long long mpeg3_MMX_V_COEF = 0x00000000ffea006f;
+-static long long mpeg3_MMX_601_Y_COEF = 0x0000004800480048;
+-static long long mpeg3_MMX_601_Y_DIFF = 0x0000000000000010;
++static unsigned long long mpeg3_MMX_U_80 = 0x0000008000800000LL;
++static unsigned long long mpeg3_MMX_V_80 = 0x0000000000800080LL;
++static long long mpeg3_MMX_U_COEF = 0x00000058ffd30000LL;
++static long long mpeg3_MMX_V_COEF = 0x00000000ffea006fLL;
++static long long mpeg3_MMX_601_Y_COEF = 0x0000004800480048LL;
++static long long mpeg3_MMX_601_Y_DIFF = 0x0000000000000010LL;
+
+ inline void mpeg3_bgra32_mmx(unsigned long y,
+ unsigned long u,
+ unsigned long v,
+ unsigned long *output)
+ {
+-asm("
+-/* Output will be 0x00rrggbb with the 00 trailing so this can also be used */
+-/* for bgr24. */
+- movd (%0), %%mm0; /* Load y 0x00000000000000yy */
+- movd (%1), %%mm1; /* Load u 0x00000000000000cr */
+- movq %%mm0, %%mm3; /* Copy y to temp */
+- psllq $16, %%mm1; /* Shift u 0x0000000000cr0000 */
+- movd (%2), %%mm2; /* Load v 0x00000000000000cb */
+- psllq $16, %%mm3; /* Shift y */
+- movq %%mm1, %%mm4; /* Copy u to temp */
+- por %%mm3, %%mm0; /* Overlay new y byte 0x0000000000yy00yy */
+- psllq $16, %%mm4; /* Shift u */
+- movq %%mm2, %%mm5; /* Copy v to temp */
+- psllq $16, %%mm3; /* Shift y */
+- por %%mm4, %%mm1; /* Overlay new u byte 0x000000cr00cr0000 */
+- psllq $16, %%mm5; /* Shift v */
+- por %%mm3, %%mm0; /* Overlay new y byte 0x000000yy00yy00yy */
+- por %%mm5, %%mm2; /* Overlay new v byte 0x0000000000cb00cb */
+-
+-/* mm0: 0x000000yy00yy00yy mm1: 0x000000uu00uu0000 mm2: 0x0000000000vv00vv */
+- psubw mpeg3_MMX_U_80, %%mm1; /* Subtract 128 from u 0x000000uu00uu0000 */
+- pmullw mpeg3_MMX_U_COEF, %%mm1; /* Multiply u coeffs 0x0000uuuuuuuu0000 */
+- psllw $6, %%mm0; /* Shift y coeffs 0x0000yyy0yyy0yyy0 */
+- psubw mpeg3_MMX_V_80, %%mm2; /* Subtract 128 from v 0x0000000000cb00cb */
+- pmullw mpeg3_MMX_V_COEF, %%mm2; /* Multiply v coeffs 0x0000crcrcrcrcrcr */
+-
+-/* mm0: 0x000000yy00yy00yy mm1: 0x0000uuuuuuuu0000 mm2: 0x00000000vvvvvvvv */
+- paddsw %%mm1, %%mm0; /* Add u to result */
+- paddsw %%mm2, %%mm0; /* Add v to result 0x0000rrrrggggbbbb */
+- psraw $6, %%mm0; /* Demote precision */
+- packuswb %%mm0, %%mm0; /* Pack into ARGB 0x0000000000rrggbb */
+- movd %%mm0, (%3); /* Store output */
++asm("\n\
++/* Output will be 0x00rrggbb with the 00 trailing so this can also be used */\n\
++/* for bgr24. */\n\
++ movd (%0), %%mm0; /* Load y 0x00000000000000yy */\n\
++ movd (%1), %%mm1; /* Load u 0x00000000000000cr */\n\
++ movq %%mm0, %%mm3; /* Copy y to temp */\n\
++ psllq $16, %%mm1; /* Shift u 0x0000000000cr0000 */\n\
++ movd (%2), %%mm2; /* Load v 0x00000000000000cb */\n\
++ psllq $16, %%mm3; /* Shift y */\n\
++ movq %%mm1, %%mm4; /* Copy u to temp */\n\
++ por %%mm3, %%mm0; /* Overlay new y byte 0x0000000000yy00yy */\n\
++ psllq $16, %%mm4; /* Shift u */\n\
++ movq %%mm2, %%mm5; /* Copy v to temp */\n\
++ psllq $16, %%mm3; /* Shift y */\n\
++ por %%mm4, %%mm1; /* Overlay new u byte 0x000000cr00cr0000 */\n\
++ psllq $16, %%mm5; /* Shift v */\n\
++ por %%mm3, %%mm0; /* Overlay new y byte 0x000000yy00yy00yy */\n\
++ por %%mm5, %%mm2; /* Overlay new v byte 0x0000000000cb00cb */\n\
++\n\
++/* mm0: 0x000000yy00yy00yy mm1: 0x000000uu00uu0000 mm2: 0x0000000000vv00vv */\n\
++ psubw mpeg3_MMX_U_80, %%mm1; /* Subtract 128 from u 0x000000uu00uu0000 */\n\
++ pmullw mpeg3_MMX_U_COEF, %%mm1; /* Multiply u coeffs 0x0000uuuuuuuu0000 */\n\
++ psllw $6, %%mm0; /* Shift y coeffs 0x0000yyy0yyy0yyy0 */\n\
++ psubw mpeg3_MMX_V_80, %%mm2; /* Subtract 128 from v 0x0000000000cb00cb */\n\
++ pmullw mpeg3_MMX_V_COEF, %%mm2; /* Multiply v coeffs 0x0000crcrcrcrcrcr */\n\
++\n\
++/* mm0: 0x000000yy00yy00yy mm1: 0x0000uuuuuuuu0000 mm2: 0x00000000vvvvvvvv */\n\
++ paddsw %%mm1, %%mm0; /* Add u to result */\n\
++ paddsw %%mm2, %%mm0; /* Add v to result 0x0000rrrrggggbbbb */\n\
++ psraw $6, %%mm0; /* Demote precision */\n\
++ packuswb %%mm0, %%mm0; /* Pack into ARGB 0x0000000000rrggbb */\n\
++ movd %%mm0, (%3); /* Store output */\n\
+ "
+ :
+ : "r" (&y), "r" (&u), "r" (&v), "r" (output));
+@@ -261,39 +261,39 @@
+ unsigned long v,
+ unsigned long *output)
+ {
+-asm("
+-/* Output will be 0x00rrggbb with the 00 trailing so this can also be used */
+-/* for bgr24. */
+- movd (%0), %%mm0; /* Load y 0x00000000000000yy */
+- psubsw mpeg3_MMX_601_Y_DIFF, %%mm0; /* Subtract 16 from y */
+- movd (%1), %%mm1; /* Load u 0x00000000000000cr */
+- movq %%mm0, %%mm3; /* Copy y to temp */
+- psllq $16, %%mm1; /* Shift u 0x0000000000cr0000 */
+- movd (%2), %%mm2; /* Load v 0x00000000000000cb */
+- psllq $16, %%mm3; /* Shift y */
+- movq %%mm1, %%mm4; /* Copy u to temp */
+- por %%mm3, %%mm0; /* Overlay new y byte 0x0000000000yy00yy */
+- psllq $16, %%mm4; /* Shift u */
+- movq %%mm2, %%mm5; /* Copy v to temp */
+- psllq $16, %%mm3; /* Shift y */
+- por %%mm4, %%mm1; /* Overlay new u byte 0x000000cr00cr0000 */
+- psllq $16, %%mm5; /* Shift v */
+- por %%mm3, %%mm0; /* Overlay new y byte 0x000000yy00yy00yy */
+- por %%mm5, %%mm2; /* Overlay new v byte 0x0000000000cb00cb */
+-
+-/* mm0: 0x000000yy00yy00yy mm1: 0x000000uu00uu0000 mm2: 0x0000000000vv00vv */
+- pmullw mpeg3_MMX_601_Y_COEF, %%mm0; /* Scale and shift y coeffs */
+- psubw mpeg3_MMX_U_80, %%mm1; /* Subtract 128 from u 0x000000uu00uu0000 */
+- pmullw mpeg3_MMX_U_COEF, %%mm1; /* Multiply u coeffs 0x0000uuuuuuuu0000 */
+- psubw mpeg3_MMX_V_80, %%mm2; /* Subtract 128 from v 0x0000000000cb00cb */
+- pmullw mpeg3_MMX_V_COEF, %%mm2; /* Multiply v coeffs 0x0000crcrcrcrcrcr */
+-
+-/* mm0: 0x000000yy00yy00yy mm1: 0x0000uuuuuuuu0000 mm2: 0x00000000vvvvvvvv */
+- paddsw %%mm1, %%mm0; /* Add u to result */
+- paddsw %%mm2, %%mm0; /* Add v to result 0x0000rrrrggggbbbb */
+- psraw $6, %%mm0; /* Demote precision */
+- packuswb %%mm0, %%mm0; /* Pack into ARGB 0x0000000000rrggbb */
+- movd %%mm0, (%3); /* Store output */
++asm("\n\
++/* Output will be 0x00rrggbb with the 00 trailing so this can also be used */\n\
++/* for bgr24. */\n\
++ movd (%0), %%mm0; /* Load y 0x00000000000000yy */\n\
++ psubsw mpeg3_MMX_601_Y_DIFF, %%mm0; /* Subtract 16 from y */\n\
++ movd (%1), %%mm1; /* Load u 0x00000000000000cr */\n\
++ movq %%mm0, %%mm3; /* Copy y to temp */\n\
++ psllq $16, %%mm1; /* Shift u 0x0000000000cr0000 */\n\
++ movd (%2), %%mm2; /* Load v 0x00000000000000cb */\n\
++ psllq $16, %%mm3; /* Shift y */\n\
++ movq %%mm1, %%mm4; /* Copy u to temp */\n\
++ por %%mm3, %%mm0; /* Overlay new y byte 0x0000000000yy00yy */\n\
++ psllq $16, %%mm4; /* Shift u */\n\
++ movq %%mm2, %%mm5; /* Copy v to temp */\n\
++ psllq $16, %%mm3; /* Shift y */\n\
++ por %%mm4, %%mm1; /* Overlay new u byte 0x000000cr00cr0000 */\n\
++ psllq $16, %%mm5; /* Shift v */\n\
++ por %%mm3, %%mm0; /* Overlay new y byte 0x000000yy00yy00yy */\n\
++ por %%mm5, %%mm2; /* Overlay new v byte 0x0000000000cb00cb */\n\
++\n\
++/* mm0: 0x000000yy00yy00yy mm1: 0x000000uu00uu0000 mm2: 0x0000000000vv00vv */\n\
++ pmullw mpeg3_MMX_601_Y_COEF, %%mm0; /* Scale and shift y coeffs */\n\
++ psubw mpeg3_MMX_U_80, %%mm1; /* Subtract 128 from u 0x000000uu00uu0000 */\n\
++ pmullw mpeg3_MMX_U_COEF, %%mm1; /* Multiply u coeffs 0x0000uuuuuuuu0000 */\n\
++ psubw mpeg3_MMX_V_80, %%mm2; /* Subtract 128 from v 0x0000000000cb00cb */\n\
++ pmullw mpeg3_MMX_V_COEF, %%mm2; /* Multiply v coeffs 0x0000crcrcrcrcrcr */\n\
++\n\
++/* mm0: 0x000000yy00yy00yy mm1: 0x0000uuuuuuuu0000 mm2: 0x00000000vvvvvvvv */\n\
++ paddsw %%mm1, %%mm0; /* Add u to result */\n\
++ paddsw %%mm2, %%mm0; /* Add v to result 0x0000rrrrggggbbbb */\n\
++ psraw $6, %%mm0; /* Demote precision */\n\
++ packuswb %%mm0, %%mm0; /* Pack into ARGB 0x0000000000rrggbb */\n\
++ movd %%mm0, (%3); /* Store output */\n\
+ "
+ :
+ : "r" (&y), "r" (&u), "r" (&v), "r" (output));
+@@ -309,38 +309,38 @@
+ unsigned long v,
+ unsigned long *output)
+ {
+-asm("
+-/* Output will be 0x00bbggrr with the 00 trailing so this can also be used */
+-/* for rgb24. */
+- movd (%0), %%mm0; /* Load y 0x00000000000000yy */
+- movd (%1), %%mm1; /* Load v 0x00000000000000vv */
+- movq %%mm0, %%mm3; /* Copy y to temp */
+- psllq $16, %%mm1; /* Shift v 0x0000000000vv0000 */
+- movd (%2), %%mm2; /* Load u 0x00000000000000uu */
+- psllq $16, %%mm3; /* Shift y */
+- movq %%mm1, %%mm4; /* Copy v to temp */
+- por %%mm3, %%mm0; /* Overlay new y byte 0x0000000000yy00yy */
+- psllq $16, %%mm4; /* Shift v */
+- movq %%mm2, %%mm5; /* Copy u to temp */
+- psllq $16, %%mm3; /* Shift y */
+- por %%mm4, %%mm1; /* Overlay new v byte 0x000000vv00vv0000 */
+- psllq $16, %%mm5; /* Shift u */
+- por %%mm3, %%mm0; /* Overlay new y byte 0x000000yy00yy00yy */
+- por %%mm5, %%mm2; /* Overlay new u byte 0x0000000000uu00uu */
+-
+-/* mm0: 0x000000yy00yy00yy mm1: 0x000000vv00vv0000 mm2: 0x0000000000uu00uu */
+- psubw mpeg3_MMX_V_80_RGB, %%mm1; /* Subtract 128 from v 0x000000vv00vv0000 */
+- pmullw mpeg3_MMX_V_COEF_RGB, %%mm1; /* Multiply v coeffs 0x0000vvvvvvvv0000 */
+- psllw $6, %%mm0; /* Shift y coeffs 0x0000yyy0yyy0yyy0 */
+- psubw mpeg3_MMX_U_80_RGB, %%mm2; /* Subtract 128 from u 0x0000000000uu00uu */
+- pmullw mpeg3_MMX_U_COEF_RGB, %%mm2; /* Multiply u coeffs 0x0000uuuuuuuuuuuu */
+-
+-/* mm0: 0x000000yy00yy00yy mm1: 0x0000vvvvvvvv0000 mm2: 0x00000000uuuuuuuu */
+- paddsw %%mm1, %%mm0; /* Add v to result */
+- paddsw %%mm2, %%mm0; /* Add u to result 0x0000bbbbggggrrrr */
+- psraw $6, %%mm0; /* Demote precision */
+- packuswb %%mm0, %%mm0; /* Pack into RGBA 0x0000000000bbggrr */
+- movd %%mm0, (%3); /* Store output */
++asm("\n\
++/* Output will be 0x00bbggrr with the 00 trailing so this can also be used */\n\
++/* for rgb24. */\n\
++ movd (%0), %%mm0; /* Load y 0x00000000000000yy */\n\
++ movd (%1), %%mm1; /* Load v 0x00000000000000vv */\n\
++ movq %%mm0, %%mm3; /* Copy y to temp */\n\
++ psllq $16, %%mm1; /* Shift v 0x0000000000vv0000 */\n\
++ movd (%2), %%mm2; /* Load u 0x00000000000000uu */\n\
++ psllq $16, %%mm3; /* Shift y */\n\
++ movq %%mm1, %%mm4; /* Copy v to temp */\n\
++ por %%mm3, %%mm0; /* Overlay new y byte 0x0000000000yy00yy */\n\
++ psllq $16, %%mm4; /* Shift v */\n\
++ movq %%mm2, %%mm5; /* Copy u to temp */\n\
++ psllq $16, %%mm3; /* Shift y */\n\
++ por %%mm4, %%mm1; /* Overlay new v byte 0x000000vv00vv0000 */\n\
++ psllq $16, %%mm5; /* Shift u */\n\
++ por %%mm3, %%mm0; /* Overlay new y byte 0x000000yy00yy00yy */\n\
++ por %%mm5, %%mm2; /* Overlay new u byte 0x0000000000uu00uu */\n\
++\n\
++/* mm0: 0x000000yy00yy00yy mm1: 0x000000vv00vv0000 mm2: 0x0000000000uu00uu */\n\
++ psubw mpeg3_MMX_V_80_RGB, %%mm1; /* Subtract 128 from v 0x000000vv00vv0000 */\n\
++ pmullw mpeg3_MMX_V_COEF_RGB, %%mm1; /* Multiply v coeffs 0x0000vvvvvvvv0000 */\n\
++ psllw $6, %%mm0; /* Shift y coeffs 0x0000yyy0yyy0yyy0 */\n\
++ psubw mpeg3_MMX_U_80_RGB, %%mm2; /* Subtract 128 from u 0x0000000000uu00uu */\n\
++ pmullw mpeg3_MMX_U_COEF_RGB, %%mm2; /* Multiply u coeffs 0x0000uuuuuuuuuuuu */\n\
++\n\
++/* mm0: 0x000000yy00yy00yy mm1: 0x0000vvvvvvvv0000 mm2: 0x00000000uuuuuuuu */\n\
++ paddsw %%mm1, %%mm0; /* Add v to result */\n\
++ paddsw %%mm2, %%mm0; /* Add u to result 0x0000bbbbggggrrrr */\n\
++ psraw $6, %%mm0; /* Demote precision */\n\
++ packuswb %%mm0, %%mm0; /* Pack into RGBA 0x0000000000bbggrr */\n\
++ movd %%mm0, (%3); /* Store output */\n\
+ "
+ :
+ : "r" (&y), "r" (&v), "r" (&u), "r" (output));
+@@ -351,39 +351,39 @@
+ unsigned long v,
+ unsigned long *output)
+ {
+-asm("
+-/* Output will be 0x00bbggrr with the 00 trailing so this can also be used */
+-/* for rgb24. */
+- movd (%0), %%mm0; /* Load y 0x00000000000000yy */
+- psubsw mpeg3_MMX_601_Y_DIFF, %%mm0; /* Subtract 16 from y */
+- movd (%1), %%mm1; /* Load v 0x00000000000000vv */
+- movq %%mm0, %%mm3; /* Copy y to temp */
+- psllq $16, %%mm1; /* Shift v 0x0000000000vv0000 */
+- movd (%2), %%mm2; /* Load u 0x00000000000000uu */
+- psllq $16, %%mm3; /* Shift y */
+- movq %%mm1, %%mm4; /* Copy v to temp */
+- por %%mm3, %%mm0; /* Overlay new y byte 0x0000000000yy00yy */
+- psllq $16, %%mm4; /* Shift v */
+- movq %%mm2, %%mm5; /* Copy u to temp */
+- psllq $16, %%mm3; /* Shift y */
+- por %%mm4, %%mm1; /* Overlay new v byte 0x000000vv00vv0000 */
+- psllq $16, %%mm5; /* Shift u */
+- por %%mm3, %%mm0; /* Overlay new y byte 0x000000yy00yy00yy */
+- por %%mm5, %%mm2; /* Overlay new u byte 0x0000000000uu00uu */
+-
+-/* mm0: 0x000000yy00yy00yy mm1: 0x000000vv00vv0000 mm2: 0x0000000000uu00uu */
+- pmullw mpeg3_MMX_601_Y_COEF, %%mm0; /* Scale y coeffs */
+- psubw mpeg3_MMX_V_80_RGB, %%mm1; /* Subtract 128 from v 0x000000vv00vv0000 */
+- pmullw mpeg3_MMX_V_COEF_RGB, %%mm1; /* Multiply v coeffs 0x0000vvvvvvvv0000 */
+- psubw mpeg3_MMX_U_80_RGB, %%mm2; /* Subtract 128 from u 0x0000000000uu00uu */
+- pmullw mpeg3_MMX_U_COEF_RGB, %%mm2; /* Multiply u coeffs 0x0000uuuuuuuuuuuu */
+-
+-/* mm0: 0x000000yy00yy00yy mm1: 0x0000vvvvvvvv0000 mm2: 0x00000000uuuuuuuu */
+- paddsw %%mm1, %%mm0; /* Add v to result */
+- paddsw %%mm2, %%mm0; /* Add u to result 0x0000bbbbggggrrrr */
+- psraw $6, %%mm0; /* Demote precision */
+- packuswb %%mm0, %%mm0; /* Pack into RGBA 0x0000000000bbggrr */
+- movd %%mm0, (%3); /* Store output */
++asm("\n\
++/* Output will be 0x00bbggrr with the 00 trailing so this can also be used */\n\
++/* for rgb24. */\n\
++ movd (%0), %%mm0; /* Load y 0x00000000000000yy */\n\
++ psubsw mpeg3_MMX_601_Y_DIFF, %%mm0; /* Subtract 16 from y */\n\
++ movd (%1), %%mm1; /* Load v 0x00000000000000vv */\n\
++ movq %%mm0, %%mm3; /* Copy y to temp */\n\
++ psllq $16, %%mm1; /* Shift v 0x0000000000vv0000 */\n\
++ movd (%2), %%mm2; /* Load u 0x00000000000000uu */\n\
++ psllq $16, %%mm3; /* Shift y */\n\
++ movq %%mm1, %%mm4; /* Copy v to temp */\n\
++ por %%mm3, %%mm0; /* Overlay new y byte 0x0000000000yy00yy */\n\
++ psllq $16, %%mm4; /* Shift v */\n\
++ movq %%mm2, %%mm5; /* Copy u to temp */\n\
++ psllq $16, %%mm3; /* Shift y */\n\
++ por %%mm4, %%mm1; /* Overlay new v byte 0x000000vv00vv0000 */\n\
++ psllq $16, %%mm5; /* Shift u */\n\
++ por %%mm3, %%mm0; /* Overlay new y byte 0x000000yy00yy00yy */\n\
++ por %%mm5, %%mm2; /* Overlay new u byte 0x0000000000uu00uu */\n\
++\n\
++/* mm0: 0x000000yy00yy00yy mm1: 0x000000vv00vv0000 mm2: 0x0000000000uu00uu */\n\
++ pmullw mpeg3_MMX_601_Y_COEF, %%mm0; /* Scale y coeffs */\n\
++ psubw mpeg3_MMX_V_80_RGB, %%mm1; /* Subtract 128 from v 0x000000vv00vv0000 */\n\
++ pmullw mpeg3_MMX_V_COEF_RGB, %%mm1; /* Multiply v coeffs 0x0000vvvvvvvv0000 */\n\
++ psubw mpeg3_MMX_U_80_RGB, %%mm2; /* Subtract 128 from u 0x0000000000uu00uu */\n\
++ pmullw mpeg3_MMX_U_COEF_RGB, %%mm2; /* Multiply u coeffs 0x0000uuuuuuuuuuuu */\n\
++\n\
++/* mm0: 0x000000yy00yy00yy mm1: 0x0000vvvvvvvv0000 mm2: 0x00000000uuuuuuuu */\n\
++ paddsw %%mm1, %%mm0; /* Add v to result */\n\
++ paddsw %%mm2, %%mm0; /* Add u to result 0x0000bbbbggggrrrr */\n\
++ psraw $6, %%mm0; /* Demote precision */\n\
++ packuswb %%mm0, %%mm0; /* Pack into RGBA 0x0000000000bbggrr */\n\
++ movd %%mm0, (%3); /* Store output */\n\
+ "
+ :
+ : "r" (&y), "r" (&v), "r" (&u), "r" (output));