Mercurial > libavcore.hg
comparison imgutils.c @ 12:c37229a98056 libavcore
Rename the av_fill_image_linesize() formal parameter linesize to
linesizes, for consistency with the function declaration.
author | stefano |
---|---|
date | Fri, 30 Jul 2010 08:42:22 +0000 |
parents | dabaa2056109 |
children | 97c3fe501477 |
comparison
equal
deleted
inserted
replaced
11:dabaa2056109 | 12:c37229a98056 |
---|---|
22 */ | 22 */ |
23 | 23 |
24 #include "imgutils.h" | 24 #include "imgutils.h" |
25 #include "libavutil/pixdesc.h" | 25 #include "libavutil/pixdesc.h" |
26 | 26 |
27 int av_fill_image_linesizes(int linesize[4], enum PixelFormat pix_fmt, int width) | 27 int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width) |
28 { | 28 { |
29 int i; | 29 int i; |
30 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; | 30 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; |
31 int max_step [4]; /* max pixel step for each plane */ | 31 int max_step [4]; /* max pixel step for each plane */ |
32 int max_step_comp[4]; /* the component for each plane which has the max pixel step */ | 32 int max_step_comp[4]; /* the component for each plane which has the max pixel step */ |
33 | 33 |
34 memset(linesize, 0, 4*sizeof(linesize[0])); | 34 memset(linesizes, 0, 4*sizeof(linesizes[0])); |
35 | 35 |
36 if (desc->flags & PIX_FMT_HWACCEL) | 36 if (desc->flags & PIX_FMT_HWACCEL) |
37 return AVERROR(EINVAL); | 37 return AVERROR(EINVAL); |
38 | 38 |
39 if (desc->flags & PIX_FMT_BITSTREAM) { | 39 if (desc->flags & PIX_FMT_BITSTREAM) { |
40 linesize[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3; | 40 linesizes[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3; |
41 return 0; | 41 return 0; |
42 } | 42 } |
43 | 43 |
44 memset(max_step , 0, sizeof(max_step )); | 44 memset(max_step , 0, sizeof(max_step )); |
45 memset(max_step_comp, 0, sizeof(max_step_comp)); | 45 memset(max_step_comp, 0, sizeof(max_step_comp)); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 for (i = 0; i < 4; i++) { | 54 for (i = 0; i < 4; i++) { |
55 int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0; | 55 int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0; |
56 linesize[i] = max_step[i] * (((width + (1 << s) - 1)) >> s); | 56 linesizes[i] = max_step[i] * (((width + (1 << s) - 1)) >> s); |
57 } | 57 } |
58 | 58 |
59 return 0; | 59 return 0; |
60 } | 60 } |
61 | 61 |