11 Commits

Author SHA1 Message Date
Tristan Matthews
24d2c9de3d yuvjpeg: fix NULL dereference on invalid format string
(cherry picked from daala commit 82e51ebb8545d99316dbeaeeef3d7b5a929702e8)
2016-07-15 10:58:32 -04:00
Kornel
e4e091a184 Merge pull request #207 from mozilla/jpg-yuv-cleanup
Cleanup for jpegyuv and yuvjpeg
2016-05-25 17:30:36 +01:00
Josh Aas
5e01695e2d Cleanup for jpegyuv and yuvjpeg 2016-05-25 13:36:12 +02:00
Tristan Matthews
0fb7725000 Drop unused includes from jpegyuv and yuvjpeg 2015-07-02 16:29:07 -04:00
Arjun Sreedharan
6c1538470f yuvjpeg: fix memory leak when @image_buffer allocation fails
Make sure @yuv_buffer is freed before return.

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
2015-04-25 02:17:45 +05:30
DRC
9cb270a216 Use mozjpeg defaults by default
Since mozjpeg is now backward ABI-compatible with libjpeg[-turbo], it is now
possible to temporarily load mozjpeg into a binary application and cause that
application to generate uber-compressed JPEGs (at the expense of an extreme
performance loss, of course.)  For instance, someone could do

LD_LIBRARY_PATH=/opt/mozjpeg/lib convert blah_blah_blah

to make ImageMagick use mozjpeg instead of the system's pre-installed JPEG
library (libjpeg-turbo, in most cases.)  However, this only makes sense if
mozjpeg is actually producing different behavior by default than libjpeg-turbo.
Currently it isn't.  Currently it requires the application to set
JBOOLEAN_USE_MOZ_DEFAULTS to TRUE in order to enable the mozjpeg-specific
behavior, but of course applications that were built to use libjpeg[-turbo]
won't do that.  Thus, this patch sets use_moz_defaults to TRUE by default,
requiring an application to explicitly set it to FALSE in order to revert to
the libjpeg[-turbo] behavior (makes sense, since the only applications that
would need to revert to the libjpeg[-turbo] behavior would be mozjpeg-aware
applications.)

Note that we discussed the possibility of adding a function
(jpeg_revert_defaults()), which would act the same as jpeg_set_defaults() does
in libjpeg[-turbo].  This is a good solution for implementing the -revert
switch in cjpeg, but unfortunately it doesn't work for jpegtran.  The reason
is that jpeg_set_defaults() is called within the body of
jpeg_copy_critical_parameters(), which is part of the API.  So yet again,
if mozjpeg were loaded into a non-mozjpeg-aware application at run time, it
would be desirable for jpeg_copy_critical_parameters() to set the parameters
to mozjpeg defaults.  That means that, in order to implement the -revert
switch in jpegtran, it would be necessary to introduce a new function
(jpeg_revert_critical_parameters(), perhaps).  It seems cleaner to just keep
using the JBOOLEAN_USE_MOZ_DEFAULTS parameter to control the behavior of
jpeg_set_defaults(), even though this represents a minor abuse of the libjpeg
API (jpeg_set_defaults() is technically supposed to set all of the parameters
to defaults, irrespective of any previous state.  However, as long as we
document that JBOOLEAN_USE_MOZ_DEFAULTS works differently, then it should be
OK.)
2014-11-19 23:31:20 -06:00
DRC
db2986c96f Restore backward ABI compatibility with libjpeg/libjpeg-turbo by moving the mozjpeg-specific parameters into the opaque jpeg_comp_master struct and implementing generic accessor functions for getting/setting those parameters. These functions can be used upstream, if the need for them arises in libjpeg-turbo, and they can also be easily extended to cover future extensions to the decompressor. Note that, in order to use jpeg_comp_master as a repository for extension parameters, cinfo->master is now allocated within the body of jpeg_CreateCompress(). It is later re-allocated in jinit_c_master_control(), because that function (and others in jcmaster.c) use an extended form of jpeg_comp_master, but the existing extension parameters are copied into the new master instance. Similar modifications would need to be made to the decompressor to support the same type of extension framework. 2014-11-04 01:58:52 -06:00
Josh Aas
39bd663c71 Add error checks for malloc calls that don't already have them. Issue #87. 2014-08-07 22:42:08 -05:00
Tristan Matthews
3a379eda44 yuvjpeg: fix trivial leak
Cherry-picked from daala 91c1dfd8ec30fda886c31f00678eaf074e3e4a6c
2014-08-06 20:52:23 -04:00
Nathan E. Egge
d47fa82ae8 Updating yuvjpeg and jpegyuv to match Daala tools.
Add support for jpeg images with non-multiple of 16 sizes.
2014-07-07 13:46:59 -04:00
Nathan E. Egge
7448ab4e82 Adding yuvjpeg and jpegyuv utilities. 2014-03-05 14:01:25 -05:00