Does FX3 support MJPEG/JPEG video streaming??

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Does FX3 support MJPEG/JPEG  720p and 1080p video streaming on USB3.0 ?

If yes then do we need to change in FX3 descriptor file ?

0 Likes
1 Solution
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello Nikhil,

Please refer to the below code example from Cypress.

http://www.cypress.com/documentation/code-examples/ez-usb-fx3-usb-video-class-example

Best regards,

Srinath S

View solution in original post

0 Likes
2 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello Nikhil,

Please refer to the below code example from Cypress.

http://www.cypress.com/documentation/code-examples/ez-usb-fx3-usb-video-class-example

Best regards,

Srinath S

0 Likes
Anonymous
Not applicable

We modified Descriptor file and Probe Control Settings for USB 3.0 , the device is getting detected in Imaging devices

with error as shown below,

DevMngrErr.png

also it is not being detected by AMCap as shown below,

AMCapErr.png

We made following changes to get MJPEG video streaming,

1. Modifications in CyFxUSBSSConfigDscr[]

- Configuration Descriptor Type

0xFD,0x01,      //Total length of this and all sub-descriptors.

- Class-specific Video Streaming Input Header Descriptor

0x03,           //3 format desciptor follows (YUV RGB and JPEG)

0x2A,0x01,      //Total size of Class specific VS descr

- added Class specific VS format and frame descriptor for JPEG after YUV and RGB

      /* Class specific VS format descriptor */

0x0B,                           /* Descriptor size */

0x24,                           /* Class-specific VS i/f type */

0x06,                           /* Descriptotor subtype : VS_FORMAT_MJPEG */

0x03,                           /* Format desciptor index */  // changed

0x01,                           /* 1 Frame desciptor follows */

0x01,                           /* Uses fixed size samples */

0x01,                           /* Default frame index is 1 */

0x00,                           /* Non interlaced stream not reqd. */

0x00,                           /* Non interlaced stream not reqd. */

0x00,                           /* Non interlaced stream */

0x00,                           /* CopyProtect: duplication unrestricted */

/* Class specific VS frame descriptor */

0x1E,                           /* Descriptor size */

0x24,                           /* Class-specific VS i/f type */

0x07,                           /* Descriptor Subtype : VS_FRAME_MJPEG */

0x01,                           /* Frame desciptor index */

0x00,                           /* Still image capture method not supported */

0x80, 0x07,                     /* Width in pixel *///1920

0x3A, 0x04,                     /* Height in pixel *///1082

0x00,0x50,0x97,0x31,            /* Min bit rate bits/s. */

0x00,0x50,0x97,0x31,            /* Max bit rate bits/s. */

0x00,0x66,0x3F,0x00,            /* Maximum video or still frame size in bytes(Deprecated)*///1920*1082*2

0x15, 0x16, 0x05, 0x00,         /* 30fps */

0x01,

0x15,0x16,0x05,0x00,

2. Modification in UVC Probe Control Settings for a USB 3.0 connection

uint8_t glProbeCtrl[CY_FX_UVC_MAX_PROBE_SETTING] = {

    0x00, 0x00,                 /* bmHint : no hit */

    0x03,                       /* Use 1st Video format index */  //jpeg

    0x01,                       /* Use 1st Video frame index */

    0x15, 0x16, 0x05, 0x00,     /* Desired frame interval in the unit of 100ns: 30 fps */

    0x00, 0x00,                 /* Key frame rate in key frame/video frame units: only applicable

                                   to video streaming with adjustable compression parameters */

    0x00, 0x00,                 /* PFrame rate in PFrame / key frame units: only applicable to

                                   video streaming with adjustable compression parameters */

    0x00, 0x00,                 /* Compression quality control: only applicable to video streaming

                                   with adjustable compression parameters */

    0x00, 0x00,                 /* Window size for average bit rate: only applicable to video

                                   streaming with adjustable compression parameters */

    0x00, 0x00,                 /* Internal video streaming i/f latency in ms */

    0x00, 0x60, 0x09, 0x00,      //600KB  (jpeg)

    0x00, 0xF0, 0x00, 0x00      /* No. of bytes device can rx in single payload = 60 KB */

3. Modification in uvc.h

/* UVC Video Streaming Endpoint Packet Size */

#define CY_FX_EP_BULK_VIDEO_PKT_SIZE    (0x400)         /* 1024 Bytes */

/* UVC Video Streaming Endpoint Packet Count */

#define CY_FX_EP_BULK_VIDEO_PKTS_COUNT  (60)          /* 16 packets (burst of 16) per DMA buffer. */

/* DMA buffer size used for video streaming. */

#define CY_FX_UVC_STREAM_BUF_SIZE      (CY_FX_EP_BULK_VIDEO_PKTS_COUNT * CY_FX_EP_BULK_VIDEO_PKT_SIZE)

/* Maximum video data that can be accommodated in one DMA buffer. */

#define CY_FX_UVC_BUF_FULL_SIZE        (CY_FX_UVC_STREAM_BUF_SIZE - 16)

/* Number of DMA buffers per GPIF DMA thread. */

#define CY_FX_UVC_STREAM_BUF_COUNT     (2)

/* Low Byte - UVC Video Streaming Endpoint Packet Size */

#define CY_FX_EP_BULK_VIDEO_PKT_SIZE_L  (uint8_t)(CY_FX_EP_BULK_VIDEO_PKT_SIZE & 0x00FF)

/* High Byte - UVC Video Streaming Endpoint Packet Size and No. of BULK packets */

#define CY_FX_EP_BULK_VIDEO_PKT_SIZE_H  (uint8_t)((CY_FX_EP_BULK_VIDEO_PKT_SIZE & 0xFF00) >> 😎

/* Maximum commit buffer failures to detect a stop streaming event in a MAC OS */

#define CY_FX_UVC_MAX_COMMIT_BUF_FAILURE_CNT    (30)

Please Kindly suggest if any other changes are required.

0 Likes