/* auto gain and exposure algorithm based on the knee algorithm described here: http://ytse.tricolour.net/docs/LowLightOptimization.html
Returns0ifnochangesweremade,1ifthegainandorexposuresettings
where changed. */ int gspca_expo_autogain( struct gspca_dev *gspca_dev, int avg_lum, int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee)
{
s32 gain, orig_gain, exposure, orig_exposure; int i, steps, retval = 0;
if (v4l2_ctrl_g_ctrl(gspca_dev->autogain) == 0) return0;
orig_gain = gain = v4l2_ctrl_g_ctrl(gspca_dev->gain);
orig_exposure = exposure = v4l2_ctrl_g_ctrl(gspca_dev->exposure);
/* If we are of a multiple of deadzone, do multiple steps to reach the
desired lumination fast (with the risc of a slight overshoot) */
steps = abs(desired_avg_lum - avg_lum) / deadzone;
if (retval)
gspca_dbg(gspca_dev, D_FRAM, "autogain: changed gain: %d, expo: %d\n",
gain, exposure); return retval;
}
EXPORT_SYMBOL(gspca_expo_autogain);
/* Autogain + exposure algorithm for cameras with a coarse exposure control (usuallythismeanswecanonlycontroltheclockdivtochangeexposure) Aschangingtheclockdivsothatthefpsdropsfrom30to15fpsfor example,willleadtoahugeexposurechange(iteffectivelydoubles), thisalgorithmnormallytriestoonlyadjustthegain(between40and 80%)andifthatdoesnothelp,onlythenchangesexposure.Thisleads toamuchmorestableimagethenusingthekneealgorithmwhichat certainpointsofthekneegraphwillonlytrytoadjustexposure, whichleadstooscillatingasoneexposurestepishuge.
Returns0ifnochangesweremade,1ifthegainandorexposuresettings
where changed. */ int gspca_coarse_grained_expo_autogain( struct gspca_dev *gspca_dev, int avg_lum, int desired_avg_lum, int deadzone)
{
s32 gain_low, gain_high, gain, orig_gain, exposure, orig_exposure; int steps, retval = 0;
if (v4l2_ctrl_g_ctrl(gspca_dev->autogain) == 0) return0;
orig_gain = gain = v4l2_ctrl_g_ctrl(gspca_dev->gain);
orig_exposure = exposure = v4l2_ctrl_g_ctrl(gspca_dev->exposure);
/* If we are of a multiple of deadzone, do multiple steps to reach the
desired lumination fast (with the risc of a slight overshoot) */
steps = (desired_avg_lum - avg_lum) / deadzone;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.