47 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
48 #define deinterlace_line ff_deinterlace_line_mmx
50 #define deinterlace_line_inplace deinterlace_line_inplace_c
51 #define deinterlace_line deinterlace_line_c
78 if (dst_pix_fmt == src_pix_fmt)
81 for (i = 0; i < nb_components; i++)
111 int dist, i, loss, min_dist;
116 min_dist = 0x7fffffff;
123 "it is either not properly terminated or contains duplicates\n");
130 if (dist < min_dist) {
142 int has_alpha,
int *loss_ptr)
146 static const int loss_mask_order[] = {
159 loss_mask = loss_mask_order[i++];
161 has_alpha, loss_mask);
162 if (dst_pix_fmt >= 0)
176 const uint8_t *src,
int src_wrap,
183 for(;height > 0; height--) {
187 for(w = width;w >= 4; w-=4) {
188 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
189 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
190 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
191 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
197 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
209 const uint8_t *src,
int src_wrap,
213 const uint8_t *s1, *s2, *s3, *s4;
216 for(;height > 0; height--) {
222 for(w = width;w > 0; w--) {
223 d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
224 s2[0] + s2[1] + s2[2] + s2[3] +
225 s3[0] + s3[1] + s3[2] + s3[3] +
226 s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
240 const uint8_t *src,
int src_wrap,
245 for(;height > 0; height--) {
246 for(w = width;w > 0; w--) {
249 tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
252 *(dst++) = (tmp + 32)>>6;
253 src += 8 - 8*src_wrap;
255 src += 8*src_wrap - 8*
width;
256 dst += dst_wrap -
width;
281 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
282 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
304 for (i = 0; i < 3; i++) {
308 if (padtop || padleft) {
309 memset(dst->
data[i], color[i],
310 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
313 if (padleft || padright) {
314 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
315 (dst->
linesize[i] - (padright >> x_shift));
316 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
317 for (y = 0; y < yheight; y++) {
318 memset(optr, color[i], (padleft + padright) >> x_shift);
325 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
326 (padleft >> x_shift);
327 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
329 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
330 (dst->
linesize[i] - (padright >> x_shift));
331 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
332 for (y = 0; y < yheight; y++) {
333 memset(optr, color[i], (padleft + padright) >> x_shift);
334 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
335 (width - padleft - padright) >> x_shift);
341 if (padbottom || padright) {
343 ((height - padbottom) >> y_shift) - (padright >> x_shift);
344 memset(optr, color[i],dst->
linesize[i] *
345 (padbottom >> y_shift) + (padright >> x_shift));
351 #if FF_API_DEINTERLACE
353 #if !HAVE_MMX_EXTERNAL
364 for(;size > 0;size--) {
366 sum += lum_m3[0] << 2;
367 sum += lum_m2[0] << 1;
368 sum += lum_m1[0] << 2;
370 dst[0] = cm[(sum + 4) >> 3];
387 for(;size > 0;size--) {
389 sum += lum_m3[0] << 2;
390 sum += lum_m2[0] << 1;
392 sum += lum_m1[0] << 2;
394 lum_m2[0] = cm[(sum + 4) >> 3];
408 const uint8_t *src1,
int src_wrap,
411 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
416 src_0=&src_m1[src_wrap];
417 src_p1=&src_0[src_wrap];
418 src_p2=&src_p1[src_wrap];
419 for(y=0;y<(height-2);y+=2) {
420 memcpy(dst,src_m1,width);
426 src_p1 += 2*src_wrap;
427 src_p2 += 2*src_wrap;
430 memcpy(dst,src_m1,width);
439 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
445 memcpy(buf,src_m1,width);
446 src_0=&src_m1[src_wrap];
447 src_p1=&src_0[src_wrap];
448 src_p2=&src_p1[src_wrap];
449 for(y=0;y<(height-2);y+=2) {
453 src_p1 += 2*src_wrap;
454 src_p2 += 2*src_wrap;
474 if ((width & 3) != 0 || (height & 3) != 0)