[MN-dev] [mndiff]: r58 - in trunk/2010: 2010.cpp 2_cryp_a.asm 2_cryp_a.h 2_crypt.cpp 2_file.cpp 2_file.h 2_grafix.cpp 2_txt.cpp 2_vc.cpp 2_vc_a.asm makefile
michael
subversion at mplayerhq.hu
Wed Jul 4 10:15:33 CEST 2007
Author: michael
Date: Wed Jul 4 10:15:33 2007
New Revision: 58
Log:
next version from unknown date
Added:
trunk/2010/2_cryp_a.asm
trunk/2010/2_cryp_a.h
Modified:
trunk/2010/2010.cpp
trunk/2010/2_crypt.cpp
trunk/2010/2_file.cpp
trunk/2010/2_file.h
trunk/2010/2_grafix.cpp
trunk/2010/2_txt.cpp
trunk/2010/2_vc.cpp
trunk/2010/2_vc_a.asm
trunk/2010/makefile
Modified: trunk/2010/2010.cpp
==============================================================================
--- trunk/2010/2010.cpp (original)
+++ trunk/2010/2010.cpp Wed Jul 4 10:15:33 2007
@@ -24,7 +24,7 @@
#include "2_nag.h"
extern volatile bool oneField;
- extern bool vSmoothState;
+ extern int iVSmooth;
extern int g_mode;
extern VID2MEMBUF *vid2MemBuf, *actVid2MemBufp;
extern byte *vidbuf;
@@ -33,11 +33,6 @@
extern int active_meteor;
extern int yuvMode, grabYuvMode;
extern bool mmx;
-// extern short *linesPerKeyTab;
-// extern int *best1;
-// extern BEST2 *best2;
-// extern u_short *keysList;
-// extern int *decoLine;
extern int bright, contr, satur;
extern int showCont;
extern CRYPTSTD cryptStd;
@@ -54,6 +49,7 @@
int _crt0_startup_flags = _CRT0_FLAG_NEARPTR | _CRT0_FLAG_NONMOVE_SBRK;
+ bool fShowRaw=false;
int grabf;
int fysize;
byte font[4096];
@@ -127,10 +123,11 @@ int error(error_code e){
case CommLine : printg_t("\nCommand-Line error!\n");
case Help : printg_t("\n2010 [<optons>]\n"
"options: -v n (Video-mode)\n"
- " -m n (Meteor Card) in case there are more than 1 (:\n"
+ " -m n (Meteor Card)\n"
" -NoFlip (Disable Page-Fliping)\n"
" -NoMMX (Disable MMX-Support)\n"
" -MaxBuf (num of Buffers)\n"
+ " -s <file0.raw> ... <filen.raw> (show raw pics)\n"
" -? / -h (This stuff)\n");
break;
default : printg_t("\nUnknown error!");
@@ -195,6 +192,10 @@ int main(int argc, char **argv){
else if(stricmp(argv[i],"nagra")==0) std=nagra;
else error(CommLine);
} */
+ else if(stricmp(argv[i],"-s")==0){
+ LoadRaws(argc-i-1, &argv[i+1]);
+ i=argc;
+ }
else error(CommLine);
}
@@ -340,10 +341,14 @@ int main(int argc, char **argv){
infoPosY=0;
infoPosX=10;
+ if(grabf==2 && TVStd!=TXTPAL) GrabRaw(), grabf=0;
+
+ if(fShowRaw) ShowRaw();
+
decrypt();
showStuff();
- if(grabf!=0 && TVStd!=TXTPAL) grab(), grabf=0;
+ if(grabf==1 && TVStd!=TXTPAL) GrabBmp(), grabf=0;
for(int k=0; k<delay*1000000; k++);
@@ -393,6 +398,8 @@ int main(int argc, char **argv){
case 'q' :
case 'Q' : quit=true;
break;
+ case 'S' : fShowRaw=!fShowRaw;
+ break;
case K_F1 : bright--;
showCont=10;
if(bright<0) bright=0;
@@ -423,14 +430,13 @@ int main(int argc, char **argv){
if(satur>127) satur=127;
setCont();
break;
- case 's' :
- case 'S' : menuLevel=mLTVStd, helpState=false;
+ case 's' : menuLevel=mLTVStd, helpState=false;
break;
case 'i' :
case 'I' : iState= !iState;
break;
case 'v' :
- case 'V' : vSmoothState= !vSmoothState;
+ case 'V' : iVSmooth++; iVSmooth%=3;
break;
case 'h' :
case 'H' : helpState= !helpState;
@@ -516,7 +522,7 @@ int main(int argc, char **argv){
cryptStd= nix;
if(yuvMode!=2) yuvMode=0, grabYuvMode=1;
else error(error_code(-988));
- vSmoothState=false;
+ iVSmooth=0;
setStdScale();
contGrab();
break;
@@ -525,7 +531,7 @@ int main(int argc, char **argv){
cryptStd= vc;
if(yuvMode==0) yuvMode=1;
grabYuvMode=yuvMode;
- vSmoothState=false;
+ iVSmooth=0;
setStdScale();
contGrab();
break;
@@ -533,7 +539,7 @@ int main(int argc, char **argv){
cryptStd= nag;
if(yuvMode==0) yuvMode=1;
grabYuvMode=yuvMode;
- vSmoothState=false;
+ iVSmooth=0;
setStdScale();
contGrab();
break;
Added: trunk/2010/2_cryp_a.asm
==============================================================================
--- (empty file)
+++ trunk/2010/2_cryp_a.asm Wed Jul 4 10:15:33 2007
@@ -0,0 +1,210 @@
+;2010 0.1 Copyright (C) Michael Niedermayer 1998
+
+%include "2_all_a.asm"
+
+segment .data
+
+global _VSmooth1RGB1555__Fiii
+global _VSmooth2RGB1555__Fiii
+
+%define pBuf1 par1
+%define iVgaX21 par2
+%define nOp1 par3
+
+%define pBuf2 par2
+%define iVgaX22 par3
+%define nOp2 par4
+
+_VSmooth1RGB1555__Fiii:
+ push eax
+ push ebx
+
+ push ecx
+ push edx
+
+ push esi
+ push edi
+
+ mov esi, [pBuf1]
+ add esi, 8
+
+ mov ecx, [nOp1]
+ add esi, ecx
+
+ xor ecx, -1
+ mov ebx, [iVgaX21]
+
+ inc ecx
+ mov edi, ebx
+
+ add ebx, esi
+ add edi, edi
+
+ add edi, esi
+
+ movq mm6, [mask1]
+ movq mm7, [mask2]
+
+ movq mm0, [esi+ecx]
+ movq mm1, [ebx+ecx]
+ movq mm3, [esi+ecx-8]
+
+
+ ; more opt possible (+2reg -1psrlw)
+MMXLoop1:
+ movq mm5, mm0
+ movq mm4, mm1
+
+ movq [esi+ecx-8], mm3
+ pand mm0, mm7
+
+ movq mm2, [edi+ecx]
+ pand mm1, mm6
+
+ movq mm3, mm2
+ pand mm2, mm6
+
+ pand mm5, mm6
+ pand mm4, mm7
+
+ pand mm3, mm7
+ paddw mm5, mm2
+
+ paddw mm3, mm0
+ psrlw mm5, 1
+
+ psrlw mm3, 1
+ paddw mm5, mm1
+
+ paddw mm3, mm4
+ psrlw mm5, 1
+
+ psrlw mm3, 1
+ pand mm5, mm6
+
+ movq mm0, [esi+ecx+8]
+ pand mm3, mm7
+
+ movq mm1, [ebx+ecx+8]
+ por mm3, mm5
+
+ add ecx, 8
+ jnc MMXLoop1
+
+ pop edi
+ pop esi
+
+ pop edx
+ pop ecx
+
+ pop ebx
+ pop eax
+
+ emms
+
+ret
+
+_VSmooth2RGB1555__Fiii:
+ push eax
+ push ebx
+
+ push ecx
+ push edx
+
+ push esi
+ push edi
+
+ push ebp
+
+ mov esi, [pBuf2]
+
+ add esi, 8
+ mov ebp, [nOp2]
+
+ xor ebp, -1
+ mov ebx, [iVgaX22]
+
+ add esi, ebx
+ mov edx, ebx
+
+ mov eax, ebx
+ add edx, edx
+
+ inc ebp
+ mov edi, ebx
+
+ add ebx, esi
+ add edi, edi
+
+ mov ecx, eax
+ add edi, esi
+
+ xor ecx, -1
+
+ inc ecx
+
+ movq mm6, [mask1]
+
+ movq mm7, [mask2]
+
+ ; lots of optimize possible
+MMXLoop2:
+ ;AGI
+ movq mm0, [esi+ecx]
+
+ movq mm1, [edi+ecx]
+ movq mm4, mm0
+
+ movq mm5, mm1
+ pand mm0, mm7
+
+ pand mm4, mm6
+ pand mm5, mm6
+
+ pand mm1, mm7
+ paddw mm4, mm5
+
+ paddw mm0, mm1
+ psrlw mm4, 1
+
+ psrlw mm0, 1
+ pand mm4, mm6
+
+ pand mm0, mm7
+
+ por mm4, mm0
+
+ movq [ebx+ecx], mm4
+
+ add ecx, 8
+ jnc MMXLoop2
+
+ sub ecx, eax
+ add ebx, edx
+
+ add esi, edx
+ add edi, edx
+
+ add ebp, edx
+ jnc MMXLoop2
+
+ pop ebp
+
+ pop edi
+ pop esi
+
+ pop edx
+ pop ecx
+
+ pop ebx
+ pop eax
+
+ emms
+
+ret
+
+xyz times 8 dd 0
+
+align8
+mask1 times 2 dd 0x7C1F03E0
+mask2 times 2 dd 0x03E07C1F
Added: trunk/2010/2_cryp_a.h
==============================================================================
--- (empty file)
+++ trunk/2010/2_cryp_a.h Wed Jul 4 10:15:33 2007
@@ -0,0 +1,8 @@
+//2010 0.1 Copyright (C) Michael Niedermayer 1998
+#ifndef n2_crypt_a_h
+#define n2_crypt_a_h
+
+void VSmooth1RGB1555(int, int, int);
+void VSmooth2RGB1555(int, int, int);
+
+#endif
Modified: trunk/2010/2_crypt.cpp
==============================================================================
--- trunk/2010/2_crypt.cpp (original)
+++ trunk/2010/2_crypt.cpp Wed Jul 4 10:15:33 2007
@@ -5,6 +5,7 @@
#include <time.h>
#include "2_all.h"
#include "2_crypt.h"
+#include "2_cryp_a.h"
#include "2_vc.h"
#include "2_nag.h"
#include "2_txt.h"
@@ -26,10 +27,10 @@ extern bool iState;
extern int infoPosX, infoPosY;
extern int some;
-static void vSmooth(void);
-static void decomb(int q);
+static void VSmooth(void);
+static void Decomb(int q);
-bool vSmoothState=true;
+int iVSmooth=1;
bool showPoints=false;
asm("__esp: .long 0\n\t");
@@ -37,13 +38,13 @@ bool showPoints=false;
void decrypt(void){
long T1=0, T2;
- char textbuf[2][128];
+ char textbuf[3][128];
if(iState){
T1=uclock();
}
- if( cryptStd == nag && satur!=0 ) decomb(0);
- if( cryptStd == vc && satur!=0 ) decomb(1);
+ if( cryptStd == nag && satur!=0 ) Decomb(0);
+ if( cryptStd == vc && satur!=0 ) Decomb(1);
if(iState){
T2=uclock();
@@ -60,20 +61,27 @@ void decrypt(void){
if(iState){
T2=uclock();
+ sprintf(textbuf[1],"%f DeCrypt", (float)(T2-T1)/UCLOCKS_PER_SEC);
+ T1=T2;
+ }
+
+ if(!oneField && iVSmooth) VSmooth();
+
+ if(iState){
+ T2=uclock();
color c;
c.init(255, 0, 0, false);
- sprintf(textbuf[1],"%f DeCrypt", (float)(T2-T1)/UCLOCKS_PER_SEC);
+ sprintf(textbuf[2],"%f VSmooth", (float)(T2-T1)/UCLOCKS_PER_SEC);
gprint(infoPosX, infoPosY+=10, c.col, textbuf[0]);
gprint(infoPosX, infoPosY+=10, c.col, textbuf[1]);
+ gprint(infoPosX, infoPosY+=10, c.col, textbuf[2]);
infoPosY+=5;
}
- if(!oneField && vSmoothState) vSmooth();
-
}
-static void decomb(int q){
+static void Decomb(int q){
int temp[max_x];
const int outy1= outy>>1;
@@ -219,33 +227,16 @@ static void decomb(int q){
*/
}
-static void vSmooth(void){
+static void VSmooth(void){
- if(yuvMode==0){
- /* asm(//"int $3 \n\t"
- "1: \n\t"
- "movl (%%esi ), %%eax \n\t" //U LINE
- "movl (%%esi,%%edi,2), %%ebx \n\t" // V 1 LINE + 2
- "shrl $2, %%eax \n\t" //U
- "andl $0xFCFCFCFC, %%ebx \n\t" // V 1
- "shrl $2, %%ebx \n\t" //U
- "andl $0x3F3F3F3F, %%eax \n\t" // V 1
- "addl %%eax, %%ebx \n\t" //U
- "movl (%%esi,%%edi ), %%eax \n\t" // V 1 LINE + 1
- "shrl $1, %%eax \n\t" //U
- "andl $0x7F7F7F7F, %%ebx \n\t" // V 1
- "andl $0x7F7F7F7F, %%eax \n\t" //U
- "addl $4, %%esi \n\t" // V 1
- "addl %%eax, %%ebx \n\t" //U
- "decl %%ecx \n\t" // V 1
- "movl %%ebx, -4(%%esi ) \n\t" //U LINE
- " jnz 1b \n\t" // V 1
- :
- : "D" (vgax<<2), "S" (actVid2MemBufp->b),
- "c" (vgax * (wndy-2) )
- : "%eax", "%ebx", "%ecx", "%esi");
- */
- }
+ if(yuvMode==0)
+ {
+ if(iVSmooth==1)
+ VSmooth1RGB1555(int(actVid2MemBufp->b), vgax<<1, vgax*(wndy-3)<<1);
+ else
+ VSmooth2RGB1555(int(actVid2MemBufp->b), vgax<<1, vgax*(wndy-3)<<1);
+ }
+/*
else{
asm(//"int $3 \n\t"
"1: \n\t"
@@ -280,5 +271,5 @@ static void vSmooth(void){
}
-
+ */
}
Modified: trunk/2010/2_file.cpp
==============================================================================
--- trunk/2010/2_file.cpp (original)
+++ trunk/2010/2_file.cpp Wed Jul 4 10:15:33 2007
@@ -15,7 +15,10 @@
extern int yuvMode;
extern char *yuv2rgb_lut;
-void grab(void){
+ static byte *ppbRawDat[64];
+ static int nRawDats=0;
+
+void GrabBmp(void){
int i, j;
FILE *fg;
char grab_name[16];
@@ -84,6 +87,50 @@ void grab(void){
}
+void GrabRaw(void){
+ FILE *fg;
+ char grab_name[16];
+ struct time ti;
+
+ gettime(&ti);
+ sprintf(grab_name, "G%02d%02d%02d.RAW", ti.ti_hour, ti.ti_min, ti.ti_sec);
+
+ if((fg=fopen(grab_name, "ab"))==NULL && g_mode==0) error(FileWrite);
+
+ fwrite(actVid2MemBufp->b, 1, vgax*wndy*2, fg);
+
+ fclose(fg);
+}
+
+
+void LoadRaws(int nRaws, char **ppcName){
+
+ nRawDats= nRaws;
+
+ FILE *pFRaw;
+
+ for(int i=0; i<nRaws; i++)
+ {
+ if((pFRaw=fopen(ppcName[i], "rb"))==NULL) error(FileRead);
+ const int iFileSize= fsize(pFRaw);
+ ppbRawDat[i]= new byte[iFileSize];
+ fread(ppbRawDat[i], 1, iFileSize, pFRaw);
+
+ fclose(pFRaw);
+ }
+}
+
+void ShowRaw(void){
+
+ if(!nRawDats) return;
+
+ static int i=0;
+
+ i++;
+ i%=nRawDats;
+ memcpy(actVid2MemBufp->b, ppbRawDat[i], vgax*vgay*2);
+}
+
long fsize(FILE *f){
long i,j;
i=ftell(f); //get pos
Modified: trunk/2010/2_file.h
==============================================================================
--- trunk/2010/2_file.h (original)
+++ trunk/2010/2_file.h Wed Jul 4 10:15:33 2007
@@ -20,7 +20,10 @@ struct bmp{
dword clrimp __attribute__ ((packed)) ;
};
-void grab(void);
+void GrabBmp(void);
long fsize(FILE *f);
+void LoadRaws(int, char **);
+void GrabRaw(void);
+void ShowRaw(void);
#endif
Modified: trunk/2010/2_grafix.cpp
==============================================================================
--- trunk/2010/2_grafix.cpp (original)
+++ trunk/2010/2_grafix.cpp Wed Jul 4 10:15:33 2007
@@ -35,12 +35,13 @@ void showStuff(void){
color c;
if(helpState){
- char text[14][256]={ "F1/F2 Brightness s TVStandart",
+ char text[15][256]={ "F1/F2 Brightness s TVStandart",
"F3/F4 Contrast i debugInfo",
"F5/F6 Saturation h Help",
- "g ScreenShot q Quit",
+ "g ScreenShot G SaveRaw",
"v smoothIterlace p Pause",
- "d allowDrop",
+ "d allowDrop q Quit",
+ "S ShowRaw",
" TELETXT:",
"+ Page+ - Page-",
"right subPage+ left subPage-",
@@ -50,7 +51,7 @@ void showStuff(void){
"e delUnSeen",
"f txt find F findNext"};
- for(int i=0; i<14; i++){
+ for(int i=0; i<15; i++){
c.init(255, 0, 0, false);
gprint(infoPosX, infoPosY+=10, c.col, text[i]);
}
Modified: trunk/2010/2_txt.cpp
==============================================================================
--- trunk/2010/2_txt.cpp (original)
+++ trunk/2010/2_txt.cpp Wed Jul 4 10:15:33 2007
@@ -223,11 +223,12 @@ void txt_decrypt(void){
// FIX ? optimize in fixp and lut ...
double si=0, co=0;
double ang=0;
- for(int x=0; x<10; x++){
+ for(int x=0; x<12; x++){
const int amp= actVid2MemBufp->b[linep + (x<<1) + 1];
si+= sin(ang)*(amp-avg);
co+= cos(ang)*(amp-avg);
ang+= angDelta;
+// actVid2MemBufp->b[linep + (x<<1) + 1]= 255;
}
int xFixp= int(atan3(si,co)/PI*freqPix2/FREQ_TXT*ONE_FIXP);
@@ -242,7 +243,7 @@ void txt_decrypt(void){
int score= sample( &actVid2MemBufp->b[linep + 1], xFixp );
if(score > avg) r|=1;
- actVid2MemBufp->b[linep + (x<<1) + 1]= (r&1)*255;
+// actVid2MemBufp->b[linep + (x<<1) + 1]= (r&1)*255;
xFixp+=delta;
x=xFixp>>FIXP_SH;
if(r==magic) break;
@@ -266,7 +267,7 @@ void txt_decrypt(void){
int score= sample( &actVid2MemBufp->b[linep + 1], xFixp );
if(score > avg) r|=0x80;
- actVid2MemBufp->b[linep + (x<<1) + 1]= (r&0x80)/0x80*255;
+// actVid2MemBufp->b[linep + (x<<1) + 1]= (r&0x80)/0x80*255;
if(!(decoded & 0x07)){
data[(decoded>>3) - 1]=r;
@@ -463,9 +464,12 @@ void txt_decrypt(void){
}
}
-
memset(actVid2MemBufp->b, 0, vgax*vgay<<mc);
+// if(yuvMode<2) memset(actVid2MemBufp->b, 0, vgax*vgay<<mc);
+// yuvMode++;
+// if(yuvMode>2) yuvMode=2;
+
if(txtHack>0 && txtHackState==0) txtHackState=14;
if(txtHackState>0){
@@ -475,6 +479,8 @@ void txt_decrypt(void){
if(iState || helpState) return;
+// return;
+
static int lastReqPage=-1, lastReqSubPage=-1, lastReqChanNum=-1;
// FIX reqChanStr
Modified: trunk/2010/2_vc.cpp
==============================================================================
--- trunk/2010/2_vc.cpp (original)
+++ trunk/2010/2_vc.cpp Wed Jul 4 10:15:33 2007
@@ -14,14 +14,14 @@
#include "2010.h"
#define FREQ_SMP 2.1e7
-#define POINT_LAND 765.0
-#define NO_POINT_LAND1 145.0 // GUESSED!
-#define NO_POINT_LAND2 145.0 // GUESSED!
-#define NO_POINT_LAND3 10.0 // GUESSED!
+#define POINT_LAND 765.0
+#define NO_POINT_LAND1 150.0 // GUESSED and ok
+#define NO_POINT_LAND2 150.0 // GUESSED and ok
+#define PHASE_PATCH (-28) // GUESSED ? -9, ...
// ? POINT_LAND + NO_POINT_LAND(1|2) = 910 (FIFO SIZE)
// ? NO_POINT_LAND + POINT_LAND = 1065 (PHASE ~+-60deg)
-#define NO_POINT_LAND (NO_POINT_LAND1 + NO_POINT_LAND2 + NO_POINT_LAND3)
+#define NO_POINT_LAND (NO_POINT_LAND1 + NO_POINT_LAND2)
#define PHASE_POINT (fmod(FREQ_CHROM / (FREQ_SMP/3.0), 1.0) * PI * 2.0)
#define PHASE_SMP (fmod(FREQ_CHROM / (FREQ_SMP ), 1.0) * PI * 2.0)
#define PHASE_SEG (fmod(FREQ_CHROM / FREQ_SMP \
@@ -33,9 +33,7 @@
#define DWN_SMP 1
#define MAX_DRIFT 2
#define DRIFT_TAB {1200, 400, 0, 400, 1200}
-//#define MAX_DRIFT 3
-//#define DRIFT_TAB {2400, 1200, 400, 0, 400, 1200, 2400}
-#define PHASE_CMP_STEP 3
+#define PHASE_CMP_STEP 3
#define BAD_THRESHOLD1 0.8
#define BAD_THRESHOLD2 200
#define EDGE_LIMIT 70
@@ -97,8 +95,11 @@ void vc_decrypt(void){
printf("xy%d %d\n", wndx, x_field);
// 18
+// const int vcStartX=int(double(16 -scales_x+3)/x_field*wndx + .5) + some - 10;
const int vcStartX=int(double(16 -scales_x+3)/x_field*wndx + .5);
+ static FILE *pF= fopen("out.dat", "wb");
+
static int cutP2X[256];
static int x2CutP[max_x];
@@ -107,11 +108,11 @@ void vc_decrypt(void){
for(int x=0; x<max_x; x++){
const int cutP=int( double(x) / ( 3.0 * freqPix2) * FREQ_SMP
- - (NO_POINT_LAND1 + NO_POINT_LAND3/2)/3.0 + .5);
+ - (NO_POINT_LAND1)/3.0 + .5);
x2CutP[x]= cutP;
}
for(int cutP=0; cutP<256; cutP++){
- const int x=int( double(cutP*3 + NO_POINT_LAND1 + NO_POINT_LAND3/2)
+ const int x=int( double(cutP*3 + NO_POINT_LAND1)
* freqPix2 / FREQ_SMP + .5);
cutP2X[cutP]= x;
}
@@ -152,6 +153,10 @@ void vc_decrypt(void){
static char sin2PerCutP[256];
static char cos2PerCutP[256];
+ static int cutPs=0;
+ static int fields=0;
+ fields++;
+
if(first){
some=10;
@@ -166,7 +171,7 @@ void vc_decrypt(void){
}
for(int cutP=0; cutP<256; cutP++){
- const double phase= PHASE_SMP*(NO_POINT_LAND1 + NO_POINT_LAND3) + PHASE_POINT*cutP;
+ const double phase= PHASE_SMP*(NO_POINT_LAND1 + PHASE_PATCH) + PHASE_POINT*cutP; // - some/360.0*2.0*PI;
phasePerCutP[cutP]= (byte)( phase * 128 / PI );
sin1PerCutP[cutP]= char(sin( -phase + PHASE_SEG )*127);
cos1PerCutP[cutP]= char(cos( -phase + PHASE_SEG )*127);
@@ -305,7 +310,7 @@ void vc_decrypt(void){
int(lowRes[1] + ((( vcDiff ) >> (DWN_SMP-1))&~1)),
int(lowRes[0] + ((( vcDiff - cutP) >> (DWN_SMP-1))&~1)),
-(( (vcDiff-cutP) >> (DWN_SMP-1) ) & ~1) );
-
+
}
if(bestDiff>diff){
@@ -377,8 +382,8 @@ void vc_decrypt(void){
const int driftPenalty[MAX_DRIFT*2+1]= DRIFT_TAB;
- int *newVal=new int[257], *lastVal=new int[257];
- memset(lastVal, 0, 257<<2);
+ int *newVal=new int[256], *lastVal=new int[256];
+ memset(lastVal, 0, 256<<2);
byte *newPhaseErr=new byte[256], *lastPhaseErr=new byte[256];
memset(lastPhaseErr, 0, 256);
@@ -389,7 +394,7 @@ void vc_decrypt(void){
llinep+=vgax<<1;
linep+=vgax<<1;
- memset(newVal, 0, 257<<2);
+ memset(newVal, 0, 256<<2);
memset(newPhaseErr, 0, 256);
bool noLeft=true;
@@ -411,6 +416,12 @@ void vc_decrypt(void){
const int p= x>>(PHASE_CMP_STEP-1);
convVec[p ]= ul*un + vl*vn;
convVec[p+1]= ul*vn - vl*un;
+/*
+ const float fsScale= sqrt(convVec[p ]*convVec[p ] +
+ convVec[p+1]*convVec[p+1] );
+ convVec[p ]= int(convVec[p ]/pow(fsScale + .001, .9));
+ convVec[p+1]= int(convVec[p+1]/pow(fsScale + .001, .9));
+*/
chromAmp+= mabs(un) + mabs(vn);
}
if(line<4) chromAmp=1;
@@ -559,10 +570,11 @@ void vc_decrypt(void){
}
if(!black[line]){
+ int iBestVal=0;
for(int newCutP = 0; newCutP < 256; newCutP++){
if(!noLeft && newVal[newCutP]==0) continue;
- const byte * const p= &linep[ ((cutP2X[ newCutP ] + vcStartX)<<1) + 1 - 4 ];
+ const byte * const p= &linep[ ((cutP2X[ newCutP ] + vcStartX)<<1) + 1 - 4];
const int diff=edgeLut[ mabs( + int(* p ) + int(*(p+2))
- int(*(p+4)) - int(*(p+6)) ) ];
@@ -570,8 +582,8 @@ void vc_decrypt(void){
if(newVal[newCutP]==0) newVal[newCutP] = diff + 1000000000;
else newVal[newCutP] += diff;
- if(newVal[256] < newVal[newCutP]){
- newVal[256]= newVal[newCutP];
+ if(iBestVal < newVal[newCutP]){
+ iBestVal= newVal[newCutP];
bestDir[line]= newCutP;
}
@@ -603,7 +615,7 @@ void vc_decrypt(void){
if(showPoints){
int bestCutP=-1;
- for(int line=wndy-1; line>0; line--){
+ for(int line=wndy-2; line>0; line--){
if(bestDir[line]==-1){
bestCutP=-1;
continue;
@@ -615,16 +627,18 @@ void vc_decrypt(void){
continue;
}
- const int bestX= cutP2X[ bestCutP ];
- actVid2MemBufp->b[(line * vgax<<1) + ((vcStartX + bestX)<<1)+1]=255;
- actVid2MemBufp->b[(line * vgax<<1) + ((vcStartX + bestX)<<1)+3]=0;
- actVid2MemBufp->b[(line * vgax<<1) + ((vcStartX + bestX)<<1)+5]=255;
+// const int bestX= cutP2X[ bestCutP ];
+ int bestX=cutP2X[ bestCutP ] + cutPointX[line-1] - cutPointX[line];
+ if(bestX<0) bestX+= vcDiff;
+ if(bestX>=vcDiff) bestX-= vcDiff;
+ actVid2MemBufp->b[((line-1) * vgax<<1) + ((vcStartX + bestX)<<1)+1]=255;
+ actVid2MemBufp->b[((line-1) * vgax<<1) + ((vcStartX + bestX)<<1)+3]=0;
bestCutP= dir[(line<<8) + bestCutP];
}
}
- int cutpp[1000];
+ byte cutpp[1000];
byte copy_buff[max_x<<1];
int bestCutP=-1;
@@ -649,7 +663,7 @@ void vc_decrypt(void){
bestCutP=-1;
continue;
}
- if(bestCutP==-1) bestCutP=dir[(line<<8) + 256];
+ if(bestCutP==-1) bestCutP= bestDir[line];
if(bestCutP<0 || bestCutP>=256){
printf("two%d\n", bestCutP);
@@ -657,9 +671,11 @@ void vc_decrypt(void){
continue;
}
+ cutpp[line]=bestCutP;
+
const int bestX= cutP2X[ bestCutP ];
- int cutX= (showPoints ? cutPointX[line] : bestX );
+ int cutX= ((showPoints && 0) ? cutPointX[line] : bestX );
const int cutP= max(x2CutP[cutX], 0); // fix ? ness, min?
@@ -754,16 +770,18 @@ void vc_decrypt(void){
: "%eax", "%ebx", "%ecx");
}
- cutpp[line]=cutX;
-
-
bestCutP= dir[(line<<8) + bestCutP];
}
+ for(int line=1; line<wndy-1; line++)
+ {
+ fprintf(pF, "%d\n", cutpp[line]);
+ }
+
/*
float avgCutP=0;
for(int line=50; line<200; line++){
- avgCutP+=float(cutpp[line]);
+ avgCutP+=float(cutpp[l ine]);
}
avgCutP/=(200.0-50.0);
@@ -794,6 +812,10 @@ void vc_decrypt(void){
T1=T2;
}
+ c.init(255, 0, 0, false);
+ sprintf(textbuf[6],"%d l %d f", cutPs, fields);
+ gprint(infoPosX, infoPosY+=10, c.col, textbuf[6]);
+
delete [] bestDir;
delete [] dir;
Modified: trunk/2010/2_vc_a.asm
==============================================================================
--- trunk/2010/2_vc_a.asm (original)
+++ trunk/2010/2_vc_a.asm Wed Jul 4 10:15:33 2007
@@ -52,7 +52,7 @@ _vc_corr__Fiiiiii:
mov ebx, [esp + edi]
or eax, 0x80008000
-NoMMXloop:
+NoMMXloop:
sub edx, ecx ; U
sub eax, ebx ; V 1
and edx, 0x00FF00FF ; U
Modified: trunk/2010/makefile
==============================================================================
--- trunk/2010/makefile (original)
+++ trunk/2010/makefile Wed Jul 4 10:15:33 2007
@@ -16,11 +16,11 @@ AFLAGS = -f coff
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_glob_a.o 2_txt.o
+ 2_glob_a.o 2_txt.o 2_cryp_a.o
OC = 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 2_txt.o
+ 2_nag_a.o 2_vc_a.o 2_glob_a.o 2_txt.o 2_cryp_a.o
default: ;$(MAKE) 2010 CFLAGS="$(OPTS)"
@@ -50,4 +50,5 @@ clean: ; del $(O) 2010
2_glob_a.o : 2_glob_a.asm 2_all_a.asm
2_nag_a.o : 2_nag_a.asm 2_all_a.asm
2_vc_a.o : 2_vc_a.asm 2_all_a.asm
+2_cryp_a.o : 2_cryp_a.asm 2_all_a.asm
More information about the Mndiff-dev
mailing list