Revision 6ab6c7c3 libpostproc/postprocess.c

View differences:

libpostproc/postprocess.c
72 72
//Changelog: use the Subversion log
73 73

  
74 74
#include "config.h"
75
#include "avutil.h"
75 76
#include <inttypes.h>
76 77
#include <stdio.h>
77 78
#include <stdlib.h>
......
96 97
#include <altivec.h>
97 98
#endif
98 99

  
99
#ifndef HAVE_MEMALIGN
100
#define memalign(a,b) malloc(b)
101
#endif
102

  
103 100
#define MIN(a,b) ((a) > (b) ? (b) : (a))
104 101
#define MAX(a,b) ((a) < (b) ? (b) : (a))
105 102
#define ABS(a) ((a) > 0 ? (a) : (-(a)))
......
428 425
        if(lut==NULL)
429 426
        {
430 427
                int i;
431
                lut= (uint64_t*)memalign(8, 256*8);
428
                lut = av_malloc(256*8);
432 429
                for(i=0; i<256; i++)
433 430
                {
434 431
                        int v= i < 128 ? 2*i : 2*(i-256);
......
771 768
        struct PPMode *ppMode;
772 769
        char *filterToken;
773 770

  
774
        ppMode= memalign(8, sizeof(PPMode));
771
        ppMode= av_malloc(sizeof(PPMode));
775 772

  
776 773
        ppMode->lumMode= 0;
777 774
        ppMode->chromMode= 0;
......
949 946
        if(ppMode->error)
950 947
        {
951 948
                fprintf(stderr, "%d errors in postprocess string \"%s\"\n", ppMode->error, name);
952
                free(ppMode);
949
                av_free(ppMode);
953 950
                return NULL;
954 951
        }
955 952
        return ppMode;
956 953
}
957 954

  
958 955
void pp_free_mode(pp_mode_t *mode){
959
    if(mode) free(mode);
956
    av_free(mode);
960 957
}
961 958

  
962 959
static void reallocAlign(void **p, int alignment, int size){
963
        if(*p) free(*p);
964
        *p= memalign(alignment, size);
965
        memset(*p, 0, size);
960
        av_free(p);
961
        *p= av_mallocz(size);
966 962
}
967 963

  
968 964
static void reallocBuffers(PPContext *c, int width, int height, int stride, int qpStride){
......
1002 998
}
1003 999

  
1004 1000
pp_context_t *pp_get_context(int width, int height, int cpuCaps){
1005
        PPContext *c= memalign(32, sizeof(PPContext));
1001
        PPContext *c= av_malloc(sizeof(PPContext));
1006 1002
        int stride= (width+15)&(~15);    //assumed / will realloc if needed
1007 1003
        int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed
1008 1004

  
......
1029 1025
        PPContext *c = (PPContext*)vc;
1030 1026
        int i;
1031 1027

  
1032
        for(i=0; i<3; i++) free(c->tempBlured[i]);
1033
        for(i=0; i<3; i++) free(c->tempBluredPast[i]);
1028
        for(i=0; i<3; i++) av_free(c->tempBlured[i]);
1029
        for(i=0; i<3; i++) av_free(c->tempBluredPast[i]);
1034 1030

  
1035
        free(c->tempBlocks);
1036
        free(c->yHistogram);
1037
        free(c->tempDst);
1038
        free(c->tempSrc);
1039
        free(c->deintTemp);
1040
        free(c->stdQPTable);
1041
        free(c->nonBQPTable);
1042
        free(c->forcedQPTable);
1031
        av_free(c->tempBlocks);
1032
        av_free(c->yHistogram);
1033
        av_free(c->tempDst);
1034
        av_free(c->tempSrc);
1035
        av_free(c->deintTemp);
1036
        av_free(c->stdQPTable);
1037
        av_free(c->nonBQPTable);
1038
        av_free(c->forcedQPTable);
1043 1039

  
1044 1040
        memset(c, 0, sizeof(PPContext));
1045 1041

  
1046
        free(c);
1042
        av_free(c);
1047 1043
}
1048 1044

  
1049 1045
void  pp_postprocess(uint8_t * src[3], int srcStride[3],

Also available in: Unified diff