Wednesday, November 19, 2014

Earth Leakage - in water!

I recently bought an Agilent U1191A clamp-meter. This is a piece of test equipment that can measure current flowing in a conductor without having to break the circuit (how you would if all you had was a digital multimeter). The jaws physically couple around the conductor in question and by induction you can measure the electrical current flowing in the conductor. 

Clamp meters have moved on somewhat since I last had to buy one (a Fluke; sometime in the late nineties). This one is a pretty competent DVM as well as being able to sample and hold min, max and average values across all setting. For most days it could definitely do double duty against my Amprobe 37XR multimeter - EXCEPT the Agilent doesn't have non-contact voltage detection (the Amprobe does!). Anyhow - how do you get four and a half digits of resolution across multiple ranges on a brand-name test set for less than a hundred quid? Engineers today, don't know they're born...!

Today I was called to a customer's site where they have three canal-barges, each with two or three edit rooms on board. In the bilges of each boat there is room for little half-height equipment cabinet where they have the shared-storage chassis, network switches etc. They've been suffering an unusual number of equipment failures (motherboards dieing etc) and since they also seem to have RCDs tripping out as a regular feature my first thought was earth leakage.
Here is a picture of the electrical termination point for each boat - two 32A feeders go into the hull, one for the pumps and one for the mains distribution board. The cables are permanently suspended in the water (and have been for many years!) and the ones I inspected had clearly been submerged for so long there has been lots of water ingress into the rubber jacket of the cables. One felt almost ready to crumble in my hands.

Insulation has both electrical resistance and capacitance – and it conducts current through both paths. Given the high resistance of insulation, very little current should actually leak. But -- if the insulation is old or damaged, the resistance is lower and substantial current may flow. Additionally, longer conductors have a higher capacitance, causing more leakage current. Attaching the clamp meter to the incoming earth bond (pre-the consumer unit) measured a massive 100mA of leakage current. This not only risks the equipment being fed off this supply - there is an imbalance between the live and neutral cores and Class-1 equipment is often upset by this, and power supplies can pass this residual current to the earth-plane on PCBs.

More worryingly you've also compromised the safety action of any RCD (Residual Current Devices) in the feed. 

So - my advice was; replace those 32A feeders with marine-grade power cable as soon as possible.

Friday, November 14, 2014

Perceptual video quality & compression - PSNR measurements

Compression is a fact of life, there have only been two production VTRs that stored uncompressed video - D1 and D5; they are no longer used because they were both SD (and D1 was only eight-bit video). So, the vast majority of the material we handle is compressed and so there should be a way of quantitatively judging it. There three methods of numerically analysing how good pictures are, but for the most part and engineer or editor proclaiming "...those pictures look a bit soft" is what still passes for picture quality analysis! 

Don't regard this blog-post as definitive (which of my rambling are?!), but this comes from a discussion with a couple of industry colleagues earlier in the week about the quality of satellite contribution circuits. They'd got into a bit of a to-and-fro with the carrier over bit-rates and chroma-sampling structures ("but 4:1:1 isn't as good as 4:2:0 for the same data rate" etc.) which for my money entirely misses the point. You have to assess the picture quality of a compressed link (satellite, IP, etc.) not on encoder settings but on perceived picture quality. A few thoughts;
  1. Modern codecs perform better than older codecs when considering data rate vs quality
  2. Progressive pictures compress nicer than interlaced pictures
  3. Statistical multiplexing always produces better results over multiplexed connections
  4. Long GOP codecs outperform iFrame codecs by a factor of 5:1 typically.
The three methods used for determining video quality are;
  • Peak signal-to-noise ratio - PSNR
  • The "Just Noticeable Difference" or JND; a very BBC-type measurement and commonly derived by asking a crowd of observers to assess picture quality.  I like the idea of this and when I was at the BBC you'd often hear people specifying "...half a JND" as being a required spec; that was also know as a "gnats" as in "gnat's whisker"! It's problematic because it describes perception rather than the effect of exposure - an editor friend told me that he preferred to work on DigiBeta pictures over DVCam footage not because he could spot the difference between shots from the more expensive format over the cheaper format (all other things - camera, lens, lighting etc being equal), but the more compressed pictures just made him feel more tired by the end of the day. The JND takes no account of the cumulative effect of looking at compressed footage that may at that moment look just as good but more subtly takes it toll on the viewer.
  • Mean Opinion Score - MOS; very similar to the JND but with a numeric score. I won't talk about this.
