62 if (dst_pix_fmt == src_pix_fmt)
65 for (i = 0; i < nb_components; i++)
95 int dist, i, loss, min_dist;
100 min_dist = 0x7fffffff;
107 "it is either not properly terminated or contains duplicates\n");
114 if (dist < min_dist) {
126 int has_alpha,
int *loss_ptr)
130 static const int loss_mask_order[] = {
143 loss_mask = loss_mask_order[i++];
145 has_alpha, loss_mask);
146 if (dst_pix_fmt >= 0)
181 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
182 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
204 for (i = 0; i < 3; i++) {
208 if (padtop || padleft) {
209 memset(dst->
data[i], color[i],
210 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
213 if (padleft || padright) {
214 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
215 (dst->
linesize[i] - (padright >> x_shift));
216 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
217 for (y = 0; y < yheight; y++) {
218 memset(optr, color[i], (padleft + padright) >> x_shift);
225 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
226 (padleft >> x_shift);
227 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
229 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
230 (dst->
linesize[i] - (padright >> x_shift));
231 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
232 for (y = 0; y < yheight; y++) {
233 memset(optr, color[i], (padleft + padright) >> x_shift);
234 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
235 (width - padleft - padright) >> x_shift);
241 if (padbottom || padright) {
243 ((height - padbottom) >> y_shift) - (padright >> x_shift);
244 memset(optr, color[i],dst->
linesize[i] *
245 (padbottom >> y_shift) + (padright >> x_shift));
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define FF_LOSS_COLORQUANT
loss due to color quantization
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
int av_picture_crop(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int top_band, int left_band)
static int is_gray(const AVPixFmtDescriptor *desc)
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
Various defines for YUV<->RGB conversion.
void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
four components are given, that's all.
int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, int has_alpha)
Compute what kind of losses will occur when converting from one specific pixel format to another...
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
8 bits with AV_PIX_FMT_RGB32 palette
attribute_deprecated int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
static FF_DISABLE_DEPRECATION_WARNINGS int is_yuv_planar(const AVPixFmtDescriptor *desc)
common internal API header
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
#define FF_LOSS_ALPHA
loss of alpha bits
uint8_t nb_components
The number of components each pixel has, (1-4)
attribute_deprecated uint8_t * data[AV_NUM_DATA_POINTERS]
enum AVPixelFormat pix_fmt
static enum AVPixelFormat avcodec_find_best_pix_fmt1(enum AVPixelFormat *pix_fmt_list, enum AVPixelFormat src_pix_fmt, int has_alpha, int loss_mask)
Libavcodec external API header.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define FF_LOSS_CHROMA
loss of chroma (e.g.
#define FF_LOSS_DEPTH
loss due to color depth change
static const uint8_t color[NB_LEVELS]
#define FF_LOSS_COLORSPACE
loss due to color space conversion
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
common internal and external API header
#define FF_ENABLE_DEPRECATION_WARNINGS
#define FF_LOSS_RESOLUTION
loss due to resolution change
enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
Find the best pixel format to convert to given a certain source pixel format.
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
int depth
Number of bits in the component.
AVPixelFormat
Pixel format.
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.