Log in

View Full Version : Capture Resolution - Are you sure?


Pages : 1 2 [3]

FredThompson
10th January 2004, 04:57
It appears to me that the 'perfect' capture frame size depends upon the resolution of your source, and the filter that is applied by your card/driver.
If you're using Brooktree, it captures at one resolution. Pull the full-sized raw capture and filter in a controllable method. NO run-time filter can compare to what you can do offline. A particular algorithm may not have a freesource equivalent in which case you can duplicate it. You'll have the same raw data set used by the Brooktree.

You're close but incorrect about the performance of a particular VCR. Tape is variable, as are the recording characteristics, even throughout the tape.

trevlac
10th January 2004, 06:37
Originally posted by FredThompson
NO run-time filter can compare to what you can do offline. A particular algorithm may not have a freesource equivalent in which case you can duplicate it.

But that's the rub. You may be able to, but I can't duplicate what those damn EEs at BT did. Their resize filter appears to do a better job with the resolution than off line filters. Hey, but what do I know? I'm just a newbie to DSP. Anyone for a 64 tap butterworth? :)


BTW: You can't get the 'full sized raw file' unless you can write a driver. :D

FredThompson
10th January 2004, 08:44
But that's the rub. You may be able to, but I can't duplicate what those damn EEs at BT did. Their resize filter appears to do a better job with the resolution than off line filters. Hey, but what do I know? I'm just a newbie to DSP. Anyone for a 64 tap butterworth? :)maybe, maybe not. Keep in mind, you're probably going to use some form of data compression which will throw away some chroma details, right?BTW: You can't get the 'full sized raw file' unless you can write a driver. :D [/B]Hav eyou contact I4004 as I suggested?

Wilbert
22nd January 2004, 22:20
About Nyquist, theory and practice, there is a thread in hydrogenaudio about it:

http://www.hydrogenaudio.org/index.php?showtopic=8177&st=0&

It's over my head, but maybe it contains something interesting for this thread :)

trevlac
23rd January 2004, 15:42
@Wilbert

Great find!

2dbDecided seems to really have it down. He describes exactly what Arachnotron shows in his test pic. If you sample near the Nyquist frequency you get what appears as amplitude modulation. Arachnotron posted a link that shows a picture of this. It also shows in his test resolution pic. I'm not sure why 6.75 does not show the problem. From what I understand, you have to actually be under 1/2 the sampling frequency. 6.74 is. 6.75 is not under 1/2 of 13.5. Fred did try to point this out I think. This is because samples at 0 and 0 could be 2 different waves.

Anyway, the filter used to do the DAC is important, as Arachnotron has pointed out. I'm hoping he figures out what are good ones and why, and then tells me. :)

I did want to point out this comment on audio vs video filters.

Though the best compromise is vastly different in image processing. Images look OK with the kind of aliasing that would sound terrible in audio. Conversely, audio sounds OK with the kind of ringing that would look awful in images!


This implies that aliasing is better in video, but ringing is not. Aliasing happens if you don't sample >2x your highest frequency. Ringing occurs at frequencies just under 1/2 sample frequency if any filter used has a sharp cutoff. So to use a sharp filter, sample higher and hope there are no frequencies near your filter cutoff, or use a gentel filter and damp the frequencies past your intended cutoff. Maybe you can also sample, gentel filter, decimate (resample). This might remove/dampen posible 'ringing' frequencies before you get to a smaller size.

In the end, it seems your frame size should be a bit higher than your highest frequency. This would allow the ADC to have a more gentel cutoff without ringing. How much higher? Surely not 2x. What is the highest frequency in your source?

Edit: I do believe more taps/coefficients means less ringing. And more processing time. As I said in another post, I think the BT uses 32x6=196 taps.

Wilbert
24th January 2004, 16:53
Another interesting point is that for the BT878, a 368 capture keeps quite a bit more resolution than a 720 capture and a last step resize. I'm waiting for Wilbert to tell me why.
Got some news. i4004 did some test for me with his bt8x8:

http://virtualdub.everwicked.com/index.php?act=ST&f=3&t=5525&st=15&#entry22839

capped at 368x576 enlarged to 768x576:

http://i4004.bizhosting.com/cgi-bin/i/bt-resizer_/368x576resizedto768x576[precisebicubic-vdub].jpg

