Commit Graph

27 Commits

Author SHA1 Message Date
Maryla
780db75618 Update Windows makefile to build libsharpyuv library.
Change-Id: I2d260aa11c06ba1c33e40e94537f5a9afe5d3880
2022-10-05 14:21:35 +02:00
Maryla
e8f83de286 Set libsharpyuv include dir to 'webp' subdirectory.
Change-Id: I57cf12fd3d544485312fb0342aac3dcf5585136f
2022-08-19 10:22:30 +02:00
James Zern
62b1bfe8bd Merge changes I2877e7bb,I777cad70,I15af7d1a,I686e6740,If10538a9, ... into main
* changes:
  picture_csp_enc.c: remove SafeInitSharpYuv
  sharpyuv: prefer webp/types.h
  sharpyuv,SharpYuvInit: add mutex protection when available
  sharyuv_{neon,sse2}.c: merge WEBP_USE_* sections
  add a few missing <stddef.h> includes for NULL
  sharpyuv.h: remove <inttypes.h>
2022-08-17 18:13:09 +00:00
James Zern
6af8845a8f sharpyuv: prefer webp/types.h
this provides better compatibility for older Visual Studio versions;
stdint.h is a part of C99.

this is consistent with the core libwebp library:
8fbb9188 prefer webp/types.h over stdint.h

Change-Id: I777cad70d9a407646c4193db9ca0f09e65d88735
2022-08-12 10:55:39 -07:00
James Zern
639619ce72 cmake: fix dll exports
move WEBP_EXTERN definition from Makefile.vc to webp/types.h using the
existing WEBP_DLL define to control its declaration to
__declspec(dllexport); the same is done for SHARPYUV_EXTERN

Change-Id: Iecea360305bdd19a878255470a00b9dcc344c730
2022-08-11 19:33:37 -07:00
James Zern
782ed48cd3 sharpyuv,SharpYuvInit: add mutex protection when available
this is similar to WEBP_DSP_INIT and avoids the potential for a race in
initializing the function pointers and gamma table

Change-Id: I15af7d1a3e92c42eaa735751ca33eba0d1e83283
2022-08-11 18:58:40 -07:00
James Zern
cad0d5adb6 sharyuv_{neon,sse2}.c: merge WEBP_USE_* sections
Change-Id: I686e6740717902d632fb01f9151e47fd3cb2cf79
2022-08-11 17:48:11 -07:00
James Zern
ef70ee06fa add a few missing <stddef.h> includes for NULL
and remove unused includes in sharpyuv/

Change-Id: If10538a994bd5dc55126f1485f2b163933ad8e91
2022-08-11 17:39:48 -07:00
James Zern
f0f9eda406 sharpyuv.h: remove <inttypes.h>
this hasn't been needed since:
93c54371 sharpyuv: add support for 10/12/16 bit rgb and 10/12 bit yuv.

Change-Id: I02051e8b576d7fd27824e13be0d087dc4e18209e
2022-08-11 17:18:49 -07:00
Christopher Degawa
7deee8103e
libsharpyuv: add pkg-config file
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I872cd62ccdf096044c7921afda8289849d141531
2022-08-02 15:46:19 -05:00
Maryla
a3b68c195e Build libsharpyuv as a full installable library.
Headers are installed in a "sharpyuv" subdirectory of the webp
dir, e.g. /usr/local/include/webp/sharpyuv/
Remove unnecessary dependency from sharpyuv to webp/types.h

Add SHARPYUV_EXTERN so that only symbols meant to be public
are exported.

Sharpyuv users can use the library with:

find_package(WebP)
if(TARGET WebP::sharpyuv)
  # ... use WebP::sharpyuv
endif()

Change-Id: I602a25521a135a2edc39d6587610484fe6447ec5
2022-07-28 12:31:59 +00:00
Maryla
f83bdb5251 libsharpyuv: add version defines
Change-Id: I2dbe69d1ce5abaf7f5bd83daec99655520b5abad
2022-06-28 11:08:14 +02:00
Maryla
ec9e782a35 sharpyuv: remove minimum image size from sharpyuv library
libwebp still has a size threshold of 4 pixels in picture_csp_enc.c
but the sharpyuv library itself can handle any image size.

