41 #if HAVE_MMX && HAVE_YASM
45 #define FF_COLOR_RGB 0
46 #define FF_COLOR_GRAY 1
47 #define FF_COLOR_YUV 2
48 #define FF_COLOR_YUV_JPEG 3
50 #define FF_PIXEL_PLANAR 0
51 #define FF_PIXEL_PACKED 1
52 #define FF_PIXEL_PALETTE 2
54 #if HAVE_MMX && HAVE_YASM
55 #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
56 #define deinterlace_line ff_deinterlace_line_mmx
58 #define deinterlace_line_inplace deinterlace_line_inplace_c
59 #define deinterlace_line deinterlace_line_c
207 .nb_channels = 4, .is_alpha = 1,
295 .nb_channels = 4, .is_alpha = 1,
307 .nb_channels = 4, .is_alpha = 1,
398 .nb_channels = 4, .is_alpha = 1,
404 .nb_channels = 4, .is_alpha = 1,
417 #if FF_API_GET_PIX_FMT_NAME
444 unsigned char *dest,
int dest_size)
446 int i, j, nb_planes = 0, linesizes[4];
450 if (size > dest_size || size < 0)
458 for (i = 0; i < nb_planes; i++) {
460 const unsigned char *s = src->
data[i];
461 h = (height + (1 << shift) - 1) >> shift;
463 for (j = 0; j < h; j++) {
464 memcpy(dest, s, linesizes[i]);
465 dest += linesizes[i];
471 memcpy((
unsigned char *)(((
size_t)dest + 3) & ~3), src->
data[1], 256 * 4);
501 ps = &pix_fmt_info[src_pix_fmt];
505 pf = &pix_fmt_info[dst_pix_fmt];
609 int dist, i, loss, min_dist;
614 min_dist = 0x7fffffff;
616 for (i = 0; i < 64; i++) {
617 if (pix_fmt_mask & (1ULL << i)) {
621 if (dist < min_dist) {
632 int has_alpha,
int *loss_ptr)
636 static const int loss_mask_order[] = {
649 loss_mask = loss_mask_order[i++];
651 has_alpha, loss_mask);
652 if (dst_pix_fmt >= 0)
668 src->
linesize, pix_fmt, width, height);
673 const uint8_t *src,
int src_wrap,
677 const uint8_t *
s1, *
s2;
680 for(;height > 0; height--) {
684 for(w = width;w >= 4; w-=4) {
685 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
686 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
687 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
688 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
694 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
706 const uint8_t *src,
int src_wrap,
713 for(;height > 0; height--) {
719 for(w = width;w > 0; w--) {
720 d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
721 s2[0] + s2[1] + s2[2] + s2[3] +
722 s3[0] + s3[1] + s3[2] + s3[3] +
723 s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
737 const uint8_t *src,
int src_wrap,
742 for(;height > 0; height--) {
743 for(w = width;w > 0; w--) {
746 tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
749 *(dst++) = (tmp + 32)>>6;
750 src += 8 - 8*src_wrap;
752 src += 8*src_wrap - 8*
width;
753 dst += dst_wrap -
width;
797 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
798 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
819 for (i = 0; i < 3; i++) {
823 if (padtop || padleft) {
824 memset(dst->
data[i], color[i],
825 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
828 if (padleft || padright) {
829 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
830 (dst->
linesize[i] - (padright >> x_shift));
831 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
832 for (y = 0; y < yheight; y++) {
833 memset(optr, color[i], (padleft + padright) >> x_shift);
839 uint8_t *iptr = src->
data[i];
840 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
841 (padleft >> x_shift);
842 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
844 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
845 (dst->
linesize[i] - (padright >> x_shift));
846 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
847 for (y = 0; y < yheight; y++) {
848 memset(optr, color[i], (padleft + padright) >> x_shift);
849 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
850 (width - padleft - padright) >> x_shift);
856 if (padbottom || padright) {
858 ((height - padbottom) >> y_shift) - (padright >> x_shift);
859 memset(optr, color[i],dst->
linesize[i] *
860 (padbottom >> y_shift) + (padright >> x_shift));
866 #if FF_API_GET_ALPHA_INFO
870 const unsigned char *p;
871 int src_wrap, ret, x, y;
876 src_wrap = src->
linesize[0] - width;
878 for(y=0;y<height;y++) {
879 for(x=0;x<
width;x++) {
880 a = palette[p[0]] >> 24;
882 ret |= FF_ALPHA_TRANSP;
883 }
else if (a != 0xff) {
884 ret |= FF_ALPHA_SEMI_TRANSP;
893 int img_get_alpha_info(
const AVPicture *src,
904 ret = get_alpha_info_pal8(src, width, height);
908 ret = FF_ALPHA_TRANSP | FF_ALPHA_SEMI_TRANSP;
915 #if !(HAVE_MMX && HAVE_YASM)
918 const uint8_t *lum_m4,
const uint8_t *lum_m3,
919 const uint8_t *lum_m2,
const uint8_t *lum_m1,
926 for(;size > 0;size--) {
928 sum += lum_m3[0] << 2;
929 sum += lum_m2[0] << 1;
930 sum += lum_m1[0] << 2;
932 dst[0] = cm[(sum + 4) >> 3];
943 uint8_t *lum_m2, uint8_t *lum_m1,
944 uint8_t *lum,
int size)
949 for(;size > 0;size--) {
951 sum += lum_m3[0] << 2;
952 sum += lum_m2[0] << 1;
954 sum += lum_m1[0] << 2;
956 lum_m2[0] = cm[(sum + 4) >> 3];
970 const uint8_t *src1,
int src_wrap,
971 int width,
int height)
973 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
978 src_0=&src_m1[src_wrap];
979 src_p1=&src_0[src_wrap];
980 src_p2=&src_p1[src_wrap];
981 for(y=0;y<(height-2);y+=2) {
982 memcpy(dst,src_m1,width);
988 src_p1 += 2*src_wrap;
989 src_p2 += 2*src_wrap;
992 memcpy(dst,src_m1,width);
999 int width,
int height)
1001 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
1007 memcpy(buf,src_m1,width);
1008 src_0=&src_m1[src_wrap];
1009 src_p1=&src_0[src_wrap];
1010 src_p2=&src_p1[src_wrap];
1011 for(y=0;y<(height-2);y+=2) {
1015 src_p1 += 2*src_wrap;
1016 src_p2 += 2*src_wrap;
1036 if ((width & 3) != 0 || (height & 3) != 0)