summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-04-09 02:57:05 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-04-09 02:57:05 +0000
commit575527352ef6ca07f7f752838ccccf2f0171314c (patch)
treecaeb6d23d13112e6bba8610f0a85c23f2a6220bd
parentf388b7ac7c20497a25693ef9f17c83ab60733c4d (diff)
downloadxine-lib-575527352ef6ca07f7f752838ccccf2f0171314c.tar.gz
xine-lib-575527352ef6ca07f7f752838ccccf2f0171314c.tar.bz2
tvtime deinterlacing algorithms assumed top_field_first=1
top_field_first=0 (aka bottom_field_first) should now work as expected CVS patchset: 6356 CVS date: 2004/04/09 02:57:05
-rw-r--r--src/post/deinterlace/deinterlace.h2
-rw-r--r--src/post/deinterlace/plugins/greedy2frame_template.c40
-rw-r--r--src/post/deinterlace/tvtime.c13
-rw-r--r--src/post/deinterlace/tvtime.h2
-rw-r--r--src/post/deinterlace/xine_plugin.c18
5 files changed, 46 insertions, 29 deletions
diff --git a/src/post/deinterlace/deinterlace.h b/src/post/deinterlace/deinterlace.h
index 1cc7bf9b1..6475aaefd 100644
--- a/src/post/deinterlace/deinterlace.h
+++ b/src/post/deinterlace/deinterlace.h
@@ -121,7 +121,7 @@ struct deinterlace_frame_data_s
typedef void (*deinterlace_frame_t)( uint8_t *output, int outstride,
deinterlace_frame_data_t *data,
- int bottom_field, int width, int height );
+ int bottom_field, int second_field, int width, int height );
/**
diff --git a/src/post/deinterlace/plugins/greedy2frame_template.c b/src/post/deinterlace/plugins/greedy2frame_template.c
index da0edcc9d..13db375ef 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.6 2004/02/12 20:53:31 mroi Exp $
+** $Id: greedy2frame_template.c,v 1.7 2004/04/09 02:57:06 miguelfreitas Exp $
******************************************************************************
** Copyright (c) 2000 John Adcock, Tom Barry, Steve Grimm All rights reserved.
** port copyright (c) 2003 Miguel Freitas
@@ -19,6 +19,10 @@
** CVS Log
**
** $Log: greedy2frame_template.c,v $
+** Revision 1.7 2004/04/09 02:57:06 miguelfreitas
+** tvtime deinterlacing algorithms assumed top_field_first=1
+** top_field_first=0 (aka bottom_field_first) should now work as expected
+**
** Revision 1.6 2004/02/12 20:53:31 mroi
** my gcc (partly 3.4 already) optimizes these away, because they are only used
** inside inline assembler (which the compiler does not recognize); so actually
@@ -101,15 +105,15 @@
#if defined(IS_SSE)
static void DeinterlaceGreedy2Frame_SSE(uint8_t *output, int outstride,
deinterlace_frame_data_t *data,
- int bottom_field, int width, int height )
+ int bottom_field, int second_field, int width, int height )
#elif defined(IS_3DNOW)
static void DeinterlaceGreedy2Frame_3DNOW(uint8_t *output, int outstride,
deinterlace_frame_data_t *data,
- int bottom_field, int width, int height )
+ int bottom_field, int second_field, int width, int height )
#else
static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride,
deinterlace_frame_data_t *data,
- int bottom_field, int width, int height )
+ int bottom_field, int second_field, int width, int height )
#endif
{
#ifdef ARCH_X86
@@ -135,19 +139,31 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride,
(qwGreedyTwoFrameThreshold << 16);
- if( bottom_field ) {
- M1 = data->f0 + stride;
+ if( second_field ) {
+ M1 = data->f0;
T1 = data->f0;
- B1 = T1 + Pitch;
- M0 = data->f1 + stride;
+ M0 = data->f1;
T0 = data->f1;
+ } else {
+ M1 = data->f0;
+ T1 = data->f1;
+ M0 = data->f1;
+ T0 = data->f2;
+ }
+
+ if( bottom_field ) {
+ M1 += stride;
+ T1 += 0;
+ B1 = T1 + Pitch;
+ M0 += stride;
+ T0 += 0;
B0 = T0 + Pitch;
} else {
- M1 = data->f0 + Pitch;
- T1 = data->f1 + stride;
+ M1 += Pitch;
+ T1 += stride;
B1 = T1 + Pitch;
- M0 = data->f1 + Pitch;
- T0 = data->f2 + stride;
+ M0 += Pitch;
+ T0 += stride;
B0 = T0 + Pitch;
xine_fast_memcpy(Dest, M1, LineLength);
diff --git a/src/post/deinterlace/tvtime.c b/src/post/deinterlace/tvtime.c
index db8911311..7e01cb5d9 100644
--- a/src/post/deinterlace/tvtime.c
+++ b/src/post/deinterlace/tvtime.c
@@ -176,7 +176,7 @@ int tvtime_build_deinterlaced_frame( tvtime_t *this, uint8_t *output,
uint8_t *curframe,
uint8_t *lastframe,
uint8_t *secondlastframe,
- int bottom_field,
+ int bottom_field, int second_field,
int width,
int frame_height,
int instride,
@@ -279,7 +279,8 @@ int tvtime_build_deinterlaced_frame( tvtime_t *this, uint8_t *output,
data.f1 = lastframe;
data.f2 = secondlastframe;
- curmethod->deinterlace_frame( output, outstride, &data, bottom_field, width, frame_height );
+ curmethod->deinterlace_frame( output, outstride, &data, bottom_field, second_field,
+ width, frame_height );
} else {
int loop_size;
@@ -314,7 +315,7 @@ int tvtime_build_deinterlaced_frame( tvtime_t *this, uint8_t *output,
data.t0 = curframe;
data.b0 = curframe + (instride*2);
- if( bottom_field ) {
+ if( second_field ) {
data.tt1 = (i < loop_size) ? (curframe - instride) : (curframe + instride);
data.m1 = curframe + instride;
data.bb1 = (i > 1) ? (curframe + (instride*3)) : (curframe + instride);
@@ -327,7 +328,7 @@ int tvtime_build_deinterlaced_frame( tvtime_t *this, uint8_t *output,
data.t2 = lastframe;
data.b2 = lastframe + (instride*2);
- if( bottom_field ) {
+ if( second_field ) {
data.tt3 = (i < loop_size) ? (lastframe - instride) : (lastframe + instride);
data.m3 = lastframe + instride;
data.bb3 = (i > 1) ? (lastframe + (instride*3)) : (lastframe + instride);
@@ -346,7 +347,7 @@ int tvtime_build_deinterlaced_frame( tvtime_t *this, uint8_t *output,
data.m0 = curframe + (instride*2);
data.bb0 = (i > 1) ? (curframe + (instride*4)) : (curframe + (instride*2));
- if( bottom_field ) {
+ if( second_field ) {
data.t1 = curframe + instride;
data.b1 = (i > 1) ? (curframe + (instride*3)) : (curframe + instride);
} else {
@@ -358,7 +359,7 @@ int tvtime_build_deinterlaced_frame( tvtime_t *this, uint8_t *output,
data.m2 = lastframe + (instride*2);
data.bb2 = (i > 1) ? (lastframe + (instride*4)) : (lastframe + (instride*2));
- if( bottom_field ) {
+ if( second_field ) {
data.t2 = lastframe + instride;
data.b2 = (i > 1) ? (lastframe + (instride*3)) : (lastframe + instride);
} else {
diff --git a/src/post/deinterlace/tvtime.h b/src/post/deinterlace/tvtime.h
index f07c8ea87..7019fe34a 100644
--- a/src/post/deinterlace/tvtime.h
+++ b/src/post/deinterlace/tvtime.h
@@ -75,7 +75,7 @@ int tvtime_build_deinterlaced_frame( tvtime_t *this, uint8_t *output,
uint8_t *curframe,
uint8_t *lastframe,
uint8_t *secondlastframe,
- int bottom_field,
+ int bottom_field, int second_field,
int width,
int frame_height,
int instride,
diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c
index 9317974ee..3ac69d39b 100644
--- a/src/post/deinterlace/xine_plugin.c
+++ b/src/post/deinterlace/xine_plugin.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_plugin.c,v 1.29 2004/02/12 18:25:07 mroi Exp $
+ * $Id: xine_plugin.c,v 1.30 2004/04/09 02:57:05 miguelfreitas Exp $
*
* advanced video deinterlacer plugin
* Jun/2003 by Miguel Freitas
@@ -704,7 +704,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream)
yuy2_frame->base[0],
(this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0],
(this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0],
- fields[0], frame->width, frame->height,
+ fields[0], 0, frame->width, frame->height,
yuy2_frame->pitches[0], deinterlaced_frame->pitches[0]);
} else {
deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime,
@@ -712,21 +712,21 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream)
yuy2_frame->base[0],
(this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0],
(this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0],
- fields[0], frame->width/2, frame->height,
+ fields[0], 0, frame->width/2, frame->height,
yuy2_frame->pitches[0], deinterlaced_frame->pitches[0]);
deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime,
deinterlaced_frame->base[1],
yuy2_frame->base[1],
(this->recent_frame[0])?this->recent_frame[0]->base[1]:yuy2_frame->base[1],
(this->recent_frame[1])?this->recent_frame[1]->base[1]:yuy2_frame->base[1],
- fields[0], frame->width/4, frame->height/2,
+ fields[0], 0, frame->width/4, frame->height/2,
yuy2_frame->pitches[1], deinterlaced_frame->pitches[1]);
deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime,
deinterlaced_frame->base[2],
yuy2_frame->base[2],
(this->recent_frame[0])?this->recent_frame[0]->base[2]:yuy2_frame->base[2],
(this->recent_frame[1])?this->recent_frame[1]->base[2]:yuy2_frame->base[2],
- fields[0], frame->width/4, frame->height/2,
+ fields[0], 0, frame->width/4, frame->height/2,
yuy2_frame->pitches[2], deinterlaced_frame->pitches[2]);
}
}
@@ -811,7 +811,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream)
yuy2_frame->base[0],
(this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0],
(this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0],
- fields[1], frame->width, frame->height,
+ fields[1], 1, frame->width, frame->height,
yuy2_frame->pitches[0], deinterlaced_frame->pitches[0]);
} else {
deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime,
@@ -819,21 +819,21 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream)
yuy2_frame->base[0],
(this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0],
(this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0],
- fields[1], frame->width/2, frame->height,
+ fields[1], 1, frame->width/2, frame->height,
yuy2_frame->pitches[0], deinterlaced_frame->pitches[0]);
deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime,
deinterlaced_frame->base[1],
yuy2_frame->base[1],
(this->recent_frame[0])?this->recent_frame[0]->base[1]:yuy2_frame->base[1],
(this->recent_frame[1])?this->recent_frame[1]->base[1]:yuy2_frame->base[1],
- fields[1], frame->width/4, frame->height/2,
+ fields[1], 1, frame->width/4, frame->height/2,
yuy2_frame->pitches[1], deinterlaced_frame->pitches[1]);
deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime,
deinterlaced_frame->base[0],
yuy2_frame->base[0],
(this->recent_frame[0])?this->recent_frame[0]->base[2]:yuy2_frame->base[2],
(this->recent_frame[1])?this->recent_frame[1]->base[2]:yuy2_frame->base[2],
- fields[1], frame->width/4, frame->height/2,
+ fields[1], 1, frame->width/4, frame->height/2,
yuy2_frame->pitches[2], deinterlaced_frame->pitches[2]);
}
}