Revision a6ddf8bf libavcore/imgutils.h
libavcore/imgutils.h | ||
---|---|---|
24 | 24 |
* misc image utilities |
25 | 25 |
*/ |
26 | 26 |
|
27 |
#include "libavutil/pixfmt.h"
|
|
27 |
#include "libavutil/pixdesc.h"
|
|
28 | 28 |
#include "avcore.h" |
29 | 29 |
|
30 | 30 |
/** |
31 |
* Compute the max pixel step for each plane of an image with a |
|
32 |
* format described by pixdesc |
|
33 |
* |
|
34 |
* The pixel step is the distance in bytes between the first byte of |
|
35 |
* the group of bytes which describe a pixel component and the first |
|
36 |
* byte of the successive group in the same plane for the same |
|
37 |
* component. |
|
38 |
* |
|
39 |
* @param max_pixstep an array which is filled with the max pixel step |
|
40 |
* for each plane. Since a plane may contain different pixel |
|
41 |
* components, the computed max_pixstep[plane] is relative to the |
|
42 |
* component in the plane with the max pixel step. |
|
43 |
* @param max_pixstep_comp an array which is filled with the component |
|
44 |
* for each plane which has the max pixel step. May be NULL. |
|
45 |
*/ |
|
46 |
static inline void av_fill_image_max_pixstep(int max_pixstep[4], int max_pixstep_comp[4], |
|
47 |
const AVPixFmtDescriptor *pixdesc) |
|
48 |
{ |
|
49 |
int i; |
|
50 |
memset(max_pixstep, 0, 4*sizeof(max_pixstep[0])); |
|
51 |
if (max_pixstep_comp) |
|
52 |
memset(max_pixstep_comp, 0, 4*sizeof(max_pixstep_comp[0])); |
|
53 |
|
|
54 |
for (i = 0; i < 4; i++) { |
|
55 |
const AVComponentDescriptor *comp = &(pixdesc->comp[i]); |
|
56 |
if ((comp->step_minus1+1) > max_pixstep[comp->plane]) { |
|
57 |
max_pixstep[comp->plane] = comp->step_minus1+1; |
|
58 |
if (max_pixstep_comp) |
|
59 |
max_pixstep_comp[comp->plane] = i; |
|
60 |
} |
|
61 |
} |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
31 | 65 |
* Compute the size of an image line with format pix_fmt and width |
32 | 66 |
* width for the plane plane. |
33 | 67 |
* |
Also available in: Unified diff