comparison avcodec.h @ 4612:5f3e6c177bac libavcodec

Add documentation to some avcodec.h's pix_fmt related functions and defines.
author takis
date Thu, 01 Mar 2007 15:27:26 +0000
parents c81aa982b72b
children 8036b117ae26
comparison
equal deleted inserted replaced
4611:96d4d0710099 4612:5f3e6c177bac
2494 const char *avcodec_get_pix_fmt_name(int pix_fmt); 2494 const char *avcodec_get_pix_fmt_name(int pix_fmt);
2495 void avcodec_set_dimensions(AVCodecContext *s, int width, int height); 2495 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
2496 enum PixelFormat avcodec_get_pix_fmt(const char* name); 2496 enum PixelFormat avcodec_get_pix_fmt(const char* name);
2497 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p); 2497 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p);
2498 2498
2499 #define FF_LOSS_RESOLUTION 0x0001 /* loss due to resolution change */ 2499 #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
2500 #define FF_LOSS_DEPTH 0x0002 /* loss due to color depth change */ 2500 #define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
2501 #define FF_LOSS_COLORSPACE 0x0004 /* loss due to color space conversion */ 2501 #define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
2502 #define FF_LOSS_ALPHA 0x0008 /* loss of alpha bits */ 2502 #define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
2503 #define FF_LOSS_COLORQUANT 0x0010 /* loss due to color quantization */ 2503 #define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
2504 #define FF_LOSS_CHROMA 0x0020 /* loss of chroma (e.g. rgb to gray conversion) */ 2504 #define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
2505 2505
2506 /** 2506 /**
2507 * compute the loss when converting from a pixel format to another 2507 * Computes what kind of losses will occur when converting from one specific
2508 * pixel format to another.
2509 * When converting from one pixel format to another, information loss may occur.
2510 * For example, when converting from RGB24 to GRAY, the color information will
2511 * be lost. Similarly, other losses occur when converting from some formats to
2512 * other formats. These losses can involve loss of chroma, but also loss of
2513 * resolution, loss of color depth, loss due to the color space conversion, loss
2514 * of the alpha bits or loss due to color quantization.
2515 * avcodec_get_fix_fmt_loss() informs you on the various types of losses which
2516 * will occur when converting from one pixel format to another.
2517 *
2518 * @param[in] dst_pix_fmt Destination pixel format.
2519 * @param[in] src_pix_fmt Source pixel format.
2520 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2521 * @return Combination of flags informing you what kind of losses will occur.
2508 */ 2522 */
2509 int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, 2523 int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
2510 int has_alpha); 2524 int has_alpha);
2511 2525
2512 /** 2526 /**
2513 * find best pixel format to convert to. Return -1 if none found 2527 * Finds the best pixel format to convert to given a certain source pixel
2528 * format. When converting from one pixel format to another, information loss
2529 * may occur. For example, when converting from RGB24 to GRAY, the color
2530 * information will be lost. Similarly, other losses occur when converting from
2531 * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
2532 * the given pixel formats should be used to undergo the least amount of losses.
2533 * The pixel formats from which it choses one, are determined by the
2534 * \p pix_fmt_mask parameter.
2535 *
2536 * @code
2537 * src_pix_fmt = PIX_FMT_YUV420P;
2538 * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24);
2539 * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
2540 * @endcode
2541 *
2542 * @param[in] pix_fmt_mask Bitmask determining which pixel format to choose from.
2543 * @param[in] src_pix_fmt Source pixel format.
2544 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2545 * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
2546 * @return The best pixel format to convert to or -1 if none was found.
2514 */ 2547 */
2515 int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt, 2548 int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
2516 int has_alpha, int *loss_ptr); 2549 int has_alpha, int *loss_ptr);
2517 2550
2518 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */ 2551 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */