summaryrefslogtreecommitdiff
path: root/src/post
diff options
context:
space:
mode:
Diffstat (limited to 'src/post')
-rw-r--r--src/post/.hgignore (renamed from src/post/.cvsignore)0
-rw-r--r--src/post/audio/.hgignore (renamed from src/post/audio/.cvsignore)0
-rw-r--r--src/post/audio/Makefile.am2
-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
-rw-r--r--src/post/goom/.hgignore (renamed from src/post/goom/.cvsignore)0
-rw-r--r--src/post/goom/Makefile.am5
-rw-r--r--src/post/goom/mmx.c2
-rw-r--r--src/post/goom/xine_goom.c32
-rw-r--r--src/post/goom/xmmx.c1
-rw-r--r--src/post/mosaico/.hgignore (renamed from src/post/mosaico/.cvsignore)0
-rw-r--r--src/post/mosaico/Makefile.am4
-rw-r--r--src/post/planar/.hgignore (renamed from src/post/planar/.cvsignore)0
-rw-r--r--src/post/planar/Makefile.am2
-rw-r--r--src/post/planar/eq.c4
-rw-r--r--src/post/planar/eq2.c10
-rw-r--r--src/post/planar/expand.c111
-rw-r--r--src/post/planar/noise.c8
-rw-r--r--src/post/visualizations/.hgignore (renamed from src/post/visualizations/.cvsignore)0
-rw-r--r--src/post/visualizations/Makefile.am2
-rw-r--r--src/post/visualizations/fftgraph.c22
-rw-r--r--src/post/visualizations/fftscope.c22
-rw-r--r--src/post/visualizations/fooviz.c22
-rw-r--r--src/post/visualizations/oscope.c22
28 files changed, 256 insertions, 122 deletions
diff --git a/src/post/.cvsignore b/src/post/.hgignore
index 282522db0..282522db0 100644
--- a/src/post/.cvsignore
+++ b/src/post/.hgignore
diff --git a/src/post/audio/.cvsignore b/src/post/audio/.hgignore
index 7d926a554..7d926a554 100644
--- a/src/post/audio/.cvsignore
+++ b/src/post/audio/.hgignore
diff --git a/src/post/audio/Makefile.am b/src/post/audio/Makefile.am
index 7ed37bc5b..9cb93dd5a 100644
--- a/src/post/audio/Makefile.am
+++ b/src/post/audio/Makefile.am
@@ -8,7 +8,7 @@ lib_LTLIBRARIES = xineplug_post_audio_filters.la
xineplug_post_audio_filters_la_SOURCES = \
upmix.c upmix_mono.c filter.c window.c stretch.c volnorm.c audio_filters.c
-xineplug_post_audio_filters_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) -lm
+xineplug_post_audio_filters_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) -lm
xineplug_post_audio_filters_la_CFLAGS = $(VISIBILITY_FLAG)
xineplug_post_audio_filters_la_LDFLAGS = -avoid-version -module
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"
diff --git a/src/post/goom/.cvsignore b/src/post/goom/.hgignore
index 7d926a554..7d926a554 100644
--- a/src/post/goom/.cvsignore
+++ b/src/post/goom/.hgignore
diff --git a/src/post/goom/Makefile.am b/src/post/goom/Makefile.am
index 5905c16cf..4aeda8f04 100644
--- a/src/post/goom/Makefile.am
+++ b/src/post/goom/Makefile.am
@@ -18,9 +18,8 @@ lib_LTLIBRARIES = xineplug_post_goom.la
#AM_CPPFLAGS = -DCPU_POWERPC
#endif
-if HAVE_FFMMX
+if HAVE_MMX
extra_files = mmx.c xmmx.c
-AM_CPPFLAGS = -DHAVE_MMX
endif
xineplug_post_goom_la_SOURCES = $(extra_files) xine_goom.c \
@@ -28,7 +27,7 @@ xineplug_post_goom_la_SOURCES = $(extra_files) xine_goom.c \
gfontlib.c goom_core.c goom_tools.c goomsl.c goomsl_hash.c goomsl_heap.c \
goomsl_lex.c goomsl_yacc.c graphic.c ifs.c lines.c \
plugin_info.c sound_tester.c surf3d.c tentacle3d.c v3d.c
-xineplug_post_goom_la_LIBADD = $(XINE_LIB) $(GOOM_LIBS) $(THREAD_LIBS)
+xineplug_post_goom_la_LIBADD = $(XINE_LIB) $(GOOM_LIBS) $(PTHREAD_LIBS) -lm
xineplug_post_goom_la_CFLAGS = $(VISIBILITY_FLAG)
xineplug_post_goom_la_LDFLAGS = -avoid-version -module
diff --git a/src/post/goom/mmx.c b/src/post/goom/mmx.c
index 5f887cf77..e2f25b47d 100644
--- a/src/post/goom/mmx.c
+++ b/src/post/goom/mmx.c
@@ -1,3 +1,5 @@
+#include "config.h"
+
#ifdef HAVE_MMX
#define BUFFPOINTNB 16
diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c
index f879f1ebc..5871618e0 100644
--- a/src/post/goom/xine_goom.c
+++ b/src/post/goom/xine_goom.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_goom.c,v 1.63 2006/10/23 21:13:44 hadess Exp $
+ * $Id: xine_goom.c,v 1.65 2007/02/20 00:58:51 dgp85 Exp $
*
* GOOM post plugin.
*
@@ -43,7 +43,7 @@
#include "goom.h"
-#define NUMSAMPLES 512
+#define NUMSAMPLES 512 /* hardcoded into goom api */
#define FPS 14
#define GOOM_WIDTH 320
@@ -83,7 +83,7 @@ struct post_plugin_goom_s {
PluginInfo *goom;
int data_idx;
- gint16 data [2][512];
+ gint16 data [2][NUMSAMPLES];
audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */
int channels;
@@ -218,7 +218,7 @@ static void *goom_init_plugin(xine_t *xine, void *data)
cfg->register_enum (cfg, "effects.goom.csc_method", 0,
- (char **)goom_csc_methods,
+ goom_csc_methods,
_("colorspace conversion method"),
_("You can choose the colorspace conversion method used by goom.\n"
"The available selections should be self-explaining."),
@@ -386,6 +386,7 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
this->sample_rate = rate;
this->samples_per_frame = rate / this->fps;
this->data_idx = 0;
+ this->sample_counter = 0;
init_yuv_planes(&this->yuv, this->width, this->height);
this->skip_frame = 0;
@@ -445,7 +446,6 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
buf = &this->buf;
this->sample_counter += buf->num_frames;
-
j = (this->channels >= 2) ? 1 : 0;
do {
@@ -455,7 +455,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
data8 += samples_used * this->channels;
/* scale 8 bit data to 16 bits and convert to signed as well */
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data8 += this->channels ) {
this->data[0][this->data_idx] = ((int16_t)data8[0] << 8) - 0x8000;
this->data[1][this->data_idx] = ((int16_t)data8[j] << 8) - 0x8000;
@@ -464,16 +464,15 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
data = buf->mem;
data += samples_used * this->channels;
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data += this->channels ) {
this->data[0][this->data_idx] = data[0];
this->data[1][this->data_idx] = data[j];
}
}
- if( this->sample_counter >= this->samples_per_frame &&
- this->data_idx == NUMSAMPLES ) {
- this->data_idx = 0;
+ if( this->sample_counter >= this->samples_per_frame ) {
+
samples_used += this->samples_per_frame;
frame = this->vo_port->get_frame (this->vo_port, this->width_back, this->height_back,
@@ -481,14 +480,23 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
- frame->bad_frame = 0;
+
+ /* frame is marked as bad if we don't have enough samples for
+ * updating the viz plugin (calculations may be skipped).
+ * we must keep the framerate though. */
+ if( this->data_idx == NUMSAMPLES ) {
+ frame->bad_frame = 0;
+ this->data_idx = 0;
+ } else {
+ frame->bad_frame = 1;
+ }
frame->duration = 90000 * this->samples_per_frame / this->sample_rate;
frame->pts = pts;
this->metronom->got_video_frame(this->metronom, frame);
this->sample_counter -= this->samples_per_frame;
- if (!this->skip_frame) {
+ if (!this->skip_frame && !frame->bad_frame) {
/* Try to be fast */
goom_frame = (uint8_t *)goom_update (this->goom, this->data, 0, 0, NULL, NULL);
diff --git a/src/post/goom/xmmx.c b/src/post/goom/xmmx.c
index 7fc9acfc8..0048a20e8 100644
--- a/src/post/goom/xmmx.c
+++ b/src/post/goom/xmmx.c
@@ -1,3 +1,4 @@
+#include "config.h"
#ifdef HAVE_MMX
diff --git a/src/post/mosaico/.cvsignore b/src/post/mosaico/.hgignore
index 7d926a554..7d926a554 100644
--- a/src/post/mosaico/.cvsignore
+++ b/src/post/mosaico/.hgignore
diff --git a/src/post/mosaico/Makefile.am b/src/post/mosaico/Makefile.am
index aefb290c6..f5497b1af 100644
--- a/src/post/mosaico/Makefile.am
+++ b/src/post/mosaico/Makefile.am
@@ -5,11 +5,11 @@ libdir = $(XINE_PLUGINDIR)/post
lib_LTLIBRARIES = xineplug_post_mosaico.la xineplug_post_switch.la
xineplug_post_mosaico_la_SOURCES = mosaico.c
-xineplug_post_mosaico_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS)
+xineplug_post_mosaico_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS)
xineplug_post_mosaico_la_CFLAGS = $(VISIBILITY_FLAG)
xineplug_post_mosaico_la_LDFLAGS = -avoid-version -module
xineplug_post_switch_la_SOURCES = switch.c
-xineplug_post_switch_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS)
+xineplug_post_switch_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS)
xineplug_post_switch_la_CFLAGS = $(VISIBILITY_FLAG)
xineplug_post_switch_la_LDFLAGS = -avoid-version -module
diff --git a/src/post/planar/.cvsignore b/src/post/planar/.hgignore
index 7d926a554..7d926a554 100644
--- a/src/post/planar/.cvsignore
+++ b/src/post/planar/.hgignore
diff --git a/src/post/planar/Makefile.am b/src/post/planar/Makefile.am
index 9f8ffed45..cc0647808 100644
--- a/src/post/planar/Makefile.am
+++ b/src/post/planar/Makefile.am
@@ -23,7 +23,7 @@ lib_LTLIBRARIES = xineplug_post_planar.la
xineplug_post_planar_la_SOURCES = planar.c invert.c expand.c fill.c boxblur.c \
denoise3d.c eq.c eq2.c unsharp.c pp.c noise.c
-xineplug_post_planar_la_LIBADD = $(XINE_LIB) $(postproc_lib) -lm $(THREAD_LIBS)
+xineplug_post_planar_la_LIBADD = $(XINE_LIB) $(postproc_lib) -lm $(PTHREAD_LIBS)
xineplug_post_planar_la_LDFLAGS = -avoid-version -module \
@IMPURE_TEXT_LDFLAGS@
xineplug_post_planar_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS)
diff --git a/src/post/planar/eq.c b/src/post/planar/eq.c
index 50fd03b7f..8c7b00e4b 100644
--- a/src/post/planar/eq.c
+++ b/src/post/planar/eq.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: eq.c,v 1.14 2006/02/04 14:06:52 miguelfreitas Exp $
+ * $Id: eq.c,v 1.15 2007/03/22 23:32:05 dgp85 Exp $
*
* mplayer's eq (soft video equalizer)
* Copyright (C) Richard Felker
@@ -52,7 +52,7 @@ static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, in
"movq (%6), %%mm4 \n\t"
"pxor %%mm0, %%mm0 \n\t"
"movl %4, %%eax\n\t"
- ".balign 16 \n\t"
+ ASMALIGN(4)
"1: \n\t"
"movq (%0), %%mm1 \n\t"
"movq (%0), %%mm2 \n\t"
diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c
index 806a4ea6c..38f9117db 100644
--- a/src/post/planar/eq2.c
+++ b/src/post/planar/eq2.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: eq2.c,v 1.16 2006/03/26 14:45:41 valtri Exp $
+ * $Id: eq2.c,v 1.18 2007/03/22 23:32:05 dgp85 Exp $
*
* mplayer's eq2 (soft video equalizer)
* Software equalizer (brightness, contrast, gamma, saturation)
@@ -128,7 +128,7 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src,
"movq (%6), %%mm4 \n\t"
"pxor %%mm0, %%mm0 \n\t"
"movl %4, %%eax\n\t"
- ".balign 16 \n\t"
+ ASMALIGN(4)
"1: \n\t"
"movq (%0), %%mm1 \n\t"
"movq (%0), %%mm2 \n\t"
@@ -599,12 +599,12 @@ static int eq2_draw(vo_frame_t *frame, xine_stream_t *stream)
pthread_mutex_lock (&this->lock);
for (i = 0; i < 3; i++) {
- int height;
+ int height, width;
height = (i==0) ? frame->height : frame->height/2;
-
+ width = (i==0) ? frame->width : frame->width/2;
if (eq2->param[i].adjust != NULL) {
eq2->param[i].adjust (&eq2->param[i], out_frame->base[i], yv12_frame->base[i],
- frame->width, height, out_frame->pitches[i], yv12_frame->pitches[i]);
+ width, height, out_frame->pitches[i], yv12_frame->pitches[i]);
}
else {
xine_fast_memcpy(out_frame->base[i],yv12_frame->base[i],
diff --git a/src/post/planar/expand.c b/src/post/planar/expand.c
index 51cc4eac2..cf288921f 100644
--- a/src/post/planar/expand.c
+++ b/src/post/planar/expand.c
@@ -21,7 +21,8 @@
*
* expand video filter by James Stembridge 24/05/2003
* improved by Michael Roitzsch
- *
+ * centre_crop_out_mode by Reinhard Nissl
+ *
* based on invert.c
*
*/
@@ -52,6 +53,11 @@
* This way, the decoder (or any other post plugin up the tree) will only
* see the frame area between the black bars and by that modify the
* enlarged version directly. No need for later copying.
+ *
+ * When centre_crop_out_mode is enabled, the plugin will detect the black
+ * bars to the left and right of the image and will then set up cropping
+ * to efficiently remove the black border around the 4:3 image, which the
+ * plugin would produce otherwise for this case.
*/
@@ -63,6 +69,7 @@ typedef struct expand_parameters_s {
int enable_automatic_shift;
int overlay_y_offset;
double aspect;
+ int centre_cut_out_mode;
} expand_parameters_t;
START_PARAM_DESCR(expand_parameters_t)
@@ -72,6 +79,8 @@ PARAM_ITEM(POST_PARAM_TYPE_INT, overlay_y_offset, NULL, -500, 500, 0,
"manually shift the overlay vertically")
PARAM_ITEM(POST_PARAM_TYPE_DOUBLE, aspect, NULL, 1.0, 3.5, 0,
"target aspect ratio")
+PARAM_ITEM(POST_PARAM_TYPE_BOOL, centre_cut_out_mode, NULL, 0, 1, 0,
+ "cut out centred 4:3 image contained in 16:9 frame")
END_PARAM_DESCR(expand_param_descr)
typedef struct post_expand_s {
@@ -83,6 +92,8 @@ typedef struct post_expand_s {
int overlay_y_offset;
double aspect;
int top_bar_height;
+ int centre_cut_out_mode;
+ int cropping_active;
} post_expand_t;
/* plugin class functions */
@@ -106,6 +117,8 @@ static char *expand_get_help (void);
static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width,
uint32_t height, double ratio,
int format, int flags);
+
+/* replaced vo_frame functions */
static int expand_draw(vo_frame_t *frame, xine_stream_t *stream);
/* overlay manager intercept check */
@@ -153,6 +166,8 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs,
this->enable_automatic_shift = 0;
this->overlay_y_offset = 0;
this->aspect = 4.0 / 3.0;
+ this->centre_cut_out_mode = 0;
+ this->cropping_active = 0;
port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output);
port->new_port.get_frame = expand_get_frame;
@@ -166,8 +181,8 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs,
input_param->data = &post_api;
xine_list_push_back(this->post.input, input_param);
- input->xine_in.name = "video";
- output->xine_out.name = "expanded video";
+ input->xine_in.name = "video";
+ output->xine_out.name = "expanded video";
this->post.xine_post.video_input[0] = &port->new_port;
@@ -214,6 +229,8 @@ static int expand_set_parameters(xine_post_t *this_gen, void *param_gen)
this->enable_automatic_shift = param->enable_automatic_shift;
this->overlay_y_offset = param->overlay_y_offset;
this->aspect = param->aspect;
+ this->centre_cut_out_mode = param->centre_cut_out_mode;
+
return 1;
}
@@ -225,6 +242,8 @@ static int expand_get_parameters(xine_post_t *this_gen, void *param_gen)
param->enable_automatic_shift = this->enable_automatic_shift;
param->overlay_y_offset = this->overlay_y_offset;
param->aspect = this->aspect;
+ param->centre_cut_out_mode = this->centre_cut_out_mode;
+
return 1;
}
@@ -238,22 +257,86 @@ static char *expand_get_help(void) {
" Enable_automatic_shift: Enable automatic overlay shifting\n"
" Overlay_y_offset: Manually shift the overlay vertically\n"
" aspect: The target aspect ratio (default 4:3)\n"
+ " Centre_cut_out_mode: extracts 4:3 image contained in 16:9 frame\n"
"\n"
);
}
+static int is_pixel_black(vo_frame_t *frame, int x, int y)
+{
+ int Y = 0x00, Cr = 0x00, Cb = 0x00;
+
+ if (x < 0) x = 0;
+ if (x >= frame->width) x = frame->width - 1;
+ if (y < 0) y = 0;
+ if (y >= frame->height) y = frame->height - 1;
+
+ switch (frame->format)
+ {
+ case XINE_IMGFMT_YV12:
+ Y = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x);
+ Cr = *(frame->base[ 1 ] + frame->pitches[ 1 ] * y / 2 + x / 2);
+ Cb = *(frame->base[ 2 ] + frame->pitches[ 2 ] * y / 2 + x / 2);
+ break;
+
+ case XINE_IMGFMT_YUY2:
+ Y = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 0);
+ x &= ~1;
+ Cr = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 1);
+ Cb = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 3);
+ break;
+ }
+
+ return (Y == 0x10 && Cr == 0x80 && Cb == 0x80);
+}
+
+
static int expand_draw(vo_frame_t *frame, xine_stream_t *stream)
{
- post_video_port_t *port = (post_video_port_t *)frame->port;
- post_expand_t *this = (post_expand_t *)port->post;
- int skip;
-
- frame->ratio = this->aspect;
- _x_post_frame_copy_down(frame, frame->next);
- skip = frame->next->draw(frame->next, stream);
- _x_post_frame_copy_up(frame, frame->next);
- return skip;
+ post_video_port_t *port = (post_video_port_t *)frame->port;
+ post_expand_t *this = (post_expand_t *)port->post;
+ int skip;
+
+ if (this->centre_cut_out_mode && !frame->bad_frame)
+ {
+ /* expected area of inner 4:3 image */
+ int centre_width = frame->width * (9 * 4) / (16 * 3);
+ int centre_left = (frame->width - centre_width ) / 2;
+
+ /* centre point for detecting a black frame */
+ int centre_x = frame->width / 2;
+ int centre_y = frame->height / 2;
+
+ /* ignore a black frame as it could lead to wrong results */
+ if (!is_pixel_black(frame, centre_x, centre_y))
+ {
+ /* coordinates for testing black border near the centre area */
+ int test_left = centre_left - 16;
+ int test_right = centre_left + 16 + centre_width;
+
+ /* enable cropping when these pixels are black */
+ this->cropping_active = is_pixel_black(frame, test_left, centre_y)
+ && is_pixel_black(frame, test_right, centre_y);
+ }
+
+ /* crop frame */
+ if (this->centre_cut_out_mode && this->cropping_active) {
+ frame->crop_left += centre_left;
+ frame->crop_right += centre_left;
+
+ /* get_frame() allocated an extra high frame */
+ frame->crop_top += (frame->next->height - frame->height) / 2;
+ frame->crop_bottom += (frame->next->height - frame->height) / 2;
+ }
+ }
+
+ frame->ratio = this->aspect;
+ _x_post_frame_copy_down(frame, frame->next);
+ skip = frame->next->draw(frame->next, stream);
+ _x_post_frame_copy_up(frame, frame->next);
+
+ return skip;
}
@@ -338,6 +421,10 @@ static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width,
static int expand_intercept_ovl(post_video_port_t *port)
{
+ post_expand_t *this = (post_expand_t *)port->post;
+
+ if (this->centre_cut_out_mode && this->cropping_active) return 0;
+
/* we always intercept overlay manager */
return 1;
}
diff --git a/src/post/planar/noise.c b/src/post/planar/noise.c
index 1b46825db..154d5f8cc 100644
--- a/src/post/planar/noise.c
+++ b/src/post/planar/noise.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: noise.c,v 1.3 2006/03/26 14:45:41 valtri Exp $
+ * $Id: noise.c,v 1.4 2007/03/22 23:32:05 dgp85 Exp $
*
* mplayer's noise filter, ported by Jason Tackaberry. Original filter
* is copyright 2002 Michael Niedermayer <michaelni@gmx.at>
@@ -159,7 +159,7 @@ static inline void lineNoise_MMX(uint8_t *dst, uint8_t *src, int8_t *noise, int
"pcmpeqb %%mm7, %%mm7 \n\t"
"psllw $15, %%mm7 \n\t"
"packsswb %%mm7, %%mm7 \n\t"
- ".balign 16 \n\t"
+ ASMALIGN(4)
"1: \n\t"
"movq (%0, %%"REG_a"), %%mm0 \n\t"
"movq (%1, %%"REG_a"), %%mm1 \n\t"
@@ -186,7 +186,7 @@ static inline void lineNoise_MMX2(uint8_t *dst, uint8_t *src, int8_t *noise, int
"pcmpeqb %%mm7, %%mm7 \n\t"
"psllw $15, %%mm7 \n\t"
"packsswb %%mm7, %%mm7 \n\t"
- ".balign 16 \n\t"
+ ASMALIGN(4)
"1: \n\t"
"movq (%0, %%"REG_a"), %%mm0 \n\t"
"movq (%1, %%"REG_a"), %%mm1 \n\t"
@@ -225,7 +225,7 @@ static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t
asm volatile(
"mov %5, %%"REG_a" \n\t"
- ".balign 16 \n\t"
+ ASMALIGN(4)
"1: \n\t"
"movq (%1, %%"REG_a"), %%mm1 \n\t"
"movq (%0, %%"REG_a"), %%mm0 \n\t"
diff --git a/src/post/visualizations/.cvsignore b/src/post/visualizations/.hgignore
index 7d926a554..7d926a554 100644
--- a/src/post/visualizations/.cvsignore
+++ b/src/post/visualizations/.hgignore
diff --git a/src/post/visualizations/Makefile.am b/src/post/visualizations/Makefile.am
index 8891b1c53..dc7679103 100644
--- a/src/post/visualizations/Makefile.am
+++ b/src/post/visualizations/Makefile.am
@@ -8,7 +8,7 @@ lib_LTLIBRARIES = xineplug_post_visualizations.la
xineplug_post_visualizations_la_SOURCES = \
visualizations.c fft.c fftscope.c oscope.c fftgraph.c
-xineplug_post_visualizations_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) -lm
+xineplug_post_visualizations_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) -lm
xineplug_post_visualizations_la_CFLAGS = $(VISIBILITY_FLAG)
xineplug_post_visualizations_la_LDFLAGS = -avoid-version -module
diff --git a/src/post/visualizations/fftgraph.c b/src/post/visualizations/fftgraph.c
index f9f8f0d4a..669a4bc94 100644
--- a/src/post/visualizations/fftgraph.c
+++ b/src/post/visualizations/fftgraph.c
@@ -20,7 +20,7 @@
* FftGraph Visualization Post Plugin For xine
* by Thibaut Mattern (tmattern@noos.fr)
*
- * $Id: fftgraph.c,v 1.14 2006/01/27 07:46:14 tmattern Exp $
+ * $Id: fftgraph.c,v 1.15 2006/12/02 22:35:18 miguelfreitas Exp $
*
*/
@@ -230,6 +230,7 @@ static int fftgraph_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream
this->lines_per_channel = FFTGRAPH_HEIGHT / this->channels;
this->samples_per_frame = rate / FPS;
this->data_idx = 0;
+ this->sample_counter = 0;
this->vo_port->open(this->vo_port, XINE_ANON_STREAM);
this->metronom->set_master(this->metronom, stream->metronom);
@@ -342,7 +343,7 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen,
data8 += samples_used * this->channels;
/* scale 8 bit data to 16 bits and convert to signed as well */
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data8 += this->channels ) {
for( c = 0; c < this->channels; c++){
this->wave[c][this->data_idx].re = (double)(data8[c] << 8) - 0x8000;
@@ -353,7 +354,7 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen,
data = buf->mem;
data += samples_used * this->channels;
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data += this->channels ) {
for( c = 0; c < this->channels; c++){
this->wave[c][this->data_idx].re = (double)data[c];
@@ -362,17 +363,24 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen,
}
}
- if( this->sample_counter >= this->samples_per_frame &&
- this->data_idx == NUMSAMPLES ) {
+ if( this->sample_counter >= this->samples_per_frame ) {
- this->data_idx = 0;
samples_used += this->samples_per_frame;
frame = this->vo_port->get_frame (this->vo_port, FFTGRAPH_WIDTH, FFTGRAPH_HEIGHT,
this->ratio, XINE_IMGFMT_YUY2,
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
- frame->bad_frame = 0;
+
+ /* frame is marked as bad if we don't have enough samples for
+ * updating the viz plugin (calculations may be skipped).
+ * we must keep the framerate though. */
+ if( this->data_idx == NUMSAMPLES ) {
+ frame->bad_frame = 0;
+ this->data_idx = 0;
+ } else {
+ frame->bad_frame = 1;
+ }
frame->duration = 90000 * this->samples_per_frame / port->rate;
frame->pts = pts;
this->metronom->got_video_frame(this->metronom, frame);
diff --git a/src/post/visualizations/fftscope.c b/src/post/visualizations/fftscope.c
index 8448f3a65..aef517c59 100644
--- a/src/post/visualizations/fftscope.c
+++ b/src/post/visualizations/fftscope.c
@@ -22,7 +22,7 @@
*
* FFT code by Steve Haehnichen, originally licensed under GPL v1
*
- * $Id: fftscope.c,v 1.29 2006/01/27 07:46:14 tmattern Exp $
+ * $Id: fftscope.c,v 1.30 2006/12/02 22:35:18 miguelfreitas Exp $
*
*/
@@ -289,6 +289,7 @@ static int fftscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream
this->channels = MAXCHANNELS;
this->samples_per_frame = rate / FPS;
this->data_idx = 0;
+ this->sample_counter = 0;
this->fft = fft_new(FFT_BITS);
this->vo_port->open(this->vo_port, XINE_ANON_STREAM);
@@ -363,7 +364,7 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen,
data8 += samples_used * this->channels;
/* scale 8 bit data to 16 bits and convert to signed as well */
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data8 += this->channels ) {
for( c = 0; c < this->channels; c++){
this->wave[c][this->data_idx].re = (double)(data8[c] << 8) - 0x8000;
@@ -374,7 +375,7 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen,
data = buf->mem;
data += samples_used * this->channels;
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data += this->channels ) {
for( c = 0; c < this->channels; c++){
this->wave[c][this->data_idx].re = (double)data[c];
@@ -383,17 +384,24 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen,
}
}
- if( this->sample_counter >= this->samples_per_frame &&
- this->data_idx == NUMSAMPLES ) {
+ if( this->sample_counter >= this->samples_per_frame ) {
- this->data_idx = 0;
samples_used += this->samples_per_frame;
frame = this->vo_port->get_frame (this->vo_port, FFT_WIDTH, FFT_HEIGHT,
this->ratio, XINE_IMGFMT_YUY2,
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
- frame->bad_frame = 0;
+
+ /* frame is marked as bad if we don't have enough samples for
+ * updating the viz plugin (calculations may be skipped).
+ * we must keep the framerate though. */
+ if( this->data_idx == NUMSAMPLES ) {
+ frame->bad_frame = 0;
+ this->data_idx = 0;
+ } else {
+ frame->bad_frame = 1;
+ }
frame->duration = 90000 * this->samples_per_frame / port->rate;
frame->pts = pts;
this->metronom->got_video_frame(this->metronom, frame);
diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c
index 8d1e84150..9e69fefab 100644
--- a/src/post/visualizations/fooviz.c
+++ b/src/post/visualizations/fooviz.c
@@ -23,7 +23,7 @@
* process. It simply paints the screen a solid color and rotates through
* colors on each iteration.
*
- * $Id: fooviz.c,v 1.27 2006/07/10 22:08:44 dgp85 Exp $
+ * $Id: fooviz.c,v 1.28 2006/12/02 22:35:18 miguelfreitas Exp $
*
*/
@@ -118,6 +118,7 @@ static int fooviz_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
this->channels = _x_ao_mode2channels(mode);
this->samples_per_frame = rate / FPS;
this->data_idx = 0;
+ this->sample_counter = 0;
this->vo_port->open(this->vo_port, XINE_ANON_STREAM);
this->metronom->set_master(this->metronom, stream->metronom);
@@ -180,7 +181,7 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen,
data8 += samples_used * this->channels;
/* scale 8 bit data to 16 bits and convert to signed as well */
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data8 += this->channels ) {
this->data[0][this->data_idx] = ((int16_t)data8[0] << 8) - 0x8000;
this->data[1][this->data_idx] = ((int16_t)data8[j] << 8) - 0x8000;
@@ -189,24 +190,31 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen,
data = buf->mem;
data += samples_used * this->channels;
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data += this->channels ) {
this->data[0][this->data_idx] = data[0];
this->data[1][this->data_idx] = data[j];
}
}
- if( this->sample_counter >= this->samples_per_frame &&
- this->data_idx == NUMSAMPLES ) {
+ if( this->sample_counter >= this->samples_per_frame ) {
- this->data_idx = 0;
samples_used += this->samples_per_frame;
frame = this->vo_port->get_frame (this->vo_port, FOO_WIDTH, FOO_HEIGHT,
this->ratio, XINE_IMGFMT_YUY2,
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
- frame->bad_frame = 0;
+
+ /* frame is marked as bad if we don't have enough samples for
+ * updating the viz plugin (calculations may be skipped).
+ * we must keep the framerate though. */
+ if( this->data_idx == NUMSAMPLES ) {
+ frame->bad_frame = 0;
+ this->data_idx = 0;
+ } else {
+ frame->bad_frame = 1;
+ }
frame->duration = 90000 * this->samples_per_frame / port->rate;
frame->pts = pts;
this->metronom->got_video_frame(this->metronom, frame);
diff --git a/src/post/visualizations/oscope.c b/src/post/visualizations/oscope.c
index 68ae0e054..483fc39ab 100644
--- a/src/post/visualizations/oscope.c
+++ b/src/post/visualizations/oscope.c
@@ -20,7 +20,7 @@
* Basic Oscilloscope Visualization Post Plugin For xine
* by Mike Melanson (melanson@pcisys.net)
*
- * $Id: oscope.c,v 1.20 2006/01/27 07:46:14 tmattern Exp $
+ * $Id: oscope.c,v 1.21 2006/12/02 22:35:18 miguelfreitas Exp $
*
*/
@@ -191,6 +191,7 @@ static int oscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
this->channels = MAXCHANNELS;
this->samples_per_frame = rate / FPS;
this->data_idx = 0;
+ this->sample_counter = 0;
init_yuv_planes(&this->yuv, OSCOPE_WIDTH, OSCOPE_HEIGHT);
this->vo_port->open(this->vo_port, XINE_ANON_STREAM);
@@ -252,7 +253,7 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen,
data8 += samples_used * this->channels;
/* scale 8 bit data to 16 bits and convert to signed as well */
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data8 += this->channels )
for( c = 0; c < this->channels; c++)
this->data[c][this->data_idx] = ((int16_t)data8[c] << 8) - 0x8000;
@@ -260,23 +261,30 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen,
data = buf->mem;
data += samples_used * this->channels;
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
i++, this->data_idx++, data += this->channels )
for( c = 0; c < this->channels; c++)
this->data[c][this->data_idx] = data[c];
}
- if( this->sample_counter >= this->samples_per_frame &&
- this->data_idx == NUMSAMPLES ) {
+ if( this->sample_counter >= this->samples_per_frame ) {
- this->data_idx = 0;
samples_used += this->samples_per_frame;
frame = this->vo_port->get_frame (this->vo_port, OSCOPE_WIDTH, OSCOPE_HEIGHT,
this->ratio, XINE_IMGFMT_YUY2,
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
- frame->bad_frame = 0;
+
+ /* frame is marked as bad if we don't have enough samples for
+ * updating the viz plugin (calculations may be skipped).
+ * we must keep the framerate though. */
+ if( this->data_idx == NUMSAMPLES ) {
+ frame->bad_frame = 0;
+ this->data_idx = 0;
+ } else {
+ frame->bad_frame = 1;
+ }
frame->duration = 90000 * this->samples_per_frame / port->rate;
frame->pts = pts;
this->metronom->got_video_frame(this->metronom, frame);