47 #define FF_COLOR_NA -1
48 #define FF_COLOR_RGB 0
49 #define FF_COLOR_GRAY 1
50 #define FF_COLOR_YUV 2
51 #define FF_COLOR_YUV_JPEG 3
54 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
55 #define deinterlace_line ff_deinterlace_line_mmx
57 #define deinterlace_line_inplace deinterlace_line_inplace_c
58 #define deinterlace_line deinterlace_line_c
61 #define pixdesc_has_alpha(pixdesc) \
62 ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL)
80 if(desc->
name && !strncmp(desc->
name,
"yuvj", 4))
102 *min = INT_MAX, *max = -INT_MAX;
112 unsigned *lossp,
unsigned consider)
116 int src_color, dst_color;
117 int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
118 int ret, loss, i, nb_components;
119 int score = INT_MAX - 1;
127 if (dst_pix_fmt == src_pix_fmt)
139 for (i = 0; i < nb_components; i++)
184 if (src_color != dst_color)
188 if(loss & FF_LOSS_COLORSPACE)
222 enum AVPixelFormat src_pix_fmt,
int has_alpha,
int *loss_ptr)
225 int loss1, loss2, loss_mask;
230 loss_mask= loss_ptr?~*loss_ptr:~0;
238 if (score1 == score2) {
245 dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
253 #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI
256 int has_alpha,
int *loss_ptr){
261 enum AVPixelFormat src_pix_fmt,
int has_alpha,
int *loss_ptr)
269 int has_alpha,
int *loss_ptr){
289 for(;height > 0; height--) {
293 for(w = width;w >= 4; w-=4) {
294 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
295 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
296 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
297 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
303 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
322 for(;height > 0; height--) {
328 for(w = width;w > 0; w--) {
329 d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
330 s2[0] + s2[1] + s2[2] + s2[3] +
331 s3[0] + s3[1] + s3[2] + s3[3] +
332 s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
351 for(;height > 0; height--) {
352 for(w = width;w > 0; w--) {
355 tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
358 *(dst++) = (tmp + 32)>>6;
359 src += 8 - 8*src_wrap;
361 src += 8*src_wrap - 8*
width;
362 dst += dst_wrap -
width;
370 int planes[4] = { 0 };
402 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
403 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
405 if(top_band % (1<<y_shift) || left_band % (1<<x_shift))
432 for (i = 0; i < 3; i++) {
436 if (padtop || padleft) {
437 memset(dst->
data[i], color[i],
438 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
441 if (padleft || padright) {
442 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
443 (dst->
linesize[i] - (padright >> x_shift));
444 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
445 for (y = 0; y < yheight; y++) {
446 memset(optr, color[i], (padleft + padright) >> x_shift);
453 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
454 (padleft >> x_shift);
455 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
457 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
458 (dst->
linesize[i] - (padright >> x_shift));
459 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
460 for (y = 0; y < yheight; y++) {
461 memset(optr, color[i], (padleft + padright) >> x_shift);
462 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
463 (width - padleft - padright) >> x_shift);
469 if (padbottom || padright) {
471 ((height - padbottom) >> y_shift) - (padright >> x_shift);
472 memset(optr, color[i],dst->
linesize[i] *
473 (padbottom >> y_shift) + (padright >> x_shift));
479 #if FF_API_DEINTERLACE
481 #if !HAVE_MMX_EXTERNAL
492 for(;size > 0;size--) {
494 sum += lum_m3[0] << 2;
495 sum += lum_m2[0] << 1;
496 sum += lum_m1[0] << 2;
498 dst[0] = cm[(sum + 4) >> 3];
515 for(;size > 0;size--) {
517 sum += lum_m3[0] << 2;
518 sum += lum_m2[0] << 1;
520 sum += lum_m1[0] << 2;
522 lum_m2[0] = cm[(sum + 4) >> 3];
536 const uint8_t *src1,
int src_wrap,
539 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
544 src_0=&src_m1[src_wrap];
545 src_p1=&src_0[src_wrap];
546 src_p2=&src_p1[src_wrap];
547 for(y=0;y<(height-2);y+=2) {
548 memcpy(dst,src_m1,width);
554 src_p1 += 2*src_wrap;
555 src_p2 += 2*src_wrap;
558 memcpy(dst,src_m1,width);
567 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
573 memcpy(buf,src_m1,width);
574 src_0=&src_m1[src_wrap];
575 src_p1=&src_0[src_wrap];
576 src_p2=&src_p1[src_wrap];
577 for(y=0;y<(height-2);y+=2) {
581 src_p1 += 2*src_wrap;
582 src_p2 += 2*src_wrap;
602 if ((width & 3) != 0 || (height & 3) != 0)
651 if(!desc || !desc->
name) {