[MN-dev] [mndiff]: r47 - in trunk/2010: 2010.cc 2_71x6.cc 2_all.h 2_crypt.cc 2_hw.cc 2_nag.cc 2_nag.h 2_nag_a.asm 2_vc.cc 2d
michael
subversion at mplayerhq.hu
Wed Jul 4 04:05:16 CEST 2007
Author: michael
Date: Wed Jul 4 04:05:15 2007
New Revision: 47
Log:
version from 1998-07-06
Added:
trunk/2010/2d
Modified:
trunk/2010/2010.cc
trunk/2010/2_71x6.cc
trunk/2010/2_all.h
trunk/2010/2_crypt.cc
trunk/2010/2_hw.cc
trunk/2010/2_nag.cc
trunk/2010/2_nag.h
trunk/2010/2_nag_a.asm
trunk/2010/2_vc.cc
Modified: trunk/2010/2010.cc
==============================================================================
--- trunk/2010/2010.cc (original)
+++ trunk/2010/2010.cc Wed Jul 4 04:05:15 2007
@@ -37,8 +37,8 @@
extern int mmx;
extern int *best1;
extern BEST2 *best2;
- extern KEYSLIST *keysList;
- extern bool manualPhaseStart;
+ extern u_short *keysList;
+ extern int *decoLine;
int _crt0_startup_flags = _CRT0_FLAG_NEARPTR | _CRT0_FLAG_NONMOVE_SBRK;
int buttons=0, xpos=0, ypos=0, lxpos=0, lypos=0;
@@ -124,6 +124,7 @@ int error(error_code e){
void exitt(void){
close_hw();
+ delete [] decoLine;
delete [] best1;
delete [] best2;
delete [] keysList;
@@ -344,7 +345,6 @@ int main(int argc, char **argv){
if(kbhit()) key=getkey();
if(key=='g' || key=='G') key=0, grabf=1;
- if(key=='p' || key=='P') key=0, manualPhaseStart^=1;
}
exit(0);
Modified: trunk/2010/2_71x6.cc
==============================================================================
--- trunk/2010/2_71x6.cc (original)
+++ trunk/2010/2_71x6.cc Wed Jul 4 04:05:15 2007
@@ -17,6 +17,7 @@
//#define wait_time 0.010
#define wait_time 0.020
+
extern meteor meteors[8];
extern __Go32_Info_Block _go32_info_block;
extern u_short my_cs;
@@ -204,18 +205,22 @@ 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>=2 )
- || ( a_saa7116->ints_ctl.stat_start == 1 && fields>=11111 ) ){
+ 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;
- int grabbingOne=0;
- while(doubleBuff[grabbingOne].state != Grabbing && grabbingOne<2)
- grabbingOne++;
- if(grabbingOne!=2) doubleBuff[grabbingOne].state= Grabbed;
- int emptyOne=0;
- while(doubleBuff[emptyOne].state!=Empty && emptyOne<2) emptyOne++;
+ if(grabbingOne!=2) doubleBuff[grabbingOne].state= Grabbed;
if(emptyOne!=2){
if(single==0){
@@ -226,11 +231,6 @@ void meteor_int_handler(void){
doubleBuff[1].state= Grabbing;
}
grab_next(doubleBuff[emptyOne]);
- 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};
}
else{
fields=11111;
@@ -239,8 +239,18 @@ 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");
}
}
+ else if( a_saa7116->ints_ctl.stat_start==1 && fields>=11111 && emptyOne!=2){
+ 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};
+ }
a_saa7116->ints_ctl_a|=0x7;
}
@@ -279,6 +289,9 @@ void close_meteor(void){
void grab_next(xxx x){
saa7116 *a_saa7116=(saa7116*)meteors[active_meteor].saa7116;
+ a_saa7116->dma_end.even=
+ a_saa7116->dma_end.odd= 0;
+
if(one_field==1){
a_saa7116->dma.even[0]= a_saa7116->dma.odd [0]=
a_saa7116->dma.even[1]= a_saa7116->dma.odd [1]=
@@ -297,21 +310,6 @@ void grab_next(xxx x){
}
-void grab_nix(){
- saa7116 *a_saa7116=(saa7116*)meteors[active_meteor].saa7116;
-
- xxx x= doubleBuff[0];
-
- 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_end.even=
- a_saa7116->dma_end.odd= x.phys + xresc*4;
-
-}
-
-
void meteor_int_handler_end(void){
}
Modified: trunk/2010/2_all.h
==============================================================================
--- trunk/2010/2_all.h (original)
+++ trunk/2010/2_all.h Wed Jul 4 04:05:15 2007
@@ -10,6 +10,9 @@
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
+#define limit(a,b,c) if( (a)<(b) || (a)>(c) ) error(-201)
+
+
#define u_char unsigned char
#define u_long unsigned long
#define u_short unsigned short
Modified: trunk/2010/2_crypt.cc
==============================================================================
--- trunk/2010/2_crypt.cc (original)
+++ trunk/2010/2_crypt.cc Wed Jul 4 04:05:15 2007
@@ -25,7 +25,7 @@ int show_points=0;
void decrypt(void){
-// if( (crypt == vc || crypt == nag) && satur!=0 ) decomb();
+// if( crypt == nag && satur!=0 ) decomb();
decomb();
if(crypt==vc) vc_decrypt();
@@ -37,57 +37,72 @@ void decrypt(void){
static void decomb(void){
-
- int linep, llinep, line, i, o;
+ int segs=1;
+ int linep, llinep, line, i;
int j, k;
int temp[max_x];
int amp[max_x];
const int outy1= outy>>1;
const int stride=one_field ? (vgax<<1) : (vgax<<2);
- const int pass=one_field ? 1 : 2;
+ const int o=one_field ? 0 : 1;
const int end=one_field ? outy : outy1;
+ const int segSize= end/segs;
- for(o=0; o<pass; o++){
-
- for(i=0; i<max_x; i++){
- temp[i]=0;
- amp[i]=0;
- }
+ int startp= 0;
+ for(int seg=0; seg<segs; seg++){
- linep=-stride;
- if(o) linep+=vgax<<1;
- for(line=0; line<end; line++){
- linep+=stride;
- for(i=0; i<wndx; i++){
- j = int(dispbuf.b[linep + (i<<1)]);
- k = temp[i];
- if(j>127) j= j - 256;
- j= (j + j) - k;
- temp[i] = j;
- if(line & 1) amp[i]-=j;
- else amp[i]+=j;
- }
- }
+ for(i=0; i<wndx; i++){
+ temp[i]=0;
+ amp[i]=0;
+ }
- for(i=0; i<max_x; i++){
- temp[i]= amp[i]/end;
- }
+ linep= startp;
+ 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= (j + j) - temp[i];
+ temp[i] = j;
+ if(line & 1) amp[i]-=j;
+ else amp[i]+=j;
+ }
+ linep+=stride;
+ }
- linep=-stride;
- if(o) linep+=vgax<<1;
- for(line=0; line<end; line++){
- linep+=stride;
for(i=0; i<wndx; i++){
- j = int(dispbuf.b[linep + (i<<1)]);
- k = temp[i];
- if(j>127) j= j - 256;
- j=(j + j) - k;
- dispbuf.b[linep + (i<<1)] = (char)(j);
- temp[i] = j;
- }
+ temp[i]= amp[i]/segSize;
+ }
+
+ linep= startp;
+ if(o) linep+=vgax<<1;
+ for(line=0; line<segSize; line++){
+ for(i=0; i<wndx; i++){
+/*
+ j = char(dispbuf.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);
+ */
+
+ j = char(dispbuf.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);
+
+
+
+
+ }
+ linep+=stride;
+ }
+ startp+= segSize*stride;
}
- }
/*
asm(//"int $3 \n\t"
Modified: trunk/2010/2_hw.cc
==============================================================================
--- trunk/2010/2_hw.cc (original)
+++ trunk/2010/2_hw.cc Wed Jul 4 04:05:15 2007
@@ -50,6 +50,7 @@
extern int in_int;
extern int mouse_tim;
extern int mouse_ltim;
+ extern volatile int frames;
int g_mode=0;
int m_mode=0;
@@ -557,9 +558,25 @@ void copy_vidbuffer(void){
int nextOne= workingOne^1;
if(doubleBuff[nextOne].state==Empty) nextOne=0; // not critical
-// meteors[active_meteor].saa7116->ints_ctl_a |= 0x7;
-// meteors[active_meteor].saa7116->capt_ctl_a |= 0x0F30;
+ while(doubleBuff[nextOne].state != Grabbed);
+
+ doubleBuff[nextOne].state= Working;
+ dispbuf= doubleBuff[nextOne];
+ }
+ else{
+ doubleBuff[0].state=
+ doubleBuff[1].state=Empty;
+
+ while(doubleBuff[0].state != Grabbed);
+
+ doubleBuff[0].state=
+ doubleBuff[1].state=Working;
+
+ dispbuf= doubleBuff[0];
+ }
+
+/*
printf("%X, %X\n", meteors[active_meteor].saa7116->capt_ctl_a,
meteors[active_meteor].saa7116->ints_ctl_a );
@@ -582,25 +599,7 @@ void copy_vidbuffer(void){
printf("DMA E END %X\n", meteors[active_meteor].saa7116->dma_end.even);
printf("DMA O END %X\n", meteors[active_meteor].saa7116->dma_end.odd);
-
- while(doubleBuff[nextOne].state != Grabbed);
-
- doubleBuff[nextOne].state= Working;
-
- dispbuf= doubleBuff[nextOne];
- }
- else{
- doubleBuff[0].state=
- doubleBuff[1].state=Empty;
-
- while(doubleBuff[0].state != Grabbed);
-
- doubleBuff[0].state=
- doubleBuff[1].state=Working;
-
- dispbuf= doubleBuff[0];
- }
-
+*/
}
Modified: trunk/2010/2_nag.cc
==============================================================================
--- trunk/2010/2_nag.cc (original)
+++ trunk/2010/2_nag.cc Wed Jul 4 04:05:15 2007
@@ -25,15 +25,13 @@ extern u_long asm_temp, asm_temp4;
extern int istate;
extern int yuvmode;
extern bool mmx;
-extern volatile int frames;
-bool manualPhaseStart=false;
-int *decoLine;
+int *decoLine=NULL;
int decoLines;
int keyTable[256];
int *best1=NULL;
-BEST2 *best2=NULL; // FIX DELETE
-KEYSLIST *keysList=NULL;
+BEST2 *best2=NULL;
+u_short *keysList=NULL;
static int outy1;
static int nagStart2;
static int nagEnd2;
@@ -51,17 +49,19 @@ bool checkAlign(void *p, int align){
void *newAlign(int size, int align){ // FIX SHOULD BE SOMEWHERE ELSE
int v= int(new char[size + align + 3]);
+ printf("anew %d\n", v);
int v2= ( (v+align-1+4) & ~(align-1) );
((int*)v2)[-1]= v;
return (void*)v2;
}
void deleteAlign(void *v){ // FIX SHOULD BE SOMEWHERE ELSE
+ printf("adel %d\n", int(((char**)v)[-1]) );
delete [] ((char**)v)[-1];
}
static inline void getPerm(const int key, int * const perm){
- int keyNdx= key >> 7;
+ int keyNdx= (key >> 7) & 0xFF;
const int keyInc= ((key & 0x7F) << 1) + 1;
int buffer[32];
@@ -172,42 +172,62 @@ static inline void doDwnSmp(byte * const
static inline int nagLineLogi2Phys(const int logi){
int phys;
+ if(logi>=287) error(-100);
if(logi<32) phys= nagStart1 + ( logi <<1);
else phys= nagStart2 + ((logi-32)<<1);
+ if(phys>=576) error(-101);
return phys;
}
-void mod4Fix(byte * p, int cleMod4, int encMod4){
- const bool xchg[16]={false, true, false, true,
- true, false, true, false,
- false, true, false, true,
- true, false, true, false };
-
- const byte neg[16]={ 0, 0, 0xFF, 0xFF,
- 0, 0, 0xFF, 0xFF,
- 0xFF, 0xFF, 0, 0,
- 0xFF, 0xFF, 0, 0 };
- const int ndx= cleMod4 | (encMod4<<2);
+static inline void mod4Fix(byte * p, const int type){
+ const bool xchg[4]={false, true, false, true};
+ const int neg [4]={ 0, 0, -1, -1};
for(int x=0; x<(vgax<<1); x+=4){
- byte u= p[x ]; // perhaps u><v
- byte v= p[x+2];
+ const byte u= p[x ]; // perhaps u><v
+ const byte v= p[x+2];
- if(xchg[ndx]){
- const int t=u;
- u=v;
- v=t;
+ if(xchg[type]){
+ p[x ]= (v^neg[type]) - neg[type];
+ p[x+2]= (u^neg[type]) - neg[type];
+ }else{
+ p[x ]= (u^neg[type]) - neg[type];
+ p[x+2]= (v^neg[type]) - neg[type];
}
- p[x ]= (u^neg[ndx]) - neg[ndx];
- p[x+2]= (v^neg[ndx]) - neg[ndx];
}
}
+void corrV(byte * p1, byte * p2, const int type, int *vPhase){
+ const bool xchg[4]={false, true, false, true};
+ const int neg [4]={ 0, 0, -1, -1};
+
+ for(int x=0; x<(vgax<<1); x+=4){
+ int u1= char(p1[x ]); // perhaps u><v
+ int v1= char(p1[x+2]);
+
+ int u2= char(p2[x ]); // perhaps u><v
+ int v2= char(p2[x+2]);
+
+ if(xchg[type]){
+ const int t=u1;
+ u1=v1;
+ v1=t;
+ }
+
+ u1=(u1^neg[type]) - neg[type];
+ v1=(v1^neg[type]) - neg[type];
+
+ *vPhase+= mabs(u1-u2) + mabs(v1-v2);
+ *vPhase-= mabs(u1+u2) + mabs(v1+v2);
+ }
+
+}
+
void nag_decrypt(void){
outy1= outy>>1;
nagStart2= int(double(17+0 - scales_y)/y_field*outy1 + .5)*2+1;
@@ -226,12 +246,9 @@ void nag_decrypt(void){
T1=uclock();
-// if(frames&1) frames++;
- const int vPhase= (((frames & 2)==2) ^ manualPhaseStart) ? 1 : 0;
-
-// printf("%d %d\n", sizeof(KEYSLIST), sizeof(BEST2) );
+ printf("%d %d\n", sizeof(u_short), sizeof(BEST2) );
-// printf("HALLOX\n");
+ printf("HALLOX\n");
static bool first=true;
if(first){
@@ -275,11 +292,11 @@ void nag_decrypt(void){
best1= new int[decoLines * NAG_LINES];
best2= new BEST2[best2Size];
- keysList= new KEYSLIST[keysListSize];
+ keysList= new u_short[keysListSize];
fread(best1, sizeof(int), decoLines * NAG_LINES, f);
fread(best2, sizeof(BEST2), best2Size , f);
- fread(keysList, sizeof(KEYSLIST), keysListSize , f);
+ fread(keysList, sizeof(u_short), keysListSize , f);
badFile:;
fclose(f);
@@ -333,7 +350,7 @@ void nag_decrypt(void){
best1= new int[NAG_LINES * decoLines];
best2= new BEST2[best2Size];
- keysList= new KEYSLIST[keysListSize];
+ keysList= new u_short[keysListSize];
for(int i=0; i<NAG_LINES * decoLines; i++){
best1[i]=-1;
@@ -359,12 +376,12 @@ void nag_decrypt(void){
int keyP=keysTempStart[ndx2];
while(keyP!=-1){
- keysList[keysListPos]=(KEYSLIST){last:0, key:(keyP & (KEYS-1))};
+ keysList[keysListPos]=keyP & (KEYS-1);
keysListPos++;
// printf("KL %d\n", keyP);
keyP=keysTemp[keyP];
}
- if(keysListPos>0) keysList[keysListPos-1].last=1;
+ if(keysListPos>0) keysList[keysListPos-1]|=KEYS;
// printf("KL END\n");
best2Pos++;
@@ -388,7 +405,7 @@ void nag_decrypt(void){
fwrite(best1, sizeof(int), decoLines * NAG_LINES, f);
fwrite(best2, sizeof(BEST2), best2Size , f);
- fwrite(keysList, sizeof(KEYSLIST), keysListSize , f);
+ fwrite(keysList, sizeof(u_short), keysListSize , f);
fclose(f);
@@ -403,12 +420,10 @@ void nag_decrypt(void){
}
byte * const decoLowRes=(byte*) newAlign( (wndx>>dwnSmpSize) * decoLines, 8);
-// printf("%d\n", int(decoLowRes));
for(int dL=0; dL<decoLines; dL++){
byte * const linep= dispbuf.b + nagLineLogi2Phys(decoLine[dL])*(vgax<<1);
byte * const lowResp= decoLowRes + dL*(wndx>>dwnSmpSize);
doDwnSmp(lowResp ,linep);
-// printf("%X\n", int(lowResp)); // FIX alignment (fine now but...)
}
if(istate==1){
@@ -417,8 +432,7 @@ void nag_decrypt(void){
T1=T2;
}
- byte * const lowRes=(byte*) newAlign( (wndx>>dwnSmpSize) * decoLines, 8);
-// printf("%d\n", int(lowRes));
+ 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);
// printf("%d\n", line);
@@ -432,11 +446,11 @@ void nag_decrypt(void){
}
}
if(mmx) asm("emms\n\t");
-// printf("H1\n");
+ printf("H1\n");
deleteAlign(decoLowRes);
deleteAlign(lowRes);
-// printf("H2\n");
+ printf("H2\n");
if(istate==1){
T2=uclock();
@@ -452,6 +466,7 @@ void nag_decrypt(void){
bestCoeffs[dL].line[1]= bestCoeffs[dL].line[0];
bestCoeffs[dL].line[0]= t;
}
+ limit(bestCoeffs[dL].line[0], 0, 285);
int l= best1[ bestCoeffs[dL].line[0] + dL*NAG_LINES ];
int r= best1[ bestCoeffs[dL].line[0] + 1 + dL*NAG_LINES ];
@@ -468,7 +483,7 @@ void nag_decrypt(void){
keysListPos[keysListPoses]= best2[l].keyNdx;
keysListPoses++;
}
-// printf("H3\n");
+ printf("H3\n");
if(istate==1){
T2=uclock();
@@ -482,30 +497,30 @@ void nag_decrypt(void){
int bestNum=0;
do{
didSome=false;
- int lowKey=0xFFFF;
+ u_short lowKey=0xFFFF;
int lowNum=0;
for(int kLP=0; kLP<keysListPoses; kLP++){
if(keysListPos[kLP]==-1) continue;
- if( int(keysList[ keysListPos[kLP] ].key)==lastLowKey ){
- if( keysList[ keysListPos[kLP] ].last==1 ){
+ if( int(keysList[ keysListPos[kLP] ] & (KEYS-1) )==lastLowKey ){
+ if( (keysList[ keysListPos[kLP] ] & KEYS)==KEYS ){
keysListPos[kLP]=-1;
continue;
}
keysListPos[kLP]++;
}
- if( int(keysList[ keysListPos[kLP] ].key) == lowKey ){
+ if( int(keysList[ keysListPos[kLP] ] & (KEYS-1)) == lowKey ){
lowNum++;
}
- if( int(keysList[ keysListPos[kLP] ].key) < lowKey ){
- lowKey= int(keysList[ keysListPos[kLP] ].key);
+ if( int(keysList[ keysListPos[kLP] ] & (KEYS-1)) < lowKey ){
+ lowKey= int(keysList[ keysListPos[kLP] ] & (KEYS-1));
lowNum=0;
}
didSome= true;
}
lastLowKey=lowKey;
-// printf(" %d %d\n", lowNum, lowKey);
+// printf("KEY %d %d\n", lowNum, lowKey);
if(lowNum>bestNum){
bestNum=lowNum;
bestKey=lowKey;
@@ -524,17 +539,41 @@ void nag_decrypt(void){
T1=T2;
}
- sprintf(textbuf[6],"%d %d vPhase", vPhase, int(frames));
+ delete [] bestCoeffs; // kill this
+
+
+
+ byte *lastV[2]={NULL, NULL};
+ int lastVType[2];
+ int vPhase=0;
+ for(int i=0; i<NAG_LINES; i++){
+ if(perm[i]>=32 && mabs(perm[i]-32 - i)<5){
+ const cleMod4= (i ) & 3;
+ const encMod4= (perm[i]) & 3;
+ const type= cleMod4 ^ encMod4;
+
+ if(lastV[type&1^1] != NULL){
+ byte *b=dispbuf.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);
+ lastVType[type&1]= type;
+ }
+ }
+ if(vPhase>0) vPhase=1;
+ else vPhase=0;
+
byte *lowDriftLinep= NULL;
for(int i=0; i<NAG_LINES; i++){
if(perm[i]>=32 && mabs(perm[i]-32 - i)<5){
const cleMod4= (i + vPhase ) & 3;
const encMod4= (perm[i] + vPhase ) & 3;
+ const type= cleMod4 ^ encMod4;
lowDriftLinep= dispbuf.b + nagLineLogi2Phys( perm[i] ) * (vgax<<1);
- if(cleMod4!=encMod4) mod4Fix(lowDriftLinep, cleMod4, encMod4);
+ if(cleMod4!=encMod4) mod4Fix(lowDriftLinep, type);
break;
}
@@ -546,14 +585,16 @@ void nag_decrypt(void){
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);
- if(cleMod4!=encMod4) mod4Fix(lowDriftLinep, cleMod4, encMod4);
+ if(cleMod4!=encMod4) mod4Fix(lowDriftLinep, type);
}
else{
- for(int x=0; x<(vgax<<1); x+=2){
- linep[x]= lowDriftLinep[x];
+ for(int x=0; x<(vgax<<1); x+=4){
+ linep[x ]= lowDriftLinep[x ];
+ linep[x+2]= lowDriftLinep[x+2];
}
}
}
@@ -566,7 +607,7 @@ void nag_decrypt(void){
T1=T2;
}
-// printf("H4\n");
+ printf("H4\n");
/*
for(int i=0; i<NAG_LINES; i++){
const int p=nagLineLogi2Phys(i);
@@ -586,8 +627,8 @@ void nag_decrypt(void){
*/
delete [] bestCoeffs;
- int enc2cleVec[outy];
- int cle2encVec[outy];
+ int enc2cleVec[max_x];
+ int cle2encVec[max_x];
for(int i=0; i<outy; i++){
enc2cleVec[i]=
@@ -669,8 +710,8 @@ void nag_decrypt(void){
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(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]);*/
T1=T2;
Modified: trunk/2010/2_nag.h
==============================================================================
--- trunk/2010/2_nag.h (original)
+++ trunk/2010/2_nag.h Wed Jul 4 04:05:15 2007
@@ -11,11 +11,6 @@ struct BEST2{
unsigned keyNdx:23;
};
-struct KEYSLIST{
- unsigned last:1;
- unsigned key:15;
-};
-
struct BESTCOEFFS{
int line[2];
int coeff[2];
Modified: trunk/2010/2_nag_a.asm
==============================================================================
--- trunk/2010/2_nag_a.asm (original)
+++ trunk/2010/2_nag_a.asm Wed Jul 4 04:05:15 2007
@@ -11,15 +11,15 @@ extern _asm_temp2
global _nagraCorr__Fiiiii
-%define buf1 par1
-%define buf2 par2
-%define bufSize par3
-%define best par4
-%define line par5
+%define buf1 par2
+%define buf2 par3
+%define bufSize par4
+%define best par5
+%define line par6
_nagraCorr__Fiiiii:
-; push eax
+ push eax
push ebx
push ecx
@@ -34,13 +34,17 @@ _nagraCorr__Fiiiii:
mov edx, [bufSize]
mov edi, [buf2]
+ and edx, 0xFFFFFFF8
+
+ sub edx, 8
+
add esi, edx
add edi, edx
xor edx, -1
mov eax, [_mmx]
- add edx, 8
+ inc edx
mov ebx, [best]
mov [_asm_temp], ebx
@@ -52,7 +56,7 @@ _nagraCorr__Fiiiii:
mov esp, edx
test eax, eax
- jz NoMMX
+ jz NEAR NoMMX
movq mm3, [mmx_zero]
@@ -80,6 +84,21 @@ MMXloop:
add esp, 8 ; U
jnc MMXloop ; V 1
+ psubusb mm2, mm1
+ psubusb mm1, mm0
+
+ por mm2, mm1
+
+ paddusb mm2, mm6
+
+ movq mm4, mm2
+
+ punpcklbw mm2, mm3
+ punpckhbw mm4, mm3
+
+ paddusw mm5, mm2
+ paddusw mm5, mm4
+
movq mm0, mm5
psrlq mm5, 32
@@ -174,7 +193,7 @@ End:
pop edx
pop ecx
pop ebx
-; pop eax
+ pop eax
ret
Modified: trunk/2010/2_vc.cc
==============================================================================
--- trunk/2010/2_vc.cc (original)
+++ trunk/2010/2_vc.cc Wed Jul 4 04:05:15 2007
@@ -49,6 +49,7 @@ void vc_decrypt(void){
long alg1=0, alg2=0, alg3=0;
color c;
+ show_points=1;
const int vc_endx=wndx;
const int vc_startx=int(double(22-scales_x+3)/double(768-scales_x+scalee_x)*wndx);
Added: trunk/2010/2d
==============================================================================
--- (empty file)
+++ trunk/2010/2d Wed Jul 4 04:05:15 2007
@@ -0,0 +1,2 @@
+fix asm_code in bfd stuff
+deComb overFlow
More information about the Mndiff-dev
mailing list