I remove white space and using alloca.

But I can't explain why I change dst ptr and source ptr name and use char ptr.
I also don't know why I did. --;;
Anyway I modify code and make new patch.
Thanks.

-----Original Message-----
From: Carsten Haitzler (The Rasterman) [mailto:[email protected]] 
Sent: Thursday, October 13, 2011 7:02 PM
To: Enlightenment developer list
Cc: Jiyoun Park
Subject: Re: [E-devel] [Patch] Add scale down decoding feature to evas png 
loader

On Mon, 03 Oct 2011 18:12:41 +0900 Jiyoun Park <[email protected]> said:

small things:

+        ie->w = (int) w32 / ie->load_opts.scale_down_by ;
+        ie->h = (int) h32 / ie->load_opts.scale_down_by ;
+        if((ie->w < 1) || (ie->h < 1))

!!! spaces (before ; and after if)

in allocation of tmp_line -> no check for malloc failure. you could use alloca 
as it might be reasonable to be on the stack for most line sizes (below 64kb 
anyway - though stack sizes can be limited by os or environment to anything).

also the last 2 if (scale_ration == 1)... else ... sections can be simplified 
and merged into a single if/else instead of 2 of them.

also... 

+             for (j = 0; j < w; j++)
+               {
+                  src_ptr[0] = dst_ptr[0];
+                  src_ptr[1] = dst_ptr[1];
+                  src_ptr[2] = dst_ptr[2];
+                  src_ptr[3] = dst_ptr[3];
+                  src_ptr += 4;
+                  dst_ptr += scale_ratio * 4;
+               }

eh? explain this to me. you use src_ptr as the destination and dst_ptr as the 
src? .... (oops!) and why use unsigned char * and copy byte-by-byte when you 
could just use unsigned int or DATA32 * and copy 1 pixel at a time in 1 go (and 
increment source by 1 with src_ptr++ and dst_ptr += scale_ratio) :)

> Hello. 
> I add scale down decoding feature to evas png loader. 
> 5515X3986 size png image need 80~90M memory, but scale down(scale 
> num=2) option can reduce memory to 25~30M.
> 
> I use down sample method for scale down. 
> (there is more efficient algorithm for scale down, I'll add this to my 
> todo
> list)
> Thanks.
>  
> ----------------------------------------------
> Jiyoun Park
>  
> Mobile S/W Platform Lab
> DMC R&D Center
> SAMSUNG ELECTRONICS CO. ,LTD
>  
> TEL: +82-31-279-0619
> Mobile: +82-10-9871-0703
> [email protected]
> ----------------------------------------------
> 
> 
> 
> 
> 


--
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    [email protected]

Attachment: evas_png_loader_scaledown_feature.patch
Description: Binary data

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to