Skip to content
Open
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Features
http://www.lavrsen.dk/foswiki/bin/view/Motion/OggTimelapse (Michael Luich)
* Added support for ffmpeg 0.11 new API.
* Added RSTP support for netcam ( merge https://github.com/hyperbolic2346/motion )
* Allow text format specifiers to take a width like printf would. (David Fries)
* Add power_line_frequency configuration item to improve image quality. (David Fries)

Bugfixes
* Avoid segfault detecting strerror_r() version GNU or SUSv3. (Angel Carpintero)
Expand Down Expand Up @@ -84,6 +86,7 @@ Bugfixes
* Fixed leak in vloopback.
* Fixed a build of motion for some kernel version with not good videodev.h
* Netcam Modulo 8
* Fix webhttpd race condition crash with SIGHUP, add it to running thread counter (David Fries)

3.2.12 Summary of Changes

Expand Down
5 changes: 5 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,11 @@ Mark Feenstra
Miguel Freitas
* Came up with the round robing idea.

David Fries
* Fix webhttpd race condition crash with SIGHUP, add it to running thread counter
* Allow text format specifiers to take a width like printf would.
* Add power_line_frequency configuration item to improve image quality.

Aaron Gage
* Pointed me to the vid_mmap/int problem when calling SYNC in
video.c
Expand Down
12 changes: 9 additions & 3 deletions alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ static int alg_labeling(struct context *cnt)
int height = imgs->height;
int labelsize = 0;
int current_label = 2;
/* Keep track of the area just under the threshold. */
int max_under = 0;

cnt->current_image->total_labels = 0;
imgs->labelsize_max = 0;
Expand Down Expand Up @@ -561,7 +563,8 @@ static int alg_labeling(struct context *cnt)
labelsize = iflood(ix, iy, width, height, out, labels, current_label + 32768, current_label);
imgs->labelgroup_max += labelsize;
imgs->labels_above++;
}
} else if(max_under < labelsize)
max_under = labelsize;

if (imgs->labelsize_max < labelsize) {
imgs->labelsize_max = labelsize;
Expand All @@ -579,8 +582,11 @@ static int alg_labeling(struct context *cnt)
"Largest Label: %i", imgs->largest_label, imgs->labelsize_max,
cnt->current_image->total_labels);

/* Return group of significant labels. */
return imgs->labelgroup_max;
/* Return group of significant labels or if that's none, the next largest
* group (which is under the threshold, but especially for setup gives an
* idea how close it was).
*/
return imgs->labelgroup_max ? imgs->labelgroup_max : max_under;
}

/**
Expand Down
26 changes: 26 additions & 0 deletions conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct config conf_template = {
contrast: 0,
saturation: 0,
hue: 0,
power_line_frequency: -1,
roundrobin_frames: 1,
roundrobin_skip: 1,
pre_capture: 0,
Expand Down Expand Up @@ -460,6 +461,22 @@ config_param config_params[] = {
print_int
},
{
"power_line_frequency",
"# Set the power line frequency to help cancel flicker by compensating\n"
"# for light intensity ripple. (default: -1).\n"
"# This can help reduce power line light flicker.\n"
"# Valuse :\n"
"# do not modify the device setting : -1\n"
"# V4L2_CID_POWER_LINE_FREQUENCY_DISABLED : 0\n"
"# V4L2_CID_POWER_LINE_FREQUENCY_50HZ : 1\n"
"# V4L2_CID_POWER_LINE_FREQUENCY_60HZ : 2\n"
"# V4L2_CID_POWER_LINE_FREQUENCY_AUTO : 3",
0,
CONF_OFFSET(power_line_frequency),
copy_int,
print_int
},
{
"roundrobin_frames",
"\n############################################################\n"
"# Round Robin (multiple inputs on same video device name)\n"
Expand Down Expand Up @@ -651,6 +668,15 @@ config_param config_params[] = {
print_string
},
{
"ffmpeg_duplicate_frames",
"# True to duplicate frames to achieve \"framerate\" fps, but enough\n"
"duplicated frames and the video appears to freeze once a second.",
0,
CONF_OFFSET(ffmpeg_duplicate_frames),
copy_bool,
print_bool
},
{
"output_debug_pictures",
"# Output pictures with only the pixels moving object (ghost images) (default: off)",
0,
Expand Down
2 changes: 2 additions & 0 deletions conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct config {
int max_changes;
int threshold_tune;
const char *output_pictures;
int ffmpeg_duplicate_frames;
int motion_img;
int emulate_motion;
int event_gap;
Expand All @@ -53,6 +54,7 @@ struct config {
int contrast;
int saturation;
int hue;
int power_line_frequency;
int roundrobin_frames;
int roundrobin_skip;
int pre_capture;
Expand Down
2 changes: 1 addition & 1 deletion ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# warning Your version of FFmpeg is newer than version 0.4.8
# warning Newer versions of ffmpeg do not support MPEG1 with
# warning non-standard framerate. MPEG1 will be disabled for
# warning normal video output. You can still use mpeg4 and
# warning normal video output. You can still use mpeg4
# warning and mpeg4ms which are both better in terms of size
# warning and quality. MPEG1 is always used for timelapse.
# warning Please read the Motion Guide for more information.
Expand Down
5 changes: 2 additions & 3 deletions jpegutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ int decode_jpeg_gray_raw(unsigned char *jpeg_data, int len,
unsigned int height, unsigned char *raw0,
unsigned char *raw1, unsigned char *raw2)
{
int numfields, hsf[3], field, yl, yc, xsl, xsc, xs, xd, hdown;
int numfields, field, yl, yc, xsl, xsc, xs, xd, hdown;
unsigned int x, y, vsf[3];

JSAMPROW row0[16] = { buf0[0], buf0[1], buf0[2], buf0[3],
Expand Down Expand Up @@ -818,8 +818,7 @@ int decode_jpeg_gray_raw(unsigned char *jpeg_data, int len,
guarantee_huff_tables(&dinfo);
jpeg_start_decompress (&dinfo);

hsf[0] = 1; hsf[1] = 1; hsf[2] = 1;
vsf[0]= 1; vsf[1] = 1; vsf[2] = 1;
vsf[0] = 1; vsf[1] = 1; vsf[2] = 1;

/* Height match image height or be exact twice the image height. */

Expand Down
Loading