From: Christian B. <cb...@st...> - 2001-01-31 02:03:20
|
Hi! On Tue, Jan 30, 2001 at 02:15:59PM +0000, Rich Wareham wrote: > It appears that the decoding algorithm is not exactly perfect. I have now had a look at it and found 2 bugs: 1) Every 00xx code is (probably) an EOL, but the decoder only recognized 0000..0003 (Dark Crystal has 0010 EOL codes). 2) The first 2 bytes of the PXD were not processed. The patch attached below fixes these two issues. I've also added some code to align the y coordinate to an even number. Otherwise the luminance and color data may be off by one pixel. Maybe this also fixes your interlace problem (I don't know whether the interlaced pixel data in SPUs refers to 'absolute' (screen) or 'relative' (subpicture) even/odd lines). =================================================================== RCS file: /cvsroot/xine/xine/libspudec/spudec.c,v retrieving revision 1.1 diff -u -r1.1 spudec.c --- libspudec/spudec.c 2001/01/28 02:56:06 1.1 +++ libspudec/spudec.c 2001/01/31 01:52:17 @@ -29,7 +29,7 @@ #include <stdio.h> #include <stdlib.h> -#include <strings.h> +#include <string.h> #include <fcntl.h> #include <unistd.h> @@ -238,6 +238,16 @@ na = d1<<1; nb = d2<<1; + + /* Align on even row */ + if (gSpudec.geom.start_row & 1) { + gSpudec.geom.start_row--; + gSpudec.geom.end_row--; + } + if (gSpudec.geom.start_col & 1) { + gSpudec.geom.start_col--; + gSpudec.geom.end_col--; + } y = gSpudec.geom.start_row; while(y <= gSpudec.geom.end_row) { @@ -260,6 +270,8 @@ if(n < 0x40) { n = (n<<4) | nibble(data, na); na++; + if(n < 0x100) + n = 0; /* Carriage return */ } } } @@ -307,6 +319,10 @@ na ++; /* Re-align */ line_base += gSpudec.width; + y++; + if (y > gSpudec.geom.end_row) + break; + off = 0; do { int num; @@ -323,6 +339,8 @@ if(n < 0x40) { n = (n<<4) | nibble(data, nb); nb++; + if(n < 0x100) + n = 0; /* Carriage return */ } } } @@ -355,7 +373,7 @@ if((nb & 1)) nb ++; /* Re-align */ - y += 2; + y++; } } @@ -453,7 +471,7 @@ spudec_process_control(packet + x0 + 2, x1-x0-2, &d1, &d2); if((d1 != -1) && (d2 != -1)) { - spudec_process_data(packet+2, x0, d1,d2); + spudec_process_data(packet, x0, d1, d2); } } =================================================================== Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/ |