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 if (pix_fmt_mask & (1ULL << i)) {
620 if (dist < min_dist) {
631 int has_alpha,
int *loss_ptr)
635 static const int loss_mask_order[] = {
648 loss_mask = loss_mask_order[i++];
650 has_alpha, loss_mask);
651 if (dst_pix_fmt >= 0)
667 src->
linesize, pix_fmt, width, height);
672 const uint8_t *src,
int src_wrap,
676 const uint8_t *
s1, *
s2;
679 for(;height > 0; height--) {
683 for(w = width;w >= 4; w-=4) {
684 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
685 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
686 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
687 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
693 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
705 const uint8_t *src,
int src_wrap,
712 for(;height > 0; height--) {
718 for(w = width;w > 0; w--) {
719 d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
720 s2[0] + s2[1] + s2[2] + s2[3] +
721 s3[0] + s3[1] + s3[2] + s3[3] +
722 s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
736 const uint8_t *src,
int src_wrap,
741 for(;height > 0; height--) {
742 for(w = width;w > 0; w--) {
745 tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
748 *(dst++) = (tmp + 32)>>6;
749 src += 8 - 8*src_wrap;
751 src += 8*src_wrap - 8*
width;
752 dst += dst_wrap -
width;
796 dst->
data[1] = src->
data[1] + ((top_band >> y_shift) * src->
linesize[1]) + (left_band >> x_shift);
797 dst->
data[2] = src->
data[2] + ((top_band >> y_shift) * src->
linesize[2]) + (left_band >> x_shift);
818 for (i = 0; i < 3; i++) {
822 if (padtop || padleft) {
823 memset(dst->
data[i], color[i],
824 dst->
linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
827 if (padleft || padright) {
828 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
829 (dst->
linesize[i] - (padright >> x_shift));
830 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
831 for (y = 0; y < yheight; y++) {
832 memset(optr, color[i], (padleft + padright) >> x_shift);
838 uint8_t *iptr = src->
data[i];
839 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
840 (padleft >> x_shift);
841 memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
843 optr = dst->
data[i] + dst->
linesize[i] * (padtop >> y_shift) +
844 (dst->
linesize[i] - (padright >> x_shift));
845 yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
846 for (y = 0; y < yheight; y++) {
847 memset(optr, color[i], (padleft + padright) >> x_shift);
848 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
849 (width - padleft - padright) >> x_shift);
855 if (padbottom || padright) {
857 ((height - padbottom) >> y_shift) - (padright >> x_shift);
858 memset(optr, color[i],dst->
linesize[i] *
859 (padbottom >> y_shift) + (padright >> x_shift));
865 #if FF_API_GET_ALPHA_INFO
869 const unsigned char *p;
870 int src_wrap, ret, x, y;
875 src_wrap = src->
linesize[0] - width;
877 for(y=0;y<height;y++) {
878 for(x=0;x<
width;x++) {
879 a = palette[p[0]] >> 24;
881 ret |= FF_ALPHA_TRANSP;
882 }
else if (a != 0xff) {
883 ret |= FF_ALPHA_SEMI_TRANSP;
892 int img_get_alpha_info(
const AVPicture *src,
903 ret = get_alpha_info_pal8(src, width, height);
907 ret = FF_ALPHA_TRANSP | FF_ALPHA_SEMI_TRANSP;
914 #if !(HAVE_MMX && HAVE_YASM)
917 const uint8_t *lum_m4,
const uint8_t *lum_m3,
918 const uint8_t *lum_m2,
const uint8_t *lum_m1,
925 for(;size > 0;size--) {
927 sum += lum_m3[0] << 2;
928 sum += lum_m2[0] << 1;
929 sum += lum_m1[0] << 2;
931 dst[0] = cm[(sum + 4) >> 3];
942 uint8_t *lum_m2, uint8_t *lum_m1,
943 uint8_t *lum,
int size)
948 for(;size > 0;size--) {
950 sum += lum_m3[0] << 2;
951 sum += lum_m2[0] << 1;
953 sum += lum_m1[0] << 2;
955 lum_m2[0] = cm[(sum + 4) >> 3];
969 const uint8_t *src1,
int src_wrap,
970 int width,
int height)
972 const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
977 src_0=&src_m1[src_wrap];
978 src_p1=&src_0[src_wrap];
979 src_p2=&src_p1[src_wrap];
980 for(y=0;y<(height-2);y+=2) {
981 memcpy(dst,src_m1,width);
987 src_p1 += 2*src_wrap;
988 src_p2 += 2*src_wrap;
991 memcpy(dst,src_m1,width);
998 int width,
int height)
1000 uint8_t *src_m1, *src_0, *src_p1, *src_p2;
1006 memcpy(buf,src_m1,width);
1007 src_0=&src_m1[src_wrap];
1008 src_p1=&src_0[src_wrap];
1009 src_p2=&src_p1[src_wrap];
1010 for(y=0;y<(height-2);y+=2) {
1014 src_p1 += 2*src_wrap;
1015 src_p2 += 2*src_wrap;
1035 if ((width & 3) != 0 || (height & 3) != 0)