Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 20 Dec 2014, 05:46
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects
pUPnGO - 6Mb ISO - Basic Building Block Puplet
Moderators: Flash, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 50 of 58 [868 Posts]   Goto page: Previous 1, 2, 3, ..., 48, 49, 50, 51, 52, ..., 56, 57, 58 Next
Author Message
greengeek

Joined: 20 Jul 2010
Posts: 2747
Location: New Zealand

PostPosted: Wed 20 Mar 2013, 04:23    Post subject:  

technosaurus wrote:
I reduced the sizes of some of the danpei xpm icons a bit (enough to save ~20kb in the compiled binary size)
I may as well describe what I did to shrink them
open with mtpaint
Image -> convert to rgb
Image -> convert to indexed
check Min Max Quantize and Floyd Steinberg
change the number at the top to 92 (maybe 93?) or less
save as whatever (works for at least xpm and png, possibly others)
(use your best judgement based on the image - lower number of colors reduces size some, but may end up looking like trash if it gets too low - most small icon pixmaps look ok at 16 colors)
this works because reducing the number of colors below 93 causes the pixels to be represented by a single character ... effectively cutting the size in half (not including the reduction for each color ... ~16B ea. I think)
Note: I have had issues with some versions of mtpaint with this method especially if you do further manipulations of the pallette - it will sometime lose a clear background and need to be edited in a text editor.

Just want to get this on my list so I can refer back to it.
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 784

PostPosted: Wed 03 Apr 2013, 11:12    Post subject:  

For console applications daily reviews and tests...continues the path of http://kmandla.wordpress.com/
Back to top
View user's profile Send private message Visit poster's website 
goingnuts

Joined: 07 Dec 2008
Posts: 784

PostPosted: Thu 29 Aug 2013, 11:16    Post subject:  

Dragging up the original pupngo thread to continue blabla on more basic things...
Back in tinyXlib testing - got stuck with xdesktopwaves. It compiles ok but refuse to run as it cant translate color #406080 and other colors in same syntax. Adding "64 96 128 #406080" to rgb.txt helps a lot but seems to be an unusual hack.
So updated GetColor.c, Xcmsint.h, LookupCol.c, ParseCol.c. Added cmsCmap.c, Cmap.h, Cv.h, CCC.c, cmsColNm.c, XRGB.c, cmsInt.c, cmsGlobls.c, CvColW.c, LRGB.c, CvCols.c, cmsProp.c, HVCGcC.c, XYZ.c, uvY.c, xyY.c, Lab.c, Luv.c, HVC.c, cmsTrig.c, cmsMath.c, AddDIC.c, HVCMxC.c, HVCMxVC.c to X11lib which solves the problem.
BUT adds 20-30K to every binary linked against the new libX11. And most applications does not use the added functions at all. I do compile with "-Wl,--gc-sections,--sort-common,-s" but seems that the new functions are "glued" in...

SO: Are there any way to map the internal dependency of the functions in a library from source-code? If so this could be used to evaluate the consequences of adding functionality or to put in conditions when to use and when not to use...

The obvious solution to xdesktopwaves is to patch the source to use names from rgb.txt and bypass all above additions - but there might be applications that really benefit from the added functions...
Back to top
View user's profile Send private message Visit poster's website 
starhawk

Joined: 22 Nov 2010
Posts: 3208
Location: Everybody knows this is nowhere...

PostPosted: Thu 29 Aug 2013, 11:40    Post subject:  

goingnuts lives! Very Happy where you been man? I can't imagine I'm the only user (you're a dev, I'm a user Wink ) who cares about pUPnGO...

Also, in the -2012 thread, bark_bark_bark has a question for you...

_________________

Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 784

PostPosted: Thu 29 Aug 2013, 14:26    Post subject:  

Been traveling back in time Smile trying to collect old goodies. Some seems to be out of reach already Sad
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Thu 29 Aug 2013, 17:23    Post subject:  

Re: added functions.
If you are talking shared lib size, you can include uncommon functions in the .h instead of the .c, but the gotcha is you need to ifndef it in the .h so you can define something like -DBUILDLIB to exclude it, that way future builds will build a static object and hopefully ffunction/gc-sections will pull it from bulds that dont need it.

If youve ever looked in a config.h (and how it is generated) it may be clear using the HAVE_/NEED_ defs as examples ... I think jwm has a shell version.

This is actually an interesting approach to overall shared lib size reduction in general and could be extended to easily inlined small functions that consist of a single conditional + a return ... Since they arent included in the .so, it shrinks and since the inlined code is smaller than a funtion call + return for these really basic fxns.

Youd be surprised how often a giant series of ifelses, can be reduced to a ternary op
return ( A || B && C)? -1 : 0:
Where the A,B,C expression is the eqivalent of the ifelse.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Thu 29 Aug 2013, 18:31    Post subject:  

Re: added functions.
If you are talking shared lib size, you can include uncommon functions in the .h instead of the .c, but the gotcha is you need to ifndef it in the .h so you can define something like -DBUILDLIB to exclude it, that way future builds will build a static object and hopefully ffunction/gc-sections will pull it from bulds that dont need it.

If youve ever looked in a config.h (and how it is generated) it may be clear using the HAVE_/NEED_ defs as examples ... I think jwm has a shell version.

This is actually an interesting approach to overall shared lib size reduction in general and could be extended to easily inlined small functions that consist of a single conditional + a return ... Since they arent included in the .so, it shrinks and since the inlined code is smaller than a funtion call + return for these really basic fxns.

