cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

New Contributor II

Hello,

I'm using an 8bit grayscale scale sensor connected to an FPGA that adds 8bit of U/V values set to 0x80 (no color).

The 16bit from the FPGA is connected to the FX3.

My firmware is based on the AN75779 example and everything works well (with my C# application or VLC player) except for one thing.

The problem is: Every software I found converts the YUV to RGB with a conversion formula like this:

  Y -= 16;
  U
-= 128;
  V
-= 128;
  R
= 1.164 *+ 1.596 * V;
  G
= 1.164 * Y - 0.392 * U - 0.813 * V;
  B
= 1.164 * Y + 2.017 * U;

Because my image is grayscale, U and V are zero so I get Y multiplied be 1.164.

This cases values larger then 255 (?!?!?!) and when I look at the image histogram I see values of 7, 14, 21, 28, .... are at zero in the pixel count. (6 * 1.164 = 6.984 and 7 * 1.164 = 8.148).

I want my camera to be a standard UVC camera.

How can I solve it at the firmware level?

Ofer.

0 Likes
Reply
1 Solution
New Contributor II

I was able to solve it by changing to RGB888. I changed the descriptors and the GPIF.

View solution in original post

0 Likes
Reply
21 Replies
Moderator
Moderator

Hi Ofer,

Since grayscale to RGB conversion requires us to make R, G and B to be same as grayscale value, can you send Y value from the FPGA as ((acual_Y_from_sensor/1.164)+16) while maintaining U and V same as 0x80?

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

Hi Hemanth,

The problem will be the same but with different values (Y values can only be integers).

Can I change the GUID or some other parameter in the descriptor that will tell the application to use Y values as is?

Thank you,

Ofer.

0 Likes
Reply
Moderator
Moderator

Hi Ofer,

I think if the application makes conversion to grayscale(instead of rgb) from yuv2, then it takes y values as grayscale value and ignores U and V. Is this an option?

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

Hi Hemanth,

The problem is I can't control the application side (like VLC for example).

I can't be the only one facing this problem.

Is there no change I can make in the descriptors that can change it?

Thanks,

Ofer.

0 Likes
Reply
Moderator
Moderator

Hi Ofer,

Please check if the conversion formula on the UVC host app changes according to GUID reported by the video device and if there is any suitable UVC driver-supported GUID that can be used such that Y values are taken as is.

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

Hi Hemanth,

I can't find a GUID that does that.

Any suggestions?

Thanks,
Ofer.

0 Likes
Reply
Moderator
Moderator

Hi Ofer,

Can you please try with e-cam view player. I think you should be able to display monochrome image with the yuy2 data sent from the device. So, does monochrome display work for you?

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

Hi Hemanth,

I can't capture images with the e-cam view player.

0 Likes
Reply
Moderator
Moderator

1. In VLC player, try below:

Go to Tools -> Preferences -> Video

Uncheck 'Use hardware YUV -> RGB conversions'

Save

2. Try with MPCHC player.

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

I was able to solve it by changing to RGB888. I changed the descriptors and the GPIF.

View solution in original post

0 Likes
Reply
Moderator
Moderator

Hi Ofer,

Good to know that you solved the issue.

Can you please let me know if you are representing 8-bit monochrome data as RGB888? Or you are padding rest two bytes of RGB888 pixel data with something (as it was done with yuv case - adding 0x80 to U and V)

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

Hi Hemanth,

I duplicate the monochrome value 3 times for the RGB.

When I changed the descriptor I started getting blue screen. I saw that someone posted about it and he say its because of the cyusb.sys (Cyusb/cyusb3 driver crash blue screen on Windows 10 with PSOC1 ) driver that is sometimes loads its self instead of the cyusb3.sys driver. I did what he says and in win10 it looks to stop crashing but on win7 it still happens.

Do you know why?

All the best,

Ofer.

0 Likes
Reply
Moderator
Moderator

Hi Ofer,

The driver that you use on the Host PC side will be UVC driver and not cyusb3. So, I am not sure how cyusb3 is related to the problem.

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

Hi Hemanth,

I know. I use it for the Example device to send vendor commands. But only when I made the change I started getting the blue screen.

0 Likes
Reply
Moderator
Moderator

Hi Ofer,

Can you let me know what are the values of VID and PID that you use for your video firmware.

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

Hi Hemanth,

The VID=0x04B4 and PID=0x00F9

All the best,

Ofer.

0 Likes
Reply
Moderator
Moderator

Hi Ofer,

If you have used this PID for some other firmware which used cysusb driver, then there could be some conflict.

Please try with PID 0x00F8

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

Hi Hemanth,

The reason to change to 0x00F8 is the it will be unique? or is their some other reason to do it?

(If I change it, will the uvc driver recognize the camera?)

All the best,

Ofer.

0 Likes
Reply
Moderator
Moderator

Hi Ofer,

The reason for suggesting 00F8 is because UVC app note firmware also uses the same PID. And I think this PID would not have been used by you to load cyusb driver.

Regards,

Hemanth

Hemanth
0 Likes
Reply
New Contributor II

Hi Hemanth,

I changed it to 00F8 and I keep getting blue screen every few times.

In the blue screen it say that cyusb3 driver failed.

Can you help me with this?

All the best,

Ofer.

0 Likes
Reply
Moderator
Moderator

Hi Ofer,

1. I hope there is no vendor interface in your firmware (that is, I think only video class interface is present in your firmware). Please confirm.

2. In your device manager, select "View->Show Hidden Devices". Then uninstall all the USB devices with VID 0x04B4 (even the greyed out ones).

Note: If check box is shown as below while uninstalling "Delete the driver software for this device", then check it and then select uninstall.

By doing so, all the cyusb3 driver instances will be delated from the PC.

pastedImage_1.png

Regards,

Hemanth

Hemanth
0 Likes
Reply