Pixel formats
[Utility functions]

Functions for working with pixel formats. More...


Defines

#define FF_LOSS_RESOLUTION   0x0001
 loss due to resolution change
#define FF_LOSS_DEPTH   0x0002
 loss due to color depth change
#define FF_LOSS_COLORSPACE   0x0004
 loss due to color space conversion
#define FF_LOSS_ALPHA   0x0008
 loss of alpha bits
#define FF_LOSS_COLORQUANT   0x0010
 loss due to color quantization
#define FF_LOSS_CHROMA   0x0020
 loss of chroma (e.g.

Functions

void avcodec_get_chroma_sub_sample (enum PixelFormat pix_fmt, int *h_shift, int *v_shift)
unsigned int avcodec_pix_fmt_to_codec_tag (enum PixelFormat pix_fmt)
 Return a value representing the fourCC code associated to the pixel format pix_fmt, or 0 if no associated fourCC code can be found.
int avcodec_get_pix_fmt_loss (enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt, int has_alpha)
 Compute what kind of losses will occur when converting from one specific pixel format to another.
enum PixelFormat avcodec_find_best_pix_fmt (int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
 Find the best pixel format to convert to given a certain source pixel format.
enum PixelFormat avcodec_find_best_pix_fmt2 (enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
 Find the best pixel format to convert to given a certain source pixel format and a selection of two destination pixel formats.
enum PixelFormat avcodec_default_get_format (struct AVCodecContext *s, const enum PixelFormat *fmt)


Detailed Description

Functions for working with pixel formats.

Define Documentation

#define FF_LOSS_ALPHA   0x0008

loss of alpha bits

Definition at line 4350 of file avcodec.h.

Referenced by avcodec_find_best_pix_fmt2(), and avcodec_get_pix_fmt_loss().

#define FF_LOSS_CHROMA   0x0020

loss of chroma (e.g.

RGB to gray conversion)

Definition at line 4352 of file avcodec.h.

Referenced by avcodec_find_best_pix_fmt2(), and avcodec_get_pix_fmt_loss().

#define FF_LOSS_COLORQUANT   0x0010

loss due to color quantization

Definition at line 4351 of file avcodec.h.

Referenced by avcodec_find_best_pix_fmt2(), and avcodec_get_pix_fmt_loss().

#define FF_LOSS_COLORSPACE   0x0004

loss due to color space conversion

Definition at line 4349 of file avcodec.h.

Referenced by avcodec_find_best_pix_fmt2(), and avcodec_get_pix_fmt_loss().

#define FF_LOSS_DEPTH   0x0002

loss due to color depth change

Definition at line 4348 of file avcodec.h.

Referenced by avcodec_find_best_pix_fmt2(), and avcodec_get_pix_fmt_loss().

#define FF_LOSS_RESOLUTION   0x0001

loss due to resolution change

Definition at line 4347 of file avcodec.h.

Referenced by avcodec_find_best_pix_fmt2(), and avcodec_get_pix_fmt_loss().


Function Documentation

enum PixelFormat avcodec_default_get_format ( struct AVCodecContext s,
const enum PixelFormat fmt 
)

Definition at line 654 of file utils.c.

Referenced by avcodec_get_context_defaults3().

enum PixelFormat avcodec_find_best_pix_fmt ( int64_t  pix_fmt_mask,
enum PixelFormat  src_pix_fmt,
int  has_alpha,
int *  loss_ptr 
)

Find the best pixel format to convert to given a certain source pixel format.

When converting from one pixel format to another, information loss may occur. For example, when converting from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when converting from some formats to other formats. avcodec_find_best_pix_fmt() searches which of the given pixel formats should be used to suffer the least amount of loss. The pixel formats from which it chooses one, are determined by the pix_fmt_mask parameter.

Note, only the first 64 pixel formats will fit in pix_fmt_mask.

 src_pix_fmt = PIX_FMT_YUV420P;
 pix_fmt_mask = (1 << PIX_FMT_YUV422P) | (1 << PIX_FMT_RGB24);
 dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);

Parameters:
[in] pix_fmt_mask bitmask determining which pixel format to choose from
[in] src_pix_fmt source pixel format
[in] has_alpha Whether the source pixel format alpha channel is used.
[out] loss_ptr Combination of flags informing you what kind of losses will occur.
Returns:
The best pixel format to convert to or -1 if none was found.

Definition at line 463 of file imgconvert.c.

enum PixelFormat avcodec_find_best_pix_fmt2 ( enum PixelFormat  dst_pix_fmt1,
enum PixelFormat  dst_pix_fmt2,
enum PixelFormat  src_pix_fmt,
int  has_alpha,
int *  loss_ptr 
)

Find the best pixel format to convert to given a certain source pixel format and a selection of two destination pixel formats.

When converting from one pixel format to another, information loss may occur. For example, when converting from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when converting from some formats to other formats. avcodec_find_best_pix_fmt2() selects which of the given pixel formats should be used to suffer the least amount of loss.

If one of the destination formats is PIX_FMT_NONE the other pixel format (if valid) will be returned.

 src_pix_fmt = PIX_FMT_YUV420P;
 dst_pix_fmt1= PIX_FMT_RGB24;
 dst_pix_fmt2= PIX_FMT_GRAY8;
 dst_pix_fmt3= PIX_FMT_RGB8;
 loss= FF_LOSS_CHROMA; // don't care about chroma loss, so chroma loss will be ignored.
 dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, alpha, &loss);
 dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt, dst_pix_fmt3, src_pix_fmt, alpha, &loss);