capped at 768x576 resized to 352x576 (avs: pointresize) enlarged back to 768x576:

http://i4004.bizhosting.com/cgi-bin/i/bt-resizer_/768x576to352x576(avs-pointresize)to768x576(vdubprecbicubic).jpg

Difference is very clear, even with avs's pointresize :)

Other pics:
http://i4004.bizhosting.com/bt-resizer_/

Are you sure you did your tests correct (on page 3)? You didn't swap any pics or so?

trevlac
26th January 2004, 22:54
@Wilbert

Thanks. I will post on the Vdub forum when I get a chance. I guess I'll offer to re-do any tests, if anyone cares. :D

I'll like to try some pics with text.

vhelp
27th January 2004, 02:54
Trevlac and others..

I thought this page might serve some additional feed for digest and
whatnots. Mostly math stuff to use in your resarch and things.

** White Papers **
** Video Compression Math (http://www.drastictech.com/vidmath_wp.html)

-vhelp

Arachnotron
13th February 2004, 21:11
I'm dragging up this old thread, because I finally was able to determine what the analogue filter circuits on my Hauppauge BT878 and CX23881 based cards do.

I used a 1-11 MHz signal generator, fed a 1 V top-top sinus to the Y input, and measured both Vin and Vout using an oscilloscope.
db = 20*log(Vout/Vin)

As I suspected, they are indeed low-pass pre-filters. But for the CX23881, the cut-off is a lot lower than I expected.

http://www.arachnotron.nl/temp/WinTV_662_input_filter.jpg

This filter has the 3 db point at about 9 MHz. I am not absolutely sure about this, since the input voltage also dropped with frequency (?). I suspect the input impedance of the card was to low for the signal generator to handle, but I'll have to test further.

http://www.arachnotron.nl/temp/WinTV_747_input_filter.jpg

This is a classic 6.75 MHz cut-off low pass filter. The input voltage is also reduced by half, I suspect to bring it better within the range of the ACG of the CX23881.

This also explains why some cards seem to get cleaner caps then others; the signal may already be low-pass filtered by components added by the manufacturer before it reaches the capture chip itself.

trevlac
19th February 2004, 23:21
I wanted to let you know I found your pics to be great. This shows one must really compare cards not chips. In addition, drivers also make a difference, not to mention cables, signal, ect...

Unfortunately, know your source/equipment and know it well....

Arachnotron
23rd February 2004, 00:51
Unfortunately, know your source/equipment and know it well....

Amen to that! :)

Just found out in off-forum discussions with i4004 that the reason the BT878 seems to look sharper then some SAA7134 cards is that some BT drivers enable a sharpening filter. So Phillips does not blurr the cap more than a BT878 does as some people have claimed in the past. The Philips just stays closer to the source. With a sharpening filter the outcome is identical (according to Ivo)

Now if only manufacturers could be bothered to document their products....