So, PSNR - to steal from Wikipedia;
...the ratio between the maximum possible power of a signal and the power of corrupting noise that affects the fidelity of its representation. Because many signals have a very wide dynamic range, PSNR is usually expressed in terms of the logarithmic decibel scale.
PSNR is calculated as a rolling set of differences between source material and the compressed version and is most easily defined via the mean squared error (MSE). Given a noise-free m×n monochrome image I and its noisy approximation K, MSE is defined as:

The point is that it can be calculated from the pixels. No observer bias is involved.
Engineers love quick rules of thumb, and PSNR for video images are no different;
  • For idential images the MSE is zero and hence the PSNR is infinite (more dBs = better pictures!)
  • 40dBs is considered to be indistinguishable from uncompressed production quality (that's where the BBC JND lives!)
  • 32dBs is considered desirable for quality broadcast link circuits
  • High twenties is what you can expect for over-the-air transmission - the 10Mbit DVB-T2 pictures you watch on Freeview or Sky.
So, to return to my point 1 (above) - here is a graph showing data rates against codec types for the same SD pictures. Venerable old MPEG2 (from the mid-90s!) up against vanilla MPEG4 (late nineties) and AVC (AKA H.264 / MPEG4.pt10 - early noughties). A full 6dBs of quality (twice as good in layman's terms?) lie between those two codecs at 2.2Mbit/sec (all other things being equal - use of a Stat Mux etc). You could even dive in further to MPEG2 and see the difference between the implementations from twenty years ago and what folks like Main Concepts are doing in 2014). The decoders particularly are now much better at hiding macro-block edges and recovering from corrupt frames.

Point 2 (above) seems obvious, but only when comparing 1080i with 1080p pictures AT THE SAME FRAMERATE; so perhaps best to say 1080i vs 1080PsF; Interlaced pictures will always be a challenge as pixels (and hence macro-blocks) move within a frame, unlike progressive pictures. BUT, you still get better motion rendition withing interlaced frames for the same framerate. Eventually we'll have moved to 1080 50/60P and so it'll be a moot point.
This graph shows data rate for HD pictures, we expect over-the-air HD to be at ten megabits in the UK.

So, how to make these assessments if you're worried about a contribution circuit or transmission path that you're responsible for? If you work in coding and mux then you probably already have tools to assess. PSNR is such an important part of delivery specs/SLAs in broadcast (you need to keep the accountants at bay after all!) that you'll have a Tektronix PQA600 or a Rohde & Schwarz DVMS-series test set. 
However, "traditional" video quality measurement needs access to the compressed signal and the original which may not be possible; particularly in the case of my pals who are at loggerheads with their satellite provider. What you need is a test signal that you can feed over the connection and then make an assessment from the picture content as to how badly the pictures are being degraded. I've banged on about the SRI Visualiser before but it has a compression multiburst that shows you lines-of-TV-resolution against perceived bit-depth. You can then relate the two worst-case lines/bit-depth figures to the table of PSNR values.

Forgive the voice-over!

Monday, November 10, 2014

The death of videotape; long time coming.

Say it ain't so! I read the news today, oh boy.....
Sony is to stop selling its range of ½-inch tape machines and camcorders in just over a year’s time. The manufacturer has targeted March 2016 as the date by which it will cease sales and distribution of its professional VTRs and camcorders, owing to what it described as “the global trend of migration towards file-based operation”.

VTs have been a constant feature of my 26 years in broadcast engineering - I spent three years in VT maintenance when I was in BBC TV News and all through my time in facilities in the nineties/early noughties and my last dozen years working for a reseller the most dense way of storing data (which is what video has been for twenty years) is on magnetic tape using a rotating head-drum. 

VTRs are mechanical and hence unreliable; you can't pull rust-on-sellotape (a crude description of videotape) over a rotating metal drum without things wearing out and when I started I estimate that at least a half of all broadcast engineering hours were spent fixing decks. I certainly enjoyed that mix of electronics and mechanics and when I left BBC TV news my supervisor in VT maintenance had this made for me - at the time he reckoned I had done more than a hundred head-drums.

So, here are a few memories about VT formats I have had to deal with. It was all analogue when I started with the D1 format just starting to make inroads. By the mid-90s DigitalBetacam had become the predominant format for most production and post-production and Sony continued their domination of tape formats with HDCam and HDCamSR in the late nineties/early noughties. Since then it's been disk-based (XDCam) and flash-based (SxS, P2 etc etc.) - I haven't done anything more than cleaning a tape path or head-drum in the last decade but I used to be a pretty good VT-fixer!

  • 2" Quad; The original broadcast tape format which was on the wein when I joined the Beeb. At Lime Grove studios we did have a couple of Ampex VR 2000 machines. These beasts needed a compressed air feed to hold the tape on the transversely rotating drum. They weren't used for editing, just for archiving P as B recordings. I remember watching an episode of "Star Trek" (original!) being transmitted and marveling at home good composite pictures could look.
  • 1" C-format; specifically the Ampex VPR-2B (which was the BBC's 1" of choice) was a bit more of a workhorse machine. Again, BetaSP and Umatic HiBand where more prevalent at BBC News when I was there but when I went out into the independent industry in 1993 1" was a lot more widely used, particularly the Sony BVH-series machines (the choice when I was at CTV in St John's Wood) and then the Ampex VPR3 when I got to Soho in 1994 mastering to an analogue format was already diminishing.
  • BetacamSP; The BVW75P was the first piece of broadcast equipment I got to know to the component level. The summer after I joined the BBC they bought three hundred of them and I jumped on the overtime to do acceptance testing. Consequently I got to know the signal path and then in 1990 I got transferred to VTR maintenance and pretty much serviced the same machines I'd been taking delivery of two years before. They were the broadcast workhorse until the late nineties and I still see them. When I went to Nigeria the whole place was still running on them. Here are some photos of the insides.
  • D1; I didn't get into Soho until the second generation of D1s had arrived - the DVR2000 series (the 1000 series had half a rack of processing for trick-speed playback). D1 was the first 8-bit uncompressed SD VTR format. All the high-end facilities in Soho made good money out of them - when you could hire a 3 machine D1 room for £650 an hour! Many a time I heard engineers dismiss DigiBeta for it being compressed but I've NEVER seen Digi compression artifacts but I have seen shallow ramp banding on D1 (8-bit vs 10-bit). D1 decks were very expensive (£100k) and cost an arm and a leg to maintain. However - being able to do more than half a dozen generations on and off tape gave rise to all those effects heavy pop videos in the early nineties.
  • D2; Sony quickly realized that they'd need a composite digital machine for run of the mill TV production work (i.e. people who needed a drop-in replacement for 1") and so they bought the format off Ampex in some complex licensing deal that allowed Ampex to sell badged BVW75s. Ampex's VPR300 was a terrible machine; we had them at Oasis TV and you could often not get recordings made in the morning to playback on the same machine in the afternoon. After that the Sony DVR28 was an eye-opener. It could stripe tapes at high speed as well!
  • D3; Like D2 a digital composite machine but like D5 a 1/2" tape path which meant a practical all-in-one camcorder was possible. The BBC embraced the AJD350 the year I left and according to a pal at Panasonic of the first 98 machines they never got more than sixty working simultaneously. They format got really good after v.2 software when stability, RF performance etc improved. The operational side of the machine was entirely unlike Sony with a very complicated screen surrounded by buttons. Panasonic had to replace heads - almost no usable serviceable parts inside...!
  • D5; Channel Four were the only UK broadcaster to commit to D5 which was Panasonic's answer to D1 (but, a 1/2" format with 10-bit video, uncompressed - eventually there was an HD variant as well). You could tell the machine ran so close to the edge in terms of heat performance. We had two of them at Oasis and every morning I would pull out the long boards (below the tape transport) and re-seat all the chips - a day's worth of heat made all the socketed devices rise up. The machine shared mechanics with the AJD-350 D3 machine and with an option decoder board would replay D3 tapes. The tape-stock was the same in both cases and when I was at CTV we would send "D5" masters to Channel Four which were really D3 recordings with a D5 card in the tape sleeve! They never spotted it and it saved us hiring D5 machines (we owned D3). The rumor at the time was that C4 had been given the initial set of machines free to establish the format which was (even then) viewed as entirely unsuitable for a broadcaster. I never id much maintenance on them save cleaning etc. You had to send them back to Panasonic for heads etc.
  • DigiBeta; Whereas the first gen digital VTs (uncompressed, either 230mBits/sec for D1 & D5, 155mBits/sec for D2 & D3) required manual tracking for record like 1" the DVW-series 1/2" Digi had a pilot tracking tone system that allowed the machine to track itself for record. It could even do an insert edit if the control track was damaged by driving the phase of the scanner-lock based on the difference in signal strength between the pilot tones and the head and tail of each video track. Consequently I rarely saw machines that made incompatible recordings (that was a constant feature of all the earlier digital VTR formats).  The DVW was also the first machine to feature a Viterbi decoder in the bitstream path off tape and so you tended to get a green channel light (no error correction or concealment) until 1800hours of tape wear and then over a couple of days it would go to orange (error correction) to red channel condition (error concealment). Compared to all those earlier formats (I used to clean the heads on D1 & D2s every day of use!) they had a very low TCO.
  • BetacamSX;
  • DVCPro / DVCam / miniDV;
  • IMX;
  • HDCam;
  • HDCamSR;
  • Umatic;
  • VHS;