summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinhard Nißl <rnissl@gmx.de>2011-01-28 23:36:57 +0100
committerReinhard Nißl <rnissl@gmx.de>2011-01-28 23:36:57 +0100
commite75518a44700ac544b60863fdfc23d2761f14c5d (patch)
tree48a844faf649c54627efa13b3001511413cdb948
parent6da5c2841fea70dd72bf5d880118dfc1701bd924 (diff)
downloadxine-lib-e75518a44700ac544b60863fdfc23d2761f14c5d.tar.gz
xine-lib-e75518a44700ac544b60863fdfc23d2761f14c5d.tar.bz2
Optimize memory usage when clearing surface.
When using pitch 0 it is sufficient to allocate just a single row. --HG-- extra : rebase_source : 47b554da704a5c6fc073fee587a968145d3fa230
-rw-r--r--src/video_out/video_out_vdpau.c12
1 files 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 )