64 #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI
67 int has_alpha,
int *loss_ptr){
80 int has_alpha,
int *loss_ptr){
100 for(;height > 0; height--) {
104 for(w = width;w >= 4; w-=4) {
105 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
106 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
107 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
108 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
114 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
133 for(;height > 0; height--) {
139 for(w = width;w > 0; w--) {
140 d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
141 s2[0] + s2[1] + s2[2] + s2[3] +
142 s3[0] + s3[1] + s3[2] + s3[3] +
143 s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
162 for(;height > 0; height--) {
163 for(w = width;w > 0; w--) {
166 tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
169 *(dst++) = (tmp + 32)>>6;
170 src += 8 - 8*src_wrap;
172 src += 8*src_wrap - 8*
width;
173 dst += dst_wrap -
width;
181 int planes[4] = { 0 };
213 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
214 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
216 if(top_band % (1<<y_shift) || left_band % (1<<x_shift))
250 if (padtop || padleft) {
251 memset(dst->
data[0], color[0],
252 dst->
linesize[0] * padtop + (padleft * max_step[0]));
255 if (padleft || padright) {
257 (dst->
linesize[0] - (padright * max_step[0]));
258 yheight = height - 1 - (padtop + padbottom);
259 for (y = 0; y < yheight; y++) {
260 memset(optr, color[0], (padleft + padright) * max_step[0]);
265 if (padbottom || padright) {
266 optr = dst->
data[0] + dst->
linesize[0] * (height - padbottom) -
267 (padright * max_step[0]);
268 memset(optr, color[0], dst->
linesize[0] * padbottom +
269 (padright * max_step[0]));
275 for (i = 0; i < 3; i++) {
279 if (padtop || padleft) {
280 memset(dst->
data[i], color[i],
281 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
284 if (padleft || padright) {
285 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
286 (dst->
linesize[i] - (padright >> x_shift));
287 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
288 for (y = 0; y < yheight; y++) {
289 memset(optr, color[i], (padleft + padright) >> x_shift);
296 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
297 (padleft >> x_shift);
298 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
300 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
301 (dst->
linesize[i] - (padright >> x_shift));
302 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
303 for (y = 0; y < yheight; y++) {
304 memset(optr, color[i], (padleft + padright) >> x_shift);
305 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
306 (width - padleft - padright) >> x_shift);
312 if (padbottom || padright) {
314 ((height - padbottom) >> y_shift) - (padright >> x_shift);
315 memset(optr, color[i],dst->
linesize[i] *
316 (padbottom >> y_shift) + (padright >> x_shift));
323 #if FF_API_DEINTERLACE
325 #if HAVE_MMX_EXTERNAL
326 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
327 #define deinterlace_line ff_deinterlace_line_mmx
329 #define deinterlace_line_inplace deinterlace_line_inplace_c
330 #define deinterlace_line deinterlace_line_c
342 for(;size > 0;size--) {
344 sum += lum_m3[0] << 2;
345 sum += lum_m2[0] << 1;
346 sum += lum_m1[0] << 2;
348 dst[0] = cm[(sum + 4) >> 3];
365 for(;size > 0;size--) {
367 sum += lum_m3[0] << 2;
368 sum += lum_m2[0] << 1;
370 sum += lum_m1[0] << 2;
372 lum_m2[0] = cm[(sum + 4) >> 3];
386 const uint8_t *src1,
int src_wrap,
389 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
394 src_0=&src_m1[src_wrap];
395 src_p1=&src_0[src_wrap];
396 src_p2=&src_p1[src_wrap];
397 for(y=0;y<(height-2);y+=2) {
398 memcpy(dst,src_m1,width);
404 src_p1 += 2*src_wrap;
405 src_p2 += 2*src_wrap;
408 memcpy(dst,src_m1,width);
417 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
425 memcpy(buf,src_m1,width);
426 src_0=&src_m1[src_wrap];
427 src_p1=&src_0[src_wrap];
428 src_p2=&src_p1[src_wrap];
429 for(y=0;y<(height-2);y+=2) {
433 src_p1 += 2*src_wrap;
434 src_p2 += 2*src_wrap;
455 if ((width & 3) != 0 || (height & 3) != 0)
507 if(!desc || !desc->
name) {
static enum AVPixelFormat pix_fmt
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
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)
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.
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.
int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, int has_alpha)
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)
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], const AVPixFmtDescriptor *pixdesc)
Compute the max pixel step for each plane of an image with a format described by pixdesc.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointers to the image data planes
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)
#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).
int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel for the pixel format described by pixdesc, including any padding ...
enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const 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.
simple assert() macros that are a bit more flexible than ISO C assert().
Libavcodec external API header.
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_...
void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
#define AV_LOG_INFO
Standard information.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
BYTE int const BYTE int int int height
int av_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 double lum(void *priv, double x, double y)
uint16_t plane
Which of the 4 planes contains the component.
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)
enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
Compute what kind of losses will occur when converting from one specific pixel format to another...
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.
static int deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, int width, int height)
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
int main(int argc, char **argv)
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)