[svn] / branches / release-1_3-branch / xvidcore / src / image / image.c Repository:
ViewVC logotype

Diff of /branches/release-1_3-branch/xvidcore/src/image/image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1666, Sat Dec 17 13:57:15 2005 UTC revision 1733, Fri Oct 13 07:38:09 2006 UTC
# Line 19  Line 19 
19   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
22   * $Id: image.c,v 1.35 2005-12-17 13:57:15 syskin Exp $   * $Id: image.c,v 1.36 2006-10-13 07:38:09 Skal Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 34  Line 34 
34  #include "interpolate8x8.h"  #include "interpolate8x8.h"
35  #include "../utils/mem_align.h"  #include "../utils/mem_align.h"
36  #include "../motion/sad.h"  #include "../motion/sad.h"
37    #include "../utils/emms.h"
38    
39  #include "font.h"               /* XXX: remove later */  #include "font.h"               /* XXX: remove later */
40    
# Line 1014  Line 1015 
1015                  p += edged_width/2;                  p += edged_width/2;
1016          }          }
1017  }  }
1018    
1019    /****************************************************************************/
1020    
1021    static void (*deintl_core)(unsigned char *, int width, int height, const int stride) = 0;
1022    extern void xvid_deinterlace_sse(unsigned char *, int width, int height, const int stride);
1023    
1024    #define CLIP_255(x)   ( ((x)&~255) ? ((-(x)) >> (8*sizeof((x))-1))&0xff : (x) )
1025    
1026    static void deinterlace_c(unsigned char *pix, int width, int height, const int bps)
1027    {
1028      pix += bps;
1029      while(width-->0)
1030      {
1031        int p1 = pix[-bps];
1032        int p2 = pix[0];
1033        int p0 = p2;
1034        int j = (height>>1) - 1;
1035        int V;
1036        unsigned char *P = pix++;
1037        while(j-->0)
1038        {
1039          const int  p3 = P[  bps];
1040          const int  p4 = P[2*bps];
1041          V =  ((p1+p3+1)>>1) + ((p2 - ((p0+p4+1)>>1)) >> 2);
1042          P[0] = CLIP_255( V );
1043          p0 = p2;
1044          p1 = p3;
1045          p2 = p4;
1046          P += 2*bps;
1047        }
1048        V =  ((p1+p1+1)>>1) + ((p2 - ((p0+p2+1)>>1)) >> 2);
1049        P[0] = CLIP_255( V );
1050      }
1051    }
1052    #undef CLIP_255
1053    
1054    int xvid_image_deinterlace(xvid_image_t* img, int width, int height, int bottom_first)
1055    {
1056            if (height&1)
1057                    return 0;
1058            if (img->csp!=XVID_CSP_PLANAR && img->csp!=XVID_CSP_I420 && img->csp!=XVID_CSP_YV12)
1059                    return 0;       /* not yet supported */
1060            if (deintl_core==0) {
1061                    const int cpu_flags = check_cpu_features();
1062                    deintl_core = deinterlace_c;
1063    #ifdef ARCH_IS_IA32
1064                    if (cpu_flags & XVID_CPU_MMX)
1065                            deintl_core = xvid_deinterlace_sse;
1066    #endif
1067            }
1068            if (!bottom_first) {
1069                    deintl_core(img->plane[0], width,    height,    img->stride[0]);
1070                    deintl_core(img->plane[1], width>>1, height>>1, img->stride[1]);
1071                    deintl_core(img->plane[2], width>>1, height>>1, img->stride[2]);
1072            }
1073            else {
1074                    deintl_core(img->plane[0] + ( height    -1)*img->stride[0], width,    height,    -img->stride[0]);
1075                    deintl_core(img->plane[1] + ((height>>1)-1)*img->stride[1], width>>1, height>>1, -img->stride[1]);
1076                    deintl_core(img->plane[2] + ((height>>1)-1)*img->stride[2], width>>1, height>>1, -img->stride[2]);
1077            }
1078            emms();
1079    
1080            return 1;
1081    }
1082    

Legend:
Removed from v.1666  
changed lines
  Added in v.1733

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4