summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Stembridge <jstembridge@users.sourceforge.net>2004-01-07 22:28:34 +0000
committerJames Stembridge <jstembridge@users.sourceforge.net>2004-01-07 22:28:34 +0000
commita35db98b34314ef95ef4cd1e21198db29f214c90 (patch)
treeb3835358ab1d2ea862bb9d0523d9b1ecee7c2f38 /src
parente52f5cce187ecfb8f252822cf313b7afc1fc8db9 (diff)
downloadxine-lib-a35db98b34314ef95ef4cd1e21198db29f214c90.tar.gz
xine-lib-a35db98b34314ef95ef4cd1e21198db29f214c90.tar.bz2
use frame copying functions
CVS patchset: 6012 CVS date: 2004/01/07 22:28:34
Diffstat (limited to 'src')
-rw-r--r--src/libxinevdec/yuv.c80
-rw-r--r--src/libxinevdec/yuv_frames.c21
2 files changed, 41 insertions, 60 deletions
diff --git a/src/libxinevdec/yuv.c b/src/libxinevdec/yuv.c
index 67fbd7201..aba87bdcf 100644
--- a/src/libxinevdec/yuv.c
+++ b/src/libxinevdec/yuv.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.
*
@@ -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.26 2003/12/14 22:13:25 siggi Exp $
+ * $Id: yuv.c,v 1.27 2004/01/07 22:28:34 jstembridge Exp $
*/
#include <stdio.h>
@@ -155,70 +155,42 @@ static void yuv_decode_data (video_decoder_t *this_gen,
if (buf->decoder_flags & BUF_FLAG_FRAME_END) {
if (buf->type == BUF_VIDEO_YV12) {
- int y;
- uint8_t *dy, *du, *dv, *sy, *su, *sv;
img = this->stream->video_out->get_frame (this->stream->video_out,
this->width, this->height,
this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS);
- /* FIXME: Write and use xine wide yv12 copy function */
- dy = img->base[0];
- du = img->base[1];
- dv = img->base[2];
- sy = this->buf;
- su = this->buf + (this->width * this->height * 5/4);
- sv = this->buf + (this->width * this->height);
-
- for (y=0; y<this->height; y++) {
- xine_fast_memcpy (dy, sy, this->width);
-
- dy += img->pitches[0];
- sy += this->width;
- }
-
- for (y=0; y<this->height/2; y++) {
- xine_fast_memcpy (du, su, this->width/2);
- xine_fast_memcpy (dv, sv, this->width/2);
-
- du += img->pitches[1];
- dv += img->pitches[2];
- su += this->width/2;
- sv += this->width/2;
- }
+ yv12_to_yv12(
+ /* Y */
+ this->buf, this->width,
+ img->base[0], img->pitches[0],
+ /* U */
+ this->buf + (this->width * this->height * 5/4), this->width/2,
+ img->base[1], img->pitches[1],
+ /* V */
+ this->buf + (this->width * this->height), this->width/2,
+ img->base[2], img->pitches[2],
+ /* width x height */
+ this->width, this->height);
} else if (buf->type == BUF_VIDEO_I420) {
- int y;
- uint8_t *dy, *du, *dv, *sy, *su, *sv;
img = this->stream->video_out->get_frame (this->stream->video_out,
this->width, this->height,
this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS);
- /* FIXME: Write and use xine wide yv12 copy function */
- dy = img->base[0];
- du = img->base[1];
- dv = img->base[2];
- sy = this->buf;
- su = this->buf + (this->width * this->height);
- sv = this->buf + (this->width * this->height * 5/4);
-
- for (y=0; y<this->height; y++) {
- xine_fast_memcpy (dy, sy, this->width);
-
- dy += img->pitches[0];
- sy += this->width;
- }
-
- for (y=0; y<this->height/2; y++) {
- xine_fast_memcpy (du, su, this->width/2);
- xine_fast_memcpy (dv, sv, this->width/2);
-
- du += img->pitches[1];
- dv += img->pitches[2];
- su += this->width/2;
- sv += this->width/2;
- }
+ yv12_to_yv12(
+ /* Y */
+ this->buf, this->width,
+ img->base[0], img->pitches[0],
+ /* U */
+ this->buf + (this->width * this->height), this->width/2,
+ img->base[1], img->pitches[1],
+ /* V */
+ this->buf + (this->width * this->height * 5/4), this->width/2,
+ img->base[2], img->pitches[2],
+ /* width x height */
+ this->width, this->height);
} else if (buf->type == BUF_VIDEO_YVU9) {
diff --git a/src/libxinevdec/yuv_frames.c b/src/libxinevdec/yuv_frames.c
index b8bcb6c22..d8b0d6a73 100644
--- a/src/libxinevdec/yuv_frames.c
+++ b/src/libxinevdec/yuv_frames.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003 the xine project
+ * Copyright (C) 2003-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: yuv_frames.c,v 1.9 2003/12/14 22:13:25 siggi Exp $
+ * $Id: yuv_frames.c,v 1.10 2004/01/07 22:28:36 jstembridge Exp $
*
* dummy video decoder for uncompressed video frames as delivered by v4l
*/
@@ -70,10 +70,19 @@ static void yuv_frames_decode_data (video_decoder_t *this_gen, buf_element_t *bu
frame_size = buf->decoder_info[0] * buf->decoder_info[1];
- xine_fast_memcpy (img->base[0], buf->content, frame_size);
- xine_fast_memcpy (img->base[1], buf->content+frame_size, frame_size/4);
- xine_fast_memcpy (img->base[2], buf->content+frame_size*5/4, frame_size/4);
-
+ yv12_to_yv12(
+ /* Y */
+ buf->content, buf->decoder_info[0],
+ img->base[0], img->pitches[0],
+ /* U */
+ buf->content + frame_size, buf->decoder_info[0] / 2,
+ img->base[1], img->pitches[1],
+ /* V */
+ buf->content + (frame_size * 5/4), buf->decoder_info[0] / 2,
+ img->base[2], img->pitches[2],
+ /* width x height */
+ buf->decoder_info[0], buf->decoder_info[1]);
+
img->draw (img, this->stream);
img->free (img);