46 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
47 #define deinterlace_line ff_deinterlace_line_mmx
49 #define deinterlace_line_inplace deinterlace_line_inplace_c
50 #define deinterlace_line deinterlace_line_c
77 if (dst_pix_fmt == src_pix_fmt)
80 for (i = 0; i < nb_components; i++)
110 int dist, i, loss, min_dist;
115 min_dist = 0x7fffffff;
122 "it is either not properly terminated or contains duplicates\n");
129 if (dist < min_dist) {
139 #if FF_API_FIND_BEST_PIX_FMT
141 int has_alpha,
int *loss_ptr)
147 for (i = 0; i < 64; i++) {
148 if (pix_fmt_mask & (1ULL << i))
159 int has_alpha,
int *loss_ptr)
163 static const int loss_mask_order[] = {
176 loss_mask = loss_mask_order[i++];
178 has_alpha, loss_mask);
179 if (dst_pix_fmt >= 0)
193 const uint8_t *src,
int src_wrap,
200 for(;height > 0; height--) {
204 for(w = width;w >= 4; w-=4) {
205 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
206 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
207 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
208 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
214 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
226 const uint8_t *src,
int src_wrap,
233 for(;height > 0; height--) {
239 for(w = width;w > 0; w--) {
240 d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
241 s2[0] + s2[1] + s2[2] + s2[3] +
242 s3[0] + s3[1] + s3[2] + s3[3] +
243 s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
257 const uint8_t *src,
int src_wrap,
262 for(;height > 0; height--) {
263 for(w = width;w > 0; w--) {
266 tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
269 *(dst++) = (tmp + 32)>>6;
270 src += 8 - 8*src_wrap;
272 src += 8*src_wrap - 8*
width;
273 dst += dst_wrap -
width;
298 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
299 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
321 for (i = 0; i < 3; i++) {
325 if (padtop || padleft) {
326 memset(dst->
data[i], color[i],
327 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
330 if (padleft || padright) {
331 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
332 (dst->
linesize[i] - (padright >> x_shift));
333 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
334 for (y = 0; y < yheight; y++) {
335 memset(optr, color[i], (padleft + padright) >> x_shift);
342 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
343 (padleft >> x_shift);
344 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
346 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
347 (dst->
linesize[i] - (padright >> x_shift));
348 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
349 for (y = 0; y < yheight; y++) {
350 memset(optr, color[i], (padleft + padright) >> x_shift);
351 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
352 (width - padleft - padright) >> x_shift);
358 if (padbottom || padright) {
360 ((height - padbottom) >> y_shift) - (padright >> x_shift);
361 memset(optr, color[i],dst->
linesize[i] *
362 (padbottom >> y_shift) + (padright >> x_shift));
368 #if !HAVE_MMX_EXTERNAL
379 for(;size > 0;size--) {
381 sum += lum_m3[0] << 2;
382 sum += lum_m2[0] << 1;
383 sum += lum_m1[0] << 2;
385 dst[0] = cm[(sum + 4) >> 3];
402 for(;size > 0;size--) {
404 sum += lum_m3[0] << 2;
405 sum += lum_m2[0] << 1;
407 sum += lum_m1[0] << 2;
409 lum_m2[0] = cm[(sum + 4) >> 3];
423 const uint8_t *src1,
int src_wrap,
426 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
431 src_0=&src_m1[src_wrap];
432 src_p1=&src_0[src_wrap];
433 src_p2=&src_p1[src_wrap];
434 for(y=0;y<(height-2);y+=2) {
435 memcpy(dst,src_m1,width);
441 src_p1 += 2*src_wrap;
442 src_p2 += 2*src_wrap;
445 memcpy(dst,src_m1,width);
454 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
460 memcpy(buf,src_m1,width);
461 src_0=&src_m1[src_wrap];
462 src_p1=&src_0[src_wrap];
463 src_p2=&src_p1[src_wrap];
464 for(y=0;y<(height-2);y+=2) {
468 src_p1 += 2*src_wrap;
469 src_p2 += 2*src_wrap;
489 if ((width & 3) != 0 || (height & 3) != 0)