From e75518a44700ac544b60863fdfc23d2761f14c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Fri, 28 Jan 2011 23:36:57 +0100 Subject: Optimize memory usage when clearing surface. When using pitch 0 it is sufficient to allocate just a single row. --HG-- extra : rebase_source : 47b554da704a5c6fc073fee587a968145d3fa230 --- src/video_out/video_out_vdpau.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/video_out/video_out_vdpau.c b/src/video_out/video_out_vdpau.c index e391fdecc..0268e8e0d 100644 --- a/src/video_out/video_out_vdpau.c +++ b/src/video_out/video_out_vdpau.c @@ -1115,9 +1115,9 @@ static void vdpau_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ if ( (format == XINE_IMGFMT_VDPAU) && (clear || (frame->surface_cleared_nr != this->surface_cleared_nr)) ) { lprintf( "clear surface: %d\n", frame->vdpau_accel_data.surface ); if ( frame->vdpau_accel_data.chroma == VDP_CHROMA_TYPE_422 ) { - uint8_t *cb = malloc( frame->width * frame->height * 2 ); - memset( cb, 127, frame->width * frame->height * 2 ); - uint32_t pitches[] = { frame->width }; + uint8_t *cb = malloc( frame->width * 2 ); + memset( cb, 127, frame->width * 2 ); + uint32_t pitches[] = { 0 }; void* data[] = { cb }; VdpStatus st = vdp_video_surface_putbits_ycbcr( frame->vdpau_accel_data.surface, VDP_YCBCR_FORMAT_YUYV, &data, pitches ); if ( st!=VDP_STATUS_OK ) @@ -1125,9 +1125,9 @@ static void vdpau_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ free( cb ); } else { - uint8_t *cb = malloc( frame->width * frame->height ); - memset( cb, 127, frame->width * frame->height ); - uint32_t pitches[] = { frame->width, frame->width, frame->width }; + uint8_t *cb = malloc( frame->width ); + memset( cb, 127, frame->width ); + uint32_t pitches[] = { 0, 0, 0 }; void* data[] = { cb, cb, cb }; VdpStatus st = vdp_video_surface_putbits_ycbcr( frame->vdpau_accel_data.surface, VDP_YCBCR_FORMAT_YV12, &data, pitches ); if ( st!=VDP_STATUS_OK ) -- cgit v1.2.3