summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Hellström <totte67@users.sourceforge.net>2005-02-22 18:31:33 +0000
committerThomas Hellström <totte67@users.sourceforge.net>2005-02-22 18:31:33 +0000
commit081ee8763663ffb98145ea232cad0260bb93aef2 (patch)
tree832625e851f76e0e9c661130c0ade972f784009c /src
parent1a73f221fdf055c093e7b9c74d49795c6007b06e (diff)
downloadxine-lib-081ee8763663ffb98145ea232cad0260bb93aef2.tar.gz
xine-lib-081ee8763663ffb98145ea232cad0260bb93aef2.tar.bz2
XvMC update largely courtesy of Kendall Bennet, Scitechsoft:
* Fix surface flushing and syncing (xxmc / xvmc) * Fix clearing of macro block lists (xxmc / xvmc) * Remove floating point operations from mpeg demuxer. Degrades performance on non-fp capable hardware. * Remove unnecessary software MC step * Fix Quantization matrix ordering which caused bad picture quality (KB/TH) * Minor optimizations in the libmpeg2 code * Fix VLD flushing at video discontinuity (TH) CVS patchset: 7424 CVS date: 2005/02/22 18:31:33
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_mpeg.c35
-rw-r--r--src/libmpeg2/decode.c36
-rw-r--r--src/libmpeg2/slice_xvmc.c171
-rw-r--r--src/libmpeg2/slice_xvmc_vld.c10
-rw-r--r--src/libmpeg2/xvmc.h6
-rw-r--r--src/video_out/video_out_xvmc.c116
-rw-r--r--src/video_out/video_out_xxmc.c28
-rw-r--r--src/video_out/xvmc_mocomp.c11
8 files changed, 198 insertions, 215 deletions
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index a788fb87d..f3cd43475 100644
--- a/src/demuxers/demux_mpeg.c
+++ b/src/demuxers/demux_mpeg.c
@@ -19,7 +19,7 @@
*/
/*
- * $Id: demux_mpeg.c,v 1.146 2005/02/06 15:26:17 tmattern Exp $
+ * $Id: demux_mpeg.c,v 1.147 2005/02/22 18:31:37 totte67 Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -358,8 +358,9 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
buf->decoder_flags = BUF_FLAG_PREVIEW;
if( this->input->get_length (this->input) )
- buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) *
- 65535 / this->input->get_length (this->input) );
+ buf->extra_info->input_normpos =
+ (int)( ((int64_t)this->input->get_current_pos (this->input) *
+ 65535) / this->input->get_length (this->input) );
if (this->rate)
buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input)
@@ -390,8 +391,9 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
buf->decoder_flags |= BUF_FLAG_PREVIEW;
if( this->input->get_length (this->input) )
- buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) *
- 65535 / this->input->get_length (this->input) );
+ buf->extra_info->input_normpos =
+ (int)( ((int64_t)this->input->get_current_pos (this->input) *
+ 65535) / this->input->get_length (this->input) );
if (this->rate)
buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input)
* 1000 / (this->rate * 50));
@@ -453,8 +455,9 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
buf->decoder_flags = BUF_FLAG_PREVIEW;
if( this->input->get_length (this->input) )
- buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) *
- 65535 / this->input->get_length (this->input) );
+ buf->extra_info->input_normpos =
+ (int)( ((int64_t)this->input->get_current_pos (this->input) *
+ 65535) / this->input->get_length (this->input) );
if (this->rate)
buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input)
* 1000 / (this->rate * 50));
@@ -525,8 +528,9 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
buf->decoder_flags = BUF_FLAG_PREVIEW;
if( this->input->get_length (this->input) )
- buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) *
- 65535 / this->input->get_length (this->input) );
+ buf->extra_info->input_normpos =
+ (int)( ((int64_t)this->input->get_current_pos (this->input) *
+ 65535) / this->input->get_length (this->input) );
if (this->rate)
buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input)
* 1000 / (this->rate * 50));
@@ -655,8 +659,9 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
buf->decoder_flags = BUF_FLAG_PREVIEW;
if( this->input->get_length (this->input) )
- buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) *
- 65535 / this->input->get_length (this->input) );
+ buf->extra_info->input_normpos =
+ (int)( ((int64_t)this->input->get_current_pos (this->input) *
+ 65535) / this->input->get_length (this->input) );
if (this->rate)
buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input)
* 1000 / (this->rate * 50));
@@ -689,8 +694,9 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
buf->decoder_flags = BUF_FLAG_PREVIEW;
if( this->input->get_length (this->input) )
- buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) *
- 65535 / this->input->get_length (this->input) );
+ buf->extra_info->input_normpos =
+ (int)( ((int64_t)this->input->get_current_pos (this->input) *
+ 65535) / this->input->get_length (this->input) );
if (this->rate)
buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input)
* 1000 / (this->rate * 50));
@@ -1002,8 +1008,7 @@ static int demux_mpeg_seek (demux_plugin_t *this_gen,
demux_mpeg_t *this = (demux_mpeg_t *) this_gen;
start_time /= 1000;
- start_pos = (off_t) ( (double) start_pos / 65535 *
- this->input->get_length (this->input) );
+ start_pos = (off_t) ( ((int64_t)start_pos * this->input->get_length (this->input)) / 65535);
if (INPUT_IS_SEEKABLE(this->input)) {
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c
index 243b3fdd2..6da1e07cf 100644
--- a/src/libmpeg2/decode.c
+++ b/src/libmpeg2/decode.c
@@ -1,4 +1,4 @@
- /*
+/*
* decode.c
* Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
@@ -64,6 +64,7 @@ void mpeg2_init (mpeg2dec_t * mpeg2dec,
mpeg2_cpu_state_init (mm_accel);
mpeg2_idct_init (mm_accel);
mpeg2_mc_init (mm_accel);
+ xvmc_setup_scan_ptable();
}
if( !mpeg2dec->chunk_buffer )
@@ -175,6 +176,10 @@ static double get_aspect_ratio(mpeg2dec_t *mpeg2dec)
1.0, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, 0.8935, 0.9157,
0.9815, 1.0255, 1.0695, 1.0950, 1.1575, 1.2015, 1.0 /*reserved*/ };
+ /* TODO: For slower machines the value of this function should be computed
+ * once and cached!
+ */
+
if( !picture->mpeg1 ) {
/* these hardcoded values are defined on mpeg2 standard for
* aspect ratio. other values are reserved or forbidden. */
@@ -251,6 +256,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
{
picture_t * picture;
int is_frame_done;
+ double ratio;
/* wait for sequence_header_code */
if (mpeg2dec->is_sequence_needed) {
@@ -514,6 +520,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
mpeg2dec->drop_frame = 1;
} else {
int flags = picture->picture_structure;
+
if (!picture->mpeg1) flags |= VO_INTERLACED_FLAG;
if (mpeg2dec->force_pan_scan) flags |= VO_PAN_SCAN_FLAG;
if (mpeg2dec->new_sequence) flags |= VO_NEW_SEQUENCE_FLAG;
@@ -524,36 +531,36 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
picture->current_frame->free (picture->current_frame);
}
if (picture->picture_coding_type == B_TYPE) {
+ ratio = get_aspect_ratio(mpeg2dec);
picture->current_frame =
mpeg2dec->stream->video_out->get_frame (mpeg2dec->stream->video_out,
picture->coded_picture_width,
picture->coded_picture_height,
- get_aspect_ratio(mpeg2dec),
+ ratio,
mpeg2dec->frame_format,
flags);
/*
* Move to libmpeg2_accel.c
* int libmpeg2_accel_new_frame(mpeg2dec_t *, picture_t *)
*/
- mpeg2_xxmc_choose_coding(mpeg2dec, picture, get_aspect_ratio(mpeg2dec),
- flags);
+ mpeg2_xxmc_choose_coding(mpeg2dec, picture, ratio, flags);
/*
* End of new frame accel code.
*/
} else {
+ ratio = get_aspect_ratio(mpeg2dec);
picture->current_frame =
mpeg2dec->stream->video_out->get_frame (mpeg2dec->stream->video_out,
picture->coded_picture_width,
picture->coded_picture_height,
- get_aspect_ratio(mpeg2dec),
+ ratio,
mpeg2dec->frame_format,
flags);
/*
* Move to libmpeg2_accel.c
* int libmpeg2_accel_new_frame(mpeg2dec_t *, picture_t *)
*/
- mpeg2_xxmc_choose_coding(mpeg2dec, picture,
- get_aspect_ratio(mpeg2dec), flags);
+ mpeg2_xxmc_choose_coding(mpeg2dec, picture, ratio, flags);
/*
* End of new frame accel code.
*/
@@ -767,6 +774,21 @@ void mpeg2_discontinuity (mpeg2dec_t * mpeg2dec) {
* int libmpeg2_accel_discontinuity(mpeg2dec_t *);
*/
mpeg2dec->xvmc_last_slice_code=-1;
+ if ( !picture->current_frame )
+ return;
+ if (mpeg2dec->frame_format == XINE_IMGFMT_XXMC) {
+ xine_xxmc_t *xxmc = (xine_xxmc_t *)
+ picture->current_frame->accel_data;
+ switch(xxmc->acceleration) {
+ case XINE_XVMC_ACCEL_VLD:
+ case XINE_XVMC_ACCEL_IDCT:
+ case XINE_XVMC_ACCEL_MOCOMP:
+ xxmc->proc_xxmc_flush( picture->current_frame );
+ break;
+ default:
+ break;
+ }
+ }
/*
* End of discontinuity accel code.
*/
diff --git a/src/libmpeg2/slice_xvmc.c b/src/libmpeg2/slice_xvmc.c
index 0079d361b..f38a74b88 100644
--- a/src/libmpeg2/slice_xvmc.c
+++ b/src/libmpeg2/slice_xvmc.c
@@ -44,8 +44,8 @@
#define ACCEL (MOTION_ACCEL | IDCT_ACCEL)
#include "vlc.h"
-
/* original (non-patched) scan tables */
+
static uint8_t mpeg2_scan_norm_orig[64] ATTR_ALIGN(16) =
{
/* Zig-Zag scan pattern */
@@ -59,7 +59,7 @@ static uint8_t mpeg2_scan_norm_orig[64] ATTR_ALIGN(16) =
53,60,61,54,47,55,62,63
};
-uint8_t mpeg2_scan_alt_orig[64] ATTR_ALIGN(16) =
+static uint8_t mpeg2_scan_alt_orig[64] ATTR_ALIGN(16) =
{
/* Alternate scan pattern */
0,8,16,24,1,9,2,10,17,25,32,40,48,56,57,49,
@@ -68,10 +68,24 @@ uint8_t mpeg2_scan_alt_orig[64] ATTR_ALIGN(16) =
53,61,22,30,7,15,23,31,38,46,54,62,39,47,55,63
};
+uint8_t mpeg2_scan_alt_ptable[64] ATTR_ALIGN(16);
+uint8_t mpeg2_scan_norm_ptable[64] ATTR_ALIGN(16);
+uint8_t mpeg2_scan_orig_ptable[64] ATTR_ALIGN(16);
+
+void xvmc_setup_scan_ptable( void )
+{
+ int i;
+ for (i=0; i<64; ++i) {
+ mpeg2_scan_norm_ptable[mpeg2_scan_norm_orig[i]] = mpeg2_scan_norm[i];
+ mpeg2_scan_alt_ptable[mpeg2_scan_alt_orig[i]] = mpeg2_scan_alt[i];
+ mpeg2_scan_orig_ptable[i] = i;
+ }
+}
+
static int non_linear_quantizer_scale [] = {
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 10, 12, 14, 16, 18, 20, 22,
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 10, 12, 14, 16, 18, 20, 22,
24, 28, 32, 36, 40, 44, 48, 52,
56, 64, 72, 80, 88, 96, 104, 112
};
@@ -389,8 +403,10 @@ static void get_xvmc_intra_block_B14 (picture_t * picture)
{
int i;
int j;
+ int l;
int val;
uint8_t * scan = picture->scan;
+ uint8_t * scan_ptable = mpeg2_scan_orig_ptable;
uint8_t * quant_matrix = picture->intra_quantizer_matrix;
int quantizer_scale = picture->quantizer_scale;
int mismatch;
@@ -401,15 +417,17 @@ static void get_xvmc_intra_block_B14 (picture_t * picture)
int16_t * dest;
dest = picture->mc->blockptr;
-
- /* XvMC's IDCT must use non-patched scan tables */
+
if( picture->mc->xvmc_accel & IDCT_ACCEL ) {
- if( scan == mpeg2_scan_norm )
- scan = mpeg2_scan_norm_orig;
- else
- scan = mpeg2_scan_alt_orig;
+ if ( scan == mpeg2_scan_norm ) {
+ scan = mpeg2_scan_norm_orig;
+ scan_ptable = mpeg2_scan_norm_ptable;
+ } else {
+ scan = mpeg2_scan_alt_orig;
+ scan_ptable = mpeg2_scan_alt_ptable;
+ }
}
-
+
i = 0;
mismatch = ~dest[0];
@@ -429,10 +447,11 @@ static void get_xvmc_intra_block_B14 (picture_t * picture)
break; /* end of block */
normal_code:
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
+
bit_buf <<= tab->len;
bits += tab->len + 1;
- val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
+ val = (tab->level * quantizer_scale * quant_matrix[l]) >> 4;
/* if (bitstream_get (1)) val = -val; */
val = (val ^ SBITS (bit_buf, 1)) - SBITS (bit_buf, 1);
@@ -460,12 +479,12 @@ static void get_xvmc_intra_block_B14 (picture_t * picture)
if (i >= 64)
break; /* illegal, check needed to avoid buffer overflow */
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
DUMPBITS (bit_buf, bits, 12);
NEEDBITS (bit_buf, bits, bit_ptr);
val = (SBITS (bit_buf, 12) *
- quantizer_scale * quant_matrix[j]) / 16;
+ quantizer_scale * quant_matrix[l]) / 16;
SATURATE (val);
dest[j] = val;
@@ -513,8 +532,10 @@ static void get_xvmc_intra_block_B15 (picture_t * picture)
{
int i;
int j;
+ int l;
int val;
uint8_t * scan = picture->scan;
+ uint8_t * scan_ptable = mpeg2_scan_orig_ptable;
uint8_t * quant_matrix = picture->intra_quantizer_matrix;
int quantizer_scale = picture->quantizer_scale;
int mismatch;
@@ -526,14 +547,16 @@ static void get_xvmc_intra_block_B15 (picture_t * picture)
dest = picture->mc->blockptr;
- /* XvMC's IDCT must use non-patched scan tables */
if( picture->mc->xvmc_accel & IDCT_ACCEL ) {
- if( scan == mpeg2_scan_norm )
- scan = mpeg2_scan_norm_orig;
- else
- scan = mpeg2_scan_alt_orig;
+ if ( scan == mpeg2_scan_norm ) {
+ scan = mpeg2_scan_norm_orig;
+ scan_ptable = mpeg2_scan_norm_ptable;
+ } else {
+ scan = mpeg2_scan_alt_orig;
+ scan_ptable = mpeg2_scan_alt_ptable;
+ }
}
-
+
i = 0;
mismatch = ~dest[0];
@@ -552,10 +575,10 @@ static void get_xvmc_intra_block_B15 (picture_t * picture)
if (i < 64) {
normal_code:
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
bit_buf <<= tab->len;
bits += tab->len + 1;
- val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
+ val = (tab->level * quantizer_scale * quant_matrix[l]) >> 4;
/* if (bitstream_get (1)) val = -val; */
val = (val ^ SBITS (bit_buf, 1)) - SBITS (bit_buf, 1);
@@ -578,19 +601,18 @@ static void get_xvmc_intra_block_B15 (picture_t * picture)
/* escape code */
- i += UBITS (bit_buf << 6, 6) - 64;
+ i += UBITS (bit_buf << 6, 6) - 64;
if (i >= 64)
break; /* illegal, check against buffer overflow */
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
DUMPBITS (bit_buf, bits, 12);
NEEDBITS (bit_buf, bits, bit_ptr);
val = (SBITS (bit_buf, 12) *
- quantizer_scale * quant_matrix[j]) / 16;
+ quantizer_scale * quant_matrix[l]) / 16;
SATURATE (val);
-
dest[j] = val;
mismatch ^= val;
@@ -637,8 +659,10 @@ static void get_xvmc_non_intra_block (picture_t * picture)
{
int i;
int j;
+ int l;
int val;
uint8_t * scan = picture->scan;
+ uint8_t * scan_ptable = mpeg2_scan_orig_ptable;
uint8_t * quant_matrix = picture->non_intra_quantizer_matrix;
int quantizer_scale = picture->quantizer_scale;
int mismatch;
@@ -653,14 +677,16 @@ static void get_xvmc_non_intra_block (picture_t * picture)
dest = picture->mc->blockptr;
- /* XvMC's IDCT must use non-patched scan tables */
if( picture->mc->xvmc_accel & IDCT_ACCEL ) {
- if( scan == mpeg2_scan_norm )
- scan = mpeg2_scan_norm_orig;
- else
- scan = mpeg2_scan_alt_orig;
+ if ( scan == mpeg2_scan_norm ) {
+ scan = mpeg2_scan_norm_orig;
+ scan_ptable = mpeg2_scan_norm_ptable;
+ } else {
+ scan = mpeg2_scan_alt_orig;
+ scan_ptable = mpeg2_scan_alt_ptable;
+ }
}
-
+
bit_buf = picture->bitstream_buf;
bits = picture->bitstream_bits;
bit_ptr = picture->bitstream_ptr;
@@ -683,10 +709,10 @@ static void get_xvmc_non_intra_block (picture_t * picture)
break; /* end of block */
normal_code:
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
bit_buf <<= tab->len;
bits += tab->len + 1;
- val = ((2*tab->level+1) * quantizer_scale * quant_matrix[j]) >> 5;
+ val = ((2*tab->level+1) * quantizer_scale * quant_matrix[l]) >> 5;
/* if (bitstream_get (1)) val = -val; */
val = (val ^ SBITS (bit_buf, 1)) - SBITS (bit_buf, 1);
@@ -713,16 +739,16 @@ static void get_xvmc_non_intra_block (picture_t * picture)
/* escape code */
- i += UBITS (bit_buf << 6, 6) - 64;
+ i += UBITS (bit_buf << 6, 6) - 64;
if (i >= 64)
break; /* illegal, check needed to avoid buffer overflow */
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
DUMPBITS (bit_buf, bits, 12);
NEEDBITS (bit_buf, bits, bit_ptr);
val = 2 * (SBITS (bit_buf, 12) + SBITS (bit_buf, 1)) + 1;
- val = (val * quantizer_scale * quant_matrix[j]) / 32;
+ val = (val * quantizer_scale * quant_matrix[l]) / 32;
SATURATE (val);
dest[j] = val;
@@ -758,7 +784,6 @@ static void get_xvmc_non_intra_block (picture_t * picture)
}
break; /* illegal, check needed to avoid buffer overflow */
}
-
dest[63] ^= mismatch & 1;
DUMPBITS (bit_buf, bits, 2); /* dump end of block code */
picture->bitstream_buf = bit_buf;
@@ -770,8 +795,10 @@ static void get_xvmc_mpeg1_intra_block (picture_t * picture)
{
int i;
int j;
+ int l;
int val;
uint8_t * scan = picture->scan;
+ uint8_t * scan_ptable = mpeg2_scan_orig_ptable;
uint8_t * quant_matrix = picture->intra_quantizer_matrix;
int quantizer_scale = picture->quantizer_scale;
DCTtab * tab;
@@ -784,14 +811,16 @@ static void get_xvmc_mpeg1_intra_block (picture_t * picture)
dest = picture->mc->blockptr;
- /* XvMC's IDCT must use non-patched scan tables */
if( picture->mc->xvmc_accel & IDCT_ACCEL ) {
- if( scan == mpeg2_scan_norm )
- scan = mpeg2_scan_norm_orig;
- else
- scan = mpeg2_scan_alt_orig;
+ if ( scan == mpeg2_scan_norm ) {
+ scan = mpeg2_scan_norm_orig;
+ scan_ptable = mpeg2_scan_norm_ptable;
+ } else {
+ scan = mpeg2_scan_alt_orig;
+ scan_ptable = mpeg2_scan_alt_ptable;
+ }
}
-
+
bit_buf = picture->bitstream_buf;
bits = picture->bitstream_bits;
bit_ptr = picture->bitstream_ptr;
@@ -808,10 +837,10 @@ static void get_xvmc_mpeg1_intra_block (picture_t * picture)
break; /* end of block */
normal_code:
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
bit_buf <<= tab->len;
bits += tab->len + 1;
- val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
+ val = (tab->level * quantizer_scale * quant_matrix[l]) >> 4;
/* oddification */
val = (val - 1) | 1;
@@ -837,11 +866,11 @@ static void get_xvmc_mpeg1_intra_block (picture_t * picture)
/* escape code */
- i += UBITS (bit_buf << 6, 6) - 64;
+ i += UBITS (bit_buf << 6, 6) - 64;
if (i >= 64)
break; /* illegal, check needed to avoid buffer overflow */
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
DUMPBITS (bit_buf, bits, 12);
NEEDBITS (bit_buf, bits, bit_ptr);
@@ -850,7 +879,7 @@ static void get_xvmc_mpeg1_intra_block (picture_t * picture)
DUMPBITS (bit_buf, bits, 8);
val = UBITS (bit_buf, 8) + 2 * val;
}
- val = (val * quantizer_scale * quant_matrix[j]) / 16;
+ val = (val * quantizer_scale * quant_matrix[l]) / 16;
/* oddification */
val = (val + ~SBITS (val, 1)) | 1;
@@ -898,8 +927,10 @@ static void get_xvmc_mpeg1_non_intra_block (picture_t * picture)
{
int i;
int j;
+ int l;
int val;
uint8_t * scan = picture->scan;
+ uint8_t * scan_ptable = mpeg2_scan_orig_ptable;
uint8_t * quant_matrix = picture->non_intra_quantizer_matrix;
int quantizer_scale = picture->quantizer_scale;
DCTtab * tab;
@@ -912,14 +943,16 @@ static void get_xvmc_mpeg1_non_intra_block (picture_t * picture)
dest = picture->mc->blockptr;
- /* XvMC's IDCT must use non-patched scan tables */
if( picture->mc->xvmc_accel & IDCT_ACCEL ) {
- if( scan == mpeg2_scan_norm )
- scan = mpeg2_scan_norm_orig;
- else
- scan = mpeg2_scan_alt_orig;
+ if ( scan == mpeg2_scan_norm ) {
+ scan = mpeg2_scan_norm_orig;
+ scan_ptable = mpeg2_scan_norm_ptable;
+ } else {
+ scan = mpeg2_scan_alt_orig;
+ scan_ptable = mpeg2_scan_alt_ptable;
+ }
}
-
+
bit_buf = picture->bitstream_buf;
bits = picture->bitstream_bits;
bit_ptr = picture->bitstream_ptr;
@@ -942,10 +975,10 @@ static void get_xvmc_mpeg1_non_intra_block (picture_t * picture)
break; /* end of block */
normal_code:
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
bit_buf <<= tab->len;
bits += tab->len + 1;
- val = ((2*tab->level+1) * quantizer_scale * quant_matrix[j]) >> 5;
+ val = ((2*tab->level+1) * quantizer_scale * quant_matrix[l]) >> 5;
/* oddification */
val = (val - 1) | 1;
@@ -978,7 +1011,7 @@ static void get_xvmc_mpeg1_non_intra_block (picture_t * picture)
if (i >= 64)
break; /* illegal, check needed to avoid buffer overflow */
- j = scan[i];
+ l = scan_ptable[j = scan[i]];
DUMPBITS (bit_buf, bits, 12);
NEEDBITS (bit_buf, bits, bit_ptr);
@@ -988,7 +1021,7 @@ static void get_xvmc_mpeg1_non_intra_block (picture_t * picture)
val = UBITS (bit_buf, 8) + 2 * val;
}
val = 2 * (val + SBITS (val, 1)) + 1;
- val = (val * quantizer_scale * quant_matrix[j]) / 32;
+ val = (val * quantizer_scale * quant_matrix[l]) / 32;
/* oddification */
val = (val + ~SBITS (val, 1)) | 1;
@@ -1052,10 +1085,7 @@ static inline void slice_xvmc_intra_DCT (picture_t * picture, int cc,
mpeg2_zero_block(picture->mc->blockptr);
- picture->mc->blockptr[0] =
- picture->dc_dct_pred[cc] << (3 - picture->intra_dc_precision);
- // memset (picture->mc->blockptr + 1, 0, 63 * sizeof (int16_t));
- // TODO do we need to zero mem here?
+ picture->mc->blockptr[0] = picture->dc_dct_pred[cc] << (3 - picture->intra_dc_precision);
if (picture->mpeg1) {
if (picture->picture_coding_type != D_TYPE)
@@ -1078,7 +1108,7 @@ static inline void slice_xvmc_intra_DCT (picture_t * picture, int cc,
static inline void slice_xvmc_non_intra_DCT (picture_t * picture, uint8_t * dest,
int stride)
{
- mpeg2_zero_block(picture->mc->blockptr);
+ mpeg2_zero_block(picture->mc->blockptr);
if (picture->mpeg1)
get_xvmc_mpeg1_non_intra_block (picture);
@@ -1093,6 +1123,7 @@ static inline void slice_xvmc_non_intra_DCT (picture_t * picture, uint8_t * dest
}
#define MOTION(table,ref,motion_x,motion_y,size,y) \
+ if(!picture->mc->xvmc_accel) { \
pos_x = 2 * picture->offset + motion_x; \
pos_y = 2 * picture->v_offset + motion_y + 2 * y; \
if ((pos_x > picture->limit_x) || (pos_y > picture->limit_y_ ## size)) \
@@ -1113,7 +1144,8 @@ static inline void slice_xvmc_non_intra_DCT (picture_t * picture, uint8_t * dest
(picture->offset >> 1), ref[2] + \
(((picture->offset + motion_x) >> 1) + \
((((picture->v_offset + motion_y) >> 1) + y/2) * \
- picture->pitches[2])), picture->pitches[2], size/2) \
+ picture->pitches[2])), picture->pitches[2], size/2); \
+ }
#define MOTION_FIELD(table,ref,motion_x,motion_y,dest_field,op,src_field) \
@@ -1631,7 +1663,7 @@ static inline int slice_xvmc_init (picture_t * picture, int code)
picture->limit_y = height - 16;
//TODO conversion to signed format signed format
- if(picture->mc->xvmc_accel == MOTION_ACCEL) {
+ if((picture->mc->xvmc_accel & ACCEL) == MOTION_ACCEL) {
//Motion Comp only unsigned intra
// original:
picture->dc_dct_pred[0] = picture->dc_dct_pred[1] =
@@ -1888,7 +1920,7 @@ void mpeg2_xvmc_slice (mpeg2dec_t *mpeg2dec, picture_t * picture, int code, uint
picture->pitches[2]); // cc2 croma
}
- if(picture->mc->xvmc_accel == MOTION_ACCEL) {
+ if((picture->mc->xvmc_accel & ACCEL) == MOTION_ACCEL) {
// original:
picture->dc_dct_pred[0] = picture->dc_dct_pred[1] =
picture->dc_dct_pred[2] = 128 << picture->intra_dc_precision;
@@ -1945,7 +1977,7 @@ void mpeg2_xvmc_slice (mpeg2dec_t *mpeg2dec, picture_t * picture, int code, uint
mba_inc += mba->mba;
if (mba_inc) {
//TODO conversion to signed format signed format
- if(picture->mc->xvmc_accel == MOTION_ACCEL) {
+ if((picture->mc->xvmc_accel & ACCEL) == MOTION_ACCEL) {
// original:
picture->dc_dct_pred[0] = picture->dc_dct_pred[1] =
picture->dc_dct_pred[2] = 128 << picture->intra_dc_precision;
@@ -2011,7 +2043,6 @@ void mpeg2_xvmc_slice (mpeg2dec_t *mpeg2dec, picture_t * picture, int code, uint
}
picture->XvMC_mb_type = macroblock_modes & 0x1E;
-
picture->XvMC_x = picture->offset/16;
picture->XvMC_y = picture->v_offset/16;
diff --git a/src/libmpeg2/slice_xvmc_vld.c b/src/libmpeg2/slice_xvmc_vld.c
index f099bc22a..1159fd90e 100644
--- a/src/libmpeg2/slice_xvmc_vld.c
+++ b/src/libmpeg2/slice_xvmc_vld.c
@@ -254,12 +254,12 @@ void mpeg2_xxmc_vld_frame_complete(mpeg2dec_t *mpeg2dec, picture_t *picture, int
*xxmc = (xine_xxmc_t *) frame->accel_data;
if (xxmc->decoded) return;
+ xxmc->proc_xxmc_flush( frame );
+ if (xxmc->result) {
+ mpeg2dec->xvmc_last_slice_code=-1;
+ return;
+ }
if (mpeg2dec->xvmc_last_slice_code >= 1) {
- xxmc->proc_xxmc_flush( frame );
- if (xxmc->result) {
- mpeg2dec->xvmc_last_slice_code=-1;
- return;
- }
xxmc->decoded = 1;
if (picture->picture_structure == 3 || picture->second_field) {
if (xxmc->result == 0)
diff --git a/src/libmpeg2/xvmc.h b/src/libmpeg2/xvmc.h
index 3abecdb77..5caa74297 100644
--- a/src/libmpeg2/xvmc.h
+++ b/src/libmpeg2/xvmc.h
@@ -25,6 +25,12 @@
#include "mpeg2.h"
/* slice_xvmc.c */
+
+extern uint8_t mpeg2_scan_alt_ptable[64] ATTR_ALIGN(16);
+extern uint8_t mpeg2_scan_norm_ptable[64] ATTR_ALIGN(16);
+extern uint8_t mpeg2_scan_orig_ptable[64] ATTR_ALIGN(16);
+
void mpeg2_xvmc_slice (mpeg2dec_t *mpeg2dec, picture_t * picture, int code, uint8_t * buffer);
+void xvmc_setup_scan_ptable( void );
#endif
diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c
index d71feceae..aee64cc08 100644
--- a/src/video_out/video_out_xvmc.c
+++ b/src/video_out/video_out_xvmc.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: video_out_xvmc.c,v 1.20 2004/12/12 22:01:29 mroi Exp $
+ * $Id: video_out_xvmc.c,v 1.21 2005/02/22 18:31:55 totte67 Exp $
*
* video_out_xvmc.c, X11 video motion compensation extension interface for xine
*
@@ -124,8 +124,6 @@ typedef struct {
XvMCSurface surface;
/* temporary Xv only storage */
- XvImage *image;
- XShmSegmentInfo shminfo;
xine_xvmc_t xvmc_data;
} xvmc_frame_t;
@@ -384,9 +382,6 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type,
mbs->macroblockptr->dct_type = dct_type;
mbs->macroblockptr->coded_block_pattern = cbp;
- cbp &= 0x3F;
- mbs->macroblockptr->coded_block_pattern = cbp;
-
while(cbp) {
if(cbp & 1) mbs->macroblockptr->index--;
cbp >>= 1;
@@ -471,18 +466,11 @@ static uint32_t xvmc_get_capabilities (vo_driver_t *this_gen) {
}
static void xvmc_frame_field (vo_frame_t *vo_img, int which_field) {
- xvmc_driver_t *this = (xvmc_driver_t *) vo_img->driver;
-
lprintf ("xvmc_frame_field\n");
-
- this->macroblocks.num_blocks = 0;
- this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr;
- this->macroblocks.xine_mc.blockptr = this->macroblocks.xine_mc.blockbaseptr;
}
static void xvmc_frame_dispose (vo_frame_t *vo_img) {
xvmc_frame_t *frame = (xvmc_frame_t *) vo_img ;
- xvmc_driver_t *this = (xvmc_driver_t *) vo_img->driver;
lprintf ("xvmc_frame_dispose\n");
@@ -492,11 +480,6 @@ static void xvmc_frame_dispose (vo_frame_t *vo_img) {
* set_context does the work
*/
- if (frame->image) {
- XLockDisplay (this->display);
- XFree (frame->image);
- XUnlockDisplay (this->display);
- }
free (frame);
}
@@ -510,6 +493,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
xvmc_frame_t *current_frame = (xvmc_frame_t *) current_image;
xvmc_frame_t *forward_frame = (xvmc_frame_t *) forward_ref_image;
xvmc_frame_t *backward_frame = (xvmc_frame_t *) backward_ref_image;
+ int flags;
lprintf ("xvmc_render_macro_blocks\n");
lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n",
@@ -521,14 +505,15 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
(long) forward_frame->surface);
*/
- /* XvMCSyncSurface(this->display,&current_frame->surface); */
+ flags = second_field;
+
if(forward_frame) {
if(backward_frame) {
XvMCRenderSurface(this->display, &this->context, picture_structure,
&current_frame->surface,
&forward_frame->surface,
&backward_frame->surface,
- second_field,
+ flags,
macroblocks->slices, 0, macroblocks->macro_blocks,
macroblocks->blocks);
}
@@ -537,7 +522,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
&current_frame->surface,
&forward_frame->surface,
NULL,
- second_field,
+ flags,
macroblocks->slices, 0, macroblocks->macro_blocks,
macroblocks->blocks);
}
@@ -548,7 +533,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
&current_frame->surface,
NULL,
&backward_frame->surface,
- second_field,
+ flags,
macroblocks->slices, 0, macroblocks->macro_blocks,
macroblocks->blocks);
}
@@ -557,13 +542,13 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
&current_frame->surface,
NULL,
NULL,
- second_field,
+ flags,
macroblocks->slices, 0, macroblocks->macro_blocks,
macroblocks->blocks);
}
}
- /* XvMCFlushSurface(this->display, &current_frame->surface); */
+ XvMCFlushSurface(this->display, &current_frame->surface);
lprintf ("xvmc_render_macro_blocks done\n");
}
@@ -712,7 +697,6 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this,
macroblocks->macroblockptr = macroblocks->macroblockbaseptr;
macroblocks->slices = slices;
macroblocks->xine_mc.xvmc_accel = this->acceleration;
-
return(&this->context_id);
}
@@ -792,45 +776,20 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen,
lprintf ("updating frame to %d x %d (ratio=%f, format=%08x)\n",
width, height, ratio, format);
- XLockDisplay (this->display);
-
- /*
- * (re-) allocate xvimage
- */
-
- if (frame->image) {
- dispose_ximage (this, &frame->shminfo, frame->image);
- frame->image = NULL;
- }
-
- frame->image = create_ximage (this, &frame->shminfo, width, height, format);
-
- frame->vo_frame.pitches[0] = frame->image->pitches[0];
- frame->vo_frame.pitches[1] = frame->image->pitches[2];
- frame->vo_frame.pitches[2] = frame->image->pitches[1];
- frame->vo_frame.base[0] = frame->image->data + frame->image->offsets[0];
- frame->vo_frame.base[1] = frame->image->data + frame->image->offsets[2];
- frame->vo_frame.base[2] = frame->image->data + frame->image->offsets[1];
-
+ /* Note that since we are rendering in hardware, we do not need to
+ * allocate any ximage's for the software rendering buffers.
+ */
frame->width = width;
frame->height = height;
frame->format = format;
-
- XUnlockDisplay (this->display);
+ frame->ratio = ratio;
}
- frame->ratio = ratio;
-
xvmc->macroblocks = (xine_macroblocks_t *)&this->macroblocks;
if( flags & VO_NEW_SEQUENCE_FLAG ) {
xvmc_set_context (this, width, height, ratio, format, flags,
xvmc->macroblocks);
}
-
- this->macroblocks.num_blocks = 0;
- this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr;
- this->macroblocks.xine_mc.blockptr = this->macroblocks.xine_mc.blockbaseptr;
-
}
static void xvmc_clean_output_area (xvmc_driver_t *this) {
@@ -955,7 +914,6 @@ static int xvmc_redraw_needed (vo_driver_t *this_gen) {
static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
xvmc_driver_t *this = (xvmc_driver_t *) this_gen;
xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen;
- int status;
lprintf ("xvmc_display_frame %d %x\n",frame_gen->id,frame_gen);
@@ -998,13 +956,9 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
xvmc_redraw_needed (this_gen);
XLockDisplay (this->display);
-
- XvMCGetSurfaceStatus(this->display, &this->cur_frame->surface, &status);
-
- if(status & XVMC_RENDERING) {
- lprintf("--------- current frame is still being rendered %x --------\n",status);
- XvMCSyncSurface(this->display, &this->cur_frame->surface);
- }
+
+ /* Make sure the surface has finished rendering before we display */
+ XvMCSyncSurface(this->display, &this->cur_frame->surface);
if (this->deinterlace_enabled &&
(this->deinterlace_method == DEINTERLACE_ONEFIELD)) {
@@ -1167,15 +1121,6 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen,
XLockDisplay (this->display);
- /*
- XvPutImage(this->display, this->xv_port,
- this->drawable, this->gc, this->cur_frame->image,
- this->sc.displayed_xoffset, this->sc.displayed_yoffset,
- this->sc.displayed_width, this->sc.displayed_height,
- this->sc.output_xoffset, this->sc.output_yoffset,
- this->sc.output_width, this->sc.output_height);
- */
-
XSetForeground (this->display, this->gc, this->black.pixel);
for( i = 0; i < 4; i++ ) {
@@ -1250,15 +1195,6 @@ static void xvmc_dispose (vo_driver_t *this_gen) {
lprintf ("xvmc_dispose\n");
- if (this->deinterlace_frame.image) {
- /* dispose_ximage should be xlocked */
- XLockDisplay(this->display);
- dispose_ximage (this, &this->deinterlace_frame.shminfo,
- this->deinterlace_frame.image);
- XUnlockDisplay(this->display);
- this->deinterlace_frame.image = NULL;
- }
-
if(this->context_id.xid) {
XLockDisplay(this->display);
for(i = 0; i < this->num_frame_buffers; i++) {
@@ -1425,7 +1361,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
this->user_data = visual->user_data;
this->deinterlace_method = 0;
- this->deinterlace_frame.image = NULL;
this->use_colorkey = 0;
this->colorkey = 0;
@@ -1731,7 +1666,7 @@ static void *init_class (xine_t *xine, void *visual_gen) {
if(Success == XvGrabPort(display,
adaptor_info[adaptor_num].base_id + j, CurrentTime)) {
xv_port = adaptor_info[adaptor_num].base_id + j;
- surface_type = surfaceInfo[j].surface_type_id;
+ surface_type = surfaceInfo[surface_num].surface_type_id;
break;
}
}
@@ -1757,7 +1692,7 @@ static void *init_class (xine_t *xine, void *visual_gen) {
if(Success == XvGrabPort(display,
adaptor_info[adaptor_num].base_id + j, CurrentTime)) {
xv_port = adaptor_info[adaptor_num].base_id + j;
- surface_type = surfaceInfo[j].surface_type_id;
+ surface_type = surfaceInfo[surface_num].surface_type_id;
break;
}
}
@@ -1770,19 +1705,18 @@ static void *init_class (xine_t *xine, void *visual_gen) {
if(xv_port) {
lprintf ("port %ld surface %d\n",xv_port,j);
- if(surfaceInfo[j].flags & XVMC_OVERLAID_SURFACE)
+ IDCTaccel = 0;
+ if(surfaceInfo[surface_num].flags & XVMC_OVERLAID_SURFACE)
useOverlay = 1;
- if(surfaceInfo[j].flags & XVMC_INTRA_UNSIGNED)
+ if(surfaceInfo[surface_num].flags & XVMC_INTRA_UNSIGNED)
unsignedIntra = 1;
- if(surfaceInfo[j].mc_type == (XVMC_IDCT | XVMC_MPEG_2))
- IDCTaccel = XINE_VO_IDCT_ACCEL + XINE_VO_MOTION_ACCEL;
- else if(surfaceInfo[j].mc_type == (XVMC_MOCOMP | XVMC_MPEG_2)) {
- IDCTaccel = XINE_VO_MOTION_ACCEL;
+ if(surfaceInfo[surface_num].mc_type == (XVMC_IDCT | XVMC_MPEG_2))
+ IDCTaccel |= XINE_VO_IDCT_ACCEL | XINE_VO_MOTION_ACCEL;
+ else if(surfaceInfo[surface_num].mc_type == (XVMC_MOCOMP | XVMC_MPEG_2)) {
+ IDCTaccel |= XINE_VO_MOTION_ACCEL;
if(!unsignedIntra)
IDCTaccel |= XINE_VO_SIGNED_INTRA;
}
- else
- IDCTaccel = 0;
xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: IDCTaccel %02x\n",IDCTaccel);
break;
}
diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c
index e2bb7e280..b6cf74d10 100644
--- a/src/video_out/video_out_xxmc.c
+++ b/src/video_out/video_out_xxmc.c
@@ -18,7 +18,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: video_out_xxmc.c,v 1.11 2004/12/12 22:01:30 mroi Exp $
+ * $Id: video_out_xxmc.c,v 1.12 2005/02/22 18:31:58 totte67 Exp $
*
* video_out_xxmc.c, X11 decoding accelerated video extension interface for xine
*
@@ -369,7 +369,6 @@ static void xvmc_flush(vo_frame_t *this_gen)
XVMCLOCKDISPLAY( driver->display );
frame->xxmc_data.result = XvMCFlushSurface( driver->display, frame->xvmc_surf );
- frame->xxmc_data.result = XvMCSyncSurface( driver->display, frame->xvmc_surf );
XVMCUNLOCKDISPLAY( driver->display );
xvmc_context_reader_unlock( &driver->xvmc_lock );
@@ -453,17 +452,7 @@ static uint32_t xxmc_get_capabilities (vo_driver_t *this_gen) {
static void xxmc_frame_field (vo_frame_t *vo_img, int which_field)
{
- xxmc_driver_t *this = (xxmc_driver_t *) vo_img->driver;
-
-
lprintf ("xvmc_frame_field\n");
- if (this->xvmc_cap) {
- if (this->xvmc_accel & (XINE_XVMC_ACCEL_IDCT | XINE_XVMC_ACCEL_MOCOMP)) {
- this->macroblocks.num_blocks = 0;
- this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr;
- this->macroblocks.xine_mc.blockptr = this->macroblocks.xine_mc.blockbaseptr;
- }
- }
}
static void xxmc_frame_dispose (vo_frame_t *vo_img) {
@@ -1008,26 +997,18 @@ static void xxmc_frame_updates(xxmc_driver_t *driver,
xxmc->acceleration = driver->xvmc_accel;
xxmc->xvmc.macroblocks = (xine_macroblocks_t *) &driver->macroblocks;
- xxmc->xvmc.macroblocks->xvmc_accel = (driver->unsigned_intra) ?
+ xxmc->xvmc.macroblocks->xvmc_accel = (driver->unsigned_intra) ?
0 : XINE_VO_SIGNED_INTRA;
switch(driver->xvmc_accel) {
case XINE_XVMC_ACCEL_IDCT:
xxmc->xvmc.macroblocks->xvmc_accel |= XINE_VO_IDCT_ACCEL;
break;
case XINE_XVMC_ACCEL_MOCOMP:
- xxmc->xvmc.macroblocks->xvmc_accel |= XINE_VO_MOTION_ACCEL;
+ xxmc->xvmc.macroblocks->xvmc_accel |= XINE_VO_MOTION_ACCEL;
break;
default:
xxmc->xvmc.macroblocks->xvmc_accel = 0;
}
- driver->macroblocks.num_blocks = 0;
- driver->macroblocks.macroblockptr = driver->macroblocks.macroblockbaseptr;
- driver->macroblocks.xine_mc.blockptr =
- driver->macroblocks.xine_mc.blockbaseptr;
-
- /*
- * Accelerated callbacks.
- */
xxmc->proc_xxmc_flush = xvmc_flush;
xxmc->xvmc.proc_macro_block = xxmc_xvmc_proc_macro_block;
@@ -1515,6 +1496,7 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen)
xxmc_redraw_needed (this_gen);
if (frame->format == XINE_IMGFMT_XXMC) {
XVMCLOCKDISPLAY( this->display );
+ XvMCSyncSurface( this->display, frame->xvmc_surf );
XvMCPutSurface( this->display, frame->xvmc_surf , this->drawable,
this->sc.displayed_xoffset, this->sc.displayed_yoffset,
this->sc.displayed_width, this->sc.displayed_height,
@@ -1711,6 +1693,7 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen,
xxmc_clean_output_area(this,(frame->format == XINE_IMGFMT_XXMC));
if (frame->format == XINE_IMGFMT_XXMC) {
XVMCLOCKDISPLAY( this->display );
+ XvMCSyncSurface( this->display, frame->xvmc_surf );
XvMCPutSurface( this->display, frame->xvmc_surf, this->drawable,
this->sc.displayed_xoffset, this->sc.displayed_yoffset,
this->sc.displayed_width, this->sc.displayed_height,
@@ -2429,7 +2412,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
_("There's a bug in NVIDIA's XvMC lib that makes red OSD colors\n"
"look blue and vice versa. This option provides a workaround.\n"),
10, xxmc_update_nvidia_fix, this);
-
this->deinterlace_enabled = 0;
#ifdef HAVE_VLDXVMC
printf("video_out_xxmc: Unichrome CPU saving is %s.\n",
diff --git a/src/video_out/xvmc_mocomp.c b/src/video_out/xvmc_mocomp.c
index ca6873ccb..75a1aa4d9 100644
--- a/src/video_out/xvmc_mocomp.c
+++ b/src/video_out/xvmc_mocomp.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: xvmc_mocomp.c,v 1.2 2004/10/03 12:36:15 totte67 Exp $
+ * $Id: xvmc_mocomp.c,v 1.3 2005/02/22 18:31:59 totte67 Exp $
*
* XvMC image support by Jack Kelliher
*/
@@ -75,19 +75,22 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
xxmc_frame_t *current_frame = (xxmc_frame_t *) current_image;
xxmc_frame_t *forward_frame = (xxmc_frame_t *) forward_ref_image;
xxmc_frame_t *backward_frame = (xxmc_frame_t *) backward_ref_image;
+ int flags;
lprintf ("xvmc_render_macro_blocks\n");
lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n",
macroblocks->slices,
(long) current_frame, (long) backward_frame,
(long) forward_frame);
-
+
+ flags = second_field;
+
XVMCLOCKDISPLAY( this->display);
XvMCRenderSurface(this->display, &this->context, picture_structure,
current_frame->xvmc_surf,
forward_frame ? forward_frame->xvmc_surf : NULL,
backward_frame ? backward_frame->xvmc_surf : NULL,
- second_field,
+ flags,
macroblocks->slices, 0, &macroblocks->macro_blocks,
&macroblocks->blocks);
XVMCUNLOCKDISPLAY( this->display);
@@ -185,7 +188,7 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type,
mbs->macroblockptr->index = ((unsigned long)mbs->xine_mc.blockptr -
(unsigned long)mbs->xine_mc.blockbaseptr) >> 7;
-
+
mbs->macroblockptr->dct_type = dct_type;
mbs->macroblockptr->coded_block_pattern = cbp;