2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-22 23:27:17 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2002-03-19 04:10:06 +00:00
|
|
|
/*#define DEBUG_ENABLED */
|
2001-12-22 23:27:17 +00:00
|
|
|
|
|
|
|
#include "gstvideoscale.h"
|
|
|
|
|
|
|
|
/* scalers */
|
|
|
|
void gst_videoscale_generate_rowbytes_x86 (unsigned char *copy_row, int src_w, int dst_w, int bpp);
|
2001-12-23 04:38:38 +00:00
|
|
|
void gst_videoscale_scale_nearest_x86 (GstVideoscale *scale,
|
2001-12-22 23:27:17 +00:00
|
|
|
unsigned char *src, unsigned char *dest,
|
|
|
|
int sw, int sh, int dw, int dh);
|
|
|
|
|
|
|
|
#define PREFIX16 0x66
|
|
|
|
#define STORE_BYTE 0xAA
|
|
|
|
#define STORE_WORD 0xAB
|
|
|
|
#define LOAD_BYTE 0xAC
|
|
|
|
#define LOAD_WORD 0xAD
|
|
|
|
#define RETURN 0xC3
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_videoscale_generate_rowbytes_x86 (unsigned char *copy_row, int src_w, int dst_w, int bpp)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int pos, inc;
|
|
|
|
unsigned char *eip;
|
|
|
|
unsigned char load, store;
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("videoscale: setup scaling %p", copy_row);
|
2001-12-22 23:27:17 +00:00
|
|
|
|
|
|
|
switch (bpp) {
|
|
|
|
case 1:
|
|
|
|
load = LOAD_BYTE;
|
|
|
|
store = STORE_BYTE;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 4:
|
|
|
|
load = LOAD_WORD;
|
|
|
|
store = STORE_WORD;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pos = 0x10000;
|
|
|
|
inc = (src_w << 16) / dst_w;
|
|
|
|
eip = copy_row;
|
|
|
|
for ( i=0; i<dst_w; ++i ) {
|
|
|
|
while ( pos >= 0x10000L ) {
|
|
|
|
if ( bpp == 2 ) {
|
|
|
|
*eip++ = PREFIX16;
|
|
|
|
}
|
|
|
|
*eip++ = load;
|
|
|
|
pos -= 0x10000L;
|
|
|
|
}
|
|
|
|
if ( bpp == 2 ) {
|
|
|
|
*eip++ = PREFIX16;
|
|
|
|
}
|
|
|
|
*eip++ = store;
|
|
|
|
pos += inc;
|
|
|
|
}
|
|
|
|
*eip++ = RETURN;
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("scaler start/end %p %p %p", copy_row, eip, (void*)(eip-copy_row));
|
2001-12-22 23:27:17 +00:00
|
|
|
}
|
|
|
|
|