jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23683
Joined: Sat Jul 30, 2011 7:41 pm

New AWB algorithm in test firmware

Wed May 29, 2019 1:13 pm

Hello all,

As part of our transition to the brave new 3D world of KMS, we are moving the AWB algorithm off the quad processors. These quads are used by the new 3D driver from ARM space, and allowing the camera AWB (firmware space) to use them as well is not very efficient for either party.

So, we now have a baysian statistical AWB algorithm that runs entirely on the VPU. This can be tested out by running `sudo rpi-update' which will update your firmware to the latest test version.

We would be grateful if people could try out this new AWB algorithm. There will be some differences, but it should match up fairly closely with the existing version. If you find a major difference we would be very interested in seeing comparison images, preferably in RAW format. (e.g. raspistill --raw option)

You can easily switch between AWB algorithms as follows:

Code: Select all

vcdbg set awb_mode [0|1]".  0 for old algorithm, 1 for our new algorithm. Defaults to our new one.
Thanks all.

Camera Team.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23683
Joined: Sat Jul 30, 2011 7:41 pm

Re: New AWB algorithm in test firmware

Tue Jun 04, 2019 2:17 pm

Bring this to top again as its important and have had no comments so far!! Which I pressume is a good thing!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

User avatar
bensimmo
Posts: 4175
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: New AWB algorithm in test firmware

Tue Jun 04, 2019 3:12 pm

I've not use the camera much, but do have the v1 of both types
Unfortunately I can't send them back up in the rocket for a while,.so will have to be normal testing.

I'm assuming if I use picamera python module, it'll just work?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23683
Joined: Sat Jul 30, 2011 7:41 pm

Re: New AWB algorithm in test firmware

Tue Jun 04, 2019 3:44 pm

bensimmo wrote:
Tue Jun 04, 2019 3:12 pm
I've not use the camera much, but do have the v1 of both types
Unfortunately I can't send them back up in the rocket for a while,.so will have to be normal testing.

I'm assuming if I use picamera python module, it'll just work?
Its all in the firmware, so yes, it should just work. Or at least, that's the plan!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

ddahms
Posts: 67
Joined: Tue Mar 18, 2014 3:38 pm

Re: New AWB algorithm in test firmware

Thu Jun 06, 2019 8:45 pm

I gave it a try. I have a v1 camera. On a sunny midday scene, I see no difference between mode 0 and 1. On a dusk scene, mode 0 has an overall reddish tint like it always did while mode 1 is less reddish, which is an improvement.

There is one minor side effect: in mode 1, the version of Raspistill that I compiled to incorporate a custom lens shading table by following this post hangs. It creates the empty temp output file with the tilde suffix and hangs.

nevilley
Posts: 13
Joined: Sat Aug 11, 2012 3:12 pm

Re: New AWB algorithm in test firmware

Sun Aug 11, 2019 9:32 am

Ran apt upgrade on 10 Pi zero W running motion over the weekend.
Those that use the Pi NOIR cam now have a purple haze. Those running under IR light are unusable.

I don't know why but running "vcdbg set awb_mode 0 " appears to kill the wifi !
For headless PIs this is a problem.

As these are security cams I have had to reload the SD cards from a backup to undo the upgrade.

roelfraspi
Posts: 8
Joined: Wed Jun 26, 2019 9:46 pm

Re: New AWB algorithm in test firmware

Sun Aug 11, 2019 10:40 am

Upgraded firmware. There is a problem with AWB off and AWBG that only effects the thumbnails right. Pictures stay the same color and have only brightness changed..

nevilley
Posts: 13
Joined: Sat Aug 11, 2012 3:12 pm

Re: New AWB algorithm in test firmware

Sun Aug 11, 2019 12:21 pm

I don't use thumbnails.

This is the "purple haze" problem reported elsewhere.
I'm using the 8Mp NOIR pi cams with no filters with Pi zero W and the motion s/w package..

Examples of before and after the recent update can be seen here on a camera that is lit only with IR leds.
http://www.nevilley.org.uk/RPi/snap1.jpg
http://www.nevilley.org.uk/RPi/snap2.jpg

I have already reverted to a previous backup of the system to make it work again on 2 of the 3 affected systems.
The 3rd system uses daylight so despite having the purple haze it is still useable.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23683
Joined: Sat Jul 30, 2011 7:41 pm

Re: New AWB algorithm in test firmware

Sun Aug 11, 2019 12:34 pm

nevilley wrote:
Sun Aug 11, 2019 12:21 pm
I don't use thumbnails.

This is the "purple haze" problem reported elsewhere.
I'm using the 8Mp NOIR pi cams with no filters with Pi zero W and the motion s/w package..

Examples of before and after the recent update can be seen here on a camera that is lit only with IR leds.
http://www.nevilley.org.uk/RPi/snap1.jpg
http://www.nevilley.org.uk/RPi/snap2.jpg

I have already reverted to a previous backup of the system to make it work again on 2 of the 3 affected systems.
The 3rd system uses daylight so despite having the purple haze it is still useable.
This was fixed some time ago. You need to set -awb greyworld on the raspistill/vid command line.

See https://github.com/raspberrypi/firmware/issues/1167

There are also fixes for the awb off problem above, use rpi-update to get that as its not made it into the main release yet.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23683
Joined: Sat Jul 30, 2011 7:41 pm

Re: New AWB algorithm in test firmware

Sun Aug 11, 2019 12:38 pm

nevilley wrote:
Sun Aug 11, 2019 9:32 am
Ran apt upgrade on 10 Pi zero W running motion over the weekend.
Those that use the Pi NOIR cam now have a purple haze. Those running under IR light are unusable.

I don't know why but running "vcdbg set awb_mode 0 " appears to kill the wifi !
For headless PIs this is a problem.

As these are security cams I have had to reload the SD cards from a backup to undo the upgrade.
Nothing to do with the purple side of things, but you should always check new software works on an offline/test system before updating live and important systems. That would be standard practice.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

nevilley
Posts: 13
Joined: Sat Aug 11, 2012 3:12 pm

Re: New AWB algorithm in test firmware

Sun Aug 11, 2019 4:24 pm

Which is why I had backups.
I've been in IT since 1975 and "restore from your latest back-up" was my favourite support reply.

nevilley
Posts: 13
Joined: Sat Aug 11, 2012 3:12 pm

Re: New AWB algorithm in test firmware

Sun Aug 11, 2019 4:31 pm

This was fixed some time ago. You need to set -awb greyworld on the raspistill/vid command line.
But as I wrote.
I'm running motion, not raspistill.

running "vcdbg set awb_mode 0" kills the wifi. This is bad as the pi zeros are headless.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23683
Joined: Sat Jul 30, 2011 7:41 pm

Re: New AWB algorithm in test firmware

Sun Aug 11, 2019 9:11 pm

nevilley wrote:
Sun Aug 11, 2019 4:31 pm
This was fixed some time ago. You need to set -awb greyworld on the raspistill/vid command line.
But as I wrote.
I'm running motion, not raspistill.

running "vcdbg set awb_mode 0" kills the wifi. This is bad as the pi zeros are headless.
So how does motion access the camera? You'll need to tell that process to use the greyworld AWB algorithm.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23683
Joined: Sat Jul 30, 2011 7:41 pm

Re: New AWB algorithm in test firmware

Sun Aug 11, 2019 9:12 pm

nevilley wrote:
Sun Aug 11, 2019 4:24 pm
Which is why I had backups.
I've been in IT since 1975 and "restore from your latest back-up" was my favourite support reply.
How about never update a running and critical system unless you tested the update first on a non-critical system? That would be my favourite.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

nevilley
Posts: 13
Joined: Sat Aug 11, 2012 3:12 pm

Re: New AWB algorithm in test firmware

Mon Aug 12, 2019 6:24 am

How about never update a running and critical system unless you tested the update first on a non-critical system? That would be my favourite.
How about "Just let the customers do the beta testing" or "if it ain't broke don't fix it". :)

If you would like an experienced QA manager I can come out of retirement. ;)

Meanwhile, I'll wait for a permanent fix to be released.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23683
Joined: Sat Jul 30, 2011 7:41 pm

Re: New AWB algorithm in test firmware

Mon Aug 12, 2019 8:08 am

nevilley wrote:
Mon Aug 12, 2019 6:24 am
How about never update a running and critical system unless you tested the update first on a non-critical system? That would be my favourite.
How about "Just let the customers do the beta testing" or "if it ain't broke don't fix it". :)

If you would like an experienced QA manager I can come out of retirement. ;)

Meanwhile, I'll wait for a permanent fix to be released.
"if it ain't broke don't fix it"

The AWB algorithm was changed because it needed to be taken off the QUAD processors on the GPU, as the use of the new Mesa driver means they are no longer available for use by the GPU - the Mesa driver is entirely ARM space, and a system to ensure safe sharing of the quads between ARM and GPU would cause performance issues (locking across a communications boundary - vchiq - is too slow). So, we needed a algorithm that could run entirely on the vector unit, so it needed to be less CPU hungry. Hence the change.

"Just let the customers do the beta testing"

Indeed , we do not have a test department (The entire trading team is about 40 people, about half engineers in HW and SW), so we prerelease stuff that get through internal testing to beta testers. The AWB change was announced a while back, and tested. The purple hue on the NoIR was reported and was fixed by adding the greyworld option to Raspistill. We are not responsible for other people's software e.g. Motion. They will need to update whatever needs updating.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

User avatar
bensimmo
Posts: 4175
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: New AWB algorithm in test firmware

Mon Aug 12, 2019 8:42 am

That is true, this was tested by whoever wanted too. it's the first two post in this section.
But this was the change. It tried it, i didn't see a problem for what I do (I did forget to report back, :oops: but I've been changing jobs. I'm moving to the dark side of education by actually becoming a teacher, rather than the fun side of education as support staff.)

Pi_DD
Posts: 26
Joined: Thu Feb 08, 2018 10:34 pm

Re: New AWB algorithm in test firmware

Mon Aug 19, 2019 5:47 pm

Request for a clarification......

RESOLVED, the answer is AWB mode 0 still works if needed on latest Stretch and Buster

I have a camera that uses both visible light LEDs and I.R LEDs and is managed using Motion/Motioneye.

Had the “purple haze problem” and fixed it with the AWB=0 workaround.

I note that the latest kernel update, today, now includes the new “greyworld” option.

Before I apply it to the relevant Pi, does the AWB=0 workaround still work on this update?

Reluctant to update if it does not until I have found out how to handle AWB modifications via Motion/Motioneye for the two forms of lighting.

Thanks

ProDigit
Posts: 374
Joined: Tue Aug 30, 2011 1:24 am

Re: New AWB algorithm in test firmware

Mon Aug 26, 2019 10:32 pm

I just want to caution people using the command:

Code: Select all

sudo rpi-update
It could brick your Pi installation, and you'll need to reinstall the OS again.
Happened to me a few weeks ago.

Don't use it, unless you know what you're doing, and have no other alternative!

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23683
Joined: Sat Jul 30, 2011 7:41 pm

Re: New AWB algorithm in test firmware

Tue Aug 27, 2019 8:58 am

ProDigit wrote:
Mon Aug 26, 2019 10:32 pm
I just want to caution people using the command:

Code: Select all

sudo rpi-update
It could brick your Pi installation, and you'll need to reinstall the OS again.
Happened to me a few weeks ago.

Don't use it, unless you know what you're doing, and have no other alternative!
Indeed, and there is a big message when you run it saying exactly that.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

roelfraspi
Posts: 8
Joined: Wed Jun 26, 2019 9:46 pm

Re: New AWB algorithm in test firmware

Tue Aug 27, 2019 12:18 pm

jamesh wrote:
Sun Aug 11, 2019 12:34 pm
nevilley wrote:
Sun Aug 11, 2019 12:21 pm
I don't use thumbnails.

This is the "purple haze" problem reported elsewhere.
I'm using the 8Mp NOIR pi cams with no filters with Pi zero W and the motion s/w package..

Examples of before and after the recent update can be seen here on a camera that is lit only with IR leds.
http://www.nevilley.org.uk/RPi/snap1.jpg
http://www.nevilley.org.uk/RPi/snap2.jpg

I have already reverted to a previous backup of the system to make it work again on 2 of the 3 affected systems.
The 3rd system uses daylight so despite having the purple haze it is still useable.
This was fixed some time ago. You need to set -awb greyworld on the raspistill/vid command line.

See https://github.com/raspberrypi/firmware/issues/1167

There are also fixes for the awb off problem above, use rpi-update to get that as its not made it into the main release yet.
I just upgraded again and tried taking photos and setting white balance myself it still does not work. Only the embedded thumbnails reflect the choosen WB setting the image does not. Greyworld is no workaround for setting a manual white balance. It might be quite satisfactory for security cams and all that but I am using the Pi Cam for photography.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7305
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: New AWB algorithm in test firmware

Tue Aug 27, 2019 2:59 pm

Bug in capturing images with manual gains noted, and fix being prepared.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

roelfraspi
Posts: 8
Joined: Wed Jun 26, 2019 9:46 pm

Re: New AWB algorithm in test firmware

Tue Aug 27, 2019 7:52 pm

6by9 wrote:
Tue Aug 27, 2019 2:59 pm
Bug in capturing images with manual gains noted, and fix being prepared.
Thank you.

Return to “Camera board”