# HG changeset patch # User nick # Date 1015661323 0 # Node ID 7f1fa1db24b49d80c9663df0eefc856427ee627c # Parent c32191b02a662179ec887e0ea58a97e7d85578a2 Optimization and get_image fixes (still untested) diff -r c32191b02a66 -r 7f1fa1db24b4 libvo/vosub_vidix.c --- a/libvo/vosub_vidix.c Sat Mar 09 02:18:33 2002 +0000 +++ b/libvo/vosub_vidix.c Sat Mar 09 08:08:43 2002 +0000 @@ -37,7 +37,7 @@ static VDL_HANDLE vidix_handler = NULL; static uint8_t *vidix_mem = NULL; static uint8_t next_frame; -static unsigned image_bpp,image_height,image_width,src_format; +static unsigned image_Bpp,image_height,image_width,src_format; extern int verbose; static int video_on=0; @@ -45,6 +45,7 @@ static vidix_playback_t vidix_play; static vidix_fourcc_t vidix_fourcc; static vo_functions_t * vo_server; +static vidix_yuv_t dstrides; static uint32_t (*server_control)(uint32_t request, void *data, ...); @@ -146,20 +147,16 @@ { uint8_t *src; uint8_t *dest; - unsigned bespitch,apitch; int i; /* Plane Y */ - apitch = vidix_play.dest.pitch.y-1; - bespitch = (w + apitch) & ~apitch; - dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; - dest += bespitch*y + x; + dest += dstrides.y*y + x; src = image[0]; for(i=0;i 1) printf("vosub_vidix: vidix_init() was called\n" "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" @@ -634,29 +549,53 @@ for (i = 0; i < vidix_play.num_frames; i++) memset(vidix_mem + vidix_play.offsets[i], 0x80, vidix_play.frame_size); + switch(format) + { + /* + case IMGFMT_YV09: + case IMGFMT_IF09: + */ + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YV12: + apitch = vidix_play.dest.pitch.y-1; + dstrides.y = (image_width + apitch) & ~apitch; + apitch = vidix_play.dest.pitch.v-1; + dstrides.v = (image_width + apitch) & ~apitch; + apitch = vidix_play.dest.pitch.u-1; + dstrides.u = (image_width + apitch) & ~apitch; + image_Bpp=1; + break; + case IMGFMT_RGB32: + case IMGFMT_BGR32: + apitch = vidix_play.dest.pitch.y-1; + dstrides.y = (image_width*4 + apitch) & ~apitch; + dstrides.u = dstrides.v = 0; + image_Bpp=4; + break; + case IMGFMT_RGB24: + case IMGFMT_BGR24: + apitch = vidix_play.dest.pitch.y-1; + dstrides.y = (image_width*3 + apitch) & ~apitch; + dstrides.u = dstrides.v = 0; + image_Bpp=3; + break; + default: + apitch = vidix_play.dest.pitch.y-1; + dstrides.y = (image_width*2 + apitch) & ~apitch; + dstrides.u = dstrides.v = 0; + image_Bpp=2; + break; + } /* tune some info here */ sstride = src_width*2; - dstride = (src_width*2+(vidix_play.dest.pitch.y-1))&~(vidix_play.dest.pitch.y-1); - is_422_planes_eq = sstride == dstride; + is_422_planes_eq = sstride == dstrides.y; if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) vo_server->draw_slice = vidix_draw_slice_420; - else - if(src_format == IMGFMT_RGB32 || src_format == IMGFMT_BGR32) - vo_server->draw_slice = + else vo_server->draw_slice = is_422_planes_eq ? - vidix_draw_slice_32_fast: - vidix_draw_slice_32; - else - if(src_format == IMGFMT_RGB24 || src_format == IMGFMT_BGR24) - vo_server->draw_slice = - is_422_planes_eq ? - vidix_draw_slice_24_fast: - vidix_draw_slice_24; - else - vo_server->draw_slice = - is_422_planes_eq ? - vidix_draw_slice_422_fast: - vidix_draw_slice_422; + vidix_draw_slice_packed_fast: + vidix_draw_slice_packed; return 0; } @@ -665,13 +604,13 @@ if(mpi->type==MP_IMGTYPE_STATIC && vidix_play.num_frames>1) return VO_FALSE; if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; /* slow video ram */ mpi->planes[0]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.y; - mpi->stride[0]=vidix_play.dest.pitch.y; + mpi->stride[0]=dstrides.y; if(mpi->flags&MP_IMGFLAG_PLANAR) { mpi->planes[1]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.v; - mpi->stride[1]=vidix_play.dest.pitch.v; + mpi->stride[1]=dstrides.v; mpi->planes[2]=vidix_mem+vidix_play.offsets[next_frame]+vidix_play.offset.u; - mpi->stride[2]=vidix_play.dest.pitch.u; + mpi->stride[2]=dstrides.u; } mpi->flags|=MP_IMGFLAG_DIRECT; return VO_TRUE;