diff options
author | James Stembridge <jstembridge@users.sourceforge.net> | 2004-01-07 22:22:54 +0000 |
---|---|---|
committer | James Stembridge <jstembridge@users.sourceforge.net> | 2004-01-07 22:22:54 +0000 |
commit | 1797cb330ae3713163cd775104781bebceb6855c (patch) | |
tree | e51aeaac4cb1fbddfa5fe3ac39a5dd017372cd68 | |
parent | ffc98f0d9de67cb1447cbc5501ad2293d65d6d40 (diff) | |
download | xine-lib-1797cb330ae3713163cd775104781bebceb6855c.tar.gz xine-lib-1797cb330ae3713163cd775104781bebceb6855c.tar.bz2 |
use frame copying functions
CVS patchset: 6010
CVS date: 2004/01/07 22:22:54
-rw-r--r-- | src/libreal/xine_decoder.c | 46 | ||||
-rw-r--r-- | src/xine-engine/video_out.c | 29 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 30 |
3 files changed, 55 insertions, 50 deletions
diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 36238e05e..9a5befa36 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2003 the xine project + * Copyright (C) 2000-2004 the xine project * * This file is part of xine, a free video player. * @@ -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.57 2003/12/14 22:13:24 siggi Exp $ + * $Id: xine_decoder.c,v 1.58 2004/01/07 22:23:33 jstembridge Exp $ * * thin layer to use real binary-only codecs in xine * @@ -263,35 +263,6 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { return 1; } -static void realdec_copy_frame (realdec_decoder_t *this, uint8_t *base[3], int pitches[3]) { - unsigned int i, j; - uint8_t *src, *dst; - - src = this->frame_buffer; - dst = base[0]; - - for (i=0; i < this->height; ++i) { - memcpy (dst, src, this->width); - src += this->width; - dst += pitches[0]; - } - - for (i=1; i < 3; i++) { - src = this->frame_buffer + this->frame_size; - dst = base[i]; - - if (i == 2) { - src += this->frame_size / 4; - } - - for (j=0; j < (this->height / 2); ++j) { - memcpy (dst, src, (this->width / 2)); - src += this->width / 2; - dst += pitches[i]; - } - } -} - static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; @@ -403,7 +374,18 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) this->num_frames, this->duration); - realdec_copy_frame (this, img->base, img->pitches); + yv12_to_yv12( + /* Y */ + this->frame_buffer, this->width, + img->base[0], img->pitches[0], + /* U */ + this->frame_buffer + this->frame_size, this->width/2, + img->base[1], img->pitches[1], + /* V */ + this->frame_buffer + this->frame_size * 5/4, this->width/2, + img->base[2], img->pitches[2], + /* width x height */ + this->width, this->height); img->draw(img, this->stream); img->free(img); diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 594a8199a..c23ceb651 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.184 2004/01/07 19:52:43 mroi Exp $ + * $Id: video_out.c,v 1.185 2004/01/07 22:22:54 jstembridge Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -552,15 +552,26 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { image_size = img->pitches[0] * img->height; if (img->format == XINE_IMGFMT_YV12) { - 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], img->pitches[1] * ((img->height+1)/2)); - if (img->base[2]) - xine_fast_memcpy(dupl->base[2], img->base[2], img->pitches[2] * ((img->height+1)/2)); + yv12_to_yv12( + /* Y */ + img->base[0], img->pitches[0], + dupl->base[0], dupl->pitches[0], + /* U */ + img->base[1], img->pitches[1], + dupl->base[1], dupl->pitches[1], + /* V */ + img->base[2], img->pitches[2], + dupl->base[2], dupl->pitches[2], + /* width x height */ + img->width, img->height); } else { - if (img->base[0]) - xine_fast_memcpy(dupl->base[0], img->base[0], image_size); + yuy2_to_yuy2( + /* src */ + img->base[0], img->pitches[0], + /* dst */ + dupl->base[0], dupl->pitches[0], + /* width x height */ + img->width, img->height); } dupl->bad_frame = 0; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index fcc04cebd..281cb0ac0 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2003 the xine project + * Copyright (C) 2000-2004 the xine project * * This file is part of xine, a free video player. * @@ -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.c,v 1.279 2004/01/04 00:00:58 storri Exp $ + * $Id: xine.c,v 1.280 2004/01/07 22:22:54 jstembridge Exp $ */ /* @@ -1500,16 +1500,28 @@ int xine_get_current_frame (xine_stream_t *stream, int *width, int *height, switch (frame->format) { case XINE_IMGFMT_YV12: - memcpy (img, frame->base[0], frame->width*frame->height); - memcpy (img+frame->width*frame->height, frame->base[1], - frame->width*frame->height/4); - memcpy (img+frame->width*frame->height+frame->width*frame->height/4, - frame->base[2], - frame->width*frame->height/4); + yv12_to_yv12( + /* Y */ + frame->base[0], frame->pitches[0], + img, frame->width, + /* U */ + frame->base[1], frame->pitches[1], + img+frame->width*frame->height, frame->width/2, + /* V */ + frame->base[2], frame->pitches[2], + img+frame->width*frame->height+frame->width*frame->height/4, frame->width/2, + /* width x height */ + frame->width, frame->height); break; case XINE_IMGFMT_YUY2: - memcpy (img, frame->base[0], frame->width * frame->height * 2); + yuy2_to_yuy2( + /* src */ + frame->base[0], frame->pitches[0], + /* dst */ + img, frame->width*2, + /* width x height */ + frame->width, frame->height); break; default: |