Skip to content

Instantly share code, notes, and snippets.

View KaairaGupta's full-sized avatar
🎯
Focusing

Kaaira Gupta KaairaGupta

🎯
Focusing
View GitHub Profile
@KaairaGupta
KaairaGupta / debug.log
Created May 30, 2021 16:33
This is the OVMF debug log output on booting Ubuntu on Qemu.
SecCoreStartupWithStack(0xFFFCC000, 0x820000)
Register PPI Notify: DCD0BE23-9586-40F4-B643-06522CED4EDE
Install PPI: 8C8CE578-8A3D-4F1C-9935-896185C32DD3
Install PPI: 5473C07A-3DCB-4DCA-BD6F-1E9689E7349A
The 0th FV start address is 0x00000820000, size is 0x000E0000, handle is 0x820000
Register PPI Notify: 49EDB1C1-BF21-4761-BB12-EB0031AABB39
Register PPI Notify: EA7CA24B-DED5-4DAD-A389-BF827E8F9B38
Install PPI: B9E0ABFE-5979-4914-977F-6DEE78C278A6
Install PPI: DBE23AA9-A345-4B97-85B6-B226F1617389
DiscoverPeimsAndOrderWithApriori(): Found 0x7 PEI FFS files in the 0th FV
@KaairaGupta
KaairaGupta / map.txt
Created June 22, 2020 19:26
partial mapping from ffplay format names to actual formats
"422P" : "yuv422p",
"YM24" : "yuv444p",
"444P" : "yuv444p",
"YU12" : "yuv420p",
"YV12" : "yuv420p", (this will swap the colors but ffmpeg has no support for yvu)
"NV12" : "nv12",
"NV21" : "nv21",
"NM12" : "nv12",
"NM21" : "nv21",
(The nv16 does not work on ffplay)
@KaairaGupta
KaairaGupta / tpg.md
Created June 22, 2020 19:09
tpg_gen_text explained
  • 'step' is used to emulate interlaced video: if the TPG generates single fields (top or bottom) instead of full frames, then when you generate text in a field you only generate every other line of the text: one field shows the odd lines, the other the even lines of a text character. Hence step == 2 when you generate the text into a field, and 'first' determines whether you start with the first or second line of a text character.
  • If the video source (the TPG in this case) generates interlaced video, then each frame actually consists of a top and bottom field that for high-def formats are typically transmitted as two separate fields.
  • vimc doesn't do interlaced, but vivid does.
  • https://hverkuil.home.xs4all.nl/spec/userspace-api/v4l/field-order.html
@KaairaGupta
KaairaGupta / vimc.md
Last active July 15, 2020 20:01
Understanding vimc
  • When you configure /dev/videoX, it is always the memory layout (thus the pixel format), when configuring /dev/v4l2-subdevX, you configure the bus format (but in virtual drivers, buses doesn't exist, because it is all emulated, there is no physical bus)
  • Hence, since VIMC is a virtual driver, we don't work with mbus codes. For example: SGRBG8_1X8 is associated with a pixelformat, that is used by the sensor, and we can see that by checking vimc_pix_map_list[]
     {
     .code = { MEDIA_BUS_FMT_SGRBG8_1X8 },
     .pixelformat = V4L2_PIX_FMT_SGRBG8,
     .bpp = 1,
     .bayer = true,
     },
    
media-ctl -d /dev/media0 -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d /dev/media0 -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d /dev/media0 -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d /dev/media0 -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d /dev/media0 -V '"Scaler":0[fmt:RGB888_1X24/640x480]'
media-ctl -d /dev/media0 -V '"Scaler":1[fmt:RGB888_1X24/1920x1440]'
v4l2-ctl -d /dev/video2 -v width=1920,height=1440
v4l2-ctl -d /dev/video0 -v pixelformat=BA81
v4l2-ctl -d /dev/video1 -v pixelformat=BA81
v4l2-ctl -d /dev/v4l-subdev0 -c brightness=222
@KaairaGupta
KaairaGupta / libcamera_dev.md
Last active June 15, 2020 09:35
Steps to set up libcamera for dev (with latest media_master) using virtme
  • Follow https://libcamera.org/getting-started.html to install libcamera on your native machine.
  • Clone latest media_tree using:
    git clone git://linuxtv.org/media_tree.git
    
  • Install virtme:
    pip3 install --user git+https://github.com/ezequielgarcia/virtme.git
    
  • Compile Kernel with Virtme:
@KaairaGupta
KaairaGupta / lcdebug
Created April 22, 2020 16:34 — forked from kbingham/lcdebug
lcdebug wrapper helper
#!/bin/bash
# We default to enabling the most debug
# (that's why we're being used right)
FILTER="*"
LEVEL="0"
while [[ $# -gt 0 ]]
do