[MN-dev] [mndiff]: r48 - in trunk/2010: 2010.cc 2010.cur 2010.h 2_71x6.cc 2_71x6.h 2_all.h 2_crypt.cc 2_file.cc 2_gfunc.cc 2_gfunc.h 2_grafix.cc 2_grafix.h 2_hw.cc 2_hw.h 2_hw_asm.s 2_hw_mem.cc 2_hw_mem.h 2_menu.h 2_mfunc.h 2_mouse.cc 2_mouse.h 2_move.cc 2_move.h 2_nag.cc 2_vc.cc 2_wins.cc 2_wins.h makefile
michael
subversion at mplayerhq.hu
Wed Jul 4 08:49:52 CEST 2007
Author: michael
Date: Wed Jul 4 08:49:51 2007
New Revision: 48
Log:
version from 1998-07-08
Removed:
trunk/2010/2010.cur
trunk/2010/2_menu.h
trunk/2010/2_mfunc.h
trunk/2010/2_mouse.cc
trunk/2010/2_mouse.h
trunk/2010/2_move.cc
trunk/2010/2_move.h
trunk/2010/2_wins.cc
trunk/2010/2_wins.h
Modified:
trunk/2010/2010.cc
trunk/2010/2010.h
trunk/2010/2_71x6.cc
trunk/2010/2_71x6.h
trunk/2010/2_all.h
trunk/2010/2_crypt.cc
trunk/2010/2_file.cc
trunk/2010/2_gfunc.cc
trunk/2010/2_gfunc.h
trunk/2010/2_grafix.cc
trunk/2010/2_grafix.h
trunk/2010/2_hw.cc
trunk/2010/2_hw.h
trunk/2010/2_hw_asm.s
trunk/2010/2_hw_mem.cc
trunk/2010/2_hw_mem.h
trunk/2010/2_nag.cc
trunk/2010/2_vc.cc
trunk/2010/makefile
Modified: trunk/2010/2010.cc
==============================================================================
--- trunk/2010/2010.cc (original)
+++ trunk/2010/2010.cc Wed Jul 4 08:49:51 2007
@@ -8,47 +8,54 @@
#include <sys/nearptr.h>
#include <unistd.h>
#include <conio.h>
+#include <keys.h>
#include <crt0.h>
+#include <ctype.h>
#include <signal.h>
#include "2_all.h"
#include "2010.h"
#include "2_hw.h"
#include "2_hw_mem.h"
-#include "2_mouse.h"
#include "2_file.h"
-#include "2_menu.h"
#include "2_grafix.h"
+#include "2_crypt.h"
#include "2_71x6.h"
#include "2_nag.h"
- extern mouse_sprites cursor;
+ extern volatile bool oneField;
+ extern bool vSmoothState;
extern int g_mode;
- extern xxx dispbuf, *doubleBuff;
+ extern VID2MEMBUF *vid2MemBuf, *actVid2MemBufp;
extern byte *vidbuf;
- extern int mouse_x, mouse_y, mouse_b;
extern volatile int page_flip;
extern int vgax, vgay, xresvb, xresc, vb, mc;
extern int active_meteor;
- extern int me, mx, my;
extern int yuvmode;
- extern byte *mouse_buff[2];
- extern int single;
- extern int grabf;
- extern int mmx;
+ extern bool mmx;
extern int *best1;
extern BEST2 *best2;
extern u_short *keysList;
extern int *decoLine;
+ extern int bright, contr, satur;
+ extern int showCont;
+ extern CRYPTSTD cryptStd;
+ extern TVSTD TVStd;
+ extern bool iState;
+ extern bool helpState;
+
+ int maxBuf=2;
int _crt0_startup_flags = _CRT0_FLAG_NEARPTR | _CRT0_FLAG_NONMOVE_SBRK;
- int buttons=0, xpos=0, ypos=0, lxpos=0, lypos=0;
+ int grabf;
int fysize;
byte font[4096];
- int NoInt8=0;
int vid=0;
int bpp;
- char *yuv2rgb_lut;
+ int *yuv2RgbLut;
int edge_lut[256];
+ MENULEVEL menuLevel=mLNorm;
+ int infoPosY;
+ bool strangeRgb16= true; // commandLineOpt FIX
void printg_t(char *text){
close_hw();
@@ -80,18 +87,10 @@ int error(error_code e){
break;
case DPMI : printg_t("\nDPMI Error!\n");
break;
- case NoMouse : printg_t("\nNo Mouse?!\n");
- break;
- case MouseHand : printg_t("\nMouse Handler error!\n");
- break;
case NoFont : printg_t("\nNo 2010.Fnt?!\n");
break;
case Font : printg_t("\n2010.Fnt is damaged!\n");
break;
- case NoCursor : printg_t("\nNo 2010.Cur?!\n");
- break;
- case Cursor : printg_t("\n2010.Cur is damaged!\n");
- break;
case FileWrite : printg_t("\nFile-Write Error!\n");
break;
case MemAlloc : printg_t("\nMemory allocation error!\n");
@@ -111,7 +110,6 @@ int error(error_code e){
"options: -v n (Video-mode)\n"
" -m n (Meteor Card) in case there are more than 1 (:\n"
" -NoFlip (Disable Page-Fliping)\n"
- " -NoInt8 (Disable Int8-Handler)\n"
" -NoMMX (Disable MMX-Support)\n"
" -? / -h (This stuff)\n");
break;
@@ -132,8 +130,6 @@ void exitt(void){
int main(int argc, char **argv){
int NoFlip=0;
- int key;
- int i, j;
char buf[256];
__dpmi_regs r;
ModeInfoBlock *mib;
@@ -152,32 +148,30 @@ int main(int argc, char **argv){
signal(SIGSEGV, sig_handler);
signal(SIGTRAP, sig_handler);
- for(i=1;i<argc;i++){
+ for(int i=1;i<argc;i++){
if(stricmp(argv[i],"-v")==0){
- i++;
- sscanf(argv[i],"%d",&vid);
+ i++;
+ sscanf(argv[i],"%d",&vid);
}
else if(stricmp(argv[i],"-m")==0){
- i++;
- sscanf(argv[i],"%d",&active_meteor);
+ i++;
+ sscanf(argv[i],"%d",&active_meteor);
}
else if(stricmp(argv[i],"-NoFlip")==0){
- NoFlip=1;
+ NoFlip=1;
}
else if(stricmp(argv[i],"-NORGB")==0){
- yuvmode=2;
- }
- else if(stricmp(argv[i],"-Single")==0){
- single=1;
+ yuvmode=2;
}
- else if(stricmp(argv[i],"-NoInt8")==0){
- NoInt8=1;
+ else if(stricmp(argv[i],"-maxBuf")==0){
+ i++;
+ sscanf(argv[i],"%d",&maxBuf);
}
else if(stricmp(argv[i],"-NoMMX")==0){
- mmx=0;
+ mmx=0;
}
else if(stricmp(argv[i],"-?")==0 || stricmp(argv[i],"-H")==0){
- error(Help);
+ error(Help);
}
/* else if(stricmp(argv[i],"-v")==0){
i++;
@@ -198,31 +192,15 @@ int main(int argc, char **argv){
if((f=fopen("2010.fnt", "rb"))==NULL) error(NoFont);
fysize=fsize(f)>>8;
if(fysize==0) error(Font);
- for(i=0; i<256; i++) fread(font+(i<<4),1,fysize,f);
- fclose(f);
-
- printf("2010.Cur...\n");
- if((f=fopen("2010.cur", "rb"))==NULL) error(NoCursor);
- cursor.x=fgetc(f);
- cursor.y=fgetc(f);
- cursor.hotx=fgetc(f);
- cursor.hoty=fgetc(f);
- cursor.z=fgetc(f); //ERROR could be readed in struct direct
- if(cursor.x*cursor.y*cursor.z!=fsize(f)-5) error(Cursor);
- cursor.data=new byte[cursor.x*cursor.y*cursor.z];
- fread(cursor.data, 1, cursor.x*cursor.y*cursor.z, f);
+ for(int i=0; i<256; i++) fread(font+(i<<4),1,fysize,f);
fclose(f);
+
+ if(scan_pci_meteors() == 0) error(NoMeteor);
+// if(active_meteor>=i) active_meteor=0;
+// printf("%d Meteor(s) Detected!\n", i);
- mouse_buff[0]=new byte[cursor.x * cursor.y << 2];
- mouse_buff[1]=new byte[cursor.x * cursor.y << 2];
-
- i=scan_pci_meteors();
- if(i==0) error(NoMeteor);
- if(active_meteor>=i) active_meteor=0;
- printf("%d Meteor(s) Detected!\n", i);
-
- for(i=0; i<256; i++){
- j=i-2;
+ for(int i=0; i<256; i++){
+ int j=i-2;
if(j<0) j=0;
if(j>5 ) j=(j>>1) + 3;
@@ -233,23 +211,34 @@ int main(int argc, char **argv){
}
printf("Building YUV to RGB LookUp Tables!\n");
- yuv2rgb_lut=new char[256*4*2];
- for(i=0; i<256; i++){
- if(i>=128) j=i-256;
- else j=i;
- double d= double(j);
+ yuv2RgbLut=new int[128*4*2];
+ for(int i=0; i<128; i++){
+ int j;
+ if(i>=64) j=i-128;
+ else j=i;
+ double uv= double(j);
- yuv2rgb_lut[(i<<2) ]= short( d * ( 1.734375) * 0.5 );
- yuv2rgb_lut[(i<<2) + 1 ]= short( d * (-0.34375 ) * 0.5 )
- + is_pos(yuv2rgb_lut[(i<<2) ]);
- yuv2rgb_lut[(i<<2) + 2 ]= is_pos(yuv2rgb_lut[(i<<2) + 1 ]);
- yuv2rgb_lut[(i<<2) + 3 ]= 0;
+ int vr= int( uv * 1.375 ) & 0x1FF;
+ int vg= int(-uv * 0.703125 * 2) & 0x3FF;
+ int ug= int(-uv * 0.34375 * 2) & 0x3FF;
+ int ub= int( uv * 1.734375 ) & 0x1FF;
+ int yn= i;
+ int yg= i<<1;
- yuv2rgb_lut[(i<<2) + 1024]= 0;
- yuv2rgb_lut[(i<<2) + 1025]= short( d * (-0.703125) * 0.5 );
- yuv2rgb_lut[(i<<2) + 1026]= short( d * ( 1.375 ) * 0.5 )
- + is_pos(yuv2rgb_lut[(i<<2) + 1025]);
- yuv2rgb_lut[(i<<2) + 1027]= 0;
+// 565565
+// 655655
+
+// B R G
+// G B R
+
+ yuv2RgbLut[(i<<1) ]= ub +(ug<<21) ;
+ yuv2RgbLut[(i<<1) + 1 ]= ug +(ub<<11) ;
+ yuv2RgbLut[(i<<1) + 256 ]= yn +(yn<<11) ;
+ yuv2RgbLut[(i<<1) + 257 ]= yg ;
+ yuv2RgbLut[(i<<1) + 512 ]= (vr<<11) +(vg<<21) ;
+ yuv2RgbLut[(i<<1) + 513 ]= vg +(vr<<22);
+ yuv2RgbLut[(i<<1) + 768 ]= +(yg<<21) ;
+ yuv2RgbLut[(i<<1) + 769 ]= +(yn<<11) +(yn<<22);
}
if((vib=get_vesa_info())==0) error(NoVESA);
@@ -258,9 +247,9 @@ int main(int argc, char **argv){
printf("VESA %d.%d detected!\n", (vib->ver>>8) & 255, vib->ver & 255);
- for(i=256;i<512;i++){
+ for(int i=256;i<512;i++){
if((mib=get_mode_info(i))!=0){
- if((mib->ModeAttrib & (8+16+128))==8+16+128 && (mib->bpp==24 || mib->bpp==32)
+ if((mib->ModeAttrib & (8+16+128))==8+16+128 && mib->bpp==16
&& mib->model==6 && (mib->Xres & 0x3F8) == mib->Xres
&& (mib->Yres & 0x3FF) == mib->Yres){
// FIX ME 3FF statt 3F8 OK?
@@ -280,7 +269,7 @@ int main(int argc, char **argv){
if((mib=get_mode_info(vid))==0) error(VESA);
- if(!((mib->ModeAttrib & (8+16+128))==8+16+128 && (mib->bpp==24 || mib->bpp==32)
+ if(!((mib->ModeAttrib & (8+16+128))==8+16+128 && mib->bpp==16
&& mib->model==6 && (mib->Xres & 0x3F8) == mib->Xres
&& (mib->Yres & 0x3FE) == mib->Yres))
error(VESA);
@@ -288,10 +277,12 @@ int main(int argc, char **argv){
vgax=mib->Xres;
vgay=mib->Yres;
- if(yuvmode!=0) mc=1;
+/* if(yuvmode!=0) mc=1;
else mc=2;
if(yuvmode==2) mc2=1;
else mc2=2;
+*/
+ mc=mc2=1;
xresc=vgax<<mc;
bpp=mib->bpp;
vb=bpp>>3;
@@ -301,19 +292,16 @@ int main(int argc, char **argv){
printf("Allocating Physical Continous Buffers...\n");
- xxx *a;
- if(single==0)
- a= alloc_cont(vgax * vgay << mc2, 2);
+ vid2MemBuf=(VID2MEMBUF*)(int(&vid2MemBuf)+4);
+
+ if(vgay<370) // +100 for out of array (optimizations...)
+ allocCont(vid2MemBuf, (vgax * vgay << 2)+100, &maxBuf);
else
- a= alloc_cont(vgax * vgay << mc2, 1);
+ allocCont(vid2MemBuf, (vgax * vgay << 1)+100, &maxBuf);
- doubleBuff=(xxx*)(int(&doubleBuff)+4);
- dispbuf= // dispbuf just cheap copy
- doubleBuff[0]= a[0];
- doubleBuff[1]= a[1];
- doubleBuff[0].state=
- doubleBuff[1].state= Empty;
+ actVid2MemBufp= &vid2MemBuf[0];
+ int i;
if(page_flip==0) i= vgax * vgay * vb;
else i= vgax * vgay * vb << 1;
@@ -325,26 +313,127 @@ int main(int argc, char **argv){
if(r.x.ax!=0x4F) error(VESA);
g_mode=1;
- setmenu();
init_hw();
init_meteor();
- setmpos();
+ static int delay=0;
- key=0;
- while(key==0){
- draw_dispbuf();
-
- xpos=mouse_x;
- ypos=mouse_y;
- buttons=mouse_b;
-
- m_buttons();
-
- lxpos=xpos;
- lypos=ypos;
+ bool quit=false;
+ while(!quit){
- if(kbhit()) key=getkey();
- if(key=='g' || key=='G') key=0, grabf=1;
+ infoPosY=0;
+
+ decrypt();
+ showStuff();
+
+ if(grabf==1) grab(), grabf=0;
+
+ for(int k=0; k<delay*1000000; k++);
+
+ copy_vidbuffer();
+
+
+
+ if(kbhit()){
+ int key= getkey();
+
+ while(kbhit()) getkey();
+
+ switch(menuLevel){
+ case mLNorm : switch(key){
+ case 'g' :
+ case 'G' : key=0, grabf=1;
+ break;
+ case 'q' :
+ case 'Q' : quit=true;
+ break;
+ case K_F1 : bright--;
+ showCont=10;
+ if(bright<0) bright=0;
+ setCont();
+ break;
+ case K_F2 : bright++;
+ showCont=10;
+ if(bright>255) bright=255;
+ setCont();
+ break;
+ case K_F3 : contr--;
+ showCont=10;
+ if(contr<0) contr=0;
+ setCont();
+ break;
+ case K_F4 : contr++;
+ showCont=10;
+ if(contr>127) contr=127;
+ setCont();
+ break;
+ case K_F5 : satur--;
+ showCont=10;
+ if(satur<0) satur=0;
+ setCont();
+ break;
+ case K_F6 : satur++;
+ showCont=10;
+ if(satur>127) satur=127;
+ setCont();
+ break;
+ case 's' :
+ case 'S' : menuLevel=mLTVStd, helpState=false;
+ break;
+ case 'i' :
+ case 'I' : iState= !iState;
+ break;
+ case 'v' :
+ case 'V' : vSmoothState= !vSmoothState;
+ break;
+ case 'h' :
+ case 'H' : helpState= !helpState;
+ break;
+ case '1' : delay++;
+ break;
+ case '2' : delay--; if(delay<0) delay=0;
+ break;
+ }
+ break;
+ case mLTVStd : switch(key){
+ case '1' : TVStd= PAL;
+ cryptStd= nix;
+ if(yuvmode==1) yuvmode=0;
+ setStdScale();
+ contGrab();
+ break;
+ case '2' : TVStd= NTSC;
+ cryptStd= nix;
+ if(yuvmode==1) yuvmode=0;
+ setStdScale();
+ contGrab();
+ break;
+ case '3' : TVStd= SECAM;
+ cryptStd= nix;
+ if(yuvmode==1) yuvmode=0;
+ setStdScale();
+ contGrab();
+ break;
+ case '4' : TVStd= PAL;
+ cryptStd= vc;
+ if(yuvmode==0) yuvmode=1;
+ vSmoothState=false;
+ setStdScale();
+ contGrab();
+ break;
+ case '5' : TVStd= PAL;
+ cryptStd= nag;
+ if(yuvmode==0) yuvmode=1;
+ if(oneField && yuvmode==2) error(MemAlloc);
+ vSmoothState=false;
+ setStdScale();
+ contGrab();
+ break;
+ }
+ menuLevel=mLNorm;
+ break;
+
+ }
+ }
}
exit(0);
Modified: trunk/2010/2010.h
==============================================================================
--- trunk/2010/2010.h (original)
+++ trunk/2010/2010.h Wed Jul 4 08:49:51 2007
@@ -3,7 +3,7 @@
#ifndef n2010_h
#define n2010_h
-typedef enum{
+enum error_code{
CommLine,
Help,
NoVDS,
@@ -17,12 +17,8 @@ typedef enum{
FileRead,
FileWrite,
Map,
- NoMouse,
- MouseHand,
NoFont,
Font,
- NoCursor,
- Cursor,
MemAlloc,
FileMax,
Lock,
@@ -31,7 +27,12 @@ typedef enum{
KeyFile,
Align,
Nagra,
-} error_code;
+};
+
+enum MENULEVEL{
+ mLNorm,
+ mLTVStd,
+};
int error(error_code e);
void exitt(void);
Modified: trunk/2010/2_71x6.cc
==============================================================================
--- trunk/2010/2_71x6.cc (original)
+++ trunk/2010/2_71x6.cc Wed Jul 4 08:49:51 2007
@@ -32,16 +32,16 @@ extern volatile int addr_errors;
extern volatile int corr_errors;
extern volatile int frames, fields;
extern volatile u_char saa7196_buf[SAA7196_regs];
-extern volatile tv_form std;
-extern volatile crypt_form crypt;
-extern volatile int x_field, y_field, one_field;
+extern volatile TVSTD TVStd;
+extern volatile CRYPTSTD cryptStd;
+extern volatile int x_field, y_field;
extern volatile int xresc, yuvmode, mc;
-extern volatile xxx dispbuf, *doubleBuff;
+extern volatile VID2MEMBUF *vid2MemBuf, *actVid2MemBufp;
+extern volatile int grabVid2MemBuf, actVid2MemBuf;
extern volatile int stride;
+extern volatile bool oneField;
extern int wndx, wndy, outy;
extern int single;
-extern int init_menu;
-extern int nagra_mode;
extern int vgax, vgay;
@@ -205,32 +205,21 @@ void meteor_int_handler(void){
// asm("int $3\n\t");
- int grabbingOne=0;
- while(doubleBuff[grabbingOne].state != Grabbing && grabbingOne<2)
- grabbingOne++;
-
- int emptyOne=0;
- while(doubleBuff[emptyOne].state!=Empty && emptyOne<2) emptyOne++;
-
-
a_saa7116->capt_ctl_a|=0x0F30;
if( a_saa7116->ints_ctl.stat_odd == 1 && fields<11111
&& a_saa7116->ints_ctl.stat_even == 0 && fields>=2
&& a_saa7116->ints_ctl.stat_start == 0 ){
fields=0;
+ if( vid2MemBuf[ grabVid2MemBuf ].state == Grabbing )
+ vid2MemBuf[ grabVid2MemBuf ].state= Grabbed;
- if(grabbingOne!=2) doubleBuff[grabbingOne].state= Grabbed;
+ grabVid2MemBuf++;
+ if( grabVid2MemBuf >= vid2MemBuf[0].num ) grabVid2MemBuf= 0;
- if(emptyOne!=2){
- if(single==0){
- doubleBuff[emptyOne].state= Grabbing;
- }
- else{
- doubleBuff[0].state=
- doubleBuff[1].state= Grabbing;
- }
- grab_next(doubleBuff[emptyOne]);
+ if( vid2MemBuf[ grabVid2MemBuf ].state == Empty ){
+ vid2MemBuf[ grabVid2MemBuf ].state= Grabbing;
+ grab_next( vid2MemBuf[ grabVid2MemBuf ] );
}
else{
fields=11111;
@@ -239,18 +228,20 @@ void meteor_int_handler(void){
done_even: 1, done_odd: 1, VRSTN: 1, fifo_en: 1,
corr_even: 1, corr_odd: 1, aerr_even: 1, aerr_odd: 1,
res1: 0, corr_dis: 0, range_en: 1, res2: 0};
- if(grabbingOne!=2) grab_next(doubleBuff[grabbingOne^1]);
- else asm("int $3\n\t");
+ grab_next( vid2MemBuf[ grabVid2MemBuf ] );
}
}
- else if( a_saa7116->ints_ctl.stat_start==1 && fields>=11111 && emptyOne!=2){
+ else if( a_saa7116->ints_ctl.stat_start==1 && fields>=11111
+ && vid2MemBuf[ grabVid2MemBuf ].state == Empty ){
fields=0;
a_saa7116->capt_ctl=(capt_c){
cont_even: 1, cont_odd: 1, sing_even: 0, sing_odd: 0,
done_even: 1, done_odd: 1, VRSTN: 1, fifo_en: 1,
corr_even: 1, corr_odd: 1, aerr_even: 1, aerr_odd: 1,
res1: 0, corr_dis: 0, range_en: 1, res2: 0};
+ vid2MemBuf[ grabVid2MemBuf ].state= Grabbing;
}
+
a_saa7116->ints_ctl_a|=0x7;
}
@@ -286,27 +277,27 @@ void close_meteor(void){
metmode=0;
}
-void grab_next(xxx x){
+void grab_next(VID2MEMBUF v2mb){
saa7116 *a_saa7116=(saa7116*)meteors[active_meteor].saa7116;
a_saa7116->dma_end.even=
a_saa7116->dma_end.odd= 0;
- if(one_field==1){
+ if(oneField){
a_saa7116->dma.even[0]= a_saa7116->dma.odd [0]=
a_saa7116->dma.even[1]= a_saa7116->dma.odd [1]=
- a_saa7116->dma.even[2]= a_saa7116->dma.odd [2]= x.phys;
+ a_saa7116->dma.even[2]= a_saa7116->dma.odd [2]= v2mb.phys;
}else{
a_saa7116->dma.even[0]=
a_saa7116->dma.even[1]=
- a_saa7116->dma.even[2]= x.phys;
+ a_saa7116->dma.even[2]= v2mb.phys;
a_saa7116->dma.odd [0]=
a_saa7116->dma.odd [1]=
- a_saa7116->dma.odd [2]= x.phys + xresc;
+ a_saa7116->dma.odd [2]= v2mb.phys + xresc;
}
a_saa7116->dma_end.even=
- a_saa7116->dma_end.odd= x.phys + xresc*outy - 1;
+ a_saa7116->dma_end.odd= v2mb.phys + xresc*outy - 1;
}
@@ -314,7 +305,7 @@ void meteor_int_handler_end(void){
}
-void setcont(void){
+void setCont(void){
write_saa7196(0x12, satur);/*7:0 Chrominance saturation control for VRAM port */
write_saa7196(0x13, contr);/*7:0 Luminance contract control for VRAM port */
@@ -322,34 +313,34 @@ void setcont(void){
}
-void setstd_scale(void){
+void setStdScale(void){
saa7116 *a_saa7116=(saa7116*)meteors[active_meteor].saa7116;
int i;
- init_menu=1;
- if(yuvmode!=0) mc=1;
- else mc=2;
+/* if(yuvmode!=0) mc=1;
+ else mc=2;*/
+ mc=1;
xresc=vgax<<mc;
wndx=vgax;
- if(std==NTSC)
+ if(TVStd==NTSC)
y_field=240-scales_y+scalee_y, x_field=640-scales_x+scalee_x;
else
y_field=288-scales_y+scalee_y, x_field=768-scales_x+scalee_x;
- if(vgay-70 <= y_field && nagra_mode==0) one_field=1;
- else one_field=0;
+ if(vgay-70 <= y_field && cryptStd!=nag) oneField=true;
+ else oneField=false;
int yrest;
- if(nagra_mode==0 || vgay-70 > y_field) yrest= vgay;
+ if(cryptStd!=nag || vgay-70 > y_field) yrest= vgay;
else yrest= vgay << 1;
- if (one_field==0 && yrest>y_field*2){
+ if (!oneField && yrest>y_field*2){
outy= y_field*2;
wndx= int( double(wndx) * double(outy) / double(yrest) );
}
- else if(one_field==1 && yrest>y_field ){
+ else if(oneField && yrest>y_field ){
outy= y_field;
wndx= int( double(wndx) * double(outy) / double(yrest) );
}
@@ -370,36 +361,40 @@ void setstd_scale(void){
if(wndx > vgax ) vgax -=8;
if(outy > yrest) outy-=2;
- if(one_field==0) stride=(vgax + vgax - wndx)<<mc;
- else stride=(vgax - wndx)<<mc;
+ if(!oneField) stride=(vgax + vgax - wndx)<<mc;
+ else stride=(vgax - wndx)<<mc;
- if(nagra_mode==0 || vgay-70 > y_field) wndy= outy;
+ if(cryptStd!=nag || vgay-70 > y_field) wndy= outy;
else wndy= outy >> 1;
- if(std==SECAM) write_saa7196(0x0D, 0x85);
- else write_saa7196(0x0D, 0x84);
+ if(TVStd==SECAM) write_saa7196(0x0D, 0x85);
+ else write_saa7196(0x0D, 0x84);
/* 7 VTR/TV mode bit = 1->VTR mode
3 Realtime output mode select bit
2 HREF position select
1 Status byte select
0 SECAM mode bit */
- if(std==SECAM) write_saa7196(0x0F, 0xB0);
- else write_saa7196(0x0F, 0x90);
+ if(TVStd==SECAM) write_saa7196(0x0F, 0xB0);
+ else write_saa7196(0x0F, 0x90);
/* 7 Automatic Field detection
6 Field Select 0 = 50hz, 1=60hz
5 SECAM cross-colour reduction
4 Enable sync and clamping pulse
3:1 Luminance delay compensation */
if(yuvmode==0){
- if(one_field==1) write_saa7196(0x20, 0xF2);
- else write_saa7196(0x20, 0x92);
+/* if(oneField) write_saa7196(0x20, 0xF2);
+ else write_saa7196(0x20, 0x92);
a_saa7116->rt_mode_e=a_saa7116->rt_mode_o=
- (rt_mode){mode: 0x00, route: 0x393939};
+ (rt_mode){mode: 0x00, route: 0x393939};*/
+ if(oneField) write_saa7196(0x20, 0xF0);
+ else write_saa7196(0x20, 0x90);
+ a_saa7116->rt_mode_e=a_saa7116->rt_mode_o=
+ (rt_mode){mode: 0x01, route: 0xeeeeee};
}
else{
- if(one_field==1) write_saa7196(0x20, 0xF1);
- else write_saa7196(0x20, 0x91);
+ if(oneField) write_saa7196(0x20, 0xF1);
+ else write_saa7196(0x20, 0x91);
a_saa7116->rt_mode_e=a_saa7116->rt_mode_o=
(rt_mode){mode: 0x41, route: 0xeeeeee};
}
@@ -419,15 +414,15 @@ void setstd_scale(void){
4 [8] Horizontal start position of scaling win
3:2 [9:8] Pixel number per line on input
1:0 [9:8] Pixel number per line on output */
- if(one_field==1) write_saa7196(0x25, outy & 0xFF);
- else write_saa7196(0x25, (outy>>1) & 0xFF);
+ if(oneField) write_saa7196(0x25, outy & 0xFF);
+ else write_saa7196(0x25, (outy>>1) & 0xFF);
/* 7:0 [7:0] Line number per output field */
write_saa7196(0x26, y_field & 0xFF);
/* 7:0 [7:0] Line number per input field */
write_saa7196(0x27, scales_y);/* 7:0 [7:0] Vertical start of scaling window */
i=saa7196_buf[0x28] & 0xE0;
- if(one_field==1) write_saa7196(0x28, i | ((y_field>>6) & 0x0C) | (outy>>8));
- else write_saa7196(0x28, i | ((y_field>>6) & 0x0C) | (outy>>9));
+ if(oneField) write_saa7196(0x28, i | ((y_field>>6) & 0x0C) | (outy>>8));
+ else write_saa7196(0x28, i | ((y_field>>6) & 0x0C) | (outy>>9));
/* 7 Adaptive filter switch
6:5 Vertical luminance data processing
4 [8] Vertical start of scaling window
@@ -583,8 +578,8 @@ write_saa7196(0x10, 0x00); //BAK
1 Transparent data transfer
0 Extended formats enable bit */
- setcont();
- setstd_scale();
+ setCont();
+ setStdScale();
// for(int c=0; c<0x30; c++){
// printf("%X, %X, %X\n",c, read_saa7196(c), saa7196_buf[c]);
@@ -602,15 +597,13 @@ static void start_grab(void){
wait(wait_time);
- xxx grab_dispbuf= doubleBuff[0].phys==dispbuf.phys ?
- doubleBuff[1] : doubleBuff[0];
-
-
- if(one_field==1){
+ VID2MEMBUF grabVid2MemBufp= vid2MemBuf[ grabVid2MemBuf ];
+
+ if(oneField){
a_saa7116->dma.even[0]= a_saa7116->dma.odd [0]=
a_saa7116->dma.even[1]= a_saa7116->dma.odd [1]=
a_saa7116->dma.even[2]= a_saa7116->dma.odd [2]=
- grab_dispbuf.phys;
+ grabVid2MemBufp.phys;
a_saa7116->stride.even[0]=a_saa7116->stride.odd[0]=
a_saa7116->stride.even[1]=a_saa7116->stride.odd[1]=
a_saa7116->stride.even[2]=a_saa7116->stride.odd[2]=
@@ -619,18 +612,18 @@ static void start_grab(void){
a_saa7116->dma.even[0]=
a_saa7116->dma.even[1]=
a_saa7116->dma.even[2]=
- grab_dispbuf.phys;
+ grabVid2MemBufp.phys;
a_saa7116->dma.odd [0]=
a_saa7116->dma.odd [1]=
a_saa7116->dma.odd [2]=
- grab_dispbuf.phys + xresc;
+ grabVid2MemBufp.phys + xresc;
a_saa7116->stride.even[0]=a_saa7116->stride.odd[0]=
a_saa7116->stride.even[1]=a_saa7116->stride.odd[1]=
a_saa7116->stride.even[2]=a_saa7116->stride.odd[2]=
stride;
}
a_saa7116->dma_end.even=
- a_saa7116->dma_end.odd= grab_dispbuf.phys + xresc*outy - 1;
+ a_saa7116->dma_end.odd= grabVid2MemBufp.phys + xresc*outy - 1;
@@ -647,10 +640,10 @@ static void start_grab(void){
}
-void cont_grab(void){
+void contGrab(void){
saa7116 *a_saa7116=(saa7116*)meteors[active_meteor].saa7116;
- if(one_field==1){
+ if(oneField){
a_saa7116->stride.even[0]=a_saa7116->stride.odd[0]=
a_saa7116->stride.even[1]=a_saa7116->stride.odd[1]=
a_saa7116->stride.even[2]=a_saa7116->stride.odd[2]=
Modified: trunk/2010/2_71x6.h
==============================================================================
--- trunk/2010/2_71x6.h (original)
+++ trunk/2010/2_71x6.h Wed Jul 4 08:49:51 2007
@@ -9,17 +9,17 @@
#define SAA7196_regs 49
-typedef enum{
+enum TVSTD{
PAL,
NTSC,
SECAM,
-} tv_form;
+};
-typedef enum{
+enum CRYPTSTD{
nix,
vc,
nag,
-} crypt_form;
+};
/*
pci_cmd; //04-05
@@ -210,12 +210,12 @@ void init_meteor(void);
void close_meteor(void);
void meteor_int_handler(void);
void meteor_int_handler_end(void);
-void cont_grab(void);
+void contGrab(void);
void write_saa7196(u_char reg, u_char data);
u_char read_saa7196(u_char reg);
-void setcont(void);
-void setstd_scale(void);
-void grab_next(xxx x);
+void setCont(void);
+void setStdScale(void);
+void grab_next(VID2MEMBUF v2mb);
void grab_nix();
#endif
Modified: trunk/2010/2_all.h
==============================================================================
--- trunk/2010/2_all.h (original)
+++ trunk/2010/2_all.h Wed Jul 4 08:49:51 2007
@@ -21,6 +21,13 @@
#define dword unsigned long
#define ll long long
+
+struct COL{
+ long yuv;
+ short rgb16;
+};
+
+/*
struct s_yuv{
byte u, y1, v, y2;
};
@@ -38,40 +45,33 @@ union s_col{
s_yuv yuv;
u_long a;
};
+ */
-typedef enum{
+enum VID2MEMBUFSTATE{
Empty,
Working,
Grabbing,
Grabbed,
-} BUFFSTATE;
+};
-struct xxx{
- union{
- s_yuv *yuv;
- s_rgb *rgb;
- s_cl *cl;
- byte *b;
- };
+struct VID2MEMBUF{
+ byte *b;
int phys;
- BUFFSTATE state;
+ VID2MEMBUFSTATE state;
+ static int num;
};
class color{
public:
- s_col c;
+ COL col;
color(void) { };
- void init(byte y, byte u, byte v, byte yuv_mode)
- { if(yuv_mode!=0){
- c.yuv.y1=c.yuv.y2=y;
- c.yuv.u=u;
- c.yuv.v=v;
- }else{
- c.rgb.r= (byte)( y + 1.375 *v);
- c.rgb.g= (byte)( y - 0.703125*v - 0.34375*u);
- c.rgb.b= (byte)( y + 1.734375*u);
- }
- };
+ void init(byte y, byte u, byte v, byte yuv_mode){
+ col.yuv= u | (y<<8) | (v<<16) | (y<<24);
+ const int r= (int( y + 1.375 *v )>>3) & 0x1F;
+ const int g= (int( y - 0.703125*v - 0.34375*u )>>2) & 0x1F;
+ const int b= (int( y + 1.734375*u)>>3) & 0x1F;
+ col.rgb16= b | (g<<5) | (r<<11);
+ };
} ;
#endif
Modified: trunk/2010/2_crypt.cc
==============================================================================
--- trunk/2010/2_crypt.cc (original)
+++ trunk/2010/2_crypt.cc Wed Jul 4 08:49:51 2007
@@ -7,31 +7,33 @@
#include "2_nag.h"
#include "2_71x6.h"
-extern volatile tv_form std;
-extern volatile crypt_form crypt;
+extern volatile TVSTD TVStd;
+extern volatile CRYPTSTD cryptStd;
extern vgax, vgay, wndx, wndy, y_field, outy;
-extern xxx dispbuf;
+extern VID2MEMBUF *actVid2MemBufp;
extern volatile int scales_x, scalee_x;
extern volatile int scales_y, scalee_y;
-extern int one_field, v_smooth, yuvmode;
+extern int yuvmode;
+extern volatile bool oneField;
extern int satur;
-static void vsmooth(void);
+static void vSmooth(void);
static void decomb(void);
+bool vSmoothState=true;
int show_points=0;
asm("__esp: .long 0\n\t");
void decrypt(void){
-// if( crypt == nag && satur!=0 ) decomb();
- decomb();
+ if( cryptStd == nag && satur!=0 ) decomb();
+// decomb();
- if(crypt==vc) vc_decrypt();
- else if(crypt==nag) nag_decrypt();
+ if(cryptStd==vc) vc_decrypt();
+ else if(cryptStd==nag) nag_decrypt();
- if(one_field==0 && v_smooth==1) vsmooth();
+ if(!oneField && vSmoothState) vSmooth();
}
@@ -44,9 +46,9 @@ static void decomb(void){
int amp[max_x];
const int outy1= outy>>1;
- const int stride=one_field ? (vgax<<1) : (vgax<<2);
- const int o=one_field ? 0 : 1;
- const int end=one_field ? outy : outy1;
+ const int stride=oneField ? (vgax<<1) : (vgax<<2);
+ const int o=oneField ? 0 : 1;
+ const int end=oneField ? outy : outy1;
const int segSize= end/segs;
int startp= 0;
@@ -61,7 +63,7 @@ static void decomb(void){
if(o) linep+=vgax<<1;
for(line=0; line<segSize; line++){
for(i=0; i<wndx; i+=2){
- j = char(dispbuf.b[linep + (i<<1) ]);
+ j = char(actVid2MemBufp->b[linep + (i<<1) ]);
j= (j + j) - temp[i];
temp[i] = j;
if(line & 1) amp[i]-=j;
@@ -79,21 +81,21 @@ static void decomb(void){
for(line=0; line<segSize; line++){
for(i=0; i<wndx; i++){
/*
- j = char(dispbuf.b[linep + (i<<1)]);
+ j = char(actVid2MemBufp->b[linep + (i<<1)]);
j=(j + j) - temp[i];
temp[i] = j;
if (j> 127) j= 127;
else if(j<-128) j=-128;
- dispbuf.b[linep + (i<<1)] = (char)(j);
+ actVid2MemBufp->b[linep + (i<<1)] = (char)(j);
*/
- j = char(dispbuf.b[linep + (i<<1)]);
+ j = char(actVid2MemBufp->b[linep + (i<<1)]);
j=(j + j) - temp[i];
if(j<temp[i]) j++;
if (j> 127) j= 127;
else if(j<-128) j=-128;
temp[i] = j;
- dispbuf.b[linep + (i<<1)] = (char)(j);
+ actVid2MemBufp->b[linep + (i<<1)] = (char)(j);
@@ -137,27 +139,27 @@ static void decomb(void){
" jnz 1b \n\t" // V 1
:
- : "D" (one_field==1 ? (vgax<<1) : (vgax<<2)), "S" (dispbuf.b),
+ : "D" (oneField ? (vgax<<1) : (vgax<<2)), "S" (actVid2MemBufp->b),
"d" (vgax * wndy>>1)
: "%eax", "%ebx", "%ecx", "%edx", "%esi");
*/
}
-static void vsmooth(void){
+static void vSmooth(void){
/*
for(int x=0; x < wndx; x++){
- dispbuf.rgb[x + y*vgax].r=( (dispbuf.rgb[x + y *vgax].r >> 1)
- + (dispbuf.rgb[x + (y+1)*vgax].r )
- + (dispbuf.rgb[x + (y+2)*vgax].r >> 1) ) >> 1;
- dispbuf.rgb[x + y*vgax].g=( (dispbuf.rgb[x + y *vgax].g >> 1)
- + (dispbuf.rgb[x + (y+1)*vgax].g )
- + (dispbuf.rgb[x + (y+2)*vgax].g >> 1) ) >> 1;
- dispbuf.rgb[x + y*vgax].b=( (dispbuf.rgb[x + y *vgax].b >> 1)
- + (dispbuf.rgb[x + (y+1)*vgax].b )
- + (dispbuf.rgb[x + (y+2)*vgax].b >> 1) ) >> 1;
+ ((s_rgb*)actVid2MemBufp.b)[x + y*vgax].r=( (((s_rgb*)actVid2MemBufp.b)[x + y *vgax].r >> 1)
+ + (((s_rgb*)actVid2MemBufp.b)[x + (y+1)*vgax].r )
+ + (((s_rgb*)actVid2MemBufp.b)[x + (y+2)*vgax].r >> 1) ) >> 1;
+ ((s_rgb*)actVid2MemBufp.b)[x + y*vgax].g=( (((s_rgb*)actVid2MemBufp.b)[x + y *vgax].g >> 1)
+ + (((s_rgb*)actVid2MemBufp.b)[x + (y+1)*vgax].g )
+ + (((s_rgb*)actVid2MemBufp.b)[x + (y+2)*vgax].g >> 1) ) >> 1;
+ ((s_rgb*)actVid2MemBufp.b)[x + y*vgax].b=( (((s_rgb*)actVid2MemBufp.b)[x + y *vgax].b >> 1)
+ + (((s_rgb*)actVid2MemBufp.b)[x + (y+1)*vgax].b )
+ + (((s_rgb*)actVid2MemBufp.b)[x + (y+2)*vgax].b >> 1) ) >> 1;
}
*/
-
+/*
if(yuvmode==0){
asm(//"int $3 \n\t"
"1: \n\t"
@@ -178,7 +180,7 @@ static void vsmooth(void){
"movl %%ebx, -4(%%esi ) \n\t" //U LINE
" jnz 1b \n\t" // V 1
:
- : "D" (vgax<<2), "S" (dispbuf.b),
+ : "D" (vgax<<2), "S" (actVid2MemBufp->b),
"c" (vgax * (wndy-2) )
: "%eax", "%ebx", "%ecx", "%esi");
@@ -211,10 +213,11 @@ static void vsmooth(void){
"movl %%ebx, -4(%%esi ) \n\t" //U LINE
" jnz 1b \n\t" // V 1
:
- : "D" (vgax<<1), "S" (dispbuf.b),
+ : "D" (vgax<<1), "S" (actVid2MemBufp->b),
"c" (vgax * (wndy-2) >> 1)
: "%eax", "%ebx", "%ecx", "%esi");
}
+ */
}
Modified: trunk/2010/2_file.cc
==============================================================================
--- trunk/2010/2_file.cc (original)
+++ trunk/2010/2_file.cc Wed Jul 4 08:49:51 2007
@@ -10,12 +10,13 @@
extern int vgax, vgay, wndx, wndy;
extern int fysize;
extern byte font[4096];
- extern xxx dispbuf;
+ extern VID2MEMBUF actVid2MemBufp;
extern int g_mode;
extern int yuvmode;
extern char *yuv2rgb_lut;
void grab(void){
+/*
int i, j;
FILE *fg;
char grab_name[16];
@@ -47,11 +48,11 @@ void grab(void){
fwrite(&bmpi, sizeof(bmpi), 1, fg);
for(i=wndy-1; i>=0; i--){
for(j=0; j<wndx; j++){
- if(yuvmode==0) fwrite((void*)(&dispbuf.rgb[j + i*vgax]), 1, 3, fg);
+ if(yuvmode==0) fwrite((void*)(&actVid2MemBufp.b[(j + i*vgax)<<2]), 1, 3, fg);
else {
if(j>=wndx>>1) break;
- mem2vid(fwbuf, dispbuf.yuv + j + (i*vgax>>1), 2, 32);
+ mem2vid(fwbuf, (s_yuv*)(&actVid2MemBufp.b[(j + (i*vgax>>1))<<2]), 2, 32);
fwbuf[3]=fwbuf[4];
fwbuf[4]=fwbuf[5];
@@ -63,7 +64,7 @@ void grab(void){
}
fclose(fg);
-
+ */
}
long fsize(FILE *f){
Modified: trunk/2010/2_gfunc.cc
==============================================================================
--- trunk/2010/2_gfunc.cc (original)
+++ trunk/2010/2_gfunc.cc Wed Jul 4 08:49:51 2007
@@ -6,13 +6,11 @@
#include "2_gfunc.h"
extern int vgax, vgay, xresc;
- extern int buttons, xpos, ypos, lxpos, lypos;
extern int fysize;
extern byte font[4096];
- extern int me, mx, my;
extern int g_mode;
extern int page_flip;
- extern xxx dispbuf;
+ extern VID2MEMBUF *actVid2MemBufp;
extern byte *vidbuf;
extern int yuvmode;
@@ -30,7 +28,7 @@ static inline void memsetd(void *pt, u_l
}
-void xcliped_gprint(int xp, int yp, const s_col c, int text){
+void xcliped_gprint(int xp, int yp, const COL c, int text){
int ix, iy;
int t3;
byte t1;
@@ -45,18 +43,19 @@ void xcliped_gprint(int xp, int yp, cons
for(; ix<8 && ix+xp<vgax; ix++){
if(((t1>>(7-ix)) & 1) == 1){
if(yuvmode!=0)
- dispbuf.yuv[(ix+t3)/2]=c.yuv; //FIX ME
- else
- dispbuf.rgb[(ix+t3)]=c.rgb;
+ ((long*) actVid2MemBufp->b)[(ix+t3)>>1]=c.yuv;
+ else
+ ((short*)actVid2MemBufp->b)[(ix+t3) ]=c.rgb16;
}
}
}
}
-void gprint(int xp, int yp, const s_col c, char *text){
+void gprint(int xp, int yp, const COL c, char *text){
static int clipyp, clipym;
int i, t=0, tp=0;
+
if(xp<0){
if(xp+int(strlen(text))*9+1<0) return;
i=(-xp+1)/9+1;
@@ -156,7 +155,7 @@ void gprint(int xp, int yp, const s_col
"popl %%ebp \n\t"
:
: "m" (fysize), "m"(xresc), "m" (&font), "m" (clipyp), "m" (clipym),
- "a" (c.yuv), "c" (text), "d" (((u_long)dispbuf.cl)+((xp+yp*vgax)<<1))
+ "a" (c.yuv), "c" (text), "d" (((u_long)actVid2MemBufp->b)+((xp+yp*vgax)<<1))
: "%ebx", "%ecx", "%edx", "%esi", "%edi");
}else{
asm(//"int $3\n\t"
@@ -175,47 +174,47 @@ void gprint(int xp, int yp, const s_col
"movb (%%ebx), %%bl \n\t"
"testb $128, %%ebx \n\t"
" jz 1f \n\t"
- "movl %%eax, (%%edx,%%esi)\n\t"
+ "movw %%ax, (%%edx,%%esi) \n\t"
"1: \n\t"
"testb $64, %%bl \n\t"
" jz 2f \n\t"
- "movl %%eax, 4(%%edx,%%esi)\n\t"
+ "movw %%ax, 2(%%edx,%%esi)\n\t"
"2: \n\t"
"testb $32, %%bl \n\t"
" jz 3f \n\t"
- "movl %%eax, 8(%%edx,%%esi)\n\t"
+ "movw %%ax, 4(%%edx,%%esi)\n\t"
"3: \n\t"
"testb $16, %%bl \n\t"
" jz 4f \n\t"
- "movl %%eax,12(%%edx,%%esi)\n\t"
+ "movw %%ax, 6(%%edx,%%esi)\n\t"
"4: \n\t"
"testb $8, %%bl \n\t"
" jz 5f \n\t"
- "movl %%eax,16(%%edx,%%esi)\n\t"
+ "movw %%ax, 8(%%edx,%%esi)\n\t"
"5: \n\t"
"testb $4, %%bl \n\t"
" jz 6f \n\t"
- "movl %%eax,20(%%edx,%%esi)\n\t"
+ "movw %%ax,10(%%edx,%%esi)\n\t"
"6: \n\t"
"testb $2, %%bl \n\t"
" jz 7f \n\t"
- "movl %%eax,24(%%edx,%%esi)\n\t"
+ "movw %%ax,12(%%edx,%%esi)\n\t"
"7: \n\t"
"testb $1, %%bl \n\t"
" jz 8f \n\t"
- "movl %%eax,28(%%edx,%%esi)\n\t"
+ "movw %%ax,14(%%edx,%%esi)\n\t"
"8: \n\t"
"incl %%edi \n\t"
"addl %1, %%esi \n\t"
"cmpl %3, %%edi \n\t"
" jb 0b \n\t"
- "addl $36, %%edx \n\t"
+ "addl $18, %%edx \n\t"
"incl %%ecx \n\t"
"jmp 10b \n\t"
"9: \n\t"
:
: "m" (fysize), "m"(xresc), "m" (&font), "m" (clipyp), "m" (clipym),
- "a" (c.rgb), "c" (text), "d" (((u_long)dispbuf.cl)+((xp+yp*vgax)<<2))
+ "a" (c.rgb16), "c" (text), "d" (((u_long)actVid2MemBufp->b)+((xp+yp*vgax)<<1))
: "%ebx", "%ecx", "%edx", "%esi", "%edi");
}
if(t!=0){
@@ -224,164 +223,3 @@ void gprint(int xp, int yp, const s_col
}
}
-void dot(const int x, const int y, const s_col c){
-
- if(x>0 && x<vgax && y>0 && y<vgay){
- if(yuvmode!=0){
- dispbuf.cl[y*vgax+x].lum=c.yuv.y1;
- dispbuf.cl[(y*vgax+x) | 1 ].chrom=c.yuv.v;
- dispbuf.cl[(y*vgax+x) & (~1)].chrom=c.yuv.u;
- }else{
- dispbuf.rgb[y*vgax+x].r=c.rgb.r;
- dispbuf.rgb[y*vgax+x].g=c.rgb.g;
- dispbuf.rgb[y*vgax+x].b=c.rgb.b;
- }
- }
-}
-/*
-void line(int x1, int y1, int x2, int y2, const s_yuv c){
- int t;
-
- if(x1<0){
- if(x2<0) return;
- else y1=(int)((float)(y1-y2)/((float)(x2-x1)+.1E-4)*(float)x2+y2), x1=0;
- }
- else if(x1>=vgax){
- if(x2>=vgax) return;
- else y1=(int)((float)(y1-y2)/((float)(x2-x1)+.1E-4)*(float)(x2-vgax+1)+y2), x1=vgax-1;
- }
- if(x2<0) y2=(int)((float)(y2-y1)/((float)(x1-x2)+.1E-4)*(float)x1+y1), x2=0;
- else if(x2>=vgax)
- y2=(int)((float)(y2-y1)/((float)(x1-x2)+.1E-4)*(float)(x1-vgax+1)+y1), x2=vgax-1;
-
-
- if(y1<0){
- if(y2<0) return;
- else x1=(int)((float)(x1-x2)/((float)(y2-y1)+.1E-4)*(float)y2+x2), y1=0;
- }
- else if(y1>=vgay){
- if(y2>=vgay) return;
- else
- x1=(int)((float)(x1-x2)/((float)(y2-y1)+.1E-4)*(float)(y2-vgay+1)+x2), y1=vgay-1;
- }
- if(y2<0) x2=(int)((float)(x2-x1)/((float)(y1-y2)+.1E-4)*(float)y1+x1), y2=0;
- else if(y2>=vgay)
- x2=(int)((float)(x2-x1)/((float)(y1-y2)+.1E-4)*(float)(y1-vgay+1)+x1), y2=vgay-1;
-
- if(x1==x2 && y1==y2) return;
-
- if(mabs(x1-x2)>mabs(y1-y2)){
- register int fl,delta;
- if(x1>x2) t=x1,x1=x2,x2=t,t=y1,y1=y2,y2=t,t=1;
- delta=(y1-y2)*(1<<16)/(x1-x2);
-
- for(fl=y1<<16; x1<x2; x1++){
- fl+=delta;
- dispbuf.yuv[(x1+(fl>>16)*vgax)>>1]=c; //FIX ME
- }
- }else {
- register int fl,delta;
- if(y1>y2) t=y1,y1=y2,y2=t,t=x1,x1=x2,x2=t,t=1;
- delta=(x1-x2)*(1<<10)/(y1-y2) + (vgax<<10);
- fl=(x1+y1*vgax)<<10;
- y2-=y1;
- for(; y2!=0; y2--){
- fl+=delta;
- dispbuf.yuv[(fl>>10)>>1]=c; //FIX ME
- }
-
- }
-}
- */
-
-void hline(register int x1, int y1, register int x2, const s_yuv c){
- int t;
- u_long *a=(u_long *)(&c);
-
- if(x1>x2) t=x1, x1=x2, x2=t;
-
- if(x1<0){
- x1=0;
- if(x2<0) return;
- }
- if(x2>=vgax){
- x2=vgax-1;
- if(x1>=vgax) return;
- }
- if(y1<0 || y1>=vgay) return;
-
- x1+=y1*vgax;
- memset(dispbuf.cl + x1, *a, ((x2+y1*vgax)-x1+1)<<1); //FIX HLINE
-}
-/*
-void vline(const int x1, register int y1, register int y2, const s_yuv c){
- int t;
-
- if(y1>y2) t=y1, y1=y2, y2=t;
-
- if(y1<0){
- y1=0;
- if(y2<0) return;
- }
- if(y2>=vgay){
- y2=vgay-1;
- if(y1>=vgay) return;
- }
- if(x1<0 || x1>=vgax) return;
-
- y1=y1*vgax+x1;
- y2=(y2-2)*vgax+x1;
- for(; y1<y2; y1+=vgax){
- dispbuf[y1]=c;
- dispbuf[y1+=vgax]=c;
- dispbuf[y1+=vgax]=c;
- dispbuf[y1+=vgax]=c;
- }
- y2+=vgax<<1;
- for(; y1<y2; y1+=vgax){
- dispbuf[y1]=c;
- }
-}
-*/
-
-void rect(int x1, int y1, int x2, int y2, const s_col c){
- u_long *a=(u_long *)(&c.yuv);
- int t;
-/*
- if(x1>x2) t=x1,x1=x2,x2=t;
- if(y1>y2) t=y1,y1=y2,y2=t; */
-
-
- if(x1<0){
- if(x2<0) return;
- x1=0;
- }
- else if(x2>=vgax){
- if(x1>=vgax) return;
- x2=vgax-1;
- }
- if(y1<0){
- if(y2<0) return;
- y1=0;
- }
- else if(y2>=vgay){
- if(y1>=vgay)
- y2=vgay-1;
- }
- y1*=xresc;
- y2*=xresc;
-
- t=x1 & (~1);
- if(yuvmode!=0){
- for(; y1<=y2; y1+=xresc){
- if(x1 & 1 == 1) {}
- memsetd((byte*)dispbuf.cl +y1 +(t<<1), *a, ((x2-x1)>>1));
- if(x2 & 1 == 1) {}
- }
- }else{
- for(; y1<=y2; y1+=xresc){
- memsetd((byte*)dispbuf.cl +y1 +(x1<<2), *a, x2-x1);
- }
- }
-
-}
Modified: trunk/2010/2_gfunc.h
==============================================================================
--- trunk/2010/2_gfunc.h (original)
+++ trunk/2010/2_gfunc.h Wed Jul 4 08:49:51 2007
@@ -2,15 +2,7 @@
#ifndef n2_gfunc_h
#define n2_gfunc_h
-void gprint(int xp, int yp, const s_col c, char *text);
-void xcliped_gprint(int xp, int yp, const s_col c, int text);
-void dot(const int x, const int y, const s_col c);
-void line(int x1, int y1, int x2, int y2, const s_col c);
-
-void hline(register int x1, int y1, register int x2, const s_col c);
-
-void vline(const int x1, register int y1, register int y2, const s_col c);
-
-void rect(int x1, int y1, int x2, int y2, const s_col c);
+void gprint(int xp, int yp, const COL c, char *text);
+void xcliped_gprint(int xp, int yp, const COL c, int text);
#endif
Modified: trunk/2010/2_grafix.cc
==============================================================================
--- trunk/2010/2_grafix.cc (original)
+++ trunk/2010/2_grafix.cc Wed Jul 4 08:49:51 2007
@@ -5,79 +5,85 @@
#include <string.h>
#include "2_all.h"
#include "2_grafix.h"
+#include "2010.h"
#include "2_gfunc.h"
#include "2_hw.h"
-#include "2_menu.h"
#include "2_file.h"
-#include "2_wins.h"
#include "2_crypt.h"
extern int xres, yres, xresc;
- extern int buttons, xpos, ypos, lxpos, lypos;
extern int fysize;
extern byte font[4096];
- extern int me, mx, my;
extern int grabf;
- extern xxx dispbuf, grab_dispbuf;
- extern menu menu_main[];
extern int yuvmode;
extern volatile int addr_errors, corr_errors;
extern int single;
- int infox, infoy;
- int istate=1;
- int conty_b, conty_s, conty_c, contx_b, contx_s, contx_c;
- int cstate=1;
+ extern int bright, contr, satur;
+ extern MENULEVEL menuLevel;
+ extern int infoPosY;
- long T1,T2,T3;
+ bool helpState=true;
+ bool iState=false;
+ int showCont=0;
-void draw_dispbuf(void){
+void showStuff(void){
char textbuf[256];
color c;
- T2=uclock();
-
- decrypt();
-
- if(istate==1){
- T1=uclock();
- sprintf(textbuf,"%f Decrypt", (float)(T1-T2)/UCLOCKS_PER_SEC);
- c.init(255, 0, 0, yuvmode);
- gprint(30, 30, c.c, textbuf);
-
- sprintf(textbuf,"%f Fps",1/((float)(T1-T3)/UCLOCKS_PER_SEC));
- c.init(255, 0, 0, yuvmode);
- gprint(50, 50, c.c, textbuf);
-
- sprintf(textbuf,"%d Corrupted Fields", corr_errors);
- c.init(255, 0, 0, yuvmode);
- gprint(60, 60, c.c, textbuf);
+ if(helpState){
+ char text[5][256]={ "F1/F2 Brightness s TVStandart",
+ "F3/F4 Contrast i debugInfo",
+ "F5/F6 Saturation h Help",
+ "g ScreenShot q Quit",
+ "v smoothIterlace"};
+ for(int i=0; i<5; i++){
+ c.init(255, 0, 0, yuvmode);
+ gprint(10, infoPosY+=10, c.col, text[i]);
+ }
+ infoPosY+=5;
+ }
- sprintf(textbuf,"%d Address error's", addr_errors);
+ if(showCont!=0){
+ showCont--;
+ sprintf(textbuf,"%3.1f%% brightness", bright/2.55);
c.init(255, 0, 0, yuvmode);
- gprint(70, 70, c.c, textbuf);
- T3=T2=T1;
+ gprint(10, infoPosY+=10, c.col, textbuf);
+ sprintf(textbuf,"%3.1f%% contrast" , contr/1.27);
+ gprint(10, infoPosY+=10, c.col, textbuf);
+ sprintf(textbuf,"%3.1f%% saturation", satur/1.27);
+ gprint(10, infoPosY+=10, c.col, textbuf);
+ infoPosY+=5;
}
- if(grabf==1) grab(), grabf=0;
-
- if(me!=0) disp_menu(menu_main, mx+4, my+4, 0); // +4 for mistakely menu hit
-
- if(me==0 && istate==1){
- // print info
-
+ if(menuLevel==mLTVStd){
+ char text[3][256]={ "1. PAL 4. VideoCrypt (PAL)",
+ "2. NTSC 5. NagraVision (PAL/SECAM)",
+ "3. SECAM"};
+ for(int i=0; i<3; i++){
+ c.init(255, 0, 0, yuvmode);
+ gprint(10, infoPosY+=10, c.col, text[i]);
+ }
+ infoPosY+=5;
}
- if(cstate==1) drawc();
+ static long T2=uclock();
+ long T1=uclock();
- if(istate==1){
- T2=uclock();
- sprintf(textbuf,"%f Misc",(float)(T2-T1)/UCLOCKS_PER_SEC);
+ if(iState){
+ sprintf(textbuf,"%2.2f Fps",1/((float)(T1-T2)/UCLOCKS_PER_SEC));
c.init(255, 0, 0, yuvmode);
- gprint(40, 40, c.c, textbuf);
+ gprint(10, infoPosY+=10, c.col, textbuf);
+
+ sprintf(textbuf,"%d Corrupted Fields", corr_errors);
+ gprint(10, infoPosY+=10, c.col, textbuf);
+
+ sprintf(textbuf,"%d Address error's", addr_errors);
+ gprint(10, infoPosY+=10, c.col, textbuf);
+ infoPosY+=5;
}
- copy_vidbuffer();
+ T2=T1;
}
Modified: trunk/2010/2_grafix.h
==============================================================================
--- trunk/2010/2_grafix.h (original)
+++ trunk/2010/2_grafix.h Wed Jul 4 08:49:51 2007
@@ -2,6 +2,6 @@
#ifndef n2_grafix_h
#define n2_grafix_h
-void draw_dispbuf(void);
+void showStuff(void);
#endif
Modified: trunk/2010/2_hw.cc
==============================================================================
--- trunk/2010/2_hw.cc (original)
+++ trunk/2010/2_hw.cc Wed Jul 4 08:49:51 2007
@@ -14,59 +14,171 @@
#include "2_hw_asm.h"
#include "2_hw_mem.h"
#include "2_71x6.h"
-#include "2_mouse.h"
#include "2_mmx.h"
#include "2010.h"
- extern int NoInt8;
-
extern byte lock_start, lock_end;
- extern dword old_int8_vect_offset;
- extern word old_int8_vect_selector;
- extern byte int8_handler;
extern int bpp;
- extern volatile long timer_count;
- extern volatile __dpmi_regs mouse_regs;
- extern volatile int mouse_handler_enable;
extern volatile int page_flip;
extern volatile int yuvmode;
extern volatile AllocList *alloclist;
- extern volatile int fresh_cursor;
- extern volatile xxx dispbuf, *doubleBuff;
+ extern volatile VID2MEMBUF *vid2MemBuf, *actVid2MemBufp;
+ extern volatile int grabVid2MemBuf, actVid2MemBuf;
extern volatile int one_field;
extern volatile int active_meteor;
extern volatile meteor meteors[8];
extern volatile int fields;
- extern int mouse_x, mouse_y, mouse_b;
- extern int mouse_lx, mouse_ly;
extern byte *vidbuf;
- extern int vgax, vgay, xresc, xresvb, vb, mc;
- extern mouse_sprites cursor;
- extern char *yuv2rgb_lut;
- extern byte *mouse_buff[2];
- extern int amb; //active_mouse_buffer
+ extern int vgax, vgay, xresc, xresvb, vb, mc, wndy, wndx;
+ extern int *yuv2RgbLut;
extern int single;
extern int in_int;
- extern int mouse_tim;
- extern int mouse_ltim;
extern volatile int frames;
+ extern bool strangeRgb16;
int g_mode=0;
int m_mode=0;
extern u_short my_cs, my_ds;
asm("__esp: .long 0\n\t");
- static inline void setdot(int xx, int yy, s_col c);
- static inline s_col getdot(int xx, int yy);
+ asm("__temp1: .long 0\n\t");
-void mem2vid(byte *to, s_yuv *from, int num, int bpp){
+ int VID2MEMBUF::num;
+
+void mem2vid(byte *to, byte *from, int num, int bpp){
int i;
if(yuvmode!=0){
+ asm(//"int $3 \n\t"
+ "pushl %%ebp \n\t"
+ "movl %%eax, %%ebp \n\t"
+ "movl %%esp, (__esp) \n\t"
+
+ "addl %%ecx, %%esi \n\t"
+ "addl %%ecx, %%edi \n\t"
+ "negl %%ecx \n\t"
+ "movl (%%esi, %%ecx), %%eax \n\t"
+ "movl %%esi, (__temp1) \n\t"
+
+ "1: \n\t"
+ "movl %%eax, %%edx \n\t"
+ "andl $0xFE, %%eax \n\t"
+
+ "movl %%edx, %%ebp \n\t"
+ "andl $0xFE00, %%edx \n\t"
+
+ "shrl $8, %%edx \n\t"
+ "movl (%%ebx, %%eax, 4), %%esp \n\t"
+
+ "shrl $16, %%ebp \n\t"
+ "movl 4(%%ebx, %%eax, 4), %%eax \n\t"
+
+ "movl 1024(%%ebx, %%edx, 4), %%esi \n\t"
+ "movl 1028(%%ebx, %%edx, 4), %%edx \n\t"
+
+ "addl %%esi, %%esp \n\t"
+ "addl %%edx, %%eax \n\t"
+
+ "movl %%ebp, %%edx \n\t"
+ "andl $0xFE, %%ebp \n\t"
+
+ "shrl $8, %%edx \n\t"
+ "andl $0x7FEFF9FF, %%esp \n\t"
+
+ "andl $0xFE, %%edx \n\t"
+ "movl 2048(%%ebx, %%ebp, 4), %%esi \n\t"
+
+ "andl $0x7FCFFBFF, %%eax \n\t"
+ "movl 2052(%%ebx, %%ebp, 4), %%ebp \n\t"
+
+ "addl %%esi, %%esp \n\t"
+ "addl %%ebp, %%eax \n\t"
+
+ "andl $0x7FEFF9FF, %%esp \n\t"
+ "movl 3072(%%ebx, %%edx, 4), %%esi \n\t"
+
+ "andl $0x7FCFFBFF, %%eax \n\t"
+ "movl 3076(%%ebx, %%edx, 4), %%edx \n\t"
+
+ "addl %%esi, %%esp \n\t"
+ "addl %%edx, %%eax \n\t"
+
+ "test $0x600C0180, %%esp \n\t"
+ " jz 2f \n\t"
+
+ "movl %%esp, %%esi \n\t"
+ "movl %%esp, %%edx \n\t"
+
+ "shrl $7, %%esi \n\t"
+ "andl $0x40080100, %%edx \n\t"
+
+ "shrl $8, %%edx \n\t"
+ "andl $0x00400801, %%esi \n\t"
+
+ "addl $0xEFDFFBFF, %%edx \n\t"
+ "addl $0xEFDFFBFF, %%esi \n\t"
+
+ "xorl $0x10200400, %%edx \n\t"
+ "xorl $0xEFDFFBFF, %%esi \n\t"
+
+ "orl %%esi, %%esp \n\t"
+
+ "andl %%edx, %%esp \n\t"
+
+ "2: \n\t"
+ "test $0x600C0300, %%eax \n\t"
+ " jz 3f \n\t"
+
+ "movl %%eax, %%esi \n\t"
+ "movl %%eax, %%edx \n\t"
+
+ "shrl $8, %%esi \n\t"
+ "andl $0x40080200, %%edx \n\t"
+
+ "shrl $9, %%edx \n\t"
+ "andl $0x00200401, %%esi \n\t"
+
+ "addl $0xEFEFFDFF, %%edx \n\t"
+ "addl $0xEFEFFDFF, %%esi \n\t"
+
+ "xorl $0x10100200, %%edx \n\t"
+ "xorl $0xEFEFFDFF, %%esi \n\t"
+
+ "orl %%esi, %%eax \n\t"
+
+ "andl %%edx, %%eax \n\t"
+
+ "3: \n\t"
+
+ "shrl $2, %%esp \n\t"
+ "movl (__temp1), %%esi \n\t"
+
+ "shll $3, %%eax \n\t"
+ "andl $0x07E0F81F, %%esp \n\t"
+
+ "andl $0xF81F07E0, %%eax \n\t"
+
+ "orl %%eax, %%esp \n\t"
+
+ "movl %%esp, (%%edi, %%ecx) \n\t"
+
+ "movl 4(%%esi, %%ecx), %%eax \n\t"
+ "addl $4, %%ecx \n\t"
+
+ "jnc 1b \n\t"
+
+ "movl (__esp), %%esp \n\t"
+ "popl %%ebp \n\t"
+ :
+ : "b" (yuv2RgbLut), "S" (from), "D" (to), "c" (num<<1)
+ : "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi");
+
+
+
+/*
num>>=1;
if(bpp==32){
-/*
U Y1 V Y2
esi from
@@ -77,7 +189,6 @@ void mem2vid(byte *to, s_yuv *from, int
ebx Y1 Y1 Y1 Y1 + LUT[ U ] + LUT[ V ]
edx Y2 Y2 Y2 Y2 + LUT[ U ] + LUT[ V ]
esp
- */
asm(//"int $3 \n\t"
"pushl %%ebp \n\t"
"movl %%eax, %%ebp \n\t"
@@ -197,7 +308,6 @@ void mem2vid(byte *to, s_yuv *from, int
-
}
else{
for(i=0; i<num; i++){
@@ -209,160 +319,43 @@ void mem2vid(byte *to, s_yuv *from, int
to[i*6+5]= (byte)( from[i].y2 + yuv2rgb_lut[(int(from[i].v)<<1) + 513] );
}
}
+ */
+
}else{
- if(bpp==32) memcpy(to, from, num<<2);
- else{
- if(num>>2==0) return;
- asm("//int $3 \n\t"
- "0: \n\t"
- "movl (%%esi), %%eax \n\t" // U
- "movl 4(%%esi), %%edx \n\t" // V 1
- "rorl $8, %%edx \n\t" // UV 1
- "movl %%edx, %%ebx \n\t" // U
- "andl $0xff000000, %%edx \n\t" // V 1
- "orl %%edx, %%eax \n\t" // U
- "andl $0x0000ffff, %%ebx \n\t" // V 1
+ if(strangeRgb16){
+ asm("addl %%ecx, %%esi \n\t"
+ "addl %%ecx, %%edi \n\t"
+ "negl %%ecx \n\t"
+
+ "movl (%%esi, %%ecx), %%eax \n\t"
+ "1: \n\t"
+ " movl %%eax, %%ebx \n\t"
+ " andl $0xFFE0FFE0, %%eax \n\t"
- "movl %%eax, (%%edi) \n\t" // U
- "movl 8(%%esi), %%edx \n\t" // V 1
- "rorl $16, %%edx \n\t" // UV 1
- "movl %%edx, %%eax \n\t" // U
- "andl $0xffff0000, %%edx \n\t" // V 1
- "orl %%edx, %%ebx \n\t" // U
- "andl $0x000000ff, %%eax \n\t" // V 1
+ " shll $1, %%eax \n\t"
+ " andl $0x001F001F, %%ebx \n\t"
- "movl %%ebx, 4(%%edi) \n\t" // U
- "movl 12(%%esi), %%edx \n\t" // V 1
- "rorl $24, %%edx \n\t" // UV 1
- "orl %%edx, %%eax \n\t" // U
+ " orl %%eax, %%ebx \n\t"
+ " movl 4(%%esi, %%ecx), %%eax \n\t"
- "addl $16, %%esi \n\t" // V 1
- "movl %%eax, 8(%%edi) \n\t" // U
- "addl $12, %%edi \n\t" // V 1
- "decl %%ecx \n\t" // U
- " jnz 0b \n\t" // V 1
+ " movl %%ebx, (%%edi, %%ecx) \n\t"
+ " addl $4, %%ecx \n\t"
+
+ "jnc 1b \n\t"
:
- : "S" (from), "D" (to), "c" (num>>2)
+ : "d" (vgax<<1), "S" (from), "D" (to), "c" (num<<1)
: "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi");
-
}
- }
-}
-
-void disabled_call_mouse_handler(void){
-
- if(mouse_handler_enable==0) return;
- mouse_handler_enable=0;
- mouse_regs.x.ax=0;
- mouse_handler();
- mouse_regs.x.ax=1;
- mouse_handler_enable=1;
-}
-
-void mouse_handler(void){
- int i, j, k, l;
- color c;
-
- if((mouse_handler_enable==0 && mouse_regs.x.ax!=0) || in_int!=0) return;
- in_int++;
-
- mouse_b=mouse_regs.x.bx;
- mouse_x=mouse_regs.x.cx;
- mouse_y=mouse_regs.x.dx;
-
- if(mouse_x>=vgax) mouse_x=vgax-1;
- if(mouse_y>=vgay) mouse_y=vgay-1;
-
- for(j=0; j < cursor.y && mouse_y + j - cursor.hoty < vgay; j++){
- if(j + mouse_y - cursor.hoty>=0){
- for(i=0 ; i < cursor.x && mouse_x + i - cursor.hotx < vgax; i++){
- if( i + mouse_x - cursor.hotx>=0){
- k=cursor.data[i + (j + mouse_tim*cursor.y)*cursor.x];
-
- int d_x=mouse_x - mouse_lx + i;
- int d_y=mouse_y - mouse_ly + j;
- if( d_x >= 0 && d_x < cursor.x
- && d_y >= 0 && d_y < cursor.y && fresh_cursor==0)
- c.c.a=*(u_long *)(mouse_buff[amb] + (d_x + d_y*cursor.x)*vb);
- else
- c.c=getdot(mouse_x + i - cursor.hotx, mouse_y + j - cursor.hoty);
-
- *(u_long *)(mouse_buff[amb^1] + (i + j*cursor.x)*vb)=c.c.a;
-
- if(k!=255)
- c.c.rgb.r= c.c.rgb.g= c.c.rgb.b= k<<3;
-
- setdot(mouse_x + i - cursor.hotx, mouse_y + j - cursor.hoty, c.c);
-
- }
- }
- }
- }
-
- for(j=0; j < cursor.y && mouse_ly + j - cursor.hoty < vgay; j++){
- if(j + mouse_ly - cursor.hoty>=0){
- for(i=0; i < cursor.x && mouse_lx + i - cursor.hotx < vgax; i++){
- if( i + mouse_lx - cursor.hotx>=0){
- k=i - mouse_x + mouse_lx;
- l=j - mouse_y + mouse_ly;
- if( k<0 || k>=cursor.x
- || l<0 || l>=cursor.y){
-
- if(cursor.data[i + (j + mouse_ltim*cursor.y)*cursor.x]!=255
- && fresh_cursor==0){
- c.c.a=*(u_long *)(mouse_buff[amb] + (i + j*cursor.x)*vb);
- setdot(mouse_lx + i - cursor.hotx, mouse_ly + j - cursor.hoty, c.c);
- }
- }
- }
- }
+ else{
+ memcpy(to, from, num<<1);
}
}
-
- amb^=1;
- fresh_cursor=0;
- mouse_lx=mouse_x;
- mouse_ly=mouse_y;
- mouse_ltim=mouse_tim;
- mouse_tim=timer_count % cursor.z;
-
-
- in_int--;
-}
-
-static inline void setdot(int xx, int yy, s_col c){
- int ppvb=xx*vb + yy*xresvb;
-
- if(page_flip==1) ppvb+=xresvb*vgay;
-
- vidbuf[ppvb ]=c.rgb.b;
- vidbuf[ppvb+1]=c.rgb.g;
- vidbuf[ppvb+2]=c.rgb.r;
-}
-
-static inline s_col getdot(int xx, int yy){
- int ppvb=xx*vb + yy*xresvb;
-
- if(page_flip==1) ppvb+=xresvb*vgay;
-
- return *(s_col* )(vidbuf + ppvb);;
}
void close_hw(void){
__dpmi_regs r;
__dpmi_paddr address;
- if(m_mode==1){
- r.x.ax=0;
- __dpmi_int(0x33, &r); //reset mouse
-
- address.offset32=old_int8_vect_offset;
- address.selector=old_int8_vect_selector;
- __dpmi_set_protected_mode_interrupt_vector(8, &address);
-
- }
- m_mode=0;
-
close_meteor();
unlockall();
unmapall();
@@ -391,71 +384,17 @@ void end_func(void){}
void init_hw(void){
__dpmi_regs r;
- static _go32_dpmi_seginfo mouse_info;
__dpmi_paddr address;
my_cs=_go32_my_cs();
my_ds=_go32_my_ds();
- r.x.ax=0;
- __dpmi_int(0x33, &r); //reset mouse
- if(r.x.ax==0) error(NoMouse);
-
- r.x.ax=7;
- r.x.cx=0;
- r.x.dx=vgax;
- __dpmi_int(0x33, &r); //set horizontal cursor range
-
- r.x.ax=8;
- r.x.cx=0;
- r.x.dx=vgay;
- __dpmi_int(0x33, &r); //set vertical cursor range
-
- r.x.ax=4;
- r.x.cx=0;
- r.x.dx=0;
- __dpmi_int(0x33, &r); //set mouse pos
-
- // set Mouse Handler
-
save_selectors();
- if(__dpmi_get_protected_mode_interrupt_vector(8, &address)!=0) error(DPMI);
- old_int8_vect_offset =address.offset32;
- old_int8_vect_selector=address.selector;
-
- m_mode=1;
-
-
lock(&lock_start, &lock_end);
- lock(&disabled_call_mouse_handler, &end_func);
-
- lock(cursor.data , cursor.data + cursor.x * cursor.y * cursor.z);
-
- lock(mouse_buff[0] , mouse_buff[0] + (cursor.x * cursor.y<<2) );
- lock(mouse_buff[1] , mouse_buff[1] + (cursor.x * cursor.y<<2) );
-
lock(meteor_int_handler, meteor_int_handler_end);
-
- address.offset32=(unsigned long)(&int8_handler);
- address.selector=my_cs;
- if(NoInt8==0)
- if(__dpmi_set_protected_mode_interrupt_vector(8, &address)!=0) error(DPMI);
-
-
- mouse_info.pm_offset=(unsigned long) mouse_handler;
-
- if((_go32_dpmi_allocate_real_mode_callback_retf(&mouse_info, (__dpmi_regs*)(&mouse_regs)))
- !=0) error(MouseHand);
-
- r.x.ax=0x0c;
- r.x.cx=1+2+4+8+16+32+64;
- r.x.es=mouse_info.rm_segment;
- r.x.dx=mouse_info.rm_offset;
- __dpmi_int(0x33, &r); //set Handler
-
}
VesaInfoBlock *get_vesa_info(void)
@@ -507,74 +446,42 @@ void copy_vidbuffer(void){
int i, j;
if(page_flip==0){
- for(i=0; i<vgay; i++){
- mem2vid(vidbuf + i*xresvb, (s_yuv*)((byte*)(dispbuf.yuv) + i*xresc), vgax, bpp);
-
- if(mouse_y - cursor.hoty <= i && mouse_y + cursor.y - cursor.hoty > i){
- disabled_call_mouse_handler();
- mouse_handler_enable=0;
- int mouse__x =mouse_x - cursor.hotx;
- int mouse__xe=mouse_x + cursor.x - cursor.hotx;
- int mouse__ye=mouse_y + cursor.y - cursor.hoty;
-
- if(mouse__x<0) mouse__x=0;
- else if(mouse__xe>=vgax) mouse__xe=vgax-1;
- if(mouse__ye>=vgay) mouse__ye=vgay-1;
-
- j=mouse__xe & (~1);
-
- for(; i < vgay && i < mouse__ye; i++ ){
- mem2vid(vidbuf + i*xresvb, (s_yuv*)((byte*)(dispbuf.yuv) + i*xresc), mouse__x, bpp);
- mem2vid(vidbuf + i*xresvb + j*vb,
- (s_yuv*)((byte*)(dispbuf.yuv) + (i*xresc + (j<<mc))),
- vgax - j - 1, bpp);
- }
- i--;
- mouse_handler_enable=1;
- }
+ int p=0;
+ for(int y=0; y<wndy; y++){
+ mem2vid(vidbuf+p, actVid2MemBufp->b+p, wndx, bpp);
+ p+=vgax<<1;
}
}else if(page_flip==2){
- mem2vid(vidbuf+xresvb*vgay, dispbuf.yuv, vgax*vgay, bpp);
+ int p=0;
+ for(int y=0; y<wndy; y++){
+ mem2vid(vidbuf+xresvb*vgay+p, actVid2MemBufp->b+p, wndx, bpp);
+ p+=vgax<<1;
+ }
page_flip=1;
- fresh_cursor=1;
- disabled_call_mouse_handler();
set_start_disp(0, vgay);
}else{
- mem2vid(vidbuf, dispbuf.yuv, vgax*vgay, bpp);
+ int p=0;
+ for(int y=0; y<wndy; y++){
+ mem2vid(vidbuf+p, actVid2MemBufp->b+p, wndx, bpp);
+ p+=vgax<<1;
+ }
page_flip=2;
- fresh_cursor=1;
- disabled_call_mouse_handler();
set_start_disp(0, 0);
}
- if(single==0){
-
- int workingOne=0;
- while(doubleBuff[workingOne].state!=Working && workingOne<2) workingOne++;
- if(workingOne==2) workingOne=0; // should be only at start
- doubleBuff[workingOne].state=Empty;
-
- int nextOne= workingOne^1;
- if(doubleBuff[nextOne].state==Empty) nextOne=0; // not critical
-
- while(doubleBuff[nextOne].state != Grabbed);
-
- doubleBuff[nextOne].state= Working;
-
- dispbuf= doubleBuff[nextOne];
+ if( vid2MemBuf[actVid2MemBuf].state==Working ){
+ vid2MemBuf[actVid2MemBuf].state=Empty;
}
- else{
- doubleBuff[0].state=
- doubleBuff[1].state=Empty;
+ actVid2MemBuf++;
+ if(actVid2MemBuf >= vid2MemBuf[0].num) actVid2MemBuf=0;
- while(doubleBuff[0].state != Grabbed);
+ while( vid2MemBuf[ actVid2MemBuf ].state!= Grabbed );
- doubleBuff[0].state=
- doubleBuff[1].state=Working;
+ vid2MemBuf[ actVid2MemBuf ].state= Working;
- dispbuf= doubleBuff[0];
- }
+
+ actVid2MemBufp= &vid2MemBuf[ actVid2MemBuf ];
/*
printf("%X, %X\n", meteors[active_meteor].saa7116->capt_ctl_a,
Modified: trunk/2010/2_hw.h
==============================================================================
--- trunk/2010/2_hw.h (original)
+++ trunk/2010/2_hw.h Wed Jul 4 08:49:51 2007
@@ -89,7 +89,7 @@ void sig_handler(int i);
void end_func(void);
u_long read_pci(int,int,int,int,int);
void write_pci(int,int,int,int,int,u_long);
-void mem2vid(byte *to, s_yuv *from, int num, int bpp);
+void mem2vid(byte *to, byte *from, int num, int bpp);
int check_mmx(void);
#endif
Modified: trunk/2010/2_hw_asm.s
==============================================================================
--- trunk/2010/2_hw_asm.s (original)
+++ trunk/2010/2_hw_asm.s Wed Jul 4 08:49:51 2007
@@ -3,26 +3,15 @@
_lock_start:
.globl _lock_start
-.globl _timer_count
-.globl _old_int8_vect_offset
-.globl _old_int8_vect_selector
-.globl _int8_handler
.globl _meteor_handler
.globl _lock_end
.globl _save_selectors__Fv
-.globl _mouse_regs
-.globl _mouse_handler_enable
.globl _in_int
-.globl _mouse_lx
-.globl _mouse_ly
-.globl _mouse_tim
-.globl _mouse_ltim
-.globl _mouse_x
-.globl _mouse_y
-.globl _mouse_b
.globl _page_flip
-.globl _dispbuf
-.globl _doubleBuff
+.globl _vid2MemBuf
+.globl _actVid2MemBufp
+.globl _actVid2MemBuf
+.globl _grabVid2MemBuf
.globl _vidbuf
.globl _vgax
.globl _xresvb
@@ -30,7 +19,6 @@
.globl _mc
.globl _xresc
.globl _vgay
-.globl _cursor
.globl _yuvmode
.globl _locklist
.globl _alloclist
@@ -48,20 +36,16 @@
.globl _frames
.globl _fields
.globl _saa7196_buf
-.globl _std
+.globl _TVStd
.globl _x_field
.globl _y_field
-.globl _one_field
-.globl _amb
-.globl _mouse_buff
-.globl _fresh_cursor
+.globl _oneField
.globl _stride
.globl _single
-.globl _crypt
+.globl _cryptStd
.globl _wndx
.globl _wndy
.globl _outy
-.globl _nagra_mode
.globl _mmx
.globl _my_cs
.globl _my_ds
@@ -71,30 +55,13 @@
.align 4
-_timer_count: .long 0
-_mouse_handler_enable: .long 1
_in_int: .long 0
-_mouse_lx: .long 0
-_mouse_ly: .long 0
-_mouse_tim: .long 0
-_mouse_ltim: .long 0
-_mouse_x: .long 0
-_mouse_y: .long 0
-_mouse_b: .long 0
_page_flip: .long 0
-_dispbuf: .long 0
-.long 0
-.long 0
-.long 0
-_doubleBuff: .long 1234
-.long 0
-.long 0
-.long 0
-.long 0
-.long 0
-.long 0
-.long 0
-.long 4321
+_actVid2MemBufp: .long 0
+_actVid2MemBuf: .long 0
+_grabVid2MemBuf: .long 0
+_vid2MemBuf: .long 0
+.space 64, 0
_vidbuf: .long 0
_vgax: .long 0
_vb: .long 0
@@ -119,28 +86,21 @@ _corr_errors: .long 0
_frames: .long 0
_fields: .long 0
_saa7196_buf: .space 52, 0
-_std: .long 0
+_TVStd: .long 0
_x_field: .long 0
_y_field: .long 0
-_one_field: .long 0
-_amb: .long 0
-_mouse_buff: .long 0
- .long 0
-_fresh_cursor: .long 1
+_oneField: .long 0
_stride: .long 0
_single: .long 0
-_crypt: .long 0
+_cryptStd: .long 0
_wndx: .long 0
_wndy: .long 0
_outy: .long 0
-_nagra_mode: .long 0
_mmx: .long 1
_my_cs: .word 0
_my_ds: .word 0
_meteors: .space 0x80, 0
-_cursor: .space 0x40, 0
-_mouse_regs: .space 0x40, 0
_ds: .word 0
_es: .word 0
@@ -205,35 +165,6 @@ _real_int__FsP11__dpmi_regs:
ret
.align 4
-_int8_handler:
-
- pushal
- pushw %ds
- pushw %es
- pushw %fs
- pushw %gs
-
- movw %cs:_ds, %ds
- movw _es, %es
- movw _fs, %fs
- movw _gs, %gs
-
- incl _timer_count
-
- call _disabled_call_mouse_handler__Fv
-
- popw %gs
- popw %fs
- popw %es
- popw %ds
- popal
-
-.byte 0xEA
-_old_int8_vect:
-_old_int8_vect_offset: .long 0
-_old_int8_vect_selector: .word 0
-
-.align 4
_meteor_handler:
// int $3
Modified: trunk/2010/2_hw_mem.cc
==============================================================================
--- trunk/2010/2_hw_mem.cc (original)
+++ trunk/2010/2_hw_mem.cc Wed Jul 4 08:49:51 2007
@@ -11,7 +11,8 @@
#include "2_hw_mem.h"
#include "2010.h"
- extern volatile xxx dispbuf, last_dispbuf, grab_dispbuf;
+ extern volatile VID2MEMBUF *vid2MemBuf, actVid2MemBufp;
+ extern volatile int actVid2MemBuf, grabVid2MemBuf;
extern volatile LockList *locklist;
extern volatile AllocList *alloclist;
extern volatile VdsList *vdslist;
@@ -193,8 +194,7 @@ void dpmi_freeall(volatile AllocList **a
}
-xxx *alloc_cont(int size, int num){
- static xxx ret[2];
+void allocCont(VID2MEMBUF *v2mb, int size, int *num){
u_long addr;
size= (size + 4095) & (~4095); //round up to next 4096 boundray
@@ -205,72 +205,61 @@ xxx *alloc_cont(int size, int num){
addr=(u_long)map(2048*1024, 2048*1024 + 1024*1024); //check if mapping of RAM is ok
unmap((void*)addr);
- bool both;
- if(num==2){
- both=true;
- size<<=1;
- }else
- both=false;
-
dds vds_info;
- for(int i=0; i<num; i++){
- int slack=0;
- for(;;){
- vds_info= vds_alloc(size + slack);
+ int left=*num;
+ for(int tryi=left; tryi>0; tryi=min(tryi-1, left) ){
+ for(int slack=0; ; slack+=4096){
+ vds_info= vds_alloc(size*tryi + slack);
if(vds_info.phys==0xFFFFFFFF){
- if(!both) error(MemAlloc);
- both=false;
- size>>=1;
- slack=0;
+ break;
}else{
- printf("AllocatedContVDS %d, at Address %lX\n", size + slack , vds_info.phys);
+ printf("AllocatedContVDS %d, at Address %lX\n", size*tryi + slack , vds_info.phys);
fflush(stdout);
const int j=~(1024*1024*4-1);
- if(both){
- if( ( ((vds_info.phys + slack ) & j)
- ==((vds_info.phys + slack + (size>>1)-1) & j) )
- && ( ((vds_info.phys + slack + (size>>1) ) & j)
- ==((vds_info.phys + slack + size -1) & j) ) ) break;
- }else{
- if( ((vds_info.phys + slack ) & j)
- == ((vds_info.phys + slack + size-1) & j) ) break;
+
+ int i;
+ for(i=0; i<tryi; i++){
+ if( ((vds_info.phys + slack + size*i ) & j)
+ != ((vds_info.phys + slack + size*i + size-1) & j) ) break;
+ }
+ if(i==tryi){
+ printf("Success!\n");
+ fflush(stdout);
+
+ for(int k=0; k<tryi; k++){
+ v2mb[*num-left+k].b=
+ (byte*)( map( vds_info.phys + slack + size*k
+ , vds_info.phys + slack + size*k + size) // FIX ?-1
+ - __djgpp_base_address);
+
+ v2mb[*num-left+k].phys= vds_info.phys + size*k + slack;
+ }
+
+ left-=tryi;
+ tryi++;
+
+ break;
}
printf("4MB Boundray violation!\n");
fflush(stdout);
vds_free(&vds_info);
+
}
- slack+=4096;
}
+ }
- if(both){
- size>>=1;
-
- ret[0].b= (byte*)(map(
- vds_info.phys + slack , vds_info.phys + slack + size)
- - __djgpp_base_address);
-
- ret[1].b= (byte*)(map(
- vds_info.phys + slack + size, vds_info.phys + slack + size + size)
- - __djgpp_base_address);
- ret[0].phys= vds_info.phys + slack;
- ret[1].phys= vds_info.phys + slack + size;
- break;
- }else{
- ret[i].b= (byte*)(map(
- vds_info.phys + slack , vds_info.phys + slack + size)
- - __djgpp_base_address);
- ret[i].phys= vds_info.phys + slack;
- }
+ *num-=left;
+ if(*num==0) error(MemAlloc);
+ v2mb[0].num= *num;
+ for(int i=0; i<*num; i++){
+ v2mb[0].state= Empty;
}
- if(num==1) ret[1]= ret[0];
-
- return ret;
}
void checkVDS(void){
Modified: trunk/2010/2_hw_mem.h
==============================================================================
--- trunk/2010/2_hw_mem.h (original)
+++ trunk/2010/2_hw_mem.h Wed Jul 4 08:49:51 2007
@@ -44,7 +44,7 @@ void dpmi_addlinlock(volatile AllocList
u_long dpmi_alloclinlock(volatile AllocList **al);
void dpmi_freelinlock(volatile AllocList *old, volatile AllocList **al);
void dpmi_freeall(volatile AllocList **al);
-xxx *alloc_cont(int size, int num);
+void allocCont(VID2MEMBUF *v2mb, int size, int *num);
void checkVDS(void);
u_long getphys(u_long);
dds vds_alloc(int size);
Modified: trunk/2010/2_nag.cc
==============================================================================
--- trunk/2010/2_nag.cc (original)
+++ trunk/2010/2_nag.cc Wed Jul 4 08:49:51 2007
@@ -17,12 +17,12 @@
#define dwnSmp 1
extern vgax, vgay, wndx, wndy, outy, y_field;
-extern xxx dispbuf;
+extern VID2MEMBUF *actVid2MemBufp;
extern volatile int scales_x, scalee_x;
extern volatile int scales_y, scalee_y;
extern int one_field;
extern u_long asm_temp, asm_temp4;
-extern int istate;
+extern bool iState;
extern int yuvmode;
extern bool mmx;
@@ -421,12 +421,12 @@ void nag_decrypt(void){
byte * const decoLowRes=(byte*) newAlign( (wndx>>dwnSmpSize) * decoLines, 8);
for(int dL=0; dL<decoLines; dL++){
- byte * const linep= dispbuf.b + nagLineLogi2Phys(decoLine[dL])*(vgax<<1);
+ byte * const linep= actVid2MemBufp->b + nagLineLogi2Phys(decoLine[dL])*(vgax<<1);
byte * const lowResp= decoLowRes + dL*(wndx>>dwnSmpSize);
doDwnSmp(lowResp ,linep);
}
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[0],"%f ReSample decoLines", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -434,7 +434,7 @@ void nag_decrypt(void){
byte * const lowRes=(byte*) newAlign( wndx>>dwnSmpSize, 8);
for(int line=0; line<NAG_LINES; line++){
- byte * const linep= dispbuf.b + nagLineLogi2Phys(line)*(vgax<<1);
+ byte * const linep= actVid2MemBufp->b + nagLineLogi2Phys(line)*(vgax<<1);
// printf("%d\n", line);
doDwnSmp(lowRes, linep);
// printf("xxX\n");
@@ -452,7 +452,7 @@ void nag_decrypt(void){
deleteAlign(lowRes);
printf("H2\n");
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[1],"%f Corr", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -485,7 +485,7 @@ void nag_decrypt(void){
}
printf("H3\n");
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[2],"%f GenKeyPointers", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -533,7 +533,7 @@ void nag_decrypt(void){
getPerm(bestKey, perm);
printf("%X\n", bestKey);
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[3],"%f FindKey", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -553,10 +553,10 @@ void nag_decrypt(void){
const type= cleMod4 ^ encMod4;
if(lastV[type&1^1] != NULL){
- byte *b=dispbuf.b + nagLineLogi2Phys( perm[i] ) * (vgax<<1);
+ byte *b=actVid2MemBufp->b + nagLineLogi2Phys( perm[i] ) * (vgax<<1);
corrV( b, lastV[type&1^1], type ^ lastVType[type&1^1], &vPhase );
}
- lastV[type&1]= dispbuf.b + nagLineLogi2Phys( perm[i] ) * (vgax<<1);
+ lastV[type&1]= actVid2MemBufp->b + nagLineLogi2Phys( perm[i] ) * (vgax<<1);
lastVType[type&1]= type;
}
}
@@ -571,7 +571,7 @@ void nag_decrypt(void){
const encMod4= (perm[i] + vPhase ) & 3;
const type= cleMod4 ^ encMod4;
- lowDriftLinep= dispbuf.b + nagLineLogi2Phys( perm[i] ) * (vgax<<1);
+ lowDriftLinep= actVid2MemBufp->b + nagLineLogi2Phys( perm[i] ) * (vgax<<1);
if(cleMod4!=encMod4) mod4Fix(lowDriftLinep, type);
@@ -580,14 +580,14 @@ void nag_decrypt(void){
}
for(int clearLine=0 ;clearLine<NAG_LINES; clearLine++){
- byte * const linep= dispbuf.b + nagLineLogi2Phys( perm[clearLine] ) * (vgax<<1);
+ byte * const linep= actVid2MemBufp->b + nagLineLogi2Phys( perm[clearLine] ) * (vgax<<1);
if(perm[clearLine]>=32 && mabs(perm[clearLine]-32 - clearLine)<5){
const cleMod4= (clearLine + vPhase ) & 3;
const encMod4= (perm[clearLine] + vPhase ) & 3;
const type= cleMod4 ^ encMod4;
- lowDriftLinep= dispbuf.b + nagLineLogi2Phys( perm[clearLine] ) * (vgax<<1);
+ lowDriftLinep= actVid2MemBufp->b + nagLineLogi2Phys( perm[clearLine] ) * (vgax<<1);
if(cleMod4!=encMod4) mod4Fix(lowDriftLinep, type);
}
@@ -601,7 +601,7 @@ void nag_decrypt(void){
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[5],"%f ColorDeco", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -611,7 +611,7 @@ void nag_decrypt(void){
/*
for(int i=0; i<NAG_LINES; i++){
const int p=nagLineLogi2Phys(i);
- dispbuf.b[p*(vgax<<1)+i*2+1]=255;
+ actVid2MemBufp->b[p*(vgax<<1)+i*2+1]=255;
}
for(int i=0; i<decoLines; i++){
@@ -619,9 +619,9 @@ void nag_decrypt(void){
const int p2=nagLineLogi2Phys(bestCoeffs[i].line[0]);
const int p3=nagLineLogi2Phys(bestCoeffs[i].line[1]);
for(int j=0; j<20; j++){
- dispbuf.b[p1*(vgax<<1)+i*20+101+j]=255;
- dispbuf.b[p2*(vgax<<1)+i*20+101+j]=255;
- dispbuf.b[p3*(vgax<<1)+i*20+101+j]=255;
+ actVid2MemBufp->b[p1*(vgax<<1)+i*20+101+j]=255;
+ actVid2MemBufp->b[p2*(vgax<<1)+i*20+101+j]=255;
+ actVid2MemBufp->b[p3*(vgax<<1)+i*20+101+j]=255;
}
}
*/
@@ -656,7 +656,7 @@ void nag_decrypt(void){
const bool open= (j == -1);
if(!open){
- memcpy(copyBuff, dispbuf.cl + i * vgax, wndx << 1);
+ memcpy(copyBuff, actVid2MemBufp->b + (i * vgax<<1), wndx << 1);
j = i;
do{
k = j;
@@ -664,9 +664,10 @@ void nag_decrypt(void){
enc2cleVec[k] = k;
cle2encVec[k] = k;
// printf("closed %d %d\n", j, k );
- if(j != i) memcpy(dispbuf.cl + k * vgax, dispbuf.cl + j * vgax, wndx << 1);
+ if(j != i) memcpy(actVid2MemBufp->b + (k * vgax<<1),
+ actVid2MemBufp->b + (j * vgax<<1), wndx << 1);
} while(j != i);
- memcpy(dispbuf.cl + k * vgax, copyBuff, wndx << 1);
+ memcpy(actVid2MemBufp->b + (k * vgax<<1), copyBuff, wndx << 1);
}
else{
j = k;
@@ -676,7 +677,8 @@ void nag_decrypt(void){
enc2cleVec[k] = k;
cle2encVec[k] = k;
// printf("open %d %d\n", j, k );
- if(j != -1) memcpy(dispbuf.cl + k * vgax, dispbuf.cl + j * vgax, wndx << 1);
+ if(j != -1) memcpy( actVid2MemBufp->b + (k * vgax<<1)
+ , actVid2MemBufp->b + (j * vgax<<1), wndx << 1);
} while(j != -1);
}
@@ -684,13 +686,14 @@ void nag_decrypt(void){
if(outy == wndy){
for(int i=0; i<outy; i+=2){
- memcpy(dispbuf.cl + (i+1) * vgax, dispbuf.cl + i * vgax, wndx << 1);
+ memcpy(actVid2MemBufp->b + ((i+1) * vgax<<1),
+ actVid2MemBufp->b + (i * vgax<<1) , wndx << 1);
}
}
delete [] copyBuff;
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[4],"%f ReOrder", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -701,19 +704,19 @@ void nag_decrypt(void){
- if(istate==1){
+ if(iState){
T2=uclock();
c.init(255, 0, 0, yuvmode);
- gprint(80, 80, c.c, textbuf[0]);
- gprint(90, 90, c.c, textbuf[1]);
- gprint(100, 100, c.c, textbuf[2]);
- gprint(110, 110, c.c, textbuf[3]);
- gprint(120, 120, c.c, textbuf[4]);
- gprint(130, 130, c.c, textbuf[5]);
-/* gprint(140, 140, c.c, textbuf[6]);
- gprint(150, 150, c.c, textbuf[7]);
- gprint(160, 160, c.c, textbuf[8]);
- gprint(170, 170, c.c, textbuf[9]);*/
+ gprint(80, 80, c.col, textbuf[0]);
+ gprint(90, 90, c.col, textbuf[1]);
+ gprint(100, 100, c.col, textbuf[2]);
+ gprint(110, 110, c.col, textbuf[3]);
+ gprint(120, 120, c.col, textbuf[4]);
+ gprint(130, 130, c.col, textbuf[5]);
+/* gprint(140, 140, c.col, textbuf[6]);
+ gprint(150, 150, c.col, textbuf[7]);
+ gprint(160, 160, c.col, textbuf[8]);
+ gprint(170, 170, c.col, textbuf[9]);*/
T1=T2;
}
@@ -809,7 +812,7 @@ void nag_decrypt(void){
"popl %%ebp \n\t"
: "=c" (avg)
: "c" (dwnSmp), "a"(&lastDwnSmp),
- "S" (dispbuf.b + line + 1) ,
+ "S" (actVid2MemBufp->b + line + 1) ,
"d" (wndx>>dwnSmp) ,
"D" (lowRes + lowResLine)
: "%eax", "%ebx", "%edx", "%esi", "%edi");
@@ -855,7 +858,7 @@ void nag_decrypt(void){
"popl %%ebp \n\t"
: "=c" (avg)
: "c" (dwnSmp), "a"(&lastDwnSmp),
- "S" (dispbuf.b + line + 1) ,
+ "S" (actVid2MemBufp->b + line + 1) ,
"d" (wndx>>dwnSmp) ,
"D" (lowRes + lowResLine)
: "%eax", "%ebx", "%edx", "%esi", "%edi");
@@ -947,7 +950,7 @@ void nag_decrypt(void){
if(mmx) asm("emms \n\t");
printf("HALLOB\n");
- if(istate==1){
+ if(iState){
T2=uclock();
T_corr+=T2-T1;
T1=T2;
@@ -1007,7 +1010,7 @@ void nag_decrypt(void){
delete [] tempSort;
- if(istate==1){
+ if(iState){
T2=uclock();
T_radix+=T2-T1;
T1=T2;
@@ -1152,7 +1155,7 @@ void nag_decrypt(void){
}
printf("HALLOD\n");
- if(istate==1){
+ if(iState){
T2=uclock();
T_merge+=T2-T1;
T1=T2;
@@ -1164,7 +1167,7 @@ void nag_decrypt(void){
printf("blockp %d\n", blockp);
- if(istate==1){
+ if(iState){
sprintf(textbuf[0],"%f Corr", (float)(T_corr)/UCLOCKS_PER_SEC);
sprintf(textbuf[1],"%f Radix Sort", (float)(T_radix)/UCLOCKS_PER_SEC);
sprintf(textbuf[2],"%f Block Handling", (float)(T_merge)/UCLOCKS_PER_SEC);
@@ -1174,7 +1177,7 @@ void nag_decrypt(void){
printf("HALLO2\n");
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[3],"%f Stat", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -1182,7 +1185,7 @@ void nag_decrypt(void){
qsort(block, blockp, sizeof(BLOCK), qsort_block);
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[4],"%f Sort", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -1226,7 +1229,7 @@ void nag_decrypt(void){
}
printf("HALLO3\n");
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[5],"%f Built Vecs", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -1246,7 +1249,7 @@ void nag_decrypt(void){
const int open= ( (j == -1) ? 1 : 0 );
if(open == 0){
- memcpy(copy_buff, dispbuf.cl + i * vgax, wndx << 1);
+ memcpy(copy_buff, actVid2MemBufp->cl + i * vgax, wndx << 1);
j = i;
do{
k = j;
@@ -1254,9 +1257,9 @@ void nag_decrypt(void){
forwVec[k] = k;
bakwVec[k] = k;
// printf("closed %d %d\n", j, k );
- if(j != i) memcpy(dispbuf.cl + k * vgax, dispbuf.cl + j * vgax, wndx << 1);
+ if(j != i) memcpy(actVid2MemBufp->cl + k * vgax, actVid2MemBufp->cl + j * vgax, wndx << 1);
} while(j != i);
- memcpy(dispbuf.cl + k * vgax, copy_buff, wndx << 1);
+ memcpy(actVid2MemBufp->cl + k * vgax, copy_buff, wndx << 1);
}
else{
j = k;
@@ -1266,7 +1269,7 @@ void nag_decrypt(void){
forwVec[k] = k;
bakwVec[k] = k;
// printf("open %d %d\n", j, k );
- if(j != -1) memcpy(dispbuf.cl + k * vgax, dispbuf.cl + j * vgax, wndx << 1);
+ if(j != -1) memcpy(actVid2MemBufp->cl + k * vgax, actVid2MemBufp->cl + j * vgax, wndx << 1);
} while(j != -1);
}
@@ -1274,7 +1277,7 @@ void nag_decrypt(void){
if(outy == wndy){
for(int i=0; i<outy; i+=2){
- memcpy(dispbuf.cl + (i+1) * vgax, dispbuf.cl + i * vgax, wndx << 1);
+ memcpy(actVid2MemBufp->cl + (i+1) * vgax, actVid2MemBufp->cl + i * vgax, wndx << 1);
}
}
@@ -1285,20 +1288,20 @@ void nag_decrypt(void){
int allnor=0;
int allinv=0;
for(i=0; i<wndx; i+=2){
- register int x=dispbuf.b[ linep + (i<<1) - (vgax<<1) + 2 ];
- register int y=dispbuf.b[ linep + (i<<1) + 2 ];
+ register int x=actVid2MemBufp->b[ linep + (i<<1) - (vgax<<1) + 2 ];
+ register int y=actVid2MemBufp->b[ linep + (i<<1) + 2 ];
if(x>127) x-=256;
if(y>127) y-=256;
allnor+=mabs(x-y);
allinv+=mabs(x+y);
}
if(allinv < allnor){
- dispbuf.cl[line * vgax + 4 ].lum=255;
- dispbuf.cl[line * vgax + 5 ].lum=0;
+ actVid2MemBufp->cl[line * vgax + 4 ].lum=255;
+ actVid2MemBufp->cl[line * vgax + 5 ].lum=0;
for(i=0; i<wndx; i+=2){
- register int x=dispbuf.b[ linep + (i<<1) + 2 ];
+ register int x=actVid2MemBufp->b[ linep + (i<<1) + 2 ];
if(x>127) x-=256;
- dispbuf.b[ 2 + linep + (i<<1) ]=char(-x);
+ actVid2MemBufp->b[ 2 + linep + (i<<1) ]=char(-x);
}
}
@@ -1311,20 +1314,20 @@ void nag_decrypt(void){
int allnor=0;
int allinv=0;
for(i=0; i<wndx; i+=2){
- register int x=dispbuf.b[ linep + (i<<1) - (vgax<<1) ];
- register int y=dispbuf.b[ linep + (i<<1) ];
+ register int x=actVid2MemBufp->b[ linep + (i<<1) - (vgax<<1) ];
+ register int y=actVid2MemBufp->b[ linep + (i<<1) ];
if(x>127) x-=256;
if(y>127) y-=256;
allnor+=mabs(x-y);
allinv+=mabs(x+y);
}
if(allinv < allnor){
- dispbuf.cl[line * vgax + 6 ].lum=255;
- dispbuf.cl[line * vgax + 7 ].lum=0;
+ actVid2MemBufp->cl[line * vgax + 6 ].lum=255;
+ actVid2MemBufp->cl[line * vgax + 7 ].lum=0;
for(i=0; i<wndx; i+=2){
- register int x=dispbuf.b[ linep + (i<<1) ];
+ register int x=actVid2MemBufp->b[ linep + (i<<1) ];
if(x>127) x-=256;
- dispbuf.b[ linep + (i<<1) ]=char(-x);
+ actVid2MemBufp->b[ linep + (i<<1) ]=char(-x);
}
}
@@ -1337,11 +1340,11 @@ void nag_decrypt(void){
// printf("%d %d %d\n", i, block[i].up_limit, block[i].avg);
line+= block[i].ent;
- dispbuf.cl[line * vgax ].lum=255;
- dispbuf.cl[line * vgax + 1 ].lum=0;
+ actVid2MemBufp->cl[line * vgax ].lum=255;
+ actVid2MemBufp->cl[line * vgax + 1 ].lum=0;
if(lineInf[ block[i].end[0] ].state == 0){
- dispbuf.cl[line * vgax + 2 ].lum=255;
- dispbuf.cl[line * vgax + 3 ].lum=0;
+ actVid2MemBufp->cl[line * vgax + 2 ].lum=255;
+ actVid2MemBufp->cl[line * vgax + 3 ].lum=0;
block_noblack--;
}
}
Modified: trunk/2010/2_vc.cc
==============================================================================
--- trunk/2010/2_vc.cc (original)
+++ trunk/2010/2_vc.cc Wed Jul 4 08:49:51 2007
@@ -16,12 +16,12 @@
#define check 1
extern vgax, vgay, wndx, wndy;
-extern xxx dispbuf;
+extern VID2MEMBUF *actVid2MemBufp;
extern volatile int scales_x, scalee_x;
extern volatile int scales_y, scalee_y;
extern int one_field;
extern int show_points;
-extern int istate;
+extern bool iState;
extern int yuvmode;
extern int edge_lut[256];
@@ -66,7 +66,7 @@ void vc_decrypt(void){
datbuf[0]= new char[vc_diff];
datbuf[1]= new char[vc_diff];
- if(istate==1){
+ if(iState){
T1=uclock();
}
@@ -111,13 +111,13 @@ void vc_decrypt(void){
"popl %%ebp \n\t"
:
: "I" (check), "i" (1<<check),
- "S" (dispbuf.b + linep + 1 + (vc_startx<<1)) ,
+ "S" (actVid2MemBufp->b + linep + 1 + (vc_startx<<1)) ,
"d" (vc_diff>>check) ,
"D" (datbuf[1])
: "%eax", "%ebx", "%edx", "%esi", "%edi");
- if(istate==1){
+ if(iState){
T2=uclock();
alg3+=T2-T1;
T1=T2;
@@ -165,7 +165,7 @@ void vc_decrypt(void){
else drift=(addap_end>>1) | 1;
- if(istate==1){
+ if(iState){
T2=uclock();
alg1+=T2-T1;
T1=T2;
@@ -192,11 +192,11 @@ void vc_decrypt(void){
int edge_x= l == 0 ? (l - 2) + vc_diff : (l - 2);
do{
if((edge_x++) >= vc_diff) edge_x-= vc_diff;
- diff+= dispbuf.b[linep + ((vc_startx + edge_x)<<1) + 1];
+ diff+= actVid2MemBufp->b[linep + ((vc_startx + edge_x)<<1) + 1];
}while( edge_x != l );
do{
if((edge_x++) >= vc_diff) edge_x-= vc_diff;
- diff-= dispbuf.b[linep + ((vc_startx + edge_x)<<1) + 1];
+ diff-= actVid2MemBufp->b[linep + ((vc_startx + edge_x)<<1) + 1];
}while( edge_x != l + 2);
diff= edge_lut[ mabs(diff) ];
@@ -258,7 +258,7 @@ void vc_decrypt(void){
last_val=new_val;
new_val=temp_val;
- if(istate==1){
+ if(iState){
T2=uclock();
alg2+=T2-T1;
T1=T2;
@@ -266,7 +266,7 @@ void vc_decrypt(void){
}
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[0],"%f Corr", (float)(alg1)/UCLOCKS_PER_SEC);
sprintf(textbuf[1],"%f Edge-Search", (float)(alg2)/UCLOCKS_PER_SEC);
@@ -283,13 +283,13 @@ void vc_decrypt(void){
else{
j=cutpoint[line]+i;
if(j >= vc_diff) j-= vc_diff;
- dispbuf.b[(line * vgax<<1) + ((vc_startx + j)<<1)+1]=255;
- dispbuf.b[(line * vgax<<1) + ((vc_startx + j)<<1)+3]=0;
+ actVid2MemBufp->b[(line * vgax<<1) + ((vc_startx + j)<<1)+1]=255;
+ actVid2MemBufp->b[(line * vgax<<1) + ((vc_startx + j)<<1)+3]=0;
}
i=dir[vc_diff*line + i];
}
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[3],"%f Misc", (float)(T2-T1)/UCLOCKS_PER_SEC);
T1=T2;
@@ -303,13 +303,13 @@ void vc_decrypt(void){
linep+=vgax<<1;
if(show_points!=0){
- dispbuf.b[linep+(vc_startx<<1)+1]=255;
- dispbuf.b[linep+(vc_startx<<1)+3]=0;
+ actVid2MemBufp->b[linep+(vc_startx<<1)+1]=255;
+ actVid2MemBufp->b[linep+(vc_startx<<1)+3]=0;
}
- memcpy(copy_buff, dispbuf.b + linep + (vc_startx<<1), vc_diff<<1);
- memcpy(dispbuf.b + linep + (vc_startx<<1), copy_buff + (cutpoint[line]<<1),
+ memcpy(copy_buff, actVid2MemBufp->b + linep + (vc_startx<<1), vc_diff<<1);
+ memcpy(actVid2MemBufp->b + linep + (vc_startx<<1), copy_buff + (cutpoint[line]<<1),
(vc_diff-cutpoint[line])<<1);
- memcpy(dispbuf.b + linep + (vc_startx<<1) + ((vc_diff-cutpoint[line])<<1),
+ memcpy(actVid2MemBufp->b + linep + (vc_startx<<1) + ((vc_diff-cutpoint[line])<<1),
copy_buff,
cutpoint[line]<<1);
/*
@@ -318,21 +318,21 @@ void vc_decrypt(void){
j=dir[line * vc_diff + i];
if(j<0 || j>=vc_diff) j=0;
- dispbuf.b[linep + ((vc_startx + j) <<1)+1]=255;
+ actVid2MemBufp->b[linep + ((vc_startx + j) <<1)+1]=255;
}
}
*/
}
- if(istate==1){
+ if(iState){
T2=uclock();
sprintf(textbuf[4],"%f Rotate", (float)(T2-T1)/UCLOCKS_PER_SEC);
c.init(255, 0, 0, yuvmode);
- gprint(80, 80, c.c, textbuf[0]);
- gprint(90, 90, c.c, textbuf[1]);
- gprint(100, 100, c.c, textbuf[2]);
- gprint(110, 110, c.c, textbuf[3]);
- gprint(120, 120, c.c, textbuf[4]);
+ gprint(80, 80, c.col, textbuf[0]);
+ gprint(90, 90, c.col, textbuf[1]);
+ gprint(100, 100, c.col, textbuf[2]);
+ gprint(110, 110, c.col, textbuf[3]);
+ gprint(120, 120, c.col, textbuf[4]);
T1=T2;
}
Modified: trunk/2010/makefile
==============================================================================
--- trunk/2010/makefile (original)
+++ trunk/2010/makefile Wed Jul 4 08:49:51 2007
@@ -12,29 +12,22 @@ AFLAGS = -f coff
.asm.o: ; nasm $(AFLAGS) $<
-O = 2010.o 2_file.o 2_menu.o 2_grafix.o 2_hw.o 2_mfunc.o 2_mouse.o 2_gfunc.o \
- 2_move.o 2_hw_asm.o 2_71x6.o 2_hw_mem.o 2_wins.o 2_crypt.o 2_vc.o 2_nag.o\
+O = 2010.o 2_file.o 2_grafix.o 2_hw.o 2_gfunc.o \
+ 2_hw_asm.o 2_71x6.o 2_hw_mem.o 2_crypt.o 2_vc.o 2_nag.o\
2_nag_a.o 2_vc_a.o 2_glob_a.o
2010 : $(O) ; gcc $(CFLAGS) -o 2010 $(O)
clean: ; del $(O) 2010
-2010.o : 2010.cc 2_all.h 2010.h 2_file.h 2_mouse.h 2_hw.h 2_grafix.h\
- 2_menu.h 2_mfunc.h 2_move.h 2_71x6.h 2_hw_mem.h\
- 2_nag.h
+2010.o : 2010.cc 2_all.h 2010.h 2_file.h 2_hw.h 2_grafix.h\
+ 2_71x6.h 2_hw_mem.h 2_nag.h
2_file.o : 2_file.cc 2_all.h 2_file.h 2010.h 2_hw.h
2_gfunc.o : 2_gfunc.cc 2_all.h 2_gfunc.h 2010.h
-2_grafix.o : 2_grafix.cc 2_all.h 2_grafix.h 2_gfunc.h 2_menu.h 2_hw.h 2_file.h\
- 2_wins.h
-2_menu.o : 2_menu.cc 2_all.h 2_menu.h 2_mfunc.h 2_gfunc.h
-2_mfunc.o : 2_mfunc.cc 2_all.h 2_mfunc.h 2_menu.h 2_71x6.h 2010.h
-2_mouse.o : 2_mouse.cc 2_all.h 2_mouse.h 2_move.h
-2_hw.o : 2_hw.cc 2_all.h 2_hw.h 2010.h 2_mouse.h 2_hw_asm.h 2_hw_mem.h\
+2_grafix.o : 2_grafix.cc 2_all.h 2_grafix.h 2010.h 2_gfunc.h 2_hw.h 2_file.h
+2_hw.o : 2_hw.cc 2_all.h 2_hw.h 2010.h 2_hw_asm.h 2_hw_mem.h\
2_71x6.h 2_mmx.h
2_hw_mem.o : 2_hw_mem.cc 2_all.h 2_hw_mem.h 2010.h
-2_move.o : 2_move.cc 2_all.h 2_move.h 2010.h
2_71x6.o : 2_71x6.cc 2_all.h 2_71x6.h 2_hw.h 2_hw_mem.h 2010.h 2_hw_asm.h
-2_wins.o : 2_wins.cc 2_all.h 2_wins.h 2_gfunc.h 2_71x6.h
2_crypt.o : 2_crypt.cc 2_all.h 2_crypt.h 2_71x6.h 2_vc.h 2_nag.h
2_vc.o : 2_vc.cc 2_all.h 2_vc.h 2_crypt.h 2_gfunc.h 2_vc_a.h
2_nag.o : 2_nag.cc 2_all.h 2_nag.h 2_crypt.h 2_gfunc.h 2_mmx.h 2_nag_a.h\
More information about the Mndiff-dev
mailing list