Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
raw [2020/03/29 17:14] yairraw [2020/10/10 12:17] – [GRAY8 vs RTP] yair
Line 4: Line 4:
  
 **solution**: \\ **solution**: \\
-map the GRAY8 **one plane** source into quarter width **four plane** RGBA output image\\ +a image formats are **just convention**, internally they are byte(octet) streams. we can re-package a datastream to another format, as long as we mind our strides.  
-we will then remap it to Y8 on the receiving side\\ + 
-the trick is to use gstreamer built in forma spec and let it optimize the remapping+view the image format as just a stream of octets. here is our stream in Y8 format 
 +       +--+--+--+--+ +--+--+--+--+ 
 +       |Y1|xx|xx|xx| |Y1|xx|xx|xx| ... 
 +       +--+--+--+--+ +--+--+--+--+ 
 +and again, data quartered and represented in 8 bit depth and with stride of 4 
 +       +--+--+--+--+ +--+--+--+--+ 
 +       |R0|G0|B0|A0| |R1|G1|B1|A1| ... 
 +       +--+--+--+--+ +--+--+--+--+ 
 + 
 +note the above represents two sequential pixels 
 + 
 +the trick is to use gstreamer built in [[https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html?gi-language=c#formats|format spec]] and let that handle the conventions
  
 the [[https://www.collabora.com/news-and-blog/blog/2016/02/16/a-programmers-view-on-digital-images-the-essentials/|hammer]] the [[https://www.collabora.com/news-and-blog/blog/2016/02/16/a-programmers-view-on-digital-images-the-essentials/|hammer]]
Line 24: Line 35:
 00000000 (0x7f369c00a8c0): eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb  ................ 00000000 (0x7f369c00a8c0): eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb  ................
 00000000 (0x556228700560): eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb  ................ 00000000 (0x556228700560): eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb eb  ................
-┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐ 
-│00000000│ eb eb eb eb eb eb eb eb ┊ eb eb eb eb eb eb eb eb │××××××××┊××××××××│ 
-└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘ 
 </code> </code>
 **note**: why white pixel is not FF=(255)?\\ **note**: why white pixel is not FF=(255)?\\
-gstreamer uses YUV colorimetry when generating a GRAY8 test image and YUV doesnt use the entire 0-255 space. [[https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/738|issue]]+gstreamer uses YUV colorimetry when generating a GRAY8 test image \\ 
 +and YUV doesnt use the entire 0-255 space. [[https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/738|issue]]
  
 +**note2**: this example is running on linux/debian, \\
 +to adapt to windows using powershell replace ''\'' with ''`'' and \\
 +place quotes around  ''video/x-raw, format=GRAY8, width=4, height=4''
  
  
Line 59: Line 71:
      
  
-====raw parsing==== 
-<code c> 
-gst-launch-1.0 videotestsrc pattern=white num-buffers=1 \ 
-! video/x-raw, format=GRAY8, width=4, height=4 \ 
-! identity dump=1 \ 
-! filesink location=white.gray8 -q 
  
-gst-launch-1.0  multifilesrc location=white.gray8 num_buffers=1 \ +====strides and offsets====
-! rawvideoparse format=rgba width=1 height=4 \ +
-! identity dump=1 \ +
-! filesink location=white.rgba -q +
-</code>+
  
- +there are caveats to this approach (yuv). get the hammer and study the [[https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html?gi-language=c#formats|design document]]
-====strides and offsets==== +
-note: we dont need to dig into this as we use the capabilities as listed in format_info\\ +
-but hopefully this section will advance your understanding.+
  
  
Line 209: Line 208:
 </hidden> </hidden>
  
-[[https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h#L174|fourcc]] on linux +[[https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h#L174|fourcc]] on linux\\ 
 +[[https://docs.microsoft.com/en-us/windows/win32/medfound/image-stride?redirectedfrom=MSDN|MSDN on stride]]