forked from ports/contrib
libfame: various fixes
This commit is contained in:
parent
cda016d986
commit
ef9e75d4ad
@ -1,2 +1,8 @@
|
||||
fb98aaf4ca928bc10f6d1fc92983b6ec libfame-0.9.1-fame_motion_pmvfast.c.patch
|
||||
9022ea48cc238fb071b9b9c29a85fc7a libfame-0.9.1-gcc-version-check.patch
|
||||
af9a3ce19e852874fd602c9c451d3160 libfame-0.9.1-m4.patch
|
||||
f01512be0252259fc94ec638f9837580 libfame-0.9.1-missing-includes.patch
|
||||
84bf7e9820d228ef3eaa2873992200aa libfame-0.9.1-mmx-pic.patch
|
||||
d7f06d0ab862883eff73dbb0ebf6a14c libfame-0.9.1-mmx.patch
|
||||
ee57a8744b4c559a7b9f8d3d50b28baa libfame-0.9.1-ptr-null-check.patch
|
||||
880085761e17a3b4fc41f4f6f198fd3b libfame-0.9.1.tar.gz
|
||||
|
@ -6,13 +6,25 @@
|
||||
|
||||
name=libfame
|
||||
version=0.9.1
|
||||
release=1
|
||||
release=2
|
||||
source=(http://dl.sourceforge.net/sourceforge/fame/libfame-$version.tar.gz
|
||||
$name-$version-m4.patch)
|
||||
$name-$version-m4.patch
|
||||
$name-$version-gcc-version-check.patch
|
||||
$name-$version-mmx.patch
|
||||
$name-$version-mmx-pic.patch
|
||||
$name-$version-fame_motion_pmvfast.c.patch
|
||||
$name-$version-missing-includes.patch
|
||||
$name-$version-ptr-null-check.patch)
|
||||
|
||||
build() {
|
||||
cd libfame-$version
|
||||
patch -p 1 -i $SRC/$name-$version-m4.patch
|
||||
patch -p 1 -i $SRC/$name-$version-gcc-version-check.patch
|
||||
patch -p 1 -i $SRC/$name-$version-mmx.patch
|
||||
patch -p 1 -i $SRC/$name-$version-mmx-pic.patch
|
||||
patch -p 1 -i $SRC/$name-$version-fame_motion_pmvfast.c.patch
|
||||
patch -p 1 -i $SRC/$name-$version-missing-includes.patch
|
||||
patch -p 1 -i $SRC/$name-$version-ptr-null-check.patch
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
|
11
libfame/libfame-0.9.1-fame_motion_pmvfast.c.patch
Normal file
11
libfame/libfame-0.9.1-fame_motion_pmvfast.c.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -pruN libfame-0.9.1.orig/src/fame_motion_pmvfast.c libfame-0.9.1/src/fame_motion_pmvfast.c
|
||||
--- libfame-0.9.1.orig/src/fame_motion_pmvfast.c 2008-08-02 22:44:06.857141618 +1000
|
||||
+++ libfame-0.9.1/src/fame_motion_pmvfast.c 2008-08-02 23:00:26.842141204 +1000
|
||||
@@ -921,7 +921,6 @@ static fame_motion_coding_t pmvfast_esti
|
||||
fame_motion_vector_t *plast;
|
||||
fame_motion_vector_t *pvector_left, *pvector_topleft;
|
||||
fame_motion_vector_t *pvector_top, *pvector_topright;
|
||||
- unsigned int weight_left, weight_top, weight_topright;
|
||||
|
||||
unsigned char *shape;
|
||||
unsigned char *current;
|
19
libfame/libfame-0.9.1-gcc-version-check.patch
Normal file
19
libfame/libfame-0.9.1-gcc-version-check.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff -pruN libfame-0.9.1.orig/configure libfame-0.9.1/configure
|
||||
--- libfame-0.9.1.orig/configure 2008-08-02 22:04:18.375141589 +1000
|
||||
+++ libfame-0.9.1/configure 2008-08-02 22:05:49.940140531 +1000
|
||||
@@ -4607,12 +4607,9 @@ fi
|
||||
if test x$ac_cv_c_compiler_gnu = xyes; then
|
||||
CFLAGS="$CFLAGS -Wall -fexpensive-optimizations -funroll-loops -ffast-math"
|
||||
|
||||
- gcc_major_version=`$CC --version | \
|
||||
- sed -e 's,[^0-9.],,g' -e 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
|
||||
- gcc_minor_version=`$CC --version | \
|
||||
- sed -e 's,[^0-9.],,g' -e 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
|
||||
- gcc_micro_version=`$CC --version | \
|
||||
- sed -e 's,[^0-9.],,g' -e 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
|
||||
+ gcc_major_version=`${CC} -dumpversion | cut -f1 -d.`
|
||||
+ gcc_minor_version=`${CC} -dumpversion | cut -f2 -d.`
|
||||
+ gcc_micro_version=`${CC} -dumpversion | cut -f3 -d.`
|
||||
|
||||
if test $gcc_major_version -eq 2; then
|
||||
if test $gcc_minor_version -gt 94; then
|
45
libfame/libfame-0.9.1-missing-includes.patch
Normal file
45
libfame/libfame-0.9.1-missing-includes.patch
Normal file
@ -0,0 +1,45 @@
|
||||
diff -pruN libfame-0.9.1.orig/src/fame_malloc.c libfame-0.9.1/src/fame_malloc.c
|
||||
--- libfame-0.9.1.orig/src/fame_malloc.c 2008-08-02 22:44:06.858140887 +1000
|
||||
+++ libfame-0.9.1/src/fame_malloc.c 2008-08-02 22:44:35.795140914 +1000
|
||||
@@ -21,6 +21,8 @@
|
||||
#define ALIGN 32
|
||||
|
||||
#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <inttypes.h>
|
||||
|
||||
void* fame_malloc(size_t size)
|
||||
{
|
||||
diff -pruN libfame-0.9.1.orig/src/fame_motion_pmvfast.c libfame-0.9.1/src/fame_motion_pmvfast.c
|
||||
--- libfame-0.9.1.orig/src/fame_motion_pmvfast.c 2008-08-02 22:44:06.857141618 +1000
|
||||
+++ libfame-0.9.1/src/fame_motion_pmvfast.c 2008-08-02 22:44:35.795140914 +1000
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h> /* memcpy, memset */
|
||||
#include "fame.h"
|
||||
#include "fame_malloc.h"
|
||||
#include "fame_motion.h"
|
||||
diff -pruN libfame-0.9.1.orig/src/fame_rate_1param.c libfame-0.9.1/src/fame_rate_1param.c
|
||||
--- libfame-0.9.1.orig/src/fame_rate_1param.c 2008-08-02 22:44:06.860141435 +1000
|
||||
+++ libfame-0.9.1/src/fame_rate_1param.c 2008-08-02 22:44:35.794142186 +1000
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h> /* strlen() */
|
||||
#include <math.h>
|
||||
#include "fame.h"
|
||||
#include "fame_rate_1param.h"
|
||||
diff -pruN libfame-0.9.1.orig/src/fame_rate_simple.c libfame-0.9.1/src/fame_rate_simple.c
|
||||
--- libfame-0.9.1.orig/src/fame_rate_simple.c 2008-08-02 22:44:06.860141435 +1000
|
||||
+++ libfame-0.9.1/src/fame_rate_simple.c 2008-08-02 22:44:35.793143865 +1000
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h> /* strlen() */
|
||||
#include <math.h>
|
||||
#include "fame.h"
|
||||
#include "fame_rate_simple.h"
|
366
libfame/libfame-0.9.1-mmx-pic.patch
Normal file
366
libfame/libfame-0.9.1-mmx-pic.patch
Normal file
@ -0,0 +1,366 @@
|
||||
diff -pruN libfame-0.9.1.orig/src/dct_mmx.h libfame-0.9.1/src/dct_mmx.h
|
||||
--- libfame-0.9.1.orig/src/dct_mmx.h 2008-08-02 23:18:19.164140803 +1000
|
||||
+++ libfame-0.9.1/src/dct_mmx.h 2008-08-02 23:19:00.554142886 +1000
|
||||
@@ -22,6 +22,9 @@
|
||||
|
||||
#define precision
|
||||
|
||||
+extern FAME_ALIGNED short const _mmx_1[];
|
||||
+extern FAME_ALIGNED short const _mmx_cos[];
|
||||
+
|
||||
static void inline dct_aan_pass(dct_t *cache)
|
||||
{
|
||||
// register unsigned short const *mmx_cos = _mmx_cos;
|
||||
@@ -66,42 +69,42 @@ static void inline dct_aan_pass(dct_t *c
|
||||
#ifdef precision
|
||||
"psllw $0x01, %%mm5\n" /* precision(va0) += 1 bit */
|
||||
#endif
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm4\n" /* + 1 */
|
||||
+ "paddw (%2), %%mm4\n" /* + 1 */
|
||||
// "pmulhw 16(%1), %%mm5\n" /* (v14+v16)*COS6 -> mm5 (va0) */
|
||||
- "pmulhw " ASMSYM "_mmx_cos+16, %%mm5\n" /* (v14+v16)*COS6 -> mm5 (va0) */
|
||||
+ "pmulhw 16(%3), %%mm5\n" /* (v14+v16)*COS6 -> mm5 (va0) */
|
||||
"" /* STEP 4 */
|
||||
#ifdef precision
|
||||
"psllw $0x02, %%mm6\n" /* precision(v22) += 1 bit */
|
||||
#else
|
||||
"psllw $0x01, %%mm6\n" /* */
|
||||
#endif
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm4\n" /* + 1 */
|
||||
+ "paddw (%2), %%mm4\n" /* + 1 */
|
||||
// "pmulhw 8(%1), %%mm6\n" /* 2*v22*COS4/2 -> mm6 (v32)*/
|
||||
- "pmulhw " ASMSYM "_mmx_cos+8, %%mm6\n" /* 2*v22*COS4/2 -> mm6 (v32)*/
|
||||
+ "pmulhw 8(%3), %%mm6\n" /* 2*v22*COS4/2 -> mm6 (v32)*/
|
||||
#ifdef precision
|
||||
"psllw $0x02, %%mm2\n" /* precision(v15) += 1 bit */
|
||||
#else
|
||||
"psllw $0x01, %%mm2\n" /* */
|
||||
#endif
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm4\n" /* + 1 */
|
||||
+ "paddw (%2), %%mm4\n" /* + 1 */
|
||||
// "pmulhw 8(%1), %%mm2\n" /* 2*v15*COS4/2 -> mm2 (v35) */
|
||||
- "pmulhw " ASMSYM "_mmx_cos+8, %%mm2\n" /* 2*v15*COS4/2 -> mm2 (v35) */
|
||||
+ "pmulhw 8(%3), %%mm2\n" /* 2*v15*COS4/2 -> mm2 (v35) */
|
||||
#ifdef precision
|
||||
"psllw $0x02, %%mm4\n" /* precision(v14) += 1 bit */
|
||||
#else
|
||||
"psllw $0x01, %%mm4\n" /* */
|
||||
#endif
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm4\n" /* + 1 */
|
||||
+ "paddw (%2), %%mm4\n" /* + 1 */
|
||||
// "pmulhw 0(%1), %%mm4\n" /* 2 * v14 * -COS2/2 -> mm4 */
|
||||
- "pmulhw " ASMSYM "_mmx_cos, %%mm4\n" /* 2 * v14 * -COS2/2 -> mm4 */
|
||||
+ "pmulhw (%3), %%mm4\n" /* 2 * v14 * -COS2/2 -> mm4 */
|
||||
"psubsw %%mm5, %%mm4\n" /* v14*-COS2 - va0 -> mm4 (v34) */
|
||||
#ifdef precision
|
||||
"psllw $0x01, %%mm1\n" /* precision(v16) += 1 bit */
|
||||
#endif
|
||||
"psubsw %%mm1, %%mm5\n" /* va0 - v16 -> mm5 */
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm4\n" /* + 1 */
|
||||
+ "paddw (%2), %%mm4\n" /* + 1 */
|
||||
// "pmulhw 24(%1), %%mm1\n" /* v16 * (COS8 - 1) -> mm1 */
|
||||
- "pmulhw " ASMSYM "_mmx_cos+24, %%mm1\n" /* v16 * (COS8 - 1) -> mm1 */
|
||||
+ "pmulhw 24(%3), %%mm1\n" /* v16 * (COS8 - 1) -> mm1 */
|
||||
"psubsw %%mm5, %%mm1\n" /* v16 * COS8 - va0 -> mm1 (v36)*/
|
||||
"" /* STEP 5 */
|
||||
"movq 0x70(%0), %%mm0\n" /* retrieve v07 -> mm0 */
|
||||
@@ -138,8 +141,8 @@ static void inline dct_aan_pass(dct_t *c
|
||||
"movq %%mm0, 0x30(%0)\n" /* store line 3 */
|
||||
"movq %%mm4, 0x50(%0)\n" /* store line 5 */
|
||||
"movq %%mm2, 0x70(%0)\n" /* store line 7 */
|
||||
- : "=r"(cache)/*, "=r"(mmx_cos)*/
|
||||
- : "0"(cache)/*, "1"(mmx_cos)*/
|
||||
+ : "=r"(cache)
|
||||
+ : "0"(cache), "r"(_mmx_1), "r"(_mmx_cos)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
diff -pruN libfame-0.9.1.orig/src/dequantize_mmx.h libfame-0.9.1/src/dequantize_mmx.h
|
||||
--- libfame-0.9.1.orig/src/dequantize_mmx.h 2008-08-02 23:18:19.164140803 +1000
|
||||
+++ libfame-0.9.1/src/dequantize_mmx.h 2008-08-02 23:19:00.555141217 +1000
|
||||
@@ -27,8 +27,8 @@
|
||||
"pmullw 0x" #x "8(%3), %%mm5\n" /* premultiply for iDCT */ \
|
||||
"psrlw $0x0b, %%mm4\n" /* keep 5 bits */ \
|
||||
"psrlw $0x0b, %%mm5\n" /* keep 5 bits */ \
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm4\n" /* + 1 */ \
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm5\n" /* + 1 */ \
|
||||
+ "paddw (%8), %%mm4\n" /* + 1 */ \
|
||||
+ "paddw (%8), %%mm5\n" /* + 1 */ \
|
||||
"psrlw $0x01, %%mm4\n" /* keep 4 bits rounded */ \
|
||||
"psrlw $0x01, %%mm5\n" /* keep 4 bits rounded */ \
|
||||
"psllw $0x04, %%mm0\n" /* multiply by 16 for iDCT */ \
|
||||
@@ -107,7 +107,7 @@ static void inline dequantize_intra_glob
|
||||
DEQUANTIZE_GLOBAL_MISMATCH_CONTROL()
|
||||
DEQUANTIZE_PRESCALE_STEP(7)
|
||||
: "=r"(block), "=r"(dqmatrix), "=r"(cache), "=r"(psmatrix)
|
||||
- : "0"(block), "1"(dqmatrix), "2"(cache), "3"(psmatrix)
|
||||
+ : "0"(block), "1"(dqmatrix), "2"(cache), "3"(psmatrix), "r"(_mmx_1)
|
||||
: "memory");
|
||||
|
||||
asm volatile("movd %%mm6, %0\n" /* export mismatch */
|
||||
@@ -160,8 +160,8 @@ static void inline dequantize_intra_loca
|
||||
"pcmpeqw %%mm7, %%mm3\n" /* invert sign */ \
|
||||
"paddw %%mm2, %%mm0\n" /* sub 1 if >0 */ \
|
||||
"paddw %%mm3, %%mm1\n" /* sub 1 if >0 */ \
|
||||
- "por " ASMSYM "_mmx_1, %%mm0\n" /* or 1 */ \
|
||||
- "por " ASMSYM "_mmx_1, %%mm1\n" /* or 1 */ \
|
||||
+ "por (%8), %%mm0\n" /* or 1 */ \
|
||||
+ "por (%8), %%mm1\n" /* or 1 */ \
|
||||
"pand %%mm4, %%mm0\n" /* [0-3]=0 if [0-3] was zero */ \
|
||||
"pand %%mm5, %%mm1\n" /* [4-7]=0 if [4-7] was zero */
|
||||
|
||||
@@ -184,7 +184,7 @@ static void inline dequantize_intra_loca
|
||||
DEQUANTIZE_INTRA_LOCAL_STEP(7)
|
||||
DEQUANTIZE_PRESCALE_STEP(7)
|
||||
: "=r"(block), "=r"(dqmatrix), "=r"(cache), "=r"(psmatrix)
|
||||
- : "0"(block), "1"(dqmatrix), "2"(cache), "3"(psmatrix)
|
||||
+ : "0"(block), "1"(dqmatrix), "2"(cache), "3"(psmatrix), "r"(_mmx_1)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ static void inline dequantize_inter_glob
|
||||
/* resetting the accumulator when the block is coded intra */
|
||||
DEQUANTIZE_PRESCALE_STEP(7)
|
||||
: "=r"(block), "=r"(dqmatrix), "=r"(cache), "=r"(psmatrix)
|
||||
- : "0"(block), "1"(dqmatrix), "2"(cache), "3"(psmatrix)
|
||||
+ : "0"(block), "1"(dqmatrix), "2"(cache), "3"(psmatrix), "r"(_mmx_1)
|
||||
: "memory");
|
||||
|
||||
asm volatile("movd %%mm6, %0\n" /* export mismatch */
|
||||
@@ -324,8 +324,8 @@ static void inline dequantize_inter_loca
|
||||
"pcmpeqw %%mm7, %%mm3\n" /* invert sign */ \
|
||||
"paddw %%mm2, %%mm0\n" /* sub 1 if >0 */ \
|
||||
"paddw %%mm3, %%mm1\n" /* sub 1 if >0 */ \
|
||||
- "por " ASMSYM "_mmx_1, %%mm0\n" /* or 1 */ \
|
||||
- "por " ASMSYM "_mmx_1, %%mm1\n" /* or 1 */ \
|
||||
+ "por (%8), %%mm0\n" /* or 1 */ \
|
||||
+ "por (%8), %%mm1\n" /* or 1 */ \
|
||||
"pand %%mm4, %%mm0\n" /* [0-3]=0 if [0-3] was zero */ \
|
||||
"pand %%mm5, %%mm1\n" /* [4-7]=0 if [4-7] was zero */
|
||||
|
||||
@@ -348,6 +348,6 @@ static void inline dequantize_inter_loca
|
||||
DEQUANTIZE_INTER_LOCAL_STEP(7)
|
||||
DEQUANTIZE_PRESCALE_STEP(7)
|
||||
: "=r"(block), "=r"(dqmatrix), "=r"(cache), "=r"(psmatrix)
|
||||
- : "0"(block), "1"(dqmatrix), "2"(cache), "3"(psmatrix)
|
||||
+ : "0"(block), "1"(dqmatrix), "2"(cache), "3"(psmatrix), "r"(_mmx_1)
|
||||
: "memory");
|
||||
}
|
||||
diff -pruN libfame-0.9.1.orig/src/fame_syntax_mpeg1.c libfame-0.9.1/src/fame_syntax_mpeg1.c
|
||||
--- libfame-0.9.1.orig/src/fame_syntax_mpeg1.c 2008-08-02 23:18:19.167141250 +1000
|
||||
+++ libfame-0.9.1/src/fame_syntax_mpeg1.c 2008-08-02 23:19:00.556140239 +1000
|
||||
@@ -469,89 +469,6 @@ static void mpeg1_block_intra(fame_synta
|
||||
fast_bitbuffer_write(data, shift, table[v+255].code, table[v+255].length);
|
||||
|
||||
/* encode AC coefficients */
|
||||
-#if defined(HAS_BSWAP)
|
||||
- {
|
||||
- unsigned long dummy1, dummy2;
|
||||
-
|
||||
- /* Note:
|
||||
- movsx mpeg1_table_clip+4096(, %%eax ,2), %%eax
|
||||
- has been replaced by
|
||||
- movw mpeg1_table_clip+4096(, %%eax ,2), %%ax
|
||||
- movsx %%ax, %%eax
|
||||
- because the first instruction failed on a PIII!! (wrong sign extension)
|
||||
- whereas it worked well on my P75 :)
|
||||
- */
|
||||
- /* Ok, a bit of explanations for a couple of tricks:
|
||||
- The DC value of block is already coded and stored in v so we can use it to store something.
|
||||
- We add one index to the zigzag table so that after coding block[63] we go to index 0. There
|
||||
- we need to escape the zero counting loop (1), what we ensure by putting a non-zero value in
|
||||
- the DC coefficient. Then we can test for index == 0 to exit.
|
||||
- Now this non-zero value is a bit special :)
|
||||
- In order to have one more 'half' register, we store sp value (16 less significant bit of the
|
||||
- 32 bit register esp) *plus one* in the DC coefficient. Since the stack is aligned at an
|
||||
- address multiple of 4 bytes (at least), we are sure that sp != 0xffff and thus sp+1 will
|
||||
- never be zero. We then retrieve sp at the end for it is needed by 'pop' instructions.
|
||||
- */
|
||||
- /* TODO : echange the role of edx and esp */
|
||||
- __asm__ __volatile__ ("pushl %%ebx\n" /* save ebx */
|
||||
- "pushl %%ebp\n" /* save stack pointer */
|
||||
- "inc %%sp\n" /* make sure sp != 0 */
|
||||
- "movw %%sp, (%%edx)\n" /* store sp+1 in DC ;) */
|
||||
- "movl %%esi, %%ebp\n" /* ebp = vlc_table */
|
||||
- "xorl %%eax, %%eax\n" /* eax = 0 */
|
||||
- "movl $" ASMSYM "mpeg1_zigzag_table+1, %%esi\n" /*esi = zigzag*/
|
||||
- "lea 1(%%esi), %%ebx\n" /* ebx = zigzag_table+1*/
|
||||
- "neg %%ebx\n" /* ebx = -(esi+1) */
|
||||
- ".p2align 4,,7\n" /* align for jump */
|
||||
- "0: xorw %%sp, %%sp\n" /* sp = 0 */
|
||||
- "1: movb (%%esi), %%al\n" /* eax = index in block*/
|
||||
- "incl %%esi\n" /* (faster than lodsb) */
|
||||
- "addw (%%edx, %%eax, 2), %%sp\n" /* sp = unzig */
|
||||
- "jz 1b\n" /* coeff == 0 then loop*/
|
||||
- "orl %%eax, %%eax\n" /* index == 0 then quit*/
|
||||
- "jz 2f\n" /* (faster than jcxz) */
|
||||
- "movsx %%sp, %%eax\n" /* extend sign */
|
||||
- "movw " ASMSYM "mpeg1_table_clip_data+4096(, %%eax ,2), %%ax\n" /*clip*/
|
||||
- "movsx %%ax, %%eax\n" /* extend sign */
|
||||
- "addl %%esi, %%ebx\n" /* ebx = run */
|
||||
- "shll $7, %%eax\n" /* eax *= 128(indexing)*/
|
||||
- "lea (%%eax, %%ebx, 2), %%eax\n" /*eax = 2 * offset*/
|
||||
- "lea (%%ebp, %%eax, 4), %%ebx\n" /* ebx = &vlc */
|
||||
- "movl (%%ebx), %%eax\n" /* eax = code */
|
||||
- "addl 4(%%ebx), %%ecx\n" /* ecx = shift+=length */
|
||||
- "xorl %%ebx, %%ebx\n" /* ebx = 0 */
|
||||
- "shrd %%cl, %%eax, %%ebx\n" /* adjust code to fit */
|
||||
- "shr %%cl, %%eax\n" /* adjust code to fit */
|
||||
- "bswap %%eax\n" /* reverse byte order of code */
|
||||
- "bswap %%ebx\n" /* reverse byte order of code */
|
||||
- "or %%eax, (%%edi)\n" /* put first 32 bits */
|
||||
- "movl %%ecx, %%eax\n" /* eax = shift + length*/
|
||||
- "shrl $5, %%eax\n" /* get dword increment */
|
||||
- "andl $31, %%ecx\n" /* mask shift */
|
||||
- "lea (%%edi, %%eax, 4), %%edi\n"/* data+=(ecx>32)*/
|
||||
- "orl %%ebx, (%%edi)\n" /* put last 32 bits */
|
||||
- "xorl %%eax, %%eax\n" /* eax = 0 */
|
||||
- "lea 1(%%esi), %%ebx\n" /* ebx = esi + 1 (last)*/
|
||||
- "neg %%ebx\n" /* ebx = -(esi + 1) */
|
||||
- "jmp 0b\n" /* loop */
|
||||
- "2:\n"
|
||||
- "movw (%%edx), %%sp\n" /* retrieve sp+1 */
|
||||
- "dec %%sp\n" /* restore esp */
|
||||
- "popl %%ebp\n" /* reload stack pointer*/
|
||||
- "popl %%ebx\n" /* reload ebx */
|
||||
- : "=c"(shift),
|
||||
- "=a"(dummy1),
|
||||
- "=d"(block),
|
||||
- "=D"(data),
|
||||
- "=S"(dummy2)
|
||||
- : "d"(block),
|
||||
- "c"(shift),
|
||||
- "D"(data),
|
||||
- "S"(syntax_mpeg1->vlc_table)
|
||||
- : "memory");
|
||||
- block[0] = v; /* restore DC value */
|
||||
- }
|
||||
-#else
|
||||
{
|
||||
short i;
|
||||
unsigned long last;
|
||||
@@ -573,7 +490,6 @@ static void mpeg1_block_intra(fame_synta
|
||||
}
|
||||
}
|
||||
}
|
||||
-#endif /* HAS_BSWAP */
|
||||
|
||||
/* mark end of block */
|
||||
fast_bitbuffer_write(data, shift, 2, 2);
|
||||
diff -pruN libfame-0.9.1.orig/src/half_mmx.h libfame-0.9.1/src/half_mmx.h
|
||||
--- libfame-0.9.1.orig/src/half_mmx.h 2008-08-02 23:18:19.161140026 +1000
|
||||
+++ libfame-0.9.1/src/half_mmx.h 2008-08-02 23:19:00.556140239 +1000
|
||||
@@ -68,8 +68,8 @@ static void inline mmx_interpolate(unsig
|
||||
"paddw %%mm5, %%mm6\n" /* mm6 = ref00+ref10+ref11+1-r 4-7*/
|
||||
"psrlw $1, %%mm4\n" /* divide by 2 */
|
||||
"psrlw $1, %%mm5\n" /* divide by 2 */
|
||||
- "paddw " ASMSYM "_mmx_one, %%mm3\n" /* add 1 */
|
||||
- "paddw " ASMSYM "_mmx_one, %%mm6\n" /* add 1 */
|
||||
+ "paddw (%8), %%mm3\n" /* add 1 */
|
||||
+ "paddw (%8), %%mm6\n" /* add 1 */
|
||||
"packuswb %%mm5, %%mm4\n" /* pack to byte and saturate */
|
||||
"movq 1(%3), %%mm1\n" /* mm1 = [ref+1] */
|
||||
"movq %%mm1, %%mm2\n" /* mm2 = mm1 */
|
||||
@@ -87,7 +87,7 @@ static void inline mmx_interpolate(unsig
|
||||
"movl 12(%0), %3\n" /* %3 = ref[3] */
|
||||
"movq %%mm3, (%3)\n" /* store in frame */
|
||||
: "=r"(ref), "=r"(pitch), "=r"(rc), "=r"(dummy)
|
||||
- : "0"(ref), "1"(pitch), "2"(rc), "3"(dummy)
|
||||
+ : "0"(ref), "1"(pitch), "2"(rc), "3"(dummy), "r"(_mmx_one)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
diff -pruN libfame-0.9.1.orig/src/half_sse.h libfame-0.9.1/src/half_sse.h
|
||||
--- libfame-0.9.1.orig/src/half_sse.h 2008-08-02 23:18:19.160143502 +1000
|
||||
+++ libfame-0.9.1/src/half_sse.h 2008-08-02 23:19:00.557139019 +1000
|
||||
@@ -71,8 +71,8 @@ static void inline mmx_interpolate_signe
|
||||
"paddw %%mm5, %%mm6\n" /* mm6 = ref00+ref10+ref11+1-r 4-7*/
|
||||
"psrlw $1, %%mm4\n" /* divide by 2 */
|
||||
"psrlw $1, %%mm5\n" /* divide by 2 */
|
||||
- "paddw " ASMSYM "_mmx_one, %%mm3\n" /* add 1 */
|
||||
- "paddw " ASMSYM "_mmx_one, %%mm6\n" /* add 1 */
|
||||
+ "paddw (%8), %%mm3\n" /* add 1 */
|
||||
+ "paddw (%8), %%mm6\n" /* add 1 */
|
||||
"packuswb %%mm5, %%mm4\n" /* pack to byte and saturate */
|
||||
"movq 1(%3), %%mm1\n" /* mm1 = [ref+1] */
|
||||
"movq %%mm1, %%mm2\n" /* mm2 = mm1 */
|
||||
@@ -90,7 +90,7 @@ static void inline mmx_interpolate_signe
|
||||
"movl 12(%0), %3\n" /* %3 = ref[3] */
|
||||
"movq %%mm3, (%3)\n" /* store in frame */
|
||||
: "=r"(ref), "=r"(pitch), "=r"(rc), "=r"(dummy)
|
||||
- : "0"(ref), "1"(pitch), "2"(rc), "3"(dummy)
|
||||
+ : "0"(ref), "1"(pitch), "2"(rc), "3"(dummy), "r"(_mmx_one)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
diff -pruN libfame-0.9.1.orig/src/idct_mmx.h libfame-0.9.1/src/idct_mmx.h
|
||||
--- libfame-0.9.1.orig/src/idct_mmx.h 2008-08-02 23:18:19.160143502 +1000
|
||||
+++ libfame-0.9.1/src/idct_mmx.h 2008-08-02 23:19:00.557139019 +1000
|
||||
@@ -18,6 +18,10 @@
|
||||
*/
|
||||
/*************************** MMX accelerated iDCT ****************************/
|
||||
|
||||
+extern FAME_ALIGNED short const _mmx_1[];
|
||||
+extern FAME_ALIGNED short const _mmx_cos[];
|
||||
+extern FAME_ALIGNED short const _mmx_icos[];
|
||||
+
|
||||
static void inline idct_aan_pass(dct_t * block)
|
||||
{
|
||||
// register unsigned short const *mmx_icos = _mmx_icos;
|
||||
@@ -65,9 +69,9 @@ static void inline idct_aan_pass(dct_t *
|
||||
block[row*8+6] = v45; - v71, v11, v44, v65, v24 -
|
||||
*/
|
||||
"psllw $0x02, %%mm5\n" /* adjust v22 for multiply */
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm5\n" /* + 1 for rounding */
|
||||
+ "paddw (%2), %%mm5\n" /* + 1 for rounding */
|
||||
// "pmulhw 8(%1), %%mm5\n" /* 4*v15*ICOS4/4 -> mm5 (v23) */
|
||||
- "pmulhw " ASMSYM "_mmx_icos+8, %%mm5\n" /* 4*v15*ICOS4/4 -> mm5 (v23)*/
|
||||
+ "pmulhw 8(%3), %%mm5\n" /* 4*v15*ICOS4/4 -> mm5 (v23)*/
|
||||
"psubsw %%mm4, %%mm5\n" /* v23 - v62 -> mm5 (v24) */
|
||||
"movq %%mm3, %%mm6\n" /* v44 -> mm6 */
|
||||
"paddsw %%mm5, %%mm6\n" /* v44 + v24 -> mm6 (v45) */
|
||||
@@ -125,25 +129,25 @@ static void inline idct_aan_pass(dct_t *
|
||||
block[row*8+4] += v55; - -
|
||||
*/
|
||||
"psllw $0x02, %%mm0\n" /* adjust v12 for multiply */
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm0\n" /* + 1 for rounding */
|
||||
+ "paddw (%2), %%mm0\n" /* + 1 for rounding */
|
||||
// "pmulhw 8(%1), %%mm0\n" /* 4*v12*ICOS4/4 -> mm0 (v13) */
|
||||
- "pmulhw " ASMSYM "_mmx_icos+8, %%mm0\n" /* 4*v12*ICOS4/4 -> mm0 (v13) */
|
||||
+ "pmulhw 8(%3), %%mm0\n" /* 4*v12*ICOS4/4 -> mm0 (v13) */
|
||||
"movq %%mm2, %%mm6\n" /* v51 -> mm6 */
|
||||
"psubsw %%mm1, %%mm6\n" /* v51 - v71 -> mm6 (va2) */
|
||||
"psllw $0x03, %%mm2\n" /* adjust v51 for multiply */
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm2\n" /* + 1 for rounding */
|
||||
+ "paddw (%2), %%mm2\n" /* + 1 for rounding */
|
||||
/* should add another one here but it seems to look better without */
|
||||
// "pmulhw 16(%1), %%mm2\n" /* 8*v51*ICOS6/8 -> mm2 (v53) */
|
||||
- "pmulhw " ASMSYM "_mmx_icos+16, %%mm2\n" /* 8*v51*ICOS6/8 -> mm2 (v53) */
|
||||
+ "pmulhw 16(%3), %%mm2\n" /* 8*v51*ICOS6/8 -> mm2 (v53) */
|
||||
"psllw $0x02, %%mm1\n" /* adjust v71 for multiply */
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm1\n" /* + 1 for rounding */
|
||||
+ "paddw (%2), %%mm1\n" /* + 1 for rounding */
|
||||
/* should add another one here but it seems to look better without */
|
||||
// "pmulhw 0(%1), %%mm1\n" /* 4*v71*ICOS2/4 -> mm1 (v73) */
|
||||
- "pmulhw " ASMSYM "_mmx_icos, %%mm1\n" /* 4*v71*ICOS2/4 -> mm1 (v73) */
|
||||
+ "pmulhw (%3), %%mm1\n" /* 4*v71*ICOS2/4 -> mm1 (v73) */
|
||||
"psllw $0x01, %%mm6\n" /* adjust va2 for multiply */
|
||||
- "paddw " ASMSYM "_mmx_1, %%mm6\n" /* + 1 for rounding */
|
||||
+ "paddw (%2), %%mm6\n" /* + 1 for rounding */
|
||||
// "pmulhw 24(%1), %%mm6\n" /* 2*v12*ICOS8/2 -> mm6 (va3) */
|
||||
- "pmulhw " ASMSYM "_mmx_icos+24, %%mm6\n" /* 2*v12*ICOS8/2 -> mm6 (va3) */
|
||||
+ "pmulhw 24(%3), %%mm6\n" /* 2*v12*ICOS8/2 -> mm6 (va3) */
|
||||
"psubsw %%mm6, %%mm2\n" /* v53 - va3 -> mm2 (v54) */
|
||||
"psubsw %%mm6, %%mm1\n" /* v73 - va3 -> mm1 (v74) */
|
||||
"psubsw %%mm3, %%mm1\n" /* v74 - v32 -> mm3 (v75) */
|
||||
@@ -167,8 +171,8 @@ static void inline idct_aan_pass(dct_t *
|
||||
"paddsw %%mm0, %%mm7\n" /* v65 + v55 -> mm7 */
|
||||
"movq %%mm6, 0x30(%0)\n" /* mm6 -> line 3 */
|
||||
"movq %%mm7, 0x40(%0)\n" /* mm7 -> line 4 */
|
||||
- : "=r"(block)/*, "=r"(mmx_icos)*/
|
||||
- : "0"(block)/*, "1"(mmx_icos)*/
|
||||
+ : "=r"(block)
|
||||
+ : "0"(block), "r"(_mmx_1), "r"(_mmx_icos)
|
||||
: "memory");
|
||||
}
|
||||
|
133
libfame/libfame-0.9.1-mmx.patch
Normal file
133
libfame/libfame-0.9.1-mmx.patch
Normal file
@ -0,0 +1,133 @@
|
||||
diff -pruN libfame-0.9.1.orig/src/fame_decoder_mpeg.c libfame-0.9.1/src/fame_decoder_mpeg.c
|
||||
--- libfame-0.9.1.orig/src/fame_decoder_mpeg.c 2008-08-02 22:44:06.860141435 +1000
|
||||
+++ libfame-0.9.1/src/fame_decoder_mpeg.c 2008-08-02 22:55:42.516142586 +1000
|
||||
@@ -78,7 +78,9 @@ static void mpeg_pad(fame_decoder_t *dec
|
||||
fame_box_t *box);
|
||||
static void mpeg_interpolate(fame_decoder_t *decoder, int rounding);
|
||||
static void mpeg_leave(fame_decoder_t *decoder);
|
||||
+#ifdef HAS_MMX
|
||||
static void mpeg_close(fame_decoder_t *decoder);
|
||||
+#endif
|
||||
|
||||
FAME_CONSTRUCTOR(fame_decoder_mpeg_t)
|
||||
{
|
||||
@@ -90,7 +92,11 @@ FAME_CONSTRUCTOR(fame_decoder_mpeg_t)
|
||||
FAME_DECODER(this)->pad = mpeg_pad;
|
||||
FAME_DECODER(this)->interpolate = mpeg_interpolate;
|
||||
FAME_DECODER(this)->leave = mpeg_leave;
|
||||
+#ifdef HAS_MMX
|
||||
FAME_DECODER(this)->close = mpeg_close;
|
||||
+#else
|
||||
+ FAME_DECODER(this)->close = NULL;
|
||||
+#endif
|
||||
return(this);
|
||||
}
|
||||
|
||||
@@ -603,6 +609,7 @@ static void mpeg_leave(fame_decoder_t *d
|
||||
arch_leave_state();
|
||||
}
|
||||
|
||||
+#ifdef HAS_MMX
|
||||
/* mpeg_close */
|
||||
/* */
|
||||
/* Description: */
|
||||
@@ -618,7 +625,6 @@ static void mpeg_close(fame_decoder_t *d
|
||||
{
|
||||
fame_decoder_mpeg_t *decoder_mpeg = FAME_DECODER_MPEG(decoder);
|
||||
|
||||
-#ifdef HAS_MMX
|
||||
/* free mismatch accumulator */
|
||||
{
|
||||
int i;
|
||||
@@ -626,5 +632,5 @@ static void mpeg_close(fame_decoder_t *d
|
||||
for(i = 0; i < 6; i++)
|
||||
fame_free(decoder_mpeg->mismatch_accumulator[i]);
|
||||
}
|
||||
-#endif
|
||||
}
|
||||
+#endif
|
||||
diff -pruN libfame-0.9.1.orig/src/half_mmx.h libfame-0.9.1/src/half_mmx.h
|
||||
--- libfame-0.9.1.orig/src/half_mmx.h 2008-08-02 22:44:06.856141130 +1000
|
||||
+++ libfame-0.9.1/src/half_mmx.h 2008-08-02 22:51:49.078142536 +1000
|
||||
@@ -28,10 +28,10 @@ static void inline mmx_interpolate(unsig
|
||||
short _mmx_rc[4]; /* rounding control */
|
||||
register short *rc = _mmx_rc;
|
||||
|
||||
- _mmx_rc[0] = 1 - rounding;
|
||||
- _mmx_rc[1] = 1 - rounding;
|
||||
- _mmx_rc[2] = 1 - rounding;
|
||||
- _mmx_rc[3] = 1 - rounding;
|
||||
+ _mmx_rc[0] = _mmx_one[0] - rounding;
|
||||
+ _mmx_rc[1] = _mmx_one[1] - rounding;
|
||||
+ _mmx_rc[2] = _mmx_one[2] - rounding;
|
||||
+ _mmx_rc[3] = _mmx_one[3] - rounding;
|
||||
|
||||
asm volatile ("movl (%0), %3\n" /* %3 = ref[0] */
|
||||
"pxor %%mm7, %%mm7\n" /* mm7 = 0 */
|
||||
diff -pruN libfame-0.9.1.orig/src/mae_int.h libfame-0.9.1/src/mae_int.h
|
||||
--- libfame-0.9.1.orig/src/mae_int.h 2008-08-02 22:44:06.862141891 +1000
|
||||
+++ libfame-0.9.1/src/mae_int.h 2008-08-02 22:55:42.517140304 +1000
|
||||
@@ -18,10 +18,10 @@
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
-static unsigned int MAE8x8_withmask(unsigned char *ref,
|
||||
- unsigned char *input,
|
||||
- unsigned char *shape,
|
||||
- int pitch)
|
||||
+static inline unsigned int
|
||||
+MAE8x8_withmask(unsigned char *ref, unsigned char *input,
|
||||
+ unsigned char *shape,
|
||||
+ int pitch)
|
||||
{
|
||||
int j,i;
|
||||
|
||||
@@ -41,10 +41,11 @@ static unsigned int MAE8x8_withmask(unsi
|
||||
return error;
|
||||
}
|
||||
|
||||
-static unsigned int MAE8x8_withoutmask(unsigned char *ref,
|
||||
- unsigned char *input,
|
||||
- unsigned char *shape,
|
||||
- int pitch)
|
||||
+static inline unsigned int
|
||||
+MAE8x8_withoutmask(unsigned char *ref,
|
||||
+ unsigned char *input,
|
||||
+ unsigned char *shape,
|
||||
+ int pitch)
|
||||
{
|
||||
int j,i;
|
||||
|
||||
diff -pruN libfame-0.9.1.orig/src/mae_mmx.h libfame-0.9.1/src/mae_mmx.h
|
||||
--- libfame-0.9.1.orig/src/mae_mmx.h 2008-08-02 22:44:06.855143632 +1000
|
||||
+++ libfame-0.9.1/src/mae_mmx.h 2008-08-02 22:55:42.517140304 +1000
|
||||
@@ -18,10 +18,10 @@
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
-static unsigned int MAE8x8_withmask(unsigned char *ref,
|
||||
- unsigned char *input,
|
||||
- unsigned char *shape,
|
||||
- int pitch)
|
||||
+static inline unsigned int
|
||||
+MAE8x8_withmask(unsigned char *ref, unsigned char *input,
|
||||
+ unsigned char *shape,
|
||||
+ int pitch)
|
||||
{
|
||||
int dummy;
|
||||
unsigned long retval;
|
||||
@@ -70,10 +70,10 @@ static unsigned int MAE8x8_withmask(unsi
|
||||
return (retval&65535);
|
||||
}
|
||||
|
||||
-static unsigned int MAE8x8_withoutmask(unsigned char *ref,
|
||||
- unsigned char *input,
|
||||
- unsigned char *shape,
|
||||
- int pitch)
|
||||
+static inline unsigned int
|
||||
+MAE8x8_withoutmask(unsigned char *ref, unsigned char *input,
|
||||
+ unsigned char *shape,
|
||||
+ int pitch)
|
||||
{
|
||||
int dummy;
|
||||
unsigned long retval;
|
19
libfame/libfame-0.9.1-ptr-null-check.patch
Normal file
19
libfame/libfame-0.9.1-ptr-null-check.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff -pruN libfame-0.9.1.orig/src/fame_malloc.c libfame-0.9.1/src/fame_malloc.c
|
||||
--- libfame-0.9.1.orig/src/fame_malloc.c 2008-08-02 22:44:06.858140887 +1000
|
||||
+++ libfame-0.9.1/src/fame_malloc.c 2008-08-02 23:05:08.693143429 +1000
|
||||
@@ -36,9 +36,13 @@ void* fame_malloc(size_t size)
|
||||
*/
|
||||
|
||||
ptr = (unsigned char*) malloc(size+ALIGN);
|
||||
- aligned = (unsigned char*) (((unsigned int)ptr & (~(ALIGN-1))) + ALIGN );
|
||||
+ if (ptr == NULL) {
|
||||
+ perror("fame_malloc");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ aligned = (unsigned char*) (((uintptr_t)ptr & (~(ALIGN-1))) + ALIGN );
|
||||
padding = aligned - 1;
|
||||
- *padding = (ALIGN-1) - ((unsigned int)ptr & (ALIGN-1));
|
||||
+ *padding = (ALIGN-1) - ((uintptr_t)ptr & (ALIGN-1));
|
||||
|
||||
return ((void*)aligned);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user