Commit Graph

115 Commits

Author SHA1 Message Date
Cedric BAIL 382c580182 evas: add support for .9.png file to PNG loader.
This support Android 9 patch file format. Only black is a recognized color for both
the stretch area and the content area. All other color are associated with being
"white".

Reviewed-by: Hermet Park <hermetpark@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9103
2019-07-12 09:54:18 -07:00
Cedric BAIL ce076d1323 evas: break Image_Loader API to allow for getting property from the data field of an image.
Reviewed-by: Hermet Park <hermetpark@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9101
2019-07-12 09:54:14 -07:00
Cedric BAIL 9f35c74d9d evas: break Evas_Loader API and introduce a version numbering for Image_Loader.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hermet Park <hermetpark@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9099
2019-07-12 09:54:11 -07:00
Vincent Torri 24e4881efb Evas: remove Evil.h when not needed and use evil_private when needed
Test Plan: compilation

Reviewers: zmike, raster, cedric

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8921
2019-05-20 08:46:02 -04:00
Hermet Park 7ef58f9581 evas png: apply interpolation when scale down image loading.
Summary:
This patch improves png quality when image uses scale-down at image loading.

Since current scale-down logic just works like point sampling,
image result could be wholely different,

Simply, if source data is consist of continous white and black pixels,
and scale down factor is 2, the sampled data would be only white,
and lose all black pixels, or vice versa.

The result can be unexpected by users.
Even current jpeg scale-down works with interpolation.

Before:
{F3711651}

After:
{F3711652}

Original:
{F3711653}

Reviewers: cedric, raster, #committers, kimcinoo, jsuya

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8788
2019-05-13 15:47:22 +09:00
Hermet Park ebd8b21d30 Revert "evas png: apply interpolation when scale down image loading."
This reverts commit 53cdf850ba.

It's still on reviewing, I didn't intend submitting.
2019-05-02 20:19:24 +09:00
Hermet Park 53cdf850ba evas png: apply interpolation when scale down image loading.
Summary:
This patch improves png quality when image uses scale-down at image loading.

Since current scale-down logic just works like point sampling,
image result could be wholely different,

Simply, if source data is consist of continous white and black pixels,
and scale down factor is 2, the sampled data would be only white,
and lose all black pixels, or vice versa.

The result can be unexpected by users.
Even current jpeg scale-down works with interpolation.

Before:
{F3711651}

After:
{F3711652}

Original:
{F3711653}

Reviewers: cedric, raster, #committers, kimcinoo, jsuya

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8788
2019-05-02 17:02:00 +09:00
Hermet Park 1f438bd1f0 evas png loader: optimize scale down logic.
Previously, mannual scale down logic was too primitive,
it copied pixel data each channels. Obviously, it's ineffective.

We know the general case - 4 bytes channel which is the most usage,
If loader copies data per four bytes, instructions could be reduced.

When I load scale-downed image(original 8k), about 0.02 secs was reduced by this.
2019-04-29 20:02:34 +09:00
Hermet Park 808df5ecc2 evas wbmp: fix wrong calc order.
Double check patch again, since my wrong logical thinking,
Every width must be considered to rounding up fiting 8 bits.
this new compuation must be correct.
2019-04-24 14:03:37 +09:00
Hermet Park bffce65f9c evas wbmp loader: coming previous patch with fixing wrong calc.
Those bits must be rounded if they are not fit to 8 bits.

see: 68fe9ec6bf
2019-04-24 10:18:57 +09:00
Hermet Park 54754ab878 Revert "evas-wbmp: revert previous two patches"
This reverts commit 0ebf41c003.
2019-04-24 10:10:36 +09:00
Mike Blumenkrantz 0ebf41c003 evas-wbmp: revert previous two patches
Revert "evas wbmp: remove unnecessary size overflow."
This reverts commit 1061d0a751.
Revert "evas image: check format more strong way for wbmp."
This reverts commit 68fe9ec6bf.

this caused wbmp files to no longer be loadable

