+ Bug fixes to test card handling
[melted] / src / modules / gtk2 / pixops.c
index 5956b6e..a835f70 100644 (file)
@@ -59,7 +59,7 @@ typedef void ( *PixopsPixelFunc ) ( guchar *dest, guint y1, guint cr, guint y2,
 
 /* mmx function declarations */
 #ifdef USE_MMX
-guchar *pixops_scale_line_22_33_mmx ( guint32 weights[ 16 ][ 8 ], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init );
+guchar *pixops_scale_line_22_yuv_mmx ( guint32 weights[ 16 ][ 8 ], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init, int destx );
 int pixops_have_mmx ( void );
 #endif
 
@@ -158,7 +158,7 @@ scale_line ( int *weights, int n_x, int n_y,
 
 #ifdef USE_MMX
 static inline guchar *
-scale_line_22_33_mmx_stub ( int *weights, int n_x, int n_y,
+scale_line_22_yuv_mmx_stub ( int *weights, int n_x, int n_y,
                             guchar *dest, int dest_x, guchar *dest_end,
                             guchar **src,
                             int x_init, int x_step, int src_width )
@@ -178,12 +178,12 @@ scale_line_22_33_mmx_stub ( int *weights, int n_x, int n_y,
                mmx_weights[ j ][ 7 ] = 0x00010001 * ( weights[ 4 * j + 3 ] >> 8 );
        }
 
-       return pixops_scale_line_22_33_mmx ( mmx_weights, dest, src[ 0 ], src[ 1 ], x_step, dest_end, x_init );
+       return pixops_scale_line_22_yuv_mmx ( mmx_weights, dest, src[ 0 ], src[ 1 ], x_step, dest_end, x_init, dest_x );
 }
 #endif /* USE_MMX */
 
 static inline guchar *
-scale_line_22_33 ( int *weights, int n_x, int n_y,
+scale_line_22_yuv ( int *weights, int n_x, int n_y,
                    guchar *dest, int dest_x, guchar *dest_end,
                    guchar **src,
                    int x_init, int x_step, int src_width )
@@ -218,17 +218,19 @@ scale_line_22_33 ( int *weights, int n_x, int n_y,
 
                /* process U/V */
                x_aligned = ( ( x_scaled >> 1 ) << 2 );
+               uv_index = ( ( dest_x & 1 ) << 1 ) + 1;
+               
                q0 = src0 + x_aligned;
                q1 = src1 + x_aligned;
-               uv_index = ( ( dest_x & 1 ) << 1 ) + 1;
                p  = w1 * q0[ uv_index ];
-               p += w2 * q0[ uv_index ];
                p += w3 * q1[ uv_index ];
+               p += w2 * q0[ uv_index ];
                p += w4 * q1[ uv_index ];
-               *dest++ = ( p + 0x8000 ) >> SCALE_SHIFT;
-
+               
                x += x_step;
-               dest_x++;
+               dest_x ++;
+
+               *dest++ = ( p + 0x8000 ) >> SCALE_SHIFT;
        }
 
        return dest;
@@ -739,12 +741,15 @@ yuv422_scale ( guchar *dest_buf,
        if ( filter.x.n == 2 && filter.y.n == 2 )
        {
 #ifdef USE_MMX
-               if ( 0 && found_mmx )
-                       line_func = scale_line_22_33_mmx_stub;
+               if ( found_mmx )
+               {
+                       //fprintf( stderr, "rescale: using mmx\n" );
+                       line_func = scale_line_22_yuv_mmx_stub;
+               }
                else
 #endif
 
-                       line_func = scale_line_22_33;
+                       line_func = scale_line_22_yuv;
        }
        else
                line_func = scale_line;