Libav
imgconvert.c
Go to the documentation of this file.
1 /*
2  * Misc image conversion routines
3  * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
27 /* TODO:
28  * - write 'ffimg' program to test all the image related stuff
29  * - move all api to slice based system
30  * - integrate deinterlacing, postprocessing and scaling in the conversion process
31  */
32 
33 #include "avcodec.h"
34 #include "imgconvert.h"
35 #include "internal.h"
36 #include "mathops.h"
37 #include "libavutil/colorspace.h"
38 #include "libavutil/common.h"
39 #include "libavutil/pixdesc.h"
40 #include "libavutil/imgutils.h"
41 
42 void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
43 {
44  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
45  *h_shift = desc->log2_chroma_w;
46  *v_shift = desc->log2_chroma_h;
47 }
48 
49 static int is_gray(const AVPixFmtDescriptor *desc)
50 {
51  return desc->nb_components - (desc->flags & AV_PIX_FMT_FLAG_ALPHA) == 1;
52 }
53 
55  enum AVPixelFormat src_pix_fmt,
56  int has_alpha)
57 {
58  const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
59  const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
60  int loss, i, nb_components = FFMIN(src_desc->nb_components,
61  dst_desc->nb_components);
62 
63  /* compute loss */
64  loss = 0;
65 
66  if (dst_pix_fmt == src_pix_fmt)
67  return 0;
68 
69  for (i = 0; i < nb_components; i++)
70  if (src_desc->comp[i].depth_minus1 > dst_desc->comp[i].depth_minus1)
71  loss |= FF_LOSS_DEPTH;
72 
73  if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w ||
74  dst_desc->log2_chroma_h > src_desc->log2_chroma_h)
75  loss |= FF_LOSS_RESOLUTION;
76 
77  if ((src_desc->flags & AV_PIX_FMT_FLAG_RGB) != (dst_desc->flags & AV_PIX_FMT_FLAG_RGB))
78  loss |= FF_LOSS_COLORSPACE;
79 
80  if (has_alpha && !(dst_desc->flags & AV_PIX_FMT_FLAG_ALPHA) &&
81  (src_desc->flags & AV_PIX_FMT_FLAG_ALPHA))
82  loss |= FF_LOSS_ALPHA;
83 
84  if (dst_pix_fmt == AV_PIX_FMT_PAL8 && !is_gray(src_desc))
85  return loss | FF_LOSS_COLORQUANT;
86 
87  if (src_desc->nb_components > dst_desc->nb_components)
88  if (is_gray(dst_desc))
89  loss |= FF_LOSS_CHROMA;
90 
91  return loss;
92 }
93 
95  enum AVPixelFormat src_pix_fmt,
96  int has_alpha,
97  int loss_mask)
98 {
99  int dist, i, loss, min_dist;
100  enum AVPixelFormat dst_pix_fmt;
101 
102  /* find exact color match with smallest size */
103  dst_pix_fmt = AV_PIX_FMT_NONE;
104  min_dist = 0x7fffffff;
105  i = 0;
106  while (pix_fmt_list[i] != AV_PIX_FMT_NONE) {
107  enum AVPixelFormat pix_fmt = pix_fmt_list[i];
108 
109  if (i > AV_PIX_FMT_NB) {
110  av_log(NULL, AV_LOG_ERROR, "Pixel format list longer than expected, "
111  "it is either not properly terminated or contains duplicates\n");
112  return AV_PIX_FMT_NONE;
113  }
114 
115  loss = avcodec_get_pix_fmt_loss(pix_fmt, src_pix_fmt, has_alpha) & loss_mask;
116  if (loss == 0) {
118  if (dist < min_dist) {
119  min_dist = dist;
120  dst_pix_fmt = pix_fmt;
121  }
122  }
123  i++;
124  }
125  return dst_pix_fmt;
126 }
127 
129  enum AVPixelFormat src_pix_fmt,
130  int has_alpha, int *loss_ptr)
131 {
132  enum AVPixelFormat dst_pix_fmt;
133  int loss_mask, i;
134  static const int loss_mask_order[] = {
135  ~0, /* no loss first */
136  ~FF_LOSS_ALPHA,
140  ~FF_LOSS_DEPTH,
141  0,
142  };
143 
144  /* try with successive loss */
145  i = 0;
146  for(;;) {
147  loss_mask = loss_mask_order[i++];
148  dst_pix_fmt = avcodec_find_best_pix_fmt1(pix_fmt_list, src_pix_fmt,
149  has_alpha, loss_mask);
150  if (dst_pix_fmt >= 0)
151  goto found;
152  if (loss_mask == 0)
153  break;
154  }
155  return AV_PIX_FMT_NONE;
156  found:
157  if (loss_ptr)
158  *loss_ptr = avcodec_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
159  return dst_pix_fmt;
160 }
161 
162 /* 2x2 -> 1x1 */
163 void ff_shrink22(uint8_t *dst, int dst_wrap,
164  const uint8_t *src, int src_wrap,
165  int width, int height)
166 {
167  int w;
168  const uint8_t *s1, *s2;
169  uint8_t *d;
170 
171  for(;height > 0; height--) {
172  s1 = src;
173  s2 = s1 + src_wrap;
174  d = dst;
175  for(w = width;w >= 4; w-=4) {
176  d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
177  d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
178  d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
179  d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
180  s1 += 8;
181  s2 += 8;
182  d += 4;
183  }
184  for(;w > 0; w--) {
185  d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
186  s1 += 2;
187  s2 += 2;
188  d++;
189  }
190  src += 2 * src_wrap;
191  dst += dst_wrap;
192  }
193 }
194 
195 /* 4x4 -> 1x1 */
196 void ff_shrink44(uint8_t *dst, int dst_wrap,
197  const uint8_t *src, int src_wrap,
198  int width, int height)
199 {
200  int w;
201  const uint8_t *s1, *s2, *s3, *s4;
202  uint8_t *d;
203 
204  for(;height > 0; height--) {
205  s1 = src;
206  s2 = s1 + src_wrap;
207  s3 = s2 + src_wrap;
208  s4 = s3 + src_wrap;
209  d = dst;
210  for(w = width;w > 0; w--) {
211  d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
212  s2[0] + s2[1] + s2[2] + s2[3] +
213  s3[0] + s3[1] + s3[2] + s3[3] +
214  s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
215  s1 += 4;
216  s2 += 4;
217  s3 += 4;
218  s4 += 4;
219  d++;
220  }
221  src += 4 * src_wrap;
222  dst += dst_wrap;
223  }
224 }
225 
226 /* 8x8 -> 1x1 */
227 void ff_shrink88(uint8_t *dst, int dst_wrap,
228  const uint8_t *src, int src_wrap,
229  int width, int height)
230 {
231  int w, i;
232 
233  for(;height > 0; height--) {
234  for(w = width;w > 0; w--) {
235  int tmp=0;
236  for(i=0; i<8; i++){
237  tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
238  src += src_wrap;
239  }
240  *(dst++) = (tmp + 32)>>6;
241  src += 8 - 8*src_wrap;
242  }
243  src += 8*src_wrap - 8*width;
244  dst += dst_wrap - width;
245  }
246 }
247 
248 /* return true if yuv planar */
249 static inline int is_yuv_planar(const AVPixFmtDescriptor *desc)
250 {
251  return (!(desc->flags & AV_PIX_FMT_FLAG_RGB) &&
252  (desc->flags & AV_PIX_FMT_FLAG_PLANAR));
253 }
254 
255 int av_picture_crop(AVPicture *dst, const AVPicture *src,
256  enum AVPixelFormat pix_fmt, int top_band, int left_band)
257 {
258  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
259  int y_shift;
260  int x_shift;
261 
262  if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB || !is_yuv_planar(desc))
263  return -1;
264 
265  y_shift = desc->log2_chroma_h;
266  x_shift = desc->log2_chroma_w;
267 
268  dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;
269  dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift);
270  dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift);
271 
272  dst->linesize[0] = src->linesize[0];
273  dst->linesize[1] = src->linesize[1];
274  dst->linesize[2] = src->linesize[2];
275  return 0;
276 }
277 
278 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
279  enum AVPixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright,
280  int *color)
281 {
282  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
283  uint8_t *optr;
284  int y_shift;
285  int x_shift;
286  int yheight;
287  int i, y;
288 
289  if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB ||
290  !is_yuv_planar(desc)) return -1;
291 
292  for (i = 0; i < 3; i++) {
293  x_shift = i ? desc->log2_chroma_w : 0;
294  y_shift = i ? desc->log2_chroma_h : 0;
295 
296  if (padtop || padleft) {
297  memset(dst->data[i], color[i],
298  dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
299  }
300 
301  if (padleft || padright) {
302  optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
303  (dst->linesize[i] - (padright >> x_shift));
304  yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
305  for (y = 0; y < yheight; y++) {
306  memset(optr, color[i], (padleft + padright) >> x_shift);
307  optr += dst->linesize[i];
308  }
309  }
310 
311  if (src) { /* first line */
312  uint8_t *iptr = src->data[i];
313  optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
314  (padleft >> x_shift);
315  memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
316  iptr += src->linesize[i];
317  optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
318  (dst->linesize[i] - (padright >> x_shift));
319  yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
320  for (y = 0; y < yheight; y++) {
321  memset(optr, color[i], (padleft + padright) >> x_shift);
322  memcpy(optr + ((padleft + padright) >> x_shift), iptr,
323  (width - padleft - padright) >> x_shift);
324  iptr += src->linesize[i];
325  optr += dst->linesize[i];
326  }
327  }
328 
329  if (padbottom || padright) {
330  optr = dst->data[i] + dst->linesize[i] *
331  ((height - padbottom) >> y_shift) - (padright >> x_shift);
332  memset(optr, color[i],dst->linesize[i] *
333  (padbottom >> y_shift) + (padright >> x_shift));
334  }
335  }
336  return 0;
337 }
338 
339 #if FF_API_DEINTERLACE
340 
341 #if HAVE_MMX_EXTERNAL
342 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
343 #define deinterlace_line ff_deinterlace_line_mmx
344 #else
345 #define deinterlace_line_inplace deinterlace_line_inplace_c
346 #define deinterlace_line deinterlace_line_c
347 
348 /* filter parameters: [-1 4 2 4 -1] // 8 */
349 static void deinterlace_line_c(uint8_t *dst,
350  const uint8_t *lum_m4, const uint8_t *lum_m3,
351  const uint8_t *lum_m2, const uint8_t *lum_m1,
352  const uint8_t *lum,
353  int size)
354 {
355  const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
356  int sum;
357 
358  for(;size > 0;size--) {
359  sum = -lum_m4[0];
360  sum += lum_m3[0] << 2;
361  sum += lum_m2[0] << 1;
362  sum += lum_m1[0] << 2;
363  sum += -lum[0];
364  dst[0] = cm[(sum + 4) >> 3];
365  lum_m4++;
366  lum_m3++;
367  lum_m2++;
368  lum_m1++;
369  lum++;
370  dst++;
371  }
372 }
373 
374 static void deinterlace_line_inplace_c(uint8_t *lum_m4, uint8_t *lum_m3,
375  uint8_t *lum_m2, uint8_t *lum_m1,
376  uint8_t *lum, int size)
377 {
378  const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
379  int sum;
380 
381  for(;size > 0;size--) {
382  sum = -lum_m4[0];
383  sum += lum_m3[0] << 2;
384  sum += lum_m2[0] << 1;
385  lum_m4[0]=lum_m2[0];
386  sum += lum_m1[0] << 2;
387  sum += -lum[0];
388  lum_m2[0] = cm[(sum + 4) >> 3];
389  lum_m4++;
390  lum_m3++;
391  lum_m2++;
392  lum_m1++;
393  lum++;
394  }
395 }
396 #endif /* !HAVE_MMX_EXTERNAL */
397 
398 /* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The
399  top field is copied as is, but the bottom field is deinterlaced
400  against the top field. */
401 static void deinterlace_bottom_field(uint8_t *dst, int dst_wrap,
402  const uint8_t *src1, int src_wrap,
403  int width, int height)
404 {
405  const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
406  int y;
407 
408  src_m2 = src1;
409  src_m1 = src1;
410  src_0=&src_m1[src_wrap];
411  src_p1=&src_0[src_wrap];
412  src_p2=&src_p1[src_wrap];
413  for(y=0;y<(height-2);y+=2) {
414  memcpy(dst,src_m1,width);
415  dst += dst_wrap;
416  deinterlace_line(dst,src_m2,src_m1,src_0,src_p1,src_p2,width);
417  src_m2 = src_0;
418  src_m1 = src_p1;
419  src_0 = src_p2;
420  src_p1 += 2*src_wrap;
421  src_p2 += 2*src_wrap;
422  dst += dst_wrap;
423  }
424  memcpy(dst,src_m1,width);
425  dst += dst_wrap;
426  /* do last line */
427  deinterlace_line(dst,src_m2,src_m1,src_0,src_0,src_0,width);
428 }
429 
430 static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap,
431  int width, int height)
432 {
433  uint8_t *src_m1, *src_0, *src_p1, *src_p2;
434  int y;
435  uint8_t *buf;
436  buf = av_malloc(width);
437 
438  src_m1 = src1;
439  memcpy(buf,src_m1,width);
440  src_0=&src_m1[src_wrap];
441  src_p1=&src_0[src_wrap];
442  src_p2=&src_p1[src_wrap];
443  for(y=0;y<(height-2);y+=2) {
444  deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,width);
445  src_m1 = src_p1;
446  src_0 = src_p2;
447  src_p1 += 2*src_wrap;
448  src_p2 += 2*src_wrap;
449  }
450  /* do last line */
451  deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,width);
452  av_free(buf);
453 }
454 
456  enum AVPixelFormat pix_fmt, int width, int height)
457 {
458  int i;
459 
460  if (pix_fmt != AV_PIX_FMT_YUV420P &&
461  pix_fmt != AV_PIX_FMT_YUVJ420P &&
462  pix_fmt != AV_PIX_FMT_YUV422P &&
463  pix_fmt != AV_PIX_FMT_YUVJ422P &&
464  pix_fmt != AV_PIX_FMT_YUV444P &&
465  pix_fmt != AV_PIX_FMT_YUV411P &&
466  pix_fmt != AV_PIX_FMT_GRAY8)
467  return -1;
468  if ((width & 3) != 0 || (height & 3) != 0)
469  return -1;
470 
471  for(i=0;i<3;i++) {
472  if (i == 1) {
473  switch(pix_fmt) {
474  case AV_PIX_FMT_YUVJ420P:
475  case AV_PIX_FMT_YUV420P:
476  width >>= 1;
477  height >>= 1;
478  break;
479  case AV_PIX_FMT_YUV422P:
480  case AV_PIX_FMT_YUVJ422P:
481  width >>= 1;
482  break;
483  case AV_PIX_FMT_YUV411P:
484  width >>= 2;
485  break;
486  default:
487  break;
488  }
489  if (pix_fmt == AV_PIX_FMT_GRAY8) {
490  break;
491  }
492  }
493  if (src == dst) {
495  width, height);
496  } else {
497  deinterlace_bottom_field(dst->data[i],dst->linesize[i],
498  src->data[i], src->linesize[i],
499  width, height);
500  }
501  }
502  emms_c();
503  return 0;
504 }
505 
506 #endif /* FF_API_DEINTERLACE */
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:62
int size
int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
Definition: avcodec.h:3044
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:1599
#define deinterlace_line_inplace
Definition: imgconvert.c:345
#define FF_LOSS_COLORQUANT
loss due to color quantization
Definition: avcodec.h:4160
int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height)
deinterlace - if not supported return -1
Definition: imgconvert.c:455
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:70
misc image utilities
static int is_yuv_planar(const AVPixFmtDescriptor *desc)
Definition: imgconvert.c:249
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
Definition: pixdesc.c:1571
static int is_gray(const AVPixFmtDescriptor *desc)
Definition: imgconvert.c:49
#define MAX_NEG_CROP
Definition: mathops.h:30
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.
Definition: imgconvert.c:255
void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Definition: imgconvert.c:42
four components are given, that's all.
Definition: avcodec.h:3042
static void deinterlace_bottom_field(uint8_t *dst, int dst_wrap, const uint8_t *src1, int src_wrap, int width, int height)
Definition: imgconvert.c:401
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:80
static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, int width, int height)
Definition: imgconvert.c:430
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...
Definition: imgconvert.c:54
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)
Definition: imgconvert.c:349
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:97
uint8_t
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition: pixdesc.h:138
8 bit with PIX_FMT_RGB32 palette
Definition: pixfmt.h:76
uint8_t * data[AV_NUM_DATA_POINTERS]
Definition: avcodec.h:3043
#define emms_c()
Definition: internal.h:47
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
Definition: pixfmt.h:78
void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height)
Definition: imgconvert.c:196
#define cm
Definition: dvbsubdec.c:34
uint16_t depth_minus1
Number of bits in the component minus 1.
Definition: pixdesc.h:57
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:186
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:89
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:128
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:169
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:69
#define FF_LOSS_ALPHA
loss of alpha bits
Definition: avcodec.h:4159
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:71
void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height)
Definition: imgconvert.c:227
void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height)
Definition: imgconvert.c:163
#define FFMIN(a, b)
Definition: common.h:57
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
Definition: pixfmt.h:77
#define deinterlace_line
Definition: imgconvert.c:346
enum AVPixelFormat pix_fmt
Definition: movenc.c:843
static enum AVPixelFormat avcodec_find_best_pix_fmt1(enum AVPixelFormat *pix_fmt_list, enum AVPixelFormat src_pix_fmt, int has_alpha, int loss_mask)
Definition: imgconvert.c:94
NULL
Definition: eval.c:55
static int width
Definition: utils.c:156
Libavcodec external API header.
uint8_t flags
Definition: pixdesc.h:90
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
#define FF_LOSS_CHROMA
loss of chroma (e.g.
Definition: avcodec.h:4161
#define FF_LOSS_DEPTH
loss due to color depth change
Definition: avcodec.h:4157
#define FF_LOSS_COLORSPACE
loss due to color space conversion
Definition: avcodec.h:4158
int height
Definition: gxfenc.c:72
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:65
Y , 8bpp.
Definition: pixfmt.h:73
common internal api header.
common internal and external API header
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:72
#define ff_crop_tab
static const uint8_t color[]
Definition: log.c:55
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.
Definition: imgconvert.c:278
#define FF_LOSS_RESOLUTION
loss due to resolution change
Definition: avcodec.h:4156
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.
Definition: imgconvert.c:128
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
Definition: pixfmt.h:209
AVPixelFormat
Pixel format.
Definition: pixfmt.h:63
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition: pixdesc.h:124
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)
Definition: imgconvert.c:374