ref T7824

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8689
2019-04-23 17:48:41 +02:00
Hermet Park 1061d0a751 evas wbmp: remove unnecessary size overflow.
since this patch 68fe9ec6bf
it checks size validation earlier,
this varification doesn't need anymore...
2019-04-23 21:33:40 +09:00
Hermet Park 68fe9ec6bf evas image: check format more strong way for wbmp.
wbmp format doesn't have any tags for verifying file header,
It's easy to pass other format headers if they have the first 1 byte 0x0,

This ocassionally brings wrong result (= succeeed loading image),
if unknown file format is tried.

So, to make it sure, here verify the size of image additionally.
if the image size is not expected, It returns fail as the result.

This problem is actually happened in this scenario.

open any mpeg file with elm_image.
elm_image_file_set() will return true though it fails to read data.
since wbmp make it pass to succeed.

@fix
2019-04-23 19:19:07 +09:00
Marcel Hollerbach 46d464e5bf here comes meson
a new shiny buildtool that currently completes in the total of ~ 4 min..
1 min. conf time
2:30 min. build time
Where autotools takes:
1:50 min. conf time
3:40 min. build time.

meson was taken because it went quite good for enlightenment, and is a traction gaining system that is also used by other mayor projects. Additionally, the DSL that is defined my meson makes the configuration of the builds a lot easier to read.

Further informations can be gathered from the README.meson

Right now, bindings & windows support are missing.

It is highly recommented to use meson 0.48 due to optimizations in meson
that reduced the time the meson call would need.

Co-authored-by: Mike Blumenkrantz <zmike@samsung.com>

Differential Revision: https://phab.enlightenment.org/D7012
Depends on D7011
2018-10-02 17:22:50 +02:00
Pawel Aksiutowicz 56abebf236 evas: remove warning from image_loaders/png/evas_image_load_png
Reviewers: stanluk, lukasz.stanislawski, cedric

Reviewed By: cedric

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5501

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2017-11-23 15:43:38 -08:00
Carsten Haitzler 6cd3d4026c jp2k module - dont print ERR on llading if format wrong
this is normal - brute force trying loaders until one succeeds is
normal is etn doesnt help identify it or it fails the first
guess-by-extension. printing errors is not good as this is an ok and
EXPECTED error. slience!

@fix
2017-10-16 08:42:13 +09:00
Prince Kumar Dubey 41197981ab efl: unsigned int/long never be less than zero. Fixed.
Reviewers: raster, cedric

Subscribers: rajeshps, jpeg

Differential Revision: https://phab.enlightenment.org/D5300

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2017-10-13 12:07:28 -07:00
Vincent Torri 0cdd501246 EFL For WIN32: Replace HAVE_EVIL define with _WIN32 2017-09-22 05:06:10 -05:00
Vincent Torri db29ee1cd6 Evas Jpeg2000 loader: port it to openjpeg 2.*
Test Plan: files in https://github.com/uclouvain/openjpeg-data/tree/master/baseline/nonregression

Reviewers: jpeg, raster, cedric

Differential Revision: https://phab.enlightenment.org/D5033
2017-08-08 11:46:35 +09:00
Carsten Haitzler 157caee2c0 evas psd loader - remove unneeded extra check in if
one if condition is always true by virtual of previous if statements
and drop-through so can remove. not actually any bug but analysers
don't like it

found by PVS studio
2017-07-29 10:37:51 +09:00
Carsten Haitzler c0764e153e evas git loader - move findo reset inside else as only that changes it
only the else changes finfo so reset inside there. not really any bug
at all byt style-wise a bit better and analysers don't like it

found by PVS studio
2017-07-29 09:42:44 +09:00
Carsten Haitzler 2930bc0b06 evas pmap loader - remove pointless extra assign of end of string to 0
not an actual bug - just analysis impacting

found by PVS studio
2017-07-29 09:08:40 +09:00
Carsten Haitzler 64dc6ab056 evas bmp loader - fix warnings about same type handled twice
so a type we handle earlir inan if we re-handle as invalid later. this
wouldnt lead to a crash or bugs as the if's would ned to be evaluated
in order normally, but it's good to get it right.

