summaryrefslogtreecommitdiff
path: root/src/libxinevdec
diff options
context:
space:
mode:
Diffstat (limited to 'src/libxinevdec')
-rw-r--r--src/libxinevdec/cinepak.c35
-rw-r--r--src/libxinevdec/cyuv.c14
-rw-r--r--src/libxinevdec/fli.c27
-rw-r--r--src/libxinevdec/foovideo.c29
-rw-r--r--src/libxinevdec/msrle.c27
-rw-r--r--src/libxinevdec/msvc.c31
-rw-r--r--src/libxinevdec/rgb.c27
-rw-r--r--src/libxinevdec/roqvideo.c17
-rw-r--r--src/libxinevdec/svq1.c25
-rw-r--r--src/libxinevdec/yuv.c31
10 files changed, 127 insertions, 136 deletions
diff --git a/src/libxinevdec/cinepak.c b/src/libxinevdec/cinepak.c
index a448d2b54..7484a6916 100644
--- a/src/libxinevdec/cinepak.c
+++ b/src/libxinevdec/cinepak.c
@@ -22,7 +22,7 @@
* based on overview of Cinepak algorithm and example decoder
* by Tim Ferguson: http://www.csse.monash.edu.au/~timf/
*
- * $Id: cinepak.c,v 1.9 2002/07/05 17:32:04 mroi Exp $
+ * $Id: cinepak.c,v 1.10 2002/07/15 21:42:34 esnel Exp $
*/
#include <stdlib.h>
@@ -358,28 +358,27 @@ static void cvid_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
img->pts = buf->pts;
img->bad_frame = 0;
+ /* FIXME: use img->pitches[3] */
xine_fast_memcpy (img->base[0], this->img_buffer, n);
xine_fast_memcpy (img->base[1], this->img_buffer + n, (n >> 2));
xine_fast_memcpy (img->base[2], this->img_buffer + n + (n >> 2), (n >> 2));
if (img->copy) {
-
- int height = abs(this->biHeight);
- int stride = this->biWidth;
- uint8_t* src[3];
-
- src[0] = img->base[0];
- src[1] = img->base[1];
- src[2] = img->base[2];
- while ((height -= 16) >= 0) {
- img->copy(img, src);
- src[0] += 16 * stride;
- src[1] += 4 * stride;
- src[2] += 4 * stride;
- }
- }
-
-
+ int height = img->height;
+ uint8_t *src[3];
+
+ src[0] = img->base[0];
+ src[1] = img->base[1];
+ src[2] = img->base[2];
+
+ while ((height -= 16) >= 0) {
+ img->copy(img, src);
+ src[0] += 16 * img->pitches[0];
+ src[1] += 8 * img->pitches[1];
+ src[2] += 8 * img->pitches[2];
+ }
+ }
+
img->draw(img);
img->free(img);
diff --git a/src/libxinevdec/cyuv.c b/src/libxinevdec/cyuv.c
index 0595e0456..6bbf39687 100644
--- a/src/libxinevdec/cyuv.c
+++ b/src/libxinevdec/cyuv.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: cyuv.c,v 1.4 2002/07/05 17:32:04 mroi Exp $
+ * $Id: cyuv.c,v 1.5 2002/07/15 21:42:34 esnel Exp $
*/
/* And this is the header that came with the CYUV decoder: */
@@ -194,6 +194,18 @@ static void cyuv_decode_data (video_decoder_t *this_gen,
cyuv_decode(this->buf, this->size, img->base[0],
this->width, this->height, 0);
+ if (img->copy) {
+ int height = img->height;
+ uint8_t *src[3];
+
+ src[0] = img->base[0];
+
+ while ((height -= 16) >= 0) {
+ img->copy(img, src);
+ src[0] += 16 * img->pitches[0];
+ }
+ }
+
this->skipframes = img->draw(img);
if( this->skipframes < 0 )
this->skipframes = 0;
diff --git a/src/libxinevdec/fli.c b/src/libxinevdec/fli.c
index fb2e4446e..9737dbc9c 100644
--- a/src/libxinevdec/fli.c
+++ b/src/libxinevdec/fli.c
@@ -23,7 +23,7 @@
* avoid when implementing a FLI decoder, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: fli.c,v 1.1 2002/07/14 01:31:57 tmmm Exp $
+ * $Id: fli.c,v 1.2 2002/07/15 21:42:34 esnel Exp $
*/
#include <stdio.h>
@@ -531,26 +531,19 @@ static void fli_decode_data (video_decoder_t *this_gen,
img->bad_frame = 0;
decode_fli_frame(this);
- yuv444_to_yuy2(&this->yuv_planes, img->base[0]);
+ yuv444_to_yuy2(&this->yuv_planes, img->base[0], img->pitches[0]);
-/*
if (img->copy) {
+ int height = img->height;
+ uint8_t *src[3];
- int height = abs(this->biHeight);
- int stride = this->biWidth;
- uint8_t* src[3];
-
- src[0] = img->base[0];
- src[1] = img->base[1];
- src[2] = img->base[2];
- while ((height -= 16) >= 0) {
- img->copy(img, src);
- src[0] += 16 * stride;
- src[1] += 4 * stride;
- src[2] += 4 * stride;
- }
+ src[0] = img->base[0];
+
+ while ((height -= 16) >= 0) {
+ img->copy(img, src);
+ src[0] += 16 * img->pitches[0];
+ }
}
-*/
img->draw(img);
img->free(img);
diff --git a/src/libxinevdec/foovideo.c b/src/libxinevdec/foovideo.c
index 28fd42f55..efe1a22b0 100644
--- a/src/libxinevdec/foovideo.c
+++ b/src/libxinevdec/foovideo.c
@@ -20,7 +20,7 @@
* General description and author credits go here...
*
* Leave the following line intact for when the decoder is committed to CVS:
- * $Id: foovideo.c,v 1.2 2002/07/05 17:32:04 mroi Exp $
+ * $Id: foovideo.c,v 1.3 2002/07/15 21:42:34 esnel Exp $
*/
#include <stdio.h>
@@ -180,20 +180,19 @@ static void foovideo_decode_data (video_decoder_t *this_gen,
/*
if (img->copy) {
-
- int height = abs(this->biHeight);
- int stride = this->biWidth;
- uint8_t* src[3];
-
- src[0] = img->base[0];
- src[1] = img->base[1];
- src[2] = img->base[2];
- while ((height -= 16) >= 0) {
- img->copy(img, src);
- src[0] += 16 * stride;
- src[1] += 4 * stride;
- src[2] += 4 * stride;
- }
+ int height = img->height;
+ uint8_t *src[3];
+
+ src[0] = img->base[0];
+ src[1] = img->base[1];
+ src[2] = img->base[2];
+
+ while ((height -= 16) >= 0) {
+ img->copy(img, src);
+ src[0] += 16 * img->pitches[0];
+ src[1] += 8 * img->pitches[1];
+ src[2] += 8 * img->pitches[2];
+ }
}
*/
diff --git a/src/libxinevdec/msrle.c b/src/libxinevdec/msrle.c
index 1c9f7ae76..9c6ea3940 100644
--- a/src/libxinevdec/msrle.c
+++ b/src/libxinevdec/msrle.c
@@ -21,7 +21,7 @@
* For more information on the MS RLE format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: msrle.c,v 1.1 2002/07/15 00:56:12 tmmm Exp $
+ * $Id: msrle.c,v 1.2 2002/07/15 21:42:34 esnel Exp $
*/
#include <stdio.h>
@@ -266,26 +266,19 @@ static void msrle_decode_data (video_decoder_t *this_gen,
img->bad_frame = 0;
decode_msrle8(this);
- yuv444_to_yuy2(&this->yuv_planes, img->base[0]);
+ yuv444_to_yuy2(&this->yuv_planes, img->base[0], img->pitches[0]);
-/*
if (img->copy) {
+ int height = img->height;
+ uint8_t *src[3];
- int height = abs(this->biHeight);
- int stride = this->biWidth;
- uint8_t* src[3];
-
- src[0] = img->base[0];
- src[1] = img->base[1];
- src[2] = img->base[2];
- while ((height -= 16) >= 0) {
- img->copy(img, src);
- src[0] += 16 * stride;
- src[1] += 4 * stride;
- src[2] += 4 * stride;
- }
+ src[0] = img->base[0];
+
+ while ((height -= 16) >= 0) {
+ img->copy(img, src);
+ src[0] += 16 * img->pitches[0];
+ }
}
-*/
img->draw(img);
img->free(img);
diff --git a/src/libxinevdec/msvc.c b/src/libxinevdec/msvc.c
index d14d34329..983d64f32 100644
--- a/src/libxinevdec/msvc.c
+++ b/src/libxinevdec/msvc.c
@@ -22,7 +22,7 @@
* based on overview of Microsoft Video-1 algorithm
* by Mike Melanson: http://www.pcisys.net/~melanson/codecs/video1.txt
*
- * $Id: msvc.c,v 1.7 2002/07/05 17:32:04 mroi Exp $
+ * $Id: msvc.c,v 1.8 2002/07/15 21:42:34 esnel Exp $
*/
#include <stdlib.h>
@@ -239,13 +239,6 @@ static void msvc_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
free (this->img_buffer);
this->img_buffer = malloc((this->biWidth * this->biHeight) << 1);
- /* FIXME: Palette not loaded */
-#if 0
- for (i=0; i < 256; i++) {
- rgb_to_yuy2 (32, le2me_32 (rgb[i]), &this->color_table[i]);
- }
-#endif
-
if (this->buf)
free (this->buf);
this->bufsize = VIDEOBUFSIZE;
@@ -284,18 +277,30 @@ static void msvc_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
img->pts = buf->pts;
img->bad_frame = 0;
- xine_fast_memcpy (img->base[0], this->img_buffer, (n << 1));
+ if (2*this->biWidth == img->pitches[0]) {
+ xine_fast_memcpy (img->base[0], this->img_buffer, img->pitches[0]*this->biHeight);
+ } else {
+ uint8_t *src, *dst;
+
+ src = (uint8_t *) this->img_buffer;
+ dst = img->base[0];
+
+ for (i=0; i < this->biHeight; i++) {
+ xine_fast_memcpy (dst, src, 2*this->biWidth);
+ src += 2*this->biWidth;
+ dst += img->pitches[0];
+ }
+ }
if (img->copy) {
- int height = abs(this->biHeight);
- int stride = this->biWidth;
- uint8_t* src[3];
+ int height = img->height;
+ uint8_t *src[3];
src[0] = img->base[0];
while ((height -= 16) >= 0) {
img->copy(img, src);
- src[0] += 32 * stride;
+ src[0] += 16 * img->pitches[0];
}
}
diff --git a/src/libxinevdec/rgb.c b/src/libxinevdec/rgb.c
index ebe1c7d35..bc88d44af 100644
--- a/src/libxinevdec/rgb.c
+++ b/src/libxinevdec/rgb.c
@@ -21,7 +21,7 @@
* Actually, this decoder just converts a raw RGB image to a YUY2 map
* suitable for display under xine.
*
- * $Id: rgb.c,v 1.1 2002/07/15 00:56:12 tmmm Exp $
+ * $Id: rgb.c,v 1.2 2002/07/15 21:42:34 esnel Exp $
*/
#include <stdio.h>
@@ -219,26 +219,19 @@ static void rgb_decode_data (video_decoder_t *this_gen,
this->yuv_planes.v[row_ptr + pixel_ptr - 2];
}
- yuv444_to_yuy2(&this->yuv_planes, img->base[0]);
+ yuv444_to_yuy2(&this->yuv_planes, img->base[0], img->pitches[0]);
-/*
if (img->copy) {
+ int height = img->height;
+ uint8_t *src[3];
- int height = abs(this->biHeight);
- int stride = this->biWidth;
- uint8_t* src[3];
-
- src[0] = img->base[0];
- src[1] = img->base[1];
- src[2] = img->base[2];
- while ((height -= 16) >= 0) {
- img->copy(img, src);
- src[0] += 16 * stride;
- src[1] += 4 * stride;
- src[2] += 4 * stride;
- }
+ src[0] = img->base[0];
+
+ while ((height -= 16) >= 0) {
+ img->copy(img, src);
+ src[0] += 16 * img->pitches[0];
+ }
}
-*/
img->draw(img);
img->free(img);
diff --git a/src/libxinevdec/roqvideo.c b/src/libxinevdec/roqvideo.c
index b2284d38c..bcee1a2b7 100644
--- a/src/libxinevdec/roqvideo.c
+++ b/src/libxinevdec/roqvideo.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: roqvideo.c,v 1.5 2002/07/05 17:32:04 mroi Exp $
+ * $Id: roqvideo.c,v 1.6 2002/07/15 21:42:34 esnel Exp $
*/
/* And this is the header that came with the RoQ video decoder: */
@@ -361,6 +361,7 @@ static void roq_decode_frame(roq_decoder_t *ri, vo_frame_t *img) {
memcpy(ri->v[1], ri->v[0], (ri->width * ri->height)/4);
/* copy the planes to the output planes */
+ /* FIXME: use img->pitches[3] */
memcpy(img->base[0], ri->y[0], ri->width * ri->height);
memcpy(img->base[1], ri->u[0], (ri->width * ri->height)/4);
memcpy(img->base[2], ri->v[0], (ri->width * ri->height)/4);
@@ -434,20 +435,20 @@ static void roq_decode_data (video_decoder_t *this_gen,
img->duration = this->video_step;
roq_decode_frame(this, img);
-
+
if (img->copy) {
int height = img->height;
- int stride = img->width;
- uint8_t* src[3];
+ uint8_t *src[3];
src[0] = img->base[0];
src[1] = img->base[1];
src[2] = img->base[2];
+
while ((height -= 16) >= 0) {
- img->copy(img, src);
- src[0] += 16 * stride;
- src[1] += 4 * stride;
- src[2] += 4 * stride;
+ img->copy(img, src);
+ src[0] += 16 * img->pitches[0];
+ src[1] += 8 * img->pitches[1];
+ src[2] += 8 * img->pitches[2];
}
}
diff --git a/src/libxinevdec/svq1.c b/src/libxinevdec/svq1.c
index 0d191f611..6441ed6e3 100644
--- a/src/libxinevdec/svq1.c
+++ b/src/libxinevdec/svq1.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: svq1.c,v 1.3 2002/07/15 19:44:53 miguelfreitas Exp $
+ * $Id: svq1.c,v 1.4 2002/07/15 21:42:34 esnel Exp $
*/
#include <stdio.h>
@@ -1317,7 +1317,7 @@ static void vscale_chroma_line (uint8_t *dst, int pitch, uint8_t *src1, uint8_t
}
}
-static void svq1_copy_frame (svq1_t *svq1, uint8_t *base[3], int pitch) {
+static void svq1_copy_frame (svq1_t *svq1, uint8_t *base[3], int pitches[3]) {
uint8_t *src;
uint8_t *dst;
uint8_t *cr1, *cr2, *tmp;
@@ -1329,14 +1329,14 @@ static void svq1_copy_frame (svq1_t *svq1, uint8_t *base[3], int pitch) {
for (y=0; y < svq1->height; y++) {
memcpy (dst, src, svq1->width);
src += svq1->luma_width;
- dst += pitch;
+ dst += pitches[0];
}
for (i=1; i < 3; i++) {
src = svq1->base[i];
dst = base[i];
- cr1 = &dst[(pitch / 2) * ((svq1->height / 2) - 1)];
- cr2 = &dst[(pitch / 2) * ((svq1->height / 2) - 2)];
+ cr1 = &dst[pitches[i] * ((svq1->height / 2) - 1)];
+ cr2 = &dst[pitches[i] * ((svq1->height / 2) - 2)];
/* horizontally upscale first line */
hscale_chroma_line (cr1, src, (svq1->width / 4));
@@ -1344,15 +1344,15 @@ static void svq1_copy_frame (svq1_t *svq1, uint8_t *base[3], int pitch) {
/* store first line */
memcpy (dst, cr1, (svq1->width / 2));
- dst += (pitch / 2);
+ dst += pitches[i];
for (y=0; y < (svq1->height / 4) - 1; y++) {
hscale_chroma_line (cr2, src, (svq1->width / 4));
src += svq1->chroma_width;
/* interpolate and store two lines */
- vscale_chroma_line (dst, (pitch / 2), cr1, cr2, (svq1->width / 2));
- dst += pitch;
+ vscale_chroma_line (dst, pitches[i], cr1, cr2, (svq1->width / 2));
+ dst += pitches[i];
/* swap buffers */
tmp = cr2;
@@ -1429,12 +1429,11 @@ static void svq1dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
img->bad_frame = (result != 0);
if (result == 0) {
- svq1_copy_frame (this->svq1, img->base, img->width);
+ svq1_copy_frame (this->svq1, img->base, img->pitches);
}
if (img->copy) {
int height = img->height;
- int stride = img->width;
uint8_t *src[3];
src[0] = img->base[0];
@@ -1443,9 +1442,9 @@ static void svq1dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
while ((height -= 16) >= 0) {
img->copy(img, src);
- src[0] += 16 * stride;
- src[1] += 4 * stride;
- src[2] += 4 * stride;
+ src[0] += 16 * img->pitches[0];
+ src[1] += 8 * img->pitches[1];
+ src[2] += 8 * img->pitches[2];
}
}
diff --git a/src/libxinevdec/yuv.c b/src/libxinevdec/yuv.c
index 70a383adf..05eba1207 100644
--- a/src/libxinevdec/yuv.c
+++ b/src/libxinevdec/yuv.c
@@ -21,7 +21,7 @@
* Actually, this decoder just reorganizes chunks of raw YUV data in such
* a way that xine can display them.
*
- * $Id: yuv.c,v 1.1 2002/07/15 00:56:12 tmmm Exp $
+ * $Id: yuv.c,v 1.2 2002/07/15 21:42:34 esnel Exp $
*/
#include <stdio.h>
@@ -196,24 +196,21 @@ static void yuv_decode_data (video_decoder_t *this_gen,
img->pts = buf->pts;
img->bad_frame = 0;
-/*
if (img->copy) {
-
- int height = abs(this->biHeight);
- int stride = this->biWidth;
- uint8_t* src[3];
-
- src[0] = img->base[0];
- src[1] = img->base[1];
- src[2] = img->base[2];
- while ((height -= 16) >= 0) {
- img->copy(img, src);
- src[0] += 16 * stride;
- src[1] += 4 * stride;
- src[2] += 4 * stride;
- }
+ int height = img->height;
+ uint8_t *src[3];
+
+ src[0] = img->base[0];
+ src[1] = img->base[1];
+ src[2] = img->base[2];
+
+ while ((height -= 16) >= 0) {
+ img->copy(img, src);
+ src[0] += 16 * img->pitches[0];
+ src[1] += 8 * img->pitches[1];
+ src[2] += 8 * img->pitches[2];
+ }
}
-*/
img->draw(img);
img->free(img);