Commit Graph

198 Commits

Author SHA1 Message Date
Peter Keresztes Schmidt 8f685b3d66 Box+Poly: Remove direct accessors to {Hi,Lo}{X,Y} 2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt e6c159fb70 Vector2: Make coordinate components public
The components were already unconditionally/without side-effects writable. Let's make them public so we don't need the setters.
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt 60db1c2eaf Coord: Rename to Vector2
The class is not only used to represent coordinates but also lengths in XY.
Vector2 is a more fitting/general name for this purpose.
2021-05-14 20:14:50 +02:00
Isaac Connor bc6ba0a772 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-05-03 13:18:51 -04:00
Isaac Connor 8bd876d8c8 improve warning message to include the values that don't match 2021-05-03 13:18:39 -04:00
Isaac Connor 90dff85e40 Only default to BGRA when colours are > 1. 2021-05-03 13:17:58 -04:00
Peter Keresztes Schmidt e5ceed31cc Image: Fix a typo introduced in 3f5dbb7780 2021-05-02 23:22:49 +02:00
Isaac Connor 3f5dbb7780 Default to rgba when subpixelorder is not specified 2021-05-02 14:07:29 -04:00
Isaac Connor ad388e9fc5 Free up encodejpg_ccinfo in Deinitialize 2021-05-01 14:49:33 -04:00
Peter Keresztes Schmidt 68bedfe48f Fix logging format string mismatches
* Remove SZFMTD format macro and use %zu instead for size_t. %zu is understood by every compiler nowadays.
2021-04-30 00:26:24 +02:00
Peter Keresztes Schmidt 36205258c0 Image: Fix crash in Annotate in GRAY8 and RGB24 mode
Actually advance the image buffer pointer by one image line when looping through the codepoint lines.
2021-04-27 21:11:50 +02:00
Peter Keresztes Schmidt 3020acf994 ZmFont: Store character padding in font file
The size/variant specific character padding should be stored with the font data.
Modify the FontBitmapHeader accordingly and introduce a version field in the FontFileHeader
so we are able to check we have a font file with the right structure associated with that version.

The version field is set to 1 in this changeset.
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt a918e8aeba Image: Modernize Annotate method 2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt 0c939f45dd ZmFont: Rework/modernize API 2021-04-25 23:13:21 +02:00
Isaac Connor aad3b243c7 initialize padding 2021-04-20 14:10:33 -04:00
Isaac Connor bb0741dc6f Add missing initializers 2021-04-20 12:59:19 -04:00
Peter Keresztes Schmidt 4894c319cc Image: Fix Wtype-limits warnings in zm_convert_yuyv_rgb
The intermediate values can be negative. Change the variables to be signed so the clamping later on works correctly.
2021-04-12 08:58:57 +02:00
Peter Keresztes Schmidt 11cfa86de3 Image: Fix Wtype-limits warnings in Annotate
line[c] is a char. There is no possibility for it to be larger than 0xff. Remove these checks.
2021-04-12 08:58:56 +02:00
Peter Keresztes Schmidt b5f3682d4e utils: some more reshuffling/grouping and formatting 2021-04-04 01:18:34 +02:00
Isaac Connor bcd0e84a31 do sws_scale from decoded image to Image using a member context and avframe to save a few cycles 2021-04-01 13:22:57 -04:00
Isaac Connor 1c9bc5c27f code doc and spacing 2021-04-01 11:51:18 -04:00
Peter Keresztes Schmidt 4e8c7d1f7c Eliminate non-thread-safe calls to localtime
localtime uses an internal static storage to which a pointer is given as return value.
Due to this it is not safe to call localtime from multiple threads since the same static storage is used.

Use localtime_r instead which allows to pass in a tm struct.