found by PVS studio
2017-07-29 09:08:40 +09:00
Carsten Haitzler 97c3eedbab evas xpm loader - don't error print for files that cant be mmaped
no point complaining because we can't mmap... it'd be an unloadable
file.
2017-07-21 16:35:21 +09:00
Carsten Haitzler 205ef8a756 evas xpm loader - remove tabs and clean up formatting
just non-code changes here...
2017-06-14 17:15:49 +09:00
Carsten Haitzler 4a9f28a677 evas xpm loader - remove the rgb txt file db loading and compile in
so modern systems seem to have abandoned rgb.txt files. this leads to
us breaking the loading of xpm files tha use color names ... i added
the rgbt.txt from vim but that didn't seem to help... odd... so to just
stop adding path after path to load... ship our own. we could ship the
file... but then we'd still have to load and parse it... every time we
look up a color. so i munged the data with awk and now we compile it
in. it should consume the same space the rgb.txt does in the shared lib
binary. if not read it shouldn't be paged in. it should end up cheaper
than our floaing of the file and mmaping it when xpm module is
loaded/initted... so either way more efficient, uses a little less ram
(12306 bytes vs 17780 for the rgb.txt) ... and bonus - dont have
an extenral out-of-code data blob to find, manage install etc...

this means we should load xpms with colornames correctly again on
systems without an rgb.txt provided by x11 ... which seems to be the
common case now. :(

@fix
2017-06-14 17:04:43 +09:00
Carsten Haitzler cc0e17d32b evas xpm loader - add more rgb.txt file locations...
2 more. /etc/X11/rgb.txt /usr/share/vim/vim80/rgb.txt  ...what i do notice
is that this file seems to have vanished from modern systems... so we'll have
lots of un-fun loading old xpm's with colornames if we cant figure out what
color names map to what colors...
2017-06-08 12:11:43 +09:00
Cedric BAIL 7832e02b2d evas: TGA does use switch case statement fallthrough to factorize code. 2017-06-05 12:07:57 -07:00
jiin.moon c89bf7b2d8 evas: Fix can't open tiff file on loader
Summary:
Evas can't open tiff file because of no implement in client read api.
I wrote codes simply for open.

Test Plan: self

Reviewers: jpeg, cedric, jypark

Subscribers: stefan_schmidt

Differential Revision: https://phab.enlightenment.org/D4857
2017-05-08 15:20:01 +02:00
Cedric BAIL 5420ebaf32 emile: rename emile_image_register to emile_image_callback_set.
This fix ABI report according to discussion on the mailing list.
2017-02-27 15:05:35 -08:00
Jaeun Choi 95d83e8040 evas: fix bugs in gif image loader
gif's logical screen size (which is considered the image size)
might be different from the size of each frame.
when decoding a frame, the width and height of the decoded data should be
based on the size of the frame, not on the size of the logical screen size.
if a frame is decoded into a buffer of screen size, this might happen

(frame = 6 X 3, logical screen = 5 X 3)
OOOXXX      OOOXX
OOOXXX  =>  XOOOX
OOOXXX      XXOOO

@fix
2017-02-13 14:28:43 +09:00
Carsten Haitzler b1aa6360e0 evas generic loader - expand buffers in case of weird install location
so we had just 128 bytes for path to generic loader utility. in most
cases this is plenty but if you have bizarre symlinks and long paths
we may run out of space, so move up to 4k buffers as this is
realistically the max path len anyway on a system.

@fix
2017-01-02 18:53:56 +09:00
Carsten Haitzler 9e01cf2698 evas image async preload - add option to also make header load async
to date if you use async preload we still load the header
synchronously and this can be horrible especially with generic
loaders. there is no way to farm this off to the preload thread. now
there is. youhave to set it as a skip head load option before doing a
file_set AND you need to issue a preload ... but now it's possible.

@feature
2017-01-02 18:53:56 +09:00
Cedric BAIL 68470a50fe evas: as an example make PMAPS decoding interruptible. 2016-12-06 16:34:48 -08:00
Cedric BAIL 365f79b7ee evas: use emile and evas new infrastructure to interrupt decoding of JPEG early. 2016-12-06 16:34:48 -08:00
Jaeun Choi b9965ffd8f evas: bug fix in bmp loader
when the DIB header is BITMAPINFOHEADER (size 40),
a bitmap file has alpha channel only if the compression method is BI_ALPHABITFIELDS (= 6).
the original code enabled alpha channel when the compression method was BI_RGB (= 0),
which made an opaque bmp image loaded as a transparent one.

@fix
2016-11-30 11:33:33 +09:00
Carsten Haitzler e146371ed9 evas modules - only unregister log domain if its registered
some modules did check, some didnt... but this makes them consistent
and silences and eina err log. :)
2016-11-17 18:41:31 +09:00
Jean-Philippe Andre be5381960b evas: Fix BMP load with region set and scale down
This fixes usage of photocam on large BMP images.
Follows previous commits by @jiin.moon.
2016-08-17 17:28:53 +09:00
Jean-Philippe Andre 0193e40d8c evas: Fix region test in jpeg load with region + zoom
The previous commit exposed an issue with the region test
does not take into account the scale down factor.

