about summary refs log tree commit diff
path: root/converter/ppm/ppmtompeg/frames.c
blob: a07648904a379f8c584a946ff98720844af00384 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "mallocvar.h"
#include "fsize.h"

#include "frames.h"


Block **dct=NULL, **dctr=NULL, **dctb=NULL;
dct_data_type   **dct_data; /* used in p/bframe.c */


/*===========================================================================*
 *
 * AllocDctBlocks
 *
 *  allocate memory for dct blocks
 *
 * RETURNS: nothing
 *
 * SIDE EFFECTS:    creates dct, dctr, dctb
 *
 *===========================================================================*/
void
AllocDctBlocks(void) {

    int dctx, dcty;
    int i;

    dctx = Fsize_x / DCTSIZE;
    dcty = Fsize_y / DCTSIZE;

    MALLOCARRAY(dct, dcty);
    ERRCHK(dct, "malloc");
    for (i = 0; i < dcty; ++i) {
        dct[i] = (Block *) malloc(sizeof(Block) * dctx);
        ERRCHK(dct[i], "malloc");
    }

    MALLOCARRAY(dct_data, dcty);
    ERRCHK(dct_data, "malloc");
    for (i = 0; i < dcty; ++i) {
        MALLOCARRAY(dct_data[i], dctx);
        ERRCHK(dct[i], "malloc");
    }

    MALLOCARRAY(dctr, dcty/2);
    ERRCHK(dctr, "malloc");
    MALLOCARRAY(dctb, dcty/2);
    ERRCHK(dctb, "malloc");
    for (i = 0; i < dcty/2; ++i) {
        MALLOCARRAY(dctr[i], dctx/2);
        ERRCHK(dctr[i], "malloc");
        MALLOCARRAY(dctb[i], dctx/2);
        ERRCHK(dctb[i], "malloc");
    }
}