comparison libmpcodecs/vf_sab.c @ 32747:170106dd2ef2

Replace memalign() by av_malloc() in libmpcodecs. as it is not available in all platforms ported from ffmpeg
author michael
date Sun, 30 Jan 2011 22:57:16 +0000
parents 7af3e6f901fd
children 93923796615c
comparison
equal deleted inserted replaced
32746:2372e26d24fe 32747:170106dd2ef2
93 static int allocStuff(FilterParam *f, int width, int height){ 93 static int allocStuff(FilterParam *f, int width, int height){
94 int stride= (width+7)&~7; 94 int stride= (width+7)&~7;
95 SwsVector *vec; 95 SwsVector *vec;
96 SwsFilter swsF; 96 SwsFilter swsF;
97 int i,x,y; 97 int i,x,y;
98 f->preFilterBuf= (uint8_t*)memalign(8, stride*height); 98 f->preFilterBuf= av_malloc(stride*height);
99 f->preFilterStride= stride; 99 f->preFilterStride= stride;
100 100
101 vec = sws_getGaussianVec(f->preFilterRadius, f->quality); 101 vec = sws_getGaussianVec(f->preFilterRadius, f->quality);
102 swsF.lumH= swsF.lumV= vec; 102 swsF.lumH= swsF.lumV= vec;
103 swsF.chrH= swsF.chrV= NULL; 103 swsF.chrH= swsF.chrV= NULL;
117 } 117 }
118 sws_freeVec(vec); 118 sws_freeVec(vec);
119 vec = sws_getGaussianVec(f->radius, f->quality); 119 vec = sws_getGaussianVec(f->radius, f->quality);
120 f->distWidth= vec->length; 120 f->distWidth= vec->length;
121 f->distStride= (vec->length+7)&~7; 121 f->distStride= (vec->length+7)&~7;
122 f->distCoeff= (int32_t*)memalign(8, f->distWidth*f->distStride*sizeof(int32_t)); 122 f->distCoeff= av_malloc(f->distWidth*f->distStride*sizeof(int32_t));
123 123
124 for(y=0; y<vec->length; y++){ 124 for(y=0; y<vec->length; y++){
125 for(x=0; x<vec->length; x++){ 125 for(x=0; x<vec->length; x++){
126 double d= vec->coeff[x] * vec->coeff[y]; 126 double d= vec->coeff[x] * vec->coeff[y];
127 127
151 151
152 static void freeBuffers(FilterParam *f){ 152 static void freeBuffers(FilterParam *f){
153 if(f->preFilterContext) sws_freeContext(f->preFilterContext); 153 if(f->preFilterContext) sws_freeContext(f->preFilterContext);
154 f->preFilterContext=NULL; 154 f->preFilterContext=NULL;
155 155
156 free(f->preFilterBuf); 156 av_free(f->preFilterBuf);
157 f->preFilterBuf=NULL; 157 f->preFilterBuf=NULL;
158 158
159 free(f->distCoeff); 159 av_free(f->distCoeff);
160 f->distCoeff=NULL; 160 f->distCoeff=NULL;
161 } 161 }
162 162
163 static void uninit(struct vf_instance *vf){ 163 static void uninit(struct vf_instance *vf){
164 if(!vf->priv) return; 164 if(!vf->priv) return;