Not a @fix in itself, as it depends on the previous patch.
2016-08-17 17:28:53 +09:00
jiin.moon 922a1bcd9e evas: Add support for region load with PNG files
Summary:
PNG loader support  region_set when decoding
@feature

Reviewers: cedric, jpeg, jypark, raster

Subscribers: raster

Differential Revision: https://phab.enlightenment.org/D4165
2016-08-17 17:28:53 +09:00
jiin.moon a76fd7b37e evas: Support region_set for BMP image
Summary:
1) BMP loader support region decoding.
     @feature

2) Fix an issue what BMP loader can't decode an 16bit image with bit field
    @fix

Test Plan: attached sample codes

Reviewers: cedric, jpeg, jypark

Differential Revision: https://phab.enlightenment.org/D4228
2016-08-17 17:28:53 +09:00
Carsten Haitzler 9527240d74 efl - fix lots of little init/shutdown pairs that are wrong
i've fixed almost all the eina init/shutdown pairs to do the right
thing now... except one (ecore_shutdown) with comment inline where
eo_shutdown is not called. if this is called we are in crash land.
this needs further inspection.
2016-07-04 21:30:34 +09:00
Ji-Youn Park 830faf2502 evas_image_load_bmp: fix bug that image is not decoded, if image is not perfact. 2016-06-17 18:42:28 +08:30
Derek Foreman 34ce296cac psd_loader: Fix bad assumption about signedness of chars
Whether "char" is signed or unsigned is architecture dependent, so if we
know we need a -1 in a char type we must declared it to be signed.
2016-06-03 16:28:24 -05:00
Cedric BAIL 0c4880e99d efl: everyone should now rely on Eina MIN/MAX redefinition. 2016-05-09 16:58:53 -07:00
Carsten Haitzler db4ff548d3 evas - gif loader - handle missing colormap
follow on from dd90b6afad - this handled
if a gif file has no colormap (it'll decode as blank now as a colormap
of all 0's is used instead).

@fix
2016-04-04 09:51:12 +09:00
Carsten Haitzler f56e33f429 evas - gif loader - be a little more optimal in pixel lookups on decode 2016-04-02 13:32:36 +09:00
Carsten Haitzler dd90b6afad evas: gif loader - fix out of bounds access on cmap of invalid pixels
if gif has example 4 colors in colormap, pixels provided still can
hold values higher than 3 (4, 8, 255 etc.) ass a pixel is still a
byte. it should not, but it could. technically it'd be nice for gitlib
to pad its palette out to 256 entires to ensure this cant be a
problem, but it doesn't have to , so make a local copy of the cmap
when decoding pixels and pad out to 256 entires (using color 0 as any
value > pallette ize is invalid anyway so any color will do).

this fixes a possible security attack vector in reading memory out of
bounds of an allocated array. not very far out of bounds - but enough
to cause a crash - ie a dos attack, (not to inject code though).

@fix
2016-04-02 13:32:28 +09:00
Vincent Torri 0497b9685c efl: add binary mode to open() calls
This allows better compatibility with Windows

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-05 21:06:04 +01:00
Stefan Schmidt 6939963e76 gif loader: use Eina_Bool for one-bit bitfield
Make sure we are using a unsigned var here. Best go with a Eina_Bool directly.
2015-11-13 13:00:04 +01:00
Jean-Philippe Andre cc5cccc511 Eet: fix decoding of embedded ETC images
Typos, lack of NULL check, excessive sizeof(type) not matching
the object type, no border set, etc... This all lead to a crash
and then no render (with an error message and then without...).

This also simplifies the implicit loading of ETC1 as ETC2 when
supported by the driver.

@fix
2015-10-29 17:58:34 +09:00
Carsten Haitzler bdebfe7962 efl - jp2k loader - guard against openjpeg bug tha causes an abort
so... if you load a non-jp2k file using openjpeg, you can get an abort
deep inside the openjpeg library that we can't do anything about. we
set all error handlers but literally the openjpeg code has ab assert
there that causes this bug. it shouldn't and newer opengjpeg libs have
it removed, but 1.5.2 has it and this causes an untrappable crash.
this is simply bad behavior in openjpeg not allowing it to be used
safely to loade image files. the relevant backtrace:

    w=w@entry=0x7fffffffb548, h=h@entry=0x7fffffffb54c,
    alpha=alpha@entry=0x7fffffffb556 "", map=map@entry=0x7fff29ac2000,
    length=<optimized out>, error=error@entry=0x7fffffffb5bc,
    opts=<optimized out>)
    at modules/evas/image_loaders/jp2k/evas_image_load_jp2k.c:111

