1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-06 15:11:58 +00:00

U,V plane odrer fixed

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5318 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-03-24 20:45:30 +00:00
parent e81578975e
commit e2cad38b0a
2 changed files with 28 additions and 17 deletions

View File

@ -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 {

View File

@ -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: