doc:appunti:hardware:ambarella_custom_firmware
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
doc:appunti:hardware:ambarella_custom_firmware [2021/12/26 18:18] – [My Custom firmware] niccolo | doc:appunti:hardware:ambarella_custom_firmware [2022/05/01 16:56] – [Chroma curves examples] niccolo | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | **How to customize the firmware | + | **How to customize the Ambarella |
+ | |||
+ | See also my SJCAM SJ8 Pro review in page **[[sjcam-8pro]]**. | ||
In this page there are some notes about customizing the firmware of the **[[sjcam-8pro|SJCAM SJ8 Pro]]** action camera, using the **[[https:// | In this page there are some notes about customizing the firmware of the **[[sjcam-8pro|SJCAM SJ8 Pro]]** action camera, using the **[[https:// | ||
Line 8: | Line 10: | ||
Unfortunately it seems that the hackers community is very jealous of their findings, hardly anyone writes complete documentation and it seems that the main interest is to prove our own supremacy by publishing as many //mod//s as possible, without documenting exactly what was done inside. A notable exception is the **BitrateEditor** software by **V_Max** hacker; being released as open source it is a source of very useful information on the internal structure of firmware files. | Unfortunately it seems that the hackers community is very jealous of their findings, hardly anyone writes complete documentation and it seems that the main interest is to prove our own supremacy by publishing as many //mod//s as possible, without documenting exactly what was done inside. A notable exception is the **BitrateEditor** software by **V_Max** hacker; being released as open source it is a source of very useful information on the internal structure of firmware files. | ||
+ | |||
+ | ===== My Custom firmware ===== | ||
+ | |||
+ | Download the custom firmware: **{{.: | ||
+ | |||
+ | This is a breif list of customizations, | ||
+ | |||
+ | * Increased **bitrates**, | ||
+ | * Increased **keyframes** rates (reducing GOP-N): one keyframe every 1/4 second instead of 1 per second. | ||
+ | * Changed **YUV color profiles**: less contrast for **SJCAM - Vivid**, more contrast for **Flat** | ||
+ | * Fixed **exposition** profiles: **Center**, **Spot** and **Average**. | ||
+ | * Changed **gamma curves**: reducing blue sky and contrast. | ||
+ | * Changed power-on, power-off and photo shutter **sounds** with louder ones. | ||
+ | * Disabled **LRV** (low resolution videos) recording. | ||
+ | |||
+ | === Bitrates === | ||
+ | |||
+ | The SJ8 Pro camera has by default very low bitrates compared with other 4K action cameras. In the following table you can compare three cameras in various video modes. My custom settings are geared to always keep the standard quality and to film mainly at 1920x1080, to save space and battery. | ||
+ | |||
+ | ^ Bitrates | ||
+ | ^ | ||
+ | ^ Video Mode ^ Eco ^ Std ^ Fine ^ Default | ||
+ | ^ 4K@60 | ||
+ | ^ 4K@30 | ||
+ | | ||||||| | ||
+ | ^ 2.7K@60 | ||
+ | ^ 2.7K@30 | ||
+ | | ||||||| | ||
+ | ^ 1440@60 | ||
+ | ^ 1440@30 | ||
+ | | ||||||| | ||
+ | ^ 1080@120 | ||
+ | ^ 1080@60 | ||
+ | ^ 1080@30 | ||
+ | | ||||||| | ||
+ | ^ 720@240 | ||
+ | |||
+ | * **[[https:// | ||
+ | * **[[https:// | ||
+ | |||
+ | **NOTICE**: For bitrates of **100 Mbit/s** or above you have to consider the micro SD card performances. Recording a stream of 100 Mbit/s means writing a **sustained stream of 12 Mb/s** (megabytes/ | ||
+ | |||
+ | === Bitrates GOP === | ||
+ | |||
+ | I want at least 4 keyframes per second, so I can cut scenes without re-encoding with the precision of about 0.25 seconds. The original firmware instead put only a keyframe every second. | ||
+ | |||
+ | ^ GOP-N Values | ||
+ | ^ FPS ^ 24 ^ 25 ^ 30 ^ 60 ^ 120 ^ 240 ^ | ||
+ | ^ SJ8Pro Default | ||
+ | ^ My Custom SJ8Pro | ||
+ | |||
+ | === YUV Profiles === | ||
+ | |||
+ | For my taste the two YUV profiles are both too exagerated. The **Vivid - SJCAM** profile has **too much contrast** and colors are **too much saturated**, | ||
+ | |||
+ | For the **default** and **vivid** profile I reduced the multipliers by about 6% on the luminance channel and by about 14% on the colors channels. Then I decreased the luminance offset (2%) to recover a bit of the black. For the **flat** profile I reduced the luminance multiplier by about 19%, on both the color channels the multiplier was reduced by about 21%; then I added about 2.5% to the luminance offset, to get some more white. | ||
+ | |||
+ | The resulting two profiles are not so different from each other, may be you cannot tell them apart looking at the touch screen. This may be a problem, because of the firmware bug which does not properly show the selected profile name and which does not remember the selected profile on power-off/ | ||
+ | |||
+ | ^ | ||
+ | ^ ^ Default | ||
+ | ^ Y | ||
+ | ^ U | ||
+ | ^ V | ||
+ | ^ Y-offset | ||
+ | ^ U-offset | ||
+ | ^ V-offset | ||
+ | |||
+ | === Exposition === | ||
+ | |||
+ | Metering tables were fixed, this simply means swapping profiles **Spot** and **Average**. | ||
+ | |||
+ | === Gamma curves === | ||
+ | |||
+ | After countless experiments with the gamma curves, I decided to replace the original ones with **ascending linear lines**, i.e. **no actual gamma transformation**. There is no documentation on how the **%%*/ | ||
+ | |||
+ | * Group **%%*/0%%** is not used at all. | ||
+ | * Groups **%%*/ | ||
+ | * It seems that in some **particular circumstances** (some color component of */255 is **very dark**) the gamma curve is replaced automatically with something different, may be a **negative** (descending) curve. | ||
+ | |||
+ | For all that reasons, I decided to replace the curves with linear ones. It may be that I will intervene in the future if I notice any problems in the footages. | ||
+ | |||
+ | === Chroma curves === | ||
+ | |||
+ | At the moment I leaved the same chroma curves as the original 1.3.2 SJCAM firmware. | ||
+ | |||
+ | |||
+ | === Sounds === | ||
+ | |||
+ | I changed the original sounds for **power-on**, | ||
+ | |||
+ | === autoexec.ash === | ||
+ | |||
+ | I suggest to add a single line **autoexec.ash** to disable the recording of the **.LRV** (low resolution video) files into the SD card. I don't use them at all, so it is a waste of space and CPU/battery to create them. | ||
===== Anatomy of the Ambarella firmware ===== | ===== Anatomy of the Ambarella firmware ===== | ||
Line 331: | Line 427: | ||
Also **photos** have their chroma tables contained into **adj_still_default_00_Imx377** and **adj_hiso_still_default_00_Imx377**. | Also **photos** have their chroma tables contained into **adj_still_default_00_Imx377** and **adj_hiso_still_default_00_Imx377**. | ||
- | |||
^ Tables | ^ Tables | ||
Line 345: | Line 440: | ||
Each chroma curve is **defined by 128 points** that map to a chrominance value ranging from 0 to 2048. On the X axis there is the brightness of the image pixels, on the Y axis there is the chroma correction factor to be applied. A value of **zero** means to **remove all the chroma** information, | Each chroma curve is **defined by 128 points** that map to a chrominance value ranging from 0 to 2048. On the X axis there is the brightness of the image pixels, on the Y axis there is the chroma correction factor to be applied. A value of **zero** means to **remove all the chroma** information, | ||
+ | |||
+ | In the following image you can see how BitrateEditor shows the chroma **4K30/128 table**. All values are equal to 1024, thus resulting into a stright line: | ||
{{.: | {{.: | ||
- | The three curves are applied by stretching the full range **over the full brightness range** of the image, i.e. the leftmost point of the curve applies to the darkest points of the image, the rightmost point of the curve applies to the brightest points of the image. The three curves are combined together, probably each one is **weighed upon the overall exposition of the image**. It seems that the **4K30/ | + | BitrateEditor can show the tables also as **curves**, here there are the ones provided by the original SJCAM firmware 1.3.2: |
+ | |||
+ | {{.: | ||
+ | {{.: | ||
+ | {{.: | ||
+ | |||
+ | The three curves are applied by stretching the full range **over the full brightness range** of the image, i.e. the leftmost point of the curve applies to the darkest points of the image, the rightmost point of the curve applies to the brightest points of the image. The three curves are combined together, probably each one is **weighed upon the overall exposition of the image**. It seems that the **4K30/ | ||
Changes made on tables **%%4K30/ | Changes made on tables **%%4K30/ | ||
Line 365: | Line 469: | ||
We tried to understand when the **4K30/ | We tried to understand when the **4K30/ | ||
- | {{.: | + | {{.: |
- | {{.: | + | {{.: |
- | {{.: | + | {{.: |
- | Using an exposition of **EV -1.0** or higher, no chrominance is added at all. Some mild effect is visible at **EV -2.0**, despite the chroma graph teeth were set to the maximum value of 2048. In the darker part of the image the effect is not noticeable; the first tooth on the left produces almost no effect. Also the third tooth on the right does not produces any noticeable effect. Only the central **narrow tooth** produces a **narrow band of color**. If the tooth instead expands from the center to the right (last image), the colored area expands from the center towards the brightest part. | + | Using an exposition of **EV -1.0** or higher, no chrominance is added at all. Some mild effect is visible at **EV -2.0**, despite the chroma graph teeth were set to the maximum value of 2048. In the darker part of the image the effect is not noticeable; the first tooth on the left produces almost no effect. Also the third tooth on the right does not produces any noticeable effect. Only the central **narrow tooth** produces a **narrow band of color**. If the tooth instead expands from the center to the right (last image), the colored area expands from the center towards the upper brightest part. |
So the maximum effect of the **4K30/ | So the maximum effect of the **4K30/ | ||
- | {{.: | + | {{.: |
=== Curve 4K30/128 === | === Curve 4K30/128 === | ||
Line 381: | Line 485: | ||
The curve **4K30/ | The curve **4K30/ | ||
- | {{.: | + | {{.: |
- | {{.: | + | {{.: |
- | {{.: | + | {{.: |
=== Curve 4K30/0 === | === Curve 4K30/0 === | ||
Line 391: | Line 495: | ||
The curve **4K30/0** is effective, using the maximum value of 2048, starting from **EV 0.0** and above: | The curve **4K30/0** is effective, using the maximum value of 2048, starting from **EV 0.0** and above: | ||
- | {{.: | + | {{.: |
- | {{.: | + | {{.: |
- | {{.: | + | {{.: |
=== Mixing the curves === | === Mixing the curves === | ||
- | The first example shows the effect of creating some **disjointed theet on the three curves**; each tooth is set at the maximum value of 2048. Actually the single tooth of the curve 4k30/255 produces almos no visble effect, you can see **only three narrow bands of colors** corresponding to teeth on curves **4k30/128** and **4k30/0**: | + | The first example shows the effect of creating some **disjointed theet on the three curves**; each tooth is set at the maximum value of 2048. Actually the single tooth of the curve 4k30/255 produces almos no visble effect, you can see **only three narrow bands of colors** corresponding to teeth on curves **4K30/128** and **4K30/0**: |
- | {{.: | + | {{.: |
The last example is used to show how curves are **mixed together**. In this case a **wide teeth** on curve **4K30/ | The last example is used to show how curves are **mixed together**. In this case a **wide teeth** on curve **4K30/ | ||
- | {{.: | + | {{.: |
===== AGC and digital gain ===== | ===== AGC and digital gain ===== | ||
Line 468: | Line 572: | ||
{{.: | {{.: | ||
- | |||
- | ===== My Custom firmware ===== | ||
- | |||
- | This is my list for firmware customizations: | ||
- | |||
- | * Increased **bitrates**, | ||
- | * Increased **keyframes** rates (reducing GOP-N): one keyframe every 1/4 second instead of 1 per second. | ||
- | * Changed **YUV color profiles**: less contrast for **SJCAM - Vivid**, more contrast for **Flat** | ||
- | * Fixed **exposition** profiles: **Center**, **Spot** and **Average**. | ||
- | * Changed **gamma curves**: reducing blue sky and contrast. | ||
- | * Changed power-on, power-off and photo shutter **sounds** with louder ones. | ||
- | * Disabled **LRV** (low resolution videos) recording. | ||
- | |||
- | === Bitrates === | ||
- | |||
- | The SJ8 Pro camera has by default very low bitrates compared with other 4K action cameras. In the following table you can compare three cameras in various video modes. My custom settings are geared to always keep the standard quality and to film mainly at 1920x1080, to save space and battery. | ||
- | |||
- | ^ Bitrates | ||
- | ^ | ||
- | ^ Video Mode ^ Eco ^ Std ^ Fine ^ Default | ||
- | ^ 4K@60 | ||
- | ^ 4K@30 | ||
- | | ||||||| | ||
- | ^ 2.7K@60 | ||
- | ^ 2.7K@30 | ||
- | | ||||||| | ||
- | ^ 1440@60 | ||
- | ^ 1440@30 | ||
- | | ||||||| | ||
- | ^ 1080@120 | ||
- | ^ 1080@60 | ||
- | ^ 1080@30 | ||
- | | ||||||| | ||
- | ^ 720@240 | ||
- | |||
- | * **[[https:// | ||
- | * **[[https:// | ||
- | |||
- | **NOTICE**: For bitrates of **100 Mbit/s** or above you have to consider the micro SD card performances. Recording a stream of 100 Mbit/s means writing a **sustained stream of 12 Mb/s** (megabytes/ | ||
- | |||
- | === Bitrates GOP === | ||
- | |||
- | I want at least 4 keyframes per second, so I can cut scenes without re-encoding with the precision of about 0.25 seconds. The original firmware instead put only a keyframe every second. | ||
- | |||
- | ^ GOP-N Values | ||
- | ^ FPS ^ 24 ^ 25 ^ 30 ^ 60 ^ 120 ^ 240 ^ | ||
- | ^ SJ8Pro Default | ||
- | ^ My Custom SJ8Pro | ||
- | |||
- | === YUV Profiles === | ||
- | |||
- | For my taste the two YUV profiles are both too exagerated. The **Vivid - SJCAM** profile has **too much contrast** and colors are **too much saturated**, | ||
- | |||
- | For the **default** and **vivid** profile I reduced the multipliers by about 6% on the luminance channel and by about 14% on the colors channels. Then I decreased the luminance offset (2%) to recover a bit of the black. For the **flat** profile I reduced the luminance multiplier by about 19%, on both the color channels the multiplier was reduced by about 21%; then I added about 2.5% to the luminance offset, to get some more white. | ||
- | |||
- | The resulting two profiles are not so different from each other, may be you cannot tell them apart looking at the touch screen. This may be a problem, because of the firmware bug which does not properly show the selected profile name and which does not remember the selected profile on power-off/ | ||
- | |||
- | ^ | ||
- | ^ ^ Default | ||
- | ^ Y | ||
- | ^ U | ||
- | ^ V | ||
- | ^ Y-offset | ||
- | ^ U-offset | ||
- | ^ V-offset | ||
- | |||
- | === Exposition === | ||
- | |||
- | Metering tables were fixed, this simply means swapping profiles **Spot** and **Average**. | ||
- | |||
- | === Gamma curves === | ||
- | |||
- | === Sounds === | ||
- | |||
- | === autoexec.ash === | ||
doc/appunti/hardware/ambarella_custom_firmware.txt · Last modified: 2022/05/05 08:26 by niccolo