the relevant code in openjpeg:

int cio_numbytesleft(opj_cio_t *cio) {
  assert((cio->end - cio->bp) >= 0);
        return cio->end - cio->bp;
}

so that assert is triggered. and nothing can be done about it which is
pretty poor.

so an upgrade of openjpeg should fix this as in newer versions have
dropped the assert line in that function, but until poeople have that from
their distro, this adds magic number checks for file headers that avoids
using openjpeg if it's not "apparently" a jp2k file. this does not
stop a corrupt file or a maliciously designed file still causing this
problem, but it does just result in an abort() and isnn't seemingly an
overflow isse that can be exploted, so if you still suffer, find a way to
upgrade openjpeg to 2.x. until then... this reduces inadvertent damage.

@fix
2015-08-24 11:39:12 +09:00
Jean-Philippe Andre a8b4607968 Evas/psd: Remove commented-out debug code
Removing because it matches a grep of <<<< used for merge conflicts :)
2015-07-23 10:34:15 +09:00
Cedric BAIL d22155487b evas: get rid of clobbered warning. 2015-04-25 19:59:18 +02:00
Jean-Philippe Andre 64ca10bcf6 Evas DDS: Fix clang warning
This one was almost a real catch by clang. Too bad we don't actually
support DXT3.
2015-04-21 20:11:02 +09:00
Jaeun Choi a09fccd88b evas: restore the value of "do_region" in jpeg loader as EINA_TRUE
this was an unwanted change from 1ab8cc75c4

@fix
2015-04-17 17:09:51 +09:00
Cedric BAIL 1ab8cc75c4 evas: use emile to decompress JPEG files. 2015-03-17 09:58:18 +01:00
Cedric BAIL b900e1787f evas: simplify structure. 2015-03-17 09:58:18 +01:00
Cedric BAIL a865d41181 emile: remove use of custom structure and prefer Eina_Rectangle.
Get rid of warning inside of the jpeg loader that result of it. I do believe
this is not an ABI break on the loader API. If you disagree, please raise your
voice.
2015-03-17 09:58:18 +01:00
Cedric BAIL 8cac4ce5e7 evas: use Emile to decode TGV. 2015-03-17 09:58:18 +01:00
Chris Michael 17a47136c9 evas-image-loaders: Fix compiler warning of comparison between signed
and unsigned values

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-01-27 11:04:51 -05:00
Cedric BAIL 154e5103c6 evas: fix signed/unsigned warning.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-01-26 11:22:33 +01:00
jiin.moon 0a758d10c9 evas: fix to load BMP file compressed with RLE.
Summary:
If the file size of RLE compressed image is bigger than original image,
BMP loader doesn't work as well.
@fix

Reviewers: Hermet, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1892

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-01-26 11:21:37 +01:00
Bogdan Devichev 043055fc8e evas: preparation of places for model_saver_loader separated from image_saver_loader. 2014-12-23 21:13:43 +01:00