Change-Id: Ic1c78c8f8fae528395fa46a74f717f47cb13098e
2022-06-14 14:55:12 +02:00
Maryla
2d607ee646 sharpyuv: increase precision of gamma<->linear conversion
Change-Id: I261bae3628315bda4ec0dafb8798c7512dd03a36
2022-06-01 15:38:44 +02:00
Maryla
266cbbc511 sharpyuv: add 32bit version of SharpYuvFilterRow.
This allows increasing intermediate value precision from 10 bits to 14 bits.

Change-Id: I0fc33400d200a849bcc2c677ab8346215a9dbc3b
2022-06-01 13:42:29 +02:00
Maryla
93c5437115 sharpyuv: add support for 10/12/16 bit rgb and 10/12 bit yuv.
10bit+ input is truncated to 10bits for now.

Change-Id: I7ac00ca54c623d94c76ccd8954418e11095997d2
2022-05-23 20:48:44 +02:00
Maryla
d3006f4b96 sharpyuv: slightly improve precision
- Remove SHALF constant so that we get back the original value when
  calling UpScale then downscale with rounding
- Make the linear->gamma precomputed table bigger (8 bits rather than 5)
- Round values in kLinearToGammaTabS

Change-Id: Ic9634d32cf93de321d2f6e9e4cad7f156d8d07df
2022-05-17 10:36:44 +02:00
James Zern
a3927cc800 sharpyuv.c,cosmetics: fix indent
+ a few typos in sharpyuv_csp.c

Change-Id: I34b208d10d7808b42afb39b0618fb2e5d76633eb
2022-05-11 11:53:25 -07:00
Maryla
0c8b0e67a4 sharpyuv: cleanup/cosmetic changes
Remove unused constants.
Use ALL_CAPS for defines and kCamelCase for static const values.
Change some defines into static constants if they are not used in array sizes.

Change-Id: I036b0f99215fd0414a33f099bd6b809ff8ee4541
2022-05-09 15:10:14 +02:00
Frank Barchard
8f4b5c62b7 Fix typo in color constants: Marix -> Matrix
Change-Id: Ia5dc8b37ea7ddbb3dba923e24ef07633edb822eb
2022-04-11 14:54:43 -07:00
James Zern
ed643f619d Merge changes I452d2485,Ic6d75475 into main
* changes:
  SharpYuvComputeConversionMatrix: quiet int->float warnings
  Makefile.vc: add sharpyuv_csp.obj to SHARPYUV_OBJS
2022-04-11 18:54:25 +00:00
Maryla
8fa053d134 Rename SharpYUV to SharpYuv for consistency.
Change-Id: I21df96b4c8f8fa97bfd2ac9c806c7e5119b55691
2022-04-11 11:55:10 +02:00
James Zern
99a8756201 SharpYuvComputeConversionMatrix: quiet int->float warnings
under some versions of visual studio:
sharpyuv\sharpyuv_csp.c(43): warning C4244: '=': conversion from 'int' to
'float', possible loss of data
sharpyuv\sharpyuv_csp.c(35): warning C4244: 'initializing': conversion from
'int' to 'float', possible loss of data

Change-Id: I452d24857b43b8a80fae0f339163b4b3965f2d9f
2022-04-09 11:07:09 -07:00
Maryla
01a05de1a7 libsharpyuv: add colorspace utilities
Change-Id: I620c8593dc81f39e747de5ed354332adb7278bed
2022-04-08 10:07:22 +02:00
Maryla
841960b670 Make libsharpyuv self-contained by removing dependency on cpu.c
Change-Id: I2edac1afa38bfddf2a91e7829e38425bd3519feb
2022-03-30 15:04:35 +02:00
Maryla
7a68afaac5 Let SharpArgbToYuv caller pass in an RGB>YUV conversion matrix.
Change-Id: I4ed2dfc00ce63361abd49c693f31f307e0b0262f
2022-03-24 16:37:47 +01:00
Maryla
29cc95ce4c Basic version of libsharpyuv in libwebp, in C.
It's self contained apart from a dependency on src/webp/types.h and src/dsp/cpu.h
For now it's only set up as an internal library, not an installable one.
Webp doesn't depend on it yet, the code is only duplicated.

Change-Id: I752799894f9d4105d0d296ddebd9f9641181a1ec
2022-02-18 14:52:44 +00:00