Revision a6ddf8bf libavcore/imgutils.c

View differences:

libavcore/imgutils.c
29 29
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
30 30
    int max_step     [4];       /* max pixel step for each plane */
31 31
    int max_step_comp[4];       /* the component for each plane which has the max pixel step */
32
    int s, i;
32
    int s;
33 33

  
34 34
    if (desc->flags & PIX_FMT_BITSTREAM)
35 35
        return (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
36 36

  
37
    memset(max_step     , 0, sizeof(max_step     ));
38
    memset(max_step_comp, 0, sizeof(max_step_comp));
39
    for (i = 0; i < 4; i++) {
40
        const AVComponentDescriptor *comp = &(desc->comp[i]);
41
        if ((comp->step_minus1+1) > max_step[comp->plane]) {
42
            max_step     [comp->plane] = comp->step_minus1+1;
43
            max_step_comp[comp->plane] = i;
44
        }
45
    }
46

  
37
    av_fill_image_max_pixstep(max_step, max_step_comp, desc);
47 38
    s = (max_step_comp[plane] == 1 || max_step_comp[plane] == 2) ? desc->log2_chroma_w : 0;
48 39
    return max_step[plane] * (((width + (1 << s) - 1)) >> s);
49 40
}
......
65 56
        return 0;
66 57
    }
67 58

  
68
    memset(max_step     , 0, sizeof(max_step     ));
69
    memset(max_step_comp, 0, sizeof(max_step_comp));
70
    for (i = 0; i < 4; i++) {
71
        const AVComponentDescriptor *comp = &(desc->comp[i]);
72
        if ((comp->step_minus1+1) > max_step[comp->plane]) {
73
            max_step     [comp->plane] = comp->step_minus1+1;
74
            max_step_comp[comp->plane] = i;
75
        }
76
    }
77

  
59
    av_fill_image_max_pixstep(max_step, max_step_comp, desc);
78 60
    for (i = 0; i < 4; i++) {
79 61
        int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0;
80 62
        linesizes[i] = max_step[i] * (((width + (1 << s) - 1)) >> s);

Also available in: Unified diff