saki4510t / UVCCamera

library and sample to access to UVC web camera on non-rooted Android device
2.95k stars 1.19k forks source link

Difference between ( 'Y', '8', ' ', ' ' ) and ('Y', '8', '0', '0') #705

Open Gaebobman opened 1 month ago

Gaebobman commented 1 month ago

Hi,

I'm currently working on a project involving the Purethermal3 and Flir Lepton3.5. I want to support the Y8 format or Y16 format in my project.

To achieve this, I'm modifying some code within libuvc. I checked the Groupgets fork of libuvc (https://github.com/groupgets/libuvc). Inside their code, specifically in libuvc/src/stream.c, I found some lines that look like this:

switch(format) {
    /* Define new formats here */
    ABS_FMT(UVC_FRAME_FORMAT_ANY, 2,
      {UVC_FRAME_FORMAT_UNCOMPRESSED, UVC_FRAME_FORMAT_COMPRESSED})

  // ~~~~~~
    FMT(UVC_FRAME_FORMAT_GRAY8,
      {'Y',  '8',  ' ',  ' ', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
    FMT(UVC_FRAME_FORMAT_Y16,
      {'Y',  '1',  '6',  ' ', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
// ~~~
    ABS_FMT(UVC_FRAME_FORMAT_COMPRESSED, 1,
      {UVC_FRAME_FORMAT_MJPEG})
    FMT(UVC_FRAME_FORMAT_MJPEG,
      {'M',  'J',  'P',  'G'})

    default:
      return NULL;
  }

However, some other implementations, which were built to support previous versions of the Purethermal board, implement it like this:

FMT(UVC_FRAME_FORMAT_GRAY8,
        {'Y', '8', '0', '0', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})

I want to know the difference between ('Y', '8', ' ', ' ') and ('Y', '8', '0', '0').

Thank you.

MrAdi149 commented 1 week ago

('Y', '8', ' ', ' '): This likely represents a basic or generic YUV format with 8 bits per Y component (luma/brightness). The spaces indicate that the specific sub-format or chroma (color) information is not explicitly defined or is flexible. ('Y', '8', '0', '0'): This might represent a more specific YUV sub-format, potentially YUV 4:2:0. The '0' characters could indicate a particular chroma subsampling scheme where the color information is sampled at half the horizontal and vertical resolution of the luma