You are on page 1of 4

CYPRESS SEMICONDUCTOR CORPORATION

This report documents our findings regarding the video corruption on Mac issue
reported by Minrray.
Problem
When CPU is loaded, the video stream is corrupted (i.e lines are seen) in a Mac
Observations
These are the basic observations we made which were also reported by the
customer:
1. The amount of corruption seen is proportional to CPU load
2. Higher resolutions show more corruption easily than lower resolution ones
3. Older Mac hardware show this easily
4. The problem is shown only in Mac OS X and not in other OSes run in a
similar hardware setup
Although observations #1 and #2 point to Mac OS X as the possible cause of the
issue, we wanted to confirm if this is indeed the case.
So, we performed a simple experiment.
1. We used a simple image sensor and the FX3 DVK and sent out a fixed
image from the sensor to the Mac.
2. Then, load the Mac and make sure that we see the video corruption.
3. Take a USB bus trace with a hardware analyzer like LeCroy Voyager and extract
the video data from the trace
4. Analyse the trace and get back the video frame sent by FX3
5. Check if the frame is corrupted or not
If the resulting frame is corrupted, then the FX3 firmware has a bug. But if it shows a
proper frame, then the Mac OS has a problem displaying the video.
NOTE: The firmware we used is extremely similar to Minrrays firmware

Page 1 of 4

The image we sent was this:

Then, we used QuickTime Player on the Mac to view the video. One frame from
this video is as shown you can easily notice the corruption:

Page 2 of 4

Simultaneously, we took a USB Bus Trace using LeCroy Voyager, extracted all
the data packets from the trace and ran a Python script to get back the video
frame with YUV2 data.
And when one YUV2 frame is viewed using a player (YUV Player Deluxe), we
get this:

This shows that the FX3 is sending out data properly and in the correct order. So,
the only conclusion is that Mac OS X is unable to display video data properly
under high load.

Page 3 of 4

Experiment Data and Source Code for the script


Source code for the Python script, the USB Bus trace and the YUV2 images are
available at
https://www.dropbox.com/sh/x2kkdoyo3uv0pi5/AABc0QdjTXhkm1voKAEpyoOxa.
To run the script, first export the USB Trace in LeCroy USB Protocol Suite
(File > Export > Data), rename the file as trace_details_corrupt_data.txt and
then run python parser.py in a command line prompt. And note that this script
only works with Python 2.
Additional Experimentation
In the process of debugging this, we also tested a few other configurations to see
which of them works on a Mac.
Through trial-and-error, we found that using Isochronous endpoints for video
data will fix the problem.
However, Isochronous endpoints will work only on a Mac (or a PC with USB
2.0 only) as the UVC driver in Windows XP/Vista/7 has not been updated to
work in USB 3.0. See this page
(http://www.cypress.com/?app=forum&id=167&rID=69881) for details.
One workaround for this could be to use Bulk endpoints for Windows and
Isochronous endpoints for Mac OS X. However, there is no way to know if FX3 is
connected to a Mac or not before enumeration and so we cannot dynamically
switch the endpoints type.
But if you (Minrray) have any host application that runs on the Mac or Windows,
you can use it to tell FX3 to switch the type of the endpoint before streaming data.

Page 4 of 4