[Edit] Ivo did not agree with my quote. see this (http://virtualdub.everwicked.com/index.php?act=ST&f=6&t=5896&st=60&#entry24277) thread on everwicked for the gory details.....

trevlac
23rd February 2004, 15:10
Originally posted by Arachnotron
Just found out in off-forum discussions with i4004 that the reason the BT878 seems to look sharper then some SAA7134 cards is that some BT drivers enable a sharpening filter. So Phillips does not blurr the cap more than a BT878 does as some people have claimed in the past. The Philips just stays closer to the source. With a sharpening filter the outcome is identical (according to Ivo)

Now if only manufacturers could be bothered to document their products....

The default for the BTwincap is to NOT use the sharpening filter.

The following is something I posted at VCDhelp when this came up a little while ago. This is in regard to the BTwincap driver... :D

.....................................


Well, the sharpness is 'implemented' in the chip. It effects a horizontal filter that is turned on. ... basically, if you pick 'auto' the text below explains. If you pick something else, a specific filter option is set.

"BT Spec Page #116, HFILT"
These bits control the configuration of the optional 6-tap Horizontal
Low-Pass Filter. The auto-format mode determines the appropriate
low-pass filter based on the horizontal scaling ratio selected. The
LDEC bit in the CONTROL register must be programmed to 0 to
use these filters.
00(1) = Auto Format. If auto format is selected when horizontally
scaling between full resolution and half resolution, no filtering
is selected. When scaling between one-half and
one-quarter resolution, the CIF filter is used. When scaling
between one-quarter and one-eighth resolution, the
QCIF filter is used, and at less than one-eight resolution,
the ICON filter is used.
If the PEAK bit is set to logical 1, the HFILT bits determine which
peaking filter is selected.
01 = Max full resolution peaking
10 = Min Cif resolution peaking
11 = Max Cif resolution peaking
00 = Min full resolution peaking


"BTwincap src, scaler.cpp"

// Adjust filters!
if (m_sharpauto) {
if ( m_ptrVideoIn->AutoHFilter )
fieldHFILT = HFilter_AutoFormat;
else // SECAM
if ( hActive < DWORD(m_ptrVideoIn->Clkx1_HACTIVE) / 7 )
fieldHFILT = HFilter_ICON;
else
fieldHFILT = HFilter_QCIF;
fieldPEAK = 0; // Peaking (1 = On)
fieldLNOTCH = 0; // This can be disabled to get full Black/White bandwidth (0 = On)
fieldLDEC = 1; // Reduces bandwidth of luma. (0 = On)
fieldCOMB = 1; // Averages color to reduce artifacts (1 = On)

} else {

/* LNOTCH -> Color subcarrier elimination
LDEC -> use or not filter LP or PEAK
PEAK -> Select between peak and filtering
COMB = CromaComb: Use this to average chroma components of next lines

PEAK/HFILT LDEC PEAK COMB
ICON 11 ON(0) OFF(0) ON(1)
QCIF 10 ON OFF ON
CIF 01 ON OFF ON
- OFF(1) OFF ON
11 ON ON(1) ON
10 ON ON ON
01 ON ON ON
00 ON ON ON
ICON 11 ON0 OFF0 OFF
QCIF 10 ON OFF OFF
CIF 01 ON OFF OFF
- OFF OFF OFF
11 ON ON OFF
10 ON ON OFF
01 ON ON OFF
00 ON ON OFF */

ULONG val = m_sharpness - 18; // Get value of horizontal sharpness
BYTE PeakHFilt = BYTE((~(val >> 4)) & 3); // Bits 54
BYTE Peak = 0; // Peak = Off
// Allow PEAKing only in Full Size in Bt848A or better.
if (hActive > DWORD(m_ptrVideoIn->Max_Pixels) / 2 && pisces->HasPEAK() ) {
Peak = BYTE((val >> 3) & 1); // Bit 3
}
BYTE LDec = (PeakHFilt || Peak) ? 0 : 1; //
BYTE Comb = BYTE((~(val >> 2)) & 1); // Bit 2

fieldHFILT = PeakHFilt;
fieldPEAK = Peak;
fieldLDEC = LDec;
fieldCOMB = Comb;
fieldLNOTCH = 0; // This is a MUST to avoid color interference!
}



For non-programmers, (like ivo and me), it is easier to read the chip register values as you set various options in your app, then translate them to english (croatian) using the spec.

Arachnotron
23rd February 2004, 15:27
Quickly reading these quotes, I get the impression this is about low pass cut-off points.
Which part is about increasing sharpness (I mean something warpsharp like, which is not the same as decreasing the amount of detail filtered out, which again is what changing the low-pass filter cut off does ).

Could you perhaps point me to the place in the specsheets? (not doubting you, just interested where to find this) :)

In general, I just ment my remark as an illustration that "it looks sharper" does not neccecarily mean a card actually is capping more detail.

trevlac
23rd February 2004, 16:00
Originally posted by Arachnotron
In general, I just ment my remark as an illustration that "it looks sharper" does not neccecarily mean a card actually is capping more detail.

Look for PEAK or Peaking page 23 starts the info. Page 116 is how the registers are set. The BTwincap has a sharpness setting that translates to values 0 to 3.

http://www.conexant.com/servlets/DownloadServlet/100119a.pdf?FileId=542


And I am 100% behind you on the "it looks sharper" thing. Actually, at some point, it is really a preference thing. I prefer zero sharpening. As you know, I am now focusing on brightness/contrast/color. Contrast, for example makes a huge difference in the detail of the picture. Basically, if there is a lot of detail that is almost the same color, you are not going to see it. :)


