From 76e9bd86be57306fbf3bf607d68f9f38c04b4691 Mon Sep 17 00:00:00 2001 From: Ewald Snel Date: Mon, 15 Jul 2002 21:42:33 +0000 Subject: Add 'pitch' support to video decoders (pitch != width) CVS patchset: 2282 CVS date: 2002/07/15 21:42:33 --- src/libdivx4/xine_decoder.c | 36 +++++++++++++++++++----------------- src/libffmpeg/xine_decoder.c | 23 +++++++++++------------ src/libw32dll/w32codec.c | 13 ++++++------- src/libxinevdec/cinepak.c | 35 +++++++++++++++++------------------ src/libxinevdec/cyuv.c | 14 +++++++++++++- src/libxinevdec/fli.c | 27 ++++++++++----------------- src/libxinevdec/foovideo.c | 29 ++++++++++++++--------------- src/libxinevdec/msrle.c | 27 ++++++++++----------------- src/libxinevdec/msvc.c | 31 ++++++++++++++++++------------- src/libxinevdec/rgb.c | 27 ++++++++++----------------- src/libxinevdec/roqvideo.c | 17 +++++++++-------- src/libxinevdec/svq1.c | 25 ++++++++++++------------- src/libxinevdec/yuv.c | 31 ++++++++++++++----------------- src/video_out/video_out_aa.c | 18 +++++++++--------- src/video_out/video_out_directfb.c | 6 +++++- src/video_out/video_out_fb.c | 24 +++++++++++++----------- src/video_out/video_out_opengl.c | 14 +++++++++----- src/video_out/video_out_sdl.c | 5 ++++- src/video_out/video_out_syncfb.c | 14 +++++++++----- src/video_out/video_out_vidix.c | 15 +++++++++------ src/video_out/video_out_xshm.c | 24 +++++++++++++----------- src/video_out/video_out_xv.c | 5 ++++- src/xine-engine/video_out.c | 20 +++++++++----------- src/xine-engine/video_out.h | 3 ++- src/xine-utils/color.c | 17 +++++++++++++---- src/xine-utils/xineutils.h | 4 ++-- 26 files changed, 264 insertions(+), 240 deletions(-) (limited to 'src') diff --git a/src/libdivx4/xine_decoder.c b/src/libdivx4/xine_decoder.c index 90ea0e494..167a0a34b 100644 --- a/src/libdivx4/xine_decoder.c +++ b/src/libdivx4/xine_decoder.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_decoder.c,v 1.39 2002/07/05 17:32:02 mroi Exp $ + * $Id: xine_decoder.c,v 1.40 2002/07/15 21:42:33 esnel Exp $ * * xine decoder plugin using divx4 * @@ -291,15 +291,15 @@ static inline void divx4_copy_frame(divx4_decoder_t *this, vo_frame_t *img, /* copy y data; use shortcut if stride_y equals width */ src_offset = 0; dst_offset = 0; - if (pict.stride_y == img->width) { - xine_fast_memcpy(img->base[0]+dst_offset, pict.y, this->bih.biWidth*this->bih.biHeight); - dst_offset += this->bih.biWidth * this->bih.biHeight; + if (pict.stride_y == img->pitches[0]) { + xine_fast_memcpy(img->base[0]+dst_offset, pict.y, img->pitches[0]*this->bih.biHeight); + dst_offset += img->pitches[0] * this->bih.biHeight; } else { /* copy line by line */ for (i=0; ibih.biHeight; i++) { xine_fast_memcpy(img->base[0]+dst_offset, pict.y+src_offset, this->bih.biWidth); src_offset += pict.stride_y; - dst_offset += this->bih.biWidth; + dst_offset += img->pitches[0]; } } @@ -310,17 +310,19 @@ static inline void divx4_copy_frame(divx4_decoder_t *this, vo_frame_t *img, /* copy u and v data */ src_offset = 0; dst_offset = 0; - if (pict.stride_uv == img->width>>1) { - xine_fast_memcpy(img->base[1]+dst_offset, pict.u, (this->bih.biWidth*this->bih.biHeight)/4); - xine_fast_memcpy(img->base[2]+dst_offset, pict.v, (this->bih.biWidth*this->bih.biHeight)/4); + if (pict.stride_uv == img->pitches[1] && pict.stride_uv == img->pitches[2]) { + xine_fast_memcpy(img->base[1]+dst_offset, pict.u, (img->pitches[1]*this->bih.biHeight)/4); + xine_fast_memcpy(img->base[2]+dst_offset, pict.v, (img->pitches[2]*this->bih.biHeight)/4); dst_offset += (this->bih.biWidth*this->bih.biHeight)/4; } else { + int dst_offset_v = 0; for (i=0; ibih.biHeight>>1; i++) { xine_fast_memcpy(img->base[1]+dst_offset, pict.u+src_offset, this->bih.biWidth/2); - xine_fast_memcpy(img->base[2]+dst_offset, pict.v+src_offset, this->bih.biWidth/2); + xine_fast_memcpy(img->base[2]+dst_offset_v, pict.v+src_offset, this->bih.biWidth/2); src_offset += pict.stride_uv; - dst_offset += this->bih.biWidth/2; + dst_offset += img->pitches[1]; + dst_offset_v += img->pitches[2]; } } @@ -328,18 +330,18 @@ static inline void divx4_copy_frame(divx4_decoder_t *this, vo_frame_t *img, with slices of 16 lines. Too bad we can't set the y,u and v stride values (because then we wouldn't need the first copy) */ if (img->copy && img->bad_frame == 0) { - int height = this->bih.biHeight; - int stride = this->bih.biWidth; - uint8_t* src[3]; - + 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 * 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/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index e53823f4c..00445dcf8 100644 --- a/src/libffmpeg/xine_decoder.c +++ b/src/libffmpeg/xine_decoder.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_decoder.c,v 1.48 2002/07/15 19:43:16 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.49 2002/07/15 21:42:33 esnel Exp $ * * xine decoder plugin using ffmpeg * @@ -275,7 +275,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { xine_fast_memcpy (dy, sy, this->bih.biWidth); - dy += this->bih.biWidth; + dy += img->pitches[0]; sy += this->av_picture.linesize[0]; } @@ -310,8 +310,8 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } - du += this->bih.biWidth/2; - dv += this->bih.biWidth/2; + du += img->pitches[1]; + dv += img->pitches[2]; if (this->context.pix_fmt != PIX_FMT_YUV420P) { su += 2*this->av_picture.linesize[1]; @@ -323,19 +323,18 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } if (img->copy) { - - int height = abs(this->bih.biHeight); - int stride = this->bih.biWidth; - uint8_t* src[3]; - + 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 * 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/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index df54f12da..8f157d693 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.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: w32codec.c,v 1.87 2002/07/10 05:44:09 pmhahn Exp $ + * $Id: w32codec.c,v 1.88 2002/07/15 21:42:33 esnel Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -779,7 +779,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { uint16_t *pixel, *out; pixel = (uint16_t *) ( (uint8_t *)this->img_buffer + 2 * row * this->o_bih.biWidth ); - out = (uint16_t *) (img->base[0] + 2 * row * this->o_bih.biWidth ); + out = (uint16_t *) (img->base[0] + row * img->pitches[0] ); for (col=0; colo_bih.biWidth; col++, pixel++, out++) { @@ -838,14 +838,13 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (img->copy && !this->skipframes) { int height = abs(this->o_bih.biHeight); - int stride = this->o_bih.biWidth; - uint8_t* src[3]; - + 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/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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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); diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index 92e3d87d6..48e168e38 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.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_aa.c,v 1.21 2002/07/12 20:19:20 f1rmb Exp $ + * $Id: video_out_aa.c,v 1.22 2002/07/15 21:42:34 esnel Exp $ * * video_out_aa.c, ascii-art output plugin for xine * @@ -128,8 +128,6 @@ static void aa_update_frame_format (vo_driver_t *this, vo_frame_t *img, uint32_t width, uint32_t height, int ratio_code, int format, int flags) { - int image_size; - aa_frame_t *frame = (aa_frame_t *) img; /* printf ("aa_update_format...\n"); */ @@ -157,16 +155,18 @@ static void aa_update_frame_format (vo_driver_t *this, vo_frame_t *img, if (format == IMGFMT_YV12) { - image_size = width * height; - frame->vo_frame.base[0] = malloc_aligned(16,image_size, (void**) &frame->mem[0]); - frame->vo_frame.base[1] = malloc_aligned(16,image_size/4, (void**) &frame->mem[1]); - frame->vo_frame.base[2] = malloc_aligned(16,image_size/4, (void**) &frame->mem[2]); + frame->vo_frame.pitches[0] = 8*((width + 7) / 8); + frame->vo_frame.pitches[1] = 8*((width + 15) / 16); + frame->vo_frame.pitches[2] = 8*((width + 15) / 16); + frame->vo_frame.base[0] = malloc_aligned(16, frame->vo_frame.pitches[0] * height, (void**) &frame->mem[0]); + frame->vo_frame.base[1] = malloc_aligned(16, frame->vo_frame.pitches[1] * ((height+1)/2), (void**) &frame->mem[1]); + frame->vo_frame.base[2] = malloc_aligned(16, frame->vo_frame.pitches[2] * ((height+1)/2), (void**) &frame->mem[2]); /* printf ("allocated yuv memory for %d x %d image\n", width, height); */ } else if (format == IMGFMT_YUY2) { - image_size = width * 2 * height; - frame->vo_frame.base[0] = malloc_aligned(16,image_size, (void**) &frame->mem[0]); + frame->vo_frame.pitches[0] = 8*((width + 3) / 4); + frame->vo_frame.base[0] = malloc_aligned(16, frame->vo_frame.pitches[0] * height, (void**) &frame->mem[0]); } else { printf ("alert! unsupported image format %04x\n", format); abort(); diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index 4dba74ab6..56e9951b2 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.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_directfb.c,v 1.9 2002/06/12 12:22:38 f1rmb Exp $ + * $Id: video_out_directfb.c,v 1.10 2002/07/15 21:42:34 esnel Exp $ * * DirectFB based output plugin. * Rich Wareham @@ -303,11 +303,15 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, frame->locked = 1; switch(frame->format) { case IMGFMT_YV12: + frame->vo_frame.pitches[0] = pitch; + frame->vo_frame.pitches[1] = pitch/2; + frame->vo_frame.pitches[2] = pitch/2; frame->vo_frame.base[0] = data; frame->vo_frame.base[1] = data + pitch*height; frame->vo_frame.base[2] = data + pitch*height + pitch*height/4; break; case IMGFMT_YUY2: + frame->vo_frame.pitches[0] = 2*pitch; frame->vo_frame.base[0] = data; frame->vo_frame.base[1] = data; frame->vo_frame.base[2] = data; diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 3f407a401..fb37f295d 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.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_fb.c,v 1.12 2002/07/10 14:04:41 mroi Exp $ + * $Id: video_out_fb.c,v 1.13 2002/07/15 21:42:34 esnel Exp $ * * video_out_fb.c, frame buffer xine driver by Miguel Freitas * @@ -409,16 +409,18 @@ static void fb_update_frame_format (vo_driver_t *this_gen, this->bytes_per_pixel ); if (format == IMGFMT_YV12) { - int image_size = frame->width * frame->height; - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, image_size, + frame->vo_frame.pitches[0] = 8*((width + 7) / 8); + frame->vo_frame.pitches[1] = 8*((width + 15) / 16); + frame->vo_frame.pitches[2] = 8*((width + 15) / 16); + frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **)&frame->chunk[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned (16, image_size/4, + frame->vo_frame.base[1] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[1] * ((height+1)/2), (void **)&frame->chunk[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned (16, image_size/4, + frame->vo_frame.base[2] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[2] * ((height+1)/2), (void **)&frame->chunk[2]); } else { - int image_size = frame->width * frame->height; - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, image_size*2, + frame->vo_frame.pitches[0] = 8*((width + 3) / 4); + frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **)&frame->chunk[0]); frame->chunk[1] = NULL; frame->chunk[2] = NULL; @@ -441,8 +443,8 @@ static void fb_update_frame_format (vo_driver_t *this_gen, frame->yuv2rgb->configure (frame->yuv2rgb, frame->width, 16, - frame->width*2, - frame->width, + 2*frame->vo_frame.pitches[0], + 2*frame->vo_frame.pitches[1], frame->output_width, frame->stripe_height, frame->bytes_per_line*2); @@ -452,8 +454,8 @@ static void fb_update_frame_format (vo_driver_t *this_gen, frame->yuv2rgb->configure (frame->yuv2rgb, frame->width, 16, - frame->width, - frame->width/2, + frame->vo_frame.pitches[0], + frame->vo_frame.pitches[1], frame->output_width, frame->stripe_height, frame->bytes_per_line); diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index b7d376fbc..93d7c39d3 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.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_opengl.c,v 1.13 2002/07/10 14:04:41 mroi Exp $ + * $Id: video_out_opengl.c,v 1.14 2002/07/15 21:42:34 esnel Exp $ * * video_out_glut.c, glut based OpenGL rendering interface for xine * Matthias Hopf @@ -358,15 +358,19 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, switch (format) { case IMGFMT_YV12: - frame->vo_frame.base[0] = my_malloc_aligned(16,image_size, + frame->vo_frame.pitches[0] = 8*((width + 7) / 8); + frame->vo_frame.pitches[1] = 8*((width + 15) / 16); + frame->vo_frame.pitches[2] = 8*((width + 15) / 16); + frame->vo_frame.base[0] = my_malloc_aligned(16, frame->vo_frame.pitches[0] * height, &frame->chunk[0]); - frame->vo_frame.base[1] = my_malloc_aligned(16,image_size/4, + frame->vo_frame.base[1] = my_malloc_aligned(16, frame->vo_frame.pitches[1] * ((height+1)/2), &frame->chunk[1]); - frame->vo_frame.base[2] = my_malloc_aligned(16,image_size/4, + frame->vo_frame.base[2] = my_malloc_aligned(16, frame->vo_frame.pitches[2] * ((height+1)/2), &frame->chunk[2]); break; case IMGFMT_YUY2: - frame->vo_frame.base[0] = my_malloc_aligned(16,image_size*2, + frame->vo_frame.pitches[0] = 8*((width + 3) / 4); + frame->vo_frame.base[0] = my_malloc_aligned(16, frame->vo_frame.pitches[0] * height, &frame->chunk[0]); break; default: diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index 6123190e1..0ef1508a6 100644 --- a/src/video_out/video_out_sdl.c +++ b/src/video_out/video_out_sdl.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_sdl.c,v 1.9 2002/07/10 14:04:41 mroi Exp $ + * $Id: video_out_sdl.c,v 1.10 2002/07/15 21:42:34 esnel Exp $ * * video_out_sdl.c, Simple DirectMedia Layer * @@ -345,6 +345,9 @@ static void sdl_update_frame_format (vo_driver_t *this_gen, if (frame->overlay == NULL) return; + frame->vo_frame.pitches[0] = frame->overlay->pitches[0]; + frame->vo_frame.pitches[1] = frame->overlay->pitches[2]; + frame->vo_frame.pitches[2] = frame->overlay->pitches[1]; frame->vo_frame.base[0] = frame->overlay->pixels[0]; frame->vo_frame.base[1] = frame->overlay->pixels[2]; frame->vo_frame.base[2] = frame->overlay->pixels[1]; diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 2ab83e291..8fcb91e41 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.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_syncfb.c,v 1.72 2002/07/10 14:04:41 mroi Exp $ + * $Id: video_out_syncfb.c,v 1.73 2002/07/15 21:42:34 esnel Exp $ * * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine * @@ -682,13 +682,17 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, /* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame_size, (void **)&frame->data_mem[0]); frame->vo_frame.base[1] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[1]); frame->vo_frame.base[2] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[2]);*/ - frame->vo_frame.base[0] = malloc(frame_size); - frame->vo_frame.base[1] = malloc(frame_size/4); - frame->vo_frame.base[2] = malloc(frame_size/4); + frame->vo_frame.pitches[0] = 8*((width + 7) / 8); + frame->vo_frame.pitches[1] = 8*((width + 15) / 16); + frame->vo_frame.pitches[2] = 8*((width + 15) / 16); + frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[1] = malloc(frame->vo_frame.pitches[1] * ((height+1)/2)); + frame->vo_frame.base[2] = malloc(frame->vo_frame.pitches[2] * ((height+1)/2)); break; case IMGFMT_YUY2: /* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, (frame_size*2), (void **)&frame->data_mem[0]);*/ - frame->vo_frame.base[0] = malloc(frame_size*2); + frame->vo_frame.pitches[0] = 8*((width + 3) / 4); + frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height); frame->vo_frame.base[1] = NULL; frame->vo_frame.base[2] = NULL; break; diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 9f7ff09cd..92e29bd7c 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.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_vidix.c,v 1.6 2002/07/12 20:36:04 f1rmb Exp $ + * $Id: video_out_vidix.c,v 1.7 2002/07/15 21:42:34 esnel Exp $ * * video_out_vidix.c * @@ -558,7 +558,6 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, int ratio_code, int format, int flags) { vidix_frame_t *frame = (vidix_frame_t *) frame_gen; - uint32_t frame_size = width*height; if ((frame->width != width) || (frame->height != height) @@ -576,12 +575,16 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, switch(format) { case IMGFMT_YV12: - frame->vo_frame.base[0] = malloc(frame_size); - frame->vo_frame.base[1] = malloc(frame_size/4); - frame->vo_frame.base[2] = malloc(frame_size/4); + frame->vo_frame.pitches[0] = 8*((width + 7) / 8); + frame->vo_frame.pitches[1] = 8*((width + 15) / 16); + frame->vo_frame.pitches[2] = 8*((width + 15) / 16); + frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[1] = malloc(frame->vo_frame.pitches[1] * ((height+1)/2)); + frame->vo_frame.base[2] = malloc(frame->vo_frame.pitches[2] * ((height+1)/2)); break; case IMGFMT_YUY2: - frame->vo_frame.base[0] = malloc(frame_size*2); + frame->vo_frame.pitches[0] = 8*((width + 3) / 4); + frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height); frame->vo_frame.base[1] = NULL; frame->vo_frame.base[2] = NULL; break; diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index c7fd72542..2ab6d8055 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.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_xshm.c,v 1.78 2002/07/10 14:04:42 mroi Exp $ + * $Id: video_out_xshm.c,v 1.79 2002/07/15 21:42:34 esnel Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -670,13 +670,15 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, XUnlockDisplay (this->display); if (format == IMGFMT_YV12) { - int image_size = frame->width * frame->height; - frame->vo_frame.base[0] = my_malloc_aligned (16, image_size, &frame->chunk[0]); - frame->vo_frame.base[1] = my_malloc_aligned (16, image_size/4, &frame->chunk[1]); - frame->vo_frame.base[2] = my_malloc_aligned (16, image_size/4, &frame->chunk[2]); + frame->vo_frame.pitches[0] = 8*((width + 7) / 8); + frame->vo_frame.pitches[1] = 8*((width + 15) / 16); + frame->vo_frame.pitches[2] = 8*((width + 15) / 16); + frame->vo_frame.base[0] = my_malloc_aligned (16, frame->vo_frame.pitches[0] * height, &frame->chunk[0]); + frame->vo_frame.base[1] = my_malloc_aligned (16, frame->vo_frame.pitches[1] * ((height+1)/2), &frame->chunk[1]); + frame->vo_frame.base[2] = my_malloc_aligned (16, frame->vo_frame.pitches[2] * ((height+1)/2), &frame->chunk[2]); } else { - int image_size = frame->width * frame->height; - frame->vo_frame.base[0] = my_malloc_aligned (16, image_size*2, &frame->chunk[0]); + frame->vo_frame.pitches[0] = 8*((width + 3) / 4); + frame->vo_frame.base[0] = my_malloc_aligned (16, frame->vo_frame.pitches[0] * height, &frame->chunk[0]); frame->chunk[1] = NULL; frame->chunk[2] = NULL; } @@ -695,8 +697,8 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->yuv2rgb->configure (frame->yuv2rgb, frame->width, 16, - frame->width*2, - frame->width, + 2*frame->vo_frame.pitches[0], + 2*frame->vo_frame.pitches[1], frame->output_width, frame->stripe_height, frame->image->bytes_per_line*2); @@ -706,8 +708,8 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->yuv2rgb->configure (frame->yuv2rgb, frame->width, 16, - frame->width, - frame->width/2, + frame->vo_frame.pitches[0], + frame->vo_frame.pitches[1], frame->output_width, frame->stripe_height, frame->image->bytes_per_line); diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index ad685093f..c6a4e3a82 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.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_xv.c,v 1.122 2002/07/10 14:04:42 mroi Exp $ + * $Id: video_out_xv.c,v 1.123 2002/07/15 21:42:34 esnel Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -463,6 +463,9 @@ static void xv_update_frame_format (vo_driver_t *this_gen, 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]; diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 382bea56d..f1f4261f7 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.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.c,v 1.99 2002/05/22 18:55:11 miguelfreitas Exp $ + * $Id: video_out.c,v 1.100 2002/07/15 21:42:34 esnel Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -662,7 +662,7 @@ static vo_frame_t * vo_duplicate_frame( vo_instance_t *this_gen, vo_frame_t *img dupl = vo_get_frame (this_gen, img->width, img->height, img->ratio, img->format, VO_BOTH_FIELDS ); - image_size = img->width * img->height; + image_size = img->pitches[0] * img->height; if (img->format == IMGFMT_YV12) { /* The dxr3 video out plugin does not allocate memory for the dxr3 @@ -670,12 +670,12 @@ static vo_frame_t * vo_duplicate_frame( vo_instance_t *this_gen, vo_frame_t *img if (img->base[0]) xine_fast_memcpy(dupl->base[0], img->base[0], image_size); if (img->base[1]) - xine_fast_memcpy(dupl->base[1], img->base[1], image_size >> 2); + xine_fast_memcpy(dupl->base[1], img->base[1], img->pitches[1] * ((img->height+1)/2)); if (img->base[2]) - xine_fast_memcpy(dupl->base[2], img->base[2], image_size >> 2); + xine_fast_memcpy(dupl->base[2], img->base[2], img->pitches[2] * ((img->height+1)/2)); } else { if (img->base[0]) - xine_fast_memcpy(dupl->base[0], img->base[0], image_size * 2); + xine_fast_memcpy(dupl->base[0], img->base[0], image_size); } dupl->bad_frame = 0; @@ -688,7 +688,6 @@ static vo_frame_t * vo_duplicate_frame( vo_instance_t *this_gen, vo_frame_t *img if (img->format == IMGFMT_YV12) { if (img->copy) { int height = img->height; - int stride = img->width; uint8_t* src[3]; src[0] = dupl->base[0]; @@ -696,22 +695,21 @@ static vo_frame_t * vo_duplicate_frame( vo_instance_t *this_gen, vo_frame_t *img src[2] = dupl->base[2]; while ((height -= 16) >= 0) { dupl->copy(dupl, 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]; } } } else { if (img->copy) { int height = img->height; - int stride = img->width; uint8_t* src[3]; src[0] = dupl->base[0]; while ((height -= 16) >= 0) { dupl->copy(dupl, src); - src[0] += 32 * stride; + src[0] += 16 * img->pitches[0]; } } } diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index a83e25d92..13a8df7f5 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -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.h,v 1.54 2002/07/08 19:52:01 mroi Exp $ + * $Id: video_out.h,v 1.55 2002/07/15 21:42:34 esnel Exp $ * * * xine version of video_out.h @@ -81,6 +81,7 @@ struct vo_frame_s { /* yv12 (planar) base[0]: y, base[1]: u, base[2]: v */ /* yuy2 (interleaved) base[0]: yuyv..., base[1]: --, base[2]: -- */ uint8_t *base[3]; + int pitches[3]; /* info that can be used for interlaced output (e.g. tv-out) */ int top_field_first; diff --git a/src/xine-utils/color.c b/src/xine-utils/color.c index 342cb4b95..eb7e0d616 100644 --- a/src/xine-utils/color.c +++ b/src/xine-utils/color.c @@ -70,7 +70,7 @@ * instructions), these macros will automatically map to those special * instructions. * - * $Id: color.c,v 1.3 2002/07/15 00:51:17 tmmm Exp $ + * $Id: color.c,v 1.4 2002/07/15 21:42:34 esnel Exp $ */ #include "xine_internal.h" @@ -140,7 +140,7 @@ int v_r_table[256]; int v_g_table[256]; int v_b_table[256]; -void (*yuv444_to_yuy2) (yuv_planes_t *yuv_planes, unsigned char *yuy2_map); +void (*yuv444_to_yuy2) (yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch); /* * init_yuv_planes @@ -191,7 +191,7 @@ void free_yuv_planes(yuv_planes_t *yuv_planes) { * * YUY2 map: Y0 U0 Y1 V1 Y2 U2 Y3 V3 */ -void yuv444_to_yuy2_c(yuv_planes_t *yuv_planes, unsigned char *yuy2_map) { +void yuv444_to_yuy2_c(yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch) { int row_ptr, pixel_ptr; int yuy2_index; @@ -203,6 +203,8 @@ void yuv444_to_yuy2_c(yuv_planes_t *yuv_planes, unsigned char *yuy2_map) { for (pixel_ptr = 0; pixel_ptr < yuv_planes->row_width; pixel_ptr++, yuy2_index += 2) yuy2_map[yuy2_index] = yuv_planes->y[row_ptr + pixel_ptr]; + + yuy2_index += (pitch - 2*yuv_planes->row_width); } /* copy the C samples */ @@ -218,6 +220,8 @@ void yuv444_to_yuy2_c(yuv_planes_t *yuv_planes, unsigned char *yuy2_map) { pixel_ptr++; yuy2_index += 2; } + + yuy2_index += (pitch - 2*yuv_planes->row_width); } } @@ -296,7 +300,7 @@ void yuv444_to_yuy2_c(yuv_planes_t *yuv_planes, unsigned char *yuy2_map) { * pad out the line. * */ -void yuv444_to_yuy2_mmx(yuv_planes_t *yuv_planes, unsigned char *yuy2_map) { +void yuv444_to_yuy2_mmx(yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch) { #ifdef ARCH_X86 int i, j, k; unsigned char *source_plane; @@ -349,6 +353,7 @@ void yuv444_to_yuy2_mmx(yuv_planes_t *yuv_planes, unsigned char *yuy2_map) { /* account for extra 2 samples */ source_plane += 2; + dest_plane += (pitch - 2*yuv_planes->row_width); } /* figure out the U samples */ @@ -410,6 +415,8 @@ void yuv444_to_yuy2_mmx(yuv_planes_t *yuv_planes, unsigned char *yuy2_map) { } } else source_plane += 2; + + dest_plane += (pitch - 2*yuv_planes->row_width); } /* figure out the V samples */ @@ -470,6 +477,8 @@ void yuv444_to_yuy2_mmx(yuv_planes_t *yuv_planes, unsigned char *yuy2_map) { } } else source_plane += 2; + + dest_plane += (pitch - 2*yuv_planes->row_width); } /* be a good MMX citizen and empty MMX state */ diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 985961a88..cb3a8139b 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -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: xineutils.h,v 1.17 2002/07/15 00:51:17 tmmm Exp $ + * $Id: xineutils.h,v 1.18 2002/07/15 21:42:34 esnel Exp $ * */ #ifndef XINEUTILS_H @@ -738,7 +738,7 @@ void init_yuv_planes(yuv_planes_t *yuv_planes, int width, int height); void free_yuv_planes(yuv_planes_t *yuv_planes); extern void (*yuv444_to_yuy2) - (yuv_planes_t *yuv_planes, unsigned char *yuy2_map); + (yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch); #define SCALEFACTOR 65536 #define CENTERSAMPLE 128 -- cgit v1.2.3