Revision 38d5c282 postproc/swscale.c

View differences:

postproc/swscale.c
61 61
#else
62 62
#include <stdlib.h>
63 63
#endif
64
#ifdef HAVE_SYS_MMAN_H
65
#include <sys/mman.h>
66
#endif
64 67
#include "swscale.h"
65 68
#include "swscale_internal.h"
66 69
#include "../cpudetect.h"
......
1999 2002
// can't downscale !!!
2000 2003
		if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR))
2001 2004
		{
2005
#define MAX_FUNNY_CODE_SIZE 10000
2006
#ifdef HAVE_SYS_MMAN_H
2007
			c->funnyYCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
2008
			c->funnyUVCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
2009
#else
2010
			c->funnyYCode = (uint8_t*)memalign(32, MAX_FUNNY_CODE_SIZE);
2011
			c->funnyUVCode = (uint8_t*)memalign(32, MAX_FUNNY_CODE_SIZE);
2012
#endif
2013

  
2002 2014
			c->lumMmx2Filter   = (int16_t*)memalign(8, (dstW        /8+8)*sizeof(int16_t));
2003 2015
			c->chrMmx2Filter   = (int16_t*)memalign(8, (c->chrDstW  /4+8)*sizeof(int16_t));
2004 2016
			c->lumMmx2FilterPos= (int32_t*)memalign(8, (dstW      /2/8+8)*sizeof(int32_t));
......
2556 2568
	if(c->hChrFilterPos) free(c->hChrFilterPos);
2557 2569
	c->hChrFilterPos = NULL;
2558 2570

  
2571
#ifdef HAVE_SYS_MMAN_H
2572
	if(c->funnyYCode) munmap(c->funnyYCode, MAX_FUNNY_CODE_SIZE);
2573
	if(c->funnyUVCode) munmap(c->funnyUVCode, MAX_FUNNY_CODE_SIZE);
2574
#else
2575
	if(c->funnyYCode) free(c->funnyYCode);
2576
	if(c->funnyUVCode) free(c->funnyUVCode);
2577
#endif
2578
	c->funnyYCode=NULL;
2579
	c->funnyUVCode=NULL;
2580

  
2559 2581
	if(c->lumMmx2Filter) free(c->lumMmx2Filter);
2560 2582
	c->lumMmx2Filter=NULL;
2561 2583
	if(c->chrMmx2Filter) free(c->chrMmx2Filter);

Also available in: Unified diff