46 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
47 #define deinterlace_line ff_deinterlace_line_mmx
49 #define deinterlace_line_inplace deinterlace_line_inplace_c
50 #define deinterlace_line deinterlace_line_c
77 if (dst_pix_fmt == src_pix_fmt)
80 for (i = 0; i < nb_components; i++)
110 int dist, i, loss, min_dist;
115 min_dist = 0x7fffffff;
122 "it is either not properly terminated or contains duplicates\n");
129 if (dist < min_dist) {
139 #if FF_API_FIND_BEST_PIX_FMT
141 int has_alpha,
int *loss_ptr)
147 for (i = 0; i < 64; i++) {
148 if (pix_fmt_mask & (1ULL << i))
159 int has_alpha,
int *loss_ptr)
163 static const int loss_mask_order[] = {
176 loss_mask = loss_mask_order[i++];
178 has_alpha, loss_mask);
179 if (dst_pix_fmt >= 0)
193 const uint8_t *src,
int src_wrap,
200 for(;height > 0; height--) {
204 for(w = width;w >= 4; w-=4) {
205 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
206 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
207 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
208 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
214 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
226 const uint8_t *src,
int src_wrap,
233 for(;height > 0; height--) {
239 for(w = width;w > 0; w--) {
240 d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
241 s2[0] + s2[1] + s2[2] + s2[3] +
242 s3[0] + s3[1] + s3[2] + s3[3] +
243 s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
257 const uint8_t *src,
int src_wrap,
262 for(;height > 0; height--) {
263 for(w = width;w > 0; w--) {
266 tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
269 *(dst++) = (tmp + 32)>>6;
270 src += 8 - 8*src_wrap;
272 src += 8*src_wrap - 8*
width;
273 dst += dst_wrap -
width;
298 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
299 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
321 for (i = 0; i < 3; i++) {
325 if (padtop || padleft) {
326 memset(dst->
data[i], color[i],
327 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
330 if (padleft || padright) {
331 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
332 (dst->
linesize[i] - (padright >> x_shift));
333 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
334 for (y = 0; y < yheight; y++) {
335 memset(optr, color[i], (padleft + padright) >> x_shift);
342 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
343 (padleft >> x_shift);
344 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
346 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
347 (dst->
linesize[i] - (padright >> x_shift));
348 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
349 for (y = 0; y < yheight; y++) {
350 memset(optr, color[i], (padleft + padright) >> x_shift);
351 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
352 (width - padleft - padright) >> x_shift);
358 if (padbottom || padright) {
360 ((height - padbottom) >> y_shift) - (padright >> x_shift);
361 memset(optr, color[i],dst->
linesize[i] *
362 (padbottom >> y_shift) + (padright >> x_shift));
368 #if !HAVE_MMX_EXTERNAL
379 for(;size > 0;size--) {
381 sum += lum_m3[0] << 2;
382 sum += lum_m2[0] << 1;
383 sum += lum_m1[0] << 2;
385 dst[0] = cm[(sum + 4) >> 3];
402 for(;size > 0;size--) {
404 sum += lum_m3[0] << 2;
405 sum += lum_m2[0] << 1;
407 sum += lum_m1[0] << 2;
409 lum_m2[0] = cm[(sum + 4) >> 3];
423 const uint8_t *src1,
int src_wrap,
426 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
431 src_0=&src_m1[src_wrap];
432 src_p1=&src_0[src_wrap];
433 src_p2=&src_p1[src_wrap];
434 for(y=0;y<(height-2);y+=2) {
435 memcpy(dst,src_m1,width);
441 src_p1 += 2*src_wrap;
442 src_p2 += 2*src_wrap;
445 memcpy(dst,src_m1,width);
454 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
460 memcpy(buf,src_m1,width);
461 src_0=&src_m1[src_wrap];
462 src_p1=&src_0[src_wrap];
463 src_p2=&src_p1[src_wrap];
464 for(y=0;y<(height-2);y+=2) {
468 src_p1 += 2*src_wrap;
469 src_p2 += 2*src_wrap;
489 if ((width & 3) != 0 || (height & 3) != 0)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define deinterlace_line_inplace
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static int is_yuv_planar(const AVPixFmtDescriptor *desc)
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
static int is_gray(const AVPixFmtDescriptor *desc)
Various defines for YUV<->RGB conversion.
int av_picture_crop(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int top_band, int left_band)
Crop image top and left side.
void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
four components are given, that's all.
static void deinterlace_bottom_field(uint8_t *dst, int dst_wrap, const uint8_t *src1, int src_wrap, int width, int height)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, int width, int height)
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...
static void deinterlace_line_c(uint8_t *dst, const uint8_t *lum_m4, const uint8_t *lum_m3, const uint8_t *lum_m2, const uint8_t *lum_m1, const uint8_t *lum, int size)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
8 bit with PIX_FMT_RGB32 palette
uint8_t * data[AV_NUM_DATA_POINTERS]
#define FF_LOSS_COLORSPACE
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height)
uint16_t depth_minus1
number of bits in the component minus 1
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
#define FF_LOSS_RESOLUTION
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
void av_log(void *avcl, int level, const char *fmt,...)
int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height)
deinterlace - if not supported return -1
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
uint8_t nb_components
The number of components each pixel has, (1-4)
void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height)
void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
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)
#define FF_LOSS_COLORQUANT
#define PIX_FMT_PLANAR
At least one pixel component is not in the first data plane.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define PIX_FMT_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
common internal and external API header
#define PIX_FMT_ALPHA
The pixel format has an alpha channel.
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
static const uint8_t color[]
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)
Pad image.
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...
AVPixelFormat
Pixel format.
static void deinterlace_line_inplace_c(uint8_t *lum_m4, uint8_t *lum_m3, uint8_t *lum_m2, uint8_t *lum_m1, uint8_t *lum, int size)