summaryrefslogtreecommitdiff
path: root/src/post/deinterlace
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-03 00:38:22 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-03 00:38:22 +0200
commit0ed2cd4f34189ec303dfac5a30de0abae0decba8 (patch)
tree7a8d08d25ca7c81daa9d6cd65fd4f633fd676b41 /src/post/deinterlace
parent6081bc9a06ee97333769f77a9e5c18a15afb29da (diff)
parent3dd7d925c2feb7868a49e7a1a0b953a5aab233f0 (diff)
downloadxine-lib-0ed2cd4f34189ec303dfac5a30de0abae0decba8.tar.gz
xine-lib-0ed2cd4f34189ec303dfac5a30de0abae0decba8.tar.bz2
Merge changes happened in 1.1 development.
Diffstat (limited to 'src/post/deinterlace')
-rw-r--r--src/post/deinterlace/.hgignore (renamed from src/post/deinterlace/.cvsignore)0
-rw-r--r--src/post/deinterlace/plugins/.hgignore (renamed from src/post/deinterlace/plugins/.cvsignore)0
-rw-r--r--src/post/deinterlace/plugins/greedy2frame_template.c33
-rw-r--r--src/post/deinterlace/plugins/greedyh.asm66
-rw-r--r--src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h4
-rw-r--r--src/post/deinterlace/plugins/x86-64_macros.inc4
6 files changed, 56 insertions, 51 deletions
diff --git a/src/post/deinterlace/.cvsignore b/src/post/deinterlace/.hgignore
index 7d926a554..7d926a554 100644
--- a/src/post/deinterlace/.cvsignore
+++ b/src/post/deinterlace/.hgignore
diff --git a/src/post/deinterlace/plugins/.cvsignore b/src/post/deinterlace/plugins/.hgignore
index 7d926a554..7d926a554 100644
--- a/src/post/deinterlace/plugins/.cvsignore
+++ b/src/post/deinterlace/plugins/.hgignore
diff --git a/src/post/deinterlace/plugins/greedy2frame_template.c b/src/post/deinterlace/plugins/greedy2frame_template.c
index 42c575f58..728bceed5 100644
--- a/src/post/deinterlace/plugins/greedy2frame_template.c
+++ b/src/post/deinterlace/plugins/greedy2frame_template.c
@@ -1,5 +1,5 @@
/*****************************************************************************
-** $Id: greedy2frame_template.c,v 1.9 2006/02/04 14:06:29 miguelfreitas Exp $
+** $Id: greedy2frame_template.c,v 1.10 2006/12/21 09:54:45 dgp85 Exp $
******************************************************************************
** Copyright (c) 2000 John Adcock, Tom Barry, Steve Grimm All rights reserved.
** port copyright (c) 2003 Miguel Freitas
@@ -19,6 +19,9 @@
** CVS Log
**
** $Log: greedy2frame_template.c,v $
+** Revision 1.10 2006/12/21 09:54:45 dgp85
+** Apply the textrel patch from Gentoo, thanks to PaX team for providing it. The patch was applied and tested for a while in Gentoo and Pardus, and solves also Debian's problems with non-PIC code. If problems will arise, they'll be debugged.
+**
** Revision 1.9 2006/02/04 14:06:29 miguelfreitas
** Enable AMD64 mmx/sse support in some plugins (tvtime, libmpeg2, goom...)
** patch by dani3l
@@ -187,7 +190,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride,
* See above for a description of the algorithm.
*/
".align 8 \n\t"
- "movq "MANGLE(Mask)", %%mm6 \n\t"
+ "movq %4, %%mm6 \n\t"
"movq %0, %%mm1 \n\t" // T1
"movq %1, %%mm0 \n\t" // M1
@@ -195,7 +198,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride,
"movq %3, %%mm2 \n\t" // M0
: /* no output */
: "m" (*T1), "m" (*M1),
- "m" (*B1), "m" (*M0) );
+ "m" (*B1), "m" (*M0), "m" (Mask) );
asm volatile(
@@ -252,10 +255,10 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride,
#endif
/* if |M1-M0| > Threshold we want dword worth of twos */
- "pcmpgtb "MANGLE(qwGreedyTwoFrameThreshold)", %%mm4 \n\t"
- "pand "MANGLE(Mask)", %%mm4 \n\t" /* get rid of sign bit */
- "pcmpgtd "MANGLE(DwordOne)", %%mm4 \n\t" /* do we want to bob */
- "pandn "MANGLE(DwordTwo)", %%mm4 \n\t"
+ "pcmpgtb %3, %%mm4 \n\t"
+ "pand %4, %%mm4 \n\t" /* get rid of sign bit */
+ "pcmpgtd %5, %%mm4 \n\t" /* do we want to bob */
+ "pandn %6, %%mm4 \n\t"
"movq %1, %%mm2 \n\t" /* mm2 = T0 */
@@ -268,11 +271,11 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride,
"pand %%mm6, %%mm5 \n\t"
/* if |T1-T0| > Threshold we want dword worth of ones */
- "pcmpgtb "MANGLE(qwGreedyTwoFrameThreshold)", %%mm5 \n\t"
+ "pcmpgtb %3, %%mm5 \n\t"
"pand %%mm6, %%mm5 \n\t" /* get rid of sign bit */
- "pcmpgtd "MANGLE(DwordOne)", %%mm5 \n\t"
- "pandn "MANGLE(DwordOne)", %%mm5 \n\t"
+ "pcmpgtd %5, %%mm5 \n\t"
+ "pandn %5, %%mm5 \n\t"
"paddd %%mm5, %%mm4 \n\t"
"movq %2, %%mm2 \n\t" /* B0 */
@@ -286,13 +289,13 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride,
"pand %%mm6, %%mm5 \n\t"
/* if |B1-B0| > Threshold we want dword worth of ones */
- "pcmpgtb "MANGLE(qwGreedyTwoFrameThreshold)", %%mm5 \n\t"
+ "pcmpgtb %3, %%mm5 \n\t"
"pand %%mm6, %%mm5 \n\t" /* get rid of any sign bit */
- "pcmpgtd "MANGLE(DwordOne)", %%mm5 \n\t"
- "pandn "MANGLE(DwordOne)", %%mm5 \n\t"
+ "pcmpgtd %5, %%mm5 \n\t"
+ "pandn %5, %%mm5 \n\t"
"paddd %%mm5, %%mm4 \n\t"
- "pcmpgtd "MANGLE(DwordTwo)", %%mm4 \n\t"
+ "pcmpgtd %6, %%mm4 \n\t"
/* debugging feature
* output the value of mm4 at this point which is pink where we will weave
@@ -318,7 +321,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride,
#endif
: "=m" (*Dest2)
- : "m" (*T0), "m" (*B0) );
+ : "m" (*T0), "m" (*B0), "m" (qwGreedyTwoFrameThreshold), "m" (Mask), "m" (DwordOne), "m" (DwordTwo) );
/* Advance to the next set of pixels. */
T1 += 8;
diff --git a/src/post/deinterlace/plugins/greedyh.asm b/src/post/deinterlace/plugins/greedyh.asm
index 0bbd745aa..11b28ca76 100644
--- a/src/post/deinterlace/plugins/greedyh.asm
+++ b/src/post/deinterlace/plugins/greedyh.asm
@@ -43,7 +43,6 @@ static void FUNCT_NAME(uint8_t *output, int outstride,
int Line;
long LoopCtr;
- long oldbx;
unsigned int Pitch = stride*2;
int FieldHeight = height / 2;
@@ -52,6 +51,7 @@ static void FUNCT_NAME(uint8_t *output, int outstride,
unsigned char* L3; // ptr to Line3
unsigned char* L2P; // ptr to prev Line2
+ unsigned char* temp;
unsigned char* Dest = output;
int64_t LastAvg=0; //interp value from left qword
@@ -121,25 +121,21 @@ static void FUNCT_NAME(uint8_t *output, int outstride,
#define asmLastAvg "%0"
#define asmL1 "%1"
#define asmL3 "%2"
-#define asmL2P "%3"
+#define asmtemp "%3"
#define asmL2 "%4"
#define asmDest "%5"
#define asmLoopCtr "%6"
-#define asmoldbx "%7"
#endif
// For ease of reading, the comments below assume that we're operating on an odd
// field (i.e., that InfoIsOdd is true). Assume the obvious for even lines..
+ temp = L2P;
__asm__ __volatile__
(
- // save ebx (-fPIC)
- MOVX" %%"XBX", "asmoldbx"\n\t"
-
MOVX" "asmL1", %%"XAX"\n\t"
- LEAX" 8(%%"XAX"), %%"XBX"\n\t" // next qword needed by DJR
+ LEAX" 8(%%"XAX"), %%"XDX"\n\t" // next qword needed by DJR
MOVX" "asmL3", %%"XCX"\n\t"
SUBX" %%"XAX", %%"XCX"\n\t" // carry L3 addr as an offset
- MOVX" "asmL2P", %%"XDX"\n\t"
MOVX" "asmL2", %%"XSI"\n\t"
MOVX" "asmDest", %%"XDI"\n\t" // DL1 if Odd or DL2 if Even
@@ -148,11 +144,14 @@ static void FUNCT_NAME(uint8_t *output, int outstride,
"movq (%%"XSI"), %%mm0\n\t" // L2 - the newest weave pixel value
"movq (%%"XAX"), %%mm1\n\t" // L1 - the top pixel
+ PUSHX" %%"XDX "\n\t"
+ MOVX" "asmtemp", %%"XDX"\n\t"
"movq (%%"XDX"), %%mm2\n\t" // L2P - the prev weave pixel
+ POPX" %%"XDX "\n\t"
"movq (%%"XAX", %%"XCX"), %%mm3\n\t" // L3, next odd row
"movq %%mm1, %%mm6\n\t" // L1 - get simple single pixel interp
// pavgb mm6, mm3 // use macro below
- V_PAVGB ("%%mm6", "%%mm3", "%%mm4", MANGLE(ShiftMask))
+ V_PAVGB ("%%mm6", "%%mm3", "%%mm4", "%8")
// DJR - Diagonal Jaggie Reduction
// In the event that we are going to use an average (Bob) pixel we do not want a jagged
@@ -166,24 +165,24 @@ static void FUNCT_NAME(uint8_t *output, int outstride,
"psllq $16, %%mm7\n\t" // left justify 3 pixels
"por %%mm7, %%mm4\n\t" // and combine
- "movq (%%"XBX"), %%mm5\n\t" // next horiz qword from L1
+ "movq (%%"XDX"), %%mm5\n\t" // next horiz qword from L1
// pavgb mm5, qword ptr[ebx+ecx] // next horiz qword from L3, use macro below
- V_PAVGB ("%%mm5", "(%%"XBX",%%"XCX")", "%%mm7", MANGLE(ShiftMask))
+ V_PAVGB ("%%mm5", "(%%"XDX",%%"XCX")", "%%mm7", "%8")
"psllq $48, %%mm5\n\t" // left just 1 pixel
"movq %%mm6, %%mm7\n\t" // another copy of simple bob pixel
"psrlq $16, %%mm7\n\t" // right just 3 pixels
"por %%mm7, %%mm5\n\t" // combine
// pavgb mm4, mm5 // avg of forward and prev by 1 pixel, use macro
- V_PAVGB ("%%mm4", "%%mm5", "%%mm5", MANGLE(ShiftMask)) // mm5 gets modified if MMX
+ V_PAVGB ("%%mm4", "%%mm5", "%%mm5", "%8") // mm5 gets modified if MMX
// pavgb mm6, mm4 // avg of center and surround interp vals, use macro
- V_PAVGB ("%%mm6", "%%mm4", "%%mm7", MANGLE(ShiftMask))
+ V_PAVGB ("%%mm6", "%%mm4", "%%mm7", "%8")
// Don't do any more averaging than needed for mmx. It hurts performance and causes rounding errors.
#ifndef IS_MMX
// pavgb mm4, mm6 // 1/4 center, 3/4 adjacent
- V_PAVGB ("%%mm4", "%%mm6", "%%mm7", MANGLE(ShiftMask))
+ V_PAVGB ("%%mm4", "%%mm6", "%%mm7", "%8")
// pavgb mm6, mm4 // 3/8 center, 5/8 adjacent
- V_PAVGB ("%%mm6", "%%mm4", "%%mm7", MANGLE(ShiftMask))
+ V_PAVGB ("%%mm6", "%%mm4", "%%mm7", "%8")
#endif
// get abs value of possible L2 comb
@@ -236,64 +235,71 @@ static void FUNCT_NAME(uint8_t *output, int outstride,
// pminub mm5, mm3 // now = Min(L1,L3), use macro
V_PMINUB ("%%mm5", "%%mm3", "%%mm7")
// allow the value to be above the high or below the low by amt of MaxComb
- "psubusb "MANGLE(MaxComb)", %%mm5\n\t" // lower min by diff
- "paddusb "MANGLE(MaxComb)", %%mm2\n\t" // increase max by diff
+ "psubusb %9, %%mm5\n\t" // lower min by diff
+ "paddusb %9, %%mm2\n\t" // increase max by diff
// pmaxub mm4, mm5 // now = Max(best,Min(L1,L3) use macro
V_PMAXUB ("%%mm4", "%%mm5")
// pminub mm4, mm2 // now = Min( Max(best, Min(L1,L3), L2 )=L2 clipped
V_PMINUB ("%%mm4", "%%mm2", "%%mm7")
// Blend weave pixel with bob pixel, depending on motion val in mm0
- "psubusb "MANGLE(MotionThreshold)", %%mm0\n\t"// test Threshold, clear chroma change >>>??
- "pmullw "MANGLE(MotionSense)", %%mm0\n\t" // mul by user factor, keep low 16 bits
- "movq "MANGLE(QW256)", %%mm7\n\t"
+ "psubusb %10, %%mm0\n\t"// test Threshold, clear chroma change >>>??
+ "pmullw %11, %%mm0\n\t" // mul by user factor, keep low 16 bits
+ "movq %12, %%mm7\n\t"
#ifdef IS_SSE
"pminsw %%mm7, %%mm0\n\t" // max = 256
#else
- "paddusw "MANGLE(QW256B)", %%mm0\n\t" // add, may sat at fff..
- "psubusw "MANGLE(QW256B)", %%mm0\n\t" // now = Min(L1,256)
+ "paddusw %13, %%mm0\n\t" // add, may sat at fff..
+ "psubusw %13, %%mm0\n\t" // now = Min(L1,256)
#endif
"psubusw %%mm0, %%mm7\n\t" // so the 2 sum to 256, weighted avg
"movq %%mm4, %%mm2\n\t" // save weave chroma info before trashing
- "pand "MANGLE(YMask)", %%mm4\n\t" // keep only luma from calc'd value
+ "pand %14, %%mm4\n\t" // keep only luma from calc'd value
"pmullw %%mm7, %%mm4\n\t" // use more weave for less motion
- "pand "MANGLE(YMask)", %%mm6\n\t" // keep only luma from calc'd value
+ "pand %14, %%mm6\n\t" // keep only luma from calc'd value
"pmullw %%mm0, %%mm6\n\t" // use more bob for large motion
"paddusw %%mm6, %%mm4\n\t" // combine
"psrlw $8, %%mm4\n\t" // div by 256 to get weighted avg
// chroma comes from weave pixel
- "pand "MANGLE(UVMask)", %%mm2\n\t" // keep chroma
+ "pand %15, %%mm2\n\t" // keep chroma
"por %%mm4, %%mm2\n\t" // and combine
V_MOVNTQ ("(%%"XDI")", "%%mm2") // move in our clipped best, use macro
// bump ptrs and loop
LEAX" 8(%%"XAX"), %%"XAX"\n\t"
- LEAX" 8(%%"XBX"), %%"XBX"\n\t"
LEAX" 8(%%"XDX"), %%"XDX"\n\t"
+ ADDX" $8, "asmtemp"\n\t"
LEAX" 8(%%"XDI"), %%"XDI"\n\t"
LEAX" 8(%%"XSI"), %%"XSI"\n\t"
DECX" "asmLoopCtr"\n\t"
"jg 1b\n\t" // loop if not to last line
// note P-III default assumes backward branches taken
"jl 1f\n\t" // done
- MOVX" %%"XAX", %%"XBX"\n\t" // sharpness lookahead 1 byte only, be wrong on 1
+ MOVX" %%"XAX", %%"XDX"\n\t" // sharpness lookahead 1 byte only, be wrong on 1
"jmp 1b\n\t"
"1:\n\t"
- MOVX" "asmoldbx", %%"XBX"\n\t"
: /* no outputs */
: "m"(LastAvg),
"m"(L1),
"m"(L3),
- "m"(L2P),
+ "m"(temp),
"m"(L2),
"m"(Dest),
"m"(LoopCtr),
- "m"(oldbx)
+ "m"(temp),
+ "m"(ShiftMask),
+ "m"(MaxComb),
+ "m"(MotionThreshold),
+ "m"(MotionSense),
+ "m"(QW256),
+ "m"(QW256B),
+ "m"(YMask),
+ "m"(UVMask)
: XAX, XCX, XDX, XSI, XDI,
#ifdef ARCH_X86
diff --git a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h
index 3d7ae308e..a3b92a51c 100644
--- a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h
+++ b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h
@@ -1,8 +1,6 @@
#include <string.h>
#include <math.h>
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
+#include <stdlib.h>
#define USE_FOR_DSCALER
diff --git a/src/post/deinterlace/plugins/x86-64_macros.inc b/src/post/deinterlace/plugins/x86-64_macros.inc
index 3dfd9b63a..b52227763 100644
--- a/src/post/deinterlace/plugins/x86-64_macros.inc
+++ b/src/post/deinterlace/plugins/x86-64_macros.inc
@@ -34,8 +34,7 @@
#ifndef XAX
-#if defined (ARCH_X86)
-
+#if defined (ARCH_X86) && !defined (ARCH_X86_64)
#define XAX "eax"
#define XBX "ebx"
#define XCX "ecx"
@@ -55,7 +54,6 @@
#define SUBX "subl"
#elif defined (ARCH_X86_64)
-
#define XAX "rax"
#define XBX "rbx"
#define XCX "rcx"