From 1375d5cdc69525a142f5a40cea2086abbae98fe6 Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Tue, 11 Sep 2001 16:15:42 +0000 Subject: 444P and 422P colorspace support (for mjpeg) for ffmpeg CVS patchset: 618 CVS date: 2001/09/11 16:15:42 --- src/libffmpeg/xine_decoder.c | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index b4c176337..65bd4a864 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.10 2001/09/11 14:11:56 guenter Exp $ + * $Id: xine_decoder.c,v 1.11 2001/09/11 16:15:42 guenter Exp $ * * xine decoder plugin using ffmpeg * @@ -235,7 +235,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { sy = this->av_picture.data[0]; su = this->av_picture.data[1]; sv = this->av_picture.data[2]; - + for (y=0; ybiHeight; y++) { memcpy (dy, sy, this->biWidth); @@ -246,15 +246,45 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } for (y=0; y<(this->biHeight/2); y++) { + + if (this->context.pix_fmt != PIX_FMT_YUV444P) { - memcpy (du, su, this->biWidth/2); - memcpy (dv, sv, this->biWidth/2); + memcpy (du, su, this->biWidth/2); + memcpy (dv, sv, this->biWidth/2); + + } else { + + int x; + uint8_t *src; + uint8_t *dst; + + /* subsample */ + + src = su; dst = du; + for (x=0; x<(this->biWidth/2); x++) { + *dst = *src; + dst++; + src += 2; + } + src = sv; dst = dv; + for (x=0; x<(this->biWidth/2); x++) { + *dst = *src; + dst++; + src += 2; + } + + } du += this->biWidth/2; dv += this->biWidth/2; - su += this->av_picture.linesize[1]; - sv += this->av_picture.linesize[2]; + if (this->context.pix_fmt != PIX_FMT_YUV420P) { + su += 2*this->av_picture.linesize[1]; + sv += 2*this->av_picture.linesize[2]; + } else { + su += this->av_picture.linesize[1]; + sv += this->av_picture.linesize[2]; + } } if (img->copy) { -- cgit v1.2.3