Parameters:
[in] dst_pix_fmt1 One of the two destination pixel formats to choose from
[in] dst_pix_fmt2 The other of the two destination pixel formats to choose from
[in] src_pix_fmt Source pixel format
[in] has_alpha Whether the source pixel format alpha channel is used.
[in,out] loss_ptr Combination of loss flags. In: selects which of the losses to ignore, i.e. NULL or value of zero means we care about all losses. Out: the loss that occurs when converting from src to selected dst pixel format.
Returns:
The best pixel format to convert to or -1 if none was found.

Definition at line 480 of file imgconvert.c.

Referenced by avcodec_find_best_pix_fmt(), choose_pixel_fmt(), and pick_format().

void avcodec_get_chroma_sub_sample ( enum PixelFormat  pix_fmt,
int *  h_shift,
int *  v_shift 
)

int avcodec_get_pix_fmt_loss ( enum PixelFormat  dst_pix_fmt,
enum PixelFormat  src_pix_fmt,
int  has_alpha 
)

Compute what kind of losses will occur when converting from one specific pixel format to another.

When converting from one pixel format to another, information loss may occur. For example, when converting from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when converting from some formats to other formats. These losses can involve loss of chroma, but also loss of resolution, loss of color depth, loss due to the color space conversion, loss of the alpha bits or loss due to color quantization. avcodec_get_fix_fmt_loss() informs you about the various types of losses which will occur when converting from one pixel format to another.

Parameters:
[in] dst_pix_fmt destination pixel format
[in] src_pix_fmt source pixel format
[in] has_alpha Whether the source pixel format alpha channel is used.
Returns:
Combination of flags informing you what kind of losses will occur (maximum loss for an invalid dst_pix_fmt).

Definition at line 385 of file imgconvert.c.

Referenced by avcodec_find_best_pix_fmt2().

unsigned int avcodec_pix_fmt_to_codec_tag ( enum PixelFormat  pix_fmt  ) 

Return a value representing the fourCC code associated to the pixel format pix_fmt, or 0 if no associated fourCC code can be found.

Definition at line 161 of file raw.c.

Referenced by raw_init_encoder(), and v4l2_read_header().


Generated on Fri Oct 26 02:48:04 2012 for FFmpeg by  doxygen 1.5.8