I did some compares on sharpness for ivo (bt vs cx). I'm not sure he ever looked at them. Just concluded he liked the cx better. At some point, the 'better' tool depends on the job and how you use it.

Arachnotron
23rd February 2004, 16:52
Thanks!

If I understand this correctly, the peak filter amplifies higher luma frequencies relative to the lower frequencies. Judging from the curves, this would also result in an overall brighter picture. Yuk!! :)

I did some compares on sharpness for ivo (bt vs cx). I'm not sure he ever looked at them. Just concluded he liked the cx better. At some point, the 'better' tool depends on the job and how you use it.

I think he did, he did mention them in off-forum mails to me. He told me he pulled a SAA7134 cap through a sharpening filter, after which it looked identical to a BT cap.

For me the choice is SAA7134/Terratec, simply because the Hauppauge BT and CX cards don't have a decent PAL60 mode. (PAL60 mode in BTWincap is broken) As you said, it depends on the job you need it for. :)

trevlac
23rd February 2004, 17:37
Originally posted by Arachnotron

If I understand this correctly, the peak filter amplifies higher luma frequencies relative to the lower frequencies. Judging from the curves, this would also result in an overall brighter picture.

Only the fine detail would be brighter. Edge sharpen kind of thing I'd guess. The Avisynth gurus could tell us....

Arachnotron
23rd February 2004, 17:56
Only the fine detail would be brighter.

Yes, but since the whole filter curve with peaking is higher than with peaking = 0, average brightness is up compared to an unfiltered pic.

fberreth
12th November 2004, 20:47
This was a long thread and somehow I have the feeling there was no real conclusion for dummies like me.

I just wanted to mention that I think i4004 had the picture blurred at 368x capture because he captured PAL and bt8x8 kicks in the additional filter on PAL earlier than on NTSC (PAL you need to be >= 400x). Yes? So I think trevlac's theory/pictures I think are 'real' for NTSC capture.

So the horizontal resize in the chip is superior because it takes samples into account that SW doesn't see. Problem is just that the resolution you have to capture is non-standard and you have to resize in SW or crop again. What is then better? To capture full (say 712x) and resize to say CVD or capture 368x for NTSC and resize to CVD (or crop)?

Hope I made myself clear - I'm still trying to digest all the information :)

trevlac
15th November 2004, 23:17
Originally posted by fberreth

So the horizontal resize in the chip is superior because it takes samples into account that SW doesn't see. Problem is just that the resolution you have to capture is non-standard and you have to resize in SW or crop again. What is then better? To capture full (say 712x) and resize to say CVD or capture 368x for NTSC and resize to CVD (or crop)?



