47 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
48 #define deinterlace_line ff_deinterlace_line_mmx
50 #define deinterlace_line_inplace deinterlace_line_inplace_c
51 #define deinterlace_line deinterlace_line_c
78 if (dst_pix_fmt == src_pix_fmt)
81 for (i = 0; i < nb_components; i++)
111 int dist, i, loss, min_dist;
116 min_dist = 0x7fffffff;
123 "it is either not properly terminated or contains duplicates\n");
130 if (dist < min_dist) {
142 int has_alpha,
int *loss_ptr)
146 static const int loss_mask_order[] = {
159 loss_mask = loss_mask_order[i++];
161 has_alpha, loss_mask);
162 if (dst_pix_fmt >= 0)
176 const uint8_t *src,
int src_wrap,
183 for(;height > 0; height--) {
187 for(w = width;w >= 4; w-=4) {
188 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
189 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
190 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
191 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
197 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
209 const uint8_t *src,
int src_wrap,
213 const uint8_t *s1, *s2, *s3, *s4;
216 for(;height > 0; height--) {
222 for(w = width;w > 0; w--) {
223 d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
224 s2[0] + s2[1] + s2[2] + s2[3] +
225 s3[0] + s3[1] + s3[2] + s3[3] +
226 s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
240 const uint8_t *src,
int src_wrap,
245 for(;height > 0; height--) {
246 for(w = width;w > 0; w--) {
249 tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
252 *(dst++) = (tmp + 32)>>6;
253 src += 8 - 8*src_wrap;
255 src += 8*src_wrap - 8*
width;
256 dst += dst_wrap -
width;
281 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
282 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
304 for (i = 0; i < 3; i++) {
308 if (padtop || padleft) {
309 memset(dst->
data[i], color[i],
310 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
313 if (padleft || padright) {
314 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
315 (dst->
linesize[i] - (padright >> x_shift));
316 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
317 for (y = 0; y < yheight; y++) {
318 memset(optr, color[i], (padleft + padright) >> x_shift);
325 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
326 (padleft >> x_shift);
327 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
329 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
330 (dst->
linesize[i] - (padright >> x_shift));
331 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
332 for (y = 0; y < yheight; y++) {
333 memset(optr, color[i], (padleft + padright) >> x_shift);
334 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
335 (width - padleft - padright) >> x_shift);
341 if (padbottom || padright) {
343 ((height - padbottom) >> y_shift) - (padright >> x_shift);
344 memset(optr, color[i],dst->
linesize[i] *
345 (padbottom >> y_shift) + (padright >> x_shift));
351 #if FF_API_DEINTERLACE
353 #if !HAVE_MMX_EXTERNAL
364 for(;size > 0;size--) {
366 sum += lum_m3[0] << 2;
367 sum += lum_m2[0] << 1;
368 sum += lum_m1[0] << 2;
370 dst[0] = cm[(sum + 4) >> 3];
387 for(;size > 0;size--) {
389 sum += lum_m3[0] << 2;
390 sum += lum_m2[0] << 1;
392 sum += lum_m1[0] << 2;
394 lum_m2[0] = cm[(sum + 4) >> 3];
408 const uint8_t *src1,
int src_wrap,
411 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
416 src_0=&src_m1[src_wrap];
417 src_p1=&src_0[src_wrap];
418 src_p2=&src_p1[src_wrap];
419 for(y=0;y<(height-2);y+=2) {
420 memcpy(dst,src_m1,width);
426 src_p1 += 2*src_wrap;
427 src_p2 += 2*src_wrap;
430 memcpy(dst,src_m1,width);
439 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
445 memcpy(buf,src_m1,width);
446 src_0=&src_m1[src_wrap];
447 src_p1=&src_0[src_wrap];
448 src_p2=&src_p1[src_wrap];
449 for(y=0;y<(height-2);y+=2) {
453 src_p1 += 2*src_wrap;
454 src_p2 += 2*src_wrap;
474 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
#define FF_LOSS_COLORQUANT
loss due to color quantization
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: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.
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
8 bit with PIX_FMT_RGB32 palette
uint8_t * data[AV_NUM_DATA_POINTERS]
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
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
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).
void av_log(void *avcl, int level, const char *fmt,...)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
#define FF_LOSS_ALPHA
loss of alpha bits
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)
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
#define FF_LOSS_COLORSPACE
loss due to color space conversion
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
common internal and external API header
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.
#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...
AVPixelFormat
Pixel format.
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
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)