[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[431] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-11-22 12:56:20
|
Revision: 431 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=431&view=rev Author: nickols_k Date: 2012-11-22 12:56:08 +0000 (Thu, 22 Nov 2012) Log Message: ----------- use new(alignmem,X) instead o mp_memalign + add some g++ related tests into configure Modified Paths: -------------- mplayerxp/configure mplayerxp/libmpcodecs/liba52/parse.cpp mplayerxp/libmpcodecs/libdca/parse.cpp mplayerxp/libmpdemux/video.cpp mplayerxp/libvo/sub.cpp mplayerxp/libvo/vosub_vidix.cpp mplayerxp/postproc/vf_noise.cpp mplayerxp/postproc/vf_smartblur.cpp mplayerxp/postproc/vf_unsharp.cpp mplayerxp/xmpcore/mp_image.cpp Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/configure 2012-11-22 12:56:08 UTC (rev 431) @@ -274,6 +274,35 @@ prefix="." fi +echocheck "whether the $cxx compiler works" +cat > $TMPC << EOF +#include <stdlib.h> +#include <malloc.h> +#include <new> + +typedef void any_t; +enum alignedmemory_t{ alignmem=0 }; +inline any_t* operator new(size_t size,const alignedmemory_t&,size_t boundary) { + return memalign(boundary,size); +} +inline any_t* operator new[](size_t size,const alignedmemory_t&,size_t boundary) { + return memalign(boundary,size); +} +inline void operator delete(any_t* p) { free(p); } + +namespace mpxp { + inline int funci(int i) { return i+2; } +} + +using namespace mpxp; +int main(void) { + char* cstr=new(alignmem,8) char [20]; + delete cstr; + return funci(2); +} +EOF +cxx_check || die "no" + echocheck "Program name" prog_alias=$program_transform_name prog_alias="$program_prefix$prog_alias$program_suffix" @@ -412,16 +441,6 @@ print_config HAVE_ mp_config.h mp_config.mak af_inet6 fi -check_func2 malloc.h malloc -freebsd && disable malloc -print_config HAVE_ mp_config.h mp_config.mak malloc -if enabled malloc; then -check_func2 malloc.h memalign -print_config HAVE_ mp_config.h mp_config.mak memalign -fi -check_func2 alloca.h alloca -print_config HAVE_ mp_config.h mp_config.mak alloca - # find if .align arg is power-of-two or not echocheck ".align is power-of-two" cat > $TMPC << EOF @@ -522,6 +541,17 @@ disabled pthread && die "Lib pthread not found. (needed by xp mode)" print_config HAVE_ mp_config.h mp_config.mak pthread +check_func2 malloc.h malloc +disabled malloc && die "malloc is not supported by your system" +print_config HAVE_ mp_config.h mp_config.mak malloc + +check_func2 malloc.h memalign +disabled memalign && die "memalign is not supported by your system" +print_config HAVE_ mp_config.h mp_config.mak memalign + +check_func2 alloca.h alloca +print_config HAVE_ mp_config.h mp_config.mak alloca + require2 sys_soundcard_h sys/soundcard.h SNDCARD_SB print_config HAVE_ mp_config.h mp_config.mak sys_soundcard_h require2 soundcard_h soundcard.h SNDCARD_SB @@ -951,11 +981,6 @@ /* set up audio OUTBURST. Do not change this! */ #define OUTBURST 512 -/* memalign is mapped to malloc if unsupported */ -#ifndef HAVE_MEMALIGN -# define memalign(a,b) malloc(b) -#endif - /* ASMALIGN */ $def_asmalign Modified: mplayerxp/libmpcodecs/liba52/parse.cpp =================================================================== --- mplayerxp/libmpcodecs/liba52/parse.cpp 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/libmpcodecs/liba52/parse.cpp 2012-11-22 12:56:08 UTC (rev 431) @@ -35,14 +35,6 @@ #include "bitstream.h" #include "tables.h" -#ifdef HAVE_MEMALIGN -/* some systems have mp_memalign() but no declaration for it */ -any_t* mp_memalign (size_t align, size_t size); -#else -/* assume mp_malloc alignment is sufficient */ -#define mp_memalign(align,size) mp_malloc (size) -#endif - typedef struct { sample_t q1[2]; sample_t q2[2]; @@ -66,7 +58,7 @@ if (state == NULL) return NULL; - state->samples = (sample_t*)mp_memalign (16, 256 * 12 * sizeof (sample_t)); + state->samples = new(alignmem,16) sample_t[256 * 12]; if (state->samples == NULL) { delete state; return NULL; Modified: mplayerxp/libmpcodecs/libdca/parse.cpp =================================================================== --- mplayerxp/libmpcodecs/libdca/parse.cpp 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/libmpcodecs/libdca/parse.cpp 2012-11-22 12:56:08 UTC (rev 431) @@ -48,14 +48,6 @@ /* #define LOG_DEBUG */ -#if defined(HAVE_MEMALIGN) && !defined(__cplusplus) -/* some systems have mp_memalign() but no declaration for it */ -any_t* mp_memalign (size_t align, size_t size); -#else -/* assume mp_malloc alignment is sufficient */ -#define mp_memalign(align,size) mp_malloc (size) -#endif - //#define LOG_DEBUG 1 static int decode_blockcode (int code, int levels, int *values); @@ -83,7 +75,7 @@ memset (state, 0, sizeof(dca_state_t)); - state->samples = (sample_t *) mp_memalign (16, 256 * 12 * sizeof (sample_t)); + state->samples = new(alignmem,16) sample_t[256 * 12]; if (state->samples == NULL) { delete state; return NULL; Modified: mplayerxp/libmpdemux/video.cpp =================================================================== --- mplayerxp/libmpdemux/video.cpp 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/libmpdemux/video.cpp 2012-11-22 12:56:08 UTC (rev 431) @@ -143,7 +143,7 @@ } } MSG_V("OK!\n"); - if(!videobuffer) videobuffer=(unsigned char*)mp_memalign(8,VIDEOBUFFER_SIZE); + if(!videobuffer) videobuffer=new(alignmem,8) unsigned char[VIDEOBUFFER_SIZE]; if(!videobuffer){ MSG_ERR(MSGTR_ShMemAllocFail); return 0; @@ -232,7 +232,7 @@ } } MSG_V("OK!\n"); - if(!videobuffer) videobuffer=(unsigned char*)mp_memalign(8,VIDEOBUFFER_SIZE); + if(!videobuffer) videobuffer=new(alignmem,8) unsigned char[VIDEOBUFFER_SIZE]; if(!videobuffer){ MSG_ERR(MSGTR_ShMemAllocFail); return 0; @@ -289,7 +289,7 @@ // sh_video=d_video->sh;sh_video->ds=d_video; // mpeg2_init(); // ========= Read & process sequence header & extension ============ - if(!videobuffer) videobuffer=(unsigned char*)mp_memalign(8,VIDEOBUFFER_SIZE); + if(!videobuffer) videobuffer=new(alignmem,8) unsigned char[VIDEOBUFFER_SIZE]; if(!videobuffer){ MSG_ERR(MSGTR_ShMemAllocFail); return 0; Modified: mplayerxp/libvo/sub.cpp =================================================================== --- mplayerxp/libvo/sub.cpp 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/libvo/sub.cpp 2012-11-22 12:56:08 UTC (rev 431) @@ -57,8 +57,8 @@ obj->allocated = len; delete obj->bitmap_buffer; delete obj->alpha_buffer; - obj->bitmap_buffer = (unsigned char *)mp_memalign(16, len); - obj->alpha_buffer = (unsigned char *)mp_memalign(16, len); + obj->bitmap_buffer = new(alignmem,16) unsigned char[len]; + obj->alpha_buffer = new(alignmem,16) unsigned char[len]; } memset(obj->bitmap_buffer, sub_data.bg_color, len); memset(obj->alpha_buffer, sub_data.bg_alpha, len); Modified: mplayerxp/libvo/vosub_vidix.cpp =================================================================== --- mplayerxp/libvo/vosub_vidix.cpp 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/libvo/vosub_vidix.cpp 2012-11-22 12:56:08 UTC (rev 431) @@ -397,7 +397,6 @@ MSG_V("using %d buffers\n", priv.vidix.playback.num_frames); /* configure busmastering */ if(vo_conf.use_bm) { -#ifdef HAVE_MEMALIGN if(priv.vidix.cap.flags & FLAG_DMA) { int psize = getpagesize(); priv.bm_locked=1; @@ -418,9 +417,6 @@ priv.bm_total_frames=priv.bm_slow_frames=0; } else -#else - MSG_ERR("Won't configure bus mastering: your system doesn't support mp_memalign()\n"); -#endif MSG_ERR("Can not configure bus mastering: your driver is not DMA capable\n"); vo_conf.use_bm = 0; } Modified: mplayerxp/postproc/vf_noise.cpp =================================================================== --- mplayerxp/postproc/vf_noise.cpp 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/postproc/vf_noise.cpp 2012-11-22 12:56:08 UTC (rev 431) @@ -74,7 +74,7 @@ int uniform= fp->uniform; int averaged= fp->averaged; int pattern= fp->pattern; - int8_t *noise= (int8_t*)mp_memalign(16, MAX_NOISE*sizeof(int8_t)); + int8_t *noise=new(alignmem,16) int8_t[MAX_NOISE]; int i, j; srand(123457); Modified: mplayerxp/postproc/vf_smartblur.cpp =================================================================== --- mplayerxp/postproc/vf_smartblur.cpp 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/postproc/vf_smartblur.cpp 2012-11-22 12:56:08 UTC (rev 431) @@ -195,7 +195,7 @@ SwsVector *vec; SwsFilter swsF; int i,x,y; - f->preFilterBuf= (uint8_t*)mp_memalign(8, stride*height); + f->preFilterBuf=new(alignmem,8) uint8_t[stride*height]; f->preFilterStride= stride; vec = sws_getGaussianVec(f->preFilterRadius, f->quality); @@ -219,7 +219,7 @@ vec = sws_getGaussianVec(f->radius, f->quality); f->distWidth= vec->length; f->distStride= (vec->length+7)&~7; - f->distCoeff= (int32_t*)mp_memalign(8, f->distWidth*f->distStride*sizeof(int32_t)); + f->distCoeff=new(alignmem,8) int32_t[f->distWidth*f->distStride]; for(y=0; y<vec->length; y++){ for(x=0; x<vec->length; x++){ Modified: mplayerxp/postproc/vf_unsharp.cpp =================================================================== --- mplayerxp/postproc/vf_unsharp.cpp 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/postproc/vf_unsharp.cpp 2012-11-22 12:56:08 UTC (rev 431) @@ -161,14 +161,14 @@ stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; for( z=0; z<2*stepsY; z++ ) - fp->SC[z] = (uint32_t*)mp_memalign( 16, sizeof(*(fp->SC[z])) * (width+2*stepsX) ); + fp->SC[z] = new(alignmem,16) uint32_t[width+2*stepsX]; fp = &vf->priv->chromaParam; memset( fp->SC, 0, sizeof( fp->SC ) ); stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; for( z=0; z<2*stepsY; z++ ) - fp->SC[z] = (uint32_t*)mp_memalign( 16, sizeof(*(fp->SC[z])) * (width+2*stepsX) ); + fp->SC[z] = new(alignmem,16) uint32_t[width+2*stepsX]; return vf_next_config( vf, width, height, d_width, d_height, flags, outfmt); } Modified: mplayerxp/xmpcore/mp_image.cpp =================================================================== --- mplayerxp/xmpcore/mp_image.cpp 2012-11-22 12:22:07 UTC (rev 430) +++ mplayerxp/xmpcore/mp_image.cpp 2012-11-22 12:56:08 UTC (rev 431) @@ -172,7 +172,7 @@ delta=0; // IF09 - allocate space for 4. plane delta info - unused if (mpi->imgfmt == IMGFMT_IF09) delta=mpi->chroma_width*mpi->chroma_height; - mpi->planes[0]=(unsigned char *)mp_memalign(64,size+delta); + mpi->planes[0]=new(alignmem,64) unsigned char[size+delta]; if(delta) /* delta table, just for fun ;) */ mpi->planes[3]=mpi->planes[0]+2*(mpi->chroma_width*mpi->chroma_height); if(mpi->flags&MP_IMGFLAG_PLANAR){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |