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))
243 for (i = 0; i < 3; i++) {
247 if (padtop || padleft) {
248 memset(dst->
data[i], color[i],
249 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
252 if (padleft || padright) {
253 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
254 (dst->
linesize[i] - (padright >> x_shift));
255 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
256 for (y = 0; y < yheight; y++) {
257 memset(optr, color[i], (padleft + padright) >> x_shift);
264 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
265 (padleft >> x_shift);
266 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
268 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
269 (dst->
linesize[i] - (padright >> x_shift));
270 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
271 for (y = 0; y < yheight; y++) {
272 memset(optr, color[i], (padleft + padright) >> x_shift);
273 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
274 (width - padleft - padright) >> x_shift);
280 if (padbottom || padright) {
282 ((height - padbottom) >> y_shift) - (padright >> x_shift);
283 memset(optr, color[i],dst->
linesize[i] *
284 (padbottom >> y_shift) + (padright >> x_shift));
290 #if FF_API_DEINTERLACE
292 #if HAVE_MMX_EXTERNAL
293 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
294 #define deinterlace_line ff_deinterlace_line_mmx
296 #define deinterlace_line_inplace deinterlace_line_inplace_c
297 #define deinterlace_line deinterlace_line_c
309 for(;size > 0;size--) {
311 sum += lum_m3[0] << 2;
312 sum += lum_m2[0] << 1;
313 sum += lum_m1[0] << 2;
315 dst[0] = cm[(sum + 4) >> 3];
332 for(;size > 0;size--) {
334 sum += lum_m3[0] << 2;
335 sum += lum_m2[0] << 1;
337 sum += lum_m1[0] << 2;
339 lum_m2[0] = cm[(sum + 4) >> 3];
353 const uint8_t *src1,
int src_wrap,
356 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
361 src_0=&src_m1[src_wrap];
362 src_p1=&src_0[src_wrap];
363 src_p2=&src_p1[src_wrap];
364 for(y=0;y<(height-2);y+=2) {
365 memcpy(dst,src_m1,width);
371 src_p1 += 2*src_wrap;
372 src_p2 += 2*src_wrap;
375 memcpy(dst,src_m1,width);
384 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
392 memcpy(buf,src_m1,width);
393 src_0=&src_m1[src_wrap];
394 src_p1=&src_0[src_wrap];
395 src_p2=&src_p1[src_wrap];
396 for(y=0;y<(height-2);y+=2) {
400 src_p1 += 2*src_wrap;
401 src_p2 += 2*src_wrap;
422 if ((width & 3) != 0 || (height & 3) != 0)
474 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)
#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 AV_PIX_FMT_YUV422P and setting col...
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)
static double lum(void *priv, double x, double y, int plane)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
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...
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)