46 #define FF_COLOR_NA -1
47 #define FF_COLOR_RGB 0
48 #define FF_COLOR_GRAY 1
49 #define FF_COLOR_YUV 2
50 #define FF_COLOR_YUV_JPEG 3
53 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
54 #define deinterlace_line ff_deinterlace_line_mmx
56 #define deinterlace_line_inplace deinterlace_line_inplace_c
57 #define deinterlace_line deinterlace_line_c
60 #define pixdesc_has_alpha(pixdesc) \
61 ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & PIX_FMT_PAL)
76 if(desc->
name && !strncmp(desc->
name,
"yuvj", 4))
98 *min = INT_MAX, *max = -INT_MAX;
112 int src_color, dst_color;
113 int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
114 int ret, loss, i, nb_components;
122 if (dst_pix_fmt == src_pix_fmt)
134 for (i = 0; i < nb_components; i++)
164 if (src_color != dst_color)
180 #if FF_API_FIND_BEST_PIX_FMT
182 int has_alpha,
int *loss_ptr)
192 if (pix_fmt_mask & (1ULL << i))
200 enum AVPixelFormat src_pix_fmt,
int has_alpha,
int *loss_ptr)
203 int loss1, loss2, loss_order1, loss_order2, i, loss_mask;
206 static const int loss_mask_order[] = {
221 loss_mask= loss_ptr?~*loss_ptr:~0;
227 for(i = 0;loss_mask_order[i] != 0 && dst_pix_fmt ==
AV_PIX_FMT_NONE;i++) {
228 loss_order1 = loss1 & loss_mask_order[i];
229 loss_order2 = loss2 & loss_mask_order[i];
237 }
else if (loss_order1 == 0 || loss_order2 == 0) {
238 dst_pix_fmt = loss_order2 ? dst_pix_fmt1 : dst_pix_fmt2;
247 #if AV_HAVE_INCOMPATIBLE_FORK_ABI
250 int has_alpha,
int *loss_ptr){
255 enum AVPixelFormat src_pix_fmt,
int has_alpha,
int *loss_ptr)
263 int has_alpha,
int *loss_ptr){
276 const uint8_t *src,
int src_wrap,
283 for(;height > 0; height--) {
287 for(w = width;w >= 4; w-=4) {
288 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
289 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
290 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
291 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
297 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
309 const uint8_t *src,
int src_wrap,
316 for(;height > 0; height--) {
322 for(w = width;w > 0; w--) {
323 d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
324 s2[0] + s2[1] + s2[2] + s2[3] +
325 s3[0] + s3[1] + s3[2] + s3[3] +
326 s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
340 const uint8_t *src,
int src_wrap,
345 for(;height > 0; height--) {
346 for(w = width;w > 0; w--) {
349 tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
352 *(dst++) = (tmp + 32)>>6;
353 src += 8 - 8*src_wrap;
355 src += 8*src_wrap - 8*
width;
356 dst += dst_wrap -
width;
364 int planes[4] = { 0 };
396 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
397 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
399 if(top_band % (1<<y_shift) || left_band % (1<<x_shift))
426 for (i = 0; i < 3; i++) {
430 if (padtop || padleft) {
431 memset(dst->
data[i], color[i],
432 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
435 if (padleft || padright) {
436 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
437 (dst->
linesize[i] - (padright >> x_shift));
438 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
439 for (y = 0; y < yheight; y++) {
440 memset(optr, color[i], (padleft + padright) >> x_shift);
447 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
448 (padleft >> x_shift);
449 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
451 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
452 (dst->
linesize[i] - (padright >> x_shift));
453 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
454 for (y = 0; y < yheight; y++) {
455 memset(optr, color[i], (padleft + padright) >> x_shift);
456 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
457 (width - padleft - padright) >> x_shift);
463 if (padbottom || padright) {
465 ((height - padbottom) >> y_shift) - (padright >> x_shift);
466 memset(optr, color[i],dst->
linesize[i] *
467 (padbottom >> y_shift) + (padright >> x_shift));
473 #if !HAVE_MMX_EXTERNAL
484 for(;size > 0;size--) {
486 sum += lum_m3[0] << 2;
487 sum += lum_m2[0] << 1;
488 sum += lum_m1[0] << 2;
490 dst[0] = cm[(sum + 4) >> 3];
507 for(;size > 0;size--) {
509 sum += lum_m3[0] << 2;
510 sum += lum_m2[0] << 1;
512 sum += lum_m1[0] << 2;
514 lum_m2[0] = cm[(sum + 4) >> 3];
528 const uint8_t *src1,
int src_wrap,
531 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
536 src_0=&src_m1[src_wrap];
537 src_p1=&src_0[src_wrap];
538 src_p2=&src_p1[src_wrap];
539 for(y=0;y<(height-2);y+=2) {
540 memcpy(dst,src_m1,width);
546 src_p1 += 2*src_wrap;
547 src_p2 += 2*src_wrap;
550 memcpy(dst,src_m1,width);
559 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
565 memcpy(buf,src_m1,width);
566 src_0=&src_m1[src_wrap];
567 src_p1=&src_0[src_wrap];
568 src_p2=&src_p1[src_wrap];
569 for(y=0;y<(height-2);y+=2) {
573 src_p1 += 2*src_wrap;
574 src_p2 += 2*src_wrap;
594 if ((width & 3) != 0 || (height & 3) != 0)
641 if(!desc || !desc->
name) {