PDA

View Full Version : Setting CX2388x registers outside of WDM driver possible?


tedkunich
17th July 2004, 07:26
I have a Leadtek 2000 Expert and am using the lated WDM drivers from Leadtek. My problem is that the driver defaults to turning on the white crush feature (I surmise a pseudo Luma AGC) by default. This is causing problems with the Luma calibration in my caps - I'm using Virtual VCR. Dscaler will allow me to set the advanced chip features on and off, (and it perfrom automated video calibration from my Video Esentials disc), but the program cannot capture worth a damn. Virtual VCR does not allow me to set these parameters. Is there a tool that would allow me to set the apporiate registers in the CX2388x chip? I can see the settings with the RegSpy utility.


Thanks

T

Arachnotron
17th July 2004, 13:45
I'm not aware of such a util (and believe me, I have been searching for it too). But if you can find the settings in the registry, why not change them there?

(That is assuming that you are using this (http://www.utils32.com/regspy.asp) regspy.)

Other than that, it is hoping someone hacks BTtweak to do CX2388x too.

tedkunich
17th July 2004, 16:25
Actually the RegSpy utility that I have reads the CX2388x registers and reports any and all changes written to the card - I beleave I found the link to it on the Dscaler site or in its help files..

I'll give the registry tool a try, although I think that these programs just write the value to the driver/card at initalization since the card always reverts to the defaults on reboot - the values are only set on the VirtualVCR's initalization....

Thanks

Ted


Originally posted by Arachnotron
I'm not aware of such a util (and believe me, I have been searching for it too). But if you can find the settings in the registry, why not change them there?

(That is assuming that you are using this (http://www.utils32.com/regspy.asp) regspy.)

Other than that, it is hoping someone hacks BTtweak to do CX2388x too.

Arachnotron
17th July 2004, 21:40
Thanks for the tip! I found it here (http://sourceforge.net/project/showfiles.php?group_id=7420) .
I'll give the registry tool a try, although I think that these programs just write the value to the driver/card at initalization since the card always reverts to the defaults on reboot - the values are only set on the VirtualVCR's initalization.... True. Which is why the BTTweak has a reassert button.
But this default is set by the driver for any program except Dscaler (which uses it's own). VirtualVCR triggers a general reset by the driver, I do not think the White crush is set by VVCR.
So the question is: is the default for white crush hard-coded in the leadtek driver or does the driver get its defaults from a registry key somewhere. I fear it is hardcoded, but you could be lucky.

tedkunich
18th July 2004, 07:37
From what I have been able to acertain is that White Crush is on by default right after a fresh reboot - something in the driver??? It would be nice if I could use Dscaler to disable the bit, but once I run Dscaler, I cannot run VirtualVCR - I just get black video....



T


Originally posted by Arachnotron
Thanks for the tip! I found it here (http://sourceforge.net/project/showfiles.php?group_id=7420) .
True. Which is why the BTTweak has a reassert button.
But this default is set by the driver for any program except Dscaler (which uses it's own). VirtualVCR triggers a general reset by the driver, I do not think the White crush is set by VVCR.
So the question is: is the default for white crush hard-coded in the leadtek driver or does the driver get its defaults from a registry key somewhere. I fear it is hardcoded, but you could be lucky.

tedkunich
20th July 2004, 17:32
After not having much success in finding resources on the Web to help in this endeavour, I took it upon myself to cobble together a hack to write the registers myself. Interesting obvservation is that the White_Crush feature is an abolute must - otherwise half the screen is white when viewing the graduated 16 shades of gray from the VE LD, no combination of bright/contrast would allow identification of all 16 shades.

I did notice though that the Leadtek drivers do some things that are really out there, if not flat out wrong - disabling the Y notchfilter in composite mode is fairly blatant.... there are a few other wierd things... guess I'll have to dig a little deeper into the CX2388 data sheet... (I'll see if I can get any app notes from Conexant ;)

Arachnotron
20th July 2004, 20:03
For Hauppauge, the default is
WCFrame 0
DNVAL 111111
MAJSEL 01
UPVAL 001111

Could you post the hack? I'm trying to get this card to do PAL60, another thing those kind people at Hauppauge disabled for me :(

tedkunich
20th July 2004, 21:18
It will not be pretty, and I'll need to figure out a way for you to enter in the base memory address of your card. Also, the VB library that I klugged in is shareware - it throws up a nag... it works for me though....

I had an idea to have it read the dump file created by the regspy utility - you can edit the bits with a text editor and then let the program bang all the bits in. It can be a bit dangerous as you can get the driver and card out of sync if you flip bits that the driver is managing....

Do you have facilities to compile VisualBasic? if so, I can post the code and link to the library. you can then customize it anyway you see fit ;) (I have mine hard coded for base mem address, and register values I want programmed)




Originally posted by Arachnotron
For Hauppauge, the default is
WCFrame 0
DNVAL 111111
MAJSEL 01
UPVAL 001111

Could you post the hack? I'm trying to get this card to do PAL60, another thing those kind people at Hauppauge disabled for me :( :D :D :D

Arachnotron
20th July 2004, 21:34
I had an idea to have it read the dump file created by the regspy utility - you can edit the bits with a text editor and then let the program bang all the bits in. It can be a bit dangerous as you can get the driver and card out of sync if you flip bits that the driver is managing....

Good Idea that.

Do you have facilities to compile VisualBasic? if so, I can post the code and link to the library. you can then customize it anyway you see fit (I have mine hard coded for base mem address, and register values I want programmed)

Thankyouthankyouthankyou.... :thanks:

Yes I have. VB6 is no problem, and something more recent is possible. Once I have something to point me in the right direction I can adapt it, but throwing something like that together from scratch is way beyond my programming skills :)

I really need something here. I was using the latest CX drivers from Hauppauge, but they give to much interference. So I went back to a previous beta version, which is the only version so far that will work with my nforce2 MB. However, they disabled the white balance slider in this beta AND the brightness is totally screwed up. Also, the capture area has been decreased to about 680 DVD pixels. Who knows what else is wrong with it, but it is the only one that will cap at all. So I'll probably hard code all the settings I need in it.

tedkunich
21st July 2004, 08:36
Originally posted by Arachnotron


Thankyouthankyouthankyou....



OK, here goes.... First you need the MemAccess Module (http://www.zealsoftstudio.com/memaccess/memaccev.zip) dll package. Run the installer and make sure you at least install the VB demo. If you accept the default install location, you will have a directory called C:\Program Files\MemAccess Library. In there you will find a sample VB directory and within that, will be one called pci.

Next you want to delete the file "Form1.frm" and replace it with the code below. (copy the code into notepad and save as Form1.frm in the PCI directory)

Check that the VendorID and DeviceID in the code matches your system. These can be found in the RegSpy register dump file.

Build the app and click on the Get BaseAddr button - DONT CLICK ON EITHER OF THE READ OR WRITE BUTTONS!!!! IF YOU DO, BAD THINGS MAY HAPPEN

You will see the Memory I/O space displayed - there should be only one, if you have more, then all bets are off from this point on!!

Get the start of memory and then code that into the global variable BaseAddr. Rebuild and from then on you are golden!! I don't save anything, nor have any default values. You must perform a read first to fill in the fields, edit whatever bits you want, then write the whole lot to the card - this is an all or nothing operation!

Good luck!

T





VERSION 5.00
Begin VB.Form Form1
Caption = "PCI Sample"
ClientHeight = 7590
ClientLeft = 45
ClientTop = 330
ClientWidth = 5550
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 7590
ScaleWidth = 5550
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Capture_Cont
Height = 372
Left = 1800
TabIndex = 25
Text = "&H00000000"
Top = 6840
Width = 1215
End
Begin VB.TextBox Color_Cont
Height = 372
Left = 1800
TabIndex = 23
Text = "&H00000000"
Top = 6360
Width = 1215
End
Begin VB.TextBox YC_Notch
Height = 372
Left = 1800
TabIndex = 21
Text = "&H00000000"
Top = 5880
Width = 1215
End
Begin VB.TextBox Comb_2H
Height = 372
Left = 1800
TabIndex = 14
Text = "&H00000000"
Top = 5400
Width = 1215
End
Begin VB.TextBox Hue
Height = 372
Left = 1800
TabIndex = 13
Text = "&H00000000"
Top = 4920
Width = 1215
End
Begin VB.TextBox Sat_UV
Height = 372
Left = 1800
TabIndex = 12
Text = "&H00000000"
Top = 4440
Width = 1215
End
Begin VB.TextBox Bright_Cont
Height = 372
Left = 1800
TabIndex = 11
Text = "&H00000000"
Top = 3960
Width = 1215
End
Begin VB.TextBox White_Crush
Height = 372
Left = 1800
TabIndex = 10
Text = "&H00000000"
Top = 3480
Width = 1215
End
Begin VB.TextBox H_Filter_Odd
Height = 372
Left = 1800
TabIndex = 9
Text = "&H00000000"
Top = 3000
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "Read Reg"
Height = 375
Left = 4320
TabIndex = 8
Top = 3840
Width = 1095
End
Begin VB.TextBox InputFormat
Height = 375
Left = 1800
TabIndex = 6
Text = "&H0000"
Top = 2040
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "Write Reg"
Height = 375
Left = 4320
TabIndex = 5
Top = 4680
Width = 1095
End
Begin VB.CommandButton btnClose
Caption = "Close"
Height = 372
Left = 4320
TabIndex = 4
Top = 720
Width = 1092
End
Begin VB.TextBox txtAddress
Height = 1095
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Top = 240
Width = 3972
End
Begin VB.TextBox H_Filter_Even
Height = 372
Left = 1800
TabIndex = 2
Text = "&H00000000"
Top = 2520
Width = 1215
End
Begin VB.CommandButton btnGet
Caption = "Get Base Addr"
Height = 495
Left = 4320
TabIndex = 0
Top = 120
Width = 1092
End
Begin VB.Label Label11
Caption = "Capture Control"
Height = 375
Left = 120
TabIndex = 26
Top = 6840
Width = 1455
End
Begin VB.Label Label10
Caption = "Color Control"
Height = 375
Left = 120
TabIndex = 24
Top = 6360
Width = 1455
End
Begin VB.Label Label9
Caption = "Y/C Notch && pixel]"
Height = 375
Left = 120
TabIndex = 22
Top = 5880
Width = 1455
End
Begin VB.Label Label8
Caption = "2H Comb Format"
Height = 255
Left = 120
TabIndex = 20
Top = 5400
Width = 1455
End
Begin VB.Label Label7
Caption = "Hue"
Height = 255
Left = 120
TabIndex = 19
Top = 4920
Width = 1455
End
Begin VB.Label Label6
Caption = "UV Saturation"
Height = 255
Left = 120
TabIndex = 18
Top = 4440
Width = 1455
End
Begin VB.Label Label5
Caption = "Brightness/Contrast"
Height = 255
Left = 120
TabIndex = 17
Top = 3960
Width = 1455
End
Begin VB.Label Label4
Caption = "White Crush"
Height = 255
Left = 120
TabIndex = 16
Top = 3480
Width = 1455
End
Begin VB.Label Label3
Caption = "Horiz Filter Odd"
Height = 255
Left = 120
TabIndex = 15
Top = 3000
Width = 1455
End
Begin VB.Label Label1
Caption = "Horiz Filter Even"
Height = 255
Left = 120
TabIndex = 7
Top = 2520
Width = 1455
End
Begin VB.Label Label2
Caption = "Input Mode"
Height = 255
Left = 120
TabIndex = 1
Top = 2040
Width = 1575
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Very ugly hack to Write CX2388x registers on Leadtek WinFast TV2000 Expert
'PCI address is hard coded in this example, may cause harm to your system.
'if you do not know what you are doing, don't play!!!!! You are warned!!!!

Option Explicit

Public index As Integer
Public BaseAddr As Long


Private Sub Form_Load()
index = 0

'this is the Base address of the the Leadtek Winfast card in MY PC!
'it is garanteed to be different than yours!
'use the Get BaseAddr function/button in the compiled app to determine
'the start of I/O memory on your card, then enter it here and then recompile.
'
'You will see something like:
' Address(0): &Hxxxxxxxx-&Hyyyyyyyy
' Memory I/O
'
'Set the BaseAddr below to whatever &Hxxxxxxxx above is.

BaseAddr = &HEC000000

End Sub





Private Sub btnClose_Click()
Unload Me
End Sub

Private Sub btnGet_Click()
Dim i As Integer
Dim sError As String

Dim baddrBuffer(5) As BADDR
Dim nResult As Long, nIndex As Long
Dim VendorID As Integer, DeviceID As Integer


sError = Space(255)

' Open the library
If maOpenLibrary() = False Then
maGetLastState sError
MsgBox "Error: " + sError, vbCritical
Exit Sub
End If

' Enumerate all devices
nIndex = 0
txtAddress = ""
Do

'these are the Vendor and Device ID's for the the Conexant CX2388x device
'confirm these values with RegSpy (part of the Dscaler package) and adjust as need

VendorID = &H14F1
DeviceID = &H8800


nResult = maGetDeviceBaseAddress(VendorID, _
DeviceID, nIndex, baddrBuffer(0))
Select Case nResult
Case 1
txtAddress = txtAddress + "VendorID: &H" + Hex(VendorID)
txtAddress = txtAddress + " DeviceID: &H" + Hex(DeviceID) + vbCrLf
For i = 0 To 5
If baddrBuffer(i).IOType <> 2 Then
txtAddress = txtAddress + Space(3) + "Address(" & i & "): &H" + Hex(baddrBuffer(i).BaseAddress) _
+ "-" + Hex(baddrBuffer(i).BaseAddress + baddrBuffer(i).Size - 1) + vbCrLf
txtAddress = txtAddress + Space(6) + IIf(baddrBuffer(i).IOType = 1, "Port I/O", "Memory I/O") + vbCrLf
End If
Next

txtAddress = txtAddress + vbCrLf

End Select
nIndex = nIndex + 1
Loop While nResult = 1

' Close the library
maCloseLibrary
End Sub


Private Sub Command1_Click()
Dim errMsg As String


' Open the library
If maOpenLibrary() = False Then
maGetLastState errMsg
MsgBox "Error: " + errMsg, vbCritical
Exit Sub
End If

InputFormat = "&H" + Hex(maPeekD(BaseAddr + &H310104))
H_Filter_Even = "&H" + Hex(maPeekD(BaseAddr + &H31015C))
H_Filter_Odd = "&H" + Hex(maPeekD(BaseAddr + &H310160))

White_Crush = "&H" + Hex(maPeekD(BaseAddr + &H31011C))
Bright_Cont = "&H" + Hex(maPeekD(BaseAddr + &H310110))
Sat_UV = "&H" + Hex(maPeekD(BaseAddr + &H310114))
Hue = "&H" + Hex(maPeekD(BaseAddr + &H310118))
Comb_2H = "&H" + Hex(maPeekD(BaseAddr + &H310164))
YC_Notch = "&H" + Hex(maPeekD(BaseAddr + &H310120))
Color_Cont = "&H" + Hex(maPeekD(BaseAddr + &H310184))
Capture_Cont = "&H" + Hex(maPeekD(BaseAddr + &H310180))

maCloseLibrary


End Sub

Private Sub Command2_Click()
Dim done As Boolean
Dim errMsg As String


' Open the library
If maOpenLibrary() = False Then
maGetLastState errMsg
MsgBox "Error: " + errMsg, vbCritical
Exit Sub
End If


done = maPokeD(BaseAddr + &H310104, Val(InputFormat))
done = maPokeD(BaseAddr + &H31015C, Val(H_Filter_Even))
done = maPokeD(BaseAddr + &H310160, Val(H_Filter_Odd))

done = maPokeD(BaseAddr + &H310110, Val(Bright_Cont))
done = maPokeD(BaseAddr + &H310114, Val(Sat_UV))
done = maPokeD(BaseAddr + &H310118, Val(Hue))
done = maPokeD(BaseAddr + &H310164, Val(Comb_2H))
done = maPokeD(BaseAddr + &H31011C, Val(White_Crush))
done = maPokeD(BaseAddr + &H310120, Val(YC_Notch))
done = maPokeD(BaseAddr + &H310184, Val(Color_Cont))
done = maPokeD(BaseAddr + &H310180, Val(Capture_Cont))

maCloseLibrary


End Sub

Arachnotron
21st July 2004, 21:07
The program works! The values it returns make sense and match those by regspy.

PAL-60 does not work yet, apparently there is more to it than just setting FMT to 0000 or 1000, but that is a matter of trial and error. At least now I can get to those settings.

Once again, many thanks!

[edit]
I have it working now, but in a *very* convoluted way. Apparently there is some sort of initialisation signal required. It works when I do this:

- set up VirtualVCR as if for NTSC_M
- start up PCIsample.exe and read out the registers
- change Input mode to &H18098 (this sets the format to PAL-60)
- open the videoWDMcontrol at the decoder tab
- start the capture (picture is scrambled at this point)
- write the registry changes
- change NTSC_M to NTSC_MJ in the pull down menu, but leave the util open. Do not click ok or apply! Do not change preview mode!

From this point on untill you change something you get a perfect PAL-60 cap.

The funny thing is, it also works if you go from NTSC_MJ to NTSC_M, but not if you change to PAL. So it seems it must be a 525 line mode, but apart from that only the act of changing it matters.

You have to use an external util to get to the decoder tab, because opening it from within VVCR blocks access to the controls.

Arachnotron
28th July 2004, 20:30
@Ted

While the method above works more or less for getting PAL-60, the price you pay is that when you touch the video format pull-down, some other settings reset too (like the active area, i.e. H_delay, H_active etc). So I can do PAL-60 now, but changing most of the other registers fails because of this.

Have you been able to find a method to implement a "bttweak re-assert button" like functionality?

tedkunich
28th July 2004, 20:43
Originally posted by Arachnotron
@Ted

While the method above works more or less for getting PAL-60, the price you pay is that when you touch the video format pull-down, some other settings reset too (like the active area, i.e. H_delay, H_active etc). So I can do PAL-60 now, but changing most of the other registers fails because of this.

Have you been able to find a method to implement a "bttweak re-assert button" like functionality?


Are the registers that are being affected by selecting the pulldown menu in the hack's window? If so, just read back all the registers before you start, and then write them back out when you need to. As far as automating it, that could be easily done, but you would have to register the memory access dll because the popup would not make it very automated anymore :)

I have never seen bttweak in action as I have never had a card that it supports - previously an ATI AIW, and now the Leadtek (CX23881).

While I have you here, and WAY OT for this thread, RE aspect ratios and capture windows - I saw that you were involved in quite a bit of discussion a while back on this.... what is optimum capture size to maintain the proper aspect ratio with this chipset? does it depend on driver settings??? I know that the driver Hscale registers are set to 910 pixels. I have been capturing at 720-480 and everthign look fine on the PC, but that does not mean anything until it gets burned to DVD and played back on the TV, right?....


T

Arachnotron
28th July 2004, 21:35
While I have you here, and WAY OT for this thread, RE aspect ratios and capture windows - I saw that you were involved in quite a bit of discussion a while back on this.... what is optimum capture size to maintain the proper aspect ratio with this chipset? does it depend on driver settings??? I know that the driver Hscale registers are set to 910 pixels. I have been capturing at 720-480 and everthign look fine on the PC, but that does not mean anything until it gets burned to DVD and played back on the TV, right?....

I wanted to do a quick test with an NTSC signal to give you an example and found out what my problem was... My CX driver is hard-coded to PAL! no matter what change I make, it will revert to PAL. Even regular NTSC does not work. I will have to change drivers...

Anyhow, the calculations are simple.
From the HSCALE you can calculate the total number of scaled pixels per line. 910 in your case. You cap 720 pixels. That gives you an active capture window of 720 * 63.556 /910 = 50.28 µs
This equals 13.5 MHz * 50.28 µs = 678.9 DVD pixels. If you want to make a DVD with correct AR out of it, cap at 678 and pad to 720 or 704.

HSCALE is not fixed. The window of 50.28 µs is by the driver. HSCALE, HACTIVE and HDELAY will be adjusted to make sure the number of pixels you set will fall into this window. Just set to 640x480 and check HSCALE with regspy. It will have changed.

What I am playing with is the role of the CX2388x_Pixel_CNT_notch register in this. I think this sets the base sampling frequency to either 4xFsc or 13.5 MHz. I suspect that if you were to set it to 13.5 MHz, HActive would change too since it gives the ratio between the raw sampling rate and the scaled sample rate. Normally it is set to 4xFSC and the calculation examples on page 2-101 work.

[edit] if the driver will not allow mod2 capping, 680 is close enough :)

tedkunich
28th July 2004, 22:46
@Arachnotron

Sorry, I misspoke - the Htotal register is set to 910, I'll have to check to see what the Hscale register is set to tonight.... Question for you in the mean time... where does the 63.556 in your calculations come from.... Are you sure it should not be 62.556?


RE CX2388x_Pixel_CNT_notch, this is register 0x310120 on page 6-67 of the data sheet if you had not figured that out yet...


Thanks

T



Originally posted by Arachnotron
I wanted to do a quick test with an NTSC signal to give you an example and found out what my problem was... My CX driver is hard-coded to PAL! no matter what change I make, it will revert to PAL. Even regular NTSC does not work. I will have to change drivers...

Anyhow, the calculations are simple.
From the HSCALE you can calculate the total number of scaled pixels per line. 910 in your case. You cap 720 pixels. That gives you an active capture window of 720 * 63.556 /910 = 50.28 µs
This equals 13.5 MHz * 50.28 µs = 678.9 DVD pixels. If you want to make a DVD with correct AR out of it, cap at 678 and pad to 720 or 704.

HSCALE is not fixed. The window of 50.28 µs is by the driver. HSCALE, HACTIVE and HDELAY will be adjusted to make sure the number of pixels you set will fall into this window. Just set to 640x480 and check HSCALE with regspy. It will have changed.

What I am playing with is the role of the CX2388x_Pixel_CNT_notch register in this. I think this sets the base sampling frequency to either 4xFsc or 13.5 MHz. I suspect that if you were to set it to 13.5 MHz, HActive would change too since it gives the ratio between the raw sampling rate and the scaled sample rate. Normally it is set to 4xFSC and the calculation examples on page 2-101 work.

[edit] if the driver will not allow mod2 capping, 680 is close enough :)

Arachnotron
28th July 2004, 23:19
Sorry, I misspoke - the Htotal register is set to 910, I'll have to check to see what the Hscale register is set to tonight.... Question for you in the mean time... where does the 63.556 in your calculations come from.... Are you sure it should not be 62.556?
ITU-R BT.470-6, page 5, table 1-1. It is the length of the full NTSC-M line. I think you are confused with the active part, which is 52.6555.

Anyhow, the active capture window is fixed by the driver.

A Htotal of 910 corresponds to a raw sample rate of 4 x Fsc. (color subcarrier frequency)
4 x 3.58 MHz = 14.32 MHz.
14.32 x 63.556 = 910 pixels

Hscale determines to how many those 910 are resized (resampled)
Hdelay how many are skipped before the start of the capture window
HActive how many scaled pixels are in it.

RE CX2388x_Pixel_CNT_notch, this is register 0x310120 on page 6-67 of the data sheet if you had not figured that out yet... Yes, I know. It is just that untill now I assumed the chip would go from the raf samples at 8xFSc to the final pixels set bu HScale in one fell swoop. The Y/C separation etc. filter indicates that there is an intermediate step with either 4xFSc or 13.5 MHz sample rate pixels.

I suspect HTotal is fixed for any capping res.

tedkunich
30th July 2004, 00:06
@Arachnotron

I briefly played with the Hscale and Hdelay registers last night... It looks like I can play with those settings to capture the full DVD 720 resolution.... maybe??? I had burned the test DVD found in the capture guide used to determine the capture window... initially there were only 9 pixels to the left of the "20" hash mark and the "700" hash marks was on the very last pixel in the capture. Playing with the Hscale and Hdelay registers only, I was able to see more of the test pattern output from the DVD player. I had no success in getting the card to sample at 13.5MHz - the Leadtek drivers seem to only work on a 4xFsc (14.18MHz) capture rate. Do you know of any other tricks to get it set to capture correctly????

I did not have much time last night, as I had an early meeting with a client this morning. I'll have plenty of time to "play" tonight.

Thanks

T


Originally posted by Arachnotron
ITU-R BT.470-6, page 5, table 1-1. It is the length of the full NTSC-M line. I think you are confused with the active part, which is 52.6555.

Anyhow, the active capture window is fixed by the driver.

A Htotal of 910 corresponds to a raw sample rate of 4 x Fsc. (color subcarrier frequency)
4 x 3.58 MHz = 14.32 MHz.
14.32 x 63.556 = 910 pixels

Hscale determines to how many those 910 are resized (resampled)
Hdelay how many are skipped before the start of the capture window
HActive how many scaled pixels are in it.

Yes, I know. It is just that untill now I assumed the chip would go from the raf samples at 8xFSc to the final pixels set bu HScale in one fell swoop. The Y/C separation etc. filter indicates that there is an intermediate step with either 4xFSc or 13.5 MHz sample rate pixels.

I suspect HTotal is fixed for any capping res.

Arachnotron
30th July 2004, 12:39
I had no success in getting the card to sample at 13.5MHz - the Leadtek drivers seem to only work on a 4xFsc (14.18MHz) capture rate.
Neither had I, but it may not matter. Sampling at 4xFsc and resizing to 13.5 MHz may in the end result in a better picture.
Do you know of any other tricks to get it set to capture correctly????No, I the active area is determided solely by those two registers. If adjusting those fails, I would advise capping at such a resolution that you do not need to resize afterwards. Especially from tape, there is not that much at the edges anyway. I suspect conexxant/hauppauge chose this narrow area for that reason: for most analogue sources, you will completely loose any jagged black borders. And most people don't notice AR errors anyway.

By the way, AFAIK there are no analogue sources with info outside the standard 52.566 range, so capping at 704 and setting the window width to 52.15 may also be ok. Even DVD players often chop off a few of the outside pixels and can, depending on the brand, deliver anything between 52.655 and 53.555 µs active area.

tedkunich
30th July 2004, 16:37
I played a bit last night and found that the LD source is not quite the same size as a DVD source when it comes to active pixels. What I have done is to adjust the offset and scale registers to "fill" up the 720x480 capture window with the Snell&Wilcox test plate from my LD Video Essentials. With the DVD version, setting the scale to 0xF8 and the offset to 0x80 put the test plate image fully in the 720x480 capture window... with the LD, the scale is closer to 0xC1.

My reasoning here is that the LD test plate is sized for the correct AR when played back on a NTSC set, and assuming that capping at 720x480 provides the correct AR on DVD playback.... I should be closer to the ideal than before! I will have to matte out the first few and last few pixels though and the image seems to shift a pixels here and there thoughout the movie....


T

Arachnotron
30th July 2004, 18:43
I played a bit last night and found that the LD source is not quite the same size as a DVD source when it comes to active pixels. DVD is probably wider than DVD. NTSC LD active area should be about 712 DVD pixels wide.

[edit] a delay of 7A would be ITU compliant. But not all DVD players adhere to that standard either....

tedkunich
30th July 2004, 20:21
Cool, because I have about 4-5 pixels of black on either side of my cap!!! Perfect!!!



Originally posted by Arachnotron
DVD is probably wider than DVD. NTSC LD active area should be about 712 DVD pixels wide.

[edit] a delay of 7A would be ITU compliant. But not all DVD players adhere to that standard either....

gnuz187
12th August 2004, 06:17
Will this work with an MSI TV@nywhere Master? If so, can someone post up a link to the compiled binary? If not, is there anything in the VB code that can be changed to make it work? Thanks in advance!

tedkunich
12th August 2004, 19:25
@gnuz187

I have no idea... does it use the CX2388x chip? The VB source and instructions are on the first page of this thread. I have no hosting capabilites, so I could not post a binary - even if I could, it would be garanteed not to work on other systems. I wrote this as pure hack - I hard coded the PCI address memory space of my card installed in my system into the code...

If you have access to a VB compiler and follow the instructions included in the post with the code, you should be able to get it to work... assuming MSI did not add another layer on the PCI host interface. :)


T

Originally posted by gnuz187
Will this work with an MSI TV@nywhere Master? If so, can someone post up a link to the compiled binary? If not, is there anything in the VB code that can be changed to make it work? Thanks in advance!

gnuz187
12th August 2004, 22:39
@tedkunich

The MSI TV@nywhere Master uses the CX23883 and the MSI TV@nywhere (the previous version of the card) uses the CX23880/1. I'll see if I can find a VB compiler and attempt to make this work.

gnuz187
13th August 2004, 02:06
Well I got this to work with my MSI TV@nywhere Master. All I had to change was the BaseAddr to &HE7000000; everything else was the same according to RegSpy.

@tedkunich

Do you think you can add the ability to change the Hscale, Hactive and Hdelay registers to the code? I'd love to capture as close to full DVD resolution as possible.

-EDIT: Took it upon myself to add it to the program. I've already tested it and it works. I also cleaned up the GUI a bit. Sorry, I couldn't help it, I just like things super neat and super tidy. :D


VERSION 5.00
Begin VB.Form Form1
Caption = "PCI Sample"
ClientHeight = 6975
ClientLeft = 45
ClientTop = 330
ClientWidth = 6495
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6975
ScaleWidth = 6495
StartUpPosition = 3 'Windows Default
Begin VB.TextBox H_Scale_Odd
Height = 405
Left = 5040
TabIndex = 38
Text = "&H00000000"
Top = 3960
Width = 1215
End
Begin VB.TextBox H_Scale_Even
Height = 375
Left = 5040
TabIndex = 37
Text = "&H00000000"
Top = 3480
Width = 1215
End
Begin VB.TextBox H_Active_Odd
Height = 375
Left = 5040
TabIndex = 36
Text = "&H00000000"
Top = 3000
Width = 1215
End
Begin VB.TextBox H_Active_Even
Height = 375
Left = 5040
TabIndex = 35
Text = "&H00000000"
Top = 2520
Width = 1215
End
Begin VB.TextBox H_Delay_Odd
Height = 375
Left = 5040
TabIndex = 34
Text = "&H00000000"
Top = 2040
Width = 1215
End
Begin VB.TextBox H_Delay_Even
Height = 375
Left = 5040
TabIndex = 33
Text = "&H00000000"
Top = 1560
Width = 1215
End
Begin VB.TextBox Capture_Cont
Height = 372
Left = 1920
TabIndex = 25
Text = "&H00000000"
Top = 6360
Width = 1215
End
Begin VB.TextBox Color_Cont
Height = 372
Left = 1920
TabIndex = 23
Text = "&H00000000"
Top = 5880
Width = 1215
End
Begin VB.TextBox YC_Notch
Height = 372
Left = 1920
TabIndex = 21
Text = "&H00000000"
Top = 5400
Width = 1215
End
Begin VB.TextBox Comb_2H
Height = 372
Left = 1920
TabIndex = 14
Text = "&H00000000"
Top = 4920
Width = 1215
End
Begin VB.TextBox Hue
Height = 372
Left = 1920
TabIndex = 13
Text = "&H00000000"
Top = 4440
Width = 1215
End
Begin VB.TextBox Sat_UV
Height = 372
Left = 1920
TabIndex = 12
Text = "&H00000000"
Top = 3960
Width = 1215
End
Begin VB.TextBox Bright_Cont
Height = 372
Left = 1920
TabIndex = 11
Text = "&H00000000"
Top = 3480
Width = 1215
End
Begin VB.TextBox White_Crush
Height = 372
Left = 1920
TabIndex = 10
Text = "&H00000000"
Top = 3000
Width = 1215
End
Begin VB.TextBox H_Filter_Odd
Height = 372
Left = 1920
TabIndex = 9
Text = "&H00000000"
Top = 2520
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "Read Reg"
Height = 375
Left = 4320
TabIndex = 8
Top = 4920
Width = 1095
End
Begin VB.TextBox InputFormat
Height = 375
Left = 1920
TabIndex = 6
Text = "&H0000"
Top = 1560
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "Write Reg"
Height = 375
Left = 4320
TabIndex = 5
Top = 5880
Width = 1095
End
Begin VB.CommandButton btnClose
Caption = "Close"
Height = 495
Left = 4800
TabIndex = 4
Top = 840
Width = 1455
End
Begin VB.TextBox txtAddress
Height = 1095
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Top = 240
Width = 4335
End
Begin VB.TextBox H_Filter_Even
Height = 372
Left = 1920
TabIndex = 2
Text = "&H00000000"
Top = 2040
Width = 1215
End
Begin VB.CommandButton btnGet
Caption = "Get Base Addr"
Height = 495
Left = 4800
TabIndex = 0
Top = 240
Width = 1455
End
Begin VB.Label Label17
Caption = "H Scale Odd"
Height = 255
Left = 3360
TabIndex = 32
Top = 3960
Width = 1455
End
Begin VB.Label Label16
Caption = "H Scale Even"
Height = 255
Left = 3360
TabIndex = 31
Top = 3480
Width = 1455
End
Begin VB.Label Label15
Caption = "H Active Odd"
Height = 255
Left = 3360
TabIndex = 30
Top = 3000
Width = 1455
End
Begin VB.Label Label14
Caption = "H Active Even"
Height = 255
Left = 3360
TabIndex = 29
Top = 2520
Width = 1455
End
Begin VB.Label Label13
Caption = "H Delay Odd"
Height = 255
Left = 3360
TabIndex = 28
Top = 2040
Width = 1455
End
Begin VB.Label Label12
Caption = "H Delay Even"
Height = 255
Left = 3360
TabIndex = 27
Top = 1560
Width = 1455
End
Begin VB.Label Label11
Caption = "Capture Control"
Height = 375
Left = 240
TabIndex = 26
Top = 6360
Width = 1455
End
Begin VB.Label Label10
Caption = "Color Control"
Height = 375
Left = 240
TabIndex = 24
Top = 5880
Width = 1455
End
Begin VB.Label Label9
Caption = "Y/C Notch && pixel]"
Height = 375
Left = 240
TabIndex = 22
Top = 5400
Width = 1455
End
Begin VB.Label Label8
Caption = "2H Comb Format"
Height = 255
Left = 240
TabIndex = 20
Top = 4920
Width = 1455
End
Begin VB.Label Label7
Caption = "Hue"
Height = 255
Left = 240
TabIndex = 19
Top = 4440
Width = 1455
End
Begin VB.Label Label6
Caption = "UV Saturation"
Height = 255
Left = 240
TabIndex = 18
Top = 3960
Width = 1455
End
Begin VB.Label Label5
Caption = "Brightness/Contrast"
Height = 255
Left = 240
TabIndex = 17
Top = 3480
Width = 1455
End
Begin VB.Label Label4
Caption = "White Crush"
Height = 255
Left = 240
TabIndex = 16
Top = 3000
Width = 1455
End
Begin VB.Label Label3
Caption = "Horiz Filter Odd"
Height = 255
Left = 240
TabIndex = 15
Top = 2520
Width = 1455
End
Begin VB.Label Label1
Caption = "Horiz Filter Even"
Height = 255
Left = 240
TabIndex = 7
Top = 2040
Width = 1455
End
Begin VB.Label Label2
Caption = "Input Mode"
Height = 255
Left = 240
TabIndex = 1
Top = 1560
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Very ugly hack to Write CX2388x registers on Leadtek WinFast TV2000 Expert
'PCI address is hard coded in this example, may cause harm to your system.
'if you do not know what you are doing, don't play!!!!! You are warned!!!!

Option Explicit

Public index As Integer
Public BaseAddr As Long


Private Sub Form_Load()
index = 0

'this is the Base address of the the Leadtek Winfast card in MY PC!
'it is garanteed to be different than yours!
'use the Get BaseAddr function/button in the compiled app to determine
'the start of I/O memory on your card, then enter it here and then recompile.
'
'You will see something like:
' Address(0): &Hxxxxxxxx-&Hyyyyyyyy
' Memory I/O
'
'Set the BaseAddr below to whatever &Hxxxxxxxx above is.

BaseAddr = &HE7000000

End Sub





Private Sub btnClose_Click()
Unload Me
End Sub

Private Sub btnGet_Click()
Dim i As Integer
Dim sError As String

Dim baddrBuffer(5) As BADDR
Dim nResult As Long, nIndex As Long
Dim VendorID As Integer, DeviceID As Integer


sError = Space(255)

' Open the library
If maOpenLibrary() = False Then
maGetLastState sError
MsgBox "Error: " + sError, vbCritical
Exit Sub
End If

' Enumerate all devices
nIndex = 0
txtAddress = ""
Do

'these are the Vendor and Device ID's for the the Conexant CX2388x device
'confirm these values with RegSpy (part of the Dscaler package) and adjust as need

VendorID = &H14F1
DeviceID = &H8800


nResult = maGetDeviceBaseAddress(VendorID, _
DeviceID, nIndex, baddrBuffer(0))
Select Case nResult
Case 1
txtAddress = txtAddress + "VendorID: &H" + Hex(VendorID)
txtAddress = txtAddress + " DeviceID: &H" + Hex(DeviceID) + vbCrLf
For i = 0 To 5
If baddrBuffer(i).IOType <> 2 Then
txtAddress = txtAddress + Space(3) + "Address(" & i & "): &H" + Hex(baddrBuffer(i).BaseAddress) _
+ "-" + Hex(baddrBuffer(i).BaseAddress + baddrBuffer(i).Size - 1) + vbCrLf
txtAddress = txtAddress + Space(6) + IIf(baddrBuffer(i).IOType = 1, "Port I/O", "Memory I/O") + vbCrLf
End If
Next

txtAddress = txtAddress + vbCrLf

End Select
nIndex = nIndex + 1
Loop While nResult = 1

' Close the library
maCloseLibrary
End Sub


Private Sub Command1_Click()
Dim errMsg As String


' Open the library
If maOpenLibrary() = False Then
maGetLastState errMsg
MsgBox "Error: " + errMsg, vbCritical
Exit Sub
End If

InputFormat = "&H" + Hex(maPeekD(BaseAddr + &H310104))
H_Filter_Even = "&H" + Hex(maPeekD(BaseAddr + &H31015C))
H_Filter_Odd = "&H" + Hex(maPeekD(BaseAddr + &H310160))

H_Delay_Even = "&H" + Hex(maPeekD(BaseAddr + &H310124))
H_Delay_Odd = "&H" + Hex(maPeekD(BaseAddr + &H310128))
H_Active_Even = "&H" + Hex(maPeekD(BaseAddr + &H31013C))
H_Active_Odd = "&H" + Hex(maPeekD(BaseAddr + &H310140))
H_Scale_Even = "&H" + Hex(maPeekD(BaseAddr + &H31014C))
H_Scale_Odd = "&H" + Hex(maPeekD(BaseAddr + &H310150))

White_Crush = "&H" + Hex(maPeekD(BaseAddr + &H31011C))
Bright_Cont = "&H" + Hex(maPeekD(BaseAddr + &H310110))
Sat_UV = "&H" + Hex(maPeekD(BaseAddr + &H310114))
Hue = "&H" + Hex(maPeekD(BaseAddr + &H310118))
Comb_2H = "&H" + Hex(maPeekD(BaseAddr + &H310164))
YC_Notch = "&H" + Hex(maPeekD(BaseAddr + &H310120))
Color_Cont = "&H" + Hex(maPeekD(BaseAddr + &H310184))
Capture_Cont = "&H" + Hex(maPeekD(BaseAddr + &H310180))

maCloseLibrary


End Sub

Private Sub Command2_Click()
Dim done As Boolean
Dim errMsg As String


' Open the library
If maOpenLibrary() = False Then
maGetLastState errMsg
MsgBox "Error: " + errMsg, vbCritical
Exit Sub
End If


done = maPokeD(BaseAddr + &H310104, Val(InputFormat))
done = maPokeD(BaseAddr + &H31015C, Val(H_Filter_Even))
done = maPokeD(BaseAddr + &H310160, Val(H_Filter_Odd))

done = maPokeD(BaseAddr + &H310124, Val(H_Delay_Even))
done = maPokeD(BaseAddr + &H310128, Val(H_Delay_Odd))
done = maPokeD(BaseAddr + &H31013C, Val(H_Active_Even))
done = maPokeD(BaseAddr + &H310140, Val(H_Active_Odd))
done = maPokeD(BaseAddr + &H31014C, Val(H_Scale_Even))
done = maPokeD(BaseAddr + &H310150, Val(H_Scale_Odd))

done = maPokeD(BaseAddr + &H310110, Val(Bright_Cont))
done = maPokeD(BaseAddr + &H310114, Val(Sat_UV))
done = maPokeD(BaseAddr + &H310118, Val(Hue))
done = maPokeD(BaseAddr + &H310164, Val(Comb_2H))
done = maPokeD(BaseAddr + &H31011C, Val(White_Crush))
done = maPokeD(BaseAddr + &H310120, Val(YC_Notch))
done = maPokeD(BaseAddr + &H310184, Val(Color_Cont))
done = maPokeD(BaseAddr + &H310180, Val(Capture_Cont))

maCloseLibrary


End Sub