Mercurial > mplayer.hg
comparison postproc/swscale.c @ 14625:e85e3894520f
makes funnyCode pages executable (for CPU with NX bit)
author | aurel |
---|---|
date | Mon, 31 Jan 2005 15:57:27 +0000 |
parents | 31cb219364a4 |
children | 734239808489 |
comparison
equal
deleted
inserted
replaced
14624:7b7c94b5e78a | 14625:e85e3894520f |
---|---|
58 #include <assert.h> | 58 #include <assert.h> |
59 #ifdef HAVE_MALLOC_H | 59 #ifdef HAVE_MALLOC_H |
60 #include <malloc.h> | 60 #include <malloc.h> |
61 #else | 61 #else |
62 #include <stdlib.h> | 62 #include <stdlib.h> |
63 #endif | |
64 #ifdef HAVE_SYS_MMAN_H | |
65 #include <sys/mman.h> | |
63 #endif | 66 #endif |
64 #include "swscale.h" | 67 #include "swscale.h" |
65 #include "swscale_internal.h" | 68 #include "swscale_internal.h" |
66 #include "../cpudetect.h" | 69 #include "../cpudetect.h" |
67 #include "../bswap.h" | 70 #include "../bswap.h" |
1997 | 2000 |
1998 #if defined(ARCH_X86) || defined(ARCH_X86_64) | 2001 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
1999 // can't downscale !!! | 2002 // can't downscale !!! |
2000 if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) | 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 c->lumMmx2Filter = (int16_t*)memalign(8, (dstW /8+8)*sizeof(int16_t)); | 2014 c->lumMmx2Filter = (int16_t*)memalign(8, (dstW /8+8)*sizeof(int16_t)); |
2003 c->chrMmx2Filter = (int16_t*)memalign(8, (c->chrDstW /4+8)*sizeof(int16_t)); | 2015 c->chrMmx2Filter = (int16_t*)memalign(8, (c->chrDstW /4+8)*sizeof(int16_t)); |
2004 c->lumMmx2FilterPos= (int32_t*)memalign(8, (dstW /2/8+8)*sizeof(int32_t)); | 2016 c->lumMmx2FilterPos= (int32_t*)memalign(8, (dstW /2/8+8)*sizeof(int32_t)); |
2005 c->chrMmx2FilterPos= (int32_t*)memalign(8, (c->chrDstW/2/4+8)*sizeof(int32_t)); | 2017 c->chrMmx2FilterPos= (int32_t*)memalign(8, (c->chrDstW/2/4+8)*sizeof(int32_t)); |
2006 | 2018 |
2554 if(c->hLumFilterPos) free(c->hLumFilterPos); | 2566 if(c->hLumFilterPos) free(c->hLumFilterPos); |
2555 c->hLumFilterPos = NULL; | 2567 c->hLumFilterPos = NULL; |
2556 if(c->hChrFilterPos) free(c->hChrFilterPos); | 2568 if(c->hChrFilterPos) free(c->hChrFilterPos); |
2557 c->hChrFilterPos = NULL; | 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 if(c->lumMmx2Filter) free(c->lumMmx2Filter); | 2581 if(c->lumMmx2Filter) free(c->lumMmx2Filter); |
2560 c->lumMmx2Filter=NULL; | 2582 c->lumMmx2Filter=NULL; |
2561 if(c->chrMmx2Filter) free(c->chrMmx2Filter); | 2583 if(c->chrMmx2Filter) free(c->chrMmx2Filter); |
2562 c->chrMmx2Filter=NULL; | 2584 c->chrMmx2Filter=NULL; |
2563 if(c->lumMmx2FilterPos) free(c->lumMmx2FilterPos); | 2585 if(c->lumMmx2FilterPos) free(c->lumMmx2FilterPos); |