That is what I would say. And 712x vs 368x only matters if you want to save space on a disc. If not, 712 is better because the AR is better. Also, 368 is better assuming that 368 can be compressed better than 712 (which btw, I'm not sure is as self evident as it seems ... because a DTC transform changes pixels into frequency numbers and the 368 should have more detailed but fewer blocks ... I'd guess 368 compresses better but i'm not sure this is true).

-----------
In the end, I was beaten down by these other folks into so many if's and and buts that I now like to be vague and say "test with your source/process/hardware and see which picture and process you like the best".

For example, a comment on Nyquist .... Nyquist (and Shannon) gave a minimum mathimatical sample rate. In practical terms, a digital representation of an analog image can never be recreated back to the original analog. This is not only due to sample rate, but also due to sample precision (bit depth), the algorithums used to muck with the color representations, what the hardware can physically do to recreate the analog from the digital ... yada yada ...

So at some point ... you just have to compare pictures on your destination display.

Arachnotron
16th November 2004, 17:47
Some cards have vertical resizers that kick in at lower resolutions that can do horrible things to your captures. For devices like that, capping high even when the final format is low res remains the best.

But with vcd slowly dying out as a final format, what cards do at lower resolutions is becoming a moot point. Nowadays, if you really need low resolution, your priority is not quality anyway.

So the only consideration left is to avoid any unneccesary resizing steps. Since no matter what you do your capture device will resize anyway you might just as well let it resize to a final resolution that has the correct PAR and pad/crop to the final resolution of your target format and avoid any further resizing.

What this capture resolution is depends on the device/drivers in question, so there is no one-size fits all answer for that, but the capture guide has a few chapters on this.

For my SAA7134 card, I cap at 704x576 since that gives me DVD sized samples. For my Hauppauge CX23881, I cap at 696x576 and pad later for the same reason.

zilog jones
22nd November 2004, 16:21
So, is 696x576 the optimal resolution for the CX23881 in PAL then? Does going higher just make it worse? I've just got one recently, and so far I've just been messing around with it and trying to get my PC to work right when recording higher resolutions (see my recent thread). I have noticed that there seems to be more noticebale ghosting if I go up to 768x576 from 720 or 704, but maybe that's just DScaler?

Could someone give links to some of these test cards again (preferably a PAL one)? The links from earlier in this thread all seem to be dead.

Arachnotron
22nd November 2004, 16:39
Could someone give links to some of these test cards again (preferably a PAL one)? The links from earlier in this thread all seem to be dead.
See chapter 10 of the analog capture guide. The links in there are ok. This chapter also explains the why of all this.

Dscaler is a separate issue, since Dscaler approaches the hardware directly instead of going through the drivers.

zilog jones
24th November 2004, 13:18
So is 696x576 optimal for the CX23881? And by padding, do you mean resizing or just adding borders to make it 720? Wouldn't that make the aspect ratio a bit wrong?

Arachnotron
24th November 2004, 13:58
So is 696x576 optimal for the CX23881? And by padding, do you mean resizing or just adding borders to make it 720? Wouldn't that make the aspect ratio a bit wrong?
If your target is DVD, adding borders to 720 (or 704 depending on your encoder) would result in a DVD with correct aspect ratio.

[edit]
And it is not so much correct for the CX23881 as correct for the drivers/cx23881 combo I tested this with. It might be that your drivers use another active window (though so far most seem to use 696). That is where the test DVD comes in.

acrespo
3rd December 2004, 18:22
I am very confusing about the resolutions.
I have a Compro Videomate Gold+ (SAA7134) TV Card.
My source is PAL-M (combination of NTSC and PAL, because fps and resolution the same of NTSC but colour of PAL).
I am assuming that NTSC is valid to me, then I am capturing at 640x480, because my needs is Xvid AVI to watch in computer.
My feelings are right?
Can I capture with a low resolution (example 320x480) and up to 640x480 with avisynth (lanczos4) and don't lose details or doing noise problems?

Arachnotron
3rd December 2004, 19:28
Assuming your source is tape, I would suggest capping at 480x480 to get the last bit of detail out of it. Most of this stuff is in the capture guide. Any other source, cap directly at the final resolution.

Read chapter 16 of the guide. Follow the examples for the Terratec Cynergy, since that is a SAA7134 card too. Assuming you have the same capture window , you have a capture window width of 52.168 µs or 704 DVD pixels.

First, determine the IAR of your card (chapter 16.3). This value is fixed for your card/driver and does not change unless something is changed in the driver. Luckily, example 2 applies to your card too.

Example 2: Terratec Cinergy 400:
When capping a NTSC signal, this card has a capture window width of exactly 52.148 µs. This makes the Image Aspect Ratio of this device:

IAR = (4 / 3) * (52.148 µs / 52.6555 µs) / (480/486) = 1.3370

This is slightly wider than the standard NTSC active window.

Next, calculate how to resize. Since you cap 480 lines, you only need to resize horizontally. That is in chapter 16.4.1. Assuming you capture at 480x480:

Source: 480x480, PAR = IAR * [vert]/[hor] = 1.3370 x 480 / 480 = 1.3370
Target: 640x480, PAR = 1 (= square pixel for on-screen divX)

1. calculate target [ver]/ source [ver] = 480 / 480 = 1
2. calculate source [hor] * (source PAR)/ (target PAR) = 480 x (1.3370/ 1) = 641.76
3. multiply with multiply number from 2 with number from 1 = 1 * 641.76 = 641.76 = 642 pixels (round to nearest multiple of 2)
4 crop or pad to target: crop of 2 pixels at the left or the right.

So, if you want to have it exactly right, cap at 480x480, resize to 642x480 and crop back to 640x480

Personally, I would not bother with the cropping and resize to 640x480 directly since the error is minute. (you captured about 0.3 % too much). You won't notice the difference anyway.

And to keep it really simple, why not cap directly at 640x480 and don't do any resizing or cropping at all. :)