Youd be surprised how often a giant series of ifelses, can be reduced to a ternary op
return ( A || B && C)? -1 : 0:
Where the A,B,C expression is the eqivalent of the ifelse.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 784

PostPosted: Fri 30 Aug 2013, 00:49    Post subject:  

Thanks! The permanent size increase is in static linked apps - I havent tested if the size of the dynamic linked also is permanently larger.

In the actual xlib case there seems to be 3-4 entries that triggers the added size: In GetColor.c, LookupCol.c and ParseCol.c we have a structure like below:
Code:
Status
XLookupColor (
   register Display *dpy,
        Colormap cmap,
   _Xconst char *spec,
   XColor *def,
   XColor *scr)
{
   register int n;
   xLookupColorReply reply;
   register xLookupColorReq *req;
#ifdef USECMS
   XcmsCCC ccc;
   XcmsColor cmsColor_exact;
/* more code removed */
#endif

where the #ifdefs are mine. If included in the lib the size-increase is there even though the functionality is not used by the application - but the function "XLookupColor" is used so it drags the rest in...

It looks like an extension to XlookupColor as the content include this statement
Code:
 /*
    * Let's Attempt to use Xcms and i18n approach to Parse Color
    */
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Mon 02 Sep 2013, 03:46    Post subject:  

I wonder what is i18n about color lookup? if it is localized color names (never seen them)? can an lgettext -> C locale be a sufficient replacement? I am tempted to convert an rgb.txt as a switch case in C similar to my file mimetype code (it will add some size internally, but could speed things up and not require an rgb.txt)
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 784

PostPosted: Mon 02 Sep 2013, 14:38    Post subject:  

I am not sure but rgb.txt might be case sensitive - at least the names can be done in many ways:
Code:
248 248 255      ghost white
248 248 255      GhostWhite
245 245 245      white smoke
245 245 245      WhiteSmoke

At least icewm (or is it imlib) benefits from the added xcms functions - maybe mostly because the format #xxyyzz is widely used in icewm-themes - but I still cant see a way to conditionally use or exclude the xcms.

After playing with tinyX11 + MESA + freeglut doing fvs & tdfsb a wish for making small videos of screen-events popped up...
After testing recordmydesktop (which build static but refuses to run) I went through various versions of xvidcap. The newer versions seems quite gnome dependent but the older 1.0.XX version builds ok and run.
Last version is xvidcap-1.0.19 and a static build is attached.
For creating a video external programs are still needed. Mencoder or ffmpeg can be used (transcode as well). ppm2mpeg is a script which works well with xvidcap and I have included it in the attached pet.
For editing, tools from ImageMagick are called but they are HUGE when static linked.

A quote from the xvidcap README:
Quote:
This program does not use a special hardware driver to access the
video card. It just asks the X server about rectangular areas. This
means you need a fast machine (>= 133 MHz) and a fast harddrive. Big
frames (e.g. 384x288 = 1/2 PAL) at a high FPS rate are only possible
with very very fast systems
Smile
xvidcap-1.0.19.pet
Description  static linked
pet

 Download 
Filename  xvidcap-1.0.19.pet 
Filesize  252.55 KB 
Downloaded  117 Time(s) 
Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2292

PostPosted: Tue 03 Sep 2013, 13:22    Post subject:  

Where did you find that version of xvidcap sources? I only find dead links to them.
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 784

PostPosted: Tue 03 Sep 2013, 15:46    Post subject:  

amigo: Sources are here
Needed below small patch to be able to compile:
Code:
--- ./src/mngutil.c.01   2003-10-13 22:53:52.000000000 +0800
+++ ./src/mngutil.c   2013-09-02 17:01:15.000000000 +0800
@@ -30,13 +30,13 @@
 #include <png.h>
 #include "mngutil.h"
 
-extern void png_write_data (png_structp png_ptr,
+/*extern void png_write_data (png_structp png_ptr,
             png_bytep data,png_size_t length);
 extern void png_save_uint_32 (png_bytep buf, png_uint_32 i);
 extern void png_save_uint_16 (png_bytep buf, png_uint_16 i);
 extern void png_write_chunk (png_structp png_ptr,
             png_bytep chunk_name, png_bytep data, png_size_t length);
-
+*/
 png_byte mng_sig[8] = {138, 77, 78, 71, 13, 10, 26, 10};
 
 /*
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Tue 03 Sep 2013, 17:51    Post subject:  

goingnuts wrote:
I am not sure but rgb.txt might be case sensitive - at least the names can be done in many ways:
Yep, but when you strip the white space from and tolower the requested color, they are == (except for gray!=grey , but switch-case has fall through)... need to figure out which function(s) look at rgb.txt to figure out a good return format though
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2292

PostPosted: Wed 04 Sep 2013, 13:44    Post subject:  

@GN -thanks for the patch.
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 784

PostPosted: Wed 04 Sep 2013, 15:53    Post subject:  

@technosaurus: Some scripts and application reads rgb.txt direct - if not present they might fail...

I am trying to get a working version of ImageMagick - I have static builds of 3.6, 4.2.9, 5.2.2 and 6.8.6-9 - increasing in size from 700Kb to 4400Kb for "display". But running "display" is unstable with all versions. Even normal build in P412 linked dynamic is not stable. Xvesa/Xorg various settings does not help.
Problem is that the command menu works maybe every second time. Described here as well. Anyone knows more about this and how to solve?
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 50 of 58 [868 Posts]   Goto page: Previous 1, 2, 3, ..., 48, 49, 50, 51, 52, ..., 56, 57, 58 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Projects
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1136s ][ Queries: 13 (0.0237s) ][ GZIP on ]