From e2cad38b0a76076b93c8186ab0522f0f3a1e691a Mon Sep 17 00:00:00 2001 From: arpi Date: Sun, 24 Mar 2002 20:45:30 +0000 Subject: [PATCH] U,V plane odrer fixed git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5318 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/mga_common.c | 37 ++++++++++++++++++++++++++----------- libvo/vo_xmga.c | 8 ++------ 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/libvo/mga_common.c b/libvo/mga_common.c index e25c331a6d..64b64571b3 100644 --- a/libvo/mga_common.c +++ b/libvo/mga_common.c @@ -85,8 +85,14 @@ draw_slice_g200(uint8_t *image[], int stride[], int width,int height,int x,int y width/=2;height/=2;x/=2;y/=2; dest = vid_data + bespitch*mga_vid_config.src_height + bespitch*y + 2*x; - src = image[1]; - src2 = image[2]; + if(mga_vid_config.format==MGA_VID_FORMAT_YV12){ + src = image[1]; + src2 = image[2]; + } else { + src = image[2]; + src2 = image[1]; + } + for(h=0; h < height; h++) { #ifdef HAVE_MMX @@ -145,6 +151,7 @@ draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y) { uint8_t *src; uint8_t *dest; + uint8_t *dest2; uint32_t bespitch,bespitch2; int i; @@ -155,14 +162,18 @@ draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y) mem2agpcpy_pic(dest, image[0], w, h, bespitch, stride[0]); w/=2;h/=2;x/=2;y/=2; - - dest = vid_data + bespitch*mga_vid_config.src_height + bespitch2 * y + x; - mem2agpcpy_pic(dest, image[1], w, h, bespitch2, stride[1]); - dest = vid_data + bespitch*mga_vid_config.src_height - + bespitch*mga_vid_config.src_height / 4 - + bespitch2 * y + x; + dest = vid_data + bespitch*mga_vid_config.src_height + bespitch2 * y + x; + dest2= dest + bespitch2*mga_vid_config.src_height / 2; + + if(mga_vid_config.format==MGA_VID_FORMAT_YV12){ + // mga_vid's YV12 assumes Y,U,V order (insteda of Y,V,U) :( + mem2agpcpy_pic(dest, image[1], w, h, bespitch2, stride[1]); + mem2agpcpy_pic(dest2,image[2], w, h, bespitch2, stride[2]); + } else { mem2agpcpy_pic(dest, image[2], w, h, bespitch2, stride[2]); + mem2agpcpy_pic(dest2,image[1], w, h, bespitch2, stride[1]); + } } @@ -233,9 +244,13 @@ get_image(mp_image_t *mpi){ // we're lucky or codec accepts stride => ok, let's go! if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[0]=vid_data; - mpi->planes[1]=vid_data + bespitch*mga_vid_config.src_height; - mpi->planes[2]=vid_data + bespitch*mga_vid_config.src_height - + bespitch*mga_vid_config.src_height / 4; + if(mpi->flags&MP_IMGFLAG_SWAPPED){ + mpi->planes[1]=vid_data + bespitch*mga_vid_config.src_height; + mpi->planes[2]=mpi->planes[1] + bespitch2*mga_vid_config.src_height/2; + } else { + mpi->planes[2]=vid_data + bespitch*mga_vid_config.src_height; + mpi->planes[1]=mpi->planes[2] + bespitch2*mga_vid_config.src_height/2; + } mpi->width=mpi->stride[0]=bespitch; mpi->stride[1]=mpi->stride[2]=bespitch2; } else { diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c index 10ce8477b7..59c51c4f4b 100644 --- a/libvo/vo_xmga.c +++ b/libvo/vo_xmga.c @@ -218,17 +218,13 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3 { case IMGFMT_YV12: height+=height&1; - mga_vid_config.format=MGA_VID_FORMAT_YV12; + mga_vid_config.format=MGA_VID_FORMAT_IYUV; mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2; break; case IMGFMT_I420: - height+=height&1; - mga_vid_config.format=MGA_VID_FORMAT_I420; - mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2; - break; case IMGFMT_IYUV: height+=height&1; - mga_vid_config.format=MGA_VID_FORMAT_IYUV; + mga_vid_config.format=MGA_VID_FORMAT_YV12; mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2; break; case IMGFMT_YUY2: