Mercurial > libavcodec.hg
comparison imgconvert.c @ 4549:48442cb0ebfa libavcodec
add doxygen docs for avpicture_fill()
Patch by Panagiotis Issaris % takis P issaris A uhasselt P be %
author | gpoirier |
---|---|
date | Tue, 20 Feb 2007 08:35:25 +0000 |
parents | 75701d9842cc |
children | 2aea8bf268d8 |
comparison
equal
deleted
inserted
replaced
4548:8abb0317d1eb | 4549:48442cb0ebfa |
---|---|
42 #endif | 42 #endif |
43 | 43 |
44 #define xglue(x, y) x ## y | 44 #define xglue(x, y) x ## y |
45 #define glue(x, y) xglue(x, y) | 45 #define glue(x, y) xglue(x, y) |
46 | 46 |
47 #define FF_COLOR_RGB 0 /* RGB color space */ | 47 #define FF_COLOR_RGB 0 /**< RGB color space */ |
48 #define FF_COLOR_GRAY 1 /* gray color space */ | 48 #define FF_COLOR_GRAY 1 /**< gray color space */ |
49 #define FF_COLOR_YUV 2 /* YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */ | 49 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */ |
50 #define FF_COLOR_YUV_JPEG 3 /* YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */ | 50 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */ |
51 | 51 |
52 #define FF_PIXEL_PLANAR 0 /* each channel has one component in AVPicture */ | 52 #define FF_PIXEL_PLANAR 0 /**< each channel has one component in AVPicture */ |
53 #define FF_PIXEL_PACKED 1 /* only one components containing all the channels */ | 53 #define FF_PIXEL_PACKED 1 /**< only one components containing all the channels */ |
54 #define FF_PIXEL_PALETTE 2 /* one components containing indexes for a palette */ | 54 #define FF_PIXEL_PALETTE 2 /**< one components containing indexes for a palette */ |
55 | 55 |
56 typedef struct PixFmtInfo { | 56 typedef struct PixFmtInfo { |
57 const char *name; | 57 const char *name; |
58 uint8_t nb_channels; /* number of channels (including alpha) */ | 58 uint8_t nb_channels; /**< number of channels (including alpha) */ |
59 uint8_t color_type; /* color type (see FF_COLOR_xxx constants) */ | 59 uint8_t color_type; /**< color type (see FF_COLOR_xxx constants) */ |
60 uint8_t pixel_type; /* pixel storage type (see FF_PIXEL_xxx constants) */ | 60 uint8_t pixel_type; /**< pixel storage type (see FF_PIXEL_xxx constants) */ |
61 uint8_t is_alpha : 1; /* true if alpha can be specified */ | 61 uint8_t is_alpha : 1; /**< true if alpha can be specified */ |
62 uint8_t x_chroma_shift; /* X chroma subsampling factor is 2 ^ shift */ | 62 uint8_t x_chroma_shift; /**< X chroma subsampling factor is 2 ^ shift */ |
63 uint8_t y_chroma_shift; /* Y chroma subsampling factor is 2 ^ shift */ | 63 uint8_t y_chroma_shift; /**< Y chroma subsampling factor is 2 ^ shift */ |
64 uint8_t depth; /* bit depth of the color components */ | 64 uint8_t depth; /**< bit depth of the color components */ |
65 } PixFmtInfo; | 65 } PixFmtInfo; |
66 | 66 |
67 /* this table gives more information about formats */ | 67 /* this table gives more information about formats */ |
68 static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { | 68 static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { |
69 /* YUV formats */ | 69 /* YUV formats */ |
380 if (!strcmp(pix_fmt_info[i].name, name)) | 380 if (!strcmp(pix_fmt_info[i].name, name)) |
381 break; | 381 break; |
382 return i; | 382 return i; |
383 } | 383 } |
384 | 384 |
385 /* Picture field are filled with 'ptr' addresses. Also return size */ | 385 /** |
386 * Fill in AVPicture's fields. | |
387 * The fields of the given AVPicture are filled in by using the 'ptr' address | |
388 * which points to the image data buffer. Depending on the specified picture | |
389 * format, one or multiple image data pointers and line sizes will be set. | |
390 * If a planar format is specified, several pointers will be set pointing to | |
391 * the different picture planes and the line sizes of the different planes | |
392 * will be stored in the lines_sizes array. | |
393 * | |
394 * @param picture AVPicture who's fields are to be filled in | |
395 * @param ptr Buffer which will contain or contains the actual image data | |
396 * @param pix_fmt The format in which the picture data is stored | |
397 * @param width The width of the image in pixels | |
398 * @param height The height of the image in pixels | |
399 * @return Size of the image data in bytes. | |
400 */ | |
386 int avpicture_fill(AVPicture *picture, uint8_t *ptr, | 401 int avpicture_fill(AVPicture *picture, uint8_t *ptr, |
387 int pix_fmt, int width, int height) | 402 int pix_fmt, int width, int height) |
388 { | 403 { |
389 int size, w2, h2, size2; | 404 int size, w2, h2, size2; |
390 const PixFmtInfo *pinfo; | 405 const PixFmtInfo *pinfo; |
558 memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4); | 573 memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4); |
559 | 574 |
560 return size; | 575 return size; |
561 } | 576 } |
562 | 577 |
578 /** | |
579 * Calculate the size in bytes that a picture of the given width and height | |
580 * would occupy if stored in the given picture format. | |
581 * | |
582 * @param pix_fmt The given picture format | |
583 * @param width The width of the image | |
584 * @param height The height of the image | |
585 * @return Image data size in bytes | |
586 */ | |
563 int avpicture_get_size(int pix_fmt, int width, int height) | 587 int avpicture_get_size(int pix_fmt, int width, int height) |
564 { | 588 { |
565 AVPicture dummy_pict; | 589 AVPicture dummy_pict; |
566 return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height); | 590 return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height); |
567 } | 591 } |