Fixes:
https://github.com/ZoneMinder/zoneminder/security/code-scanning/24
https://github.com/ZoneMinder/zoneminder/security/code-scanning/25
https://github.com/ZoneMinder/zoneminder/security/code-scanning/26
https://github.com/ZoneMinder/zoneminder/security/code-scanning/27
https://github.com/ZoneMinder/zoneminder/security/code-scanning/28
https://github.com/ZoneMinder/zoneminder/security/code-scanning/30
https://github.com/ZoneMinder/zoneminder/security/code-scanning/31
https://github.com/ZoneMinder/zoneminder/security/code-scanning/33
https://github.com/ZoneMinder/zoneminder/security/code-scanning/58
https://github.com/ZoneMinder/zoneminder/security/code-scanning/59
https://github.com/ZoneMinder/zoneminder/security/code-scanning/63
https://github.com/ZoneMinder/zoneminder/security/code-scanning/64
https://github.com/ZoneMinder/zoneminder/security/code-scanning/65
2021-03-21 21:42:02 +01:00
Peter Keresztes Schmidt d9568a98c0 Drop zm_thread which has been replaced by STL implementations 2021-03-04 10:55:46 +01:00
Isaac Connor 57585e4986 Not sure why raw_fd should be static... 2021-03-01 16:46:48 -05:00
Peter Keresztes Schmidt 76e6c468e8 rgb: Convert some constant defines to constexpr
Using defines interferes with fmt.
Also rename them according to the Google styleguide.
2021-03-01 00:38:21 +01:00
Isaac Connor 224fcd2cd3 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-02-25 14:58:45 -05:00
Isaac Connor d8e37945a3 TRY OUT SWS_POINT|SWS_BITEXACT scaling 2021-02-19 13:44:37 -05:00
Isaac Connor d85e4121ef set pts of dest_frame to make debug less confusing 2021-02-19 12:44:24 -05:00
Isaac Connor 0b0df96271 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-02-18 16:05:10 -05:00
Isaac Connor 99264e4072 Fix swscale failing on resolution change. Fixes #3161 2021-02-12 11:55:25 -05:00
Isaac Connor fab7efa003 Fix PrimeCapture on local cams. We need to be able to call it for each monitor 2021-02-09 20:29:37 -05:00
Peter Keresztes Schmidt 9dc3f15eac Image: Replace qsort with std::sort
std::sort has stricter complexity requirements than qsort and can be better optimized
by the compiler due to templating.
2021-02-06 15:41:56 +01:00
Peter Keresztes Schmidt 0dbc39ee25 Cleanup and reorganize includes
With this commit a unified structure for includes is introduced.
The general rules:
 * Only include what you need
 * Include wherever possible in the cpp and forward-declare in the header

 The includes are sorted in a local to global fashion. This means for the include order:
  0. If cpp file: The corresponding h file and an empty line
  1. Includes from the project sorted alphabetically
  2. System/library includes sorted alphabetically
  3. Conditional includes
2021-02-04 18:02:01 +01:00
Peter Keresztes Schmidt 5a57efdfe2 Replace deprecated C header includes with the C++ ones. 2021-02-04 05:39:03 +01:00
Isaac Connor f868d92269 Fix colour shift in Crop function due to not multiplying x position by colours 2021-02-02 23:19:53 -05:00
Isaac Connor 7e469a28fa remove redundant code, code style and remove some unnecessary multiplies 2021-02-02 23:19:53 -05:00
Isaac Connor b47d2428da Minor code, debugging improvements 2021-01-30 20:34:39 -05:00
Isaac Connor 7cc21b0d0b Always load AvFrame to RGBA 2021-01-26 12:22:07 -05:00
Isaac Connor 0f7c46e2cc Merge branch 'master' into zma_to_thread 2021-01-15 14:56:00 -05:00
hax0kartik 6845c2cab4 Fix padding issue in timestamp code 2021-01-15 11:46:30 +05:30
Isaac Connor f3c4bb0027 Add AVBufferRef setup when Populating AVFrame from Image. This allows hwtranfer to work because it relies on AVBuffer AVFrame. Please note that we don't want AVBuffer to free the buffer so we pass an empty function to it. 2021-01-11 13:46:50 -05:00
Isaac Connor 9fb8e51ff2 Set imagePixFormat everywhere. Add PopulateFrame which creates and AVFrame pointing to the image's buffer. Will do this with proper refcounting eventually 2021-01-11 13:46:50 -05:00
Isaac Connor ee8f940acf Add some debug 2020-12-23 18:18:16 -05:00
Isaac Connor 39212d8ca0 Remove or increase debug level 2020-12-15 15:59:22 -05:00
Isaac Connor b261fbb397 Merge branch 'master' into zma_to_thread 2020-12-07 16:26:26 -05:00
hax0kartik 8012438573 Fix font rendering issue 2020-12-04 05:22:54 +05:30
Isaac Connor b2e5df1854 Need to -1 to size parameter when calling SetFontSize 2020-12-03 18:31:41 -05:00
Isaac Connor 1bbcf4ea31 spacing and make assignments a little more readable/efficient maybe 2020-12-03 16:43:27 -05:00
Isaac Connor cfd4c17953 Include invalid font path in the error message 2020-12-03 13:35:12 -05:00
Isaac Connor 836cd2d58d Merge branch 'Font' of https://github.com/hax0kartik/zoneminder into font 2020-11-30 09:45:39 -05:00